diff options
Diffstat (limited to '')
455 files changed, 42268 insertions, 0 deletions
diff --git a/vcl/inc/BitmapColorizeFilter.hxx b/vcl/inc/BitmapColorizeFilter.hxx new file mode 100644 index 000000000..93e4d92b2 --- /dev/null +++ b/vcl/inc/BitmapColorizeFilter.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/. + * + */ + +#ifndef INCLUDED_VCL_INC_BITMAPCOLORIZEFILTER_HXX +#define INCLUDED_VCL_INC_BITMAPCOLORIZEFILTER_HXX + +#include <tools/color.hxx> + +#include <vcl/BitmapFilter.hxx> + +class BitmapColorizeFilter final : public BitmapFilter +{ +public: + BitmapColorizeFilter(Color aColor) + : maColor(aColor) + { + } + + virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + +private: + Color maColor; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/BitmapDisabledImageFilter.hxx b/vcl/inc/BitmapDisabledImageFilter.hxx new file mode 100644 index 000000000..0967cad6b --- /dev/null +++ b/vcl/inc/BitmapDisabledImageFilter.hxx @@ -0,0 +1,26 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_BITMAPDISABLEDIMAGEFILTER_HXX +#define INCLUDED_VCL_INC_BITMAPDISABLEDIMAGEFILTER_HXX + +#include <vcl/BitmapFilter.hxx> + +class VCL_DLLPUBLIC BitmapDisabledImageFilter final : public BitmapFilter +{ +public: + BitmapDisabledImageFilter() {} + + virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/BitmapFastScaleFilter.hxx b/vcl/inc/BitmapFastScaleFilter.hxx new file mode 100644 index 000000000..09fbdcaeb --- /dev/null +++ b/vcl/inc/BitmapFastScaleFilter.hxx @@ -0,0 +1,36 @@ +/* -*- 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/. + * + */ + +#ifndef VCL_INC_BITMAPFASTSCALEFILTER_HXX +#define VCL_INC_BITMAPFASTSCALEFILTER_HXX + +#include <vcl/bitmapex.hxx> +#include <vcl/BitmapFilter.hxx> + +class BitmapFastScaleFilter final : public BitmapFilter +{ +public: + explicit BitmapFastScaleFilter(double fScaleX, double fScaleY) + : mfScaleX(fScaleX) + , mfScaleY(fScaleY) + { + } + + virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + +private: + double mfScaleX; + double mfScaleY; + Size maSize; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/BitmapInterpolateScaleFilter.hxx b/vcl/inc/BitmapInterpolateScaleFilter.hxx new file mode 100644 index 000000000..8cbae0601 --- /dev/null +++ b/vcl/inc/BitmapInterpolateScaleFilter.hxx @@ -0,0 +1,35 @@ +/* -*- 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/. + * + */ + +#ifndef VCL_INC_BITMAPINTERPOLATESCALEFILTER_HXX +#define VCL_INC_BITMAPINTERPOLATESCALEFILTER_HXX + +#include <vcl/bitmapex.hxx> +#include <vcl/BitmapFilter.hxx> + +class BitmapInterpolateScaleFilter final : public BitmapFilter +{ +public: + explicit BitmapInterpolateScaleFilter(double fScaleX, double fScaleY) + : mfScaleX(fScaleX) + , mfScaleY(fScaleY) + { + } + + virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; + +private: + double mfScaleX; + double mfScaleY; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/BitmapLightenFilter.hxx b/vcl/inc/BitmapLightenFilter.hxx new file mode 100644 index 000000000..f30e0d5bb --- /dev/null +++ b/vcl/inc/BitmapLightenFilter.hxx @@ -0,0 +1,24 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_BITMAPLIGHTENFILTER_HXX +#define INCLUDED_VCL_INC_BITMAPLIGHTENFILTER_HXX + +#include <vcl/BitmapFilter.hxx> + +class BitmapLightenFilter final : public BitmapFilter +{ +public: + virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/BitmapScaleConvolutionFilter.hxx b/vcl/inc/BitmapScaleConvolutionFilter.hxx new file mode 100644 index 000000000..9bc1bd45c --- /dev/null +++ b/vcl/inc/BitmapScaleConvolutionFilter.hxx @@ -0,0 +1,78 @@ +/* -*- 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 . + */ + +#ifndef VCL_INC_BITMAPSCALECONVOLUTIONFILTER_HXX +#define VCL_INC_BITMAPSCALECONVOLUTIONFILTER_HXX + +#include <vcl/BitmapFilter.hxx> + +#include "ResampleKernel.hxx" + +namespace vcl +{ +class BitmapScaleConvolutionFilter : public BitmapFilter +{ +protected: + BitmapScaleConvolutionFilter(const double& rScaleX, const double& rScaleY, std::unique_ptr<Kernel> pKernel) + : mxKernel(std::move(pKernel)) + , mrScaleX(rScaleX) + , mrScaleY(rScaleY) + { + } + + virtual BitmapEx execute(BitmapEx const& rBitmap) const override; + +private: + std::unique_ptr<Kernel> mxKernel; + double mrScaleX; + double mrScaleY; +}; + +class VCL_DLLPUBLIC BitmapScaleBilinearFilter final : public BitmapScaleConvolutionFilter +{ +public: + BitmapScaleBilinearFilter(const double& rScaleX, const double& rScaleY) + : BitmapScaleConvolutionFilter(rScaleX, rScaleY, std::make_unique<BilinearKernel>()) + { + } +}; + +class VCL_DLLPUBLIC BitmapScaleBicubicFilter final : public BitmapScaleConvolutionFilter +{ +public: + BitmapScaleBicubicFilter(const double& rScaleX, const double& rScaleY) + : BitmapScaleConvolutionFilter(rScaleX, rScaleY, std::make_unique<BicubicKernel>()) + { + } +}; + +class VCL_DLLPUBLIC BitmapScaleLanczos3Filter final : public BitmapScaleConvolutionFilter +{ +public: + BitmapScaleLanczos3Filter(const double& rScaleX, const double& rScaleY) + : BitmapScaleConvolutionFilter(rScaleX, rScaleY, std::make_unique<Lanczos3Kernel>()) + { + } +}; + +} + +#endif // VCL_INC_BITMAPSCALECONVOLUTIONFILTER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/BitmapScaleSuperFilter.hxx b/vcl/inc/BitmapScaleSuperFilter.hxx new file mode 100644 index 000000000..47e48eb1a --- /dev/null +++ b/vcl/inc/BitmapScaleSuperFilter.hxx @@ -0,0 +1,41 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_BITMAPSCALESUPER_HXX +#define INCLUDED_VCL_INC_BITMAPSCALESUPER_HXX + +#include <vcl/BitmapFilter.hxx> + +class BitmapScaleSuperFilter final : public BitmapFilter +{ +public: + BitmapScaleSuperFilter(const double& rScaleX, const double& rScaleY); + virtual ~BitmapScaleSuperFilter() override; + + virtual BitmapEx execute(BitmapEx const& rBitmap) const override; + +private: + double mrScaleX; + double mrScaleY; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/BitmapSymmetryCheck.hxx b/vcl/inc/BitmapSymmetryCheck.hxx new file mode 100644 index 000000000..faf058923 --- /dev/null +++ b/vcl/inc/BitmapSymmetryCheck.hxx @@ -0,0 +1,31 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_BITMAPSYMMETRYCHECK_HXX +#define INCLUDED_VCL_INC_BITMAPSYMMETRYCHECK_HXX + +#include <vcl/bitmap.hxx> +#include <vcl/bitmapaccess.hxx> + +class VCL_DLLPUBLIC BitmapSymmetryCheck final +{ +public: + BitmapSymmetryCheck(); + ~BitmapSymmetryCheck(); + + static bool check(Bitmap& rBitmap); + +private: + static bool checkImpl(BitmapReadAccess const * pReadAccess); +}; + +#endif // INCLUDED_VCL_INC_BITMAPSYMMETRYCHECK_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ControlCacheKey.hxx b/vcl/inc/ControlCacheKey.hxx new file mode 100644 index 000000000..9c8f467ee --- /dev/null +++ b/vcl/inc/ControlCacheKey.hxx @@ -0,0 +1,94 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_CONTROLCACHEKEY_HXX +#define INCLUDED_VCL_INC_CONTROLCACHEKEY_HXX + +#include <tools/gen.hxx> +#include <vcl/salnativewidgets.hxx> +#include <boost/functional/hash.hpp> + +class ControlCacheKey +{ +public: + ControlType mnType; + ControlPart mnPart; + ControlState mnState; + Size maSize; + + ControlCacheKey(ControlType nType, ControlPart nPart, ControlState nState, const Size& rSize) + : mnType(nType) + , mnPart(nPart) + , mnState(nState) + , maSize(rSize) + {} + + bool operator==(ControlCacheKey const& aOther) const + { + return mnType == aOther.mnType + && mnPart == aOther.mnPart + && mnState == aOther.mnState + && maSize.Width() == aOther.maSize.Width() + && maSize.Height() == aOther.maSize.Height(); + } + + bool canCacheControl() const + { + switch(mnType) + { + case ControlType::Checkbox: + case ControlType::Radiobutton: + case ControlType::ListNode: + case ControlType::Slider: + case ControlType::Progress: + // FIXME: these guys have complex state hidden in ImplControlValue + // structs which affects rendering, needs to be a and needs to be + // part of the key to our cache. + case ControlType::Spinbox: + case ControlType::SpinButtons: + case ControlType::TabItem: + return false; + + case ControlType::Menubar: + if (mnPart == ControlPart::Entire) + return false; + break; + + default: + break; + } + return true; + } +}; + +struct ControlCacheHashFunction +{ + std::size_t operator()(ControlCacheKey const& aCache) const + { + std::size_t seed = 0; + boost::hash_combine(seed, aCache.mnType); + boost::hash_combine(seed, aCache.mnPart); + boost::hash_combine(seed, aCache.mnState); + boost::hash_combine(seed, aCache.maSize.Width()); + boost::hash_combine(seed, aCache.maSize.Height()); + return seed; + } +}; + +#endif // INCLUDED_VCL_INC_CONTROLCACHEKEY_HXX diff --git a/vcl/inc/FileDefinitionWidgetDraw.hxx b/vcl/inc/FileDefinitionWidgetDraw.hxx new file mode 100644 index 000000000..68f5d3489 --- /dev/null +++ b/vcl/inc/FileDefinitionWidgetDraw.hxx @@ -0,0 +1,61 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_FILEDEFINITIONWIDGETDRAW_HXX +#define INCLUDED_VCL_INC_FILEDEFINITIONWIDGETDRAW_HXX + +#include "widgetdraw/WidgetDefinition.hxx" +#include "salgdi.hxx" +#include "WidgetDrawInterface.hxx" + +namespace vcl +{ +class FileDefinitionWidgetDraw final : public vcl::WidgetDrawInterface +{ +private: + SalGraphics& m_rGraphics; + bool m_bIsActive; + + std::shared_ptr<WidgetDefinition> m_pWidgetDefinition; + + bool resolveDefinition(ControlType eType, ControlPart ePart, ControlState eState, + const ImplControlValue& rValue, long nX, long nY, long nWidth, + long nHeight); + +public: + FileDefinitionWidgetDraw(SalGraphics& rGraphics); + + bool isActive() const { return m_bIsActive; } + + bool isNativeControlSupported(ControlType eType, ControlPart ePart) override; + + bool hitTestNativeControl(ControlType eType, ControlPart ePart, + const tools::Rectangle& rBoundingControlRegion, const Point& aPos, + bool& rIsInside) override; + + bool drawNativeControl(ControlType eType, ControlPart ePart, + const tools::Rectangle& rBoundingControlRegion, ControlState eState, + const ImplControlValue& aValue, const OUString& aCaptions, + const Color& rBackgroundColor) override; + + bool getNativeControlRegion(ControlType eType, ControlPart ePart, + const tools::Rectangle& rBoundingControlRegion, ControlState eState, + const ImplControlValue& aValue, const OUString& aCaption, + tools::Rectangle& rNativeBoundingRegion, + tools::Rectangle& rNativeContentRegion) override; + + bool updateSettings(AllSettings& rSettings) override; +}; + +} // end vcl namespace + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/IconThemeScanner.hxx b/vcl/inc/IconThemeScanner.hxx new file mode 100644 index 000000000..3cbca74a4 --- /dev/null +++ b/vcl/inc/IconThemeScanner.hxx @@ -0,0 +1,92 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_ICONTHEMESCANNER_HXX +#define INCLUDED_VCL_ICONTHEMESCANNER_HXX + +#include <vcl/dllapi.h> + +#include <rtl/ustring.hxx> +#include <vcl/IconThemeInfo.hxx> + +#include <memory> +#include <vector> + +// forward declaration of unit test class. Required for friend relationship. +class IconThemeScannerTest; + +namespace vcl { + +/** This class scans a folder for icon themes and provides the results. + */ +class VCL_DLLPUBLIC IconThemeScanner +{ +public: + /** Factory method to create the object. + * Provide a path to search for IconThemes. + */ + static std::shared_ptr<IconThemeScanner> Create(const OUString &path); + + /** This method will return the standard path where icon themes are located. + */ + static OUString + GetStandardIconThemePath(); + + const std::vector<IconThemeInfo>& + GetFoundIconThemes() const {return mFoundIconThemes;} + + /** Get the IconThemeInfo for a theme. + * If the theme id is not among the found themes, a std::runtime_error will be thrown. + * Use IconThemeIsInstalled() to check whether it is available. + */ + const IconThemeInfo& GetIconThemeInfo(const OUString& themeId); + + /** Checks whether the theme with the provided name has been found in the + * scanned directory. + */ + bool + IconThemeIsInstalled(const OUString& themeId) const; + +private: + IconThemeScanner(); + + /** Scan a directory for icon themes. + * + * @return + * There are several cases when this method will fail: + * - The directory does not exist + * - There are no files which match the pattern images_xxx.zip + */ + void ScanDirectoryForIconThemes(const OUString &path); + + /** Adds the provided icon theme by path. + */ + bool + AddIconThemeByPath(const OUString &path); + + /** Scans the provided directory for icon themes. + * The returned strings will contain the URLs to the icon themes. + */ + static std::vector<OUString> + ReadIconThemesFromPath(const OUString& dir); + + /** Check whether a single file is valid */ + static bool + FileIsValidIconTheme(const OUString&); + + std::vector<IconThemeInfo> mFoundIconThemes; + + friend class ::IconThemeScannerTest; +}; + +} // end namespace vcl + +#endif // INCLUDED_VCL_ICONTHEMESCANNER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/IconThemeSelector.hxx b/vcl/inc/IconThemeSelector.hxx new file mode 100644 index 000000000..0fcd66d1f --- /dev/null +++ b/vcl/inc/IconThemeSelector.hxx @@ -0,0 +1,97 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_ICONTHEMESELECTOR_HXX +#define INCLUDED_VCL_ICONTHEMESELECTOR_HXX + +#include <rtl/ustring.hxx> + +#include <vcl/dllapi.h> + +#include <vector> + +// forward declaration of unit test class. Required for friend relationship. +class IconThemeSelectorTest; + +namespace vcl { +class IconThemeInfo; + +/** This class helps to choose an icon theme from a list of installed themes. + * + * The following factors influence the selection: + * -# When high contrast mode is enabled, the high contrast icon theme is selected (if it is installed). + * -# When a preferred theme has been set (e.g., in the gnome desktop settings), that theme is selected. + */ +class VCL_DLLPUBLIC IconThemeSelector { +public: + IconThemeSelector(); + + /** Select an icon theme from the list of installed themes. + * + * If high contrast mode has been enabled, the highcontrast theme will be selected (if it is available). + * + * @pre + * @p installedThemes must not be empty + */ + OUString + SelectIconTheme( + const std::vector<IconThemeInfo>& installedThemes, + const OUString& theme + ) const; + + /** Select the standard icon theme for a desktop environment from a list of installed themes. + * + * If a preferred theme has been set, this one will take precedence. + * + * The same logic as in SelectIconTheme() will apply. + * + * @pre + * @p installedThemes must not be empty + */ + OUString + SelectIconThemeForDesktopEnvironment( + const std::vector<IconThemeInfo>& installedThemes, + const OUString& desktopEnvironment) const; + + void + SetUseHighContrastTheme(bool); + + void + SetPreferredIconTheme(const OUString&, bool bDarkIconTheme); + + bool + operator==(const vcl::IconThemeSelector&) const; + + bool + operator!=(const vcl::IconThemeSelector&) const; + +private: + /** Return the first element of the themes, or the fallback if the vector is empty */ + static OUString + ReturnFallback(const std::vector<IconThemeInfo>& installedThemes); + + /** The name of the icon theme which is used as fallback */ + static const OUStringLiteral FALLBACK_ICON_THEME_ID; + + + static OUString + GetIconThemeForDesktopEnvironment(const OUString& desktopEnvironment); + + OUString mPreferredIconTheme; + bool mUseHighContrastTheme; + bool mPreferDarkIconTheme; + + friend class ::IconThemeSelectorTest; +}; + +} /* namespace vcl */ + +#endif // INCLUDED_VCL_ICONTHEMESELECTOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/OptionalBox.hxx b/vcl/inc/OptionalBox.hxx new file mode 100644 index 000000000..326fc7536 --- /dev/null +++ b/vcl/inc/OptionalBox.hxx @@ -0,0 +1,42 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_OPTIONALBOX_HXX +#define INCLUDED_VCL_OPTIONALBOX_HXX + +#include <vcl/IPrioritable.hxx> +#include <vcl/layout.hxx> + +class OptionalBox final : public VclHBox, public vcl::IPrioritable +{ +private: + bool m_bInFullView; + +public: + explicit OptionalBox(vcl::Window* pParent); + virtual ~OptionalBox() override; + + void HideContent() override; + void ShowContent() override; + bool IsHidden() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/PhysicalFontCollection.hxx b/vcl/inc/PhysicalFontCollection.hxx new file mode 100644 index 000000000..87b94fe2c --- /dev/null +++ b/vcl/inc/PhysicalFontCollection.hxx @@ -0,0 +1,96 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_PHYSICALFONTCOLLECTION_HXX +#define INCLUDED_VCL_INC_PHYSICALFONTCOLLECTION_HXX + +#include <vcl/dllapi.h> + +#include "fontinstance.hxx" +#include "PhysicalFontFamily.hxx" +#include <array> + +#define MAX_GLYPHFALLBACK 16 + +class ImplDeviceFontSizeList; +class ImplGlyphFallbackFontSubstitution; +class ImplPreMatchFontSubstitution; + + +// TODO: merge with ImplFontCache +// TODO: rename to LogicalFontManager + +class VCL_PLUGIN_PUBLIC PhysicalFontCollection final +{ +public: + explicit PhysicalFontCollection(); + ~PhysicalFontCollection(); + + // fill the list with device font faces + void Add( PhysicalFontFace* ); + void Clear(); + int Count() const { return maPhysicalFontFamilies.size(); } + + // find the device font family + PhysicalFontFamily* FindFontFamily( const OUString& rFontName ) const; + PhysicalFontFamily* FindOrCreateFontFamily( const OUString &rFamilyName ); + PhysicalFontFamily* FindFontFamily( FontSelectPattern& ) const; + PhysicalFontFamily* FindFontFamilyByTokenNames(const OUString& rTokenStr) const; + PhysicalFontFamily* FindFontFamilyByAttributes(ImplFontAttrs nSearchType, FontWeight, FontWidth, + FontItalic, const OUString& rSearchFamily) const; + + // suggest fonts for glyph fallback + PhysicalFontFamily* GetGlyphFallbackFont( FontSelectPattern&, + LogicalFontInstance* pLogicalFont, + OUString& rMissingCodes, int nFallbackLevel ) const; + + // prepare platform specific font substitutions + void SetPreMatchHook( ImplPreMatchFontSubstitution* ); + void SetFallbackHook( ImplGlyphFallbackFontSubstitution* ); + + // misc utilities + std::shared_ptr<PhysicalFontCollection> Clone() const; + std::unique_ptr<ImplDeviceFontList> GetDeviceFontList() const; + std::unique_ptr<ImplDeviceFontSizeList> GetDeviceFontSizeList( const OUString& rFontName ) const; + +private: + mutable bool mbMatchData; // true if matching attributes are initialized + + typedef std::unordered_map<OUString, std::unique_ptr<PhysicalFontFamily>> PhysicalFontFamilies; + PhysicalFontFamilies maPhysicalFontFamilies; + + ImplPreMatchFontSubstitution* mpPreMatchHook; // device specific prematch substitution + ImplGlyphFallbackFontSubstitution* mpFallbackHook; // device specific glyph fallback substitution + + mutable std::unique_ptr<std::array<PhysicalFontFamily*,MAX_GLYPHFALLBACK>> mpFallbackList; + mutable int mnFallbackCount; + + void ImplInitMatchData() const; + void ImplInitGenericGlyphFallback() const; + + PhysicalFontFamily* ImplFindFontFamilyBySearchName( const OUString& ) const; + PhysicalFontFamily* ImplFindFontFamilyBySubstFontAttr( const utl::FontNameAttr& ) const; + + PhysicalFontFamily* ImplFindFontFamilyOfDefaultFont() const; + +}; + +#endif // INCLUDED_VCL_INC_PHYSICALFONTCOLLECTION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/PhysicalFontFace.hxx b/vcl/inc/PhysicalFontFace.hxx new file mode 100644 index 000000000..23af5be91 --- /dev/null +++ b/vcl/inc/PhysicalFontFace.hxx @@ -0,0 +1,78 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_PHYSICALFONTFACE_HXX +#define INCLUDED_VCL_INC_PHYSICALFONTFACE_HXX + +#include <salhelper/simplereferenceobject.hxx> +#include <rtl/ref.hxx> +#include <vcl/dllapi.h> + +#include "fontattributes.hxx" + +class LogicalFontInstance; +struct FontMatchStatus; +class FontSelectPattern; +class PhysicalFontFamily; + +struct FontMatchStatus +{ +public: + int mnFaceMatch; + int mnHeightMatch; + int mnWidthMatch; + const OUString* mpTargetStyleName; +}; + + +// TODO: no more direct access to members +// TODO: get rid of height/width for scalable fonts +// TODO: make cloning cheaper + +/** + * abstract base class for physical font faces + * + * It acts as a factory for its corresponding LogicalFontInstances and + * can be extended to cache device and font instance specific data. + */ +class VCL_PLUGIN_PUBLIC PhysicalFontFace : public FontAttributes, public salhelper::SimpleReferenceObject +{ +public: + virtual rtl::Reference<LogicalFontInstance> CreateFontInstance(const FontSelectPattern&) const = 0; + + int GetHeight() const { return mnHeight; } + int GetWidth() const { return mnWidth; } + virtual sal_IntPtr GetFontId() const = 0; + + bool IsBetterMatch( const FontSelectPattern&, FontMatchStatus& ) const; + sal_Int32 CompareWithSize( const PhysicalFontFace& ) const; + sal_Int32 CompareIgnoreSize( const PhysicalFontFace& ) const; + +protected: + explicit PhysicalFontFace(const FontAttributes&); + void SetBitmapSize( int nW, int nH ) { mnWidth=nW; mnHeight=nH; } + + long mnWidth; // Width (in pixels) + long mnHeight; // Height (in pixels) +}; + +#endif // INCLUDED_VCL_INC_PHYSICALFONTFACE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ + diff --git a/vcl/inc/PhysicalFontFamily.hxx b/vcl/inc/PhysicalFontFamily.hxx new file mode 100644 index 000000000..b8468a6e4 --- /dev/null +++ b/vcl/inc/PhysicalFontFamily.hxx @@ -0,0 +1,101 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_PHYSICALFONTFAMILY_HXX +#define INCLUDED_VCL_INC_PHYSICALFONTFAMILY_HXX + +#include <vcl/dllapi.h> +#include <vcl/outdev.hxx> + +#include <set> + +#include <unotools/fontcfg.hxx> + +#include "PhysicalFontFace.hxx" + +class ImplDeviceFontList; +class PhysicalFontFace; +class PhysicalFontCollection; + +// flags for mnTypeFaces member +enum class FontTypeFaces { + NONE = 0x00, + Scalable = 0x01, + Symbol = 0x02, + NoneSymbol = 0x04, + Light = 0x08, + Bold = 0x10, + Normal = 0x20, + NoneItalic = 0x40, + Italic = 0x80 +}; +namespace o3tl { + template<> struct typed_flags<FontTypeFaces> : is_typed_flags<FontTypeFaces, 0xff> {}; +}; + +class VCL_PLUGIN_PUBLIC PhysicalFontFamily +{ +public: + PhysicalFontFamily( const OUString& rSearchName ); + ~PhysicalFontFamily(); + + const OUString& GetFamilyName() const { return maFamilyName; } + const OUString& GetSearchName() const { return maSearchName; } + const OUString& GetAliasNames() const { return maMapNames; } + int GetMinQuality() const { return mnMinQuality; } + FontTypeFaces GetTypeFaces() const { return mnTypeFaces; } + void GetFontHeights( std::set<int>& rHeights ) const; + + const OUString& GetMatchFamilyName() const { return maMatchFamilyName; } + ImplFontAttrs GetMatchType() const { return mnMatchType ; } + FontWeight GetMatchWeight() const { return meMatchWeight ; } + FontWidth GetMatchWidth() const { return meMatchWidth ; } + void InitMatchData( const utl::FontSubstConfiguration&, + const OUString& rSearchName ); + + void AddFontFace( PhysicalFontFace* ); + + PhysicalFontFace* FindBestFontFace( const FontSelectPattern& rFSD ) const; + + void UpdateDevFontList( ImplDeviceFontList& ) const; + void UpdateCloneFontList(PhysicalFontCollection&) const; + +static void CalcType( ImplFontAttrs& rType, FontWeight& rWeight, FontWidth& rWidth, + FontFamily eFamily, const utl::FontNameAttr* pFontAttr ); + +private: + std::vector< rtl::Reference<PhysicalFontFace> > maFontFaces; + + OUString maFamilyName; // original font family name + OUString maSearchName; // normalized font family name + OUString maMapNames; // fontname aliases + FontTypeFaces mnTypeFaces; // Typeface Flags + FontFamily meFamily; + FontPitch mePitch; + int mnMinQuality; // quality of the worst font face + + ImplFontAttrs mnMatchType; // MATCH - Type + OUString maMatchFamilyName; // MATCH - FamilyName + FontWeight meMatchWeight; // MATCH - Weight + FontWidth meMatchWidth; // MATCH - Width +}; + +#endif // INCLUDED_VCL_INC_PHYSICALFONTFAMILY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ResampleKernel.hxx b/vcl/inc/ResampleKernel.hxx new file mode 100644 index 000000000..ca54213f5 --- /dev/null +++ b/vcl/inc/ResampleKernel.hxx @@ -0,0 +1,116 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_RESAMPLEKERNEL_HXX +#define INCLUDED_VCL_RESAMPLEKERNEL_HXX + +#include <boost/math/special_functions/sinc.hpp> + +namespace vcl { + +// Resample kernels + +class Kernel +{ +public: + Kernel() {} + virtual ~Kernel() {} + + virtual double GetWidth() const = 0; + virtual double Calculate( double x ) const = 0; +}; + +class Lanczos3Kernel final : public Kernel +{ +public: + Lanczos3Kernel() : Kernel () {} + + virtual double GetWidth() const override { return 3.0; } + virtual double Calculate (double x) const override + { + return (-3.0 <= x && x < 3.0) ? SincFilter(x) * SincFilter( x / 3.0 ) : 0.0; + } + + static double SincFilter(double x) + { + if (x == 0.0) + { + return 1.0; + } + x = x * M_PI; + return boost::math::sinc_pi(x, SincPolicy()); + } + +private: + typedef boost::math::policies::policy< + boost::math::policies::promote_double<false> > SincPolicy; +}; + +class BicubicKernel final : public Kernel +{ +public: + BicubicKernel() : Kernel () {} + +private: + virtual double GetWidth() const override { return 2.0; } + virtual double Calculate (double x) const override + { + if (x < 0.0) + { + x = -x; + } + + if (x <= 1.0) + { + return (1.5 * x - 2.5) * x * x + 1.0; + } + else if (x < 2.0) + { + return ((-0.5 * x + 2.5) * x - 4) * x + 2; + } + return 0.0; + } +}; + +class BilinearKernel final : public Kernel +{ +public: + BilinearKernel() : Kernel () {} + +private: + virtual double GetWidth() const override { return 1.0; } + virtual double Calculate (double x) const override + { + if (x < 0.0) + { + x = -x; + } + if (x < 1.0) + { + return 1.0-x; + } + return 0.0; + } +}; + +} // namespace vcl + +#endif // INCLUDED_VCL_RESAMPLEKERNEL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/SalGradient.hxx b/vcl/inc/SalGradient.hxx new file mode 100644 index 000000000..1b4a47f9a --- /dev/null +++ b/vcl/inc/SalGradient.hxx @@ -0,0 +1,36 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_SALGRADIENT_HXX +#define INCLUDED_VCL_INC_SALGRADIENT_HXX + +#include <basegfx/point/b2dpoint.hxx> + +struct SalGradientStop +{ + Color maColor; + float mfOffset; + + SalGradientStop(Color const& rColor, float fOffset) + : maColor(rColor) + , mfOffset(fOffset) + { + } +}; + +struct SalGradient +{ + basegfx::B2DPoint maPoint1; + basegfx::B2DPoint maPoint2; + std::vector<SalGradientStop> maStops; +}; + +#endif // INCLUDED_VCL_INC_SALGRADIENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/TypeSerializer.hxx b/vcl/inc/TypeSerializer.hxx new file mode 100644 index 000000000..060876593 --- /dev/null +++ b/vcl/inc/TypeSerializer.hxx @@ -0,0 +1,52 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_TYPESERIALIZER_HXX +#define INCLUDED_VCL_INC_TYPESERIALIZER_HXX + +#include <vcl/dllapi.h> +#include <tools/GenericTypeSerializer.hxx> +#include <vcl/gradient.hxx> +#include <vcl/gfxlink.hxx> +#include <vcl/graph.hxx> + +constexpr sal_uInt32 createMagic(char char1, char char2, char char3, char char4) +{ + return (static_cast<sal_uInt32>(char1) << 24) | (static_cast<sal_uInt32>(char2) << 16) + | (static_cast<sal_uInt32>(char3) << 8) | (static_cast<sal_uInt32>(char4) << 0); +} + +class VCL_DLLPUBLIC TypeSerializer : public tools::GenericTypeSerializer +{ +public: + TypeSerializer(SvStream& rStream); + + void readGradient(Gradient& rGradient); + void writeGradient(const Gradient& rGradient); + + void readGfxLink(GfxLink& rGfxLink); + void writeGfxLink(const GfxLink& rGfxLink); + + void readGraphic(Graphic& rGraphic); + void writeGraphic(const Graphic& rGraphic); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/WidgetDrawInterface.hxx b/vcl/inc/WidgetDrawInterface.hxx new file mode 100644 index 000000000..78d5d7625 --- /dev/null +++ b/vcl/inc/WidgetDrawInterface.hxx @@ -0,0 +1,126 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_WIDGETDRAWINTERFACE_HXX +#define INCLUDED_VCL_INC_WIDGETDRAWINTERFACE_HXX + +#include <vcl/dllapi.h> +#include <vcl/salnativewidgets.hxx> +#include <vcl/settings.hxx> + +namespace vcl +{ +class VCL_PLUGIN_PUBLIC WidgetDrawInterface +{ +public: + virtual ~WidgetDrawInterface() COVERITY_NOEXCEPT_FALSE {} + + /** + * Query the platform layer for native control support. + * + * @param [in] eType The widget type. + * @param [in] ePart The part of the widget. + * @return true if the platform supports native drawing of the widget type defined by part. + */ + virtual inline bool isNativeControlSupported(ControlType eType, ControlPart ePart); + + /** + * Query if a position is inside the native widget part. + * + * Mainly used for scrollbars. + * + * @param [in] eType The widget type. + * @param [in] ePart The part of the widget. + * @param [in] rBoundingControlRegion The bounding Rectangle of + the complete control in VCL frame coordinates. + * @param [in] aPos The position to check the hit. + * @param [out] rIsInside true, if \a aPos was inside the native widget. + * @return true, if the query was successful. + */ + virtual inline bool hitTestNativeControl(ControlType eType, ControlPart ePart, + const tools::Rectangle& rBoundingControlRegion, + const Point& aPos, bool& rIsInside); + + /** + * Draw the requested control. + * + * @param [in] eType The widget type. + * @param [in] ePart The part of the widget. + * @param [in] rBoundingControlRegion The bounding rectangle of + * the complete control in VCL frame coordinates. + * @param [in] eState The general state of the control (enabled, focused, etc.). + * @param [in] aValue Addition control specific information. + * @param [in] aCaption A caption or title string (like button text etc.). + * @param [in] rBackgroundColor Background color for the control (may be COL_AUTO) + * @return true, if the control could be drawn. + */ + virtual inline bool drawNativeControl(ControlType eType, ControlPart ePart, + const tools::Rectangle& rBoundingControlRegion, + ControlState eState, const ImplControlValue& aValue, + const OUString& aCaptions, const Color& rBackgroundColor); + + /** + * Get the native control regions for the control part. + * + * If the return value is true, \a rNativeBoundingRegion contains + * the true bounding region covered by the control including any + * adornment, while \a rNativeContentRegion contains the area + * within the control that can be safely drawn into without drawing over + * the borders of the control. + * + * @param [in] eType Type of the widget. + * @param [in] ePart Specification of the widget's part if it consists of more than one. + * @param [in] rBoundingControlRegion The bounding region of the control in VCL frame coordinates. + * @param [in] eState The general state of the control (enabled, focused, etc.). + * @param [in] aValue Addition control specific information. + * @param [in] aCaption A caption or title string (like button text etc.). + * @param [out] rNativeBoundingRegion The region covered by the control including any adornment. + * @param [out] rNativeContentRegion The region within the control that can be safely drawn into. + * @return true, if the regions are filled. + */ + virtual inline bool getNativeControlRegion(ControlType eType, ControlPart ePart, + const tools::Rectangle& rBoundingControlRegion, + ControlState eState, const ImplControlValue& aValue, + const OUString& aCaption, + tools::Rectangle& rNativeBoundingRegion, + tools::Rectangle& rNativeContentRegion); + + virtual inline bool updateSettings(AllSettings& rSettings); +}; + +bool WidgetDrawInterface::isNativeControlSupported(ControlType, ControlPart) { return false; } + +bool WidgetDrawInterface::hitTestNativeControl(ControlType, ControlPart, const tools::Rectangle&, + const Point&, bool&) +{ + return false; +} + +bool WidgetDrawInterface::drawNativeControl(ControlType, ControlPart, const tools::Rectangle&, + ControlState, const ImplControlValue&, const OUString&, + const Color& /*rBackgroundColor*/) +{ + return false; +} + +bool WidgetDrawInterface::getNativeControlRegion(ControlType, ControlPart, const tools::Rectangle&, + ControlState, const ImplControlValue&, + const OUString&, tools::Rectangle&, + tools::Rectangle&) +{ + return false; +} + +bool WidgetDrawInterface::updateSettings(AllSettings&) { return false; } +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx new file mode 100644 index 000000000..ace74a49a --- /dev/null +++ b/vcl/inc/WidgetThemeLibrary.hxx @@ -0,0 +1,159 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_WIDGETTHEME_HXX +#define INCLUDED_VCL_INC_WIDGETTHEME_HXX + +#include <cstdint> + +namespace vcl +{ +struct WidgetDrawStyle +{ + uint32_t nSize; + uint32_t maFaceColor; + uint32_t maCheckedColor; + uint32_t maLightColor; + uint32_t maLightBorderColor; + uint32_t maShadowColor; + uint32_t maDarkShadowColor; + uint32_t maDefaultButtonTextColor; + uint32_t maButtonTextColor; + uint32_t maDefaultActionButtonTextColor; + uint32_t maActionButtonTextColor; + uint32_t maFlatButtonTextColor; + uint32_t maDefaultButtonRolloverTextColor; + uint32_t maButtonRolloverTextColor; + uint32_t maDefaultActionButtonRolloverTextColor; + uint32_t maActionButtonRolloverTextColor; + uint32_t maFlatButtonRolloverTextColor; + uint32_t maDefaultButtonPressedRolloverTextColor; + uint32_t maButtonPressedRolloverTextColor; + uint32_t maDefaultActionButtonPressedRolloverTextColor; + uint32_t maActionButtonPressedRolloverTextColor; + uint32_t maFlatButtonPressedRolloverTextColor; + uint32_t maRadioCheckTextColor; + uint32_t maGroupTextColor; + uint32_t maLabelTextColor; + uint32_t maWindowColor; + uint32_t maWindowTextColor; + uint32_t maDialogColor; + uint32_t maDialogTextColor; + uint32_t maWorkspaceColor; + uint32_t maMonoColor; + uint32_t maFieldColor; + uint32_t maFieldTextColor; + uint32_t maFieldRolloverTextColor; + uint32_t maActiveColor; + uint32_t maActiveTextColor; + uint32_t maActiveBorderColor; + uint32_t maDeactiveColor; + uint32_t maDeactiveTextColor; + uint32_t maDeactiveBorderColor; + uint32_t maMenuColor; + uint32_t maMenuBarColor; + uint32_t maMenuBarRolloverColor; + uint32_t maMenuBorderColor; + uint32_t maMenuTextColor; + uint32_t maMenuBarTextColor; + uint32_t maMenuBarRolloverTextColor; + uint32_t maMenuBarHighlightTextColor; + uint32_t maMenuHighlightColor; + uint32_t maMenuHighlightTextColor; + uint32_t maHighlightColor; + uint32_t maHighlightTextColor; + uint32_t maActiveTabColor; + uint32_t maInactiveTabColor; + uint32_t maTabTextColor; + uint32_t maTabRolloverTextColor; + uint32_t maTabHighlightTextColor; + uint32_t maDisableColor; + uint32_t maHelpColor; + uint32_t maHelpTextColor; + uint32_t maLinkColor; + uint32_t maVisitedLinkColor; + uint32_t maToolTextColor; + uint32_t maFontColor; +}; + +struct ControlDrawParameters +{ + typedef struct _cairo cairo_t; + ControlDrawParameters(cairo_t* i_pCairo, ControlPart i_ePart, ControlState i_eState) + : nSize(sizeof(ControlDrawParameters)) + , pCairo(i_pCairo) + , ePart(i_ePart) + , eState(i_eState) + , eButtonValue(ButtonValue::DontKnow) + , bIsAction(false) + , nValue(0) + { + } + + uint32_t nSize; + cairo_t* pCairo; + ControlPart ePart; + ControlState eState; + ButtonValue eButtonValue; + bool bIsAction; + int64_t nValue; +}; + +typedef struct WidgetThemeLibrary_t WidgetThemeLibrary; + +typedef struct _rectangle +{ + long x, y; + long width, height; +} rectangle_t; + +struct WidgetThemeLibrary_t +{ + uint32_t nSize; + + bool (*isNativeControlSupported)(ControlType eType, ControlPart ePart); + bool (*getRegion)(ControlType eType, ControlPart ePart, ControlState eState, + const rectangle_t& rBoundingControlRegion, rectangle_t& rNativeBoundingRegion, + rectangle_t& rNativeContentRegion); + + bool (*drawPushButton)(ControlDrawParameters const& rParameters, long nWidth, long nHeight); + bool (*drawRadiobutton)(ControlDrawParameters const& rParameters, long nWidth, long nHeight); + bool (*drawCheckbox)(ControlDrawParameters const& rParameters, long nWidth, long nHeight); + bool (*drawCombobox)(ControlDrawParameters const& rParameters, long nWidth, long nHeight); + bool (*drawEditbox)(ControlDrawParameters const& rParameters, long nWidth, long nHeight); + bool (*drawScrollbar)(ControlDrawParameters const& rParameters, long nWidth, long nHeight); + bool (*drawSpinButtons)(ControlDrawParameters const& rParameters, long nWidth, long nHeight); + bool (*drawSpinbox)(ControlDrawParameters const& rParameters, long nWidth, long nHeight); + bool (*drawTabItem)(ControlDrawParameters const& rParameters, long nWidth, long nHeight); + bool (*drawTabPane)(ControlDrawParameters const& rParameters, long nWidth, long nHeight); + bool (*drawTabHeader)(ControlDrawParameters const& rParameters, long nWidth, long nHeight); + bool (*drawTabBody)(ControlDrawParameters const& rParameters, long nWidth, long nHeight); + bool (*drawSlider)(ControlDrawParameters const& rParameters, long nWidth, long nHeight); + bool (*drawFixedline)(ControlDrawParameters const& rParameters, long nWidth, long nHeight); + bool (*drawToolbar)(ControlDrawParameters const& rParameters, long nWidth, long nHeight); + bool (*drawProgress)(ControlDrawParameters const& rParameters, long nWidth, long nHeight); + bool (*drawWindowsBackground)(ControlDrawParameters const& rParameters, long nWidth, + long nHeight); + bool (*drawListbox)(ControlDrawParameters const& rParameters, long nWidth, long nHeight); + bool (*drawFrame)(ControlDrawParameters const& rParameters, long nWidth, long nHeight); + bool (*drawListNode)(ControlDrawParameters const& rParameters, long nWidth, long nHeight); + bool (*drawListNet)(ControlDrawParameters const& rParameters, long nWidth, long nHeight); + bool (*drawListHeader)(ControlDrawParameters const& rParameters, long nWidth, long nHeight); + + bool (*updateSettings)(WidgetDrawStyle& rStyle); +}; + +extern "C" vcl::WidgetThemeLibrary* CreateWidgetThemeLibrary(); + +} // end vcl namespace + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/WidgetThemeLibraryTypes.hxx b/vcl/inc/WidgetThemeLibraryTypes.hxx new file mode 100644 index 000000000..b3270bf23 --- /dev/null +++ b/vcl/inc/WidgetThemeLibraryTypes.hxx @@ -0,0 +1,235 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_WIDGETTHEMETYPES_HXX +#define INCLUDED_VCL_INC_WIDGETTHEMETYPES_HXX + +#include <o3tl/typed_flags_set.hxx> + +/** + * These types are all based on the supported variants + * vcl/salnativewidgets.hxx and must be kept in-sync. + **/ + +/* Control Types: + * + * Specify the overall, whole control + * type (as opposed to parts of the + * control if it were composite). + */ + +enum class ControlType { +// for use in general purpose ImplControlValue + Generic = 0, +// Normal PushButton/Command Button + Pushbutton = 1, +// Normal single radio button + Radiobutton = 2, +// Normal single checkbox + Checkbox = 10, +// Combobox, i.e. a ListBox +// that allows data entry by user + Combobox = 20, +// Control that allows text entry + Editbox = 30, +// Control that allows text entry, but without the usual border +// Has to be handled separately, because this one cannot handle +// ControlPart::HasBackgroundTexture, which is drawn in the edit box'es +// border window. + EditboxNoBorder = 31, +// Control that allows text entry +// ( some systems distinguish between single and multi line edit boxes ) + MultilineEditbox = 32, +// Control that pops up a menu, +// but does NOT allow data entry + Listbox = 35, +// An edit field together with two little +// buttons on the side (aka spin field) + Spinbox = 40, +// Two standalone spin buttons +// without an edit field + SpinButtons = 45, +// A single tab + TabItem = 50, +// The border around a tab area, +// but without the tabs themselves. +// May have a gap at the top for +// the active tab + TabPane = 55, +// The background to the tab area + TabHeader = 56, +// Background of a Tab Pane + TabBody = 57, +// Normal scrollbar, including +// all parts like slider, buttons + Scrollbar = 60, + Slider = 65, +// A separator line + Fixedline = 80, +// A toolbar control with buttons and a grip + Toolbar = 100, +// The menubar + Menubar = 120, +// popup menu + MenuPopup = 121, + Progress = 131, +// Progress bar for the intro window +// (aka splash screen), in case some +// wants native progress bar in the +// application but not for the splash +// screen (used in desktop/) + IntroProgress = 132, +// tool tips + Tooltip = 140, +// to draw the implemented theme + WindowBackground = 150, +//to draw border of frames natively + Frame = 160, +// for nodes in listviews +// used in svtools/source/contnr/svtreebx.cxx + ListNode = 170, +// nets between elements of listviews +// with nodes + ListNet = 171, +// for list headers + ListHeader = 172, +}; + + +/* Control Parts: + * + * Uniquely identify a part of a control, + * for example the slider of a scroll bar. + */ + +enum class ControlPart +{ + NONE = 0, + Entire = 1, + ListboxWindow = 5, // the static listbox window containing the list + Button = 100, + ButtonUp = 101, + ButtonDown = 102, // Also for ComboBoxes/ListBoxes + ButtonLeft = 103, + ButtonRight = 104, + AllButtons = 105, + SeparatorHorz = 106, + SeparatorVert = 107, + TrackHorzLeft = 200, + TrackVertUpper = 201, + TrackHorzRight = 202, + TrackVertLower = 203, + TrackHorzArea = 204, + TrackVertArea = 205, + Arrow = 220, + ThumbHorz = 210, // Also used as toolbar grip + ThumbVert = 211, // Also used as toolbar grip + MenuItem = 250, + MenuItemCheckMark = 251, + MenuItemRadioMark = 252, + Separator = 253, + SubmenuArrow = 254, + +/* #i77549# + HACK: for scrollbars in case of thumb rect, page up and page down rect we + abuse the HitTestNativeScrollbar interface. All theming engines but aqua + are actually able to draw the thumb according to our internal representation. + However aqua draws a little outside. The canonical way would be to enhance the + HitTestNativeScrollbar passing a ScrollbarValue additionally so all necessary + information is available in the call. + . + However since there is only this one small exception we will deviate a little and + instead pass the respective rect as control region to allow for a small correction. + + So all places using HitTestNativeScrollbar on ControlPart::ThumbHorz, ControlPart::ThumbVert, + ControlPart::TrackHorzLeft, ControlPart::TrackHorzRight, ControlPart::TrackVertUpper, ControlPart::TrackVertLower + do not use the control rectangle as region but the actual part rectangle, making + only small deviations feasible. +*/ + +/** The edit field part of a control, e.g. of the combo box. + + Currently used just for combo boxes and just for GetNativeControlRegion(). + It is valid only if GetNativeControlRegion() supports ControlPart::ButtonDown as + well. +*/ + SubEdit = 300, + +// For controls that require the entire background +// to be drawn first, and then other pieces over top. +// (GTK+ scrollbars for example). Control region passed +// in to draw this part is expected to be the entire +// area of the control. +// A control may respond to one or both. + DrawBackgroundHorz = 1000, + DrawBackgroundVert = 1001, + +// GTK+ also draws tabs right->left since there is a +// hardcoded 2 pixel overlap between adjacent tabs + TabsDrawRtl = 3000, + +// For themes that do not want to have the focus +// rectangle part drawn by VCL but take care of the +// whole inner control part by themselves +// eg, listboxes or comboboxes or spinbuttons + HasBackgroundTexture = 4000, + +// For scrollbars that have 3 buttons (most KDE themes) + HasThreeButtons = 5000, + + BackgroundWindow = 6000, + BackgroundDialog = 6001, + +//to draw natively the border of frames + Border = 7000, + +//to draw natively the focus rects + Focus = 8000 +}; + +/* Control State: + * + * Specify how a particular part of the control + * is to be drawn. Constants are bitwise OR-ed + * together to compose a final drawing state. + * A _disabled_ state is assumed by the drawing + * functions until an ENABLED or HIDDEN is passed + * in the ControlState. + */ +enum class ControlState { + NONE = 0, + ENABLED = 0x0001, + FOCUSED = 0x0002, + PRESSED = 0x0004, + ROLLOVER = 0x0008, + DEFAULT = 0x0020, + SELECTED = 0x0040, + DOUBLEBUFFERING = 0x4000, ///< Set when the control is painted using double-buffering via VirtualDevice. + CACHING_ALLOWED = 0x8000, ///< Set when the control is completely visible (i.e. not clipped). +}; + +template<> struct o3tl::typed_flags<ControlState>: o3tl::is_typed_flags<ControlState, 0xC06F> {}; + +/* ButtonValue: + * + * Identifies the tri-state value options + * that buttons allow + */ + +enum class ButtonValue { + DontKnow, + On, + Off, + Mixed +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accel.h b/vcl/inc/accel.h new file mode 100644 index 000000000..0c27a5411 --- /dev/null +++ b/vcl/inc/accel.h @@ -0,0 +1,41 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_ACCEL_H +#define INCLUDED_VCL_INC_ACCEL_H + +#include <vcl/keycod.hxx> + +class Accelerator; + +class ImplAccelEntry +{ +public: + sal_uInt16 mnId; + vcl::KeyCode maKeyCode; + Accelerator* mpAccel; + Accelerator* mpAutoAccel; + bool mbEnabled; +}; + +bool ImplGetKeyCode( KeyFuncType eFunc, sal_uInt16& rCode1, sal_uInt16& rCode2, sal_uInt16& rCode3, sal_uInt16& rCode4 ); + +#endif // INCLUDED_VCL_INC_ACCEL_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accmgr.hxx b/vcl/inc/accmgr.hxx new file mode 100644 index 000000000..1e57ed44d --- /dev/null +++ b/vcl/inc/accmgr.hxx @@ -0,0 +1,53 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_ACCMGR_HXX +#define INCLUDED_VCL_INC_ACCMGR_HXX + +#include <vector> +#include <memory> + +#include <vcl/keycod.hxx> + +class Accelerator; + +class ImplAccelManager +{ +private: + std::unique_ptr<std::vector< Accelerator* >> mpAccelList; + std::unique_ptr<std::vector< Accelerator* >> mpSequenceList; + +public: + ImplAccelManager() + { + } + ~ImplAccelManager(); + + bool InsertAccel( Accelerator* pAccel ); + void RemoveAccel( Accelerator const * pAccel ); + + void EndSequence(); + void FlushAccel() { EndSequence(); } + + bool IsAccelKey( const vcl::KeyCode& rKeyCode ); +}; + +#endif // INCLUDED_VCL_INC_ACCMGR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/android/androidinst.hxx b/vcl/inc/android/androidinst.hxx new file mode 100644 index 000000000..526174b14 --- /dev/null +++ b/vcl/inc/android/androidinst.hxx @@ -0,0 +1,48 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_ANDROID_ANDROIDINST_HXX +#define INCLUDED_VCL_INC_ANDROID_ANDROIDINST_HXX + +#include <jni.h> +#include <android/input.h> +#include <android/native_window.h> +#include <headless/svpinst.hxx> +#include <headless/svpframe.hxx> + +class AndroidSalFrame; +class AndroidSalInstance : public SvpSalInstance +{ + // This JNIEnv is valid only in the thread where this + // AndroidSalInstance object is created, which is the "LO" thread + // in which soffice_main() runs + JNIEnv *m_pJNIEnv; + +public: + AndroidSalInstance( std::unique_ptr<SalYieldMutex> pMutex ); + virtual ~AndroidSalInstance(); + static AndroidSalInstance *getInstance(); + + virtual SalSystem* CreateSalSystem(); + + // frame management + void GetWorkArea( tools::Rectangle& rRect ); + SalFrame* CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ); + SalFrame* CreateChildFrame( SystemParentData* pParent, SalFrameStyleFlags nStyle ); + + // mainloop pieces + virtual bool AnyInput( VclInputFlags nType ); + + virtual void updateMainThread(); + virtual void releaseMainThread(); +}; + +#endif // INCLUDED_VCL_INC_ANDROID_ANDROIDINST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/android/svsys.h b/vcl/inc/android/svsys.h new file mode 100644 index 000000000..6939e5066 --- /dev/null +++ b/vcl/inc/android/svsys.h @@ -0,0 +1,17 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_ANDROID_SVSYS_H +#define INCLUDED_VCL_INC_ANDROID_SVSYS_H + +// ? + +#endif // INCLUDED_VCL_INC_ANDROID_SVSYS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/backend/BackendCapabilities.hxx b/vcl/inc/backend/BackendCapabilities.hxx new file mode 100644 index 000000000..89879ee49 --- /dev/null +++ b/vcl/inc/backend/BackendCapabilities.hxx @@ -0,0 +1,28 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_BACKENDCAPABILITIES_HXX +#define INCLUDED_VCL_INC_BACKENDCAPABILITIES_HXX + +namespace vcl +{ +struct BackendCapabilities +{ + bool mbSupportsBitmap32; + BackendCapabilities() + : mbSupportsBitmap32(false) + { + } +}; +} + +#endif // INCLUDED_VCL_INC_BACKENDCAPABILITIES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/bitmap/Octree.hxx b/vcl/inc/bitmap/Octree.hxx new file mode 100644 index 000000000..f1d6e2a58 --- /dev/null +++ b/vcl/inc/bitmap/Octree.hxx @@ -0,0 +1,82 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OCTREE_HXX +#define INCLUDED_VCL_INC_OCTREE_HXX + +#include <vcl/dllapi.h> +#include <vcl/BitmapColor.hxx> + +struct OctreeNode +{ + sal_uLong nCount = 0; + sal_uLong nRed = 0; + sal_uLong nGreen = 0; + sal_uLong nBlue = 0; + std::unique_ptr<OctreeNode> pChild[8]; + OctreeNode* pNext = nullptr; + sal_uInt16 nPalIndex = 0; + bool bLeaf = false; +}; + +class BitmapReadAccess; + +class VCL_PLUGIN_PUBLIC Octree +{ +private: + void CreatePalette(OctreeNode* pNode); + void GetPalIndex(const OctreeNode* pNode); + + SAL_DLLPRIVATE void add(std::unique_ptr<OctreeNode>& rpNode); + SAL_DLLPRIVATE void reduce(); + + BitmapPalette maPalette; + sal_uLong mnLeafCount; + sal_uLong mnLevel; + std::unique_ptr<OctreeNode> pTree; + std::vector<OctreeNode*> mpReduce; + BitmapColor const* mpColor; + sal_uInt16 mnPalIndex; + +public: + Octree(const BitmapReadAccess& rReadAcc, sal_uLong nColors); + ~Octree(); + + const BitmapPalette& GetPalette(); + sal_uInt16 GetBestPaletteIndex(const BitmapColor& rColor); +}; + +class InverseColorMap +{ +private: + std::vector<sal_uInt8> mpBuffer; + std::vector<sal_uInt8> mpMap; + + void ImplCreateBuffers(); + +public: + explicit InverseColorMap(const BitmapPalette& rPal); + ~InverseColorMap(); + + sal_uInt16 GetBestPaletteIndex(const BitmapColor& rColor); +}; + +#endif // INCLUDED_VCL_INC_OCTREE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/bitmap/ScanlineTools.hxx b/vcl/inc/bitmap/ScanlineTools.hxx new file mode 100644 index 000000000..9528f4809 --- /dev/null +++ b/vcl/inc/bitmap/ScanlineTools.hxx @@ -0,0 +1,236 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_BITMAP_SCANLINETOOLS_HXX +#define INCLUDED_VCL_INC_BITMAP_SCANLINETOOLS_HXX + +#include <tools/color.hxx> +#include <vcl/BitmapPalette.hxx> + +namespace vcl::bitmap +{ +class ScanlineTransformer +{ +public: + virtual void startLine(sal_uInt8* pLine) = 0; + virtual void skipPixel(sal_uInt32 nPixel) = 0; + virtual Color readPixel() = 0; + virtual void writePixel(Color nColor) = 0; + + virtual ~ScanlineTransformer() = default; +}; + +class ScanlineTransformer_ARGB final : public ScanlineTransformer +{ +private: + sal_uInt8* pData; + +public: + virtual void startLine(sal_uInt8* pLine) override { pData = pLine; } + + virtual void skipPixel(sal_uInt32 nPixel) override { pData += nPixel << 2; } + + virtual Color readPixel() override + { + const Color aColor(pData[4], pData[1], pData[2], pData[3]); + pData += 4; + return aColor; + } + + virtual void writePixel(Color nColor) override + { + *pData++ = nColor.GetTransparency(); + *pData++ = nColor.GetRed(); + *pData++ = nColor.GetGreen(); + *pData++ = nColor.GetBlue(); + } +}; + +class ScanlineTransformer_BGR final : public ScanlineTransformer +{ +private: + sal_uInt8* pData; + +public: + virtual void startLine(sal_uInt8* pLine) override { pData = pLine; } + + virtual void skipPixel(sal_uInt32 nPixel) override { pData += (nPixel << 1) + nPixel; } + + virtual Color readPixel() override + { + const Color aColor(pData[2], pData[1], pData[0]); + pData += 3; + return aColor; + } + + virtual void writePixel(Color nColor) override + { + *pData++ = nColor.GetBlue(); + *pData++ = nColor.GetGreen(); + *pData++ = nColor.GetRed(); + } +}; + +class ScanlineTransformer_8BitPalette final : public ScanlineTransformer +{ +private: + sal_uInt8* pData; + const BitmapPalette& mrPalette; + +public: + explicit ScanlineTransformer_8BitPalette(const BitmapPalette& rPalette) + : pData(nullptr) + , mrPalette(rPalette) + { + } + + virtual void startLine(sal_uInt8* pLine) override { pData = pLine; } + + virtual void skipPixel(sal_uInt32 nPixel) override { pData += nPixel; } + + virtual Color readPixel() override + { + const sal_uInt8 nIndex(*pData++); + if (nIndex < mrPalette.GetEntryCount()) + return mrPalette[nIndex]; + else + return COL_BLACK; + } + + virtual void writePixel(Color nColor) override + { + *pData++ = static_cast<sal_uInt8>(mrPalette.GetBestIndex(nColor)); + } +}; + +class ScanlineTransformer_4BitPalette final : public ScanlineTransformer +{ +private: + sal_uInt8* pData; + const BitmapPalette& mrPalette; + sal_uInt32 mnX; + sal_uInt32 mnShift; + +public: + explicit ScanlineTransformer_4BitPalette(const BitmapPalette& rPalette) + : pData(nullptr) + , mrPalette(rPalette) + , mnX(0) + , mnShift(0) + { + } + + virtual void skipPixel(sal_uInt32 nPixel) override + { + mnX += nPixel; + if (nPixel & 1) // is nPixel an odd number + mnShift ^= 4; + } + + virtual void startLine(sal_uInt8* pLine) override + { + pData = pLine; + mnX = 0; + mnShift = 4; + } + + virtual Color readPixel() override + { + const sal_uInt32 nDataIndex = mnX / 2; + const sal_uInt8 nIndex((pData[nDataIndex] >> mnShift) & 0x0f); + mnX++; + mnShift ^= 4; + + if (nIndex < mrPalette.GetEntryCount()) + return mrPalette[nIndex]; + else + return COL_BLACK; + } + + virtual void writePixel(Color nColor) override + { + const sal_uInt32 nDataIndex = mnX / 2; + const sal_uInt8 nColorIndex = mrPalette.GetBestIndex(nColor); + pData[nDataIndex] |= (nColorIndex & 0x0f) << mnShift; + mnX++; + mnShift ^= 4; + } +}; + +class ScanlineTransformer_1BitPalette final : public ScanlineTransformer +{ +private: + sal_uInt8* pData; + const BitmapPalette& mrPalette; + sal_uInt32 mnX; + +public: + explicit ScanlineTransformer_1BitPalette(const BitmapPalette& rPalette) + : pData(nullptr) + , mrPalette(rPalette) + , mnX(0) + { + } + + virtual void skipPixel(sal_uInt32 nPixel) override { mnX += nPixel; } + + virtual void startLine(sal_uInt8* pLine) override + { + pData = pLine; + mnX = 0; + } + + virtual Color readPixel() override + { + const sal_uInt8 nIndex((pData[mnX >> 3] >> (7 - (mnX & 7))) & 1); + mnX++; + + if (nIndex < mrPalette.GetEntryCount()) + return mrPalette[nIndex]; + else + return COL_BLACK; + } + + virtual void writePixel(Color nColor) override + { + if (mrPalette.GetBestIndex(nColor) & 1) + pData[mnX >> 3] |= 1 << (7 - (mnX & 7)); + else + pData[mnX >> 3] &= ~(1 << (7 - (mnX & 7))); + mnX++; + } +}; + +std::unique_ptr<ScanlineTransformer> getScanlineTransformer(sal_uInt16 nBits, + const BitmapPalette& rPalette) +{ + switch (nBits) + { + case 1: + return std::make_unique<ScanlineTransformer_1BitPalette>(rPalette); + case 4: + return std::make_unique<ScanlineTransformer_4BitPalette>(rPalette); + case 8: + return std::make_unique<ScanlineTransformer_8BitPalette>(rPalette); + case 24: + return std::make_unique<ScanlineTransformer_BGR>(); + case 32: + return std::make_unique<ScanlineTransformer_ARGB>(); + default: + assert(false); + break; + } + return nullptr; +} +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/bitmap/impoctree.hxx b/vcl/inc/bitmap/impoctree.hxx new file mode 100644 index 000000000..06fbd6924 --- /dev/null +++ b/vcl/inc/bitmap/impoctree.hxx @@ -0,0 +1,109 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_IMPOCTREE_HXX +#define INCLUDED_VCL_INC_IMPOCTREE_HXX + +#include "Octree.hxx" + +class ImpErrorQuad +{ + long nRed; + long nGreen; + long nBlue; + +public: + ImpErrorQuad() + : nRed(0) + , nGreen(0) + , nBlue(0) + { + } + + ImpErrorQuad(const BitmapColor& rColor) + : nRed(long(rColor.GetRed()) << 5) + , nGreen(long(rColor.GetGreen()) << 5) + , nBlue(long(rColor.GetBlue()) << 5) + { + } + + inline void operator=(const BitmapColor& rColor); + inline ImpErrorQuad& operator-=(const BitmapColor& rColor); + + inline void ImplAddColorError1(const ImpErrorQuad& rErrQuad); + inline void ImplAddColorError3(const ImpErrorQuad& rErrQuad); + inline void ImplAddColorError5(const ImpErrorQuad& rErrQuad); + inline void ImplAddColorError7(const ImpErrorQuad& rErrQuad); + + inline BitmapColor ImplGetColor(); +}; + +inline void ImpErrorQuad::operator=(const BitmapColor& rColor) +{ + nRed = long(rColor.GetRed()) << 5; + nGreen = long(rColor.GetGreen()) << 5; + nBlue = long(rColor.GetBlue()) << 5; +} + +inline ImpErrorQuad& ImpErrorQuad::operator-=(const BitmapColor& rColor) +{ + nRed -= long(rColor.GetRed()) << 5; + nGreen -= long(rColor.GetGreen()) << 5; + nBlue -= long(rColor.GetBlue()) << 5; + + return *this; +} + +inline void ImpErrorQuad::ImplAddColorError1(const ImpErrorQuad& rErrQuad) +{ + nRed += rErrQuad.nRed >> 4; + nGreen += rErrQuad.nGreen >> 4; + nBlue += rErrQuad.nBlue >> 4; +} + +inline void ImpErrorQuad::ImplAddColorError3(const ImpErrorQuad& rErrQuad) +{ + nRed += rErrQuad.nRed * 3L >> 4; + nGreen += rErrQuad.nGreen * 3L >> 4; + nBlue += rErrQuad.nBlue * 3L >> 4; +} + +inline void ImpErrorQuad::ImplAddColorError5(const ImpErrorQuad& rErrQuad) +{ + nRed += rErrQuad.nRed * 5L >> 4; + nGreen += rErrQuad.nGreen * 5L >> 4; + nBlue += rErrQuad.nBlue * 5L >> 4; +} + +inline void ImpErrorQuad::ImplAddColorError7(const ImpErrorQuad& rErrQuad) +{ + nRed += rErrQuad.nRed * 7L >> 4; + nGreen += rErrQuad.nGreen * 7L >> 4; + nBlue += rErrQuad.nBlue * 7L >> 4; +} + +inline BitmapColor ImpErrorQuad::ImplGetColor() +{ + return BitmapColor(std::clamp(nRed, 0L, 8160L) >> 5, std::clamp(nGreen, 0L, 8160L) >> 5, + std::clamp(nBlue, 0L, 8160L) >> 5); +} + +#endif // INCLUDED_VCL_INC_IMPOCTREE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/bitmaps.hlst b/vcl/inc/bitmaps.hlst new file mode 100644 index 000000000..68f23533e --- /dev/null +++ b/vcl/inc/bitmaps.hlst @@ -0,0 +1,228 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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/. + */ + +#ifndef INCLUDED_VCL_INC_BITMAPS_HRC +#define INCLUDED_VCL_INC_BITMAPS_HRC + +#define SV_RESID_BITMAP_CHECK1 "vcl/res/check1.png" +#define SV_RESID_BITMAP_CHECK2 "vcl/res/check2.png" +#define SV_RESID_BITMAP_CHECK3 "vcl/res/check3.png" +#define SV_RESID_BITMAP_CHECK4 "vcl/res/check4.png" +#define SV_RESID_BITMAP_CHECK5 "vcl/res/check5.png" +#define SV_RESID_BITMAP_CHECK6 "vcl/res/check6.png" +#define SV_RESID_BITMAP_CHECK7 "vcl/res/check7.png" +#define SV_RESID_BITMAP_CHECK8 "vcl/res/check8.png" +#define SV_RESID_BITMAP_CHECK9 "vcl/res/check9.png" +#define SV_RESID_BITMAP_CHECKMONO1 "vcl/res/checkmono1.png" +#define SV_RESID_BITMAP_CHECKMONO2 "vcl/res/checkmono2.png" +#define SV_RESID_BITMAP_CHECKMONO3 "vcl/res/checkmono3.png" +#define SV_RESID_BITMAP_CHECKMONO4 "vcl/res/checkmono4.png" +#define SV_RESID_BITMAP_CHECKMONO5 "vcl/res/checkmono5.png" +#define SV_RESID_BITMAP_CHECKMONO6 "vcl/res/checkmono6.png" +#define SV_RESID_BITMAP_CHECKMONO7 "vcl/res/checkmono7.png" +#define SV_RESID_BITMAP_CHECKMONO8 "vcl/res/checkmono8.png" +#define SV_RESID_BITMAP_CHECKMONO9 "vcl/res/checkmono9.png" +#define SV_RESID_BITMAP_RADIO1 "vcl/res/radio1.png" +#define SV_RESID_BITMAP_RADIO2 "vcl/res/radio2.png" +#define SV_RESID_BITMAP_RADIO3 "vcl/res/radio3.png" +#define SV_RESID_BITMAP_RADIO4 "vcl/res/radio4.png" +#define SV_RESID_BITMAP_RADIO5 "vcl/res/radio5.png" +#define SV_RESID_BITMAP_RADIO6 "vcl/res/radio6.png" +#define SV_RESID_BITMAP_RADIOMONO1 "vcl/res/radiomono1.png" +#define SV_RESID_BITMAP_RADIOMONO2 "vcl/res/radiomono2.png" +#define SV_RESID_BITMAP_RADIOMONO3 "vcl/res/radiomono3.png" +#define SV_RESID_BITMAP_RADIOMONO4 "vcl/res/radiomono4.png" +#define SV_RESID_BITMAP_RADIOMONO5 "vcl/res/radiomono5.png" +#define SV_RESID_BITMAP_RADIOMONO6 "vcl/res/radiomono6.png" + +#define SV_RESID_BITMAP_ERRORBOX "vcl/res/errorbox.png" +#define SV_RESID_BITMAP_QUERYBOX "vcl/res/querybox.png" +#define SV_RESID_BITMAP_WARNINGBOX "vcl/res/warningbox.png" +#define SV_RESID_BITMAP_INFOBOX "vcl/res/infobox.png" + +#define SV_RESID_BITMAP_SCROLLMSK "vcl/res/scrmsk.png" +#define SV_RESID_BITMAP_WHEELVH "vcl/res/wheelvh.png" +#define SV_RESID_BITMAP_WHEELV "vcl/res/wheelv.png" +#define SV_RESID_BITMAP_WHEELH "vcl/res/wheelh.png" +#define SV_RESID_BITMAP_SCROLLVH "vcl/res/scrollvh.png" +#define SV_RESID_BITMAP_SCROLLV "vcl/res/scrollv.png" +#define SV_RESID_BITMAP_SCROLLH "vcl/res/scrollh.png" +#define SV_RESID_BITMAP_CLOSEDOC "vcl/res/closedoc.png" +#define SV_RESID_BITMAP_INDEX "vcl/res/index.png" +#define SV_RESID_BITMAP_REFRESH "res/reload.png" +#define SV_RESID_BITMAP_NOTEBOOKBAR "res/notebookbar.png" + +#define SV_DISCLOSURE_PLUS "res/plus.png" +#define SV_DISCLOSURE_MINUS "res/minus.png" + +#define SV_PRINT_COLLATE_BMP "vcl/res/collate.png" +#define SV_PRINT_NOCOLLATE_BMP "vcl/res/ncollate.png" + +#define MAINAPP_48_8 "res/mainapp_48_8.png" +#define ODT_48_8 "res/odt_48_8.png" +#define OTT_48_8 "res/ott_48_8.png" +#define ODS_48_8 "res/ods_48_8.png" +#define OTS_48_8 "res/ots_48_8.png" +#define ODG_48_8 "res/odg_48_8.png" +#define ODP_48_8 "res/odp_48_8.png" +#define ODM_48_8 "res/odm_48_8.png" +#define ODB_48_8 "res/odb_48_8.png" +#define ODF_48_8 "res/odf_48_8.png" + +#define MAINAPP_32_8 "res/mainapp_32_8.png" +#define ODT_32_8 "res/odt_32_8.png" +#define OTT_32_8 "res/ott_32_8.png" +#define ODS_32_8 "res/ods_32_8.png" +#define OTS_32_8 "res/ots_32_8.png" +#define ODG_32_8 "res/odg_32_8.png" +#define ODP_32_8 "res/odp_32_8.png" +#define ODM_32_8 "res/odm_32_8.png" +#define ODB_32_8 "res/odb_32_8.png" +#define ODF_32_8 "res/odf_32_8.png" + +#define MAINAPP_16_8 "res/mainapp_16_8.png" +#define ODT_16_8 "res/odt_16_8.png" +#define OTT_16_8 "res/ott_16_8.png" +#define ODS_16_8 "res/ods_16_8.png" +#define OTS_16_8 "res/ots_16_8.png" +#define ODG_16_8 "res/odg_16_8.png" +#define ODP_16_8 "res/odp_16_8.png" +#define ODM_16_8 "res/odm_16_8.png" +#define ODB_16_8 "res/odb_16_8.png" +#define ODF_16_8 "res/odf_16_8.png" + +//start, Throbber::getDefaultImageURLs +#define SPINNER_16_01 "vcl/res/spinner-16-01.png" +#define SPINNER_16_02 "vcl/res/spinner-16-02.png" +#define SPINNER_16_03 "vcl/res/spinner-16-03.png" +#define SPINNER_16_04 "vcl/res/spinner-16-04.png" +#define SPINNER_16_05 "vcl/res/spinner-16-05.png" +#define SPINNER_16_06 "vcl/res/spinner-16-06.png" + +#define SPINNER_32_01 "vcl/res/spinner-32-01.png" +#define SPINNER_32_02 "vcl/res/spinner-32-02.png" +#define SPINNER_32_03 "vcl/res/spinner-32-03.png" +#define SPINNER_32_04 "vcl/res/spinner-32-04.png" +#define SPINNER_32_05 "vcl/res/spinner-32-05.png" +#define SPINNER_32_06 "vcl/res/spinner-32-06.png" +#define SPINNER_32_07 "vcl/res/spinner-32-07.png" +#define SPINNER_32_08 "vcl/res/spinner-32-08.png" +#define SPINNER_32_09 "vcl/res/spinner-32-09.png" +#define SPINNER_32_10 "vcl/res/spinner-32-10.png" +#define SPINNER_32_11 "vcl/res/spinner-32-11.png" +#define SPINNER_32_12 "vcl/res/spinner-32-12.png" + +#define SPINNER_64_01 "vcl/res/spinner-64-01.png" +#define SPINNER_64_02 "vcl/res/spinner-64-02.png" +#define SPINNER_64_03 "vcl/res/spinner-64-03.png" +#define SPINNER_64_04 "vcl/res/spinner-64-04.png" +#define SPINNER_64_05 "vcl/res/spinner-64-05.png" +#define SPINNER_64_06 "vcl/res/spinner-64-06.png" +#define SPINNER_64_07 "vcl/res/spinner-64-07.png" +#define SPINNER_64_08 "vcl/res/spinner-64-08.png" +#define SPINNER_64_09 "vcl/res/spinner-64-09.png" +#define SPINNER_64_10 "vcl/res/spinner-64-10.png" +#define SPINNER_64_11 "vcl/res/spinner-64-11.png" +#define SPINNER_64_12 "vcl/res/spinner-64-12.png" +//end, Throbber::getDefaultImageURLs + +#define IMG_APPLY "sw/res/sc20558.png" +#define IMG_WARN "dbaccess/res/exwarning.png" +#define IMG_ERROR "dbaccess/res/exerror.png" +#define IMG_INFO "dbaccess/res/exinfo.png" +#define IMG_ADD "extensions/res/scanner/plus.png" +#define IMG_REMOVE "extensions/res/scanner/minus.png" +#define IMG_COPY "cmd/sc_copy.png" +#define IMG_PASTE "cmd/sc_paste.png" + +#define RID_BMP_TREENODE_COLLAPSED "res/plus.png" +#define RID_BMP_TREENODE_EXPANDED "res/minus.png" + +#define RID_CURSOR_AUTOSCROLL_E "vcl/res/autoscroll_e.png" +#define RID_CURSOR_AUTOSCROLL_N "vcl/res/autoscroll_n.png" +#define RID_CURSOR_AUTOSCROLL_NE "vcl/res/autoscroll_ne.png" +#define RID_CURSOR_AUTOSCROLL_NS "vcl/res/autoscroll_ns.png" +#define RID_CURSOR_AUTOSCROLL_NSWE "vcl/res/autoscroll_nswe.png" +#define RID_CURSOR_AUTOSCROLL_NW "vcl/res/autoscroll_nw.png" +#define RID_CURSOR_AUTOSCROLL_S "vcl/res/autoscroll_s.png" +#define RID_CURSOR_AUTOSCROLL_SE "vcl/res/autoscroll_se.png" +#define RID_CURSOR_AUTOSCROLL_SW "vcl/res/autoscroll_sw.png" +#define RID_CURSOR_AUTOSCROLL_W "vcl/res/autoscroll_w.png" +#define RID_CURSOR_AUTOSCROLL_WE "vcl/res/autoscroll_we.png" +#define RID_CURSOR_CHAIN "vcl/res/chain.png" +#define RID_CURSOR_CHAIN_NOT_ALLOWED "vcl/res/chain_not_allowed.png" +#define RID_CURSOR_CHART "vcl/res/chart.png" +#define RID_CURSOR_COPY_DATA "vcl/res/copy_data.png" +#define RID_CURSOR_COPY_DATA_LINK "vcl/res/copy_data_link.png" +#define RID_CURSOR_COPY_FILE "vcl/res/copy_file.png" +#define RID_CURSOR_COPY_FILES "vcl/res/copy_files.png" +#define RID_CURSOR_COPY_FILE_LINK "vcl/res/copy_file_link.png" +#define RID_CURSOR_CROOK "vcl/res/crook.png" +#define RID_CURSOR_CROP "vcl/res/crop.png" +#define RID_CURSOR_DRAW_ARC "vcl/res/draw_arc.png" +#define RID_CURSOR_DRAW_BEZIER "vcl/res/draw_bezier.png" +#define RID_CURSOR_DRAW_CAPTION "vcl/res/draw_caption.png" +#define RID_CURSOR_DRAW_CIRCLE_CUT "vcl/res/draw_circle_cut.png" +#define RID_CURSOR_DRAW_CONNECT "vcl/res/draw_connect.png" +#define RID_CURSOR_DRAW_ELLIPSE "vcl/res/draw_ellipse.png" +#define RID_CURSOR_DETECTIVE "vcl/res/detective.png" +#define RID_CURSOR_DRAW_FREEHAND "vcl/res/draw_freehand.png" +#define RID_CURSOR_DRAW_LINE "vcl/res/draw_line.png" +#define RID_CURSOR_DRAW_PIE "vcl/res/draw_pie.png" +#define RID_CURSOR_DRAW_POLYGON "vcl/res/draw_polygon.png" +#define RID_CURSOR_DRAW_RECT "vcl/res/draw_rect.png" +#define RID_CURSOR_DRAW_TEXT "vcl/res/draw_text.png" +#define RID_CURSOR_FILL "vcl/res/fill.png" +#define RID_CURSOR_HELP "vcl/res/help.png" +#define RID_CURSOR_H_SHEAR "vcl/res/h_shear.png" +#define RID_CURSOR_LINK_DATA "vcl/res/link_data.png" +#define RID_CURSOR_LINK_FILE "vcl/res/link_file.png" +#define RID_CURSOR_MAGNIFY "vcl/res/magnify.png" +#define RID_CURSOR_MIRROR "vcl/res/mirror.png" +#define RID_CURSOR_MOVE_BEZIER_WEIGHT "vcl/res/move_bezier_weight.png" +#define RID_CURSOR_MOVE_DATA "vcl/res/move_data.png" +#define RID_CURSOR_MOVE_DATA_LINK "vcl/res/move_data_link.png" +#define RID_CURSOR_MOVE_FILE "vcl/res/move_file.png" +#define RID_CURSOR_MOVE_FILES "vcl/res/move_files.png" +#define RID_CURSOR_MOVE_FILE_LINK "vcl/res/move_file_link.png" +#define RID_CURSOR_MOVE_POINT "vcl/res/move_point.png" +#define RID_CURSOR_NESWSIZE "vcl/res/neswsize.png" +#define RID_CURSOR_NOT_ALLOWED "vcl/res/not_allowed.png" +#define RID_CURSOR_NULL "vcl/res/null.png" +#define RID_CURSOR_NWSESIZE "vcl/res/nwsesize.png" +#define RID_CURSOR_PEN "vcl/res/pen.png" +#define RID_CURSOR_PIVOT_COLUMN "vcl/res/pivot_column.png" +#define RID_CURSOR_PIVOT_DELETE "vcl/res/pivot_delete.png" +#define RID_CURSOR_PIVOT_FIELD "vcl/res/pivot_field.png" +#define RID_CURSOR_PIVOT_ROW "vcl/res/pivot_row.png" +#define RID_CURSOR_ROTATE "vcl/res/rotate.png" +#define RID_CURSOR_TAB_SELECT_E "vcl/res/tab_select_e.png" +#define RID_CURSOR_TAB_SELECT_S "vcl/res/tab_select_s.png" +#define RID_CURSOR_TAB_SELECT_SE "vcl/res/tab_select_se.png" +#define RID_CURSOR_TAB_SELECT_SW "vcl/res/tab_select_sw.png" +#define RID_CURSOR_TAB_SELECT_W "vcl/res/tab_select_w.png" +#define RID_CURSOR_V_SHEAR "vcl/res/v_shear.png" +#define RID_CURSOR_TEXT_VERTICAL "vcl/res/text_vertical.png" +#define RID_CURSOR_HIDE_WHITESPACE "vcl/res/hide_whitespace.png" +#define RID_CURSOR_SHOW_WHITESPACE "vcl/res/show_whitespace.png" +#define RID_CURSOR_WAIT "vcl/res/wait.png" +#define RID_CURSOR_NWSIZE "vcl/res/nwsize.png" +#define RID_CURSOR_NESIZE "vcl/res/nesize.png" +#define RID_CURSOR_SWSIZE "vcl/res/swsize.png" +#define RID_CURSOR_SESIZE "vcl/res/sesize.png" +#define RID_CURSOR_WINDOW_NWSIZE "vcl/res/window_nwsize.png" +#define RID_CURSOR_WINDOW_NESIZE "vcl/res/window_nesize.png" +#define RID_CURSOR_WINDOW_SWSIZE "vcl/res/window_swsize.png" +#define RID_CURSOR_WINDOW_SESIZE "vcl/res/window_sesize.png" + +#define CHEVRON "sfx2/res/chevron.png" + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/bitmapwriteaccess.hxx b/vcl/inc/bitmapwriteaccess.hxx new file mode 100644 index 000000000..f747223ec --- /dev/null +++ b/vcl/inc/bitmapwriteaccess.hxx @@ -0,0 +1,94 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_BITMAPWRITEACCESS_HXX +#define INCLUDED_VCL_INC_BITMAPWRITEACCESS_HXX + +#include <vcl/alpha.hxx> +#include <vcl/bitmap.hxx> +#include <vcl/bitmapaccess.hxx> +#include <optional> + +typedef vcl::ScopedBitmapAccess<BitmapWriteAccess, Bitmap, &Bitmap::AcquireWriteAccess> + BitmapScopedWriteAccess; + +typedef vcl::ScopedBitmapAccess<BitmapWriteAccess, AlphaMask, &AlphaMask::AcquireAlphaWriteAccess> + AlphaScopedWriteAccess; + +class VCL_DLLPUBLIC BitmapWriteAccess : public BitmapReadAccess +{ +public: + BitmapWriteAccess(Bitmap& rBitmap); + virtual ~BitmapWriteAccess() override; + + void CopyScanline(long nY, const BitmapReadAccess& rReadAcc); + void CopyScanline(long nY, ConstScanline aSrcScanline, ScanlineFormat nSrcScanlineFormat, + sal_uInt32 nSrcScanlineSize); + + void SetPalette(const BitmapPalette& rPalette) + { + assert(mpBuffer && "Access is not valid!"); + + mpBuffer->maPalette = rPalette; + } + + void SetPaletteEntryCount(sal_uInt16 nCount) + { + assert(mpBuffer && "Access is not valid!"); + + mpBuffer->maPalette.SetEntryCount(nCount); + } + + void SetPaletteColor(sal_uInt16 nColor, const BitmapColor& rBitmapColor) + { + assert(mpBuffer && "Access is not valid!"); + assert(HasPalette() && "Bitmap has no palette!"); + + mpBuffer->maPalette[nColor] = rBitmapColor; + } + + void SetPixel(long nY, long nX, const BitmapColor& rBitmapColor) + { + assert(mpBuffer && "Access is not valid!"); + assert(nX < mpBuffer->mnWidth && "x-coordinate out of range!"); + assert(nY < mpBuffer->mnHeight && "y-coordinate out of range!"); + + mFncSetPixel(GetScanline(nY), nX, rBitmapColor, maColorMask); + } + + void SetPixelIndex(long nY, long nX, sal_uInt8 cIndex) + { + SetPixel(nY, nX, BitmapColor(cIndex)); + } + + void SetLineColor(const Color& rColor); + + void SetFillColor(); + void SetFillColor(const Color& rColor); + + void Erase(const Color& rColor); + + void DrawLine(const Point& rStart, const Point& rEnd); + + void FillRect(const tools::Rectangle& rRect); + void DrawRect(const tools::Rectangle& rRect); + +private: + std::optional<BitmapColor> mpLineColor; + std::optional<BitmapColor> mpFillColor; + + BitmapWriteAccess() = delete; + BitmapWriteAccess(const BitmapWriteAccess&) = delete; + BitmapWriteAccess& operator=(const BitmapWriteAccess&) = delete; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/bmpfast.hxx b/vcl/inc/bmpfast.hxx new file mode 100644 index 000000000..f9a1f891b --- /dev/null +++ b/vcl/inc/bmpfast.hxx @@ -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 . + */ + +#ifndef INCLUDED_VCL_INC_BMPFAST_HXX +#define INCLUDED_VCL_INC_BMPFAST_HXX + +#include <vcl/dllapi.h> + +class BitmapWriteAccess; +class BitmapReadAccess; +struct BitmapBuffer; +class BitmapColor; +struct SalTwoRect; + +// the bmpfast functions have signatures with good compatibility to +// their canonic counterparts, which employ the GetPixel/SetPixel methods + +VCL_DLLPUBLIC bool ImplFastBitmapConversion( BitmapBuffer& rDst, const BitmapBuffer& rSrc, + const SalTwoRect& rTwoRect ); + +bool ImplFastBitmapBlending( BitmapWriteAccess const & rDst, + const BitmapReadAccess& rSrc, const BitmapReadAccess& rMask, + const SalTwoRect& rTwoRect ); + +bool ImplFastEraseBitmap( BitmapBuffer&, const BitmapColor& ); + +#endif // INCLUDED_VCL_INC_BMPFAST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/brdwin.hxx b/vcl/inc/brdwin.hxx new file mode 100644 index 000000000..1dedce0e2 --- /dev/null +++ b/vcl/inc/brdwin.hxx @@ -0,0 +1,294 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_BRDWIN_HXX +#define INCLUDED_VCL_INC_BRDWIN_HXX + +#include <vcl/notebookbar.hxx> +#include <vcl/window.hxx> +#include <o3tl/typed_flags_set.hxx> +#include <vcl/NotebookBarAddonsMerger.hxx> + +#include <com/sun/star/frame/XFrame.hpp> + +class ImplBorderWindowView; +enum class DrawButtonFlags; + +enum class BorderWindowStyle { + NONE = 0x0000, + Overlap = 0x0001, + Float = 0x0004, + Frame = 0x0008, + App = 0x0010 +}; +namespace o3tl { + template<> struct typed_flags<BorderWindowStyle> : is_typed_flags<BorderWindowStyle, 0x001d> {}; +}; + +enum class BorderWindowHitTest { + NONE = 0x0000, + Title = 0x0001, + Left = 0x0002, + Menu = 0x0004, + Top = 0x0008, + Right = 0x0010, + Bottom = 0x0020, + TopLeft = 0x0040, + TopRight = 0x0080, + BottomLeft = 0x0100, + BottomRight = 0x0200, + Close = 0x0400, + Roll = 0x0800, + Dock = 0x1000, + Hide = 0x2000, + Help = 0x4000, +}; +namespace o3tl { + template<> struct typed_flags<BorderWindowHitTest> : is_typed_flags<BorderWindowHitTest, 0x7fff> {}; +}; + +enum class BorderWindowTitleType { + Normal = 0x0001, + Small = 0x0002, + Tearoff = 0x0004, + Popup = 0x0008, + NONE = 0x0010 +}; +namespace o3tl { + template<> struct typed_flags<BorderWindowTitleType> : is_typed_flags<BorderWindowTitleType, 0x001f> {}; +}; + +class ImplBorderWindow : public vcl::Window +{ + friend class vcl::Window; + friend class ImplBorderWindowView; + friend class ImplSmallBorderWindowView; + friend class ImplStdBorderWindowView; + +private: + std::unique_ptr<ImplBorderWindowView> mpBorderView; + VclPtr<vcl::Window> mpMenuBarWindow; + VclPtr<NotebookBar> mpNotebookBar; + long mnMinWidth; + long mnMinHeight; + long mnMaxWidth; + long mnMaxHeight; + long mnOrgMenuHeight; + BorderWindowTitleType mnTitleType; + WindowBorderStyle mnBorderStyle; + bool mbFloatWindow; + bool mbSmallOutBorder; + bool mbFrameBorder; + bool mbRollUp; + bool mbMenuHide; + bool mbDockBtn; + bool mbHideBtn; + bool mbMenuBtn; + bool mbDisplayActive; + + using Window::ImplInit; + void ImplInit( vcl::Window* pParent, + WinBits nStyle, BorderWindowStyle nTypeStyle, + SystemParentData* pParentData ); + + ImplBorderWindow (const ImplBorderWindow &) = delete; + ImplBorderWindow& operator= (const ImplBorderWindow &) = delete; + +public: + ImplBorderWindow( vcl::Window* pParent, + SystemParentData* pParentData, + WinBits nStyle, + BorderWindowStyle nTypeStyle ); + ImplBorderWindow( vcl::Window* pParent, WinBits nStyle, + BorderWindowStyle nTypeStyle ); + virtual ~ImplBorderWindow() override; + virtual void dispose() override; + + virtual void MouseMove( const MouseEvent& rMEvt ) override; + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual void Tracking( const TrackingEvent& rTEvt ) override; + virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; + virtual void Activate() override; + virtual void Deactivate() override; + virtual void Resize() override; + virtual void RequestHelp( const HelpEvent& rHEvt ) override; + virtual void StateChanged( StateChangedType nType ) override; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override; + + void InitView(); + void UpdateView( bool bNewView, const Size& rNewOutSize ); + void InvalidateBorder(); + + using Window::Draw; + void Draw( OutputDevice* pDev, const Point& rPos ); + + void SetDisplayActive( bool bActive ); + void SetTitleType( BorderWindowTitleType nTitleType, const Size& rSize ); + void SetBorderStyle( WindowBorderStyle nStyle ); + WindowBorderStyle GetBorderStyle() const { return mnBorderStyle; } + void SetRollUp( bool bRollUp, const Size& rSize ); + void SetCloseButton(); + void SetDockButton( bool bDockButton ); + void SetHideButton( bool bHideButton ); + void SetMenuButton( bool bMenuButton ); + + void UpdateMenuHeight(); + void SetMenuBarWindow( vcl::Window* pWindow ); + void SetMenuBarMode( bool bHide ); + + void SetNotebookBar(const OUString& rUIXMLDescription, + const css::uno::Reference<css::frame::XFrame>& rFrame, + const NotebookBarAddonsItem &aNotebookBarAddonsItem); + void CloseNotebookBar(); + const VclPtr<NotebookBar>& GetNotebookBar() const { return mpNotebookBar; } + + void SetMinOutputSize( long nWidth, long nHeight ) + { mnMinWidth = nWidth; mnMinHeight = nHeight; } + void SetMaxOutputSize( long nWidth, long nHeight ) + { mnMaxWidth = nWidth; mnMaxHeight = nHeight; } + + void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, + sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const; + long CalcTitleWidth() const; + + tools::Rectangle GetMenuRect() const; + + virtual Size GetOptimalSize() const override; +}; + +struct ImplBorderFrameData +{ + VclPtr<ImplBorderWindow> mpBorderWindow; + VclPtr<OutputDevice> mpOutDev; + tools::Rectangle maTitleRect; + tools::Rectangle maCloseRect; + tools::Rectangle maRollRect; + tools::Rectangle maDockRect; + tools::Rectangle maMenuRect; + tools::Rectangle maHideRect; + tools::Rectangle maHelpRect; + Point maMouseOff; + long mnWidth; + long mnHeight; + long mnTrackX; + long mnTrackY; + long mnTrackWidth; + long mnTrackHeight; + sal_Int32 mnLeftBorder; + sal_Int32 mnTopBorder; + sal_Int32 mnRightBorder; + sal_Int32 mnBottomBorder; + long mnNoTitleTop; + long mnBorderSize; + long mnTitleHeight; + BorderWindowHitTest mnHitTest; + DrawButtonFlags mnCloseState; + DrawButtonFlags mnRollState; + DrawButtonFlags mnDockState; + DrawButtonFlags mnMenuState; + DrawButtonFlags mnHideState; + DrawButtonFlags mnHelpState; + BorderWindowTitleType mnTitleType; + bool mbDragFull; + bool mbTitleClipped; +}; + +class ImplBorderWindowView +{ +public: + virtual ~ImplBorderWindowView(); + + virtual bool MouseMove( const MouseEvent& rMEvt ); + virtual bool MouseButtonDown( const MouseEvent& rMEvt ); + virtual bool Tracking( const TrackingEvent& rTEvt ); + virtual OUString RequestHelp( const Point& rPos, tools::Rectangle& rHelpRect ); + + virtual void Init( OutputDevice* pDev, long nWidth, long nHeight ) = 0; + virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, + sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const = 0; + virtual long CalcTitleWidth() const = 0; + virtual void DrawWindow(vcl::RenderContext& rRenderContext, const Point* pOffset = nullptr) = 0; + virtual tools::Rectangle GetMenuRect() const; + + static void ImplInitTitle( ImplBorderFrameData* pData ); + static BorderWindowHitTest ImplHitTest( ImplBorderFrameData const * pData, const Point& rPos ); + static void ImplMouseMove( ImplBorderFrameData* pData, const MouseEvent& rMEvt ); + static OUString ImplRequestHelp( ImplBorderFrameData const * pData, const Point& rPos, tools::Rectangle& rHelpRect ); + static long ImplCalcTitleWidth( const ImplBorderFrameData* pData ); +}; + +class ImplNoBorderWindowView final : public ImplBorderWindowView +{ +public: + ImplNoBorderWindowView(); + + virtual void Init( OutputDevice* pDev, long nWidth, long nHeight ) override; + virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, + sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const override; + virtual long CalcTitleWidth() const override; + virtual void DrawWindow(vcl::RenderContext& rRenderContext, const Point* pOffset = nullptr) override; +}; + +class ImplSmallBorderWindowView : public ImplBorderWindowView +{ + VclPtr<ImplBorderWindow> mpBorderWindow; + VclPtr<OutputDevice> mpOutDev; + long mnWidth; + long mnHeight; + sal_Int32 mnLeftBorder; + sal_Int32 mnTopBorder; + sal_Int32 mnRightBorder; + sal_Int32 mnBottomBorder; + bool mbNWFBorder; + +public: + ImplSmallBorderWindowView( ImplBorderWindow* pBorderWindow ); + + virtual void Init( OutputDevice* pOutDev, long nWidth, long nHeight ) override; + virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, + sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const override; + virtual long CalcTitleWidth() const override; + virtual void DrawWindow(vcl::RenderContext& rRenderContext, const Point* pOffset = nullptr) override; +}; + +class ImplStdBorderWindowView : public ImplBorderWindowView +{ + ImplBorderFrameData maFrameData; + +public: + ImplStdBorderWindowView( ImplBorderWindow* pBorderWindow ); + virtual ~ImplStdBorderWindowView() override; + + virtual bool MouseMove( const MouseEvent& rMEvt ) override; + virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual bool Tracking( const TrackingEvent& rTEvt ) override; + virtual OUString RequestHelp( const Point& rPos, tools::Rectangle& rHelpRect ) override; + virtual tools::Rectangle GetMenuRect() const override; + + virtual void Init( OutputDevice* pDev, long nWidth, long nHeight ) override; + virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, + sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const override; + virtual long CalcTitleWidth() const override; + virtual void DrawWindow(vcl::RenderContext& rRenderContext, const Point* pOffset = nullptr) override; +}; + +#endif // INCLUDED_VCL_INC_BRDWIN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/canvasbitmap.hxx b/vcl/inc/canvasbitmap.hxx new file mode 100644 index 000000000..e49f3f43a --- /dev/null +++ b/vcl/inc/canvasbitmap.hxx @@ -0,0 +1,121 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_CANVASBITMAP_HXX +#define INCLUDED_VCL_INC_CANVASBITMAP_HXX + +#include <cppuhelper/implbase.hxx> +#include <com/sun/star/rendering/XIntegerReadOnlyBitmap.hpp> +#include <com/sun/star/rendering/XIntegerBitmapColorSpace.hpp> +#include <com/sun/star/rendering/XBitmapPalette.hpp> + +#include <vcl/bitmapex.hxx> + +namespace vcl +{ +namespace unotools +{ + class VCL_DLLPUBLIC VclCanvasBitmap final : + public cppu::WeakImplHelper< css::rendering::XIntegerReadOnlyBitmap, + css::rendering::XBitmapPalette, + css::rendering::XIntegerBitmapColorSpace > + { + private: + BitmapEx m_aBmpEx; + ::Bitmap m_aBitmap; + ::Bitmap m_aAlpha; + Bitmap::ScopedReadAccess m_pBmpAcc; + Bitmap::ScopedReadAccess m_pAlphaAcc; + css::uno::Sequence<sal_Int8> m_aComponentTags; + css::uno::Sequence<sal_Int32> m_aComponentBitCounts; + css::rendering::IntegerBitmapLayout m_aLayout; + sal_Int32 m_nBitsPerInputPixel; + sal_Int32 m_nBitsPerOutputPixel; + sal_Int32 m_nRedIndex; + sal_Int32 m_nGreenIndex; + sal_Int32 m_nBlueIndex; + sal_Int32 m_nAlphaIndex; + sal_Int32 m_nIndexIndex; + sal_Int8 m_nEndianness; + bool m_bPalette; + + SAL_DLLPRIVATE void setComponentInfo( sal_uInt32 redShift, sal_uInt32 greenShift, sal_uInt32 blueShift ); + + virtual ~VclCanvasBitmap() override; + + public: + // XBitmap + virtual css::geometry::IntegerSize2D SAL_CALL getSize() override; + virtual sal_Bool SAL_CALL hasAlpha( ) override; + virtual css::uno::Reference< css::rendering::XBitmap > SAL_CALL getScaledBitmap( const css::geometry::RealSize2D& newSize, sal_Bool beFast ) override; + + // XIntegerReadOnlyBitmap + virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL getData( css::rendering::IntegerBitmapLayout& bitmapLayout, const css::geometry::IntegerRectangle2D& rect ) override; + virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL getPixel( css::rendering::IntegerBitmapLayout& bitmapLayout, const css::geometry::IntegerPoint2D& pos ) override; + /// @throws css::uno::RuntimeException + css::uno::Reference< css::rendering::XBitmapPalette > getPalette( ); + virtual css::rendering::IntegerBitmapLayout SAL_CALL getMemoryLayout( ) override; + + // XBitmapPalette + virtual sal_Int32 SAL_CALL getNumberOfEntries() override; + virtual sal_Bool SAL_CALL getIndex( css::uno::Sequence< double >& entry, ::sal_Int32 nIndex ) override; + virtual sal_Bool SAL_CALL setIndex( const css::uno::Sequence< double >& color, sal_Bool transparency, ::sal_Int32 nIndex ) override; + virtual css::uno::Reference< css::rendering::XColorSpace > SAL_CALL getColorSpace( ) override; + + // XIntegerBitmapColorSpace + virtual ::sal_Int8 SAL_CALL getType( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getComponentTags( ) override; + virtual ::sal_Int8 SAL_CALL getRenderingIntent( ) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getProperties( ) override; + virtual css::uno::Sequence< double > SAL_CALL convertColorSpace( const css::uno::Sequence< double >& deviceColor, const css::uno::Reference< css::rendering::XColorSpace >& targetColorSpace ) override; + virtual css::uno::Sequence< css::rendering::RGBColor > SAL_CALL convertToRGB( const css::uno::Sequence< double >& deviceColor ) override; + virtual css::uno::Sequence< css::rendering::ARGBColor > SAL_CALL convertToARGB( const css::uno::Sequence< double >& deviceColor ) override; + virtual css::uno::Sequence< css::rendering::ARGBColor > SAL_CALL convertToPARGB( const css::uno::Sequence< double >& deviceColor ) override; + virtual css::uno::Sequence< double > SAL_CALL convertFromRGB( const css::uno::Sequence< css::rendering::RGBColor >& rgbColor ) override; + virtual css::uno::Sequence< double > SAL_CALL convertFromARGB( const css::uno::Sequence< css::rendering::ARGBColor >& rgbColor ) override; + virtual css::uno::Sequence< double > SAL_CALL convertFromPARGB( const css::uno::Sequence< css::rendering::ARGBColor >& rgbColor ) override; + virtual ::sal_Int32 SAL_CALL getBitsPerPixel( ) override; + virtual css::uno::Sequence< ::sal_Int32 > SAL_CALL getComponentBitCounts( ) override; + virtual ::sal_Int8 SAL_CALL getEndianness( ) override; + virtual css::uno::Sequence<double> SAL_CALL convertFromIntegerColorSpace( const css::uno::Sequence< ::sal_Int8 >& deviceColor, const css::uno::Reference< css::rendering::XColorSpace >& targetColorSpace ) override; + virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL convertToIntegerColorSpace( const css::uno::Sequence< ::sal_Int8 >& deviceColor, const css::uno::Reference< css::rendering::XIntegerBitmapColorSpace >& targetColorSpace ) override; + virtual css::uno::Sequence< css::rendering::RGBColor > SAL_CALL convertIntegerToRGB( const css::uno::Sequence< ::sal_Int8 >& deviceColor ) override; + virtual css::uno::Sequence< css::rendering::ARGBColor > SAL_CALL convertIntegerToARGB( const css::uno::Sequence< ::sal_Int8 >& deviceColor ) override; + virtual css::uno::Sequence< css::rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const css::uno::Sequence< ::sal_Int8 >& deviceColor ) override; + virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB( const css::uno::Sequence< css::rendering::RGBColor >& rgbColor ) override; + virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromARGB( const css::uno::Sequence< css::rendering::ARGBColor >& rgbColor ) override; + virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB( const css::uno::Sequence< css::rendering::ARGBColor >& rgbColor ) override; + + /** Create API wrapper for given BitmapEx + + @param rBitmap + Bitmap to wrap. As usual, changes to the original bitmap + are not reflected in this object (copy on write). + */ + explicit VclCanvasBitmap( const BitmapEx& rBitmap ); + + /// Retrieve contained bitmap. Call me with locked Solar mutex! + const BitmapEx& getBitmapEx() const { return m_aBmpEx; } + }; +} +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/configsettings.hxx b/vcl/inc/configsettings.hxx new file mode 100644 index 000000000..ea6cf6574 --- /dev/null +++ b/vcl/inc/configsettings.hxx @@ -0,0 +1,66 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_VCL_CONFIGSETTINGS_HXX +#define INCLUDED_VCL_CONFIGSETTINGS_HXX + +#include <rtl/ustring.hxx> +#include <unotools/configitem.hxx> +#include <vcl/dllapi.h> + +#include <unordered_map> + +namespace com::sun::star::uno { template <typename > class Sequence; } + +namespace vcl +{ + typedef std::unordered_map< OUString, OUString > OUStrMap; + class SmallOUStrMap : public OUStrMap { public: SmallOUStrMap() : OUStrMap(1) {} }; + + + //= SettingsConfigItem + + class VCL_DLLPUBLIC SettingsConfigItem final : public ::utl::ConfigItem + { + private: + std::unordered_map< OUString, SmallOUStrMap > m_aSettings; + + virtual void Notify( const css::uno::Sequence< OUString >& rPropertyNames ) override; + + void getValues(); + SettingsConfigItem(); + + virtual void ImplCommit() override; + + public: + virtual ~SettingsConfigItem() override; + + static SettingsConfigItem* get(); + + OUString getValue( const OUString& rGroup, const OUString& rKey ) const; + void setValue( const OUString& rGroup, const OUString& rKey, const OUString& rValue ); + + }; + + +} // namespace vcl + + +#endif // INCLUDED_VCL_CONFIGSETTINGS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/controldata.hxx b/vcl/inc/controldata.hxx new file mode 100644 index 000000000..ed6e3a368 --- /dev/null +++ b/vcl/inc/controldata.hxx @@ -0,0 +1,38 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_CONTROLDATA_HXX +#define INCLUDED_VCL_INC_CONTROLDATA_HXX + +#include <memory> +#include <vcl/toolkit/controllayout.hxx> + +namespace vcl +{ + struct ImplControlData + { + mutable std::unique_ptr<ControlLayoutData> mpLayoutData; + VclPtr<OutputDevice> mpReferenceDevice; + }; + +} // namespace vcl + +#endif // INCLUDED_VCL_INC_CONTROLDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/cursor_hotspots.hxx b/vcl/inc/cursor_hotspots.hxx new file mode 100644 index 000000000..74a041ddd --- /dev/null +++ b/vcl/inc/cursor_hotspots.hxx @@ -0,0 +1,169 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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/. + */ + +#ifndef INCLUDED_VCL_INC_CURSOR_HOTSPOTS_HXX +#define INCLUDED_VCL_INC_CURSOR_HOTSPOTS_HXX + +#define help_curs_x_hot 0 +#define help_curs_y_hot 0 +#define pen_curs_x_hot 3 +#define pen_curs_y_hot 27 +#define nodrop_curs_x_hot 9 +#define nodrop_curs_y_hot 9 +#define magnify_curs_x_hot 12 +#define magnify_curs_y_hot 13 +#define rotate_curs_x_hot 15 +#define rotate_curs_y_hot 15 +#define hshear_curs_x_hot 15 +#define hshear_curs_y_hot 15 +#define vshear_curs_x_hot 15 +#define vshear_curs_y_hot 15 +#define drawline_curs_x_hot 7 +#define drawline_curs_y_hot 7 +#define drawrect_curs_x_hot 7 +#define drawrect_curs_y_hot 7 +#define drawpolygon_curs_x_hot 7 +#define drawpolygon_curs_y_hot 7 +#define drawbezier_curs_x_hot 7 +#define drawbezier_curs_y_hot 7 +#define drawarc_curs_x_hot 7 +#define drawarc_curs_y_hot 7 +#define drawpie_curs_x_hot 7 +#define drawpie_curs_y_hot 7 +#define drawcirclecut_curs_x_hot 7 +#define drawcirclecut_curs_y_hot 7 +#define drawellipse_curs_x_hot 7 +#define drawellipse_curs_y_hot 7 +#define drawconnect_curs_x_hot 7 +#define drawconnect_curs_y_hot 7 +#define drawtext_curs_x_hot 8 +#define drawtext_curs_y_hot 8 +#define mirror_curs_x_hot 14 +#define mirror_curs_y_hot 12 +#define crook_curs_x_hot 15 +#define crook_curs_y_hot 14 +#define crop_curs_x_hot 9 +#define crop_curs_y_hot 9 +#define movepoint_curs_x_hot 0 +#define movepoint_curs_y_hot 0 +#define movebezierweight_curs_x_hot 0 +#define movebezierweight_curs_y_hot 0 +#define drawfreehand_curs_x_hot 8 +#define drawfreehand_curs_y_hot 8 +#define drawcaption_curs_x_hot 8 +#define drawcaption_curs_y_hot 8 +#define movedata_curs_x_hot 1 +#define movedata_curs_y_hot 1 +#define copydata_curs_x_hot 1 +#define copydata_curs_y_hot 1 +#define linkdata_curs_x_hot 1 +#define linkdata_curs_y_hot 1 +#define movedlnk_curs_x_hot 1 +#define movedlnk_curs_y_hot 1 +#define copydlnk_curs_x_hot 1 +#define copydlnk_curs_y_hot 1 +#define movefile_curs_x_hot 9 +#define movefile_curs_y_hot 9 +#define copyfile_curs_x_hot 9 +#define copyfile_curs_y_hot 9 +#define linkfile_curs_x_hot 9 +#define linkfile_curs_y_hot 9 +#define moveflnk_curs_x_hot 9 +#define moveflnk_curs_y_hot 9 +#define copyflnk_curs_x_hot 9 +#define copyflnk_curs_y_hot 9 +#define movefiles_curs_x_hot 8 +#define movefiles_curs_y_hot 9 +#define copyfiles_curs_x_hot 8 +#define copyfiles_curs_y_hot 9 + +#define chart_curs_x_hot 15 +#define chart_curs_y_hot 16 +#define detective_curs_x_hot 12 +#define detective_curs_y_hot 13 +#define pivotcol_curs_x_hot 7 +#define pivotcol_curs_y_hot 5 +#define pivotfld_curs_x_hot 8 +#define pivotfld_curs_y_hot 7 +#define pivotrow_curs_x_hot 8 +#define pivotrow_curs_y_hot 7 +#define pivotdel_curs_x_hot 9 +#define pivotdel_curs_y_hot 8 + +#define chain_curs_x_hot 0 +#define chain_curs_y_hot 2 +#define chainnot_curs_x_hot 2 +#define chainnot_curs_y_hot 2 + +#define ase_curs_x_hot 19 +#define ase_curs_y_hot 16 +#define asn_curs_x_hot 16 +#define asn_curs_y_hot 12 +#define asne_curs_x_hot 21 +#define asne_curs_y_hot 10 +#define asns_curs_x_hot 15 +#define asns_curs_y_hot 15 +#define asnswe_curs_x_hot 15 +#define asnswe_curs_y_hot 15 +#define asnw_curs_x_hot 10 +#define asnw_curs_y_hot 10 +#define ass_curs_x_hot 15 +#define ass_curs_y_hot 19 +#define asse_curs_x_hot 21 +#define asse_curs_y_hot 21 +#define assw_curs_x_hot 10 +#define assw_curs_y_hot 21 +#define asw_curs_x_hot 12 +#define asw_curs_y_hot 15 +#define aswe_curs_x_hot 15 +#define aswe_curs_y_hot 15 +#define nullcurs_x_hot 2 +#define nullcurs_y_hot 2 + +#define fill_curs_x_hot 10 +#define fill_curs_y_hot 22 +#define vertcurs_curs_x_hot 8 +#define vertcurs_curs_y_hot 8 +#define tblsele_curs_x_hot 14 +#define tblsele_curs_y_hot 8 +#define tblsels_curs_x_hot 7 +#define tblsels_curs_y_hot 14 +#define tblselse_curs_x_hot 14 +#define tblselse_curs_y_hot 14 +#define tblselw_curs_x_hot 1 +#define tblselw_curs_y_hot 8 +#define tblselsw_curs_x_hot 1 +#define tblselsw_curs_y_hot 14 +#define hidewhitespace_curs_x_hot 0 +#define hidewhitespace_curs_y_hot 10 +#define showwhitespace_curs_x_hot 0 +#define showwhitespace_curs_y_hot 10 + +#define wait_curs_x_hot 10 +#define wait_curs_y_hot 10 +#define nwsize_curs_x_hot 10 +#define nwsize_curs_y_hot 10 +#define nesize_curs_x_hot 10 +#define nesize_curs_y_hot 10 +#define swsize_curs_x_hot 10 +#define swsize_curs_y_hot 10 +#define sesize_curs_x_hot 10 +#define sesize_curs_y_hot 10 +#define window_nwsize_curs_x_hot 10 +#define window_nwsize_curs_y_hot 10 +#define window_nesize_curs_x_hot 10 +#define window_nesize_curs_y_hot 10 +#define window_swsize_curs_x_hot 10 +#define window_swsize_curs_y_hot 10 +#define window_sesize_curs_x_hot 10 +#define window_sesize_curs_y_hot 10 + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/dbggui.hxx b/vcl/inc/dbggui.hxx new file mode 100644 index 000000000..b3d93c5e1 --- /dev/null +++ b/vcl/inc/dbggui.hxx @@ -0,0 +1,29 @@ +/* -*- 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 + +#ifndef NDEBUG + +void DbgGUIInitSolarMutexCheck(); +void DbgGUIDeInitSolarMutexCheck(); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/debugevent.hxx b/vcl/inc/debugevent.hxx new file mode 100644 index 000000000..a6f458265 --- /dev/null +++ b/vcl/inc/debugevent.hxx @@ -0,0 +1,36 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_DEBUGEVENT_HXX +#define INCLUDED_VCL_DEBUGEVENT_HXX + +#include <vcl/dllapi.h> +#include <vcl/timer.hxx> +#include <sal/types.h> + +namespace vcl { class Window; } + +class DebugEventInjector final : private Timer { + sal_uInt32 mnEventsLeft; + DebugEventInjector( sal_uInt32 nMaxEvents ); + + static vcl::Window *ChooseWindow(); + static void InjectTextEvent(); + static void InjectMenuEvent(); + static void InjectEvent(); + static void InjectKeyNavEdit(); + virtual void Invoke() override; + + public: + static DebugEventInjector *getCreate(); +}; + +#endif // INCLUDED_VCL_DEBUGEVENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/displayconnectiondispatch.hxx b/vcl/inc/displayconnectiondispatch.hxx new file mode 100644 index 000000000..e988ee62f --- /dev/null +++ b/vcl/inc/displayconnectiondispatch.hxx @@ -0,0 +1,63 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_DISPLAYCONNECTIONDISPATCH_HXX +#define INCLUDED_VCL_INC_DISPLAYCONNECTIONDISPATCH_HXX + +#include <sal/config.h> +#include <com/sun/star/awt/XDisplayConnection.hpp> +#include <cppuhelper/implbase.hxx> +#include <osl/mutex.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <vector> + +namespace vcl { + +class DisplayConnectionDispatch final : + public cppu::WeakImplHelper< css::awt::XDisplayConnection > +{ + ::osl::Mutex m_aMutex; + ::std::vector< css::uno::Reference< css::awt::XEventHandler > > + m_aHandlers; + OUString m_ConnectionIdentifier; +public: + DisplayConnectionDispatch(); + ~DisplayConnectionDispatch() override; + + void start(); + void terminate(); + + bool dispatchEvent( void const * pData, int nBytes ); + + // XDisplayConnection + virtual void SAL_CALL addEventHandler( const css::uno::Any& window, const css::uno::Reference< css::awt::XEventHandler >& handler, sal_Int32 eventMask ) override; + virtual void SAL_CALL removeEventHandler( const css::uno::Any& window, const css::uno::Reference< css::awt::XEventHandler >& handler ) override; + virtual void SAL_CALL addErrorHandler( const css::uno::Reference< css::awt::XEventHandler >& handler ) override; + virtual void SAL_CALL removeErrorHandler( const css::uno::Reference< css::awt::XEventHandler >& handler ) override; + virtual css::uno::Any SAL_CALL getIdentifier() override; + +}; + +} + + + +#endif // INCLUDED_VCL_INC_DISPLAYCONNECTIONDISPATCH_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/dndeventdispatcher.hxx b/vcl/inc/dndeventdispatcher.hxx new file mode 100644 index 000000000..bc2f5d999 --- /dev/null +++ b/vcl/inc/dndeventdispatcher.hxx @@ -0,0 +1,111 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_DNDEVENTDISPATCHER_HXX +#define INCLUDED_VCL_INC_DNDEVENTDISPATCHER_HXX + +#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTargetDragContext.hpp> + +#include <com/sun/star/datatransfer/dnd/XDragGestureListener.hpp> +#include <cppuhelper/implbase.hxx> +#include <vcl/window.hxx> + +class DNDEventDispatcher final : public ::cppu::WeakImplHelper< + css::datatransfer::dnd::XDropTargetListener, + css::datatransfer::dnd::XDropTargetDragContext, + css::datatransfer::dnd::XDragGestureListener > +{ + VclPtr<vcl::Window> m_pTopWindow; + + VclPtr<vcl::Window> m_pCurrentWindow; + void designate_currentwindow(vcl::Window *pWindow); + DECL_LINK(WindowEventListener, VclWindowEvent&, void); + + ::osl::Mutex m_aMutex; + css::uno::Sequence< css::datatransfer::DataFlavor > m_aDataFlavorList; + + vcl::Window* findTopLevelWindow(Point location); + /* + * fire the events on the dnd listener container of the specified window + */ + + /// @throws css::uno::RuntimeException + static sal_Int32 fireDragEnterEvent( vcl::Window *pWindow, const css::uno::Reference< css::datatransfer::dnd::XDropTargetDragContext >& xContext, + const sal_Int8 nDropAction, const Point& rLocation, const sal_Int8 nSourceAction, + const css::uno::Sequence< css::datatransfer::DataFlavor >& aFlavorList ); + + /// @throws css::uno::RuntimeException + static sal_Int32 fireDragOverEvent( vcl::Window *pWindow, const css::uno::Reference< css::datatransfer::dnd::XDropTargetDragContext >& xContext, + const sal_Int8 nDropAction, const Point& rLocation, const sal_Int8 nSourceAction ); + + /// @throws css::uno::RuntimeException + static sal_Int32 fireDragExitEvent( vcl::Window *pWindow ); + + /// @throws css::uno::RuntimeException + static sal_Int32 fireDropActionChangedEvent( vcl::Window *pWindow, const css::uno::Reference< css::datatransfer::dnd::XDropTargetDragContext >& xContext, + const sal_Int8 nDropAction, const Point& rLocation, const sal_Int8 nSourceAction ); + + /// @throws css::uno::RuntimeException + static sal_Int32 fireDropEvent( vcl::Window *pWindow, const css::uno::Reference< css::datatransfer::dnd::XDropTargetDropContext >& xContext, + const sal_Int8 nDropAction, const Point& rLocation, const sal_Int8 nSourceAction, + const css::uno::Reference< css::datatransfer::XTransferable >& xTransferable ); + + /// @throws css::uno::RuntimeException + static sal_Int32 fireDragGestureEvent( vcl::Window *pWindow, const css::uno::Reference< css::datatransfer::dnd::XDragSource >& xSource, + const css::uno::Any& event, const Point& rOrigin, const sal_Int8 nDragAction ); + +public: + + DNDEventDispatcher( vcl::Window * pTopWindow ); + virtual ~DNDEventDispatcher() override; + + /* + * XDropTargetDragContext + */ + + virtual void SAL_CALL acceptDrag( sal_Int8 dropAction ) override; + virtual void SAL_CALL rejectDrag() override; + + /* + * XDropTargetListener + */ + + virtual void SAL_CALL drop( const css::datatransfer::dnd::DropTargetDropEvent& dtde ) override; + virtual void SAL_CALL dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) override; + virtual void SAL_CALL dragExit( const css::datatransfer::dnd::DropTargetEvent& dte ) override; + virtual void SAL_CALL dragOver( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) override; + virtual void SAL_CALL dropActionChanged( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) override; + + /* + * XDragGestureListener + */ + + virtual void SAL_CALL dragGestureRecognized( const css::datatransfer::dnd::DragGestureEvent& dge ) override; + + /* + * XEventListener + */ + + virtual void SAL_CALL disposing( const css::lang::EventObject& eo ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/dndlistenercontainer.hxx b/vcl/inc/dndlistenercontainer.hxx new file mode 100644 index 000000000..28339e7ab --- /dev/null +++ b/vcl/inc/dndlistenercontainer.hxx @@ -0,0 +1,112 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_DNDLCON_HXX +#define INCLUDED_VCL_INC_DNDLCON_HXX + +#include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp> +#include <com/sun/star/datatransfer/dnd/XDragSource.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTargetDragContext.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTargetDropContext.hpp> +#include <cppuhelper/compbase.hxx> + +#include <vcl/unohelp2.hxx> + +class DNDListenerContainer final : public vcl::unohelper::MutexHelper, + public ::cppu::WeakComponentImplHelper< + css::datatransfer::dnd::XDragGestureRecognizer, + css::datatransfer::dnd::XDropTargetDragContext, + css::datatransfer::dnd::XDropTargetDropContext, + css::datatransfer::dnd::XDropTarget > +{ + bool m_bActive; + sal_Int8 m_nDefaultActions; + + css::uno::Reference< css::datatransfer::dnd::XDropTargetDragContext > m_xDropTargetDragContext; + css::uno::Reference< css::datatransfer::dnd::XDropTargetDropContext > m_xDropTargetDropContext; + +public: + + DNDListenerContainer( sal_Int8 nDefaultActions ); + virtual ~DNDListenerContainer() override; + + sal_uInt32 fireDropEvent( + const css::uno::Reference< css::datatransfer::dnd::XDropTargetDropContext >& context, + sal_Int8 dropAction, sal_Int32 locationX, sal_Int32 locationY, sal_Int8 sourceActions, + const css::uno::Reference< css::datatransfer::XTransferable >& transferable ); + + sal_uInt32 fireDragExitEvent(); + + sal_uInt32 fireDragOverEvent( + const css::uno::Reference< css::datatransfer::dnd::XDropTargetDragContext >& context, + sal_Int8 dropAction, sal_Int32 locationX, sal_Int32 locationY, sal_Int8 sourceActions ); + + sal_uInt32 fireDragEnterEvent( + const css::uno::Reference< css::datatransfer::dnd::XDropTargetDragContext >& context, + sal_Int8 dropAction, sal_Int32 locationX, sal_Int32 locationY, sal_Int8 sourceActions, + const css::uno::Sequence< css::datatransfer::DataFlavor >& dataFlavor ); + + sal_uInt32 fireDropActionChangedEvent( + const css::uno::Reference< css::datatransfer::dnd::XDropTargetDragContext >& context, + sal_Int8 dropAction, sal_Int32 locationX, sal_Int32 locationY, sal_Int8 sourceActions ); + + sal_uInt32 fireDragGestureEvent( + sal_Int8 dragAction, sal_Int32 dragOriginX, sal_Int32 dragOriginY, + const css::uno::Reference< css::datatransfer::dnd::XDragSource >& dragSource, + const css::uno::Any& triggerEvent ); + + /* + * XDragGestureRecognizer + */ + + virtual void SAL_CALL addDragGestureListener( const css::uno::Reference< css::datatransfer::dnd::XDragGestureListener >& dgl ) override; + virtual void SAL_CALL removeDragGestureListener( const css::uno::Reference< css::datatransfer::dnd::XDragGestureListener >& dgl ) override; + virtual void SAL_CALL resetRecognizer( ) override; + + /* + * XDropTargetDragContext + */ + + virtual void SAL_CALL acceptDrag( sal_Int8 dragOperation ) override; + virtual void SAL_CALL rejectDrag( ) override; + + /* + * XDropTargetDropContext + */ + + virtual void SAL_CALL acceptDrop( sal_Int8 dropOperation ) override; + virtual void SAL_CALL rejectDrop( ) override; + virtual void SAL_CALL dropComplete( sal_Bool success ) override; + + /* + * XDropTarget + */ + + virtual void SAL_CALL addDropTargetListener( const css::uno::Reference< css::datatransfer::dnd::XDropTargetListener >& dtl ) override; + virtual void SAL_CALL removeDropTargetListener( const css::uno::Reference< css::datatransfer::dnd::XDropTargetListener >& dtl ) override; + virtual sal_Bool SAL_CALL isActive( ) override; + virtual void SAL_CALL setActive( sal_Bool active ) override; + virtual sal_Int8 SAL_CALL getDefaultActions( ) override; + virtual void SAL_CALL setDefaultActions( sal_Int8 actions ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/driverblocklist.hxx b/vcl/inc/driverblocklist.hxx new file mode 100644 index 000000000..c3feea278 --- /dev/null +++ b/vcl/inc/driverblocklist.hxx @@ -0,0 +1,176 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_DRIVERBLOCKLIST_HXX +#define INCLUDED_VCL_DRIVERBLOCKLIST_HXX + +#include <vcl/dllapi.h> +#include <xmlreader/xmlreader.hxx> +#include <vector> + +namespace DriverBlocklist +{ +// Details of how to treat a version number. +enum class VersionType +{ + OpenGL, // a.b.c.d, 1.98 > 1.978 + Vulkan // a.b.c , 1.98 < 1.978 +}; + +VCL_DLLPUBLIC bool IsDeviceBlocked(const OUString& blocklistURL, VersionType versionType, + const OUString& driverVersion, const OUString& vendorId, + const OUString& deviceId); + +#ifdef _WIN32 +VCL_DLLPUBLIC int32_t GetWindowsVersion(); +#endif + +enum DeviceVendor +{ + VendorAll, + VendorIntel, + VendorNVIDIA, + VendorAMD, + VendorMicrosoft, +}; +const int DeviceVendorMax = VendorMicrosoft + 1; + +/// Returns vendor for the given vendor ID, or VendorAll if not known. +VCL_DLLPUBLIC DeviceVendor GetVendorFromId(uint32_t id); + +VCL_DLLPUBLIC OUStringLiteral GetVendorNameFromId(uint32_t id); + +// The rest should be private (only for the unittest). + +struct InvalidFileException +{ +}; + +enum OperatingSystem +{ + DRIVER_OS_UNKNOWN = 0, + DRIVER_OS_WINDOWS_FIRST, + DRIVER_OS_WINDOWS_7 = DRIVER_OS_WINDOWS_FIRST, + DRIVER_OS_WINDOWS_8, + DRIVER_OS_WINDOWS_8_1, + DRIVER_OS_WINDOWS_10, + DRIVER_OS_WINDOWS_LAST = DRIVER_OS_WINDOWS_10, + DRIVER_OS_WINDOWS_ALL, + DRIVER_OS_LINUX, + DRIVER_OS_OSX_FIRST, + DRIVER_OS_OSX_10_5 = DRIVER_OS_OSX_FIRST, + DRIVER_OS_OSX_10_6, + DRIVER_OS_OSX_10_7, + DRIVER_OS_OSX_10_8, + DRIVER_OS_OSX_LAST = DRIVER_OS_OSX_10_8, + DRIVER_OS_OSX_ALL, + DRIVER_OS_ANDROID, + DRIVER_OS_ALL +}; + +enum VersionComparisonOp +{ + DRIVER_LESS_THAN, // driver < version + DRIVER_LESS_THAN_OR_EQUAL, // driver <= version + DRIVER_GREATER_THAN, // driver > version + DRIVER_GREATER_THAN_OR_EQUAL, // driver >= version + DRIVER_EQUAL, // driver == version + DRIVER_NOT_EQUAL, // driver != version + DRIVER_BETWEEN_EXCLUSIVE, // driver > version && driver < versionMax + DRIVER_BETWEEN_INCLUSIVE, // driver >= version && driver <= versionMax + DRIVER_BETWEEN_INCLUSIVE_START, // driver >= version && driver < versionMax + DRIVER_COMPARISON_IGNORED +}; + +struct DriverInfo +{ + DriverInfo(OperatingSystem os, const OUString& vendor, VersionComparisonOp op, + uint64_t driverVersion, bool bWhiteListed = false, + const char* suggestedVersion = nullptr); + + DriverInfo(); + + OperatingSystem meOperatingSystem; + OUString maAdapterVendor; + std::vector<OUString> maDevices; + + bool mbWhitelisted; + + VersionComparisonOp meComparisonOp; + + /* versions are assumed to be A.B.C.D packed as 0xAAAABBBBCCCCDDDD */ + uint64_t mnDriverVersion; + uint64_t mnDriverVersionMax; + static uint64_t allDriverVersions; + + OUString maSuggestedVersion; + OUString maMsg; +}; + +class VCL_DLLPUBLIC Parser +{ +public: + Parser(const OUString& rURL, std::vector<DriverInfo>& rDriverList, VersionType versionType); + bool parse(); + +private: + void handleEntry(DriverInfo& rDriver, xmlreader::XmlReader& rReader); + void handleList(xmlreader::XmlReader& rReader); + void handleContent(xmlreader::XmlReader& rReader); + static void handleDevices(DriverInfo& rDriver, xmlreader::XmlReader& rReader); + uint64_t getVersion(const OString& rString); + + enum class BlockType + { + WHITELIST, + BLACKLIST, + UNKNOWN + }; + + BlockType meBlockType; + std::vector<DriverInfo>& mrDriverList; + OUString maURL; + const VersionType mVersionType; +}; + +OUString VCL_DLLPUBLIC GetVendorId(DeviceVendor id); + +bool VCL_DLLPUBLIC FindBlocklistedDeviceInList( + std::vector<DriverInfo>& aDeviceInfos, VersionType versionType, OUString const& sDriverVersion, + OUString const& sAdapterVendorID, OUString const& sAdapterDeviceID, OperatingSystem system, + const OUString& blocklistURL = OUString()); + +#define GFX_DRIVER_VERSION(a, b, c, d) \ + ((uint64_t(a) << 48) | (uint64_t(b) << 32) | (uint64_t(c) << 16) | uint64_t(d)) + +inline uint64_t OpenGLVersion(uint32_t a, uint32_t b, uint32_t c, uint32_t d) +{ + // We make sure every driver number is padded by 0s, this will allow us the + // easiest 'compare as if decimals' approach. See ParseDriverVersion for a + // more extensive explanation of this approach. + while (b > 0 && b < 1000) + { + b *= 10; + } + while (c > 0 && c < 1000) + { + c *= 10; + } + while (d > 0 && d < 1000) + { + d *= 10; + } + return GFX_DRIVER_VERSION(a, b, c, d); +} + +} // namespace + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/factory.hxx b/vcl/inc/factory.hxx new file mode 100644 index 000000000..54a382aa4 --- /dev/null +++ b/vcl/inc/factory.hxx @@ -0,0 +1,79 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_FACTORY_HXX +#define INCLUDED_VCL_INC_FACTORY_HXX + +#include <sal/config.h> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <rtl/ustring.hxx> + +namespace com::sun::star { + namespace lang { + class XMultiServiceFactory; + class XSingleServiceFactory; + } + namespace uno { class XInterface; } +} + +css::uno::Sequence<OUString> vcl_session_getSupportedServiceNames(); + +OUString vcl_session_getImplementationName(); + +css::uno::Reference<css::uno::XInterface> vcl_session_createInstance( + css::uno::Reference<css::lang::XMultiServiceFactory > const &); + +namespace vcl { + +css::uno::Sequence<OUString> +FontIdentificator_getSupportedServiceNames(); + +OUString FontIdentificator_getImplementationName(); + +css::uno::Reference<css::uno::XInterface> +FontIdentificator_createInstance( + css::uno::Reference<css::lang::XMultiServiceFactory > const &); + +OUString Clipboard_getImplementationName(); + +css::uno::Reference<css::lang::XSingleServiceFactory> +Clipboard_createFactory(); + +css::uno::Sequence<OUString> DragSource_getSupportedServiceNames(); + +OUString DragSource_getImplementationName(); + +css::uno::Reference<css::uno::XInterface> DragSource_createInstance( + css::uno::Reference<css::lang::XMultiServiceFactory > const &); + +css::uno::Sequence<OUString> DropTarget_getSupportedServiceNames(); + +OUString DropTarget_getImplementationName(); + +css::uno::Reference<css::uno::XInterface> DropTarget_createInstance( + css::uno::Reference<css::lang::XMultiServiceFactory > const &); + +} + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/fltcall.hxx b/vcl/inc/fltcall.hxx new file mode 100644 index 000000000..f10e72b07 --- /dev/null +++ b/vcl/inc/fltcall.hxx @@ -0,0 +1,37 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_FLTCALL_HXX +#define INCLUDED_VCL_FLTCALL_HXX + +class FilterConfigItem; +class SvStream; +class Graphic; + +typedef bool (*PFilterCall)(SvStream & rStream, Graphic & rGraphic, + FilterConfigItem* pConfigItem); + // Of this type are both export-filter and import-filter functions + // rFileName is the complete path to the file to be imported or exported + // pCallBack can be NULL. pCallerData is handed to the callback function + // pOptionsConfig can be NULL; if not, the group of the config is already set + // and may not be changed by this filter! + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/font/FeatureCollector.hxx b/vcl/inc/font/FeatureCollector.hxx new file mode 100644 index 000000000..bae9e3c56 --- /dev/null +++ b/vcl/inc/font/FeatureCollector.hxx @@ -0,0 +1,55 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_FONT_FEATURECOLLECTOR_HXX +#define INCLUDED_VCL_INC_FONT_FEATURECOLLECTOR_HXX + +#include <vcl/font/Feature.hxx> +#include <hb.h> +#include <i18nlangtag/lang.h> + +namespace vcl +{ +namespace font +{ +class FeatureCollector +{ +private: + hb_face_t* m_pHbFace; + std::vector<vcl::font::Feature>& m_rFontFeatures; + LanguageType m_eLanguageType; + +public: + FeatureCollector(hb_face_t* pHbFace, std::vector<vcl::font::Feature>& rFontFeatures, + LanguageType eLanguageType) + : m_pHbFace(pHbFace) + , m_rFontFeatures(rFontFeatures) + , m_eLanguageType(eLanguageType) + { + } + +private: + void collectForLanguage(hb_tag_t aTableTag, sal_uInt32 nScript, hb_tag_t aScriptTag, + sal_uInt32 nLanguage, hb_tag_t aLanguageTag); + + void collectForScript(hb_tag_t aTableTag, sal_uInt32 nScript, hb_tag_t aScriptTag); + void collectForTable(hb_tag_t aTableTag); + bool collectGraphite(); + +public: + bool collect(); +}; + +} // end namespace font +} // end namespace vcl + +#endif // INCLUDED_VCL_INC_FONT_FEATURECOLLECTOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/font/OpenTypeFeatureDefinitionList.hxx b/vcl/inc/font/OpenTypeFeatureDefinitionList.hxx new file mode 100644 index 000000000..3a01d9135 --- /dev/null +++ b/vcl/inc/font/OpenTypeFeatureDefinitionList.hxx @@ -0,0 +1,48 @@ +/* -*- 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/. + */ + +#pragma once + +#include <vcl/dllapi.h> +#include <vcl/font/Feature.hxx> +#include <rtl/instance.hxx> +#include <vector> +#include <unordered_map> + +namespace vcl +{ +namespace font +{ +class OpenTypeFeatureDefinitionListPrivate +{ +private: + std::vector<FeatureDefinition> m_aFeatureDefinition; + std::unordered_map<sal_uInt32, size_t> m_aCodeToIndex; + std::vector<sal_uInt32> m_aRequiredFeatures; + + void init(); + + static bool isSpecialFeatureCode(sal_uInt32 nFeatureCode); + static FeatureDefinition handleSpecialFeatureCode(sal_uInt32 nFeatureCode); + +public: + OpenTypeFeatureDefinitionListPrivate(); + FeatureDefinition getDefinition(sal_uInt32 nFeatureCode); + bool isRequired(sal_uInt32 nFeatureCode); +}; + +class VCL_DLLPUBLIC OpenTypeFeatureDefinitionList + : public rtl::Static<OpenTypeFeatureDefinitionListPrivate, OpenTypeFeatureDefinitionList> +{ +}; + +} // end font namespace +} // end vcl namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/font/OpenTypeFeatureStrings.hrc b/vcl/inc/font/OpenTypeFeatureStrings.hrc new file mode 100644 index 000000000..9fa782b16 --- /dev/null +++ b/vcl/inc/font/OpenTypeFeatureStrings.hrc @@ -0,0 +1,106 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_FONT_OPENTYPEFEATRESTRINGS_HRC +#define INCLUDED_VCL_INC_FONT_OPENTYPEFEATRESTRINGS_HRC + +#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) + +#define STR_FONT_FEATURE_ID_AALT NC_("STR_FONT_FEATURE_ID_AALT", "Access All Alternates") +#define STR_FONT_FEATURE_ID_AFRC NC_("STR_FONT_FEATURE_ID_AFRC", "Alternative (Vertical) Fractions") +#define STR_FONT_FEATURE_ID_ALIG NC_("STR_FONT_FEATURE_ID_ALIG", "Ancient Ligatures") +#define STR_FONT_FEATURE_ID_C2PC NC_("STR_FONT_FEATURE_ID_C2PC", "Capitals to Petite Capitals") +#define STR_FONT_FEATURE_ID_C2SC NC_("STR_FONT_FEATURE_ID_C2SC", "Capitals to Small Capitals") +#define STR_FONT_FEATURE_ID_CALT NC_("STR_FONT_FEATURE_ID_CALT", "Contextual Alternates") +#define STR_FONT_FEATURE_ID_CASE NC_("STR_FONT_FEATURE_ID_CASE", "Case-Sensitive Forms") +#define STR_FONT_FEATURE_ID_CLIG NC_("STR_FONT_FEATURE_ID_CLIG", "Contextual Ligatures") +#define STR_FONT_FEATURE_ID_CPCT NC_("STR_FONT_FEATURE_ID_CPCT", "Centered CJK Punctuation") +#define STR_FONT_FEATURE_ID_CPSP NC_("STR_FONT_FEATURE_ID_CPSP", "Capital Spacing") +#define STR_FONT_FEATURE_ID_CSWH NC_("STR_FONT_FEATURE_ID_CSWH", "Contextual Swash") +#define STR_FONT_FEATURE_ID_CVXX NC_("STR_FONT_FEATURE_ID_CVXX", "Character Variant %1") +#define STR_FONT_FEATURE_ID_DCAP NC_("STR_FONT_FEATURE_ID_DCAP", "Drop Caps") +#define STR_FONT_FEATURE_ID_DLIG NC_("STR_FONT_FEATURE_ID_DLIG", "Discretionary Ligatures") +#define STR_FONT_FEATURE_ID_DNOM NC_("STR_FONT_FEATURE_ID_DNOM", "Denominators") +#define STR_FONT_FEATURE_ID_DPNG NC_("STR_FONT_FEATURE_ID_DPNG", "Diphthongs (Obsolete)") +#define STR_FONT_FEATURE_ID_EXPT NC_("STR_FONT_FEATURE_ID_EXPT", "Expert Forms") +#define STR_FONT_FEATURE_ID_FALT NC_("STR_FONT_FEATURE_ID_FALT", "Final Glyph on Line Alternates") +#define STR_FONT_FEATURE_ID_FRAC NC_("STR_FONT_FEATURE_ID_FRAC", "Fraction style:") +#define STR_FONT_FEATURE_ID_FRAC_PARAM_0 NC_("STR_FONT_FEATURE_ID_FRAC_PARAM_0", "None") +#define STR_FONT_FEATURE_ID_FRAC_PARAM_1 NC_("STR_FONT_FEATURE_ID_FRAC_PARAM_1", "Diagonal Fractions") +#define STR_FONT_FEATURE_ID_FRAC_PARAM_2 NC_("STR_FONT_FEATURE_ID_FRAC_PARAM_2", "Nut Fractions") +#define STR_FONT_FEATURE_ID_FWID NC_("STR_FONT_FEATURE_ID_FWID", "Full Widths") +#define STR_FONT_FEATURE_ID_HALT NC_("STR_FONT_FEATURE_ID_HALT", "Alternate Half Widths") +#define STR_FONT_FEATURE_ID_HIST NC_("STR_FONT_FEATURE_ID_HIST", "Historical Forms") +#define STR_FONT_FEATURE_ID_HKNA NC_("STR_FONT_FEATURE_ID_HKNA", "Horizontal Kana Alternates") +#define STR_FONT_FEATURE_ID_HLIG NC_("STR_FONT_FEATURE_ID_HLIG", "Historical Ligatures") +#define STR_FONT_FEATURE_ID_HNGL NC_("STR_FONT_FEATURE_ID_HNGL", "Hanja to Hangul (Obsolete)") +#define STR_FONT_FEATURE_ID_HOJO NC_("STR_FONT_FEATURE_ID_HOJO", "Hojo Kanji Forms (JIS X 0212-1990 Kanji Forms)") +#define STR_FONT_FEATURE_ID_HWID NC_("STR_FONT_FEATURE_ID_HWID", "Half Widths") +#define STR_FONT_FEATURE_ID_ITAL NC_("STR_FONT_FEATURE_ID_ITAL", "Italics") +#define STR_FONT_FEATURE_ID_JALT NC_("STR_FONT_FEATURE_ID_JALT", "Justification Alternates") +#define STR_FONT_FEATURE_ID_JP04 NC_("STR_FONT_FEATURE_ID_JP04", "JIS2004 Forms") +#define STR_FONT_FEATURE_ID_JP78 NC_("STR_FONT_FEATURE_ID_JP78", "JIS78 Forms") +#define STR_FONT_FEATURE_ID_JP83 NC_("STR_FONT_FEATURE_ID_JP83", "JIS83 Forms") +#define STR_FONT_FEATURE_ID_JP90 NC_("STR_FONT_FEATURE_ID_JP90", "JIS90 Forms") +#define STR_FONT_FEATURE_ID_KERN NC_("STR_FONT_FEATURE_ID_KERN", "Horizontal Kerning") +#define STR_FONT_FEATURE_ID_LFBD NC_("STR_FONT_FEATURE_ID_LFBD", "Left Bounds") +#define STR_FONT_FEATURE_ID_LIGA NC_("STR_FONT_FEATURE_ID_LIGA", "Standard Ligatures") +#define STR_FONT_FEATURE_ID_LNUM NC_("STR_FONT_FEATURE_ID_LNUM", "Lining Figures") +#define STR_FONT_FEATURE_ID_MGRK NC_("STR_FONT_FEATURE_ID_MGRK", "Mathematical Greek") +#define STR_FONT_FEATURE_ID_NALT NC_("STR_FONT_FEATURE_ID_NALT", "Alternate Annotation Forms") +#define STR_FONT_FEATURE_ID_NLCK NC_("STR_FONT_FEATURE_ID_NLCK", "NLC Kanji Forms") +#define STR_FONT_FEATURE_ID_NUMR NC_("STR_FONT_FEATURE_ID_NUMR", "Numerators") +#define STR_FONT_FEATURE_ID_ONUM NC_("STR_FONT_FEATURE_ID_ONUM", "Oldstyle Figures") +#define STR_FONT_FEATURE_ID_OPBD NC_("STR_FONT_FEATURE_ID_OPBD", "Optical Bounds") +#define STR_FONT_FEATURE_ID_ORDN NC_("STR_FONT_FEATURE_ID_ORDN", "Ordinals") +#define STR_FONT_FEATURE_ID_ORNM NC_("STR_FONT_FEATURE_ID_ORNM", "Ornaments") +#define STR_FONT_FEATURE_ID_PALT NC_("STR_FONT_FEATURE_ID_PALT", "Proportional Alternate Metrics") +#define STR_FONT_FEATURE_ID_PCAP NC_("STR_FONT_FEATURE_ID_PCAP", "Lowercase to Petite Capitals") +#define STR_FONT_FEATURE_ID_PKNA NC_("STR_FONT_FEATURE_ID_PKNA", "Proportional Kana") +#define STR_FONT_FEATURE_ID_PNUM NC_("STR_FONT_FEATURE_ID_PNUM", "Proportional Numbers") +#define STR_FONT_FEATURE_ID_PWID NC_("STR_FONT_FEATURE_ID_PWID", "Proportional Widths") +#define STR_FONT_FEATURE_ID_QWID NC_("STR_FONT_FEATURE_ID_QWID", "Quarter Widths") +#define STR_FONT_FEATURE_ID_RTBD NC_("STR_FONT_FEATURE_ID_RTBD", "Right Bounds") +#define STR_FONT_FEATURE_ID_RUBY NC_("STR_FONT_FEATURE_ID_RUBY", "Ruby Notation Forms") +#define STR_FONT_FEATURE_ID_SALT NC_("STR_FONT_FEATURE_ID_SALT", "Stylistic Alternates") +#define STR_FONT_FEATURE_ID_SINF NC_("STR_FONT_FEATURE_ID_SINF", "Scientific Inferiors") +#define STR_FONT_FEATURE_ID_SMCP NC_("STR_FONT_FEATURE_ID_SMCP", "Lowercase to Small Capitals") +#define STR_FONT_FEATURE_ID_SMPL NC_("STR_FONT_FEATURE_ID_SMPL", "Simplified Forms") +#define STR_FONT_FEATURE_ID_SSXX NC_("STR_FONT_FEATURE_ID_SSXX", "Stylistic Set %1") +#define STR_FONT_FEATURE_ID_SUBS NC_("STR_FONT_FEATURE_ID_SUBS", "Subscript") +#define STR_FONT_FEATURE_ID_SUPS NC_("STR_FONT_FEATURE_ID_SUPS", "Superscript") +#define STR_FONT_FEATURE_ID_SWSH NC_("STR_FONT_FEATURE_ID_SWSH", "Swash") +#define STR_FONT_FEATURE_ID_TITL NC_("STR_FONT_FEATURE_ID_TITL", "Titling") +#define STR_FONT_FEATURE_ID_TNAM NC_("STR_FONT_FEATURE_ID_TNAM", "Traditional Name Forms") +#define STR_FONT_FEATURE_ID_TNUM NC_("STR_FONT_FEATURE_ID_TNUM", "Tabular Numbers") +#define STR_FONT_FEATURE_ID_TRAD NC_("STR_FONT_FEATURE_ID_TRAD", "Traditional Forms") +#define STR_FONT_FEATURE_ID_TWID NC_("STR_FONT_FEATURE_ID_TWID", "Third Widths") +#define STR_FONT_FEATURE_ID_UNIC NC_("STR_FONT_FEATURE_ID_UNIC", "Unicase") +#define STR_FONT_FEATURE_ID_VALT NC_("STR_FONT_FEATURE_ID_VALT", "Alternate Vertical Metrics") +#define STR_FONT_FEATURE_ID_VHAL NC_("STR_FONT_FEATURE_ID_VHAL", "Alternate Vertical Half Metrics") +#define STR_FONT_FEATURE_ID_VKNA NC_("STR_FONT_FEATURE_ID_VKNA", "Vertical Kana Alternates") +#define STR_FONT_FEATURE_ID_VKRN NC_("STR_FONT_FEATURE_ID_VKRN", "Vertical Kerning") +#define STR_FONT_FEATURE_ID_VPAL NC_("STR_FONT_FEATURE_ID_VPAL", "Proportional Alternate Vertical Metrics") +#define STR_FONT_FEATURE_ID_VRT2 NC_("STR_FONT_FEATURE_ID_VRT2", "Vertical Alternates and Rotation") +#define STR_FONT_FEATURE_ID_VRTR NC_("STR_FONT_FEATURE_ID_VRTR", "Vertical Alternates for Rotation") +#define STR_FONT_FEATURE_ID_ZERO NC_("STR_FONT_FEATURE_ID_ZERO", "Slashed Zero") + +#endif // INCLUDED_VCL_INC_STRINGS_HRC + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/fontattributes.hxx b/vcl/inc/fontattributes.hxx new file mode 100644 index 000000000..352ea10e3 --- /dev/null +++ b/vcl/inc/fontattributes.hxx @@ -0,0 +1,126 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_FONTATTRIBUTES_HXX +#define INCLUDED_VCL_INC_FONTATTRIBUTES_HXX + +#include <vcl/dllapi.h> +#include <rtl/ustring.hxx> +#include <sal/log.hxx> +#include <tools/fontenum.hxx> + + +/* The following class is extraordinarily similar to ImplFont. */ + +class VCL_DLLPUBLIC FontAttributes +{ +public: + explicit FontAttributes(); + + // device independent font functions + const OUString& GetFamilyName() const { return maFamilyName; } + FontFamily GetFamilyType() const { return meFamily; } + const OUString& GetStyleName() const { return maStyleName; } + + FontWeight GetWeight() const { return meWeight; } + FontItalic GetItalic() const { return meItalic; } + FontPitch GetPitch() const { return mePitch; } + FontWidth GetWidthType() const { return meWidthType; } + rtl_TextEncoding GetCharSet() const { return meCharSet; } + + bool IsSymbolFont() const { return mbSymbolFlag; } + + void SetFamilyName(const OUString& sFamilyName) { maFamilyName = sFamilyName; } + void SetStyleName( const OUString& sStyleName) { maStyleName = sStyleName; } + void SetFamilyType(const FontFamily eFontFamily) { meFamily = eFontFamily; } + + void SetPitch(const FontPitch ePitch ) { mePitch = ePitch; } + void SetItalic(const FontItalic eItalic ) { meItalic = eItalic; } + void SetWeight(const FontWeight eWeight ) { meWeight = eWeight; } + void SetWidthType(const FontWidth eWidthType) { meWidthType = eWidthType; } + + void SetSymbolFlag(const bool ); + + bool CompareDeviceIndependentFontAttributes(const FontAttributes& rOther) const; + + // Device dependent functions + int GetQuality() const { return mnQuality; } + const OUString& GetMapNames() const { return maMapNames; } + + + void SetQuality( int nQuality ) { mnQuality = nQuality; } + void IncreaseQualityBy( int nQualityAmount ) { mnQuality += nQualityAmount; } + void AddMapName( OUString const& ); + +private: + // device independent variables + OUString maFamilyName; // Font Family Name + OUString maStyleName; // Font Style Name + FontWeight meWeight; // Weight Type + FontFamily meFamily; // Family Type + FontPitch mePitch; // Pitch Type + FontWidth meWidthType; // Width Type + FontItalic meItalic; // Slant Type + rtl_TextEncoding meCharSet; // RTL_TEXTENCODING_SYMBOL or RTL_TEXTENCODING_UNICODE + bool mbSymbolFlag; // Is font a symbol? + + // device dependent variables + OUString maMapNames; // List of family name aliases separated with ';' + int mnQuality; // Quality (used when similar fonts compete) + +}; + +inline void FontAttributes::SetSymbolFlag( const bool bSymbolFlag ) +{ + mbSymbolFlag = bSymbolFlag; + if ( bSymbolFlag ) + { + meCharSet = RTL_TEXTENCODING_SYMBOL; + } + else + { + // if the symbol flag is unset, but it was a symbol font before then + // until the character set encoding is set via SetCharSet then we + // can't know what the characterset is! + if ( meCharSet == RTL_TEXTENCODING_SYMBOL ) + { + meCharSet = RTL_TEXTENCODING_DONTKNOW; + } + } +} + +inline void FontAttributes::AddMapName( OUString const & aMapName ) +{ + if( maMapNames.getLength() > 0 ) + { + maMapNames += ";"; + } + + if (aMapName.getLength() == 0) + { + SAL_WARN("vcl.fonts", "New map name is empty"); + return; + } + + maMapNames += aMapName; +} + +#endif // INCLUDED_VCL_INC_FONTATTRIBUTES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/fontinstance.hxx new file mode 100644 index 000000000..4aff50c95 --- /dev/null +++ b/vcl/inc/fontinstance.hxx @@ -0,0 +1,126 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_FONTINSTANCE_HXX +#define INCLUDED_VCL_INC_FONTINSTANCE_HXX + +#include "fontselect.hxx" +#include "impfontmetricdata.hxx" + +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <rtl/ref.hxx> +#include <salhelper/simplereferenceobject.hxx> +#include <tools/gen.hxx> +#include <tools/fontenum.hxx> +#include <vcl/glyphitem.hxx> + +#include <optional> +#include <unordered_map> +#include <memory> + +#include <hb.h> + +class ConvertChar; +class ImplFontCache; +class PhysicalFontFace; + +// TODO: allow sharing of metrics for related fonts + +class VCL_PLUGIN_PUBLIC LogicalFontInstance : public salhelper::SimpleReferenceObject +{ + // just declaring the factory function doesn't work AKA + // friend LogicalFontInstance* PhysicalFontFace::CreateFontInstance(const FontSelectPattern&) const; + friend class PhysicalFontFace; + friend class ImplFontCache; + +public: // TODO: make data members private + virtual ~LogicalFontInstance() override; + + ImplFontMetricDataRef mxFontMetric; // Font attributes + const ConvertChar* mpConversion; // used e.g. for StarBats->StarSymbol + + long mnLineHeight; + short mnOwnOrientation; // text angle if lower layers don't rotate text themselves + short mnOrientation; // text angle in 3600 system + bool mbInit; // true if maFontMetric member is valid + + void AddFallbackForUnicode( sal_UCS4, FontWeight eWeight, const OUString& rFontName ); + bool GetFallbackForUnicode( sal_UCS4, FontWeight eWeight, OUString* pFontName ) const; + void IgnoreFallbackForUnicode( sal_UCS4, FontWeight eWeight, const OUString& rFontName ); + + inline hb_font_t* GetHbFont(); + bool IsGraphiteFont(); + void SetAverageWidthFactor(double nFactor) { m_nAveWidthFactor = std::abs(nFactor); } + double GetAverageWidthFactor() const { return m_nAveWidthFactor; } + const FontSelectPattern& GetFontSelectPattern() const { return m_aFontSelData; } + + const PhysicalFontFace* GetFontFace() const { return m_pFontFace.get(); } + PhysicalFontFace* GetFontFace() { return m_pFontFace.get(); } + const ImplFontCache* GetFontCache() const { return mpFontCache; } + + bool GetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const; + virtual bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const = 0; + + int GetKashidaWidth(); + + void GetScale(double* nXScale, double* nYScale); + static inline void DecodeOpenTypeTag(const uint32_t nTableTag, char* pTagName); + +protected: + explicit LogicalFontInstance(const PhysicalFontFace&, const FontSelectPattern&); + + virtual bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const = 0; + + // Takes ownership of pHbFace. + static hb_font_t* InitHbFont(hb_face_t* pHbFace); + virtual hb_font_t* ImplInitHbFont() { assert(false); return hb_font_get_empty(); } + +private: + // cache of Unicode characters and replacement font names + // TODO: a fallback map can be shared with many other ImplFontEntries + // TODO: at least the ones which just differ in orientation, stretching or height + typedef ::std::unordered_map< ::std::pair<sal_UCS4,FontWeight>, OUString > UnicodeFallbackList; + std::unique_ptr<UnicodeFallbackList> mpUnicodeFallbackList; + mutable ImplFontCache * mpFontCache; + const FontSelectPattern m_aFontSelData; + hb_font_t* m_pHbFont; + double m_nAveWidthFactor; + rtl::Reference<PhysicalFontFace> m_pFontFace; + std::optional<bool> m_xbIsGraphiteFont; +}; + +inline hb_font_t* LogicalFontInstance::GetHbFont() +{ + if (!m_pHbFont) + m_pHbFont = ImplInitHbFont(); + return m_pHbFont; +} + +inline void LogicalFontInstance::DecodeOpenTypeTag(const uint32_t nTableTag, char* pTagName) +{ + pTagName[0] = static_cast<char>(nTableTag >> 24); + pTagName[1] = static_cast<char>(nTableTag >> 16); + pTagName[2] = static_cast<char>(nTableTag >> 8); + pTagName[3] = static_cast<char>(nTableTag); + pTagName[4] = 0; +} + +#endif // INCLUDED_VCL_INC_FONTINSTANCE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/fontselect.hxx b/vcl/inc/fontselect.hxx new file mode 100644 index 000000000..7df7dd930 --- /dev/null +++ b/vcl/inc/fontselect.hxx @@ -0,0 +1,83 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_FONTSELECT_HXX +#define INCLUDED_VCL_INC_FONTSELECT_HXX + +#include <i18nlangtag/lang.h> +#include <vcl/vclenum.hxx> + +#include "fontattributes.hxx" + +#include <ostream> + +namespace vcl { class Font; } + +class LogicalFontInstance; +class PhysicalFontFace; +class Size; + +class VCL_DLLPUBLIC FontSelectPattern : public FontAttributes +{ +public: + FontSelectPattern(const vcl::Font&, const OUString& rSearchName, + const Size&, float fExactHeight, bool bNonAntialias = false); +#ifdef _WIN32 + FontSelectPattern( const PhysicalFontFace&, const Size&, + float fExactHeight, int nOrientation, bool bVertical ); +#endif + + size_t hashCode() const; + bool operator==(const FontSelectPattern& rOther) const; + bool operator!=(const FontSelectPattern& rOther) const + { + return !(*this == rOther); + } + + static const char FEAT_PREFIX; + static const char FEAT_SEPARATOR; + +public: + OUString maTargetName; // name of the font name token that is chosen + OUString maSearchName; // name of the font that matches best + int mnWidth; // width of font in pixel units + int mnHeight; // height of font in pixel units + float mfExactHeight; // requested height (in pixels with subpixel details) + int mnOrientation; // text orientation in 1/10 degree (0-3600) + LanguageType meLanguage; // text language + bool mbVertical; // vertical mode of requested font + bool mbNonAntialiased; // true if antialiasing is disabled + + bool mbEmbolden; // Force emboldening + ItalicMatrix maItalicMatrix; // Force matrix for slant +}; + +template< typename charT, typename traits > +inline std::basic_ostream<charT, traits> & operator <<( + std::basic_ostream<charT, traits> & stream, const FontSelectPattern & rFSP) +{ + stream << (rFSP.maTargetName.isEmpty() ? "<default>" : rFSP.maTargetName) + << " (" << rFSP.maSearchName << ") w: " << rFSP.mnWidth << " h: " + << rFSP.mnHeight << " alias: " << rFSP.mbNonAntialiased; + return stream; +} + +#endif // INCLUDED_VCL_INC_FONTSELECT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/fontsubset.hxx b/vcl/inc/fontsubset.hxx new file mode 100644 index 000000000..54fa20946 --- /dev/null +++ b/vcl/inc/fontsubset.hxx @@ -0,0 +1,94 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_FONTSUBSET_HXX +#define INCLUDED_VCL_INC_FONTSUBSET_HXX + +#include <rtl/ustring.hxx> +#include <tools/gen.hxx> +#include <o3tl/typed_flags_set.hxx> + +#include <vcl/dllapi.h> +#include <vcl/glyphitem.hxx> + +namespace vcl { struct TrueTypeFont; } ///< SFT's idea of a TTF font + +enum class FontType { + NO_FONT = 0, + SFNT_TTF = 1<<1, ///< SFNT container with TrueType glyphs + SFNT_CFF = 1<<2, ///< SFNT container with CFF-container + TYPE1_PFA = 1<<3, ///< PSType1 Postscript Font Ascii + TYPE1_PFB = 1<<4, ///< PSType1 Postscript Font Binary + CFF_FONT = 1<<5, ///< CFF-container with PSType2 glyphs + TYPE3_FONT = 1<<6, ///< PSType3 Postscript font + TYPE42_FONT = 1<<7, ///< PSType42 wrapper for an SFNT_TTF + ANY_SFNT = SFNT_TTF | SFNT_CFF, + ANY_TYPE1 = TYPE1_PFA | TYPE1_PFB +}; +namespace o3tl { + template<> struct typed_flags<FontType> : is_typed_flags<FontType, (1<<8)-1> {}; +} + +class VCL_DLLPUBLIC FontSubsetInfo final +{ +public: + explicit FontSubsetInfo(); + ~FontSubsetInfo(); + + void LoadFont( FontType eInFontType, + const unsigned char* pFontBytes, int nByteLength ); + void LoadFont( vcl::TrueTypeFont* pSftTrueTypeFont ); + + bool CreateFontSubset( FontType nOutFontTypeMask, + FILE* pOutFile, const char* pOutFontName, + const sal_GlyphId* pGlyphIds, const sal_uInt8* pEncodedIds, + int nReqGlyphCount, sal_Int32* pOutGlyphWidths = nullptr ); + +public: // TODO: make subsetter results private and provide accessor methods instead + // subsetter-provided subset details needed by e.g. Postscript or PDF + OUString m_aPSName; + int m_nAscent; ///< all metrics in PS font units + int m_nDescent; + int m_nCapHeight; + tools::Rectangle m_aFontBBox; + FontType m_nFontType; ///< font-type of subset result + +private: + // input-font-specific details + unsigned const char* mpInFontBytes; + int mnInByteLength; + FontType meInFontType; ///< allowed mask of input font-types + vcl::TrueTypeFont* mpSftTTFont; + + // subset-request details + FontType mnReqFontTypeMask; ///< allowed subset-target font types + FILE* mpOutFile; + const char* mpReqFontName; + const sal_GlyphId* mpReqGlyphIds; + const sal_uInt8* mpReqEncodedIds; + int mnReqGlyphCount; + + bool CreateFontSubsetFromCff( sal_Int32* pOutGlyphWidths ); + bool CreateFontSubsetFromSfnt( sal_Int32* pOutGlyphWidths ); + static bool CreateFontSubsetFromType1( const sal_Int32* pOutGlyphWidths ); +}; + +#endif // INCLUDED_VCL_INC_FONTSUBSET_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/graphic/DetectorTools.hxx b/vcl/inc/graphic/DetectorTools.hxx new file mode 100644 index 000000000..3847457fc --- /dev/null +++ b/vcl/inc/graphic/DetectorTools.hxx @@ -0,0 +1,61 @@ +/* -*- 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/. + * + */ + +#pragma once + +namespace vcl +{ +const char* matchArray(const char* pSource, sal_Int32 nSourceSize, const char* pSearch, + sal_Int32 nSearchSize) +{ + for (sal_Int32 increment = 0; increment <= (nSourceSize - nSearchSize); ++increment) + { + bool bMatch = true; + // search both arrays if they match + for (sal_Int32 index = 0; index < nSearchSize && bMatch; ++index) + { + if (pSource[index] != pSearch[index]) + bMatch = false; + } + // match has been found + if (bMatch) + return pSource; + pSource++; + } + return nullptr; +} + +const char* matchArrayWithString(const char* pSource, sal_Int32 nSourceSize, OString const& rString) +{ + return matchArray(pSource, nSourceSize, rString.getStr(), rString.getLength()); +} + +bool checkArrayForMatchingStrings(const char* pSource, sal_Int32 nSourceSize, + std::vector<OString> const& rStrings) +{ + if (rStrings.empty()) + return false; + if (rStrings.size() < 2) + return matchArrayWithString(pSource, nSourceSize, rStrings[0]) != nullptr; + + const char* pBegin = pSource; + const char* pCurrent = pSource; + for (OString const& rString : rStrings) + { + sal_Int32 nCurrentSize = nSourceSize - sal_Int32(pCurrent - pBegin); + pCurrent = matchArray(pCurrent, nCurrentSize, rString.getStr(), rString.getLength()); + if (pCurrent == nullptr) + return false; + } + return true; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/graphic/GraphicFormatDetector.hxx b/vcl/inc/graphic/GraphicFormatDetector.hxx new file mode 100644 index 000000000..e914ee64a --- /dev/null +++ b/vcl/inc/graphic/GraphicFormatDetector.hxx @@ -0,0 +1,76 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_GRAPHICFORMATDETECTOR_HXX +#define INCLUDED_VCL_INC_GRAPHICFORMATDETECTOR_HXX + +#include <tools/stream.hxx> +#include <vector> + +VCL_DLLPUBLIC bool ImpPeekGraphicFormat(SvStream& rStream, OUString& rFormatExtension, bool bTest); + +namespace vcl +{ +class VCL_DLLPUBLIC GraphicFormatDetector +{ +public: + SvStream& mrStream; + OUString maExtension; + + std::vector<sal_uInt8> maFirstBytes; + sal_uInt32 mnFirstLong; + sal_uInt32 mnSecondLong; + + sal_uInt64 mnStreamPosition; + sal_uInt64 mnStreamLength; + + OUString msDetectedFormat; + + GraphicFormatDetector(SvStream& rStream, OUString const& rFormatExtension); + + bool detect(); + + bool checkMET(); + bool checkBMP(); + bool checkWMForEMF(); + bool checkPCX(); + bool checkTIF(); + bool checkGIF(); + bool checkPNG(); + bool checkJPG(); + bool checkSVM(); + bool checkPCD(); + bool checkPSD(); + bool checkEPS(); + bool checkDXF(); + bool checkPCT(); + bool checkPBMorPGMorPPM(); + bool checkRAS(); + bool checkXPM(); + bool checkXBM(); + bool checkSVG(); + bool checkTGA(); + bool checkMOV(); + bool checkPDF(); +}; +} + +#endif // INCLUDED_VCL_INC_GRAPHICFORMATDETECTOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/graphic/GraphicID.hxx b/vcl/inc/graphic/GraphicID.hxx new file mode 100644 index 000000000..87ac6a50f --- /dev/null +++ b/vcl/inc/graphic/GraphicID.hxx @@ -0,0 +1,47 @@ +/* -*- 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 <vcl/dllapi.h> +#include <rtl/string.hxx> +#include <vcl/checksum.hxx> + +class ImpGraphic; + +class GraphicID +{ +private: + sal_uInt32 mnID1; + sal_uInt32 mnID2; + sal_uInt32 mnID3; + BitmapChecksum mnID4; + +public: + GraphicID(ImpGraphic const& rGraphic); + + bool operator==(const GraphicID& rID) const + { + return rID.mnID1 == mnID1 && rID.mnID2 == mnID2 && rID.mnID3 == mnID3 && rID.mnID4 == mnID4; + } + + OString getIDString() const; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/graphic/GraphicReader.hxx b/vcl/inc/graphic/GraphicReader.hxx new file mode 100644 index 000000000..9576d4253 --- /dev/null +++ b/vcl/inc/graphic/GraphicReader.hxx @@ -0,0 +1,40 @@ +/* -*- 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 <vcl/dllapi.h> +#include <rtl/ustring.hxx> +#include <tools/gen.hxx> +#include <memory> + +class GraphicReader +{ +public: + virtual ~GraphicReader(); + + const OUString& GetUpperFilterName() const { return maUpperName; } + +protected: + OUString maUpperName; + + GraphicReader(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/graphic/Manager.hxx b/vcl/inc/graphic/Manager.hxx new file mode 100644 index 000000000..bb52a0cfc --- /dev/null +++ b/vcl/inc/graphic/Manager.hxx @@ -0,0 +1,76 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_GRAPHIC_MANAGER_HXX +#define INCLUDED_VCL_INC_GRAPHIC_MANAGER_HXX + +#include <sal/types.h> +#include <rtl/ustring.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/animate/Animation.hxx> +#include <vcl/vectorgraphicdata.hxx> +#include <vcl/timer.hxx> +#include <vcl/GraphicExternalLink.hxx> + +#include <memory> +#include <mutex> +#include <chrono> +#include <o3tl/sorted_vector.hxx> + +class ImpGraphic; + +namespace vcl +{ +namespace graphic +{ +class Manager final +{ +private: + std::recursive_mutex maMutex; // instead of SolarMutex because graphics can live past vcl main + o3tl::sorted_vector<ImpGraphic*> m_pImpGraphicList; + std::chrono::seconds mnAllowedIdleTime; + bool mbSwapEnabled; + sal_Int64 mnMemoryLimit; + sal_Int64 mnUsedSize; + Timer maSwapOutTimer; + + Manager(); + + void registerGraphic(const std::shared_ptr<ImpGraphic>& rImpGraphic, OUString const& rsContext); + + DECL_LINK(SwapOutTimerHandler, Timer*, void); + + static sal_Int64 getGraphicSizeBytes(const ImpGraphic* pImpGraphic); + +public: + static Manager& get(); + + void swappedIn(const ImpGraphic* pImpGraphic); + void swappedOut(const ImpGraphic* pImpGraphic); + + void reduceGraphicMemory(); + void changeExisting(const ImpGraphic* pImpGraphic, sal_Int64 nOldSize); + void unregisterGraphic(ImpGraphic* pImpGraphic); + + std::shared_ptr<ImpGraphic> copy(std::shared_ptr<ImpGraphic> const& pImpGraphic); + std::shared_ptr<ImpGraphic> newInstance(); + std::shared_ptr<ImpGraphic> newInstance(const Bitmap& rBitmap); + std::shared_ptr<ImpGraphic> newInstance(const BitmapEx& rBitmapEx); + std::shared_ptr<ImpGraphic> + newInstance(const std::shared_ptr<VectorGraphicData>& rVectorGraphicDataPtr); + std::shared_ptr<ImpGraphic> newInstance(const Animation& rAnimation); + std::shared_ptr<ImpGraphic> newInstance(const GDIMetaFile& rMtf); + std::shared_ptr<ImpGraphic> newInstance(const GraphicExternalLink& rGraphicLink); +}; +} +} // end namespace vcl::graphic + +#endif // INCLUDED_VCL_INC_GRAPHIC_MANAGER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/graphic/UnoGraphic.hxx b/vcl/inc/graphic/UnoGraphic.hxx new file mode 100644 index 000000000..f6eed8fab --- /dev/null +++ b/vcl/inc/graphic/UnoGraphic.hxx @@ -0,0 +1,82 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_SOURCE_GRAPHIC_GRAPHIC_HXX +#define INCLUDED_VCL_SOURCE_GRAPHIC_GRAPHIC_HXX + +#include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/awt/XBitmap.hpp> + +#include <graphic/UnoGraphicDescriptor.hxx> +#include <graphic/UnoGraphicTransformer.hxx> + +#include <vcl/graph.hxx> + +namespace unographic { + +class Graphic final : public css::graphic::XGraphic, + public css::awt::XBitmap, + public css::lang::XUnoTunnel, + public ::unographic::GraphicDescriptor, + public ::unographic::GraphicTransformer +{ +public: + Graphic(); + virtual ~Graphic() throw() override; + + using ::unographic::GraphicDescriptor::init; + void init( const ::Graphic& rGraphic ) throw(); + +private: + + // XInterface + virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() throw() override; + virtual void SAL_CALL release() throw() override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override; + + // XGraphic + virtual ::sal_Int8 SAL_CALL getType( ) override; + + // XBitmap + virtual css::awt::Size SAL_CALL getSize( ) override; + virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL getDIB( ) override; + virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL getMaskDIB( ) override; + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rId ) override; + + ::Graphic maGraphic; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/graphic/UnoGraphicDescriptor.hxx b/vcl/inc/graphic/UnoGraphicDescriptor.hxx new file mode 100644 index 000000000..ad46952ce --- /dev/null +++ b/vcl/inc/graphic/UnoGraphicDescriptor.hxx @@ -0,0 +1,121 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_SOURCE_GRAPHIC_DESCRIPTOR_HXX +#define INCLUDED_VCL_SOURCE_GRAPHIC_DESCRIPTOR_HXX + +#include <comphelper/propertysethelper.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> + +#include <cppuhelper/weakagg.hxx> +#include <comphelper/propertysetinfo.hxx> +#include <vcl/graph.hxx> + +#define MIMETYPE_BMP "image/x-MS-bmp" +#define MIMETYPE_GIF "image/gif" +#define MIMETYPE_JPG "image/jpeg" +#define MIMETYPE_PCD "image/x-photo-cd" +#define MIMETYPE_PCX "image/x-pcx" +#define MIMETYPE_PNG "image/png" +#define MIMETYPE_TIF "image/tiff" +#define MIMETYPE_XBM "image/x-xbitmap" +#define MIMETYPE_XPM "image/x-xpixmap" +#define MIMETYPE_PBM "image/x-portable-bitmap" +#define MIMETYPE_PGM "image/x-portable-graymap" +#define MIMETYPE_PPM "image/x-portable-pixmap" +#define MIMETYPE_RAS "image/x-cmu-raster" +#define MIMETYPE_TGA "image/x-targa" +#define MIMETYPE_PSD "image/vnd.adobe.photoshop" +#define MIMETYPE_EPS "image/x-eps" +#define MIMETYPE_DXF "image/vnd.dxf" +#define MIMETYPE_MET "image/x-met" +#define MIMETYPE_PCT "image/x-pict" +#define MIMETYPE_SVM "image/x-svm" +#define MIMETYPE_WMF "image/x-wmf" +#define MIMETYPE_EMF "image/x-emf" +#define MIMETYPE_SVG "image/svg+xml" +#define MIMETYPE_PDF "application/pdf" +#define MIMETYPE_VCLGRAPHIC "image/x-vclgraphic" + +namespace comphelper { class PropertySetInfo; } +namespace com::sun::star::io { class XInputStream; } + +class Graphic; + +namespace unographic { + +class GraphicDescriptor : public ::cppu::OWeakAggObject, + public css::lang::XServiceInfo, + public css::lang::XTypeProvider, + public ::comphelper::PropertySetHelper +{ +public: + + GraphicDescriptor(); + virtual ~GraphicDescriptor() throw() override; + + void init( const ::Graphic& rGraphic ); + void init( const OUString& rURL ); + void init( const css::uno::Reference< css::io::XInputStream >& rxIStm, const OUString& rURL ); + +protected: + + static rtl::Reference<::comphelper::PropertySetInfo> createPropertySetInfo(); + + // XInterface + virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() throw() override; + virtual void SAL_CALL release() throw() override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override; + + // PropertySetHelper + virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const css::uno::Any* pValues ) override; + virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, css::uno::Any* pValue ) override; + +private: + + const ::Graphic* mpGraphic; + GraphicType meType; + OUString maMimeType; + Size maSizePixel; + Size maSize100thMM; + sal_uInt16 mnBitsPerPixel; + bool mbTransparent; + + GraphicDescriptor( const GraphicDescriptor& rDescriptor ) = delete; + + GraphicDescriptor& operator=( const GraphicDescriptor& ) = delete; + + void implCreate( SvStream& rIStm, const OUString* pPath ); +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/graphic/UnoGraphicTransformer.hxx b/vcl/inc/graphic/UnoGraphicTransformer.hxx new file mode 100644 index 000000000..785efdcd1 --- /dev/null +++ b/vcl/inc/graphic/UnoGraphicTransformer.hxx @@ -0,0 +1,58 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_SOURCE_GRAPHIC_TRANSFORMER_HXX +#define INCLUDED_VCL_SOURCE_GRAPHIC_TRANSFORMER_HXX + +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/graphic/XGraphicTransformer.hpp> + +namespace unographic { + + +typedef ::cppu::WeakAggImplHelper1< + css::graphic::XGraphicTransformer + > GraphicTransformer_UnoImplHelper1; +class GraphicTransformer : public GraphicTransformer_UnoImplHelper1 +{ + public: + + GraphicTransformer(); + virtual ~GraphicTransformer() override; + + // XGraphicTransformer + virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL colorChange( + const css::uno::Reference< css::graphic::XGraphic >& rGraphic, + sal_Int32 nColorFrom, sal_Int8 nTolerance, sal_Int32 nColorTo, sal_Int8 nAlphaTo ) override; + + virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL applyDuotone( + const css::uno::Reference< css::graphic::XGraphic >& rGraphic, + sal_Int32 nColorOne, sal_Int32 nColorTwo ) override; + + virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL applyBrightnessContrast( + const css::uno::Reference< css::graphic::XGraphic >& rxGraphic, + sal_Int32 nBrightness, sal_Int32 nContrast, sal_Bool mso ) override; + +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/headless/CustomWidgetDraw.hxx b/vcl/inc/headless/CustomWidgetDraw.hxx new file mode 100644 index 000000000..f30488ca8 --- /dev/null +++ b/vcl/inc/headless/CustomWidgetDraw.hxx @@ -0,0 +1,56 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_CUSTOMWIDGETDRAW_HXX +#define INCLUDED_VCL_INC_CUSTOMWIDGETDRAW_HXX + +#include <vcl/dllapi.h> +#include <WidgetDrawInterface.hxx> +#include <WidgetThemeLibrary.hxx> +#include <headless/svpgdi.hxx> +#include <vcl/settings.hxx> + +namespace vcl +{ +class CustomWidgetDraw final : public vcl::WidgetDrawInterface +{ +private: + static WidgetThemeLibrary* s_pWidgetImplementation; + SvpSalGraphics& m_rGraphics; + +public: + CustomWidgetDraw(SvpSalGraphics& rGraphics); + ~CustomWidgetDraw() override; + + bool isNativeControlSupported(ControlType eType, ControlPart ePart) override; + + bool hitTestNativeControl(ControlType eType, ControlPart ePart, + const tools::Rectangle& rBoundingControlRegion, const Point& aPos, + bool& rIsInside) override; + + bool drawNativeControl(ControlType eType, ControlPart ePart, + const tools::Rectangle& rBoundingControlRegion, ControlState eState, + const ImplControlValue& aValue, const OUString& aCaptions, + const Color& rBackgroundColor) override; + + bool getNativeControlRegion(ControlType eType, ControlPart ePart, + const tools::Rectangle& rBoundingControlRegion, ControlState eState, + const ImplControlValue& aValue, const OUString& aCaption, + tools::Rectangle& rNativeBoundingRegion, + tools::Rectangle& rNativeContentRegion) override; + + bool updateSettings(AllSettings& rSettings) override; +}; + +} // end vcl namespace + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/headless/svpbmp.hxx b/vcl/inc/headless/svpbmp.hxx new file mode 100644 index 000000000..1551fc844 --- /dev/null +++ b/vcl/inc/headless/svpbmp.hxx @@ -0,0 +1,89 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_HEADLESS_SVPBMP_HXX +#define INCLUDED_VCL_INC_HEADLESS_SVPBMP_HXX + +#include <sal/config.h> + +#include <salbmp.hxx> +#include <basegfx/utils/systemdependentdata.hxx> + +class VCL_DLLPUBLIC SvpSalBitmap final : public SalBitmap, public basegfx::SystemDependentDataHolder // MM02 +{ + std::unique_ptr<BitmapBuffer> mpDIB; +public: + SvpSalBitmap(); + virtual ~SvpSalBitmap() override; + + // SalBitmap + 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; + void Create(std::unique_ptr<BitmapBuffer> pBuf); + const BitmapBuffer* GetBuffer() const + { + return mpDIB.get(); + } + 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_uInt8 nTol ) override; + + // MM02 exclusive management op's for SystemDependentData at WinSalBitmap + template<class T> + std::shared_ptr<T> getSystemDependentData() const + { + return std::static_pointer_cast<T>(basegfx::SystemDependentDataHolder::getSystemDependentData(typeid(T).hash_code())); + } + + template<class T, class... Args> + std::shared_ptr<T> addOrReplaceSystemDependentData(basegfx::SystemDependentDataManager& manager, Args&&... args) const + { + std::shared_ptr<T> r = std::make_shared<T>(manager, std::forward<Args>(args)...); + + // tdf#129845 only add to buffer if a relevant buffer time is estimated + if(r->calculateCombinedHoldCyclesInSeconds() > 0) + { + basegfx::SystemDependentData_SharedPtr r2(r); + const_cast< SvpSalBitmap* >(this)->basegfx::SystemDependentDataHolder::addOrReplaceSystemDependentData(r2); + } + + return r; + } +}; + +#endif // INCLUDED_VCL_INC_HEADLESS_SVPBMP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/headless/svpcairotextrender.hxx b/vcl/inc/headless/svpcairotextrender.hxx new file mode 100644 index 000000000..35744d5a2 --- /dev/null +++ b/vcl/inc/headless/svpcairotextrender.hxx @@ -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/. + */ + +#ifndef INCLUDED_VCL_UNX_GTK3_GDI_GTK3CAIROTEXTRENDER_HXX +#define INCLUDED_VCL_UNX_GTK3_GDI_GTK3CAIROTEXTRENDER_HXX + +#include <unx/cairotextrender.hxx> + +class SvpSalGraphics; + +class SvpCairoTextRender final : public CairoTextRender +{ + SvpSalGraphics& mrParent; + +public: + explicit SvpCairoTextRender(SvpSalGraphics& rParent); + + virtual cairo_t* getCairoContext() override; + virtual void getSurfaceOffset(double& nDX, double& nDY) override; + virtual void clipRegion(cairo_t* cr) override; + virtual void releaseCairoContext(cairo_t* cr) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/headless/svpdummies.hxx b/vcl/inc/headless/svpdummies.hxx new file mode 100644 index 000000000..51007916b --- /dev/null +++ b/vcl/inc/headless/svpdummies.hxx @@ -0,0 +1,64 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_HEADLESS_SVPDUMMIES_HXX +#define INCLUDED_VCL_INC_HEADLESS_SVPDUMMIES_HXX + +#include <vcl/sysdata.hxx> +#include <unx/gensys.h> +#include <salobj.hxx> + +class SalGraphics; + +class SvpSalObject final : public SalObject +{ +public: + SystemEnvData m_aSystemChildData; + + virtual ~SvpSalObject() override; + + // override all pure virtual methods + virtual void ResetClipRegion() override; + virtual void BeginSetClipRegion( sal_uInt32 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 const SystemEnvData* GetSystemData() const override; +}; + +class SvpSalSystem : public SalGenericSystem +{ +public: + SvpSalSystem() {} + virtual ~SvpSalSystem() override; + // get info about the display + virtual unsigned int GetDisplayScreenCount() override; + virtual tools::Rectangle GetDisplayScreenPosSizePixel( unsigned int nScreen ) override; + + virtual int ShowNativeDialog( const OUString& rTitle, + const OUString& rMessage, + const std::vector< OUString >& rButtons ) override; +}; + +#endif // INCLUDED_VCL_INC_HEADLESS_SVPDUMMIES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/headless/svpframe.hxx b/vcl/inc/headless/svpframe.hxx new file mode 100644 index 000000000..7245a31d5 --- /dev/null +++ b/vcl/inc/headless/svpframe.hxx @@ -0,0 +1,124 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_HEADLESS_SVPFRAME_HXX +#define INCLUDED_VCL_INC_HEADLESS_SVPFRAME_HXX + +#include <vcl/sysdata.hxx> + +#include <salframe.hxx> + +#include <list> +#include <vector> + +#ifdef IOS +#define SvpSalInstance AquaSalInstance +#define SvpSalGraphics AquaSalGraphics +#endif + +class SvpSalInstance; +class SvpSalGraphics; + +class SvpSalFrame : public SalFrame +{ + SvpSalInstance* m_pInstance; + SvpSalFrame* m_pParent; // pointer to parent frame + std::list< SvpSalFrame* > m_aChildren; // List of child frames + SalFrameStyleFlags m_nStyle; + bool m_bVisible; +#ifndef IOS + cairo_surface_t* m_pSurface; +#endif + long m_nMinWidth; + long m_nMinHeight; + long m_nMaxWidth; + long m_nMaxHeight; + + SystemEnvData m_aSystemChildData; + + std::vector< SvpSalGraphics* > m_aGraphics; + + static SvpSalFrame* s_pFocusFrame; +public: + SvpSalFrame( SvpSalInstance* pInstance, + SalFrame* pParent, + SalFrameStyleFlags nSalFrameStyle ); + virtual ~SvpSalFrame() override; + + void GetFocus(); + void LoseFocus(); + void PostPaint() const; + + // SalFrame + virtual SalGraphics* AcquireGraphics() override; + virtual void ReleaseGraphics( SalGraphics* pGraphics ) override; + + virtual bool PostEvent(std::unique_ptr<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; + using SalFrame::Flush; + virtual void Flush() 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_uInt32 nRects ) override; + virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) override; + virtual void EndSetClipRegion() override; + + /*TODO: functional implementation */ + virtual void SetScreenNumber( unsigned int ) override {} + virtual void SetApplicationID(const OUString &) override {} + +}; + +#endif // INCLUDED_VCL_INC_HEADLESS_SVPFRAME_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx new file mode 100644 index 000000000..3d1617d07 --- /dev/null +++ b/vcl/inc/headless/svpgdi.hxx @@ -0,0 +1,287 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_HEADLESS_SVPGDI_HXX +#define INCLUDED_VCL_INC_HEADLESS_SVPGDI_HXX + +#ifdef IOS +#error This file is not for iOS +#endif + +#include <config_features.h> + +#include <osl/endian.h> +#include <vcl/sysdata.hxx> +#include <config_cairo_canvas.h> + +#include <salgdi.hxx> +#include <sallayout.hxx> +#include "svpcairotextrender.hxx" +#include <impfontmetricdata.hxx> + +#include <cairo.h> + +//Using formats that match cairo's formats. For android we patch cairo, +//which is internal in that case, to swap the rgb components so that +//cairo then matches the OpenGL GL_RGBA format so we can use it there +//where we don't have GL_BGRA support. +// SVP_24BIT_FORMAT is used to store 24-bit images in 3-byte pixels to conserve memory. +#if defined(ANDROID) && !HAVE_FEATURE_ANDROID_LOK +# define SVP_24BIT_FORMAT (ScanlineFormat::N24BitTcRgb | ScanlineFormat::TopDown) +# define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcRgba | ScanlineFormat::TopDown) +# define SVP_CAIRO_BLUE 1 +# define SVP_CAIRO_GREEN 2 +# define SVP_CAIRO_RED 0 +# define SVP_CAIRO_ALPHA 3 +#elif defined OSL_BIGENDIAN +# define SVP_24BIT_FORMAT (ScanlineFormat::N24BitTcRgb | ScanlineFormat::TopDown) +# define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcArgb | ScanlineFormat::TopDown) +# define SVP_CAIRO_BLUE 3 +# define SVP_CAIRO_GREEN 2 +# define SVP_CAIRO_RED 1 +# define SVP_CAIRO_ALPHA 0 +#else +# define SVP_24BIT_FORMAT (ScanlineFormat::N24BitTcBgr | ScanlineFormat::TopDown) +# define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcBgra | ScanlineFormat::TopDown) +# define SVP_CAIRO_BLUE 0 +# define SVP_CAIRO_GREEN 1 +# define SVP_CAIRO_RED 2 +# define SVP_CAIRO_ALPHA 3 +#endif + +struct BitmapBuffer; +class FreetypeFont; +typedef struct _cairo cairo_t; +typedef struct _cairo_surface cairo_surface_t; +typedef struct _cairo_user_data_key cairo_user_data_key_t; + +VCL_DLLPUBLIC void dl_cairo_surface_set_device_scale(cairo_surface_t *surface, double x_scale, double y_scale); +VCL_DLLPUBLIC void dl_cairo_surface_get_device_scale(cairo_surface_t *surface, double *x_scale, double *y_scale); + +enum class PaintMode { Over, Xor }; + +typedef void (*damageHandler)(void* handle, + sal_Int32 nExtentsX, sal_Int32 nExtentsY, + sal_Int32 nExtentsWidth, sal_Int32 nExtentsHeight); + +struct VCL_DLLPUBLIC DamageHandler +{ + void *handle; + damageHandler damaged; +}; + +class VCL_DLLPUBLIC SvpSalGraphics : public SalGraphics +{ + cairo_surface_t* m_pSurface; + basegfx::B2IVector m_aFrameSize; + double m_fScale; + Color m_aLineColor; + Color m_aFillColor; + PaintMode m_ePaintMode; + +public: + void setSurface(cairo_surface_t* pSurface, const basegfx::B2IVector& rSize); + cairo_surface_t* getSurface() const { return m_pSurface; } + static cairo_user_data_key_t* getDamageKey(); + + static void clipRegion(cairo_t* cr, const vcl::Region& rClipRegion); + + // need this static version of ::drawPolyLine for usage from + // vcl/unx/generic/gdi/salgdi.cxx. It gets wrapped by + // ::drawPolyLine with some added parameters (see there) + static bool drawPolyLine( + cairo_t* cr, + basegfx::B2DRange* pExtents, + const Color& rLineColor, + bool bAntiAliasB2DDraw, + const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolygon& rPolyLine, + double fTransparency, + double fLineWidth, + const std::vector< double >* pStroke, // MM01 + basegfx::B2DLineJoin eLineJoin, + css::drawing::LineCap eLineCap, + double fMiterMinimumAngle, + bool bPixelSnapHairline); + + void copySource(const SalTwoRect& rTR, cairo_surface_t* source); + void copyWithOperator(const SalTwoRect& rTR, cairo_surface_t* source, + cairo_operator_t eOp = CAIRO_OPERATOR_SOURCE); + +private: + void invert(const basegfx::B2DPolygon &rPoly, SalInvert nFlags); + void applyColor(cairo_t *cr, Color rColor, double fTransparency = 0.0); + +protected: + vcl::Region m_aClipRegion; + SvpCairoTextRender m_aTextRenderImpl; + +protected: + 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; + virtual 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; + + cairo_t* createTmpCompatibleCairoContext() const; + +public: + SvpSalGraphics(); + virtual ~SvpSalGraphics() override; + + virtual SalGraphicsImpl* GetImpl() const override { return nullptr; }; + virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) override; + virtual sal_uInt16 GetBitCount() const override; + virtual long GetGraphicsWidth() const override; + + virtual void ResetClipRegion() override; + virtual bool setClipRegion( const vcl::Region& ) override; + + virtual void SetLineColor() override; + virtual void SetLineColor( Color nColor ) override; + virtual void SetFillColor() override; + virtual void SetFillColor( Color nColor ) override; + + virtual void SetXORMode( bool bSet, bool ) override; + + virtual void SetROPLineColor( SalROPColor nROPColor ) override; + virtual void SetROPFillColor( SalROPColor nROPColor ) override; + + virtual void SetTextColor( Color nColor ) override; + virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) override; + virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override; + virtual 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*, + const sal_GlyphId* pGlyphIds, + const sal_uInt8* pEncoding, + sal_Int32* pWidths, + int nGlyphs, + FontSubsetInfo& rInfo + ) 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 std::unique_ptr<GenericSalLayout> + GetTextLayout(int nFallbackLevel) override; + virtual void DrawTextLayout( const GenericSalLayout& ) override; + virtual bool supportsOperation( OutDevSupportType ) const override; + virtual void drawPixel( long nX, long nY ) override; + virtual void drawPixel( long nX, long nY, Color nColor ) 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 bool drawPolyPolygon( + const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolyPolygon&, + double fTransparency ) override; + + virtual bool drawPolyLine( + const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolygon&, + double fTransparency, + double fLineWidth, + const std::vector< double >* pStroke, // MM01 + basegfx::B2DLineJoin, + css::drawing::LineCap, + double fMiterMinimumAngle, + bool bPixelSnapHairline) 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 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 drawGradient( const tools::PolyPolygon&, const Gradient& ) override { return false; }; + + virtual bool implDrawGradient(basegfx::B2DPolyPolygon const & rPolyPolygon, SalGradient const & rGradient) 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; + void drawBitmap( const SalTwoRect& rPosAry, + const BitmapBuffer* pBuffer, + cairo_operator_t eOp ); + virtual void drawBitmap( const SalTwoRect& rPosAry, + const SalBitmap& rSalBitmap, + const SalBitmap& rTransparentBitmap ) override; + virtual void drawMask( const SalTwoRect& rPosAry, + const SalBitmap& rSalBitmap, + Color nMaskColor ) override; + virtual std::shared_ptr<SalBitmap> getBitmap( long nX, long nY, long nWidth, long nHeight ) override; + virtual Color 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_uInt32 nSize ) override; + + virtual SystemGraphicsData GetGraphicsData() const override; + + virtual OUString getRenderBackendName() const override { return "svp"; } + +#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 + + cairo_t* getCairoContext(bool bXorModeAllowed) const; + void releaseCairoContext(cairo_t* cr, bool bXorModeAllowed, const basegfx::B2DRange& rExtents) const; + static cairo_surface_t* createCairoSurface(const BitmapBuffer *pBuffer); + void clipRegion(cairo_t* cr); +}; + +#endif // INCLUDED_VCL_INC_HEADLESS_SVPGDI_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/headless/svpinst.hxx b/vcl/inc/headless/svpinst.hxx new file mode 100644 index 000000000..ef20f0cab --- /dev/null +++ b/vcl/inc/headless/svpinst.hxx @@ -0,0 +1,195 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_HEADLESS_SVPINST_HXX +#define INCLUDED_VCL_INC_HEADLESS_SVPINST_HXX + +#include <osl/thread.hxx> +#include <osl/conditn.hxx> +#include <salinst.hxx> +#include <saltimer.hxx> +#include <salusereventlist.hxx> +#include <unx/geninst.h> +#include <unx/genprn.h> + +#include <condition_variable> + +#include <sys/time.h> + +#define VIRTUAL_DESKTOP_WIDTH 1024 +#define VIRTUAL_DESKTOP_HEIGHT 768 + +#ifdef IOS +#define SvpSalInstance AquaSalInstance +#endif + +class SvpSalInstance; +class SvpSalTimer final : public SalTimer +{ + SvpSalInstance* m_pInstance; +public: + SvpSalTimer( SvpSalInstance* pInstance ) : m_pInstance( pInstance ) {} + virtual ~SvpSalTimer() override; + + // override all pure virtual methods + virtual void Start( sal_uInt64 nMS ) override; + virtual void Stop() override; +}; + +class SvpSalFrame; +class GenPspGraphics; + +enum class SvpRequest +{ + NONE, + MainThreadDispatchOneEvent, + MainThreadDispatchAllEvents, +}; + +class SvpSalYieldMutex final : public SalYieldMutex +{ +private: + // note: these members might as well live in SvpSalInstance, but there is + // at least one subclass of SvpSalInstance (GTK3) that doesn't use them. + friend class SvpSalInstance; + // members for communication from main thread to non-main thread + int m_FeedbackFDs[2]; + osl::Condition m_NonMainWaitingYieldCond; + // members for communication from non-main thread to main thread + bool m_bNoYieldLock = false; // accessed only on main thread + std::mutex m_WakeUpMainMutex; // guard m_wakeUpMain & m_Request + std::condition_variable m_WakeUpMainCond; + bool m_wakeUpMain = false; + SvpRequest m_Request = SvpRequest::NONE; + + virtual void doAcquire( sal_uInt32 nLockCount ) override; + virtual sal_uInt32 doRelease( bool bUnlockAll ) override; + +public: + SvpSalYieldMutex(); + virtual ~SvpSalYieldMutex() override; + + virtual bool IsCurrentThread() const override; +}; + +SalInstance* svp_create_SalInstance(); + +// NOTE: the functions IsMainThread, DoYield and Wakeup *require* the use of +// SvpSalYieldMutex; if a subclass uses something else it must override these +// (Wakeup is only called by SvpSalTimer and SvpSalFrame) +class VCL_DLLPUBLIC SvpSalInstance : public SalGenericInstance, public SalUserEventList +{ + timeval m_aTimeout; + sal_uLong m_nTimeoutMS; + oslThreadIdentifier m_MainThread; + + virtual void TriggerUserEventProcessing() override; + virtual void ProcessEvent( SalUserEvent aEvent ) override; + +public: + static SvpSalInstance* s_pDefaultInstance; + + SvpSalInstance( std::unique_ptr<SalYieldMutex> pMutex ); + virtual ~SvpSalInstance() override; + + void CloseWakeupPipe(bool log); + void CreateWakeupPipe(bool log); + void Wakeup(SvpRequest request = SvpRequest::NONE); + + void StartTimer( sal_uInt64 nMS ); + void StopTimer(); + + inline void registerFrame( SalFrame* pFrame ); + inline void deregisterFrame( SalFrame* pFrame ); + + bool CheckTimeout( bool bExecuteTimers = true ); + + // Frame + virtual SalFrame* CreateChildFrame( SystemParentData* pParent, SalFrameStyleFlags nStyle ) override; + virtual SalFrame* CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ) override; + virtual void DestroyFrame( SalFrame* pFrame ) override; + + // Object (System Child Window) + virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow ) override; + virtual void DestroyObject( SalObject* pObject ) override; + + // VirtualDevice + // nDX and nDY in Pixel + // nBitCount: 0 == Default(=as window) / 1 == Mono + // pData allows for using a system dependent graphics or device context + virtual std::unique_ptr<SalVirtualDevice> + CreateVirtualDevice( SalGraphics* pGraphics, + long &nDX, long &nDY, + DeviceFormat eFormat, const SystemGraphicsData *pData = nullptr ) override; + + // Printer + // pSetupData->mpDriverData can be 0 + // pSetupData must be updated with the current + // JobSetup + virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, + ImplJobSetup* pSetupData ) override; + virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter ) override; + virtual std::unique_ptr<SalPrinter> CreatePrinter( SalInfoPrinter* pInfoPrinter ) override; + + virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList ) override; + virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) override; + virtual OUString GetDefaultPrinter() override; + virtual void PostPrintersChanged() override; + + // SalTimer + virtual SalTimer* CreateSalTimer() override; + // SalSystem + virtual SalSystem* CreateSalSystem() override; + // SalBitmap + virtual std::shared_ptr<SalBitmap> CreateSalBitmap() override; + + std::shared_ptr<vcl::BackendCapabilities> GetBackendCapabilities() override; + + // wait next event and dispatch + // must returned by UserEvent (SalFrame::PostEvent) + // and timer + virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents) override; + virtual bool AnyInput( VclInputFlags nType ) override; + virtual bool IsMainThread() const override; + virtual void updateMainThread() override; + + virtual OpenGLContext* CreateOpenGLContext() override; + + virtual OUString GetConnectionIdentifier() override; + + virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) override; + + virtual std::unique_ptr<GenPspGraphics> CreatePrintGraphics() override; +}; + +inline void SvpSalInstance::registerFrame( SalFrame* pFrame ) +{ + insertFrame( pFrame ); +} + +inline void SvpSalInstance::deregisterFrame( SalFrame* pFrame ) +{ + eraseFrame( pFrame ); +} + +VCL_DLLPUBLIC cairo_surface_t* get_underlying_cairo_surface(const VirtualDevice& rDevice); + +#endif // INCLUDED_VCL_INC_HEADLESS_SVPINST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/headless/svpprn.hxx b/vcl/inc/headless/svpprn.hxx new file mode 100644 index 000000000..3d241a96e --- /dev/null +++ b/vcl/inc/headless/svpprn.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 . + */ + +#ifndef INCLUDED_VCL_INC_HEADLESS_SVPPRN_HXX +#define INCLUDED_VCL_INC_HEADLESS_SVPPRN_HXX + +#include <unx/genprn.h> + +class SvpSalInfoPrinter final : public PspSalInfoPrinter +{ +public: + virtual bool Setup( weld::Window* pFrame, ImplJobSetup* pSetupData ) override; +}; + +class SvpSalPrinter final : public PspSalPrinter +{ +public: + SvpSalPrinter( SalInfoPrinter* pInfoPrinter ); +}; + +#endif // INCLUDED_VCL_INC_HEADLESS_SVPPRN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/headless/svpvd.hxx b/vcl/inc/headless/svpvd.hxx new file mode 100644 index 000000000..7ec666709 --- /dev/null +++ b/vcl/inc/headless/svpvd.hxx @@ -0,0 +1,68 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_HEADLESS_SVPVD_HXX +#define INCLUDED_VCL_INC_HEADLESS_SVPVD_HXX + +#include <salvd.hxx> +#include <vcl/salgtype.hxx> +#include <basegfx/vector/b2ivector.hxx> + +#include <vector> + +class SvpSalGraphics; +typedef struct _cairo_surface cairo_surface_t; + +class VCL_DLLPUBLIC SvpSalVirtualDevice : public SalVirtualDevice +{ + DeviceFormat m_eFormat; + cairo_surface_t* m_pRefSurface; + cairo_surface_t* m_pSurface; + bool m_bOwnsSurface; // nearly always true, except for edge case of tdf#127529 + basegfx::B2IVector m_aFrameSize; + std::vector< SvpSalGraphics* > m_aGraphics; + + void CreateSurface(long nNewDX, long nNewDY, sal_uInt8 *const pBuffer); + +protected: + SvpSalGraphics* AddGraphics(SvpSalGraphics* aGraphics); + +public: + SvpSalVirtualDevice(DeviceFormat eFormat, cairo_surface_t* pRefSurface, cairo_surface_t* pPreExistingTarget); + virtual ~SvpSalVirtualDevice() 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; + + cairo_surface_t* GetSurface() const { return m_pSurface; } + + // SalGeometryProvider + virtual long GetWidth() const override; + virtual long GetHeight() const override; +}; + +#endif // INCLUDED_VCL_INC_HEADLESS_SVPVD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/helpwin.hxx b/vcl/inc/helpwin.hxx new file mode 100644 index 000000000..089f7417c --- /dev/null +++ b/vcl/inc/helpwin.hxx @@ -0,0 +1,84 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_HELPWIN_HXX +#define INCLUDED_VCL_INC_HELPWIN_HXX + +#include <vcl/floatwin.hxx> +#include <vcl/timer.hxx> + +enum class QuickHelpFlags; +struct ImplSVHelpData; + +/// A tooltip: adds tips to widgets in a floating / popup window. +class HelpTextWindow final : public FloatingWindow +{ +private: + tools::Rectangle maHelpArea; // If next Help for the same rectangle w/ same text, then keep window + + tools::Rectangle maTextRect; // For wrapped text in QuickHelp + + OUString maHelpText; + + Timer maShowTimer; + Timer maHideTimer; + + sal_uInt16 mnHelpWinStyle; + QuickHelpFlags mnStyle; + +private: + DECL_LINK( TimerHdl, Timer*, void ); + + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; + virtual void RequestHelp( const HelpEvent& rHEvt ) override; + virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; + + virtual OUString GetText() const override; + void ImplShow(); + + virtual void dispose() override; +public: + HelpTextWindow( vcl::Window* pParent, const OUString& rText, sal_uInt16 nHelpWinStyle, QuickHelpFlags nStyle ); + virtual ~HelpTextWindow() override; + + const OUString& GetHelpText() const { return maHelpText; } + void SetHelpText( const OUString& rHelpText ); + sal_uInt16 GetWinStyle() const { return mnHelpWinStyle; } + QuickHelpFlags GetStyle() const { return mnStyle; } + + // only remember: + void SetHelpArea( const tools::Rectangle& rRect ) { maHelpArea = rRect; } + + void ShowHelp(bool bNoDelay); + + Size CalcOutSize() const; + const tools::Rectangle& GetHelpArea() const { return maHelpArea; } +}; + +void ImplShowHelpWindow( vcl::Window* pParent, sal_uInt16 nHelpWinStyle, QuickHelpFlags nStyle, + const OUString& rHelpText, + const Point& rScreenPos, const tools::Rectangle& rHelpArea ); +VCL_DLLPUBLIC void ImplDestroyHelpWindow( bool bUpdateHideTime ); +void ImplDestroyHelpWindow(ImplSVHelpData& rHelpData, bool bUpdateHideTime); +void ImplSetHelpWindowPos( vcl::Window* pHelpWindow, sal_uInt16 nHelpWinStyle, QuickHelpFlags nStyle, + const Point& rPos, const tools::Rectangle& rHelpArea ); + +#endif // INCLUDED_VCL_INC_HELPWIN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/hyperlabel.hxx b/vcl/inc/hyperlabel.hxx new file mode 100644 index 000000000..c43dbb469 --- /dev/null +++ b/vcl/inc/hyperlabel.hxx @@ -0,0 +1,71 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_VCL_HYPERLABEL_HXX +#define INCLUDED_VCL_HYPERLABEL_HXX + +#include <memory> + +#include <vcl/fixed.hxx> + +namespace vcl +{ + class HyperLabelImpl; + + class HyperLabel final : public FixedText + { + std::unique_ptr<HyperLabelImpl> m_pImpl; + Link<HyperLabel*,void> maClickHdl; + + virtual void MouseMove( const MouseEvent& rMEvt ) override; + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual void GetFocus() override; + virtual void LoseFocus() override; + + void implInit(); + + using FixedText::CalcMinimumSize; + + public: + HyperLabel( vcl::Window* _pParent, WinBits _nWinStyle ); + virtual ~HyperLabel( ) override; + virtual void dispose() override; + + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; + + void SetID( sal_Int16 ID ); + sal_Int16 GetID() const; + + void SetIndex( sal_Int32 Index ); + sal_Int32 GetIndex() const; + + void SetLabel( const OUString& _rText ); + + void ToggleBackgroundColor( const Color& _rGBColor ); + void SetInteractive( bool _bInteractive ); + + void SetClickHdl( const Link<HyperLabel*,void>& rLink ) { maClickHdl = rLink; } + + Size const & CalcMinimumSize( long nMaxWidth ) const; + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/iconview.hxx b/vcl/inc/iconview.hxx new file mode 100644 index 000000000..09d1a0b02 --- /dev/null +++ b/vcl/inc/iconview.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 . + */ + +#ifndef INCLUDED_SVTOOLS_ICONVIEW_HXX +#define INCLUDED_SVTOOLS_ICONVIEW_HXX + +#include <vcl/treelistbox.hxx> + +class IconView final : public SvTreeListBox +{ +public: + IconView( vcl::Window* pParent, WinBits nBits ); + + virtual void Resize() override; + + virtual tools::Rectangle GetFocusRect(const SvTreeListEntry*, long nEntryPos) override; + + void PaintEntry( SvTreeListEntry&, long nX, long nY, vcl::RenderContext& rRenderContext); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/image.h b/vcl/inc/image.h new file mode 100644 index 000000000..c25015624 --- /dev/null +++ b/vcl/inc/image.h @@ -0,0 +1,72 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_IMAGE_H +#define INCLUDED_VCL_INC_IMAGE_H + +#include <vcl/bitmapex.hxx> + +class ImplImage +{ +private: + BitmapChecksum maBitmapChecksum; + /// if non-empty: cached original size of maStockName else Size of maBitmap + Size maSizePixel; + Size maPreferedSizePixel; + /// If set - defines the bitmap via images.zip* + OUString maStockName; + + + /// Original bitmap - or cache of a potentially scaled bitmap + BitmapEx maBitmapEx; + BitmapEx maDisabledBitmapEx; + + bool loadStockAtScale(double fScale, BitmapEx &rBitmapEx); + +public: + ImplImage(const BitmapEx& rBitmapEx); + ImplImage(const OUString &aStockName, Size const & rPreferedSize); + + bool isStock() const + { + return maStockName.getLength() > 0; + } + + OUString getStock() const + { + return maStockName; + } + + /// get size in co-ordinates not scaled for HiDPI + Size getSizePixel(); + /// Legacy - the original bitmap + BitmapEx const & getBitmapEx(bool bDisabled = false); + /// Taking account of HiDPI scaling + BitmapEx const & getBitmapExForHiDPI(bool bDisabled = false); + + bool isEqual(const ImplImage &ref) const; + bool isSizeEmpty() const + { + return maSizePixel == Size(); + } +}; + +#endif // INCLUDED_VCL_INC_IMAGE_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/imagerepository.hxx b/vcl/inc/imagerepository.hxx new file mode 100644 index 000000000..a1a28d3fa --- /dev/null +++ b/vcl/inc/imagerepository.hxx @@ -0,0 +1,59 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_IMAGEREPOSITORY_HXX +#define INCLUDED_VCL_IMAGEREPOSITORY_HXX + +#include <vcl/dllapi.h> +#include <rtl/ustring.hxx> + +class BitmapEx; + + +namespace vcl +{ + + + //= ImageRepository + + // provides access to the application's image repository (image.zip) + class ImageRepository + { + public: + /** loads an image from the application's image repository + @param _rName + the name of the image to load. + @param _out_rImage + will take the image upon successful return. + @return + whether or not the image could be loaded successfully. + */ + static bool loadImage( + const OUString& _rName, + BitmapEx& _out_rImage + ); + }; + + +} // namespace vcl + + +#endif // INCLUDED_VCL_IMAGEREPOSITORY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/impanmvw.hxx b/vcl/inc/impanmvw.hxx new file mode 100644 index 000000000..b4e634071 --- /dev/null +++ b/vcl/inc/impanmvw.hxx @@ -0,0 +1,98 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_SOURCE_GDI_IMPANMVW_HXX +#define INCLUDED_VCL_SOURCE_GDI_IMPANMVW_HXX + +#include <vcl/animate/Animation.hxx> +#include <vcl/vclptr.hxx> + +class Animation; +class OutputDevice; +class VirtualDevice; +struct AnimationBitmap; + +struct AInfo +{ + Point aStartOrg; + Size aStartSize; + VclPtr<OutputDevice> pOutDev; + void* pViewData; + long nExtraData; + bool bPause; + + AInfo(); +}; + + +class ImplAnimView +{ +private: + + friend class Animation; + + Animation* mpParent; + VclPtr<OutputDevice> mpRenderContext; + long mnExtraData; + Point maPt; + Point maDispPt; + Point maRestPt; + Size maSz; + Size maSzPix; + Size maDispSz; + Size maRestSz; + vcl::Region maClip; + VclPtr<VirtualDevice> mpBackground; + VclPtr<VirtualDevice> mpRestore; + sal_uLong mnActPos; + Disposal meLastDisposal; + bool mbIsPaused; + bool mbIsMarked; + bool mbIsMirroredHorizontally; + bool mbIsMirroredVertically; + +public: + ~ImplAnimView(); +private: + ImplAnimView( Animation* pParent, OutputDevice* pOut, + const Point& rPt, const Size& rSz, sal_uLong nExtraData, + OutputDevice* pFirstFrameOutDev = nullptr ); + + bool matches(const OutputDevice* pOut, long nExtraData) const; + void drawToPos( sal_uLong nPos ); + void draw( sal_uLong nPos, VirtualDevice* pVDev=nullptr ); + void repaint(); + AInfo* createAInfo() const; + + void getPosSize( const AnimationBitmap& rAnm, Point& rPosPix, Size& rSizePix ); + + const Point& getOutPos() const { return maPt; } + + const Size& getOutSizePix() const { return maSzPix; } + + void pause( bool bIsPaused ) { mbIsPaused = bIsPaused; } + bool isPause() const { return mbIsPaused; } + + void setMarked( bool bIsMarked ) { mbIsMarked = bIsMarked; } + bool isMarked() const { return mbIsMarked; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/impdel.hxx b/vcl/inc/impdel.hxx new file mode 100644 index 000000000..308872b9c --- /dev/null +++ b/vcl/inc/impdel.hxx @@ -0,0 +1,80 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_IMPDEL_HXX +#define INCLUDED_VCL_IMPDEL_HXX + +#include <list> + +namespace vcl +{ + +class DeletionListener; + +class DeletionNotifier +{ + std::list< DeletionListener* > m_aListeners; + protected: + DeletionNotifier() {} + + ~DeletionNotifier() + { notifyDelete(); } + + inline void notifyDelete(); + + public: + void addDel( DeletionListener* pListener ) + { m_aListeners.push_back( pListener ); } + + void removeDel( DeletionListener* pListener ) + { m_aListeners.remove( pListener ); } +}; + +class DeletionListener +{ + DeletionNotifier* m_pNotifier; + public: + DeletionListener( DeletionNotifier* pNotifier ) + : m_pNotifier( pNotifier ) + { + if( m_pNotifier ) + m_pNotifier->addDel( this ); + } + ~DeletionListener() + { + if( m_pNotifier ) + m_pNotifier->removeDel( this ); + } + void deleted() { m_pNotifier = nullptr; } + bool isDeleted() const { return (m_pNotifier == nullptr); } +}; + +inline void DeletionNotifier::notifyDelete() +{ + for( auto& rListener : m_aListeners ) + rListener->deleted(); + + m_aListeners.clear(); +} + +} // namespace vcl + +#endif // INCLUDED_VCL_IMPDEL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx new file mode 100644 index 000000000..7f4301d97 --- /dev/null +++ b/vcl/inc/impfont.hxx @@ -0,0 +1,137 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_IMPFONT_HXX +#define INCLUDED_VCL_INC_IMPFONT_HXX + +#include <rtl/ustring.hxx> +#include <tools/color.hxx> +#include <tools/fontenum.hxx> +#include <tools/gen.hxx> +#include <i18nlangtag/languagetag.hxx> +#include <vcl/fntstyle.hxx> + +#include "fontselect.hxx" + +/* The following class is extraordinarily similar to FontAttributes. */ + +class ImplFont +{ +public: + explicit ImplFont(); + explicit ImplFont( const ImplFont& ); + + // device independent font functions + const OUString& GetFamilyName() const { return maFamilyName; } + FontFamily GetFamilyType() { if(meFamily==FAMILY_DONTKNOW) AskConfig(); return meFamily; } + const OUString& GetStyleName() const { return maStyleName; } + + FontWeight GetWeight() { if(meWeight==WEIGHT_DONTKNOW) AskConfig(); return meWeight; } + FontItalic GetItalic() { if(meItalic==ITALIC_DONTKNOW) AskConfig(); return meItalic; } + FontPitch GetPitch() { if(mePitch==PITCH_DONTKNOW) AskConfig(); return mePitch; } + FontWidth GetWidthType() { if(meWidthType==WIDTH_DONTKNOW) AskConfig(); return meWidthType; } + TextAlign GetAlignment() const { return meAlign; } + rtl_TextEncoding GetCharSet() const { return meCharSet; } + const Size& GetFontSize() const { return maAverageFontSize; } + + bool IsSymbolFont() const { return mbSymbolFlag; } + + void SetFamilyName( const OUString& sFamilyName ) { maFamilyName = sFamilyName; } + void SetStyleName( const OUString& sStyleName ) { maStyleName = sStyleName; } + void SetFamilyType( const FontFamily eFontFamily ) { meFamily = eFontFamily; } + + void SetPitch( const FontPitch ePitch ) { mePitch = ePitch; } + void SetItalic( const FontItalic eItalic ) { meItalic = eItalic; } + void SetWeight( const FontWeight eWeight ) { meWeight = eWeight; } + void SetWidthType( const FontWidth eWidthType ) { meWidthType = eWidthType; } + void SetAlignment( const TextAlign eAlignment ) { meAlign = eAlignment; } + void SetCharSet( const rtl_TextEncoding eCharSet ) { meCharSet = eCharSet; } + void SetFontSize( const Size& rSize ) { maAverageFontSize = rSize; } + + void SetSymbolFlag( const bool bSymbolFlag ) { mbSymbolFlag = bSymbolFlag; } + + // straight properties, no getting them from AskConfig() + FontFamily GetFamilyTypeNoAsk() const { return meFamily; } + FontWeight GetWeightNoAsk() const { return meWeight; } + FontItalic GetItalicNoAsk() const { return meItalic; } + FontPitch GetPitchNoAsk() const { return mePitch; } + FontWidth GetWidthTypeNoAsk() const { return meWidthType; } + + // device dependent functions + int GetQuality() const { return mnQuality; } + + void SetQuality( int nQuality ) { mnQuality = nQuality; } + void IncreaseQualityBy( int nQualityAmount ) { mnQuality += nQualityAmount; } + void DecreaseQualityBy( int nQualityAmount ) { mnQuality -= nQualityAmount; } + + bool operator==( const ImplFont& ) const; + +private: + friend class vcl::Font; + friend SvStream& ReadImplFont( SvStream& rIStm, ImplFont& ); + friend SvStream& WriteImplFont( SvStream& rOStm, const ImplFont& ); + + void AskConfig(); + + // Device independent variables + OUString maFamilyName; + OUString maStyleName; + FontWeight meWeight; + FontFamily meFamily; + FontPitch mePitch; + FontWidth meWidthType; + FontItalic meItalic; + TextAlign meAlign; + FontLineStyle meUnderline; + FontLineStyle meOverline; + FontStrikeout meStrikeout; + FontRelief meRelief; + FontEmphasisMark meEmphasisMark; + FontKerning meKerning; + Size maAverageFontSize; + rtl_TextEncoding meCharSet; + + LanguageTag maLanguageTag; + LanguageTag maCJKLanguageTag; + + // Flags - device independent + bool mbSymbolFlag:1, + mbOutline:1, + mbConfigLookup:1, // config lookup should only be done once + mbShadow:1, + mbVertical:1, + mbTransparent:1; // compatibility, now on output device + + // deprecated variables - device independent + Color maColor; // compatibility, now on output device + Color maFillColor; // compatibility, now on output device + + // Device dependent variables + bool mbWordLine:1; + + // TODO: metric data, should be migrated to ImplFontMetric + short mnOrientation; + + int mnQuality; + +}; + +#endif // INCLUDED_VCL_INC_IMPFONT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/impfontcache.hxx b/vcl/inc/impfontcache.hxx new file mode 100644 index 000000000..78dfb4a71 --- /dev/null +++ b/vcl/inc/impfontcache.hxx @@ -0,0 +1,99 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_IMPFONTCACHE_HXX +#define INCLUDED_VCL_INC_IMPFONTCACHE_HXX + +#include <boost/functional/hash.hpp> + +#include <rtl/ref.hxx> +#include <o3tl/lru_map.hxx> +#include <tools/gen.hxx> +#include <vcl/glyphitem.hxx> + +#include "fontselect.hxx" + +class Size; +namespace vcl { class Font; } +class PhysicalFontCollection; + +// TODO: closely couple with PhysicalFontCollection + +struct GlyphBoundRectCacheKey +{ + const LogicalFontInstance* m_pFont; + const sal_GlyphId m_nId; + + GlyphBoundRectCacheKey(const LogicalFontInstance* pFont, sal_GlyphId nID) + : m_pFont(pFont), m_nId(nID) + {} + + bool operator==(GlyphBoundRectCacheKey const& aOther) const + { return m_pFont == aOther.m_pFont && m_nId == aOther.m_nId; } +}; + +struct GlyphBoundRectCacheHash +{ + std::size_t operator()(GlyphBoundRectCacheKey const& aCache) const + { + std::size_t seed = 0; + boost::hash_combine(seed, aCache.m_pFont); + boost::hash_combine(seed, aCache.m_nId); + return seed; + } +}; + +typedef o3tl::lru_map<GlyphBoundRectCacheKey, tools::Rectangle, + GlyphBoundRectCacheHash> GlyphBoundRectCache; +typedef GlyphBoundRectCache::key_value_pair_t GlyphBoundRectCachePair; + +class ImplFontCache +{ +private: + // cache of recently used font instances + struct IFSD_Equal { bool operator()( const FontSelectPattern&, const FontSelectPattern& ) const; }; + struct IFSD_Hash { size_t operator()( const FontSelectPattern& ) const; }; + typedef o3tl::lru_map<FontSelectPattern, rtl::Reference<LogicalFontInstance>, IFSD_Hash, IFSD_Equal> FontInstanceList; + typedef FontInstanceList::key_value_pair_t FontInstanceListPair; + + LogicalFontInstance* mpLastHitCacheEntry; ///< keeps the last hit cache entry + FontInstanceList maFontInstanceList; + GlyphBoundRectCache m_aBoundRectCache; + + rtl::Reference<LogicalFontInstance> GetFontInstance(PhysicalFontCollection const*, FontSelectPattern&); + +public: + ImplFontCache(); + ~ImplFontCache(); + + rtl::Reference<LogicalFontInstance> GetFontInstance(PhysicalFontCollection const *, + const vcl::Font&, const Size& rPixelSize, float fExactHeight, bool bNonAntialias = false); + rtl::Reference<LogicalFontInstance> GetGlyphFallbackFont( PhysicalFontCollection const *, FontSelectPattern&, + LogicalFontInstance* pLogicalFont, + int nFallbackLevel, OUString& rMissingCodes ); + + bool GetCachedGlyphBoundRect(const LogicalFontInstance *, sal_GlyphId, tools::Rectangle &); + void CacheGlyphBoundRect(const LogicalFontInstance *, sal_GlyphId, tools::Rectangle &); + + void Invalidate(); +}; + +#endif // INCLUDED_VCL_INC_IMPFONTCACHE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/impfontcharmap.hxx b/vcl/inc/impfontcharmap.hxx new file mode 100644 index 000000000..eaa99dbe2 --- /dev/null +++ b/vcl/inc/impfontcharmap.hxx @@ -0,0 +1,58 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_IMPFONTCHARMAP_HXX +#define INCLUDED_VCL_INC_IMPFONTCHARMAP_HXX + +#include <tools/ref.hxx> +#include <vcl/dllapi.h> + +class ImplFontCharMap; +typedef tools::SvRef<ImplFontCharMap> ImplFontCharMapRef; + +class CmapResult; + +class ImplFontCharMap : public SvRefBase +{ +public: + explicit ImplFontCharMap( const CmapResult& ); + virtual ~ImplFontCharMap() override; + +private: + friend class FontCharMap; + + ImplFontCharMap( const ImplFontCharMap& ) = delete; + void operator=( const ImplFontCharMap& ) = delete; + + static ImplFontCharMapRef const & getDefaultMap( bool bSymbols=false); + bool isDefaultMap() const; + +private: + const sal_uInt32* mpRangeCodes; // pairs of StartCode/(EndCode+1) + const int* mpStartGlyphs; // range-specific mapper to glyphs + const sal_uInt16* mpGlyphIds; // individual glyphid mappings + int mnRangeCount; + int mnCharCount; // covered codepoints +}; + +bool VCL_DLLPUBLIC ParseCMAP( const unsigned char* pRawData, int nRawLength, CmapResult& ); + +#endif // INCLUDED_VCL_INC_IMPFONTCHARMAP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/impfontmetricdata.hxx b/vcl/inc/impfontmetricdata.hxx new file mode 100644 index 000000000..d801b9e41 --- /dev/null +++ b/vcl/inc/impfontmetricdata.hxx @@ -0,0 +1,149 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_IMPFONTMETRICDATA_HXX +#define INCLUDED_VCL_INC_IMPFONTMETRICDATA_HXX + +#include <vcl/dllapi.h> +#include <tools/ref.hxx> +#include "fontattributes.hxx" +#include "sft.hxx" + +#include <vector> + +class ImplFontMetricData; +typedef tools::SvRef<ImplFontMetricData> ImplFontMetricDataRef; + +class OutputDevice; +class FontSelectPattern; +class LogicalFontInstance; + +class VCL_DLLPUBLIC ImplFontMetricData : public FontAttributes, public SvRefBase +{ +public: + explicit ImplFontMetricData( const FontSelectPattern& ); + + // font instance attributes from the font request + long GetWidth() const { return mnWidth; } + short GetOrientation() const { return mnOrientation; } + + void SetWidth(long nWidth) { mnWidth=nWidth; } + void SetOrientation(short nOrientation) { mnOrientation=nOrientation; } + + // font metrics measured for the font instance + long GetAscent() const { return mnAscent; } + long GetDescent() const { return mnDescent; } + long GetInternalLeading() const { return mnIntLeading; } + long GetExternalLeading() const { return mnExtLeading; } + int GetSlant() const { return mnSlant; } + long GetMinKashida() const { return mnMinKashida; } + + void SetSlant(int nSlant) { mnSlant=nSlant; } + void SetMinKashida( long nMinKashida ) { mnMinKashida=nMinKashida; } + + // font attributes queried from the font instance + bool IsFullstopCentered() const { return mbFullstopCentered; } + long GetBulletOffset() const { return mnBulletOffset; } + + void SetFullstopCenteredFlag(bool bFullstopCentered) { mbFullstopCentered = bFullstopCentered; } + + // font metrics that are usually derived from the measurements + long GetUnderlineSize() const { return mnUnderlineSize; } + long GetUnderlineOffset() const { return mnUnderlineOffset; } + long GetBoldUnderlineSize() const { return mnBUnderlineSize; } + long GetBoldUnderlineOffset() const { return mnBUnderlineOffset; } + long GetDoubleUnderlineSize() const { return mnDUnderlineSize; } + long GetDoubleUnderlineOffset1() const { return mnDUnderlineOffset1; } + long GetDoubleUnderlineOffset2() const { return mnDUnderlineOffset2; } + long GetWavelineUnderlineSize() const { return mnWUnderlineSize; } + long GetWavelineUnderlineOffset() const { return mnWUnderlineOffset; } + long GetAboveUnderlineSize() const { return mnAboveUnderlineSize; } + long GetAboveUnderlineOffset() const { return mnAboveUnderlineOffset; } + long GetAboveBoldUnderlineSize() const { return mnAboveBUnderlineSize; } + long GetAboveBoldUnderlineOffset() const { return mnAboveBUnderlineOffset; } + long GetAboveDoubleUnderlineSize() const { return mnAboveDUnderlineSize; } + long GetAboveDoubleUnderlineOffset1() const { return mnAboveDUnderlineOffset1; } + long GetAboveDoubleUnderlineOffset2() const { return mnAboveDUnderlineOffset2; } + long GetAboveWavelineUnderlineSize() const { return mnAboveWUnderlineSize; } + long GetAboveWavelineUnderlineOffset() const { return mnAboveWUnderlineOffset; } + long GetStrikeoutSize() const { return mnStrikeoutSize; } + long GetStrikeoutOffset() const { return mnStrikeoutOffset; } + long GetBoldStrikeoutSize() const { return mnBStrikeoutSize; } + long GetBoldStrikeoutOffset() const { return mnBStrikeoutOffset; } + long GetDoubleStrikeoutSize() const { return mnDStrikeoutSize; } + long GetDoubleStrikeoutOffset1() const { return mnDStrikeoutOffset1; } + long GetDoubleStrikeoutOffset2() const { return mnDStrikeoutOffset2; } + + void ImplInitTextLineSize( const OutputDevice* pDev ); + void ImplInitAboveTextLineSize(); + void ImplInitFlags( const OutputDevice* pDev ); + void ImplCalcLineSpacing(LogicalFontInstance *pFontInstance); + +private: + bool ShouldUseWinMetrics(const vcl::TTGlobalFontInfo& rInfo); + + // font instance attributes from the font request + long mnHeight; // Font size + long mnWidth; // Reference Width + short mnOrientation; // Rotation in 1/10 degrees + + // font metrics measured for the font instance + long mnAscent; // Ascent + long mnDescent; // Descent + long mnIntLeading; // Internal Leading + long mnExtLeading; // External Leading + int mnSlant; // Slant (Italic/Oblique) + long mnMinKashida; // Minimal width of kashida (Arabic) + + // font attributes queried from the font instance + bool mbFullstopCentered; + long mnBulletOffset; // Offset to position non-print character + + // font metrics that are usually derived from the measurements + long mnUnderlineSize; // Lineheight of Underline + long mnUnderlineOffset; // Offset from Underline to Baseline + long mnBUnderlineSize; // Height of bold underline + long mnBUnderlineOffset; // Offset from bold underline to baseline + long mnDUnderlineSize; // Height of double underline + long mnDUnderlineOffset1; // Offset from double underline to baseline + long mnDUnderlineOffset2; // Offset from double underline to baseline + long mnWUnderlineSize; // Height of WaveLine underline + long mnWUnderlineOffset; // Offset from WaveLine underline to baseline, but centrered to WaveLine + long mnAboveUnderlineSize; // Height of single underline (for Vertical Right) + long mnAboveUnderlineOffset; // Offset from single underline to baseline (for Vertical Right) + long mnAboveBUnderlineSize; // Height of bold underline (for Vertical Right) + long mnAboveBUnderlineOffset; // Offset from bold underline to baseline (for Vertical Right) + long mnAboveDUnderlineSize; // Height of double underline (for Vertical Right) + long mnAboveDUnderlineOffset1; // Offset from double underline to baseline (for Vertical Right) + long mnAboveDUnderlineOffset2; // Offset from double underline to baseline (for Vertical Right) + long mnAboveWUnderlineSize; // Height of WaveLine-strike-out (for Vertical Right) + long mnAboveWUnderlineOffset; // Offset from WaveLine-strike-out to baseline, but centrered to the WaveLine (for Vertical Right) + long mnStrikeoutSize; // Height of single strike-out + long mnStrikeoutOffset; // Offset from single strike-out to baseline + long mnBStrikeoutSize; // Height of bold strike-out + long mnBStrikeoutOffset; // Offset of bold strike-out to baseline + long mnDStrikeoutSize; // Height of double strike-out + long mnDStrikeoutOffset1; // Offset of double strike-out to baseline + long mnDStrikeoutOffset2; // Offset of double strike-out to baseline + +}; + +#endif // INCLUDED_VCL_INC_IMPFONTMETRICDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/impglyphitem.hxx b/vcl/inc/impglyphitem.hxx new file mode 100644 index 000000000..da56b660d --- /dev/null +++ b/vcl/inc/impglyphitem.hxx @@ -0,0 +1,140 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_IMPGLYPHITEM_HXX +#define INCLUDED_VCL_IMPGLYPHITEM_HXX + +#include <o3tl/typed_flags_set.hxx> +#include <tools/gen.hxx> +#include <vcl/dllapi.h> +#include <vcl/glyphitem.hxx> +#include <vcl/outdev.hxx> +#include <vector> + +#include "fontinstance.hxx" + +enum class GlyphItemFlags +{ + NONE = 0, + IS_IN_CLUSTER = 0x001, + IS_RTL_GLYPH = 0x002, + IS_DIACRITIC = 0x004, + IS_VERTICAL = 0x008, + IS_SPACING = 0x010, + ALLOW_KASHIDA = 0x020, + IS_DROPPED = 0x040, + IS_CLUSTER_START = 0x080 +}; +namespace o3tl +{ +template <> struct typed_flags<GlyphItemFlags> : is_typed_flags<GlyphItemFlags, 0xff> +{ +}; +}; + +class VCL_DLLPUBLIC GlyphItem +{ + sal_GlyphId m_aGlyphId; + int m_nCharCount; // number of characters making up this glyph + int m_nOrigWidth; // original glyph width + LogicalFontInstance* m_pFontInstance; + int m_nCharPos; // index in string + GlyphItemFlags m_nFlags; + int m_nXOffset; + +public: + int m_nNewWidth; // width after adjustments + Point m_aLinearPos; // absolute position of non rotated string + + GlyphItem(int nCharPos, int nCharCount, sal_GlyphId aGlyphId, const Point& rLinearPos, + GlyphItemFlags nFlags, int nOrigWidth, int nXOffset, + LogicalFontInstance* pFontInstance) + : m_aGlyphId(aGlyphId) + , m_nCharCount(nCharCount) + , m_nOrigWidth(nOrigWidth) + , m_pFontInstance(pFontInstance) + , m_nCharPos(nCharPos) + , m_nFlags(nFlags) + , m_nXOffset(nXOffset) + , m_nNewWidth(nOrigWidth) + , m_aLinearPos(rLinearPos) + { + assert(m_pFontInstance); + } + + bool IsInCluster() const { return bool(m_nFlags & GlyphItemFlags::IS_IN_CLUSTER); } + bool IsRTLGlyph() const { return bool(m_nFlags & GlyphItemFlags::IS_RTL_GLYPH); } + bool IsDiacritic() const { return bool(m_nFlags & GlyphItemFlags::IS_DIACRITIC); } + bool IsVertical() const { return bool(m_nFlags & GlyphItemFlags::IS_VERTICAL); } + bool IsSpacing() const { return bool(m_nFlags & GlyphItemFlags::IS_SPACING); } + bool AllowKashida() const { return bool(m_nFlags & GlyphItemFlags::ALLOW_KASHIDA); } + bool IsDropped() const { return bool(m_nFlags & GlyphItemFlags::IS_DROPPED); } + bool IsClusterStart() const { return bool(m_nFlags & GlyphItemFlags::IS_CLUSTER_START); } + + inline bool GetGlyphBoundRect(tools::Rectangle&) const; + inline bool GetGlyphOutline(basegfx::B2DPolyPolygon&) const; + inline void dropGlyph(); + + sal_GlyphId glyphId() const { return m_aGlyphId; } + int charCount() const { return m_nCharCount; } + int origWidth() const { return m_nOrigWidth; } + int charPos() const { return m_nCharPos; } + int xOffset() const { return m_nXOffset; } +}; + +VCL_DLLPUBLIC bool GlyphItem::GetGlyphBoundRect(tools::Rectangle& rRect) const +{ + return m_pFontInstance->GetGlyphBoundRect(m_aGlyphId, rRect, IsVertical()); +} + +VCL_DLLPUBLIC bool GlyphItem::GetGlyphOutline(basegfx::B2DPolyPolygon& rPoly) const +{ + return m_pFontInstance->GetGlyphOutline(m_aGlyphId, rPoly, IsVertical()); +} + +void GlyphItem::dropGlyph() +{ + m_nCharPos = -1; + m_nFlags |= GlyphItemFlags::IS_DROPPED; +} + +class SalLayoutGlyphsImpl : public std::vector<GlyphItem> +{ + friend class GenericSalLayout; + +public: + SalLayoutGlyphsImpl* clone(SalLayoutGlyphs& rGlyphs) const; + LogicalFontInstance& GetFont() const { return *m_rFontInstance; } + bool IsValid() const; + void Invalidate(); + +private: + mutable rtl::Reference<LogicalFontInstance> m_rFontInstance; + SalLayoutFlags mnFlags = SalLayoutFlags::NONE; + + SalLayoutGlyphsImpl(SalLayoutGlyphs& rGlyphs, LogicalFontInstance& rFontInstance) + : m_rFontInstance(&rFontInstance) + { + rGlyphs.m_pImpl = this; + } +}; + +#endif // INCLUDED_VCL_IMPGLYPHITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx new file mode 100644 index 000000000..749a5b82a --- /dev/null +++ b/vcl/inc/impgraph.hxx @@ -0,0 +1,214 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_IMPGRAPH_HXX +#define INCLUDED_VCL_INC_IMPGRAPH_HXX + +#include <vcl/dllapi.h> +#include <vcl/GraphicExternalLink.hxx> +#include <vcl/gdimtf.hxx> +#include <vcl/graph.hxx> +#include "graphic/Manager.hxx" +#include "graphic/GraphicID.hxx" + +struct ImpSwapInfo +{ + MapMode maPrefMapMode; + Size maPrefSize; + Size maSizePixel; + + bool mbIsAnimated; + bool mbIsEPS; + bool mbIsTransparent; + bool mbIsAlpha; + + sal_uInt32 mnAnimationLoopCount; +}; + +class OutputDevice; +class GfxLink; +class ImpSwapFile; +class GraphicConversionParameters; +class ImpGraphic; + +class VCL_DLLPUBLIC ImpGraphic final +{ + friend class Graphic; + friend class GraphicID; + friend class vcl::graphic::Manager; + +private: + + GDIMetaFile maMetaFile; + BitmapEx maBitmapEx; + /// If maBitmapEx is empty, this preferred size will be set on it when it gets initialized. + Size maExPrefSize; + ImpSwapInfo maSwapInfo; + std::unique_ptr<Animation> mpAnimation; + std::shared_ptr<GraphicReader> mpContext; + std::shared_ptr<ImpSwapFile> mpSwapFile; + std::shared_ptr<GfxLink> mpGfxLink; + GraphicType meType; + mutable sal_uLong mnSizeBytes; + bool mbSwapOut; + bool mbDummyContext; + std::shared_ptr<VectorGraphicData> maVectorGraphicData; + // cache checksum computation + mutable BitmapChecksum mnChecksum = 0; + + std::unique_ptr<GraphicID> mpGraphicID; + GraphicExternalLink maGraphicExternalLink; + + std::chrono::high_resolution_clock::time_point maLastUsed; + bool mbPrepared; + +public: + ImpGraphic(); + ImpGraphic( const ImpGraphic& rImpGraphic ); + ImpGraphic( ImpGraphic&& rImpGraphic ) noexcept; + ImpGraphic( const GraphicExternalLink& rExternalLink); + ImpGraphic( const Bitmap& rBmp ); + ImpGraphic( const BitmapEx& rBmpEx ); + ImpGraphic(const std::shared_ptr<VectorGraphicData>& rVectorGraphicDataPtr); + ImpGraphic( const Animation& rAnimation ); + ImpGraphic( const GDIMetaFile& rMtf ); + ~ImpGraphic(); + + void ImplSetPrepared(bool bAnimated, const Size* pSizeHint); + +private: + + ImpGraphic& operator=( const ImpGraphic& rImpGraphic ); + ImpGraphic& operator=( ImpGraphic&& rImpGraphic ); + bool operator==( const ImpGraphic& rImpGraphic ) const; + bool operator!=( const ImpGraphic& rImpGraphic ) const { return !( *this == rImpGraphic ); } + + OUString const & getOriginURL() const + { + return maGraphicExternalLink.msURL; + } + + void setOriginURL(OUString const & rOriginURL) + { + maGraphicExternalLink.msURL = rOriginURL; + } + + OString getUniqueID() + { + if (!mpGraphicID) + mpGraphicID.reset(new GraphicID(*this)); + return mpGraphicID->getIDString(); + } + + void createSwapInfo(); + void ImplClearGraphics(); + void ImplClear(); + + GraphicType ImplGetType() const { return meType;} + void ImplSetDefaultType(); + bool ImplIsSupportedGraphic() const; + + bool ImplIsTransparent() const; + bool ImplIsAlpha() const; + bool ImplIsAnimated() const; + bool ImplIsEPS() const; + + bool isAvailable() const; + bool makeAvailable(); + + Bitmap ImplGetBitmap(const GraphicConversionParameters& rParameters) const; + BitmapEx ImplGetBitmapEx(const GraphicConversionParameters& rParameters) const; + /// Gives direct access to the contained BitmapEx. + const BitmapEx& ImplGetBitmapExRef() const; + Animation ImplGetAnimation() const; + const GDIMetaFile& ImplGetGDIMetaFile() const; + + Size ImplGetSizePixel() const; + + Size ImplGetPrefSize() const; + void ImplSetPrefSize( const Size& rPrefSize ); + + MapMode ImplGetPrefMapMode() const; + void ImplSetPrefMapMode( const MapMode& rPrefMapMode ); + + sal_uLong ImplGetSizeBytes() const; + + void ImplDraw( OutputDevice* pOutDev, + const Point& rDestPt ) const; + void ImplDraw( OutputDevice* pOutDev, + const Point& rDestPt, + const Size& rDestSize ) const; + + void ImplStartAnimation( OutputDevice* pOutDev, + const Point& rDestPt, + const Size& rDestSize, + long nExtraData, + OutputDevice* pFirstFrameOutDev ); + void ImplStopAnimation( OutputDevice* pOutputDevice, + long nExtraData ); + + void ImplSetAnimationNotifyHdl( const Link<Animation*,void>& rLink ); + Link<Animation*,void> ImplGetAnimationNotifyHdl() const; + + sal_uInt32 ImplGetAnimationLoopCount() const; + +private: + + std::shared_ptr<GraphicReader>& ImplGetContext() { return mpContext;} + void ImplSetContext( const std::shared_ptr<GraphicReader>& pReader ); + void ImplSetDummyContext( bool value ) { mbDummyContext = value; } + bool ImplReadEmbedded( SvStream& rIStream ); + bool ImplWriteEmbedded( SvStream& rOStream ); + + bool swapInFromStream(SvStream* pIStm); + + bool ImplIsDummyContext() const { return mbDummyContext; } + void ImplSetLink( const std::shared_ptr<GfxLink>& ); + std::shared_ptr<GfxLink> ImplGetSharedGfxLink() const; + GfxLink ImplGetLink(); + bool ImplIsLink() const; + + BitmapChecksum ImplGetChecksum() const; + + bool ImplExportNative( SvStream& rOStm ) const; + + friend void WriteImpGraphic(SvStream& rOStm, const ImpGraphic& rImpGraphic); + friend void ReadImpGraphic(SvStream& rIStm, ImpGraphic& rImpGraphic); + + const std::shared_ptr<VectorGraphicData>& getVectorGraphicData() const; + + /// Gets the bitmap replacement for a vector graphic. + BitmapEx getVectorGraphicReplacement() const; + + bool ensureAvailable () const; + + bool loadPrepared(); + + sal_Int32 getPageNumber() const; + +public: + bool swapIn(); + bool swapOut(); + bool isSwappedOut() const { return mbSwapOut; } + OUString getSwapFileURL(); +}; + +#endif // INCLUDED_VCL_INC_IMPGRAPH_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/implimagetree.hxx b/vcl/inc/implimagetree.hxx new file mode 100644 index 000000000..3656b66de --- /dev/null +++ b/vcl/inc/implimagetree.hxx @@ -0,0 +1,158 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_IMPLIMAGETREE_HXX +#define INCLUDED_VCL_INC_IMPLIMAGETREE_HXX + +#include <sal/config.h> + +#include <memory> +#include <unordered_map> +#include <utility> +#include <vector> + +#include <com/sun/star/uno/Reference.hxx> +#include <rtl/ustring.hxx> +#include <vcl/bitmapex.hxx> +#include <i18nlangtag/languagetag.hxx> +#include <vcl/ImageTree.hxx> + +namespace com::sun::star::container { + class XNameAccess; +} + +struct ImageRequestParameters +{ + OUString msName; + OUString msStyle; + BitmapEx& mrBitmap; + bool mbLocalized; + ImageLoadFlags meFlags; + bool mbWriteImageToCache; + sal_Int32 mnScalePercentage; + + ImageRequestParameters(const OUString & rName, const OUString & rStyle, BitmapEx& rBitmap, bool bLocalized, + ImageLoadFlags eFlags, sal_Int32 nScalePercentage) + : msName(rName) + , msStyle(rStyle) + , mrBitmap(rBitmap) + , mbLocalized(bLocalized) + , meFlags(eFlags) + , mbWriteImageToCache(false) + , mnScalePercentage(nScalePercentage) + {} + + bool convertToDarkTheme(); + sal_Int32 scalePercentage(); +}; + +class ImplImageTree +{ +public: + ImplImageTree(); + ~ImplImageTree(); + + OUString getImageUrl( + OUString const & name, OUString const & style, OUString const & lang); + + std::shared_ptr<SvMemoryStream> getImageStream( + OUString const & rName, OUString const & rStyle, OUString const & rLang); + + bool loadImage( + OUString const & name, OUString const & style, + BitmapEx & bitmap, bool localized, + const ImageLoadFlags eFlags, + sal_Int32 nScalePercentage = -1); + + /** a crude form of life cycle control (called from DeInitVCL; otherwise, + * if the ImplImageTree singleton were destroyed during exit that would + * be too late for the destructors of the bitmaps in maIconCache)*/ + void shutdown(); + + css::uno::Reference< css::container::XNameAccess > const & getNameAccess(); + +private: + ImplImageTree(const ImplImageTree&) = delete; + ImplImageTree& operator=(const ImplImageTree&) = delete; + + typedef std::unordered_map<OUString, std::pair<bool,BitmapEx>> IconCache; + typedef std::unordered_map<sal_Int32, std::unique_ptr<IconCache>> ScaledIconCache; + typedef std::unordered_map<OUString, OUString> IconLinkHash; + + struct IconSet + { + OUString maURL; + css::uno::Reference<css::container::XNameAccess> maNameAccess; + ScaledIconCache maScaledIconCaches; + IconLinkHash maLinkHash; + + IconSet() + {} + + IconSet(const OUString & rURL) + : maURL(rURL) + {} + }; + + /// Remember all the (used) icon styles and individual icons in them. + /// Map between the theme name(s) and the content. + std::unordered_map<OUString, IconSet> maIconSets; + + /// Style used for the current operations; switches switch several times during fallback search. + OUString maCurrentStyle; + + IconSet& getCurrentIconSet() + { + return maIconSets[maCurrentStyle]; + } + + bool doLoadImage(ImageRequestParameters& rParameters); + + std::vector<OUString> getPaths(OUString const & name, LanguageTag const & rLanguageTag); + + bool checkPathAccess(); + + void setStyle(OUString const & rStyle); + + void createStyle(); + + IconCache &getIconCache(const ImageRequestParameters& rParameters); + + bool iconCacheLookup(ImageRequestParameters& rParameters); + + bool findImage(std::vector<OUString> const & rPaths, ImageRequestParameters& rParameters); + + void loadImageLinks(); + + void parseLinkFile(std::shared_ptr<SvStream> const & aStream); + + /// Return name of a real .png according to links.txt. + OUString const & getRealImageName(OUString const & rName); + + + /** Return name of the fallback style for the provided one. + + Must not be cyclic :-) The last theme in the chain returns an empty string. + */ + static OUString fallbackStyle(const OUString &rStyle); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/iosinst.hxx b/vcl/inc/ios/iosinst.hxx new file mode 100644 index 000000000..a937fb25f --- /dev/null +++ b/vcl/inc/ios/iosinst.hxx @@ -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 . + */ + +#ifndef INCLUDED_VCL_INC_IOS_IOSINST_HXX +#define INCLUDED_VCL_INC_IOS_IOSINST_HXX + +#include <premac.h> +#include <CoreGraphics/CoreGraphics.h> +#include <postmac.h> + +#include <tools/link.hxx> + +#include "headless/svpinst.hxx" +#include "headless/svpframe.hxx" + +class IosSalFrame; +class IosSalInstance : public SvpSalInstance +{ +public: + IosSalInstance( std::unique_ptr<SalYieldMutex> pMutex ); + virtual ~IosSalInstance(); + static IosSalInstance *getInstance(); + + SalSystem* CreateSalSystem() override; + + css::uno::Reference< css::uno::XInterface > CreateClipboard( const css::uno::Sequence< css::uno::Any >& i_rArguments ) override; + + void GetWorkArea( tools::Rectangle& rRect ); + SalFrame* CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ) override; + SalFrame* CreateChildFrame( SystemParentData* pParent, SalFrameStyleFlags nStyle ) override; +}; + +#endif // INCLUDED_VCL_INC_IOS_IOSINST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/svsys.h b/vcl/inc/ios/svsys.h new file mode 100644 index 000000000..dcd14e79f --- /dev/null +++ b/vcl/inc/ios/svsys.h @@ -0,0 +1,17 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_IOS_SVSYS_H +#define INCLUDED_VCL_INC_IOS_SVSYS_H + +// ? + +#endif // INCLUDED_VCL_INC_IOS_SVSYS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/jobdata.hxx b/vcl/inc/jobdata.hxx new file mode 100644 index 000000000..714bcb381 --- /dev/null +++ b/vcl/inc/jobdata.hxx @@ -0,0 +1,87 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_JOBDATA_HXX +#define INCLUDED_VCL_JOBDATA_HXX + +#include "ppdparser.hxx" + +namespace psp { + +enum class orientation { + Portrait, + Landscape +}; + +struct VCL_DLLPUBLIC JobData +{ + int m_nCopies; + bool m_bCollate; + int m_nLeftMarginAdjust; + int m_nRightMarginAdjust; + int m_nTopMarginAdjust; + int m_nBottomMarginAdjust; + // user overrides for PPD + int m_nColorDepth; + int m_nPSLevel; // 0: no override, else languagelevel to use + int m_nColorDevice; // 0: no override, -1 grey scale, +1 color + int m_nPDFDevice; // 0: no override, -1 PostScript, +1: Automatically PDF, +2: Explicitly PDF + orientation m_eOrientation; + OUString m_aPrinterName; + bool m_bPapersizeFromSetup; + const PPDParser* m_pParser; + PPDContext m_aContext; + + JobData() : + m_nCopies( 1 ), + m_bCollate(false), + m_nLeftMarginAdjust( 0 ), + m_nRightMarginAdjust( 0 ), + m_nTopMarginAdjust( 0 ), + m_nBottomMarginAdjust( 0 ), + m_nColorDepth( 24 ), + m_nPSLevel( 0 ), + m_nColorDevice( 0 ), + m_nPDFDevice( 0 ), + m_eOrientation( orientation::Portrait ), + m_bPapersizeFromSetup( false ), + m_pParser( nullptr ) {} + + JobData& operator=(const psp::JobData& rRight); + + JobData( const JobData& rData ) { *this = rData; } + + void setCollate( bool bCollate ); + void setPaper( int nWidth, int nHeight ); // dimensions in pt + void setPaperBin( int nPaperBin ); + void resolveDefaultBackend(); + void setDefaultBackend(bool bUsePDF); + + // creates a new buffer using new + // it is up to the user to delete it again + bool getStreamBuffer( void*& pData, sal_uInt32& bytes ); + static bool constructFromStreamBuffer( const void* pData, sal_uInt32 bytes, JobData& rJobData ); +}; + +} // namespace + + +#endif // PSPRINT_JOBDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/jobset.h b/vcl/inc/jobset.h new file mode 100644 index 000000000..ce53c0541 --- /dev/null +++ b/vcl/inc/jobset.h @@ -0,0 +1,112 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_JOBSET_H +#define INCLUDED_VCL_INC_JOBSET_H + +#include <rtl/ustring.hxx> +#include <i18nutil/paper.hxx> +#include <vcl/dllapi.h> +#include <vcl/prntypes.hxx> +#include <unordered_map> + +// see com.sun.star.portal.client.JobSetupSystem.idl: +#define JOBSETUP_SYSTEM_WINDOWS 1 +#define JOBSETUP_SYSTEM_UNIX 3 +#define JOBSETUP_SYSTEM_MAC 4 + +class VCL_DLLPUBLIC ImplJobSetup +{ +private: + sal_uInt16 mnSystem; //< System - JOBSETUP_SYSTEM_xxxx + OUString maPrinterName; //< Printer-Name + OUString maDriver; //< Driver-Name + Orientation meOrientation; //< Orientation + DuplexMode meDuplexMode; //< Duplex + sal_uInt16 mnPaperBin; //< paper bin / in tray + Paper mePaperFormat; //< paper format + long mnPaperWidth; //< paper width (100th mm) + long mnPaperHeight; //< paper height (100th mm) + sal_uInt32 mnDriverDataLen; //< length of system specific data + sal_uInt8* mpDriverData; //< system specific data (will be streamed a byte block) + bool mbPapersizeFromSetup; + // setup mode + PrinterSetupMode meSetupMode; + // TODO: orig paper size + std::unordered_map< OUString, OUString > maValueMap; + +public: + ImplJobSetup(); + ImplJobSetup( const ImplJobSetup& rJobSetup ); + ~ImplJobSetup(); + + bool operator==( const ImplJobSetup& rImplJobSetup ) const; + + sal_uInt16 GetSystem() const { return mnSystem; } + void SetSystem(sal_uInt16 nSystem); + + const OUString& GetPrinterName() const { return maPrinterName; } + void SetPrinterName(const OUString& rPrinterName); + + const OUString& GetDriver() const { return maDriver; } + void SetDriver(const OUString& rDriver); + + Orientation GetOrientation() const { return meOrientation; } + void SetOrientation(Orientation eOrientation); + + DuplexMode GetDuplexMode() const { return meDuplexMode; } + void SetDuplexMode(DuplexMode eDuplexMode); + + sal_uInt16 GetPaperBin() const { return mnPaperBin; } + void SetPaperBin(sal_uInt16 nPaperBin); + + Paper GetPaperFormat() const { return mePaperFormat; } + void SetPaperFormat(Paper ePaperFormat); + + long GetPaperWidth() const { return mnPaperWidth; } + void SetPaperWidth(long nWidth); + + long GetPaperHeight() const { return mnPaperHeight; } + void SetPaperHeight(long nHeight); + + sal_uInt32 GetDriverDataLen() const { return mnDriverDataLen; } + void SetDriverDataLen(sal_uInt32 nDriverDataLen); + + const sal_uInt8* GetDriverData() const { return mpDriverData; } + void SetDriverData(sal_uInt8* pDriverData); + + bool GetPapersizeFromSetup() const { return mbPapersizeFromSetup; } + void SetPapersizeFromSetup(bool bPapersizeFromSetup); + + PrinterSetupMode GetPrinterSetupMode() const { return meSetupMode; } + void SetPrinterSetupMode(PrinterSetupMode eMode); + + const std::unordered_map< OUString, OUString >& GetValueMap() const + { return maValueMap; } + void SetValueMap(const OUString& rKey, const OUString& rValue); +}; + +// If paper format is PAPER_USER, in the system-independent part it will +// automatically be computed from paper width/height. +// If paper width/height is 0, in the system-independent part it will +// automatically be computed from paper format, if the latter is not PAPER_USER. + +#endif // INCLUDED_VCL_INC_JOBSET_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx new file mode 100644 index 000000000..d01521924 --- /dev/null +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -0,0 +1,133 @@ +#ifndef INCLUDED_VCL_INC_JSDIALOG_JSDIALOG_HXX +#define INCLUDED_VCL_INC_JSDIALOG_JSDIALOG_HXX + +#include <vcl/weld.hxx> +#include <comphelper/string.hxx> +#include <vcl/sysdata.hxx> +#include <vcl/virdev.hxx> +#include <vcl/builder.hxx> +#include <salvtables.hxx> +#include <vcl/toolkit/combobox.hxx> +#include <vcl/button.hxx> + +class JSDialogSender +{ + VclPtr<vcl::Window> m_aOwnedToplevel; + +public: + JSDialogSender(VclPtr<vcl::Window> aOwnedToplevel) + : m_aOwnedToplevel(aOwnedToplevel) + { + } + + void notifyDialogState(); +}; + +class VCL_DLLPUBLIC JSInstanceBuilder : public SalInstanceBuilder +{ +public: + JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile); + virtual std::unique_ptr<weld::Dialog> weld_dialog(const OString& id, + bool bTakeOwnership = true) override; + virtual std::unique_ptr<weld::Label> weld_label(const OString& id, + bool bTakeOwnership = false) override; + virtual std::unique_ptr<weld::Button> weld_button(const OString& id, + bool bTakeOwnership = false) override; + virtual std::unique_ptr<weld::Entry> weld_entry(const OString& id, + bool bTakeOwnership = false) override; + virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString& id, + bool bTakeOwnership = false) override; + virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString& id, + bool bTakeOwnership = false) override; +}; + +template <class BaseInstanceClass, class VclClass> +class JSWidget : public BaseInstanceClass, public JSDialogSender +{ +public: + JSWidget(VclPtr<vcl::Window> aOwnedToplevel, VclClass* pObject, SalInstanceBuilder* pBuilder, + bool bTakeOwnership) + : BaseInstanceClass(pObject, pBuilder, bTakeOwnership) + , JSDialogSender(aOwnedToplevel) + { + } + + virtual void show() override + { + BaseInstanceClass::show(); + notifyDialogState(); + } + + virtual void hide() override + { + BaseInstanceClass::hide(); + notifyDialogState(); + } + + virtual void set_sensitive(bool sensitive) override + { + BaseInstanceClass::set_sensitive(sensitive); + notifyDialogState(); + } +}; + +class VCL_DLLPUBLIC JSLabel : public JSWidget<SalInstanceLabel, FixedText> +{ +public: + JSLabel(VclPtr<vcl::Window> aOwnedToplevel, FixedText* pLabel, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + virtual void set_label(const OUString& rText) override; +}; + +class VCL_DLLPUBLIC JSButton : public JSWidget<SalInstanceButton, ::Button> +{ +public: + JSButton(VclPtr<vcl::Window> aOwnedToplevel, ::Button* pButton, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); +}; + +class VCL_DLLPUBLIC JSEntry : public JSWidget<SalInstanceEntry, ::Edit> +{ +public: + JSEntry(VclPtr<vcl::Window> aOwnedToplevel, ::Edit* pEntry, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + virtual void set_text(const OUString& rText) override; +}; + +class VCL_DLLPUBLIC JSListBox : public JSWidget<SalInstanceComboBoxWithoutEdit, ::ListBox> +{ +public: + JSListBox(VclPtr<vcl::Window> aOwnedToplevel, ::ListBox* pListBox, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + virtual void insert(int pos, const OUString& rStr, const OUString* pId, + const OUString* pIconName, VirtualDevice* pImageSurface) override; + virtual void remove(int pos) override; +}; + +class VCL_DLLPUBLIC JSComboBox : public JSWidget<SalInstanceComboBoxWithEdit, ::ComboBox> +{ +public: + JSComboBox(VclPtr<vcl::Window> aOwnedToplevel, ::ComboBox* pComboBox, + SalInstanceBuilder* pBuilder, bool bTakeOwnership); + virtual void insert(int pos, const OUString& rStr, const OUString* pId, + const OUString* pIconName, VirtualDevice* pImageSurface) override; + virtual void remove(int pos) override; + virtual void set_entry_text(const OUString& rText) override; +}; + +class VCL_DLLPUBLIC JSNotebook : public JSWidget<SalInstanceNotebook, ::TabControl> +{ +public: + JSNotebook(VclPtr<vcl::Window> aOwnedToplevel, ::TabControl* pControl, + SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void set_current_page(int nPage) override; + + virtual void set_current_page(const OString& rIdent) override; + + virtual void remove_page(const OString& rIdent) override; + + virtual void insert_page(const OString& rIdent, const OUString& rLabel, int nPos) override; +}; + +#endif diff --git a/vcl/inc/langboost.hxx b/vcl/inc/langboost.hxx new file mode 100644 index 000000000..84bdb2d84 --- /dev/null +++ b/vcl/inc/langboost.hxx @@ -0,0 +1,18 @@ +/* -*- 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/. + */ +#ifndef INCLUDED_VCL_INC_LANGBOOST_HXX +#define INCLUDED_VCL_INC_LANGBOOST_HXX + +namespace vcl +{ + const char* getLangBoost(); +} + +#endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/listbox.hxx b/vcl/inc/listbox.hxx new file mode 100644 index 000000000..1e4512eef --- /dev/null +++ b/vcl/inc/listbox.hxx @@ -0,0 +1,608 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_LISTBOX_HXX +#define INCLUDED_VCL_INC_LISTBOX_HXX + +#include <sal/config.h> + +#include <o3tl/safeint.hxx> +#include <vcl/toolkit/button.hxx> +#include <vcl/floatwin.hxx> +#include <vcl/quickselectionengine.hxx> +#include <vcl/glyphitem.hxx> +#include <vcl/vcllayout.hxx> + +#include <set> +#include <vector> +#include <memory> + +class ScrollBar; +class ScrollBarBox; + +#define HORZ_SCROLL 4 +#define IMG_TXT_DISTANCE 6 + +enum LB_EVENT_TYPE +{ + LET_MBDOWN, + LET_TRACKING, + LET_KEYMOVE, + LET_KEYSPACE +}; + +struct ImplEntryType +{ + OUString maStr; + SalLayoutGlyphs maStrGlyphs; + Image maImage; + void* mpUserData; + bool mbIsSelected; + ListBoxEntryFlags mnFlags; + long mnHeight; + + long getHeightWithMargin() const; + + ImplEntryType( const OUString& rStr, const Image& rImage ) : + maStr( rStr ), + maImage( rImage ), + mnFlags( ListBoxEntryFlags::NONE ), + mnHeight( 0 ) + { + mbIsSelected = false; + mpUserData = nullptr; + } + + ImplEntryType( const OUString& rStr ) : + maStr( rStr ), + mnFlags( ListBoxEntryFlags::NONE ), + mnHeight( 0 ) + { + mbIsSelected = false; + mpUserData = nullptr; + } + + /// Computes maStr's text layout (glyphs), cached in maStrGlyphs. + SalLayoutGlyphs* GetTextGlyphs(const OutputDevice* pOutputDevice); +}; + +class ImplEntryList +{ +private: + VclPtr<vcl::Window> mpWindow; ///< For getting the current locale when matching strings + sal_Int32 mnLastSelected; + sal_Int32 mnSelectionAnchor; + sal_Int32 mnImages; + + sal_Int32 mnMRUCount; + sal_Int32 mnMaxMRUCount; + + Link<sal_Int32,void> maSelectionChangedHdl; + bool mbCallSelectionChangedHdl; + std::vector<std::unique_ptr<ImplEntryType> > maEntries; + + ImplEntryType* GetEntry( sal_Int32 nPos ) const + { + if (nPos < 0 || o3tl::make_unsigned(nPos) >= maEntries.size()) + return nullptr; + return maEntries[nPos].get(); + } + +public: + ImplEntryList( vcl::Window* pWindow ); + ~ImplEntryList(); + + sal_Int32 InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry, bool bSort ); + void RemoveEntry( sal_Int32 nPos ); + const ImplEntryType* GetEntryPtr( sal_Int32 nPos ) const { return GetEntry( nPos ); } + ImplEntryType* GetMutableEntryPtr( sal_Int32 nPos ) const { return GetEntry( nPos ); } + void Clear(); + + sal_Int32 FindMatchingEntry( const OUString& rStr, sal_Int32 nStart, bool bLazy ) const; + sal_Int32 FindEntry( const OUString& rStr, bool bSearchMRUArea = false ) const; + + /// helper: add up heights up to index nEndIndex. + /// GetAddedHeight( 0 ) @return 0 + /// GetAddedHeight( LISTBOX_ENTRY_NOTFOUND ) @return 0 + /// GetAddedHeight( i, k ) with k > i is equivalent -GetAddedHeight( k, i ) + long GetAddedHeight( sal_Int32 nEndIndex, sal_Int32 nBeginIndex ) const; + long GetEntryHeight( sal_Int32 nPos ) const; + + sal_Int32 GetEntryCount() const { return static_cast<sal_Int32>(maEntries.size()); } + bool HasImages() const { return mnImages != 0; } + + OUString GetEntryText( sal_Int32 nPos ) const; + + bool HasEntryImage( sal_Int32 nPos ) const; + Image GetEntryImage( sal_Int32 nPos ) const; + + void SetEntryData( sal_Int32 nPos, void* pNewData ); + void* GetEntryData( sal_Int32 nPos ) const; + + void SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags ); + + void SelectEntry( sal_Int32 nPos, bool bSelect ); + + sal_Int32 GetSelectedEntryCount() const; + OUString GetSelectedEntry( sal_Int32 nIndex ) const; + sal_Int32 GetSelectedEntryPos( sal_Int32 nIndex ) const; + bool IsEntryPosSelected( sal_Int32 nIndex ) const; + + void SetLastSelected( sal_Int32 nPos ) { mnLastSelected = nPos; } + sal_Int32 GetLastSelected() const { return mnLastSelected; } + + void SetSelectionAnchor( sal_Int32 nPos ) { mnSelectionAnchor = nPos; } + sal_Int32 GetSelectionAnchor() const { return mnSelectionAnchor; } + + void SetSelectionChangedHdl( const Link<sal_Int32,void>& rLnk ) { maSelectionChangedHdl = rLnk; } + void SetCallSelectionChangedHdl( bool bCall ) { mbCallSelectionChangedHdl = bCall; } + + void SetMRUCount( sal_Int32 n ) { mnMRUCount = n; } + sal_Int32 GetMRUCount() const { return mnMRUCount; } + + void SetMaxMRUCount( sal_Int32 n ) { mnMaxMRUCount = n; } + sal_Int32 GetMaxMRUCount() const { return mnMaxMRUCount; } + + /** An Entry is selectable if its mnFlags does not have the + ListBoxEntryFlags::DisableSelection flag set. */ + bool IsEntrySelectable( sal_Int32 nPos ) const; + + /** @return the first entry found from the given position nPos that is selectable + or LISTBOX_ENTRY_NOTFOUND if non is found. If the entry at nPos is not selectable, + it returns the first selectable entry after nPos if bForward is true and the + first selectable entry after nPos is bForward is false. + */ + sal_Int32 FindFirstSelectable( sal_Int32 nPos, bool bForward = true ); +}; + +class ImplListBoxWindow : public Control, public vcl::ISearchableStringList +{ +private: + std::unique_ptr<ImplEntryList> mpEntryList; ///< EntryList + tools::Rectangle maFocusRect; + + Size maUserItemSize; + + long mnMaxTxtHeight; ///< Maximum height of a text item + long mnMaxTxtWidth; ///< Maximum width of a text item + ///< Entry without Image + long mnMaxImgTxtWidth;///< Maximum width of a text item + ///< Entry AND Image + long mnMaxImgWidth; ///< Maximum width of an image item + long mnMaxImgHeight; ///< Maximum height of an image item + long mnMaxWidth; ///< Maximum width of an entry + long mnMaxHeight; ///< Maximum height of an entry + + sal_Int32 mnCurrentPos; ///< Position (Focus) + sal_Int32 mnTrackingSaveSelection; ///< Selection before Tracking(); + + std::set< sal_Int32 > maSeparators; ///< Separator positions + + sal_Int32 mnUserDrawEntry; + + sal_Int32 mnTop; ///< output from line on + long mnLeft; ///< output from column on + long mnTextHeight; ///< text height + + sal_uInt16 mnSelectModifier; ///< Modifiers + + bool mbHasFocusRect : 1; + bool mbSort : 1; ///< ListBox sorted + bool mbTrack : 1; ///< Tracking + bool mbMulti : 1; ///< MultiListBox + bool mbStackMode : 1; ///< StackSelection + bool mbSimpleMode : 1; ///< SimpleMode for MultiListBox + bool mbTravelSelect : 1; ///< TravelSelect + bool mbTrackingSelect : 1; ///< Selected at a MouseMove + bool mbSelectionChanged : 1; ///< Do not call Select() too often ... + bool mbMouseMoveSelect : 1; ///< Select at MouseMove + bool mbGrabFocus : 1; ///< Grab focus at MBDown + bool mbUserDrawEnabled : 1; ///< UserDraw possible + bool mbInUserDraw : 1; ///< In UserDraw + bool mbReadOnly : 1; ///< ReadOnly + bool mbMirroring : 1; ///< pb: #106948# explicit mirroring for calc + bool mbCenter : 1; ///< center Text output + bool mbRight : 1; ///< right align Text output + bool mbEdgeBlending : 1; + /// Listbox is actually a dropdown (either combobox, or popup window treated as dropdown) + bool mbIsDropdown : 1; + + Link<ImplListBoxWindow*,void> maScrollHdl; + Link<LinkParamNone*,void> maSelectHdl; + Link<LinkParamNone*,void> maCancelHdl; + Link<ImplListBoxWindow*,void> maDoubleClickHdl; + Link<UserDrawEvent*, void> maUserDrawHdl; + Link<LinkParamNone*,void> maMRUChangedHdl; + Link<sal_Int32,void> maFocusHdl; + Link<LinkParamNone*,void> maListItemSelectHdl; + + vcl::QuickSelectionEngine maQuickSelectionEngine; + +protected: + virtual void KeyInput( const KeyEvent& rKEvt ) override; + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual void MouseMove( const MouseEvent& rMEvt ) override; + virtual void Tracking( const TrackingEvent& rTEvt ) override; + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; + virtual void Resize() override; + virtual void GetFocus() override; + virtual void LoseFocus() override; + + bool SelectEntries( sal_Int32 nSelect, LB_EVENT_TYPE eLET, bool bShift = false, bool bCtrl = false, bool bSelectPosChange = false ); + void ImplPaint(vcl::RenderContext& rRenderContext, sal_Int32 nPos); + void ImplDoPaint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect); + void ImplCalcMetrics(); + void ImplUpdateEntryMetrics( ImplEntryType& rEntry ); + void ImplCallSelect(); + + void ImplShowFocusRect(); + void ImplHideFocusRect(); + + virtual void StateChanged( StateChangedType nType ) override; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + +public: + virtual void FillLayoutData() const override; + + ImplListBoxWindow( vcl::Window* pParent, WinBits nWinStyle ); + virtual ~ImplListBoxWindow() override; + virtual void dispose() override; + + ImplEntryList* GetEntryList() const { return mpEntryList.get(); } + + sal_Int32 InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry ); // sorts using mbSort + sal_Int32 InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry, bool bSort ); // to insert ignoring mbSort, e.g. mru + void RemoveEntry( sal_Int32 nPos ); + void Clear(); + void ResetCurrentPos() { mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; } + sal_Int32 GetCurrentPos() const { return mnCurrentPos; } + sal_uInt16 GetDisplayLineCount() const; + void SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags ); + + void DrawEntry(vcl::RenderContext& rRenderContext, sal_Int32 nPos, bool bDrawImage, bool bDrawText); + + void SelectEntry( sal_Int32 nPos, bool bSelect ); + void DeselectAll(); + sal_Int32 GetEntryPosForPoint( const Point& rPoint ) const; + sal_Int32 GetLastVisibleEntry() const; + + bool ProcessKeyInput( const KeyEvent& rKEvt ); + + void SetTopEntry( sal_Int32 nTop ); + sal_Int32 GetTopEntry() const { return mnTop; } + /** ShowProminentEntry will set the entry corresponding to nEntryPos + either at top or in the middle depending on the chosen style*/ + void ShowProminentEntry( sal_Int32 nEntryPos ); + using Window::IsVisible; + bool IsVisible( sal_Int32 nEntry ) const; + + long GetLeftIndent() const { return mnLeft; } + void SetLeftIndent( long n ); + void ScrollHorz( long nDiff ); + + void AllowGrabFocus( bool b ) { mbGrabFocus = b; } + bool IsGrabFocusAllowed() const { return mbGrabFocus; } + + /** + * Removes existing separators, and sets the position of the + * one and only separator. + */ + void SetSeparatorPos( sal_Int32 n ); + /** + * Gets the position of the separator which was added first. + * Returns LISTBOX_ENTRY_NOTFOUND if there is no separator. + */ + sal_Int32 GetSeparatorPos() const; + + /** + * Adds a new separator at the given position n. + */ + void AddSeparator( sal_Int32 n ) { maSeparators.insert( n ); } + /** + * Checks if the given number n is an element of the separator positions set. + */ + bool isSeparator( const sal_Int32 &n ) const; + + void SetTravelSelect( bool bTravelSelect ) { mbTravelSelect = bTravelSelect; } + bool IsTravelSelect() const { return mbTravelSelect; } + bool IsTrackingSelect() const { return mbTrackingSelect; } + + void SetUserItemSize( const Size& rSz ); + + void EnableUserDraw( bool bUserDraw ) { mbUserDrawEnabled = bUserDraw; } + bool IsUserDrawEnabled() const { return mbUserDrawEnabled; } + + void EnableMultiSelection( bool bMulti, bool bStackMode ) { mbMulti = bMulti; mbStackMode = bStackMode; } + bool IsMultiSelectionEnabled() const { return mbMulti; } + + void SetMultiSelectionSimpleMode( bool bSimple ) { mbSimpleMode = bSimple; } + + void EnableMouseMoveSelect( bool bMouseMoveSelect ) { mbMouseMoveSelect = bMouseMoveSelect; } + bool IsMouseMoveSelect() const { return mbMouseMoveSelect||mbStackMode; } + + Size CalcSize(sal_Int32 nMaxLines) const; + tools::Rectangle GetBoundingRectangle( sal_Int32 nItem ) const; + + long GetEntryHeight() const { return mnMaxHeight; } + long GetEntryHeightWithMargin() const; + long GetMaxEntryWidth() const { return mnMaxWidth; } + + void SetScrollHdl( const Link<ImplListBoxWindow*,void>& rLink ) { maScrollHdl = rLink; } + void SetSelectHdl( const Link<LinkParamNone*,void>& rLink ) { maSelectHdl = rLink; } + void SetCancelHdl( const Link<LinkParamNone*,void>& rLink ) { maCancelHdl = rLink; } + void SetDoubleClickHdl( const Link<ImplListBoxWindow*,void>& rLink ) { maDoubleClickHdl = rLink; } + void SetUserDrawHdl( const Link<UserDrawEvent*, void>& rLink ) { maUserDrawHdl = rLink; } + void SetMRUChangedHdl( const Link<LinkParamNone*,void>& rLink ) { maMRUChangedHdl = rLink; } + void SetFocusHdl( const Link<sal_Int32,void>& rLink ) { maFocusHdl = rLink ; } + + void SetListItemSelectHdl( const Link<LinkParamNone*,void>& rLink ) { maListItemSelectHdl = rLink ; } + bool IsSelectionChanged() const { return mbSelectionChanged; } + sal_uInt16 GetSelectModifier() const { return mnSelectModifier; } + + void EnableSort( bool b ) { mbSort = b; } + + void SetReadOnly( bool bReadOnly ) { mbReadOnly = bReadOnly; } + bool IsReadOnly() const { return mbReadOnly; } + + DrawTextFlags ImplGetTextStyle() const; + + /// pb: #106948# explicit mirroring for calc + void EnableMirroring() { mbMirroring = true; } + bool IsMirroring() const { return mbMirroring; } + + bool GetEdgeBlending() const { return mbEdgeBlending; } + void SetEdgeBlending(bool bNew) { mbEdgeBlending = bNew; } + + using Control::ImplInitSettings; + virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; + +protected: + // ISearchableStringList + virtual vcl::StringEntryIdentifier CurrentEntry( OUString& _out_entryText ) const override; + virtual vcl::StringEntryIdentifier NextEntry( vcl::StringEntryIdentifier _currentEntry, OUString& _out_entryText ) const override; + virtual void SelectEntry( vcl::StringEntryIdentifier _entry ) override; +}; + +class ImplListBox : public Control +{ +private: + VclPtr<ImplListBoxWindow> maLBWindow; + VclPtr<ScrollBar> mpHScrollBar; + VclPtr<ScrollBar> mpVScrollBar; + VclPtr<ScrollBarBox> mpScrollBarBox; + + bool mbVScroll : 1; // VScroll on or off + bool mbHScroll : 1; // HScroll on or off + bool mbAutoHScroll : 1; // AutoHScroll on or off + bool mbEdgeBlending : 1; + + Link<ImplListBox*,void> maScrollHdl; // because it is needed by ImplListBoxWindow itself + +protected: + virtual void GetFocus() override; + virtual void StateChanged( StateChangedType nType ) override; + + virtual bool EventNotify( NotifyEvent& rNEvt ) override; + + void ImplResizeControls(); + void ImplCheckScrollBars(); + void ImplInitScrollBars(); + + DECL_LINK( ScrollBarHdl, ScrollBar*, void ); + DECL_LINK( LBWindowScrolled, ImplListBoxWindow*, void ); + DECL_LINK( MRUChanged, LinkParamNone*, void ); + +public: + ImplListBox( vcl::Window* pParent, WinBits nWinStyle ); + virtual ~ImplListBox() override; + virtual void dispose() override; + + const ImplEntryList* GetEntryList() const { return maLBWindow->GetEntryList(); } + ImplListBoxWindow* GetMainWindow() { return maLBWindow.get(); } + + virtual void Resize() override; + virtual const Wallpaper& GetDisplayBackground() const override; + + sal_Int32 InsertEntry( sal_Int32 nPos, const OUString& rStr ); + sal_Int32 InsertEntry( sal_Int32 nPos, const OUString& rStr, const Image& rImage ); + void RemoveEntry( sal_Int32 nPos ); + void SetEntryData( sal_Int32 nPos, void* pNewData ) { maLBWindow->GetEntryList()->SetEntryData( nPos, pNewData ); } + void Clear(); + + void SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags ); + + void SelectEntry( sal_Int32 nPos, bool bSelect ); + void SetNoSelection(); + void ResetCurrentPos() { maLBWindow->ResetCurrentPos(); } + sal_Int32 GetCurrentPos() const { return maLBWindow->GetCurrentPos(); } + + bool ProcessKeyInput( const KeyEvent& rKEvt ) { return maLBWindow->ProcessKeyInput( rKEvt ); } + bool HandleWheelAsCursorTravel( const CommandEvent& rCEvt ); + + /** + * Removes existing separators, and sets the position of the + * one and only separator. + */ + void SetSeparatorPos( sal_Int32 n ) { maLBWindow->SetSeparatorPos( n ); } + /** + * Gets the position of the separator which was added first. + * Returns LISTBOX_ENTRY_NOTFOUND if there is no separator. + */ + sal_Int32 GetSeparatorPos() const { return maLBWindow->GetSeparatorPos(); } + + /** + * Adds a new separator at the given position n. + */ + void AddSeparator( sal_Int32 n ) { maLBWindow->AddSeparator( n ); } + + void SetTopEntry( sal_Int32 nTop ) { maLBWindow->SetTopEntry( nTop ); } + sal_Int32 GetTopEntry() const { return maLBWindow->GetTopEntry(); } + void ShowProminentEntry( sal_Int32 nPos ) { maLBWindow->ShowProminentEntry( nPos ); } + using Window::IsVisible; + bool IsVisible( sal_Int32 nEntry ) const { return maLBWindow->IsVisible( nEntry ); } + + long GetLeftIndent() const { return maLBWindow->GetLeftIndent(); } + void SetLeftIndent( sal_uInt16 n ) { maLBWindow->SetLeftIndent( n ); } + + void SetTravelSelect( bool bTravelSelect ) { maLBWindow->SetTravelSelect( bTravelSelect ); } + bool IsTravelSelect() const { return maLBWindow->IsTravelSelect(); } + bool IsTrackingSelect() const { return maLBWindow->IsTrackingSelect(); } + + void EnableMultiSelection( bool bMulti, bool bStackMode ) { maLBWindow->EnableMultiSelection( bMulti, bStackMode ); } + bool IsMultiSelectionEnabled() const { return maLBWindow->IsMultiSelectionEnabled(); } + + void SetMultiSelectionSimpleMode( bool bSimple ) { maLBWindow->SetMultiSelectionSimpleMode( bSimple ); } + + void SetReadOnly( bool b ) { maLBWindow->SetReadOnly( b ); } + bool IsReadOnly() const { return maLBWindow->IsReadOnly(); } + + Size CalcSize( sal_Int32 nMaxLines ) const { return maLBWindow->CalcSize( nMaxLines ); } + long GetEntryHeight() const { return maLBWindow->GetEntryHeight(); } + long GetEntryHeightWithMargin() const{ return maLBWindow->GetEntryHeightWithMargin(); } + long GetMaxEntryWidth() const { return maLBWindow->GetMaxEntryWidth(); } + + void SetScrollHdl( const Link<ImplListBox*,void>& rLink ) { maScrollHdl = rLink; } + void SetSelectHdl( const Link<LinkParamNone*,void>& rLink ) { maLBWindow->SetSelectHdl( rLink ); } + void SetCancelHdl( const Link<LinkParamNone*,void>& rLink ) { maLBWindow->SetCancelHdl( rLink ); } + void SetDoubleClickHdl( const Link<ImplListBoxWindow*,void>& rLink ) { maLBWindow->SetDoubleClickHdl( rLink ); } + void SetUserDrawHdl( const Link<UserDrawEvent*, void>& rLink ) { maLBWindow->SetUserDrawHdl( rLink ); } + void SetFocusHdl( const Link<sal_Int32,void>& rLink ) { maLBWindow->SetFocusHdl( rLink ); } + void SetListItemSelectHdl( const Link<LinkParamNone*,void>& rLink ) { maLBWindow->SetListItemSelectHdl( rLink ); } + void SetSelectionChangedHdl( const Link<sal_Int32,void>& rLnk ) { maLBWindow->GetEntryList()->SetSelectionChangedHdl( rLnk ); } + void SetCallSelectionChangedHdl( bool bCall ) { maLBWindow->GetEntryList()->SetCallSelectionChangedHdl( bCall ); } + bool IsSelectionChanged() const { return maLBWindow->IsSelectionChanged(); } + sal_uInt16 GetSelectModifier() const { return maLBWindow->GetSelectModifier(); } + + void SetMRUEntries( const OUString& rEntries, sal_Unicode cSep ); + OUString GetMRUEntries( sal_Unicode cSep ) const; + void SetMaxMRUCount( sal_Int32 n ) { maLBWindow->GetEntryList()->SetMaxMRUCount( n ); } + sal_Int32 GetMaxMRUCount() const { return maLBWindow->GetEntryList()->GetMaxMRUCount(); } + sal_uInt16 GetDisplayLineCount() const + { return maLBWindow->GetDisplayLineCount(); } + + bool GetEdgeBlending() const { return mbEdgeBlending; } + void SetEdgeBlending(bool bNew); + + /// pb: #106948# explicit mirroring for calc + void EnableMirroring() { maLBWindow->EnableMirroring(); } +}; + +class ImplListBoxFloatingWindow : public FloatingWindow +{ +private: + VclPtr<ImplListBox> mpImplLB; + Size maPrefSz; + sal_uInt16 mnDDLineCount; + sal_Int32 mnPopupModeStartSaveSelection; + bool mbAutoWidth; + +protected: + virtual bool PreNotify( NotifyEvent& rNEvt ) override; + +public: + ImplListBoxFloatingWindow( vcl::Window* pParent ); + virtual ~ImplListBoxFloatingWindow() override; + virtual void dispose() override; + void SetImplListBox( ImplListBox* pLB ) { mpImplLB = pLB; } + + void SetPrefSize( const Size& rSz ) { maPrefSz = rSz; } + const Size& GetPrefSize() const { return maPrefSz; } + + void SetAutoWidth( bool b ) { mbAutoWidth = b; } + + Size CalcFloatSize(); + void StartFloat( bool bStartTracking ); + + virtual void setPosSizePixel( long nX, long nY, + long nWidth, long nHeight, PosSizeFlags nFlags = PosSizeFlags::All ) override; + + void SetDropDownLineCount( sal_uInt16 n ) { mnDDLineCount = n; } + sal_uInt16 GetDropDownLineCount() const { return mnDDLineCount; } + + sal_Int32 GetPopupModeStartSaveSelection() const { return mnPopupModeStartSaveSelection; } + + virtual void Resize() override; +}; + +class ImplWin : public Control +{ +private: + + sal_Int32 mnItemPos; ///< because of UserDraw I have to know which item I draw + OUString maString; + Image maImage; + + tools::Rectangle maFocusRect; + + Link<void*,void> maMBDownHdl; + + bool mbEdgeBlending : 1; + + void ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout = false); +protected: + virtual void FillLayoutData() const override; + +public: + ImplWin( vcl::Window* pParent, WinBits nWinStyle ); + + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; + virtual void Resize() override; + virtual void GetFocus() override; + virtual void LoseFocus() override; + virtual bool PreNotify( NotifyEvent& rNEvt ) override; + + sal_Int32 GetItemPos() const { return mnItemPos; } + void SetItemPos( sal_Int32 n ) { mnItemPos = n; } + + void SetString( const OUString& rStr ) { maString = rStr; } + + void SetImage( const Image& rImg ) { maImage = rImg; } + + void SetMBDownHdl( const Link<void*,void>& rLink ) { maMBDownHdl = rLink; } + + void DrawEntry(vcl::RenderContext& rRenderContext, bool bLayout); + + bool GetEdgeBlending() const { return mbEdgeBlending; } + void SetEdgeBlending(bool bNew) { mbEdgeBlending = bNew; } + + virtual void ShowFocus(const tools::Rectangle& rRect) override; + + using Control::ImplInitSettings; + virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; + +}; + +class ImplBtn : public PushButton +{ +private: + Link<void*,void> maMBDownHdl; + +public: + ImplBtn( vcl::Window* pParent, WinBits nWinStyle ); + + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + void SetMBDownHdl( const Link<void*,void>& rLink ) { maMBDownHdl = rLink; } +}; + +void ImplInitDropDownButton( PushButton* pButton ); + +#endif // INCLUDED_VCL_INC_LISTBOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/messagedialog.hxx b/vcl/inc/messagedialog.hxx new file mode 100644 index 000000000..679767be7 --- /dev/null +++ b/vcl/inc/messagedialog.hxx @@ -0,0 +1,58 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_MESSAGEDIALOG_HXX +#define INCLUDED_VCL_INC_MESSAGEDIALOG_HXX + +#include <vcl/toolkit/dialog.hxx> +#include <vcl/layout.hxx> +#include <vcl/fixed.hxx> + +class MessageDialog : public Dialog +{ +private: + VclButtonsType m_eButtonsType; + VclMessageType m_eMessageType; + VclPtr<VclBox> m_pOwnedContentArea; + VclPtr<VclButtonBox> m_pOwnedActionArea; + VclPtr<VclGrid> m_pGrid; + VclPtr<VclVBox> m_pMessageBox; + VclPtr<FixedImage> m_pImage; + VclPtr<VclMultiLineEdit> m_pPrimaryMessage; + VclPtr<VclMultiLineEdit> m_pSecondaryMessage; + OUString m_sPrimaryString; + OUString m_sSecondaryString; + void create_owned_areas(); + + static void SetMessagesWidths(vcl::Window const* pParent, VclMultiLineEdit* pPrimaryMessage, + VclMultiLineEdit* pSecondaryMessage); + + friend class VclPtr<MessageDialog>; + MessageDialog(vcl::Window* pParent, WinBits nStyle); + + virtual void StateChanged(StateChangedType nType) override; + +public: + MessageDialog(vcl::Window* pParent, const OUString& rMessage, VclMessageType eMessageType, + VclButtonsType eButtonsType); + virtual bool set_property(const OString& rKey, const OUString& rValue) override; + OUString const& get_primary_text() const; + OUString const& get_secondary_text() const; + void set_primary_text(const OUString& rPrimaryString); + void set_secondary_text(const OUString& rSecondaryString); + virtual ~MessageDialog() override; + virtual void dispose() override; + + void create_message_area(); + VclContainer* get_message_area() const { return m_pMessageBox.get(); } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/BufferObject.hxx b/vcl/inc/opengl/BufferObject.hxx new file mode 100644 index 000000000..396de89de --- /dev/null +++ b/vcl/inc/opengl/BufferObject.hxx @@ -0,0 +1,84 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_BUFFEROBJECT_H +#define INCLUDED_VCL_INC_OPENGL_BUFFEROBJECT_H + +namespace vcl +{ + +template<typename TYPE, GLenum BUFFER_TYPE> +class BufferObject +{ +private: + GLuint mId; + +public: + BufferObject() + : mId(0) + { + glGenBuffers(1, &mId); + CHECK_GL_ERROR(); + } + + virtual ~BufferObject() + { + if (mId) + { + glDeleteBuffers(1, &mId); + CHECK_GL_ERROR(); + mId = 0; + } + } + + void bind() + { + if (mId) + { + glBindBuffer(BUFFER_TYPE, mId); + CHECK_GL_ERROR(); + } + } + + void unbind() + { + if (mId) + { + glBindBuffer(BUFFER_TYPE, 0); + CHECK_GL_ERROR(); + } + } + + void upload(const std::vector<TYPE>& rData) + { + if (mId) + { + bind(); + glBufferData(BUFFER_TYPE, sizeof(TYPE) * rData.size(), rData.data(), GL_STATIC_DRAW); + CHECK_GL_ERROR(); + } + } + +}; + +template<typename TYPE> +class VertexBufferObject final : public BufferObject<TYPE, GL_ARRAY_BUFFER> +{ +}; + +class IndexBufferObject final : public BufferObject<GLuint, GL_ELEMENT_ARRAY_BUFFER> +{ +}; + +} // end vcl + +#endif // INCLUDED_VCL_INC_OPENGL_BUFFEROBJECT_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/DeviceInfo.hxx b/vcl/inc/opengl/DeviceInfo.hxx new file mode 100644 index 000000000..b0ad3a6cf --- /dev/null +++ b/vcl/inc/opengl/DeviceInfo.hxx @@ -0,0 +1,23 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_DEVICEINFO_HXX +#define INCLUDED_VCL_INC_OPENGL_DEVICEINFO_HXX + +class OpenGLDeviceInfo +{ +public: + virtual ~OpenGLDeviceInfo() = 0; + + virtual bool isDeviceBlocked() = 0; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/FixedTextureAtlas.hxx b/vcl/inc/opengl/FixedTextureAtlas.hxx new file mode 100644 index 000000000..e576fcb54 --- /dev/null +++ b/vcl/inc/opengl/FixedTextureAtlas.hxx @@ -0,0 +1,47 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_FIXEDTEXTUREATLAS_HXX +#define INCLUDED_VCL_INC_OPENGL_FIXEDTEXTUREATLAS_HXX + +#include <memory> +#include <opengl/texture.hxx> + +struct FixedTexture; + +class FixedTextureAtlasManager final +{ + std::vector<std::unique_ptr<FixedTexture>> maFixedTextures; + + int mWidthFactor; + int mHeightFactor; + int mSubTextureSize; + + void CreateNewTexture(); + + FixedTextureAtlasManager( const FixedTextureAtlasManager& ) = delete; + FixedTextureAtlasManager& operator=( const FixedTextureAtlasManager& ) = delete; + +public: + FixedTextureAtlasManager(int nWidthFactor, int nHeightFactor, int nTextureSize); + ~FixedTextureAtlasManager(); + + OpenGLTexture InsertBuffer(int nWidth, int nHeight, int nFormat, int nType, sal_uInt8 const * pData); + OpenGLTexture Reserve(int nWidth, int nHeight); + + int GetSubtextureSize() const + { + return mSubTextureSize; + } +}; + +#endif // INCLUDED_VCL_INC_OPENGL_FIXEDTEXTUREATLAS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/LineRenderUtils.hxx b/vcl/inc/opengl/LineRenderUtils.hxx new file mode 100644 index 000000000..8d97fa3ee --- /dev/null +++ b/vcl/inc/opengl/LineRenderUtils.hxx @@ -0,0 +1,55 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_LINERENDERUTILS_H +#define INCLUDED_VCL_INC_OPENGL_LINERENDERUTILS_H + +#include <opengl/RenderList.hxx> + +namespace vcl +{ +class LineBuilder +{ +private: + std::vector<Vertex>& mrVertices; + std::vector<GLuint>& mrIndices; + GLubyte mR, mG, mB, mA; + GLfloat mfLineWidth; + GLfloat mfLineWidthAndAA; + size_t mnInitialIndexSize; + bool mbIncomplete; + +public: + LineBuilder(std::vector<Vertex>& rVertices, std::vector<GLuint>& rIndices, + Color nColor, GLfloat fTransparency, + GLfloat fLineWidth, bool bUseAA); + + void appendLineSegment(const glm::vec2& rPoint1, const glm::vec2& rNormal1, GLfloat aExtrusion1, + const glm::vec2& rPoint2, const glm::vec2& rNormal2, GLfloat aExtrusion2); + + void appendLine(const glm::vec2& rPoint1, const glm::vec2& rPoint2); + + void appendAndConnectLinePoint(const glm::vec2& rPoint, const glm::vec2& aNormal, GLfloat aExtrusion); + + void appendMiterJoint(glm::vec2 const& point, const glm::vec2& prevLineVector, + glm::vec2 const& nextLineVector); + void appendBevelJoint(glm::vec2 const& point, const glm::vec2& prevLineVector, + const glm::vec2& nextLineVector); + void appendRoundJoint(glm::vec2 const& point, const glm::vec2& prevLineVector, + const glm::vec2& nextLineVector); + void appendRoundLineCapVertices(const glm::vec2& rPoint1, const glm::vec2& rPoint2); + void appendSquareLineCapVertices(const glm::vec2& rPoint1, const glm::vec2& rPoint2); +}; + +} // end vcl + +#endif // INCLUDED_VCL_INC_OPENGL_LINERENDERUTILS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/PackedTextureAtlas.hxx b/vcl/inc/opengl/PackedTextureAtlas.hxx new file mode 100644 index 000000000..7a283aa45 --- /dev/null +++ b/vcl/inc/opengl/PackedTextureAtlas.hxx @@ -0,0 +1,57 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_PACKEDTEXTUREATLAS_HXX +#define INCLUDED_VCL_INC_OPENGL_PACKEDTEXTUREATLAS_HXX + +#include <memory> +#include <opengl/texture.hxx> + +struct PackedTexture; + +/** + * Pack textures into one texture atlas. + * + * This is based on algorithm described in [1] and is an + * adaptation of "texture atlas generator" from [2]. + * + * [1]: http://www.blackpawn.com/texts/lightmaps/ + * [2]: https://github.com/lukaszdk/texture-atlas-generator + * + */ +class VCL_DLLPUBLIC PackedTextureAtlasManager final +{ + std::vector<std::unique_ptr<PackedTexture>> maPackedTextures; + + int mnTextureWidth; + int mnTextureHeight; + + void CreateNewTexture(); + + PackedTextureAtlasManager( const PackedTextureAtlasManager& ) = delete; + PackedTextureAtlasManager& operator=( const PackedTextureAtlasManager& ) = delete; + +public: + + /** + * nTextureWidth and nTextureHeight are the dimensions of the common texture(s) + * nTextureLimit is the maximum limit of that a texture atlas can have (0 or less - unlimited) + */ + PackedTextureAtlasManager(int nTextureWidth, int nTextureHeight); + ~PackedTextureAtlasManager(); + + OpenGLTexture InsertBuffer(int nWidth, int nHeight, int nFormat, int nType, sal_uInt8 const * pData); + OpenGLTexture Reserve(int nWidth, int nHeight); + std::vector<GLuint> ReduceTextureNumber(int nMaxNumberOfTextures); +}; + +#endif // INCLUDED_VCL_INC_OPENGL_PACKEDTEXTUREATLAS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/RenderList.hxx b/vcl/inc/opengl/RenderList.hxx new file mode 100644 index 000000000..213a2f43b --- /dev/null +++ b/vcl/inc/opengl/RenderList.hxx @@ -0,0 +1,173 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_RENDERLIST_H +#define INCLUDED_VCL_INC_OPENGL_RENDERLIST_H + +#include <unordered_map> + +#include <glm/glm.hpp> + +#include <vcl/salgtype.hxx> +#include <basegfx/range/b2drange.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> + +#include <opengl/texture.hxx> + +#include <com/sun/star/drawing/LineCap.hpp> + +struct Vertex +{ + glm::vec2 position; + glm::vec4 color; + glm::vec4 lineData; +}; + +static_assert(sizeof(Vertex) == (2*4 + 4*4 + 4*4), "Vertex struct has wrong size/alignment"); + + +struct RenderParameters +{ + std::vector<Vertex> maVertices; + std::vector<GLuint> maIndices; +}; + +struct RenderTextureParameters +{ + std::vector<GLfloat> maVertices; + std::vector<GLfloat> maTextureCoords; + std::vector<GLubyte> maColors; + OpenGLTexture maTexture; +}; + +struct RenderEntry +{ + basegfx::B2DRange maOverlapTrackingRectangle; + + RenderParameters maTriangleParameters; + RenderParameters maLineParameters; + + std::unordered_map<GLuint, RenderTextureParameters> maTextureParametersMap; + + bool hasTriangles() const + { + return !maTriangleParameters.maVertices.empty(); + } + + bool hasLines() const + { + return !maLineParameters.maVertices.empty(); + } + + bool hasTextures() const + { + return !maTextureParametersMap.empty(); + } +}; + +class RenderList +{ +private: + std::vector<RenderEntry> maRenderEntries; + std::vector<basegfx::B2DRange> maRectangles; + + bool doesOverlap(const basegfx::B2DRange& rDrawRectangle) + { + if (!maRenderEntries.back().maOverlapTrackingRectangle.overlaps(rDrawRectangle)) + return false; + + for (const basegfx::B2DRange& rRectangle : maRectangles) + { + if (rRectangle.overlaps(rDrawRectangle)) + return true; + } + return false; + } + + void checkOverlapping(const basegfx::B2DRange& rDrawRectangle) + { + if (maRenderEntries.empty() || doesOverlap(rDrawRectangle)) + { + maRenderEntries.emplace_back(); + maRenderEntries.back().maOverlapTrackingRectangle = rDrawRectangle; + + maRectangles.clear(); + maRectangles.reserve(30); + maRectangles.push_back(rDrawRectangle); + } + else + { + maRenderEntries.back().maOverlapTrackingRectangle.expand(rDrawRectangle); + + if (maRectangles.size() < 30) + { + maRectangles.push_back(rDrawRectangle); + } + else + { + basegfx::B2DRange aTempRectangle(maRectangles[0]); + aTempRectangle.expand(rDrawRectangle); + double minArea = aTempRectangle.getWidth() * aTempRectangle.getHeight(); + size_t index = 0; + + double area; + for (size_t i = 1; i < maRectangles.size(); ++i) + { + aTempRectangle = maRectangles[i]; + aTempRectangle.expand(rDrawRectangle); + area = aTempRectangle.getWidth() * aTempRectangle.getHeight(); + if (area < minArea) + index = i; + } + maRectangles[index].expand(rDrawRectangle); + } + } + } + +public: + + RenderList() = default; + + bool empty() + { + return maRenderEntries.empty(); + } + + void clear() + { + maRenderEntries.clear(); + } + + std::vector<RenderEntry>& getEntries() + { + return maRenderEntries; + } + + VCL_DLLPUBLIC void addDrawTextureWithMaskColor(OpenGLTexture const & rTexture, Color nColor, const SalTwoRect& r2Rect); + + void addDrawPixel(long nX, long nY, Color nColor); + + void addDrawRectangle(long nX, long nY, long nWidth, long nHeight, double fTransparency, + Color nLineColor, Color nFillColor); + + void addDrawLine(long nX1, long nY1, long nX2, long nY2, Color nLineColor, bool bUseAA); + + void addDrawPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon, double fTransparency, + Color nLineColor, Color nFillColor, bool bUseAA); + + void addDrawPolyLine(const basegfx::B2DPolygon& rPolygon, double fTransparency, + double fLineWidth, basegfx::B2DLineJoin eLineJoin, + css::drawing::LineCap eLineCap, double fMiterMinimumAngle, + Color nLineColor, bool bUseAA); +}; + +#endif // INCLUDED_VCL_INC_OPENGL_RENDERLIST_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/RenderState.hxx b/vcl/inc/opengl/RenderState.hxx new file mode 100644 index 000000000..3a89344e2 --- /dev/null +++ b/vcl/inc/opengl/RenderState.hxx @@ -0,0 +1,188 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_RENDER_STATE_H +#define INCLUDED_VCL_INC_OPENGL_RENDER_STATE_H + +#include <opengl/TextureState.hxx> + +template<GLenum ENUM_TYPE, typename TYPE> +class GenericCapabilityState +{ +protected: + bool mbTest; + + GenericCapabilityState() + : mbTest(false) + { + } + + static bool readState() + { + return glIsEnabled(ENUM_TYPE); + } + +public: + void sync() + { + mbTest = readState(); + } + + void enable() + { + if (!mbTest) + { + glEnable(ENUM_TYPE); + CHECK_GL_ERROR(); + mbTest = true; + } + else + { + VCL_GL_INFO(TYPE::className() << ": enable called but already enabled"); + } +#ifdef DBG_UTIL + checkState(); +#endif + } + + void disable() + { + if (mbTest) + { + glDisable(ENUM_TYPE); + CHECK_GL_ERROR(); + mbTest = false; + } + else + { + VCL_GL_INFO(TYPE::className() << ": disable called but already disabled"); + } +#ifdef DBG_UTIL + checkState(); +#endif + } + +#ifdef DBG_UTIL + void checkState() + { + bool bRealState = readState(); + if (mbTest != bRealState) + { + VCL_GL_INFO(TYPE::className() << " mismatch! " + << "Expected: " << (mbTest ? "enabled" : "disabled") + << " but is: " << (bRealState ? "enabled" : "disabled")); + } + } +#endif +}; + +class ScissorState : public GenericCapabilityState<GL_SCISSOR_TEST, ScissorState> +{ +private: + int mX; + int mY; + int mWidth; + int mHeight; + +public: + static std::string className() { return std::string("ScissorState"); } + + ScissorState() + : mX(0) + , mY(0) + , mWidth(0) + , mHeight(0) + {} + + void set(int x, int y, int width, int height) + { + if (x != mX || y != mY || width != mWidth || height != mHeight) + { + glScissor(x, y, width, height); + CHECK_GL_ERROR(); + + mX = x; + mY = y; + mWidth = width; + mHeight = height; + } + } +}; + +class StencilState : public GenericCapabilityState<GL_STENCIL_TEST, StencilState> +{ +public: + static std::string className() { return std::string("StencilState"); } +}; + +class BlendState : public GenericCapabilityState<GL_BLEND, BlendState> +{ + GLenum mnSourceMode; + GLenum mnDestinationMode; +public: + BlendState() + : mnSourceMode(GL_ZERO) + , mnDestinationMode(GL_ZERO) + {} + + static std::string className() { return std::string("BlendState"); } + + void func(GLenum nSource, GLenum nDestination) + { + if (mnSourceMode != nSource || mnDestinationMode != nDestination) + { + glBlendFunc(nSource, nDestination); + CHECK_GL_ERROR(); + mnSourceMode = nSource; + mnDestinationMode = nDestination; + } + } +}; + +class RenderState +{ + TextureState maTexture; + ScissorState maScissor; + StencilState maStencil; + BlendState maBlend; + + tools::Rectangle maCurrentViewport; + +public: + RenderState() + {} + + void viewport(tools::Rectangle aViewPort) + { + if (aViewPort != maCurrentViewport) + { + glViewport(aViewPort.Left(), aViewPort.Top(), aViewPort.GetWidth(), aViewPort.GetHeight()); + CHECK_GL_ERROR(); + maCurrentViewport = aViewPort; + } + } + + TextureState& texture() { return maTexture; } + ScissorState& scissor() { return maScissor; } + StencilState& stencil() { return maStencil; } + BlendState& blend() { return maBlend; } + + void sync() + { + VCL_GL_INFO("RenderState::sync"); + maScissor.sync(); + maStencil.sync(); + maBlend.sync(); + } +}; + +#endif // INCLUDED_VCL_INC_OPENGL_RENDER_STATE_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/TextureState.hxx b/vcl/inc/opengl/TextureState.hxx new file mode 100644 index 000000000..fbf2b9cee --- /dev/null +++ b/vcl/inc/opengl/TextureState.hxx @@ -0,0 +1,76 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_TEXTURE_STATE_H +#define INCLUDED_VCL_INC_OPENGL_TEXTURE_STATE_H + +#include <vcl/opengl/OpenGLHelper.hxx> + +class TextureState +{ +private: + GLuint mnCurrentTextureUnit; + std::vector<GLuint> maBoundTextures; + +public: + TextureState() + : mnCurrentTextureUnit(0) + , maBoundTextures(4, 0) + {} + + static void generate(GLuint& nTexture) + { + glGenTextures(1, &nTexture); + CHECK_GL_ERROR(); + } + + void active(GLuint nTextureUnit) + { + if (mnCurrentTextureUnit != nTextureUnit) + { + glActiveTexture(GL_TEXTURE0 + nTextureUnit); + CHECK_GL_ERROR(); + mnCurrentTextureUnit = nTextureUnit; + } + + } + + void bind(GLuint nTexture) + { + if (maBoundTextures[mnCurrentTextureUnit] != nTexture) + { + glBindTexture(GL_TEXTURE_2D, nTexture); + CHECK_GL_ERROR(); + maBoundTextures[mnCurrentTextureUnit] = nTexture; + } + } + + void unbindAndDelete(GLuint nTexture) + { + unbind(nTexture); + glDeleteTextures(1, &nTexture); + } + + void unbind(GLuint nTexture) + { + for (size_t i = 0; i < maBoundTextures.size(); i++) + { + if (nTexture == maBoundTextures[i]) + maBoundTextures[i] = 0; + } + } + +}; + + + +#endif // INCLUDED_VCL_INC_OPENGL_TEXTURE_STATE_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/VertexUtils.hxx b/vcl/inc/opengl/VertexUtils.hxx new file mode 100644 index 000000000..910b8725a --- /dev/null +++ b/vcl/inc/opengl/VertexUtils.hxx @@ -0,0 +1,120 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_VERTEXUTILS_H +#define INCLUDED_VCL_INC_OPENGL_VERTEXUTILS_H + +#include <basegfx/numeric/ftools.hxx> +#include <epoxy/gl.h> +#include <glm/gtx/norm.hpp> +#include <tools/color.hxx> +#include <vector> + +namespace vcl +{ +namespace vertex +{ + +template<GLenum TYPE> +inline void addRectangle(std::vector<GLfloat>& rVertices, GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); + +template<> +inline void addRectangle<GL_TRIANGLES>(std::vector<GLfloat>& rVertices, GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) +{ + rVertices.insert(rVertices.end(), { + x1, y1, x2, y1, x1, y2, + x1, y2, x2, y1, x2, y2 + }); +} + +template<> +inline void addRectangle<GL_TRIANGLE_FAN>(std::vector<GLfloat>& rVertices, GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) +{ + rVertices.insert(rVertices.end(), { + x1, y2, x1, y1, + x2, y1, x2, y2 + }); +} + +inline void createColor(Color nColor, GLfloat fTransparency, GLubyte& nR, GLubyte& nG, GLubyte& nB, GLubyte& nA) +{ + nR = nColor.GetRed(); + nG = nColor.GetGreen(); + nB = nColor.GetBlue(); + nA = (1.0f - fTransparency) * 255.0f; +} + +template<GLenum TYPE> +inline void addQuadColors(std::vector<GLubyte>& rColors, Color nColor, GLfloat fTransparency); + +template<> +inline void addQuadColors<GL_TRIANGLES>(std::vector<GLubyte>& rColors, Color nColor, GLfloat fTransparency) +{ + GLubyte nR, nG, nB, nA; + createColor(nColor, fTransparency, nR, nG, nB, nA); + + rColors.insert(rColors.end(), { + nR, nG, nB, nA, + nR, nG, nB, nA, + nR, nG, nB, nA, + nR, nG, nB, nA, + nR, nG, nB, nA, + nR, nG, nB, nA, + }); +} + +inline void addLineSegmentVertices(std::vector<GLfloat>& rVertices, std::vector<GLfloat>& rExtrusionVectors, + glm::vec2 prevPoint, glm::vec2 prevExtrusionVector, GLfloat prevLength, + glm::vec2 currPoint, glm::vec2 currExtrusionVector, GLfloat currLength) +{ + rVertices.insert(rVertices.end(), { + prevPoint.x, prevPoint.y, + prevPoint.x, prevPoint.y, + currPoint.x, currPoint.y, + currPoint.x, currPoint.y, + prevPoint.x, prevPoint.y, + currPoint.x, currPoint.y, + }); + + rExtrusionVectors.insert(rExtrusionVectors.end(), { + -prevExtrusionVector.x, -prevExtrusionVector.y, -prevLength, + prevExtrusionVector.x, prevExtrusionVector.y, prevLength, + -currExtrusionVector.x, -currExtrusionVector.y, -currLength, + -currExtrusionVector.x, -currExtrusionVector.y, -currLength, + prevExtrusionVector.x, prevExtrusionVector.y, prevLength, + currExtrusionVector.x, currExtrusionVector.y, currLength, + }); +} + +inline glm::vec2 normalize(const glm::vec2& vector) +{ + if (glm::length(vector) > 0.0) + return glm::normalize(vector); + return vector; +} + +inline glm::vec2 perpendicular(const glm::vec2& vector) +{ + return glm::vec2(-vector.y, vector.x); +} + +inline float lineVectorAngle(const glm::vec2& previous, const glm::vec2& next) +{ + float angle = std::atan2(previous.x * next.y - previous.y * next.x, + previous.x * next.x + previous.y * next.y); + + return F_PI - std::fabs(angle); +} + +}} // end vcl::vertex + +#endif // INCLUDED_VCL_INC_OPENGL_VERTEXUTILS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/framebuffer.hxx b/vcl/inc/opengl/framebuffer.hxx new file mode 100644 index 000000000..4445e6198 --- /dev/null +++ b/vcl/inc/opengl/framebuffer.hxx @@ -0,0 +1,48 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_FRAMEBUFFER_H +#define INCLUDED_VCL_INC_OPENGL_FRAMEBUFFER_H + +#include <vcl/dllapi.h> + +#include <opengl/texture.hxx> + +class OpenGLFramebuffer final +{ +private: + GLuint mnId; + int mnWidth; + int mnHeight; + GLuint mnAttachedTexture; + +public: + OpenGLFramebuffer(); + ~OpenGLFramebuffer(); + + int GetWidth() const { return mnWidth; }; + int GetHeight() const { return mnHeight; }; + + void Bind(GLenum eTarget = GL_FRAMEBUFFER); + + static void Unbind(GLenum eTarget = GL_FRAMEBUFFER); + + VCL_DLLPUBLIC bool IsFree() const; + bool IsAttached( GLuint nTexture ) const; + bool IsAttached( const OpenGLTexture& rTexture ) const; + void AttachTexture( const OpenGLTexture& rTexture ); + void DetachTexture(); + +public: + OpenGLFramebuffer* mpPrevFramebuffer; +}; + +#endif // INCLUDED_VCL_INC_OPENGL_FRAMEBUFFER_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/gdiimpl.hxx b/vcl/inc/opengl/gdiimpl.hxx new file mode 100644 index 000000000..a6de106a6 --- /dev/null +++ b/vcl/inc/opengl/gdiimpl.hxx @@ -0,0 +1,395 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_OPENGLGDIIMPL_HXX +#define INCLUDED_VCL_OPENGLGDIIMPL_HXX + +#include <vcl/dllapi.h> +#include <vcl/opengl/OpenGLContext.hxx> + +#include <regionband.hxx> +#include <salgeom.hxx> +#include <salgdiimpl.hxx> +#include <opengl/program.hxx> +#include <opengl/texture.hxx> +#include <opengl/RenderList.hxx> + +#include <memory> + +class SalFrame; +class SalVirtualDevice; +class OpenGLTests; + +namespace basegfx +{ +class B2DTrapezoid; +}; + +namespace tools +{ + class Polygon; + class PolyPolygon; +} + +struct TextureCombo +{ + std::unique_ptr<OpenGLTexture> mpTexture; + std::unique_ptr<OpenGLTexture> mpMask; +}; + +class OpenGLFlushIdle; + +class VCL_DLLPUBLIC OpenGLSalGraphicsImpl : public SalGraphicsImpl +{ + friend class OpenGLTests; +protected: + + /// This context is solely for blitting maOffscreenTex + rtl::Reference<OpenGLContext> mpWindowContext; + + /// This context is whatever is most convenient to render + /// to maOffscreenTex with. + rtl::Reference<OpenGLContext> mpContext; + + SalGraphics& mrParent; + /// Pointer to the SalFrame or SalVirtualDevice + SalGeometryProvider* mpProvider; + OpenGLProgram* mpProgram; + + /// This idle handler is used to swap buffers after rendering. + std::unique_ptr<OpenGLFlushIdle> mpFlush; + + // clipping + vcl::Region maClipRegion; + bool mbUseScissor; + bool mbUseStencil; + + bool mbXORMode; + + bool mbAcquiringOpenGLContext; + + /** + * All rendering happens to this off-screen texture. For + * non-virtual devices, ie. windows - we will blit it and + * swapBuffers later. + */ + OpenGLTexture maOffscreenTex; + + Color mnLineColor; + Color mnFillColor; +#ifdef DBG_UTIL + bool mProgramIsSolidColor; +#endif + sal_uInt32 mnDrawCount; + sal_uInt32 mnDrawCountAtFlush; + Color mProgramSolidColor; + double mProgramSolidTransparency; + + std::unique_ptr<RenderList> mpRenderList; + + void ImplInitClipRegion(); + void ImplSetClipBit( const vcl::Region& rClip, GLuint nMask ); + void ImplDrawLineAA( double nX1, double nY1, double nX2, double nY2, bool edge ); + void CheckOffscreenTexture(); + + void ApplyProgramMatrices(float fPixelOffset = 0.0); + +public: + bool UseProgram( const OUString& rVertexShader, const OUString& rFragmentShader, const OString& preamble = "" ); + bool UseSolid( Color nColor, sal_uInt8 nTransparency ); + bool UseSolid( Color nColor, double fTransparency ); + bool UseSolid( Color nColor ); + void UseSolid(); + bool UseLine(Color nColor, double fTransparency, GLfloat fLineWidth, bool bUseAA); + void UseLine(GLfloat fLineWidth, bool bUseAA); + bool UseInvert50(); + bool UseInvert(SalInvert nFlags); + + void DrawConvexPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry, bool blockAA = false ); + void DrawConvexPolygon( const tools::Polygon& rPolygon, bool blockAA ); + void DrawTrapezoid( const basegfx::B2DTrapezoid& trapezoid, bool blockAA ); + void DrawRect( long nX, long nY, long nWidth, long nHeight ); + void DrawRect( const tools::Rectangle& rRect ); + void DrawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ); + void DrawLineSegment(float x1, float y1, float x2, float y2); + void DrawPolyPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, bool blockAA = false ); + void DrawRegionBand( const RegionBand& rRegion ); + void DrawTextureRect( const SalTwoRect& rPosAry ); + void DrawTexture( OpenGLTexture& rTexture, const SalTwoRect& rPosAry, bool bInverted = false ); + void DrawTransformedTexture( OpenGLTexture& rTexture, OpenGLTexture& rMask, const basegfx::B2DPoint& rNull, const basegfx::B2DPoint& rX, const basegfx::B2DPoint& rY ); + void DrawAlphaTexture( OpenGLTexture& rTexture, const SalTwoRect& rPosAry, bool bInverted, bool pPremultiplied ); + void DrawTextureDiff( OpenGLTexture& rTexture, OpenGLTexture& rMask, const SalTwoRect& rPosAry, bool bInverted ); + void DrawTextureWithMask( OpenGLTexture& rTexture, OpenGLTexture& rMask, const SalTwoRect& rPosAry ); + void DrawBlendedTexture( OpenGLTexture& rTexture, OpenGLTexture& rMask, OpenGLTexture& rAlpha, const SalTwoRect& rPosAry ); + void DrawMask( OpenGLTexture& rTexture, Color nMaskColor, const SalTwoRect& rPosAry ); + void DrawLinearGradient( const Gradient& rGradient, const tools::Rectangle& rRect ); + void DrawAxialGradient( const Gradient& rGradient, const tools::Rectangle& rRect ); + void DrawRadialGradient( const Gradient& rGradient, const tools::Rectangle& rRect ); + + void FlushDeferredDrawing(); + void FlushLinesOrTriangles(DrawShaderType eType, RenderParameters const & rParameters); + +public: + // get the width of the device + GLfloat GetWidth() const { return mpProvider ? mpProvider->GetWidth() : 1; } + + // get the height of the device + GLfloat GetHeight() const { return mpProvider ? mpProvider->GetHeight() : 1; } + + /** + * check whether this instance is used for offscreen (Virtual Device) + * rendering ie. does it need its own context. + */ + bool IsOffscreen() const { return mpProvider == nullptr || mpProvider->IsOffScreen(); } + + /// Oddly not all operations obey the XOR option. + enum XOROption { IGNORE_XOR, IMPLEMENT_XOR }; + + // initialize pre-draw state + void InitializePreDrawState(XOROption eOpt); + + // operations to do before painting + void PreDraw(XOROption eOpt = IGNORE_XOR); + + // operations to do after painting + void PostDraw(); + + void PostBatchDraw(); + +protected: + bool AcquireContext(bool bForceCreate = false); + void ReleaseContext(); + + /// create a new context for rendering to the underlying window + virtual rtl::Reference<OpenGLContext> CreateWinContext() = 0; + + /// check whether the given context can be used for off-screen rendering + static bool UseContext( const rtl::Reference<OpenGLContext> &pContext ) + { + return pContext->isInitialized() && // not released by the OS etc. + pContext->isVCLOnly(); + } + +public: + OpenGLSalGraphicsImpl(SalGraphics& pParent, SalGeometryProvider *pProvider); + virtual ~OpenGLSalGraphicsImpl () override; + + rtl::Reference<OpenGLContext> GetOpenGLContext(); + + virtual void Init() override; + + virtual void DeInit() override; + + virtual void freeResources() override; + + virtual OUString getRenderBackendName() const override { return "opengl"; } + + const vcl::Region& getClipRegion() const; + virtual bool setClipRegion( const vcl::Region& ) override; + + // + // get the depth of the device + virtual sal_uInt16 GetBitCount() const override; + + // get the width of the device + virtual long GetGraphicsWidth() const override; + + // set the clip region to empty + virtual void ResetClipRegion() override; + + // set the line color to transparent (= don't draw lines) + + virtual void SetLineColor() override; + + // set the line color to a specific color + virtual void SetLineColor( Color nColor ) override; + + // set the fill color to transparent (= don't fill) + virtual void SetFillColor() override; + + // set the fill color to a specific color, shapes will be + // filled accordingly + virtual void SetFillColor( Color nColor ) override; + + // enable/disable XOR drawing + virtual void SetXORMode( bool bSet, bool bInvertOnly ) override; + + // set line color for raster operations + virtual void SetROPLineColor( SalROPColor nROPColor ) override; + + // set fill color for raster operations + virtual void SetROPFillColor( SalROPColor nROPColor ) override; + + // draw --> LineColor and FillColor and RasterOp and ClipRegion + virtual void drawPixel( long nX, long nY ) override; + virtual void drawPixel( long nX, long nY, Color nColor ) 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::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolyPolygon&, + double fTransparency) override; + + virtual bool drawPolyLine( + const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolygon&, + double fTransparency, + double fLineWidth, + const std::vector< double >* pStroke, // MM01 + basegfx::B2DLineJoin, + css::drawing::LineCap, + double fMiterMinimumAngle, + bool bPixelSnapHairline) 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; + + // CopyArea --> No RasterOp, but ClipRegion + virtual void copyArea( + long nDestX, long nDestY, + long nSrcX, long nSrcY, + long nSrcWidth, long nSrcHeight, + bool bWindowInvalidate ) override; + + // CopyBits and DrawBitmap --> RasterOp and ClipRegion + // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics + void DoCopyBits(const SalTwoRect& rPosAry, OpenGLSalGraphicsImpl &rSrcImpl); + + 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 void drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) override; + + virtual void drawBitmap( + const SalTwoRect& rPosAry, + const SalBitmap& rSalBitmap, + const SalBitmap& rMaskBitmap ) override; + + virtual void drawMask( + const SalTwoRect& rPosAry, + const SalBitmap& rSalBitmap, + Color nMaskColor ) override; + + virtual std::shared_ptr<SalBitmap> getBitmap( long nX, long nY, long nWidth, long nHeight ) override; + + virtual Color getPixel( long nX, long nY ) override; + + // invert --> ClipRegion (only Windows or VirDevs) + 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_uInt32 nSize ) override; + + /** Render bitmap with alpha channel + + @param rSourceBitmap + Source bitmap to blit + + @param rAlphaBitmap + Alpha channel to use for blitting + + @return true, if the operation succeeded, and false + otherwise. In this case, clients should try to emulate alpha + compositing themselves + */ + virtual bool drawAlphaBitmap( + const SalTwoRect&, + const SalBitmap& rSourceBitmap, + const SalBitmap& rAlphaBitmap ) override; + + /** draw transformed bitmap (maybe with alpha) where Null, X, Y define the coordinate system */ + virtual bool drawTransformedBitmap( + const basegfx::B2DPoint& rNull, + const basegfx::B2DPoint& rX, + const basegfx::B2DPoint& rY, + const SalBitmap& rSourceBitmap, + const SalBitmap* pAlphaBitmap) override; + + /** Render solid rectangle with given transparency + + @param nX Top left coordinate of rectangle + + @param nY Bottom right coordinate of rectangle + + @param nWidth Width of rectangle + + @param nHeight Height of rectangle + + @param nTransparency Transparency value (0-255) to use. 0 blits and opaque, 255 a + fully transparent rectangle + + @returns true if successfully drawn, false if not able to draw rectangle + */ + virtual bool drawAlphaRect( + long nX, long nY, + long nWidth, long nHeight, + sal_uInt8 nTransparency ) override; + + virtual bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) override; + + virtual bool supportsOperation(OutDevSupportType eType) const override; + + /// queue an idle flush of contents of the back-buffer to the screen + void flush(); + +public: + /// do flush of contents of the back-buffer to the screen & swap. + void doFlush(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/program.hxx b/vcl/inc/opengl/program.hxx new file mode 100644 index 000000000..bff248d9b --- /dev/null +++ b/vcl/inc/opengl/program.hxx @@ -0,0 +1,122 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_PROGRAM_H +#define INCLUDED_VCL_INC_OPENGL_PROGRAM_H + +#include <sal/config.h> + +#include <vector> + +#include <vcl/dllapi.h> + +#include <basegfx/point/b2dpoint.hxx> +#include <rtl/ustring.hxx> +#include <opengl/texture.hxx> + +#include <unordered_map> + +class Color; + +enum class TextureShaderType +{ + Normal = 0, + Blend, + Masked, + Diff, + MaskedColor +}; + +enum class DrawShaderType +{ + Normal = 0, + Line +}; + +class OpenGLProgram +{ +private: + GLuint mnId; + std::unordered_map< OString, GLuint > + maUniformLocations; + sal_uInt32 mnEnabledAttribs; + GLuint mnPositionAttrib; + GLuint mnTexCoordAttrib; + GLuint mnAlphaCoordAttrib; + GLuint mnMaskCoordAttrib; + GLuint mnExtrusionVectorsAttrib; + GLuint mnVertexColorsAttrib; + + std::vector< OpenGLTexture > maTextures; + bool mbBlending; + + float mfLastWidth; + float mfLastHeight; + float mfLastPixelOffset; + + + OpenGLProgram(const OpenGLProgram &) = delete; +public: + OpenGLProgram(); + ~OpenGLProgram(); + + GLuint Id() { return mnId; } + + bool Load( const OUString& rVertexShader, const OUString& rFragmentShader, + const OString& preamble, const OString& rDigest ); + void Use(); + void Reuse(); + void Clean(); + + void SetVertices( const GLvoid* pData ); + void SetTextureCoord( const GLvoid* pData ); + void SetAlphaCoord( const GLvoid* pData ); + void SetMaskCoord(const GLvoid* pData); + void SetExtrusionVectors(const GLvoid* pData); + void SetVertexColors(std::vector<GLubyte>& rColorVector); + + void SetUniform1f( const OString& rName, GLfloat v1 ); + void SetUniform2f( const OString& rName, GLfloat v1, GLfloat v2 ); + void SetUniform1fv( const OString& rName, GLsizei nCount, GLfloat const * aValues ); + void SetUniform2fv( const OString& rName, GLsizei nCount, GLfloat const * aValues ); + void SetUniform1i( const OString& rName, GLint v1 ); + void SetColor( const OString& rName, const Color& rColor ); + void SetColor( const OString& rName, Color nColor, sal_uInt8 nTransparency ); + void SetColorf( const OString& rName, Color nColor, double fTransparency ); + void SetColorWithIntensity( const OString& rName, const Color& rColor, long nFactor ); + void SetTexture( const OString& rName, OpenGLTexture& rTexture ); + void SetTransform( const OString& rName, const OpenGLTexture& rTexture, + const basegfx::B2DPoint& rNull, const basegfx::B2DPoint& rX, + const basegfx::B2DPoint& rY ); + void SetIdentityTransform(const OString& rName); + void SetShaderType(TextureShaderType eTextureShaderType); + void SetShaderType(DrawShaderType eDrawShaderType); + + void SetBlendMode( GLenum nSFactor, GLenum nDFactor ); + + void ApplyMatrix(float fWidth, float fHeight, float fPixelOffset = 0.0f); + + void DrawTexture( const OpenGLTexture& rTexture ); + + void DrawArrays(GLenum aMode, std::vector<GLfloat>& aVertices); + void DrawElements(GLenum aMode, GLuint nNumberOfVertices); + + bool EnableVertexAttrib(GLuint& rAttrib, const OString& rName); + + void SetVertexAttrib(GLuint& rAttrib, const OString& rName, GLint nSize, + GLenum eType, GLboolean bNormalized, GLsizei aStride, + const GLvoid* pPointer); + +private: + GLuint GetUniformLocation( const OString& rName ); +}; + +#endif // INCLUDED_VCL_INC_OPENGL_PROGRAM_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/salbmp.hxx b/vcl/inc/opengl/salbmp.hxx new file mode 100644 index 000000000..a01eca89f --- /dev/null +++ b/vcl/inc/opengl/salbmp.hxx @@ -0,0 +1,113 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_SALBMP_H +#define INCLUDED_VCL_INC_OPENGL_SALBMP_H + +#include <vcl/opengl/OpenGLContext.hxx> + +#include <opengl/texture.hxx> + +#include <salbmp.hxx> + +#include <memory> + +struct BitmapBuffer; +class BitmapPalette; +namespace vcl +{ + class Kernel; +} + +class VCL_PLUGIN_PUBLIC OpenGLSalBitmap final : public SalBitmap +{ +private: + OpenGLTexture maTexture; + bool mbDirtyTexture; + BitmapPalette maPalette; + std::shared_ptr<sal_uInt8> mpUserBuffer; + sal_uInt16 mnBits; + sal_uInt32 mnBytesPerRow; + int mnWidth; + int mnHeight; + + virtual void updateChecksum() const override; + + bool calcChecksumGL(OpenGLTexture& rInputTexture, BitmapChecksum& rChecksum) const; + +public: + OpenGLSalBitmap(); + virtual ~OpenGLSalBitmap() override; + +public: + + // SalBitmap methods + bool Create( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal ) override; + bool Create( const SalBitmap& rSalBmp ) override; + bool Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics ) override; + 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; + + void Destroy() final override; + + Size GetSize() const override; + sal_uInt16 GetBitCount() const override; + + BitmapBuffer* AcquireBuffer( BitmapAccessMode nMode ) override; + void ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) override; + + bool GetSystemData( BitmapSystemData& rData ) override; + + bool ScalingSupported() const override; + bool Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag ) override; + bool Replace( const Color& rSearchColor, const Color& rReplaceColor, sal_uInt8 nTol ) override; + bool ConvertToGreyscale() override; + bool InterpretAs8Bit() override; + +public: + + void Create( const OpenGLTexture& rTex, long nX, long nY, long nWidth, long nHeight ); + OpenGLTexture& GetTexture() const; + const BitmapPalette& GetBitmapPalette() const { return maPalette; } + +private: + + GLuint CreateTexture(); + bool AllocateUserData(); + void DeallocateUserData(); + bool ReadTexture(); + +private: + + bool ImplScaleFilter( const rtl::Reference< OpenGLContext > &xContext, const double& rScaleX, const double& rScaleY, GLenum nFilter ); + static void ImplCreateKernel( const double& fScale, const vcl::Kernel& rKernel, GLfloat*& pWeights, sal_uInt32& aKernelSize ); + bool ImplScaleConvolution(const rtl::Reference< OpenGLContext > &xContext, const double& rScaleX, const double& rScaleY, const vcl::Kernel& rKernel); + bool ImplScaleArea( const rtl::Reference< OpenGLContext > &xContext, + double rScaleX, double rScaleY ); + +public: + + void ImplScale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag ); +}; + +#endif // INCLUDED_VCL_INC_OPENGL_SALBMP_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/texture.hxx b/vcl/inc/opengl/texture.hxx new file mode 100644 index 000000000..0438b9af1 --- /dev/null +++ b/vcl/inc/opengl/texture.hxx @@ -0,0 +1,139 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_TEXTURE_H +#define INCLUDED_VCL_INC_OPENGL_TEXTURE_H + +#include <epoxy/gl.h> +#include <vcl/dllapi.h> +#include <vcl/salgtype.hxx> +#include <rtl/ustring.hxx> +#include <tools/gen.hxx> + +#include <functional> +#include <memory> +#include <vector> + +class ImplOpenGLTexture +{ +public: + GLuint mnTexture; + int mnWidth; + int mnHeight; + GLenum mnFilter; + GLuint mnOptStencil; + + std::unique_ptr<std::vector<int>> mpSlotReferences; + std::function<void(int)> mFunctSlotDeallocateCallback; + + ImplOpenGLTexture( int nWidth, int nHeight, bool bAllocate ); + ImplOpenGLTexture( int nWidth, int nHeight, int nFormat, int nType, void const * pData ); + ImplOpenGLTexture( int nX, int nY, int nWidth, int nHeight ); + ~ImplOpenGLTexture(); + + bool InsertBuffer(int nX, int nY, int nWidth, int nHeight, int nFormat, int nType, sal_uInt8 const * pData); + + void IncreaseRefCount(int nSlotNumber); + void DecreaseRefCount(int nSlotNumber); + + void InitializeSlotMechanism(int nInitialSlotSize); + + void SetSlotDeallocateCallback(std::function<void(int)> aCallback) + { + mFunctSlotDeallocateCallback = aCallback; + } + + void ResetSlotDeallocateCallback() + { + mFunctSlotDeallocateCallback = std::function<void(int)>(); + } + + GLuint AddStencil(); +}; + +class VCL_DLLPUBLIC OpenGLTexture final +{ +private: + // if the rect size doesn't match the mpImpl one, this instance + // is a sub-area from the real OpenGL texture + tools::Rectangle maRect; + std::shared_ptr<ImplOpenGLTexture> mpImpl; + int mnSlotNumber; + + inline void GetTextureRect(const SalTwoRect& rPosAry, GLfloat& x1, GLfloat& x2, GLfloat& y1, GLfloat& y2) const; + + bool IsValid() const + { + return (mpImpl && mpImpl->mnTexture != 0); + } + +public: + OpenGLTexture(); + OpenGLTexture(const std::shared_ptr<ImplOpenGLTexture>& pImpl, tools::Rectangle aRectangle, int nSlotNumber); + + OpenGLTexture( int nWidth, int nHeight, bool bAllocate = true ); + OpenGLTexture( int nWidth, int nHeight, int nFormat, int nType, void const * pData ); + OpenGLTexture( int nX, int nY, int nWidth, int nHeight ); + OpenGLTexture( const OpenGLTexture& rTexture ); + OpenGLTexture( OpenGLTexture&& rTexture ) noexcept; + OpenGLTexture( const OpenGLTexture& rTexture, int nX, int nY, int nWidth, int nHeight ); + ~OpenGLTexture(); + + bool IsUnique() const; + + GLuint Id() const; + int GetWidth() const; + int GetHeight() const; + + void GetCoord( GLfloat* pCoord, const SalTwoRect& rPosAry, bool bInverted=false ) const; + void GetWholeCoord( GLfloat* pCoord ) const; + void Bind(); + void Unbind(); + void Read( GLenum nFormat, GLenum nType, sal_uInt8* pData ); + GLuint AddStencil(); + GLuint StencilId() const; + + bool CopyData(int nWidth, int nHeight, int nFormat, int nType, sal_uInt8 const * pData); + + void SaveToFile(const OUString& rFileName); + + GLenum GetFilter() const; + void SetFilter( GLenum nFilter ); + + operator bool() const; + OpenGLTexture& operator=( const OpenGLTexture& rTexture ); + OpenGLTexture& operator=( OpenGLTexture&& rTexture ); + bool operator==( const OpenGLTexture& rTexture ) const; + bool operator!=( const OpenGLTexture& rTexture ) const; + + template<GLenum type> + void FillCoords(std::vector<GLfloat>& aCoordVector, const SalTwoRect& rPosAry) const; +}; + +template<> void OpenGLTexture::FillCoords<GL_TRIANGLES>( + std::vector<GLfloat>& aCoord, const SalTwoRect& rPosAry) + const; + +template<> void OpenGLTexture::FillCoords<GL_TRIANGLE_FAN>( + std::vector<GLfloat>& aCoord, const SalTwoRect& rPosAry) + const; + +#endif // INCLUDED_VCL_INC_OPENGL_TEXTURE_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/win/WinDeviceInfo.hxx b/vcl/inc/opengl/win/WinDeviceInfo.hxx new file mode 100644 index 000000000..04d97406b --- /dev/null +++ b/vcl/inc/opengl/win/WinDeviceInfo.hxx @@ -0,0 +1,103 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_OPENGL_WIN_WINDEVICEINFO_HXX +#define INCLUDED_VCL_OPENGL_WIN_WINDEVICEINFO_HXX + +#include <vcl/dllapi.h> + +#include <opengl/DeviceInfo.hxx> +#include <driverblocklist.hxx> + +#include <rtl/ustring.hxx> +#include <vector> +#include <cstdint> + +class VCL_DLLPUBLIC WinOpenGLDeviceInfo : public OpenGLDeviceInfo +{ +private: + OUString maDriverVersion; + OUString maDriverVersion2; + + OUString maDriverDate; + OUString maDriverDate2; + + OUString maDeviceID; + OUString maDeviceID2; + + OUString maAdapterVendorID; + OUString maAdapterDeviceID; + OUString maAdapterSubsysID; + + OUString maAdapterVendorID2; + OUString maAdapterDeviceID2; + OUString maAdapterSubsysID2; + + OUString maDeviceKey; + OUString maDeviceKey2; + + OUString maDeviceString; + OUString maDeviceString2; + + bool mbHasDualGPU; + bool mbRDP; + + void GetData(); + bool FindBlocklistedDeviceInList(); + +public: + WinOpenGLDeviceInfo(); + + virtual ~WinOpenGLDeviceInfo() override; + + virtual bool isDeviceBlocked() override; + + const OUString& GetDriverVersion() const + { + return maDriverVersion; + } + + const OUString& GetDriverDate() const + { + return maDriverDate; + } + + const OUString& GetDeviceID() const + { + return maDeviceID; + } + + const OUString& GetAdapterVendorID() const + { + return maAdapterVendorID; + } + + const OUString& GetAdapterDeviceID() const + { + return maAdapterDeviceID; + } + + const OUString& GetAdapterSubsysID() const + { + return maAdapterSubsysID; + } + const OUString& GetDeviceKey() const + { + return maDeviceKey; + } + + const OUString& GetDeviceString() const + { + return maDeviceString; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/win/gdiimpl.hxx b/vcl/inc/opengl/win/gdiimpl.hxx new file mode 100644 index 000000000..dff47ef7e --- /dev/null +++ b/vcl/inc/opengl/win/gdiimpl.hxx @@ -0,0 +1,97 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_WIN_GDIIMPL_HXX +#define INCLUDED_VCL_INC_OPENGL_WIN_GDIIMPL_HXX + +#include <memory> +#include <vcl/dllapi.h> + +#include <opengl/gdiimpl.hxx> +#include <svdata.hxx> +#include <win/salgdi.h> +#include <win/wingdiimpl.hxx> +#include <o3tl/lru_map.hxx> +#include <vcl/opengl/OpenGLContext.hxx> +#include <ControlCacheKey.hxx> + +class OpenGLCompatibleDC : public CompatibleDC +{ +public: + OpenGLCompatibleDC(SalGraphics &rGraphics, int x, int y, int width, int height); + + virtual std::unique_ptr<Texture> getAsMaskTexture() const override; + // caller must delete + OpenGLTexture* getOpenGLTexture() const; + + /// Copy bitmap data to the texture. Texture must be initialized and the correct size to hold the bitmap. + bool copyToTexture(Texture& aTexture) const; + + struct Texture; +}; + +struct OpenGLCompatibleDC::Texture : public CompatibleDC::Texture +{ + OpenGLTexture texture; + virtual bool isValid() const { return !!texture; } + virtual int GetWidth() const { return texture.GetWidth(); } + virtual int GetHeight() const { return texture.GetHeight(); } +}; + +class WinOpenGLSalGraphicsImpl : public OpenGLSalGraphicsImpl, public WinSalGraphicsImplBase +{ + friend class WinLayout; +private: + WinSalGraphics& mrWinParent; + + bool RenderCompatibleDC(OpenGLCompatibleDC& rWhite, OpenGLCompatibleDC& rBlack, + int nX, int nY, TextureCombo& rCombo); + +public: + WinOpenGLSalGraphicsImpl(WinSalGraphics& rGraphics, + SalGeometryProvider *mpProvider); + +protected: + virtual rtl::Reference<OpenGLContext> CreateWinContext() override; + + bool RenderTextureCombo(TextureCombo const & rCombo, int nX, int nY); + +public: + virtual void Init() override; + virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) override; + + virtual bool UseTextDraw() const override { return true; } + virtual void PreDrawText() override; + virtual void PostDrawText() override; + virtual void DrawTextMask( CompatibleDC::Texture* rTexture, Color nMaskColor, const SalTwoRect& rPosAry ) override; + using OpenGLSalGraphicsImpl::DrawMask; + virtual void DeferredTextDraw(const CompatibleDC::Texture* pTexture, Color nMaskColor, const SalTwoRect& rPosAry) override; + + virtual bool UseRenderNativeControl() const override { return true; } + virtual bool TryRenderCachedNativeControl(ControlCacheKey const & rControlCacheKey, int nX, int nY) override; + virtual bool RenderAndCacheNativeControl(CompatibleDC& rWhite, CompatibleDC& rBlack, + int nX, int nY , ControlCacheKey& aControlCacheKey) override; + +}; + +typedef std::pair<ControlCacheKey, std::unique_ptr<TextureCombo>> OpenGLControlCachePair; +typedef o3tl::lru_map<ControlCacheKey, std::unique_ptr<TextureCombo>, ControlCacheHashFunction> OpenGLControlCacheType; + +class OpenGLControlsCache { + OpenGLControlCacheType cache; + + OpenGLControlsCache(); + +public: + static OpenGLControlCacheType & get(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/win/winlayout.hxx b/vcl/inc/opengl/win/winlayout.hxx new file mode 100644 index 000000000..d017bc250 --- /dev/null +++ b/vcl/inc/opengl/win/winlayout.hxx @@ -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 . + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_WIN_WINLAYOUT_HXX +#define INCLUDED_VCL_INC_OPENGL_WIN_WINLAYOUT_HXX + +#include <win/winlayout.hxx> +#include <opengl/PackedTextureAtlas.hxx> + +struct OpenGLGlobalWinGlyphCache : public GlobalWinGlyphCache +{ + OpenGLGlobalWinGlyphCache() + : maPackedTextureAtlas(2048, 2048) + { + } + + PackedTextureAtlasManager maPackedTextureAtlas; + + virtual bool AllocateTexture(WinGlyphDrawElement& rElement, CompatibleDC* dc) override; + virtual void Prune() override; +}; + +class OpenGLWinGlyphCache : public WinGlyphCache +{ +public: + void RemoveTextures(std::vector<GLuint>& rTextureIDs); + +private: + // This class just "adds" RemoveTextures() to the base class, it's never instantiated. + OpenGLWinGlyphCache() = delete; +}; + +#endif // INCLUDED_VCL_INC_OPENGL_WIN_WINLAYOUT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/x11/X11DeviceInfo.hxx b/vcl/inc/opengl/x11/X11DeviceInfo.hxx new file mode 100644 index 000000000..d51de3a69 --- /dev/null +++ b/vcl/inc/opengl/x11/X11DeviceInfo.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/. + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_X11_X11DEVICEINFO_HXX +#define INCLUDED_VCL_INC_OPENGL_X11_X11DEVICEINFO_HXX + +#include <opengl/DeviceInfo.hxx> + +#include <rtl/string.hxx> + +class X11OpenGLDeviceInfo final : public OpenGLDeviceInfo +{ +private: + bool mbIsMesa; + bool mbIsNVIDIA; + bool mbIsFGLRX; + bool mbIsNouveau; + bool mbIsIntel; + bool mbIsOldSwrast; + bool mbIsLlvmpipe; + + OString maVendor; + OString maRenderer; + OString maVersion; + OString maOS; + OString maOSRelease; + + size_t mnGLMajorVersion; + size_t mnMajorVersion; + size_t mnMinorVersion; + size_t mnRevisionVersion; + + void GetData(); + +public: + X11OpenGLDeviceInfo(); + + virtual bool isDeviceBlocked() override; + + const OString& GetVendor() const + { + return maVendor; + } + + const OString& GetRenderer() const + { + return maRenderer; + } + + const OString& GetVersion() const + { + return maVersion; + } + + const OString& GetOS() const + { + return maOS; + } + + const OString& GetOSRelease() const + { + return maOSRelease; + } + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/x11/cairotextrender.hxx b/vcl/inc/opengl/x11/cairotextrender.hxx new file mode 100644 index 000000000..137022fa8 --- /dev/null +++ b/vcl/inc/opengl/x11/cairotextrender.hxx @@ -0,0 +1,27 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_UNX_GENERIC_GDI_OPENGLX11CAIROTEXTRENDER_HXX +#define INCLUDED_VCL_UNX_GENERIC_GDI_OPENGLX11CAIROTEXTRENDER_HXX + +#include <unx/x11/x11cairotextrender.hxx> + +class OpenGLX11CairoTextRender final : public X11CairoTextRender +{ +public: + explicit OpenGLX11CairoTextRender(X11SalGraphics& rParent); + + virtual cairo_t* getCairoContext() override; + virtual void getSurfaceOffset(double& nDX, double& nDY) override; + virtual void releaseCairoContext(cairo_t* cr) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/x11/gdiimpl.hxx b/vcl/inc/opengl/x11/gdiimpl.hxx new file mode 100644 index 000000000..d86af9223 --- /dev/null +++ b/vcl/inc/opengl/x11/gdiimpl.hxx @@ -0,0 +1,42 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_X11_GDIIMPL_HXX +#define INCLUDED_VCL_INC_OPENGL_X11_GDIIMPL_HXX + +#include <vcl/dllapi.h> + +#include <unx/salgdi.h> +#include <unx/x11/x11gdiimpl.h> +#include <opengl/gdiimpl.hxx> +#include <ControlCacheKey.hxx> + +struct TextureCombo; + +class X11OpenGLSalGraphicsImpl : public OpenGLSalGraphicsImpl, public X11GraphicsImpl +{ +private: + X11SalGraphics& mrX11Parent; + +public: + X11OpenGLSalGraphicsImpl( X11SalGraphics& rParent ); + virtual ~X11OpenGLSalGraphicsImpl() override; + +protected: + virtual rtl::Reference<OpenGLContext> CreateWinContext() override; + +public: + virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) override; + + virtual void Init() override; +}; + +#endif // INCLUDED_VCL_INC_OPENGL_X11_GDIIMPL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/x11/glxtest.hxx b/vcl/inc/opengl/x11/glxtest.hxx new file mode 100644 index 000000000..5715a6d9f --- /dev/null +++ b/vcl/inc/opengl/x11/glxtest.hxx @@ -0,0 +1,21 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_X11_GLXTEST_HXX +#define INCLUDED_VCL_INC_OPENGL_X11_GLXTEST_HXX + +#include <vcl/dllapi.h> + +VCL_DLLPUBLIC int* getGlxPipe(); + +VCL_DLLPUBLIC pid_t* getGlxPid(); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/x11/salvd.hxx b/vcl/inc/opengl/x11/salvd.hxx new file mode 100644 index 000000000..a77b9874e --- /dev/null +++ b/vcl/inc/opengl/x11/salvd.hxx @@ -0,0 +1,57 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_X11_SALVD_H +#define INCLUDED_VCL_INC_OPENGL_X11_SALVD_H + +#include <memory> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +#include <unx/saltype.h> +#include <salvd.hxx> + +class SalDisplay; +class X11OpenGLSalGraphics; +class X11SalGraphics; + +class X11OpenGLSalVirtualDevice : public SalVirtualDevice +{ + SalDisplay *mpDisplay; + std::unique_ptr<X11SalGraphics> + mpGraphics; + bool mbGraphics; // is Graphics used + SalX11Screen mnXScreen; + int mnWidth; + int mnHeight; + +public: + X11OpenGLSalVirtualDevice( SalGraphics const *pGraphics, + long nDX, long nDY, + const SystemGraphicsData *pData, + std::unique_ptr<X11SalGraphics> pNewGraphics); + virtual ~X11OpenGLSalVirtualDevice() override; + + // SalGeometryProvider + virtual long GetWidth() const override { return mnWidth; } + virtual long GetHeight() const override { return mnHeight; } + + SalDisplay * GetDisplay() const { return mpDisplay; } + const SalX11Screen& GetXScreenNumber() const { return mnXScreen; } + + virtual SalGraphics* AcquireGraphics() override; + virtual void ReleaseGraphics( SalGraphics* pGraphics ) override; + + // Set new size, without saving the old contents + virtual bool SetSize( long nNewDX, long nNewDY ) override; +}; + +#endif // INCLUDED_VCL_INC_OPENGL_X11_SALVD_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/zone.hxx b/vcl/inc/opengl/zone.hxx new file mode 100644 index 000000000..4bcdf15dc --- /dev/null +++ b/vcl/inc/opengl/zone.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/. + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_ZONE_H +#define INCLUDED_VCL_INC_OPENGL_ZONE_H + +#include <sal/config.h> +#include <sal/types.h> +#include <vcl/dllapi.h> +#include <comphelper/crashzone.hxx> + +/** + * We want to be able to detect if a given crash came + * from the OpenGL code, so use this helper to track that. + */ +class VCL_DLLPUBLIC OpenGLZone : public CrashZone< OpenGLZone > { +public: + static void hardDisable(); + static void relaxWatchdogTimings(); + static const CrashWatchdogTimingsValues& getCrashWatchdogTimingsValues(); + static void checkDebug( int nUnchanged, const CrashWatchdogTimingsValues& aTimingValues ); + static const char* name() { return "OpenGL"; } +}; + +/// Create this to not only enter the zone, but set VCL context. +class OpenGLVCLContextZone { + OpenGLZone aZone; +public: + OpenGLVCLContextZone(); +}; + +class VCL_DLLPUBLIC PreDefaultWinNoOpenGLZone { +public: + PreDefaultWinNoOpenGLZone(); + ~PreDefaultWinNoOpenGLZone(); +}; + +#endif // INCLUDED_VCL_INC_OPENGL_ZONE_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/a11yfactory.h b/vcl/inc/osx/a11yfactory.h new file mode 100644 index 000000000..b20755a03 --- /dev/null +++ b/vcl/inc/osx/a11yfactory.h @@ -0,0 +1,42 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_A11YFACTORY_H +#define INCLUDED_VCL_INC_OSX_A11YFACTORY_H + +#include "osxvcltypes.h" +#include "a11ywrapper.h" +#include <com/sun/star/accessibility/XAccessibleContext.hpp> + +@interface AquaA11yFactory : NSObject +{ +} ++(void)insertIntoWrapperRepository: (NSView *) viewElement forAccessibleContext: (css::uno::Reference < css::accessibility::XAccessibleContext >) rxAccessibleContext; ++(AquaA11yWrapper *)wrapperForAccessible: (css::uno::Reference < css::accessibility::XAccessible >) rxAccessible; ++(AquaA11yWrapper *)wrapperForAccessibleContext: (css::uno::Reference < css::accessibility::XAccessibleContext >) rxAccessibleContext; ++(AquaA11yWrapper *)wrapperForAccessibleContext: (css::uno::Reference < css::accessibility::XAccessibleContext >) rxAccessibleContext createIfNotExists:(BOOL) bCreate; ++(AquaA11yWrapper *)wrapperForAccessibleContext: (css::uno::Reference < css::accessibility::XAccessibleContext >) rxAccessibleContext createIfNotExists:(BOOL) bCreate asRadioGroup:(BOOL) asRadioGroup; ++(void)removeFromWrapperRepositoryFor: (css::uno::Reference < css::accessibility::XAccessibleContext >) rxAccessibleContext; ++(void)registerView: (NSView *) theView; ++(void)revokeView: (NSView *) theViewt; +@end + +#endif // INCLUDED_VCL_INC_OSX_A11YFACTORY_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/a11yfocustracker.hxx b/vcl/inc/osx/a11yfocustracker.hxx new file mode 100644 index 000000000..59f2e579c --- /dev/null +++ b/vcl/inc/osx/a11yfocustracker.hxx @@ -0,0 +1,103 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_A11YFOCUSTRACKER_HXX +#define INCLUDED_VCL_INC_OSX_A11YFOCUSTRACKER_HXX + +#include <com/sun/star/accessibility/XAccessible.hpp> + +#include "keyboardfocuslistener.hxx" + +#include <rtl/instance.hxx> + +#include <tools/link.hxx> +#include <vcl/vclevent.hxx> +#include <set> + +namespace vcl { class Window; } +class ToolBox; +class DocumentFocusListener; + + +class AquaA11yFocusTracker +{ + +public: + AquaA11yFocusTracker(); + + ~AquaA11yFocusTracker(); + + css::uno::Reference< css::accessibility::XAccessible > const & getFocusedObject() { return m_xFocusedObject; }; + + // sets the currently focus object and notifies the FocusEventListener (if any) + void setFocusedObject(const css::uno::Reference< css::accessibility::XAccessible >& xAccessible); + + // may evolve to add/remove later + void setFocusListener(const rtl::Reference< KeyboardFocusListener >& aFocusListener) { m_aFocusListener = aFocusListener; }; + +protected: + + // received a WINDOW_GETFOCUS event for this window + void window_got_focus(vcl::Window *pWindow); + + // received a TOOLBOX_HIGHLIGHT event for this window + void toolbox_highlight_on(vcl::Window *pWindow); + + // received a TOOLBOX_HIGHLIGHTOFF event for this window + void toolbox_highlight_off(vcl::Window const *pWindow); + + // received a TABPAGE_ACTIVATE event for this window + void tabpage_activated(vcl::Window *pWindow); + + // received a MENU_HIGHLIGHT event for this window + void menu_highlighted(const ::VclMenuEvent *pEvent); + + // toolbox items are widgets in gtk+ and Cocoa + void notify_toolbox_item_focus(ToolBox *pToolBox); + + // toolbox item opened a floating window (e.g. color chooser) + void toolbox_open_floater(vcl::Window *pWindow); + + // callback function for Application::addEventListener + static void WindowEventHandler(void * pThis, VclSimpleEvent&); + +private: + // the accessible object that has the keyboard focus (if any) + css::uno::Reference< css::accessibility::XAccessible > m_xFocusedObject; + + // the listener for focus events + rtl::Reference< KeyboardFocusListener > m_aFocusListener; + + // the list of Windows that need deeper (focus) investigation + std::set<VclPtr<vcl::Window>> m_aDocumentWindowList; + + // the link object needed for Application::addEventListener + Link<VclSimpleEvent&,void> m_aWindowEventLink; + + // the UNO XAccessibilityEventListener for Documents and other non VCL objects + const rtl::Reference< DocumentFocusListener > m_xDocumentFocusListener; +}; + +struct TheAquaA11yFocusTracker: + rtl::Static<AquaA11yFocusTracker, TheAquaA11yFocusTracker> +{}; + +#endif // INCLUDED_VCL_INC_OSX_A11YFOCUSTRACKER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/a11ylistener.hxx b/vcl/inc/osx/a11ylistener.hxx new file mode 100644 index 000000000..a53559467 --- /dev/null +++ b/vcl/inc/osx/a11ylistener.hxx @@ -0,0 +1,53 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_A11YLISTENER_HXX +#define INCLUDED_VCL_INC_OSX_A11YLISTENER_HXX + +#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> +#include <cppuhelper/implbase.hxx> + +#include "a11yfocustracker.hxx" +#include "osxvcltypes.h" +#include <set> +#include <com/sun/star/awt/Rectangle.hpp> + + +class AquaA11yEventListener : + public ::cppu::WeakImplHelper< css::accessibility::XAccessibleEventListener > +{ + +public: + AquaA11yEventListener(id wrapperObject, sal_Int16 role); + virtual ~AquaA11yEventListener() override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // XAccessibleEventListener + virtual void SAL_CALL notifyEvent( const css::accessibility::AccessibleEventObject& aEvent ) override; + +private: + const id m_wrapperObject; + const sal_Int16 m_role; + css::awt::Rectangle m_oldBounds; +}; + +#endif // INCLUDED_VCL_INC_OSX_A11YLISTENER_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/a11ywrapper.h b/vcl/inc/osx/a11ywrapper.h new file mode 100644 index 000000000..e33d247a1 --- /dev/null +++ b/vcl/inc/osx/a11ywrapper.h @@ -0,0 +1,110 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_A11YWRAPPER_H +#define INCLUDED_VCL_INC_OSX_A11YWRAPPER_H + +#include "osxvcltypes.h" +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include <com/sun/star/accessibility/XAccessibleTable.hpp> +#include <com/sun/star/accessibility/XAccessibleText.hpp> +#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp> +#include <com/sun/star/accessibility/XAccessibleEditableText.hpp> +#include <com/sun/star/accessibility/XAccessibleValue.hpp> +#include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp> +#include <com/sun/star/accessibility/XAccessibleTextMarkup.hpp> + +// rAccessibleXYZ as a field in an Objective-C-Class would not call Con-/Destructor, so use a struct instead +struct ReferenceWrapper +{ + css::uno::Reference < css::accessibility::XAccessibleAction > rAccessibleAction; + css::uno::Reference < css::accessibility::XAccessibleContext > rAccessibleContext; + css::uno::Reference < css::accessibility::XAccessibleComponent > rAccessibleComponent; + css::uno::Reference < css::accessibility::XAccessibleExtendedComponent > rAccessibleExtendedComponent; + css::uno::Reference < css::accessibility::XAccessibleSelection > rAccessibleSelection; + css::uno::Reference < css::accessibility::XAccessibleTable > rAccessibleTable; + css::uno::Reference < css::accessibility::XAccessibleText > rAccessibleText; + css::uno::Reference < css::accessibility::XAccessibleEditableText > rAccessibleEditableText; + css::uno::Reference < css::accessibility::XAccessibleValue > rAccessibleValue; + css::uno::Reference < css::accessibility::XAccessibleTextAttributes > rAccessibleTextAttributes; + css::uno::Reference < css::accessibility::XAccessibleMultiLineText > rAccessibleMultiLineText; + css::uno::Reference < css::accessibility::XAccessibleTextMarkup > rAccessibleTextMarkup; +}; + +@interface AquaA11yWrapper : NSView +{ + ReferenceWrapper * mpReferenceWrapper; + BOOL mActsAsRadioGroup; + BOOL mIsTableCell; +} +// NSAccessibility Protocol +-(id)accessibilityAttributeValue:(NSString *)attribute; +-(BOOL)accessibilityIsIgnored; +-(NSArray *)accessibilityAttributeNames; +-(BOOL)accessibilityIsAttributeSettable:(NSString *)attribute; +-(NSArray *)accessibilityParameterizedAttributeNames; +-(BOOL)accessibilitySetOverrideValue:(id)value forAttribute:(NSString *)attribute; +-(void)accessibilitySetValue:(id)value forAttribute:(NSString *)attribute; +-(id)accessibilityAttributeValue:(NSString *)attribute forParameter:(id)parameter; +-(id)accessibilityFocusedUIElement; +-(NSString *)accessibilityActionDescription:(NSString *)action; +-(void)accessibilityPerformAction:(NSString *)action; +-(NSArray *)accessibilityActionNames; +-(id)accessibilityHitTest:(NSPoint)point; +// Attribute values +-(id)parentAttribute; +-(id)valueAttribute; +-(id)titleAttribute; +-(id)helpAttribute; +-(id)numberOfCharactersAttribute; +-(id)selectedTextAttribute; +-(id)selectedTextRangeAttribute; +-(id)visibleCharacterRangeAttribute; +-(id)childrenAttribute; +-(id)orientationAttribute; +-(id)windowAttribute; +// Wrapper-specific +-(void)setActsAsRadioGroup:(BOOL)actsAsRadioGroup; +-(BOOL)actsAsRadioGroup; +-(NSWindow*)windowForParent; +-(id)initWithAccessibleContext: (css::uno::Reference < css::accessibility::XAccessibleContext >) anAccessibleContext; +-(void) setDefaults: (css::uno::Reference < css::accessibility::XAccessibleContext >) rxAccessibleContext; +-(void) dealloc; ++(void)setPopupMenuOpen:(BOOL)popupMenuOpen; +-(css::accessibility::XAccessibleAction *)accessibleAction; +-(css::accessibility::XAccessibleContext *)accessibleContext; +-(css::accessibility::XAccessibleComponent *)accessibleComponent; +-(css::accessibility::XAccessibleExtendedComponent *)accessibleExtendedComponent; +-(css::accessibility::XAccessibleSelection *)accessibleSelection; +-(css::accessibility::XAccessibleTable *)accessibleTable; +-(css::accessibility::XAccessibleText *)accessibleText; +-(css::accessibility::XAccessibleEditableText *)accessibleEditableText; +-(css::accessibility::XAccessibleValue *)accessibleValue; +-(css::accessibility::XAccessibleTextAttributes *)accessibleTextAttributes; +-(css::accessibility::XAccessibleMultiLineText *)accessibleMultiLineText; +-(css::accessibility::XAccessibleTextMarkup *)accessibleTextMarkup; +@end + +#endif // INCLUDED_VCL_INC_OSX_A11YWRAPPER_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/keyboardfocuslistener.hxx b/vcl/inc/osx/keyboardfocuslistener.hxx new file mode 100644 index 000000000..1da1c8452 --- /dev/null +++ b/vcl/inc/osx/keyboardfocuslistener.hxx @@ -0,0 +1,37 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_KEYBOARDFOCUSLISTENER_HXX +#define INCLUDED_VCL_INC_OSX_KEYBOARDFOCUSLISTENER_HXX + +#include <com/sun/star/accessibility/XAccessible.hpp> + +#include <rtl/ref.hxx> +#include <salhelper/simplereferenceobject.hxx> + + +class KeyboardFocusListener : public salhelper::SimpleReferenceObject +{ +public: + virtual void focusedObjectChanged(const css::uno::Reference< css::accessibility::XAccessible >& xAccessible) = 0; +}; + +#endif // INCLUDED_VCL_INC_OSX_KEYBOARDFOCUSLISTENER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/osxvcltypes.h b/vcl/inc/osx/osxvcltypes.h new file mode 100644 index 000000000..bf3f4ec46 --- /dev/null +++ b/vcl/inc/osx/osxvcltypes.h @@ -0,0 +1,30 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_OSXVCLTYPES_H +#define INCLUDED_VCL_INC_OSX_OSXVCLTYPES_H + +#include <premac.h> +#import <Cocoa/Cocoa.h> +#import <AppKit/NSEvent.h> +#include <postmac.h> + +#endif // INCLUDED_VCL_INC_OSX_OSXVCLTYPES_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/printview.h b/vcl/inc/osx/printview.h new file mode 100644 index 000000000..a2a6e5454 --- /dev/null +++ b/vcl/inc/osx/printview.h @@ -0,0 +1,63 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_PRINTVIEW_H +#define INCLUDED_VCL_INC_OSX_PRINTVIEW_H + +#include <premac.h> +#include <Cocoa/Cocoa.h> +#include <postmac.h> + +#include <vcl/print.hxx> + +class AquaSalInfoPrinter; + +struct PrintAccessoryViewState +{ + bool bNeedRestart; + sal_Int32 nLastPage; + + PrintAccessoryViewState() + : bNeedRestart( false ), nLastPage( 0 ) {} +}; + +@interface AquaPrintView : NSView +{ + vcl::PrinterController* mpController; + AquaSalInfoPrinter* mpInfoPrinter; +} +-(id)initWithController: (vcl::PrinterController*)pController + withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter; +-(BOOL)knowsPageRange: (NSRangePointer)range; +-(NSRect)rectForPage: (int)page; +-(NSPoint)locationOfPrintRect: (NSRect)aRect; +-(void)drawRect: (NSRect)rect; +@end + +@interface AquaPrintAccessoryView : NSObject +{ +} ++(NSObject*)setupPrinterPanel: (NSPrintOperation*)pOp + withController: (vcl::PrinterController*)pController + withState: (PrintAccessoryViewState*)pState; +@end + +#endif // INCLUDED_VCL_INC_OSX_PRINTVIEW_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/runinmain.hxx b/vcl/inc/osx/runinmain.hxx new file mode 100644 index 000000000..e68bc4d35 --- /dev/null +++ b/vcl/inc/osx/runinmain.hxx @@ -0,0 +1,175 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_RUNINMAIN_HXX +#define INCLUDED_VCL_INC_OSX_RUNINMAIN_HXX + +/** + * Runs a command in the main thread. + * + * These macros are always used like a recursive calls, so they work like + * a closure. + * + * Uses two conditionals for a two way communication. + * The data (code block + result) is protected by the SolarMutex. + * + * There are three main macros, which act as function initializers: + * - OSX_RUNINMAIN - for all functions without return values + * - OSX_RUNINMAIN_POINTER - for all functions returning a pointer + * - OSX_RUNINMAIN_UNION - for all other return types + * + * All types used via OSX_RUNINMAIN_UNION must implement a move constructor, + * so there is no memory leak! + */ + +#include <unordered_map> + +#include <Block.h> + +#include <osl/thread.h> + +#include "saltimer.h" +#include <salframe.hxx> +#include <tools/debug.hxx> + +union RuninmainResult +{ + void* pointer; + bool boolean; + struct SalFrame::SalPointerState state; + + RuninmainResult() {} +}; + +#define OSX_RUNINMAIN_MEMBERS \ + std::mutex m_runInMainMutex; \ + std::condition_variable m_aInMainCondition; \ + std::condition_variable m_aResultCondition; \ + bool m_wakeUpMain = false; \ + bool m_resultReady = false; \ + RuninmainBlock m_aCodeBlock; \ + RuninmainResult m_aResult; + +#define OSX_RUNINMAIN( instance, command ) \ + if ( !instance->IsMainThread() ) \ + { \ + DBG_TESTSOLARMUTEX(); \ + SalYieldMutex *aMutex = static_cast<SalYieldMutex*>(instance->GetYieldMutex()); \ + { \ + std::scoped_lock<std::mutex> g(aMutex->m_runInMainMutex); \ + assert( !aMutex->m_aCodeBlock ); \ + aMutex->m_aCodeBlock = Block_copy(^{ \ + command; \ + }); \ + aMutex->m_wakeUpMain = true; \ + aMutex->m_aInMainCondition.notify_all(); \ + } \ + dispatch_async(dispatch_get_main_queue(),^{ \ + ImplNSAppPostEvent( AquaSalInstance::YieldWakeupEvent, NO ); \ + }); \ + { \ + std::unique_lock<std::mutex> g(aMutex->m_runInMainMutex); \ + aMutex->m_aResultCondition.wait( \ + g, [&aMutex]() { return aMutex->m_resultReady; }); \ + aMutex->m_resultReady = false; \ + } \ + return; \ + } + +#define OSX_RUNINMAIN_POINTER( instance, command, type ) \ + if ( !instance->IsMainThread() ) \ + { \ + DBG_TESTSOLARMUTEX(); \ + SalYieldMutex *aMutex = static_cast<SalYieldMutex*>(instance->GetYieldMutex()); \ + { \ + std::scoped_lock<std::mutex> g(aMutex->m_runInMainMutex); \ + assert( !aMutex->m_aCodeBlock ); \ + aMutex->m_aCodeBlock = Block_copy(^{ \ + aMutex->m_aResult.pointer = static_cast<void*>( command ); \ + }); \ + aMutex->m_wakeUpMain = true; \ + aMutex->m_aInMainCondition.notify_all(); \ + } \ + dispatch_async(dispatch_get_main_queue(),^{ \ + ImplNSAppPostEvent( AquaSalInstance::YieldWakeupEvent, NO ); \ + }); \ + { \ + std::unique_lock<std::mutex> g(aMutex->m_runInMainMutex); \ + aMutex->m_aResultCondition.wait( \ + g, [&aMutex]() { return aMutex->m_resultReady; }); \ + aMutex->m_resultReady = false; \ + } \ + return static_cast<type>( aMutex->m_aResult.pointer ); \ + } + +#define OSX_RUNINMAIN_UNION( instance, command, member ) \ + if ( !instance->IsMainThread() ) \ + { \ + DBG_TESTSOLARMUTEX(); \ + SalYieldMutex *aMutex = static_cast<SalYieldMutex*>(instance->GetYieldMutex()); \ + { \ + std::scoped_lock<std::mutex> g(aMutex->m_runInMainMutex); \ + assert( !aMutex->m_aCodeBlock ); \ + aMutex->m_aCodeBlock = Block_copy(^{ \ + aMutex->m_aResult.member = command; \ + }); \ + aMutex->m_wakeUpMain = true; \ + aMutex->m_aInMainCondition.notify_all(); \ + } \ + dispatch_async(dispatch_get_main_queue(),^{ \ + ImplNSAppPostEvent( AquaSalInstance::YieldWakeupEvent, NO ); \ + }); \ + { \ + std::unique_lock<std::mutex> g(aMutex->m_runInMainMutex); \ + aMutex->m_aResultCondition.wait( \ + g, [&aMutex]() { return aMutex->m_resultReady; }); \ + aMutex->m_resultReady = false; \ + } \ + return std::move( aMutex->m_aResult.member ); \ + } + +/** + * convenience macros used from SalInstance + */ + +#define OSX_INST_RUNINMAIN( command ) \ + OSX_RUNINMAIN( this, command ) + +#define OSX_INST_RUNINMAIN_POINTER( command, type ) \ + OSX_RUNINMAIN_POINTER( this, command, type ) + +#define OSX_INST_RUNINMAIN_UNION( command, member ) \ + OSX_RUNINMAIN_UNION( this, command, member ) + +/** + * convenience macros using global SalData + */ + +#define OSX_SALDATA_RUNINMAIN( command ) \ + OSX_RUNINMAIN( GetSalData()->mpInstance, command ) + +#define OSX_SALDATA_RUNINMAIN_POINTER( command, type ) \ + OSX_RUNINMAIN_POINTER( GetSalData()->mpInstance, command, type ) + +#define OSX_SALDATA_RUNINMAIN_UNION( command, member ) \ + OSX_RUNINMAIN_UNION( GetSalData()->mpInstance, command, member ) + +#endif // INCLUDED_VCL_INC_OSX_RUNINMAIN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/saldata.hxx b/vcl/inc/osx/saldata.hxx new file mode 100644 index 000000000..483902ff2 --- /dev/null +++ b/vcl/inc/osx/saldata.hxx @@ -0,0 +1,111 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_SALDATA_HXX +#define INCLUDED_VCL_INC_OSX_SALDATA_HXX + +#include <config_features.h> + +#include <premac.h> +#include <Cocoa/Cocoa.h> +#include <postmac.h> + +#include <com/sun/star/uno/Reference.hxx> + +#include <vcl/ptrstyle.hxx> + +#include <svdata.hxx> +#include <salwtype.hxx> + +#include <functional> +#include <list> +#include <map> +#include <unordered_set> +#include <vector> +#include <o3tl/enumarray.hxx> + +#include <cstdio> +#include <cstdarg> + +#include <apple_remote/RemoteMainController.h> + +class AquaSalFrame; +class AquaSalInstance; +class SalObject; +class SalFrame; +class SalVirtualDevice; +class SalPrinter; +class SystemFontList; + +#define SAL_CLIPRECT_COUNT 16 +#define INVALID_CURSOR_PTR reinterpret_cast<NSCursor*>(0xdeadbeef) + +// Singleton, instantiated from Application::Application() in +// vcl/source/app/svapp.cxx. + +class SalData +{ +public: + SALTIMERPROC mpTimerProc; // timer callback proc + AquaSalInstance *mpInstance; + std::list<AquaSalFrame*> maPresentationFrames; // list of frames in presentation mode + SalObject *mpFirstObject; // pointer of first object window + SalVirtualDevice *mpFirstVD; // first VirDev + SalPrinter *mpFirstPrinter; // first printing printer + SystemFontList *mpFontList; + NSStatusItem* mpStatusItem; // one status item that draws all our statuses + // at the moment this is only one add menu button + CGColorSpaceRef mxRGBSpace; + CGColorSpaceRef mxGraySpace; + + o3tl::enumarray< PointerStyle, NSCursor* > maCursors; + std::vector< NSMenuItem* > maFallbackMenu; + std::map< NSEvent*, bool > maKeyEventAnswer; + + static oslThreadKey s_aAutoReleaseKey; + + bool mbIsScrollbarDoubleMax; // TODO: support DoubleMin and DoubleBoth too +#if !HAVE_FEATURE_MACOSX_SANDBOX + AppleRemoteMainController* mpAppleRemoteMainController; +#endif + NSObject* mpDockIconClickHandler; + long mnDPIX; // #i100617# read DPI only once per office life + long mnDPIY; // #i100617# read DPI only once per office life + + css::uno::Reference< css::uno::XInterface > mxClipboard; + + SalData(); + ~SalData(); + + NSCursor* getCursor( PointerStyle i_eStyle ); + + static void ensureThreadAutoreleasePool(); + + static NSStatusItem* getStatusItem(); +}; + +inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = pData; } +inline SalData *GetSalData() { return ImplGetSVData()->mpSalData; } + +bool ImplSalYieldMutexTryToAcquire(); +void ImplSalYieldMutexRelease(); + +#endif // INCLUDED_VCL_INC_OSX_SALDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/salframe.h b/vcl/inc/osx/salframe.h new file mode 100644 index 000000000..3d0f19f41 --- /dev/null +++ b/vcl/inc/osx/salframe.h @@ -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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_SALFRAME_H +#define INCLUDED_VCL_INC_OSX_SALFRAME_H + +#include <premac.h> +#include <IOKit/pwr_mgt/IOPMLib.h> +#include <postmac.h> + +#include <vcl/sysdata.hxx> + +#include <osx/salinst.h> +#include <osx/salmenu.h> +#include <osx/saldata.hxx> +#include <osx/osxvcltypes.h> + +#include <salframe.hxx> + +#include <vector> +#include <utility> +#include <stdexcept> + +class AquaSalGraphics; +class AquaSalFrame; +class AquaSalTimer; +class AquaSalInstance; +class AquaSalMenu; + +class AquaSalFrame : public SalFrame +{ +public: + NSWindow* mpNSWindow; // Cocoa window + NSView* mpNSView; // Cocoa view (actually a custom view) + NSMenuItem* mpDockMenuEntry; // entry in the dynamic dock menu + NSRect maScreenRect; // for mirroring purposes + AquaSalGraphics* mpGraphics; // current frame graphics + AquaSalFrame* mpParent; // pointer to parent frame + SystemEnvData maSysData; // system data + int mnMinWidth; // min. client width in pixels + int mnMinHeight; // min. client height in pixels + int mnMaxWidth; // max. client width in pixels + int mnMaxHeight; // max. client height in pixels + NSRect maFullScreenRect; // old window size when in FullScreen + bool mbGraphics; // is Graphics used? + bool mbFullScreen; // is Window in FullScreen? + bool mbShown; + bool mbInitShow; + bool mbPositioned; + bool mbSized; + bool mbPresentation; + + SalFrameStyleFlags mnStyle; + unsigned int mnStyleMask; // our style mask from NSWindow creation + + sal_uInt64 mnLastEventTime; + unsigned int mnLastModifierFlags; + AquaSalMenu* mpMenu; + + SalExtStyle mnExtStyle; // currently document frames are marked this way + + PointerStyle mePointerStyle; // currently active pointer style + + NSTrackingRectTag mnTrackingRectTag; // used to get enter/leave messages + NSRect maTrackingRect; + + CGMutablePathRef mrClippingPath; // used for "shaping" + std::vector< CGRect > maClippingRects; + + tools::Rectangle maInvalidRect; + + InputContextFlags mnICOptions; + + // To prevent display sleep during presentation + IOPMAssertionID mnAssertionID; + + NSRect maFrameRect; + NSRect maContentRect; + + bool mbGeometryDidChange; + + int mnBlinkCursorDelay; + +public: + /** Constructor + + Creates a system window and connects this frame with it. + + @throws std::runtime_error in case window creation fails + */ + AquaSalFrame( SalFrame* pParent, SalFrameStyleFlags salFrameStyle ); + + virtual ~AquaSalFrame() override; + + virtual SalGraphics* AcquireGraphics() override; + virtual void ReleaseGraphics( SalGraphics* pGraphics ) override; + virtual bool PostEvent(std::unique_ptr<ImplSVEvent> pData) override; + virtual void SetTitle( const OUString& rTitle ) override; + virtual void SetIcon( sal_uInt16 nIcon ) override; + virtual void SetRepresentedURL( const OUString& ) override; + virtual void SetMenu( SalMenu* pSalMenu ) override; + virtual void DrawMenuBar() 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( void ) override; + virtual void Flush( const tools::Rectangle& ) 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 SetExtendedFrameStyle( SalExtStyle ) override; + virtual void SetScreenNumber(unsigned int) override; + virtual void SetApplicationID( const OUString &rApplicationID ) override; + + // shaped system windows + // set clip region to none (-> rectangular windows, normal state) + virtual void ResetClipRegion() override; + // start setting the clipregion consisting of nRects rectangles + virtual void BeginSetClipRegion( sal_uInt32 nRects ) override; + // add a rectangle to the clip region + virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) override; + // done setting up the clipregion + virtual void EndSetClipRegion() override; + + void UpdateFrameGeometry(); + + // trigger painting of the window + void SendPaintEvent( const tools::Rectangle* pRect = nullptr ); + + static inline bool isAlive( const AquaSalFrame* pFrame ); + + static AquaSalFrame* GetCaptureFrame() { return s_pCaptureFrame; } + + NSWindow* getNSWindow() const { return mpNSWindow; } + NSView* getNSView() const { return mpNSView; } + unsigned int getStyleMask() const { return mnStyleMask; } + + void getResolution( sal_Int32& o_rDPIX, sal_Int32& o_rDPIY ); + + // actually the following methods do the same thing: flipping y coordinates + // but having two of them makes clearer what the coordinate system + // is supposed to be before and after + void VCLToCocoa( NSRect& io_rRect, bool bRelativeToScreen = true ); + void CocoaToVCL( NSRect& io_rRect, bool bRelativeToScreen = true ); + + void VCLToCocoa( NSPoint& io_rPoint, bool bRelativeToScreen = true ); + void CocoaToVCL( NSPoint& io_Point, bool bRelativeToScreen = true ); + + NSCursor* getCurrentCursor(); + + CGMutablePathRef getClipPath() const { return mrClippingPath; } + + // called by VCL_NSApplication to indicate screen settings have changed + void screenParametersChanged(); + +protected: + SalEvent PreparePosSize(long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags); + +private: // methods + /** do things on initial show (like centering on parent or on screen) + */ + void initShow(); + + void initWindowAndView(); + + void doShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ); + + void doResetClipRegion(); + +private: // data + static AquaSalFrame* s_pCaptureFrame; + + AquaSalFrame( const AquaSalFrame& ) = delete; + AquaSalFrame& operator=(const AquaSalFrame&) = delete; +}; + +inline bool AquaSalFrame::isAlive( const AquaSalFrame* pFrame ) +{ + AquaSalInstance *pInst = GetSalData()->mpInstance; + return pInst && pInst->isFrameAlive( pFrame ); +} + +#endif // INCLUDED_VCL_INC_OSX_SALFRAME_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/salframeview.h b/vcl/inc/osx/salframeview.h new file mode 100644 index 000000000..36537f3db --- /dev/null +++ b/vcl/inc/osx/salframeview.h @@ -0,0 +1,213 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_SALFRAMEVIEW_H +#define INCLUDED_VCL_INC_OSX_SALFRAMEVIEW_H + +#include <osx/a11ywrapper.h> + +enum class SalEvent; + +@interface SalFrameWindow : NSWindow<NSWindowDelegate> +{ + AquaSalFrame* mpFrame; + id mDraggingDestinationHandler; +} +-(id)initWithSalFrame: (AquaSalFrame*)pFrame; +-(BOOL)canBecomeKeyWindow; +-(void)displayIfNeeded; +-(void)windowDidBecomeKey: (NSNotification*)pNotification; +-(void)windowDidResignKey: (NSNotification*)pNotification; +-(void)windowDidChangeScreen: (NSNotification*)pNotification; +-(void)windowDidMove: (NSNotification*)pNotification; +-(void)windowDidResize: (NSNotification*)pNotification; +-(void)windowDidMiniaturize: (NSNotification*)pNotification; +-(void)windowDidDeminiaturize: (NSNotification*)pNotification; +-(BOOL)windowShouldClose: (NSNotification*)pNotification; +//-(void)willEncodeRestorableState:(NSCoder*)pCoderState; +//-(void)didDecodeRestorableState:(NSCoder*)pCoderState; +//-(void)windowWillEnterVersionBrowser:(NSNotification*)pNotification; +-(void)dockMenuItemTriggered: (id)sender; +-(AquaSalFrame*)getSalFrame; +-(BOOL)containsMouse; +-(css::uno::Reference < css::accessibility::XAccessibleContext >)accessibleContext; + +/* NSDraggingDestination protocol methods + */ +-(NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender; +-(NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender; +-(void)draggingExited:(id <NSDraggingInfo>)sender; +-(BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender; +-(BOOL)performDragOperation:(id <NSDraggingInfo>)sender; +-(void)concludeDragOperation:(id <NSDraggingInfo>)sender; + +-(void)registerDraggingDestinationHandler:(id)theHandler; +-(void)unregisterDraggingDestinationHandler:(id)theHandler; +@end + +@interface SalFrameView : AquaA11yWrapper <NSTextInputClient> +{ + AquaSalFrame* mpFrame; + + // for NSTextInput/NSTextInputClient + NSEvent* mpLastEvent; + BOOL mbNeedSpecialKeyHandle; + BOOL mbInKeyInput; + BOOL mbKeyHandled; + NSRange mMarkedRange; + NSRange mSelectedRange; + id mpMouseEventListener; + id mDraggingDestinationHandler; + NSEvent* mpLastSuperEvent; + + // #i102807# used by magnify event handler + NSTimeInterval mfLastMagnifyTime; + float mfMagnifyDeltaSum; +} ++(void)unsetMouseFrame: (AquaSalFrame*)pFrame; +-(id)initWithSalFrame: (AquaSalFrame*)pFrame; +-(AquaSalFrame*)getSalFrame; +-(BOOL)acceptsFirstResponder; +-(BOOL)acceptsFirstMouse: (NSEvent *)pEvent; +-(BOOL)isOpaque; +-(void)drawRect: (NSRect)aRect; +-(void)mouseDown: (NSEvent*)pEvent; +-(void)mouseDragged: (NSEvent*)pEvent; +-(void)mouseUp: (NSEvent*)pEvent; +-(void)mouseMoved: (NSEvent*)pEvent; +-(void)mouseEntered: (NSEvent*)pEvent; +-(void)mouseExited: (NSEvent*)pEvent; +-(void)rightMouseDown: (NSEvent*)pEvent; +-(void)rightMouseDragged: (NSEvent*)pEvent; +-(void)rightMouseUp: (NSEvent*)pEvent; +-(void)otherMouseDown: (NSEvent*)pEvent; +-(void)otherMouseDragged: (NSEvent*)pEvent; +-(void)otherMouseUp: (NSEvent*)pEvent; +-(void)scrollWheel: (NSEvent*)pEvent; +-(void)magnifyWithEvent: (NSEvent*)pEvent; +-(void)rotateWithEvent: (NSEvent*)pEvent; +-(void)swipeWithEvent: (NSEvent*)pEvent; +-(void)keyDown: (NSEvent*)pEvent; +-(void)flagsChanged: (NSEvent*)pEvent; +-(void)sendMouseEventToFrame:(NSEvent*)pEvent button:(sal_uInt16)nButton eventtype:(SalEvent)nEvent; +-(BOOL)sendKeyInputAndReleaseToFrame: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar; +-(BOOL)sendKeyInputAndReleaseToFrame: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar modifiers: (unsigned int)nMod; +-(BOOL)sendKeyToFrameDirect: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar modifiers: (unsigned int)nMod; +-(BOOL)sendSingleCharacter:(NSEvent*)pEvent; +-(BOOL)handleKeyDownException:(NSEvent*)pEvent; +-(void)clearLastEvent; +/* + text action methods +*/ +-(void)insertText:(id)aString replacementRange:(NSRange)replacementRange; +-(void)insertTab: (id)aSender; +-(void)insertBacktab: (id)aSender; +-(void)moveLeft: (id)aSender; +-(void)moveLeftAndModifySelection: (id)aSender; +-(void)moveBackwardAndModifySelection: (id)aSender; +-(void)moveRight: (id)aSender; +-(void)moveRightAndModifySelection: (id)aSender; +-(void)moveForwardAndModifySelection: (id)aSender; +-(void)moveUp: (id)aSender; +-(void)moveDown: (id)aSender; +-(void)moveWordBackward: (id)aSender; +-(void)moveWordBackwardAndModifySelection: (id)aSender; +-(void)moveWordLeftAndModifySelection: (id)aSender; +-(void)moveWordForward: (id)aSender; +-(void)moveWordForwardAndModifySelection: (id)aSender; +-(void)moveWordRightAndModifySelection: (id)aSender; +-(void)moveToEndOfLine: (id)aSender; +-(void)moveToRightEndOfLine: (id)aSender; +-(void)moveToLeftEndOfLine: (id)aSender; +-(void)moveToEndOfLineAndModifySelection: (id)aSender; +-(void)moveToRightEndOfLineAndModifySelection: (id)aSender; +-(void)moveToLeftEndOfLineAndModifySelection: (id)aSender; +-(void)moveToBeginningOfLine: (id)aSender; +-(void)moveToBeginningOfLineAndModifySelection: (id)aSender; +-(void)moveToEndOfParagraph: (id)aSender; +-(void)moveToEndOfParagraphAndModifySelection: (id)aSender; +-(void)moveToBeginningOfParagraph: (id)aSender; +-(void)moveToBeginningOfParagraphAndModifySelection: (id)aSender; +-(void)moveParagraphForward: (id)aSender; +-(void)moveParagraphForwardAndModifySelection: (id)aSender; +-(void)moveParagraphBackward: (id)aSender; +-(void)moveParagraphBackwardAndModifySelection: (id)aSender; +-(void)moveToEndOfDocument: (id)aSender; +-(void)scrollToEndOfDocument: (id)aSender; +-(void)moveToEndOfDocumentAndModifySelection: (id)aSender; +-(void)moveToBeginningOfDocument: (id)aSender; +-(void)scrollToBeginningOfDocument: (id)aSender; +-(void)moveToBeginningOfDocumentAndModifySelection: (id)aSender; +-(void)insertNewline: (id)aSender; +-(void)deleteBackward: (id)aSender; +-(void)deleteForward: (id)aSender; +-(void)cancelOperation: (id)aSender; +-(void)deleteBackwardByDecomposingPreviousCharacter: (id)aSender; +-(void)deleteWordBackward: (id)aSender; +-(void)deleteWordForward: (id)aSender; +-(void)deleteToBeginningOfLine: (id)aSender; +-(void)deleteToEndOfLine: (id)aSender; +-(void)deleteToBeginningOfParagraph: (id)aSender; +-(void)deleteToEndOfParagraph: (id)aSender; +-(void)insertLineBreak: (id)aSender; +-(void)insertParagraphSeparator: (id)aSender; +-(void)selectWord: (id)aSender; +-(void)selectLine: (id)aSender; +-(void)selectParagraph: (id)aSender; +-(void)selectAll: (id)aSender; +-(void)noop: (id)aSender; +/* set the correct pointer for our view */ +-(void)resetCursorRects; +-(css::accessibility::XAccessibleContext *)accessibleContext; +-(id)parentAttribute; +-(NSWindow*)windowForParent; +/* + Event hook for D&D service. + + A drag operation will be invoked on a NSView using + the method 'dragImage'. This method requires the + actual mouse event initiating this drag operation. + Mouse events can only be received by subclassing + NSView and overriding methods like 'mouseDown' etc. + hence we implement an event hook here so that the + D&D service can register as listener for mouse + messages and use the last 'mouseDown' or + 'mouseDragged' message to initiate the drag + operation. +*/ +-(void)registerMouseEventListener: (id)theListener; +-(void)unregisterMouseEventListener: (id)theListener; + +/* NSDraggingDestination protocol methods + */ +-(NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender; +-(NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender; +-(void)draggingExited:(id <NSDraggingInfo>)sender; +-(BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender; +-(BOOL)performDragOperation:(id <NSDraggingInfo>)sender; +-(void)concludeDragOperation:(id <NSDraggingInfo>)sender; + +-(void)registerDraggingDestinationHandler:(id)theHandler; +-(void)unregisterDraggingDestinationHandler:(id)theHandler; + +@end + +#endif // INCLUDED_VCL_INC_OSX_SALFRAMEVIEW_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/salinst.h b/vcl/inc/osx/salinst.h new file mode 100644 index 000000000..edece53b6 --- /dev/null +++ b/vcl/inc/osx/salinst.h @@ -0,0 +1,162 @@ + +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_SALINST_H +#define INCLUDED_VCL_INC_OSX_SALINST_H + +#include <sal/config.h> + +#include <condition_variable> +#include <list> +#include <mutex> + +#include <comphelper/solarmutex.hxx> +#include <osl/conditn.hxx> +#include <osl/thread.hxx> + +#ifdef MACOSX +#include <osx/osxvcltypes.h> +#endif +#include <salinst.hxx> + +#include <osx/runinmain.hxx> + +#include <salusereventlist.hxx> + +class AquaSalFrame; +class SalFrame; +class SalObject; +class ApplicationEvent; +class Image; +enum class SalEvent; + +typedef void(^RuninmainBlock)(void); + +class SalYieldMutex : public comphelper::SolarMutex +{ +public: + OSX_RUNINMAIN_MEMBERS + +protected: + virtual void doAcquire( sal_uInt32 nLockCount ) override; + virtual sal_uInt32 doRelease( bool bUnlockAll ) override; + +public: + SalYieldMutex(); + virtual ~SalYieldMutex() override; + + virtual bool IsCurrentThread() const override; +}; + +class AquaSalInstance : public SalInstance, public SalUserEventList +{ + friend class AquaSalFrame; + + bool RunInMainYield( bool bHandleAllCurrentEvents ); + + virtual void ProcessEvent( SalUserEvent aEvent ) override; + +public: + virtual void TriggerUserEventProcessing() override; + + OUString maDefaultPrinter; + oslThreadIdentifier maMainThread; + int mnActivePrintJobs; + osl::Mutex maUserEventListMutex; + osl::Condition maWaitingYieldCond; + bool mbIsLiveResize; + bool mbNoYieldLock; + bool mbTimerProcessed; + + static std::list<const ApplicationEvent*> aAppEventList; + + AquaSalInstance(); + virtual ~AquaSalInstance() override; + + virtual void AfterAppInit() override; + virtual bool SVMainHook(int *) override; + + virtual SalFrame* CreateChildFrame( SystemParentData* pParent, SalFrameStyleFlags nStyle ) override; + virtual SalFrame* CreateFrame( SalFrame* 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 std::unique_ptr<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 std::unique_ptr<SalPrinter> CreatePrinter( SalInfoPrinter* pInfoPrinter ) override; + virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList ) override; + virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) override; + virtual OUString GetDefaultPrinter() override; + virtual SalTimer* CreateSalTimer() override; + virtual SalSystem* CreateSalSystem() override; + virtual std::shared_ptr<SalBitmap> CreateSalBitmap() override; + virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents) override; + virtual bool AnyInput( VclInputFlags nType ) override; + virtual std::unique_ptr<SalMenu> CreateMenu( bool bMenuBar, Menu* pVCLMenu ) override; + virtual std::unique_ptr<SalMenuItem> CreateMenuItem( const SalItemParams & rItemData ) override; + virtual OpenGLContext* CreateOpenGLContext() override; + virtual OUString GetConnectionIdentifier() override; + virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, + const OUString& rDocumentService) override; + + virtual OUString getOSVersion() override; + + // dtrans implementation + virtual css::uno::Reference< css::uno::XInterface > CreateClipboard( + const css::uno::Sequence< css::uno::Any >& i_rArguments ) override; + virtual css::uno::Reference< css::uno::XInterface > CreateDragSource() override; + virtual css::uno::Reference< css::uno::XInterface > CreateDropTarget() override; + + static void handleAppDefinedEvent( NSEvent* pEvent ); + + // check whether a particular string is passed on the command line + // this is needed to avoid duplicate open events through a) command line and b) NSApp's openFile + static bool isOnCommandLine( const OUString& ); + + void delayedSettingsChanged( bool bInvalidate ); + + // Is this the NSAppThread? + virtual bool IsMainThread() const override; + + void startedPrintJob() { mnActivePrintJobs++; } + void endedPrintJob() { mnActivePrintJobs--; } + + // event subtypes for NSApplicationDefined events + static const short AppExecuteSVMain = 1; + static const short AppStartTimerEvent = 10; + static const short YieldWakeupEvent = 20; + static const short DispatchTimerEvent = 30; + + static NSMenu* GetDynamicDockMenu(); +}; + +CGImageRef CreateCGImage( const Image& ); +NSImage* CreateNSImage( const Image& ); + +#endif // INCLUDED_VCL_INC_OSX_SALINST_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/salmenu.h b/vcl/inc/osx/salmenu.h new file mode 100644 index 000000000..597180cc1 --- /dev/null +++ b/vcl/inc/osx/salmenu.h @@ -0,0 +1,112 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_SALMENU_H +#define INCLUDED_VCL_INC_OSX_SALMENU_H + +#include <premac.h> +#include <Cocoa/Cocoa.h> +#include <postmac.h> + +#include <salmenu.hxx> + +#include <vector> + +class AquaSalFrame; +class AquaSalMenuItem; + +class AquaSalMenu : public SalMenu +{ + std::vector< AquaSalMenuItem* > maItems; + +public: // for OOStatusView + struct MenuBarButtonEntry + { + SalMenuButtonItem maButton; + NSImage* mpNSImage; // cached image + NSString* mpToolTipString; + + MenuBarButtonEntry() : mpNSImage( nil ), mpToolTipString( nil ) {} + MenuBarButtonEntry( const SalMenuButtonItem& i_rItem ) + : maButton( i_rItem), mpNSImage( nil ), mpToolTipString( nil ) {} + }; +private: + std::vector< MenuBarButtonEntry > maButtons; + + MenuBarButtonEntry* findButtonItem( sal_uInt16 i_nItemId ); + static void statusLayout(); +public: + AquaSalMenu( bool bMenuBar ); + virtual ~AquaSalMenu() override; + + virtual bool VisibleMenuBar() override; + + virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) override; + virtual void RemoveItem( unsigned nPos ) override; + virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ) override; + virtual void SetFrame( const SalFrame* pFrame ) override; + virtual void CheckItem( unsigned nPos, bool bCheck ) override; + virtual void EnableItem( unsigned nPos, bool bEnable ) override; + virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OUString& rText ) override; + virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage) override; + virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& rKeyName ) override; + virtual void GetSystemMenuData( SystemMenuData* pData ) override; + virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const tools::Rectangle& rRect, FloatWinPopupFlags nFlags) override; + virtual bool AddMenuBarButton( const SalMenuButtonItem& ) override; + virtual void RemoveMenuBarButton( sal_uInt16 nId ) override; + virtual tools::Rectangle GetMenuBarButtonRectPixel( sal_uInt16 i_nItemId, SalFrame* i_pReferenceFrame ) override; + + int getItemIndexByPos( sal_uInt16 nPos ) const; + const AquaSalFrame* getFrame() const; + + void setMainMenu(); + static void unsetMainMenu(); + static void setDefaultMenu(); + static void enableMainMenu( bool bEnable ); + static void addFallbackMenuItem( NSMenuItem* NewItem ); + static void removeFallbackMenuItem( NSMenuItem* pOldItem ); + + const std::vector< MenuBarButtonEntry >& getButtons() const { return maButtons; } + + bool mbMenuBar; // true - Menubar, false - Menu + NSMenu* mpMenu; // The Carbon reference to this menu + VclPtr<Menu> mpVCLMenu; // the corresponding vcl Menu object + const AquaSalFrame* mpFrame; // the frame to dispatch the menu events to + AquaSalMenu* mpParentSalMenu; // the parent menu that contains us (and perhaps has a frame) + + static const AquaSalMenu* pCurrentMenuBar; + +}; + +class AquaSalMenuItem : public SalMenuItem +{ +public: + AquaSalMenuItem( const SalItemParams* ); + virtual ~AquaSalMenuItem() override; + + sal_uInt16 mnId; // Item ID + VclPtr<Menu> mpVCLMenu; // VCL Menu into which this MenuItem is inserted + AquaSalMenu* mpParentMenu; // The menu in which this menu item is inserted + AquaSalMenu* mpSubMenu; // Sub menu of this item (if defined) + NSMenuItem* mpMenuItem; // The NSMenuItem +}; + +#endif // INCLUDED_VCL_INC_OSX_SALMENU_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/salnativewidgets.h b/vcl/inc/osx/salnativewidgets.h new file mode 100644 index 000000000..3fdcdc40c --- /dev/null +++ b/vcl/inc/osx/salnativewidgets.h @@ -0,0 +1,70 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_SALNATIVEWIDGETS_H +#define INCLUDED_VCL_INC_OSX_SALNATIVEWIDGETS_H + +#define TAB_HEIGHT 20 // height of tab header in pixels +#define TAB_TEXT_MARGIN 12 // left/right margin of text within tab headers +#define VCL_TAB_TEXT_SEPARATOR 2 // Space between two tabs required by VCL + +#define FOCUS_RING_WIDTH 4 // width of focus ring in pixels + +#define MEDIUM_PROGRESS_INDICATOR_HEIGHT 10 // height of medium progress indicator in pixels +#define LARGE_PROGRESS_INDICATOR_HEIGHT 16 // height of large progress indicator in pixels + +#define PUSH_BUTTON_NORMAL_HEIGHT 21 // height of normal push button without focus ring in pixels +#define PUSH_BUTTON_SMALL_HEIGHT 15 // height of small push button without focus ring in pixels + +#define RADIO_BUTTON_SMALL_SIZE 14 // width/height of small radio button without focus ring in pixels +#define RADIO_BUTTON_TEXT_SEPARATOR 3 // space between radio button and following text in pixels + +#define CHECKBOX_SMALL_SIZE 14 // width/height of checkbox without focus ring in pixels +#define CHECKBOX_TEXT_SEPARATOR 3 // space between checkbox and following text in pixels + +#define SLIDER_WIDTH 19 // width of slider in pixels +#define SLIDER_HEIGHT 18 // height of slider in pixels + +#define EDITBOX_HEIGHT 21 // height of editbox without focus ring in pixels +#define EDITBOX_BORDER_WIDTH 1 // width of editbox border in pixels +#define EDITBOX_INSET_MARGIN 1 // width of left/right as well as top/bottom editbox margin in pixels + +#define COMBOBOX_HEIGHT 20 // height of combobox without focus ring in pixels +#define COMBOBOX_BUTTON_WIDTH 18 // width of combobox button without focus ring in pixels +#define COMBOBOX_BORDER_WIDTH 1 // width of combobox border in pixels +#define COMBOBOX_TEXT_MARGIN 1 // left/right margin of text in pixels + +#define LISTBOX_HEIGHT 20 // height of listbox without focus ring in pixels +#define LISTBOX_BUTTON_WIDTH 18 // width of listbox button without focus ring in pixels +#define LISTBOX_BORDER_WIDTH 1 // width of listbox border in pixels +#define LISTBOX_TEXT_MARGIN 1 // left/right margin of text in pixels + +#define SPIN_BUTTON_WIDTH 13 // width of spin button without focus ring in pixels +#define SPIN_UPPER_BUTTON_HEIGHT 11 // height of upper spin button without focus ring in pixels +#define SPIN_LOWER_BUTTON_HEIGHT 11 // height of lower spin button without focus ring in pixels + +// FIXME: spinboxes are positioned one pixel shifted to the right by VCL. As positioning as well as size should be equal to +// corresponding editboxes, comboboxes or listboxes, positioning of spinboxes should by equal too. Issue cannot be fixed within +// native widget drawing code. As a workaround, an offset is considered for spinboxes to align spinboxes correctly. + +#define SPINBOX_OFFSET 1 // left offset for alignment with editboxes, comboboxes, and listboxes + +#endif // INCLUDED_VCL_INC_OSX_SALNATIVEWIDGETS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/salnsmenu.h b/vcl/inc/osx/salnsmenu.h new file mode 100644 index 000000000..f815c14c0 --- /dev/null +++ b/vcl/inc/osx/salnsmenu.h @@ -0,0 +1,53 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_SALNSMENU_H +#define INCLUDED_VCL_INC_OSX_SALNSMENU_H + +class AquaSalMenu; +class AquaSalMenuItem; + +@interface OOStatusItemView : NSView +{ +} +-(void)drawRect: (NSRect)aRect; +-(void)layout; +-(void)mouseUp: (NSEvent *)pEvent; +@end + +@interface SalNSMenu : NSMenu +{ + AquaSalMenu* mpMenu; +} +-(id)initWithMenu: (AquaSalMenu*)pMenu; +-(void)menuNeedsUpdate: (NSMenu*)pMenu; +-(void)setSalMenu: (AquaSalMenu*)pMenu; +@end + +@interface SalNSMenuItem : NSMenuItem +{ + AquaSalMenuItem* mpMenuItem; +} +-(id)initWithMenuItem: (AquaSalMenuItem*)pMenuItem; +-(void)menuItemTriggered: (id)aSender; +@end + +#endif // INCLUDED_VCL_INC_OSX_SALNSMENU_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/salnstimer.h b/vcl/inc/osx/salnstimer.h new file mode 100644 index 000000000..d1928fe9d --- /dev/null +++ b/vcl/inc/osx/salnstimer.h @@ -0,0 +1,35 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_SALNSTIMER_H +#define INCLUDED_VCL_INC_OSX_SALNSTIMER_H + +#include <premac.h> +#include <Cocoa/Cocoa.h> +#include <postmac.h> + +@interface TimerCallbackCaller : NSObject +{ +} +-(void)timerElapsed:(NSTimer*)pTimer; +@end + +#endif // INCLUDED_VCL_INC_OSX_SALNSTIMER_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/salobj.h b/vcl/inc/osx/salobj.h new file mode 100644 index 000000000..17f5374d1 --- /dev/null +++ b/vcl/inc/osx/salobj.h @@ -0,0 +1,68 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_SALOBJ_H +#define INCLUDED_VCL_INC_OSX_SALOBJ_H + +#include <vcl/sysdata.hxx> +#include <salobj.hxx> + +class AquaSalFrame; +class AquaSalObject; + + +struct SalObjectData +{ +}; + +class AquaSalObject : public SalObject +{ +public: + AquaSalFrame* mpFrame; // parent frame + NSClipView* mpClipView; + SystemEnvData maSysData; + + long mnClipX; + long mnClipY; + long mnClipWidth; + long mnClipHeight; + bool mbClip; + + long mnX; + long mnY; + long mnWidth; + long mnHeight; + + void setClippedPosSize(); + + AquaSalObject( AquaSalFrame* pFrame, SystemWindowData const * pWinData ); + virtual ~AquaSalObject() override; + + virtual void ResetClipRegion() override; + virtual void BeginSetClipRegion( sal_uInt32 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 const SystemEnvData* GetSystemData() const override; +}; + +#endif // INCLUDED_VCL_INC_OSX_SALOBJ_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/salprn.h b/vcl/inc/osx/salprn.h new file mode 100644 index 000000000..0c7ec1e9e --- /dev/null +++ b/vcl/inc/osx/salprn.h @@ -0,0 +1,152 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_SALPRN_H +#define INCLUDED_VCL_INC_OSX_SALPRN_H + +#include <osx/osxvcltypes.h> + +#include <salprn.hxx> + +#include <memory> + +class AquaSalGraphics; + +class AquaSalInfoPrinter : public SalInfoPrinter +{ + /// Printer graphics + AquaSalGraphics* mpGraphics; + /// is Graphics used + bool mbGraphics; + /// job active ? + bool mbJob; + + /// cocoa printer object + NSPrinter* mpPrinter; + /// cocoa print info object + NSPrintInfo* mpPrintInfo; + + /// FIXME: get real printer context for infoprinter if possible + /// fake context for info printer + /// graphics context for Quartz 2D + CGContextRef mrContext; + /// memory for graphics bitmap context for querying metrics + std::unique_ptr<sal_uInt8[]> mpContextMemory; + + // since changes to NSPrintInfo during a job are ignored + // we have to care for some settings ourselves + // currently we do this for orientation; + // really needed however is a solution for paper formats + Orientation mePageOrientation; + + int mnStartPageOffsetX; + int mnStartPageOffsetY; + sal_Int32 mnCurPageRangeStart; + sal_Int32 mnCurPageRangeCount; + + public: + AquaSalInfoPrinter( const SalPrinterQueueInfo& pInfo ); + virtual ~AquaSalInfoPrinter() override; + + void SetupPrinterGraphics( CGContextRef i_xContext ) const; + + virtual SalGraphics* AcquireGraphics() override; + virtual void ReleaseGraphics( SalGraphics* i_pGraphics ) override; + virtual bool Setup( weld::Window* i_pFrame, ImplJobSetup* i_pSetupData ) override; + virtual bool SetPrinterData( ImplJobSetup* pSetupData ) override; + virtual bool SetData( JobSetFlags i_nFlags, ImplJobSetup* i_pSetupData ) override; + virtual void GetPageInfo( const ImplJobSetup* i_pSetupData, + long& o_rOutWidth, long& o_rOutHeight, + Point& rPageOffset, + Size& rPaperSize ) override; + virtual sal_uInt32 GetCapabilities( const ImplJobSetup* i_pSetupData, PrinterCapType i_nType ) override; + virtual sal_uInt16 GetPaperBinCount( const ImplJobSetup* i_pSetupData ) override; + virtual OUString GetPaperBinName( const ImplJobSetup* i_pSetupData, sal_uInt16 i_nPaperBin ) override; + virtual void InitPaperFormats( const ImplJobSetup* i_pSetupData ) override; + virtual int GetLandscapeAngle( const ImplJobSetup* i_pSetupData ) override; + + // the artificial separation between InfoPrinter and Printer + // is not really useful for us + // so let's make AquaSalPrinter just a forwarder to AquaSalInfoPrinter + // and concentrate the real work in one class + // implement pull model print system + bool StartJob( const OUString* i_pFileName, + const OUString& rJobName, + const OUString& i_rAppName, + ImplJobSetup* i_pSetupData, + vcl::PrinterController& i_rController ); + bool EndJob(); + bool AbortJob(); + SalGraphics* StartPage( ImplJobSetup* i_pSetupData, bool i_bNewJobData ); + bool EndPage(); + + NSPrintInfo* getPrintInfo() const { return mpPrintInfo; } + void setStartPageOffset( int nOffsetX, int nOffsetY ) { mnStartPageOffsetX = nOffsetX; mnStartPageOffsetY = nOffsetY; } + sal_Int32 getCurPageRangeStart() const { return mnCurPageRangeStart; } + sal_Int32 getCurPageRangeCount() const { return mnCurPageRangeCount; } + + // match width/height against known paper formats, possibly switching orientation + const PaperInfo* matchPaper( long i_nWidth, long i_nHeight, Orientation& o_rOrientation ) const; + void setPaperSize( long i_nWidth, long i_nHeight, Orientation i_eSetOrientation ); + + private: + AquaSalInfoPrinter( const AquaSalInfoPrinter& ) = delete; + AquaSalInfoPrinter& operator=(const AquaSalInfoPrinter&) = delete; +}; + + +class AquaSalPrinter : public SalPrinter +{ + AquaSalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter + public: + AquaSalPrinter( AquaSalInfoPrinter* i_pInfoPrinter ); + virtual ~AquaSalPrinter() override; + + virtual bool StartJob( const OUString* i_pFileName, + const OUString& i_rJobName, + const OUString& i_rAppName, + sal_uInt32 i_nCopies, + bool i_bCollate, + bool i_bDirect, + ImplJobSetup* i_pSetupData ) override; + // implement pull model print system + virtual bool StartJob( const OUString* i_pFileName, + const OUString& rJobName, + const OUString& i_rAppName, + ImplJobSetup* i_pSetupData, + vcl::PrinterController& i_rListener ) override; + + virtual bool EndJob() override; + virtual SalGraphics* StartPage( ImplJobSetup* i_pSetupData, bool i_bNewJobData ) override; + virtual void EndPage() override; + + private: + AquaSalPrinter( const AquaSalPrinter& ) = delete; + AquaSalPrinter& operator=(const AquaSalPrinter&) = delete; +}; + +const double fPtTo100thMM = 35.27777778; + +inline int PtTo10Mu( double nPoints ) { return static_cast<int>((nPoints*fPtTo100thMM)+0.5); } + +inline double TenMuToPt( double nUnits ) { return floor((nUnits/fPtTo100thMM)+0.5); } + +#endif // INCLUDED_VCL_INC_OSX_SALPRN_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/salsys.h b/vcl/inc/osx/salsys.h new file mode 100644 index 000000000..b0bc98578 --- /dev/null +++ b/vcl/inc/osx/salsys.h @@ -0,0 +1,44 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_SALSYS_H +#define INCLUDED_VCL_INC_OSX_SALSYS_H + +#include <salsys.hxx> + +#include <list> + + +class VCL_DLLPUBLIC AquaSalSystem : public SalSystem +{ +public: + AquaSalSystem() {} + virtual ~AquaSalSystem() override; + + // get info about the display + virtual unsigned int GetDisplayScreenCount() override; + virtual tools::Rectangle GetDisplayScreenPosSizePixel( unsigned int nScreen ) override; + + virtual int ShowNativeMessageBox( const OUString& rTitle, + const OUString& rMessage) override; +}; + +#endif // INCLUDED_VCL_INC_OSX_SALSYS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/saltimer.h b/vcl/inc/osx/saltimer.h new file mode 100644 index 000000000..cdde3ec84 --- /dev/null +++ b/vcl/inc/osx/saltimer.h @@ -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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_SALTIMER_H +#define INCLUDED_VCL_INC_OSX_SALTIMER_H + +#include <premac.h> +#include <Cocoa/Cocoa.h> +#include <postmac.h> + +#include <saltimer.hxx> + +/** + * if NO == bAtStart, then it has to be run in the main thread, + * e.g. via performSelectorOnMainThread! + **/ +void ImplNSAppPostEvent( short nEventId, BOOL bAtStart, int nUserData = 0 ); + +class ReleasePoolHolder +{ + NSAutoreleasePool* mpPool; + +public: + ReleasePoolHolder() : mpPool( [[NSAutoreleasePool alloc] init] ) {} + ~ReleasePoolHolder() { [mpPool release]; } +}; + +class AquaSalTimer final : public SalTimer, protected VersionedEvent +{ + NSTimer *m_pRunningTimer; + bool m_bDirectTimeout; ///< timeout can be processed directly + + void queueDispatchTimerEvent( bool bAtStart ); + void callTimerCallback(); + +public: + AquaSalTimer(); + virtual ~AquaSalTimer() override; + + void Start( sal_uInt64 nMS ) override; + void Stop() override; + + void handleStartTimerEvent( NSEvent* pEvent ); + bool handleDispatchTimerEvent( NSEvent* pEvent ); + void handleTimerElapsed(); + void handleWindowShouldClose(); + + bool IsTimerElapsed() const; + inline bool IsDirectTimeout() const; +}; + +inline bool AquaSalTimer::IsDirectTimeout() const +{ + return m_bDirectTimeout; +} + +#endif // INCLUDED_VCL_INC_OSX_SALTIMER_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/svsys.h b/vcl/inc/osx/svsys.h new file mode 100644 index 000000000..9fcabe074 --- /dev/null +++ b/vcl/inc/osx/svsys.h @@ -0,0 +1,29 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_SVSYS_H +#define INCLUDED_VCL_INC_OSX_SVSYS_H + +#include <premac.h> +#include <Cocoa/Cocoa.h> +#include <postmac.h> + +#endif // INCLUDED_VCL_INC_OSX_SVSYS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/osx/vclnsapp.h b/vcl/inc/osx/vclnsapp.h new file mode 100644 index 000000000..82f0229a9 --- /dev/null +++ b/vcl/inc/osx/vclnsapp.h @@ -0,0 +1,68 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_OSX_VCLNSAPP_H +#define INCLUDED_VCL_INC_OSX_VCLNSAPP_H + +#include <config_features.h> + +#include <premac.h> +#include <Cocoa/Cocoa.h> +#include <postmac.h> + +class AquaSalFrame; + +@interface CocoaThreadEnabler : NSObject +{ +} +-(void)enableCocoaThreads:(id)param; +@end + +// our very own application +@interface VCL_NSApplication : NSApplication +{ +} +-(void)applicationDidFinishLaunching:(NSNotification*)pNotification; +-(void)sendEvent:(NSEvent*)pEvent; +-(void)sendSuperEvent:(NSEvent*)pEvent; +-(NSMenu*)applicationDockMenu:(NSApplication *)sender; +-(BOOL)application: (NSApplication*) app openFile: (NSString*)file; +-(void)application: (NSApplication*) app openFiles: (NSArray*)files; +-(BOOL)application: (NSApplication*) app printFile: (NSString*)file; +-(NSApplicationPrintReply)application: (NSApplication *) app printFiles:(NSArray *)files withSettings: (NSDictionary *)printSettings showPrintPanels:(BOOL)bShowPrintPanels; +-(NSApplicationTerminateReply)applicationShouldTerminate: (NSApplication *) app; +-(void)applicationWillTerminate: (NSNotification *) aNotification; +-(void)systemColorsChanged: (NSNotification*) pNotification; +-(void)screenParametersChanged: (NSNotification*) pNotification; +-(void)scrollbarVariantChanged: (NSNotification*) pNotification; +-(void)scrollbarSettingsChanged: (NSNotification*) pNotification; +-(void)addFallbackMenuItem: (NSMenuItem*)pNewItem; +-(void)removeFallbackMenuItem: (NSMenuItem*)pOldItem; +-(void)addDockMenuItem: (NSMenuItem*)pNewItem; +#if !HAVE_FEATURE_MACOSX_SANDBOX +-(void)applicationWillBecomeActive: (NSNotification *)pNotification; +-(void)applicationWillResignActive: (NSNotification *)pNotification; +#endif +-(BOOL)applicationShouldHandleReopen: (NSApplication*)pApp hasVisibleWindows: (BOOL)bWinVisible; +-(void)setDockIconClickHandler: (NSObject*)pHandler; +@end + +#endif // INCLUDED_VCL_INC_OSX_VCLNSAPP_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/outdata.hxx b/vcl/inc/outdata.hxx new file mode 100644 index 000000000..9764a6cda --- /dev/null +++ b/vcl/inc/outdata.hxx @@ -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 . + */ + +#ifndef INCLUDED_VCL_INC_OUTDATA_HXX +#define INCLUDED_VCL_INC_OUTDATA_HXX + +#include <tools/color.hxx> + +inline bool ImplIsColorTransparent( Color aColor ) +{ + return aColor.GetTransparency() != 0; +} + +#endif // INCLUDED_VCL_INC_OUTDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/outdev.h b/vcl/inc/outdev.h new file mode 100644 index 000000000..27f8dc548 --- /dev/null +++ b/vcl/inc/outdev.h @@ -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 . + */ + +#ifndef INCLUDED_VCL_INC_OUTDEV_H +#define INCLUDED_VCL_INC_OUTDEV_H + +#include <set> +#include <vector> + +#include <tools/gen.hxx> +#include <vcl/vclptr.hxx> + +#include "fontinstance.hxx" +#include "PhysicalFontFace.hxx" +#include "impfontcache.hxx" + +class Size; +namespace vcl { class Font; } +class VirtualDevice; +class PhysicalFontCollection; +enum class AddFontSubstituteFlags; + +// an ImplDeviceFontList is created by a PhysicalFontCollection +// it becomes invalid when original PhysicalFontCollection is modified +class ImplDeviceFontList +{ +private: + std::vector<rtl::Reference<PhysicalFontFace>> maDevFontVector; + +public: + ImplDeviceFontList() { maDevFontVector.reserve(1024); } + void Add( PhysicalFontFace* pFace ) { maDevFontVector.push_back( pFace ); } + PhysicalFontFace* Get( int nIndex ) const { return maDevFontVector[ nIndex ].get(); } + int Count() const { return maDevFontVector.size(); } +}; + +class ImplDeviceFontSizeList +{ +private: + std::vector<int> maSizeList; + +public: + ImplDeviceFontSizeList() + { maSizeList.reserve( 32 ); } + void Add( int nHeight ) { maSizeList.push_back( nHeight ); } + int Count() const { return maSizeList.size(); } + int Get( int nIndex ) const { return maSizeList[ nIndex ]; } +}; + +// nowadays these substitutions are needed for backward compatibility and tight platform integration: +// - substitutions from configuration entries (Tools->Options->FontReplacement and/or fontconfig) +// - device specific substitutions (e.g. for PS printer builtin fonts) +// - substitutions for missing fonts defined by configuration entries (generic and/or platform dependent fallbacks) +// - substitutions for missing fonts defined by multi-token fontnames (e.g. fontname="SpecialFont;FallbackA;FallbackB") +// - substitutions for incomplete fonts (implicit, generic, EUDC and/or platform dependent fallbacks) +// - substitutions for missing symbol fonts by translating code points into other symbol fonts + +class ImplFontSubstitution +{ + // TODO: there is more commonality between the different substitutions +protected: + virtual ~ImplFontSubstitution() {} +}; + +// ImplDirectFontSubstitution is for Tools->Options->FontReplacement and PsPrinter substitutions +// The class is just a simple port of the unmaintainable manual-linked-list based mechanism +// TODO: get rid of this class when the Tools->Options->FontReplacement tabpage is gone for good + +struct ImplFontSubstEntry +{ + OUString maSearchName; + OUString maSearchReplaceName; + AddFontSubstituteFlags mnFlags; + + ImplFontSubstEntry( const OUString& rFontName, const OUString& rSubstFontName, AddFontSubstituteFlags nSubstFlags ); +}; + +class ImplDirectFontSubstitution final +: public ImplFontSubstitution +{ +private: + std::vector<ImplFontSubstEntry> maFontSubstList; +public: + void AddFontSubstitute( const OUString& rFontName, const OUString& rSubstName, AddFontSubstituteFlags nFlags ); + void RemoveFontsSubstitute(); + + bool FindFontSubstitute( OUString& rSubstName, const OUString& rFontName ) const; +}; + +// PreMatchFontSubstitution +// abstracts the concept of a configured font substitution +// before the availability of the originally selected font has been checked +class ImplPreMatchFontSubstitution +: public ImplFontSubstitution +{ +public: + virtual bool FindFontSubstitute(FontSelectPattern&) const = 0; +}; + +// ImplGlyphFallbackFontSubstitution +// abstracts the concept of finding the best font to support an incomplete font +class ImplGlyphFallbackFontSubstitution +: public ImplFontSubstitution +{ +public: + virtual bool FindFontSubstitute(FontSelectPattern&, LogicalFontInstance* pLogicalFont, OUString& rMissingCodes) const = 0; +}; + +namespace vcl { struct ControlLayoutData; } +// #i75163# +namespace basegfx { class B2DHomMatrix; } + +struct ImplOutDevData +{ + VclPtr<VirtualDevice> mpRotateDev; + vcl::ControlLayoutData* mpRecordLayout; + tools::Rectangle maRecordRect; + + // #i75163# + basegfx::B2DHomMatrix* mpViewTransform; + basegfx::B2DHomMatrix* mpInverseViewTransform; +}; + +void ImplFontSubstitute( OUString& rFontName ); + +#endif // INCLUDED_VCL_INC_OUTDEV_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/pch/precompiled_vcl.cxx b/vcl/inc/pch/precompiled_vcl.cxx new file mode 100644 index 000000000..79285a8f9 --- /dev/null +++ b/vcl/inc/pch/precompiled_vcl.cxx @@ -0,0 +1,12 @@ +/* -*- 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/. + */ + +#include "precompiled_vcl.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/pch/precompiled_vcl.hxx b/vcl/inc/pch/precompiled_vcl.hxx new file mode 100644 index 000000000..2e94519a4 --- /dev/null +++ b/vcl/inc/pch/precompiled_vcl.hxx @@ -0,0 +1,340 @@ +/* -*- 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 has been autogenerated by update_pch.sh. It is possible to edit it + manually (such as when an include file has been moved/renamed/removed). All such + manual changes will be rewritten by the next run of update_pch.sh (which presumably + also fixes all possible problems, so it's usually better to use it). + + Generated on 2020-05-07 20:21:38 using: + ./bin/update_pch vcl vcl --cutoff=6 --exclude:system --include:module --include:local + + If after updating build fails, use the following command to locate conflicting headers: + ./bin/update_pch_bisect ./vcl/inc/pch/precompiled_vcl.hxx "make vcl.build" --find-conflicts +*/ + +#if PCH_LEVEL >= 1 +#include <algorithm> +#include <atomic> +#include <cassert> +#include <cmath> +#include <cstddef> +#include <cstdlib> +#include <cstring> +#include <deque> +#include <float.h> +#include <functional> +#include <initializer_list> +#include <iomanip> +#include <limits.h> +#include <limits> +#include <map> +#include <math.h> +#include <memory> +#include <new> +#include <optional> +#include <ostream> +#include <set> +#include <stddef.h> +#include <string.h> +#include <string> +#include <string_view> +#include <type_traits> +#include <unordered_map> +#include <utility> +#include <vector> +#include <boost/functional/hash.hpp> +#include <boost/math/special_functions/sinc.hpp> +#include <boost/multi_array.hpp> +#include <boost/property_tree/ptree.hpp> +#include <boost/property_tree/ptree_fwd.hpp> +#endif // PCH_LEVEL >= 1 +#if PCH_LEVEL >= 2 +#include <osl/conditn.hxx> +#include <osl/diagnose.h> +#include <osl/endian.h> +#include <osl/file.hxx> +#include <osl/interlck.h> +#include <osl/module.hxx> +#include <osl/mutex.h> +#include <osl/mutex.hxx> +#include <osl/process.h> +#include <osl/signal.h> +#include <osl/thread.h> +#include <osl/time.h> +#include <rtl/alloc.h> +#include <rtl/bootstrap.hxx> +#include <rtl/character.hxx> +#include <rtl/crc.h> +#include <rtl/digest.h> +#include <rtl/instance.hxx> +#include <rtl/math.h> +#include <rtl/math.hxx> +#include <rtl/ref.hxx> +#include <rtl/strbuf.hxx> +#include <rtl/string.h> +#include <rtl/string.hxx> +#include <rtl/stringconcat.hxx> +#include <rtl/stringutils.hxx> +#include <rtl/tencinfo.h> +#include <rtl/textcvt.h> +#include <rtl/textenc.h> +#include <rtl/unload.h> +#include <rtl/uri.hxx> +#include <rtl/ustrbuf.hxx> +#include <rtl/ustring.h> +#include <rtl/ustring.hxx> +#include <rtl/uuid.h> +#include <sal/config.h> +#include <sal/log.hxx> +#include <sal/macros.h> +#include <sal/saldllapi.h> +#include <sal/types.h> +#endif // PCH_LEVEL >= 2 +#if PCH_LEVEL >= 3 +#include <basegfx/basegfxdllapi.h> +#include <basegfx/color/bcolor.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/point/b2ipoint.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/range/b2drange.hxx> +#include <basegfx/range/basicrange.hxx> +#include <basegfx/tuple/b2dtuple.hxx> +#include <basegfx/tuple/b2ituple.hxx> +#include <basegfx/tuple/b3dtuple.hxx> +#include <basegfx/utils/common.hxx> +#include <basegfx/vector/b2dvector.hxx> +#include <basegfx/vector/b2enums.hxx> +#include <basegfx/vector/b2ivector.hxx> +#include <com/sun/star/awt/Key.hpp> +#include <com/sun/star/awt/KeyGroup.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/datatransfer/DataFlavor.hpp> +#include <com/sun/star/datatransfer/XTransferable2.hpp> +#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> +#include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp> +#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> +#include <com/sun/star/datatransfer/dnd/DropTargetDragEvent.hpp> +#include <com/sun/star/datatransfer/dnd/DropTargetDropEvent.hpp> +#include <com/sun/star/datatransfer/dnd/XDragGestureListener.hpp> +#include <com/sun/star/datatransfer/dnd/XDragSourceListener.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp> +#include <com/sun/star/embed/Aspects.hpp> +#include <com/sun/star/frame/XTerminateListener.hpp> +#include <com/sun/star/i18n/Calendar2.hpp> +#include <com/sun/star/i18n/TransliterationModules.hpp> +#include <com/sun/star/i18n/TransliterationModulesExtra.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/lang/EventObject.hpp> +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/uno/Any.h> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Type.h> +#include <com/sun/star/uno/Type.hxx> +#include <com/sun/star/uno/TypeClass.hdl> +#include <com/sun/star/uno/XAggregation.hpp> +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/uno/XWeak.hpp> +#include <com/sun/star/uno/genfunc.h> +#include <com/sun/star/uno/genfunc.hxx> +#include <com/sun/star/util/Date.hpp> +#include <com/sun/star/util/DateTime.hpp> +#include <comphelper/comphelperdllapi.h> +#include <comphelper/fileformat.h> +#include <comphelper/lok.hxx> +#include <comphelper/processfactory.hxx> +#include <comphelper/sequence.hxx> +#include <comphelper/string.hxx> +#include <cppu/cppudllapi.h> +#include <cppu/unotype.hxx> +#include <cppuhelper/cppuhelperdllapi.h> +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/implbase_ex.hxx> +#include <cppuhelper/implbase_ex_post.hxx> +#include <cppuhelper/implbase_ex_pre.hxx> +#include <cppuhelper/interfacecontainer.h> +#include <cppuhelper/supportsservice.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/weakagg.hxx> +#include <cppuhelper/weakref.hxx> +#include <i18nlangtag/lang.h> +#include <i18nlangtag/languagetag.hxx> +#include <i18nlangtag/mslangid.hxx> +#include <i18nutil/i18nutildllapi.h> +#include <o3tl/cow_wrapper.hxx> +#include <o3tl/safeint.hxx> +#include <o3tl/strong_int.hxx> +#include <o3tl/typed_flags_set.hxx> +#include <o3tl/underlyingenumvalue.hxx> +#include <officecfg/Office/Common.hxx> +#include <salhelper/linkhelper.hxx> +#include <salhelper/salhelperdllapi.h> +#include <salhelper/simplereferenceobject.hxx> +#include <salhelper/thread.hxx> +#include <sot/exchange.hxx> +#include <sot/formats.hxx> +#include <sot/sotdllapi.h> +#include <svl/hint.hxx> +#include <svl/macitem.hxx> +#include <svl/poolitem.hxx> +#include <svl/svldllapi.h> +#include <svl/typedwhich.hxx> +#include <test/outputdevice.hxx> +#include <tools/UnitConversion.hxx> +#include <tools/color.hxx> +#include <tools/contnr.hxx> +#include <tools/date.hxx> +#include <tools/datetime.hxx> +#include <tools/debug.hxx> +#include <tools/diagnose_ex.h> +#include <tools/fontenum.hxx> +#include <tools/fract.hxx> +#include <tools/gen.hxx> +#include <tools/globname.hxx> +#include <tools/helpers.hxx> +#include <tools/link.hxx> +#include <tools/mapunit.hxx> +#include <tools/poly.hxx> +#include <tools/ref.hxx> +#include <tools/solar.h> +#include <tools/stream.hxx> +#include <tools/time.hxx> +#include <tools/toolsdllapi.h> +#include <tools/urlobj.hxx> +#include <tools/vcompat.hxx> +#include <tools/zcodec.hxx> +#include <typelib/typeclass.h> +#include <typelib/typedescription.h> +#include <typelib/uik.h> +#include <uno/any2.h> +#include <uno/data.h> +#include <uno/sequence2.h> +#include <unotools/configmgr.hxx> +#include <unotools/localedatawrapper.hxx> +#include <unotools/ucbstreamhelper.hxx> +#include <unotools/unotoolsdllapi.h> +#endif // PCH_LEVEL >= 3 +#if PCH_LEVEL >= 4 +#include <PhysicalFontCollection.hxx> +#include <PhysicalFontFace.hxx> +#include <TypeSerializer.hxx> +#include <bitmapwriteaccess.hxx> +#include <brdwin.hxx> +#include <configsettings.hxx> +#include <controldata.hxx> +#include <fontattributes.hxx> +#include <impglyphitem.hxx> +#include <outdev.h> +#include <salbmp.hxx> +#include <salframe.hxx> +#include <salgdi.hxx> +#include <salgdiimpl.hxx> +#include <sallayout.hxx> +#include <salmenu.hxx> +#include <salobj.hxx> +#include <salptype.hxx> +#include <salsession.hxx> +#include <salsys.hxx> +#include <saltimer.hxx> +#include <salusereventlist.hxx> +#include <salvd.hxx> +#include <salvtables.hxx> +#include <svdata.hxx> +#include <vcl/BitmapFilter.hxx> +#include <vcl/BitmapTools.hxx> +#include <vcl/accel.hxx> +#include <vcl/alpha.hxx> +#include <vcl/bitmap.hxx> +#include <vcl/bitmapaccess.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/builder.hxx> +#include <vcl/canvastools.hxx> +#include <vcl/commandevent.hxx> +#include <vcl/commandinfoprovider.hxx> +#include <vcl/ctrl.hxx> +#include <vcl/cursor.hxx> +#include <vcl/cvtgrf.hxx> +#include <vcl/decoview.hxx> +#include <vcl/dibtools.hxx> +#include <vcl/dllapi.h> +#include <vcl/dockwin.hxx> +#include <vcl/edit.hxx> +#include <vcl/event.hxx> +#include <vcl/fixed.hxx> +#include <vcl/floatwin.hxx> +#include <vcl/fntstyle.hxx> +#include <vcl/font.hxx> +#include <vcl/gdimtf.hxx> +#include <vcl/gradient.hxx> +#include <vcl/graph.hxx> +#include <vcl/graphicfilter.hxx> +#include <vcl/help.hxx> +#include <vcl/i18nhelp.hxx> +#include <vcl/idle.hxx> +#include <vcl/image.hxx> +#include <vcl/layout.hxx> +#include <vcl/lineinfo.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/menu.hxx> +#include <vcl/metaact.hxx> +#include <vcl/mnemonic.hxx> +#include <vcl/mnemonicengine.hxx> +#include <vcl/outdev.hxx> +#include <vcl/ptrstyle.hxx> +#include <vcl/quickselectionengine.hxx> +#include <vcl/scrbar.hxx> +#include <vcl/settings.hxx> +#include <vcl/spinfld.hxx> +#include <vcl/svapp.hxx> +#include <vcl/svlbitm.hxx> +#include <vcl/syswin.hxx> +#include <vcl/tabctrl.hxx> +#include <vcl/tabpage.hxx> +#include <vcl/taskpanelist.hxx> +#include <vcl/timer.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/toolkit/button.hxx> +#include <vcl/toolkit/dialog.hxx> +#include <vcl/toolkit/unowrap.hxx> +#include <vcl/transfer.hxx> +#include <vcl/treelist.hxx> +#include <vcl/treelistentries.hxx> +#include <vcl/treelistentry.hxx> +#include <vcl/uitest/logger.hxx> +#include <vcl/uitest/uiobject.hxx> +#include <vcl/unohelp.hxx> +#include <vcl/vclenum.hxx> +#include <vcl/vclevent.hxx> +#include <vcl/vclptr.hxx> +#include <vcl/viewdataentry.hxx> +#include <vcl/virdev.hxx> +#include <vcl/weld.hxx> +#include <vcl/window.hxx> +#include <vcl/wrkwin.hxx> +#include <window.h> +#endif // PCH_LEVEL >= 4 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/pdf/BitmapID.hxx b/vcl/inc/pdf/BitmapID.hxx new file mode 100644 index 000000000..cedc57903 --- /dev/null +++ b/vcl/inc/pdf/BitmapID.hxx @@ -0,0 +1,44 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_PDF_BITMAPID_HXX +#define INCLUDED_VCL_INC_PDF_BITMAPID_HXX + +#include <vcl/dllapi.h> +#include <vcl/checksum.hxx> +#include <tools/gen.hxx> + +namespace vcl::pdf +{ +struct BitmapID +{ + Size m_aPixelSize; + sal_Int32 m_nSize; + BitmapChecksum m_nChecksum; + BitmapChecksum m_nMaskChecksum; + + BitmapID() + : m_nSize(0) + , m_nChecksum(0) + , m_nMaskChecksum(0) + { + } + + bool operator==(const BitmapID& rComp) const + { + return (m_aPixelSize == rComp.m_aPixelSize && m_nSize == rComp.m_nSize + && m_nChecksum == rComp.m_nChecksum && m_nMaskChecksum == rComp.m_nMaskChecksum); + } +}; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/pdf/Matrix3.hxx b/vcl/inc/pdf/Matrix3.hxx new file mode 100644 index 000000000..c36332015 --- /dev/null +++ b/vcl/inc/pdf/Matrix3.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/. + * + */ + +#ifndef INCLUDED_VCL_INC_PDF_MATRIX3_HXX +#define INCLUDED_VCL_INC_PDF_MATRIX3_HXX + +#include <vcl/dllapi.h> +#include <tools/gen.hxx> + +namespace vcl::pdf +{ +// matrix helper class +// TODO: use basegfx matrix class instead or derive from it + +/* for sparse matrices of the form (2D linear transformations) + * f[0] f[1] 0 + * f[2] f[3] 0 + * f[4] f[5] 1 + */ +class Matrix3 +{ + double f[6]; + + void set(const double* pn) + { + for (int i = 0; i < 6; i++) + f[i] = pn[i]; + } + +public: + Matrix3(); + + void skew(double alpha, double beta); + void scale(double sx, double sy); + void rotate(double angle); + void translate(double tx, double ty); + void invert(); + + double get(size_t i) const { return f[i]; } + + Point transform(const Point& rPoint) const; +}; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/pdf/ResourceDict.hxx b/vcl/inc/pdf/ResourceDict.hxx new file mode 100644 index 000000000..488a821db --- /dev/null +++ b/vcl/inc/pdf/ResourceDict.hxx @@ -0,0 +1,42 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_PDF_RESOURCEDICT_HXX +#define INCLUDED_VCL_INC_PDF_RESOURCEDICT_HXX + +#include <vcl/dllapi.h> +#include <rtl/strbuf.hxx> +#include <map> + +namespace vcl::pdf +{ +enum class ResourceKind +{ + XObject, + ExtGState, + Shading, + Pattern +}; + +struct ResourceDict +{ + // note: handle fonts globally for performance + std::map<OString, sal_Int32> m_aXObjects; + std::map<OString, sal_Int32> m_aExtGStates; + std::map<OString, sal_Int32> m_aShadings; + std::map<OString, sal_Int32> m_aPatterns; + + void append(OStringBuffer& rBuffer, sal_Int32 nFontDictObject); +}; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/pdf/XmpMetadata.hxx b/vcl/inc/pdf/XmpMetadata.hxx new file mode 100644 index 000000000..61438e0e5 --- /dev/null +++ b/vcl/inc/pdf/XmpMetadata.hxx @@ -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/. + * + */ + +#ifndef INCLUDED_VCL_INC_PDF_XMPMETADATA_HXX +#define INCLUDED_VCL_INC_PDF_XMPMETADATA_HXX + +#include <vcl/dllapi.h> +#include <rtl/string.hxx> +#include <tools/stream.hxx> +#include <memory> + +namespace vcl::pdf +{ +class XmpMetadata +{ +private: + bool mbWritten; + std::unique_ptr<SvMemoryStream> mpMemoryStream; + +public: + OString msTitle; + OString msAuthor; + OString msSubject; + OString msProducer; + OString msKeywords; + OString m_sCreatorTool; + OString m_sCreateDate; + + sal_Int32 mnPDF_A; + bool mbPDF_UA; + +public: + XmpMetadata(); + sal_uInt64 getSize(); + const void* getData(); + +private: + void write(); +}; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ppdparser.hxx b/vcl/inc/ppdparser.hxx new file mode 100644 index 000000000..b5bf309ed --- /dev/null +++ b/vcl/inc/ppdparser.hxx @@ -0,0 +1,274 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_VCL_PPDPARSER_HXX +#define INCLUDED_VCL_PPDPARSER_HXX + +#include <sal/config.h> + +#include <cstddef> +#include <memory> +#include <unordered_map> +#include <vector> + +#include <rtl/string.hxx> +#include <rtl/ustring.hxx> +#include <tools/solar.h> +#include <vcl/dllapi.h> + +#define PRINTER_PPDDIR "driver" + +namespace psp { + +class PPDCache; +class PPDTranslator; + +enum PPDValueType { eInvocation, eQuoted, eSymbol, eString, eNo }; + +struct VCL_DLLPUBLIC PPDValue +{ + PPDValueType m_eType; + //CustomOption stuff for fdo#43049 + //see http://www.cups.org/documentation.php/spec-ppd.html#OPTIONS + //for full specs, only the basics are implemented here + bool m_bCustomOption; + mutable OUString m_aCustomOption; + OUString m_aOption; + OUString m_aValue; +}; + + +/* + * PPDKey - a container for the available options (=values) of a PPD keyword + */ + +class PPDKey +{ + friend class PPDParser; + friend class CPDManager; + + typedef std::unordered_map< OUString, PPDValue > hash_type; + typedef std::vector< PPDValue* > value_type; + + OUString m_aKey; + hash_type m_aValues; + value_type m_aOrderedValues; + const PPDValue* m_pDefaultValue; + bool m_bQueryValue; + OUString m_aGroup; + +public: + enum class SetupType { ExitServer, Prolog, DocumentSetup, PageSetup, JCLSetup, AnySetup }; +private: + + bool m_bUIOption; + int m_nOrderDependency; + SetupType m_eSetupType; + + void eraseValue( const OUString& rOption ); +public: + PPDKey( const OUString& rKey ); + ~PPDKey(); + + PPDValue* insertValue(const OUString& rOption, PPDValueType eType, bool bCustomOption = false); + int countValues() const + { return m_aValues.size(); } + // neither getValue will return the query option + const PPDValue* getValue( int n ) const; + const PPDValue* getValue( const OUString& rOption ) const; + const PPDValue* getValueCaseInsensitive( const OUString& rOption ) const; + const PPDValue* getDefaultValue() const { return m_pDefaultValue; } + const OUString& getGroup() const { return m_aGroup; } + + const OUString& getKey() const { return m_aKey; } + bool isUIKey() const { return m_bUIOption; } + SetupType getSetupType() const { return m_eSetupType; } + int getOrderDependency() const { return m_nOrderDependency; } +}; + +// define a hash for PPDKey +struct PPDKeyhash +{ + size_t operator()( const PPDKey * pKey) const + { return reinterpret_cast<size_t>(pKey); } +}; + + +/* + * PPDParser - parses a PPD file and contains all available keys from it + */ + +class PPDParser +{ + friend class PPDContext; + friend class CUPSManager; + friend class CPDManager; + friend class PPDCache; + + typedef std::unordered_map< OUString, std::unique_ptr<PPDKey> > hash_type; + typedef std::vector< PPDKey* > value_type; + + void insertKey( std::unique_ptr<PPDKey> pKey ); +public: + struct PPDConstraint + { + const PPDKey* m_pKey1; + const PPDValue* m_pOption1; + const PPDKey* m_pKey2; + const PPDValue* m_pOption2; + + PPDConstraint() : m_pKey1( nullptr ), m_pOption1( nullptr ), m_pKey2( nullptr ), m_pOption2( nullptr ) {} + }; +private: + hash_type m_aKeys; + value_type m_aOrderedKeys; + ::std::vector< PPDConstraint > m_aConstraints; + + // the full path of the PPD file + OUString m_aFile; + // some basic attributes + bool m_bColorDevice; + bool m_bType42Capable; + sal_uLong m_nLanguageLevel; + rtl_TextEncoding m_aFileEncoding; + + + // shortcuts to important keys and their default values + // imageable area + const PPDKey* m_pImageableAreas; + // paper dimensions + const PPDValue* m_pDefaultPaperDimension; + const PPDKey* m_pPaperDimensions; + // paper trays + const PPDValue* m_pDefaultInputSlot; + // resolutions + const PPDValue* m_pDefaultResolution; + + // translations + std::unique_ptr<PPDTranslator> m_pTranslator; + + PPDParser( const OUString& rFile ); + PPDParser(const OUString& rFile, const std::vector<PPDKey*>& keys); + + void parseOrderDependency(const OString& rLine); + void parseOpenUI(const OString& rLine, const OString& rPPDGroup); + void parseConstraint(const OString& rLine); + void parse( std::vector< OString >& rLines ); + + OUString handleTranslation(const OString& i_rString, bool i_bIsGlobalized); + + static void scanPPDDir( const OUString& rDir ); + static void initPPDFiles(PPDCache &rPPDCache); + static OUString getPPDFile( const OUString& rFile ); +public: + ~PPDParser(); + static const PPDParser* getParser( const OUString& rFile ); + + const PPDKey* getKey( int n ) const; + const PPDKey* getKey( const OUString& rKey ) const; + int getKeys() const { return m_aKeys.size(); } + bool hasKey( const PPDKey* ) const; + + const ::std::vector< PPDConstraint >& getConstraints() const { return m_aConstraints; } + + bool isColorDevice() const { return m_bColorDevice; } + bool isType42Capable() const { return m_bType42Capable; } + sal_uLong getLanguageLevel() const { return m_nLanguageLevel; } + + OUString getDefaultPaperDimension() const; + void getDefaultPaperDimension( int& rWidth, int& rHeight ) const + { getPaperDimension( getDefaultPaperDimension(), rWidth, rHeight ); } + bool getPaperDimension( const OUString& rPaperName, + int& rWidth, int& rHeight ) const; + // width and height in pt + // returns false if paper not found + + // match the best paper for width and height + OUString matchPaper( int nWidth, int nHeight ) const; + + bool getMargins( const OUString& rPaperName, + int &rLeft, int& rRight, + int &rUpper, int& rLower ) const; + // values in pt + // returns true if paper found + + // values int pt + + OUString getDefaultInputSlot() const; + + void getDefaultResolution( int& rXRes, int& rYRes ) const; + // values in dpi + static void getResolutionFromString( const OUString&, int&, int& ); + // helper function + + OUString translateKey( const OUString& i_rKey ) const; + OUString translateOption( const OUString& i_rKey, + const OUString& i_rOption ) const; +}; + + +/* + * PPDContext - a class to manage user definable states based on the + * contents of a PPDParser. + */ + +class PPDContext +{ + typedef std::unordered_map< const PPDKey*, const PPDValue*, PPDKeyhash > hash_type; + hash_type m_aCurrentValues; + const PPDParser* m_pParser; + + // returns false: check failed, new value is constrained + // true: check succeeded, new value can be set + bool checkConstraints( const PPDKey*, const PPDValue*, bool bDoReset ); + bool resetValue( const PPDKey*, bool bDefaultable = false ); +public: + PPDContext(); + PPDContext( const PPDContext& rContext ) { operator=( rContext ); } + PPDContext& operator=( const PPDContext& rContext ) = default; + PPDContext& operator=( PPDContext&& rContext ); + + void setParser( const PPDParser* ); + const PPDParser* getParser() const { return m_pParser; } + + const PPDValue* getValue( const PPDKey* ) const; + const PPDValue* setValue( const PPDKey*, const PPDValue*, bool bDontCareForConstraints = false ); + + std::size_t countValuesModified() const { return m_aCurrentValues.size(); } + const PPDKey* getModifiedKey( std::size_t n ) const; + + // public wrapper for the private method + bool checkConstraints( const PPDKey*, const PPDValue* ); + + // for printer setup + char* getStreamableBuffer( sal_uLong& rBytes ) const; + void rebuildFromStreamBuffer(const std::vector<char> &rBuffer); + + // convenience + int getRenderResolution() const; + + // width, height in points, paper will contain the name of the selected + // paper after the call + void getPageSize( OUString& rPaper, int& rWidth, int& rHeight ) const; +}; + +} // namespace + +#endif // INCLUDED_VCL_PPDPARSER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/print.h b/vcl/inc/print.h new file mode 100644 index 000000000..13650ceef --- /dev/null +++ b/vcl/inc/print.h @@ -0,0 +1,73 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_PRINT_H +#define INCLUDED_VCL_INC_PRINT_H + +#include <rtl/ustring.hxx> +#include <vcl/dllapi.h> +#include <vcl/print.hxx> +#include "salprn.hxx" + +#include <vector> +#include <unordered_map> + +class JobSetup; + +namespace vcl +{ class PrinterListener; } + +struct ImplPrnQueueData +{ + std::unique_ptr<QueueInfo> mpQueueInfo; + std::unique_ptr<SalPrinterQueueInfo> mpSalQueueInfo; + +// unlike other similar places, we need to ifdef this to keep old GCC baseline happy +#ifdef _MSC_VER + ImplPrnQueueData() {} + ImplPrnQueueData(ImplPrnQueueData&&) = default; + + ImplPrnQueueData& operator=( ImplPrnQueueData const & ) = delete; // MSVC2017 workaround + ImplPrnQueueData( ImplPrnQueueData const & ) = delete; // MSVC2017 workaround +#endif +}; + +class VCL_PLUGIN_PUBLIC ImplPrnQueueList +{ +public: + std::unordered_map< OUString, sal_Int32 > m_aNameToIndex; + std::vector< ImplPrnQueueData > m_aQueueInfos; + std::vector< OUString > m_aPrinterList; + + ImplPrnQueueList() {} + ~ImplPrnQueueList(); + + ImplPrnQueueList& operator=( ImplPrnQueueList const & ) = delete; // MSVC2017 workaround + ImplPrnQueueList( ImplPrnQueueList const & ) = delete; // MSVC2017 workaround + +void Add( std::unique_ptr<SalPrinterQueueInfo> pData ); + ImplPrnQueueData* Get( const OUString& rPrinter ); +}; + +void ImplDeletePrnQueueList(); +void ImplUpdateJobSetupPaper( JobSetup& rJobSetup ); + +#endif // INCLUDED_VCL_INC_PRINT_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/print.hrc b/vcl/inc/print.hrc new file mode 100644 index 000000000..91c11309a --- /dev/null +++ b/vcl/inc/print.hrc @@ -0,0 +1,115 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_PRINT_HRC +#define INCLUDED_VCL_INC_PRINT_HRC + +#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) + +const char* RID_STR_PAPERNAMES[] = +{ + // To translators: This is the first entry of a sequence of paper size names + NC_("RID_STR_PAPERNAMES", "A0"), + NC_("RID_STR_PAPERNAMES", "A1"), + NC_("RID_STR_PAPERNAMES", "A2"), + NC_("RID_STR_PAPERNAMES", "A3"), + NC_("RID_STR_PAPERNAMES", "A4"), + NC_("RID_STR_PAPERNAMES", "A5"), + NC_("RID_STR_PAPERNAMES", "B4 (ISO)"), + NC_("RID_STR_PAPERNAMES", "B5 (ISO)"), + NC_("RID_STR_PAPERNAMES", "Letter"), + NC_("RID_STR_PAPERNAMES", "Legal"), + NC_("RID_STR_PAPERNAMES", "Tabloid"), + NC_("RID_STR_PAPERNAMES", "User Defined"), + NC_("RID_STR_PAPERNAMES", "B6 (ISO)"), + NC_("RID_STR_PAPERNAMES", "C4 Envelope"), + NC_("RID_STR_PAPERNAMES", "C5 Envelope"), + NC_("RID_STR_PAPERNAMES", "C6 Envelope"), + NC_("RID_STR_PAPERNAMES", "C6/5 Envelope"), + NC_("RID_STR_PAPERNAMES", "DL Envelope"), + NC_("RID_STR_PAPERNAMES", "Dia Slide"), + NC_("RID_STR_PAPERNAMES", "Screen 4:3"), + NC_("RID_STR_PAPERNAMES", "C"), + NC_("RID_STR_PAPERNAMES", "D"), + NC_("RID_STR_PAPERNAMES", "E"), + NC_("RID_STR_PAPERNAMES", "Executive"), + NC_("RID_STR_PAPERNAMES", "German Legal Fanfold"), + NC_("RID_STR_PAPERNAMES", "#8 (Monarch) Envelope"), + NC_("RID_STR_PAPERNAMES", "#6 3/4 (Personal) Envelope"), + NC_("RID_STR_PAPERNAMES", "#9 Envelope"), + NC_("RID_STR_PAPERNAMES", "#10 Envelope"), + NC_("RID_STR_PAPERNAMES", "#11 Envelope"), + NC_("RID_STR_PAPERNAMES", "#12 Envelope"), + NC_("RID_STR_PAPERNAMES", "16 Kai (16k)"), + NC_("RID_STR_PAPERNAMES", "32 Kai"), + NC_("RID_STR_PAPERNAMES", "Big 32 Kai"), + NC_("RID_STR_PAPERNAMES", "B4 (JIS)"), + NC_("RID_STR_PAPERNAMES", "B5 (JIS)"), + NC_("RID_STR_PAPERNAMES", "B6 (JIS)"), + NC_("RID_STR_PAPERNAMES", "Ledger"), + NC_("RID_STR_PAPERNAMES", "Statement"), + NC_("RID_STR_PAPERNAMES", "Quarto"), + NC_("RID_STR_PAPERNAMES", "10x14"), + NC_("RID_STR_PAPERNAMES", "#14 Envelope"), + NC_("RID_STR_PAPERNAMES", "C3 Envelope"), + NC_("RID_STR_PAPERNAMES", "Italian Envelope"), + NC_("RID_STR_PAPERNAMES", "U.S. Standard Fanfold"), + NC_("RID_STR_PAPERNAMES", "German Standard Fanfold"), + NC_("RID_STR_PAPERNAMES", "Japanese Postcard"), + NC_("RID_STR_PAPERNAMES", "9x11"), + NC_("RID_STR_PAPERNAMES", "10x11"), + NC_("RID_STR_PAPERNAMES", "15x11"), + NC_("RID_STR_PAPERNAMES", "Invitation Envelope"), + NC_("RID_STR_PAPERNAMES", "SuperA"), + NC_("RID_STR_PAPERNAMES", "SuperB"), + NC_("RID_STR_PAPERNAMES", "Letter Plus"), + NC_("RID_STR_PAPERNAMES", "A4 Plus"), + NC_("RID_STR_PAPERNAMES", "Double Postcard"), + NC_("RID_STR_PAPERNAMES", "A6"), + NC_("RID_STR_PAPERNAMES", "12x11"), + NC_("RID_STR_PAPERNAMES", "A7"), + NC_("RID_STR_PAPERNAMES", "A8"), + NC_("RID_STR_PAPERNAMES", "A9"), + NC_("RID_STR_PAPERNAMES", "A10"), + NC_("RID_STR_PAPERNAMES", "B0 (ISO)"), + NC_("RID_STR_PAPERNAMES", "B1 (ISO)"), + NC_("RID_STR_PAPERNAMES", "B2 (ISO)"), + NC_("RID_STR_PAPERNAMES", "B3 (ISO)"), + NC_("RID_STR_PAPERNAMES", "B7 (ISO)"), + NC_("RID_STR_PAPERNAMES", "B8 (ISO)"), + NC_("RID_STR_PAPERNAMES", "B9 (ISO)"), + NC_("RID_STR_PAPERNAMES", "B10 (ISO)"), + NC_("RID_STR_PAPERNAMES", "C2 Envelope"), + NC_("RID_STR_PAPERNAMES", "C7 Envelope"), + NC_("RID_STR_PAPERNAMES", "C8 Envelope"), + NC_("RID_STR_PAPERNAMES", "Arch A"), + NC_("RID_STR_PAPERNAMES", "Arch B"), + NC_("RID_STR_PAPERNAMES", "Arch C"), + NC_("RID_STR_PAPERNAMES", "Arch D"), + NC_("RID_STR_PAPERNAMES", "Arch E"), + NC_("RID_STR_PAPERNAMES", "Screen 16:9"), + NC_("RID_STR_PAPERNAMES", "Screen 16:10"), + NC_("RID_STR_PAPERNAMES", "16k (195 x 270)"), + // To translators: This is the last entry of the sequence of paper size names + NC_("RID_STR_PAPERNAMES", "16k (197 x 273)") +}; + +#endif // INCLUDED_VCL_INC_PRINT_HRC + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/printaccessoryview.hrc b/vcl/inc/printaccessoryview.hrc new file mode 100644 index 000000000..936c5b2bc --- /dev/null +++ b/vcl/inc/printaccessoryview.hrc @@ -0,0 +1,36 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_PRINTACCESSORYVIEW_HRC +#define INCLUDED_VCL_INC_PRINTACCESSORYVIEW_HRC + +#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) + +const char* SV_PRINT_NATIVE_STRINGS[] = +{ + NC_("SV_PRINT_NATIVE_STRINGS", "Preview"), + NC_("SV_PRINT_NATIVE_STRINGS", "Page number"), + NC_("SV_PRINT_NATIVE_STRINGS", "Number of pages"), + NC_("SV_PRINT_NATIVE_STRINGS", "More"), + NC_("SV_PRINT_NATIVE_STRINGS", "Print selection only") +}; + +#endif // INCLUDED_VCL_INC_PRINTACCESSORYVIEW_HRC + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx new file mode 100644 index 000000000..c313e8fc4 --- /dev/null +++ b/vcl/inc/printdlg.hxx @@ -0,0 +1,292 @@ +/* -*- 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 . + */ + +#ifndef VCL_INC_NEWPRINTDLG_HXX +#define VCL_INC_NEWPRINTDLG_HXX + +#include <vcl/bitmapex.hxx> +#include <vcl/gdimtf.hxx> +#include <vcl/print.hxx> +#include <vcl/customweld.hxx> +#include <vcl/weld.hxx> +#include <map> + +namespace vcl { + class PrintDialog; +} + +namespace vcl +{ + class MoreOptionsDialog final : public weld::GenericDialogController + { + PrintDialog* mpParent; + std::unique_ptr<weld::Button> mxOKButton; + std::unique_ptr<weld::Button> mxCancelButton; + std::unique_ptr<weld::CheckButton> mxSingleJobsBox; + + DECL_LINK( ClickHdl, weld::Button&, void ); + + public: + + MoreOptionsDialog(PrintDialog* i_pParent); + virtual ~MoreOptionsDialog() override; + }; + + class PrintDialog : public weld::GenericDialogController + { + friend class MoreOptionsDialog; + public: + + class PrintPreviewWindow final : public weld::CustomWidgetController + { + PrintDialog* mpDialog; + GDIMetaFile maMtf; + Size maOrigSize; + Size maPreviewSize; + sal_Int32 mnDPIX; + sal_Int32 mnDPIY; + BitmapEx maPreviewBitmap; + OUString maReplacementString; + bool mbGreyscale; + + OUString maHorzText; + OUString maVertText; + + void preparePreviewBitmap(); + + public: + PrintPreviewWindow(PrintDialog* pDialog); + virtual ~PrintPreviewWindow() override; + + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; + virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; + virtual bool Command( const CommandEvent& ) override; + virtual void Resize() override; + + void setPreview( const GDIMetaFile&, const Size& i_rPaperSize, + const OUString& i_rPaperName, + const OUString& i_rNoPageString, + sal_Int32 i_nDPIX, sal_Int32 i_nDPIY, + bool i_bGreyscale + ); + }; + + class ShowNupOrderWindow final : public weld::CustomWidgetController + { + NupOrderType mnOrderMode; + int mnRows; + int mnColumns; + public: + ShowNupOrderWindow(); + + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; + + virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) override; + + void setValues( NupOrderType i_nOrderMode, int i_nColumns, int i_nRows ) + { + mnOrderMode = i_nOrderMode; + mnRows = i_nRows; + mnColumns = i_nColumns; + Invalidate(); + } + }; + + PrintDialog(weld::Window*, const std::shared_ptr<PrinterController>&); + virtual ~PrintDialog() override; + + bool isPrintToFile() const; + bool isCollate() const; + bool isSingleJobs() const { return mbSingleJobs; }; + bool hasPreview() const; + + void setPaperSizes(); + void previewForward(); + void previewBackward(); + void previewFirst(); + void previewLast(); + + private: + + std::unique_ptr<weld::Builder> mxCustomOptionsUIBuilder; + + std::shared_ptr<PrinterController> maPController; + + std::unique_ptr<MoreOptionsDialog> mxMoreOptionsDlg; + + std::unique_ptr<weld::Notebook> mxTabCtrl; + std::unique_ptr<weld::ScrolledWindow> mxScrolledWindow; + std::unique_ptr<weld::Frame> mxPageLayoutFrame; + std::unique_ptr<weld::ComboBox> mxPrinters; + std::unique_ptr<weld::Label> mxStatusTxt; + std::unique_ptr<weld::Button> mxSetupButton; + + std::unique_ptr<weld::SpinButton> mxCopyCountField; + std::unique_ptr<weld::CheckButton> mxCollateBox; + std::unique_ptr<weld::Image> mxCollateImage; + std::unique_ptr<weld::Entry> mxPageRangeEdit; + std::unique_ptr<weld::RadioButton> mxPageRangesRadioButton; + std::unique_ptr<weld::ComboBox> mxPaperSidesBox; + std::unique_ptr<weld::CheckButton> mxReverseOrderBox; + + std::unique_ptr<weld::Button> mxOKButton; + std::unique_ptr<weld::Button> mxCancelButton; + std::unique_ptr<weld::Button> mxHelpButton; + std::unique_ptr<weld::Button> mxMoreOptionsBtn; + + std::unique_ptr<weld::Button> mxBackwardBtn; + std::unique_ptr<weld::Button> mxForwardBtn; + std::unique_ptr<weld::Button> mxFirstBtn; + std::unique_ptr<weld::Button> mxLastBtn; + + std::unique_ptr<weld::CheckButton> mxPreviewBox; + std::unique_ptr<weld::Label> mxNumPagesText; + std::unique_ptr<PrintPreviewWindow> mxPreview; + std::unique_ptr<weld::CustomWeld> mxPreviewWindow; + std::unique_ptr<weld::Entry> mxPageEdit; + + std::unique_ptr<weld::RadioButton> mxPagesBtn; + std::unique_ptr<weld::RadioButton> mxBrochureBtn; + std::unique_ptr<weld::Label> mxPagesBoxTitleTxt; + std::unique_ptr<weld::ComboBox> mxNupPagesBox; + + // controls for "Custom" page mode + std::unique_ptr<weld::Label> mxNupNumPagesTxt; + std::unique_ptr<weld::SpinButton> mxNupColEdt; + std::unique_ptr<weld::Label> mxNupTimesTxt; + std::unique_ptr<weld::SpinButton> mxNupRowsEdt; + std::unique_ptr<weld::Label> mxPageMarginTxt1; + std::unique_ptr<weld::MetricSpinButton> mxPageMarginEdt; + std::unique_ptr<weld::Label> mxPageMarginTxt2; + std::unique_ptr<weld::Label> mxSheetMarginTxt1; + std::unique_ptr<weld::MetricSpinButton> mxSheetMarginEdt; + std::unique_ptr<weld::Label> mxSheetMarginTxt2; + std::unique_ptr<weld::ComboBox> mxPaperSizeBox; + std::unique_ptr<weld::ComboBox> mxOrientationBox; + + // page order ("left to right, then down") + std::unique_ptr<weld::Label> mxNupOrderTxt; + std::unique_ptr<weld::ComboBox> mxNupOrderBox; + std::unique_ptr<ShowNupOrderWindow> mxNupOrder; + std::unique_ptr<weld::CustomWeld> mxNupOrderWin; + /// border around each page + std::unique_ptr<weld::CheckButton> mxBorderCB; + std::unique_ptr<weld::Expander> mxRangeExpander; + std::unique_ptr<weld::Expander> mxLayoutExpander; + std::unique_ptr<weld::Widget> mxCustom; + + OUString maPrintToFileText; + OUString maPrintText; + OUString maDefPrtText; + + OUString maPageStr; + OUString maNoPageStr; + OUString maNoPreviewStr; + sal_Int32 mnCurPage; + sal_Int32 mnCachedPages; + + bool mbCollateAlwaysOff; + + std::vector<std::unique_ptr<weld::Widget>> + maExtraControls; + + std::map<weld::Widget*, OUString> + maControlToPropertyMap; + std::map<OUString, std::vector<weld::Widget*>> + maPropertyToWindowMap; + std::map<weld::Widget*, sal_Int32> + maControlToNumValMap; + + Size maNupPortraitSize; + Size maNupLandscapeSize; + /// internal, used for automatic Nup-Portrait/landscape + Size maFirstPageSize; + + bool mbShowLayoutFrame; + bool mbSingleJobs; + + Paper mePaper; + + DECL_LINK( ClickHdl, weld::Button&, void ); + DECL_LINK( SelectHdl, weld::ComboBox&, void ); + DECL_LINK( ActivateHdl, weld::Entry&, bool ); + DECL_LINK( FocusOutHdl, weld::Widget&, void ); + DECL_LINK( SpinModifyHdl, weld::SpinButton&, void ); + DECL_LINK( MetricSpinModifyHdl, weld::MetricSpinButton&, void ); + DECL_LINK( ToggleHdl, weld::ToggleButton&, void ); + + DECL_LINK( UIOption_CheckHdl, weld::ToggleButton&, void ); + DECL_LINK( UIOption_RadioHdl, weld::ToggleButton&, void ); + DECL_LINK( UIOption_SelectHdl, weld::ComboBox&, void ); + DECL_LINK( UIOption_SpinModifyHdl, weld::SpinButton&, void ); + DECL_LINK( UIOption_EntryModifyHdl, weld::Entry&, void ); + + DECL_LINK( ExpandHdl, weld::Expander&, void ); + + css::beans::PropertyValue* getValueForWindow(weld::Widget*) const; + + void preparePreview( bool i_bMayUseCache ); + void setupPaperSidesBox(); + void storeToSettings(); + void readFromSettings(); + void setPaperOrientation( Orientation eOrientation ); + void updateOrientationBox( bool bAutomatic = true ); + bool hasOrientationChanged() const; + void checkPaperSize( Size& rPaperSize ); + void setPreviewText(); + void updatePrinterText(); + void checkControlDependencies(); + void checkOptionalControlDependencies(); + void makeEnabled( weld::Widget* ); + void updateWindowFromProperty( const OUString& ); + void initFromMultiPageSetup( const vcl::PrinterController::MultiPageSetup& ); + void showAdvancedControls( bool ); + void updateNup( bool i_bMayUseCache = true ); + void updateNupFromPages( bool i_bMayUseCache = true ); + void enableNupControls( bool bEnable ); + void setupOptionalUI(); + Size const & getJobPageSize(); + + }; + + class PrintProgressDialog final : public weld::GenericDialogController + { + OUString maStr; + bool mbCanceled; + sal_Int32 mnCur; + sal_Int32 mnMax; + + std::unique_ptr<weld::Label> mxText; + std::unique_ptr<weld::ProgressBar> mxProgress; + std::unique_ptr<weld::Button> mxButton; + + DECL_LINK( ClickHdl, weld::Button&, void ); + + public: + PrintProgressDialog(weld::Window* i_pParent, int i_nMax); + virtual ~PrintProgressDialog() override; + bool isCanceled() const { return mbCanceled; } + void setProgress( int i_nCurrent ); + void tick(); + }; +} + +#endif // VCL_INC_NEWPRINTDLG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/printerinfomanager.hxx b/vcl/inc/printerinfomanager.hxx new file mode 100644 index 000000000..2286158d6 --- /dev/null +++ b/vcl/inc/printerinfomanager.hxx @@ -0,0 +1,175 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_PRINTERINFOMANAGER_HXX +#define INCLUDED_VCL_PRINTERINFOMANAGER_HXX + +#include <memory> +#include <vector> +#include <unordered_map> +#include <unordered_set> + +#include <vcl/dllapi.h> +#include <vcl/prntypes.hxx> +#include <osl/time.h> + +#include <cstdio> + +#include "jobdata.hxx" + +namespace psp +{ + +class SystemQueueInfo; + +struct PrinterInfo : JobData +{ + // basename of PPD + OUString m_aDriverName; + // can be the queue + OUString m_aLocation; + // a user defined comment + OUString m_aComment; + // a command line to pipe a PS-file to + OUString m_aCommand; + // a command line to pipe a PS-file to in case of direct print + OUString m_aQuickCommand; + // a list of special features separated by ',' not used by psprint + // but assigned from the outside (currently for "fax","pdf=","autoqueue","external_dialog") + OUString m_aFeatures; + // auth-info-required, potential [domain],[username],[password] to prompt for to authenticate printing + OUString m_aAuthInfoRequired; + PrinterSetupMode meSetupMode; + + PrinterInfo() + : JobData() + , meSetupMode(PrinterSetupMode::SingleJob) + {} +}; + +class VCL_DLLPUBLIC PrinterInfoManager +{ +public: + enum class Type { Default = 0, CUPS = 1, CPD = 2 }; + + struct SystemPrintQueue + { + OUString m_aQueue; + OUString m_aLocation; + OUString m_aComment; + }; +protected: + // needed for checkPrintersChanged: files (not necessarily existent) + // and their last known modification time + struct WatchFile + { + // the file in question + OUString m_aFilePath; + // the last know modification time or 0, if file did not exist + TimeValue m_aModified; + }; + + // internal data to describe a printer + struct Printer + { + // configuration file containing this printer + // empty means a freshly added printer that has to be saved yet + OUString m_aFile; + // details other config files that have this printer + // in case of removal all have to be removed + std::unordered_set< OUString > m_aAlternateFiles; + // the corresponding info and job data + PrinterInfo m_aInfo; + }; + + std::unordered_map< OUString, Printer > m_aPrinters; + PrinterInfo m_aGlobalDefaults; + std::vector< WatchFile > m_aWatchFiles; + OUString m_aDefaultPrinter; + OUString m_aSystemPrintCommand; + + std::vector< SystemPrintQueue > m_aSystemPrintQueues; + + std::unique_ptr<SystemQueueInfo> + m_pQueueInfo; + + Type m_eType; + bool m_bUseIncludeFeature; + bool m_bUseJobPatch; + OUString m_aSystemDefaultPaper; + + PrinterInfoManager( Type eType = Type::Default ); + + virtual void initialize(); + + // fill default paper if not configured in config file + // default paper is e.g. locale dependent + // if a paper is already set it will not be overwritten + void setDefaultPaper( PPDContext& rInfo ) const; + +public: + + // there can only be one + static PrinterInfoManager& get(); + // only called by SalData destructor, frees the global instance + static void release(); + + // get PrinterInfoManager type + Type getType() const { return m_eType; } + + // lists the names of all known printers + void listPrinters( std::vector< OUString >& rVector ) const; + + // gets info about a named printer + const PrinterInfo& getPrinterInfo( const OUString& rPrinter ) const; + + // gets the name of the default printer + const OUString& getDefaultPrinter() const { return m_aDefaultPrinter; } + + virtual void setupJobContextData( JobData& rData ); + + // check if the printer configuration has changed + // if bwait is true, then this method waits for eventual asynchronous + // printer discovery to finish + virtual bool checkPrintersChanged( bool bWait ); + + // abstract print command + // returns a stdio FILE* that a postscript file may be written to + // this may either be a regular file or the result of popen() + virtual FILE* startSpool( const OUString& rPrinterName, bool bQuickCommand ); + // close the FILE* returned by startSpool and does the actual spooling + // set bBanner to "false" will attempt to suppress banner printing + // set bBanner to "true" will rely on the system default + // returns true on success + virtual bool endSpool( const OUString& rPrinterName, const OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner, const OUString &rFaxNumber ); + + bool getUseIncludeFeature() const { return m_bUseIncludeFeature; } + bool getUseJobPatch() const { return m_bUseJobPatch; } + + // check whether a printer's feature string contains a subfeature + bool checkFeatureToken( const OUString& rPrinterName, const char* pToken ) const; + + virtual ~PrinterInfoManager(); +}; + +} // namespace + +#endif // INCLUDED_VCL_PRINTERINFOMANAGER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5AccessibleEventListener.hxx b/vcl/inc/qt5/Qt5AccessibleEventListener.hxx new file mode 100644 index 000000000..0fd3783ee --- /dev/null +++ b/vcl/inc/qt5/Qt5AccessibleEventListener.hxx @@ -0,0 +1,38 @@ +/* -*- 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/. + */ + +#pragma once + +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> +#include <com/sun/star/lang/EventObject.hpp> + +#include "Qt5AccessibleWidget.hxx" + +#include <cppuhelper/implbase.hxx> + +class Qt5AccessibleEventListener final + : public cppu::WeakImplHelper<css::accessibility::XAccessibleEventListener> +{ +public: + Qt5AccessibleEventListener( + const css::uno::Reference<css::accessibility::XAccessible> xAccessible, + Qt5AccessibleWidget* pAccessibleWidget); + + virtual void SAL_CALL + notifyEvent(const css::accessibility::AccessibleEventObject& aEvent) override; + + virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override; + +private: + css::uno::Reference<css::accessibility::XAccessible> m_xAccessible; + Qt5AccessibleWidget* m_pAccessibleWidget; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5AccessibleWidget.hxx b/vcl/inc/qt5/Qt5AccessibleWidget.hxx new file mode 100644 index 000000000..aacaba9a8 --- /dev/null +++ b/vcl/inc/qt5/Qt5AccessibleWidget.hxx @@ -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/. + */ + +#pragma once + +#include <vclpluginapi.h> + +#include <QtCore/QObject> +#include <QtCore/QPair> +#include <QtCore/QString> +#include <QtCore/QStringList> +#include <QtCore/QVector> +#include <QtGui/QAccessible> +#include <QtGui/QAccessibleActionInterface> +#include <QtGui/QAccessibleInterface> +#include <QtGui/QAccessibleTableInterface> +#include <QtGui/QAccessibleTextInterface> +#include <QtGui/QAccessibleValueInterface> +#include <QtGui/QColor> +#include <QtGui/QWindow> + +#include <com/sun/star/accessibility/XAccessible.hpp> + +class Qt5Frame; +class Qt5Widget; + +class Qt5AccessibleWidget final : public QObject, + public QAccessibleInterface, + public QAccessibleActionInterface, + public QAccessibleTextInterface, + public QAccessibleEditableTextInterface, + public QAccessibleTableInterface, + public QAccessibleValueInterface +{ + Q_OBJECT + +public: + Qt5AccessibleWidget(const css::uno::Reference<css::accessibility::XAccessible> xAccessible, + QObject* pObject); + QWindow* window() const override; + int childCount() const override; + int indexOfChild(const QAccessibleInterface* child) const override; + QVector<QPair<QAccessibleInterface*, QAccessible::Relation>> + relations(QAccessible::Relation match = QAccessible::AllRelations) const override; + QAccessibleInterface* focusChild() const override; + + QRect rect() const override; + + QAccessibleInterface* parent() const override; + QAccessibleInterface* child(int index) const override; + + QString text(QAccessible::Text t) const override; + QAccessible::Role role() const override; + QAccessible::State state() const override; + + QColor foregroundColor() const override; + QColor backgroundColor() const override; + + bool isValid() const override; + QObject* object() const override; + void setText(QAccessible::Text t, const QString& text) override; + QAccessibleInterface* childAt(int x, int y) const override; + + void* interface_cast(QAccessible::InterfaceType t) override; + + // QAccessibleActionInterface + QStringList actionNames() const override; + void doAction(const QString& actionName) override; + QStringList keyBindingsForAction(const QString& actionName) const override; + + static QAccessibleValueInterface* valueInterface(); + static QAccessibleTextInterface* textInterface(); + + // QAccessibleTextInterface + void addSelection(int startOffset, int endOffset) override; + QString attributes(int offset, int* startOffset, int* endOffset) const override; + int characterCount() const override; + QRect characterRect(int offset) const override; + int cursorPosition() const override; + int offsetAtPoint(const QPoint& point) const override; + void removeSelection(int selectionIndex) override; + void scrollToSubstring(int startIndex, int endIndex) override; + void selection(int selectionIndex, int* startOffset, int* endOffset) const override; + int selectionCount() const override; + void setCursorPosition(int position) override; + void setSelection(int selectionIndex, int startOffset, int endOffset) override; + QString text(int startOffset, int endOffset) const override; + QString textAfterOffset(int offset, QAccessible::TextBoundaryType boundaryType, + int* startOffset, int* endOffset) const override; + QString textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType, int* startOffset, + int* endOffset) const override; + QString textBeforeOffset(int offset, QAccessible::TextBoundaryType boundaryType, + int* startOffset, int* endOffset) const override; + + // QAccessibleEditableTextInterface + virtual void deleteText(int startOffset, int endOffset) override; + virtual void insertText(int offset, const QString& text) override; + virtual void replaceText(int startOffset, int endOffset, const QString& text) override; + + // QAccessibleValueInterface + QVariant currentValue() const override; + QVariant maximumValue() const override; + QVariant minimumStepSize() const override; + QVariant minimumValue() const override; + void setCurrentValue(const QVariant& value) override; + + // QAccessibleTableInterface + virtual QAccessibleInterface* caption() const override; + virtual QAccessibleInterface* cellAt(int row, int column) const override; + virtual int columnCount() const override; + virtual QString columnDescription(int column) const override; + virtual bool isColumnSelected(int column) const override; + virtual bool isRowSelected(int row) const override; + virtual void modelChange(QAccessibleTableModelChangeEvent* event) override; + virtual int rowCount() const override; + virtual QString rowDescription(int row) const override; + virtual bool selectColumn(int column) override; + virtual bool selectRow(int row) override; + virtual int selectedCellCount() const override; + virtual QList<QAccessibleInterface*> selectedCells() const override; + virtual int selectedColumnCount() const override; + virtual QList<int> selectedColumns() const override; + virtual int selectedRowCount() const override; + virtual QList<int> selectedRows() const override; + virtual QAccessibleInterface* summary() const override; + virtual bool unselectColumn(int column) override; + virtual bool unselectRow(int row) override; + + // Factory + static QAccessibleInterface* customFactory(const QString& classname, QObject* object); + +private: + css::uno::Reference<css::accessibility::XAccessible> m_xAccessible; + css::uno::Reference<css::accessibility::XAccessibleContext> getAccessibleContextImpl() const; + QObject* m_pObject; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5Bitmap.hxx b/vcl/inc/qt5/Qt5Bitmap.hxx new file mode 100644 index 000000000..8ff4297e4 --- /dev/null +++ b/vcl/inc/qt5/Qt5Bitmap.hxx @@ -0,0 +1,66 @@ +/* -*- 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 Qt5Bitmap final : 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: + Qt5Bitmap(); + Qt5Bitmap(const QImage& rQImage); + + 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_uInt8 nTol) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5Clipboard.hxx b/vcl/inc/qt5/Qt5Clipboard.hxx new file mode 100644 index 000000000..b99534f59 --- /dev/null +++ b/vcl/inc/qt5/Qt5Clipboard.hxx @@ -0,0 +1,97 @@ +/* -*- 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/. + * + */ + +#pragma once + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/datatransfer/XTransferable.hpp> +#include <com/sun/star/datatransfer/clipboard/XSystemClipboard.hpp> +#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp> +#include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp> +#include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp> +#include <cppuhelper/compbase.hxx> + +#include <QtGui/QClipboard> + +/** + * This implementation has two main functions, which handle the clipboard content: + * the XClipboard::setContent function and the QClipboard::change signal handler. + * + * The first just sets the respective clipboard to the expected content from LO, + * the latter will handle any reported changes. + **/ +class Qt5Clipboard final + : public QObject, + public cppu::WeakComponentImplHelper<css::datatransfer::clipboard::XSystemClipboard, + css::datatransfer::clipboard::XFlushableClipboard, + css::lang::XServiceInfo> +{ + Q_OBJECT + + osl::Mutex m_aMutex; + const OUString m_aClipboardName; + const QClipboard::Mode m_aClipboardMode; + // has to be set, if LO changes the QClipboard itself, so it won't instantly lose + // ownership by it's self-triggered QClipboard::changed handler + bool m_bOwnClipboardChange; + // true, if LO really wants to give up clipboard ownership + bool m_bDoClear; + + // if not empty, this holds the setContents provided XTransferable or a Qt5ClipboardTransferable + css::uno::Reference<css::datatransfer::XTransferable> m_aContents; + // the owner of the current contents, which must be informed on content change + css::uno::Reference<css::datatransfer::clipboard::XClipboardOwner> m_aOwner; + std::vector<css::uno::Reference<css::datatransfer::clipboard::XClipboardListener>> m_aListeners; + + static bool isOwner(const QClipboard::Mode aMode); + static bool isSupported(const QClipboard::Mode aMode); + + explicit Qt5Clipboard(const OUString& aModeString, const QClipboard::Mode aMode); + +private Q_SLOTS: + void handleChanged(QClipboard::Mode mode); + void handleClearClipboard(); + +signals: + void clearClipboard(); + +public: + // factory function to construct only valid Qt5Clipboard objects by name + static css::uno::Reference<css::uno::XInterface> create(const OUString& aModeString); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + // XClipboard + virtual css::uno::Reference<css::datatransfer::XTransferable> SAL_CALL getContents() override; + virtual void SAL_CALL setContents( + const css::uno::Reference<css::datatransfer::XTransferable>& xTrans, + const css::uno::Reference<css::datatransfer::clipboard::XClipboardOwner>& xClipboardOwner) + override; + virtual OUString SAL_CALL getName() override; + + // XClipboardEx + virtual sal_Int8 SAL_CALL getRenderingCapabilities() override; + + // XFlushableClipboard + virtual void SAL_CALL flushClipboard() override; + + // XClipboardNotifier + virtual void SAL_CALL addClipboardListener( + const css::uno::Reference<css::datatransfer::clipboard::XClipboardListener>& listener) + override; + virtual void SAL_CALL removeClipboardListener( + const css::uno::Reference<css::datatransfer::clipboard::XClipboardListener>& listener) + override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5Data.hxx b/vcl/inc/qt5/Qt5Data.hxx new file mode 100644 index 000000000..1834835d3 --- /dev/null +++ b/vcl/inc/qt5/Qt5Data.hxx @@ -0,0 +1,47 @@ +/* -*- 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> + +#include <o3tl/enumarray.hxx> +#include <vcl/ptrstyle.hxx> +#include <memory> +#include <vclpluginapi.h> + +class QCursor; + +class VCLPLUG_QT5_PUBLIC Qt5Data final : public GenericUnixSalData +{ + o3tl::enumarray<PointerStyle, std::unique_ptr<QCursor>> m_aCursors; + +public: + explicit Qt5Data(SalInstance* pInstance); + virtual ~Qt5Data() override; + + virtual void ErrorTrapPush() override; + virtual bool ErrorTrapPop(bool bIgnoreError = true) override; + + QCursor& getCursor(PointerStyle ePointerStyle); + + static bool noNativeControls(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5DragAndDrop.hxx b/vcl/inc/qt5/Qt5DragAndDrop.hxx new file mode 100644 index 000000000..c88465ab3 --- /dev/null +++ b/vcl/inc/qt5/Qt5DragAndDrop.hxx @@ -0,0 +1,115 @@ +/* -*- 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/. + * + */ + +#pragma once + +#include <com/sun/star/datatransfer/dnd/XDragSource.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/compbase.hxx> + +class Qt5Frame; + +class Qt5DragSource final + : public cppu::WeakComponentImplHelper<css::datatransfer::dnd::XDragSource, + css::lang::XInitialization, css::lang::XServiceInfo> +{ + osl::Mutex m_aMutex; + Qt5Frame* m_pFrame; + css::uno::Reference<css::datatransfer::dnd::XDragSourceListener> m_xListener; + +public: + Qt5DragSource() + : WeakComponentImplHelper(m_aMutex) + , m_pFrame(nullptr) + { + } + + virtual ~Qt5DragSource() override; + + // XDragSource + virtual sal_Bool SAL_CALL isDragImageSupported() override; + virtual sal_Int32 SAL_CALL getDefaultCursor(sal_Int8 dragAction) override; + virtual void SAL_CALL startDrag( + const css::datatransfer::dnd::DragGestureEvent& trigger, sal_Int8 sourceActions, + sal_Int32 cursor, sal_Int32 image, + const css::uno::Reference<css::datatransfer::XTransferable>& transferable, + const css::uno::Reference<css::datatransfer::dnd::XDragSourceListener>& listener) override; + + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override; + void deinitialize(); + + OUString SAL_CALL getImplementationName() override; + + sal_Bool SAL_CALL supportsService(OUString const& ServiceName) override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + void fire_dragEnd(sal_Int8 nAction, bool bSuccessful); +}; + +class Qt5DropTarget final + : public cppu::WeakComponentImplHelper<css::datatransfer::dnd::XDropTarget, + css::datatransfer::dnd::XDropTargetDragContext, + css::datatransfer::dnd::XDropTargetDropContext, + css::lang::XInitialization, css::lang::XServiceInfo> +{ + osl::Mutex m_aMutex; + Qt5Frame* m_pFrame; + sal_Int8 m_nDropAction; + bool m_bActive; + sal_Int8 m_nDefaultActions; + std::vector<css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>> m_aListeners; + bool m_bDropSuccessful; + +public: + Qt5DropTarget(); + virtual ~Qt5DropTarget() override; + + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArgs) override; + void deinitialize(); + + // XDropTarget + virtual void SAL_CALL addDropTargetListener( + const css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>&) override; + virtual void SAL_CALL removeDropTargetListener( + const css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>&) override; + virtual sal_Bool SAL_CALL isActive() override; + virtual void SAL_CALL setActive(sal_Bool active) override; + virtual sal_Int8 SAL_CALL getDefaultActions() override; + virtual void SAL_CALL setDefaultActions(sal_Int8 actions) override; + + // XDropTargetDragContext + virtual void SAL_CALL acceptDrag(sal_Int8 dragOperation) override; + virtual void SAL_CALL rejectDrag() override; + + // XDropTargetDropContext + virtual void SAL_CALL acceptDrop(sal_Int8 dropOperation) override; + virtual void SAL_CALL rejectDrop() override; + virtual void SAL_CALL dropComplete(sal_Bool success) override; + + // XServiceInfo + OUString SAL_CALL getImplementationName() override; + sal_Bool SAL_CALL supportsService(OUString const& ServiceName) override; + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + void fire_dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent& dtde); + void fire_dragExit(const css::datatransfer::dnd::DropTargetEvent& dte); + void fire_dragOver(const css::datatransfer::dnd::DropTargetDragEnterEvent& dtde); + void fire_drop(const css::datatransfer::dnd::DropTargetDropEvent& dtde); + + sal_Int8 proposedDropAction() const { return m_nDropAction; } + bool dropSuccessful() const { return m_bDropSuccessful; } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5FilePicker.hxx b/vcl/inc/qt5/Qt5FilePicker.hxx new file mode 100644 index 000000000..5fef2aaea --- /dev/null +++ b/vcl/inc/qt5/Qt5FilePicker.hxx @@ -0,0 +1,175 @@ +/* -*- 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 <vclpluginapi.h> + +#include <cppuhelper/compbase.hxx> + +#include <com/sun/star/frame/XTerminateListener.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/ui/dialogs/XFilePicker3.hpp> +#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> +#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + +#include <osl/conditn.hxx> +#include <osl/mutex.hxx> + +#include <QtCore/QObject> +#include <QtCore/QString> +#include <QtCore/QStringList> +#include <QtCore/QHash> +#include <QtWidgets/QFileDialog> + +#include <memory> + +class QComboBox; +class QGridLayout; +class QLabel; +class QWidget; + +typedef ::cppu::WeakComponentImplHelper<css::frame::XTerminateListener, css::lang::XInitialization, + css::lang::XServiceInfo, css::ui::dialogs::XFilePicker3, + css::ui::dialogs::XFilePickerControlAccess, + css::ui::dialogs::XFolderPicker2> + Qt5FilePicker_Base; + +class VCLPLUG_QT5_PUBLIC Qt5FilePicker : public QObject, public Qt5FilePicker_Base +{ + Q_OBJECT + +private: + css::uno::Reference<css::uno::XComponentContext> m_context; + + css::uno::Reference<css::ui::dialogs::XFilePickerListener> m_xListener; + + osl::Mutex m_aHelperMutex; ///< mutex used by the WeakComponentImplHelper + + QStringList m_aNamedFilterList; ///< to keep the original sequence + QHash<QString, QString> m_aTitleToFilterMap; + // to retrieve the filename extension for a given filter + QHash<QString, QString> m_aNamedFilterToExtensionMap; + QString m_aCurrentFilter; + + QGridLayout* m_pLayout; ///< layout for extra custom controls + QHash<sal_Int16, QWidget*> m_aCustomWidgetsMap; ///< map of SAL control ID's to widget + + const bool m_bIsFolderPicker; + + QWidget* m_pParentWidget; + +protected: + std::unique_ptr<QFileDialog> m_pFileDialog; ///< the file picker dialog + QWidget* m_pExtraControls; ///< widget to contain extra custom controls + +public: + // use non-native file dialog by default; there's no easy way to add custom widgets + // in a generic way in the native one + explicit Qt5FilePicker(css::uno::Reference<css::uno::XComponentContext> const& context, + QFileDialog::FileMode, bool bUseNative = false); + virtual ~Qt5FilePicker() override; + + // XFilePickerNotifier + virtual void SAL_CALL addFilePickerListener( + const css::uno::Reference<css::ui::dialogs::XFilePickerListener>& xListener) override; + virtual void SAL_CALL removeFilePickerListener( + const css::uno::Reference<css::ui::dialogs::XFilePickerListener>& xListener) override; + + // XFilterManager functions + virtual void SAL_CALL appendFilter(const OUString& rTitle, const OUString& rFilter) override; + virtual void SAL_CALL setCurrentFilter(const OUString& rTitle) override; + virtual OUString SAL_CALL getCurrentFilter() override; + + // XFilterGroupManager functions + virtual void SAL_CALL + appendFilterGroup(const OUString& rGroupTitle, + const css::uno::Sequence<css::beans::StringPair>& rFilters) override; + + // XCancellable + virtual void SAL_CALL cancel() override; + + // XExecutableDialog functions + virtual void SAL_CALL setTitle(const OUString& rTitle) override; + virtual sal_Int16 SAL_CALL execute() override; + + // XFilePicker functions + virtual void SAL_CALL setMultiSelectionMode(sal_Bool bMode) override; + virtual void SAL_CALL setDefaultName(const OUString& rName) override; + virtual void SAL_CALL setDisplayDirectory(const OUString& rDirectory) override; + virtual OUString SAL_CALL getDisplayDirectory() override; + virtual css::uno::Sequence<OUString> SAL_CALL getFiles() override; + + // XFilePickerControlAccess functions + virtual void SAL_CALL setValue(sal_Int16 nControlId, sal_Int16 nControlAction, + const css::uno::Any& rValue) override; + virtual css::uno::Any SAL_CALL getValue(sal_Int16 nControlId, + sal_Int16 nControlAction) override; + virtual void SAL_CALL enableControl(sal_Int16 nControlId, sal_Bool bEnable) override; + virtual void SAL_CALL setLabel(sal_Int16 nControlId, const OUString& rLabel) override; + virtual OUString SAL_CALL getLabel(sal_Int16 nControlId) override; + + // XFilePicker2 functions + virtual css::uno::Sequence<OUString> SAL_CALL getSelectedFiles() override; + + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override; + + // XEventListener + void SAL_CALL disposing(const css::lang::EventObject& rEvent) override; + using cppu::WeakComponentImplHelperBase::disposing; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override; + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + // XFolderPicker functions + virtual OUString SAL_CALL getDirectory() override; + virtual void SAL_CALL setDescription(const OUString& rDescription) override; + + // XTerminateListener + void SAL_CALL queryTermination(const css::lang::EventObject& aEvent) override; + void SAL_CALL notifyTermination(const css::lang::EventObject& aEvent) override; + +protected: + virtual void addCustomControl(sal_Int16 controlId); + void setCustomControlWidgetLayout(QGridLayout* pLayout) { m_pLayout = pLayout; } + +private: + Qt5FilePicker(const Qt5FilePicker&) = delete; + Qt5FilePicker& operator=(const Qt5FilePicker&) = delete; + + static QString getResString(const char* pRedId); + static css::uno::Any handleGetListValue(const QComboBox* pWidget, sal_Int16 nControlAction); + static void handleSetListValue(QComboBox* pQComboBox, sal_Int16 nAction, + const css::uno::Any& rValue); + +private Q_SLOTS: + // emit XFilePickerListener controlStateChanged event + void filterSelected(const QString&); + // emit XFilePickerListener fileSelectionChanged event + void currentChanged(const QString&); + // (un)set automatic file extension + virtual void updateAutomaticFileExtension(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5Font.hxx b/vcl/inc/qt5/Qt5Font.hxx new file mode 100644 index 000000000..0720be931 --- /dev/null +++ b/vcl/inc/qt5/Qt5Font.hxx @@ -0,0 +1,41 @@ +/* -*- 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 <fontinstance.hxx> + +#include <QtGui/QFont> + +#include "Qt5FontFace.hxx" + +class Qt5Font final : public QFont, public LogicalFontInstance +{ + friend rtl::Reference<LogicalFontInstance> + Qt5FontFace::CreateFontInstance(const FontSelectPattern&) const; + + bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const override; + bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const override; + + virtual hb_font_t* ImplInitHbFont() override; + + explicit Qt5Font(const PhysicalFontFace&, const FontSelectPattern&); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5FontFace.hxx b/vcl/inc/qt5/Qt5FontFace.hxx new file mode 100644 index 000000000..585f4aaa8 --- /dev/null +++ b/vcl/inc/qt5/Qt5FontFace.hxx @@ -0,0 +1,67 @@ +/* -*- 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 <vclpluginapi.h> +#include <PhysicalFontFace.hxx> + +#include <tools/ref.hxx> +#include <vcl/fontcapabilities.hxx> +#include <vcl/fontcharmap.hxx> + +#include <QtCore/QString> +#include <QtGui/QFont> + +class FontAttributes; +class FontSelectPattern; + +class Qt5FontFace final : public PhysicalFontFace +{ +public: + static Qt5FontFace* fromQFont(const QFont& rFont); + static Qt5FontFace* fromQFontDatabase(const QString& aFamily, const QString& aStyle); + static void fillAttributesFromQFont(const QFont& rFont, FontAttributes& rFA); + + VCLPLUG_QT5_PUBLIC static FontWeight toFontWeight(const int nWeight); + VCLPLUG_QT5_PUBLIC static FontWidth toFontWidth(const int nStretch); + VCLPLUG_QT5_PUBLIC static FontItalic toFontItalic(const QFont::Style eStyle); + + sal_IntPtr GetFontId() const override; + + int GetFontTable(const char pTagName[5], unsigned char*) const; + + const FontCharMapRef& GetFontCharMap() const; + bool GetFontCapabilities(vcl::FontCapabilities& rFontCapabilities) const; + bool HasChar(sal_uInt32 cChar) const; + + rtl::Reference<LogicalFontInstance> + CreateFontInstance(const FontSelectPattern& rFSD) const override; + +private: + Qt5FontFace(const Qt5FontFace&); + Qt5FontFace(const FontAttributes& rFA, const QString& rFontID); + + const QString m_aFontId; + mutable FontCharMapRef m_xCharMap; + mutable vcl::FontCapabilities m_aFontCapabilities; + mutable bool m_bFontCapabilitiesRead; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx new file mode 100644 index 000000000..0caf1bc3e --- /dev/null +++ b/vcl/inc/qt5/Qt5Frame.hxx @@ -0,0 +1,225 @@ +/* -*- 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 <config_vclplug.h> + +#include <salframe.hxx> +#include <vclpluginapi.h> + +#include "Qt5Tools.hxx" + +#include <headless/svpgdi.hxx> +#include <vcl/svapp.hxx> +#include <vcl/sysdata.hxx> + +#include <QtCore/QObject> + +#if QT5_USING_X11 +#include <unx/screensaverinhibitor.hxx> +// any better way to get rid of the X11 / Qt type clashes? +#undef Bool +#undef CursorShape +#undef Expose +#undef KeyPress +#undef KeyRelease +#undef FocusIn +#undef FocusOut +#undef FontChange +#undef None +#undef Status +#undef Unsorted +#endif + +class Qt5DragSource; +class Qt5DropTarget; +class Qt5Graphics; +class Qt5Instance; +class Qt5MainWindow; +class Qt5Menu; +class Qt5SvpGraphics; + +class QDragMoveEvent; +class QDropEvent; +class QImage; +class QMimeData; +class QPaintDevice; +class QScreen; +class QWidget; + +class VCLPLUG_QT5_PUBLIC Qt5Frame : public QObject, public SalFrame +{ + Q_OBJECT + + friend class Qt5Widget; + + QWidget* m_pQWidget; + Qt5MainWindow* m_pTopLevel; + + const bool m_bUseCairo; + std::unique_ptr<QImage> m_pQImage; + std::unique_ptr<Qt5Graphics> m_pQt5Graphics; + UniqueCairoSurface m_pSurface; + std::unique_ptr<Qt5SvpGraphics> m_pOurSvpGraphics; + // in base class, this ptr is the same as m_pOurSvpGraphic + // in derived class, it can point to a derivative + // of Qt5SvpGraphics (which the derived class then owns) + Qt5SvpGraphics* m_pSvpGraphics; + DamageHandler m_aDamageHandler; + QRegion m_aRegion; + bool m_bNullRegion; + + bool m_bGraphicsInUse; + bool m_bGraphicsInvalid; + SalFrameStyleFlags m_nStyle; + Qt5Frame* m_pParent; + PointerStyle m_ePointerStyle; + + SystemEnvData m_aSystemData; + + Qt5Menu* m_pSalMenu; + + Qt5DragSource* m_pDragSource; + Qt5DropTarget* m_pDropTarget; + bool m_bInDrag; + + bool m_bDefaultSize; + bool m_bDefaultPos; + bool m_bFullScreen; + bool m_bFullScreenSpanAll; + sal_uInt32 m_nRestoreScreen; + QRect m_aRestoreGeometry; + +#if QT5_USING_X11 + ScreenSaverInhibitor m_ScreenSaverInhibitor; +#endif + + void SetDefaultPos(); + Size CalcDefaultSize(); + void SetDefaultSize(); + + bool isChild(bool bPlug = true, bool bSysChild = true) const + { + SalFrameStyleFlags nMask = SalFrameStyleFlags::NONE; + if (bPlug) + nMask |= SalFrameStyleFlags::PLUG; + if (bSysChild) + nMask |= SalFrameStyleFlags::SYSTEMCHILD; + return bool(m_nStyle & nMask); + } + + bool isWindow() const; + QWindow* windowHandle() const; + QScreen* screen() const; + bool isMinimized() const; + bool isMaximized() const; + void SetWindowStateImpl(Qt::WindowStates eState); + + void fixICCCMwindowGroup(); + +public: + Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nSalFrameStyle, bool bUseCairo); + virtual ~Qt5Frame() override; + + QWidget* GetQWidget() const { return m_pQWidget; } + Qt5MainWindow* GetTopLevelWindow() const { return m_pTopLevel; } + QWidget* asChild() const; + qreal devicePixelRatioF() const; + + void Damage(sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 nExtentsWidth, + sal_Int32 nExtentsHeight) const; + + void InitQt5SvpGraphics(Qt5SvpGraphics* pQt5SvpGraphics); + virtual SalGraphics* AcquireGraphics() override; + virtual void ReleaseGraphics(SalGraphics* pGraphics) override; + + virtual bool PostEvent(std::unique_ptr<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 registerDragSource(Qt5DragSource* pDragSource); + virtual void deregisterDragSource(Qt5DragSource const* pDragSource); + virtual void registerDropTarget(Qt5DropTarget* pDropTarget); + virtual void deregisterDropTarget(Qt5DropTarget const* pDropTarget); + + void handleDragLeave(); + void handleDragMove(QDragMoveEvent* pEvent); + void handleDrop(QDropEvent* pEvent); + + 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 SetModal(bool bModal) override; + virtual bool GetModal() 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 bool ShowTooltip(const OUString& rText, const tools::Rectangle& rHelpArea) override; + using SalFrame::Flush; + virtual void Flush() 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 { return &m_aSystemData; } + 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_uInt32 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; + + inline bool CallCallback(SalEvent nEvent, const void* pEvent) const; + + cairo_t* getCairoContext() const; +}; + +inline bool Qt5Frame::CallCallback(SalEvent nEvent, const void* pEvent) const +{ + SolarMutexGuard aGuard; + return SalFrame::CallCallback(nEvent, pEvent); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5Graphics.hxx b/vcl/inc/qt5/Qt5Graphics.hxx new file mode 100644 index 000000000..bc4870ee7 --- /dev/null +++ b/vcl/inc/qt5/Qt5Graphics.hxx @@ -0,0 +1,202 @@ +/* -*- 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/QPainter> +#include <QtGui/QPainterPath> +#include <QtGui/QRegion> + +#include "Qt5GraphicsBase.hxx" + +class PhysicalFontCollection; +class QImage; +class QPushButton; +class Qt5Font; +class Qt5FontFace; +class Qt5Frame; +class Qt5Painter; + +class Qt5Graphics final : public SalGraphics, public Qt5GraphicsBase +{ + friend class Qt5Bitmap; + friend class Qt5Painter; + + Qt5Frame* m_pFrame; + QImage* m_pQImage; + QRegion m_aClipRegion; + QPainterPath m_aClipPath; + Color m_aLineColor; + Color m_aFillColor; + QPainter::CompositionMode m_eCompositionMode; + + PhysicalFontCollection* m_pFontCollection; + rtl::Reference<Qt5Font> m_pTextStyle[MAX_FALLBACK]; + Color m_aTextColor; + std::unique_ptr<QPushButton> m_focusedButton; + std::unique_ptr<QImage> m_image; + QRect m_lastPopupRect; + + Qt5Graphics(Qt5Frame* pFrame, QImage* pQImage); + + void drawScaledImage(const SalTwoRect& rPosAry, const QImage& rImage); + + void handleDamage(const tools::Rectangle&) override; + +public: + Qt5Graphics(Qt5Frame* pFrame) + : Qt5Graphics(pFrame, nullptr) + { + } + Qt5Graphics(QImage* pQImage) + : Qt5Graphics(nullptr, pQImage) + { + } + virtual ~Qt5Graphics() override; + + void ChangeQImage(QImage* pImage); + + virtual SalGraphicsImpl* GetImpl() const override; + virtual SystemGraphicsData GetGraphicsData() const override; + virtual bool supportsOperation(OutDevSupportType) const override; + virtual OUString getRenderBackendName() const override { return "qt5"; } + +#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, Color nColor) 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::B2DHomMatrix& rObjectToDevice, + 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::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolygon&, double fTransparency, double fLineWidths, + const std::vector<double>* pStroke, // MM01 + basegfx::B2DLineJoin, css::drawing::LineCap eLineCap, + double fMiterMinimumAngle, bool bPixelSnapHairline) 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, + Color nMaskColor) override; + + virtual std::shared_ptr<SalBitmap> getBitmap(long nX, long nY, long nWidth, + long nHeight) override; + virtual Color 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_uInt32 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(Color nColor) override; + virtual void SetFillColor() override; + virtual void SetFillColor(Color nColor) override; + virtual void SetXORMode(bool bSet, bool bInvertOnly) override; + virtual void SetROPLineColor(SalROPColor nROPColor) override; + virtual void SetROPFillColor(SalROPColor nROPColor) override; + + // Text rendering + font support + + virtual void SetTextColor(Color nColor) override; + virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) override; + virtual void GetFontMetric(ImplFontMetricDataRef&, int nFallbackLevel) override; + virtual 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 std::unique_ptr<GenericSalLayout> GetTextLayout(int nFallbackLevel) override; + virtual void DrawTextLayout(const GenericSalLayout&) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5GraphicsBase.hxx b/vcl/inc/qt5/Qt5GraphicsBase.hxx new file mode 100644 index 000000000..ef7955186 --- /dev/null +++ b/vcl/inc/qt5/Qt5GraphicsBase.hxx @@ -0,0 +1,30 @@ +/* -*- 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/. + */ + +#pragma once + +#include <QtWidgets/QApplication> + +class Qt5GraphicsBase +{ + qreal m_fDPR; + +protected: + Qt5GraphicsBase() + : m_fDPR(qApp ? qApp->devicePixelRatio() : 1.0) + { + } + + void setDevicePixelRatioF(qreal fDPR) { m_fDPR = fDPR; } + +public: + qreal devicePixelRatioF() const { return m_fDPR; } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5Graphics_Controls.hxx b/vcl/inc/qt5/Qt5Graphics_Controls.hxx new file mode 100644 index 000000000..325e5c351 --- /dev/null +++ b/vcl/inc/qt5/Qt5Graphics_Controls.hxx @@ -0,0 +1,97 @@ +/* -*- 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 <vclpluginapi.h> +#include <WidgetDrawInterface.hxx> + +#include <memory> + +#include <QtGui/QImage> +#include <QtGui/QPainter> +#include <QtGui/QRegion> +#include <QtWidgets/QPushButton> +#include <QtWidgets/QStyle> +#include <QtWidgets/QStyleOption> + +class Qt5GraphicsBase; + +class Qt5Graphics_Controls final : public vcl::WidgetDrawInterface +{ + std::unique_ptr<QImage> m_image; + QRect m_lastPopupRect; + Qt5GraphicsBase const& m_rGraphics; + +public: + Qt5Graphics_Controls(const Qt5GraphicsBase& rGraphics); + + QImage* getImage() { return m_image.get(); } + + bool isNativeControlSupported(ControlType nType, ControlPart nPart) override; + bool hitTestNativeControl(ControlType nType, ControlPart nPart, + const tools::Rectangle& rControlRegion, const Point& aPos, + bool& rIsInside) override; + bool drawNativeControl(ControlType nType, ControlPart nPart, + const tools::Rectangle& rControlRegion, ControlState nState, + const ImplControlValue& aValue, const OUString& aCaption, + const Color& rBackgroundColor) override; + 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; + +private: + static int pixelMetric(QStyle::PixelMetric metric, const QStyleOption* option = nullptr); + static QSize sizeFromContents(QStyle::ContentsType type, const QStyleOption* option, + const QSize& contentsSize); + static QRect subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex* option, + QStyle::SubControl subControl); + static QRect subElementRect(QStyle::SubElement element, const QStyleOption* option); + + void draw(QStyle::ControlElement element, QStyleOption* option, QImage* image, + QStyle::State const state = QStyle::State_None, QRect rect = QRect()); + void draw(QStyle::PrimitiveElement element, QStyleOption* option, QImage* image, + QStyle::State const state = QStyle::State_None, QRect rect = QRect()); + void draw(QStyle::ComplexControl element, QStyleOptionComplex* option, QImage* image, + QStyle::State const state = QStyle::State_None); + void drawFrame(QStyle::PrimitiveElement element, QImage* image, QStyle::State const& state, + bool bClip = true, + QStyle::PixelMetric eLineMetric = QStyle::PM_DefaultFrameWidth); + + static void fillQStyleOptionTab(const ImplControlValue& value, QStyleOptionTab& sot); + void fullQStyleOptionTabWidgetFrame(QStyleOptionTabWidgetFrame& option, bool bDownscale); + + enum class Round + { + Floor, + Ceil, + }; + + int downscale(int value, Round eRound); + int upscale(int value, Round eRound); + QRect downscale(const QRect& rect); + QRect upscale(const QRect& rect); + QSize downscale(const QSize& size, Round eRound); + QSize upscale(const QSize& size, Round eRound); + QPoint upscale(const QPoint& point, Round eRound); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5Instance.hxx b/vcl/inc/qt5/Qt5Instance.hxx new file mode 100644 index 000000000..361eca0fc --- /dev/null +++ b/vcl/inc/qt5/Qt5Instance.hxx @@ -0,0 +1,161 @@ +/* -*- 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 <vclpluginapi.h> +#include <unx/geninst.h> +#include <salusereventlist.hxx> +#include <vcl/timer.hxx> + +#include <osl/conditn.hxx> + +#include <QtCore/QObject> + +#include <cstdlib> +#include <functional> +#include <memory> +#include <vector> + +#include "Qt5FilePicker.hxx" + +class QApplication; +class SalYieldMutex; +class SalFrame; + +struct StdFreeCStr +{ + void operator()(char* arg) const noexcept { std::free(arg); } +}; +using FreeableCStr = std::unique_ptr<char[], StdFreeCStr>; + +class VCLPLUG_QT5_PUBLIC Qt5Instance : public QObject, + public SalGenericInstance, + public SalUserEventList +{ + Q_OBJECT + + osl::Condition m_aWaitingYieldCond; + int m_postUserEventId; + const bool m_bUseCairo; + std::unordered_map<OUString, css::uno::Reference<css::uno::XInterface>> m_aClipboards; + + std::unique_ptr<QApplication> m_pQApplication; + std::vector<FreeableCStr> m_pFakeArgvFreeable; + std::unique_ptr<char* []> m_pFakeArgv; + std::unique_ptr<int> m_pFakeArgc; + + Timer m_aUpdateStyleTimer; + bool m_bUpdateFonts; + + DECL_LINK(updateStyleHdl, Timer*, void); + void AfterAppInit() override; + +private Q_SLOTS: + bool ImplYield(bool bWait, bool bHandleAllCurrentEvents); + void ImplRunInMain(); + static void deleteObjectLater(QObject* pObject); + +Q_SIGNALS: + bool ImplYieldSignal(bool bWait, bool bHandleAllCurrentEvents); + void ImplRunInMainSignal(); + void deleteObjectLaterSignal(QObject* pObject); + +protected: + virtual Qt5FilePicker* + createPicker(css::uno::Reference<css::uno::XComponentContext> const& context, + QFileDialog::FileMode); + +public: + explicit Qt5Instance(std::unique_ptr<QApplication>& pQApp, bool bUseCairo = false); + virtual ~Qt5Instance() override; + + // handle common SalInstance setup + static void AllocFakeCmdlineArgs(std::unique_ptr<char* []>& rFakeArgv, + std::unique_ptr<int>& rFakeArgc, + std::vector<FreeableCStr>& rFakeArgvFreeable); + void MoveFakeCmdlineArgs(std::unique_ptr<char* []>& rFakeArgv, std::unique_ptr<int>& rFakeArgc, + std::vector<FreeableCStr>& rFakeArgvFreeable); + static std::unique_ptr<QApplication> CreateQApplication(int& nArgc, char** pArgv); + + void RunInMainThread(std::function<void()> func); + + 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 std::unique_ptr<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 std::unique_ptr<SalPrinter> CreatePrinter(SalInfoPrinter* pInfoPrinter) override; + virtual void GetPrinterQueueInfo(ImplPrnQueueList* pList) override; + virtual void GetPrinterQueueState(SalPrinterQueueInfo* pInfo) override; + virtual OUString GetDefaultPrinter() override; + virtual void PostPrintersChanged() override; + + virtual std::unique_ptr<SalMenu> CreateMenu(bool, Menu*) override; + virtual std::unique_ptr<SalMenuItem> CreateMenuItem(const SalItemParams&) override; + + virtual SalTimer* CreateSalTimer() override; + virtual SalSystem* CreateSalSystem() override; + virtual std::shared_ptr<SalBitmap> CreateSalBitmap() override; + + virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents) override; + virtual bool AnyInput(VclInputFlags nType) override; + + virtual OpenGLContext* CreateOpenGLContext() override; + + virtual OUString GetConnectionIdentifier() override; + + virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, + const OUString& rDocumentService) override; + + virtual std::unique_ptr<GenPspGraphics> CreatePrintGraphics() override; + + virtual bool IsMainThread() const override; + + virtual void TriggerUserEventProcessing() override; + virtual void ProcessEvent(SalUserEvent aEvent) override; + + bool hasNativeFileSelection() const override { return true; } + css::uno::Reference<css::ui::dialogs::XFilePicker2> + createFilePicker(const css::uno::Reference<css::uno::XComponentContext>&) override; + css::uno::Reference<css::ui::dialogs::XFolderPicker2> + createFolderPicker(const css::uno::Reference<css::uno::XComponentContext>&) override; + + virtual css::uno::Reference<css::uno::XInterface> + CreateClipboard(const css::uno::Sequence<css::uno::Any>& i_rArguments) override; + virtual css::uno::Reference<css::uno::XInterface> CreateDragSource() override; + virtual css::uno::Reference<css::uno::XInterface> CreateDropTarget() override; + + void UpdateStyle(bool bFontsChanged); + + void* CreateGStreamerSink(const SystemChildWindow*) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5MainWindow.hxx b/vcl/inc/qt5/Qt5MainWindow.hxx new file mode 100644 index 000000000..f1e91b489 --- /dev/null +++ b/vcl/inc/qt5/Qt5MainWindow.hxx @@ -0,0 +1,40 @@ +/* -*- 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> +#include <QtWidgets/QMainWindow> + +#include "Qt5Frame.hxx" + +class Qt5MainWindow : public QMainWindow +{ + Q_OBJECT + + Qt5Frame& m_rFrame; + + virtual void closeEvent(QCloseEvent* pEvent) override; + void moveEvent(QMoveEvent*) override; + +public: + Qt5MainWindow(Qt5Frame& rFrame, Qt::WindowFlags f = Qt::WindowFlags()); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5Menu.hxx b/vcl/inc/qt5/Qt5Menu.hxx new file mode 100644 index 000000000..2e5434f4d --- /dev/null +++ b/vcl/inc/qt5/Qt5Menu.hxx @@ -0,0 +1,122 @@ +/* -*- 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/. + */ + +#pragma once + +#include <salmenu.hxx> + +#include <QtCore/QObject> + +#include <memory> + +class MenuItemList; +class QAction; +class QActionGroup; +class QPushButton; +class QMenu; +class QMenuBar; +class Qt5MenuItem; +class Qt5Frame; + +/* + * Qt5Menu can represent + * (1) the top-level menu of a menubar, in which case 'mbMenuBar' is true and + * 'mpQMenuBar' refers to the corresponding QMenuBar + * (2) another kind of menu (like a PopupMenu), in which case the corresponding QMenu + * object is instantiated and owned by this Qt5Menu (held in 'mpOwnedQMenu'). + * (3) a "submenu" in an existing menu (like (1)), in which case the corresponding + * QMenu object is owned by the corresponding Qt5MenuItem. + * + * For (2) and (3), member 'mpQMenu' points to the corresponding QMenu object. + */ +class Qt5Menu : public QObject, public SalMenu +{ + Q_OBJECT +private: + std::vector<Qt5MenuItem*> maItems; + VclPtr<Menu> mpVCLMenu; + Qt5Menu* mpParentSalMenu; + Qt5Frame* mpFrame; + bool mbMenuBar; + QMenuBar* mpQMenuBar; + // self-created QMenu that this Qt5Menu represents, if applicable (s. comment for class) + std::unique_ptr<QMenu> mpOwnedQMenu; + // pointer to QMenu owned by the corresponding Qt5MenuItem or self (-> mpOwnedQMenu) + QMenu* mpQMenu; + QPushButton* mpCloseButton; + QMetaObject::Connection maCloseButtonConnection; + + void DoFullMenuUpdate(Menu* pMenuBar); + static void NativeItemText(OUString& rItemText); + + void InsertMenuItem(Qt5MenuItem* pSalMenuItem, unsigned nPos); + + void ReinitializeActionGroup(unsigned nPos); + void ResetAllActionGroups(); + void UpdateActionGroupItem(const Qt5MenuItem* pSalMenuItem); + +public: + Qt5Menu(bool bMenuBar); + + virtual bool VisibleMenuBar() override; // must return TRUE to actually DISPLAY native menu bars + + virtual void InsertItem(SalMenuItem* pSalMenuItem, unsigned nPos) override; + virtual void RemoveItem(unsigned nPos) override; + virtual void SetSubMenu(SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos) override; + virtual void SetFrame(const SalFrame* pFrame) override; + const Qt5Frame* GetFrame() const; + virtual void ShowMenuBar(bool bVisible) override; + virtual bool ShowNativePopupMenu(FloatingWindow* pWin, const tools::Rectangle& rRect, + FloatWinPopupFlags nFlags) override; + Qt5Menu* GetTopLevel(); + virtual void SetItemBits(unsigned nPos, MenuItemBits nBits) override; + virtual void CheckItem(unsigned nPos, bool bCheck) override; + virtual void EnableItem(unsigned nPos, bool bEnable) override; + virtual void ShowItem(unsigned nPos, bool bShow) override; + virtual void SetItemText(unsigned nPos, SalMenuItem* pSalMenuItem, + const OUString& rText) override; + virtual void SetItemImage(unsigned nPos, SalMenuItem* pSalMenuItem, + const Image& rImage) override; + virtual void SetAccelerator(unsigned nPos, SalMenuItem* pSalMenuItem, + const vcl::KeyCode& rKeyCode, const OUString& rKeyName) override; + virtual void GetSystemMenuData(SystemMenuData* pData) override; + virtual void ShowCloseButton(bool bShow) override; + + void SetMenu(Menu* pMenu) { mpVCLMenu = pMenu; } + Menu* GetMenu() { return mpVCLMenu; } + unsigned GetItemCount() const { return maItems.size(); } + Qt5MenuItem* GetItemAtPos(unsigned nPos) { return maItems[nPos]; } + +private slots: + static void slotMenuTriggered(Qt5MenuItem* pQItem); + static void slotMenuAboutToShow(Qt5MenuItem* pQItem); + static void slotMenuAboutToHide(Qt5MenuItem* pQItem); + void slotCloseDocument(); +}; + +class Qt5MenuItem : public SalMenuItem +{ +public: + Qt5MenuItem(const SalItemParams*); + + QAction* getAction() const; + + Qt5Menu* mpParentMenu; // The menu into which this menu item is inserted + Qt5Menu* mpSubMenu; // Submenu of this item (if defined) + std::unique_ptr<QAction> mpAction; // action corresponding to this item + std::unique_ptr<QMenu> mpMenu; // menu corresponding to this item + std::shared_ptr<QActionGroup> mpActionGroup; // empty if it's a separator element + sal_uInt16 mnId; // Item ID + MenuItemType mnType; // Item type + bool mbVisible; // Item visibility. + bool mbEnabled; // Item active. + Image maImage; // Item image +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5Object.hxx b/vcl/inc/qt5/Qt5Object.hxx new file mode 100644 index 000000000..0479db2d6 --- /dev/null +++ b/vcl/inc/qt5/Qt5Object.hxx @@ -0,0 +1,79 @@ +/* -*- 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 <QtCore/QObject> +#include <QtGui/QRegion> +#include <QtGui/QWindow> + +class Qt5Frame; +class QWidget; + +class Qt5Object final : public QObject, public SalObject +{ + Q_OBJECT + + SystemEnvData m_aSystemData; + Qt5Frame* m_pParent; + QWidget* m_pQWidget; // main widget, container + QWindow* m_pQWindow; // contained window, used for opengl rendering + QRegion m_pRegion; + +public: + Qt5Object(Qt5Frame* pParent, bool bShow); + ~Qt5Object() override; + + Qt5Frame* frame() const { return m_pParent; } + QWidget* widget() const { return m_pQWidget; } + QWindow* windowHandle() const { return m_pQWindow; } + + virtual void ResetClipRegion() override; + virtual void BeginSetClipRegion(sal_uInt32 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 { return &m_aSystemData; } +}; + +class Qt5ObjectWindow final : public QWindow +{ + Qt5Object& m_rParent; + + bool event(QEvent*) override; + void focusInEvent(QFocusEvent*) override; + void focusOutEvent(QFocusEvent*) override; + void mousePressEvent(QMouseEvent*) override; + void mouseReleaseEvent(QMouseEvent*) override; + // keyPressEvent(QKeyEvent*) is handled via event(QEvent*); see comment in Qt5Widget::event + void keyReleaseEvent(QKeyEvent*) override; + +public: + explicit Qt5ObjectWindow(Qt5Object& rParent); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5OpenGLContext.hxx b/vcl/inc/qt5/Qt5OpenGLContext.hxx new file mode 100644 index 000000000..df5424620 --- /dev/null +++ b/vcl/inc/qt5/Qt5OpenGLContext.hxx @@ -0,0 +1,50 @@ +/* -*- 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 <vcl/opengl/OpenGLContext.hxx> + +class QWindow; +class QOpenGLContext; + +class Qt5OpenGLContext final : public OpenGLContext +{ +public: + virtual void initWindow() override; + +private: + virtual const GLWindow& getOpenGLWindow() const override { return m_aGLWin; } + virtual GLWindow& getModifiableOpenGLWindow() override { return m_aGLWin; } + virtual bool ImplInit() override; + + virtual void makeCurrent() override; + virtual void destroyCurrentContext() override; + virtual bool isCurrent() override; + virtual bool isAnyCurrent() override; + virtual void resetCurrent() override; + virtual void swapBuffers() override; + + static bool g_bAnyCurrent; + + GLWindow m_aGLWin; + + QWindow* m_pWindow; + QOpenGLContext* m_pContext; +}; diff --git a/vcl/inc/qt5/Qt5Painter.hxx b/vcl/inc/qt5/Qt5Painter.hxx new file mode 100644 index 000000000..51ddc3d69 --- /dev/null +++ b/vcl/inc/qt5/Qt5Painter.hxx @@ -0,0 +1,67 @@ +/* -*- 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/QRectF> +#include <QtGui/QPainter> +#include <QtWidgets/QWidget> + +#include "Qt5Frame.hxx" +#include "Qt5Graphics.hxx" + +class Qt5Painter final : public QPainter +{ + Qt5Graphics& m_rGraphics; + QRegion m_aRegion; + +public: + Qt5Painter(Qt5Graphics& rGraphics, bool bPrepareBrush = false, sal_uInt8 nTransparency = 255); + ~Qt5Painter() + { + if (m_rGraphics.m_pFrame && !m_aRegion.isEmpty()) + m_rGraphics.m_pFrame->GetQWidget()->update(m_aRegion); + } + + void update(int nx, int ny, int nw, int nh) + { + if (m_rGraphics.m_pFrame) + m_aRegion += scaledQRect({ nx, ny, nw, nh }, 1 / m_rGraphics.devicePixelRatioF()); + } + + void update(const QRect& rRect) + { + if (m_rGraphics.m_pFrame) + m_aRegion += scaledQRect(rRect, 1 / m_rGraphics.devicePixelRatioF()); + } + + void update(const QRectF& rRectF) + { + if (m_rGraphics.m_pFrame) + update(scaledQRect(rRectF.toAlignedRect(), 1 / m_rGraphics.devicePixelRatioF())); + } + + void update() + { + if (m_rGraphics.m_pFrame) + m_aRegion += m_rGraphics.m_pFrame->GetQWidget()->rect(); + } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5Printer.hxx b/vcl/inc/qt5/Qt5Printer.hxx new file mode 100644 index 000000000..23f5428ca --- /dev/null +++ b/vcl/inc/qt5/Qt5Printer.hxx @@ -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 . + */ + +#pragma once + +#include <unx/genprn.h> + +class SalFrame; + +class Qt5Printer final : public PspSalPrinter +{ +public: + Qt5Printer(SalInfoPrinter* pInfoPrinter); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5SvpGraphics.hxx b/vcl/inc/qt5/Qt5SvpGraphics.hxx new file mode 100644 index 000000000..2ea5e6ad9 --- /dev/null +++ b/vcl/inc/qt5/Qt5SvpGraphics.hxx @@ -0,0 +1,55 @@ +/* -*- 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 <vclpluginapi.h> +#include <headless/svpgdi.hxx> + +#include "Qt5GraphicsBase.hxx" + +class Qt5Frame; + +class VCLPLUG_QT5_PUBLIC Qt5SvpGraphics : public SvpSalGraphics, public Qt5GraphicsBase +{ + Qt5Frame* const m_pFrame; + +protected: + void handleDamage(const tools::Rectangle&) override; + +public: + Qt5SvpGraphics(Qt5Frame* pFrame); + ~Qt5SvpGraphics() override; + + void updateQWidget() const; + +#if ENABLE_CAIRO_CANVAS + bool SupportsCairo() const override; + cairo::SurfaceSharedPtr + CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override; + cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, + int height) const override; +#endif // ENABLE_CAIRO_CANVAS + + virtual void GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) override; + + virtual OUString getRenderBackendName() const override { return "qt5svp"; } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5SvpSurface.hxx b/vcl/inc/qt5/Qt5SvpSurface.hxx new file mode 100644 index 000000000..0e4da4877 --- /dev/null +++ b/vcl/inc/qt5/Qt5SvpSurface.hxx @@ -0,0 +1,44 @@ +/* -*- 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/. + */ + +#pragma once + +#include <sal/config.h> + +#include <vcl/cairo.hxx> + +class Qt5SvpGraphics; +class OutputDevice; + +namespace cairo +{ +class Qt5SvpSurface final : public Surface +{ + const Qt5SvpGraphics* m_pGraphics; + cairo_t* const m_pCairoContext; + CairoSurfaceSharedPtr m_pSurface; + +public: + /// takes over ownership of passed cairo_surface + explicit Qt5SvpSurface(const CairoSurfaceSharedPtr& pSurface); + /// create surface on subarea of given drawable + explicit Qt5SvpSurface(const Qt5SvpGraphics* pGraphics, int x, int y, int width, int height); + ~Qt5SvpSurface() override; + + // Surface interface + CairoSharedPtr getCairo() const override; + CairoSurfaceSharedPtr getCairoSurface() const override { return m_pSurface; } + SurfaceSharedPtr getSimilar(int nContentType, int width, int height) const override; + + VclPtr<VirtualDevice> createVirtualDevice() const override; + void flush() const override; +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5System.hxx b/vcl/inc/qt5/Qt5System.hxx new file mode 100644 index 000000000..63a7e9bde --- /dev/null +++ b/vcl/inc/qt5/Qt5System.hxx @@ -0,0 +1,23 @@ +/* -*- 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/. + */ + +#pragma once + +#include <unx/gensys.h> + +class Qt5System final : public SalGenericSystem +{ +public: + virtual unsigned int GetDisplayScreenCount() override; + virtual tools::Rectangle GetDisplayScreenPosSizePixel(unsigned int nScreen) override; + virtual int ShowNativeDialog(const OUString& rTitle, const OUString& rMessage, + const std::vector<OUString>& rButtons) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5Timer.hxx b/vcl/inc/qt5/Qt5Timer.hxx new file mode 100644 index 000000000..20b2a4c70 --- /dev/null +++ b/vcl/inc/qt5/Qt5Timer.hxx @@ -0,0 +1,47 @@ +/* -*- 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 Qt5Timer final : public QObject, public SalTimer +{ + Q_OBJECT + + QTimer m_aTimer; + +private Q_SLOTS: + void timeoutActivated(); + void startTimer(int); + void stopTimer(); + +Q_SIGNALS: + void startTimerSignal(int); + void stopTimerSignal(); + +public: + Qt5Timer(); + + virtual void Start(sal_uInt64 nMS) override; + virtual void Stop() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5Tools.hxx b/vcl/inc/qt5/Qt5Tools.hxx new file mode 100644 index 000000000..1b58750ec --- /dev/null +++ b/vcl/inc/qt5/Qt5Tools.hxx @@ -0,0 +1,154 @@ +/* -*- 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/QPoint> +#include <QtCore/QRect> +#include <QtCore/QSize> +#include <QtCore/QString> +#include <QtGui/QImage> + +#include <rtl/string.hxx> +#include <rtl/ustring.hxx> +#include <tools/color.hxx> +#include <tools/gen.hxx> + +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> + +#include <memory> + +class Image; +class QImage; + +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 QRect toQRect(const tools::Rectangle& rRect, const qreal fScale) +{ + return QRect(floor(rRect.Left() * fScale), floor(rRect.Top() * fScale), + ceil(rRect.GetWidth() * fScale), ceil(rRect.GetHeight() * fScale)); +} + +inline QRect scaledQRect(const QRect& rRect, const qreal fScale) +{ + return QRect(floor(rRect.x() * fScale), floor(rRect.y() * fScale), ceil(rRect.width() * fScale), + ceil(rRect.height() * fScale)); +} + +inline tools::Rectangle toRectangle(const QRect& rRect) +{ + return tools::Rectangle(rRect.left(), rRect.top(), rRect.right(), rRect.bottom()); +} + +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 Point toPoint(const QPoint& rPoint) { return Point(rPoint.x(), rPoint.y()); } + +inline QColor toQColor(const Color& rColor) +{ + return QColor(rColor.GetRed(), rColor.GetGreen(), rColor.GetBlue(), + 255 - rColor.GetTransparency()); +} + +Qt::DropActions toQtDropActions(sal_Int8 dragOperation); +sal_Int8 toVclDropActions(Qt::DropActions dragOperation); +sal_Int8 toVclDropAction(Qt::DropAction dragOperation); +Qt::DropAction getPreferredDropAction(sal_Int8 dragOperation); + +inline QList<int> toQList(const css::uno::Sequence<sal_Int32>& aSequence) +{ + QList<int> aList; + for (sal_Int32 i : aSequence) + { + aList.append(i); + } + return aList; +} + +static constexpr QImage::Format Qt5_DefaultFormat32 = QImage::Format_ARGB32; + +inline QImage::Format getBitFormat(sal_uInt16 nBitCount) +{ + switch (nBitCount) + { + case 1: + return QImage::Format_Mono; + case 8: + return QImage::Format_Indexed8; + case 24: + return QImage::Format_RGB888; + case 32: + return Qt5_DefaultFormat32; + 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_RGB888: + return 24; + case Qt5_DefaultFormat32: + case QImage::Format_ARGB32_Premultiplied: + return 32; + default: + std::abort(); + return 0; + } +} + +typedef struct _cairo_surface cairo_surface_t; +struct CairoDeleter +{ + void operator()(cairo_surface_t* pSurface) const; +}; + +typedef std::unique_ptr<cairo_surface_t, CairoDeleter> UniqueCairoSurface; + +sal_uInt16 GetKeyModCode(Qt::KeyboardModifiers eKeyModifiers); +sal_uInt16 GetMouseModCode(Qt::MouseButtons eButtons); + +QImage toQImage(const Image& rImage); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5Transferable.hxx b/vcl/inc/qt5/Qt5Transferable.hxx new file mode 100644 index 000000000..0d1cc7050 --- /dev/null +++ b/vcl/inc/qt5/Qt5Transferable.hxx @@ -0,0 +1,124 @@ +/* -*- 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/. + * + */ + +#pragma once + +#include <cppuhelper/compbase.hxx> +#include <com/sun/star/datatransfer/XTransferable.hpp> + +#include <QtCore/QMimeData> +#include <QtCore/QStringList> +#include <QtGui/QClipboard> + +/** + * Qt5Transferable classes are used to read QMimeData via the XTransferable + * interface. All the functionality is already implemented in the Qt5Transferable. + * + * The specialisations map to the two users, which provide QMimeData: the Clipboard + * and the Drag'n'Drop functionality. + * + * LO itself seem to just accept "text/plain;charset=utf-16", so it relies on the + * backend to convert to this charset, but still offers "text/plain" itself. + * + * It's the "mirror" interface of the Qt5MimeData, which is defined below. + **/ +class Qt5Transferable : public cppu::WeakImplHelper<css::datatransfer::XTransferable> +{ + Qt5Transferable(const Qt5Transferable&) = delete; + + const QMimeData* m_pMimeData; + osl::Mutex m_aMutex; + bool m_bConvertFromLocale; + css::uno::Sequence<css::datatransfer::DataFlavor> m_aMimeTypeSeq; + +public: + Qt5Transferable(const QMimeData* pMimeData); + const QMimeData* mimeData() const { return m_pMimeData; } + + css::uno::Sequence<css::datatransfer::DataFlavor> SAL_CALL getTransferDataFlavors() override; + sal_Bool SAL_CALL isDataFlavorSupported(const css::datatransfer::DataFlavor& rFlavor) override; + css::uno::Any SAL_CALL getTransferData(const css::datatransfer::DataFlavor& rFlavor) override; +}; + +/** + * The QClipboard's QMimeData is volatile. As written in the QClipboard::mimeData + * documentation, "the pointer returned might become invalidated when the contents + * of the clipboard changes". Therefore it can just be accessed reliably inside + * the QClipboard's object thread, which is the QApplication's thread, so all of + * the access has to go through RunInMainThread(). + * + * If we detect a QMimeData change, we simply drop reporting any content. In theory + * we can recover in the case where there hadn't been any calls of the XTransferable + * interface, but currently we don't. But we ensure to never report mixed content, + * so we'll just cease operation on QMimeData change. + **/ +class Qt5ClipboardTransferable final : public Qt5Transferable +{ + // to detect in-flight QMimeData changes + const QClipboard::Mode m_aMode; + + bool hasInFlightChanged() const; + +public: + explicit Qt5ClipboardTransferable(const QClipboard::Mode aMode, const QMimeData* pMimeData); + + // these are the same then Qt5Transferable, except they go through RunInMainThread + css::uno::Sequence<css::datatransfer::DataFlavor> SAL_CALL getTransferDataFlavors() override; + sal_Bool SAL_CALL isDataFlavorSupported(const css::datatransfer::DataFlavor& rFlavor) override; + css::uno::Any SAL_CALL getTransferData(const css::datatransfer::DataFlavor& rFlavor) override; +}; + +/** + * Convenience typedef for better code readability + * + * This just uses the QMimeData provided by the QWidgets D'n'D events. + **/ +typedef Qt5Transferable Qt5DnDTransferable; + +/** + * A lazy loading QMimeData for XTransferable reads + * + * This is an interface class to make a XTransferable read accessible as a + * QMimeData. The mime data is just stored inside the XTransferable, never + * in the QMimeData itself! It's objects are just used for QClipboard to read + * the XTransferable data. + * + * Like XTransferable itself, this class should be considered an immutable + * container for mime data. There is no need to ever set any of its data. + * + * LO will offer at least UTF-16, if there is a viable text representation. + * If LO misses to offer a UTF-8 or a locale encoded string, these objects + * will offer them themselves and convert from UTF-16 on demand. + * + * It's the "mirror" interface of the Qt5Transferable. + **/ +class Qt5MimeData final : public QMimeData +{ + friend class Qt5ClipboardTransferable; + + const css::uno::Reference<css::datatransfer::XTransferable> m_aContents; + mutable bool m_bHaveNoCharset; // = uses the locale charset + mutable bool m_bHaveUTF8; + mutable QStringList m_aMimeTypeList; + + QVariant retrieveData(const QString& mimeType, QVariant::Type type) const override; + +public: + explicit Qt5MimeData(const css::uno::Reference<css::datatransfer::XTransferable>& aContents); + + bool hasFormat(const QString& mimeType) const override; + QStringList formats() const override; + + bool deepCopy(QMimeData** const) const; + + css::datatransfer::XTransferable* xTransferable() const { return m_aContents.get(); } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5VirtualDevice.hxx b/vcl/inc/qt5/Qt5VirtualDevice.hxx new file mode 100644 index 000000000..89251c96d --- /dev/null +++ b/vcl/inc/qt5/Qt5VirtualDevice.hxx @@ -0,0 +1,56 @@ +/* -*- 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 <memory> +#include <list> + +#include <QtCore/QSize> + +class Qt5Graphics; +class QImage; +enum class DeviceFormat; + +class Qt5VirtualDevice final : public SalVirtualDevice +{ + std::list<Qt5Graphics*> m_aGraphics; + std::unique_ptr<QImage> m_pImage; + DeviceFormat m_eFormat; + QSize m_aFrameSize; + double m_fScale; + +public: + Qt5VirtualDevice(DeviceFormat eFormat, double fScale); + + // 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/inc/qt5/Qt5Widget.hxx b/vcl/inc/qt5/Qt5Widget.hxx new file mode 100644 index 000000000..159794b2d --- /dev/null +++ b/vcl/inc/qt5/Qt5Widget.hxx @@ -0,0 +1,103 @@ +/* -*- 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> +#include <rtl/ustring.hxx> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/accessibility/XAccessibleEditableText.hpp> + +class Qt5Frame; +class Qt5Object; + +class Qt5Widget : public QWidget +{ + Q_OBJECT + + Qt5Frame& m_rFrame; + bool m_bNonEmptyIMPreeditSeen; + int m_nDeltaX; + int m_nDeltaY; + + enum class ButtonKeyState + { + Pressed, + Released + }; + + static void commitText(Qt5Frame&, const QString& aText); + static bool handleKeyEvent(Qt5Frame&, const QWidget&, QKeyEvent*, const ButtonKeyState); + static void handleMouseButtonEvent(const Qt5Frame&, const QMouseEvent*, const ButtonKeyState); + + virtual bool event(QEvent*) override; + + virtual void focusInEvent(QFocusEvent*) override; + virtual void focusOutEvent(QFocusEvent*) override; + // keyPressEvent(QKeyEvent*) is handled via event(QEvent*); see comment + virtual void keyReleaseEvent(QKeyEvent*) override; + virtual void mouseMoveEvent(QMouseEvent*) override; + virtual void mousePressEvent(QMouseEvent*) override; + virtual void mouseReleaseEvent(QMouseEvent*) override; + virtual void dragEnterEvent(QDragEnterEvent*) override; + virtual void dragLeaveEvent(QDragLeaveEvent*) override; + virtual void dragMoveEvent(QDragMoveEvent*) override; + virtual void dropEvent(QDropEvent*) override; + virtual void moveEvent(QMoveEvent*) override; + virtual void paintEvent(QPaintEvent*) override; + virtual void resizeEvent(QResizeEvent*) override; + virtual void showEvent(QShowEvent*) override; + virtual void wheelEvent(QWheelEvent*) override; + virtual void closeEvent(QCloseEvent*) override; + virtual void changeEvent(QEvent*) override; + + void inputMethodEvent(QInputMethodEvent*) override; + QVariant inputMethodQuery(Qt::InputMethodQuery) const override; + +public: + Qt5Widget(Qt5Frame& rFrame, Qt::WindowFlags f = Qt::WindowFlags()); + + Qt5Frame& frame() const { return m_rFrame; } + void endExtTextInput(); + + static bool handleEvent(Qt5Frame&, const QWidget&, QEvent*); + // key events might be propagated further down => call base on false + static inline bool handleKeyReleaseEvent(Qt5Frame&, const QWidget&, QKeyEvent*); + // mouse events are always accepted + static inline void handleMousePressEvent(const Qt5Frame&, const QMouseEvent*); + static inline void handleMouseReleaseEvent(const Qt5Frame&, const QMouseEvent*); +}; + +bool Qt5Widget::handleKeyReleaseEvent(Qt5Frame& rFrame, const QWidget& rWidget, QKeyEvent* pEvent) +{ + return handleKeyEvent(rFrame, rWidget, pEvent, ButtonKeyState::Released); +} + +void Qt5Widget::handleMousePressEvent(const Qt5Frame& rFrame, const QMouseEvent* pEvent) +{ + handleMouseButtonEvent(rFrame, pEvent, ButtonKeyState::Pressed); +} + +void Qt5Widget::handleMouseReleaseEvent(const Qt5Frame& rFrame, const QMouseEvent* pEvent) +{ + handleMouseButtonEvent(rFrame, pEvent, ButtonKeyState::Released); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5XAccessible.hxx b/vcl/inc/qt5/Qt5XAccessible.hxx new file mode 100644 index 000000000..fe8e424e4 --- /dev/null +++ b/vcl/inc/qt5/Qt5XAccessible.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/. + */ + +#pragma once + +#include <vclpluginapi.h> + +#include <QtCore/QObject> + +#include <com/sun/star/accessibility/XAccessible.hpp> + +#include <vcl/window.hxx> + +class Qt5Frame; +class Qt5Widget; + +// Wrapper class to hold a css::accessibility::XAccessible object +// while being able to pass it as a QObject +class Qt5XAccessible : public QObject +{ + Q_OBJECT + +public: + Qt5XAccessible(css::uno::Reference<css::accessibility::XAccessible> xAccessible); + css::uno::Reference<css::accessibility::XAccessible> m_xAccessible; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/quartz/CGHelpers.hxx b/vcl/inc/quartz/CGHelpers.hxx new file mode 100644 index 000000000..cbd9a5e78 --- /dev/null +++ b/vcl/inc/quartz/CGHelpers.hxx @@ -0,0 +1,105 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_QUARTZ_CGHELPER_HXX +#define INCLUDED_VCL_INC_QUARTZ_CGHELPER_HXX + +#include <premac.h> +#include <CoreGraphics/CoreGraphics.h> +#include <postmac.h> + +#include <quartz/utils.h> + +class CGLayerHolder +{ +private: + CGLayerRef mpLayer; + + // Layer's scaling factor + float mfScale; + +public: + CGLayerHolder() + : mpLayer(nullptr) + , mfScale(1.0) + { + } + + CGLayerHolder(CGLayerRef pLayer, float fScale = 1.0) + : mpLayer(pLayer) + , mfScale(fScale) + { + } + + // Just the size of the layer in pixels + CGSize getSizePixels() const + { + CGSize aSize; + if (mpLayer) + { + aSize = CGLayerGetSize(mpLayer); + } + return aSize; + } + + // Size in points is size in pixels multiplied by the scaling factor + CGSize getSizePoints() const + { + CGSize aSize; + if (mpLayer) + { + const CGSize aLayerSize = getSizePixels(); + aSize.width = aLayerSize.width / mfScale; + aSize.height = aLayerSize.height / mfScale; + } + return aSize; + } + + CGLayerRef get() const { return mpLayer; } + + bool isSet() const { return mpLayer != nullptr; } + + void set(CGLayerRef const& pLayer) { mpLayer = pLayer; } + + float getScale() { return mfScale; } + + void setScale(float fScale) { mfScale = fScale; } +}; + +class CGContextHolder +{ +private: + CGContextRef mpContext; + +public: + CGContextHolder() + : mpContext(nullptr) + { + } + + CGContextHolder(CGContextRef pContext) + : mpContext(pContext) + { + } + + CGContextRef get() const { return mpContext; } + + bool isSet() const { return mpContext != nullptr; } + + void set(CGContextRef const& pContext) { mpContext = pContext; } + + void saveState() { CGContextSaveGState(mpContext); } + + void restoreState() { CGContextRestoreGState(mpContext); } +}; + +#endif // INCLUDED_VCL_INC_QUARTZ_CGHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/quartz/common.h b/vcl/inc/quartz/common.h new file mode 100644 index 000000000..003711198 --- /dev/null +++ b/vcl/inc/quartz/common.h @@ -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 . + */ + +#ifndef INCLUDED_VCL_INC_QUARTZ_COMMON_H +#define INCLUDED_VCL_INC_QUARTZ_COMMON_H + +#include <iostream> + +#include <premac.h> +#ifdef MACOSX +#include <ApplicationServices/ApplicationServices.h> +#else +#include <CoreGraphics/CoreGraphics.h> +#include <CoreText/CoreText.h> +#endif +#include <postmac.h> + +#include <sal/types.h> + +// CoreFoundation designers, in their wisdom, decided that CFRelease of NULL +// cause a Crash, yet few API can return NULL when asking for the creation +// of an object, which force us to paper the code with ugly if construct everywhere +// and open the door to very nasty crash on rare occasion +// this macro hide the mess +#define SafeCFRelease(a) do { if(a) { CFRelease(a); (a)=NULL; } } while(false) + +#define round_to_long(a) ((a) >= 0 ? ((long)((a) + 0.5)) : ((long)((a) - 0.5))) + +#include <vcl/salgtype.hxx> + +std::ostream &operator <<(std::ostream& s, CTFontRef pFont); + +#endif // INCLUDED_VCL_INC_QUARTZ_COMMON_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/quartz/ctfonts.hxx b/vcl/inc/quartz/ctfonts.hxx new file mode 100644 index 000000000..89cc55443 --- /dev/null +++ b/vcl/inc/quartz/ctfonts.hxx @@ -0,0 +1,31 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_QUARTZ_CTFONTS_HXX +#define INCLUDED_VCL_INC_QUARTZ_CTFONTS_HXX + +#include <quartz/salgdi.h> +#include <sallayout.hxx> + +SystemFontList* GetCoretextFontList(); +FontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef, bool* ); + +#endif // INCLUDED_VCL_INC_QUARTZ_CTFONTS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/quartz/salbmp.h b/vcl/inc/quartz/salbmp.h new file mode 100644 index 000000000..87929249f --- /dev/null +++ b/vcl/inc/quartz/salbmp.h @@ -0,0 +1,105 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_QUARTZ_SALBMP_H +#define INCLUDED_VCL_INC_QUARTZ_SALBMP_H + +#include <tools/gen.hxx> + +#include <vcl/BitmapBuffer.hxx> +#include <vcl/BitmapPalette.hxx> + +#include <quartz/salgdi.h> + +#include <salinst.hxx> +#include <salvd.hxx> +#include <salbmp.hxx> + +#include <memory> + + +struct BitmapBuffer; +class BitmapPalette; + +class QuartzSalBitmap : public SalBitmap +{ +public: + CGContextHolder maGraphicContext; + mutable CGImageRef mxCachedImage; + BitmapPalette maPalette; + std::shared_ptr<sal_uInt8> m_pUserBuffer; + std::shared_ptr<sal_uInt8> m_pContextBuffer; + sal_uInt16 mnBits; + int mnWidth; + int mnHeight; + sal_uInt32 mnBytesPerRow; + +public: + QuartzSalBitmap(); + virtual ~QuartzSalBitmap() override; + +public: + + // SalBitmap methods + bool Create( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal ) override; + bool Create( const SalBitmap& rSalBmp ) override; + bool Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics ) override; + 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; + + void Destroy() override; + + Size GetSize() const override; + sal_uInt16 GetBitCount() const override; + + BitmapBuffer *AcquireBuffer( BitmapAccessMode nMode ) override; + void ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) override; + + bool GetSystemData( BitmapSystemData& rData ) override; + + bool ScalingSupported() const override; + bool Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag ) override; + bool Replace( const Color& rSearchColor, const Color& rReplaceColor, sal_uInt8 nTol ) override; + +private: + // quartz helper + bool CreateContext(); + void DestroyContext(); + bool AllocateUserData(); + + void ConvertBitmapData( sal_uInt32 nWidth, sal_uInt32 nHeight, + sal_uInt16 nDestBits, sal_uInt32 nDestBytesPerRow, const BitmapPalette& rDestPalette, sal_uInt8* pDestData, + sal_uInt16 nSrcBits, sal_uInt32 nSrcBytesPerRow, const BitmapPalette& rSrcPalette, sal_uInt8* pSrcData ); + +public: + bool Create(CGLayerHolder const & rLayerHolder, int nBitCount, int nX, int nY, int nWidth, int nHeight, bool bFlipped); + +public: + CGImageRef CreateWithMask( const QuartzSalBitmap& rMask, int nX, int nY, int nWidth, int nHeight ) const; + CGImageRef CreateColorMask( int nX, int nY, int nWidth, int nHeight, Color nMaskColor ) const; + CGImageRef CreateCroppedImage( int nX, int nY, int nWidth, int nHeight ) const; + + void doDestroy(); +}; + +#endif // INCLUDED_VCL_INC_QUARTZ_SALBMP_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h new file mode 100644 index 000000000..2ac33fdbd --- /dev/null +++ b/vcl/inc/quartz/salgdi.h @@ -0,0 +1,425 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_QUARTZ_SALGDI_H +#define INCLUDED_VCL_INC_QUARTZ_SALGDI_H + +#include <vector> + +#include <basegfx/polygon/b2dpolypolygon.hxx> + +#include <premac.h> +#ifdef MACOSX +#include <ApplicationServices/ApplicationServices.h> +#include <osx/osxvcltypes.h> +#include <osx/salframe.h> +#else +#include <CoreGraphics/CoreGraphics.h> +#include <CoreText/CoreText.h> +#endif +#include <postmac.h> + +#include <vcl/fontcapabilities.hxx> +#include <vcl/metric.hxx> + + +#include <fontinstance.hxx> +#include <impfontmetricdata.hxx> +#include <PhysicalFontFace.hxx> +#include <salgdi.hxx> + +#include <quartz/salgdicommon.hxx> +#include <unordered_map> +#include <hb-ot.h> + +#include <quartz/CGHelpers.hxx> + +class AquaSalFrame; +class FontAttributes; +class CoreTextStyle; +class XorEmulation; + +// CoreText-specific physically available font face +class CoreTextFontFace : public PhysicalFontFace +{ +public: + CoreTextFontFace( const FontAttributes&, sal_IntPtr nFontID ); + virtual ~CoreTextFontFace() override; + + sal_IntPtr GetFontId() const override; + + int GetFontTable( uint32_t nTagCode, unsigned char* ) const; + int GetFontTable( const char pTagName[5], unsigned char* ) const; + + FontCharMapRef GetFontCharMap() const; + bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const; + bool HasChar( sal_uInt32 cChar ) const; + + rtl::Reference<LogicalFontInstance> CreateFontInstance(const FontSelectPattern&) const override; + +private: + const sal_IntPtr mnFontId; + mutable FontCharMapRef mxCharMap; + mutable vcl::FontCapabilities maFontCapabilities; + mutable bool mbFontCapabilitiesRead; +}; + +class CoreTextStyle final : public LogicalFontInstance +{ + friend rtl::Reference<LogicalFontInstance> CoreTextFontFace::CreateFontInstance(const FontSelectPattern&) const; + +public: + ~CoreTextStyle() override; + + void GetFontMetric( ImplFontMetricDataRef const & ); + bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const override; + + CFMutableDictionaryRef GetStyleDict( void ) const { return mpStyleDict; } + + /// <1.0: font is squeezed, >1.0 font is stretched, else 1.0 + float mfFontStretch; + /// text rotation in radian + float mfFontRotation; + /// faux bold - true, if font doesn't have proper bold variants + bool mbFauxBold; + +private: + explicit CoreTextStyle(const PhysicalFontFace&, const FontSelectPattern&); + + hb_font_t* ImplInitHbFont() override; + bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const override; + + /// CoreText text style object + CFMutableDictionaryRef mpStyleDict; +}; + +// TODO: move into cross-platform headers + +class SystemFontList +{ +public: + SystemFontList( void ); + ~SystemFontList( void ); + + bool Init( void ); + void AddFont( CoreTextFontFace* ); + + void AnnounceFonts( PhysicalFontCollection& ) const; + CoreTextFontFace* GetFontDataFromId( sal_IntPtr nFontId ) const; + +private: + CTFontCollectionRef mpCTFontCollection; + CFArrayRef mpCTFontArray; + + std::unordered_map<sal_IntPtr, rtl::Reference<CoreTextFontFace>> maFontContainer; +}; + +class AquaSalGraphics : public SalGraphics +{ + CGLayerHolder maLayer; // Quartz graphics layer + CGContextHolder maContextHolder; // Quartz drawing context + CGContextHolder maBGContextHolder; // Quartz drawing context for CGLayer + CGContextHolder maCSContextHolder; // Quartz drawing context considering the color space + + XorEmulation* mpXorEmulation; + int mnXorMode; // 0: off 1: on 2: invert only + int mnWidth; + int mnHeight; + int mnBitmapDepth; // zero unless bitmap + /// device resolution of this graphics + long mnRealDPIX; + long mnRealDPIY; + + /// path representing current clip region + CGMutablePathRef mxClipPath; + + /// Drawing colors + /// pen color RGBA + RGBAColor maLineColor; + /// brush color RGBA + RGBAColor maFillColor; + + // Device Font settings + rtl::Reference<CoreTextStyle> mpTextStyle[MAX_FALLBACK]; + RGBAColor maTextColor; + /// allows text to be rendered without antialiasing + bool mbNonAntialiasedText; + +#ifdef MACOSX + AquaSalFrame* mpFrame; +#endif + + // Graphics types + + /// is this a printer graphics + bool mbPrinter; + /// is this a virtual device graphics + bool mbVirDev; +#ifdef MACOSX + /// is this a window graphics + bool mbWindow; + +#else // IOS + + // mirror AquaSalVirtualDevice::mbForeignContext for SvpSalGraphics objects related to such + bool mbForeignContext; + +#endif + +public: + AquaSalGraphics(); + virtual ~AquaSalGraphics() override; + + bool IsPenVisible() const { return maLineColor.IsVisible(); } + bool IsBrushVisible() const { return maFillColor.IsVisible(); } + + void SetWindowGraphics( AquaSalFrame* pFrame ); + void SetPrinterGraphics( CGContextRef, long nRealDPIX, long nRealDPIY ); + void SetVirDevGraphics(CGLayerHolder const & rLayer, CGContextRef, int nBitDepth = 0); +#ifdef MACOSX + void initResolution( NSWindow* ); + void copyResolution( AquaSalGraphics& ); + void updateResolution(); + + bool IsWindowGraphics() const { return mbWindow; } + AquaSalFrame* getGraphicsFrame() const { return mpFrame; } + void setGraphicsFrame( AquaSalFrame* pFrame ) { mpFrame = pFrame; } +#endif + + void ImplDrawPixel( long nX, long nY, const RGBAColor& ); // helper to draw single pixels + + bool CheckContext(); + CGContextRef GetContext(); +#ifdef MACOSX + void UpdateWindow( NSRect& ); // delivered in NSView coordinates + void RefreshRect( const NSRect& ); +#else + void RefreshRect( const CGRect& ) {} +#endif + void RefreshRect(float lX, float lY, float lWidth, float lHeight); + + void SetState(); + void UnsetState(); + // InvalidateContext does an UnsetState and sets mrContext to 0 + void InvalidateContext(); + + virtual SalGraphicsImpl* GetImpl() const override; + + virtual bool setClipRegion( const vcl::Region& ) override; + + // draw --> LineColor and FillColor and RasterOp and ClipRegion + virtual void drawPixel( long nX, long nY ) override; + virtual void drawPixel( long nX, long nY, Color nColor ) 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::B2DHomMatrix& rObjectToDevice, + 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::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolygon&, + double fTransparency, + double rLineWidth, + const std::vector< double >* pStroke, // MM01 + basegfx::B2DLineJoin, + css::drawing::LineCap eLineCap, + double fMiterMinimumAngle, + bool bPixelSnapHairline) override; + virtual bool drawGradient( const tools::PolyPolygon&, const Gradient& ) override { return false; }; + + // CopyArea --> No RasterOp, but ClipRegion + virtual void copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, + long nSrcHeight, bool bWindowInvalidate ) override; + + // CopyBits and DrawBitmap --> RasterOp and ClipRegion + // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics + 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, + Color nMaskColor ) override; + + virtual std::shared_ptr<SalBitmap> getBitmap( long nX, long nY, long nWidth, long nHeight ) override; + virtual Color getPixel( long nX, long nY ) override; + + // invert --> ClipRegion (only Windows or VirDevs) + 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_uInt32 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; + + // native widget rendering methods that require mirroring +#ifdef MACOSX +protected: + 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, const Color& rBackgroundColor ) 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; + +public: +#endif + + // get device resolution + virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) override; + // get the depth of the device + virtual sal_uInt16 GetBitCount() const override; + // get the width of the device + virtual long GetGraphicsWidth() const override; + + // set the clip region to empty + virtual void ResetClipRegion() override; + + // set the line color to transparent (= don't draw lines) + virtual void SetLineColor() override; + // set the line color to a specific color + virtual void SetLineColor( Color nColor ) override; + // set the fill color to transparent (= don't fill) + virtual void SetFillColor() override; + // set the fill color to a specific color, shapes will be + // filled accordingly + virtual void SetFillColor( Color nColor ) override; + // enable/disable XOR drawing + virtual void SetXORMode( bool bSet, bool bInvertOnly ) override; + // set line color for raster operations + virtual void SetROPLineColor( SalROPColor nROPColor ) override; + // set fill color for raster operations + virtual void SetROPFillColor( SalROPColor nROPColor ) override; + // set the text color to a specific color + virtual void SetTextColor( Color nColor ) override; + // set the font + virtual void SetFont( LogicalFontInstance*, int nFallbackLevel ) override; + // get the current font's metrics + virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override; + // get the repertoire of the current font + virtual FontCharMapRef GetFontCharMap() const override; + virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override; + // graphics must fill supplied font list + virtual void GetDevFontList( PhysicalFontCollection* ) override; + // graphics must drop any cached font info + virtual void ClearDevFontCache() override; + virtual bool AddTempDevFont( PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override; + // CreateFontSubset: a method to get a subset of glyhps of a font + // inside a new valid font file + // returns TRUE if creation of subset was successful + // parameters: rToFile: contains an osl file URL to write the subset to + // pFont: describes from which font to create a subset + // pGlyphIDs: the glyph ids to be extracted + // pEncoding: the character code corresponding to each glyph + // pWidths: the advance widths of the corresponding glyphs (in PS font units) + // nGlyphs: the number of glyphs + // rInfo: additional outgoing information + // implementation note: encoding 0 with glyph id 0 should be added implicitly + // as "undefined character" + 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; + + // GetEmbedFontData: gets the font data for a font marked + // embeddable by GetDevFontList or NULL in case of error + // parameters: pFont: describes the font in question + // pDataLen: out parameter, contains the byte length of the returned buffer + virtual const void* GetEmbedFontData(const PhysicalFontFace*, long* pDataLen) override; + // frees the font data again + 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 std::unique_ptr<GenericSalLayout> + GetTextLayout(int nFallbackLevel) override; + virtual void DrawTextLayout( const GenericSalLayout& ) override; + virtual bool supportsOperation( OutDevSupportType ) const override; + virtual OUString getRenderBackendName() const override { return "aqua"; } + + virtual SystemGraphicsData + GetGraphicsData() const override; + +private: + // differences between VCL, Quartz and kHiThemeOrientation coordinate systems + // make some graphics seem to be vertically-mirrored from a VCL perspective + bool IsFlipped() const; + + void ApplyXorContext(); + void Pattern50Fill(); + UInt32 getState( ControlState nState ); + UInt32 getTrackState( ControlState nState ); + static bool GetRawFontData( const PhysicalFontFace* pFontData, + std::vector<unsigned char>& rBuffer, + bool* pJustCFF ); +}; + +// --- some trivial inlines + +#ifdef MACOSX + +inline void AquaSalGraphics::RefreshRect( const NSRect& rRect ) +{ + RefreshRect( rRect.origin.x, rRect.origin.y, rRect.size.width, rRect.size.height ); +} + +#endif + +#endif // INCLUDED_VCL_INC_QUARTZ_SALGDI_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/quartz/salgdicommon.hxx b/vcl/inc/quartz/salgdicommon.hxx new file mode 100644 index 000000000..71c40acdf --- /dev/null +++ b/vcl/inc/quartz/salgdicommon.hxx @@ -0,0 +1,111 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_QUARTZ_SALGDICOMMON_HXX +#define INCLUDED_VCL_INC_QUARTZ_SALGDICOMMON_HXX + +#include <iostream> + +#include <premac.h> +#ifdef IOS +#include <CoreGraphics/CoreGraphics.h> +#else +#include <ApplicationServices/ApplicationServices.h> +#endif +#include <postmac.h> + +#include <tools/color.hxx> +#include <vcl/salgtype.hxx> + +// abstracting quartz color instead of having to use a CGFloat[] array +class RGBAColor +{ +public: + RGBAColor( ::Color ); + RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha ); //NOTUSEDYET + const CGFloat* AsArray() const { return m_fRGBA; } + bool IsVisible() const { return m_fRGBA[3] > 0; } + void SetAlpha( float fAlpha ) { m_fRGBA[3] = fAlpha; } + + CGFloat GetRed() const { return m_fRGBA[0]; } + CGFloat GetGreen() const { return m_fRGBA[1]; } + CGFloat GetBlue() const { return m_fRGBA[2]; } + CGFloat GetAlpha() const { return m_fRGBA[3]; } +private: + CGFloat m_fRGBA[4]; // red, green, blue, alpha +}; + +inline RGBAColor::RGBAColor( ::Color nColor ) +{ + m_fRGBA[0] = nColor.GetRed() * (1.0/255); + m_fRGBA[1] = nColor.GetGreen() * (1.0/255); + m_fRGBA[2] = nColor.GetBlue() * (1.0/255); + m_fRGBA[3] = 1.0; // opaque +} + +inline RGBAColor::RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha ) +{ + m_fRGBA[0] = fRed; + m_fRGBA[1] = fGreen; + m_fRGBA[2] = fBlue; + m_fRGBA[3] = fAlpha; +} + +inline std::ostream &operator <<(std::ostream& s, const RGBAColor &aColor) +{ +#ifndef SAL_LOG_INFO + (void) aColor; +#else + s << "{" << aColor.GetRed() << "," << aColor.GetGreen() << "," << aColor.GetBlue() << "," << aColor.GetAlpha() << "}"; +#endif + return s; +} + +// XOR emulation suckage. +// See http://www.openoffice.org/marketing/ooocon2008/programme/wednesday_1401.pdf +// and https://bugs.freedesktop.org/show_bug.cgi?id=38844 . + +class XorEmulation +{ +public: + XorEmulation(); + ~XorEmulation(); + + void SetTarget( int nWidth, int nHeight, int nBitmapDepth, CGContextRef, CGLayerRef ); + bool UpdateTarget(); + void Enable() { m_bIsEnabled = true; } + void Disable() { m_bIsEnabled = false; } + bool IsEnabled() const { return m_bIsEnabled; } + CGContextRef GetTargetContext() const { return m_xTargetContext; } + CGContextRef GetMaskContext() const { return (m_bIsEnabled ? m_xMaskContext : nullptr); } + +private: + CGLayerRef m_xTargetLayer; + CGContextRef m_xTargetContext; + CGContextRef m_xMaskContext; + CGContextRef m_xTempContext; + sal_uLong* m_pMaskBuffer; + sal_uLong* m_pTempBuffer; + int m_nBufferLongs; + bool m_bIsEnabled; +}; + +#endif // INCLUDED_VCL_INC_QUARTZ_SALGDICOMMON_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/quartz/salvd.h b/vcl/inc/quartz/salvd.h new file mode 100644 index 000000000..9c2d70798 --- /dev/null +++ b/vcl/inc/quartz/salvd.h @@ -0,0 +1,73 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_QUARTZ_SALVD_H +#define INCLUDED_VCL_INC_QUARTZ_SALVD_H + +#include <premac.h> +#ifdef MACOSX +#include <ApplicationServices/ApplicationServices.h> +#else +#include <CoreGraphics/CoreGraphics.h> +#endif +#include <postmac.h> + +#include <quartz/salgdi.h> + +#include <salvd.hxx> + +class AquaSalGraphics; + +class AquaSalVirtualDevice : public SalVirtualDevice +{ +private: + bool mbGraphicsUsed; // is Graphics used + bool mbForeignContext; // is mxContext from outside VCL + CGContextHolder maBitmapContext; + int mnBitmapDepth; + CGLayerHolder maLayer; // Quartz layer + AquaSalGraphics* mpGraphics; // current VirDev graphics + + long mnWidth; + long mnHeight; + + void Destroy(); + +public: + AquaSalVirtualDevice( AquaSalGraphics* pGraphic, long &nDX, long &nDY, DeviceFormat eFormat, const SystemGraphicsData *pData ); + virtual ~AquaSalVirtualDevice() override; + + virtual SalGraphics* AcquireGraphics() override; + virtual void ReleaseGraphics( SalGraphics* pGraphics ) override; + virtual bool SetSize( long nNewDX, long nNewDY ) override; + + long GetWidth() const override + { + return mnWidth; + } + + long GetHeight() const override + { + return mnHeight; + } +}; + +#endif // INCLUDED_VCL_INC_QUARTZ_SALVD_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/quartz/utils.h b/vcl/inc/quartz/utils.h new file mode 100644 index 000000000..2452c151d --- /dev/null +++ b/vcl/inc/quartz/utils.h @@ -0,0 +1,50 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_QUARTZ_UTILS_H +#define INCLUDED_VCL_INC_QUARTZ_UTILS_H + +#include <iostream> + +#include <premac.h> +#include <CoreFoundation/CoreFoundation.h> +#include <Foundation/Foundation.h> +#ifdef MACOSX +#include <ApplicationServices/ApplicationServices.h> +#else +#include <CoreGraphics/CoreGraphics.h> +#endif +#include <postmac.h> + +#include <rtl/ustring.hxx> + +OUString GetOUString( CFStringRef ); +OUString GetOUString( const NSString* ); +CFStringRef CreateCFString( const OUString& ); +NSString* CreateNSString( const OUString& ); + +std::ostream &operator <<(std::ostream& s, const CGRect &rRect); +std::ostream &operator <<(std::ostream& s, const CGPoint &rPoint); +std::ostream &operator <<(std::ostream& s, const CGSize &rSize); +std::ostream &operator <<(std::ostream& s, CGColorRef pSize); +std::ostream &operator <<(std::ostream& s, const CGAffineTransform &aXform); + +#endif // INCLUDED_VCL_INC_QUARTZ_UTILS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/regband.hxx b/vcl/inc/regband.hxx new file mode 100644 index 000000000..c7b9e6119 --- /dev/null +++ b/vcl/inc/regband.hxx @@ -0,0 +1,129 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_REGBAND_HXX +#define INCLUDED_VCL_INC_REGBAND_HXX + +/* + +class ImplRegionBand + +This class handles one y-band of the region. In this band may contain one +or more separations in x-direction. The y-Band do not contain any +separation after creation. + +The separations are modified with basic clipping functions like Union and +Intersection - the Class will process the clipping for the actual band. + +*/ + +// element for the list with x-separations +struct ImplRegionBandSep +{ + ImplRegionBandSep* mpNextSep; + long mnXLeft; + long mnXRight; + bool mbRemoved; +}; + +enum class LineType { Ascending, Descending }; + +// element for the list with x-separations +struct ImplRegionBandPoint +{ + ImplRegionBandPoint* mpNextBandPoint; + long mnX; + long mnLineId; + bool mbEndPoint; + LineType meLineType; +}; + +class ImplRegionBand +{ +public: + ImplRegionBand* mpNextBand; // pointer to the next element of the list + ImplRegionBand* mpPrevBand; // pointer to the previous element of the list (only used temporarily) + ImplRegionBandSep* mpFirstSep; // root of the list with x-separations + ImplRegionBandPoint* mpFirstBandPoint; // root of the list with lines + long mnYTop; // actual boundary of the band + long mnYBottom; + + bool mbTouched : 1; + + // create y-band with boundaries + ImplRegionBand( long nYTop, long nYBottom ); + /** copy y-band with all data + @param theSourceBand + The new ImplRegionBand object will + be a copy of this band. + @param bIgnorePoints + When true (the default) the + band points pointed to by + mpFirstBandPoint are not copied. + When false they are copied. + You need the points when you are + planning to call ProcessPoints() + later on. + */ + ImplRegionBand( const ImplRegionBand & theSourceBand, + const bool bIgnorePoints = true); + ~ImplRegionBand(); + + long GetXLeftBoundary() const; + long GetXRightBoundary() const; + + // combine overlapping bands + void OptimizeBand(); + + // generate separations from lines and process + // union with existing separations + void ProcessPoints(); + // insert point in the list for later processing + bool InsertPoint( long nX, long nLineID, + bool bEndPoint, LineType eLineType ); + + void Union( long nXLeft, long nXRight ); + void Intersect( long nXLeft, long nXRight ); + void Exclude( long nXLeft, long nXRight ); + void XOr( long nXLeft, long nXRight ); + + void MoveX( long nHorzMove ); + void ScaleX( double fHorzScale ); + + bool IsInside( long nX ); + + bool IsEmpty() const { return ((!mpFirstSep) && (!mpFirstBandPoint)); } + + bool operator==( const ImplRegionBand& rRegionBand ) const; + + /** Split the called band at the given vertical coordinate. After the + split the called band will cover the upper part not including nY. + The new band will cover the lower part including nY. + @param nY + The band is split at this y coordinate. The new, lower band + will include this very value. + @return + Returns the new, lower band. + */ + ImplRegionBand* SplitBand (const sal_Int32 nY); +}; + +#endif // INCLUDED_VCL_INC_REGBAND_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/regionband.hxx b/vcl/inc/regionband.hxx new file mode 100644 index 000000000..a00726148 --- /dev/null +++ b/vcl/inc/regionband.hxx @@ -0,0 +1,82 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_VCL_INC_REGIONBAND_HXX +#define INCLUDED_VCL_INC_REGIONBAND_HXX + +#include <vcl/region.hxx> + +#include "regband.hxx" + +#ifdef DBG_UTIL +const char* ImplDbgTestRegionBand(const void*); +#endif + +class RegionBand +{ +private: + friend const char* ImplDbgTestRegionBand(const void*); + + ImplRegionBand* mpFirstBand; // root of the list with y-bands + ImplRegionBand* mpLastCheckedBand; + + void implReset(); + [[nodiscard]] bool CheckConsistency() const; + +public: + RegionBand(); + RegionBand(const RegionBand&); + RegionBand& operator=(const RegionBand&); + RegionBand(const tools::Rectangle&); + ~RegionBand(); + + bool operator==( const RegionBand& rRegionBand ) const; + + [[nodiscard]] bool load(SvStream& rIStrm); + void save(SvStream& rIStrm) const; + + bool isSingleRectangle() const; + ImplRegionBand* ImplGetFirstRegionBand() const { return mpFirstBand; } + void ImplAddMissingBands(const long nTop, const long nBottom); + void InsertBand(ImplRegionBand* pPreviousBand, ImplRegionBand* pBandToInsert); + void processPoints(); + void CreateBandRange(long nYTop, long nYBottom); + void InsertLine(const Point& rStartPt, const Point& rEndPt, long nLineId); + void InsertPoint(const Point &rPoint, long nLineID, bool bEndPoint, LineType eLineType); + bool OptimizeBandList(); + void Move(long nHorzMove, long nVertMove); + void Scale(double fScaleX, double fScaleY); + void InsertBands(long nTop, long nBottom); + static bool InsertSingleBand(ImplRegionBand* pBand, long nYBandPosition); + void Union(long nLeft, long nTop, long nRight, long nBottom); + void Intersect(long nLeft, long nTop, long nRight, long nBottom); + void Union(const RegionBand& rSource); + void Exclude(long nLeft, long nTop, long nRight, long nBottom); + void XOr(long nLeft, long nTop, long nRight, long nBottom); + void Intersect(const RegionBand& rSource); + bool Exclude(const RegionBand& rSource); + void XOr(const RegionBand& rSource); + tools::Rectangle GetBoundRect() const; + bool IsInside(const Point& rPoint) const; + sal_uInt32 getRectangleCount() const; // only users are Region::Intersect, Region::IsRectangle and PSWriter::ImplBmp + void GetRegionRectangles(RectangleVector& rTarget) const; +}; + +#endif // INCLUDED_VCL_INC_REGIONBAND_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salbmp.hxx b/vcl/inc/salbmp.hxx new file mode 100644 index 000000000..4244ae1a3 --- /dev/null +++ b/vcl/inc/salbmp.hxx @@ -0,0 +1,125 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SALBMP_HXX +#define INCLUDED_VCL_INC_SALBMP_HXX + +#include <tools/gen.hxx> +#include <tools/solar.h> +#include <vcl/checksum.hxx> +#include <vcl/BitmapAccessMode.hxx> +#include <vcl/BitmapBuffer.hxx> +#include <com/sun/star/rendering/XBitmapCanvas.hpp> + +struct BitmapBuffer; +class Color; +class SalGraphics; +class BitmapPalette; +struct BitmapSystemData; +enum class BmpScaleFlag; + +extern const sal_uLong nVCLRLut[ 6 ]; +extern const sal_uLong nVCLGLut[ 6 ]; +extern const sal_uLong nVCLBLut[ 6 ]; +extern const sal_uLong nVCLDitherLut[ 256 ]; +extern const sal_uLong nVCLLut[ 256 ]; + +class VCL_PLUGIN_PUBLIC SalBitmap +{ +public: + + SalBitmap() + : mnChecksum(0) + , mbChecksumValid(false) + { + } + + virtual ~SalBitmap(); + + virtual bool Create( const Size& rSize, + sal_uInt16 nBitCount, + const BitmapPalette& rPal ) = 0; + virtual bool Create( const SalBitmap& rSalBmp ) = 0; + virtual bool Create( const SalBitmap& rSalBmp, + SalGraphics* pGraphics ) = 0; + virtual bool Create( const SalBitmap& rSalBmp, + sal_uInt16 nNewBitCount ) = 0; + virtual bool Create( const css::uno::Reference< css::rendering::XBitmapCanvas >& rBitmapCanvas, + Size& rSize, + bool bMask = false ) = 0; + virtual void Destroy() = 0; + virtual Size GetSize() const = 0; + virtual sal_uInt16 GetBitCount() const = 0; + + virtual BitmapBuffer* AcquireBuffer( BitmapAccessMode nMode ) = 0; + virtual void ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) = 0; + virtual bool GetSystemData( BitmapSystemData& rData ) = 0; + + virtual bool ScalingSupported() const = 0; + virtual bool Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag ) = 0; + void DropScaledCache(); + + virtual bool Replace( const Color& rSearchColor, const Color& rReplaceColor, sal_uInt8 nTol ) = 0; + + virtual bool ConvertToGreyscale() + { + return false; + } + virtual bool InterpretAs8Bit() + { + return false; + } + + void GetChecksum(BitmapChecksum& rChecksum) const + { + updateChecksum(); + if (!mbChecksumValid) + rChecksum = 0; // back-compat + else + rChecksum = mnChecksum; + } + + void InvalidateChecksum() + { + mbChecksumValid = false; + } + +protected: + BitmapChecksum mnChecksum; + bool mbChecksumValid; + +protected: + virtual void updateChecksum() const; + // helper function to convert data in 1,2,4 bpp formats to a 8/24/32bpp format + enum class BitConvert + { + A8, + RGB, + BGR, + RGBA, + BGRA + }; + static std::unique_ptr< sal_uInt8[] > convertDataBitCount( const sal_uInt8* src, + int width, int height, int bitCount, int bytesPerRow, const BitmapPalette& palette, + BitConvert type ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/saldatabasic.hxx b/vcl/inc/saldatabasic.hxx new file mode 100644 index 000000000..859117188 --- /dev/null +++ b/vcl/inc/saldatabasic.hxx @@ -0,0 +1,67 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SALDATABASIC_HXX +#define INCLUDED_VCL_INC_SALDATABASIC_HXX + +#include <vcl/dllapi.h> + +#include "svdata.hxx" +#include "salinst.hxx" + +#ifdef IOS +#include "quartz/salgdi.h" +#endif + +namespace psp +{ + class PrinterInfoManager; +} + +class VCL_PLUGIN_PUBLIC SalData +{ +public: + SalInstance* m_pInstance; // pointer to instance +#ifndef IOS + psp::PrinterInfoManager* m_pPIManager; +#endif + + SalData(); + virtual ~SalData() COVERITY_NOEXCEPT_FALSE; +#ifdef IOS + SystemFontList* mpFontList; + CGColorSpaceRef mxRGBSpace; + CGColorSpaceRef mxGraySpace; + static void ensureThreadAutoreleasePool() {}; +#endif +}; + +inline void SetSalData( SalData* pData ) +{ + ImplGetSVData()->mpSalData = pData; +} + +inline SalData* GetSalData() +{ + return ImplGetSVData()->mpSalData; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx new file mode 100644 index 000000000..b83138e29 --- /dev/null +++ b/vcl/inc/salframe.hxx @@ -0,0 +1,311 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SALFRAME_HXX +#define INCLUDED_VCL_INC_SALFRAME_HXX + +#include "impdel.hxx" +#include "salwtype.hxx" +#include "salgeom.hxx" + +#include <vcl/help.hxx> +#include <o3tl/typed_flags_set.hxx> + +#include <vcl/window.hxx> + // complete vcl::Window for SalFrame::CallCallback under -fsanitize=function + +class AllSettings; +class SalGraphics; +class SalBitmap; +class SalMenu; + +struct SalFrameState; +struct SalInputContext; +struct SystemEnvData; + +// SalFrame types +enum class SalFrameToTop { + NONE = 0x00, + RestoreWhenMin = 0x01, + ForegroundTask = 0x02, + GrabFocus = 0x04, + GrabFocusOnly = 0x08 +}; +namespace o3tl { + template<> struct typed_flags<SalFrameToTop> : is_typed_flags<SalFrameToTop, 0x0f> {}; +}; + +namespace vcl { class KeyCode; } + +namespace weld +{ + class Window; +} + +enum class FloatWinPopupFlags; + +// SalFrame styles +enum class SalFrameStyleFlags +{ + NONE = 0x00000000, + DEFAULT = 0x00000001, + MOVEABLE = 0x00000002, + SIZEABLE = 0x00000004, + CLOSEABLE = 0x00000008, + // no shadow effect on Windows XP + NOSHADOW = 0x00000010, + // indicate tooltip windows, so they can always be topmost + TOOLTIP = 0x00000020, + // windows without windowmanager decoration, this typically only applies to floating windows + OWNERDRAWDECORATION = 0x00000040, + // dialogs + DIALOG = 0x00000080, + // the window containing the intro bitmap, aka splashscreen + INTRO = 0x00000100, + // partial fullscreen: fullscreen on one monitor of a multimonitor display + PARTIAL_FULLSCREEN = 0x00800000, + // system child window inside another SalFrame + SYSTEMCHILD = 0x08000000, + // plugged system child window + PLUG = 0x10000000, + // floating window + FLOAT = 0x20000000, + // toolwindows should be painted with a smaller decoration + TOOLWINDOW = 0x40000000, +}; + +namespace o3tl { + template<> struct typed_flags<SalFrameStyleFlags> : is_typed_flags<SalFrameStyleFlags, 0x788001ff> {}; +}; + +// Extended frame style (sal equivalent to extended WinBits) +typedef sal_uInt64 SalExtStyle; +#define SAL_FRAME_EXT_STYLE_DOCUMENT SalExtStyle(0x00000001) +#define SAL_FRAME_EXT_STYLE_DOCMODIFIED SalExtStyle(0x00000002) + +// Flags for SetPosSize +#define SAL_FRAME_POSSIZE_X (sal_uInt16(0x0001)) +#define SAL_FRAME_POSSIZE_Y (sal_uInt16(0x0002)) +#define SAL_FRAME_POSSIZE_WIDTH (sal_uInt16(0x0004)) +#define SAL_FRAME_POSSIZE_HEIGHT (sal_uInt16(0x0008)) + +struct SystemParentData; +struct ImplSVEvent; + +/// A SalFrame is a system window (e.g. an X11 window). +class VCL_PLUGIN_PUBLIC SalFrame + : public vcl::DeletionNotifier + , public SalGeometryProvider +{ +private: + // the VCL window corresponding to this frame + VclPtr<vcl::Window> m_pWindow; + SALFRAMEPROC m_pProc; + Link<bool, void> m_aModalHierarchyHdl; +protected: + mutable std::unique_ptr<weld::Window> m_xFrameWeld; +public: + SalFrame(); + virtual ~SalFrame() override; + + SalFrameGeometry maGeometry = {}; ///< absolute, unmirrored values + + // SalGeometryProvider + virtual long GetWidth() const override { return maGeometry.nWidth; } + virtual long GetHeight() const override { return maGeometry.nHeight; } + virtual bool IsOffScreen() const override { return false; } + + // SalGraphics or NULL, but two Graphics for all SalFrames + // must be returned + virtual SalGraphics* AcquireGraphics() = 0; + virtual void ReleaseGraphics( SalGraphics* pGraphics ) = 0; + + // Event must be destroyed, when Frame is destroyed + // When Event is called, SalInstance::Yield() must be returned + virtual bool PostEvent(std::unique_ptr<ImplSVEvent> pData) = 0; + + virtual void SetTitle( const OUString& rTitle ) = 0; + virtual void SetIcon( sal_uInt16 nIcon ) = 0; + virtual void SetRepresentedURL( const OUString& ); + virtual void SetMenu( SalMenu *pSalMenu ) = 0; + virtual void DrawMenuBar() = 0; + + virtual void SetExtendedFrameStyle( SalExtStyle nExtStyle ) = 0; + + // Before the window is visible, a resize event + // must be sent with the correct size + virtual void Show( bool bVisible, bool bNoActivate = false ) = 0; + + // Set ClientSize and Center the Window to the desktop + // and send/post a resize message + virtual void SetMinClientSize( long nWidth, long nHeight ) = 0; + virtual void SetMaxClientSize( long nWidth, long nHeight ) = 0; + virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags ) = 0; + virtual void GetClientSize( long& rWidth, long& rHeight ) = 0; + virtual void GetWorkArea( tools::Rectangle& rRect ) = 0; + virtual SalFrame* GetParent() const = 0; + // Note: x will be mirrored at parent if UI mirroring is active + SalFrameGeometry GetGeometry() const; + const SalFrameGeometry& GetUnmirroredGeometry() const { return maGeometry; } + + virtual void SetWindowState( const SalFrameState* pState ) = 0; + // return the absolute, unmirrored system frame state + // if this returns false the structure is uninitialised + [[nodiscard]] + virtual bool GetWindowState( SalFrameState* pState ) = 0; + virtual void ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ) = 0; + virtual void PositionByToolkit( const tools::Rectangle&, FloatWinPopupFlags ) {}; + + // Enable/Disable ScreenSaver, SystemAgents, ... + virtual void StartPresentation( bool bStart ) = 0; + // Show Window over all other Windows + virtual void SetAlwaysOnTop( bool bOnTop ) = 0; + + // Window to top and grab focus + virtual void ToTop( SalFrameToTop nFlags ) = 0; + + // grab focus to the main widget, can be no-op if the vclplug only uses one widget + virtual void GrabFocus() {} + + // this function can call with the same + // pointer style + virtual void SetPointer( PointerStyle ePointerStyle ) = 0; + virtual void CaptureMouse( bool bMouse ) = 0; + virtual void SetPointerPos( long nX, long nY ) = 0; + + // flush output buffer + virtual void Flush() = 0; + virtual void Flush( const tools::Rectangle& ); + + virtual void SetInputContext( SalInputContext* pContext ) = 0; + virtual void EndExtTextInput( EndExtTextInputFlags nFlags ) = 0; + + virtual OUString GetKeyName( sal_uInt16 nKeyCode ) = 0; + + // returns in 'rKeyCode' the single keycode that translates to the given unicode when using a keyboard layout of language 'aLangType' + // returns false if no mapping exists or function not supported + // this is required for advanced menu support + virtual bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, vcl::KeyCode& rKeyCode ) = 0; + + // returns the input language used for the last key stroke + // may be LANGUAGE_DONTKNOW if not supported by the OS + virtual LanguageType GetInputLanguage() = 0; + + virtual void UpdateSettings( AllSettings& rSettings ) = 0; + + virtual void Beep() = 0; + + // returns system data (most prominent: window handle) + virtual const SystemEnvData* + GetSystemData() const = 0; + + // get current modifier, button mask and mouse position + struct SalPointerState + { + sal_uLong mnState; + Point maPos; // in frame coordinates + }; + + virtual SalPointerState GetPointerState() = 0; + + virtual KeyIndicatorState GetIndicatorState() = 0; + + virtual void SimulateKeyPress( sal_uInt16 nKeyCode ) = 0; + + // set new parent window + virtual void SetParent( SalFrame* pNewParent ) = 0; + // reparent window to act as a plugin; implementation + // may choose to use a new system window internally + // return false to indicate failure + virtual bool SetPluginParent( SystemParentData* pNewParent ) = 0; + + // move the frame to a new screen + virtual void SetScreenNumber( unsigned int nScreen ) = 0; + + virtual void SetApplicationID( const OUString &rApplicationID) = 0; + + // shaped system windows + // set clip region to none (-> rectangular windows, normal state) + virtual void ResetClipRegion() = 0; + // start setting the clipregion consisting of nRects rectangles + virtual void BeginSetClipRegion( sal_uInt32 nRects ) = 0; + // add a rectangle to the clip region + virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) = 0; + // done setting up the clipregion + virtual void EndSetClipRegion() = 0; + + virtual void SetModal(bool /*bModal*/) + { + } + + virtual bool GetModal() const + { + return false; + } + + // return true to indicate tooltips are shown natively, false otherwise + virtual bool ShowTooltip(const OUString& /*rHelpText*/, const tools::Rectangle& /*rHelpArea*/) + { + return false; + } + + // return !0 to indicate popovers are shown natively, 0 otherwise + virtual void* ShowPopover(const OUString& /*rHelpText*/, vcl::Window* /*pParent*/, const tools::Rectangle& /*rHelpArea*/, QuickHelpFlags /*nFlags*/) + { + return nullptr; + } + + // return true to indicate popovers are shown natively, false otherwise + virtual bool UpdatePopover(void* /*nId*/, const OUString& /*rHelpText*/, vcl::Window* /*pParent*/, const tools::Rectangle& /*rHelpArea*/) + { + return false; + } + + // return true to indicate popovers are shown natively, false otherwise + virtual bool HidePopover(void* /*nId*/) + { + return false; + } + + virtual weld::Window* GetFrameWeld() const; + + // Callbacks (independent part in vcl/source/window/winproc.cxx) + // for default message handling return 0 + void SetCallback( vcl::Window* pWindow, SALFRAMEPROC pProc ); + + // returns the instance set + vcl::Window* GetWindow() const { return m_pWindow; } + + void SetModalHierarchyHdl(const Link<bool, void>& rLink) { m_aModalHierarchyHdl = rLink; } + void NotifyModalHierarchy(bool bModal) { m_aModalHierarchyHdl.Call(bModal); } + + // Call the callback set; this sometimes necessary for implementation classes + // that should not know more than necessary about the SalFrame implementation + // (e.g. input methods, printer update handlers). + bool CallCallback( SalEvent nEvent, const void* pEvent ) const + { return m_pProc && m_pProc( m_pWindow, nEvent, pEvent ); } +}; + +#ifdef _WIN32 +bool HasAtHook(); +#endif + +#endif // INCLUDED_VCL_INC_SALFRAME_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx new file mode 100644 index 000000000..8d8e4c96d --- /dev/null +++ b/vcl/inc/salgdi.hxx @@ -0,0 +1,638 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SALGDI_HXX +#define INCLUDED_VCL_INC_SALGDI_HXX + +#include <vcl/outdev.hxx> + +#include "impfontmetricdata.hxx" +#include "salgdiimpl.hxx" +#include "sallayout.hxx" +#include "SalGradient.hxx" +#include <basegfx/matrix/b2dhommatrix.hxx> +#include "WidgetDrawInterface.hxx" + +#include <config_cairo_canvas.h> + +#include <map> +#include <vector> + +class PhysicalFontCollection; +class SalBitmap; +class FontSelectPattern; +class FontAttributes; +class PhysicalFontFace; +class SalLayout; +class ImplLayoutArgs; +namespace tools { class Rectangle; } +class FontSubsetInfo; +class OpenGLContext; +class OutputDevice; +class FreetypeFont; +struct SystemGraphicsData; + +#if ENABLE_CAIRO_CANVAS +struct SystemFontData; +#endif // ENABLE_CAIRO_CANVAS + +namespace basegfx { + class B2DVector; + class B2DPolygon; + class B2DPolyPolygon; +} + +typedef sal_Unicode sal_Ucs; // TODO: use sal_UCS4 instead of sal_Unicode +typedef std::map< sal_Ucs, sal_uInt32 > Ucs2UIntMap; + +// note: if you add any new methods to class SalGraphics using coordinates +// make sure they have a corresponding protected pure virtual method +// which has to be implemented by the platform dependent part. +// Add a method that performs coordinate mirroring if required, (see +// existing methods as sample) and then calls the equivalent pure method. + +// note: all positions are in pixel and relative to +// the top/left-position of the virtual output area + +class VCL_PLUGIN_PUBLIC SalGraphics : protected vcl::WidgetDrawInterface +{ +public: + SalGraphics(); + ~SalGraphics() COVERITY_NOEXCEPT_FALSE override; + + virtual SalGraphicsImpl* GetImpl() const = 0; + + /// Check that our mpImpl is OpenGL and return the context, otherwise NULL. + rtl::Reference<OpenGLContext> GetOpenGLContext() const; + + void setAntiAliasB2DDraw(bool bNew) { m_bAntiAliasB2DDraw = bNew; } + bool getAntiAliasB2DDraw() const { return m_bAntiAliasB2DDraw; } + + // public SalGraphics methods, the interface to the independent vcl part + + // get device resolution + virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) = 0; + + // get the depth of the device + virtual sal_uInt16 GetBitCount() const = 0; + + // get the width of the device + virtual long GetGraphicsWidth() const = 0; + + // set the clip region to empty + virtual void ResetClipRegion() = 0; + + // set the line color to transparent (= don't draw lines) + + virtual void SetLineColor() = 0; + + // set the line color to a specific color + virtual void SetLineColor( Color nColor ) = 0; + + // set the fill color to transparent (= don't fill) + virtual void SetFillColor() = 0; + + // set the fill color to a specific color, shapes will be + // filled accordingly + virtual void SetFillColor( Color nColor ) = 0; + + // enable/disable XOR drawing + virtual void SetXORMode( bool bSet, bool bInvertOnly ) = 0; + + // set line color for raster operations + virtual void SetROPLineColor( SalROPColor nROPColor ) = 0; + + // set fill color for raster operations + virtual void SetROPFillColor( SalROPColor nROPColor ) = 0; + + // set the text color to a specific color + virtual void SetTextColor( Color nColor ) = 0; + + // set the font + virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) = 0; + + // release the fonts + void ReleaseFonts() { SetFont( nullptr, 0 ); } + + // get the current font's metrics + virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) = 0; + + // get the repertoire of the current font + virtual FontCharMapRef GetFontCharMap() const = 0; + + // get the layout capabilities of the current font + virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const = 0; + + // graphics must fill supplied font list + virtual void GetDevFontList( PhysicalFontCollection* ) = 0; + + // graphics must drop any cached font info + virtual void ClearDevFontCache() = 0; + + virtual bool AddTempDevFont( + PhysicalFontCollection*, + const OUString& rFileURL, + const OUString& rFontName ) = 0; + + // CreateFontSubset: a method to get a subset of glyhps of a font + // inside a new valid font file + // returns true if creation of subset was successful + // parameters: rToFile: contains an osl file URL to write the subset to + // pFont: describes from which font to create a subset + // pGlyphIDs: the glyph ids to be extracted + // pEncoding: the character code corresponding to each glyph + // pWidths: the advance widths of the corresponding glyphs (in PS font units) + // nGlyphs: the number of glyphs + // rInfo: additional outgoing information + // implementation note: encoding 0 with glyph id 0 should be added implicitly + // as "undefined character" + virtual bool CreateFontSubset( + const OUString& rToFile, + const PhysicalFontFace* pFont, + const sal_GlyphId* pGlyphIDs, + const sal_uInt8* pEncoding, + sal_Int32* pWidths, + int nGlyphs, + FontSubsetInfo& rInfo ) = 0; + + // GetEmbedFontData: gets the font data for a font marked + // embeddable by GetDevFontList or NULL in case of error + // parameters: pFont: describes the font in question + // pDataLen: out parameter, contains the byte length of the returned buffer + virtual const void* GetEmbedFontData(const PhysicalFontFace* pFont, long* pDataLen) = 0; + + // free the font data again + virtual void FreeEmbedFontData( const void* pData, long nDataLen ) = 0; + + // get the same widths as in CreateFontSubset + // in case of an embeddable font also fill the mapping + // between unicode and glyph id + // leave widths vector and mapping untouched in case of failure + virtual void GetGlyphWidths( + const PhysicalFontFace* pFont, + bool bVertical, + std::vector< sal_Int32 >& rWidths, + Ucs2UIntMap& rUnicodeEnc ) = 0; + + virtual std::unique_ptr<GenericSalLayout> + GetTextLayout(int nFallbackLevel) = 0; + virtual void DrawTextLayout( const GenericSalLayout& ) = 0; + + virtual bool supportsOperation( OutDevSupportType ) const = 0; + + // mirroring specifics + SalLayoutFlags GetLayout() const { return m_nLayout; } + void SetLayout( SalLayoutFlags aLayout ) { m_nLayout = aLayout;} + + void mirror( long& nX, const OutputDevice *pOutDev ) const; + // only called mirror2 to avoid ambiguity + [[nodiscard]] + long mirror2( long nX, const OutputDevice *pOutDev ) const; + void mirror( long& nX, long nWidth, const OutputDevice *pOutDev, bool bBack = false ) const; + bool mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoint *pPtAry2, const OutputDevice *pOutDev ) const; + void mirror( tools::Rectangle& rRect, const OutputDevice*, bool bBack = false ) const; + void mirror( vcl::Region& rRgn, const OutputDevice *pOutDev ) const; + void mirror( ImplControlValue&, const OutputDevice* ) const; + basegfx::B2DPolyPolygon mirror( const basegfx::B2DPolyPolygon& i_rPoly, const OutputDevice *pOutDev ) const; + const basegfx::B2DHomMatrix& getMirror( const OutputDevice *pOutDev ) const; + + // non virtual methods; these do possible coordinate mirroring and + // then delegate to protected virtual methods + bool SetClipRegion( const vcl::Region&, const OutputDevice *pOutDev ); + + // draw --> LineColor and FillColor and RasterOp and ClipRegion + void DrawPixel( long nX, long nY, const OutputDevice *pOutDev ); + void DrawPixel( long nX, long nY, Color nColor, const OutputDevice *pOutDev ); + + void DrawLine( long nX1, long nY1, long nX2, long nY2, const OutputDevice *pOutDev ); + + void DrawRect( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev ); + + void DrawPolyLine( sal_uInt32 nPoints, SalPoint const * pPtAry, const OutputDevice *pOutDev ); + + void DrawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry, const OutputDevice *pOutDev ); + + void DrawPolyPolygon( + sal_uInt32 nPoly, + const sal_uInt32* pPoints, + PCONSTSALPOINT* pPtAry, + const OutputDevice *pOutDev ); + + bool DrawPolyPolygon( + const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolyPolygon &i_rPolyPolygon, + double i_fTransparency, + const OutputDevice *i_pOutDev); + + bool DrawPolyLine( + const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolygon& i_rPolygon, + double i_fTransparency, + double i_fLineWidth, + const std::vector< double >* i_pStroke, // MM01 + basegfx::B2DLineJoin i_eLineJoin, + css::drawing::LineCap i_eLineCap, + double i_fMiterMinimumAngle, + bool bPixelSnapHairline, + const OutputDevice* i_pOutDev); + + bool DrawPolyLineBezier( + sal_uInt32 nPoints, + const SalPoint* pPtAry, + const PolyFlags* pFlgAry, + const OutputDevice *pOutDev ); + + bool DrawPolygonBezier( + sal_uInt32 nPoints, + const SalPoint* pPtAry, + const PolyFlags* pFlgAry, + const OutputDevice *pOutDev ); + + bool DrawPolyPolygonBezier( + sal_uInt32 nPoly, + const sal_uInt32* pPoints, + const SalPoint* const* pPtAry, + const PolyFlags* const* pFlgAry, + const OutputDevice *pOutDev ); + + bool DrawGradient( + const tools::PolyPolygon& rPolyPoly, + const Gradient& rGradient ); + + bool DrawGradient(basegfx::B2DPolyPolygon const & rPolyPolygon, + SalGradient const & rGradient); + + // CopyArea --> No RasterOp, but ClipRegion + void CopyArea( + long nDestX, long nDestY, + long nSrcX, long nSrcY, + long nSrcWidth, long nSrcHeight, + const OutputDevice *pOutDev ); + + // CopyBits and DrawBitmap --> RasterOp and ClipRegion + // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics + void CopyBits( + const SalTwoRect& rPosAry, + SalGraphics* pSrcGraphics, + const OutputDevice *pOutDev, + const OutputDevice *pSrcOutDev ); + + void DrawBitmap( + const SalTwoRect& rPosAry, + const SalBitmap& rSalBitmap, + const OutputDevice *pOutDev ); + + void DrawBitmap( + const SalTwoRect& rPosAry, + const SalBitmap& rSalBitmap, + const SalBitmap& rTransparentBitmap, + const OutputDevice *pOutDev ); + + void DrawMask( + const SalTwoRect& rPosAry, + const SalBitmap& rSalBitmap, + Color nMaskColor, + const OutputDevice *pOutDev ); + + std::shared_ptr<SalBitmap> GetBitmap( + long nX, long nY, + long nWidth, long nHeight, + const OutputDevice *pOutDev ); + + Color GetPixel( + long nX, long nY, + const OutputDevice *pOutDev ); + + // invert --> ClipRegion (only Windows) + void Invert( + long nX, long nY, + long nWidth, long nHeight, + SalInvert nFlags, + const OutputDevice *pOutDev ); + + void Invert( + sal_uInt32 nPoints, + const SalPoint* pPtAry, + SalInvert nFlags, + const OutputDevice *pOutDev ); + + bool DrawEPS( + long nX, long nY, + long nWidth, long nHeight, + void* pPtr, + sal_uInt32 nSize, + const OutputDevice *pOutDev ); + + // native widget rendering functions + + /** + * @see WidgetDrawInterface::isNativeControlSupported + */ + inline bool IsNativeControlSupported(ControlType, ControlPart); + + /** + * @see WidgetDrawInterface::hitTestNativeControl + */ + bool HitTestNativeScrollbar( + ControlPart nPart, + const tools::Rectangle& rControlRegion, + const Point& aPos, + bool& rIsInside, + const OutputDevice *pOutDev ); + + /** + * @see WidgetDrawInterface::drawNativeControl + */ + bool DrawNativeControl( + ControlType nType, + ControlPart nPart, + const tools::Rectangle& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + const OUString& aCaption, + const OutputDevice *pOutDev, + const Color& rBackgroundColor = COL_AUTO ); + + /** + * @see WidgetDrawInterface::getNativeControlRegion + */ + bool GetNativeControlRegion( + ControlType nType, + ControlPart nPart, + const tools::Rectangle& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + tools::Rectangle &rNativeBoundingRegion, + tools::Rectangle &rNativeContentRegion, + const OutputDevice *pOutDev ); + + /** + * @see WidgetDrawInterface::updateSettings + */ + inline bool UpdateSettings(AllSettings&); + + bool BlendBitmap( + const SalTwoRect& rPosAry, + const SalBitmap& rSalBitmap, + const OutputDevice *pOutDev ); + + bool BlendAlphaBitmap( + const SalTwoRect& rPosAry, + const SalBitmap& rSalSrcBitmap, + const SalBitmap& rSalMaskBitmap, + const SalBitmap& rSalAlphaBitmap, + const OutputDevice *pOutDev ); + + bool DrawAlphaBitmap( + const SalTwoRect&, + const SalBitmap& rSourceBitmap, + const SalBitmap& rAlphaBitmap, + const OutputDevice *pOutDev ); + + bool DrawTransformedBitmap( + const basegfx::B2DPoint& rNull, + const basegfx::B2DPoint& rX, + const basegfx::B2DPoint& rY, + const SalBitmap& rSourceBitmap, + const SalBitmap* pAlphaBitmap, + const OutputDevice* pOutDev ); + + bool DrawAlphaRect( + long nX, long nY, + long nWidth, long nHeight, + sal_uInt8 nTransparency, + const OutputDevice *pOutDev ); + + virtual OUString getRenderBackendName() const; + + virtual SystemGraphicsData GetGraphicsData() const = 0; + +#if ENABLE_CAIRO_CANVAS + + /// Check whether cairo will work + virtual bool SupportsCairo() const = 0; + /// Create Surface from given cairo surface + virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const = 0; + /// Create surface with given dimensions + virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const = 0; + /// Create Surface for given bitmap data + virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice, const BitmapSystemData& rData, const Size& rSize) const = 0; + virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const = 0; + + virtual SystemFontData GetSysFontData( int nFallbacklevel ) const = 0; + +#endif // ENABLE_CAIRO_CANVAS + +protected: + virtual bool setClipRegion( const vcl::Region& ) = 0; + + // draw --> LineColor and FillColor and RasterOp and ClipRegion + virtual void drawPixel( long nX, long nY ) = 0; + virtual void drawPixel( long nX, long nY, Color nColor ) = 0; + + virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ) = 0; + + virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) = 0; + + virtual void drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) = 0; + + virtual void drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) = 0; + + virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ) = 0; + + virtual bool drawPolyPolygon( + const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolyPolygon&, + double fTransparency) = 0; + + virtual bool drawPolyLine( + const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolygon&, + double fTransparency, + double fLineWidth, + const std::vector< double >* pStroke, // MM01 + basegfx::B2DLineJoin, + css::drawing::LineCap, + double fMiterMinimumAngle, + bool bPixelSnapHairline) = 0; + + virtual bool drawPolyLineBezier( + sal_uInt32 nPoints, + const SalPoint* pPtAry, + const PolyFlags* pFlgAry ) = 0; + + virtual bool drawPolygonBezier( + sal_uInt32 nPoints, + const SalPoint* pPtAry, + const PolyFlags* pFlgAry ) = 0; + + virtual bool drawPolyPolygonBezier( + sal_uInt32 nPoly, + const sal_uInt32* pPoints, + const SalPoint* const* pPtAry, + const PolyFlags* const* pFlgAry ) = 0; + + virtual bool drawGradient( + const tools::PolyPolygon& rPolyPoly, + const Gradient& rGradient ) = 0; + + virtual bool implDrawGradient(basegfx::B2DPolyPolygon const & /*rPolyPolygon*/, + SalGradient const & /*rGradient*/) + { + return false; + } + + // CopyArea --> No RasterOp, but ClipRegion + virtual void copyArea( + long nDestX, long nDestY, + long nSrcX, long nSrcY, + long nSrcWidth, long nSrcHeight, + bool bWindowInvalidate ) = 0; + + // CopyBits and DrawBitmap --> RasterOp and ClipRegion + // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics + virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) = 0; + + virtual void drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) = 0; + + virtual void drawBitmap( + const SalTwoRect& rPosAry, + const SalBitmap& rSalBitmap, + const SalBitmap& rMaskBitmap ) = 0; + + virtual void drawMask( + const SalTwoRect& rPosAry, + const SalBitmap& rSalBitmap, + Color nMaskColor ) = 0; + + virtual std::shared_ptr<SalBitmap> getBitmap( long nX, long nY, long nWidth, long nHeight ) = 0; + + virtual Color getPixel( long nX, long nY ) = 0; + + // invert --> ClipRegion (only Windows or VirDevs) + virtual void invert( + long nX, long nY, + long nWidth, long nHeight, + SalInvert nFlags) = 0; + + virtual void invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags ) = 0; + + virtual bool drawEPS( + long nX, long nY, + long nWidth, long nHeight, + void* pPtr, + sal_uInt32 nSize ) = 0; + + /** Blend the bitmap with the current buffer */ + virtual bool blendBitmap( + const SalTwoRect&, + const SalBitmap& rBitmap ) = 0; + + /** Draw the bitmap by blending using the mask and alpha channel */ + virtual bool blendAlphaBitmap( + const SalTwoRect&, + const SalBitmap& rSrcBitmap, + const SalBitmap& rMaskBitmap, + const SalBitmap& rAlphaBitmap ) = 0; + + /** Render bitmap with alpha channel + + @param rSourceBitmap + Source bitmap to blit + + @param rAlphaBitmap + Alpha channel to use for blitting + + @return true, if the operation succeeded, and false + otherwise. In this case, clients should try to emulate alpha + compositing themselves + */ + virtual bool drawAlphaBitmap( + const SalTwoRect&, + const SalBitmap& rSourceBitmap, + const SalBitmap& rAlphaBitmap ) = 0; + + /** draw transformed bitmap (maybe with alpha) where Null, X, Y define the coordinate system */ + virtual bool drawTransformedBitmap( + const basegfx::B2DPoint& rNull, + const basegfx::B2DPoint& rX, + const basegfx::B2DPoint& rY, + const SalBitmap& rSourceBitmap, + const SalBitmap* pAlphaBitmap) = 0; + + /** Render solid rectangle with given transparency + * + * @param nX Top left coordinate of rectangle + * @param nY Bottom right coordinate of rectangle + * @param nWidth Width of rectangle + * @param nHeight Height of rectangle + * @param nTransparency Transparency value (0-255) to use. 0 blits and opaque, 255 a + * fully transparent rectangle + * @returns true if successfully drawn, false if not able to draw rectangle + */ + virtual bool drawAlphaRect( + long nX, long nY, + long nWidth, long nHeight, + sal_uInt8 nTransparency ) = 0; + +private: + SalLayoutFlags m_nLayout; //< 0: mirroring off, 1: mirror x-axis + + // for buffering the Mirror-Matrix, see ::getMirror + basegfx::B2DHomMatrix m_aLastMirror; + long m_aLastMirrorW; + +protected: + /// flags which hold the SetAntialiasing() value from OutputDevice + bool m_bAntiAliasB2DDraw : 1; + + inline long GetDeviceWidth(const OutputDevice* pOutDev) const; + + /** + * Handle damage done by drawing with a widget draw override + * + * If a m_pWidgetDraw is set and successfully draws using drawNativeControl, + * this function is called to handle the damage done to the graphics buffer. + * + * @param rDamagedRegion the region damaged by drawNativeControl. + **/ + virtual inline void handleDamage(const tools::Rectangle& rDamagedRegion); + + // native controls + bool initWidgetDrawBackends(bool bForce = false); + + std::unique_ptr<vcl::WidgetDrawInterface> m_pWidgetDraw; + vcl::WidgetDrawInterface* forWidget() { return m_pWidgetDraw ? m_pWidgetDraw.get() : this; } +}; + +bool SalGraphics::IsNativeControlSupported(ControlType eType, ControlPart ePart) +{ + return forWidget()->isNativeControlSupported(eType, ePart); +} + +bool SalGraphics::UpdateSettings(AllSettings& rSettings) +{ + return forWidget()->updateSettings(rSettings); +} + +void SalGraphics::handleDamage(const tools::Rectangle&) {} + +#endif // INCLUDED_VCL_INC_SALGDI_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx new file mode 100644 index 000000000..0e62669d6 --- /dev/null +++ b/vcl/inc/salgdiimpl.hxx @@ -0,0 +1,211 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SALGDIIMPL_HXX +#define INCLUDED_VCL_INC_SALGDIIMPL_HXX + +#include <vcl/dllapi.h> + +#include <tools/color.hxx> +#include <tools/poly.hxx> + +#include <vcl/salgtype.hxx> +#include <vcl/region.hxx> +#include <vcl/vclenum.hxx> + +#include <com/sun/star/drawing/LineCap.hpp> + +class SalGraphics; +class SalBitmap; +class SalFrame; +class Gradient; +class OpenGLContext; +class SalVirtualDevice; + +class VCL_PLUGIN_PUBLIC SalGraphicsImpl +{ +public: + + virtual ~SalGraphicsImpl(); + + virtual void Init() = 0; + + virtual void DeInit() {} + + virtual void freeResources() = 0; + + virtual OUString getRenderBackendName() const = 0; + + virtual bool setClipRegion( const vcl::Region& ) = 0; + // + // get the depth of the device + virtual sal_uInt16 GetBitCount() const = 0; + + // get the width of the device + virtual long GetGraphicsWidth() const = 0; + + // set the clip region to empty + virtual void ResetClipRegion() = 0; + + // set the line color to transparent (= don't draw lines) + + virtual void SetLineColor() = 0; + + // set the line color to a specific color + virtual void SetLineColor( Color nColor ) = 0; + + // set the fill color to transparent (= don't fill) + virtual void SetFillColor() = 0; + + // set the fill color to a specific color, shapes will be + // filled accordingly + virtual void SetFillColor( Color nColor ) = 0; + + // enable/disable XOR drawing + virtual void SetXORMode( bool bSet, bool bInvertOnly ) = 0; + + // set line color for raster operations + virtual void SetROPLineColor( SalROPColor nROPColor ) = 0; + + // set fill color for raster operations + virtual void SetROPFillColor( SalROPColor nROPColor ) = 0; + + // draw --> LineColor and FillColor and RasterOp and ClipRegion + virtual void drawPixel( long nX, long nY ) = 0; + virtual void drawPixel( long nX, long nY, Color nColor ) = 0; + + virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ) = 0; + + virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) = 0; + + virtual void drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) = 0; + + virtual void drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) = 0; + + virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ) = 0; + + virtual bool drawPolyPolygon( + const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolyPolygon&, + double fTransparency) = 0; + + virtual bool drawPolyLine( + const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolygon&, + double fTransparency, + double fLineWidth, + const std::vector< double >* pStroke, // MM01 + basegfx::B2DLineJoin, + css::drawing::LineCap, + double fMiterMinimumAngle, + bool bPixelSnapHairline) = 0; + + virtual bool drawPolyLineBezier( + sal_uInt32 nPoints, + const SalPoint* pPtAry, + const PolyFlags* pFlgAry ) = 0; + + virtual bool drawPolygonBezier( + sal_uInt32 nPoints, + const SalPoint* pPtAry, + const PolyFlags* pFlgAry ) = 0; + + virtual bool drawPolyPolygonBezier( + sal_uInt32 nPoly, + const sal_uInt32* pPoints, + const SalPoint* const* pPtAry, + const PolyFlags* const* pFlgAry ) = 0; + + // CopyArea --> No RasterOp, but ClipRegion + virtual void copyArea( + long nDestX, long nDestY, + long nSrcX, long nSrcY, + long nSrcWidth, long nSrcHeight, + bool bWindowInvalidate ) = 0; + + // CopyBits and DrawBitmap --> RasterOp and ClipRegion + // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics + virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) = 0; + + virtual void drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) = 0; + + virtual void drawBitmap( + const SalTwoRect& rPosAry, + const SalBitmap& rSalBitmap, + const SalBitmap& rMaskBitmap ) = 0; + + virtual void drawMask( + const SalTwoRect& rPosAry, + const SalBitmap& rSalBitmap, + Color nMaskColor ) = 0; + + virtual std::shared_ptr<SalBitmap> getBitmap( long nX, long nY, long nWidth, long nHeight ) = 0; + + virtual Color getPixel( long nX, long nY ) = 0; + + // invert --> ClipRegion (only Windows or VirDevs) + virtual void invert( + long nX, long nY, + long nWidth, long nHeight, + SalInvert nFlags) = 0; + + virtual void invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags ) = 0; + + virtual bool drawEPS( + long nX, long nY, + long nWidth, long nHeight, + void* pPtr, + sal_uInt32 nSize ) = 0; + + virtual bool blendBitmap( + const SalTwoRect&, + const SalBitmap& rBitmap ) = 0; + + virtual bool blendAlphaBitmap( + const SalTwoRect&, + const SalBitmap& rSrcBitmap, + const SalBitmap& rMaskBitmap, + const SalBitmap& rAlphaBitmap ) = 0; + + virtual bool drawAlphaBitmap( + const SalTwoRect&, + const SalBitmap& rSourceBitmap, + const SalBitmap& rAlphaBitmap ) = 0; + + /** draw transformed bitmap (maybe with alpha) where Null, X, Y define the coordinate system */ + virtual bool drawTransformedBitmap( + const basegfx::B2DPoint& rNull, + const basegfx::B2DPoint& rX, + const basegfx::B2DPoint& rY, + const SalBitmap& rSourceBitmap, + const SalBitmap* pAlphaBitmap) = 0; + + virtual bool drawAlphaRect( + long nX, long nY, + long nWidth, long nHeight, + sal_uInt8 nTransparency ) = 0; + + virtual bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) = 0; + + virtual bool supportsOperation(OutDevSupportType eType) const = 0; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salgeom.hxx b/vcl/inc/salgeom.hxx new file mode 100644 index 000000000..6adeb7a69 --- /dev/null +++ b/vcl/inc/salgeom.hxx @@ -0,0 +1,72 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SALGEOM_HXX +#define INCLUDED_VCL_INC_SALGEOM_HXX + +#include <iostream> + +#include <vcl/dllapi.h> + +struct SalFrameGeometry { + // screen position of upper left corner of drawable area in pixel + long nX, nY; + // dimensions of the drawable area in pixel + unsigned long nWidth, nHeight; + // thickness of the decoration in pixel + unsigned long nLeftDecoration, + nTopDecoration, + nRightDecoration, + nBottomDecoration; + unsigned int nDisplayScreenNumber; + + SalFrameGeometry() : + nX( 0 ), + nY( 0 ), + nWidth( 1 ), + nHeight( 1 ), + nLeftDecoration( 0 ), + nTopDecoration( 0 ), + nRightDecoration( 0 ), + nBottomDecoration( 0 ), + nDisplayScreenNumber( 0 ) + {} +}; + +inline std::ostream &operator <<(std::ostream& s, const SalFrameGeometry& rGeom) +{ + s << rGeom.nWidth << "x" << rGeom.nHeight << "@(" << rGeom.nX << "," << rGeom.nY << "):{" + << rGeom.nLeftDecoration << "," << rGeom.nTopDecoration << "," << rGeom.nRightDecoration << "," << rGeom.nBottomDecoration << "}"; + + return s; +} + +/// Interface used to share logic on sizing between +/// SalVirtualDevices and SalFrames +class VCL_PLUGIN_PUBLIC SalGeometryProvider { +public: + virtual ~SalGeometryProvider() {} + virtual long GetWidth() const = 0; + virtual long GetHeight() const = 0; + virtual bool IsOffScreen() const = 0; +}; + +#endif // INCLUDED_VCL_INC_SALGEOM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx new file mode 100644 index 000000000..36c51d990 --- /dev/null +++ b/vcl/inc/salinst.hxx @@ -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 . + */ + +#ifndef INCLUDED_VCL_INC_SALINST_HXX +#define INCLUDED_VCL_INC_SALINST_HXX + +#include <sal/types.h> +#include <rtl/ref.hxx> +#include <vcl/dllapi.h> +#include <vcl/salgtype.hxx> +#include <vcl/vclenum.hxx> + +#include "backend/BackendCapabilities.hxx" + +#include "displayconnectiondispatch.hxx" + +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/ui/dialogs/XFilePicker2.hpp> +#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp> +#include <memory> + +namespace com { +namespace sun { +namespace star { +namespace awt { + class XWindow; +} +} } } +namespace comphelper { class SolarMutex; } +namespace vcl { class Window; } +namespace weld { + class Builder; + class MessageDialog; + class Widget; + class Window; +} +class SystemChildWindow; +struct SystemParentData; +struct SalPrinterQueueInfo; +class ImplJobSetup; +class OpenGLContext; +class SalGraphics; +class SalFrame; +class SalObject; +class SalMenu; +class SalMenuItem; +class SalVirtualDevice; +class SalInfoPrinter; +class SalPrinter; +class SalTimer; +class ImplPrnQueueList; +class SalSystem; +class SalBitmap; +struct SalItemParams; +class SalSession; +struct SystemGraphicsData; +struct SystemWindowData; +class Menu; +enum class VclInputFlags; +enum class SalFrameStyleFlags; + +typedef struct _cairo_font_options cairo_font_options_t; + +class VCL_DLLPUBLIC SalInstance +{ +private: + rtl::Reference< vcl::DisplayConnectionDispatch > m_pEventInst; + const std::unique_ptr<comphelper::SolarMutex> m_pYieldMutex; + css::uno::Reference<css::uno::XInterface> m_clipboard; + +public: + SalInstance(std::unique_ptr<comphelper::SolarMutex> pMutex); + virtual ~SalInstance(); + + //called directly after Application::Init + virtual void AfterAppInit() {} + virtual bool SVMainHook(int*) { return false; } + + // Frame + // DisplayName for Unix ??? + virtual SalFrame* CreateChildFrame( SystemParentData* pParent, SalFrameStyleFlags nStyle ) = 0; + virtual SalFrame* CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ) = 0; + virtual void DestroyFrame( SalFrame* pFrame ) = 0; + + // Object (System Child Window) + virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow ) = 0; + virtual void DestroyObject( SalObject* pObject ) = 0; + + // VirtualDevice + // nDX and nDY in pixels + // nBitCount: 0 == default(=as window) / 1 == mono + // pData allows for using a system dependent graphics or device context, + // if a system context is passed in nDX and nDY are updated to reflect + // its size; otherwise these remain unchanged. + virtual std::unique_ptr<SalVirtualDevice> + CreateVirtualDevice( SalGraphics* pGraphics, + long &rDX, long &rDY, + DeviceFormat eFormat, const SystemGraphicsData *pData = nullptr ) = 0; + + // Printer + // pSetupData->mpDriverData can be 0 + // pSetupData must be updated with the current + // JobSetup + virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, + ImplJobSetup* pSetupData ) = 0; + virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter ) = 0; + virtual std::unique_ptr<SalPrinter> CreatePrinter( SalInfoPrinter* pInfoPrinter ) = 0; + + virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList ) = 0; + virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) = 0; + virtual OUString GetDefaultPrinter() = 0; + + // SalTimer + virtual SalTimer* CreateSalTimer() = 0; + // SalSystem + virtual SalSystem* CreateSalSystem() = 0; + // SalBitmap + virtual std::shared_ptr<SalBitmap> CreateSalBitmap() = 0; + // BackendCapabilities + virtual std::shared_ptr<vcl::BackendCapabilities> GetBackendCapabilities() + { + return std::make_shared<vcl::BackendCapabilities>(); + } + + // YieldMutex + comphelper::SolarMutex* GetYieldMutex(); + sal_uInt32 ReleaseYieldMutexAll(); + void AcquireYieldMutex(sal_uInt32 nCount = 1); + + // return true, if the current thread is the main thread + virtual bool IsMainThread() const = 0; + + /** + * Wait for the next event (if bWait) and dispatch it, + * includes posted events, and timers. + * If bHandleAllCurrentEvents - dispatch multiple posted + * user events. Returns true if events were processed. + */ + virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents) = 0; + virtual bool AnyInput( VclInputFlags nType ) = 0; + + // menus + virtual std::unique_ptr<SalMenu> CreateMenu( bool bMenuBar, Menu* pMenu ); + virtual std::unique_ptr<SalMenuItem> CreateMenuItem( const SalItemParams& pItemData ); + + // may return NULL to disable session management, only used by X11 backend + virtual std::unique_ptr<SalSession> CreateSalSession(); + + virtual OpenGLContext* CreateOpenGLContext() = 0; + + virtual weld::Builder* CreateBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile); + virtual weld::Builder* CreateInterimBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile); + virtual weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, + VclButtonsType eButtonType, const OUString& rPrimaryMessage); + virtual weld::Window* GetFrameWeld(const css::uno::Reference<css::awt::XWindow>& rWindow); + + // methods for XDisplayConnection + + void SetEventCallback( rtl::Reference< vcl::DisplayConnectionDispatch > const & pInstance ) + { m_pEventInst = pInstance; } + + bool CallEventCallback( void const * pEvent, int nBytes ); + + virtual OUString GetConnectionIdentifier() = 0; + + // dtrans implementation + virtual css::uno::Reference< css::uno::XInterface > CreateClipboard( const css::uno::Sequence< css::uno::Any >& i_rArguments ); + virtual css::uno::Reference< css::uno::XInterface > CreateDragSource(); + virtual css::uno::Reference< css::uno::XInterface > CreateDropTarget(); + virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) = 0; + + virtual bool hasNativeFileSelection() const { return false; } + // if you override this, make sure to override hasNativeFileSelection too. + virtual css::uno::Reference< css::ui::dialogs::XFilePicker2 > createFilePicker( const css::uno::Reference< css::uno::XComponentContext >& ) + { return css::uno::Reference< css::ui::dialogs::XFilePicker2 >(); } + virtual css::uno::Reference< css::ui::dialogs::XFolderPicker2 > createFolderPicker( const css::uno::Reference< css::uno::XComponentContext >& ) + { return css::uno::Reference< css::ui::dialogs::XFolderPicker2 >(); } + + // callbacks for printer updates + virtual void updatePrinterUpdate() {} + virtual void jobStartedPrinterUpdate() {} + virtual void jobEndedPrinterUpdate() {} + + /// Set the app's (somewhat) magic/main-thread to this one. + virtual void updateMainThread() {} + /// Disconnect that - good for detaching from the JavaVM on Android. + virtual void releaseMainThread() {} + + /// get information about underlying versions + virtual OUString getOSVersion() { return "-"; } + + virtual const cairo_font_options_t* GetCairoFontOptions() { return nullptr; } + + virtual void* CreateGStreamerSink(const SystemChildWindow*) { return nullptr; } +}; + +// called from SVMain +SalInstance* CreateSalInstance(); +void DestroySalInstance( SalInstance* pInst ); + +void SalAbort( const OUString& rErrorText, bool bDumpCore ); + +const OUString& SalGetDesktopEnvironment(); + +#endif // INCLUDED_VCL_INC_SALINST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx new file mode 100644 index 000000000..e94b4c205 --- /dev/null +++ b/vcl/inc/sallayout.hxx @@ -0,0 +1,226 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SALLAYOUT_HXX +#define INCLUDED_VCL_INC_SALLAYOUT_HXX + +#include <iostream> +#include <memory> +#include <vector> + +#include <hb.h> + +#include <com/sun/star/i18n/XBreakIterator.hpp> + +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <i18nlangtag/languagetag.hxx> +#include <tools/gen.hxx> +#include <vcl/dllapi.h> +#include <vcl/vclenum.hxx> // for typedef sal_UCS4 +#include <vcl/devicecoordinate.hxx> +#include <vcl/vcllayout.hxx> + +#include "impglyphitem.hxx" + +#define MAX_FALLBACK 16 + + +class SalGraphics; +class PhysicalFontFace; +class GenericSalLayout; +enum class SalLayoutFlags; +namespace vcl { + class TextLayoutCache; +} + +// used for managing runs e.g. for BiDi, glyph and script fallback +class ImplLayoutRuns +{ +private: + int mnRunIndex; + std::vector<int> maRuns; + +public: + ImplLayoutRuns() { mnRunIndex = 0; maRuns.reserve(8); } + + void Clear() { maRuns.clear(); } + void AddPos( int nCharPos, bool bRTL ); + void AddRun( int nMinRunPos, int nEndRunPos, bool bRTL ); + + bool IsEmpty() const { return maRuns.empty(); } + void ResetPos() { mnRunIndex = 0; } + void NextRun() { mnRunIndex += 2; } + bool GetRun( int* nMinRunPos, int* nEndRunPos, bool* bRTL ) const; + bool GetNextPos( int* nCharPos, bool* bRTL ); + bool PosIsInRun( int nCharPos ) const; + bool PosIsInAnyRun( int nCharPos ) const; +}; + +class VCL_DLLPUBLIC ImplLayoutArgs +{ +public: + // string related inputs + LanguageTag maLanguageTag; + SalLayoutFlags mnFlags; + const OUString& mrStr; + int mnMinCharPos; + int mnEndCharPos; + + // performance hack + vcl::TextLayoutCache const* m_pTextLayoutCache; + + // positioning related inputs + const DeviceCoordinate* mpDXArray; // in pixel units + DeviceCoordinate mnLayoutWidth; // in pixel units + int mnOrientation; // in 0-3600 system + + // data for bidi and glyph+script fallback + ImplLayoutRuns maRuns; + ImplLayoutRuns maFallbackRuns; + + ImplLayoutArgs( const OUString& rStr, + int nMinCharPos, int nEndCharPos, SalLayoutFlags nFlags, + const LanguageTag& rLanguageTag, + vcl::TextLayoutCache const* pLayoutCache); + + void SetLayoutWidth( DeviceCoordinate nWidth ) { mnLayoutWidth = nWidth; } + void SetDXArray( const DeviceCoordinate* pDXArray ) { mpDXArray = pDXArray; } + void SetOrientation( int nOrientation ) { mnOrientation = nOrientation; } + + void ResetPos() + { maRuns.ResetPos(); } + bool GetNextPos( int* nCharPos, bool* bRTL ) + { return maRuns.GetNextPos( nCharPos, bRTL ); } + bool GetNextRun( int* nMinRunPos, int* nEndRunPos, bool* bRTL ); + void NeedFallback( int nMinRunPos, int nEndRunPos, bool bRTL ) + { maFallbackRuns.AddRun( nMinRunPos, nEndRunPos, bRTL ); } + // methods used by BiDi and glyph fallback + bool NeedFallback() const + { return !maFallbackRuns.IsEmpty(); } + bool PrepareFallback(); + +private: + void AddRun( int nMinCharPos, int nEndCharPos, bool bRTL ); +}; + +// For nice SAL_INFO logging of ImplLayoutArgs values +std::ostream &operator <<(std::ostream& s, ImplLayoutArgs const &rArgs); + +class MultiSalLayout final : public SalLayout +{ +public: + void DrawText(SalGraphics&) const override; + sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const override; + DeviceCoordinate FillDXArray(DeviceCoordinate* pDXArray) const override; + void GetCaretPositions(int nArraySize, long* pCaretXArray) const override; + bool GetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int& nStart, + const PhysicalFontFace** pFallbackFont = nullptr, + int* const pFallbackLevel = nullptr) const override; + bool GetOutline(basegfx::B2DPolyPolygonVector&) const override; + bool IsKashidaPosValid(int nCharPos) const override; + + // used only by OutputDevice::ImplLayout, TODO: make friend + explicit MultiSalLayout( std::unique_ptr<SalLayout> pBaseLayout ); + void AddFallback(std::unique_ptr<SalLayout> pFallbackLayout, ImplLayoutRuns const &); + bool LayoutText(ImplLayoutArgs&, const SalLayoutGlyphs*) override; + void AdjustLayout(ImplLayoutArgs&) override; + void InitFont() const override; + + void SetIncomplete(bool bIncomplete); + +public: + virtual ~MultiSalLayout() override; + +private: + MultiSalLayout( const MultiSalLayout& ) = delete; + MultiSalLayout& operator=( const MultiSalLayout& ) = delete; + + std::unique_ptr<GenericSalLayout> mpLayouts[ MAX_FALLBACK ]; + ImplLayoutRuns maFallbackRuns[ MAX_FALLBACK ]; + int mnLevel; + bool mbIncomplete; +}; + +class VCL_DLLPUBLIC GenericSalLayout : public SalLayout +{ + friend void MultiSalLayout::AdjustLayout(ImplLayoutArgs&); + +public: + GenericSalLayout(LogicalFontInstance&); + ~GenericSalLayout() override; + + void AdjustLayout(ImplLayoutArgs&) final override; + bool LayoutText(ImplLayoutArgs&, const SalLayoutGlyphs*) final override; + void DrawText(SalGraphics&) const final override; + static std::shared_ptr<vcl::TextLayoutCache> CreateTextLayoutCache(OUString const&); + const SalLayoutGlyphs* GetGlyphs() const final override; + + bool IsKashidaPosValid(int nCharPos) const final override; + + // used by upper layers + DeviceCoordinate GetTextWidth() const final override; + DeviceCoordinate FillDXArray(DeviceCoordinate* pDXArray) const final override; + sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const final override; + void GetCaretPositions(int nArraySize, long* pCaretXArray) const final override; + + // used by display layers + LogicalFontInstance& GetFont() const + { return m_GlyphItems.Impl()->GetFont(); } + + bool GetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int& nStart, + const PhysicalFontFace** pFallbackFont = nullptr, + int* const pFallbackLevel = nullptr) const override; + +private: + // for glyph+font+script fallback + void MoveGlyph(int nStart, long nNewXPos); + void DropGlyph(int nStart); + void Simplify(bool bIsBase); + + GenericSalLayout( const GenericSalLayout& ) = delete; + GenericSalLayout& operator=( const GenericSalLayout& ) = delete; + + void ApplyDXArray(const ImplLayoutArgs&); + void Justify(DeviceCoordinate nNewWidth); + void ApplyAsianKerning(const OUString& rStr); + + void GetCharWidths(DeviceCoordinate* pCharWidths) const; + + void SetNeedFallback(ImplLayoutArgs&, sal_Int32, bool); + + bool HasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 aNextChar); + + void ParseFeatures(const OUString& name); + + css::uno::Reference<css::i18n::XBreakIterator> mxBreak; + + SalLayoutGlyphs m_GlyphItems; + + OString msLanguage; + std::vector<hb_feature_t> maFeatures; + + hb_set_t* mpVertGlyphs; + const bool mbFuzzing; +}; + +#undef SalGraphics + +#endif // INCLUDED_VCL_INC_SALLAYOUT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salmenu.hxx b/vcl/inc/salmenu.hxx new file mode 100644 index 000000000..c69650354 --- /dev/null +++ b/vcl/inc/salmenu.hxx @@ -0,0 +1,102 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SALMENU_HXX +#define INCLUDED_VCL_INC_SALMENU_HXX + +#include <vcl/menu.hxx> +#include <vcl/image.hxx> + +struct SystemMenuData; +class FloatingWindow; +class SalFrame; + +struct SalItemParams +{ + Image aImage; // Image + VclPtr<Menu> pMenu; // Pointer to Menu + OUString aText; // Menu-Text + MenuItemType eType; // MenuItem-Type + sal_uInt16 nId; // item Id + MenuItemBits nBits; // MenuItem-Bits +}; + +struct SalMenuButtonItem +{ + sal_uInt16 mnId; + Image maImage; + OUString maToolTipText; + + SalMenuButtonItem() : mnId( 0 ) {} + SalMenuButtonItem( sal_uInt16 i_nId, const Image& rImg, const OUString& i_rTTText ) + : mnId( i_nId ), maImage( rImg ), maToolTipText( i_rTTText ) {} +}; + +class VCL_PLUGIN_PUBLIC SalMenuItem +{ +public: + SalMenuItem() {} + virtual ~SalMenuItem(); +}; + +class VCL_PLUGIN_PUBLIC SalMenu +{ +public: + SalMenu() {} + virtual ~SalMenu(); + + virtual bool VisibleMenuBar() = 0; // must return true to actually DISPLAY native menu bars + // otherwise only menu messages are processed (eg, OLE on Windows) + virtual void ShowMenuBar( bool ) {} + virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) = 0; + virtual void RemoveItem( unsigned nPos ) = 0; + virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ) = 0; + virtual void SetFrame( const SalFrame* pFrame ) = 0; + virtual void SetItemBits( unsigned /*nPos*/, MenuItemBits /*nBits*/ ) {} + virtual void CheckItem( unsigned nPos, bool bCheck ) = 0; + virtual void EnableItem( unsigned nPos, bool bEnable ) = 0; + virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OUString& rText )= 0; + virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage ) = 0; + virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& rKeyName ) = 0; + virtual void GetSystemMenuData( SystemMenuData* pData ) = 0; + virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const tools::Rectangle& rRect, FloatWinPopupFlags nFlags); + virtual void ShowCloseButton(bool bShow); + virtual bool AddMenuBarButton( const SalMenuButtonItem& ); // return false if not implemented or failure + virtual void RemoveMenuBarButton( sal_uInt16 nId ); + virtual void Update() {} + + virtual bool CanGetFocus() const { return false; } + virtual bool TakeFocus() { return false; } + + // TODO: implement show/hide for the Win/Mac VCL native backends + virtual void ShowItem( unsigned nPos, bool bShow ) { EnableItem( nPos, bShow ); } + + // return an empty rectangle if not implemented + // return Rectangle( Point( -1, -1 ), Size( 1, 1 ) ) if menu bar buttons implemented + // but rectangle cannot be determined + virtual tools::Rectangle GetMenuBarButtonRectPixel( sal_uInt16 i_nItemId, SalFrame* i_pReferenceFrame ); + + virtual int GetMenuBarHeight() const; + + virtual void ApplyPersona(); +}; + +#endif // INCLUDED_VCL_INC_SALMENU_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salobj.hxx b/vcl/inc/salobj.hxx new file mode 100644 index 000000000..6e79e4920 --- /dev/null +++ b/vcl/inc/salobj.hxx @@ -0,0 +1,79 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SALOBJ_HXX +#define INCLUDED_VCL_INC_SALOBJ_HXX + +#include <vcl/dllapi.h> +#include <vcl/syschild.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include "salwtype.hxx" + +struct SystemEnvData; + +typedef void (*SALOBJECTPROC)(SystemChildWindow* pInst, SalObjEvent nEvent); + +class VCL_PLUGIN_PUBLIC SalObject +{ + VclPtr<SystemChildWindow> m_pInst; + SALOBJECTPROC m_pCallback; + bool m_bMouseTransparent:1, + m_bEraseBackground:1; +public: + SalObject() : m_pInst( nullptr ), m_pCallback( nullptr ), m_bMouseTransparent( false ), m_bEraseBackground( true ) {} + virtual ~SalObject(); + + virtual void ResetClipRegion() = 0; + virtual void BeginSetClipRegion( sal_uInt32 nRects ) = 0; + virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) = 0; + virtual void EndSetClipRegion() = 0; + + virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight ) = 0; + virtual void Show( bool bVisible ) = 0; + virtual void Enable( bool /* nEnable */ ) {} // overridden by WinSalObject + virtual void GrabFocus() {} + virtual void Reparent(SalFrame* /*pFrame*/) {} + + virtual void SetForwardKey( bool /* bEnable */ ) {} + + virtual void SetLeaveEnterBackgrounds(const css::uno::Sequence<css::uno::Any>& /*rLeaveArgs*/, const css::uno::Sequence<css::uno::Any>& /*rEnterArgs*/) {} + + virtual const SystemEnvData* GetSystemData() const = 0; + + virtual Size GetOptimalSize() const { return Size(); } + + void SetCallback( SystemChildWindow* pInst, SALOBJECTPROC pProc ) + { m_pInst = pInst; m_pCallback = pProc; } + void CallCallback( SalObjEvent nEvent ) + { if (m_pCallback) m_pCallback( m_pInst, nEvent ); } + + void SetMouseTransparent( bool bMouseTransparent ) + { m_bMouseTransparent = bMouseTransparent; } + bool IsMouseTransparent() const + { return m_bMouseTransparent; } + + void EnableEraseBackground( bool bEnable ) + { m_bEraseBackground = bEnable; } + bool IsEraseBackgroundEnabled() const + { return m_bEraseBackground; } +}; + +#endif // INCLUDED_VCL_INC_SALOBJ_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salprn.hxx b/vcl/inc/salprn.hxx new file mode 100644 index 000000000..9c631dc02 --- /dev/null +++ b/vcl/inc/salprn.hxx @@ -0,0 +1,122 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SALPRN_HXX +#define INCLUDED_VCL_INC_SALPRN_HXX + +#include <i18nutil/paper.hxx> +#include <vcl/prntypes.hxx> +#include <vcl/dllapi.h> + +#include "salptype.hxx" + +#include <vector> + +class SalGraphics; +class SalFrame; +class ImplJobSetup; +namespace vcl { class PrinterController; } +namespace weld { class Window; } + +struct VCL_PLUGIN_PUBLIC SalPrinterQueueInfo +{ + OUString maPrinterName; + OUString maDriver; + OUString maLocation; + OUString maComment; + PrintQueueFlags mnStatus; + sal_uInt32 mnJobs; + std::unique_ptr<OUString> mpPortName; // only used by Windows backend + + SalPrinterQueueInfo(); + ~SalPrinterQueueInfo(); +}; + +class VCL_PLUGIN_PUBLIC SalInfoPrinter +{ +public: + std::vector< PaperInfo > m_aPaperFormats; // all printer supported formats + bool m_bPapersInit; // set to true after InitPaperFormats + + SalInfoPrinter() : m_bPapersInit( false ) {} + virtual ~SalInfoPrinter(); + + // SalGraphics or NULL, but two Graphics for all SalFrames + // must be returned + virtual SalGraphics* AcquireGraphics() = 0; + virtual void ReleaseGraphics( SalGraphics* pGraphics ) = 0; + + virtual bool Setup(weld::Window* pFrame, ImplJobSetup* pSetupData) = 0; + // This function set the driver data and + // set the new indepen data in pSetupData + virtual bool SetPrinterData( ImplJobSetup* pSetupData ) = 0; + // This function merged the indepen driver data + // and set the new indepen data in pSetupData + // Only the data must changed, where the bit + // in nFlags is set + virtual bool SetData( JobSetFlags nFlags, ImplJobSetup* pSetupData ) = 0; + + virtual void GetPageInfo( const ImplJobSetup* pSetupData, + long& rOutWidth, long& rOutHeight, + Point& rPageOffset, + Size& rPaperSize ) = 0; + virtual sal_uInt32 GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) = 0; + virtual sal_uInt16 GetPaperBinCount( const ImplJobSetup* pSetupData ) = 0; + virtual OUString GetPaperBinName( const ImplJobSetup* pSetupData, sal_uInt16 nPaperBin ) = 0; + // fills m_aPaperFormats and sets m_bPapersInit to true + virtual void InitPaperFormats( const ImplJobSetup* pSetupData ) = 0; + // returns angle that a landscape page will be turned counterclockwise wrt to portrait + virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ) = 0; +}; + +class VCL_PLUGIN_PUBLIC SalPrinter +{ + SalPrinter( const SalPrinter& ) = delete; + SalPrinter& operator=( const SalPrinter& ) = delete; + +public: + SalPrinter() {} + virtual ~SalPrinter(); + + virtual bool StartJob( const OUString* pFileName, + const OUString& rJobName, + const OUString& rAppName, + sal_uInt32 nCopies, + bool bCollate, + bool bDirect, + ImplJobSetup* pSetupData ) = 0; + + // implement for pull model print systems only, + // default implementations (see salvtables.cxx) just returns false + virtual bool StartJob( const OUString* pFileName, + const OUString& rJobName, + const OUString& rAppName, + ImplJobSetup* pSetupData, + vcl::PrinterController& rController ); + + virtual bool EndJob() = 0; + virtual SalGraphics* StartPage( ImplJobSetup* pSetupData, bool bNewJobData ) = 0; + virtual void EndPage() = 0; + virtual SalPrinterError GetErrorCode() { return SalPrinterError::NONE; } + +}; + +#endif // INCLUDED_VCL_INC_SALPRN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salptype.hxx b/vcl/inc/salptype.hxx new file mode 100644 index 000000000..9d09c869a --- /dev/null +++ b/vcl/inc/salptype.hxx @@ -0,0 +1,52 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SALPTYPE_HXX +#define INCLUDED_VCL_INC_SALPTYPE_HXX + +#include <sal/config.h> + +#include <o3tl/typed_flags_set.hxx> + +enum class JobSetFlags : sal_uInt16 { + ORIENTATION = 1, + PAPERBIN = 2, + PAPERSIZE = 4, + DUPLEXMODE = 8, + ALL = ORIENTATION | PAPERBIN | PAPERSIZE | DUPLEXMODE +}; + +namespace o3tl { + +template<> struct typed_flags<JobSetFlags>: is_typed_flags<JobSetFlags, 0xF> {}; + +} + +enum class SalPrinterError { + NONE = 0, + General = 1, + Abort = 2 +}; + +class SalPrinter; +typedef long (*SALPRNABORTPROC)( void* pInst, SalPrinter* pPrinter ); + +#endif // INCLUDED_VCL_INC_SALPTYPE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salsession.hxx b/vcl/inc/salsession.hxx new file mode 100644 index 000000000..fb9763bb6 --- /dev/null +++ b/vcl/inc/salsession.hxx @@ -0,0 +1,113 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SALSESSION_HXX +#define INCLUDED_VCL_INC_SALSESSION_HXX + +#include <vcl/dllapi.h> + +enum SalSessionEventType +{ + Interaction, + SaveRequest, + ShutdownCancel, + Quit +}; + +struct SalSessionEvent +{ + SalSessionEventType m_eType; + + SalSessionEvent( SalSessionEventType eType ) + : m_eType( eType ) + {} +}; + +struct SalSessionInteractionEvent : public SalSessionEvent +{ + bool m_bInteractionGranted; + + SalSessionInteractionEvent( bool bGranted ) + : SalSessionEvent( Interaction ), + m_bInteractionGranted( bGranted ) + {} +}; + +struct SalSessionSaveRequestEvent : public SalSessionEvent +{ + bool m_bShutdown; + + SalSessionSaveRequestEvent( bool bShutdown ) + : SalSessionEvent( SaveRequest ), + m_bShutdown( bShutdown ) + {} +}; + +struct SalSessionShutdownCancelEvent : public SalSessionEvent +{ + SalSessionShutdownCancelEvent() + : SalSessionEvent( ShutdownCancel ) + {} +}; + +struct SalSessionQuitEvent : public SalSessionEvent +{ + SalSessionQuitEvent() + : SalSessionEvent( Quit ) + {} +}; + +typedef void(*SessionProc)(void *pData, SalSessionEvent *pEvent); + +class VCL_PLUGIN_PUBLIC SalSession +{ + SessionProc m_aProc; + void * m_pProcData; +public: + SalSession() + : m_aProc(nullptr) + , m_pProcData(nullptr) + { + } + virtual ~SalSession(); + + void SetCallback( SessionProc aCallback, void * pCallbackData ) + { + m_aProc = aCallback; + m_pProcData = pCallbackData; + } + void CallCallback( SalSessionEvent* pEvent ) + { + if( m_aProc ) + m_aProc( m_pProcData, pEvent ); + } + + // query the session manager for a user interaction slot + virtual void queryInteraction() = 0; + // signal the session manager that we're done with user interaction + virtual void interactionDone() = 0; + // signal that we're done saving + virtual void saveDone() = 0; + // try to cancel the shutdown in progress + virtual bool cancelShutdown() = 0; +}; + +#endif // INCLUDED_VCL_INC_SALSESSION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salsys.hxx b/vcl/inc/salsys.hxx new file mode 100644 index 000000000..fc80e90d0 --- /dev/null +++ b/vcl/inc/salsys.hxx @@ -0,0 +1,90 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SALSYS_HXX +#define INCLUDED_VCL_INC_SALSYS_HXX + +#include <tools/gen.hxx> +#include <vcl/dllapi.h> +#include <rtl/ustring.hxx> + +// Button identifier for ShowNativeMessageBox +const int SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK = 1; + +class VCL_PLUGIN_PUBLIC SalSystem +{ +public: + SalSystem() {} + virtual ~SalSystem(); + + // get info about the display + + /* Gets the number of active screens attached to the display + + @returns the number of active screens + */ + virtual unsigned int GetDisplayScreenCount() = 0; + /* Queries whether multiple screens are part of one bigger display + + @returns true if screens form one big display + false if screens are distinct and windows cannot + be moved between, or span multiple screens + */ + virtual bool IsUnifiedDisplay() { return true; } + /* Queries the default screen number. The default screen is the + screen on which windows will appear if no special positioning + is made. + + @returns the default screen number + */ + virtual unsigned int GetDisplayBuiltInScreen() { return 0; } + /* Gets relative position and size of the screens attached to the display + + @param nScreen + The screen number to be queried + + @returns position: (0,0) in case of IsMultiscreen() == true + else position relative to whole display + size: size of the screen + */ + virtual tools::Rectangle GetDisplayScreenPosSizePixel( unsigned int nScreen ) = 0; + + /* Shows a native message box with the specified title, message and button + combination. + + @param rTitle + The title to be shown by the dialog box. + + @param rMessage + The message to be shown by the dialog box. + + @returns the identifier of the button that was pressed by the user. + See button identifier above. If the function fails the + return value is 0. + */ + virtual int ShowNativeMessageBox( const OUString& rTitle, + const OUString& rMessage ) = 0; + +}; + +VCL_DLLPUBLIC SalSystem* ImplGetSalSystem(); + +#endif // INCLUDED_VCL_INC_SALSYS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/saltimer.hxx b/vcl/inc/saltimer.hxx new file mode 100644 index 000000000..69545ac96 --- /dev/null +++ b/vcl/inc/saltimer.hxx @@ -0,0 +1,103 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SALTIMER_HXX +#define INCLUDED_VCL_INC_SALTIMER_HXX + +#include <sal/config.h> +#include <vcl/dllapi.h> +#include "salwtype.hxx" + +/* + * note: there will be only a single instance of SalTimer + * SalTimer originally had only static methods, but + * this needed to be virtualized for the sal plugin migration + */ + +class VCL_PLUGIN_PUBLIC SalTimer +{ + SALTIMERPROC m_pProc; + +public: + SalTimer() : m_pProc( nullptr ) {} + virtual ~SalTimer() COVERITY_NOEXCEPT_FALSE; + + // AutoRepeat and Restart + virtual void Start( sal_uInt64 nMS ) = 0; + virtual void Stop() = 0; + + // Callbacks (indepen in \sv\source\app\timer.cxx) + void SetCallback( SALTIMERPROC pProc ) + { + m_pProc = pProc; + } + + void CallCallback() + { + if( m_pProc ) + m_pProc(); + } +}; + +class VersionedEvent +{ + /** + * The "additional event data" members on macOS are integers, so we can't + * use an unsigned integer and rely on the defined unsigned overflow in + * InvalidateEvent(). + */ + sal_Int32 m_nEventVersion; + bool m_bIsValidVersion; + +public: + VersionedEvent() : m_nEventVersion( 0 ), m_bIsValidVersion( false ) {} + + sal_Int32 GetNextEventVersion() + { + InvalidateEvent(); + m_bIsValidVersion = true; + return m_nEventVersion; + } + + void InvalidateEvent() + { + if ( m_bIsValidVersion ) + { + if ( m_nEventVersion == SAL_MAX_INT32 ) + m_nEventVersion = 0; + else + ++m_nEventVersion; + m_bIsValidVersion = false; + } + } + + bool ExistsValidEvent() const + { + return m_bIsValidVersion; + } + + bool IsValidEventVersion( const sal_Int32 nEventVersion ) const + { + return m_bIsValidVersion && nEventVersion == m_nEventVersion; + } +}; + +#endif // INCLUDED_VCL_INC_SALTIMER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salusereventlist.hxx b/vcl/inc/salusereventlist.hxx new file mode 100644 index 000000000..cc5aa88c9 --- /dev/null +++ b/vcl/inc/salusereventlist.hxx @@ -0,0 +1,122 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SALUSEREVENTLIST_HXX +#define INCLUDED_VCL_INC_SALUSEREVENTLIST_HXX + +#include <sal/config.h> +#include <vcl/dllapi.h> +#include <osl/mutex.hxx> +#include <osl/thread.hxx> + +#include <list> +#include <o3tl/sorted_vector.hxx> + +class SalFrame; +enum class SalEvent; + +typedef o3tl::sorted_vector< SalFrame* > SalFrameSet; + +class VCL_PLUGIN_PUBLIC SalUserEventList +{ +public: + struct SalUserEvent + { + SalFrame* m_pFrame; + void* m_pData; + SalEvent m_nEvent; + + SalUserEvent( SalFrame* pFrame, void* pData, SalEvent nEvent ) + : m_pFrame( pFrame ), + m_pData( pData ), + m_nEvent( nEvent ) + {} + + bool operator==(const SalUserEvent &aEvent) const + { + return m_pFrame == aEvent.m_pFrame + && m_pData == aEvent.m_pData + && m_nEvent== aEvent.m_nEvent; + } + }; + +protected: + mutable osl::Mutex m_aUserEventsMutex; + std::list< SalUserEvent > m_aUserEvents; + std::list< SalUserEvent > m_aProcessingUserEvents; + bool m_bAllUserEventProcessedSignaled; + SalFrameSet m_aFrames; + oslThreadIdentifier m_aProcessingThread; + + virtual void ProcessEvent( SalUserEvent aEvent ) = 0; + virtual void TriggerUserEventProcessing() = 0; + virtual void TriggerAllUserEventsProcessed() {} + +public: + SalUserEventList(); + virtual ~SalUserEventList() COVERITY_NOEXCEPT_FALSE; + + inline const SalFrameSet& getFrames() const; + inline SalFrame* anyFrame() const; + void insertFrame( SalFrame* pFrame ); + void eraseFrame( SalFrame* pFrame ); + inline bool isFrameAlive( const SalFrame* pFrame ) const; + + void PostEvent( SalFrame* pFrame, void* pData, SalEvent nEvent ); + void RemoveEvent( SalFrame* pFrame, void* pData, SalEvent nEvent ); + inline bool HasUserEvents() const; + + bool DispatchUserEvents( bool bHandleAllCurrentEvents ); +}; + +inline SalFrame* SalUserEventList::anyFrame() const +{ + if ( m_aFrames.empty() ) + return nullptr; + return *m_aFrames.begin(); +} + +inline bool SalUserEventList::isFrameAlive( const SalFrame* pFrame ) const +{ + auto it = m_aFrames.find( const_cast<SalFrame*>( pFrame ) ); + return it != m_aFrames.end(); +} + +inline bool SalUserEventList::HasUserEvents() const +{ + osl::MutexGuard aGuard( m_aUserEventsMutex ); + return !(m_aUserEvents.empty() && m_aProcessingUserEvents.empty()); +} + +inline void SalUserEventList::PostEvent( SalFrame* pFrame, void* pData, SalEvent nEvent ) +{ + osl::MutexGuard aGuard( m_aUserEventsMutex ); + m_aUserEvents.push_back( SalUserEvent( pFrame, pData, nEvent ) ); + m_bAllUserEventProcessedSignaled = false; + TriggerUserEventProcessing(); +} + +inline const SalFrameSet& SalUserEventList::getFrames() const +{ + return m_aFrames; +} + +#endif // INCLUDED_VCL_INC_SALUSEREVENTLIST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salvd.hxx b/vcl/inc/salvd.hxx new file mode 100644 index 000000000..8a6fe144c --- /dev/null +++ b/vcl/inc/salvd.hxx @@ -0,0 +1,58 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SALVD_HXX +#define INCLUDED_VCL_INC_SALVD_HXX + +#include "salgeom.hxx" + +class SalGraphics; + +/// A non-visible drawable/buffer (e.g. an X11 Pixmap). +class VCL_PLUGIN_PUBLIC SalVirtualDevice + : public SalGeometryProvider +{ +public: + SalVirtualDevice() {} + virtual ~SalVirtualDevice() override; + + // SalGeometryProvider + virtual bool IsOffScreen() const override { return true; } + + // SalGraphics or NULL, but two Graphics for all SalVirtualDevices + // must be returned + virtual SalGraphics* AcquireGraphics() = 0; + virtual void ReleaseGraphics( SalGraphics* pGraphics ) = 0; + + // Set new size, without saving the old contents + virtual bool SetSize( long nNewDX, long nNewDY ) = 0; + + // Set new size using a buffer at the given address + virtual bool SetSizeUsingBuffer( long nNewDX, long nNewDY, + sal_uInt8 * /* pBuffer */) + { + // Only the headless virtual device has an implementation that uses + // pBuffer (and bTopDown). + return SetSize( nNewDX, nNewDY ); + } +}; + +#endif // INCLUDED_VCL_INC_SALVD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx new file mode 100644 index 000000000..d0ae4ad38 --- /dev/null +++ b/vcl/inc/salvtables.hxx @@ -0,0 +1,1105 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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/. + */ +#pragma once + +#include <vcl/weld.hxx> +#include <vcl/svapp.hxx> +#include <vcl/syswin.hxx> +#include <vcl/settings.hxx> +#include <vcl/virdev.hxx> +#include <vcl/ctrl.hxx> +#include <vcl/edit.hxx> +#include <vcl/spinfld.hxx> +#include <vcl/fixed.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/menubtn.hxx> +#include <vcl/toolkit/combobox.hxx> +#include <vcl/tabctrl.hxx> +#include <vcl/layout.hxx> +#include "messagedialog.hxx" + +class SalInstanceBuilder : public weld::Builder +{ +protected: + std::unique_ptr<VclBuilder> m_xBuilder; + VclPtr<vcl::Window> m_aOwnedToplevel; + +public: + SalInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile); + + virtual std::unique_ptr<weld::MessageDialog> + weld_message_dialog(const OString& id, bool bTakeOwnership = true) override; + + virtual std::unique_ptr<weld::Dialog> weld_dialog(const OString& id, + bool bTakeOwnership = true) override; + + virtual std::unique_ptr<weld::Assistant> weld_assistant(const OString& id, + bool bTakeOwnership = true) override; + + virtual std::unique_ptr<weld::Window> create_screenshot_window() override; + + virtual std::unique_ptr<weld::Window> weld_window(const OString& id, + bool bTakeOwnership = true) override; + + virtual std::unique_ptr<weld::Widget> weld_widget(const OString& id, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::Container> weld_container(const OString& id, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::Box> weld_box(const OString& id, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::Paned> weld_paned(const OString& id, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::Frame> weld_frame(const OString& id, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::ScrolledWindow> + weld_scrolled_window(const OString& id, bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString& id, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::Button> weld_button(const OString& id, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::MenuButton> + weld_menu_button(const OString& id, bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::LinkButton> + weld_link_button(const OString& id, bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::ToggleButton> + weld_toggle_button(const OString& id, bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::RadioButton> + weld_radio_button(const OString& id, bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::CheckButton> + weld_check_button(const OString& id, bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::Scale> weld_scale(const OString& id, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::ProgressBar> + weld_progress_bar(const OString& id, bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::Spinner> weld_spinner(const OString& id, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::Image> weld_image(const OString& id, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::Calendar> weld_calendar(const OString& id, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::Entry> weld_entry(const OString& id, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::SpinButton> + weld_spin_button(const OString& id, bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::MetricSpinButton> + weld_metric_spin_button(const OString& id, FieldUnit eUnit, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::FormattedSpinButton> + weld_formatted_spin_button(const OString& id, bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::TimeSpinButton> + weld_time_spin_button(const OString& id, TimeFieldFormat eFormat, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString& id, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::EntryTreeView> + weld_entry_tree_view(const OString& containerid, const OString& entryid, + const OString& treeviewid, bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OString& id, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::IconView> weld_icon_view(const OString& id, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::Label> weld_label(const OString& id, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::TextView> weld_text_view(const OString& id, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::Expander> weld_expander(const OString& id, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::DrawingArea> + weld_drawing_area(const OString& id, const a11yref& rA11yImpl = nullptr, + FactoryFunction pUITestFactoryFunction = nullptr, void* pUserData = nullptr, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::Menu> weld_menu(const OString& id, + bool bTakeOwnership = true) override; + + virtual std::unique_ptr<weld::Toolbar> weld_toolbar(const OString& id, + bool bTakeOwnership = false) override; + + virtual std::unique_ptr<weld::SizeGroup> create_size_group() override; + + OString get_current_page_help_id() const; + + virtual ~SalInstanceBuilder() override; +}; + +class SalInstanceMenu : public weld::Menu +{ +private: + VclPtr<PopupMenu> m_xMenu; + + bool m_bTakeOwnership; + sal_uInt16 m_nLastId; + + DECL_LINK(SelectMenuHdl, ::Menu*, bool); + +public: + SalInstanceMenu(PopupMenu* pMenu, bool bTakeOwnership); + virtual OString popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect) override; + virtual void set_sensitive(const OString& rIdent, bool bSensitive) override; + virtual void set_active(const OString& rIdent, bool bActive) override; + virtual bool get_active(const OString& rIdent) const override; + virtual void set_label(const OString& rIdent, const OUString& rLabel) override; + virtual OUString get_label(const OString& rIdent) const override; + virtual void set_visible(const OString& rIdent, bool bShow) override; + virtual void clear() override; + virtual void insert(int pos, const OUString& rId, const OUString& rStr, + const OUString* pIconName, VirtualDevice* pImageSurface, + TriState eCheckRadioFalse) override; + virtual void insert_separator(int pos, const OUString& rId) override; + virtual void remove(const OString& rId) override; + virtual int n_children() const override; + PopupMenu* getMenu() const; + virtual ~SalInstanceMenu() override; +}; + +class SalInstanceWidget : public virtual weld::Widget +{ +protected: + VclPtr<vcl::Window> m_xWidget; + SalInstanceBuilder* m_pBuilder; + +private: + DECL_LINK(EventListener, VclWindowEvent&, void); + DECL_LINK(KeyEventListener, VclWindowEvent&, bool); + DECL_LINK(MouseEventListener, VclSimpleEvent&, void); + DECL_LINK(MnemonicActivateHdl, vcl::Window&, bool); + + const bool m_bTakeOwnership; + bool m_bEventListener; + bool m_bKeyEventListener; + bool m_bMouseEventListener; + int m_nBlockNotify; + +protected: + void ensure_event_listener(); + + // we want the ability to mark key events as handled, so use this variant + // for those, we get all keystrokes in this case, so we will need to filter + // them later + void ensure_key_listener(); + + // we want the ability to know about mouse events that happen in our children + // so use this variant, we will need to filter them later + void ensure_mouse_listener(); + + virtual void HandleEventListener(VclWindowEvent& rEvent); + virtual bool HandleKeyEventListener(VclWindowEvent& rEvent); + virtual void HandleMouseEventListener(VclSimpleEvent& rEvent); + + void set_background(const Color& rColor); + +public: + SalInstanceWidget(vcl::Window* pWidget, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void set_sensitive(bool sensitive) override; + + virtual bool get_sensitive() const override; + + virtual bool get_visible() const override; + + virtual bool is_visible() const override; + + virtual void set_can_focus(bool bCanFocus) override; + + virtual void grab_focus() override; + + virtual bool has_focus() const override; + + virtual bool is_active() const override; + + virtual void set_has_default(bool has_default) override; + + virtual bool get_has_default() const override; + + virtual void show() override; + + virtual void hide() override; + + virtual void set_size_request(int nWidth, int nHeight) override; + + virtual Size get_size_request() const override; + + virtual Size get_preferred_size() const override; + + virtual float get_approximate_digit_width() const override; + + virtual int get_text_height() const override; + + virtual Size get_pixel_size(const OUString& rText) const override; + + virtual vcl::Font get_font() override; + + virtual OString get_buildable_name() const override; + + virtual void set_help_id(const OString& rId) override; + + virtual OString get_help_id() const override; + + virtual void set_grid_left_attach(int nAttach) override; + + virtual int get_grid_left_attach() const override; + + virtual void set_grid_width(int nCols) override; + + virtual void set_grid_top_attach(int nAttach) override; + + virtual int get_grid_top_attach() const override; + + virtual void set_hexpand(bool bExpand) override; + + virtual bool get_hexpand() const override; + + virtual void set_vexpand(bool bExpand) override; + + virtual bool get_vexpand() const override; + + virtual void set_secondary(bool bSecondary) override; + + virtual void set_margin_top(int nMargin) override; + + virtual void set_margin_bottom(int nMargin) override; + + virtual void set_margin_left(int nMargin) override; + + virtual void set_margin_right(int nMargin) override; + + virtual int get_margin_top() const override; + + virtual int get_margin_bottom() const override; + + virtual int get_margin_left() const override; + + virtual int get_margin_right() const override; + + virtual void set_accessible_name(const OUString& rName) override; + + virtual OUString get_accessible_name() const override; + + virtual OUString get_accessible_description() const override; + + virtual void set_accessible_relation_labeled_by(weld::Widget* pLabel) override; + + virtual void set_accessible_relation_label_for(weld::Widget* pLabeled) override; + + virtual void set_tooltip_text(const OUString& rTip) override; + + virtual OUString get_tooltip_text() const override; + + virtual void connect_focus_in(const Link<Widget&, void>& rLink) override; + + virtual void connect_mnemonic_activate(const Link<Widget&, bool>& rLink) override; + + virtual void connect_focus_out(const Link<Widget&, void>& rLink) override; + + virtual void connect_size_allocate(const Link<const Size&, void>& rLink) override; + + virtual void connect_mouse_press(const Link<const MouseEvent&, bool>& rLink) override; + + virtual void connect_mouse_move(const Link<const MouseEvent&, bool>& rLink) override; + + virtual void connect_mouse_release(const Link<const MouseEvent&, bool>& rLink) override; + + virtual void connect_key_press(const Link<const KeyEvent&, bool>& rLink) override; + + virtual void connect_key_release(const Link<const KeyEvent&, bool>& rLink) override; + + virtual bool get_extents_relative_to(Widget& rRelative, int& x, int& y, int& width, + int& height) override; + + virtual void grab_add() override; + + virtual bool has_grab() const override; + + virtual void grab_remove() override; + + virtual bool get_direction() const override; + + virtual void set_direction(bool bRTL) override; + + virtual void freeze() override; + + virtual void thaw() override; + + virtual std::unique_ptr<weld::Container> weld_parent() const override; + + virtual ~SalInstanceWidget() override; + + vcl::Window* getWidget(); + + void disable_notify_events(); + + bool notify_events_disabled(); + + void enable_notify_events(); + + virtual void help_hierarchy_foreach(const std::function<bool(const OString&)>& func) override; + + virtual OUString strip_mnemonic(const OUString& rLabel) const override; + + virtual VclPtr<VirtualDevice> create_virtual_device() const override; + + virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> get_drop_target() override; + + virtual void + connect_get_property_tree(const Link<boost::property_tree::ptree&, void>& rLink) override; + + virtual void set_stack_background() override; + + virtual void set_toolbar_background() override; + + virtual void set_highlight_background() override; + + virtual void draw(VirtualDevice& rOutput) override; + + SystemWindow* getSystemWindow(); +}; + +class SalInstanceLabel : public SalInstanceWidget, public virtual weld::Label +{ +private: + // Control instead of FixedText so we can also use this for + // SelectableFixedText which is derived from Edit. We just typically need + // [G|S]etText which exists in their shared baseclass + VclPtr<Control> m_xLabel; + +public: + SalInstanceLabel(Control* pLabel, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void set_label(const OUString& rText) override; + + virtual OUString get_label() const override; + + virtual void set_mnemonic_widget(Widget* pTarget) override; + + virtual void set_message_type(weld::EntryMessageType eType) override; + + virtual void set_font(const vcl::Font& rFont) override; +}; + +class SalInstanceContainer : public SalInstanceWidget, public virtual weld::Container +{ +protected: + VclPtr<vcl::Window> m_xContainer; + +private: + void implResetDefault(const vcl::Window* _pWindow); + +public: + SalInstanceContainer(vcl::Window* pContainer, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + virtual void move(weld::Widget* pWidget, weld::Container* pNewParent) override; + virtual void recursively_unset_default_buttons() override; + virtual css::uno::Reference<css::awt::XWindow> CreateChildFrame() override; +}; + +class SalInstanceWindow : public SalInstanceContainer, public virtual weld::Window +{ +private: + VclPtr<vcl::Window> m_xWindow; + + DECL_LINK(HelpHdl, vcl::Window&, bool); + + void override_child_help(vcl::Window* pParent); + + void clear_child_help(vcl::Window* pParent); + +public: + SalInstanceWindow(vcl::Window* pWindow, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void set_title(const OUString& rTitle) override; + + virtual OUString get_title() const override; + + void help(); + + virtual void set_busy_cursor(bool bBusy) override; + + virtual css::uno::Reference<css::awt::XWindow> GetXWindow() override; + + virtual void resize_to_request() override; + + virtual void set_modal(bool bModal) override; + + virtual bool get_modal() const override; + + virtual void window_move(int x, int y) override; + + virtual Size get_size() const override; + + virtual Point get_position() const override; + + virtual tools::Rectangle get_monitor_workarea() const override; + + virtual void set_centered_on_parent(bool /*bTrackGeometryRequests*/) override; + + virtual bool get_resizable() const override; + + virtual bool has_toplevel_focus() const override; + + virtual void present() override; + + virtual void set_window_state(const OString& rStr) override; + + virtual OString get_window_state(WindowStateMask nMask) const override; + + virtual SystemEnvData get_system_data() const override; + + virtual void connect_toplevel_focus_changed(const Link<weld::Widget&, void>& rLink) override; + + virtual void HandleEventListener(VclWindowEvent& rEvent) override; + + virtual void draw(VirtualDevice& rOutput) override; + + virtual weld::ScreenShotCollection collect_screenshot_data() override; + + virtual ~SalInstanceWindow() override; +}; + +class SalInstanceDialog : public SalInstanceWindow, public virtual weld::Dialog +{ +private: + VclPtr<::Dialog> m_xDialog; + + // for calc ref dialog that shrink to range selection widgets and resize back + VclPtr<vcl::Window> m_xRefEdit; + std::vector<VclPtr<vcl::Window>> m_aHiddenWidgets; // vector of hidden Controls + long m_nOldEditWidthReq; // Original width request of the input field + sal_Int32 m_nOldBorderWidth; // border width for expanded dialog + + DECL_LINK(PopupScreenShotMenuHdl, const CommandEvent&, bool); + +public: + SalInstanceDialog(::Dialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual bool runAsync(std::shared_ptr<weld::DialogController> aOwner, + const std::function<void(sal_Int32)>& rEndDialogFn) override; + + virtual bool runAsync(std::shared_ptr<Dialog> const& rxSelf, + const std::function<void(sal_Int32)>& rEndDialogFn) override; + + virtual void collapse(weld::Widget* pEdit, weld::Widget* pButton) override; + + virtual void undo_collapse() override; + + virtual void + SetInstallLOKNotifierHdl(const Link<void*, vcl::ILibreOfficeKitNotifier*>& rLink) override; + + virtual int run() override; + + virtual void response(int nResponse) override; + + virtual void add_button(const OUString& rText, int nResponse, + const OString& rHelpId = OString()) override; + + virtual void set_modal(bool bModal) override; + + virtual bool get_modal() const override; + + virtual weld::Button* weld_widget_for_response(int nResponse) override; + + virtual void set_default_response(int nResponse) override; + + virtual weld::Container* weld_content_area() override; +}; + +class WeldTextFilter final : public TextFilter +{ +private: + Link<OUString&, bool>& m_rInsertTextHdl; + +public: + WeldTextFilter(Link<OUString&, bool>& rInsertTextHdl); + + virtual OUString filter(const OUString& rText) override; +}; + +class SalInstanceEntry : public SalInstanceWidget, public virtual weld::Entry +{ +private: + VclPtr<::Edit> m_xEntry; + + DECL_LINK(ChangeHdl, Edit&, void); + DECL_LINK(CursorListener, VclWindowEvent&, void); + DECL_LINK(ActivateHdl, Edit&, bool); + + WeldTextFilter m_aTextFilter; + +public: + SalInstanceEntry(::Edit* pEntry, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void set_text(const OUString& rText) override; + + virtual OUString get_text() const override; + + virtual void set_width_chars(int nChars) override; + + virtual int get_width_chars() const override; + + virtual void set_max_length(int nChars) override; + + virtual void select_region(int nStartPos, int nEndPos) override; + + bool get_selection_bounds(int& rStartPos, int& rEndPos) override; + + virtual void replace_selection(const OUString& rText) override; + + virtual void set_position(int nCursorPos) override; + + virtual int get_position() const override; + + virtual void set_editable(bool bEditable) override; + + virtual bool get_editable() const override; + + virtual void set_message_type(weld::EntryMessageType eType) override; + + virtual void set_font(const vcl::Font& rFont) override; + + virtual void connect_cursor_position(const Link<Entry&, void>& rLink) override; + + virtual void set_placeholder_text(const OUString& rText) override; + + Edit& getEntry(); + + void fire_signal_changed(); + + virtual void cut_clipboard() override; + + virtual void copy_clipboard() override; + + virtual void paste_clipboard() override; + + virtual ~SalInstanceEntry() override; +}; + +class SalInstanceSpinButton final : public SalInstanceEntry, public virtual weld::SpinButton +{ +private: + VclPtr<FormattedField> m_xButton; + + DECL_LINK(UpDownHdl, SpinField&, void); + DECL_LINK(LoseFocusHdl, Control&, void); + DECL_LINK(OutputHdl, Edit&, bool); + DECL_LINK(InputHdl, sal_Int64*, TriState); + DECL_LINK(ActivateHdl, Edit&, bool); + + double toField(int nValue) const; + + int fromField(double fValue) const; + +public: + SalInstanceSpinButton(FormattedField* pButton, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual int get_value() const override; + + virtual void set_value(int value) override; + + virtual void set_range(int min, int max) override; + + virtual void get_range(int& min, int& max) const override; + + virtual void set_increments(int step, int /*page*/) override; + + virtual void get_increments(int& step, int& page) const override; + + virtual void set_digits(unsigned int digits) override; + + // SpinButton may be comprised of multiple subwidgets, consider the lot as + // one thing for focus + virtual bool has_focus() const override; + + //so with hh::mm::ss, incrementing mm will not reset ss + void DisableRemainderFactor(); + + //off by default for direct SpinButtons, MetricSpinButton enables it + void SetUseThousandSep(); + + virtual unsigned int get_digits() const override; + + virtual ~SalInstanceSpinButton() override; +}; + +//ComboBox and ListBox have similar apis, ComboBoxes in LibreOffice have an edit box and ListBoxes +//don't. This distinction isn't there in Gtk. Use a template to sort this problem out. +template <class vcl_type> +class SalInstanceComboBox : public SalInstanceContainer, public virtual weld::ComboBox +{ +protected: + // owner for ListBox/ComboBox UserData + std::vector<std::shared_ptr<OUString>> m_aUserData; + VclPtr<vcl_type> m_xComboBox; + ScopedVclPtr<MenuButton> m_xMenuButton; + OUString m_sMenuButtonRow; + +public: + SalInstanceComboBox(vcl_type* pComboBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership) + : SalInstanceContainer(pComboBox, pBuilder, bTakeOwnership) + , m_xComboBox(pComboBox) + { + } + + virtual int get_active() const override + { + const sal_Int32 nRet = m_xComboBox->GetSelectedEntryPos(); + if (nRet == LISTBOX_ENTRY_NOTFOUND) + return -1; + return nRet; + } + + const OUString* getEntryData(int index) const + { + return static_cast<const OUString*>(m_xComboBox->GetEntryData(index)); + } + + // ComboBoxes are comprised of multiple subwidgets, consider the lot as + // one thing for focus + virtual bool has_focus() const override + { + return m_xWidget->HasChildPathFocus() + || (m_xMenuButton && (m_xMenuButton->HasFocus() || m_xMenuButton->InPopupMode())); + } + + virtual OUString get_active_id() const override + { + sal_Int32 nPos = m_xComboBox->GetSelectedEntryPos(); + const OUString* pRet; + if (nPos != LISTBOX_ENTRY_NOTFOUND) + pRet = getEntryData(m_xComboBox->GetSelectedEntryPos()); + else + pRet = nullptr; + if (!pRet) + return OUString(); + return *pRet; + } + + virtual void set_active_id(const OUString& rStr) override + { + for (int i = 0; i < get_count(); ++i) + { + const OUString* pId = getEntryData(i); + if (!pId) + continue; + if (*pId == rStr) + m_xComboBox->SelectEntryPos(i); + } + } + + virtual void set_active(int pos) override + { + if (pos == -1) + { + m_xComboBox->SetNoSelection(); + return; + } + m_xComboBox->SelectEntryPos(pos); + } + + virtual OUString get_text(int pos) const override { return m_xComboBox->GetEntry(pos); } + + virtual OUString get_id(int pos) const override + { + const OUString* pRet = getEntryData(pos); + if (!pRet) + return OUString(); + return *pRet; + } + + virtual void set_id(int row, const OUString& rId) override + { + m_aUserData.emplace_back(std::make_unique<OUString>(rId)); + m_xComboBox->SetEntryData(row, m_aUserData.back().get()); + } + + virtual void insert_vector(const std::vector<weld::ComboBoxEntry>& rItems, + bool bKeepExisting) override + { + freeze(); + if (!bKeepExisting) + clear(); + for (const auto& rItem : rItems) + { + insert(-1, rItem.sString, rItem.sId.isEmpty() ? nullptr : &rItem.sId, + rItem.sImage.isEmpty() ? nullptr : &rItem.sImage, nullptr); + } + thaw(); + } + + virtual int get_count() const override { return m_xComboBox->GetEntryCount(); } + + virtual int find_text(const OUString& rStr) const override + { + const sal_Int32 nRet = m_xComboBox->GetEntryPos(rStr); + if (nRet == LISTBOX_ENTRY_NOTFOUND) + return -1; + return nRet; + } + + virtual int find_id(const OUString& rStr) const override + { + for (int i = 0; i < get_count(); ++i) + { + const OUString* pId = getEntryData(i); + if (!pId) + continue; + if (*pId == rStr) + return i; + } + return -1; + } + + virtual void clear() override + { + m_xComboBox->Clear(); + m_aUserData.clear(); + } + + virtual void make_sorted() override + { + m_xComboBox->SetStyle(m_xComboBox->GetStyle() | WB_SORT); + } + + virtual bool get_popup_shown() const override { return m_xComboBox->IsInDropDown(); } + + virtual void connect_popup_toggled(const Link<ComboBox&, void>& rLink) override + { + weld::ComboBox::connect_popup_toggled(rLink); + ensure_event_listener(); + } + + void call_signal_custom_render(UserDrawEvent* pEvent) + { + vcl::RenderContext* pRenderContext = pEvent->GetRenderContext(); + auto nPos = pEvent->GetItemId(); + const tools::Rectangle& rRect = pEvent->GetRect(); + const OUString sId = get_id(nPos); + signal_custom_render(*pRenderContext, rRect, pEvent->IsSelected(), sId); + m_xComboBox->DrawEntry(*pEvent); // draw separator + + if (m_xMenuButton && m_xMenuButton->IsVisible() && m_sMenuButtonRow == sId) + { + if (m_xMenuButton->GetParent() != pEvent->GetWindow()) + m_xMenuButton->SetParent(pEvent->GetWindow()); + int nButtonWidth = get_menu_button_width(); + m_xMenuButton->SetSizePixel(Size(nButtonWidth, rRect.GetHeight())); + m_xMenuButton->SetPosPixel(Point(rRect.GetWidth() - nButtonWidth, rRect.getY())); + } + } + + VclPtr<VirtualDevice> create_render_virtual_device() const override + { + auto xRet = VclPtr<VirtualDevice>::Create(); + xRet->SetBackground(Application::GetSettings().GetStyleSettings().GetFieldColor()); + return xRet; + } + + virtual void set_item_menu(const OString& rIdent, weld::Menu* pMenu) override + { + SalInstanceMenu* pInstanceMenu = dynamic_cast<SalInstanceMenu*>(pMenu); + + PopupMenu* pPopup = pInstanceMenu ? pInstanceMenu->getMenu() : nullptr; + + if (!m_xMenuButton) + m_xMenuButton + = VclPtr<MenuButton>::Create(m_xComboBox, WB_FLATBUTTON | WB_NOPOINTERFOCUS); + + m_xMenuButton->SetPopupMenu(pPopup); + m_xMenuButton->Show(pPopup != nullptr); + m_sMenuButtonRow = OUString::fromUtf8(rIdent); + } + + int get_menu_button_width() const override + { + const int nButtonWidth = 20; + return nButtonWidth; + } + + void CallHandleEventListener(VclWindowEvent& rEvent) + { + if (rEvent.GetId() == VclEventId::DropdownPreOpen + || rEvent.GetId() == VclEventId::DropdownClose) + { + signal_popup_toggled(); + return; + } + SalInstanceContainer::HandleEventListener(rEvent); + } +}; + +class SalInstanceComboBoxWithoutEdit : public SalInstanceComboBox<ListBox> +{ +private: + DECL_LINK(SelectHdl, ListBox&, void); + +public: + SalInstanceComboBoxWithoutEdit(ListBox* pListBox, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual OUString get_active_text() const override; + + virtual void remove(int pos) override; + + virtual void insert(int pos, const OUString& rStr, const OUString* pId, + const OUString* pIconName, VirtualDevice* pImageSurface) override; + + virtual void insert_separator(int pos, const OUString& /*rId*/) override; + + virtual bool has_entry() const override; + + virtual bool changed_by_direct_pick() const override; + + virtual void set_entry_message_type(weld::EntryMessageType /*eType*/) override; + + virtual void set_entry_text(const OUString& /*rText*/) override; + + virtual void select_entry_region(int /*nStartPos*/, int /*nEndPos*/) override; + + virtual bool get_entry_selection_bounds(int& /*rStartPos*/, int& /*rEndPos*/) override; + + virtual void set_entry_width_chars(int /*nChars*/) override; + + virtual void set_entry_max_length(int /*nChars*/) override; + + virtual void set_entry_completion(bool, bool bCaseSensitive = false) override; + + virtual void set_entry_placeholder_text(const OUString&) override; + + virtual void set_entry_editable(bool bEditable) override; + + virtual void cut_entry_clipboard() override; + + virtual void copy_entry_clipboard() override; + + virtual void paste_entry_clipboard() override; + + virtual void set_entry_font(const vcl::Font&) override; + + virtual vcl::Font get_entry_font() override; + + virtual void set_custom_renderer(bool bOn) override; + + virtual int get_max_mru_count() const override; + + virtual void set_max_mru_count(int) override; + + virtual OUString get_mru_entries() const override; + + virtual void set_mru_entries(const OUString&) override; + + virtual void HandleEventListener(VclWindowEvent& rEvent) override; + + virtual ~SalInstanceComboBoxWithoutEdit() override; +}; + +class SalInstanceComboBoxWithEdit : public SalInstanceComboBox<ComboBox> +{ +private: + DECL_LINK(ChangeHdl, Edit&, void); + DECL_LINK(EntryActivateHdl, Edit&, bool); + DECL_LINK(SelectHdl, ::ComboBox&, void); + DECL_LINK(UserDrawHdl, UserDrawEvent*, void); + WeldTextFilter m_aTextFilter; + bool m_bInSelect; + +public: + SalInstanceComboBoxWithEdit(::ComboBox* pComboBox, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual bool has_entry() const override; + + virtual bool changed_by_direct_pick() const override; + + virtual void set_entry_message_type(weld::EntryMessageType eType) override; + + virtual OUString get_active_text() const override; + + virtual void remove(int pos) override; + + virtual void insert(int pos, const OUString& rStr, const OUString* pId, + const OUString* pIconName, VirtualDevice* pImageSurface) override; + + virtual void insert_separator(int pos, const OUString& /*rId*/) override; + + virtual void set_entry_text(const OUString& rText) override; + + virtual void set_entry_width_chars(int nChars) override; + + virtual void set_entry_max_length(int nChars) override; + + virtual void set_entry_completion(bool bEnable, bool bCaseSensitive = false) override; + + virtual void set_entry_placeholder_text(const OUString& rText) override; + + virtual void set_entry_editable(bool bEditable) override; + + virtual void cut_entry_clipboard() override; + + virtual void copy_entry_clipboard() override; + + virtual void paste_entry_clipboard() override; + + virtual void select_entry_region(int nStartPos, int nEndPos) override; + + virtual bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) override; + + virtual void set_entry_font(const vcl::Font& rFont) override; + + virtual vcl::Font get_entry_font() override; + + virtual void set_custom_renderer(bool bOn) override; + + virtual int get_max_mru_count() const override; + + virtual void set_max_mru_count(int nCount) override; + + virtual OUString get_mru_entries() const override; + + virtual void set_mru_entries(const OUString& rEntries) override; + + virtual void HandleEventListener(VclWindowEvent& rEvent) override; + + virtual ~SalInstanceComboBoxWithEdit() override; +}; + +class SalInstanceButton : public SalInstanceContainer, public virtual weld::Button +{ +private: + VclPtr<::Button> m_xButton; + Link<::Button*, void> const m_aOldClickHdl; + + DECL_LINK(ClickHdl, ::Button*, void); + +public: + SalInstanceButton(::Button* pButton, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void set_label(const OUString& rText) override; + + virtual void set_image(VirtualDevice* pDevice) override; + + virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) override; + + virtual void set_from_icon_name(const OUString& rIconName) override; + + virtual void set_label_line_wrap(bool wrap) override; + + virtual OUString get_label() const override; + + virtual ~SalInstanceButton() override; +}; + +class SalInstanceNotebook : public SalInstanceContainer, public virtual weld::Notebook +{ +private: + VclPtr<TabControl> m_xNotebook; + mutable std::vector<std::shared_ptr<SalInstanceContainer>> m_aPages; + std::map<OString, std::pair<VclPtr<TabPage>, VclPtr<VclGrid>>> m_aAddedPages; + + DECL_LINK(DeactivatePageHdl, TabControl*, bool); + DECL_LINK(ActivatePageHdl, TabControl*, void); + +public: + SalInstanceNotebook(TabControl* pNotebook, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual int get_current_page() const override; + + virtual OString get_page_ident(int nPage) const override; + + virtual OString get_current_page_ident() const override; + + virtual weld::Container* get_page(const OString& rIdent) const override; + + virtual void set_current_page(int nPage) override; + + virtual void set_current_page(const OString& rIdent) override; + + virtual void remove_page(const OString& rIdent) override; + + virtual void insert_page(const OString& rIdent, const OUString& rLabel, int nPos) override; + + virtual int get_n_pages() const override; + + virtual OUString get_tab_label_text(const OString& rIdent) const override; + + virtual void set_tab_label_text(const OString& rIdent, const OUString& rText) override; + + virtual ~SalInstanceNotebook() override; +}; + +class SalInstanceMessageDialog : public SalInstanceDialog, public virtual weld::MessageDialog +{ +private: + VclPtr<::MessageDialog> m_xMessageDialog; + +public: + SalInstanceMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual void set_primary_text(const OUString& rText) override; + + virtual OUString get_primary_text() const override; + + virtual void set_secondary_text(const OUString& rText) override; + + virtual OUString get_secondary_text() const override; + + virtual weld::Container* weld_message_area() override; +}; + +class SalInstanceCheckButton : public SalInstanceButton, public virtual weld::CheckButton +{ +private: + VclPtr<CheckBox> m_xCheckButton; + + DECL_LINK(ToggleHdl, CheckBox&, void); + +public: + SalInstanceCheckButton(CheckBox* pButton, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void set_active(bool active) override; + + virtual bool get_active() const override; + + virtual void set_inconsistent(bool inconsistent) override; + + virtual bool get_inconsistent() const override; + + virtual ~SalInstanceCheckButton() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/salwtype.hxx b/vcl/inc/salwtype.hxx new file mode 100644 index 000000000..fc8aeb497 --- /dev/null +++ b/vcl/inc/salwtype.hxx @@ -0,0 +1,274 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SALWTYPE_HXX +#define INCLUDED_VCL_INC_SALWTYPE_HXX + +#include <i18nlangtag/lang.h> +#include <rtl/ref.hxx> +#include <rtl/ustring.hxx> +#include <tools/solar.h> +#include <vcl/GestureEvent.hxx> + +class LogicalFontInstance; +class SalGraphics; +class SalFrame; +class SalObject; +namespace vcl { class Window; } +enum class InputContextFlags; +enum class WindowStateMask; +enum class WindowStateState; +enum class ExtTextInputAttr; +enum class ModKeyFlags; + +enum class SalEvent { + NONE, + MouseMove, + MouseLeave, + MouseButtonDown, + MouseButtonUp, + KeyInput, + KeyUp, + KeyModChange, + Paint, + Resize, + GetFocus, + LoseFocus, + Close, + Shutdown, + SettingsChanged, + PrinterChanged, + DisplayChanged, + FontChanged, + WheelMouse, + UserEvent, + MouseActivate, + ExtTextInput, + EndExtTextInput, + ExtTextInputPos, + InputContextChange, + Move, + MoveResize, + ClosePopups, + ExternalKeyInput, + ExternalKeyUp, + MenuCommand, + MenuHighlight, + MenuActivate, + MenuDeactivate, + ExternalMouseMove, + ExternalMouseButtonDown, + ExternalMouseButtonUp, + InputLanguageChange, + ShowDialog, + MenuButtonCommand, + SurroundingTextRequest, + SurroundingTextSelectionChange, + StartReconversion, + QueryCharPosition, + Swipe, + LongPress, + ExternalGesture, + Gesture, +}; + +// MOUSELEAVE must send, when the pointer leave the client area and +// the mouse is not captured +// MOUSEMOVE, MOUSELEAVE, MOUSEBUTTONDOWN and MOUSEBUTTONUP +// MAC: Ctrl+Button is MOUSE_RIGHT +struct SalMouseEvent +{ + sal_uInt64 mnTime; // Time in ms, when event is created + long mnX; // X-Position (Pixel, TopLeft-Output) + long mnY; // Y-Position (Pixel, TopLeft-Output) + sal_uInt16 mnButton; // 0-MouseMove/MouseLeave, MOUSE_LEFT, MOUSE_RIGHT, MOUSE_MIDDLE + sal_uInt16 mnCode; // SV-Modifiercode (KEY_SHIFT|KEY_MOD1|KEY_MOD2|MOUSE_LEFT|MOUSE_MIDDLE|MOUSE_RIGHT) +}; + +// KEYINPUT and KEYUP +struct SalKeyEvent +{ + sal_uInt16 mnCode; // SV-KeyCode (KEY_xxx | KEY_SHIFT | KEY_MOD1 | KEY_MOD2) + sal_uInt16 mnCharCode; // SV-CharCode + sal_uInt16 mnRepeat; // Repeat-Count (KeyInputs-1) +}; + +// MENUEVENT +struct SalMenuEvent +{ + sal_uInt16 mnId; // Menu item ID + void* mpMenu; // pointer to VCL menu (class Menu) + + SalMenuEvent() : mnId( 0 ), mpMenu( nullptr ) {} + SalMenuEvent( sal_uInt16 i_nId, void* i_pMenu ) + : mnId( i_nId ), mpMenu( i_pMenu ) {} +}; + +// KEYMODCHANGE +struct SalKeyModEvent +{ + bool mbDown; // Whether the change occurred on a key down event + sal_uInt16 mnCode; // SV-Modifiercode (KEY_SHIFT|KEY_MOD1|KEY_MOD2) + ModKeyFlags mnModKeyCode; // extended Modifier (MODKEY_LEFT,MODKEY_RIGHT,MODKEY_PRESS,MODKEY_RELEASE) +}; + +struct SalPaintEvent +{ + long mnBoundX; // BoundRect - X + long mnBoundY; // BoundRect - Y + long mnBoundWidth; // BoundRect - Width + long mnBoundHeight; // BoundRect - Height + bool mbImmediateUpdate; // set to true to force an immediate update + + SalPaintEvent( long x, long y, long w, long h, bool bImmediate = false ) : + mnBoundX( x ), mnBoundY( y ), + mnBoundWidth( w ), mnBoundHeight( h ), + mbImmediateUpdate( bImmediate ) + {} +}; + +#define SAL_WHEELMOUSE_EVENT_PAGESCROLL (sal_uLong(0xFFFFFFFF)) +struct SalWheelMouseEvent +{ + sal_uInt64 mnTime; // Time in ms, when event is created + long mnX; // X-Position (Pixel, TopLeft-Output) + long mnY; // Y-Position (Pixel, TopLeft-Output) + long mnDelta; // Number of rotations + long mnNotchDelta; // Number of fixed rotations + double mnScrollLines; // Actual number of lines to scroll + sal_uInt16 mnCode; // SV-Modifiercode (KEY_SHIFT|KEY_MOD1|KEY_MOD2|MOUSE_LEFT|MOUSE_MIDDLE|MOUSE_RIGHT) + bool mbHorz; // Horizontal + bool mbDeltaIsPixel; // delta value is a pixel value (on touch devices) + + SalWheelMouseEvent() + : mnTime( 0 ), mnX( 0 ), mnY( 0 ), mnDelta( 0 ), mnNotchDelta( 0 ), mnScrollLines( 0 ), mnCode( 0 ), mbHorz( false ), mbDeltaIsPixel( false ) + {} +}; + +struct SalExtTextInputEvent +{ + OUString maText; // Text + const ExtTextInputAttr* mpTextAttr; // Text-Attribute + sal_Int32 mnCursorPos; // Cursor-Position + sal_uInt8 mnCursorFlags; // EXTTEXTINPUT_CURSOR_xxx +}; + +struct SalExtTextInputPosEvent +{ + long mnX; // Cursor-X-Position to upper left corner of frame + long mnY; // Cursor-Y-Position to upper left corner of frame + long mnWidth; // Cursor-Width in Pixel + long mnHeight; // Cursor-Height in Pixel + long mnExtWidth; // Width of the PreEdit area + bool mbVertical; // true if in vertical mode + SalExtTextInputPosEvent() + : mnX(0) + , mnY(0) + , mnWidth(0) + , mnHeight(0) + , mnExtWidth(0) + , mbVertical(false) + { + } +}; + +struct SalInputContextChangeEvent +{ +}; + +struct SalSurroundingTextRequestEvent +{ + OUString maText; // Text + sal_uLong mnStart; // The beginning index of selected range + sal_uLong mnEnd; // The end index of selected range +}; + +struct SalSurroundingTextSelectionChangeEvent +{ + sal_uLong mnStart; // The beginning index of selected range + sal_uLong mnEnd; // The end index of selected range +}; + +struct SalQueryCharPositionEvent +{ + bool mbValid; // The data is valid or not. + sal_uLong mnCharPos; // The index of character in a composition. + bool mbVertical; // The text is vertical or not. + long mnCursorBoundX; // The cursor bounds corresponding to the character specified by mnCharPos - X + long mnCursorBoundY; // The cursor bounds corresponding to the character specified by mnCharPos - Y + long mnCursorBoundWidth; // The cursor bounds corresponding to the character specified by mnCharPos - Width + long mnCursorBoundHeight; // The cursor bounds corresponding to the character specified by mnCharPos - Height +}; + +typedef bool (*SALFRAMEPROC)( vcl::Window* pInst, SalEvent nEvent, const void* pEvent ); + +enum class SalObjEvent { + GetFocus = 1, + LoseFocus = 2, + ToTop = 3 +}; + +struct SalFrameState +{ + WindowStateMask mnMask; + long mnX; + long mnY; + long mnWidth; + long mnHeight; + long mnMaximizedX; + long mnMaximizedY; + long mnMaximizedWidth; + long mnMaximizedHeight; + WindowStateState mnState; +}; + +struct SalInputContext +{ + rtl::Reference<LogicalFontInstance> mpFont; + InputContextFlags mnOptions; +}; + +struct SalSwipeEvent +{ + double mnVelocityX; + double mnVelocityY; + long mnX; + long mnY; +}; + +struct SalLongPressEvent +{ + long mnX; + long mnY; +}; + +struct SalGestureEvent +{ + GestureEventType meEventType; + PanningOrientation meOrientation; + double mfOffset; + long mnX; + long mnY; +}; + +typedef void (*SALTIMERPROC)(); + +#endif // INCLUDED_VCL_INC_SALWTYPE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/scanlinewriter.hxx b/vcl/inc/scanlinewriter.hxx new file mode 100644 index 000000000..a5b892b02 --- /dev/null +++ b/vcl/inc/scanlinewriter.hxx @@ -0,0 +1,90 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SCANLINEWRITER_HXX +#define INCLUDED_VCL_INC_SCANLINEWRITER_HXX + +#include <vcl/bitmap.hxx> +#include <vcl/BitmapPalette.hxx> + +namespace vcl +{ + +// Write color information for 1, 4 and 8 bit palette bitmap scanlines. +class ScanlineWriter +{ + BitmapPalette& maPalette; + sal_uInt8 const mnColorsPerByte; // number of colors that are stored in one byte + sal_uInt8 const mnColorBitSize; // number of bits a color takes + sal_uInt8 const mnColorBitMask; // bit mask used to isolate the color + sal_uInt8* mpCurrentScanline; + long mnX; + +public: + + ScanlineWriter(BitmapPalette& aPalette, sal_Int8 nColorsPerByte) + : maPalette(aPalette) + , mnColorsPerByte(nColorsPerByte) + , mnColorBitSize(8 / mnColorsPerByte) // bit size is number of bit in a byte divided by number of colors per byte (8 / 2 = 4 for 4-bit) + , mnColorBitMask((1 << mnColorBitSize) - 1) // calculate the bit mask from the bit size + , mpCurrentScanline(nullptr) + , mnX(0) + {} + + static std::unique_ptr<ScanlineWriter> Create(sal_uInt16 nBits, BitmapPalette& aPalette) + { + switch(nBits) + { + case 1: + return std::make_unique<ScanlineWriter>(aPalette, 8); + case 4: + return std::make_unique<ScanlineWriter>(aPalette, 2); + case 8: + return std::make_unique<ScanlineWriter>(aPalette, 1); + default: + abort(); + } + } + + void writeRGB(sal_uInt8 nR, sal_uInt8 nG, sal_uInt8 nB) + { + // calculate to which index we will write + long nScanlineIndex = mnX / mnColorsPerByte; + + // calculate the number of shifts to get the color information to the right place + long nShift = (8 - mnColorBitSize) - ((mnX % mnColorsPerByte) * mnColorBitSize); + + sal_uInt16 nColorIndex = maPalette.GetBestIndex(BitmapColor(nR, nG, nB)); + mpCurrentScanline[nScanlineIndex] &= ~(mnColorBitMask << nShift); // clear + mpCurrentScanline[nScanlineIndex] |= (nColorIndex & mnColorBitMask) << nShift; // set + mnX++; + } + + void nextLine(sal_uInt8* pScanline) + { + mnX = 0; + mpCurrentScanline = pScanline; + } +}; + +} // namespace vcl + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/schedulerimpl.hxx b/vcl/inc/schedulerimpl.hxx new file mode 100644 index 000000000..38f27a665 --- /dev/null +++ b/vcl/inc/schedulerimpl.hxx @@ -0,0 +1,70 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SCHEDULERIMPL_HXX +#define INCLUDED_VCL_INC_SCHEDULERIMPL_HXX + +#include "salwtype.hxx" +#include <osl/mutex.hxx> +#include <vcl/scheduler.hxx> + +class Task; + +// Internal scheduler record holding intrusive linked list pieces +struct ImplSchedulerData final +{ + ImplSchedulerData* mpNext; ///< Pointer to the next element in list + Task* mpTask; ///< Pointer to VCL Task instance + bool mbInScheduler; ///< Task currently processed? + sal_uInt64 mnUpdateTime; ///< Last Update Time + TaskPriority mePriority; ///< Task priority + + const char *GetDebugName() const; +}; + +class SchedulerMutex final +{ + sal_uInt32 mnLockDepth; + osl::Mutex maMutex; + +public: + SchedulerMutex() : mnLockDepth( 0 ) {} + + void acquire( sal_uInt32 nLockCount = 1 ); + sal_uInt32 release( bool bUnlockAll = false ); + sal_uInt32 lockDepth() const { return mnLockDepth; } +}; + +class SchedulerGuard final +{ +public: + SchedulerGuard() + { + Scheduler::Lock(); + } + + ~SchedulerGuard() + { + Scheduler::Unlock(); + } +}; + +#endif // INCLUDED_VCL_INC_SCHEDULERIMPL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/scrptrun.h b/vcl/inc/scrptrun.h new file mode 100644 index 000000000..b663deeed --- /dev/null +++ b/vcl/inc/scrptrun.h @@ -0,0 +1,158 @@ +/* + ******************************************************************************* + * + * Copyright (c) 1995-2013 International Business Machines Corporation and others + * + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, and/or sell copies of the + * Software, and to permit persons to whom the Software is furnished to do so, + * provided that the above copyright notice(s) and this permission notice appear + * in all copies of the Software and that both the above copyright notice(s) and + * this permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN + * NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE + * LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Except as contained in this notice, the name of a copyright holder shall not be + * used in advertising or otherwise to promote the sale, use or other dealings in + * this Software without prior written authorization of the copyright holder. + * + ******************************************************************************* + * file name: scrptrun.h + * + * created on: 10/17/2001 + * created by: Eric R. Mader + */ + +#ifndef INCLUDED_VCL_INC_SCRPTRUN_H +#define INCLUDED_VCL_INC_SCRPTRUN_H + +#include <sal/config.h> + +#include <unicode/uobject.h> +#include <unicode/uscript.h> +#include <vector> + +namespace vcl { + +struct ParenStackEntry +{ + int32_t pairIndex; + UScriptCode scriptCode; + ParenStackEntry() + : pairIndex(0) + , scriptCode(USCRIPT_INVALID_CODE) + { + } +}; + +class ScriptRun final : public icu::UObject { +public: + + ScriptRun(const UChar chars[], int32_t length); + + void reset(); + + void reset(int32_t start, int32_t count); + + void reset(const UChar chars[], int32_t start, int32_t length); + + int32_t getScriptStart() const; + + int32_t getScriptEnd() const; + + UScriptCode getScriptCode() const; + + UBool next(); + + /** +s * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.2 + */ + virtual UClassID getDynamicClassID() const override { return getStaticClassID(); } + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.2 + */ + static UClassID getStaticClassID() { return static_cast<UClassID>(const_cast<char *>(&fgClassID)); } + +private: + + int32_t charStart; + int32_t charLimit; + const UChar *charArray; + + int32_t scriptStart; + int32_t scriptEnd; + UScriptCode scriptCode; + + std::vector<ParenStackEntry> parenStack; + int32_t parenSP; + + /** + * The address of this static class variable serves as this class's ID + * for ICU "poor man's RTTI". + */ + static const char fgClassID; +}; + +inline ScriptRun::ScriptRun(const UChar chars[], int32_t length) +{ + reset(chars, 0, length); +} + +inline int32_t ScriptRun::getScriptStart() const +{ + return scriptStart; +} + +inline int32_t ScriptRun::getScriptEnd() const +{ + return scriptEnd; +} + +inline UScriptCode ScriptRun::getScriptCode() const +{ + return scriptCode; +} + +inline void ScriptRun::reset() +{ + scriptStart = charStart; + scriptEnd = charStart; + scriptCode = USCRIPT_INVALID_CODE; + parenSP = -1; + parenStack.resize(128); +} + +inline void ScriptRun::reset(int32_t start, int32_t length) +{ + charStart = start; + charLimit = start + length; + + reset(); +} + +inline void ScriptRun::reset(const UChar chars[], int32_t start, int32_t length) +{ + charArray = chars; + + reset(start, length); +} + +} + +#endif diff --git a/vcl/inc/scrwnd.hxx b/vcl/inc/scrwnd.hxx new file mode 100644 index 000000000..c55fbd985 --- /dev/null +++ b/vcl/inc/scrwnd.hxx @@ -0,0 +1,82 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SCRWND_HXX +#define INCLUDED_VCL_INC_SCRWND_HXX + +#include <vcl/floatwin.hxx> +#include <vcl/bitmap.hxx> +#include <vcl/image.hxx> + +class Timer; + +enum class WheelMode { + NONE = 0x0000, + VH = 0x0001, + V = 0x0002, + H = 0x0004, + ScrollVH = 0x0008, + ScrollV = 0x0010, + ScrollH = 0x0020 +}; +namespace o3tl { + template<> struct typed_flags<WheelMode> : is_typed_flags<WheelMode, 0x003f> {}; +} + +class ImplWheelWindow final : public FloatingWindow +{ +private: + + std::vector<Image> maImgList; + Point maLastMousePos; + Point maCenter; + std::unique_ptr<Timer> mpTimer; + sal_uInt64 mnRepaintTime; + sal_uInt64 mnTimeout; + WheelMode mnWheelMode; + sal_uLong mnMaxWidth; + sal_uLong mnActDist; + long mnActDeltaX; + long mnActDeltaY; + void ImplCreateImageList(); + void ImplSetRegion(const Bitmap& rRegionBmp); + using Window::ImplGetMousePointer; + PointerStyle ImplGetMousePointer( long nDistX, long nDistY ); + void ImplDrawWheel(vcl::RenderContext& rRenderContext); + void ImplRecalcScrollValues(); + + DECL_LINK(ImplScrollHdl, Timer *, void); + + virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; + virtual void MouseMove( const MouseEvent& rMEvt ) override; + virtual void MouseButtonUp( const MouseEvent& rMEvt ) override; + +public: + + explicit ImplWheelWindow( vcl::Window* pParent ); + virtual ~ImplWheelWindow() override; + virtual void dispose() override; + + void ImplStop(); + void ImplSetWheelMode( WheelMode nWheelMode ); +}; + +#endif // INCLUDED_VCL_INC_SCRWND_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx new file mode 100644 index 000000000..aca60a456 --- /dev/null +++ b/vcl/inc/sft.hxx @@ -0,0 +1,752 @@ +/* -*- 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 . + */ + +/** + * @file sft.hxx + * @brief Sun Font Tools + */ + +/* + * Generated fonts contain an XUID entry in the form of: + * + * 103 0 T C1 N C2 C3 + * + * 103 - Sun's Adobe assigned XUID number. Contact person: Alexander Gelfenbain <gelf@eng.sun.com> + * + * T - font type. 0: Type 3, 1: Type 42 + * C1 - CRC-32 of the entire source TrueType font + * N - number of glyphs in the subset + * C2 - CRC-32 of the array of glyph IDs used to generate the subset + * C3 - CRC-32 of the array of encoding numbers used to generate the subset + * + */ + +#ifndef INCLUDED_VCL_INC_SFT_HXX +#define INCLUDED_VCL_INC_SFT_HXX + +#include <vcl/dllapi.h> +#include <vcl/fontcapabilities.hxx> +#include <i18nlangtag/lang.h> + +#include <array> +#include <memory> +#include <vector> +#include <cstdint> + +namespace vcl +{ + +/*@{*/ + typedef sal_Int32 F16Dot16; /**< fixed: 16.16 */ +/*@}*/ + +/** Return value of OpenTTFont() and CreateT3FromTTGlyphs() */ + enum class SFErrCodes { + Ok, /**< no error */ + BadFile, /**< file not found */ + FileIo, /**< file I/O error */ + Memory, /**< memory allocation error */ + GlyphNum, /**< incorrect number of glyphs */ + BadArg, /**< incorrect arguments */ + TtFormat, /**< incorrect TrueType font format */ + FontNo /**< incorrect logical font number of a TTC font */ + }; + +#ifndef FW_THIN /* WIN32 compilation would conflict */ +/** Value of the weight member of the TTGlobalFontInfo struct */ + enum WeightClass { + FW_THIN = 100, /**< Thin */ + FW_EXTRALIGHT = 200, /**< Extra-light (Ultra-light) */ + FW_LIGHT = 300, /**< Light */ + FW_NORMAL = 400, /**< Normal (Regular) */ + FW_MEDIUM = 500, /**< Medium */ + FW_SEMIBOLD = 600, /**< Semi-bold (Demi-bold) */ + FW_BOLD = 700, /**< Bold */ + FW_EXTRABOLD = 800, /**< Extra-bold (Ultra-bold) */ + FW_BLACK = 900 /**< Black (Heavy) */ + }; +#endif /* FW_THIN */ + +/** Value of the width member of the TTGlobalFontInfo struct */ + enum WidthClass { + FWIDTH_ULTRA_CONDENSED = 1, /**< 50% of normal */ + FWIDTH_EXTRA_CONDENSED = 2, /**< 62.5% of normal */ + FWIDTH_CONDENSED = 3, /**< 75% of normal */ + FWIDTH_SEMI_CONDENSED = 4, /**< 87.5% of normal */ + FWIDTH_NORMAL = 5, /**< Medium, 100% */ + FWIDTH_SEMI_EXPANDED = 6, /**< 112.5% of normal */ + FWIDTH_EXPANDED = 7, /**< 125% of normal */ + FWIDTH_EXTRA_EXPANDED = 8, /**< 150% of normal */ + FWIDTH_ULTRA_EXPANDED = 9 /**< 200% of normal */ + }; + +/** Composite glyph flags definition */ + enum CompositeFlags { + ARG_1_AND_2_ARE_WORDS = 1, + ARGS_ARE_XY_VALUES = 1<<1, + ROUND_XY_TO_GRID = 1<<2, + WE_HAVE_A_SCALE = 1<<3, + MORE_COMPONENTS = 1<<5, + WE_HAVE_AN_X_AND_Y_SCALE = 1<<6, + WE_HAVE_A_TWO_BY_TWO = 1<<7, + WE_HAVE_INSTRUCTIONS = 1<<8, + USE_MY_METRICS = 1<<9, + OVERLAP_COMPOUND = 1<<10 + }; + +/** Structure used by GetTTSimpleCharMetrics() functions */ + typedef struct { + sal_uInt16 adv; /**< advance width or height */ + sal_Int16 sb; /**< left or top sidebearing */ + } TTSimpleGlyphMetrics; + +/** Structure used by the TrueType Creator and GetRawGlyphData() */ + + typedef struct { + sal_uInt32 glyphID; /**< glyph ID */ + sal_uInt16 nbytes; /**< number of bytes in glyph data */ + sal_uInt8 *ptr; /**< pointer to glyph data */ + sal_uInt16 aw; /**< advance width */ + sal_Int16 lsb; /**< left sidebearing */ + bool compflag; /**< false- if non-composite */ + sal_uInt16 npoints; /**< number of points */ + sal_uInt16 ncontours; /**< number of contours */ + /* */ + sal_uInt32 newID; /**< used internally by the TTCR */ + } GlyphData; + +/** Structure used by the TrueType Creator and CreateTTFromTTGlyphs() */ + typedef struct { + sal_uInt16 platformID; /**< Platform ID */ + sal_uInt16 encodingID; /**< Platform-specific encoding ID */ + LanguageType languageID; /**< Language ID */ + sal_uInt16 nameID; /**< Name ID */ + sal_uInt16 slen; /**< String length in bytes */ + sal_uInt8 *sptr; /**< Pointer to string data (not zero-terminated!) */ + } NameRecord; + +/** Return value of GetTTGlobalFontInfo() */ + + typedef struct { + char *family; /**< family name */ + sal_Unicode *ufamily; /**< family name UCS2 */ + char *subfamily; /**< subfamily name */ + sal_Unicode *usubfamily; /**< subfamily name UCS2 */ + char *psname; /**< PostScript name */ + sal_uInt16 macStyle; /**< macstyle bits from 'HEAD' table */ + int weight; /**< value of WeightClass or 0 if can't be determined */ + int width; /**< value of WidthClass or 0 if can't be determined */ + int pitch; /**< 0: proportional font, otherwise: monospaced */ + int italicAngle; /**< in counter-clockwise degrees * 65536 */ + int xMin; /**< global bounding box: xMin */ + int yMin; /**< global bounding box: yMin */ + int xMax; /**< global bounding box: xMax */ + int yMax; /**< global bounding box: yMax */ + int ascender; /**< typographic ascent. */ + int descender; /**< typographic descent. */ + int linegap; /**< typographic line gap.\ Negative values are treated as + zero in Win 3.1, System 6 and System 7. */ + int typoAscender; /**< OS/2 portable typographic ascender */ + int typoDescender; /**< OS/2 portable typographic descender */ + int typoLineGap; /**< OS/2 portable typographic line gap */ + int winAscent; /**< ascender metric for Windows */ + int winDescent; /**< descender metric for Windows */ + bool symbolEncoded; /**< true: MS symbol encoded */ + sal_uInt8 panose[10]; /**< PANOSE classification number */ + sal_uInt32 typeFlags; /**< type flags (copyright bits) */ + sal_uInt16 fsSelection; /**< OS/2 fsSelection */ + } TTGlobalFontInfo; + +/** ControlPoint structure used by GetTTGlyphPoints() */ + typedef struct { + sal_uInt32 flags; /**< 00000000 00000000 e0000000 bbbbbbbb */ + /**< b - byte flags from the glyf array */ + /**< e == 0 - regular point */ + /**< e == 1 - end contour */ + sal_Int16 x; /**< X coordinate in EmSquare units */ + sal_Int16 y; /**< Y coordinate in EmSquare units */ + } ControlPoint; + + struct TrueTypeFont; + +/* + Some table OS/2 consts + quick history: + OpenType has been created from TrueType + - original TrueType had an OS/2 table with a length of 68 bytes + (cf https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6OS2.html) + - There have been 6 versions (from version 0 to 5) + (cf https://docs.microsoft.com/en-us/typography/opentype/otspec140/os2ver0) + + For the record: + // From Initial TrueType version + TYPE NAME FROM BYTE + uint16 version 0 + int16 xAvgCharWidth 2 + uint16 usWeightClass 4 + uint16 usWidthClass 6 + uint16 fsType 8 + int16 ySubscriptXSize 10 + int16 ySubscriptYSize 12 + int16 ySubscriptXOffset 14 + int16 ySubscriptYOffset 16 + int16 ySuperscriptXSize 18 + int16 ySuperscriptYSize 20 + int16 ySuperscriptXOffset 22 + int16 ySuperscriptYOffset 24 + int16 yStrikeoutSize 26 + int16 yStrikeoutPosition 28 + int16 sFamilyClass 30 + uint8 panose[10] 32 + uint32 ulUnicodeRange1 42 + uint32 ulUnicodeRange2 46 + uint32 ulUnicodeRange3 50 + uint32 ulUnicodeRange4 54 + Tag achVendID 58 + uint16 fsSelection 62 + uint16 usFirstCharIndex 64 + uint16 usLastCharIndex 66 + + // From Version 0 of OpenType + int16 sTypoAscender 68 + int16 sTypoDescender 70 + int16 sTypoLineGap 72 + uint16 usWinAscent 74 + uint16 usWinDescent 76 + + => length for OpenType version 0 = 78 bytes + + // From Version 1 of OpenType + uint32 ulCodePageRange1 78 + uint32 ulCodePageRange2 82 + + => length for OpenType version 1 = 86 bytes + + // From Version 2 of OpenType + // (idem for Versions 3 and 4) + int16 sxHeight 86 + int16 sCapHeight 88 + uint16 usDefaultChar 90 + uint16 usBreakChar 92 + uint16 usMaxContext 94 + + => length for OpenType version 2, 3 and 4 = 96 bytes + + // From Version 5 of OpenType + uint16 usLowerOpticalPointSize 96 + uint16 usUpperOpticalPointSize 98 + END 100 + + => length for OS/2 table version 5 = 100 bytes + +*/ +constexpr int OS2_Legacy_length = 68; +constexpr int OS2_V0_length = 78; +constexpr int OS2_V1_length = 86; + +constexpr int OS2_usWeightClass_offset = 4; +constexpr int OS2_usWidthClass_offset = 6; +constexpr int OS2_fsType_offset = 8; +constexpr int OS2_panose_offset = 32; +constexpr int OS2_panoseNbBytes_offset = 10; +constexpr int OS2_ulUnicodeRange1_offset = 42; +constexpr int OS2_ulUnicodeRange2_offset = 46; +constexpr int OS2_ulUnicodeRange3_offset = 50; +constexpr int OS2_ulUnicodeRange4_offset = 54; +constexpr int OS2_fsSelection_offset = 62; +constexpr int OS2_typoAscender_offset = 68; +constexpr int OS2_typoDescender_offset = 70; +constexpr int OS2_typoLineGap_offset = 72; +constexpr int OS2_winAscent_offset = 74; +constexpr int OS2_winDescent_offset = 76; +constexpr int OS2_ulCodePageRange1_offset = 78; +constexpr int OS2_ulCodePageRange2_offset = 82; + +/* + Some table hhea consts + cf https://docs.microsoft.com/fr-fr/typography/opentype/spec/hhea + TYPE NAME FROM BYTE + uint16 majorVersion 0 + uint16 minorVersion 2 + FWORD ascender 4 + FWORD descender 6 + FWORD lineGap 8 + UFWORD advanceWidthMax 10 + FWORD minLeftSideBearing 12 + FWORD minRightSideBearing 14 + FWORD xMaxExtent 16 + int16 caretSlopeRise 18 + int16 caretSlopeRun 20 + int16 caretOffset 22 + int16 (reserved) 24 + int16 (reserved) 26 + int16 (reserved) 28 + int16 (reserved) 30 + int16 metricDataFormat 32 + uint16 numberOfHMetrics 34 + END 36 + + => length for hhea table = 36 bytes + +*/ +constexpr int HHEA_Length = 36; + +constexpr int HHEA_ascender_offset = 4; +constexpr int HHEA_descender_offset = 6; +constexpr int HHEA_lineGap_offset = 8; +constexpr int HHEA_caretSlopeRise_offset = 18; +constexpr int HHEA_caretSlopeRun_offset = 20; + +/* + Some table post consts + cf https://docs.microsoft.com/fr-fr/typography/opentype/spec/post + TYPE NAME FROM BYTE + Fixed version 0 + Fixed italicAngle 4 + FWord underlinePosition 8 + FWord underlineThickness 10 + uint32 isFixedPitch 12 + ... + +*/ +constexpr int POST_italicAngle_offset = 4; +constexpr int POST_underlinePosition_offset = 8; +constexpr int POST_underlineThickness_offset = 10; +constexpr int POST_isFixedPitch_offset = 12; + +/* + Some table head consts + cf https://docs.microsoft.com/fr-fr/typography/opentype/spec/head + TYPE NAME FROM BYTE + uit16 majorVersion 0 + uit16 minorVersion 2 + Fixed fontRevision 4 + uint32 checkSumAdjustment 8 + uint32 magicNumber 12 (= 0x5F0F3CF5) + uint16 flags 16 + uint16 unitsPerEm 18 + LONGDATETIME created 20 + LONGDATETIME modified 28 + int16 xMin 36 + int16 yMin 38 + int16 xMax 40 + int16 yMax 42 + uint16 macStyle 44 + uint16 lowestRecPPEM 46 + int16 fontDirectionHint 48 + int16 indexToLocFormat 50 + int16 glyphDataFormat 52 + + END 54 + + => length head table = 54 bytes +*/ +constexpr int HEAD_Length = 54; + +constexpr int HEAD_majorVersion_offset = 0; +constexpr int HEAD_fontRevision_offset = 4; +constexpr int HEAD_magicNumber_offset = 12; +constexpr int HEAD_flags_offset = 16; +constexpr int HEAD_unitsPerEm_offset = 18; +constexpr int HEAD_created_offset = 20; +constexpr int HEAD_xMin_offset = 36; +constexpr int HEAD_yMin_offset = 38; +constexpr int HEAD_xMax_offset = 40; +constexpr int HEAD_yMax_offset = 42; +constexpr int HEAD_macStyle_offset = 44; +constexpr int HEAD_lowestRecPPEM_offset = 46; +constexpr int HEAD_fontDirectionHint_offset = 48; +constexpr int HEAD_indexToLocFormat_offset = 50; +constexpr int HEAD_glyphDataFormat_offset = 52; + +/* + Some table maxp consts + cf https://docs.microsoft.com/fr-fr/typography/opentype/spec/maxp + For 0.5 version + TYPE NAME FROM BYTE + Fixed version 0 + uint16 numGlyphs 4 + + For 1.0 Version + Fixed version 0 + uint16 numGlyphs 4 + uint16 maxPoints 6 + uint16 maxContours 8 + uint16 maxCompositePoints 10 + uint16 maxCompositeContours 12 + ... + +*/ +constexpr int MAXP_Version1Length = 32; + +constexpr int MAXP_numGlyphs_offset = 4; +constexpr int MAXP_maxPoints_offset = 6; +constexpr int MAXP_maxContours_offset = 8; +constexpr int MAXP_maxCompositePoints_offset = 10; +constexpr int MAXP_maxCompositeContours_offset = 12; + +/* + Some table glyf consts + cf https://docs.microsoft.com/fr-fr/typography/opentype/spec/glyf + For 0.5 version + TYPE NAME FROM BYTE + int16 numberOfContours 0 + int16 xMin 2 + int16 yMin 4 + int16 xMax 6 + int16 yMax 8 + + END 10 + + => length glyf table = 10 bytes + +*/ +constexpr int GLYF_Length = 10; + +constexpr int GLYF_numberOfContours_offset = 0; +constexpr int GLYF_xMin_offset = 2; +constexpr int GLYF_yMin_offset = 4; +constexpr int GLYF_xMax_offset = 6; +constexpr int GLYF_yMax_offset = 8; + +constexpr sal_uInt32 T_true = 0x74727565; /* 'true' */ +constexpr sal_uInt32 T_ttcf = 0x74746366; /* 'ttcf' */ +constexpr sal_uInt32 T_otto = 0x4f54544f; /* 'OTTO' */ + +// standard TrueType table tags +constexpr sal_uInt32 T_maxp = 0x6D617870; +constexpr sal_uInt32 T_glyf = 0x676C7966; +constexpr sal_uInt32 T_head = 0x68656164; +constexpr sal_uInt32 T_loca = 0x6C6F6361; +constexpr sal_uInt32 T_name = 0x6E616D65; +constexpr sal_uInt32 T_hhea = 0x68686561; +constexpr sal_uInt32 T_hmtx = 0x686D7478; +constexpr sal_uInt32 T_cmap = 0x636D6170; +constexpr sal_uInt32 T_vhea = 0x76686561; +constexpr sal_uInt32 T_vmtx = 0x766D7478; +constexpr sal_uInt32 T_OS2 = 0x4F532F32; +constexpr sal_uInt32 T_post = 0x706F7374; +constexpr sal_uInt32 T_cvt = 0x63767420; +constexpr sal_uInt32 T_prep = 0x70726570; +constexpr sal_uInt32 T_fpgm = 0x6670676D; +constexpr sal_uInt32 T_gsub = 0x47535542; +constexpr sal_uInt32 T_CFF = 0x43464620; + + +/** + * @defgroup sft Sun Font Tools Exported Functions + */ + +/** + * Get the number of fonts contained in a TrueType collection + * @param fname - file name + * @return number of fonts or zero, if file is not a TTC file. + * @ingroup sft + */ + int CountTTCFonts(const char* fname); + +/** + * TrueTypeFont constructor. + * The font file has to be provided as a memory buffer and length + * @param pBuffer - memory buffer + * @param nLen - size of memory buffer + * @param facenum - logical font number within a TTC file. This value is ignored + * for TrueType fonts + * @param ttf - array of TrueTypeFonts + * @return value of SFErrCodes enum + * @ingroup sft + */ + SFErrCodes VCL_DLLPUBLIC OpenTTFontBuffer(const void* pBuffer, sal_uInt32 nLen, sal_uInt32 facenum, TrueTypeFont** ttf); +#if !defined(_WIN32) +/** + * TrueTypeFont constructor. + * Reads the font file and allocates the memory for the structure. + * on WIN32 the font has to be provided as a memory buffer and length + * @param fname - name of TrueType font file + * @param facenum - logical font number within a TTC file. This value is ignored + * for TrueType fonts + * @param ttf - array of TrueTypeFonts + * @return value of SFErrCodes enum + * @ingroup sft + */ + SFErrCodes VCL_DLLPUBLIC OpenTTFontFile(const char *fname, sal_uInt32 facenum, TrueTypeFont** ttf); +#endif + + bool VCL_DLLPUBLIC getTTCoverage( + std::optional<std::bitset<UnicodeCoverage::MAX_UC_ENUM>> & rUnicodeCoverage, + std::optional<std::bitset<CodePageCoverage::MAX_CP_ENUM>> & rCodePageCoverage, + const unsigned char* pTable, size_t nLength); + +/** + * TrueTypeFont destructor. Deallocates the memory. + * @ingroup sft + */ + void VCL_DLLPUBLIC CloseTTFont(TrueTypeFont *); + +/** + * Extracts TrueType control points, and stores them in an allocated array pointed to + * by *pointArray. This function returns the number of extracted points. + * + * @param ttf pointer to the TrueTypeFont structure + * @param glyphID Glyph ID + * @param pointArray Return value - address of the pointer to the first element of the array + * of points allocated by the function + * @return Returns the number of points in *pointArray or -1 if glyphID is + * invalid. + * @ingroup sft + * + */ + int GetTTGlyphPoints(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoint **pointArray); + +/** + * Extracts raw glyph data from the 'glyf' table and returns it in an allocated + * GlyphData structure. + * + * @param ttf pointer to the TrueTypeFont structure + * @param glyphID Glyph ID + * + * @return pointer to an allocated GlyphData structure or NULL if + * glyphID is not present in the font + * @ingroup sft + * + */ + GlyphData *GetTTRawGlyphData(TrueTypeFont *ttf, sal_uInt32 glyphID); + +/** + * For a specified glyph adds all component glyphs IDs to the list and + * return their number. If the glyph is a single glyph it has one component + * glyph (which is added to the list) and the function returns 1. + * For a composite glyphs it returns the number of component glyphs + * and adds all of them to the list. + * + * @param ttf pointer to the TrueTypeFont structure + * @param glyphID Glyph ID + * @param glyphlist list of glyphs + * + * @return number of component glyphs + * @ingroup sft + * + */ + int GetTTGlyphComponents(TrueTypeFont *ttf, sal_uInt32 glyphID, std::vector< sal_uInt32 >& glyphlist); + +/** + * Extracts all Name Records from the font and stores them in an allocated + * array of NameRecord structs + * + * @param ttf pointer to the TrueTypeFont struct + * @param nr pointer to the array of NameRecord structs + * + * @return number of NameRecord structs + * @ingroup sft + */ + + int GetTTNameRecords(TrueTypeFont const *ttf, NameRecord **nr); + +/** + * Deallocates previously allocated array of NameRecords. + * + * @param nr array of NameRecord structs + * @param n number of elements in the array + * + * @ingroup sft + */ + void DisposeNameRecords(NameRecord* nr, int n); + +/** + * Generates a new PostScript Type 3 font and dumps it to <b>outf</b> file. + * This function substitutes glyph 0 for all glyphIDs that are not found in the font. + * @param ttf pointer to the TrueTypeFont structure + * @param outf the resulting font is written to this stream + * @param fname font name for the new font. If it is NULL the PostScript name of the + * original font will be used + * @param glyphArray pointer to an array of glyphs that are to be extracted from ttf + * @param encoding array of encoding values. encoding[i] specifies the position of the glyph + * glyphArray[i] in the encoding vector of the resulting Type3 font + * @param nGlyphs number of glyph IDs in glyphArray and encoding values in encoding + * @param wmode writing mode for the output file: 0 - horizontal, 1 - vertical + * @return return the value of SFErrCodes enum + * @see SFErrCodes + * @ingroup sft + * + */ + SFErrCodes CreateT3FromTTGlyphs(TrueTypeFont *ttf, FILE *outf, const char *fname, sal_uInt16 const *glyphArray, sal_uInt8 *encoding, int nGlyphs, int wmode); + +/** + * Generates a new TrueType font and dumps it to <b>outf</b> file. + * This function substitutes glyph 0 for all glyphIDs that are not found in the font. + * @param ttf pointer to the TrueTypeFont structure + * @param fname file name for the output TrueType font file + * @param glyphArray pointer to an array of glyphs that are to be extracted from ttf. The first + * element of this array has to be glyph 0 (default glyph) + * @param encoding array of encoding values. encoding[i] specifies character code for + * the glyphID glyphArray[i]. Character code 0 usually points to a default + * glyph (glyphID 0) + * @param nGlyphs number of glyph IDs in glyphArray and encoding values in encoding + * @param flags or'ed TTCreationFlags + * @return return the value of SFErrCodes enum + * @see SFErrCodes + * @ingroup sft + * + */ + VCL_DLLPUBLIC SFErrCodes CreateTTFromTTGlyphs(TrueTypeFont *ttf, + const char *fname, + sal_uInt16 const *glyphArray, + sal_uInt8 const *encoding, + int nGlyphs); + +/** + * Generates a new PostScript Type42 font and dumps it to <b>outf</b> file. + * This function substitutes glyph 0 for all glyphIDs that are not found in the font. + * @param ttf pointer to the TrueTypeFont structure + * @param outf output stream for a resulting font + * @param psname PostScript name of the resulting font + * @param glyphArray pointer to an array of glyphs that are to be extracted from ttf. The first + * element of this array has to be glyph 0 (default glyph) + * @param encoding array of encoding values. encoding[i] specifies character code for + * the glyphID glyphArray[i]. Character code 0 usually points to a default + * glyph (glyphID 0) + * @param nGlyphs number of glyph IDs in glyphArray and encoding values in encoding + * @return SFErrCodes::Ok - no errors + * SFErrCodes::GlyphNum - too many glyphs (> 255) + * SFErrCodes::TtFormat - corrupted TrueType fonts + * + * @see SFErrCodes + * @ingroup sft + * + */ + SFErrCodes CreateT42FromTTGlyphs(TrueTypeFont *ttf, + FILE *outf, + const char *psname, + sal_uInt16 const *glyphArray, + sal_uInt8 *encoding, + int nGlyphs); + +/** + * Queries glyph metrics. Allocates an array of advance width/height values and returns it. + * + * @param ttf pointer to the TrueTypeFont structure + * @param glyphArray pointer to an array of glyphs that are to be extracted from ttf + * @param nGlyphs number of glyph IDs in glyphArray and encoding values in encoding + * @param vertical writing mode: false - horizontal, true - vertical + * @ingroup sft + * + */ + VCL_DLLPUBLIC std::unique_ptr<sal_uInt16[]> GetTTSimpleGlyphMetrics(TrueTypeFont const *ttf, const sal_uInt16 *glyphArray, int nGlyphs, bool vertical); + +#if defined(_WIN32) || defined(MACOSX) || defined(IOS) +/** + * Maps a Unicode (UCS-2) character to a glyph ID and returns it. Missing glyph has + * a glyphID of 0 so this function can be used to test if a character is encoded in the font. + * + * @param ttf pointer to the TrueTypeFont structure + * @param ch Unicode (UCS-2) character + * @return glyph ID, if the character is missing in the font, the return value is 0. + * @ingroup sft + */ + VCL_DLLPUBLIC sal_uInt16 MapChar(TrueTypeFont const *ttf, sal_uInt16 ch); +#endif + +/** + * Returns global font information about the TrueType font. + * @see TTGlobalFontInfo + * + * @param ttf pointer to a TrueTypeFont structure + * @param info pointer to a TTGlobalFontInfo structure + * @ingroup sft + * + */ + VCL_DLLPUBLIC void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info); + +/** + * Returns fonts metrics. + * @see TTGlobalFontInfo + * + * @param hhea hhea table data + * @param os2 OS/2 table data + * @param info pointer to a TTGlobalFontInfo structure + * @ingroup sft + * + */ + void GetTTFontMetrics(const uint8_t *pHhea, size_t nHhea, + const uint8_t *pOs2, size_t nOs2, + TTGlobalFontInfo *info); + +/** + * returns the number of glyphs in a font + */ + VCL_DLLPUBLIC int GetTTGlyphCount( TrueTypeFont const * ttf ); + +/** + * provide access to the raw data of a SFNT-container's subtable + */ + bool GetSfntTable( TrueTypeFont const * ttf, int nSubtableIndex, + const sal_uInt8** ppRawBytes, int* pRawLength ); + +/*- private definitions */ + +/* indexes into TrueTypeFont::tables[] and TrueTypeFont::tlens[] */ +constexpr int O_maxp = 0; +constexpr int O_glyf = 1; /* 'glyf' */ +constexpr int O_head = 2; /* 'head' */ +constexpr int O_loca = 3; /* 'loca' */ +constexpr int O_name = 4; /* 'name' */ +constexpr int O_hhea = 5; /* 'hhea' */ +constexpr int O_hmtx = 6; /* 'hmtx' */ +constexpr int O_cmap = 7; /* 'cmap' */ +constexpr int O_vhea = 8; /* 'vhea' */ +constexpr int O_vmtx = 9; /* 'vmtx' */ +constexpr int O_OS2 = 10; /* 'OS/2' */ +constexpr int O_post = 11; /* 'post' */ +constexpr int O_cvt = 12; /* 'cvt_' - only used in TT->TT generation */ +constexpr int O_prep = 13; /* 'prep' - only used in TT->TT generation */ +constexpr int O_fpgm = 14; /* 'fpgm' - only used in TT->TT generation */ +constexpr int O_gsub = 15; /* 'GSUB' */ +constexpr int O_CFF = 16; /* 'CFF' */ +constexpr int NUM_TAGS = 17; + + struct TrueTypeFont { + char *fname; + sal_Int32 fsize; + sal_uInt8 *ptr; + + char *psname; + char *family; + sal_Unicode *ufamily; + char *subfamily; + sal_Unicode *usubfamily; + + sal_uInt32 ntables; + sal_uInt32 *goffsets; + sal_uInt32 nglyphs; + sal_uInt32 unitsPerEm; + sal_uInt32 numberOfHMetrics; + sal_uInt32 numOfLongVerMetrics; /* if this number is not 0, font has vertical metrics information */ + const sal_uInt8* cmap; + int cmapType; + sal_uInt32 (*mapper)(const sal_uInt8 *, sal_uInt32, sal_uInt32); /* character to glyphID translation function */ + std::array<const sal_uInt8 *, NUM_TAGS> tables; /* array of pointers to raw subtables in SFNT file */ + std::array<sal_uInt32, NUM_TAGS> tlens; /* array of table lengths */ + }; + + +} // namespace vcl + +#endif // INCLUDED_VCL_INC_SFT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx new file mode 100644 index 000000000..ca227e4e8 --- /dev/null +++ b/vcl/inc/skia/gdiimpl.hxx @@ -0,0 +1,332 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_SKIA_GDIIMPL_HXX +#define INCLUDED_VCL_SKIA_GDIIMPL_HXX + +#include <vcl/dllapi.h> + +#include <salgdiimpl.hxx> +#include <salgeom.hxx> + +#include <SkSurface.h> +#include <SkRegion.h> + +#include <prewin.h> +#include <tools/sk_app/WindowContext.h> +#include <postwin.h> + +class SkiaFlushIdle; +class GenericSalLayout; +class SkFont; +class SkiaSalBitmap; + +class VCL_DLLPUBLIC SkiaSalGraphicsImpl : public SalGraphicsImpl +{ +public: + SkiaSalGraphicsImpl(SalGraphics& pParent, SalGeometryProvider* pProvider); + virtual ~SkiaSalGraphicsImpl() override; + + virtual void Init() override; + + virtual void DeInit() override; + + virtual OUString getRenderBackendName() const override { return "skia"; } + + const vcl::Region& getClipRegion() const; + virtual bool setClipRegion(const vcl::Region&) override; + + // + // get the depth of the device + virtual sal_uInt16 GetBitCount() const override; + + // get the width of the device + virtual long GetGraphicsWidth() const override; + + // set the clip region to empty + virtual void ResetClipRegion() override; + + // set the line color to transparent (= don't draw lines) + + virtual void SetLineColor() override; + + // set the line color to a specific color + virtual void SetLineColor(Color nColor) override; + + // set the fill color to transparent (= don't fill) + virtual void SetFillColor() override; + + // set the fill color to a specific color, shapes will be + // filled accordingly + virtual void SetFillColor(Color nColor) override; + + // enable/disable XOR drawing + virtual void SetXORMode(bool bSet, bool bInvertOnly) override; + + // set line color for raster operations + virtual void SetROPLineColor(SalROPColor nROPColor) override; + + // set fill color for raster operations + virtual void SetROPFillColor(SalROPColor nROPColor) override; + + // draw --> LineColor and FillColor and RasterOp and ClipRegion + virtual void drawPixel(long nX, long nY) override; + virtual void drawPixel(long nX, long nY, Color nColor) 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::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolyPolygon&, double fTransparency) override; + + virtual bool drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolygon&, double fTransparency, double fLineWidth, + const std::vector<double>* pStroke, basegfx::B2DLineJoin, + css::drawing::LineCap, double fMiterMinimumAngle, + bool bPixelSnapHairline) 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; + + // CopyArea --> No RasterOp, but ClipRegion + 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 bool blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap) override; + + virtual bool blendAlphaBitmap(const SalTwoRect&, const SalBitmap& rSrcBitmap, + const SalBitmap& rMaskBitmap, + const SalBitmap& rAlphaBitmap) override; + + virtual void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) override; + + virtual void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, + const SalBitmap& rMaskBitmap) override; + + virtual void drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, + Color nMaskColor) override; + + virtual std::shared_ptr<SalBitmap> getBitmap(long nX, long nY, long nWidth, + long nHeight) override; + + virtual Color getPixel(long nX, long nY) override; + + // invert --> ClipRegion (only Windows or VirDevs) + 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_uInt32 nSize) override; + + /** Render bitmap with alpha channel + + @param rSourceBitmap + Source bitmap to blit + + @param rAlphaBitmap + Alpha channel to use for blitting + + @return true, if the operation succeeded, and false + otherwise. In this case, clients should try to emulate alpha + compositing themselves + */ + virtual bool drawAlphaBitmap(const SalTwoRect&, const SalBitmap& rSourceBitmap, + const SalBitmap& rAlphaBitmap) override; + + /** draw transformed bitmap (maybe with alpha) where Null, X, Y define the coordinate system */ + virtual bool drawTransformedBitmap(const basegfx::B2DPoint& rNull, const basegfx::B2DPoint& rX, + const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap, + const SalBitmap* pAlphaBitmap) override; + + /** Render solid rectangle with given transparency + + @param nX Top left coordinate of rectangle + + @param nY Bottom right coordinate of rectangle + + @param nWidth Width of rectangle + + @param nHeight Height of rectangle + + @param nTransparency Transparency value (0-255) to use. 0 blits and opaque, 255 a + fully transparent rectangle + + @returns true if successfully drawn, false if not able to draw rectangle + */ + virtual bool drawAlphaRect(long nX, long nY, long nWidth, long nHeight, + sal_uInt8 nTransparency) override; + + virtual bool drawGradient(const tools::PolyPolygon& rPolygon, + const Gradient& rGradient) override; + + virtual bool supportsOperation(OutDevSupportType eType) const override; + +#ifdef DBG_UTIL + void dump(const char* file) const; +#endif + + // Default blend mode for SkPaint is SkBlendMode::kSrcOver + void drawImage(const SalTwoRect& rPosAry, const sk_sp<SkImage>& aImage, + SkBlendMode eBlendMode = SkBlendMode::kSrcOver); + + void drawShader(const SalTwoRect& rPosAry, const sk_sp<SkShader>& shader); + + enum class GlyphOrientation + { + Apply, + Ignore + }; + void drawGenericLayout(const GenericSalLayout& layout, Color textColor, const SkFont& font, + GlyphOrientation glyphOrientation); + +protected: + // To be called before any drawing. + void preDraw(); + // To be called after any drawing. + void postDraw(); + // The canvas to draw to. Will be diverted to a temporary for Xor mode. + SkCanvas* getDrawCanvas() { return mXorMode ? getXorCanvas() : mSurface->getCanvas(); } + // Call before makeImageSnapshot(), ensures the content is up to date. + void flushDrawing(); + + virtual void createSurface(); + // Call to ensure that mSurface is valid. If mSurface is going to be modified, + // use preDraw() instead of this. + void checkSurface(); + void destroySurface(); + // Reimplemented for X11. + virtual bool avoidRecreateByResize() const { return false; } + void createWindowSurface(bool forceRaster = false); + virtual void createWindowContext(bool forceRaster = false) = 0; + void createOffscreenSurface(); + + void privateDrawAlphaRect(long nX, long nY, long nWidth, long nHeight, double nTransparency, + bool blockAA = false); + + void setProvider(SalGeometryProvider* provider) { mProvider = provider; } + + bool isOffscreen() const { return mProvider == nullptr || mProvider->IsOffScreen(); } + bool isGPU() const { return mIsGPU; } + + void invert(basegfx::B2DPolygon const& rPoly, SalInvert eFlags); + + // Called by SkiaFlushIdle. + virtual void performFlush() = 0; + void scheduleFlush(); + friend class SkiaFlushIdle; + + // get the width of the device + int GetWidth() const { return mProvider ? mProvider->GetWidth() : 1; } + // get the height of the device + int GetHeight() const { return mProvider ? mProvider->GetHeight() : 1; } + + SkCanvas* getXorCanvas(); + void applyXor(); + // NOTE: This must be called before the operation does any drawing. + void addXorRegion(const SkRect& rect) + { + if (mXorMode) + { + // Make slightly larger, just in case (rounding, antialiasing,...). + SkIRect addedRect = rect.makeOutset(2, 2).round(); + // Two xor operations should cancel each other out. We batch xor operations, + // but if they can overlap, apply xor now, since applyXor() does the operation + // just once. + if (mXorRegion.intersects(addedRect)) + applyXor(); + mXorRegion.op(addedRect, SkRegion::kUnion_Op); + } + } + static void setCanvasClipRegion(SkCanvas* canvas, const vcl::Region& region); + sk_sp<SkImage> mergeCacheBitmaps(const SkiaSalBitmap& bitmap, const SkiaSalBitmap* alphaBitmap, + const Size targetSize); + + // Skia uses floating point coordinates, so when we use integer coordinates, sometimes + // rounding results in off-by-one errors (down), especially when drawing using GPU, + // see https://bugs.chromium.org/p/skia/issues/detail?id=9611 . Compensate for + // it by using centers of pixels. Using 0.5 may sometimes round up, so go with 0.495 . + static constexpr SkScalar toSkX(long x) { return x + 0.495; } + static constexpr SkScalar toSkY(long y) { return y + 0.495; } + // Value to add to be exactly in the middle of the pixel. + static constexpr SkScalar toSkXYFix = SkScalar(0.005); + + // Perform any pending drawing such as delayed merging of polygons. Called by preDraw() + // and anything that means the next operation cannot be another one in a series (e.g. + // changing colors). + void checkPendingDrawing(); + bool delayDrawPolyPolygon(const basegfx::B2DPolyPolygon& polygon, double transparency); + void performDrawPolyPolygon(const basegfx::B2DPolyPolygon& polygon, double transparency, + bool useAA); + + template <typename charT, typename traits> + friend inline std::basic_ostream<charT, traits>& + operator<<(std::basic_ostream<charT, traits>& stream, const SkiaSalGraphicsImpl* graphics) + { // O - offscreen, G - GPU-based, R - raster + return stream << static_cast<const void*>(graphics) << " " + << Size(graphics->GetWidth(), graphics->GetHeight()) + << (graphics->isGPU() ? "G" : "R") << (graphics->isOffscreen() ? "O" : ""); + } + + SalGraphics& mParent; + /// Pointer to the SalFrame or SalVirtualDevice + SalGeometryProvider* mProvider; + std::unique_ptr<sk_app::WindowContext> mWindowContext; + // The Skia surface that is target of all the rendering. + sk_sp<SkSurface> mSurface; + bool mIsGPU; // whether the surface is GPU-backed + // Keep reference to shared GrContext. + vcl::Region mClipRegion; + Color mLineColor; + Color mFillColor; + bool mXorMode; + SkBitmap mXorBitmap; + std::unique_ptr<SkCanvas> mXorCanvas; + SkRegion mXorRegion; // the area that needs updating for the xor operation + std::unique_ptr<SkiaFlushIdle> mFlush; + // Info about pending polygons to draw (we try to merge adjacent polygons into one). + struct LastPolyPolygonInfo + { + basegfx::B2DPolyPolygonVector polygons; + basegfx::B2DRange bounds; + double transparency; + }; + LastPolyPolygonInfo mLastPolyPolygonInfo; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/skia/salbmp.hxx b/vcl/inc/skia/salbmp.hxx new file mode 100644 index 000000000..5079be088 --- /dev/null +++ b/vcl/inc/skia/salbmp.hxx @@ -0,0 +1,134 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SKIA_SALBMP_H +#define INCLUDED_VCL_INC_SKIA_SALBMP_H + +#include <salbmp.hxx> + +#include <SkImage.h> + +#include <boost/shared_ptr.hpp> + +class VCL_PLUGIN_PUBLIC SkiaSalBitmap final : public SalBitmap +{ +public: + SkiaSalBitmap(); + SkiaSalBitmap(const sk_sp<SkImage>& image); + virtual ~SkiaSalBitmap() override; + + // SalBitmap methods + 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_uInt8 nTol) override; + virtual bool InterpretAs8Bit() override; + virtual bool ConvertToGreyscale() override; + + const BitmapPalette& Palette() const { return mPalette; } + // Returns the contents as SkImage (possibly GPU-backed). + const sk_sp<SkImage>& GetSkImage() const; + + // Returns the contents as alpha SkImage (possibly GPU-backed) + const sk_sp<SkImage>& GetAlphaSkImage() const; + +#ifdef DBG_UTIL + void dump(const char* file) const; +#endif + +private: + // Reset the cached images allocated in GetSkImage()/GetAlphaSkImage(). + void ResetCachedData(); + // Sets the data only as SkImage (will be converted as needed). + void ResetToSkImage(sk_sp<SkImage> image); + // Resets all data that does not match mSize. + void ResetCachedDataBySize(); + // Call to ensure mBuffer has data (will convert from mImage if necessary). + void EnsureBitmapData(); + void EnsureBitmapData() const { return const_cast<SkiaSalBitmap*>(this)->EnsureBitmapData(); } + // Like EnsureBitmapData(), but will also make any shared data unique. + // Call before changing the data. + void EnsureBitmapUniqueData(); + // Allocate mBuffer (with uninitialized contents). + bool CreateBitmapData(); + SkBitmap GetAsSkBitmap() const; +#ifdef DBG_UTIL + void verify() const; +#else + void verify() const {}; +#endif + + template <typename charT, typename traits> + friend inline std::basic_ostream<charT, traits>& + operator<<(std::basic_ostream<charT, traits>& stream, const SkiaSalBitmap* bitmap) + { + // I/i - has SkImage (on GPU/CPU), + // A/a - has alpha SkImage (on GPU/CPU) + return stream << static_cast<const void*>(bitmap) << " " << bitmap->GetSize() << "/" + << (bitmap->mImage ? (bitmap->mImage->isTextureBacked() ? "I" : "i") : "") + << (bitmap->mAlphaImage ? (bitmap->mAlphaImage->isTextureBacked() ? "A" : "a") + : ""); + } + + BitmapPalette mPalette; + int mBitCount = 0; // bpp + Size mSize; + // The contents of the bitmap may be stored in several different ways: + // As mBuffer buffer, which normally stores pixels in the given format. + // As SkImage, as cached GPU-backed data, but sometimes also a result of some operation. + // There is no "master" storage that the other would be derived from. The usual + // mode of operation is that mBuffer holds the data, mImage is created + // on demand as GPU-backed cached data by calling GetSkImage(), and the cached mImage + // is reset by ResetCachedImage(). But sometimes only mImage will be set and in that case + // mBuffer must be filled from it on demand if necessary by EnsureBitmapData(). + boost::shared_ptr<sal_uInt8[]> mBuffer; + int mScanlineSize; // size of one row in mBuffer + sk_sp<SkImage> mImage; // possibly GPU-backed + sk_sp<SkImage> mAlphaImage; // cached contents as alpha image, possibly GPU-backed + // Actual scaling triggered by scale() is done on-demand. This is the size of the pixel + // data in mBuffer, if it differs from mSize, then there is a scaling operation pending. + Size mPixelsSize; + SkFilterQuality mScaleQuality = kHigh_SkFilterQuality; // quality for on-demand scaling +#ifdef DBG_UTIL + int mWriteAccessCount = 0; // number of write AcquireAccess() that have not been released +#endif +}; + +#endif // INCLUDED_VCL_INC_SKIA_SALBMP_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/skia/utils.hxx b/vcl/inc/skia/utils.hxx new file mode 100644 index 000000000..a43ff8f58 --- /dev/null +++ b/vcl/inc/skia/utils.hxx @@ -0,0 +1,135 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SKIA_UTILS_H +#define INCLUDED_VCL_INC_SKIA_UTILS_H + +#include <vcl/skia/SkiaHelper.hxx> + +#include <tools/gen.hxx> +#include <driverblocklist.hxx> + +#include <SkRegion.h> +#include <tools/sk_app/VulkanWindowContext.h> + +namespace SkiaHelper +{ +// Get the one shared GrContext instance. +GrContext* getSharedGrContext(); + +void disableRenderMethod(RenderMethod method); + +// Create SkSurface, GPU-backed if possible. +VCL_DLLPUBLIC sk_sp<SkSurface> createSkSurface(int width, int height, + SkColorType type = kN32_SkColorType); + +inline sk_sp<SkSurface> createSkSurface(const Size& size, SkColorType type = kN32_SkColorType) +{ + return createSkSurface(size.Width(), size.Height(), type); +} + +// Create SkImage, GPU-backed if possible. +VCL_DLLPUBLIC sk_sp<SkImage> createSkImage(const SkBitmap& bitmap); + +// Call surface->makeImageSnapshot() and abort on failure. +VCL_DLLPUBLIC sk_sp<SkImage> makeCheckedImageSnapshot(sk_sp<SkSurface> surface); +VCL_DLLPUBLIC sk_sp<SkImage> makeCheckedImageSnapshot(sk_sp<SkSurface> surface, + const SkIRect& bounds); + +// Must be called in any VCL backend before any Skia functionality is used. +// If not set, Skia will be disabled. +VCL_DLLPUBLIC void + prepareSkia(std::unique_ptr<sk_app::WindowContext> (*createVulkanWindowContext)(bool)); + +// Shared cache of images. +void addCachedImage(const OString& key, sk_sp<SkImage> image); +sk_sp<SkImage> findCachedImage(const OString& key); +void removeCachedImage(sk_sp<SkImage> image); + +#ifdef DBG_UTIL +void prefillSurface(sk_sp<SkSurface>& surface); +VCL_DLLPUBLIC void dump(const SkBitmap& bitmap, const char* file); +VCL_DLLPUBLIC void dump(const sk_sp<SkImage>& image, const char* file); +VCL_DLLPUBLIC void dump(const sk_sp<SkSurface>& surface, const char* file); +#endif + +extern uint32_t vendorId; + +inline DriverBlocklist::DeviceVendor getVendor() +{ + return DriverBlocklist::GetVendorFromId(vendorId); +} + +} // namespace + +template <typename charT, typename traits> +inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream, + const SkRect& rectangle) +{ + if (rectangle.isEmpty()) + return stream << "EMPTY"; + else + return stream << rectangle.width() << 'x' << rectangle.height() << "@(" << rectangle.x() + << ',' << rectangle.y() << ")"; +} + +template <typename charT, typename traits> +inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream, + const SkIRect& rectangle) +{ + if (rectangle.isEmpty()) + return stream << "EMPTY"; + else + return stream << rectangle.width() << 'x' << rectangle.height() << "@(" << rectangle.x() + << ',' << rectangle.y() << ")"; +} + +template <typename charT, typename traits> +inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream, + const SkRegion& region) +{ + if (region.isEmpty()) + return stream << "EMPTY"; + stream << "("; + SkRegion::Iterator it(region); + for (int i = 0; !it.done(); it.next(), ++i) + stream << "[" << i << "] " << it.rect(); + stream << ")"; + return stream; +} + +template <typename charT, typename traits> +inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream, + const SkImage& image) +{ + // G - on GPU + return stream << static_cast<const void*>(&image) << " " << Size(image.width(), image.height()) + << "/" << (SkColorTypeBytesPerPixel(image.imageInfo().colorType()) * 8) + << (image.isTextureBacked() ? "G" : ""); +} +template <typename charT, typename traits> +inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream, + const sk_sp<SkImage>& image) +{ + return stream << *image; +} + +#endif // INCLUDED_VCL_INC_SKIA_UTILS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/skia/win/gdiimpl.hxx b/vcl/inc/skia/win/gdiimpl.hxx new file mode 100644 index 000000000..564fcd7e9 --- /dev/null +++ b/vcl/inc/skia/win/gdiimpl.hxx @@ -0,0 +1,102 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_SKIA_WIN_GDIIMPL_HXX +#define INCLUDED_VCL_INC_SKIA_WIN_GDIIMPL_HXX + +#include <memory> +#include <vcl/dllapi.h> + +#include <skia/gdiimpl.hxx> +#include <win/salgdi.h> +#include <win/wingdiimpl.hxx> +#include <o3tl/lru_map.hxx> +#include <ControlCacheKey.hxx> +#include <svdata.hxx> + +#include <SkFont.h> + +class SkTypeface; +class SkFontMgr; +class ControlCacheKey; + +class SkiaCompatibleDC : public CompatibleDC +{ +public: + SkiaCompatibleDC(SalGraphics& rGraphics, int x, int y, int width, int height); + + virtual std::unique_ptr<Texture> getAsMaskTexture() const override; + + sk_sp<SkImage> getAsImage() const; + sk_sp<SkImage> getAsMaskImage() const; + sk_sp<SkImage> getAsImageDiff(const SkiaCompatibleDC& white) const; + + struct Texture; +}; + +struct SkiaCompatibleDC::Texture : public CompatibleDC::Texture +{ + sk_sp<SkImage> image; + virtual bool isValid() const { return image.get(); } + virtual int GetWidth() const { return image->width(); } + virtual int GetHeight() const { return image->height(); } +}; + +class WinSkiaSalGraphicsImpl : public SkiaSalGraphicsImpl, public WinSalGraphicsImplBase +{ +private: + WinSalGraphics& mWinParent; + +public: + WinSkiaSalGraphicsImpl(WinSalGraphics& rGraphics, SalGeometryProvider* mpProvider); + + virtual void DeInit() override; + virtual void freeResources() override; + + virtual bool UseRenderNativeControl() const override { return true; } + virtual bool TryRenderCachedNativeControl(ControlCacheKey const& rControlCacheKey, int nX, + int nY) override; + virtual bool RenderAndCacheNativeControl(CompatibleDC& rWhite, CompatibleDC& rBlack, int nX, + int nY, ControlCacheKey& aControlCacheKey) override; + + virtual bool DrawTextLayout(const GenericSalLayout& layout) override; + virtual void ClearDevFontCache() override; + + static void prepareSkia(); + +protected: + virtual void createWindowContext(bool forceRaster = false) override; + virtual void performFlush() override; + sk_sp<SkTypeface> createDirectWriteTypeface(const LOGFONTW& logFont); + SkFont::Edging getFontEdging(); + IDWriteFactory* dwriteFactory; + IDWriteGdiInterop* dwriteGdiInterop; + sk_sp<SkFontMgr> dwriteFontMgr; + bool dwriteDone = false; + SkFont::Edging fontEdging; + bool fontEdgingDone = false; +}; + +typedef std::pair<ControlCacheKey, sk_sp<SkImage>> SkiaControlCachePair; +typedef o3tl::lru_map<ControlCacheKey, sk_sp<SkImage>, ControlCacheHashFunction> + SkiaControlCacheType; + +class SkiaControlsCache +{ + SkiaControlCacheType cache; + + SkiaControlsCache(); + +public: + static SkiaControlCacheType& get(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/skia/x11/gdiimpl.hxx b/vcl/inc/skia/x11/gdiimpl.hxx new file mode 100644 index 000000000..d131d54bf --- /dev/null +++ b/vcl/inc/skia/x11/gdiimpl.hxx @@ -0,0 +1,48 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_SKIA_X11_GDIIMPL_HXX +#define INCLUDED_VCL_INC_SKIA_X11_GDIIMPL_HXX + +#include <vcl/dllapi.h> + +#include <unx/salgdi.h> +#include <unx/x11/x11gdiimpl.h> +#include <skia/gdiimpl.hxx> +#include <skia/utils.hxx> + +class VCL_PLUGIN_PUBLIC X11SkiaSalGraphicsImpl final : public SkiaSalGraphicsImpl, + public X11GraphicsImpl +{ +private: + X11SalGraphics& mX11Parent; + +public: + X11SkiaSalGraphicsImpl(X11SalGraphics& rParent); + virtual ~X11SkiaSalGraphicsImpl() override; + + virtual void Init() override; + virtual void DeInit() override; + virtual void freeResources() override; + + static void prepareSkia(); + +private: + virtual void createWindowContext(bool forceRaster = false) override; + virtual void performFlush() override; + virtual bool avoidRecreateByResize() const override; + static std::unique_ptr<sk_app::WindowContext> + createWindowContext(Display* display, Drawable drawable, const XVisualInfo* visual, int width, + int height, SkiaHelper::RenderMethod renderMethod, bool temporary); + friend std::unique_ptr<sk_app::WindowContext> createVulkanWindowContext(bool); +}; + +#endif // INCLUDED_VCL_INC_SKIA_X11_GDIIMPL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/skia/x11/salvd.hxx b/vcl/inc/skia/x11/salvd.hxx new file mode 100644 index 000000000..8ff75175d --- /dev/null +++ b/vcl/inc/skia/x11/salvd.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/. + */ + +#ifndef INCLUDED_VCL_INC_SKIA_X11_SALVD_H +#define INCLUDED_VCL_INC_SKIA_X11_SALVD_H + +#include <salvd.hxx> + +class X11SkiaSalVirtualDevice : public SalVirtualDevice +{ + SalDisplay* mpDisplay; + std::unique_ptr<X11SalGraphics> mpGraphics; + bool mbGraphics; // is Graphics used + SalX11Screen mnXScreen; + int mnWidth; + int mnHeight; + +public: + X11SkiaSalVirtualDevice(SalGraphics const* pGraphics, long nDX, long nDY, + const SystemGraphicsData* pData, + std::unique_ptr<X11SalGraphics> pNewGraphics); + virtual ~X11SkiaSalVirtualDevice() override; + + // SalGeometryProvider + virtual long GetWidth() const override { return mnWidth; } + virtual long GetHeight() const override { return mnHeight; } + + SalDisplay* GetDisplay() const { return mpDisplay; } + const SalX11Screen& GetXScreenNumber() const { return mnXScreen; } + + virtual SalGraphics* AcquireGraphics() override; + virtual void ReleaseGraphics(SalGraphics* pGraphics) override; + + // Set new size, without saving the old contents + virtual bool SetSize(long nNewDX, long nNewDY) override; +}; + +#endif // INCLUDED_VCL_INC_SKIA_X11_SALVD_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/skia/x11/textrender.hxx b/vcl/inc/skia/x11/textrender.hxx new file mode 100644 index 000000000..d6eda9a04 --- /dev/null +++ b/vcl/inc/skia/x11/textrender.hxx @@ -0,0 +1,40 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SKIA_TEXTRENDER_HXX +#define INCLUDED_VCL_INC_SKIA_TEXTRENDER_HXX + +#include <unx/freetypetextrender.hxx> + +#include <SkFontMgr.h> +#include <SkFontMgr_fontconfig.h> + +class VCL_DLLPUBLIC SkiaTextRender final : public FreeTypeTextRenderImpl +{ +public: + virtual void DrawTextLayout(const GenericSalLayout&, const SalGraphics&) override; + virtual void ClearDevFontCache() override; + +private: + sk_sp<SkFontMgr> fontManager; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/skia/zone.hxx b/vcl/inc/skia/zone.hxx new file mode 100644 index 000000000..1f6bbb0dd --- /dev/null +++ b/vcl/inc/skia/zone.hxx @@ -0,0 +1,30 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_SKIA_ZONE_H +#define INCLUDED_VCL_INC_SKIA_ZONE_H + +#include <comphelper/crashzone.hxx> + +#include <vcl/dllapi.h> + +// Used around calls to Skia code to detect crashes in drivers. +class VCL_DLLPUBLIC SkiaZone : public CrashZone<SkiaZone> +{ +public: + static void hardDisable(); + static void relaxWatchdogTimings(); + static const CrashWatchdogTimingsValues& getCrashWatchdogTimingsValues(); + static void checkDebug(int nUnchanged, const CrashWatchdogTimingsValues& aTimingValues); + static const char* name() { return "Skia"; } +}; + +#endif // INCLUDED_VCL_INC_SKIA_ZONE_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/slider.hxx b/vcl/inc/slider.hxx new file mode 100644 index 000000000..6f57d269c --- /dev/null +++ b/vcl/inc/slider.hxx @@ -0,0 +1,103 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_SLIDER_HXX +#define INCLUDED_VCL_SLIDER_HXX + +#include <vcl/dllapi.h> +#include <vcl/ctrl.hxx> +#include <vcl/scrbar.hxx> + +class Slider final : public Control +{ +private: + tools::Rectangle maChannel1Rect; + tools::Rectangle maChannel2Rect; + tools::Rectangle maThumbRect; + long mnStartPos; + long mnMouseOff; + long mnThumbPixOffset; + long mnThumbPixRange; + long mnThumbPixPos; + long mnThumbSize; + long mnChannelPixRange; + long mnChannelPixTop; + long mnChannelPixBottom; + long mnMinRange; + long mnMaxRange; + long mnThumbPos; + long mnLineSize; + long mnPageSize; + sal_uInt16 mnStateFlags; + ScrollType meScrollType; + bool mbCalcSize; + + Link<Slider*,void> maSlideHdl; + + using Control::ImplInitSettings; + using Window::ImplInit; + void ImplInit( vcl::Window* pParent, WinBits nStyle ); + void ImplInitSettings(); + void ImplUpdateRects( bool bUpdate = true ); + long ImplCalcThumbPos( long nPixPos ); + long ImplCalcThumbPosPix( long nPos ); + void ImplCalc( bool bUpdate = true ); + void ImplDraw(vcl::RenderContext& rRenderContext); + bool ImplIsPageUp( const Point& rPos ); + bool ImplIsPageDown( const Point& rPos ); + long ImplSlide( long nNewPos ); + long ImplDoAction( ); + void ImplDoMouseAction( const Point& rPos, bool bCallAction ); + void ImplDoSlide( long nNewPos ); + void ImplDoSlideAction( ScrollType eScrollType ); + +public: + Slider( vcl::Window* pParent, WinBits nStyle); + virtual ~Slider() override; + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual void MouseButtonUp( const MouseEvent& rMEvt ) override; + virtual void Tracking( const TrackingEvent& rTEvt ) override; + virtual void KeyInput( const KeyEvent& rKEvt ) override; + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; + virtual void Resize() override; + virtual void StateChanged( StateChangedType nType ) override; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + + void Slide(); + + void SetRangeMin(long nNewRange); + long GetRangeMin() const { return mnMinRange; } + void SetRangeMax(long nNewRange); + long GetRangeMax() const { return mnMaxRange; } + void SetRange( const Range& rRange ); + void SetThumbPos( long nThumbPos ); + long GetThumbPos() const { return mnThumbPos; } + void SetLineSize( long nNewSize ) { mnLineSize = nNewSize; } + long GetLineSize() const { return mnLineSize; } + void SetPageSize( long nNewSize ) { mnPageSize = nNewSize; } + long GetPageSize() const { return mnPageSize; } + + Size CalcWindowSizePixel(); + + void SetSlideHdl( const Link<Slider*,void>& rLink ) { maSlideHdl = rLink; } +}; + +#endif // INCLUDED_VCL_SLIDER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/spin.hxx b/vcl/inc/spin.hxx new file mode 100644 index 000000000..7b7fbe11b --- /dev/null +++ b/vcl/inc/spin.hxx @@ -0,0 +1,43 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SPIN_HXX +#define INCLUDED_VCL_INC_SPIN_HXX + +#include <vcl/window.hxx> + +namespace tools { class Rectangle; } + +// Draw Spinners as found in a SpinButton. Some themes like gtk3 will draw +- elements here, +// so these are only suitable in the context of SpinButtons +void ImplDrawSpinButton(vcl::RenderContext& rRenderContext, vcl::Window* pWindow, + const tools::Rectangle& rUpperRect, const tools::Rectangle& rLowerRect, + bool bUpperIn, bool bLowerIn, bool bUpperEnabled = true, bool bLowerEnabled = true, + bool bHorz = false, bool bMirrorHorz = false); + +// Draw Up/Down buttons suitable for use in any context +void ImplDrawUpDownButtons(vcl::RenderContext& rRenderContext, + const tools::Rectangle& rUpperRect, const tools::Rectangle& rLowerRect, + bool bUpperIn, bool bLowerIn, bool bUpperEnabled, bool bLowerEnabled, + bool bHorz, bool bMirrorHorz = false); + + +#endif // INCLUDED_VCL_INC_SPIN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/strhelper.hxx b/vcl/inc/strhelper.hxx new file mode 100644 index 000000000..be2f54678 --- /dev/null +++ b/vcl/inc/strhelper.hxx @@ -0,0 +1,72 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_VCL_STRHELPER_HXX +#define INCLUDED_VCL_STRHELPER_HXX + +#include <cstring> +#include <rtl/math.hxx> +#include <rtl/ustring.hxx> +#include <vcl/dllapi.h> + +namespace psp +{ + OUString GetCommandLineToken( int, const OUString& ); + OString GetCommandLineToken(int, const OString&); + // gets one token of a unix command line style string + // doublequote, singlequote and singleleftquote protect their respective + // contents + + int GetCommandLineTokenCount(const OUString&); + // returns number of tokens (zero if empty or whitespace only) + + OUString WhitespaceToSpace( const OUString&, bool bProtect = true ); + OString WhitespaceToSpace(const OString&); + // returns a string with multiple adjacent occurrences of whitespace + // converted to a single space. if bProtect is sal_True (nonzero), then + // doublequote, singlequote and singleleftquote protect their respective + // contents + + + // parses the first double in the string; decimal is '.' only + inline double StringToDouble( const OUString& rStr ) + { + return rtl::math::stringToDouble(rStr, u'.', u'\0'); + } + + inline double StringToDouble(const OString& rStr) + { + return rtl::math::stringToDouble(rStr, '.', static_cast<char>(0)); + } + + // fills a character buffer with the string representation of a double + // the buffer has to be long enough (e.g. 128 bytes) + // returns the string len + inline int getValueOfDouble( char* pBuffer, double f, int nPrecision = 0) + { + OString aStr( rtl::math::doubleToString( f, rtl_math_StringFormat_G, nPrecision, '.', true ) ); + int nLen = aStr.getLength(); + std::strncpy( pBuffer, aStr.getStr(), nLen+1 ); // copy string including terminating zero + return nLen; + } + +} // namespace + +#endif // INCLUDED_VCL_STRHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/strings.hrc b/vcl/inc/strings.hrc new file mode 100644 index 000000000..e378b5481 --- /dev/null +++ b/vcl/inc/strings.hrc @@ -0,0 +1,158 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_STRINGS_HRC +#define INCLUDED_VCL_INC_STRINGS_HRC + +#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) + +#define SV_RESID_STRING_NOSELECTIONPOSSIBLE NC_("SV_RESID_STRING_NOSELECTIONPOSSIBLE", "<No selection possible>") + +#define SV_MENU_MAC_SERVICES NC_("SV_MENU_MAC_SERVICES", "Services") +#define SV_MENU_MAC_HIDEAPP NC_("SV_MENU_MAC_HIDEAPP", "Hide %PRODUCTNAME") +#define SV_MENU_MAC_HIDEALL NC_("SV_MENU_MAC_HIDEALL", "Hide Others") +#define SV_MENU_MAC_SHOWALL NC_("SV_MENU_MAC_SHOWALL", "Show All") +#define SV_MENU_MAC_QUITAPP NC_("SV_MENU_MAC_QUITAPP", "Quit %PRODUCTNAME") + +#define SV_HELPTEXT_CLOSE NC_("SV_HELPTEXT_CLOSE", "Close") +#define SV_HELPTEXT_MINIMIZE NC_("SV_HELPTEXT_MINIMIZE", "Minimize") +#define SV_HELPTEXT_MAXIMIZE NC_("SV_HELPTEXT_MAXIMIZE", "Maximize") +#define SV_HELPTEXT_RESTORE NC_("SV_HELPTEXT_RESTORE", "Restore") +#define SV_HELPTEXT_ROLLDOWN NC_("SV_HELPTEXT_ROLLDOWN", "Drop down") +#define SV_HELPTEXT_ROLLUP NC_("SV_HELPTEXT_ROLLUP", "Roll up") +#define SV_HELPTEXT_HELP NC_("SV_HELPTEXT_HELP", "Help") +#define SV_HELPTEXT_SCREENSHOT NC_("SV_HELPTEXT_SCREENSHOT", "Take and annotate a screenshot") +#define SV_HELPTEXT_FADEIN NC_("SV_HELPTEXT_FADEIN", "Show") +#define SV_HELPTEXT_FADEOUT NC_("SV_HELPTEXT_FADEOUT", "Hide") +#define SV_HELPTEXT_CLOSEDOCUMENT NC_("SV_HELPTEXT_CLOSEDOCUMENT", "Close Document") + +// To translators: This is used on buttons for platforms other than Windows, there should be a ~ mnemonic in this string +#define SV_BUTTONTEXT_OK NC_("SV_BUTTONTEXT_OK", "~OK") +// To translators: This is used on buttons for platforms other than windows, there should be a ~ mnemonic in this string +#define SV_BUTTONTEXT_CANCEL NC_("SV_BUTTONTEXT_CANCEL", "~Cancel") +// To translators: This is used on buttons for Windows, there should be no ~ mnemonic in this string +#define SV_BUTTONTEXT_OK_NOMNEMONIC NC_("SV_BUTTONTEXT_OK_NOMNEMONIC", "OK") +// To translators: This is used on buttons for Windows, there should be no ~ mnemonic in this string +#define SV_BUTTONTEXT_CANCEL_NOMNEMONIC NC_("SV_BUTTONTEXT_CANCEL_NOMNEMONIC", "Cancel") +#define SV_BUTTONTEXT_YES NC_("SV_BUTTONTEXT_YES", "~Yes") +#define SV_BUTTONTEXT_NO NC_("SV_BUTTONTEXT_NO", "~No") +#define SV_BUTTONTEXT_RETRY NC_("SV_BUTTONTEXT_RETRY", "~Retry") +#define SV_BUTTONTEXT_HELP NC_("SV_BUTTONTEXT_HELP", "~Help") +#define SV_BUTTONTEXT_CLOSE NC_("SV_BUTTONTEXT_CLOSE", "~Close") +#define SV_BUTTONTEXT_MORE NC_("SV_BUTTONTEXT_MORE", "~More") +#define SV_BUTTONTEXT_IGNORE NC_("SV_BUTTONTEXT_IGNORE", "~Ignore") +#define SV_BUTTONTEXT_ABORT NC_("SV_BUTTONTEXT_ABORT", "~Abort") +#define SV_BUTTONTEXT_LESS NC_("SV_BUTTONTEXT_LESS", "~Less") +#define SV_BUTTONTEXT_RESET NC_("SV_BUTTONTEXT_RESET", "R~eset") +#define SV_BUTTONTEXT_ADD NC_("SV_BUTTONTEXT_ADD", "~Add") +#define SV_BUTTONTEXT_DELETE NC_("SV_BUTTONTEXT_DELETE", "~Delete") +#define SV_BUTTONTEXT_REMOVE NC_("SV_BUTTONTEXT_REMOVE", "~Remove") +#define SV_BUTTONTEXT_NEW NC_("SV_BUTTONTEXT_NEW", "~New") +#define SV_BUTTONTEXT_EDIT NC_("SV_BUTTONTEXT_EDIT", "~Edit") +#define SV_BUTTONTEXT_APPLY NC_("SV_BUTTONTEXT_APPLY", "~Apply") +#define SV_BUTTONTEXT_SAVE NC_("SV_BUTTONTEXT_SAVE", "~Save") +#define SV_BUTTONTEXT_UNDO NC_("SV_BUTTONTEXT_UNDO", "~Undo") +#define SV_BUTTONTEXT_PASTE NC_("SV_BUTTONTEXT_PASTE", "~Paste") +#define SV_BUTTONTEXT_NEXT NC_("SV_BUTTONTEXT_NEXT", "~Next") +#define SV_BUTTONTEXT_PREV NC_("SV_BUTTONTEXT_PREV", "~Previous") +#define SV_BUTTONTEXT_GO_UP NC_("SV_BUTTONTEXT_GO_UP", "~Up") +#define SV_BUTTONTEXT_GO_DOWN NC_("SV_BUTTONTEXT_GO_DOWN", "Do~wn") +#define SV_BUTTONTEXT_CLEAR NC_("SV_BUTTONTEXT_CLEAR", "~Clear") +#define SV_BUTTONTEXT_OPEN NC_("SV_BUTTONTEXT_OPEN", "~Open") +#define SV_BUTTONTEXT_PLAY NC_("SV_BUTTONTEXT_PLAY", "~Play") +#define SV_BUTTONTEXT_FIND NC_("SV_BUTTONTEXT_FIND", "~Find") +#define SV_BUTTONTEXT_STOP NC_("SV_BUTTONTEXT_STOP", "~Stop") +#define SV_BUTTONTEXT_CONNECT NC_("SV_BUTTONTEXT_CONNECT", "C~onnect") +#define SV_BUTTONTEXT_SCREENSHOT NC_("SV_BUTTONTEXT_SCREENSHOT", "~Screenshot") + +#define SV_STDTEXT_SERVICENOTAVAILABLE NC_("SV_STDTEXT_SERVICENOTAVAILABLE", "The component (%s) could not be loaded.\nPlease start setup with the repair option.") + +#define SV_STDTEXT_ABOUT NC_("SV_STDTEXT_ABOUT", "About %PRODUCTNAME") +#define SV_STDTEXT_PREFERENCES NC_("SV_STDTEXT_PREFERENCES", "Preferences...") +#define SV_STDTEXT_ALLFILETYPES NC_("SV_STDTEXT_ALLFILETYPES", "Any type") + +#define STR_FPICKER_AUTO_EXTENSION NC_("STR_FPICKER_AUTO_EXTENSION", "~Automatic file name extension") +#define STR_FPICKER_PASSWORD NC_("STR_FPICKER_PASSWORD", "Save with pass~word") +// dear loplugins, please don't remove this constant, it will be used in follow-up commits +#define STR_FPICKER_GPGENCRYPT NC_("STR_FPICKER_GPGENCRYPT", "Encrypt with ~GPG key") +#define STR_FPICKER_FILTER_OPTIONS NC_("STR_FPICKER_FILTER_OPTIONS", "~Edit filter settings") +#define STR_FPICKER_READONLY NC_("STR_FPICKER_READONLY", "~Read-only") +#define STR_FPICKER_INSERT_AS_LINK NC_("STR_FPICKER_INSERT_AS_LINK", "Insert as ~Link") +#define STR_FPICKER_SHOW_PREVIEW NC_("STR_FPICKER_SHOW_PREVIEW", "Pr~eview") +#define STR_FPICKER_PLAY NC_("STR_FPICKER_PLAY", "~Play") +#define STR_FPICKER_VERSION NC_("STR_FPICKER_VERSION", "~Version:") +#define STR_FPICKER_TEMPLATES NC_("STR_FPICKER_TEMPLATES", "S~tyles:") +#define STR_FPICKER_IMAGE_TEMPLATE NC_("STR_FPICKER_IMAGE_TEMPLATE", "Frame Style: ") +#define STR_FPICKER_IMAGE_ANCHOR NC_("STR_FPICKER_IMAGE_ANCHOR", "A~nchor: ") +#define STR_FPICKER_SELECTION NC_("STR_FPICKER_SELECTION", "~Selection") +#define STR_FPICKER_FOLDER_DEFAULT_TITLE NC_("STR_FPICKER_FOLDER_DEFAULT_TITLE", "Select Path") +#define STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION NC_("STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION", "Please select a folder.") +#define STR_FPICKER_ALREADYEXISTOVERWRITE_PRIMARY NC_("STR_FPICKER_ALREADYEXISTOVERWRITE_PRIMARY", "A file named \"$filename$\" already exists. Do you want to replace it?") +#define STR_FPICKER_ALREADYEXISTOVERWRITE_SECONDARY NC_("STR_FPICKER_ALREADYEXISTOVERWRITE_SECONDARY", "The file already exists in \"$dirname$\". Replacing it will overwrite its contents.") +#define STR_FPICKER_ALLFORMATS NC_("STR_FPICKER_ALLFORMATS", "All Formats") +#define STR_FPICKER_OPEN NC_("STR_FPICKER_OPEN", "Open") +#define STR_FPICKER_SAVE NC_("STR_FPICKER_SAVE", "Save") +#define STR_FPICKER_TYPE NC_("STR_FPICKER_TYPE", "File ~type") + +#define SV_ACCESSERROR_NO_FONTS NC_("SV_ACCESSERROR_NO_FONTS", "No fonts could be found on the system.") + +#define SV_PRINT_NOPAGES NC_("SV_PRINT_NOPAGES", "No pages") +#define SV_PRINT_NOPREVIEW NC_("SV_PRINT_NOPREVIEW", "Preview is disabled") +#define SV_PRINT_TOFILE_TXT NC_("SV_PRINT_TOFILE_TXT", "Print to File...") +#define SV_PRINT_DEFPRT_TXT NC_("SV_PRINT_DEFPRT_TXT", "Default printer") +#define SV_PRINT_QUERYFAXNUMBER_TXT NC_("SV_PRINT_QUERYFAXNUMBER_TXT", "Please enter the fax number") +#define SV_PRINT_CUSTOM_TXT NC_("SV_PRINT_CUSTOM_TXT", "Custom") + +#define SV_EDIT_WARNING_STR NC_("SV_EDIT_WARNING_STR", "The inserted text exceeded the maximum length of this text field. The text was truncated.") + +#define SV_APP_CPUTHREADS NC_("SV_APP_CPUTHREADS", "CPU threads: ") +#define SV_APP_OSVERSION NC_("SV_APP_OSVERSION", "OS: ") +#define SV_APP_UIRENDER NC_("SV_APP_UIRENDER", "UI render: ") +#define SV_APP_GL NC_("SV_APP_GL", "GL") +#define SV_APP_SKIA_VULKAN NC_("SV_APP_SKIA_VULKAN", "Skia/Vulkan") +#define SV_APP_SKIA_RASTER NC_("SV_APP_SKIA_RASTER", "Skia/Raster") +#define SV_APP_DEFAULT NC_("SV_APP_DEFAULT", "default") + +#define SV_MSGBOX_INFO NC_("SV_MSGBOX_INFO", "Information") +#define SV_MSGBOX_WARNING NC_("SV_MSGBOX_WARNING", "Warning") +#define SV_MSGBOX_ERROR NC_("SV_MSGBOX_ERROR", "Error") +#define SV_MSGBOX_QUERY NC_("SV_MSGBOX_QUERY", "Confirmation") + +#define STR_TEXTUNDO_DELPARA NC_("STR_TEXTUNDO_DELPARA", "delete line") +#define STR_TEXTUNDO_CONNECTPARAS NC_("STR_TEXTUNDO_CONNECTPARAS", "delete multiple lines") +#define STR_TEXTUNDO_SPLITPARA NC_("STR_TEXTUNDO_SPLITPARA", "insert multiple lines") +#define STR_TEXTUNDO_INSERTCHARS NC_("STR_TEXTUNDO_INSERTCHARS", "insert '$1'") +#define STR_TEXTUNDO_REMOVECHARS NC_("STR_TEXTUNDO_REMOVECHARS", "delete '$1'") + +// descriptions of accessible objects +#define STR_SVT_ACC_DESC_TABLISTBOX NC_("STR_SVT_ACC_DESC_TABLISTBOX", "Row: %1, Column: %2") +#define STR_SVT_ACC_EMPTY_FIELD NC_("STR_SVT_ACC_EMPTY_FIELD", "Empty Field") + +#define STR_SVT_CALENDAR_DAY NC_("STR_SVT_CALENDAR_DAY", "Day") +#define STR_SVT_CALENDAR_WEEK NC_("STR_SVT_CALENDAR_WEEK", "Week") +#define STR_SVT_CALENDAR_TODAY NC_("STR_SVT_CALENDAR_TODAY", "Today") + +#define STR_WIZDLG_ROADMAP_TITLE NC_("STR_WIZDLG_ROADMAP_TITLE", "Steps") +#define STR_WIZDLG_FINISH NC_("STR_WIZDLG_FINISH", "~Finish") +#define STR_WIZDLG_NEXT NC_("STR_WIZDLG_NEXT", "~Next >") +#define STR_WIZDLG_PREVIOUS NC_("STR_WIZDLG_PREVIOUS", "< Bac~k") + +#endif // INCLUDED_VCL_INC_STRINGS_HRC + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/strings.hxx b/vcl/inc/strings.hxx new file mode 100644 index 000000000..45e9b2af4 --- /dev/null +++ b/vcl/inc/strings.hxx @@ -0,0 +1,17 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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/. + */ + +#ifndef INCLUDED_VCL_INC_STRINGS_HXX +#define INCLUDED_VCL_INC_STRINGS_HXX + +#define SV_APP_VCLBACKEND "VCL: " + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx new file mode 100644 index 000000000..46a4a20cf --- /dev/null +++ b/vcl/inc/svdata.hxx @@ -0,0 +1,462 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SVDATA_HXX +#define INCLUDED_VCL_INC_SVDATA_HXX + +#include <config_version.h> + +#include <o3tl/lru_map.hxx> +#include <tools/fldunit.hxx> +#include <unotools/options.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/svapp.hxx> +#include <vcl/window.hxx> +#include <vcl/task.hxx> +#include <LibreOfficeKit/LibreOfficeKitTypes.h> + +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/i18n/XCharacterClassification.hpp> + +#include "vcleventlisteners.hxx" +#include "salwtype.hxx" +#include "displayconnectiondispatch.hxx" + +#include <vector> +#include <unordered_map> +#include <boost/functional/hash.hpp> +#include "ControlCacheKey.hxx" +#include "schedulerimpl.hxx" +#include <basegfx/DrawCommands.hxx> + +struct ImplPostEventData; +struct ImplTimerData; +struct ImplIdleData; +struct ImplConfigData; +class ImplDirectFontSubstitution; +struct ImplHotKey; +struct ImplEventHook; +class Point; +class ImplAccelManager; +class PhysicalFontCollection; +class ImplFontCache; +class HelpTextWindow; +class ImplTBDragMgr; +class ImplIdleMgr; +class FloatingWindow; +class AllSettings; +class NotifyEvent; +class Timer; +class AutoTimer; +class Idle; +class Help; +class Image; +class PopupMenu; +class Application; +class OutputDevice; +class SvFileStream; +class SystemWindow; +class WorkWindow; +class Dialog; +class VirtualDevice; +class Printer; +class SalFrame; +class SalInstance; +class SalSystem; +class ImplPrnQueueList; +class UnoWrapperBase; +class GraphicConverter; +class ImplWheelWindow; +class SalTimer; +class DockingManager; +class VclEventListeners2; +class SalData; +class OpenGLContext; +class UITestLogger; + +#define SV_ICON_ID_OFFICE 1 +#define SV_ICON_ID_TEXT 2 +#define SV_ICON_ID_TEXT_TEMPLATE 3 +#define SV_ICON_ID_SPREADSHEET 4 +#define SV_ICON_ID_SPREADSHEET_TEMPLATE 5 +#define SV_ICON_ID_DRAWING 6 +#define SV_ICON_ID_PRESENTATION 8 +#define SV_ICON_ID_MASTER_DOCUMENT 10 +#define SV_ICON_ID_TEMPLATE 11 +#define SV_ICON_ID_DATABASE 12 +#define SV_ICON_ID_FORMULA 13 + +namespace com::sun::star::datatransfer::clipboard { class XClipboard; } + +namespace vcl +{ + class DisplayConnectionDispatch; + class SettingsConfigItem; + class DeleteOnDeinitBase; + class Window; +} + +namespace basegfx +{ + class SystemDependentDataManager; +} + +class LocaleConfigurationListener final : public utl::ConfigurationListener +{ +public: + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, ConfigurationHints ) override; +}; + +typedef std::vector<Link<VclWindowEvent&,bool> > SVAppKeyListeners; + +typedef std::pair<VclPtr<vcl::Window>, ImplPostEventData *> ImplPostEventPair; + +struct ImplSVAppData +{ + ~ImplSVAppData(); + + std::unique_ptr<AllSettings> mpSettings; // Application settings + LocaleConfigurationListener* mpCfgListener = nullptr; + VclEventListeners maEventListeners; // listeners for vcl events (eg, extended toolkit) + SVAppKeyListeners maKeyListeners; // listeners for key events only (eg, extended toolkit) + std::vector<ImplPostEventPair> maPostedEventList; + ImplAccelManager* mpAccelMgr; // Accelerator Manager + std::optional<OUString> mxAppName; // Application name + std::optional<OUString> mxAppFileName; // Abs. Application FileName + std::optional<OUString> mxDisplayName; // Application Display Name + std::optional<OUString> mxToolkitName; // Toolkit Name + Help* mpHelp = nullptr; // Application help + VclPtr<PopupMenu> mpActivePopupMenu; // Actives Popup-Menu (in Execute) + VclPtr<ImplWheelWindow> mpWheelWindow; // WheelWindow + sal_uInt64 mnLastInputTime = 0; // GetLastInputTime() + sal_uInt16 mnDispatchLevel = 0; // DispatchLevel + sal_uInt16 mnModalMode = 0; // ModalMode Count + SystemWindowFlags mnSysWinMode = SystemWindowFlags(0); // Mode, when SystemWindows should be created + bool mbInAppMain = false; // is Application::Main() on stack + bool mbInAppExecute = false; // is Application::Execute() on stack + bool mbAppQuit = false; // is Application::Quit() called + bool mbSettingsInit = false; // true: Settings are initialized + DialogCancelMode meDialogCancel = DialogCancelMode::Off; // true: All Dialog::Execute() calls will be terminated immediately with return false + bool mbRenderToBitmaps = false; // set via svp / headless plugin + + SvFileStream* mpEventTestInput = nullptr; + Idle* mpEventTestingIdle = nullptr; + int mnEventTestLimit = 0; + + DECL_STATIC_LINK(ImplSVAppData, ImplQuitMsg, void*, void); + DECL_STATIC_LINK(ImplSVAppData, ImplPrepareExitMsg, void*, void); + DECL_STATIC_LINK(ImplSVAppData, ImplEndAllDialogsMsg, void*, void); + DECL_STATIC_LINK(ImplSVAppData, ImplEndAllPopupsMsg, void*, void); + DECL_STATIC_LINK(ImplSVAppData, ImplVclEventTestingHdl, void*, void); + DECL_LINK(VclEventTestingHdl, Timer*, void); +}; + +/// Cache multiple scalings for the same bitmap +struct ScaleCacheKey { + SalBitmap *mpBitmap; + Size maDestSize; + ScaleCacheKey(SalBitmap *pBitmap, const Size &aDestSize) + { + mpBitmap = pBitmap; + maDestSize = aDestSize; + } + ScaleCacheKey(const ScaleCacheKey &key) + { + mpBitmap = key.mpBitmap; + maDestSize = key.maDestSize; + } + bool operator==(ScaleCacheKey const& rOther) const + { + return mpBitmap == rOther.mpBitmap && maDestSize == rOther.maDestSize; + } +}; + +namespace std +{ +template <> struct hash<ScaleCacheKey> +{ + std::size_t operator()(ScaleCacheKey const& k) const noexcept + { + std::size_t seed = 0; + boost::hash_combine(seed, k.mpBitmap); + boost::hash_combine(seed, k.maDestSize.getWidth()); + boost::hash_combine(seed, k.maDestSize.getHeight()); + return seed; + } +}; + +} // end std namespace + +typedef o3tl::lru_map<ScaleCacheKey, BitmapEx> lru_scale_cache; + +struct ImplSVGDIData +{ + ~ImplSVGDIData(); + + VclPtr<OutputDevice> mpFirstWinGraphics; // First OutputDevice with a Frame Graphics + VclPtr<OutputDevice> mpLastWinGraphics; // Last OutputDevice with a Frame Graphics + VclPtr<OutputDevice> mpFirstVirGraphics; // First OutputDevice with a VirtualDevice Graphics + VclPtr<OutputDevice> mpLastVirGraphics; // Last OutputDevice with a VirtualDevice Graphics + VclPtr<OutputDevice> mpFirstPrnGraphics; // First OutputDevice with an InfoPrinter Graphics + VclPtr<OutputDevice> mpLastPrnGraphics; // Last OutputDevice with an InfoPrinter Graphics + VclPtr<VirtualDevice> mpFirstVirDev; // First VirtualDevice + OpenGLContext* mpLastContext = nullptr; // Last OpenGLContext + VclPtr<Printer> mpFirstPrinter; // First Printer + std::unique_ptr<ImplPrnQueueList> mpPrinterQueueList; // List of all printer queue + std::shared_ptr<PhysicalFontCollection> mxScreenFontList; // Screen-Font-List + std::shared_ptr<ImplFontCache> mxScreenFontCache; // Screen-Font-Cache + lru_scale_cache maScaleCache = lru_scale_cache(10); // Cache for scaled images + ImplDirectFontSubstitution* mpDirectFontSubst = nullptr; // Font-Substitutions defined in Tools->Options->Fonts + GraphicConverter* mpGrfConverter = nullptr; // Converter for graphics + long mnAppFontX = 0; // AppFont X-Numenator for 40/tel Width + long mnAppFontY = 0; // AppFont Y-Numenator for 80/tel Height + bool mbFontSubChanged = false; // true: FontSubstitution was changed between Begin/End + + o3tl::lru_map<OUString, BitmapEx> maThemeImageCache = o3tl::lru_map<OUString, BitmapEx>(10); + o3tl::lru_map<OUString, gfx::DrawRoot> maThemeDrawCommandsCache = o3tl::lru_map<OUString, gfx::DrawRoot>(50); +}; + +struct ImplSVFrameData +{ + ~ImplSVFrameData(); + VclPtr<vcl::Window> mpFirstFrame; // First FrameWindow + VclPtr<vcl::Window> mpActiveApplicationFrame; // the last active application frame, can be used as DefModalDialogParent if no focuswin set + VclPtr<WorkWindow> mpAppWin; // Application-Window + + std::unique_ptr<UITestLogger> m_pUITestLogger; +}; + +struct ImplSVWinData +{ + ~ImplSVWinData(); + VclPtr<vcl::Window> mpFocusWin; // window, that has the focus + VclPtr<vcl::Window> mpCaptureWin; // window, that has the mouse capture + VclPtr<vcl::Window> mpLastDeacWin; // Window, that need a deactivate (FloatingWindow-Handling) + VclPtr<FloatingWindow> mpFirstFloat; // First FloatingWindow in PopupMode + std::vector<VclPtr<Dialog>> mpExecuteDialogs; ///< Stack of dialogs that are Execute()'d - the last one is the top most one. + VclPtr<vcl::Window> mpExtTextInputWin; // Window, which is in ExtTextInput + VclPtr<vcl::Window> mpTrackWin; // window, that is in tracking mode + AutoTimer* mpTrackTimer = nullptr; // tracking timer + std::vector<Image> maMsgBoxImgList; // ImageList for MessageBox + VclPtr<vcl::Window> mpAutoScrollWin; // window, that is in AutoScrollMode mode + VclPtr<vcl::Window> mpLastWheelWindow; // window, that last received a mouse wheel event + SalWheelMouseEvent maLastWheelEvent; // the last received mouse wheel event + + StartTrackingFlags mnTrackFlags = StartTrackingFlags::NONE; // tracking flags + StartAutoScrollFlags mnAutoScrollFlags = StartAutoScrollFlags::NONE; // auto scroll flags + bool mbNoDeactivate = false; // true: do not execute Deactivate + bool mbNoSaveFocus = false; // true: menus must not save/restore focus +}; + +typedef std::vector< std::pair< OUString, FieldUnit > > FieldUnitStringList; + +struct ImplSVCtrlData +{ + std::vector<Image> maCheckImgList; // ImageList for CheckBoxes + std::vector<Image> maRadioImgList; // ImageList for RadioButtons + std::unique_ptr<Image> mpDisclosurePlus; + std::unique_ptr<Image> mpDisclosureMinus; + ImplTBDragMgr* mpTBDragMgr = nullptr; // DragMgr for ToolBox + sal_uInt16 mnCheckStyle = 0; // CheckBox-Style for ImageList-Update + sal_uInt16 mnRadioStyle = 0; // Radio-Style for ImageList-Update + Color mnLastCheckFColor; // Last FaceColor for CheckImage + Color mnLastCheckWColor; // Last WindowColor for CheckImage + Color mnLastCheckLColor; // Last LightColor for CheckImage + Color mnLastRadioFColor; // Last FaceColor for RadioImage + Color mnLastRadioWColor; // Last WindowColor for RadioImage + Color mnLastRadioLColor; // Last LightColor for RadioImage + FieldUnitStringList maFieldUnitStrings; // list with field units + FieldUnitStringList maCleanUnitStrings; // same list but with some "fluff" like spaces removed +}; + +struct ImplSVHelpData +{ + ~ImplSVHelpData(); + bool mbContextHelp = false; // is ContextHelp enabled + bool mbExtHelp = false; // is ExtendedHelp enabled + bool mbExtHelpMode = false; // is in ExtendedHelp Mode + bool mbOldBalloonMode = false; // BalloonMode, before ExtHelpMode started + bool mbBalloonHelp = false; // is BalloonHelp enabled + bool mbQuickHelp = false; // is QuickHelp enabled + bool mbSetKeyboardHelp = false; // tiphelp was activated by keyboard + bool mbKeyboardHelp = false; // tiphelp was activated by keyboard + bool mbRequestingHelp = false; // In Window::RequestHelp + VclPtr<HelpTextWindow> mpHelpWin; // HelpWindow + sal_uInt64 mnLastHelpHideTime = 0; // ticks of last show +}; + +// "NWF" means "Native Widget Framework" and was the term used for the +// idea that StarView/OOo "widgets" should *look* (and feel) like the +// "native widgets" on each platform, even if not at all implemented +// using them. See http://people.redhat.com/dcbw/ooo-nwf.html . + +struct ImplSVNWFData +{ + int mnStatusBarLowerRightOffset = 0; // amount in pixel to avoid in the lower righthand corner + int mnMenuFormatBorderX = 0; // horizontal inner popup menu border + int mnMenuFormatBorderY = 0; // vertical inner popup menu border + ::Color maMenuBarHighlightTextColor = COL_TRANSPARENT; // override highlight text color + // in menubar if not transparent + bool mbMenuBarDockingAreaCommonBG = false; // e.g. WinXP default theme + bool mbDockingAreaSeparateTB = false; // individual toolbar backgrounds + // instead of one for docking area + bool mbDockingAreaAvoidTBFrames = false; ///< don't draw frames around the individual toolbars if mbDockingAreaSeparateTB is false + bool mbFlatMenu = false; // no popup 3D border + bool mbNoFocusRects = false; // on Aqua/Gtk3 use native focus rendering, except for flat buttons + bool mbNoFocusRectsForFlatButtons = false; // on Gtk3 native focusing is also preferred for flat buttons + bool mbCenteredTabs = false; // on Aqua, tabs are centered + bool mbNoActiveTabTextRaise = false; // on Aqua the text for the selected tab + // should not "jump up" a pixel + bool mbProgressNeedsErase = false; // set true for platforms that should draw the + // window background before drawing the native + // progress bar + bool mbCanDrawWidgetAnySize = false; // set to true currently on gtk + + /// entire drop down listbox resembles a button, no textarea/button parts (as currently on Windows) + bool mbDDListBoxNoTextArea = false; + bool mbAutoAccel = false; // whether accelerators are only shown when Alt is held down + bool mbRolloverMenubar = false; // theming engine supports rollover in menubar + // gnome#768128 I cannot see a route under wayland at present to support + // floating toolbars that can be redocked because there's no way to track + // that the toolbar is over a dockable area. + bool mbCanDetermineWindowPosition = true; + + int mnListBoxEntryMargin = 0; +}; + +struct BlendFrameCache +{ + Size m_aLastSize; + sal_uInt8 m_nLastAlpha; + Color m_aLastColorTopLeft; + Color m_aLastColorTopRight; + Color m_aLastColorBottomRight; + Color m_aLastColorBottomLeft; + BitmapEx m_aLastResult; + + BlendFrameCache() + : m_aLastSize(0, 0) + , m_nLastAlpha(0) + , m_aLastColorTopLeft(COL_BLACK) + , m_aLastColorTopRight(COL_BLACK) + , m_aLastColorBottomRight(COL_BLACK) + , m_aLastColorBottomLeft(COL_BLACK) + { + } +}; + +struct ImplSchedulerContext +{ + ImplSchedulerData* mpFirstSchedulerData[PRIO_COUNT] = { nullptr, }; ///< list of all active tasks per priority + ImplSchedulerData* mpLastSchedulerData[PRIO_COUNT] = { nullptr, }; ///< last item of each mpFirstSchedulerData list + ImplSchedulerData* mpSchedulerStack = nullptr; ///< stack of invoked tasks + ImplSchedulerData* mpSchedulerStackTop = nullptr; ///< top most stack entry to detect needed rescheduling during pop + SalTimer* mpSalTimer = nullptr; ///< interface to sal event loop / system timer + sal_uInt64 mnTimerStart = 0; ///< start time of the timer + sal_uInt64 mnTimerPeriod = SAL_MAX_UINT64; ///< current timer period + SchedulerMutex maMutex; ///< lock counting mutex for scheduler locking + bool mbActive = true; ///< is the scheduler active? +}; + +struct ImplSVData +{ + ImplSVData(); + ~ImplSVData(); + SalData* mpSalData = nullptr; + SalInstance* mpDefInst = nullptr; // Default SalInstance + Application* mpApp = nullptr; // pApp + VclPtr<WorkWindow> mpDefaultWin; // Default-Window + bool mbDeInit = false; // Is VCL deinitializing + std::unique_ptr<SalSystem> mpSalSystem; // SalSystem interface + bool mbResLocaleSet = false; // SV-Resource-Manager + std::locale maResLocale; // Resource locale + ImplSchedulerContext maSchedCtx; // Data for class Scheduler + ImplSVAppData maAppData; // Data for class Application + ImplSVGDIData maGDIData; // Data for Output classes + ImplSVFrameData maFrameData; // Data for Frame classes + ImplSVWinData* mpWinData = nullptr; // Data for per-view Windows classes + ImplSVCtrlData maCtrlData; // Data for Control classes + ImplSVHelpData* mpHelpData; // Data for Help classes + ImplSVNWFData maNWFData; + UnoWrapperBase* mpUnoWrapper = nullptr; + VclPtr<vcl::Window> mpIntroWindow; // the splash screen + std::unique_ptr<DockingManager> mpDockingManager; + std::unique_ptr<BlendFrameCache> mpBlendFrameCache; + + oslThreadIdentifier mnMainThreadId = 0; + rtl::Reference< vcl::DisplayConnectionDispatch > mxDisplayConnection; + + css::uno::Reference< css::lang::XComponent > mxAccessBridge; + std::unique_ptr<vcl::SettingsConfigItem> mpSettingsConfigItem; + std::vector< vcl::DeleteOnDeinitBase* > maDeinitDeleteList; + std::unordered_map< int, OUString > maPaperNames; + + css::uno::Reference<css::i18n::XCharacterClassification> m_xCharClass; + +#if defined _WIN32 + css::uno::Reference<css::datatransfer::clipboard::XClipboard> m_xSystemClipboard; +#endif + + Link<LinkParamNone*,void> maDeInitHook; + + // LOK & headless backend specific hooks + LibreOfficeKitPollCallback mpPollCallback = nullptr; + LibreOfficeKitWakeCallback mpWakeCallback = nullptr; + void *mpPollClosure = nullptr; +}; + +css::uno::Reference<css::i18n::XCharacterClassification> const& ImplGetCharClass(); + +void ImplDeInitSVData(); +VCL_PLUGIN_PUBLIC basegfx::SystemDependentDataManager& ImplGetSystemDependentDataManager(); +VCL_PLUGIN_PUBLIC vcl::Window* ImplGetDefaultWindow(); +vcl::Window* ImplGetDefaultContextWindow(); +const std::locale& ImplGetResLocale(); +VCL_PLUGIN_PUBLIC OUString VclResId(const char* pId); +DockingManager* ImplGetDockingManager(); +BlendFrameCache* ImplGetBlendFrameCache(); + +VCL_PLUGIN_PUBLIC ImplSVHelpData& ImplGetSVHelpData(); + +VCL_DLLPUBLIC bool ImplCallPreNotify( NotifyEvent& rEvt ); + +VCL_PLUGIN_PUBLIC ImplSVData* ImplGetSVData(); +VCL_PLUGIN_PUBLIC void ImplHideSplash(); + +#ifdef _WIN32 +bool ImplInitAccessBridge(); +#endif + +const FieldUnitStringList& ImplGetFieldUnits(); +const FieldUnitStringList& ImplGetCleanedFieldUnits(); + +struct ImplSVEvent +{ + void* mpData; + Link<void*,void> maLink; + VclPtr<vcl::Window> mpInstanceRef; + VclPtr<vcl::Window> mpWindow; + bool mbCall; +}; + +extern int nImplSysDialog; + +#endif // INCLUDED_VCL_INC_SVDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/svimpbox.hxx b/vcl/inc/svimpbox.hxx new file mode 100644 index 000000000..c5a51143f --- /dev/null +++ b/vcl/inc/svimpbox.hxx @@ -0,0 +1,398 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_SOURCE_INC_SVIMPBOX_HXX +#define INCLUDED_VCL_SOURCE_INC_SVIMPBOX_HXX + +#include <vcl/dllapi.h> +#include <vcl/seleng.hxx> +#include <vcl/scrbar.hxx> +#include <vcl/idle.hxx> +#include <vcl/image.hxx> +#include <vcl/svtaccessiblefactory.hxx> +#include <vcl/vclevent.hxx> +#include <vcl/treelistbox.hxx> +#include <o3tl/enumarray.hxx> +#include <memory> +#include <vector> + +class SvLBoxButton; +class SvTreeList; +class SvImpLBox; +class SvTreeListEntry; +namespace comphelper +{ + namespace string + { + class NaturalStringSorter; + } +} + +class ImpLBSelEng final : public FunctionSet +{ + SvImpLBox* pImp; + VclPtr<SvTreeListBox> pView; + +public: + ImpLBSelEng( SvImpLBox* pImp, SvTreeListBox* pView ); + virtual ~ImpLBSelEng() override; + void BeginDrag() override; + void CreateAnchor() override; + void DestroyAnchor() override; + void SetCursorAtPoint( const Point& rPoint, + bool bDontSelectAtCursor=false ) override; + bool IsSelectionAtPoint( const Point& rPoint ) override; + void DeselectAtPoint( const Point& rPoint ) override; + void DeselectAll() override; +}; + +// Flags for nFlag +enum class LBoxFlags { + NONE = 0x0000, + InScrolling = 0x0001, + DeselectAll = 0x0002, + StartEditTimer = 0x0004, // MAC only + IgnoreSelect = 0x0008, + InResize = 0x0010, + RemovedEntryInvisible = 0x0020, + RemovedRecalcMostRight = 0x0040, + IgnoreChangedTabs = 0x0080, + InPaint = 0x0100, + EndScrollSetVisSize = 0x0200, + Filling = 0x0400, +}; +namespace o3tl +{ + template<> struct typed_flags<LBoxFlags> : is_typed_flags<LBoxFlags, 0x07ff> {}; +} + +#define NODE_BMP_TABDIST_NOTVALID -2000000 +#define FIRST_ENTRY_TAB 1 + +class SvImpLBox +{ +friend class ImpLBSelEng; +friend class SvTreeListBox; +friend class SalInstanceTreeView; +friend class IconView; +private: + SvTreeList* m_pTree; + SvTreeListEntry* m_pAnchor; + SvTreeListEntry* m_pMostRightEntry; + SvLBoxButton* m_pActiveButton; + SvTreeListEntry* m_pActiveEntry; + SvLBoxTab* m_pActiveTab; + + VclPtr<ScrollBar> m_aHorSBar; + VclPtr<ScrollBarBox> m_aScrBarBox; + + ::vcl::AccessibleFactoryAccess + m_aFactoryAccess; + + static Image* s_pDefCollapsed; + static Image* s_pDefExpanded; + static oslInterlockedCount s_nImageRefCount; /// When 0 all static images will be destroyed + + // Node Bitmaps + enum class ImageType + { + NodeExpanded = 0, // node is expanded ( usually a bitmap showing a minus ) + NodeCollapsed, // node is collapsed ( usually a bitmap showing a plus ) + NodeDontKnow, // don't know the node state + EntryDefExpanded, // default for expanded entries + EntryDefCollapsed, // default for collapsed entries + LAST = EntryDefCollapsed + }; + + // all our images + o3tl::enumarray<ImageType, Image> + m_aNodeAndEntryImages; + + ImpLBSelEng m_aFctSet; + + long m_nNodeBmpWidth; + long m_nMostRight; + short m_nHorSBarHeight, m_nVerSBarWidth; + + bool m_bUpdateMode : 1; + bool m_bSubLstOpLR : 1; // open/close sublist with cursor left/right, defaulted with false + bool m_bContextMenuHandling : 1; + bool mbForceMakeVisible; + + Point m_aEditClickPos; + Idle m_aEditIdle; + + std::unique_ptr<comphelper::string::NaturalStringSorter> m_pStringSorter; + + std::vector< short > m_aContextBmpWidthVector; + + DECL_LINK(EditTimerCall, Timer *, void); + + void InvalidateEntriesFrom( long nY ) const; + bool IsLineVisible( long nY ) const; + void KeyLeftRight( long nDiff ); + + void DrawNet(vcl::RenderContext& rRenderContext); + + // ScrollBar-Handler + DECL_LINK( ScrollUpDownHdl, ScrollBar*, void ); + DECL_LINK( ScrollLeftRightHdl, ScrollBar*, void ); + DECL_LINK( EndScrollHdl, ScrollBar*, void ); + + void SetNodeBmpWidth( const Image& ); + void SetNodeBmpTabDistance(); + + // Selection-Engine + SvTreeListEntry* MakePointVisible( const Point& rPoint ); + + void SetAnchorSelection( SvTreeListEntry* pOld, + SvTreeListEntry* pNewCursor ); + void BeginDrag(); + bool ButtonDownCheckCtrl( const MouseEvent& rMEvt, SvTreeListEntry* pEntry ); + bool MouseMoveCheckCtrl( const MouseEvent& rMEvt, SvTreeListEntry const * pEntry ); + bool ButtonUpCheckCtrl( const MouseEvent& rMEvt ); + bool ButtonDownCheckExpand( const MouseEvent&, SvTreeListEntry* ); + + bool EntryReallyHit(SvTreeListEntry* pEntry, const Point& rPos, long nLine); + void InitScrollBarBox(); + SvLBoxTab* NextTab( SvLBoxTab const * ); + + bool SetMostRight( SvTreeListEntry* pEntry ); + void FindMostRight( SvTreeListEntry* pParent ); + void FindMostRight_Impl( SvTreeListEntry* pParent ); + void NotifyTabsChanged(); + + // if element at cursor can be expanded in general + bool IsExpandable() const; + + static void implInitDefaultNodeImages(); + + void UpdateStringSorter(); + + short UpdateContextBmpWidthVector( SvTreeListEntry const * pEntry, short nWidth ); + void UpdateContextBmpWidthMax( SvTreeListEntry const * pEntry ); + void UpdateContextBmpWidthVectorFromMovedEntry( SvTreeListEntry* pEntry ); + + void ExpandAll(); + void CollapseTo(SvTreeListEntry* pParentToCollapse); + +protected: + VclPtr<SvTreeListBox> m_pView; + VclPtr<ScrollBar> m_aVerSBar; + SvTreeListEntry* m_pCursor; + SvTreeListEntry* m_pStartEntry; + ImplSVEvent* m_nCurUserEvent; + Size m_aOutputSize; + LBoxFlags m_nFlags; + WinBits m_nStyle; + bool mbNoAutoCurEntry; // disable the behavior of automatically selecting a "CurEntry" upon painting the control + SelectionEngine m_aSelEng; + sal_uLong m_nVisibleCount; // Number of lines in control + bool m_bInVScrollHdl : 1; + bool m_bSimpleTravel : 1; // is true if SelectionMode::Single + long m_nNextVerVisSize; + long m_nNodeBmpTabDistance; // typical smaller than 0 + + virtual long GetEntryLine(const SvTreeListEntry* pEntry) const; + virtual void CursorDown(); + virtual void CursorUp(); + virtual void PageDown( sal_uInt16 nDelta ); + virtual void PageUp( sal_uInt16 nDelta ); + // set Thumb to FirstEntryToDraw + virtual void SyncVerThumb(); + virtual void AdjustScrollBars( Size& rSize ); + virtual void InvalidateEntry( long nY ) const; + + tools::Rectangle GetVisibleArea() const; + void SetCursor( SvTreeListEntry* pEntry, bool bForceNoSelect = false ); + void BeginScroll(); + void EndScroll(); + void PositionScrollBars( Size& rOSize, sal_uInt16 nMask ); + void FindMostRight(); + void FillView(); + void ShowVerSBar(); + void StopUserEvent(); + + DECL_LINK( MyUserEvent, void*, void); + +public: + SvImpLBox( SvTreeListBox* pView, SvTreeList*, WinBits nWinStyle ); + virtual ~SvImpLBox(); + + void Clear(); + void SetStyle( WinBits i_nWinStyle ); + void SetNoAutoCurEntry( bool b ); + void SetModel( SvTreeList* pModel ) { m_pTree = pModel;} + + void EntryInserted( SvTreeListEntry*); + void RemovingEntry( SvTreeListEntry* pEntry ); + void EntryRemoved(); + void MovingEntry( SvTreeListEntry* pEntry ); + void EntryMoved( SvTreeListEntry* pEntry ); + void TreeInserted( SvTreeListEntry* pEntry ); + + void EntryExpanded( SvTreeListEntry* pEntry ); + void EntryCollapsed( SvTreeListEntry* pEntry ); + void CollapsingEntry( SvTreeListEntry* pEntry ); + void EntrySelected( SvTreeListEntry* pEntry, bool bSelect ); + + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect); + void MouseButtonDown( const MouseEvent& ); + void MouseButtonUp( const MouseEvent& ); + void MouseMove( const MouseEvent&); + virtual bool KeyInput( const KeyEvent& ); + void Resize(); + void GetFocus(); + void LoseFocus(); + virtual void UpdateAll( bool bInvalidateCompleteView ); + void SetEntryHeight(); + void InvalidateEntry( SvTreeListEntry* ); + void RecalcFocusRect(); + + void SelectEntry( SvTreeListEntry* pEntry, bool bSelect ); + void SetDragDropMode( DragDropMode eDDMode ); + void SetSelectionMode( SelectionMode eSelMode ); + + virtual bool IsEntryInView( SvTreeListEntry* pEntry ) const; + virtual SvTreeListEntry* GetEntry( const Point& rPos ) const; + // returns last entry, if Pos below last entry + virtual SvTreeListEntry* GetClickedEntry( const Point& ) const; + SvTreeListEntry* GetCurEntry() const { return m_pCursor; } + void SetCurEntry( SvTreeListEntry* ); + virtual Point GetEntryPosition(const SvTreeListEntry*) const; + void MakeVisible( SvTreeListEntry* pEntry, bool bMoveToTop = false ); + void ScrollToAbsPos( long nPos ); + + void PaintDDCursor(SvTreeListEntry* pEntry, bool bShow); + + // Images + inline Image& implGetImageLocation( const ImageType _eType ); + + inline void SetExpandedNodeBmp( const Image& _rImg ); + inline void SetCollapsedNodeBmp( const Image& _rImg ); + + inline const Image& GetExpandedNodeBmp( ); + inline const Image& GetCollapsedNodeBmp( ); + inline const Image& GetDontKnowNodeBmp( ); + + inline void SetDefaultEntryExpBmp( const Image& _rImg ); + inline void SetDefaultEntryColBmp( const Image& _rImg ); + inline const Image& GetDefaultEntryExpBmp( ); + inline const Image& GetDefaultEntryColBmp( ); + + static const Image& GetDefaultExpandedNodeImage( ); + static const Image& GetDefaultCollapsedNodeImage( ); + + const Size& GetOutputSize() const { return m_aOutputSize;} + virtual void KeyUp( bool bPageUp ); + virtual void KeyDown( bool bPageDown ); + void Command( const CommandEvent& rCEvt ); + + void Invalidate(); + void DestroyAnchor() { m_pAnchor=nullptr; m_aSelEng.Reset(); } + void SelAllDestrAnch( bool bSelect, bool bDestroyAnchor = true, bool bSingleSelToo = false ); + void ShowCursor( bool bShow ); + + bool RequestHelp( const HelpEvent& rHEvt ); + void EndSelection(); + bool IsNodeButton( const Point& rPosPixel, SvTreeListEntry* pEntry ) const; + void SetUpdateMode( bool bMode ); + bool GetUpdateMode() const { return m_bUpdateMode; } + tools::Rectangle GetClipRegionRect() const; + bool HasHorScrollBar() const { return m_aHorSBar->IsVisible(); } + void ShowFocusRect( const SvTreeListEntry* pEntry ); + void CallEventListeners( VclEventId nEvent, void* pData = nullptr ); + + bool IsSelectable( const SvTreeListEntry* pEntry ); + void SetForceMakeVisible(bool bEnable) { mbForceMakeVisible = bEnable; } +}; + +inline Image& SvImpLBox::implGetImageLocation( const ImageType _eType ) +{ + return m_aNodeAndEntryImages[_eType]; +} + +inline void SvImpLBox::SetExpandedNodeBmp( const Image& rImg ) +{ + implGetImageLocation( ImageType::NodeExpanded ) = rImg; + SetNodeBmpWidth( rImg ); +} + +inline void SvImpLBox::SetCollapsedNodeBmp( const Image& rImg ) +{ + implGetImageLocation( ImageType::NodeCollapsed ) = rImg; + SetNodeBmpWidth( rImg ); +} + +inline const Image& SvImpLBox::GetDontKnowNodeBmp( ) +{ + return implGetImageLocation( ImageType::NodeDontKnow ); +} + +inline const Image& SvImpLBox::GetExpandedNodeBmp( ) +{ + return implGetImageLocation( ImageType::NodeExpanded ); +} + +inline const Image& SvImpLBox::GetCollapsedNodeBmp( ) +{ + return implGetImageLocation( ImageType::NodeCollapsed ); +} + +inline void SvImpLBox::SetDefaultEntryExpBmp( const Image& _rImg ) +{ + implGetImageLocation( ImageType::EntryDefExpanded ) = _rImg; +} + +inline void SvImpLBox::SetDefaultEntryColBmp( const Image& _rImg ) +{ + implGetImageLocation( ImageType::EntryDefCollapsed ) = _rImg; +} + +inline const Image& SvImpLBox::GetDefaultEntryExpBmp( ) +{ + return implGetImageLocation( ImageType::EntryDefExpanded ); +} + +inline const Image& SvImpLBox::GetDefaultEntryColBmp( ) +{ + return implGetImageLocation( ImageType::EntryDefCollapsed ); +} + +inline Point SvImpLBox::GetEntryPosition(const SvTreeListEntry* pEntry) const +{ + return Point(0, GetEntryLine(pEntry)); +} + +inline bool SvImpLBox::IsLineVisible( long nY ) const +{ + bool bRet = true; + if ( nY < 0 || nY >= m_aOutputSize.Height() ) + bRet = false; + return bRet; +} + +inline void SvImpLBox::TreeInserted( SvTreeListEntry* pInsTree ) +{ + EntryInserted( pInsTree ); +} + +#endif // INCLUDED_VCL_SOURCE_INC_SVIMPBOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/svmconverter.hxx b/vcl/inc/svmconverter.hxx new file mode 100644 index 000000000..459f327d4 --- /dev/null +++ b/vcl/inc/svmconverter.hxx @@ -0,0 +1,90 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SVMCONVERTER_HXX +#define INCLUDED_VCL_INC_SVMCONVERTER_HXX + +#include <vcl/dllapi.h> +#include <vcl/gdimtf.hxx> + +#define GDI_PIXEL_ACTION 1 +#define GDI_POINT_ACTION 2 +#define GDI_LINE_ACTION 3 +#define GDI_RECT_ACTION 4 +#define GDI_ELLIPSE_ACTION 5 +#define GDI_ARC_ACTION 6 +#define GDI_PIE_ACTION 7 +#define GDI_INVERTRECT_ACTION 8 +#define GDI_HIGHLIGHTRECT_ACTION 9 +#define GDI_POLYLINE_ACTION 10 +#define GDI_POLYGON_ACTION 11 +#define GDI_POLYPOLYGON_ACTION 12 +#define GDI_TEXT_ACTION 13 +#define GDI_TEXTARRAY_ACTION 14 +#define GDI_STRETCHTEXT_ACTION 15 +#define GDI_BITMAP_ACTION 17 +#define GDI_BITMAPSCALE_ACTION 18 +#define GDI_PEN_ACTION 19 +#define GDI_FONT_ACTION 20 +#define GDI_FILLBRUSH_ACTION 22 +#define GDI_MAPMODE_ACTION 23 +#define GDI_CLIPREGION_ACTION 24 +#define GDI_RASTEROP_ACTION 25 +#define GDI_PUSH_ACTION 26 +#define GDI_POP_ACTION 27 +#define GDI_MOVECLIPREGION_ACTION 28 +#define GDI_ISECTCLIPREGION_ACTION 29 +#define GDI_BITMAPSCALEPART_ACTION 32 +#define GDI_GRADIENT_ACTION 33 + +#define GDI_TRANSPARENT_COMMENT 1024 +#define GDI_HATCH_COMMENT 1025 +#define GDI_REFPOINT_COMMENT 1026 +#define GDI_TEXTLINECOLOR_COMMENT 1027 +#define GDI_TEXTLINE_COMMENT 1028 +#define GDI_FLOATTRANSPARENT_COMMENT 1029 +#define GDI_GRADIENTEX_COMMENT 1030 +#define GDI_COMMENT_COMMENT 1031 +#define GDI_UNICODE_COMMENT 1032 + +#define GDI_LINEJOIN_ACTION 1033 +#define GDI_EXTENDEDPOLYGON_ACTION 1034 +#define GDI_LINEDASHDOT_ACTION 1035 + +#define GDI_LINECAP_ACTION 1036 + +/** + * Converts old SVGDI aka SVM1 format data to current VCLMTF aka SVM2 format metafile data. + */ +class SVMConverter +{ +private: + static void ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ); + +public: + SVMConverter( SvStream& rIStm, GDIMetaFile& rMtf ); + +private: + SVMConverter( const SVMConverter& ) = delete; + SVMConverter& operator=( const SVMConverter& ) = delete; +}; + +#endif // INCLUDED_VCL_INC_SVMCONVERTER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/svsys.h b/vcl/inc/svsys.h new file mode 100644 index 000000000..d86985669 --- /dev/null +++ b/vcl/inc/svsys.h @@ -0,0 +1,41 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_SVSYS_H +#define INCLUDED_VCL_INC_SVSYS_H + +#include <config_features.h> + +#ifdef _WIN32 +#include "win/svsys.h" +#elif defined MACOSX +#include "osx/svsys.h" +#elif defined IOS +#include "ios/svsys.h" +#elif defined ANDROID +#include "android/svsys.h" +#elif defined HAIKU +#elif !HAVE_FEATURE_UI +#else +#include "unx/svsys.h" +#endif + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/test/outputdevice.hxx b/vcl/inc/test/outputdevice.hxx new file mode 100644 index 000000000..b8ad0b67f --- /dev/null +++ b/vcl/inc/test/outputdevice.hxx @@ -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/. + * + */ + +#ifndef INCLUDED_VCL_OUTDEVTESTS_HXX +#define INCLUDED_VCL_OUTDEVTESTS_HXX + +#include <vcl/virdev.hxx> + +namespace vcl { +namespace test { + +/** Rendering test result. + * + * Test either "Passed", "Failed" or "PassedWithQuirks" which means + * the test passed but at least one rendering quirk was detected. + */ +enum class TestResult +{ + Failed, + PassedWithQuirks, + Passed +}; + +/** Common subclass for output device rendering tests. + */ +class VCL_DLLPUBLIC OutputDeviceTestCommon +{ +protected: + + ScopedVclPtr<VirtualDevice> mpVirtualDevice; + tools::Rectangle maVDRectangle; + + static const Color constBackgroundColor; + static const Color constLineColor; + static const Color constFillColor; + +public: + OutputDeviceTestCommon(); + + OUString getRenderBackendName() const; + + void initialSetup(long nWidth, long nHeight, Color aColor, bool bEnableAA = false, bool bAlphaVirtualDevice = false); + + static TestResult checkRectangle(Bitmap& rBitmap); + static TestResult checkRectangleAA(Bitmap& rBitmap); + static TestResult checkFilledRectangle(Bitmap& rBitmap, bool useLineColor); + static TestResult checkLines(Bitmap& rBitmap); + static TestResult checkAALines(Bitmap& rBitmap); + static TestResult checkDiamond(Bitmap& rBitmap); + + static TestResult checkInvertRectangle(Bitmap& rBitmap); + static TestResult checkInvertN50Rectangle(Bitmap& aBitmap); + static TestResult checkInvertTrackFrameRectangle(Bitmap& aBitmap); + + static TestResult checkRectangles(Bitmap& rBitmap, std::vector<Color>& aExpectedColors); + static TestResult checkRectangle(Bitmap& rBitmap, int aLayerNumber, Color aExpectedColor); + + static TestResult checkFilled(Bitmap& rBitmap, tools::Rectangle aRectangle, Color aExpectedColor); + static TestResult checkChecker(Bitmap& rBitmap, sal_Int32 nStartX, sal_Int32 nEndX, + sal_Int32 nStartY, sal_Int32 nEndY, std::vector<Color> const & rExpected); + + static void createDiamondPoints(tools::Rectangle rRect, int nOffset, + Point& rPoint1, Point& rPoint2, + Point& rPoint3, Point& rPoint4); + + static void createHorizontalVerticalDiagonalLinePoints(tools::Rectangle rRect, + Point& rHorizontalLinePoint1, Point& rHorizontalLinePoint2, + Point& rVerticalLinePoint1, Point& rVerticalLinePoint2, + Point& rDiagonalLinePoint1, Point& rDiagonalLinePoint2); + // tools + static tools::Rectangle alignToCenter(tools::Rectangle aRect1, tools::Rectangle aRect2); + + static TestResult checkBezier(Bitmap& rBitmap); +}; + +class VCL_DLLPUBLIC OutputDeviceTestBitmap : public OutputDeviceTestCommon +{ +public: + OutputDeviceTestBitmap() = default; + + Bitmap setupDrawTransformedBitmap(); + Bitmap setupDrawBitmap(); + Bitmap setupDrawBitmapExWithAlpha(); + Bitmap setupDrawMask(); + BitmapEx setupDrawBlend(); + + static TestResult checkTransformedBitmap(Bitmap& rBitmap); + static TestResult checkBitmapExWithAlpha(Bitmap& rBitmap); + static TestResult checkMask(Bitmap& rBitmap); + static TestResult checkBlend(BitmapEx& rBitmap); +}; + +class VCL_DLLPUBLIC OutputDeviceTestAnotherOutDev : public OutputDeviceTestCommon +{ +public: + OutputDeviceTestAnotherOutDev() = default; + + Bitmap setupDrawOutDev(); + Bitmap setupXOR(); + + static TestResult checkDrawOutDev(Bitmap& rBitmap); + static TestResult checkXOR(Bitmap& rBitmap); +}; + +class VCL_DLLPUBLIC OutputDeviceTestPixel : public OutputDeviceTestCommon +{ +public: + OutputDeviceTestPixel() = default; + + Bitmap setupRectangle(bool bEnableAA); +}; + +class VCL_DLLPUBLIC OutputDeviceTestLine : public OutputDeviceTestCommon +{ +public: + OutputDeviceTestLine() = default; + + Bitmap setupRectangle(bool bEnableAA); + Bitmap setupDiamond(); + Bitmap setupLines(); + Bitmap setupAALines(); + + Bitmap setupDashedLine(); + static TestResult checkDashedLine(Bitmap& rBitmap); +}; + +class VCL_DLLPUBLIC OutputDeviceTestPolyLine : public OutputDeviceTestCommon +{ +public: + OutputDeviceTestPolyLine() = default; + + Bitmap setupRectangle(bool bEnableAA); + Bitmap setupDiamond(); + Bitmap setupLines(); + Bitmap setupAALines(); +}; + +class VCL_DLLPUBLIC OutputDeviceTestPolyLineB2D : public OutputDeviceTestCommon +{ +public: + OutputDeviceTestPolyLineB2D() = default; + + Bitmap setupRectangle(bool bEnableAA); + Bitmap setupDiamond(); + Bitmap setupBezier(); + Bitmap setupAABezier(); +}; + +class VCL_DLLPUBLIC OutputDeviceTestRect : public OutputDeviceTestCommon +{ +public: + OutputDeviceTestRect() = default; + + Bitmap setupRectangle(bool bEnableAA); + Bitmap setupFilledRectangle(bool useLineColor); + Bitmap setupInvert_NONE(); + Bitmap setupInvert_N50(); + Bitmap setupInvert_TrackFrame(); +}; + +class VCL_DLLPUBLIC OutputDeviceTestPolygon : public OutputDeviceTestCommon +{ +public: + OutputDeviceTestPolygon() = default; + + Bitmap setupRectangle(bool bEnableAA); + Bitmap setupFilledRectangle(bool useLineColor); + Bitmap setupDiamond(); + Bitmap setupLines(); + Bitmap setupAALines(); +}; + +class VCL_DLLPUBLIC OutputDeviceTestPolyPolygon : public OutputDeviceTestCommon +{ +public: + OutputDeviceTestPolyPolygon() = default; + + Bitmap setupRectangle(bool bEnableAA); + Bitmap setupFilledRectangle(bool useLineColor); +}; + +class VCL_DLLPUBLIC OutputDeviceTestPolyPolygonB2D : public OutputDeviceTestCommon +{ +public: + OutputDeviceTestPolyPolygonB2D() = default; + + Bitmap setupRectangle(bool bEnableAA); + Bitmap setupFilledRectangle(bool useLineColor); +}; + +class VCL_DLLPUBLIC OutputDeviceTestGradient : public OutputDeviceTestCommon +{ +public: + OutputDeviceTestGradient() = default; + + Bitmap setupLinearGradient(); + Bitmap setupRadialGradient(); +}; + +class VCL_DLLPUBLIC OutputDeviceTestClip : public OutputDeviceTestCommon +{ +public: + Bitmap setupClipRectangle(); + Bitmap setupClipPolygon(); + Bitmap setupClipPolyPolygon(); + Bitmap setupClipB2DPolyPolygon(); + + static TestResult checkClip(Bitmap& rBitmap); +}; + + +}} // end namespace vcl::test + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/textlayout.hxx b/vcl/inc/textlayout.hxx new file mode 100644 index 000000000..e26cc6219 --- /dev/null +++ b/vcl/inc/textlayout.hxx @@ -0,0 +1,112 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_TEXTLAYOUT_HXX +#define INCLUDED_VCL_INC_TEXTLAYOUT_HXX + +#include <memory> + +class Control; + +namespace vcl +{ + class SAL_NO_VTABLE ITextLayout + { + public: + virtual long GetTextWidth( const OUString& _rText, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const = 0; + virtual void DrawText( const Point& _rStartPoint, const OUString& _rText, sal_Int32 _nStartIndex, sal_Int32 _nLength, + MetricVector* _pVector, OUString* _pDisplayText ) = 0; + virtual void GetCaretPositions( const OUString& _rText, long* _pCaretXArray, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const = 0; + virtual sal_Int32 GetTextBreak( const OUString& _rText, long _nMaxTextWidth, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const = 0; + virtual bool DecomposeTextRectAction() const = 0; + + protected: + ~ITextLayout() COVERITY_NOEXCEPT_FALSE {} + }; + + /** is an implementation of the ITextLayout interface which simply delegates its calls to the respective + methods of an OutputDevice instance, without any inbetween magic. + */ + class DefaultTextLayout final : public ITextLayout + { + public: + DefaultTextLayout( OutputDevice& _rTargetDevice ) + : m_rTargetDevice( _rTargetDevice ) + { + } + virtual ~DefaultTextLayout(); + + // ITextLayout overridables + virtual long GetTextWidth( const OUString& _rText, + sal_Int32 _nStartIndex, + sal_Int32 _nLength ) const override; + + virtual void DrawText( const Point& _rStartPoint, + const OUString& _rText, + sal_Int32 _nStartIndex, + sal_Int32 _nLength, + MetricVector* _pVector, + OUString* _pDisplayText ) override; + + virtual void GetCaretPositions( const OUString& _rText, + long* _pCaretXArray, + sal_Int32 _nStartIndex, + sal_Int32 _nLength ) const override; + + virtual sal_Int32 GetTextBreak( const OUString& _rText, + long _nMaxTextWidth, + sal_Int32 _nStartIndex, + sal_Int32 _nLength ) const override; + + virtual bool DecomposeTextRectAction() const override; + + private: + OutputDevice& m_rTargetDevice; + }; + + class ReferenceDeviceTextLayout; + /** a class which allows rendering text of a Control onto a device, by taking into account the metrics of + a reference device. + */ + class ControlTextRenderer final + { + public: + ControlTextRenderer( const Control& _rControl, OutputDevice& _rTargetDevice, OutputDevice& _rReferenceDevice ); + ~ControlTextRenderer(); + + tools::Rectangle DrawText( const tools::Rectangle& _rRect, + const OUString& _rText, DrawTextFlags _nStyle, + MetricVector* _pVector, OUString* _pDisplayText, const Size* i_pDeviceSize ); + + tools::Rectangle GetTextRect( const tools::Rectangle& _rRect, + const OUString& _rText, DrawTextFlags _nStyle, Size* o_pDeviceSize ); + + private: + ControlTextRenderer( const ControlTextRenderer& ) = delete; + ControlTextRenderer& operator=( const ControlTextRenderer& ) = delete; + + private: + ::std::unique_ptr< ReferenceDeviceTextLayout > m_pImpl; + }; + +} // namespace vcl + +#endif // INCLUDED_VCL_INC_TEXTLAYOUT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/textlineinfo.hxx b/vcl/inc/textlineinfo.hxx new file mode 100644 index 000000000..03b19ede9 --- /dev/null +++ b/vcl/inc/textlineinfo.hxx @@ -0,0 +1,71 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_TEXTLINEINFO_HXX +#define INCLUDED_VCL_INC_TEXTLINEINFO_HXX + +#include <memory> +#include <vector> + +class ImplTextLineInfo +{ +private: + long mnWidth; + sal_Int32 mnIndex; + sal_Int32 mnLen; + +public: + ImplTextLineInfo( long nWidth, sal_Int32 nIndex, sal_Int32 nLen ) + { + mnWidth = nWidth; + mnIndex = nIndex; + mnLen = nLen; + } + + long GetWidth() const { return mnWidth; } + sal_Int32 GetIndex() const { return mnIndex; } + sal_Int32 GetLen() const { return mnLen; } +}; + +#define MULTITEXTLINEINFO_RESIZE 16 + +class ImplMultiTextLineInfo +{ +public: + ImplMultiTextLineInfo(); + ~ImplMultiTextLineInfo(); + + void AddLine( ImplTextLineInfo* pLine ); + void Clear(); + + ImplTextLineInfo* GetLine( sal_Int32 nLine ) const + { return mvLines[nLine].get(); } + sal_Int32 Count() const { return mvLines.size(); } + +private: + ImplMultiTextLineInfo( const ImplMultiTextLineInfo& ) = delete; + ImplMultiTextLineInfo& operator=( const ImplMultiTextLineInfo& ) = delete; + + std::vector<std::unique_ptr<ImplTextLineInfo>> mvLines; + +}; + +#endif // INCLUDED_VCL_INC_TEXTLINEINFO_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/textrender.hxx b/vcl/inc/textrender.hxx new file mode 100644 index 000000000..1aec8fba2 --- /dev/null +++ b/vcl/inc/textrender.hxx @@ -0,0 +1,74 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_CAIROFONTIMPL_HXX +#define INCLUDED_VCL_INC_UNX_CAIROFONTIMPL_HXX + +#include "salgdi.hxx" + +#include <config_cairo_canvas.h> + +class ImplLayoutArgs; +class ImplFontMetricData; +class PhysicalFontCollection; +class PhysicalFontFace; + +class TextRenderImpl +{ +public: + // can't call ReleaseFonts here, as the destructor just calls this classes SetFont (pure virtual)! + virtual ~TextRenderImpl() {} + + virtual void SetTextColor( Color nColor ) = 0; + virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) = 0; + void ReleaseFonts() { SetFont(nullptr, 0); } + virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) = 0; + virtual FontCharMapRef GetFontCharMap() const = 0; + virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const = 0; + virtual void GetDevFontList( PhysicalFontCollection* ) = 0; + virtual void ClearDevFontCache() = 0; + virtual bool AddTempDevFont( PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) = 0; + virtual bool CreateFontSubset( + const OUString& rToFile, + const PhysicalFontFace*, + const sal_GlyphId* pGlyphIDs, + const sal_uInt8* pEncoding, + sal_Int32* pWidths, + int nGlyphs, + FontSubsetInfo& rInfo) = 0; + + virtual const void* GetEmbedFontData(const PhysicalFontFace*, long* pDataLen) = 0; + virtual void FreeEmbedFontData( const void* pData, long nDataLen ) = 0; + virtual void GetGlyphWidths( + const PhysicalFontFace*, + bool bVertical, + std::vector< sal_Int32 >& rWidths, + Ucs2UIntMap& rUnicodeEnc ) = 0; + + virtual std::unique_ptr<GenericSalLayout> + GetTextLayout(int nFallbackLevel) = 0; + virtual void DrawTextLayout(const GenericSalLayout&, const SalGraphics&) = 0; +#if ENABLE_CAIRO_CANVAS + virtual SystemFontData GetSysFontData( int nFallbackLevel ) const = 0; +#endif // ENABLE_CAIRO_CANVAS +}; + +#endif + +/* vim:set tabstop=4 shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/toolbox.h b/vcl/inc/toolbox.h new file mode 100644 index 000000000..bf4c51c5d --- /dev/null +++ b/vcl/inc/toolbox.h @@ -0,0 +1,158 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_TOOLBOX_H +#define INCLUDED_VCL_INC_TOOLBOX_H + +#include <vcl/toolbox.hxx> +#include <vcl/toolkit/controllayout.hxx> + +#include <vector> + +#define TB_DROPDOWNARROWWIDTH 11 + +#define TB_MENUBUTTON_SIZE 12 +#define TB_MENUBUTTON_OFFSET 2 + +namespace vcl { class Window; } + +struct ImplToolItem +{ + VclPtr<vcl::Window> mpWindow; //don't dispose mpWindow - we get copied around + bool mbNonInteractiveWindow; + void* mpUserData; + Image maImage; + long mnImageAngle; + bool mbMirrorMode; + OUString maText; + OUString maQuickHelpText; + OUString maHelpText; + OUString maCommandStr; + OString maHelpId; + tools::Rectangle maRect; + tools::Rectangle maCalcRect; + /// Widget layout may request size; set it as the minimal size (like, the item will always have at least this size). + Size maMinimalItemSize; + /// The overall horizontal item size, including one or more of [image size + textlength + dropdown arrow] + Size maItemSize; + long mnSepSize; + long mnDropDownArrowWidth; + /// Size of the content (bitmap or text, without dropdown) that we have in the item. + Size maContentSize; + ToolBoxItemType meType; + ToolBoxItemBits mnBits; + TriState meState; + sal_uInt16 mnId; + bool mbEnabled:1, + mbVisible:1, + mbEmptyBtn:1, + mbShowWindow:1, + mbBreak:1, + mbVisibleText:1, // indicates if text will definitely be drawn, influences dropdown pos + mbExpand:1; + + ImplToolItem(); + ImplToolItem( sal_uInt16 nItemId, const Image& rImage, + ToolBoxItemBits nItemBits ); + ImplToolItem( sal_uInt16 nItemId, const OUString& rTxt, + ToolBoxItemBits nItemBits ); + ImplToolItem( sal_uInt16 nItemId, const Image& rImage, + const OUString& rTxt, + ToolBoxItemBits nItemBits ); + + // returns the size of an item, taking toolbox orientation into account + // the default size is the precomputed size for standard items + // ie those that are just ordinary buttons (no windows or text etc.) + // bCheckMaxWidth indicates that item windows must not exceed maxWidth in which case they will be painted as buttons + Size GetSize( bool bHorz, bool bCheckMaxWidth, long maxWidth, const Size& rDefaultSize ); + + // only useful for buttons: returns if the text or image part or both can be drawn according to current button drawing style + void DetermineButtonDrawStyle( ButtonType eButtonType, bool& rbImage, bool& rbText ) const; + + // returns the rectangle which contains the drop down arrow + // or an empty rect if there is none + // bHorz denotes the toolbox alignment + tools::Rectangle GetDropDownRect( bool bHorz ) const; + + // returns sal_True if the toolbar item is currently clipped, which can happen for docked toolbars + bool IsClipped() const; + + // returns sal_True if the toolbar item is currently hidden i.e. they are unchecked in the toolbar Customize menu + bool IsItemHidden() const; + +private: + void init(sal_uInt16 nItemId, ToolBoxItemBits nItemBits, bool bEmptyBtn); +}; + +namespace vcl +{ + +struct ToolBoxLayoutData : public ControlLayoutData +{ + std::vector< sal_uInt16 > m_aLineItemIds; +}; + +} /* namespace vcl */ + +struct ImplToolBoxPrivateData +{ + std::unique_ptr<vcl::ToolBoxLayoutData> m_pLayoutData; + ToolBox::ImplToolItems m_aItems; + + ImplToolBoxPrivateData(); + ~ImplToolBoxPrivateData(); + + void ImplClearLayoutData() { m_pLayoutData.reset(); } + + // called when dropdown items are clicked + Link<ToolBox *, void> maDropdownClickHdl; + Timer maDropdownTimer; // for opening dropdown items on "long click" + + // large or small buttons ? + ToolBoxButtonSize meButtonSize; + + // the optional custom menu + VclPtr<PopupMenu> mpMenu; + ToolBoxMenuType maMenuType; + + // called when menu button is clicked and before the popup menu is executed + Link<ToolBox *, void> maMenuButtonHdl; + + // a dummy item representing the custom menu button + ImplToolItem maMenubuttonItem; + long mnMenuButtonWidth; + + Wallpaper maDisplayBackground; + + bool mbIsLocked:1, // keeps last lock state from ImplDockingWindowWrapper + mbAssumeDocked:1, // only used during calculations to override current floating/popup mode + mbAssumeFloating:1, + mbAssumePopupMode:1, + mbKeyInputDisabled:1, // no KEY input if all items disabled, closing/docking will be allowed though + mbIsPaintLocked:1, // don't allow paints + mbMenubuttonSelected:1, // menu button is highlighted + mbMenubuttonWasLastSelected:1, // menu button was highlighted when focus was lost + mbNativeButtons:1, // system supports native toolbar buttons + mbWillUsePopupMode:1, // this toolbox will be opened in popup mode + mbDropDownByKeyboard:1; // tells whether a dropdown was started by key input +}; + +#endif // INCLUDED_VCL_INC_TOOLBOX_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/treeglue.hxx b/vcl/inc/treeglue.hxx new file mode 100644 index 000000000..11c61944f --- /dev/null +++ b/vcl/inc/treeglue.hxx @@ -0,0 +1,174 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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/. + */ + +#include <vcl/toolkit/svtabbx.hxx> +#include "svimpbox.hxx" + +//the default NotifyStartDrag is weird to me, and defaults to enabling all +//possibilities when drag starts, while restricting it to some subset of +//the configured drag drop mode would make more sense to me, but I'm not +//going to change the baseclass + +class LclHeaderTabListBox final : public SvHeaderTabListBox +{ +private: + Link<SvTreeListEntry*, bool> m_aEditingEntryHdl; + Link<std::pair<SvTreeListEntry*, OUString>, bool> m_aEditedEntryHdl; + +public: + LclHeaderTabListBox(vcl::Window* pParent, WinBits nWinStyle) + : SvHeaderTabListBox(pParent, nWinStyle) + { + } + + void SetEditingEntryHdl(const Link<SvTreeListEntry*, bool>& rLink) + { + m_aEditingEntryHdl = rLink; + } + + void SetEditedEntryHdl(const Link<std::pair<SvTreeListEntry*, OUString>, bool>& rLink) + { + m_aEditedEntryHdl = rLink; + } + + virtual DragDropMode NotifyStartDrag(TransferDataContainer&, SvTreeListEntry*) override + { + return GetDragDropMode(); + } + + virtual bool EditingEntry(SvTreeListEntry* pEntry, Selection&) override + { + return m_aEditingEntryHdl.Call(pEntry); + } + + virtual bool EditedEntry(SvTreeListEntry* pEntry, const OUString& rNewText) override + { + return m_aEditedEntryHdl.Call(std::pair<SvTreeListEntry*, OUString>(pEntry, rNewText)); + } +}; + +class LclTabListBox final : public SvTabListBox +{ + Link<SvTreeListBox*, void> m_aModelChangedHdl; + Link<SvTreeListBox*, bool> m_aStartDragHdl; + Link<SvTreeListBox*, void> m_aEndDragHdl; + Link<SvTreeListEntry*, bool> m_aEditingEntryHdl; + Link<std::pair<SvTreeListEntry*, OUString>, bool> m_aEditedEntryHdl; + +public: + LclTabListBox(vcl::Window* pParent, WinBits nWinStyle) + : SvTabListBox(pParent, nWinStyle) + { + } + + void SetModelChangedHdl(const Link<SvTreeListBox*, void>& rLink) { m_aModelChangedHdl = rLink; } + void SetStartDragHdl(const Link<SvTreeListBox*, bool>& rLink) { m_aStartDragHdl = rLink; } + void SetEndDragHdl(const Link<SvTreeListBox*, void>& rLink) { m_aEndDragHdl = rLink; } + void SetEditingEntryHdl(const Link<SvTreeListEntry*, bool>& rLink) + { + m_aEditingEntryHdl = rLink; + } + void SetEditedEntryHdl(const Link<std::pair<SvTreeListEntry*, OUString>, bool>& rLink) + { + m_aEditedEntryHdl = rLink; + } + + virtual DragDropMode NotifyStartDrag(TransferDataContainer&, SvTreeListEntry*) override + { + return GetDragDropMode(); + } + + virtual void StartDrag(sal_Int8 nAction, const Point& rPosPixel) override + { + if (m_aStartDragHdl.Call(this)) + return; + SvTabListBox::StartDrag(nAction, rPosPixel); + } + + virtual void DragFinished(sal_Int8 nDropAction) override + { + SvTabListBox::DragFinished(nDropAction); + m_aEndDragHdl.Call(this); + } + + virtual void ModelHasCleared() override + { + SvTabListBox::ModelHasCleared(); + m_aModelChangedHdl.Call(this); + } + + virtual void ModelHasInserted(SvTreeListEntry* pEntry) override + { + SvTabListBox::ModelHasInserted(pEntry); + m_aModelChangedHdl.Call(this); + } + + virtual void ModelHasInsertedTree(SvTreeListEntry* pEntry) override + { + SvTabListBox::ModelHasInsertedTree(pEntry); + m_aModelChangedHdl.Call(this); + } + + virtual void ModelHasMoved(SvTreeListEntry* pSource) override + { + SvTabListBox::ModelHasMoved(pSource); + m_aModelChangedHdl.Call(this); + } + + virtual void ModelHasRemoved(SvTreeListEntry* pEntry) override + { + SvTabListBox::ModelHasRemoved(pEntry); + m_aModelChangedHdl.Call(this); + } + + SvTreeListEntry* GetTargetAtPoint(const Point& rPos, bool bHighLightTarget) + { + SvTreeListEntry* pOldTargetEntry = pTargetEntry; + pTargetEntry = pImpl->GetEntry(rPos); + if (pOldTargetEntry != pTargetEntry) + ImplShowTargetEmphasis(pOldTargetEntry, false); + + // scroll + if (rPos.Y() < 12) + { + ImplShowTargetEmphasis(pTargetEntry, false); + ScrollOutputArea(+1); + } + else + { + Size aSize(pImpl->GetOutputSize()); + if (rPos.Y() > aSize.Height() - 12) + { + ImplShowTargetEmphasis(pTargetEntry, false); + ScrollOutputArea(-1); + } + } + + if (pTargetEntry && bHighLightTarget) + ImplShowTargetEmphasis(pTargetEntry, true); + return pTargetEntry; + } + + virtual SvTreeListEntry* GetDropTarget(const Point& rPos) override + { + return GetTargetAtPoint(rPos, true); + } + + virtual bool EditingEntry(SvTreeListEntry* pEntry, Selection&) override + { + return m_aEditingEntryHdl.Call(pEntry); + } + + virtual bool EditedEntry(SvTreeListEntry* pEntry, const OUString& rNewText) override + { + return m_aEditedEntryHdl.Call(std::pair<SvTreeListEntry*, OUString>(pEntry, rNewText)); + } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/uiobject-internal.hxx b/vcl/inc/uiobject-internal.hxx new file mode 100644 index 000000000..accecb2e8 --- /dev/null +++ b/vcl/inc/uiobject-internal.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/. + */ + +#include <memory> +#include <vcl/uitest/uiobject.hxx> +#include "wizdlg.hxx" + +class RoadmapWizard; + +class RoadmapWizardUIObject final : public WindowUIObject +{ + VclPtr<vcl::RoadmapWizard> mxRoadmapWizard; + +public: + RoadmapWizardUIObject(const VclPtr<vcl::RoadmapWizard>& xRoadmapWizard); + virtual ~RoadmapWizardUIObject() override; + + virtual StringMap get_state() override; + + virtual void execute(const OUString& rAction, const StringMap& rParameters) override; + + static std::unique_ptr<UIObject> create(vcl::Window* pWindow); + +private: + virtual OUString get_name() const override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/units.hrc b/vcl/inc/units.hrc new file mode 100644 index 000000000..74c449675 --- /dev/null +++ b/vcl/inc/units.hrc @@ -0,0 +1,62 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNITS_HRC +#define INCLUDED_VCL_INC_UNITS_HRC + +#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) + +std::pair<const char*, FieldUnit> SV_FUNIT_STRINGS[] = +{ + // To translators: This is the first entry of a sequence of measurement unit names + { NC_("SV_FUNIT_STRINGS", "mm"), FieldUnit::MM }, + { NC_("SV_FUNIT_STRINGS", "cm"), FieldUnit::CM }, + { NC_("SV_FUNIT_STRINGS", "m"), FieldUnit::M }, + { NC_("SV_FUNIT_STRINGS", "km"), FieldUnit::KM }, + { NC_("SV_FUNIT_STRINGS", "twips"), FieldUnit::TWIP }, + { NC_("SV_FUNIT_STRINGS", "twip"), FieldUnit::TWIP }, + { NC_("SV_FUNIT_STRINGS", "pt"), FieldUnit::POINT }, + { NC_("SV_FUNIT_STRINGS", "pc"), FieldUnit::PICA }, + /* To translators: double prime symbol for inch */ + { NC_("SV_FUNIT_STRINGS", "″"), FieldUnit::INCH }, + { NC_("SV_FUNIT_STRINGS", "\""), FieldUnit::INCH }, + { NC_("SV_FUNIT_STRINGS", "in"), FieldUnit::INCH }, + { NC_("SV_FUNIT_STRINGS", "inch"), FieldUnit::INCH }, + /* To translators: prime symbol for foot */ + { NC_("SV_FUNIT_STRINGS", "′"), FieldUnit::FOOT }, + { NC_("SV_FUNIT_STRINGS", "'"), FieldUnit::FOOT }, + { NC_("SV_FUNIT_STRINGS", "ft"), FieldUnit::FOOT }, + { NC_("SV_FUNIT_STRINGS", "foot"), FieldUnit::FOOT }, + { NC_("SV_FUNIT_STRINGS", "feet"), FieldUnit::FOOT }, + { NC_("SV_FUNIT_STRINGS", "miles"), FieldUnit::MILE }, + { NC_("SV_FUNIT_STRINGS", "mile"), FieldUnit::MILE }, + { NC_("SV_FUNIT_STRINGS", "ch"), FieldUnit::CHAR }, + { NC_("SV_FUNIT_STRINGS", "line"), FieldUnit::LINE }, + { NC_("SV_FUNIT_STRINGS", "pixels"), FieldUnit::PIXEL }, + { NC_("SV_FUNIT_STRINGS", "pixel"), FieldUnit::PIXEL }, + /* To translators: degree */ + { NC_("SV_FUNIT_STRINGS", "°"), FieldUnit::DEGREE }, + { NC_("SV_FUNIT_STRINGS", "sec"), FieldUnit::SECOND }, + // To translators: This is the last entry of the sequence of measurement unit names + { NC_("SV_FUNIT_STRINGS", "ms"), FieldUnit::MILLISECOND } +}; + +#endif // INCLUDED_VCL_INC_UNITS_HRC + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/XIM.h b/vcl/inc/unx/XIM.h new file mode 100644 index 000000000..d2fcd9c0e --- /dev/null +++ b/vcl/inc/unx/XIM.h @@ -0,0 +1,111 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_VCL_INC_UNX_XIM_H +#define INCLUDED_VCL_INC_UNX_XIM_H + +#include <X11/Xlib.h> + +#ifndef XIMCallback1 +typedef int (*XIMProc1)(XIC, XPointer, XPointer); +typedef struct { + XPointer client_data; + XIMProc1 callback; +} XIMCallback1; +#endif + +typedef struct { + int start_position; + int end_position; + XPointer data; +} XIMAnnotation; + +/* + XIMUText: XIMText extension for UTF16 + */ +typedef struct { + unsigned short length; + XIMFeedback *feedback; + Bool encoding_is_wchar; + union { + char *multi_byte; + wchar_t *wide_char; + unsigned short *utf16_char; + } string; + unsigned int count_annotations; + XIMAnnotation *annotations; +} XIMUnicodeText; + +/* lookup choice */ +typedef enum { + XIMDrawUpHorizontally = 0 , + XIMDrawUpVertically = 1 +} XIMDrawUpDirection ; + +typedef struct { + int choice_per_window; /* Number of choices can be display + * in the region + */ + int nrows; + int ncolumns; + XIMDrawUpDirection draw_up_direction; +} XIMLookupStartCallbackStruct; + +typedef struct { + XIMUnicodeText *label; + XIMUnicodeText *value; +} XIMUnicodeChoiceObject; + +typedef struct { + XIMUnicodeChoiceObject *choices; /* the lookup choices */ + int n_choices; /* Total number of lookup choices */ + int first_index; + int last_index; + int current_index; + XIMUnicodeText *title; +} XIMLookupDrawCallbackStruct; + +/* Unicode Subset */ +typedef enum { + XIMKatakana, XIMHanzi +} XIMUnicodeCharacterSubsetID; + +typedef struct { + XIMUnicodeCharacterSubsetID index; + XIMUnicodeCharacterSubsetID subset_id; + char *name; + Bool is_active; +} XIMUnicodeCharacterSubset; + +typedef struct { + unsigned short count_subsets; + XIMUnicodeCharacterSubset *supported_subsets; +} XIMUnicodeCharacterSubsets; + +typedef struct { + XIMUnicodeCharacterSubset *from; + XIMUnicodeCharacterSubset *to; +} XIMSwitchIMNotifyCallbackStruct; + +/* XIC attributes for multilingual IM extension */ + +#define XNUnicodeCharacterSubset "UnicodeChararcterSubset" + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/cairotextrender.hxx b/vcl/inc/unx/cairotextrender.hxx new file mode 100644 index 000000000..3879bf5d9 --- /dev/null +++ b/vcl/inc/unx/cairotextrender.hxx @@ -0,0 +1,42 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_CAIROTEXTRENDER_HXX +#define INCLUDED_VCL_INC_UNX_CAIROTEXTRENDER_HXX + +#include <unx/freetypetextrender.hxx> + +typedef struct _cairo cairo_t; + +class VCL_DLLPUBLIC CairoTextRender : public FreeTypeTextRenderImpl +{ +protected: + virtual cairo_t* getCairoContext() = 0; + virtual void getSurfaceOffset(double& nDX, double& nDY) = 0; + virtual void releaseCairoContext(cairo_t* cr) = 0; + + virtual void clipRegion(cairo_t* cr) = 0; + +public: + virtual void DrawTextLayout(const GenericSalLayout&, const SalGraphics&) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/cpdmgr.hxx b/vcl/inc/unx/cpdmgr.hxx new file mode 100644 index 000000000..6449355a1 --- /dev/null +++ b/vcl/inc/unx/cpdmgr.hxx @@ -0,0 +1,126 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_CPDMGR_HXX +#define INCLUDED_VCL_INC_UNX_CPDMGR_HXX + +#include <config_dbus.h> +#include <config_gio.h> + +#if ENABLE_DBUS && ENABLE_GIO +#include <gio/gio.h> +#else +typedef struct _GDBusProxy GDBusProxy; +typedef struct _GDBusConnection GDBusConnection; +#endif + +#include <printerinfomanager.hxx> +#include "cupsmgr.hxx" + +#define BACKEND_DIR "/usr/share/print-backends" +#define FRONTEND_INTERFACE "/usr/share/dbus-1/interfaces/org.openprinting.Frontend.xml" +#define BACKEND_INTERFACE "/usr/share/dbus-1/interfaces/org.openprinting.Backend.xml" + +namespace psp +{ + +class PPDParser; + +struct CPDPrinter +{ + const char* id; + const char* name; + const char* info; + const char* location; + const char* make_and_model; + const char* printer_state; + const char* backend_name; + bool is_accepting_jobs; + GDBusProxy* backend; +}; + +class CPDManager : public PrinterInfoManager +{ +#if ENABLE_DBUS && ENABLE_GIO + GDBusConnection * m_pConnection = nullptr; + bool m_aPrintersChanged = true; + std::vector<std::pair<std::string, gchar*>> m_tBackends; + std::unordered_map< std::string, GDBusProxy * > m_pBackends; + std::unordered_map< FILE*, OString, FPtrHash > m_aSpoolFiles; + std::unordered_map< OUString, CPDPrinter * > m_aCPDDestMap; + std::unordered_map< OUString, PPDContext > m_aDefaultContexts; +#endif + CPDManager(); + // Function called when CPDManager is destroyed + virtual ~CPDManager() override; + + virtual void initialize() override; + +#if ENABLE_DBUS && ENABLE_GIO + static void onNameAcquired(GDBusConnection *connection, const gchar* name, gpointer user_data); + static void onNameLost (GDBusConnection *, const gchar *name, gpointer); + static void printerAdded (GDBusConnection *connection, + const gchar *sender_name, + const gchar *object_path, + const gchar *interface_name, + const gchar *signal_name, + GVariant *parameters, + gpointer user_data); + static void printerRemoved (GDBusConnection *connection, + const gchar *sender_name, + const gchar *object_path, + const gchar *interface_name, + const gchar *signal_name, + GVariant *parameters, + gpointer user_data); + + static void getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner, const OString& rJobName, int& rNumOptions, GVariant **arr ); +#endif + +public: +#if ENABLE_DBUS && ENABLE_GIO + // Functions involved in initialization + GDBusProxy* getProxy(const std::string& target); + void addBackend( std::pair< std::string, GDBusProxy * > pair ); + void addTempBackend(const std::pair<std::string, gchar*>& pair); + std::vector<std::pair<std::string, gchar*>> const & getTempBackends() const; + void addNewPrinter( const OUString&, const OUString&, CPDPrinter * ); +#endif + + // Create CPDManager + static CPDManager* tryLoadCPD(); + + // Create a PPDParser for CPD Printers + const PPDParser* createCPDParser( const OUString& rPrinter ); + + // Functions related to printing + virtual FILE* startSpool( const OUString& rPrinterName, bool bQuickCommand ) override; + virtual bool endSpool( const OUString& rPrinterName, const OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner, const OUString& rFaxNumber ) override; + virtual void setupJobContextData( JobData& rData ) override; + + // check if the printer configuration has changed + virtual bool checkPrintersChanged( bool bWait ) override; +}; + +} // namespace psp + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ + diff --git a/vcl/inc/unx/cupsmgr.hxx b/vcl/inc/unx/cupsmgr.hxx new file mode 100644 index 000000000..9fd153938 --- /dev/null +++ b/vcl/inc/unx/cupsmgr.hxx @@ -0,0 +1,90 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_CUPSMGR_HXX +#define INCLUDED_VCL_INC_UNX_CUPSMGR_HXX + +#include <printerinfomanager.hxx> +#include <osl/thread.h> +#include <osl/mutex.hxx> + +namespace psp +{ + +class PPDParser; + +struct FPtrHash +{ + size_t operator()(const FILE* pPtr) const + { return reinterpret_cast<size_t>(pPtr); } +}; + +class CUPSManager : public PrinterInfoManager +{ + std::unordered_map< FILE*, OString, FPtrHash > m_aSpoolFiles; + int m_nDests; + void* m_pDests; + bool m_bNewDests; + std::unordered_map< OUString, int > m_aCUPSDestMap; + + std::unordered_map< OUString, PPDContext > m_aDefaultContexts; + + OString m_aUser; + /** this is a security risk, but the CUPS API demands + to deliver a pointer to a static buffer containing + the password, so this cannot be helped*/ + OString m_aPassword; + + osl::Mutex m_aCUPSMutex; + oslThread m_aDestThread; + + osl::Mutex m_aGetPPDMutex; + bool m_bPPDThreadRunning; + + CUPSManager(); + virtual ~CUPSManager() override; + + virtual void initialize() override; + + static void getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner, int& rNumOptions, void** rOptions ); + void runDests(); + OString threadedCupsGetPPD(const char* pPrinter); +public: + static void runDestThread(void* pMgr); + + static CUPSManager* tryLoadCUPS(); + + /// wraps cupsGetPPD, so unlink after use ! + const PPDParser* createCUPSParser( const OUString& rPrinter ); + + const char* authenticateUser(); + + virtual FILE* startSpool( const OUString& rPrinterName, bool bQuickCommand ) override; + virtual bool endSpool( const OUString& rPrinterName, const OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner, const OUString& rFaxNumber ) override; + virtual void setupJobContextData( JobData& rData ) override; + + /// check if the printer configuration has changed + virtual bool checkPrintersChanged( bool bWait ) override; +}; + +} // namespace psp + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/desktops.hxx b/vcl/inc/unx/desktops.hxx new file mode 100644 index 000000000..531e4c642 --- /dev/null +++ b/vcl/inc/unx/desktops.hxx @@ -0,0 +1,40 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_DESKTOPS_HXX +#define INCLUDED_VCL_INC_UNX_DESKTOPS_HXX + +#include <sal/config.h> + +#include <sal/types.h> + +enum SAL_DLLPUBLIC_RTTI DesktopType { + DESKTOP_NONE, // headless, i.e. no X connection at all + DESKTOP_UNKNOWN, // unknown desktop, simple WM, etc. + DESKTOP_GNOME, + DESKTOP_UNITY, + DESKTOP_XFCE, + DESKTOP_MATE, + DESKTOP_PLASMA5, + DESKTOP_LXQT +}; // keep in sync with desktop_strings[] in salplug.cxx + +#endif // INCLUDED_VCL_INC_UNX_DESKTOPS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/fc_fontoptions.hxx b/vcl/inc/unx/fc_fontoptions.hxx new file mode 100644 index 000000000..de6ed2aba --- /dev/null +++ b/vcl/inc/unx/fc_fontoptions.hxx @@ -0,0 +1,43 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_FC_FONTOPTIONS_HXX +#define INCLUDED_VCL_INC_UNX_FC_FONTOPTIONS_HXX + +#include <rtl/string.hxx> + +typedef struct _FcPattern FcPattern; +class VCL_DLLPUBLIC FontConfigFontOptions +{ +public: + FontConfigFontOptions(FcPattern* pPattern) : + mpPattern(pPattern) {} + ~FontConfigFontOptions(); + + void SyncPattern(const OString& rFileName, sal_uInt32 nFontFace, sal_uInt32 nFontVariation, bool bEmbolden); + FcPattern* GetPattern() const; + static void cairo_font_options_substitute(FcPattern* pPattern); +private: + FcPattern* mpPattern; +}; + + +#endif // INCLUDED_VCL_INC_UNX_FC_FONTOPTIONS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx new file mode 100644 index 000000000..7d625555d --- /dev/null +++ b/vcl/inc/unx/fontmanager.hxx @@ -0,0 +1,322 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_FONTMANAGER_HXX +#define INCLUDED_VCL_INC_FONTMANAGER_HXX + +#include <config_options.h> +#include <tools/fontenum.hxx> +#include <vcl/dllapi.h> +#include <vcl/glyphitem.hxx> +#include <vcl/timer.hxx> +#include <com/sun/star/lang/Locale.hpp> +#include <unx/fc_fontoptions.hxx> + +#include <map> +#include <set> +#include <memory> +#include <vector> +#include <unordered_map> + +/* + * some words on metrics: every length returned by PrintFontManager and + * friends are PostScript afm style, that is they are 1/1000 font height + */ + +class FontSubsetInfo; +class FontConfigFontOptions; +class FontSelectPattern; +class GenericUnixSalData; + +namespace psp { +class PPDParser; + +typedef int fontID; + +/* + * the difference between FastPrintFontInfo and PrintFontInfo + * is that the information in FastPrintFontInfo can usually + * be gathered without opening either the font file, they are + * gathered from fonts.dir alone. + * if only FastPrintFontInfo is gathered and PrintFontInfo + * on demand and for less fonts, then performance in startup + * increases considerably + */ + +struct FastPrintFontInfo +{ + fontID m_nID; // FontID + + // font attributes + OUString m_aFamilyName; + OUString m_aStyleName; + std::vector< OUString > m_aAliases; + FontFamily m_eFamilyStyle; + FontItalic m_eItalic; + FontWidth m_eWidth; + FontWeight m_eWeight; + FontPitch m_ePitch; + rtl_TextEncoding m_aEncoding; + + FastPrintFontInfo() + : m_nID(0) + , m_eFamilyStyle(FAMILY_DONTKNOW) + , m_eItalic(ITALIC_DONTKNOW) + , m_eWidth(WIDTH_DONTKNOW) + , m_eWeight(WEIGHT_DONTKNOW) + , m_ePitch(PITCH_DONTKNOW) + , m_aEncoding(RTL_TEXTENCODING_DONTKNOW) + {} +}; + +struct PrintFontInfo : public FastPrintFontInfo +{ + int m_nAscend; + int m_nDescend; + + PrintFontInfo() : + FastPrintFontInfo(), + m_nAscend( 0 ), + m_nDescend( 0 ) + {} +}; + +// a class to manage printable fonts + +class VCL_PLUGIN_PUBLIC PrintFontManager +{ + struct PrintFont; + friend struct PrintFont; + + struct VCL_DLLPRIVATE PrintFont + { + // font attributes + OUString m_aFamilyName; + std::vector<OUString> m_aAliases; + OUString m_aPSName; + OUString m_aStyleName; + FontFamily m_eFamilyStyle; + FontItalic m_eItalic; + FontWidth m_eWidth; + FontWeight m_eWeight; + FontPitch m_ePitch; + rtl_TextEncoding m_aEncoding; + int m_nAscend; + int m_nDescend; + int m_nLeading; + int m_nXMin; // font bounding box + int m_nYMin; + int m_nXMax; + int m_nYMax; + + int m_nDirectory; // atom containing system dependent path + OString m_aFontFile; // relative to directory + int m_nCollectionEntry; // 0 for regular fonts, 0 to ... for fonts stemming from collections + int m_nVariationEntry; // 0 for regular fonts, 0 to ... for fonts stemming from font variations + + explicit PrintFont(); + }; + + fontID m_nNextFontID; + std::unordered_map< fontID, std::unique_ptr<PrintFont> > m_aFonts; + // for speeding up findFontFileID + std::unordered_map< OString, std::set< fontID > > + m_aFontFileToFontID; + + std::unordered_map< OString, int > + m_aDirToAtom; + std::unordered_map< int, OString > m_aAtomToDir; + int m_nNextDirAtom; + + OString getFontFile(const PrintFont* pFont) const; + + std::vector<std::unique_ptr<PrintFont>> analyzeFontFile(int nDirID, const OString& rFileName, const char *pFormat=nullptr) const; + static OUString convertSfntName( void* pNameRecord ); // actually a NameRecord* format font subsetting code + static void analyzeSfntFamilyName( void const * pTTFont, std::vector< OUString >& rnames ); // actually a TrueTypeFont* from font subsetting code + bool analyzeSfntFile(PrintFont* pFont) const; + // finds the font id for the nFaceIndex face in this font file + // There may be multiple font ids for font collections + fontID findFontFileID(int nDirID, const OString& rFile, int nFaceIndex, int nVariationIndex) const; + + // There may be multiple font ids for font collections + std::vector<fontID> findFontFileIDs( int nDirID, const OString& rFile ) const; + + static FontFamily matchFamilyName( const OUString& rFamily ); + + PrintFont* getFont( fontID nID ) const + { + auto it = m_aFonts.find( nID ); + return it == m_aFonts.end() ? nullptr : it->second.get(); + } + static void fillPrintFontInfo(PrintFont* pFont, FastPrintFontInfo& rInfo); + void fillPrintFontInfo( PrintFont* pFont, PrintFontInfo& rInfo ) const; + + OString getDirectory( int nAtom ) const; + int getDirectoryAtom( const OString& rDirectory ); + + /* try to initialize fonts from libfontconfig + + called from <code>initialize()</code> + */ + static void initFontconfig(); + void countFontconfigFonts( std::unordered_map<OString, int>& o_rVisitedPaths ); + /* deinitialize fontconfig + */ + static void deinitFontconfig(); + + /* register an application specific font directory for libfontconfig + + since fontconfig is asked for font substitutes before OOo will check for font availability + and fontconfig will happily substitute fonts it doesn't know (e.g. "Arial Narrow" -> "DejaVu Sans Book"!) + it becomes necessary to tell the library about all the hidden font treasures + */ + static void addFontconfigDir(const OString& rDirectory); + + std::set<OString> m_aPreviousLangSupportRequests; + std::vector<OUString> m_aCurrentRequests; + Timer m_aFontInstallerTimer; + + DECL_LINK( autoInstallFontLangSupport, Timer*, void ); + PrintFontManager(); +public: + ~PrintFontManager(); + friend class ::GenericUnixSalData; + static PrintFontManager& get(); // one instance only + + // There may be multiple font ids for font collections + std::vector<fontID> addFontFile( const OUString& rFileUrl ); + + void initialize(); + + // returns the ids of all managed fonts. + void getFontList( std::vector< fontID >& rFontIDs ); + + // get font info for a specific font + bool getFontInfo( fontID nFontID, PrintFontInfo& rInfo ) const; + // get fast font info for a specific font + bool getFontFastInfo( fontID nFontID, FastPrintFontInfo& rInfo ) const; + + // routines to get font info in small pieces + + // get a specific fonts PSName name + OUString getPSName( fontID nFontID ) const; + + // get a specific fonts italic type + FontItalic getFontItalic( fontID nFontID ) const + { + PrintFont* pFont = getFont( nFontID ); + return pFont ? pFont->m_eItalic : ITALIC_DONTKNOW; + } + + // get a specific fonts weight type + FontWeight getFontWeight( fontID nFontID ) const + { + PrintFont* pFont = getFont( nFontID ); + return pFont ? pFont->m_eWeight : WEIGHT_DONTKNOW; + } + + // get a specific fonts system dependent filename + OString getFontFileSysPath( fontID nFontID ) const + { + return getFontFile( getFont( nFontID ) ); + } + + // get the ttc face number + int getFontFaceNumber( fontID nFontID ) const; + + // get the ttc face variation + int getFontFaceVariation( fontID nFontID ) const; + + // get a specific fonts ascend + int getFontAscend( fontID nFontID ) const; + + // get a specific fonts descent + int getFontDescend( fontID nFontID ) const; + + // get a fonts glyph bounding box + void getFontBoundingBox( fontID nFont, int& xMin, int& yMin, int& xMax, int& yMax ); + + // creates a new font subset of an existing SFNT font + // returns true in case of success, else false + // nFont: the font to be subsetted + // rOutFile: the file to put the new subset into; + // must be a valid osl file URL + // pGlyphIDs: input array of glyph ids for new font + // pNewEncoding: the corresponding encoding in the new font + // pWidths: output array of widths of requested glyphs + // nGlyphs: number of glyphs in arrays + // pCapHeight:: capital height of the produced font + // pXMin, pYMin, pXMax, pYMax: outgoing font bounding box + // TODO: callers of this method should use its FontSubsetInfo counterpart directly + bool createFontSubset( FontSubsetInfo&, + fontID nFont, + const OUString& rOutFile, + const sal_GlyphId* pGlyphIDs, + const sal_uInt8* pNewEncoding, + sal_Int32* pWidths, + int nGlyphs + ); + void getGlyphWidths( fontID nFont, + bool bVertical, + std::vector< sal_Int32 >& rWidths, + std::map< sal_Unicode, sal_uInt32 >& rUnicodeEnc ); + + // font administration functions + + /* system dependent font matching + + <p> + <code>matchFont</code> matches a pattern of font characteristics + and returns the closest match if possible. If a match was found + the <code>FastPrintFontInfo</code> passed in as parameter + will be update to the found matching font. + </p> + <p> + implementation note: currently the function is only implemented + for fontconfig. + </p> + + @param rInfo + out of the FastPrintFontInfo structure the following + fields will be used for the match: + <ul> + <li>family name</li> + <li>italic</li> + <li>width</li> + <li>weight</li> + <li>pitch</li> + </ul> + + @param rLocale + if <code>rLocal</code> contains non empty strings the corresponding + locale will be used for font matching also; e.g. "Sans" can result + in different fonts in e.g. english and japanese + */ + void matchFont( FastPrintFontInfo& rInfo, const css::lang::Locale& rLocale ); + static std::unique_ptr<FontConfigFontOptions> getFontOptions( const FastPrintFontInfo&, int nSize); + + void Substitute(FontSelectPattern &rPattern, OUString& rMissingCodes); + +}; + +} // namespace + +#endif // INCLUDED_VCL_INC_FONTMANAGER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/freetype_glyphcache.hxx b/vcl/inc/unx/freetype_glyphcache.hxx new file mode 100644 index 000000000..c375ba2ff --- /dev/null +++ b/vcl/inc/unx/freetype_glyphcache.hxx @@ -0,0 +1,127 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_GENERIC_GLYPHS_GCACH_FTYP_HXX +#define INCLUDED_VCL_GENERIC_GLYPHS_GCACH_FTYP_HXX + +#include <unx/glyphcache.hxx> +#include <PhysicalFontFace.hxx> +#include <fontinstance.hxx> +#include <vcl/glyphitem.hxx> + +class CmapResult; + +// FreetypeFontFile has the responsibility that a font file is only mapped once. +// (#86621#) the old directly ft-managed solution caused it to be mapped +// in up to nTTC*nSizes*nOrientation*nSynthetic times +class FreetypeFontFile final +{ +public: + bool Map(); + void Unmap(); + + const unsigned char* GetBuffer() const { return mpFileMap; } + int GetFileSize() const { return mnFileSize; } + const OString& GetFileName() const { return maNativeFileName; } + int GetLangBoost() const { return mnLangBoost; } + +private: + friend class FreetypeManager; + explicit FreetypeFontFile( const OString& rNativeFileName ); + + const OString maNativeFileName; + unsigned char* mpFileMap; + int mnFileSize; + int mnRefCount; + int mnLangBoost; +}; + +// FreetypeFontInfo corresponds to an unscaled font face +class FreetypeFontInfo final +{ +public: + ~FreetypeFontInfo(); + + const unsigned char* GetTable( const char*, sal_uLong* pLength) const; + + FT_FaceRec_* GetFaceFT(); + void ReleaseFaceFT(); + + const OString& GetFontFileName() const { return mpFontFile->GetFileName(); } + int GetFontFaceIndex() const { return mnFaceNum; } + int GetFontFaceVariation() const { return mnFaceVariation; } + sal_IntPtr GetFontId() const { return mnFontId; } + bool IsSymbolFont() const { return maDevFontAttributes.IsSymbolFont(); } + const FontAttributes& GetFontAttributes() const { return maDevFontAttributes; } + + void AnnounceFont( PhysicalFontCollection* ); + + const FontCharMapRef& GetFontCharMap(); + +private: + friend class FreetypeManager; + explicit FreetypeFontInfo(const FontAttributes&, FreetypeFontFile* const pFontFile, + int nFaceNum, int nFaceVariation, sal_IntPtr nFontId); + + FT_FaceRec_* maFaceFT; + FreetypeFontFile* const mpFontFile; + const int mnFaceNum; + const int mnFaceVariation; + int mnRefCount; + sal_IntPtr mnFontId; + FontAttributes maDevFontAttributes; + + FontCharMapRef mxFontCharMap; +}; + +class FreetypeFontFace : public PhysicalFontFace +{ +private: + FreetypeFontInfo* mpFreetypeFontInfo; + +public: + FreetypeFontFace( FreetypeFontInfo*, const FontAttributes& ); + + virtual rtl::Reference<LogicalFontInstance> CreateFontInstance( const FontSelectPattern& ) const override; + virtual sal_IntPtr GetFontId() const override { return mpFreetypeFontInfo->GetFontId(); } +}; + +class SAL_DLLPUBLIC_RTTI FreetypeFontInstance : public LogicalFontInstance +{ + friend rtl::Reference<LogicalFontInstance> FreetypeFontFace::CreateFontInstance(const FontSelectPattern&) const; + + std::unique_ptr<FreetypeFont> mxFreetypeFont; + + virtual hb_font_t* ImplInitHbFont() override; + virtual bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const override; + +protected: + explicit FreetypeFontInstance(const PhysicalFontFace& rPFF, const FontSelectPattern& rFSP); + +public: + virtual ~FreetypeFontInstance() override; + + FreetypeFont& GetFreetypeFont() const { return *mxFreetypeFont; } + + virtual bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const override; +}; + +#endif // INCLUDED_VCL_GENERIC_GLYPHS_GCACH_FTYP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/freetypetextrender.hxx b/vcl/inc/unx/freetypetextrender.hxx new file mode 100644 index 000000000..ccc1db015 --- /dev/null +++ b/vcl/inc/unx/freetypetextrender.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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_FREETYPETEXTRENDER_HXX +#define INCLUDED_VCL_INC_UNX_FREETYPETEXTRENDER_HXX + +#include <textrender.hxx> + +class FreetypeFontInstance; + +// Generic implementation that uses freetype, but DrawTextLayout() +// still needs implementing (e.g. by Cairo or Skia). +class VCL_DLLPUBLIC FreeTypeTextRenderImpl : public TextRenderImpl +{ +protected: + rtl::Reference<FreetypeFontInstance> + mpFreetypeFont[ MAX_FALLBACK ]; + + Color mnTextColor; + +public: + FreeTypeTextRenderImpl(); + virtual ~FreeTypeTextRenderImpl() override; + + virtual void SetTextColor( Color nColor ) override; + virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) override; + virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override; + virtual 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*, + const sal_GlyphId* pGlyphIDs, + const sal_uInt8* pEncoding, + sal_Int32* pWidths, + int nGlyphs, + FontSubsetInfo& rInfo) 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 std::unique_ptr<GenericSalLayout> + GetTextLayout(int nFallbackLevel) override; +#if ENABLE_CAIRO_CANVAS + virtual SystemFontData GetSysFontData( int nFallbackLevel ) const override; +#endif +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gendata.hxx b/vcl/inc/unx/gendata.hxx new file mode 100644 index 000000000..f06dda35c --- /dev/null +++ b/vcl/inc/unx/gendata.hxx @@ -0,0 +1,102 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_GENERIC_GENDATA_HXX +#define INCLUDED_VCL_INC_GENERIC_GENDATA_HXX + +#include <osl/socket.hxx> + +#include <saldatabasic.hxx> + +#include <memory> + +class FreetypeManager; +class SalGenericDisplay; +namespace psp +{ +class PrintFontManager; +} + +enum GenericUnixSalDataType +{ + SAL_DATA_GTK, + SAL_DATA_GTK3, + SAL_DATA_KF5, + SAL_DATA_UNX, + SAL_DATA_SVP, + SAL_DATA_ANDROID, + SAL_DATA_IOS, + SAL_DATA_HEADLESS, + SAL_DATA_QT5 +}; + +class VCL_DLLPUBLIC GenericUnixSalData : public SalData +{ +private: + GenericUnixSalDataType m_eType; + SalGenericDisplay* m_pDisplay; + // cached hostname to avoid slow lookup + OUString m_aHostname; + // for transient storage of unicode strings eg. 'u123' by input methods + OUString m_aUnicodeEntry; + + std::unique_ptr<FreetypeManager> m_pFreetypeManager; + std::unique_ptr<psp::PrintFontManager> m_pPrintFontManager; + + void InitFreetypeManager(); + void InitPrintFontManager(); + +public: + GenericUnixSalData(GenericUnixSalDataType const t, SalInstance* const pInstance); + virtual ~GenericUnixSalData() override; + virtual void Dispose() {} + + SalGenericDisplay* GetDisplay() const { return m_pDisplay; } + void SetDisplay(SalGenericDisplay* pDisp) { m_pDisplay = pDisp; } + + const OUString& GetHostname() + { + if (m_aHostname.isEmpty()) + osl_getLocalHostname(&m_aHostname.pData); + return m_aHostname; + } + + OUString& GetUnicodeCommand() { return m_aUnicodeEntry; } + + GenericUnixSalDataType GetType() const { return m_eType; } + + FreetypeManager* GetFreetypeManager() + { + if (!m_pFreetypeManager) + InitFreetypeManager(); + return m_pFreetypeManager.get(); + } + + psp::PrintFontManager* GetPrintFontManager() + { + if (!m_pPrintFontManager) + InitPrintFontManager(); + // PrintFontManager needs the FreetypeManager + assert(m_pFreetypeManager); + return m_pPrintFontManager.get(); + } + + // Mostly useful for remote protocol backends + virtual void ErrorTrapPush() = 0; + virtual bool ErrorTrapPop(bool bIgnoreError = true) = 0; // true on error +}; + +inline GenericUnixSalData* GetGenericUnixSalData() +{ + return static_cast<GenericUnixSalData*>(ImplGetSVData()->mpSalData); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gendisp.hxx b/vcl/inc/unx/gendisp.hxx new file mode 100644 index 000000000..a6188e27a --- /dev/null +++ b/vcl/inc/unx/gendisp.hxx @@ -0,0 +1,55 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_GENERIC_GENDISP_HXX +#define INCLUDED_VCL_INC_GENERIC_GENDISP_HXX + +#include <salwtype.hxx> +#include <vcl/dllapi.h> +#include <salusereventlist.hxx> + +class SalFrame; +class VCL_DLLPUBLIC SalGenericDisplay : public SalUserEventList +{ +protected: + SalFrame* m_pCapture; + + virtual void ProcessEvent( SalUserEvent aEvent ) override; + +public: + SalGenericDisplay(); + virtual ~SalGenericDisplay() override; + + void registerFrame( SalFrame* pFrame ); + virtual void deregisterFrame( SalFrame* pFrame ); + void emitDisplayChanged(); + + void SendInternalEvent( SalFrame* pFrame, void* pData, SalEvent nEvent = SalEvent::UserEvent ); + void CancelInternalEvent( SalFrame* pFrame, void* pData, SalEvent nEvent ); + bool DispatchInternalEvent( bool bHandleAllCurrentEvent = false ); + + bool MouseCaptured( const SalFrame *pFrameData ) const + { return m_pCapture == pFrameData; } + SalFrame* GetCaptureFrame() const + { return m_pCapture; } +}; + +#endif // INCLUDED_VCL_INC_GENERIC_GENDISP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/geninst.h b/vcl/inc/unx/geninst.h new file mode 100644 index 000000000..dcd8bdd6f --- /dev/null +++ b/vcl/inc/unx/geninst.h @@ -0,0 +1,84 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_GENERIC_GENINST_H +#define INCLUDED_VCL_INC_GENERIC_GENINST_H + +#include <memory> +#include <comphelper/solarmutex.hxx> +#include <salinst.hxx> +#include <saldatabasic.hxx> +#include <unx/genprn.h> + +class VCL_DLLPUBLIC SalYieldMutex : public comphelper::SolarMutex +{ +public: + SalYieldMutex(); + virtual ~SalYieldMutex() override; +}; + +/* + * Abstract generic class to build vclplugin's instance classes from + */ +class GenPspGraphics; +class PhysicalFontCollection; +class VCL_DLLPUBLIC SalGenericInstance : public SalInstance +{ +protected: + bool mbPrinterInit; + +public: + SalGenericInstance( std::unique_ptr<comphelper::SolarMutex> pMutex ) + : SalInstance(std::move(pMutex)), mbPrinterInit(false) {} + virtual ~SalGenericInstance() override; + + // Printing + virtual SalInfoPrinter* CreateInfoPrinter ( SalPrinterQueueInfo* pQueueInfo, + ImplJobSetup* pSetupData ) override; + virtual void DestroyInfoPrinter ( SalInfoPrinter* pPrinter ) override; + virtual std::unique_ptr<SalPrinter> CreatePrinter ( SalInfoPrinter* pInfoPrinter ) override; + virtual void GetPrinterQueueInfo ( ImplPrnQueueList* pList ) override; + virtual void GetPrinterQueueState ( SalPrinterQueueInfo* pInfo ) override; + virtual OUString GetDefaultPrinter() override; + virtual void PostPrintersChanged() = 0; + virtual void updatePrinterUpdate() override; + virtual void jobStartedPrinterUpdate() override; + virtual void jobEndedPrinterUpdate() override; + bool isPrinterInit() const { return mbPrinterInit; } + virtual std::unique_ptr<GenPspGraphics> CreatePrintGraphics() = 0; + + virtual OUString getOSVersion() override; + + // prolly belongs somewhere else ... just a font help + static void RegisterFontSubstitutors( PhysicalFontCollection* pFontCollection ); + +protected: + static void configurePspInfoPrinter( PspSalInfoPrinter* pInfoPrinter, + SalPrinterQueueInfo const * pQueueInfo, + ImplJobSetup* pSetupData ); +}; + +inline SalGenericInstance *GetGenericInstance() +{ + return static_cast<SalGenericInstance *>(GetSalData()->m_pInstance); +} + +#endif // INCLUDED_VCL_INC_GENERIC_GENINST_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/genprn.h b/vcl/inc/unx/genprn.h new file mode 100644 index 000000000..14917cf72 --- /dev/null +++ b/vcl/inc/unx/genprn.h @@ -0,0 +1,94 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_GENERIC_GENPRN_H +#define INCLUDED_VCL_INC_GENERIC_GENPRN_H + +#include <jobdata.hxx> +#include <unx/printergfx.hxx> +#include <unx/printerjob.hxx> +#include <salprn.hxx> + +class GenPspGraphics; +class VCL_DLLPUBLIC PspSalInfoPrinter : public SalInfoPrinter +{ +public: + std::unique_ptr<GenPspGraphics> m_pGraphics; + psp::JobData m_aJobData; + psp::PrinterGfx m_aPrinterGfx; + + PspSalInfoPrinter(); + virtual ~PspSalInfoPrinter() override; + + // override all pure virtual methods + virtual SalGraphics* AcquireGraphics() override; + virtual void ReleaseGraphics( SalGraphics* pGraphics ) override; + virtual bool Setup( weld::Window* pFrame, ImplJobSetup* pSetupData ) override; + virtual bool SetPrinterData( ImplJobSetup* pSetupData ) override; + virtual bool SetData( JobSetFlags nFlags, ImplJobSetup* pSetupData ) override; + virtual void GetPageInfo( const ImplJobSetup* pSetupData, + long& rOutWidth, long& rOutHeight, + Point& rPageOffset, + Size& rPaperSize ) override; + virtual sal_uInt32 GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) override; + virtual sal_uInt16 GetPaperBinCount( const ImplJobSetup* pSetupData ) override; + virtual OUString GetPaperBinName( const ImplJobSetup* pSetupData, sal_uInt16 nPaperBin ) override; + virtual void InitPaperFormats( const ImplJobSetup* pSetupData ) override; + virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ) override; +}; + +class VCL_DLLPUBLIC PspSalPrinter : public SalPrinter +{ +public: + OUString m_aFileName; + OUString m_aTmpFile; + SalInfoPrinter* m_pInfoPrinter; + std::unique_ptr<GenPspGraphics> m_xGraphics; + psp::PrinterJob m_aPrintJob; + psp::JobData m_aJobData; + psp::PrinterGfx m_aPrinterGfx; + sal_uInt32 m_nCopies; + bool m_bCollate; + bool m_bPdf; + bool m_bIsPDFWriterJob; + + PspSalPrinter( SalInfoPrinter *pPrinter ); + virtual ~PspSalPrinter() override; + + // override all pure virtual methods + virtual bool StartJob( const OUString* pFileName, + const OUString& rJobName, + const OUString& rAppName, + sal_uInt32 nCopies, + bool bCollate, + bool bDirect, + ImplJobSetup* pSetupData ) override; + virtual bool StartJob( const OUString*, + const OUString&, + const OUString&, + ImplJobSetup*, + vcl::PrinterController& i_rController ) override; + virtual bool EndJob() override; + virtual SalGraphics* StartPage( ImplJobSetup* pSetupData, bool bNewJobData ) override; + virtual void EndPage() override; +}; + +#endif // INCLUDED_VCL_INC_GENERIC_GENPRN_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/genpspgraphics.h b/vcl/inc/unx/genpspgraphics.h new file mode 100644 index 000000000..b696618c7 --- /dev/null +++ b/vcl/inc/unx/genpspgraphics.h @@ -0,0 +1,213 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_GENERIC_GENPSPGRAPHICS_H +#define INCLUDED_VCL_INC_GENERIC_GENPSPGRAPHICS_H + +#include <vcl/vclenum.hxx> +#include <config_cairo_canvas.h> + +#include <unx/fontmanager.hxx> +#include <salgdi.hxx> +#include <sallayout.hxx> + +class PhysicalFontFace; +class PhysicalFontCollection; + +namespace psp { struct JobData; class PrinterGfx; } + +class FreetypeFontInstance; +class FontAttributes; +class SalInfoPrinter; +class ImplFontMetricData; + +class VCL_DLLPUBLIC GenPspGraphics final : public SalGraphics +{ + psp::JobData* m_pJobData; + psp::PrinterGfx* m_pPrinterGfx; + + rtl::Reference<FreetypeFontInstance> + m_pFreetypeFont[ MAX_FALLBACK ]; +public: + GenPspGraphics(); + virtual ~GenPspGraphics() override; + + void Init( psp::JobData* pJob, psp::PrinterGfx* pGfx ); + + // helper methods + static const void * DoGetEmbedFontData(psp::fontID aFont, long* pDataLen); + static void DoFreeEmbedFontData( const void* pData, long nLen ); + + // helper methods for sharing with X11SalGraphics + static void DoGetGlyphWidths( psp::fontID aFont, + bool bVertical, + std::vector< sal_Int32 >& rWidths, + Ucs2UIntMap& rUnicodeEnc ); + + static FontAttributes Info2FontAttributes( const psp::FastPrintFontInfo& ); + static void AnnounceFonts( PhysicalFontCollection*, + const psp::FastPrintFontInfo& ); + + // override all pure virtual methods + virtual SalGraphicsImpl*GetImpl() const override { return nullptr; }; + virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) override; + virtual sal_uInt16 GetBitCount() const override; + virtual long GetGraphicsWidth() const override; + + virtual void ResetClipRegion() override; + virtual bool setClipRegion( const vcl::Region& ) override; + + virtual void SetLineColor() override; + virtual void SetLineColor( Color nColor ) override; + virtual void SetFillColor() override; + virtual void SetFillColor( Color nColor ) override; + virtual void SetXORMode( bool bSet, bool ) override; + virtual void SetROPLineColor( SalROPColor nROPColor ) override; + virtual void SetROPFillColor( SalROPColor nROPColor ) override; + + virtual void SetTextColor( Color nColor ) override; + virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) override; + virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override; + virtual FontCharMapRef GetFontCharMap() const override; + virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override; + virtual void GetDevFontList( PhysicalFontCollection* ) override; + // graphics must drop any cached font info + virtual void ClearDevFontCache() override; + virtual bool AddTempDevFont( PhysicalFontCollection*, + const OUString& rFileURL, + const OUString& rFontName ) override; + static bool AddTempDevFontHelper( PhysicalFontCollection* pFontCollection, + const OUString& rFileURL, + const OUString& rFontName); + + virtual bool CreateFontSubset( const OUString& rToFile, + const PhysicalFontFace*, + const sal_GlyphId* pGlyphIDs, + const sal_uInt8* pEncoding, + sal_Int32* pWidths, + int nGlyphs, + FontSubsetInfo& rInfo ) 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 std::unique_ptr<GenericSalLayout> + GetTextLayout(int nFallbackLevel) override; + virtual void DrawTextLayout( const GenericSalLayout& ) override; + virtual bool supportsOperation( OutDevSupportType ) const override; + virtual void drawPixel( long nX, long nY ) override; + virtual void drawPixel( long nX, long nY, Color nColor ) 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::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolyPolygon&, + double fTransparency) override; + + virtual bool drawPolyLine( + const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolygon&, + double fTransparency, + double fLineWidth, + const std::vector< double >* pStroke, // MM01 + basegfx::B2DLineJoin, + css::drawing::LineCap, + double fMiterMinimumAngle, + bool bPixelSnapHairline) 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 drawGradient( const tools::PolyPolygon&, const Gradient& ) override { return false; }; + + 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, + Color nMaskColor ) override; + virtual std::shared_ptr<SalBitmap> getBitmap( long nX, long nY, long nWidth, long nHeight ) override; + virtual Color 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_uInt32 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; + virtual 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 SystemGraphicsData GetGraphicsData() const override; + + virtual OUString getRenderBackendName() const override { return "genpsp"; } + +#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 +}; + +#endif // INCLUDED_VCL_INC_GENERIC_GENPSPGRAPHICS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gensys.h b/vcl/inc/unx/gensys.h new file mode 100644 index 000000000..6da0b17b8 --- /dev/null +++ b/vcl/inc/unx/gensys.h @@ -0,0 +1,50 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_GENERIC_GENSYS_H +#define INCLUDED_VCL_INC_GENERIC_GENSYS_H + +#include <salsys.hxx> +#include <vector> + +/* + * Helps de-tangle the rather horrible ShowNativeMessageBox API + */ +class VCL_DLLPUBLIC SalGenericSystem : public SalSystem +{ + public: + SalGenericSystem(); + virtual ~SalGenericSystem() override; + virtual int ShowNativeDialog( const OUString& rTitle, + const OUString& rMessage, + const std::vector< OUString >& rButtons ) = 0; + + virtual int ShowNativeMessageBox( const OUString& rTitle, + const OUString& rMessage) override; + +#if !defined(ANDROID) && !defined(IOS) + // Simple helpers for X11 WM_CLASS hints + static const char *getFrameResName(); + static const char *getFrameClassName(); +#endif +}; + +#endif // INCLUDED_VCL_INC_GENERIC_GENSYS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx new file mode 100644 index 000000000..983a6ec03 --- /dev/null +++ b/vcl/inc/unx/glyphcache.hxx @@ -0,0 +1,174 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_GENERIC_GLYPHCACHE_HXX +#define INCLUDED_VCL_INC_GENERIC_GLYPHCACHE_HXX + +#include <memory> +#include <freetype/config/ftheader.h> +#include FT_FREETYPE_H +#include FT_GLYPH_H + +#include <tools/gen.hxx> +#include <tools/solar.h> +#include <unx/gendata.hxx> +#include <vcl/dllapi.h> +#include <vcl/outdev.hxx> + +#include <fontattributes.hxx> +#include <fontinstance.hxx> +#include <impfontmetricdata.hxx> + +#include <unordered_map> + +class FreetypeFont; +class FreetypeFontFile; +class FreetypeFontInstance; +class FreetypeFontInfo; +class FontConfigFontOptions; +class PhysicalFontCollection; +class FreetypeFont; +class SvpGcpHelper; + +namespace basegfx { class B2DPolyPolygon; } +namespace vcl { struct FontCapabilities; } + + /** + * The FreetypeManager caches various aspects of Freetype fonts + * + * It mainly consists of two std::unordered_map lists, which hold the items of the cache. + * + * They form kind of a tree, with FreetypeFontFile as the roots, referenced by multiple FreetypeFontInfo + * entries, which are referenced by the FreetypeFont items. + * + * All of these items have reference counters, but these don't control the items life-cycle, but that of + * the managed resources. + * + * The respective resources are: + * FreetypeFontFile = holds the mmapped font file, as long as it's used by any FreetypeFontInfo. + * FreetypeFontInfo = holds the FT_FaceRec_ object, as long as it's used by any FreetypeFont. + * FreetypeFont = holds the FT_SizeRec_ and is owned by a FreetypeFontInstance + * + * FreetypeFontInfo therefore is embedded in the Freetype subclass of PhysicalFontFace. + * FreetypeFont is owned by FreetypeFontInstance, the Freetype subclass of LogicalFontInstance. + * + * Nowadays there is not really a reason to have separate files for the classes, as the FreetypeManager + * is just about handling of Freetype based fonts, not some abstract glyphs. + **/ +class VCL_DLLPUBLIC FreetypeManager final +{ +public: + ~FreetypeManager(); + + static FreetypeManager& get(); + + void AddFontFile(const OString& rNormalizedName, + int nFaceNum, int nVariantNum, + sal_IntPtr nFontId, + const FontAttributes&); + + void AnnounceFonts( PhysicalFontCollection* ) const; + + void ClearFontCache(); + + FreetypeFont* CreateFont(FreetypeFontInstance* pLogicalFont); + +private: + // to access the constructor (can't use InitFreetypeManager function, because it's private?!) + friend class GenericUnixSalData; + explicit FreetypeManager(); + + static void InitFreetype(); + FreetypeFontFile* FindFontFile(const OString& rNativeFileName); + + typedef std::unordered_map<sal_IntPtr, std::shared_ptr<FreetypeFontInfo>> FontInfoList; + typedef std::unordered_map<const char*, std::unique_ptr<FreetypeFontFile>, rtl::CStringHash, rtl::CStringEqual> FontFileList; + + FontInfoList m_aFontInfoList; + sal_IntPtr m_nMaxFontId; + + FontFileList m_aFontFileList; +}; + +class VCL_DLLPUBLIC FreetypeFont final +{ +public: + ~FreetypeFont(); + + const OString& GetFontFileName() const; + int GetFontFaceIndex() const; + int GetFontFaceVariation() const; + bool TestFont() const { return mbFaceOk;} + FT_Face GetFtFace() const; + int GetLoadFlags() const { return (mnLoadFlags & ~FT_LOAD_IGNORE_TRANSFORM); } + const FontConfigFontOptions* GetFontOptions() const; + bool NeedsArtificialBold() const { return mbArtBold; } + bool NeedsArtificialItalic() const { return mbArtItalic; } + + void GetFontMetric(ImplFontMetricDataRef const &) const; + const unsigned char* GetTable( const char* pName, sal_uLong* pLength ) const; + FontCharMapRef GetFontCharMap() const; + bool GetFontCapabilities(vcl::FontCapabilities &) const; + + bool GetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const; + bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const; + bool GetAntialiasAdvice() const; + + FreetypeFontInstance& GetFontInstance() const { return mrFontInstance; } + + void SetFontVariationsOnHBFont(hb_font_t* pHbFace) const; + + // tdf#127189 FreeType <= 2.8 will fail to render stretched horizontal brace glyphs + // in starmath at a fairly low stretch ratio. This appears fixed in 2.9 with + // https://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=91015cb41d8f56777f93394f5a60914bc0c0f330 + // "Improve complex rendering at high ppem" + static bool AlmostHorizontalDrainsRenderingPool(int nRatio, const FontSelectPattern& rFSD); + +private: + friend class FreetypeFontInstance; + friend class FreetypeManager; + + explicit FreetypeFont(FreetypeFontInstance&, std::shared_ptr<FreetypeFontInfo>& rFontInfo); + + void ApplyGlyphTransform(bool bVertical, FT_Glyph) const; + + FreetypeFontInstance& mrFontInstance; + + // 16.16 fixed point values used for a rotated font + long mnCos; + long mnSin; + + int mnWidth; + int mnPrioAntiAlias; + std::shared_ptr<FreetypeFontInfo> mxFontInfo; + FT_Int mnLoadFlags; + double mfStretch; + FT_FaceRec_* maFaceFT; + FT_SizeRec_* maSizeFT; + + mutable std::unique_ptr<FontConfigFontOptions> mxFontOptions; + + bool mbFaceOk; + bool mbArtItalic; + bool mbArtBold; +}; + +#endif // INCLUDED_VCL_INC_GENERIC_GLYPHCACHE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gstsink.hxx b/vcl/inc/unx/gstsink.hxx new file mode 100644 index 000000000..2dff94b02 --- /dev/null +++ b/vcl/inc/unx/gstsink.hxx @@ -0,0 +1,27 @@ +/* -*- 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/. + * + */ + +#pragma once + +#include <config_vclplug.h> + +#if ENABLE_GSTREAMER_1_0 +#include <gst/gst.h> +#include <dlfcn.h> + +typedef GstElement* (*GstElementFactoryName)(const gchar*, const gchar*); + +static GstElementFactoryName gstElementFactoryNameSymbol() +{ + return reinterpret_cast<GstElementFactoryName>(dlsym(nullptr, "gst_element_factory_make")); +} +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/atkbridge.hxx b/vcl/inc/unx/gtk/atkbridge.hxx new file mode 100644 index 000000000..49c422dac --- /dev/null +++ b/vcl/inc/unx/gtk/atkbridge.hxx @@ -0,0 +1,30 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_GTK_ATKBRIDGE_HXX +#define INCLUDED_VCL_INC_UNX_GTK_ATKBRIDGE_HXX + +#include <vclpluginapi.h> + +bool InitAtkBridge(); +void DeInitAtkBridge(); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/gloactiongroup.h b/vcl/inc/unx/gtk/gloactiongroup.h new file mode 100644 index 000000000..4028f76dc --- /dev/null +++ b/vcl/inc/unx/gtk/gloactiongroup.h @@ -0,0 +1,78 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_UNX_GTK_GLOACTIONGROUP_H +#define INCLUDED_VCL_INC_UNX_GTK_GLOACTIONGROUP_H + +#include <glib-object.h> +#include <glib.h> + +G_BEGIN_DECLS + +#define G_TYPE_LO_ACTION_GROUP (g_lo_action_group_get_type ()) +#define G_LO_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_LO_ACTION_GROUP, GLOActionGroup)) +#define G_IS_LO_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_LO_ACTION_GROUP)) + +struct GLOActionGroupPrivate; + +struct GLOActionGroup +{ + /*< private >*/ + GObject parent_instance; + + GLOActionGroupPrivate *priv; +}; + +struct GLOActionGroupClass +{ + /*< private >*/ + GObjectClass parent_class; + + /*< private >*/ + gpointer padding[12]; +}; + +GType g_lo_action_group_get_type (void) G_GNUC_CONST; + +GLOActionGroup * g_lo_action_group_new (void); + +void g_lo_action_group_set_top_menu (GLOActionGroup *group, + gpointer top_menu); + +void g_lo_action_group_insert (GLOActionGroup *group, + const gchar *action_name, + gint item_id, + gboolean submenu); + +void g_lo_action_group_insert_stateful (GLOActionGroup *group, + const gchar *action_name, + gint item_id, + gboolean submenu, + const GVariantType *parameter_type, + const GVariantType *state_type, + GVariant *state_hint, + GVariant *state); + +void g_lo_action_group_set_action_enabled (GLOActionGroup *group, + const gchar *action_name, + gboolean enabled); + +void g_lo_action_group_remove (GLOActionGroup *group, + const gchar *action_name); + +void g_lo_action_group_clear (GLOActionGroup *group); + +G_END_DECLS + +#endif // INCLUDED_VCL_INC_UNX_GTK_GLOACTIONGROUP_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/glomenu.h b/vcl/inc/unx/gtk/glomenu.h new file mode 100644 index 000000000..a0150a845 --- /dev/null +++ b/vcl/inc/unx/gtk/glomenu.h @@ -0,0 +1,137 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_UNX_GTK_GLOMENU_H +#define INCLUDED_VCL_INC_UNX_GTK_GLOMENU_H + +#include <gio/gio.h> + +#define G_LO_MENU_ATTRIBUTE_ACCELERATOR "accel" +#define G_LO_MENU_ATTRIBUTE_COMMAND "command" +#define G_LO_MENU_ATTRIBUTE_SUBMENU_ACTION "submenu-action" + +G_BEGIN_DECLS + +#define G_TYPE_LO_MENU (g_lo_menu_get_type ()) +#define G_LO_MENU(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_LO_MENU, GLOMenu)) +#define G_IS_LO_MENU(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_LO_MENU)) + +struct GLOMenu; + +class GtkSalMenuItem; + +GLIB_AVAILABLE_IN_2_32 +GType g_lo_menu_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_2_32 +GLOMenu * g_lo_menu_new (void); + +gint g_lo_menu_get_n_items_from_section (GLOMenu *menu, + gint section); + +void g_lo_menu_insert (GLOMenu *menu, + gint position, + const gchar *label); + +void g_lo_menu_insert_in_section (GLOMenu *menu, + gint section, + gint position, + const gchar *label); + +void g_lo_menu_new_section (GLOMenu *menu, + gint position, + const gchar *label); + +void g_lo_menu_insert_section (GLOMenu *menu, + gint position, + const gchar *label, + GMenuModel *section); + +GLOMenu * g_lo_menu_get_section (GLOMenu *menu, + gint section); + +void g_lo_menu_remove (GLOMenu *menu, + gint position); + +void g_lo_menu_remove_from_section (GLOMenu *menu, + gint section, + gint position); + +void g_lo_menu_set_label (GLOMenu *menu, + gint position, + const gchar *label); + +void g_lo_menu_set_icon (GLOMenu *menu, + gint position, + const GIcon *icon); + + +void g_lo_menu_set_label_to_item_in_section (GLOMenu *menu, + gint section, + gint position, + const gchar *label); + +void g_lo_menu_set_icon_to_item_in_section (GLOMenu *menu, + gint section, + gint position, + const GIcon *icon); + +gchar * g_lo_menu_get_label_from_item_in_section (GLOMenu *menu, + gint section, + gint position); + +void g_lo_menu_set_action_and_target_value (GLOMenu *menu, + gint position, + const gchar *command, + GVariant *target_value); + +void g_lo_menu_set_action_and_target_value_to_item_in_section (GLOMenu *menu, + gint section, + gint position, + const gchar *command, + GVariant *target_value); + +void g_lo_menu_set_command_to_item_in_section (GLOMenu *menu, + gint section, + gint position, + const gchar *command); + +gchar * g_lo_menu_get_command_from_item_in_section (GLOMenu *menu, + gint section, + gint position); + +void g_lo_menu_set_accelerator_to_item_in_section (GLOMenu *menu, + gint section, + gint position, + const gchar *accelerator); + +gchar * g_lo_menu_get_accelerator_from_item_in_section (GLOMenu *menu, + gint section, + gint position); + +void g_lo_menu_new_submenu_in_item_in_section (GLOMenu *menu, + gint section, + gint position); + +GLOMenu * g_lo_menu_get_submenu_from_item_in_section (GLOMenu *menu, + gint section, + gint position); + +void g_lo_menu_set_submenu_action_to_item_in_section (GLOMenu *menu, + gint section, + gint position, + const gchar *action); + +G_END_DECLS + +#endif // INCLUDED_VCL_INC_UNX_GTK_GLOMENU_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/gtkbackend.hxx b/vcl/inc/unx/gtk/gtkbackend.hxx new file mode 100644 index 000000000..288311b41 --- /dev/null +++ b/vcl/inc/unx/gtk/gtkbackend.hxx @@ -0,0 +1,25 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_UNX_GTK_GTKBACKEND_HXX +#define INCLUDED_VCL_INC_UNX_GTK_GTKBACKEND_HXX + +#include <gtk/gtk.h> +#if defined(GDK_WINDOWING_X11) +#include <gdk/gdkx.h> +bool DLSYM_GDK_IS_X11_DISPLAY(GdkDisplay* pDisplay); +#endif +#if defined(GDK_WINDOWING_WAYLAND) +#include <gdk/gdkwayland.h> +bool DLSYM_GDK_IS_WAYLAND_DISPLAY(GdkDisplay* pDisplay); +#endif + +#endif // INCLUDED_VCL_INC_UNX_GTK_GTKBACKEND_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx new file mode 100644 index 000000000..2f88ffe8b --- /dev/null +++ b/vcl/inc/unx/gtk/gtkdata.hxx @@ -0,0 +1,152 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_GTK_GTKDATA_HXX +#define INCLUDED_VCL_INC_UNX_GTK_GTKDATA_HXX + +#define GLIB_DISABLE_DEPRECATION_WARNINGS +#include <gdk/gdk.h> +#include <gdk/gdkx.h> +#include <gtk/gtk.h> + +#include <unx/gendata.hxx> +#include <unx/saldisp.hxx> +#include <unx/gtk/gtksys.hxx> +#include <vcl/ptrstyle.hxx> +#include <osl/conditn.hxx> +#include <saltimer.hxx> +#include <o3tl/enumarray.hxx> + +#include <vector> + +namespace com::sun::star::accessibility { class XAccessibleEventListener; } + +class GtkSalDisplay; +class DocumentFocusListener; + +inline ::Window widget_get_xid(GtkWidget *widget) +{ + return GDK_WINDOW_XID(gtk_widget_get_window(widget)); +} + +class GtkSalTimer final : public SalTimer +{ + struct SalGtkTimeoutSource *m_pTimeout; +public: + GtkSalTimer(); + virtual ~GtkSalTimer() override; + virtual void Start( sal_uInt64 nMS ) override; + virtual void Stop() override; + bool Expired(); + + sal_uLong m_nTimeoutMS; +}; + +class GtkSalData final : public GenericUnixSalData +{ + GSource* m_pUserEvent; + osl::Mutex m_aDispatchMutex; + osl::Condition m_aDispatchCondition; + std::exception_ptr m_aException; + + css::uno::Reference<css::accessibility::XAccessibleEventListener> m_xDocumentFocusListener; + DocumentFocusListener * m_pDocumentFocusListener; + +public: + GtkSalData( SalInstance *pInstance ); + virtual ~GtkSalData() override; + + DocumentFocusListener & GetDocumentFocusListener(); + + void Init(); + virtual void Dispose() override; + + static void initNWF(); + static void deInitNWF(); + + void TriggerUserEventProcessing(); + void TriggerAllUserEventsProcessed(); + + bool Yield( bool bWait, bool bHandleAllCurrentEvents ); + inline GdkDisplay *GetGdkDisplay(); + + virtual void ErrorTrapPush() override; + virtual bool ErrorTrapPop( bool bIgnoreError = true ) override; + + inline GtkSalDisplay *GetGtkDisplay() const; + void setException(const std::exception_ptr& exception) { m_aException = exception; } +}; + +class GtkSalFrame; + +class GtkSalDisplay : public SalGenericDisplay +{ + GtkSalSystem* m_pSys; + GdkDisplay* m_pGdkDisplay; + o3tl::enumarray<PointerStyle, GdkCursor*> m_aCursors; + bool m_bStartupCompleted; + bool m_bX11Display; + + GdkCursor* getFromSvg( OUString const & name, int nXHot, int nYHot ); + +public: + GtkSalDisplay( GdkDisplay* pDisplay ); + virtual ~GtkSalDisplay() override; + + GdkDisplay* GetGdkDisplay() const { return m_pGdkDisplay; } + bool IsX11Display() const { return m_bX11Display; } + + GtkSalSystem* getSystem() const { return m_pSys; } + + GtkWidget* findGtkWidgetForNativeHandle(sal_uIntPtr hWindow) const; + + virtual void deregisterFrame( SalFrame* pFrame ) override; + GdkCursor *getCursor( PointerStyle ePointerStyle ); + virtual int CaptureMouse( SalFrame* pFrame ); + + SalX11Screen GetDefaultXScreen() { return m_pSys->GetDisplayDefaultXScreen(); } + Size GetScreenSize( int nDisplayScreen ); + + GdkFilterReturn filterGdkEvent( GdkXEvent* sys_event ); + void startupNotificationCompleted() { m_bStartupCompleted = true; } + + void screenSizeChanged( GdkScreen const * ); + void monitorsChanged( GdkScreen const * ); + + virtual void TriggerUserEventProcessing() override; + virtual void TriggerAllUserEventsProcessed() override; +}; + +inline GtkSalData* GetGtkSalData() +{ + return static_cast<GtkSalData*>(ImplGetSVData()->mpSalData); +} +inline GdkDisplay *GtkSalData::GetGdkDisplay() +{ + return GetGtkDisplay()->GetGdkDisplay(); +} + +GtkSalDisplay *GtkSalData::GetGtkDisplay() const +{ + return static_cast<GtkSalDisplay *>(GetDisplay()); +} + +#endif // INCLUDED_VCL_INC_UNX_GTK_GTKDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx new file mode 100644 index 000000000..e42e1649a --- /dev/null +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -0,0 +1,567 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_GTK_GTKFRAME_HXX +#define INCLUDED_VCL_INC_UNX_GTK_GTKFRAME_HXX + +#include <cairo.h> +#include <gdk/gdk.h> +#include <gdk/gdkx.h> +#include <gtk/gtk.h> +#include <gtk/gtkx.h> +#include <gdk/gdkkeysyms.h> + +#include <salframe.hxx> +#include <vcl/idle.hxx> +#include <vcl/sysdata.hxx> +#include <unx/nativewindowhandleprovider.hxx> +#include <unx/saltype.h> +#include <unx/screensaverinhibitor.hxx> + +#include <tools/link.hxx> + +#include <com/sun/star/awt/XTopWindow.hpp> +#include <com/sun/star/datatransfer/DataFlavor.hpp> +#include <com/sun/star/datatransfer/dnd/XDragSource.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp> + +#include <list> +#include <vector> + +#include <config_dbus.h> +#include <config_gio.h> + +#include <headless/svpgdi.hxx> + +class GtkSalGraphics; +class GtkSalDisplay; + +typedef sal_uIntPtr GdkNativeWindow; +#define GDK_WINDOW_XWINDOW(o) GDK_WINDOW_XID(o) +#define gdk_set_sm_client_id(i) gdk_x11_set_sm_client_id(i) +#define gdk_window_foreign_new_for_display(a,b) gdk_x11_window_foreign_new_for_display(a,b) +class GtkDropTarget; +class GtkDragSource; +class GtkDnDTransferable; + +class GtkSalMenu; + +class GtkSalFrame final : public SalFrame + , public NativeWindowHandleProvider +{ + struct IMHandler + { + + // Not all GTK Input Methods swallow key release + // events. Since they swallow the key press events and we + // are left with the key release events, we need to + // manually swallow those. To do this, we keep a list of + // the previous 10 key press events in each GtkSalFrame + // and when we get a key release that matches one of the + // key press events in our list, we swallow it. + struct PreviousKeyPress + { + GdkWindow *window; + gint8 send_event; + guint32 time; + guint state; + guint keyval; + guint16 hardware_keycode; + guint8 group; + + PreviousKeyPress (GdkEventKey *event) + : window (nullptr), + send_event (0), + time (0), + state (0), + keyval (0), + hardware_keycode (0), + group (0) + { + if (event) + { + window = event->window; + send_event = event->send_event; + time = event->time; + state = event->state; + keyval = event->keyval; + hardware_keycode = event->hardware_keycode; + group = event->group; + } + } + + PreviousKeyPress( const PreviousKeyPress& rPrev ) + : window( rPrev.window ), + send_event( rPrev.send_event ), + time( rPrev.time ), + state( rPrev.state ), + keyval( rPrev.keyval ), + hardware_keycode( rPrev.hardware_keycode ), + group( rPrev.group ) + {} + + bool operator== (GdkEventKey const *event) const + { + return (event != nullptr) + && (event->window == window) + && (event->send_event == send_event) + // ignore non-Gdk state bits, e.g., these used by IBus + && ((event->state & GDK_MODIFIER_MASK) == (state & GDK_MODIFIER_MASK)) + && (event->keyval == keyval) + && (event->hardware_keycode == hardware_keycode) + && (event->group == group) + && (event->time - time < 300) + ; + } + }; + + GtkSalFrame* m_pFrame; + std::list< PreviousKeyPress > m_aPrevKeyPresses; + int m_nPrevKeyPresses; // avoid using size() + GtkIMContext* m_pIMContext; + bool m_bFocused; + bool m_bPreeditJustChanged; + SalExtTextInputEvent m_aInputEvent; + std::vector< ExtTextInputAttr > m_aInputFlags; + + IMHandler( GtkSalFrame* ); + ~IMHandler(); + + void createIMContext(); + void deleteIMContext(); + void updateIMSpotLocation(); + void endExtTextInput( EndExtTextInputFlags nFlags ); + bool handleKeyEvent( GdkEventKey* pEvent ); + void focusChanged( bool bFocusIn ); + + void doCallEndExtTextInput(); + void sendEmptyCommit(); + + static void signalIMCommit( GtkIMContext*, gchar*, gpointer ); + static gboolean signalIMDeleteSurrounding( GtkIMContext*, gint, gint, gpointer ); + static void signalIMPreeditChanged( GtkIMContext*, gpointer ); + static void signalIMPreeditEnd( GtkIMContext*, gpointer ); + static void signalIMPreeditStart( GtkIMContext*, gpointer ); + static gboolean signalIMRetrieveSurrounding( GtkIMContext*, gpointer ); + }; + friend struct IMHandler; + + friend class GtkSalObjectWidgetClip; + + SalX11Screen m_nXScreen; + GtkWidget* m_pWindow; + GtkHeaderBar* m_pHeaderBar; + GtkGrid* m_pTopLevelGrid; + GtkEventBox* m_pEventBox; + GtkFixed* m_pFixedContainer; + GdkWindow* m_pForeignParent; + GdkNativeWindow m_aForeignParentWindow; + GdkWindow* m_pForeignTopLevel; + GdkNativeWindow m_aForeignTopLevelWindow; + SalFrameStyleFlags m_nStyle; + GtkSalFrame* m_pParent; + std::list< GtkSalFrame* > m_aChildren; + GdkWindowState m_nState; + SystemEnvData m_aSystemData; + std::unique_ptr<GtkSalGraphics> m_pGraphics; + bool m_bGraphics; + ModKeyFlags m_nKeyModifiers; + GdkCursor *m_pCurrentCursor; + PointerStyle m_ePointerStyle; + ScreenSaverInhibitor m_ScreenSaverInhibitor; + bool m_bFullscreen; + bool m_bSpanMonitorsWhenFullscreen; + bool m_bDefaultPos; + bool m_bDefaultSize; + bool m_bTooltipBlocked; + OUString m_sWMClass; + + std::unique_ptr<IMHandler> m_pIMHandler; + + Size m_aMaxSize; + Size m_aMinSize; + tools::Rectangle m_aRestorePosSize; + + OUString m_aTooltip; + tools::Rectangle m_aHelpArea; + tools::Rectangle m_aFloatRect; + FloatWinPopupFlags m_nFloatFlags; + bool m_bFloatPositioned; + long m_nWidthRequest; + long m_nHeightRequest; + cairo_region_t* m_pRegion; + GtkDropTarget* m_pDropTarget; + GtkDragSource* m_pDragSource; + bool m_bGeometryIsProvisional; + bool m_bIconSetWhileUnmapped; + + GtkSalMenu* m_pSalMenu; + +#if ENABLE_DBUS && ENABLE_GIO + private: + friend void ensure_dbus_setup(GdkWindow* gdkWindow, GtkSalFrame* pSalFrame); + friend void on_registrar_available (GDBusConnection*, const gchar*, const gchar*, gpointer); + friend void on_registrar_unavailable (GDBusConnection*, const gchar*, gpointer); +#endif + guint m_nWatcherId; + + void Init( SalFrame* pParent, SalFrameStyleFlags nStyle ); + void Init( SystemParentData* pSysData ); + void InitCommon(); + void InvalidateGraphics(); + + // signals + static gboolean signalButton( GtkWidget*, GdkEventButton*, gpointer ); + static void signalStyleUpdated(GtkWidget*, gpointer); + static gboolean signalDraw( GtkWidget*, cairo_t *cr, gpointer ); + static void signalRealize(GtkWidget*, gpointer frame); + static void sizeAllocated(GtkWidget*, GdkRectangle *pAllocation, gpointer frame); + static gboolean signalTooltipQuery(GtkWidget*, gint x, gint y, + gboolean keyboard_mode, GtkTooltip *tooltip, + gpointer frame); + static gboolean signalDragMotion(GtkWidget *widget, GdkDragContext *context, gint x, gint y, + guint time, gpointer frame); + static gboolean signalDragDrop(GtkWidget* widget, GdkDragContext *context, gint x, gint y, + guint time, gpointer frame); + static void signalDragDropReceived(GtkWidget *widget, GdkDragContext *context, gint x, gint y, + GtkSelectionData *data, guint ttype, guint time, gpointer frame); + static void signalDragLeave(GtkWidget *widget, GdkDragContext *context, guint time, gpointer frame); + + static gboolean signalDragFailed(GtkWidget *widget, GdkDragContext *context, GtkDragResult result, gpointer frame); + static void signalDragDelete(GtkWidget *widget, GdkDragContext *context, gpointer frame); + static void signalDragEnd(GtkWidget *widget, GdkDragContext *context, gpointer frame); + static void signalDragDataGet(GtkWidget* widget, GdkDragContext* context, GtkSelectionData *data, guint info, + guint time, gpointer frame); + + static void gestureSwipe(GtkGestureSwipe* gesture, gdouble velocity_x, gdouble velocity_y, gpointer frame); + static void gestureLongPress(GtkGestureLongPress* gesture, gdouble x, gdouble y, gpointer frame); + static gboolean signalFocus( GtkWidget*, GdkEventFocus*, gpointer ); + static void signalSetFocus( GtkWindow* pWindow, GtkWidget* pWidget, gpointer frame ); + static gboolean signalMap( GtkWidget*, GdkEvent*, gpointer ); + static gboolean signalUnmap( GtkWidget*, GdkEvent*, gpointer ); + static gboolean signalConfigure( GtkWidget*, GdkEventConfigure*, gpointer ); + static gboolean signalMotion( GtkWidget*, GdkEventMotion*, gpointer ); + static gboolean signalKey( GtkWidget*, GdkEventKey*, gpointer ); + static gboolean signalDelete( GtkWidget*, GdkEvent*, gpointer ); + static gboolean signalWindowState( GtkWidget*, GdkEvent*, gpointer ); + static gboolean signalScroll( GtkWidget*, GdkEvent*, gpointer ); + static gboolean signalCrossing( GtkWidget*, GdkEventCrossing*, gpointer ); + static gboolean signalVisibility( GtkWidget*, GdkEventVisibility*, gpointer ); + static void signalDestroy( GtkWidget*, gpointer ); + + void Center(); + void SetDefaultSize(); + + bool doKeyCallback( guint state, + guint keyval, + guint16 hardware_keycode, + guint8 group, + sal_Unicode aOrigCode, + bool bDown, + bool bSendRelease + ); + + static GdkNativeWindow findTopLevelSystemWindow( GdkNativeWindow aWindow ); + + static int m_nFloats; + + bool isFloatGrabWindow() const + { + return + (m_nStyle & SalFrameStyleFlags::FLOAT) && // only a float can be floatgrab + !(m_nStyle & SalFrameStyleFlags::TOOLTIP) && // tool tips are not + !(m_nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION); // toolbars are also not + } + + 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); + } + + //call gtk_window_resize + void window_resize(long nWidth, long nHeight); + //call gtk_widget_set_size_request + void widget_set_size_request(long nWidth, long nHeight); + + void resizeWindow( long nWidth, long nHeight ); + void moveWindow( long nX, long nY ); + + Size calcDefaultSize(); + + void setMinMaxSize(); + + void AllocateFrame(); + void TriggerPaintEvent(); + + void updateWMClass(); + + enum class SetType { RetainSize, Fullscreen, UnFullscreen }; + + void SetScreen( unsigned int nNewScreen, SetType eType, tools::Rectangle const *pSize = nullptr ); + + void SetIcon(const char* pIcon); + +public: + cairo_surface_t* m_pSurface; + basegfx::B2IVector m_aFrameSize; + DamageHandler m_aDamageHandler; + std::vector<GdkEvent*> m_aPendingScrollEvents; + Idle m_aSmoothScrollIdle; + int m_nGrabLevel; + bool m_bSalObjectSetPosSize; + GtkSalFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ); + GtkSalFrame( SystemParentData* pSysData ); + + guint m_nMenuExportId; + guint m_nActionGroupExportId; + guint m_nHudAwarenessId; + std::vector<gulong> m_aMouseSignalIds; + + void grabPointer(bool bGrab, bool bKeyboardAlso, bool bOwnerEvents); + + static GtkSalDisplay* getDisplay(); + static GdkDisplay* getGdkDisplay(); + GtkWidget* getWindow() const { return m_pWindow; } + GtkFixed* getFixedContainer() const { return m_pFixedContainer; } + GtkEventBox* getEventBox() const { return m_pEventBox; } + GtkWidget* getMouseEventWidget() const; + GtkGrid* getTopLevelGridWidget() const { return m_pTopLevelGrid; } + const SalX11Screen& getXScreenNumber() const { return m_nXScreen; } + int GetDisplayScreen() const { return maGeometry.nDisplayScreenNumber; } + void updateScreenNumber(); + + cairo_t* getCairoContext() const; + void damaged(sal_Int32 nExtentsLeft, sal_Int32 nExtentsTop, + sal_Int32 nExtentsRight, sal_Int32 nExtentsBottom) const; + + void registerDropTarget(GtkDropTarget* pDropTarget) + { + assert(!m_pDropTarget); + m_pDropTarget = pDropTarget; + } + + void deregisterDropTarget(GtkDropTarget const * pDropTarget) + { + assert(m_pDropTarget == pDropTarget); (void)pDropTarget; + m_pDropTarget = nullptr; + } + + void registerDragSource(GtkDragSource* pDragSource) + { + assert(!m_pDragSource); + m_pDragSource = pDragSource; + } + + void deregisterDragSource(GtkDragSource const * pDragSource) + { + assert(m_pDragSource == pDragSource); (void)pDragSource; + m_pDragSource = nullptr; + } + + void startDrag(gint nButton, gint nDragOriginX, gint nDragOriginY, + GdkDragAction sourceActions, GtkTargetList* pTargetList); + + void closePopup(); + + void addGrabLevel(); + void removeGrabLevel(); + + void nopaint_container_resize_children(GtkContainer*); + + void LaunchAsyncScroll(GdkEvent const * pEvent); + DECL_LINK(AsyncScroll, Timer *, void); + + virtual ~GtkSalFrame() override; + + // SalGraphics or NULL, but two Graphics for all SalFrames + // must be returned + virtual SalGraphics* AcquireGraphics() override; + virtual void ReleaseGraphics( SalGraphics* pGraphics ) override; + + // Event must be destroyed, when Frame is destroyed + // When Event is called, SalInstance::Yield() must be returned + virtual bool PostEvent(std::unique_ptr<ImplSVEvent> pData) override; + + virtual void SetTitle( const OUString& rTitle ) override; + virtual void SetIcon( sal_uInt16 nIcon ) override; + virtual void SetMenu( SalMenu *pSalMenu ) override; + SalMenu* GetMenu(); + virtual void DrawMenuBar() override; + void EnsureAppMenuWatch(); + + virtual void SetExtendedFrameStyle( SalExtStyle nExtStyle ) override; + // Before the window is visible, a resize event + // must be sent with the correct size + virtual void Show( bool bVisible, bool bNoActivate = false ) override; + // Set ClientSize and Center the Window to the desktop + // and send/post a resize message + 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; + // Enable/Disable ScreenSaver, SystemAgents, ... + virtual void StartPresentation( bool bStart ) override; + // Show Window over all other Windows + virtual void SetAlwaysOnTop( bool bOnTop ) override; + + // Window to top and grab focus + virtual void ToTop( SalFrameToTop nFlags ) override; + + // this function can call with the same + // pointer style + virtual void SetPointer( PointerStyle ePointerStyle ) override; + virtual void CaptureMouse( bool bMouse ) override; + virtual void GrabFocus() override; + virtual void SetPointerPos( long nX, long nY ) override; + + // flush output buffer + using SalFrame::Flush; + virtual void Flush() override; + // flush output buffer, wait till outstanding operations are done + + 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; + + // returns the input language used for the last key stroke + // may be LANGUAGE_DONTKNOW if not supported by the OS + virtual LanguageType GetInputLanguage() override; + + virtual void UpdateSettings( AllSettings& rSettings ) override; + + virtual void Beep() override; + + // returns system data (most prominent: window handle) + virtual const SystemEnvData* GetSystemData() const override; + + // get current modifier and button mask + virtual SalPointerState GetPointerState() override; + + virtual KeyIndicatorState GetIndicatorState() override; + + virtual void SimulateKeyPress( sal_uInt16 nKeyCode ) override; + + // set new parent window + virtual void SetParent( SalFrame* pNewParent ) override; + // reparent window to act as a plugin; implementation + // may choose to use a new system window internally + // return false to indicate failure + virtual bool SetPluginParent( SystemParentData* pNewParent ) override; + + virtual void SetScreenNumber( unsigned int ) override; + virtual void SetApplicationID( const OUString &rWMClass ) override; + + // shaped system windows + // set clip region to none (-> rectangular windows, normal state) + virtual void ResetClipRegion() override; + // start setting the clipregion consisting of nRects rectangles + virtual void BeginSetClipRegion( sal_uInt32 nRects ) override; + // add a rectangle to the clip region + virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) override; + // done setting up the clipregion + virtual void EndSetClipRegion() override; + + virtual void PositionByToolkit(const tools::Rectangle& rRect, FloatWinPopupFlags nFlags) override; + virtual void SetModal(bool bModal) override; + virtual bool GetModal() const override; + void HideTooltip(); + void BlockTooltip(); + void UnblockTooltip(); + virtual bool ShowTooltip(const OUString& rHelpText, const tools::Rectangle& rHelpArea) override; + virtual void* ShowPopover(const OUString& rHelpText, vcl::Window* pParent, const tools::Rectangle& rHelpArea, QuickHelpFlags nFlags) override; + virtual bool UpdatePopover(void* nId, const OUString& rHelpText, vcl::Window* pParent, const tools::Rectangle& rHelpArea) override; + virtual bool HidePopover(void* nId) override; + virtual weld::Window* GetFrameWeld() const override; + + static GtkSalFrame *getFromWindow( GtkWidget *pWindow ); + + sal_uIntPtr GetNativeWindowHandle(GtkWidget *pWidget); + virtual sal_uIntPtr GetNativeWindowHandle() override; + + //Call the usual SalFrame Callback, but catch uno exceptions and delegate + //to GtkSalData to rethrow them after the gsignal is processed when its safe + //to do so again in our own code after the g_main_context_iteration call + //which triggers the gsignals. + bool CallCallbackExc(SalEvent nEvent, const void* pEvent) const; + + + static void KeyCodeToGdkKey(const vcl::KeyCode& rKeyCode, + guint* pGdkKeyCode, GdkModifierType *pGdkModifiers); + + static guint32 GetLastInputEventTime(); + static void UpdateLastInputEventTime(guint32 nUserInputTime); + static sal_uInt16 GetMouseModCode(guint nState); + static sal_uInt16 GetKeyCode(guint nKeyVal); + static guint GetKeyValFor(GdkKeymap* pKeyMap, guint16 hardware_keycode, guint8 group); + static sal_uInt16 GetKeyModCode(guint nState); + static GdkEvent* makeFakeKeyPress(GtkWidget* pWidget); + static SalWheelMouseEvent GetWheelEvent(GdkEventScroll& rEvent); + static gboolean NativeWidgetHelpPressed(GtkAccelGroup*, GObject*, guint, + GdkModifierType, gpointer pFrame); + static OUString GetPreeditDetails(GtkIMContext* pIMContext, std::vector<ExtTextInputAttr>& rInputFlags, sal_Int32& rCursorPos, sal_uInt8& rCursorFlags); +}; + +#define OOO_TYPE_FIXED ooo_fixed_get_type() + +extern "C" { + +GType ooo_fixed_get_type(); +AtkObject* ooo_fixed_get_accessible(GtkWidget *obj); + +} // extern "C" + +#if !GTK_CHECK_VERSION(3, 20, 0) +enum GdkDragCancelReason +{ + GDK_DRAG_CANCEL_NO_TARGET, + GDK_DRAG_CANCEL_USER_CANCELLED, + GDK_DRAG_CANCEL_ERROR +}; +#endif + +#if !GTK_CHECK_VERSION(3, 22, 0) +enum GdkAnchorHints +{ + GDK_ANCHOR_FLIP_X = 1 << 0, + GDK_ANCHOR_FLIP_Y = 1 << 1, + GDK_ANCHOR_SLIDE_X = 1 << 2, + GDK_ANCHOR_SLIDE_Y = 1 << 3, + GDK_ANCHOR_RESIZE_X = 1 << 4, + GDK_ANCHOR_RESIZE_Y = 1 << 5, + GDK_ANCHOR_FLIP = GDK_ANCHOR_FLIP_X | GDK_ANCHOR_FLIP_Y, + GDK_ANCHOR_SLIDE = GDK_ANCHOR_SLIDE_X | GDK_ANCHOR_SLIDE_Y, + GDK_ANCHOR_RESIZE = GDK_ANCHOR_RESIZE_X | GDK_ANCHOR_RESIZE_Y +}; +#endif + +#endif // INCLUDED_VCL_INC_UNX_GTK_GTKFRAME_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx new file mode 100644 index 000000000..430bab56d --- /dev/null +++ b/vcl/inc/unx/gtk/gtkgdi.hxx @@ -0,0 +1,399 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_GTK_GTKGDI_HXX +#define INCLUDED_VCL_INC_UNX_GTK_GTKGDI_HXX + +#include <config_cairo_canvas.h> + +#include <gtk/gtk.h> +#include "gtkbackend.hxx" +#include <gdk/gdkkeysyms.h> + +#include <unx/gtk/gtkframe.hxx> +#include <ControlCacheKey.hxx> + +#include <headless/svpgdi.hxx> +#include <textrender.hxx> + +enum class GtkControlPart +{ + ToplevelWindow, + Button, + LinkButton, + CheckButton, + CheckButtonCheck, + RadioButton, + RadioButtonRadio, + Entry, + Combobox, + ComboboxBox, + ComboboxBoxEntry, + ComboboxBoxButton, + ComboboxBoxButtonBox, + ComboboxBoxButtonBoxArrow, + Listbox, + ListboxBox, + ListboxBoxButton, + ListboxBoxButtonBox, + ListboxBoxButtonBoxArrow, + SpinButton, + SpinButtonEntry, + SpinButtonUpButton, + SpinButtonDownButton, + ScrollbarVertical, + ScrollbarVerticalContents, + ScrollbarVerticalTrough, + ScrollbarVerticalSlider, + ScrollbarVerticalButton, + ScrollbarHorizontal, + ScrollbarHorizontalContents, + ScrollbarHorizontalTrough, + ScrollbarHorizontalSlider, + ScrollbarHorizontalButton, + ProgressBar, + ProgressBarTrough, + ProgressBarProgress, + Notebook, + NotebookHeader, + NotebookStack, + NotebookHeaderTabs, + NotebookHeaderTabsTab, + NotebookHeaderTabsTabLabel, + NotebookHeaderTabsTabActiveLabel, + NotebookHeaderTabsTabHoverLabel, + FrameBorder, + MenuBar, + MenuBarItem, + MenuWindow, + Menu, + MenuItem, + MenuItemLabel, + MenuItemArrow, + CheckMenuItem, + CheckMenuItemCheck, + RadioMenuItem, + RadioMenuItemRadio, + SeparatorMenuItem, + SeparatorMenuItemSeparator, +}; + +typedef void (*gtk_widget_path_iter_set_object_nameFunc)(GtkWidgetPath *, guint, const char*); + +class GtkSalGraphics : public SvpSalGraphics +{ + GtkSalFrame * const mpFrame; + +protected: + bool isNativeControlSupported(ControlType, ControlPart) override; + virtual bool drawNativeControl( ControlType nType, ControlPart nPart, + const tools::Rectangle& rControlRegion, + ControlState nState, const ImplControlValue& aValue, + const OUString& rCaption, + const Color& rBackgroundColor ) override; + virtual bool getNativeControlRegion( ControlType nType, ControlPart nPart, + const tools::Rectangle& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + const OUString& rCaption, + tools::Rectangle &rNativeBoundingRegion, + tools::Rectangle &rNativeContentRegion ) override; + bool updateSettings(AllSettings&) override; + void handleDamage(const tools::Rectangle&) override; + +public: + GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow ); + +#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; + +#endif + + void WidgetQueueDraw() const; + + virtual void GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) override; + + virtual OUString getRenderBackendName() const override { return "gtk3svp"; } + + GtkStyleContext* createStyleContext(gtk_widget_path_iter_set_object_nameFunc set_object_name, GtkControlPart ePart); + GtkStyleContext* createNewContext(GtkControlPart ePart, gtk_widget_path_iter_set_object_nameFunc set_object_name); + GtkStyleContext* createOldContext(GtkControlPart ePart); + GtkStyleContext* makeContext(GtkWidgetPath *pPath, GtkStyleContext *pParent); +private: + GtkWidget *mpWindow; + static GtkStyleContext *mpWindowStyle; + static GtkStyleContext *mpButtonStyle; + static GtkStyleContext *mpLinkButtonStyle; + static GtkStyleContext *mpEntryStyle; + static GtkStyleContext *mpTextViewStyle; + static GtkStyleContext *mpVScrollbarStyle; + static GtkStyleContext *mpVScrollbarContentsStyle; + static GtkStyleContext *mpVScrollbarTroughStyle; + static GtkStyleContext *mpVScrollbarSliderStyle; + static GtkStyleContext *mpVScrollbarButtonStyle; + static GtkStyleContext *mpHScrollbarStyle; + static GtkStyleContext *mpHScrollbarContentsStyle; + static GtkStyleContext *mpHScrollbarTroughStyle; + static GtkStyleContext *mpHScrollbarSliderStyle; + static GtkStyleContext *mpHScrollbarButtonStyle; + static GtkStyleContext *mpToolbarStyle; + static GtkStyleContext *mpToolButtonStyle; + static GtkStyleContext *mpToolbarSeperatorStyle; + static GtkStyleContext *mpCheckButtonStyle; + static GtkStyleContext *mpCheckButtonCheckStyle; + static GtkStyleContext *mpRadioButtonStyle; + static GtkStyleContext *mpRadioButtonRadioStyle; + static GtkStyleContext *mpSpinStyle; + static GtkStyleContext *mpSpinEntryStyle; + static GtkStyleContext *mpSpinUpStyle; + static GtkStyleContext *mpSpinDownStyle; + static GtkStyleContext *mpComboboxStyle; + static GtkStyleContext *mpComboboxBoxStyle; + static GtkStyleContext *mpComboboxEntryStyle; + static GtkStyleContext *mpComboboxButtonStyle; + static GtkStyleContext *mpComboboxButtonBoxStyle; + static GtkStyleContext *mpComboboxButtonArrowStyle; + static GtkStyleContext *mpListboxStyle; + static GtkStyleContext *mpListboxBoxStyle; + static GtkStyleContext *mpListboxButtonStyle; + static GtkStyleContext *mpListboxButtonBoxStyle; + static GtkStyleContext *mpListboxButtonArrowStyle; + static GtkStyleContext *mpFrameInStyle; + static GtkStyleContext *mpFrameOutStyle; + static GtkStyleContext *mpFixedHoriLineStyle; + static GtkStyleContext *mpFixedVertLineStyle; + static GtkStyleContext *mpTreeHeaderButtonStyle; + static GtkStyleContext *mpProgressBarStyle; + static GtkStyleContext *mpProgressBarTroughStyle; + static GtkStyleContext *mpProgressBarProgressStyle; + static GtkStyleContext *mpNotebookStyle; + static GtkStyleContext *mpNotebookStackStyle; + static GtkStyleContext *mpNotebookHeaderStyle; + static GtkStyleContext *mpNotebookHeaderTabsStyle; + static GtkStyleContext *mpNotebookHeaderTabsTabStyle; + static GtkStyleContext *mpNotebookHeaderTabsTabLabelStyle; + static GtkStyleContext *mpNotebookHeaderTabsTabActiveLabelStyle; + static GtkStyleContext *mpNotebookHeaderTabsTabHoverLabelStyle; + static GtkStyleContext *mpMenuBarStyle; + static GtkStyleContext *mpMenuBarItemStyle; + static GtkStyleContext *mpMenuWindowStyle; + static GtkStyleContext *mpMenuStyle; + static GtkStyleContext *mpMenuItemStyle; + static GtkStyleContext *mpMenuItemLabelStyle; + static GtkStyleContext *mpMenuItemArrowStyle; + static GtkStyleContext *mpCheckMenuItemStyle; + static GtkStyleContext *mpCheckMenuItemCheckStyle; + static GtkStyleContext *mpRadioMenuItemStyle; + static GtkStyleContext *mpRadioMenuItemRadioStyle; + static GtkStyleContext *mpSeparatorMenuItemStyle; + static GtkStyleContext *mpSeparatorMenuItemSeparatorStyle; + + static tools::Rectangle NWGetScrollButtonRect( ControlPart nPart, tools::Rectangle aAreaRect ); + static tools::Rectangle NWGetSpinButtonRect( ControlPart nPart, tools::Rectangle aAreaRect); + static tools::Rectangle NWGetComboBoxButtonRect(ControlType nType, ControlPart nPart, tools::Rectangle aAreaRect); + + static void PaintScrollbar(GtkStyleContext *context, + cairo_t *cr, + const tools::Rectangle& rControlRectangle, + ControlPart nPart, + const ImplControlValue& aValue ); + void PaintOneSpinButton( GtkStyleContext *context, + cairo_t *cr, + ControlPart nPart, + tools::Rectangle aAreaRect, + ControlState nState ); + void PaintSpinButton(GtkStateFlags flags, + cairo_t *cr, + const tools::Rectangle& rControlRectangle, + ControlPart nPart, + const ImplControlValue& aValue); + static void PaintCombobox(GtkStateFlags flags, + cairo_t *cr, + const tools::Rectangle& rControlRectangle, + ControlType nType, + ControlPart nPart); + static void PaintCheckOrRadio(cairo_t *cr, GtkStyleContext *context, + const tools::Rectangle& rControlRectangle, + bool bIsCheck, bool bInMenu); + + static void PaintCheck(cairo_t *cr, GtkStyleContext *context, + const tools::Rectangle& rControlRectangle, bool bInMenu); + + static void PaintRadio(cairo_t *cr, GtkStyleContext *context, + const tools::Rectangle& rControlRectangle, bool bInMenu); + + + static bool style_loaded; +}; + +#else +#include <unx/salgdi.h> + +class GdkX11Pixmap; +class GtkSalGraphics : public X11SalGraphics +{ + GtkWidget *m_pWindow; + vcl::Region m_aClipRegion; + +public: + GtkSalGraphics(GtkSalFrame *, GtkWidget *window, SalX11Screen nXScreen); + virtual ~GtkSalGraphics() override; + + GtkWidget* GetGtkWidget() const { return m_pWindow; } + GdkWindow* GetGdkWindow() const { return m_pWindow->window; } + GtkSalFrame* GetGtkFrame() const { return static_cast<GtkSalFrame*>(m_pFrame); } + void SetWindow( GtkWidget* window ) { m_pWindow = window; } + + // will be set when UI theme was changed + static bool bThemeChanged; + static bool bNeedPixmapPaint; + static bool bNeedTwoPasses; + +protected: + // native widget methods + bool isNativeControlSupported(ControlType, ControlPart) 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& rCaption, const Color& rBackgroundColor ) override; + virtual bool getNativeControlRegion( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, ControlState nState, + const ImplControlValue& aValue, const OUString& rCaption, + tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion ) override; + bool updateSettings(AllSettings&) override; + +public: + //helper methods for frame's UpdateSettings + static void refreshFontconfig( GtkSettings *pSettings ); + static void signalSettingsNotify( GObject*, GParamSpec *pSpec, gpointer ); + + virtual bool setClipRegion( const vcl::Region& ) override; + virtual void ResetClipRegion() override; + + // some themes set the background pixmap of our window EVERY time + // a control is painted; but presentation effects need + // the background set to None; workaround: set the background + // before copyBits + virtual void copyBits( const SalTwoRect& rPosAry, + SalGraphics* pSrcGraphics ) override; + + virtual OUString getRenderBackendName() const override { return "gtk3"; } + +protected: + + std::unique_ptr<GdkX11Pixmap> NWGetPixmapFromScreen( tools::Rectangle srcRect, int nBgColor = 0 ); + bool NWRenderPixmapToScreen( GdkX11Pixmap* pPixmap, GdkX11Pixmap* pMask, tools::Rectangle dstRect ); + + bool DoDrawNativeControl( GdkDrawable* pDrawable, + ControlType nType, + ControlPart nPart, + const tools::Rectangle& aCtrlRect, + const std::vector< tools::Rectangle >& aClip, + ControlState nState, + const ImplControlValue& aValue, + ControlCacheKey& rControlCacheKey); + + bool NWPaintGTKArrow( GdkDrawable* gdkDrawable, + const tools::Rectangle& rControlRectangle, + const std::vector< tools::Rectangle >& rClipList, + ControlState nState, const ImplControlValue& aValue ); + bool NWPaintGTKListHeader( GdkDrawable* gdkDrawable, + const tools::Rectangle& rControlRectangle, + const std::vector< tools::Rectangle >& rClipList, + ControlState nState ); + bool NWPaintGTKFixedLine( GdkDrawable* gdkDrawable, ControlPart nPart, + const tools::Rectangle& rControlRectangle ); + bool NWPaintGTKFrame( GdkDrawable* gdkDrawable, + const tools::Rectangle& rControlRectangle, + const std::vector< tools::Rectangle >& rClipList, + const ImplControlValue& aValue ); + bool NWPaintGTKWindowBackground( GdkDrawable* gdkDrawable, + const tools::Rectangle& rControlRectangle, + const std::vector< tools::Rectangle >& rClipList ); + bool NWPaintGTKButtonReal( GtkWidget* button, GdkDrawable* gdkDrawable, + const tools::Rectangle& rControlRectangle, + const std::vector< tools::Rectangle >& rClipList, + ControlState nState ); + bool NWPaintGTKButton( GdkDrawable* gdkDrawable, + const tools::Rectangle& rControlRectangle, + const std::vector< tools::Rectangle >& rClipList, + ControlState nState ); + bool NWPaintGTKRadio( GdkDrawable* gdkDrawable, + const tools::Rectangle& rControlRectangle, + const std::vector< tools::Rectangle >& rClipList, + ControlState nState, const ImplControlValue& aValue ); + bool NWPaintGTKCheck( GdkDrawable* gdkDrawable, + const tools::Rectangle& rControlRectangle, + const std::vector< tools::Rectangle >& rClipList, + ControlState nState, const ImplControlValue& aValue ); + bool NWPaintGTKScrollbar( ControlPart nPart, + const tools::Rectangle& rControlRectangle, + ControlState nState, const ImplControlValue& aValue ); + bool NWPaintGTKEditBox( GdkDrawable* gdkDrawable, ControlType nType, + const tools::Rectangle& rControlRectangle, + const std::vector< tools::Rectangle >& rClipList, + ControlState nState ); + bool NWPaintGTKSpinBox(ControlType nType, ControlPart nPart, + const tools::Rectangle& rControlRectangle, + ControlState nState, const ImplControlValue& aValue, + ControlCacheKey& rControlCacheKey); + bool NWPaintGTKComboBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, + const tools::Rectangle& rControlRectangle, + const std::vector< tools::Rectangle >& rClipList, + ControlState nState ); + bool NWPaintGTKTabItem( ControlType nType, + const tools::Rectangle& rControlRectangle, + ControlState nState, const ImplControlValue& aValue ); + bool NWPaintGTKListBox( GdkDrawable* gdkDrawable, ControlPart nPart, + const tools::Rectangle& rControlRectangle, + const std::vector< tools::Rectangle >& rClipList, + ControlState nState ); + + bool NWPaintGTKToolbar( GdkDrawable* gdkDrawable, ControlPart nPart, + const tools::Rectangle& rControlRectangle, + const std::vector< tools::Rectangle >& rClipList, + ControlState nState, const ImplControlValue& aValue ); + bool NWPaintGTKMenubar( GdkDrawable* gdkDrawable, ControlPart nPart, + const tools::Rectangle& rControlRectangle, + const std::vector< tools::Rectangle >& rClipList, + ControlState nState ); + bool NWPaintGTKPopupMenu( GdkDrawable* gdkDrawable, ControlPart nPart, + const tools::Rectangle& rControlRectangle, + const std::vector< tools::Rectangle >& rClipList, + ControlState nState ); + bool NWPaintGTKTooltip( GdkDrawable* gdkDrawable, + const tools::Rectangle& rControlRectangle, + const std::vector< tools::Rectangle >& rClipList ); + bool NWPaintGTKProgress( + const tools::Rectangle& rControlRectangle, + const ImplControlValue& aValue ); + bool NWPaintGTKSlider( GdkDrawable* gdkDrawable, ControlPart nPart, + const tools::Rectangle& rControlRectangle, + ControlState nState, const ImplControlValue& aValue ); + bool NWPaintGTKListNode( GdkDrawable* gdkDrawable, + const tools::Rectangle& rControlRectangle, + ControlState nState, const ImplControlValue& aValue ); +}; + +#endif // INCLUDED_VCL_INC_UNX_GTK_GTKGDI_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx new file mode 100644 index 000000000..3402aa6e3 --- /dev/null +++ b/vcl/inc/unx/gtk/gtkinst.hxx @@ -0,0 +1,298 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_GTK_GTKINST_HXX +#define INCLUDED_VCL_INC_UNX_GTK_GTKINST_HXX + +#include <sal/config.h> + +#include <stack> + +#include <unx/salinst.h> +#include <unx/gensys.h> +#include <headless/svpinst.hxx> +#include <com/sun/star/datatransfer/DataFlavor.hpp> +#include <com/sun/star/datatransfer/dnd/XDragSource.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <cppuhelper/compbase.hxx> +#include <vcl/weld.hxx> +#include <vcl/weldutils.hxx> +#include <gtk/gtk.h> + +namespace vcl +{ +namespace unx +{ +class GtkPrintWrapper; +} +} + +vcl::Font pango_to_vcl(const PangoFontDescription* font, const css::lang::Locale& rLocale); + +class GenPspGraphics; +class GtkYieldMutex final : public SalYieldMutex +{ + thread_local static std::stack<sal_uInt32> yieldCounts; + +public: + GtkYieldMutex() {} + void ThreadsEnter(); + void ThreadsLeave(); +}; + +class GtkSalFrame; + +struct VclToGtkHelper +{ + std::vector<css::datatransfer::DataFlavor> aInfoToFlavor; + std::vector<GtkTargetEntry> FormatsToGtk(const css::uno::Sequence<css::datatransfer::DataFlavor> &rFormats); + void setSelectionData(const css::uno::Reference<css::datatransfer::XTransferable> &rTrans, + GtkSelectionData *selection_data, guint info); +private: + GtkTargetEntry makeGtkTargetEntry(const css::datatransfer::DataFlavor& rFlavor); +}; + +class GtkTransferable : public cppu::WeakImplHelper<css::datatransfer::XTransferable> +{ +protected: + std::map<OUString, GdkAtom> m_aMimeTypeToAtom; + + std::vector<css::datatransfer::DataFlavor> getTransferDataFlavorsAsVector(GdkAtom *targets, gint n_targets); + +public: + virtual css::uno::Any SAL_CALL getTransferData(const css::datatransfer::DataFlavor& rFlavor) override = 0; + virtual std::vector<css::datatransfer::DataFlavor> getTransferDataFlavorsAsVector() = 0; + virtual css::uno::Sequence<css::datatransfer::DataFlavor> SAL_CALL getTransferDataFlavors() override; + virtual sal_Bool SAL_CALL isDataFlavorSupported(const css::datatransfer::DataFlavor& rFlavor) override; +}; + +class GtkDnDTransferable; + +class GtkDropTarget final : public cppu::WeakComponentImplHelper<css::datatransfer::dnd::XDropTarget, + css::lang::XInitialization, + css::lang::XServiceInfo> +{ + osl::Mutex m_aMutex; + GtkSalFrame* m_pFrame; + GtkDnDTransferable* m_pFormatConversionRequest; + bool m_bActive; + bool m_bInDrag; + sal_Int8 m_nDefaultActions; + std::vector<css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>> m_aListeners; +public: + GtkDropTarget(); + virtual ~GtkDropTarget() override; + + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArgs) override; + void deinitialize(); + + // XDropTarget + virtual void SAL_CALL addDropTargetListener(const css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>&) override; + virtual void SAL_CALL removeDropTargetListener(const css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>&) override; + virtual sal_Bool SAL_CALL isActive() override; + virtual void SAL_CALL setActive(sal_Bool active) override; + virtual sal_Int8 SAL_CALL getDefaultActions() override; + virtual void SAL_CALL setDefaultActions(sal_Int8 actions) override; + + OUString SAL_CALL getImplementationName() override; + + sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + void fire_dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent& dtdee); + void fire_dragOver(const css::datatransfer::dnd::DropTargetDragEvent& dtde); + void fire_drop(const css::datatransfer::dnd::DropTargetDropEvent& dtde); + void fire_dragExit(const css::datatransfer::dnd::DropTargetEvent& dte); + + void SetFormatConversionRequest(GtkDnDTransferable *pRequest) + { + m_pFormatConversionRequest = pRequest; + } + + gboolean signalDragDrop(GtkWidget* pWidget, GdkDragContext* context, gint x, gint y, guint time); + gboolean signalDragMotion(GtkWidget* pWidget, GdkDragContext* context, gint x, gint y, guint time); + void signalDragDropReceived(GtkWidget* pWidget, GdkDragContext* context, gint x, gint y, GtkSelectionData* data, guint ttype, guint time); + void signalDragLeave(GtkWidget* pWidget, GdkDragContext* context, guint time); +}; + +class GtkDragSource final : public cppu::WeakComponentImplHelper<css::datatransfer::dnd::XDragSource, + css::lang::XInitialization, + css::lang::XServiceInfo> +{ + osl::Mutex m_aMutex; + GtkSalFrame* m_pFrame; + css::uno::Reference<css::datatransfer::dnd::XDragSourceListener> m_xListener; + css::uno::Reference<css::datatransfer::XTransferable> m_xTrans; + VclToGtkHelper m_aConversionHelper; +public: + GtkDragSource() + : WeakComponentImplHelper(m_aMutex) + , m_pFrame(nullptr) + { + } + + void set_datatransfer(const css::uno::Reference<css::datatransfer::XTransferable>& rTrans, + const css::uno::Reference<css::datatransfer::dnd::XDragSourceListener>& rListener); + + std::vector<GtkTargetEntry> FormatsToGtk(const css::uno::Sequence<css::datatransfer::DataFlavor> &rFormats); + + void setActiveDragSource(); + + virtual ~GtkDragSource() override; + + // XDragSource + virtual sal_Bool SAL_CALL isDragImageSupported() override; + virtual sal_Int32 SAL_CALL getDefaultCursor(sal_Int8 dragAction) override; + virtual void SAL_CALL startDrag( + const css::datatransfer::dnd::DragGestureEvent& trigger, sal_Int8 sourceActions, sal_Int32 cursor, sal_Int32 image, + const css::uno::Reference< css::datatransfer::XTransferable >& transferable, + const css::uno::Reference< css::datatransfer::dnd::XDragSourceListener >& listener) override; + + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any >& rArguments) override; + void deinitialize(); + + OUString SAL_CALL getImplementationName() override; + + sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + void dragFailed(); + void dragDelete(); + void dragEnd(GdkDragContext* context); + void dragDataGet(GtkSelectionData *data, guint info); + + // For LibreOffice internal D&D we provide the Transferable without Gtk + // intermediaries as a shortcut, see tdf#100097 for how dbaccess depends on this + static GtkDragSource* g_ActiveDragSource; + css::uno::Reference<css::datatransfer::XTransferable> const & GetTransferrable() const { return m_xTrans; } +}; + +class GtkSalTimer; +class GtkInstance final : public SvpSalInstance +{ +public: + GtkInstance( std::unique_ptr<SalYieldMutex> pMutex ); + virtual ~GtkInstance() override; + void EnsureInit(); + virtual void AfterAppInit() override; + + virtual SalFrame* CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ) override; + virtual SalFrame* CreateChildFrame( SystemParentData* pParent, SalFrameStyleFlags nStyle ) override; + virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow ) override; + virtual SalSystem* CreateSalSystem() override; + virtual SalInfoPrinter* CreateInfoPrinter(SalPrinterQueueInfo* pPrinterQueueInfo, ImplJobSetup* pJobSetup) override; + virtual std::unique_ptr<SalPrinter> CreatePrinter( SalInfoPrinter* pInfoPrinter ) override; + virtual std::unique_ptr<SalMenu> CreateMenu( bool, Menu* ) override; + virtual std::unique_ptr<SalMenuItem> CreateMenuItem( const SalItemParams& ) override; + virtual SalTimer* CreateSalTimer() override; + virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) override; + virtual std::unique_ptr<SalVirtualDevice> + CreateVirtualDevice( SalGraphics*, + long &nDX, long &nDY, + DeviceFormat eFormat, + const SystemGraphicsData* = nullptr ) override; + virtual std::shared_ptr<SalBitmap> CreateSalBitmap() override; + + virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents) override; + virtual bool AnyInput( VclInputFlags nType ) override; + // impossible to handle correctly, as "main thread" depends on the dispatch mutex + virtual bool IsMainThread() const override { return false; } + + virtual std::unique_ptr<GenPspGraphics> CreatePrintGraphics() override; + + virtual bool hasNativeFileSelection() const override { return true; } + + virtual css::uno::Reference< css::ui::dialogs::XFilePicker2 > + createFilePicker( const css::uno::Reference< css::uno::XComponentContext >& ) override; + virtual css::uno::Reference< css::ui::dialogs::XFolderPicker2 > + createFolderPicker( const css::uno::Reference< css::uno::XComponentContext >& ) override; + + virtual css::uno::Reference< css::uno::XInterface > CreateClipboard( const css::uno::Sequence< css::uno::Any >& i_rArguments ) override; + virtual css::uno::Reference< css::uno::XInterface > CreateDragSource() override; + virtual css::uno::Reference< css::uno::XInterface > CreateDropTarget() override; + virtual OpenGLContext* CreateOpenGLContext() override; + virtual weld::Builder* CreateBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile) override; + virtual weld::Builder* CreateInterimBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile) override; + virtual weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage) override; + virtual weld::Window* GetFrameWeld(const css::uno::Reference<css::awt::XWindow>& rWindow) override; + + virtual const cairo_font_options_t* GetCairoFontOptions() override; + const cairo_font_options_t* GetLastSeenCairoFontOptions() const; + void ResetLastSeenCairoFontOptions(const cairo_font_options_t* pOptions); + + void RemoveTimer (); + + std::shared_ptr<vcl::unx::GtkPrintWrapper> const & getPrintWrapper() const; + + void* CreateGStreamerSink(const SystemChildWindow*) override; + +private: + GtkSalTimer *m_pTimer; + std::unordered_map< GdkAtom, css::uno::Reference<css::uno::XInterface> > m_aClipboards; + bool IsTimerExpired(); + bool bNeedsInit; + cairo_font_options_t* m_pLastCairoFontOptions; + + mutable std::shared_ptr<vcl::unx::GtkPrintWrapper> m_xPrintWrapper; +}; + +class SalGtkXWindow final : public weld::TransportAsXWindow +{ +private: + weld::Window* m_pWeldWidget; + GtkWidget* m_pWidget; +public: + + SalGtkXWindow(weld::Window* pWeldWidget, GtkWidget* pWidget) + : TransportAsXWindow(pWeldWidget) + , m_pWeldWidget(pWeldWidget) + , m_pWidget(pWidget) + { + } + + virtual void clear() override + { + m_pWeldWidget = nullptr; + m_pWidget = nullptr; + TransportAsXWindow::clear(); + } + + GtkWidget* getGtkWidget() const + { + return m_pWidget; + } + + weld::Window* getFrameWeld() const + { + return m_pWeldWidget; + } +}; + +GdkPixbuf* load_icon_by_name(const OUString& rIconName); + +#endif // INCLUDED_VCL_INC_UNX_GTK_GTKINST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/gtkobject.hxx b/vcl/inc/unx/gtk/gtkobject.hxx new file mode 100644 index 000000000..d1a5226cd --- /dev/null +++ b/vcl/inc/unx/gtk/gtkobject.hxx @@ -0,0 +1,107 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_GTK_GTKOBJECT_HXX +#define INCLUDED_VCL_INC_UNX_GTK_GTKOBJECT_HXX + +#include <tools/solar.h> +#include <vcl/sysdata.hxx> +#include <salobj.hxx> +#include <unx/gtk/gtkframe.hxx> + +class GtkSalObjectBase : public SalObject +{ +protected: + SystemEnvData m_aSystemData; + GtkWidget* m_pSocket; + GtkSalFrame* m_pParent; + cairo_region_t* m_pRegion; + + void Init(); + +public: + GtkSalObjectBase(GtkSalFrame* pParent); + virtual ~GtkSalObjectBase() override; + + virtual void BeginSetClipRegion( sal_uInt32 nRects ) override; + virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) override; + + virtual void SetForwardKey( bool bEnable ) override; + + virtual const SystemEnvData* GetSystemData() const override; + + virtual Size GetOptimalSize() const override; + +private: + // signals + static gboolean signalButton( GtkWidget*, GdkEventButton*, gpointer ); + static gboolean signalFocus( GtkWidget*, GdkEventFocus*, gpointer ); +}; + +// this attempts to clip the hosted native window using gdk_window_shape_combine_region +class GtkSalObject final : public GtkSalObjectBase +{ + // signals + static void signalDestroy( GtkWidget*, gpointer ); + +public: + GtkSalObject(GtkSalFrame* pParent, bool bShow); + virtual ~GtkSalObject() override; + + // override all pure virtual methods + virtual void ResetClipRegion() 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 Reparent(SalFrame* pFrame) override; +}; + +// this attempts to clip the hosted native GtkWidget by using a GtkScrolledWindow as a viewport +// only a rectangular area is going to work +class GtkSalObjectWidgetClip final : public GtkSalObjectBase +{ + tools::Rectangle m_aRect; + tools::Rectangle m_aClipRect; + GtkWidget* m_pScrolledWindow; + + // signals + static gboolean signalScroll( GtkWidget*, GdkEvent*, gpointer ); + static void signalDestroy( GtkWidget*, gpointer ); + + bool signal_scroll(GtkWidget* pScrolledWindow, GdkEvent* pEvent); + + void ApplyClipRegion(); +public: + GtkSalObjectWidgetClip(GtkSalFrame* pParent, bool bShow); + virtual ~GtkSalObjectWidgetClip() override; + + // override all pure virtual methods + virtual void ResetClipRegion() 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 Reparent(SalFrame* pFrame) override; +}; + + +#endif // INCLUDED_VCL_INC_UNX_GTK_GTKOBJECT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/gtkprintwrapper.hxx b/vcl/inc/unx/gtk/gtkprintwrapper.hxx new file mode 100644 index 000000000..589c800d7 --- /dev/null +++ b/vcl/inc/unx/gtk/gtkprintwrapper.hxx @@ -0,0 +1,69 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_UNX_GTK_INC_GTKPRINTWRAPPER_HXX +#define INCLUDED_VCL_UNX_GTK_INC_GTKPRINTWRAPPER_HXX + +#include <gtk/gtk.h> + +#include <gtk/gtkunixprint.h> + +#include <osl/module.hxx> +#include <sal/types.h> + +namespace vcl +{ +namespace unx +{ + +class GtkPrintWrapper +{ +private: + GtkPrintWrapper(const GtkPrintWrapper&) = delete; + GtkPrintWrapper& operator=(const GtkPrintWrapper&) = delete; +public: + GtkPrintWrapper(); + ~GtkPrintWrapper(); + + bool supportsPrinting() const; + bool supportsPrintSelection() const; + + // general printing support, since 2.10.0 + GtkPageSetup* page_setup_new() const; + + GtkPrintJob* print_job_new(const gchar* title, GtkPrinter* printer, GtkPrintSettings* settings, GtkPageSetup* page_setup) const; + void print_job_send(GtkPrintJob* job, GtkPrintJobCompleteFunc callback, gpointer user_data, GDestroyNotify dnotify) const; + gboolean print_job_set_source_file(GtkPrintJob* job, const gchar* filename, GError** error) const; + + const gchar* print_settings_get(GtkPrintSettings* settings, const gchar* key) const; + gboolean print_settings_get_collate(GtkPrintSettings* settings) const; + void print_settings_set_collate(GtkPrintSettings* settings, gboolean collate) const; + gint print_settings_get_n_copies(GtkPrintSettings* settings) const; + void print_settings_set_n_copies(GtkPrintSettings* settings, gint num_copies) const; + GtkPageRange* print_settings_get_page_ranges(GtkPrintSettings* settings, gint* num_ranges) const; + void print_settings_set_print_pages(GtkPrintSettings* settings, GtkPrintPages pages) const; + + GtkWidget* print_unix_dialog_new() const; + void print_unix_dialog_add_custom_tab(GtkPrintUnixDialog* dialog, GtkWidget* child, GtkWidget* tab_label) const; + GtkPrinter* print_unix_dialog_get_selected_printer(GtkPrintUnixDialog* dialog) const; + void print_unix_dialog_set_manual_capabilities(GtkPrintUnixDialog* dialog, GtkPrintCapabilities capabilities) const; + GtkPrintSettings* print_unix_dialog_get_settings(GtkPrintUnixDialog* dialog) const; + void print_unix_dialog_set_settings(GtkPrintUnixDialog* dialog, GtkPrintSettings* settings) const; + + // print selection support, since 2.17.4 + void print_unix_dialog_set_support_selection(GtkPrintUnixDialog* dialog, gboolean support_selection) const; + void print_unix_dialog_set_has_selection(GtkPrintUnixDialog* dialog, gboolean has_selection) const; +}; + +} +} + +#endif // INCLUDED_VCL_UNX_GTK_INC_GTKPRINTWRAPPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/gtkprn.hxx b/vcl/inc/unx/gtk/gtkprn.hxx new file mode 100644 index 000000000..aa24f0e4d --- /dev/null +++ b/vcl/inc/unx/gtk/gtkprn.hxx @@ -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/. + */ + +#ifndef INCLUDED_VCL_INC_UNX_GTK_GTKPRN_HXX +#define INCLUDED_VCL_INC_UNX_GTK_GTKPRN_HXX + +#include <unx/genprn.h> + +#include <memory> + +struct GtkSalPrinter_Impl; + +class GtkSalPrinter final : public PspSalPrinter +{ +public: + GtkSalPrinter(SalInfoPrinter* i_pInfoPrinter); + + ~GtkSalPrinter() override; + + using PspSalPrinter::StartJob; + virtual bool StartJob( + const OUString* i_pFileName, const OUString& i_rJobName, + const OUString& i_rAppName, ImplJobSetup* io_pSetupData, + vcl::PrinterController& io_rController) override; + virtual bool EndJob() override; + +private: + bool impl_doJob( + const OUString* i_pFileName, const OUString& i_rJobName, + const OUString& i_rAppName, ImplJobSetup* io_pSetupData, + bool i_bCollate, vcl::PrinterController& io_rController); + +private: + std::unique_ptr<GtkSalPrinter_Impl> m_xImpl; +}; + +class GtkSalInfoPrinter final : public PspSalInfoPrinter +{ +public: + sal_uInt32 GetCapabilities(const ImplJobSetup* i_pSetupData, PrinterCapType i_nType) override; +}; + +#endif // INCLUDED_VCL_INC_UNX_GTK_GTKPRN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx new file mode 100644 index 000000000..4bac1fe53 --- /dev/null +++ b/vcl/inc/unx/gtk/gtksalmenu.hxx @@ -0,0 +1,151 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_UNX_GTK_GTKSALMENU_HXX +#define INCLUDED_VCL_INC_UNX_GTK_GTKSALMENU_HXX + +#include <config_dbus.h> +#include <config_gio.h> + +#include <vector> +#if ENABLE_GIO +#include <gio/gio.h> +#endif + +#include <salmenu.hxx> +#include <unx/gtk/gtkframe.hxx> +#include <unotools/tempfile.hxx> +#include <vcl/idle.hxx> + +#include <unx/gtk/glomenu.h> +#include <unx/gtk/gloactiongroup.h> + +class MenuItemList; +class GtkSalMenuItem; + +class GtkSalMenu : public SalMenu +{ +private: + std::vector< GtkSalMenuItem* > maItems; + Idle maUpdateMenuBarIdle; + + bool mbInActivateCallback; + bool mbMenuBar; + bool mbNeedsUpdate; + bool mbReturnFocusToDocument; + bool mbAddedGrab; + /// Even setting null icon on a menuitem can be expensive, so cache state to avoid that call + bool mbHasNullItemIcon = true; + GtkWidget* mpMenuBarContainerWidget; + std::unique_ptr<utl::TempFile> mxPersonaImage; + BitmapEx maPersonaBitmap; + GtkWidget* mpMenuAllowShrinkWidget; + GtkWidget* mpMenuBarWidget; + GtkCssProvider* mpMenuBarContainerProvider; + GtkCssProvider* mpMenuBarProvider; + GtkWidget* mpCloseButton; + VclPtr<Menu> mpVCLMenu; + GtkSalMenu* mpParentSalMenu; + GtkSalFrame* mpFrame; + + // GMenuModel and GActionGroup attributes + GMenuModel* mpMenuModel; + GActionGroup* mpActionGroup; + + void ImplUpdate(bool bRecurse, bool bRemoveDisabledEntries); + void ActivateAllSubmenus(Menu* pMenuBar); + + DECL_LINK(MenuBarHierarchyChangeHandler, Timer*, void); + +public: + GtkSalMenu( bool bMenuBar ); + virtual ~GtkSalMenu() override; + + virtual bool VisibleMenuBar() override; // must return TRUE to actually DISPLAY native menu bars + // otherwise only menu messages are processed (eg, OLE on Windows) + + virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) override; + virtual void RemoveItem( unsigned nPos ) override; + virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ) override; + virtual void SetFrame( const SalFrame* pFrame ) override; + const GtkSalFrame* GetFrame() const; + virtual void CheckItem( unsigned nPos, bool bCheck ) override; + virtual void EnableItem( unsigned nPos, bool bEnable ) override; + virtual void ShowItem( unsigned nPos, bool bShow ) override; + virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OUString& rText ) override; + virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage) override; + virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& rKeyName ) override; + virtual void GetSystemMenuData( SystemMenuData* pData ) override; + + void SetMenu( Menu* pMenu ) { mpVCLMenu = pMenu; } + Menu* GetMenu() { return mpVCLMenu; } + void SetMenuModel(GMenuModel* pMenuModel); + unsigned GetItemCount() const { return maItems.size(); } + GtkSalMenuItem* GetItemAtPos( unsigned nPos ) { return maItems[ nPos ]; } + void SetActionGroup( GActionGroup* pActionGroup ) { mpActionGroup = pActionGroup; } + bool IsItemVisible( unsigned nPos ); + + void NativeSetItemText( unsigned nSection, unsigned nItemPos, const OUString& rText ); + void NativeSetItemIcon( unsigned nSection, unsigned nItemPos, const Image& rImage ); + bool NativeSetItemCommand( unsigned nSection, + unsigned nItemPos, + sal_uInt16 nId, + const gchar* aCommand, + MenuItemBits nBits, + bool bChecked, + bool bIsSubmenu ); + void NativeSetEnableItem( gchar const * aCommand, gboolean bEnable ); + void NativeCheckItem( unsigned nSection, unsigned nItemPos, MenuItemBits bits, gboolean bCheck ); + void NativeSetAccelerator( unsigned nSection, unsigned nItemPos, const vcl::KeyCode& rKeyCode, const OUString& rKeyName ); + + static void DispatchCommand(const gchar* pMenuCommand); + static void Activate(const gchar* pMenuCommand); + static void Deactivate(const gchar* pMenuCommand); + void EnableUnity(bool bEnable); + virtual void ShowMenuBar( bool bVisible ) override; + bool PrepUpdate(); + virtual void Update() override; // Update this menu only. + // Update full menu hierarchy from this menu. + void UpdateFull () { ActivateAllSubmenus(mpVCLMenu); Update(); } + // Clear ActionGroup and MenuModel from full menu hierarchy + void ClearActionGroupAndMenuModel(); + GtkSalMenu* GetTopLevel(); + void SetNeedsUpdate(); + + GtkWidget* GetMenuBarContainerWidget() const { return mpMenuBarContainerWidget; } + + void CreateMenuBarWidget(); + void DestroyMenuBarWidget(); + gboolean SignalKey(GdkEventKey const * pEvent); + void ReturnFocus(); + + virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const tools::Rectangle& rRect, FloatWinPopupFlags nFlags) override; + virtual void ShowCloseButton(bool bShow) override; + virtual bool CanGetFocus() const override; + virtual bool TakeFocus() override; + virtual int GetMenuBarHeight() const override; + virtual void ApplyPersona() override; +}; + +class GtkSalMenuItem : public SalMenuItem +{ +public: + GtkSalMenuItem( const SalItemParams* ); + virtual ~GtkSalMenuItem() override; + + GtkSalMenu* mpParentMenu; // The menu into which this menu item is inserted + GtkSalMenu* mpSubMenu; // Submenu of this item (if defined) + MenuItemType mnType; // Item type + sal_uInt16 mnId; // Item ID + bool mbVisible; // Item visibility. +}; + +#endif // INCLUDED_VCL_INC_UNX_GTK_GTKSALMENU_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/gtksys.hxx b/vcl/inc/unx/gtk/gtksys.hxx new file mode 100644 index 000000000..8775f5af0 --- /dev/null +++ b/vcl/inc/unx/gtk/gtksys.hxx @@ -0,0 +1,48 @@ +/* -*- 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/. + */ +#ifndef INCLUDED_VCL_INC_UNX_GTK_GTKSYS_HXX +#define INCLUDED_VCL_INC_UNX_GTK_GTKSYS_HXX + +#include <unx/gensys.h> +#include <gtk/gtk.h> +#include <unx/saltype.h> +#include <deque> + +class GtkSalSystem final : public SalGenericSystem +{ + typedef std::deque<std::pair<GdkScreen*, int> > ScreenMonitors_t; + + GdkDisplay *mpDisplay; + // Number of monitors for every active screen. + ScreenMonitors_t maScreenMonitors; +public: + GtkSalSystem(); + virtual ~GtkSalSystem() override; + static GtkSalSystem *GetSingleton(); + + virtual bool IsUnifiedDisplay() override; + virtual unsigned int GetDisplayScreenCount() override; + virtual unsigned int GetDisplayBuiltInScreen() override; + virtual tools::Rectangle GetDisplayScreenPosSizePixel (unsigned int nScreen) override; + virtual int ShowNativeDialog (const OUString& rTitle, + const OUString& rMessage, + const std::vector< OUString >& rButtons) override; + SalX11Screen GetDisplayDefaultXScreen() + { return getXScreenFromDisplayScreen( GetDisplayBuiltInScreen() ); } + SalX11Screen getXScreenFromDisplayScreen(unsigned int nDisplayScreen); + void countScreenMonitors(); + // We have a 'screen' number that is combined from screen-idx + monitor-idx + int getScreenIdxFromPtr (GdkScreen *pScreen); + int getScreenMonitorIdx (GdkScreen *pScreen, int nX, int nY); + GdkScreen *getScreenMonitorFromIdx (int nIdx, gint &nMonitor); +}; + +#endif // INCLUDED_VCL_INC_UNX_GTK_GTKSYS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/hudawareness.h b/vcl/inc/unx/gtk/hudawareness.h new file mode 100644 index 000000000..eb80e12fe --- /dev/null +++ b/vcl/inc/unx/gtk/hudawareness.h @@ -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/. + */ + +#ifndef INCLUDED_VCL_INC_UNX_GTK_HUDAWARENESS_H +#define INCLUDED_VCL_INC_UNX_GTK_HUDAWARENESS_H + +#include <gio/gio.h> + +G_BEGIN_DECLS + +typedef void (* HudAwarenessCallback) (gboolean hud_active, + gpointer user_data); + +guint hud_awareness_register (GDBusConnection *connection, + const gchar *object_path, + HudAwarenessCallback callback, + gpointer user_data, + GDestroyNotify notify, + GError **error); + +void hud_awareness_unregister (GDBusConnection *connection, + guint awareness_id); + +G_END_DECLS + +#endif // INCLUDED_VCL_INC_UNX_GTK_HUDAWARENESS_H diff --git a/vcl/inc/unx/helper.hxx b/vcl/inc/unx/helper.hxx new file mode 100644 index 000000000..ac018b374 --- /dev/null +++ b/vcl/inc/unx/helper.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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_HELPER_HXX +#define INCLUDED_VCL_INC_UNX_HELPER_HXX + +#include <vector> + +#include <rtl/ustring.hxx> + + +// forwards +namespace osl { class File; } + +namespace psp +{ + +void getPrinterPathList( std::vector< OUString >& rPathList, const char* pSubDir ); + +OUString const & getFontPath(); + +// normalized path (equivalent to realpath) +void normPath( OString& rPath ); + +// splits rOrgPath into dirname and basename +// rOrgPath will be subject to normPath +void splitPath( OString& rOrgPath, OString& rDir, OString& rBase ); + +enum class whichOfficePath { InstallationRootPath, UserPath, ConfigPath }; + +OUString getOfficePath( whichOfficePath ePath ); + +} // namespace + + +#endif // INCLUDED_VCL_INC_UNX_HELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/i18n_cb.hxx b/vcl/inc/unx/i18n_cb.hxx new file mode 100644 index 000000000..d6a505e0d --- /dev/null +++ b/vcl/inc/unx/i18n_cb.hxx @@ -0,0 +1,91 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_VCL_INC_UNX_I18N_CB_HXX +#define INCLUDED_VCL_INC_UNX_I18N_CB_HXX + +#include <X11/Xlib.h> + +#include <salwtype.hxx> +#include <vector> + +extern "C" { + +// xim callbacks +void PreeditDoneCallback ( XIC ic, XPointer client_data, XPointer call_data); +int PreeditStartCallback( XIC ic, XPointer client_data, XPointer call_data); +void PreeditDrawCallback ( XIC ic, XPointer client_data, + XIMPreeditDrawCallbackStruct *call_data ); +void PreeditCaretCallback( XIC ic, XPointer client_data, + XIMPreeditCaretCallbackStruct *call_data ); +void GetPreeditSpotLocation(XIC ic, XPointer client_data); + +void StatusStartCallback (XIC ic, XPointer client_data, XPointer call_data); +void StatusDoneCallback (XIC ic, XPointer client_data, XPointer call_data); +void StatusDrawCallback (XIC ic, XPointer client_data, + XIMStatusDrawCallbackStruct *call_data); + +// keep informed if kinput2 crashed again +void IC_IMDestroyCallback (XIM im, XPointer client_data, XPointer call_data); +void IM_IMDestroyCallback (XIM im, XPointer client_data, XPointer call_data); + +Bool IsControlCode(sal_Unicode nChar); + +} /* extern "C" */ + +struct preedit_text_t +{ + sal_Unicode *pUnicodeBuffer; + XIMFeedback *pCharStyle; + unsigned int nLength; + unsigned int nSize; + preedit_text_t() + : pUnicodeBuffer(nullptr) + , pCharStyle(nullptr) + , nLength(0) + , nSize(0) + { + } +}; + +class SalFrame; + +enum class PreeditStatus { + DontKnow = 0, + Active, + ActivationRequired, + StartPending +}; + +struct preedit_data_t +{ + SalFrame* pFrame; + PreeditStatus eState; + preedit_text_t aText; + SalExtTextInputEvent aInputEv; + std::vector< ExtTextInputAttr > aInputFlags; + preedit_data_t() + : pFrame(nullptr) + , eState(PreeditStatus::DontKnow) + { + } +}; + +#endif // INCLUDED_VCL_INC_UNX_I18N_CB_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/i18n_ic.hxx b/vcl/inc/unx/i18n_ic.hxx new file mode 100644 index 000000000..c9302c5eb --- /dev/null +++ b/vcl/inc/unx/i18n_ic.hxx @@ -0,0 +1,80 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_I18N_IC_HXX +#define INCLUDED_VCL_INC_UNX_I18N_IC_HXX + +#include "i18n_cb.hxx" + +enum class EndExtTextInputFlags; + +class SalI18N_InputContext +{ + +private: + + Bool mbUseable; // system supports current locale ? + XIC maContext; + + XIMStyle mnSupportedPreeditStyle; + XIMStyle mnStatusStyle; + XIMStyle mnPreeditStyle; + + preedit_data_t maClientData; + XIMCallback maPreeditStartCallback; + XIMCallback maPreeditDoneCallback; + XIMCallback maPreeditDrawCallback; + XIMCallback maPreeditCaretCallback; + XIMCallback maCommitStringCallback; + XIMCallback maSwitchIMCallback; + XIMCallback maDestroyCallback; + + XVaNestedList mpAttributes; + XVaNestedList mpStatusAttributes; + XVaNestedList mpPreeditAttributes; + + bool SupportInputMethodStyle( XIMStyles const *pIMStyles ); + static unsigned int GetWeightingOfIMStyle( XIMStyle n_style ); + bool IsSupportedIMStyle( XIMStyle n_style ) const; + +public: + + Bool UseContext() { return mbUseable; } + bool IsPreeditMode() const { return maClientData.eState == PreeditStatus::Active; } + XIC GetContext() { return maContext; } + + void ExtendEventMask( ::Window aFocusWindow ); + void SetICFocus( SalFrame* pFocusFrame ); + void UnsetICFocus(); + void HandleDestroyIM(); + + void EndExtTextInput(); + void CommitKeyEvent( sal_Unicode const * pText, std::size_t nLength ); + int UpdateSpotLocation(); + + void Map( SalFrame *pFrame ); + void Unmap(); + + SalI18N_InputContext( SalFrame *aFrame ); + ~SalI18N_InputContext(); +}; + +#endif // INCLUDED_VCL_INC_UNX_I18N_IC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/i18n_im.hxx b/vcl/inc/unx/i18n_im.hxx new file mode 100644 index 000000000..2539ab2da --- /dev/null +++ b/vcl/inc/unx/i18n_im.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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_I18N_IM_HXX +#define INCLUDED_VCL_INC_UNX_I18N_IM_HXX + +#include <X11/Xlib.h> + +#include <vclpluginapi.h> + +#define bUseInputMethodDefault True + +class SalI18N_InputMethod +{ + bool mbUseable; // system supports locale as well as status + // and preedit style ? + XIM maMethod; + XIMCallback maDestroyCallback; + XIMStyles *mpStyles; + +public: + + Bool PosixLocale(); + bool UseMethod() { return mbUseable; } + XIM GetMethod() { return maMethod; } + void HandleDestroyIM(); + void CreateMethod( Display *pDisplay ); + XIMStyles *GetSupportedStyles() { return mpStyles; } + void SetLocale(); + bool FilterEvent( XEvent *pEvent, ::Window window ); + + SalI18N_InputMethod(); + ~SalI18N_InputMethod(); +}; + +#endif // INCLUDED_VCL_INC_UNX_I18N_IM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/i18n_keysym.hxx b/vcl/inc/unx/i18n_keysym.hxx new file mode 100644 index 000000000..318908739 --- /dev/null +++ b/vcl/inc/unx/i18n_keysym.hxx @@ -0,0 +1,67 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_I18N_KEYSYM_HXX +#define INCLUDED_VCL_INC_UNX_I18N_KEYSYM_HXX + +#include <X11/X.h> + +#include <sal/types.h> + +/* + convert a keysym as defined in /usr/{X11R6|openwin}/include/X11/keysymdef.h + to unicode + + supported charsets: (byte1 and byte2 are always 0x0) + + Latin-1 Byte 3 = 0x00 + Latin-2 Byte 3 = 0x01 + Latin-3 Byte 3 = 0x02 + Latin-4 Byte 3 = 0x03 + Kana Byte 3 = 0x04 + Arabic Byte 3 = 0x05 + Cyrillic Byte 3 = 0x06 + Greek Byte 3 = 0x07 + Technical Byte 3 = 0x08 + Special Byte 3 = 0x09 + Publishing Byte 3 = 0x0a = 10 + APL Byte 3 = 0x0b = 11 + Hebrew Byte 3 = 0x0c = 12 + Thai Byte 3 = 0x0d = 13 + Korean Byte 3 = 0x0e = 14 + Latin-9 Byte 3 = 0x13 = 19 + Currency Byte 3 = 0x20 = 32 + Keyboard Byte 3 = 0xff = 255 + + missing charsets: + + Latin-8 Byte 3 = 0x12 = 18 + Armenian Byte 3 = 0x14 = 20 + Georgian Byte 3 = 0x15 = 21 + Azeri Byte 3 = 0x16 = 22 + Vietnamese Byte 3 = 0x1e = 30 + + of course not all keysyms can be mapped to a unicode code point +*/ + +sal_Unicode KeysymToUnicode (KeySym nKeySym); + +#endif // INCLUDED_VCL_INC_UNX_I18N_KEYSYM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/i18n_xkb.hxx b/vcl/inc/unx/i18n_xkb.hxx new file mode 100644 index 000000000..473251b48 --- /dev/null +++ b/vcl/inc/unx/i18n_xkb.hxx @@ -0,0 +1,67 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_I18N_XKB_HXX +#define INCLUDED_VCL_INC_UNX_I18N_XKB_HXX + +#include <X11/Xlib.h> + +#include <vclpluginapi.h> + +class SalI18N_KeyboardExtension +{ +private: + + bool mbUseExtension; + int mnEventBase; + +public: + + SalI18N_KeyboardExtension( Display *pDisplay ); + + inline bool UseExtension() const ; // server and client support the + // extension + inline void UseExtension( bool bState );// used to disable the Extension + + void Dispatch( XEvent *pEvent ); // keep track of group changes + + inline int GetEventBase() const ; +}; + +inline bool +SalI18N_KeyboardExtension::UseExtension() const +{ + return mbUseExtension; +} + +inline void +SalI18N_KeyboardExtension::UseExtension( bool bState ) +{ + mbUseExtension = mbUseExtension && bState; +} + +inline int +SalI18N_KeyboardExtension::GetEventBase() const +{ + return mnEventBase; +} + +#endif // INCLUDED_VCL_INC_UNX_I18N_XKB_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/nativewindowhandleprovider.hxx b/vcl/inc/unx/nativewindowhandleprovider.hxx new file mode 100644 index 000000000..1d85cb4cf --- /dev/null +++ b/vcl/inc/unx/nativewindowhandleprovider.hxx @@ -0,0 +1,25 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_UNX_NATIVEWINDOWHANDLEPROVIDER +#define INCLUDED_VCL_UNX_NATIVEWINDOWHANDLEPROVIDER + +#include <vcl/dllapi.h> + +class VCL_PLUGIN_PUBLIC NativeWindowHandleProvider +{ +public: + virtual ~NativeWindowHandleProvider(); + + virtual sal_uIntPtr GetNativeWindowHandle() = 0; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/printergfx.hxx b/vcl/inc/unx/printergfx.hxx new file mode 100644 index 000000000..fcb8a9241 --- /dev/null +++ b/vcl/inc/unx/printergfx.hxx @@ -0,0 +1,347 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_GENERIC_PRINTERGFX_HXX +#define INCLUDED_VCL_INC_GENERIC_PRINTERGFX_HXX + +#include <osl/file.hxx> +#include <tools/gen.hxx> +#include <vcl/dllapi.h> +#include <vcl/glyphitem.hxx> + +#include <impglyphitem.hxx> + +#include <list> +#include <vector> + +enum class PolyFlags : sal_uInt8; + +namespace psp { + +struct JobData; + +/* + * lightweight container to handle RGB values + */ + +class PrinterColor +{ +public: + + enum ColorSpace { eInvalid, eRGB }; + +private: + + sal_uInt8 mnRed; + sal_uInt8 mnGreen; + sal_uInt8 mnBlue; + ColorSpace meColorspace; + +public: + + PrinterColor() + : mnRed(0) + , mnGreen(0) + , mnBlue(0) + , meColorspace(eInvalid) + {} + PrinterColor (sal_uInt16 nRed, sal_uInt16 nGreen, + sal_uInt16 nBlue) : + mnRed (nRed), + mnGreen (nGreen), + mnBlue (nBlue), + meColorspace (eRGB) + {} + PrinterColor (sal_uInt32 nRGB) : + mnRed ((nRGB & 0x00ff0000) >> 16), + mnGreen ((nRGB & 0x0000ff00) >> 8), + mnBlue ((nRGB & 0x000000ff) ), + meColorspace (eRGB) + {} + + bool Is () const + { return meColorspace != eInvalid; } + + sal_uInt16 GetRed () const + { return mnRed; } + sal_uInt16 GetGreen () const + { return mnGreen; } + sal_uInt16 GetBlue () const + { return mnBlue; } + bool operator== (const PrinterColor& aColor) const + { + return aColor.Is() && Is() + && mnRed == aColor.mnRed + && mnGreen == aColor.mnGreen + && mnBlue == aColor.mnBlue; + } + bool operator!= (const PrinterColor& aColor) const + { return ! (aColor==*this); } + + PrinterColor& operator= (sal_uInt32 nRGB) + { + meColorspace = eRGB; + mnBlue = (nRGB & 0x000000ff); + mnGreen = (nRGB & 0x0000ff00) >> 8; + mnRed = (nRGB & 0x00ff0000) >> 16; + + return *this; + } +}; + +class GlyphSet; +class PrinterJob; +class PrintFontManager; +struct CharacterMetric; + +/* + * Bitmap Interface, this has to be filled with your actual bitmap implementation + * sample implementations can be found in: + * psprint/workben/cui/pspdem.cxx + * vcl/unx/source/gdi/salgdi2.cxx + */ + +class PrinterBmp +{ +public: + + virtual ~PrinterBmp () = 0; + virtual sal_uInt32 GetPaletteColor (sal_uInt32 nIdx) const = 0; + virtual sal_uInt32 GetPaletteEntryCount () const = 0; + virtual sal_uInt32 GetPixelRGB (sal_uInt32 nRow, sal_uInt32 nColumn) const = 0; + virtual sal_uInt8 GetPixelGray (sal_uInt32 nRow, sal_uInt32 nColumn) const = 0; + virtual sal_uInt8 GetPixelIdx (sal_uInt32 nRow, sal_uInt32 nColumn) const = 0; + virtual sal_uInt32 GetDepth () const = 0; +}; + +enum class ImageType { + TrueColorImage, + MonochromeImage, + PaletteImage, + GrayScaleImage +}; + +/* + * printer raster operations + */ + +struct GraphicsStatus +{ + OString maFont; + rtl_TextEncoding maEncoding; + bool mbArtItalic; + bool mbArtBold; + sal_Int32 mnTextHeight; + sal_Int32 mnTextWidth; + PrinterColor maColor; + double mfLineWidth; + + GraphicsStatus(); +}; + +class PrinterGfx +{ +private: + + /* common settings */ + + double mfScaleX; + double mfScaleY; + + sal_uInt32 mnDpi; + sal_uInt16 mnDepth; + + sal_uInt16 mnPSLevel; + bool mbColor; + bool mbUploadPS42Fonts; + + osl::File* mpPageBody; + + /* text/font related data, for a type1 font it has to be checked + whether this font has already been downloaded. A TrueType font + will be converted into one or more Type3 fonts, containing glyphs + in no particular order. In addition to the existence of the + glyph in one of the subfonts, the mapping from unicode to the + glyph has to be remembered */ + + std::vector< GlyphSet > maPS3Font; + + sal_Int32 mnFontID; + sal_Int32 mnTextAngle; + bool mbTextVertical; + PrintFontManager& mrFontMgr; + + /* bitmap drawing implementation */ + + void DrawPS1GrayImage (const PrinterBmp& rBitmap, const tools::Rectangle& rArea); + void writePS2ImageHeader (const tools::Rectangle& rArea, psp::ImageType nType); + void writePS2Colorspace (const PrinterBmp& rBitmap, psp::ImageType nType); + void DrawPS2GrayImage (const PrinterBmp& rBitmap, const tools::Rectangle& rArea); + void DrawPS2PaletteImage (const PrinterBmp& rBitmap, const tools::Rectangle& rArea); + void DrawPS2TrueColorImage (const PrinterBmp& rBitmap, const tools::Rectangle& rArea); + void DrawPS2MonoImage (const PrinterBmp& rBitmap, const tools::Rectangle& rArea); + + /* clip region */ + + std::list< tools::Rectangle > maClipRegion; + bool JoinVerticalClipRectangles( std::list< tools::Rectangle >::iterator& it, + Point& aOldPoint, sal_Int32& nColumn ); + + /* color settings */ + PrinterColor maFillColor; + PrinterColor maTextColor; + PrinterColor maLineColor; + + /* graphics state */ + GraphicsStatus maVirtualStatus; + std::list< GraphicsStatus > maGraphicsStack; + GraphicsStatus& currentState() { return maGraphicsStack.front(); } + +public: + /* graphics status update */ + void PSSetColor (); + void PSSetLineWidth (); + void PSSetFont (); + + /* graphics status functions */ + void PSSetColor (const PrinterColor& rColor) + { maVirtualStatus.maColor = rColor; } + + void PSSetFont (const OString& rName, + rtl_TextEncoding nEncoding) + { maVirtualStatus.maFont = rName; maVirtualStatus.maEncoding = nEncoding; } + + /* graphics status stack */ + void PSGSave (); + void PSGRestore (); + + /* PS helpers */ + enum pspath_t { moveto = 0, lineto = 1 }; + void PSBinLineTo (const Point& rCurrent, Point& rOld, + sal_Int32& nColumn); + void PSBinMoveTo (const Point& rCurrent, Point& rOld, + sal_Int32& nColumn); + void PSBinStartPath (); + void PSBinEndPath (); + void PSBinCurrentPath (sal_uInt32 nPoints, const Point* pPath); + void PSBinPath (const Point& rCurrent, Point& rOld, + pspath_t eType, sal_Int32& nColumn); + + void PSRotate (sal_Int32 nAngle); + void PSTranslate (const Point& rPoint); + void PSMoveTo (const Point& rPoint); + void PSScale (double fScaleX, double fScaleY); + void PSLineTo(const Point& rPoint ); + void PSPointOp (const Point& rPoint, const char* pOperator); + void PSHexString (const unsigned char* pString, sal_Int16 nLen); + void PSShowGlyph (const unsigned char nGlyphId); + + void OnEndJob (); + void writeResources( osl::File* pFile, std::vector< OString >& rSuppliedFonts ); + PrintFontManager& GetFontMgr () { return mrFontMgr; } + + void drawGlyph(const Point& rPoint, + sal_GlyphId aGlyphId); +public: + PrinterGfx(); + ~PrinterGfx(); + void Init (PrinterJob &rPrinterSpec); + void Init (const JobData& rData); + void Clear(); + + // query depth + sal_uInt16 GetBitCount () const { return mnDepth;} + + // clip region + void ResetClipRegion (); + void BeginSetClipRegion(); + void UnionClipRegion (sal_Int32 nX, sal_Int32 nY, + sal_Int32 nDX, sal_Int32 nDY); + void EndSetClipRegion (); + + // set xy color + void SetLineColor (const PrinterColor& rLineColor = PrinterColor()) + { maLineColor = rLineColor; } + void SetFillColor (const PrinterColor& rFillColor = PrinterColor()) + { maFillColor = rFillColor; } + + // drawing primitives + void DrawPixel (const Point& rPoint, const PrinterColor& rPixelColor); + void DrawPixel (const Point& rPoint) + { DrawPixel (rPoint, maLineColor); } + void DrawLine (const Point& rFrom, const Point& rTo); + void DrawRect (const tools::Rectangle& rRectangle); + void DrawPolyLine (sal_uInt32 nPoints, const Point* pPath ); + void DrawPolygon (sal_uInt32 nPoints, const Point* pPath); + void DrawPolyPolygon (sal_uInt32 nPoly, + const sal_uInt32 *pPolygonSize, + const Point** pPolygonList); + void DrawPolyLineBezier (sal_uInt32 nPoints, + const Point* pPath, + const PolyFlags* pFlgAry ); + void DrawPolygonBezier (sal_uInt32 nPoints, + const Point* pPath, + const PolyFlags* pFlgAry); + void DrawPolyPolygonBezier (sal_uInt32 nPoly, + const sal_uInt32* pPoints, + const Point* const* pPtAry, + const PolyFlags* const* pFlgAry); + + // eps + bool DrawEPS ( const tools::Rectangle& rBoundingBox, void* pPtr, sal_uInt32 nSize); + + // image drawing + void DrawBitmap (const tools::Rectangle& rDest, const tools::Rectangle& rSrc, + const PrinterBmp& rBitmap); + + // font and text handling + void SetFont ( + sal_Int32 nFontID, + sal_Int32 nPointHeight, + sal_Int32 nPointWidth, + sal_Int32 nAngle, + bool bVertical, + bool bArtItalic, + bool bArtBold + ); + sal_Int32 GetFontID () const + { return mnFontID; } + bool GetFontVertical() const + { return mbTextVertical; } + sal_Int32 GetFontHeight () const + { return maVirtualStatus.mnTextHeight; } + sal_Int32 GetFontWidth () const + { return maVirtualStatus.mnTextWidth; } + bool GetArtificialItalic() const + { return maVirtualStatus.mbArtItalic; } + bool GetArtificialBold() const + { return maVirtualStatus.mbArtBold; } + void SetTextColor (PrinterColor const & rTextColor) + { maTextColor = rTextColor; } + + void DrawGlyph(const Point& rPoint, + const GlyphItem& rGlyph); + +}; + +} /* namespace psp */ + +#endif // INCLUDED_VCL_INC_GENERIC_PRINTERGFX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/printerjob.hxx b/vcl/inc/unx/printerjob.hxx new file mode 100644 index 000000000..33f92abc7 --- /dev/null +++ b/vcl/inc/unx/printerjob.hxx @@ -0,0 +1,128 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_GENERIC_PRINTERJOB_HXX +#define INCLUDED_VCL_INC_GENERIC_PRINTERJOB_HXX + +#include <jobdata.hxx> +#include <osl/file.hxx> + +#include <vector> + +namespace psp { + +class PrinterGfx; + +class PrinterJob +{ +private: + OUString maSpoolDirName; + OUString maFileName; // empty: spool to command, else spool to named file + OUString maJobTitle; + int mnFileMode; + + std::unique_ptr<osl::File> mpJobHeader; + std::unique_ptr<osl::File> mpJobTrailer; + + std::vector< std::unique_ptr<osl::File> > maPageVector; + std::vector< std::unique_ptr<osl::File> > maHeaderVector; + + JobData m_aDocumentJobData; + JobData m_aLastJobData; + PrinterGfx* m_pGraphics; + + sal_uInt32 mnResolution; + + sal_uInt32 mnWidthPt; + sal_uInt32 mnHeightPt; + sal_uInt32 mnMaxWidthPt; + sal_uInt32 mnMaxHeightPt; + + int mnLandscapes; + int mnPortraits; + + sal_uInt32 mnLMarginPt; + sal_uInt32 mnRMarginPt; + sal_uInt32 mnTMarginPt; + sal_uInt32 mnBMarginPt; + + double mfXScale; + double mfYScale; + + bool m_bQuickJob; + +private: + std::unique_ptr<osl::File> CreateSpoolFile (const OUString& rName, + const OUString& rExtension); + void InitPaperSize (const JobData& rJobSetup); + + bool writeFeatureList( osl::File* pFile, const JobData&, bool bDocumentSetup ); + bool writeSetup( osl::File* pFile, const JobData& ); + bool writePageSetup( osl::File* pFile, const JobData&, bool bWriteFeatures ); + static void writeJobPatch( osl::File* File, const JobData& ); + static void writeProlog (osl::File* pFile, const JobData& ); + +public: // for usage in PrinterGfx + sal_uInt32 GetResolution () const { return mnResolution; } + void GetScale (double &rXScale, double &rYScale) const; + sal_uInt16 GetDepth () const; + sal_uInt16 GetPostscriptLevel (const JobData *pJobData = nullptr) const; + bool IsColorPrinter () const; + + osl::File* GetCurrentPageBody (); + + const OUString& GetPrinterName() const { return m_aLastJobData.m_aPrinterName; } + +public: + PrinterJob (); + ~PrinterJob (); + + /* rFileName: if length is greater than 0 save resulting PostScript + * to named file. + * nMode: only meaningful when saving to file: if nonzero, try + * to impose the mode on the resulting file's inode; for nonexistent + * files use open, for existent files try a chmod + * rJobName: text to appear in the %%Title comment + * rAppName: text to appear in the %%Creator comment + * rSetupData: JobData that apply to this job + * pGraphics: the graphics used to print this job; + * this graphics must live until EndJob() has returned + * bIsQuickJob: the job was started as "direct print" meaning + * the quick command for spooling should be used instead + * of the normal command + */ + bool StartJob (const OUString& rFileName, + int nMode, + const OUString& rJobName, + const OUString& rAppName, + const JobData& rSetupData, + PrinterGfx* pGraphics, + bool bIsQuickJob + ); + bool EndJob (); + + void StartPage (const JobData& rJobSetup); + void EndPage (); +}; + +} // namespace psp + +#endif // INCLUDED_VCL_INC_GENERIC_PRINTERJOB_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/salbmp.h b/vcl/inc/unx/salbmp.h new file mode 100644 index 000000000..fc8450129 --- /dev/null +++ b/vcl/inc/unx/salbmp.h @@ -0,0 +1,231 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_SALBMP_H +#define INCLUDED_VCL_INC_UNX_SALBMP_H + +#include <X11/Xlib.h> + +#include <vcl/salgtype.hxx> +#include <unx/saldisp.hxx> +#include <salbmp.hxx> +#include <vclpluginapi.h> + +struct BitmapBuffer; +class BitmapPalette; +class SalGraphics; +class ImplSalDDB; +class ImplSalBitmapCache; + + +class X11SalBitmap final : public SalBitmap +{ +private: + + static std::unique_ptr<BitmapBuffer> + ImplCreateDIB( + const Size& rSize, + sal_uInt16 nBitCount, + const BitmapPalette& rPal + ); + + static std::unique_ptr<BitmapBuffer> + ImplCreateDIB( + Drawable aDrawable, + SalX11Screen nXScreen, + long nDrawableDepth, + long nX, + long nY, + long nWidth, + long nHeight, + bool bGrey + ); + +public: + + static ImplSalBitmapCache* mpCache; + static unsigned int mnCacheInstCount; + + static void ImplCreateCache(); + static void ImplDestroyCache(); + void ImplRemovedFromCache(); + +private: + + std::unique_ptr<BitmapBuffer> mpDIB; + mutable std::unique_ptr<ImplSalDDB> mpDDB; + bool mbGrey; + +public: + + bool ImplCreateFromDrawable( + Drawable aDrawable, + SalX11Screen nXScreen, + long nDrawableDepth, + long nX, + long nY, + long nWidth, + long nHeight + ); + + XImage* ImplCreateXImage( + SalDisplay const * pSalDisp, + SalX11Screen nXScreen, + long nDepth, + const SalTwoRect& rTwoRect + ) const; + + ImplSalDDB* ImplGetDDB( + Drawable, + SalX11Screen nXScreen, + long nDrawableDepth, + const SalTwoRect& + ) const; + + void ImplDraw( + Drawable aDrawable, + SalX11Screen nXScreen, + long nDrawableDepth, + const SalTwoRect& rTwoRect, + const GC& rGC + ) const; + +public: + + X11SalBitmap(); + virtual ~X11SalBitmap() override; + + // override pure virtual methods + 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() 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_uInt8 nTol ) override; +}; + + +class ImplSalDDB +{ +private: + + Pixmap maPixmap; + SalTwoRect maTwoRect; + long mnDepth; + SalX11Screen mnXScreen; + + static void ImplDraw( + Drawable aSrcDrawable, + long nSrcDrawableDepth, + Drawable aDstDrawable, + long nSrcX, + long nSrcY, + long nDestWidth, + long nDestHeight, + long nDestX, + long nDestY, + const GC& rGC + ); + +public: + + ImplSalDDB( + XImage* pImage, + Drawable aDrawable, + SalX11Screen nXScreen, + const SalTwoRect& rTwoRect + ); + + ImplSalDDB( + Drawable aDrawable, + SalX11Screen nXScreen, + long nDrawableDepth, + long nX, + long nY, + long nWidth, + long nHeight + ); + + ~ImplSalDDB(); + + Pixmap ImplGetPixmap() const { return maPixmap; } + long ImplGetWidth() const { return maTwoRect.mnDestWidth; } + long ImplGetHeight() const { return maTwoRect.mnDestHeight; } + long ImplGetDepth() const { return mnDepth; } + const SalX11Screen& ImplGetScreen() const { return mnXScreen; } + + bool ImplMatches( SalX11Screen nXScreen, long nDepth, const SalTwoRect& rTwoRect ) const; + + void ImplDraw( + Drawable aDrawable, + const SalTwoRect& rTwoRect, + const GC& rGC + ) const; +}; + + +class X11SalBitmap; + +class ImplSalBitmapCache +{ +private: + std::vector<X11SalBitmap*> maBmpList; + +public: + + ImplSalBitmapCache(); + ~ImplSalBitmapCache(); + + void ImplAdd( X11SalBitmap* pBmp ); + void ImplRemove( X11SalBitmap const * pBmp ); + void ImplClear(); +}; + +#endif // INCLUDED_VCL_INC_UNX_SALBMP_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/saldata.hxx b/vcl/inc/unx/saldata.hxx new file mode 100644 index 000000000..de66ace37 --- /dev/null +++ b/vcl/inc/unx/saldata.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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_SALDATA_HXX +#define INCLUDED_VCL_INC_UNX_SALDATA_HXX + +#include <X11/Xlib.h> + +#include <unx/saldisp.hxx> +#include <unx/gendata.hxx> +#include <vclpluginapi.h> + +class SalXLib; +class SalDisplay; +class SalPrinter; + +class X11SalData final : public GenericUnixSalData +{ + struct XErrorStackEntry + { + bool m_bIgnore; + bool m_bWas; + XErrorHandler m_aHandler; + }; + std::vector< XErrorStackEntry > m_aXErrorHandlerStack; + XIOErrorHandler m_aOrigXIOErrorHandler; + + std::unique_ptr<SalXLib> pXLib_; + +public: + X11SalData( GenericUnixSalDataType t, SalInstance *pInstance ); + virtual ~X11SalData() override; + + virtual void Init(); + virtual void Dispose() override; + + void DeleteDisplay(); // for shutdown + + SalXLib* GetLib() const { return pXLib_.get(); } + + static void Timeout(); + + // X errors + virtual void ErrorTrapPush() override; + virtual bool ErrorTrapPop( bool bIgnoreError = true ) override; + void XError( Display *pDisp, XErrorEvent *pEvent ); + bool HasXErrorOccurred() const + { return m_aXErrorHandlerStack.back().m_bWas; } + void ResetXErrorOccurred() + { m_aXErrorHandlerStack.back().m_bWas = false; } + void PushXErrorLevel( bool bIgnore ); + void PopXErrorLevel(); +}; + +X11SalData* GetX11SalData(); + +#endif // INCLUDED_VCL_INC_UNX_SALDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx new file mode 100644 index 000000000..b5bed8e60 --- /dev/null +++ b/vcl/inc/unx/saldisp.hxx @@ -0,0 +1,428 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_SALDISP_HXX +#define INCLUDED_VCL_INC_UNX_SALDISP_HXX + +class SalDisplay; +class SalColormap; +class SalVisual; +class SalXLib; + +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/extensions/render.h> +#include <epoxy/glx.h> + +#include <rtl/string.hxx> +#include <unx/saltype.h> +#include <vcl/opengl/OpenGLContext.hxx> +#include <vcl/ptrstyle.hxx> +#include <sal/types.h> +#include <cassert> +#include <list> +#include <unordered_map> +#include <vector> +#include <tools/gen.hxx> +#include <salwtype.hxx> +#include <unx/gendata.hxx> +#include <unx/gendisp.hxx> +#include <o3tl/enumarray.hxx> + +#include <vclpluginapi.h> + +/* From <X11/Intrinsic.h> */ +typedef unsigned long Pixel; + +class BitmapPalette; +class SalFrame; +class ColorMask; + +namespace vcl_sal { class WMAdaptor; } + +// server vendor + +typedef enum { + vendor_none = 0, + vendor_sun, + vendor_unknown +} srv_vendor_t; + +extern "C" srv_vendor_t sal_GetServerVendor( Display *p_display ); + +// MSB/Bigendian view (Color == RGB, r=0xFF0000, g=0xFF00, b=0xFF) + +enum class SalRGB { RGB, RBG, + GBR, GRB, + BGR, BRG, + otherSalRGB }; + +class SalVisual : public XVisualInfo +{ + SalRGB eRGBMode_; + int nRedShift_; + int nGreenShift_; + int nBlueShift_; + int nRedBits_; + int nGreenBits_; + int nBlueBits_; +public: + SalVisual(); + SalVisual( const XVisualInfo* pXVI ); + + VisualID GetVisualId() const { return visualid; } + Visual *GetVisual() const { return visual; } + int GetClass() const { return c_class; } + int GetDepth() const { return depth; } + + Pixel GetTCPixel( Color nColor ) const; + Color GetTCColor( Pixel nPixel ) const; +}; + +// A move-only flag, used by SalColormap to track ownership of its m_aVisual.visual: +struct OwnershipFlag { + bool owner = false; + + OwnershipFlag() = default; + + OwnershipFlag(OwnershipFlag && other) noexcept: owner(other.owner) { other.owner = false; } + + OwnershipFlag & operator =(OwnershipFlag && other) noexcept { + assert(&other != this); + owner = other.owner; + other.owner = false; + return *this; + } +}; + +class SalColormap +{ + const SalDisplay* m_pDisplay; + Colormap m_hColormap; + std::vector<Color> m_aPalette; // Pseudocolor + SalVisual m_aVisual; + OwnershipFlag m_aVisualOwnership; + std::vector<sal_uInt16> m_aLookupTable; // Pseudocolor: 12bit reduction + Pixel m_nWhitePixel; + Pixel m_nBlackPixel; + Pixel m_nUsed; // Pseudocolor + + void GetPalette(); + void GetLookupTable(); +public: + SalColormap( const SalDisplay* pSalDisplay, + Colormap hColormap, + SalX11Screen nXScreen ); + SalColormap( sal_uInt16 nDepth ); + SalColormap(); + + ~SalColormap(); + + SalColormap(SalColormap &&) = default; + SalColormap & operator =(SalColormap &&) = default; + + Colormap GetXColormap() const { return m_hColormap; } + const SalDisplay* GetDisplay() const { return m_pDisplay; } + inline Display* GetXDisplay() const; + const SalVisual& GetVisual() const { return m_aVisual; } + Visual* GetXVisual() const { return m_aVisual.GetVisual(); } + Pixel GetWhitePixel() const { return m_nWhitePixel; } + Pixel GetBlackPixel() const { return m_nBlackPixel; } + Pixel GetUsed() const { return m_nUsed; } + + bool GetXPixels( XColor &rColor, + int r, + int g, + int b ) const; + inline bool GetXPixel( XColor &rColor, + int r, + int g, + int b ) const; + Pixel GetPixel( Color nColor ) const; + Color GetColor( Pixel nPixel ) const; +}; + +class SalI18N_InputMethod; + +typedef int(*YieldFunc)(int fd, void* data); + +class SalXLib +{ +protected: + timeval m_aTimeout; + sal_uLong m_nTimeoutMS; + int m_pTimeoutFDS[2]; + + int nFDs_; + fd_set aReadFDS_; + fd_set aExceptionFDS_; + + Display *m_pDisplay; + std::unique_ptr<SalI18N_InputMethod> m_pInputMethod; + +public: + SalXLib(); + virtual ~SalXLib(); + virtual void Init(); + + virtual bool Yield( bool bWait, bool bHandleAllCurrentEvents ); + virtual void Wakeup(); + void TriggerUserEventProcessing(); + + virtual void Insert( int fd, void* data, + YieldFunc pending, + YieldFunc queued, + YieldFunc handle ); + virtual void Remove( int fd ); + + virtual void StartTimer( sal_uInt64 nMS ); + virtual void StopTimer(); + + virtual bool CheckTimeout( bool bExecuteTimers = true ); + + SalI18N_InputMethod* GetInputMethod() const { return m_pInputMethod.get(); } + Display* GetDisplay() const { return m_pDisplay; } +}; + +class SalI18N_KeyboardExtension; +class AttributeProvider; + +extern "C" { + typedef Bool(*X_if_predicate)(Display*,XEvent*,XPointer); +} + +class GLX11Window final : public GLWindow +{ +public: + Display* dpy; + int screen; + Window win; + XVisualInfo* vi; + GLXContext ctx; + OString GLXExtensions; + + bool HasGLXExtension(const char* name) const; + + GLX11Window(); + virtual bool Synchronize(bool bOnoff) const override; + virtual ~GLX11Window() override; +}; + +class VCLPLUG_GEN_PUBLIC SalDisplay : public SalGenericDisplay +{ +public: + struct RenderEntry + { + Pixmap m_aPixmap; + Picture m_aPicture; + + RenderEntry() : m_aPixmap( 0 ), m_aPicture( 0 ) {} + }; + + typedef std::unordered_map<int,RenderEntry> RenderEntryMap; + + struct ScreenData + { + bool m_bInit; + + ::Window m_aRoot; + ::Window m_aRefWindow; + Size m_aSize; + SalVisual m_aVisual; + SalColormap m_aColormap; + GC m_aMonoGC; + GC m_aCopyGC; + GC m_aAndInvertedGC; + GC m_aAndGC; + GC m_aOrGC; + GC m_aStippleGC; + Pixmap m_hInvert50; + mutable RenderEntryMap m_aRenderData; + + ScreenData() : + m_bInit( false ), + m_aRoot( None ), + m_aRefWindow( None ), + m_aMonoGC( None ), + m_aCopyGC( None ), + m_aAndInvertedGC( None ), + m_aAndGC( None ), + m_aOrGC( None ), + m_aStippleGC( None ), + m_hInvert50( None ), + m_aRenderData( 1 ) + {} + }; + +protected: + SalXLib *pXLib_; + SalI18N_KeyboardExtension *mpKbdExtension; + + Display *pDisp_; // X Display + + SalX11Screen m_nXDefaultScreen; + std::vector< ScreenData > m_aScreens; + ScreenData m_aInvalidScreenData; + Pair aResolution_; // [dpi] + sal_uLong nMaxRequestSize_; // [byte] + + srv_vendor_t meServerVendor; + + // until x bytes + + o3tl::enumarray<PointerStyle, Cursor> aPointerCache_; + + // Keyboard + bool bNumLockFromXS_; // Num Lock handled by X Server + int nNumLockIndex_; // modifier index in modmap + KeySym nShiftKeySym_; // first shift modifier + KeySym nCtrlKeySym_; // first control modifier + KeySym nMod1KeySym_; // first mod1 modifier + + std::unique_ptr<vcl_sal::WMAdaptor> m_pWMAdaptor; + + bool m_bXinerama; + std::vector< tools::Rectangle > m_aXineramaScreens; + std::vector< int > m_aXineramaScreenIndexMap; + std::list<SalObject*> m_aSalObjects; + + mutable Time m_nLastUserEventTime; // mutable because changed on first access + + virtual bool Dispatch( XEvent *pEvent ) = 0; + void InitXinerama(); + void InitRandR( ::Window aRoot ) const; + static void DeInitRandR(); + void processRandREvent( XEvent* ); + + void doDestruct(); + void addXineramaScreenUnique( int i, long i_nX, long i_nY, long i_nWidth, long i_nHeight ); + Time GetEventTimeImpl( bool bAlwaysReget = false ) const; +public: + static bool BestOpenGLVisual(Display* pDisplay, int nScreen, XVisualInfo& rVI); + static bool BestVisual(Display *pDisp, int nScreen, XVisualInfo &rVI); + + SalDisplay( Display* pDisp ); + + virtual ~SalDisplay() override; + + void Init(); + +#ifdef DBG_UTIL + void PrintInfo() const; + void DbgPrintDisplayEvent(const char *pComment, XEvent *pEvent) const; +#endif + + void Beep() const; + + void ModifierMapping(); + void SimulateKeyPress( sal_uInt16 nKeyCode ); + KeyIndicatorState GetIndicatorState() const; + OUString GetKeyNameFromKeySym( KeySym keysym ) const; + OUString GetKeyName( sal_uInt16 nKeyCode ) const; + sal_uInt16 GetKeyCode( KeySym keysym, char*pcPrintable ) const; + KeySym GetKeySym( XKeyEvent *pEvent, + char *pPrintable, + int *pLen, + KeySym *pUnmodifiedKeySym, + Status *pStatus, + XIC = nullptr ) const; + + Cursor GetPointer( PointerStyle ePointerStyle ); + int CaptureMouse( SalFrame *pCapture ); + + ScreenData* initScreen( SalX11Screen nXScreen ) const; + const ScreenData& getDataForScreen( SalX11Screen nXScreen ) const + { + if( nXScreen.getXScreen() >= m_aScreens.size() ) + return m_aInvalidScreenData; + if( ! m_aScreens[nXScreen.getXScreen()].m_bInit ) + initScreen( nXScreen ); + return m_aScreens[nXScreen.getXScreen()]; + } + + ::Window GetDrawable( SalX11Screen nXScreen ) const { return getDataForScreen( nXScreen ).m_aRefWindow; } + Display *GetDisplay() const { return pDisp_; } + const SalX11Screen& GetDefaultXScreen() const { return m_nXDefaultScreen; } + const Size& GetScreenSize( SalX11Screen nXScreen ) const { return getDataForScreen( nXScreen ).m_aSize; } + srv_vendor_t GetServerVendor() const { return meServerVendor; } + bool IsDisplay() const { return !!pXLib_; } + GC GetCopyGC( SalX11Screen nXScreen ) const { return getDataForScreen(nXScreen).m_aCopyGC; } + Pixmap GetInvert50( SalX11Screen nXScreen ) const { return getDataForScreen(nXScreen).m_hInvert50; } + const SalColormap& GetColormap( SalX11Screen nXScreen ) const { return getDataForScreen(nXScreen).m_aColormap; } + const SalVisual& GetVisual( SalX11Screen nXScreen ) const { return getDataForScreen(nXScreen).m_aVisual; } + RenderEntryMap& GetRenderEntries( SalX11Screen nXScreen ) const { return getDataForScreen(nXScreen).m_aRenderData; } + const Pair &GetResolution() const { return aResolution_; } + sal_uLong GetMaxRequestSize() const { return nMaxRequestSize_; } + Time GetLastUserEventTime() const { return GetEventTimeImpl(); } + // this is an equivalent of gdk_x11_get_server_time() + Time GetX11ServerTime() const { return GetEventTimeImpl( true ); } + + bool XIfEventWithTimeout( XEvent*, XPointer, X_if_predicate ) const; + SalXLib* GetXLib() const { return pXLib_; } + + SalI18N_InputMethod* GetInputMethod() const { return pXLib_->GetInputMethod(); } + SalI18N_KeyboardExtension* GetKbdExtension() const { return mpKbdExtension; } + void SetKbdExtension(SalI18N_KeyboardExtension *pKbdExtension) + { mpKbdExtension = pKbdExtension; } + ::vcl_sal::WMAdaptor* getWMAdaptor() const { return m_pWMAdaptor.get(); } + bool IsXinerama() const { return m_bXinerama; } + const std::vector< tools::Rectangle >& GetXineramaScreens() const { return m_aXineramaScreens; } + ::Window GetRootWindow( SalX11Screen nXScreen ) const + { return getDataForScreen( nXScreen ).m_aRoot; } + unsigned int GetXScreenCount() const { return m_aScreens.size(); } + + const SalFrameSet& getFrames() const { return m_aFrames; } + + std::list< SalObject* >& getSalObjects() { return m_aSalObjects; } +}; + +inline Display *SalColormap::GetXDisplay() const +{ return m_pDisplay->GetDisplay(); } + +class SalX11Display final : public SalDisplay +{ +public: + SalX11Display( Display* pDisp ); + virtual ~SalX11Display() override; + + virtual bool Dispatch( XEvent *pEvent ) override; + virtual void Yield(); + virtual void TriggerUserEventProcessing() override; + + bool IsEvent(); + void SetupInput(); +}; + +namespace vcl_sal { + // get foreign key names + OUString getKeysymReplacementName( + const OUString& pLang, + KeySym nSymbol ); + + inline SalDisplay *getSalDisplay(GenericUnixSalData const * data) + { + assert(data != nullptr); + assert(data->GetType() != SAL_DATA_GTK3); + return static_cast<SalDisplay *>(data->GetDisplay()); + } +} + +#endif // INCLUDED_VCL_INC_UNX_SALDISP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h new file mode 100644 index 000000000..4bc756a01 --- /dev/null +++ b/vcl/inc/unx/salframe.h @@ -0,0 +1,270 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_SALFRAME_H +#define INCLUDED_VCL_INC_UNX_SALFRAME_H + +#include <X11/Xlib.h> + +#include <unx/saltype.h> +#include <unx/saldisp.hxx> +#include <unx/screensaverinhibitor.hxx> +#include <unx/nativewindowhandleprovider.hxx> +#include <salframe.hxx> +#include <salwtype.hxx> +#include <salinst.hxx> + +#include <vcl/ptrstyle.hxx> +#include <vcl/sysdata.hxx> +#include <vcl/timer.hxx> +#include <vclpluginapi.h> + +#include <list> + +class X11SalGraphics; +class SalI18N_InputContext; + +namespace vcl_sal { class WMAdaptor; class NetWMAdaptor; class GnomeWMAdaptor; } + +// X11SalFrame +#define SHOWSTATE_UNKNOWN -1 +#define SHOWSTATE_MINIMIZED 0 +#define SHOWSTATE_NORMAL 1 +#define SHOWSTATE_HIDDEN 2 + +enum class WMWindowType +{ + Normal, + ModelessDialogue, + Utility, + Splash, + Toolbar, + Dock +}; + +class X11SalFrame final : public SalFrame, public NativeWindowHandleProvider +{ + friend class vcl_sal::WMAdaptor; + friend class vcl_sal::NetWMAdaptor; + friend class vcl_sal::GnomeWMAdaptor; + + X11SalFrame* mpParent; // pointer to parent frame + // which should never obscure this frame + bool mbTransientForRoot; + std::list< X11SalFrame* > maChildren; // List of child frames + + SalDisplay *pDisplay_; + SalX11Screen m_nXScreen; + ::Window mhWindow; + ::Window mhShellWindow; + ::Window mhForeignParent; + // window to fall back to when no longer in fullscreen mode + ::Window mhStackingWindow; + // window to listen for CirculateNotify events + + Cursor hCursor_; + int nCaptured_; // is captured + + std::unique_ptr<X11SalGraphics> pGraphics_; // current frame graphics + std::unique_ptr<X11SalGraphics> pFreeGraphics_; // first free frame graphics + + bool mbSendExtKeyModChange; + ModKeyFlags mnExtKeyMod; + + int nShowState_; // show state + int nWidth_; // client width + int nHeight_; // client height + tools::Rectangle maRestorePosSize; + SalFrameStyleFlags nStyle_; + SalExtStyle mnExtStyle; + bool bAlwaysOnTop_; + bool bViewable_; + bool bMapped_; + bool bDefaultPosition_; // client is centered initially + bool m_bXEmbed; + int nVisibility_; + int m_nWorkArea; + bool m_bSetFocusOnMap; + + ScreenSaverInhibitor maScreenSaverInhibitor; + tools::Rectangle maPaintRegion; + + Timer maAlwaysOnTopRaiseTimer; + + // data for WMAdaptor + WMWindowType meWindowType; + bool mbMaximizedVert; + bool mbMaximizedHorz; + bool mbShaded; + bool mbFullScreen; + + // icon id + int mnIconID; + + OUString m_aTitle; + + OUString m_sWMClass; + + SystemEnvData maSystemChildData; + + std::unique_ptr<SalI18N_InputContext> mpInputContext; + Bool mbInputFocus; + + std::vector<XRectangle> m_vClipRectangles; + + bool mPendingSizeEvent; + + void GetPosSize( tools::Rectangle &rPosSize ); + void SetSize ( const Size &rSize ); + void Center(); + void SetPosSize( const tools::Rectangle &rPosSize ); + void Minimize(); + void Maximize(); + void Restore(); + + void RestackChildren( ::Window* pTopLevelWindows, int nTopLevelWindows ); + void RestackChildren(); + + bool HandleKeyEvent ( XKeyEvent *pEvent ); + bool HandleMouseEvent ( XEvent *pEvent ); + bool HandleFocusEvent ( XFocusChangeEvent const *pEvent ); + bool HandleExposeEvent ( XEvent const *pEvent ); + bool HandleSizeEvent ( XConfigureEvent *pEvent ); + bool HandleStateEvent ( XPropertyEvent const *pEvent ); + bool HandleReparentEvent ( XReparentEvent *pEvent ); + bool HandleClientMessage ( XClientMessageEvent*pEvent ); + + DECL_LINK( HandleAlwaysOnTopRaise, Timer*, void ); + + void createNewWindow( ::Window aParent, SalX11Screen nXScreen = SalX11Screen( -1 ) ); + void updateScreenNumber(); + + void setXEmbedInfo(); + void askForXEmbedFocus( sal_Int32 i_nTimeCode ); + + void updateWMClass(); +public: + X11SalFrame( SalFrame* pParent, SalFrameStyleFlags nSalFrameStyle, SystemParentData const * pSystemParent = nullptr ); + virtual ~X11SalFrame() override; + + bool Dispatch( XEvent *pEvent ); + void Init( SalFrameStyleFlags nSalFrameStyle, SalX11Screen nScreen, + SystemParentData const * pParentData, bool bUseGeometry = false ); + + SalDisplay* GetDisplay() const + { + return pDisplay_; + } + Display *GetXDisplay() const + { + return pDisplay_->GetDisplay(); + } + const SalX11Screen& GetScreenNumber() const { return m_nXScreen; } + ::Window GetWindow() const { return mhWindow; } + ::Window GetShellWindow() const { return mhShellWindow; } + ::Window GetForeignParent() const { return mhForeignParent; } + ::Window GetStackingWindow() const { return mhStackingWindow; } + void Close() const { CallCallback( SalEvent::Close, nullptr ); } + SalFrameStyleFlags GetStyle() const { return nStyle_; } + + Cursor GetCursor() const { return hCursor_; } + bool IsCaptured() const { return nCaptured_ == 1; } +#if !defined(__synchronous_extinput__) + void HandleExtTextEvent (XClientMessageEvent const *pEvent); +#endif + bool IsOverrideRedirect() const; + bool IsChildWindow() const { return bool(nStyle_ & (SalFrameStyleFlags::PLUG|SalFrameStyleFlags::SYSTEMCHILD)); } + bool IsSysChildWindow() const { return bool(nStyle_ & SalFrameStyleFlags::SYSTEMCHILD); } + bool IsFloatGrabWindow() const; + SalI18N_InputContext* getInputContext() const { return mpInputContext.get(); } + bool hasFocus() const { return mbInputFocus; } + + void beginUnicodeSequence(); + bool appendUnicodeSequence( sal_Unicode ); + bool endUnicodeSequence(); + + virtual SalGraphics* AcquireGraphics() override; + virtual void ReleaseGraphics( SalGraphics* pGraphics ) override; + + // call with true to clear graphics (setting None as drawable) + // call with false to setup graphics with window (GetWindow()) + virtual void updateGraphics( bool bClear ); + + virtual bool PostEvent(std::unique_ptr<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 nMonitor ) 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; + using SalFrame::Flush; + virtual void Flush() 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 SetScreenNumber( unsigned int ) override; + virtual void SetApplicationID( const OUString &rWMClass ) override; + + // shaped system windows + // set clip region to none (-> rectangular windows, normal state) + virtual void ResetClipRegion() override; + // start setting the clipregion consisting of nRects rectangles + virtual void BeginSetClipRegion( sal_uInt32 nRects ) override; + // add a rectangle to the clip region + virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) override; + // done setting up the clipregion + virtual void EndSetClipRegion() override; + + virtual sal_uIntPtr GetNativeWindowHandle() override; + + /// @internal + void setPendingSizeEvent(); +}; + +#endif // INCLUDED_VCL_INC_UNX_SALFRAME_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h new file mode 100644 index 000000000..4216b703c --- /dev/null +++ b/vcl/inc/unx/salgdi.h @@ -0,0 +1,340 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_SALGDI_H +#define INCLUDED_VCL_INC_UNX_SALGDI_H + +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/extensions/Xrender.h> + +#include <vcl/salgtype.hxx> +#include <vcl/vclenum.hxx> + +#include <unx/saldisp.hxx> +#include <salgdi.hxx> +#include <salgeom.hxx> +#include <sallayout.hxx> +#include <vclpluginapi.h> +#include <ControlCacheKey.hxx> + +#include "saltype.h" +#include "saldisp.hxx" + +#include <memory> + +/* From <X11/Intrinsic.h> */ +typedef unsigned long Pixel; + +class FontAttributes; +class FontSelectPattern; +class SalBitmap; +class SalColormap; +class SalDisplay; +class SalFrame; +class X11Pixmap; +class X11SalVirtualDevice; +class X11SalGraphicsImpl; +class X11OpenGLSalGraphicsImpl; +class X11OpenGLSalVirtualDevice; +class X11SkiaSalVirtualDevice; +class FreetypeFont; +class ImplLayoutArgs; +class PhysicalFontCollection; +class PhysicalFontFace; +class SalGraphicsImpl; +class TextRenderImpl; + +namespace basegfx { + class B2DTrapezoid; +} + +class X11SalGraphics final : public SalGraphics +{ + friend class X11SalGraphicsImpl; + friend class X11OpenGLSalGraphicsImpl; + friend class X11CairoTextRender; + +public: + X11SalGraphics(); + virtual ~X11SalGraphics() COVERITY_NOEXCEPT_FALSE override; + + void Init( SalFrame *pFrame, Drawable aDrawable, SalX11Screen nXScreen ); + void Init( X11SalVirtualDevice *pVirtualDevice, SalColormap* pColormap = nullptr, bool bDeleteColormap = false ); + void Init( X11OpenGLSalVirtualDevice *pVirtualDevice ); + void Init( X11SkiaSalVirtualDevice *pVirtualDevice ); + void DeInit(); + + virtual SalGraphicsImpl* GetImpl() const override; + inline const SalDisplay* GetDisplay() const; + inline Display* GetXDisplay() const; + inline const SalVisual& GetVisual() const; + SalGeometryProvider* GetGeometryProvider() const; + Drawable GetDrawable() const { return hDrawable_; } + void SetDrawable( Drawable d, SalX11Screen nXScreen ); + XRenderPictFormat* GetXRenderFormat() const; + void SetXRenderFormat( XRenderPictFormat* pXRenderFormat ) { m_pXRenderFormat = pXRenderFormat; } + const SalColormap& GetColormap() const { return *m_pColormap; } + + using SalGraphics::GetPixel; + inline Pixel GetPixel( Color nColor ) const; + + const SalX11Screen& GetScreenNumber() const { return m_nXScreen; } + + // override all pure virtual methods + virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) override; + virtual sal_uInt16 GetBitCount() const override; + virtual long GetGraphicsWidth() const override; + + virtual void ResetClipRegion() override; + virtual bool setClipRegion( const vcl::Region& ) override; + + virtual void SetLineColor() override; + virtual void SetLineColor( Color nColor ) override; + virtual void SetFillColor() override; + + virtual void SetFillColor( Color nColor ) override; + + virtual void SetXORMode( bool bSet, bool ) override; + + virtual void SetROPLineColor( SalROPColor nROPColor ) override; + virtual void SetROPFillColor( SalROPColor nROPColor ) override; + + virtual void SetTextColor( Color nColor ) override; + virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) override; + virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override; + virtual 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*, + const sal_GlyphId* pGlyphIDs, + const sal_uInt8* pEncoding, + sal_Int32* pWidths, + int nGlyphs, + FontSubsetInfo& rInfo ) 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 std::unique_ptr<GenericSalLayout> + GetTextLayout(int nFallbackLevel) override; + virtual void DrawTextLayout( const GenericSalLayout& ) override; + + virtual bool supportsOperation( OutDevSupportType ) const override; + virtual void drawPixel( long nX, long nY ) override; + virtual void drawPixel( long nX, long nY, Color nColor ) 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::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolyPolygon&, + double fTransparency) override; + + virtual bool drawPolyLine( + const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolygon&, + double fTransparency, + double fLineWidth, + const std::vector< double >* pStroke, // MM01 + basegfx::B2DLineJoin, + css::drawing::LineCap, + double fMiterMinimumAngle, + bool bPixelSnapHairline) override; + + virtual bool drawGradient( const tools::PolyPolygon&, const Gradient& ) override; + +#if 1 // TODO: remove these obsolete methods + 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; +#endif + + 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& rMaskBitmap ) override; + + virtual void drawMask( + const SalTwoRect& rPosAry, + const SalBitmap& rSalBitmap, + Color nMaskColor ) override; + + virtual std::shared_ptr<SalBitmap> getBitmap( long nX, long nY, long nWidth, long nHeight ) override; + virtual Color 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_uInt32 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; + + virtual 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 SystemGraphicsData GetGraphicsData() 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; + + void clipRegion(cairo_t* cr); +#endif // ENABLE_CAIRO_CANVAS + + /* use to handle GraphicsExpose/NoExpose after XCopyArea & friends + * if pFrame is not NULL, corresponding Paint events are generated + * and dispatched to pFrame + * + * it is imperative to eat up graphics exposes even in case you don't need + * them because the next one using XCopyArea can depend on them + */ + void YieldGraphicsExpose(); + + cairo_t* getCairoContext(); + static void releaseCairoContext(cairo_t* cr); + + +private: + using SalGraphics::SetClipRegion; + void SetClipRegion( GC pGC, Region pXReg = nullptr ) const; + bool GetDitherPixmap ( Color nColor ); + + using SalGraphics::DrawBitmap; + + void freeResources(); + + SalFrame* m_pFrame; // the SalFrame which created this Graphics or NULL + SalVirtualDevice* m_pVDev; // the SalVirtualDevice which created this Graphics or NULL + + const SalColormap* m_pColormap; + std::unique_ptr<SalColormap> m_pDeleteColormap; + Drawable hDrawable_; // use + SalX11Screen m_nXScreen; + mutable XRenderPictFormat* m_pXRenderFormat; + XID m_aXRenderPicture; + + Region mpClipRegion; +#if ENABLE_CAIRO_CANVAS + vcl::Region maClipRegion; + Color mnPenColor; + Color mnFillColor; +#endif // ENABLE_CAIRO_CANVAS + + Pixel nTextPixel_; + + Pixmap hBrush_; // Dither + + bool bWindow_ : 1; // is Window + bool bVirDev_ : 1; // is VirDev + bool m_bOpenGL : 1; + bool m_bSkia : 1; + +private: + std::unique_ptr<SalGraphicsImpl> mxImpl; + std::unique_ptr<TextRenderImpl> mxTextRenderImpl; + +}; + +inline const SalDisplay *X11SalGraphics::GetDisplay() const +{ return GetColormap().GetDisplay(); } + +inline const SalVisual& X11SalGraphics::GetVisual() const +{ return GetColormap().GetVisual(); } + +inline Display *X11SalGraphics::GetXDisplay() const +{ return GetColormap().GetXDisplay(); } + +inline Pixel X11SalGraphics::GetPixel( Color nColor ) const +{ return GetColormap().GetPixel( nColor ); } + +#endif // INCLUDED_VCL_INC_UNX_SALGDI_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/salinst.h b/vcl/inc/unx/salinst.h new file mode 100644 index 000000000..89c9a8ae0 --- /dev/null +++ b/vcl/inc/unx/salinst.h @@ -0,0 +1,95 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_SALINST_H +#define INCLUDED_VCL_INC_UNX_SALINST_H + +#include <vclpluginapi.h> +#include <salinst.hxx> +#include <unx/geninst.h> + +#include <X11/X.h> + +namespace com::sun::star::datatransfer { + namespace clipboard { class XClipboard; } +} + +class SalXLib; +class X11SalGraphics; +class SalX11Display; + +class X11SalInstance final : public SalGenericInstance +{ +private: + std::unordered_map< Atom, css::uno::Reference< css::datatransfer::clipboard::XClipboard > > m_aInstances; + + SalXLib *mpXLib; + + virtual SalX11Display* CreateDisplay() const; + +public: + explicit X11SalInstance(std::unique_ptr<SalYieldMutex> pMutex); + virtual ~X11SalInstance() override; + + virtual SalFrame* CreateChildFrame( SystemParentData* pParent, SalFrameStyleFlags nStyle ) override; + virtual SalFrame* CreateFrame( SalFrame* 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; + + /// Gtk vclplug needs to pass GtkSalGraphics to X11SalVirtualDevice, so create it, and pass as pNewGraphics. + static std::unique_ptr<SalVirtualDevice> CreateX11VirtualDevice(SalGraphics const * pGraphics, long &nDX, long &nDY, + DeviceFormat eFormat, const SystemGraphicsData* pData, std::unique_ptr<X11SalGraphics> pNewGraphics); + + virtual std::unique_ptr<SalVirtualDevice> + CreateVirtualDevice( SalGraphics* pGraphics, + long &nDX, long &nDY, + DeviceFormat eFormat, const SystemGraphicsData *pData = nullptr ) override; + virtual void PostPrintersChanged() override; + virtual std::unique_ptr<GenPspGraphics> CreatePrintGraphics() override; + + virtual SalTimer* CreateSalTimer() override; + virtual SalSystem* CreateSalSystem() override; + virtual std::shared_ptr<SalBitmap> CreateSalBitmap() override; + virtual std::unique_ptr<SalSession> CreateSalSession() override; + virtual OpenGLContext* CreateOpenGLContext() override; + + virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents) override; + virtual bool AnyInput( VclInputFlags nType ) override; + virtual bool IsMainThread() const override { return true; } + + virtual OUString GetConnectionIdentifier() override; + void SetLib( SalXLib *pXLib ) { mpXLib = pXLib; } + + virtual void AfterAppInit() override; + + std::shared_ptr<vcl::BackendCapabilities> GetBackendCapabilities() override; + + // dtrans implementation + virtual css::uno::Reference< css::uno::XInterface > + CreateClipboard( const css::uno::Sequence< css::uno::Any >& i_rArguments ) override; + virtual css::uno::Reference< css::uno::XInterface > CreateDragSource() override; + virtual css::uno::Reference< css::uno::XInterface > CreateDropTarget() override; + virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) override; +}; + +#endif // INCLUDED_VCL_INC_UNX_SALINST_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/salobj.h b/vcl/inc/unx/salobj.h new file mode 100644 index 000000000..52e4b8f2b --- /dev/null +++ b/vcl/inc/unx/salobj.h @@ -0,0 +1,91 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_SALOBJ_H +#define INCLUDED_VCL_INC_UNX_SALOBJ_H + +#include <X11/Xlib.h> + +#include <salobj.hxx> +#include <vcl/sysdata.hxx> +#include <vclpluginapi.h> +#include <memory> + +class SalClipRegion +{ + +public: + + SalClipRegion(); + ~SalClipRegion(); + + void BeginSetClipRegion( sal_uInt32 nRects ); + void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ); + + XRectangle *EndSetClipRegion() { + return ClipRectangleList.get(); } + void ResetClipRegion() { + numClipRectangles = 0; } + int GetRectangleCount() const { + return numClipRectangles; } + +private: + + std::unique_ptr<XRectangle[]> + ClipRectangleList; + int numClipRectangles; + int maxClipRectangles; +}; + +class X11SalObject final : public SalObject +{ +public: + SystemEnvData maSystemChildData; + SalFrame* mpParent; + ::Window maParentWin; + ::Window maPrimary; + ::Window maSecondary; + Colormap maColormap; + SalClipRegion maClipRegion; + bool mbVisible; + + static VCL_DLLPUBLIC bool Dispatch( XEvent* pEvent ); + static VCL_DLLPUBLIC X11SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow ); + + X11SalObject(); + virtual ~X11SalObject() override; + + // override all pure virtual methods + virtual void ResetClipRegion() override; + virtual void BeginSetClipRegion( sal_uInt32 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 GrabFocus() override; + + virtual void SetLeaveEnterBackgrounds(const css::uno::Sequence<css::uno::Any>& rLeaveArgs, const css::uno::Sequence<css::uno::Any>& rEnterArgs) override; + + virtual const SystemEnvData* GetSystemData() const override; +}; + +#endif // INCLUDED_VCL_INC_UNX_SALOBJ_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/saltimer.h b/vcl/inc/unx/saltimer.h new file mode 100644 index 000000000..c8da2fcac --- /dev/null +++ b/vcl/inc/unx/saltimer.h @@ -0,0 +1,40 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_SALTIMER_H +#define INCLUDED_VCL_INC_UNX_SALTIMER_H + +#include <saltimer.hxx> + +class SalXLib; +class X11SalTimer final : public SalTimer +{ + SalXLib *mpXLib; +public: + X11SalTimer( SalXLib *pXLib ) : mpXLib( pXLib ) {} + virtual ~X11SalTimer() override; + + // override all pure virtual methods + void Start( sal_uInt64 nMS ) override; + void Stop() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/saltype.h b/vcl/inc/unx/saltype.h new file mode 100644 index 000000000..e62bdd25e --- /dev/null +++ b/vcl/inc/unx/saltype.h @@ -0,0 +1,26 @@ +/* -*- 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/. + */ +#ifndef INCLUDED_VCL_INC_UNX_SALTYPE_H +#define INCLUDED_VCL_INC_UNX_SALTYPE_H + +// an X11 screen index - this unpleasant construct is to allow +// us to cleanly separate the 'DisplayScreen' concept - as used +// in the public facing API, from X's idea of screen indices. +// Both of these are plain unsigned integers called 'screen' +class SalX11Screen { + unsigned int mnXScreen; +public: + explicit SalX11Screen(unsigned int nXScreen) : mnXScreen( nXScreen ) {} + unsigned int getXScreen() const { return mnXScreen; } + bool operator==(const SalX11Screen &rOther) const { return rOther.mnXScreen == mnXScreen; } + bool operator!=(const SalX11Screen &rOther) const { return rOther.mnXScreen != mnXScreen; } +}; + +#endif // INCLUDED_VCL_INC_UNX_SALTYPE_H +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/salunx.h b/vcl/inc/unx/salunx.h new file mode 100644 index 000000000..b70f45769 --- /dev/null +++ b/vcl/inc/unx/salunx.h @@ -0,0 +1,28 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_SALUNX_H +#define INCLUDED_VCL_INC_UNX_SALUNX_H + +inline long Divide( long nDividend, long nDivisor ) +{ return (nDividend + nDivisor/2) / nDivisor; } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/salunxtime.h b/vcl/inc/unx/salunxtime.h new file mode 100644 index 000000000..13f8ecc35 --- /dev/null +++ b/vcl/inc/unx/salunxtime.h @@ -0,0 +1,80 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_SALUNXTIME_H +#define INCLUDED_VCL_INC_UNX_SALUNXTIME_H + +#if defined LINUX || defined FREEBSD || \ + defined NETBSD || defined OPENBSD || defined DRAGONFLY +#include <sys/time.h> +#elif defined AIX +#include <time.h> +#include <sys/time.h> +#include <strings.h> +#endif +#include <sal/types.h> + +inline bool operator >= ( const timeval &t1, const timeval &t2 ) +{ + if( t1.tv_sec == t2.tv_sec ) + return t1.tv_usec >= t2.tv_usec; + return t1.tv_sec > t2.tv_sec; +} + +inline bool operator > ( const timeval &t1, const timeval &t2 ) +{ + if( t1.tv_sec == t2.tv_sec ) + return t1.tv_usec > t2.tv_usec; + return t1.tv_sec > t2.tv_sec; +} + +inline timeval &operator -= ( timeval &t1, const timeval &t2 ) +{ + if( t1.tv_usec < t2.tv_usec ) + { + t1.tv_sec--; + t1.tv_usec += 1000000; + } + t1.tv_sec -= t2.tv_sec; + t1.tv_usec -= t2.tv_usec; + return t1; +} + +inline timeval &operator += ( timeval &t1, sal_uIntPtr t2 ) +{ + t1.tv_sec += t2 / 1000; + t1.tv_usec += (t2 % 1000) * 1000; + if( t1.tv_usec > 1000000 ) + { + t1.tv_sec++; + t1.tv_usec -= 1000000; + } + return t1; +} + +inline timeval operator - ( const timeval &t1, const timeval &t2 ) +{ + timeval t0 = t1; + t0 -= t2; + return t0; +} + +#endif // INCLUDED_VCL_INC_UNX_SALUNXTIME_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/salvd.h b/vcl/inc/unx/salvd.h new file mode 100644 index 000000000..b9874a3eb --- /dev/null +++ b/vcl/inc/unx/salvd.h @@ -0,0 +1,79 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_SALVD_H +#define INCLUDED_VCL_INC_UNX_SALVD_H + +#include <X11/Xlib.h> + +#include <unx/saldisp.hxx> +#include <unx/saltype.h> +#include <salvd.hxx> + +#include <memory> + +class SalDisplay; +class X11SalGraphics; + +class X11SalVirtualDevice : public SalVirtualDevice +{ + SalDisplay *pDisplay_; + std::unique_ptr<X11SalGraphics> pGraphics_; + + Pixmap hDrawable_; + SalX11Screen m_nXScreen; + + int nDX_; + int nDY_; + sal_uInt16 nDepth_; + bool bGraphics_; // is Graphics used + bool bExternPixmap_; + +public: + X11SalVirtualDevice(SalGraphics const *pGraphics, long &nDX, long &nDY, + DeviceFormat eFormat, const SystemGraphicsData *pData, std::unique_ptr<X11SalGraphics> pNewGraphics); + + virtual ~X11SalVirtualDevice() override; + + Display *GetXDisplay() const + { + return pDisplay_->GetDisplay(); + } + SalDisplay *GetDisplay() const + { + return pDisplay_; + } + Pixmap GetDrawable() const { return hDrawable_; } + sal_uInt16 GetDepth() const { return nDepth_; } + const SalX11Screen& GetXScreenNumber() const { return m_nXScreen; } + + virtual SalGraphics* AcquireGraphics() override; + virtual void ReleaseGraphics( SalGraphics* pGraphics ) override; + + /// Set new size, without saving the old contents + virtual bool SetSize( long nNewDX, long nNewDY ) override; + + // SalGeometryProvider + virtual long GetWidth() const override { return nDX_; } + virtual long GetHeight() const override { return nDY_; } +}; + +#endif // INCLUDED_VCL_INC_UNX_SALVD_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/screensaverinhibitor.hxx b/vcl/inc/unx/screensaverinhibitor.hxx new file mode 100644 index 000000000..58c00e7fa --- /dev/null +++ b/vcl/inc/unx/screensaverinhibitor.hxx @@ -0,0 +1,71 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_UNX_SCREENSAVERINHIBITOR_HXX +#define INCLUDED_VCL_INC_UNX_SCREENSAVERINHIBITOR_HXX + +#include <X11/Xlib.h> +#include <X11/Xmd.h> + +#include <rtl/ustring.hxx> +#include <vcl/dllapi.h> + +#include <optional> + +class VCL_PLUGIN_PUBLIC ScreenSaverInhibitor +{ +public: + void inhibit( bool bInhibit, const OUString& sReason, + bool bIsX11, const std::optional<unsigned int>& xid, std::optional<Display*> pDisplay ); + +private: + // These are all used as guint, however this header may be included + // in kde/tde/etc backends, where we would ideally avoid having + // any glib dependencies, hence the direct use of unsigned int. + std::optional<unsigned int> mnFDOCookie; // FDO ScreenSaver Inhibit + std::optional<unsigned int> mnFDOPMCookie; // FDO PowerManagement Inhibit + std::optional<unsigned int> mnGSMCookie; + std::optional<unsigned int> mnMSMCookie; + + std::optional<int> mnXScreenSaverTimeout; + +#if !defined(__sun) && !defined(AIX) + BOOL mbDPMSWasEnabled; + CARD16 mnDPMSStandbyTimeout; + CARD16 mnDPMSSuspendTimeout; + CARD16 mnDPMSOffTimeout; +#endif + + // There are a bunch of different dbus based inhibition APIs. Some call + // themselves ScreenSaver inhibition, some are PowerManagement inhibition, + // but they appear to have the same effect. There doesn't appear to be one + // all encompassing standard, hence we should just try all of them. + // + // The current APIs we have: (note: the list of supported environments is incomplete) + // FDO: org.freedesktop.ScreenSaver::Inhibit - appears to be supported only by KDE? + // FDOPM: org.freedesktop.PowerManagement.Inhibit::Inhibit - XFCE, (KDE) ? + // (KDE: doesn't inhibit screensaver, but does inhibit PowerManagement) + // GSM: org.gnome.SessionManager::Inhibit - gnome 3 + // MSM: org.mate.Sessionmanager::Inhibit - Mate <= 1.10, is identical to GSM + // (This is replaced by the GSM interface from Mate 1.12 onwards) + // + // Note: the Uninhibit call has different spelling in FDO (UnInhibit) vs GSM (Uninhibit) + void inhibitFDO( bool bInhibit, const char* appname, const char* reason ); + void inhibitFDOPM( bool bInhibit, const char* appname, const char* reason ); + void inhibitGSM( bool bInhibit, const char* appname, const char* reason, const unsigned int xid ); + void inhibitMSM( bool bInhibit, const char* appname, const char* reason, const unsigned int xid ); + + void inhibitXScreenSaver( bool bInhibit, Display* pDisplay ); + static void inhibitXAutoLock( bool bInhibit, Display* pDisplay ); + void inhibitDPMS( bool bInhibit, Display* pDisplay ); +}; + +#endif // INCLUDED_VCL_INC_UNX_SCREENSAVERINHIBITOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/sm.hxx b/vcl/inc/unx/sm.hxx new file mode 100644 index 000000000..164fd4f6d --- /dev/null +++ b/vcl/inc/unx/sm.hxx @@ -0,0 +1,81 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_VCL_INC_UNX_SM_HXX +#define INCLUDED_VCL_INC_UNX_SM_HXX + +#include <sal/config.h> + +#include <X11/SM/SMlib.h> + +#include <tools/link.hxx> +#include <rtl/ustring.hxx> +#include <memory> + +#include <vclpluginapi.h> + +class ICEConnectionObserver; +class SalSession; + +class SessionManagerClient +{ + static SalSession * m_pSession; + static std::unique_ptr< ICEConnectionObserver > m_xICEConnectionObserver; + static SmcConn m_pSmcConnection; + static OString m_aClientID; + static OString m_aTimeID; + static OString m_aClientTimeID; + static bool m_bDocSaveDone; + + static void SaveYourselfProc( SmcConn connection, + SmPointer client_data, + int save_type, + Bool shutdown, + int interact_style, + Bool fast ); + static void DieProc( SmcConn connection, + SmPointer client_data ); + static void SaveCompleteProc( SmcConn connection, + SmPointer client_data ); + static void ShutdownCanceledProc( SmcConn connection, + SmPointer client_data ); + static void InteractProc( SmcConn connection, + SmPointer clientData ); + + static OString getPreviousSessionID(); + + DECL_STATIC_LINK( SessionManagerClient, ShutDownHdl, void*, void ); + DECL_STATIC_LINK( SessionManagerClient, ShutDownCancelHdl, void*, void ); + DECL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void*, void ); + DECL_STATIC_LINK( SessionManagerClient, InteractionHdl, void*, void ); +public: + static void open(SalSession * pSession); + static void close(); + + static bool checkDocumentsSaved(); + static bool queryInteraction(); + static void saveDone(); + static void interactionDone( bool bCancelShutdown ); + + static OUString getExecName(); + static const OString& getSessionID(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/svsys.h b/vcl/inc/unx/svsys.h new file mode 100644 index 000000000..174a1ed74 --- /dev/null +++ b/vcl/inc/unx/svsys.h @@ -0,0 +1,29 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_VCL_INC_UNX_SVSYS_H +#define INCLUDED_VCL_INC_UNX_SVSYS_H + +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/extensions/Xrender.h> +#include <X11/XKBlib.h> + +#endif // INCLUDED_VCL_INC_UNX_SVSYS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/wmadaptor.hxx b/vcl/inc/unx/wmadaptor.hxx new file mode 100644 index 000000000..1739053a0 --- /dev/null +++ b/vcl/inc/unx/wmadaptor.hxx @@ -0,0 +1,302 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_WMADAPTOR_HXX +#define INCLUDED_VCL_INC_UNX_WMADAPTOR_HXX + +#include <rtl/ustring.hxx> +#include <tools/gen.hxx> + +#include <X11/Xlib.h> + +#include <vclpluginapi.h> +#include "salframe.h" +#include <vector> + +class SalDisplay; +class X11SalFrame; + +namespace vcl_sal { + +class WMAdaptor +{ +public: + enum WMAtom { + // atoms for types + UTF8_STRING, + + // atoms for extended WM hints + NET_ACTIVE_WINDOW, + NET_SUPPORTED, + NET_SUPPORTING_WM_CHECK, + NET_WM_NAME, + NET_WM_DESKTOP, + NET_WM_ICON_NAME, + NET_WM_PID, + NET_WM_PING, + NET_WM_STATE, + NET_WM_STATE_MAXIMIZED_HORZ, + NET_WM_STATE_MAXIMIZED_VERT, + NET_WM_STATE_MODAL, + NET_WM_STATE_SHADED, + NET_WM_STATE_SKIP_PAGER, + NET_WM_STATE_SKIP_TASKBAR, + NET_WM_STATE_STAYS_ON_TOP, + NET_WM_STATE_STICKY, + NET_WM_STATE_FULLSCREEN, + NET_WM_STRUT, + NET_WM_STRUT_PARTIAL, + NET_WM_USER_TIME, + NET_WM_WINDOW_TYPE, + NET_WM_WINDOW_TYPE_DESKTOP, + NET_WM_WINDOW_TYPE_DIALOG, + NET_WM_WINDOW_TYPE_DOCK, + NET_WM_WINDOW_TYPE_MENU, + NET_WM_WINDOW_TYPE_NORMAL, + NET_WM_WINDOW_TYPE_TOOLBAR, + KDE_NET_WM_WINDOW_TYPE_OVERRIDE, + NET_WM_WINDOW_TYPE_SPLASH, + NET_WM_WINDOW_TYPE_UTILITY, + NET_NUMBER_OF_DESKTOPS, + NET_CURRENT_DESKTOP, + NET_WORKAREA, + NET_WM_ICON, + + // atoms for Gnome WM hints + WIN_SUPPORTING_WM_CHECK, + WIN_PROTOCOLS, + WIN_WORKSPACE_COUNT, + WIN_WORKSPACE, + WIN_LAYER, + WIN_STATE, + WIN_HINTS, + WIN_APP_STATE, + WIN_EXPANDED_SIZE, + WIN_ICONS, + WIN_CLIENT_LIST, + + // atoms for general WM hints + WM_STATE, + MOTIF_WM_HINTS, + WM_PROTOCOLS, + WM_DELETE_WINDOW, + WM_TAKE_FOCUS, + WM_CLIENT_LEADER, + WM_COMMAND, + WM_LOCALE_NAME, + WM_TRANSIENT_FOR, + + // special atoms + SAL_QUITEVENT, + SAL_USEREVENT, + SAL_EXTTEXTEVENT, + SAL_GETTIMEEVENT, + VCL_SYSTEM_SETTINGS, + XSETTINGS, + XEMBED, + XEMBED_INFO, + NetAtomMax + }; + + /* + * flags for frame decoration + */ + static const int decoration_Title = 0x00000001; + static const int decoration_Border = 0x00000002; + static const int decoration_Resize = 0x00000004; + static const int decoration_MinimizeBtn = 0x00000008; + static const int decoration_MaximizeBtn = 0x00000010; + static const int decoration_CloseBtn = 0x00000020; + static const int decoration_All = 0x10000000; + +protected: + SalDisplay* m_pSalDisplay; // Display to use + Display* m_pDisplay; // X Display of SalDisplay + OUString m_aWMName; + Atom m_aWMAtoms[ NetAtomMax]; + int m_nDesktops; + bool m_bEqualWorkAreas; + ::std::vector< tools::Rectangle > + m_aWMWorkAreas; + bool m_bEnableAlwaysOnTopWorks; + bool m_bLegacyPartialFullscreen; + int m_nWinGravity; + int m_nInitWinGravity; + bool m_bWMshouldSwitchWorkspace; + bool m_bWMshouldSwitchWorkspaceInit; + + WMAdaptor( SalDisplay * ) +; + void initAtoms(); + bool getNetWmName(); + + /* + * returns whether this instance is useful + * only useful for createWMAdaptor + */ + virtual bool isValid() const; + + bool getWMshouldSwitchWorkspace() const; +public: + virtual ~WMAdaptor(); + + /* + * creates a valid WMAdaptor instance for the SalDisplay + */ + static std::unique_ptr<WMAdaptor> createWMAdaptor( SalDisplay* ); + + /* + * may return an empty string if the window manager could + * not be identified. + */ + const OUString& getWindowManagerName() const + { return m_aWMName; } + + /* + * gets the current work area/desktop number: [0,m_nDesktops[ or -1 if unknown + */ + int getCurrentWorkArea() const; + /* + * gets the workarea the specified window is on (or -1) + */ + int getWindowWorkArea( ::Window aWindow ) const; + /* + * gets the specified workarea + */ + const tools::Rectangle& getWorkArea( int n ) const + { return m_aWMWorkAreas[n]; } + + /* + * attempt to switch the desktop to a certain workarea (ie. virtual desktops) + */ + void switchToWorkArea( int nWorkArea ) const; + + /* + * sets window title + */ + virtual void setWMName( X11SalFrame* pFrame, const OUString& rWMName ) const; + + /* + * set NET_WM_PID + */ + void setPID( X11SalFrame const * pFrame ) const; + + /* + * set WM_CLIENT_MACHINE + */ + void setClientMachine( X11SalFrame const * pFrame ) const; + + void answerPing( X11SalFrame const *, XClientMessageEvent const * ) const; + + /* + * maximizes frame + * maximization can be toggled in either direction + * to get the original position and size + * use maximizeFrame( pFrame, false, false ) + */ + virtual void maximizeFrame( X11SalFrame* pFrame, bool bHorizontal = true, bool bVertical = true ) const; + /* + * start/stop fullscreen mode on a frame + */ + virtual void showFullScreen( X11SalFrame* pFrame, bool bFullScreen ) const; + /* + * tell whether legacy partial full screen handling is necessary + * see #i107249#: NET_WM_STATE_FULLSCREEN is not well defined, but de facto + * modern WM's interpret it the "right" way, namely they make "full screen" + * taking twin view or Xinerama into account and honor the positioning hints + * to see which screen actually was meant to use for fullscreen. + */ + bool isLegacyPartialFullscreen() const + { return m_bLegacyPartialFullscreen; } + /* + * set _NET_WM_USER_TIME property, if NetWM + */ + virtual void setUserTime( X11SalFrame* i_pFrame, long i_nUserTime ) const; + + /* + * tells whether fullscreen mode is supported by WM + */ + bool supportsFullScreen() const { return m_aWMAtoms[ NET_WM_STATE_FULLSCREEN ] != 0; } + + /* + * shade/unshade frame + */ + virtual void shade( X11SalFrame* pFrame, bool bToShaded ) const; + + /* + * set hints what decoration is needed; + * must be called before showing the frame + */ + virtual void setFrameTypeAndDecoration( X11SalFrame* pFrame, WMWindowType eType, int nDecorationFlags, X11SalFrame* pTransientFrame ) const; + + /* + * tells whether there is WM support for splash screens + */ + bool supportsSplash() const { return m_aWMAtoms[ NET_WM_WINDOW_TYPE_SPLASH ] != 0; } + + /* + * enables always on top or equivalent if possible + */ + virtual void enableAlwaysOnTop( X11SalFrame* pFrame, bool bEnable ) const; + + /* + * tells whether enableAlwaysOnTop actually works with this WM + */ + bool isAlwaysOnTopOK() const { return m_bEnableAlwaysOnTopWorks; } + + /* + * handle WM messages (especially WM state changes) + */ + virtual int handlePropertyNotify( X11SalFrame* pFrame, XPropertyEvent* pEvent ) const; + + /* + * called by SalFrame::Show: time to update state properties + */ + virtual void frameIsMapping( X11SalFrame* ) const; + + /* + * gets a WM atom + */ + Atom getAtom( WMAtom eAtom ) const + { return m_aWMAtoms[ eAtom ]; } + + int getPositionWinGravity () const + { return m_nWinGravity; } + int getInitWinGravity() const + { return m_nInitWinGravity; } + + /* + * changes the transient hint of a window to reference frame + * if reference frame is NULL the root window is used instead + */ + void changeReferenceFrame( X11SalFrame* pFrame, X11SalFrame const * pReferenceFrame ) const; + + /* + * Requests the change of active window by sending + * _NET_ACTIVE_WINDOW message to the frame. The frame + * has to be mapped + */ + void activateWindow( X11SalFrame const *pFrame, Time nTimestamp ); +}; + +} // namespace + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11/x11cairotextrender.hxx b/vcl/inc/unx/x11/x11cairotextrender.hxx new file mode 100644 index 000000000..666f09f8c --- /dev/null +++ b/vcl/inc/unx/x11/x11cairotextrender.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 . + */ + +#ifndef INCLUDED_VCL_UNX_GENERIC_GDI_X11CAIROTEXTRENDER_HXX +#define INCLUDED_VCL_UNX_GENERIC_GDI_X11CAIROTEXTRENDER_HXX + +#include <unx/cairotextrender.hxx> +#include <unx/salgdi.h> + +class X11CairoTextRender : public CairoTextRender +{ +protected: + X11SalGraphics& mrParent; + +protected: + size_t GetWidth() const; + size_t GetHeight() const; + +public: + explicit X11CairoTextRender(X11SalGraphics& rParent); + + virtual cairo_t* getCairoContext() override; + virtual void getSurfaceOffset(double& nDX, double& nDY) override; + virtual void clipRegion(cairo_t* cr) override; + virtual void releaseCairoContext(cairo_t* cr) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11/x11gdiimpl.h b/vcl/inc/unx/x11/x11gdiimpl.h new file mode 100644 index 000000000..2e41e87c8 --- /dev/null +++ b/vcl/inc/unx/x11/x11gdiimpl.h @@ -0,0 +1,25 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_UNX_X11_X11GDIIMPL_HXX +#define INCLUDED_VCL_INC_UNX_X11_X11GDIIMPL_HXX + +#include <ControlCacheKey.hxx> + +class ControlCacheKey; + +class X11GraphicsImpl +{ +public: + virtual ~X11GraphicsImpl() {}; +}; + +#endif // INCLUDED_VCL_INC_UNX_X11_X11GDIIMPL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11/x11sys.hxx b/vcl/inc/unx/x11/x11sys.hxx new file mode 100644 index 000000000..dcbe45928 --- /dev/null +++ b/vcl/inc/unx/x11/x11sys.hxx @@ -0,0 +1,44 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_UNX_X11_X11SYS_HXX +#define INCLUDED_VCL_INC_UNX_X11_X11SYS_HXX + +#include <unx/gensys.h> +#include <vclpluginapi.h> + +class X11SalSystem final : public SalGenericSystem +{ +public: + X11SalSystem() {} + virtual ~X11SalSystem() override; + + // override pure virtual methods + virtual unsigned int GetDisplayScreenCount() override; + virtual bool IsUnifiedDisplay() override; + virtual unsigned int GetDisplayBuiltInScreen() override; + virtual tools::Rectangle GetDisplayScreenPosSizePixel( unsigned int nScreen ) override; + virtual int ShowNativeDialog( const OUString& rTitle, + const OUString& rMessage, + const std::vector< OUString >& rButtons ) override; +}; + +#endif // INCLUDED_VCL_INC_UNX_X11_X11SYS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11/xlimits.hxx b/vcl/inc/unx/x11/xlimits.hxx new file mode 100644 index 000000000..b46ff9bb1 --- /dev/null +++ b/vcl/inc/unx/x11/xlimits.hxx @@ -0,0 +1,20 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_UNX_X11_XLIMITS_HXX +#define INCLUDED_VCL_INC_UNX_X11_XLIMITS_HXX + +#include <X11/Xlib.h> +#include <vclpluginapi.h> + +Pixmap limitXCreatePixmap(Display *display, Drawable d, unsigned int width, unsigned int height, unsigned int depth); + +#endif // INCLUDED_VCL_INC_UNX_X11_XLIMITS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11/xrender_peer.hxx b/vcl/inc/unx/x11/xrender_peer.hxx new file mode 100644 index 000000000..e1006f88e --- /dev/null +++ b/vcl/inc/unx/x11/xrender_peer.hxx @@ -0,0 +1,165 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_UNX_X11_XRENDER_PEER_HXX +#define INCLUDED_VCL_UNX_X11_XRENDER_PEER_HXX + +#include <X11/Xlib.h> +#include <X11/Xutil.h> +struct _XTrap; // on some older systems this is not declared within Xrender.h +#include <X11/extensions/Xrender.h> + +#include <tools/color.hxx> + + +class XRenderPeer +{ +public: + static XRenderPeer& GetInstance(); + +private: + XRenderPeer(); + void InitRenderLib(); + + Display* mpDisplay; + XRenderPictFormat* mpStandardFormatA8; + +public: + XRenderPictFormat* GetStandardFormatA8() const; + XRenderPictFormat* FindStandardFormat(int nFormat) const; + + // the methods below are thin wrappers for the XRENDER API + XRenderPictFormat* FindVisualFormat( Visual const * ) const; + Picture CreatePicture( Drawable, const XRenderPictFormat*, + unsigned long nDrawable, const XRenderPictureAttributes* ) const; + void ChangePicture( Picture, unsigned long nValueMask, + const XRenderPictureAttributes* ) const; + void SetPictureClipRegion( Picture, Region ) const; + void CompositePicture( int nOp, Picture aSrc, Picture aMask, Picture aDst, + int nXSrc, int nYSrc, + int nXDst, int nYDst, unsigned nWidth, unsigned nHeight ) const; + void FreePicture( Picture ) const; + + void FillRectangle( int nOp, Picture aDst, const XRenderColor*, + int nX, int nY, unsigned nW, unsigned nH ) const; + void CompositeTrapezoids( int nOp, Picture aSrc, Picture aDst, + const XRenderPictFormat*, int nXSrc, int nYSrc, + const XTrapezoid*, int nCount ) const; + void CompositeTriangles( int nOp, Picture aSrc, Picture aDst, + const XRenderPictFormat*, int nXSrc, int nYSrc, + const XTriangle*, int nCount ) const; +}; + +inline XRenderPictFormat* XRenderPeer::GetStandardFormatA8() const +{ + return mpStandardFormatA8; +} + +inline XRenderPictFormat* XRenderPeer::FindStandardFormat(int nFormat) const +{ + return XRenderFindStandardFormat(mpDisplay, nFormat); +} + +inline XRenderPictFormat* XRenderPeer::FindVisualFormat( Visual const * pVisual ) const +{ + return XRenderFindVisualFormat ( mpDisplay, pVisual ); +} + +inline Picture XRenderPeer::CreatePicture( Drawable aDrawable, + const XRenderPictFormat* pVisFormat, unsigned long nValueMask, + const XRenderPictureAttributes* pRenderAttr ) const +{ + return XRenderCreatePicture( mpDisplay, aDrawable, pVisFormat, + nValueMask, pRenderAttr ); +} + +inline void XRenderPeer::ChangePicture( Picture aPicture, + unsigned long nValueMask, const XRenderPictureAttributes* pRenderAttr ) const +{ + XRenderChangePicture( mpDisplay, aPicture, nValueMask, pRenderAttr ); +} + +inline void XRenderPeer::SetPictureClipRegion( Picture aPicture, + Region aXlibRegion ) const +{ + XRenderSetPictureClipRegion( mpDisplay, aPicture, aXlibRegion ); +} + +inline void XRenderPeer::CompositePicture( int nXRenderOp, + Picture aSrcPic, Picture aMaskPic, Picture aDstPic, + int nSrcX, int nSrcY, int nDstX, int nDstY, + unsigned nWidth, unsigned nHeight ) const +{ + XRenderComposite( mpDisplay, nXRenderOp, aSrcPic, aMaskPic, aDstPic, + nSrcX, nSrcY, 0/*nMaskX*/, 0/*nMaskY*/, nDstX, nDstY, nWidth, nHeight ); +} + +inline void XRenderPeer::FreePicture( Picture aPicture ) const +{ + XRenderFreePicture( mpDisplay, aPicture ); +} + +inline void XRenderPeer::FillRectangle( int a, Picture b, const XRenderColor* c, + int d, int e, unsigned int f, unsigned int g) const +{ + XRenderFillRectangle( mpDisplay, a, b, c, d, e, f, g ); +} + +inline void XRenderPeer::CompositeTrapezoids( int nOp, + Picture aSrc, Picture aDst, const XRenderPictFormat* pXRPF, + int nXSrc, int nYSrc, const XTrapezoid* pXT, int nCount ) const +{ + XRenderCompositeTrapezoids( mpDisplay, nOp, aSrc, aDst, pXRPF, + nXSrc, nYSrc, pXT, nCount ); +} + +inline void XRenderPeer::CompositeTriangles( int nOp, + Picture aSrc, Picture aDst, const XRenderPictFormat* pXRPF, + int nXSrc, int nYSrc, const XTriangle* pXT, int nCount ) const +{ + XRenderCompositeTriangles( mpDisplay, nOp, aSrc, aDst, pXRPF, + nXSrc, nYSrc, pXT, nCount ); +} + +inline XRenderColor GetXRenderColor( Color rColor, double fTransparency ) +{ + XRenderColor aRetVal; + // convert the Color + aRetVal.red = rColor.GetRed(); aRetVal.red |= (aRetVal.red << 8); + aRetVal.green = rColor.GetGreen(); aRetVal.green |= (aRetVal.green << 8); + aRetVal.blue = rColor.GetBlue(); aRetVal.blue |= (aRetVal.blue << 8); + + // handle transparency + aRetVal.alpha = 0xFFFF; // default to opaque + if( fTransparency != 0 ) + { + const double fAlpha = 1.0 - fTransparency; + aRetVal.alpha = static_cast<sal_uInt16>(fAlpha * 0xFFFF + 0.5); + // xrender wants pre-multiplied colors + aRetVal.red = static_cast<sal_uInt16>(fAlpha * aRetVal.red + 0.5); + aRetVal.green = static_cast<sal_uInt16>(fAlpha * aRetVal.green + 0.5); + aRetVal.blue = static_cast<sal_uInt16>(fAlpha * aRetVal.blue + 0.5); + } + + return aRetVal; +} + +#endif // INCLUDED_VCL_UNX_X11_XRENDER_PEER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/ase_curs.h b/vcl/inc/unx/x11_cursors/ase_curs.h new file mode 100644 index 000000000..878d1ff57 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/ase_curs.h @@ -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 . + */ +#define ase_curs_width 32 +#define ase_curs_height 32 +#define ase_curs_x_hot 19 +#define ase_curs_y_hot 16 +static unsigned char ase_curs_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x1c,0x0e, + 0x00,0x00,0x3e,0x1e,0x00,0x00,0x3e,0x7e,0x00,0x00,0x3e,0x1e,0x00,0x00,0x1c, + 0x0e,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/ase_mask.h b/vcl/inc/unx/x11_cursors/ase_mask.h new file mode 100644 index 000000000..258b2bc93 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/ase_mask.h @@ -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 . + */ +#define ase_mask_width 32 +#define ase_mask_height 32 +#define ase_mask_x_hot 19 +#define ase_mask_y_hot 16 +static unsigned char ase_mask_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x9c,0x0f,0x00,0x00,0x3e,0x1f, + 0x00,0x00,0x7f,0x7f,0x00,0x00,0x7f,0xff,0x00,0x00,0x7f,0x7f,0x00,0x00,0x3e, + 0x1f,0x00,0x00,0x9c,0x0f,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asn_curs.h b/vcl/inc/unx/x11_cursors/asn_curs.h new file mode 100644 index 000000000..1e6170af4 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/asn_curs.h @@ -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 . + */ +#define asn_curs_width 32 +#define asn_curs_height 32 +#define asn_curs_x_hot 16 +#define asn_curs_y_hot 12 +static unsigned char asn_curs_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x80,0x03, + 0x00,0x00,0xc0,0x07,0x00,0x00,0xc0,0x07,0x00,0x00,0xe0,0x0f,0x00,0x00,0x20, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x03,0x00,0x00, + 0xc0,0x07,0x00,0x00,0xc0,0x07,0x00,0x00,0xc0,0x07,0x00,0x00,0x80,0x03,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asn_mask.h b/vcl/inc/unx/x11_cursors/asn_mask.h new file mode 100644 index 000000000..c44b5eeb9 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/asn_mask.h @@ -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 . + */ +#define asn_mask_width 32 +#define asn_mask_height 32 +#define asn_mask_x_hot 16 +#define asn_mask_y_hot 12 +static unsigned char asn_mask_bits[] = { + 0x00,0x00,0x01,0x00,0x00,0x80,0x03,0x00,0x00,0x80,0x03,0x00,0x00,0xc0,0x07, + 0x00,0x00,0xe0,0x0f,0x00,0x00,0xe0,0x0f,0x00,0x00,0xf0,0x1f,0x00,0x00,0xf0, + 0x1f,0x00,0x00,0x20,0x08,0x00,0x00,0x80,0x03,0x00,0x00,0xc0,0x07,0x00,0x00, + 0xe0,0x0f,0x00,0x00,0xe0,0x0f,0x00,0x00,0xe0,0x0f,0x00,0x00,0xc0,0x07,0x00, + 0x00,0x80,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asne_curs.h b/vcl/inc/unx/x11_cursors/asne_curs.h new file mode 100644 index 000000000..cc757474e --- /dev/null +++ b/vcl/inc/unx/x11_cursors/asne_curs.h @@ -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 . + */ +#define asne_curs_width 32 +#define asne_curs_height 32 +#define asne_curs_x_hot 21 +#define asne_curs_y_hot 10 +static unsigned char asne_curs_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x80, + 0x3f,0x00,0x00,0xc0,0x3f,0x00,0x00,0x00,0x3f,0x00,0x00,0x00,0x1c,0x00,0x00, + 0x00,0x1c,0x00,0x00,0x70,0x18,0x00,0x00,0xf8,0x08,0x00,0x00,0xf8,0x00,0x00, + 0x00,0xf8,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asne_mask.h b/vcl/inc/unx/x11_cursors/asne_mask.h new file mode 100644 index 000000000..ebb80c0ba --- /dev/null +++ b/vcl/inc/unx/x11_cursors/asne_mask.h @@ -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 . + */ +#define asne_mask_width 32 +#define asne_mask_height 32 +#define asne_mask_x_hot 21 +#define asne_mask_y_hot 10 +static unsigned char asne_mask_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x80,0x7f,0x00,0x00,0xc0, + 0x7f,0x00,0x00,0xe0,0x7f,0x00,0x00,0xc0,0x7f,0x00,0x00,0x00,0x3f,0x00,0x00, + 0x70,0x3e,0x00,0x00,0xf8,0x3c,0x00,0x00,0xfc,0x1d,0x00,0x00,0xfc,0x09,0x00, + 0x00,0xfc,0x01,0x00,0x00,0xf8,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asns_curs.h b/vcl/inc/unx/x11_cursors/asns_curs.h new file mode 100644 index 000000000..27c0ce7e7 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/asns_curs.h @@ -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 . + */ +#define asns_curs_width 32 +#define asns_curs_height 32 +#define asns_curs_x_hot 15 +#define asns_curs_y_hot 15 +static unsigned char asns_curs_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0xe0, + 0x03,0x00,0x00,0xe0,0x03,0x00,0x00,0xf0,0x07,0x00,0x00,0x10,0x04,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0xe0,0x03,0x00, + 0x00,0xe0,0x03,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x04,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0, + 0x03,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00,0x00,0x80,0x00,0x00,0x00, + 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asns_mask.h b/vcl/inc/unx/x11_cursors/asns_mask.h new file mode 100644 index 000000000..d7d8a1253 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/asns_mask.h @@ -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 . + */ +#define asns_mask_width 32 +#define asns_mask_height 32 +#define asns_mask_x_hot 15 +#define asns_mask_y_hot 15 +static unsigned char asns_mask_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00, + 0x00,0x00,0xc0,0x01,0x00,0x00,0xc0,0x01,0x00,0x00,0xe0,0x03,0x00,0x00,0xf0, + 0x07,0x00,0x00,0xf0,0x07,0x00,0x00,0xf8,0x0f,0x00,0x00,0xf8,0x0f,0x00,0x00, + 0x10,0x04,0x00,0x00,0xc0,0x01,0x00,0x00,0xe0,0x03,0x00,0x00,0xf0,0x07,0x00, + 0x00,0xf0,0x07,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01, + 0x00,0x00,0x10,0x04,0x00,0x00,0xf8,0x0f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xf0, + 0x07,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00,0x00, + 0xc0,0x01,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asnswe_curs.h b/vcl/inc/unx/x11_cursors/asnswe_curs.h new file mode 100644 index 000000000..e746fc59b --- /dev/null +++ b/vcl/inc/unx/x11_cursors/asnswe_curs.h @@ -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 . + */ +#define asnswe_curs_width 32 +#define asnswe_curs_height 32 +#define asnswe_curs_x_hot 15 +#define asnswe_curs_y_hot 15 +static unsigned char asnswe_curs_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0xe0, + 0x03,0x00,0x00,0xe0,0x03,0x00,0x00,0xf0,0x07,0x00,0x00,0x10,0x04,0x00,0x00, + 0x00,0x00,0x00,0x00,0x06,0x30,0x00,0x80,0xc3,0xe1,0x00,0xc0,0xe3,0xe3,0x01, + 0xf0,0xe3,0xe3,0x07,0xc0,0xe3,0xe3,0x01,0x80,0xc3,0xe1,0x00,0x00,0x06,0x30, + 0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x04,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0, + 0x03,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00,0x00,0x80,0x00,0x00,0x00, + 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asnswe_mask.h b/vcl/inc/unx/x11_cursors/asnswe_mask.h new file mode 100644 index 000000000..69bb087d3 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/asnswe_mask.h @@ -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 . + */ +#define asnswe_mask_width 32 +#define asnswe_mask_height 32 +#define asnswe_mask_x_hot 15 +#define asnswe_mask_y_hot 15 +static unsigned char asnswe_mask_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00, + 0x00,0x00,0xc0,0x01,0x00,0x00,0xc0,0x01,0x00,0x00,0xe0,0x03,0x00,0x00,0xf0, + 0x07,0x00,0x00,0xf0,0x07,0x00,0x00,0xf8,0x0f,0x00,0x00,0xf8,0x0f,0x00,0x00, + 0x16,0x34,0x00,0x80,0xcf,0xf9,0x00,0xc0,0xe7,0xf3,0x01,0xf0,0xf7,0xf7,0x07, + 0xf8,0xf7,0xf7,0x0f,0xf0,0xf7,0xf7,0x07,0xc0,0xe7,0xf3,0x01,0x80,0xcf,0xf9, + 0x00,0x00,0x16,0x34,0x00,0x00,0xf8,0x0f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xf0, + 0x07,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00,0x00, + 0xc0,0x01,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asnw_curs.h b/vcl/inc/unx/x11_cursors/asnw_curs.h new file mode 100644 index 000000000..67df6fb7b --- /dev/null +++ b/vcl/inc/unx/x11_cursors/asnw_curs.h @@ -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 . + */ +#define asnw_curs_width 32 +#define asnw_curs_height 32 +#define asnw_curs_x_hot 10 +#define asnw_curs_y_hot 10 +static unsigned char asnw_curs_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0xfc,0x01,0x00, + 0x00,0xfc,0x03,0x00,0x00,0xfc,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x38,0x00, + 0x00,0x00,0x18,0x0e,0x00,0x00,0x10,0x1f,0x00,0x00,0x00,0x1f,0x00,0x00,0x00, + 0x1f,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asnw_mask.h b/vcl/inc/unx/x11_cursors/asnw_mask.h new file mode 100644 index 000000000..15bc43bcf --- /dev/null +++ b/vcl/inc/unx/x11_cursors/asnw_mask.h @@ -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 . + */ +#define asnw_mask_width 32 +#define asnw_mask_height 32 +#define asnw_mask_x_hot 10 +#define asnw_mask_y_hot 10 +static unsigned char asnw_mask_bits[] = { + 0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0xfe,0x01,0x00,0x00,0xfe,0x03,0x00, + 0x00,0xfe,0x07,0x00,0x00,0xfe,0x03,0x00,0x00,0xfc,0x00,0x00,0x00,0x7c,0x0e, + 0x00,0x00,0x3c,0x1f,0x00,0x00,0xb8,0x3f,0x00,0x00,0x90,0x3f,0x00,0x00,0x80, + 0x3f,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/ass_curs.h b/vcl/inc/unx/x11_cursors/ass_curs.h new file mode 100644 index 000000000..4335c1821 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/ass_curs.h @@ -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 . + */ +#define ass_curs_width 32 +#define ass_curs_height 32 +#define ass_curs_x_hot 15 +#define ass_curs_y_hot 19 +static unsigned char ass_curs_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0xe0,0x03, + 0x00,0x00,0xe0,0x03,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x04,0x00,0x00,0xf0,0x07,0x00,0x00, + 0xe0,0x03,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00,0x00,0x80,0x00,0x00, + 0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/ass_mask.h b/vcl/inc/unx/x11_cursors/ass_mask.h new file mode 100644 index 000000000..1ba699bc4 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/ass_mask.h @@ -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 . + */ +#define ass_mask_width 32 +#define ass_mask_height 32 +#define ass_mask_x_hot 15 +#define ass_mask_y_hot 19 +static unsigned char ass_mask_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0xe0,0x03,0x00,0x00,0xf0,0x07, + 0x00,0x00,0xf0,0x07,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0, + 0x01,0x00,0x00,0x10,0x04,0x00,0x00,0xf8,0x0f,0x00,0x00,0xf8,0x0f,0x00,0x00, + 0xf0,0x07,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00, + 0x00,0xc0,0x01,0x00,0x00,0x80,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asse_curs.h b/vcl/inc/unx/x11_cursors/asse_curs.h new file mode 100644 index 000000000..ea3607bea --- /dev/null +++ b/vcl/inc/unx/x11_cursors/asse_curs.h @@ -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 . + */ +#define asse_curs_width 32 +#define asse_curs_height 32 +#define asse_curs_x_hot 21 +#define asse_curs_y_hot 21 +static unsigned char asse_curs_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x70,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0xf8,0x00,0x00,0x00, + 0xf8,0x08,0x00,0x00,0x70,0x18,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x1c,0x00, + 0x00,0x00,0x3f,0x00,0x00,0xc0,0x3f,0x00,0x00,0x80,0x3f,0x00,0x00,0x00,0x3c, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asse_mask.h b/vcl/inc/unx/x11_cursors/asse_mask.h new file mode 100644 index 000000000..3d366d8e1 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/asse_mask.h @@ -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 . + */ +#define asse_mask_width 32 +#define asse_mask_height 32 +#define asse_mask_x_hot 21 +#define asse_mask_y_hot 21 +static unsigned char asse_mask_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70, + 0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0xfc,0x01,0x00,0x00,0xfc,0x09,0x00,0x00, + 0xfc,0x1d,0x00,0x00,0xf8,0x3c,0x00,0x00,0x70,0x3e,0x00,0x00,0x00,0x3f,0x00, + 0x00,0xc0,0x7f,0x00,0x00,0xe0,0x7f,0x00,0x00,0xc0,0x7f,0x00,0x00,0x80,0x7f, + 0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/assw_curs.h b/vcl/inc/unx/x11_cursors/assw_curs.h new file mode 100644 index 000000000..fe5645c28 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/assw_curs.h @@ -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 . + */ +#define assw_curs_width 32 +#define assw_curs_height 32 +#define assw_curs_x_hot 10 +#define assw_curs_y_hot 21 +static unsigned char assw_curs_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x0e,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x1f,0x00,0x00,0x10,0x1f, + 0x00,0x00,0x18,0x0e,0x00,0x00,0x38,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0xfc, + 0x00,0x00,0x00,0xfc,0x03,0x00,0x00,0xfc,0x01,0x00,0x00,0x3c,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/assw_mask.h b/vcl/inc/unx/x11_cursors/assw_mask.h new file mode 100644 index 000000000..959a0600c --- /dev/null +++ b/vcl/inc/unx/x11_cursors/assw_mask.h @@ -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 . + */ +#define assw_mask_width 32 +#define assw_mask_height 32 +#define assw_mask_x_hot 10 +#define assw_mask_y_hot 21 +static unsigned char assw_mask_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00, + 0x00,0x00,0x1F,0x00,0x00,0x80,0x3F,0x00,0x00,0x90,0x3F,0x00,0x00,0xB8,0x3F, + 0x00,0x00,0x3C,0x1F,0x00,0x00,0x7C,0x0E,0x00,0x00,0xFC,0x00,0x00,0x00,0xFE, + 0x03,0x00,0x00,0xFE,0x07,0x00,0x00,0xFE,0x03,0x00,0x00,0xFE,0x01,0x00,0x00, + 0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asw_curs.h b/vcl/inc/unx/x11_cursors/asw_curs.h new file mode 100644 index 000000000..b3b4a56c4 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/asw_curs.h @@ -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 . + */ +#define asw_curs_width 32 +#define asw_curs_height 32 +#define asw_curs_x_hot 12 +#define asw_curs_y_hot 15 +static unsigned char asw_curs_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x70,0x38,0x00,0x00,0x78,0x7c,0x00,0x00, + 0x7e,0x7c,0x00,0x00,0x78,0x7c,0x00,0x00,0x70,0x38,0x00,0x00,0xc0,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/asw_mask.h b/vcl/inc/unx/x11_cursors/asw_mask.h new file mode 100644 index 000000000..ad85d47f7 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/asw_mask.h @@ -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 . + */ +#define asw_mask_width 32 +#define asw_mask_height 32 +#define asw_mask_x_hot 12 +#define asw_mask_y_hot 15 +static unsigned char asw_mask_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0, + 0x00,0x00,0x00,0xf0,0x39,0x00,0x00,0xf8,0x7c,0x00,0x00,0xfe,0xfe,0x00,0x00, + 0xff,0xfe,0x00,0x00,0xfe,0xfe,0x00,0x00,0xf8,0x7c,0x00,0x00,0xf0,0x39,0x00, + 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/aswe_curs.h b/vcl/inc/unx/x11_cursors/aswe_curs.h new file mode 100644 index 000000000..0f7ed0fc1 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/aswe_curs.h @@ -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 . + */ +#define aswe_curs_width 32 +#define aswe_curs_height 32 +#define aswe_curs_x_hot 15 +#define aswe_curs_y_hot 15 +static unsigned char aswe_curs_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x06,0x30,0x00,0x80,0xc3,0xe1,0x00,0xc0,0xe3,0xe3,0x01, + 0xf0,0xe3,0xe3,0x07,0xc0,0xe3,0xe3,0x01,0x80,0xc3,0xe1,0x00,0x00,0x06,0x30, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/aswe_mask.h b/vcl/inc/unx/x11_cursors/aswe_mask.h new file mode 100644 index 000000000..24e105058 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/aswe_mask.h @@ -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 . + */ +#define aswe_mask_width 32 +#define aswe_mask_height 32 +#define aswe_mask_x_hot 15 +#define aswe_mask_y_hot 15 +static unsigned char aswe_mask_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x06,0x30,0x00,0x80,0xcf,0xf9,0x00,0xc0,0xe7,0xf3,0x01,0xf0,0xf7,0xf7,0x07, + 0xf8,0xf7,0xf7,0x0f,0xf0,0xf7,0xf7,0x07,0xc0,0xe7,0xf3,0x01,0x80,0xcf,0xf9, + 0x00,0x00,0x06,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/chain_curs.h b/vcl/inc/unx/x11_cursors/chain_curs.h new file mode 100644 index 000000000..26c055225 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/chain_curs.h @@ -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 . + */ +#define chain_curs_width 32 +#define chain_curs_height 32 +#define chain_curs_x_hot 0 +#define chain_curs_y_hot 2 +static unsigned char chain_curs_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00, + 0x00,0x05,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x21,0x00, + 0x00,0x00,0x41,0x00,0x00,0x00,0x81,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x01, + 0x02,0x00,0x00,0x01,0x04,0x00,0x00,0x81,0x0f,0x00,0x00,0x91,0x00,0x00,0x00, + 0x99,0x00,0x00,0x00,0x25,0x01,0x00,0x00,0x23,0x01,0x00,0x00,0x41,0x3e,0xbf, + 0x0f,0x40,0x82,0x40,0x10,0x80,0x5c,0xae,0x23,0x80,0x24,0x91,0x24,0x00,0x23, + 0x91,0x28,0x80,0x24,0x91,0x28,0x80,0x24,0x91,0x24,0x80,0x98,0x4f,0x23,0x00, + 0x41,0x20,0x10,0x00,0x3e,0xde,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/chain_mask.h b/vcl/inc/unx/x11_cursors/chain_mask.h new file mode 100644 index 000000000..4b25c9c4b --- /dev/null +++ b/vcl/inc/unx/x11_cursors/chain_mask.h @@ -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 . + */ +#define chain_mask_width 32 +#define chain_mask_height 32 +static unsigned char chain_mask_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00, + 0x00,0x07,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x3f,0x00, + 0x00,0x00,0x7f,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x01,0x00,0x00,0xff, + 0x03,0x00,0x00,0xff,0x07,0x00,0x00,0xff,0x0f,0x00,0x00,0xff,0x00,0x00,0x00, + 0xff,0x00,0x00,0x00,0xe7,0x01,0x00,0x00,0xe3,0x01,0x00,0x00,0xc1,0x3f,0xbf, + 0x0f,0xc0,0xbf,0xff,0x1f,0x80,0xdf,0xff,0x3f,0x80,0xe7,0xf1,0x3c,0x00,0xe3, + 0xf1,0x38,0x80,0xe7,0xf1,0x38,0x80,0xe7,0xf1,0x3c,0x80,0xff,0xff,0x3f,0x00, + 0x7f,0xff,0x1f,0x00,0x3e,0xde,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/chainnot_curs.h b/vcl/inc/unx/x11_cursors/chainnot_curs.h new file mode 100644 index 000000000..9af6f79d3 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/chainnot_curs.h @@ -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 . + */ +#define chainnot_curs_width 32 +#define chainnot_curs_height 32 +#define chainnot_curs_x_hot 2 +#define chainnot_curs_y_hot 2 +static unsigned char chainnot_curs_bits[] = { + 0x00,0x00,0x00,0x00,0x80,0x1f,0x00,0x00,0xe0,0x7f,0x00,0x00,0xf0,0xf0,0x00, + 0x00,0x38,0xc0,0x01,0x00,0x7c,0x80,0x03,0x00,0xec,0x00,0x03,0x00,0xce,0x01, + 0x07,0x00,0x86,0x03,0x06,0x00,0x06,0x07,0x06,0x00,0x06,0x0e,0x06,0x00,0x06, + 0x1c,0x06,0x00,0x0e,0x38,0x07,0x00,0x0c,0x70,0x03,0x00,0x1c,0xe0,0x03,0x00, + 0x38,0xc0,0x01,0x00,0xf0,0xe0,0x00,0x00,0xe0,0x7f,0x00,0x00,0x80,0x9f,0xfc, + 0x3e,0x00,0x00,0x02,0x41,0x00,0x72,0xb9,0x8e,0x00,0x92,0x44,0x92,0x00,0x8c, + 0x44,0xa2,0x00,0x92,0x44,0xa2,0x00,0x92,0x44,0x92,0x00,0x62,0x3e,0x8d,0x00, + 0x04,0x81,0x40,0x00,0xf8,0x78,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/chainnot_mask.h b/vcl/inc/unx/x11_cursors/chainnot_mask.h new file mode 100644 index 000000000..e5e24e0c7 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/chainnot_mask.h @@ -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 . + */ +#define chainnot_mask_width 32 +#define chainnot_mask_height 32 +static unsigned char chainnot_mask_bits[] = { + 0x80,0x1f,0x00,0x00,0xe0,0x7f,0x00,0x00,0xf0,0xff,0x00,0x00,0xf8,0xff,0x01, + 0x00,0xfc,0xf0,0x03,0x00,0xfe,0xc0,0x07,0x00,0xfe,0x81,0x07,0x00,0xff,0x83, + 0x0f,0x00,0xcf,0x07,0x0f,0x00,0x8f,0x0f,0x0f,0x00,0x0f,0x1f,0x0f,0x00,0x0f, + 0x3e,0x0f,0x00,0x1f,0xfc,0x0f,0x00,0x1e,0xf8,0x07,0x00,0x3e,0xf0,0x07,0x00, + 0xfc,0xe0,0x03,0x00,0xf8,0xff,0x01,0x00,0xf0,0xff,0x00,0x00,0xe0,0xff,0xfc, + 0x3e,0x80,0xff,0xfe,0x7f,0x00,0x7e,0xff,0xff,0x00,0x9e,0xc7,0xf3,0x00,0x8c, + 0xc7,0xe3,0x00,0x9e,0xc7,0xe3,0x00,0x9e,0xc7,0xf3,0x00,0xfe,0xff,0xff,0x00, + 0xfc,0xfd,0x7f,0x00,0xf8,0x78,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/chart_curs.h b/vcl/inc/unx/x11_cursors/chart_curs.h new file mode 100644 index 000000000..367f6b05c --- /dev/null +++ b/vcl/inc/unx/x11_cursors/chart_curs.h @@ -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 . + */ +#define chart_curs_width 32 +#define chart_curs_height 32 +#define chart_curs_x_hot 15 +#define chart_curs_y_hot 16 +static unsigned char chart_curs_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00, + 0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xbf,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00, + 0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80, + 0x10,0x00,0x00,0x80,0x00,0x06,0x00,0x00,0x10,0x06,0x00,0x00,0x00,0x06,0x00, + 0x00,0x10,0x36,0x00,0x00,0xc0,0x36,0x00,0x00,0xd0,0x36,0x00,0x00,0xc0,0x36, + 0x00,0x00,0xf0,0x7f,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/chart_mask.h b/vcl/inc/unx/x11_cursors/chart_mask.h new file mode 100644 index 000000000..6f6977062 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/chart_mask.h @@ -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 . + */ +#define chart_mask_width 32 +#define chart_mask_height 32 +#define chart_mask_x_hot 15 +#define chart_mask_y_hot 16 +static unsigned char chart_mask_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0xc0,0x01,0x00,0x00,0xc0,0x01,0x00,0x00, + 0xc0,0x01,0x00,0x00,0xc0,0x01,0x00,0x00,0xc0,0x01,0x00,0x00,0xc0,0x01,0x00, + 0x80,0xff,0xff,0x00,0x80,0xff,0xff,0x00,0x80,0xff,0xff,0x00,0x00,0xc0,0x01, + 0x00,0x00,0xc0,0x01,0x00,0x00,0xc0,0x01,0x00,0x00,0xc0,0x39,0x00,0x00,0xc0, + 0x39,0x0f,0x00,0xc0,0x39,0x0f,0x00,0xc0,0x39,0x0f,0x00,0x00,0x38,0x7f,0x00, + 0x00,0xf8,0x7f,0x00,0x00,0xf8,0x7f,0x00,0x00,0xf8,0x7f,0x00,0x00,0xf8,0xff, + 0x00,0x00,0xf8,0xff,0x00,0x00,0xf8,0xff}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/copydata_curs.h b/vcl/inc/unx/x11_cursors/copydata_curs.h new file mode 100644 index 000000000..4cc36ebde --- /dev/null +++ b/vcl/inc/unx/x11_cursors/copydata_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define copydata_curs_width 32 +#define copydata_curs_height 32 +#define copydata_curs_x_hot 1 +#define copydata_curs_y_hot 1 +static unsigned char copydata_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x0e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, + 0x7e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, + 0xfe, 0x03, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, + 0x66, 0x00, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, + 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x10, 0x53, 0x00, 0x00, + 0x28, 0xa3, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x10, 0xf0, 0x1f, 0x00, 0x08, 0xf0, 0x1f, 0x00, 0x10, 0xf0, 0x1e, 0x00, + 0xa8, 0xf2, 0x1e, 0x00, 0x50, 0x35, 0x18, 0x00, 0x00, 0xf0, 0x1e, 0x00, + 0x00, 0xf0, 0x1e, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/copydata_mask.h b/vcl/inc/unx/x11_cursors/copydata_mask.h new file mode 100644 index 000000000..a3538c952 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/copydata_mask.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define copydata_mask_width 32 +#define copydata_mask_height 32 +#define copydata_mask_x_hot 1 +#define copydata_mask_y_hot 1 +static unsigned char copydata_mask_bits[] = { + 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, + 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, + 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + 0xff, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xe7, 0x03, 0x00, 0x00, + 0xe0, 0x03, 0x00, 0x00, 0xf8, 0xff, 0x00, 0x00, 0xfc, 0xff, 0x01, 0x00, + 0xfc, 0xff, 0x01, 0x00, 0xfc, 0xff, 0x01, 0x00, 0x3c, 0xf8, 0x3f, 0x00, + 0x3c, 0xf8, 0x3f, 0x00, 0x3c, 0xf8, 0x3f, 0x00, 0xfc, 0xff, 0x3f, 0x00, + 0xfc, 0xff, 0x3f, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x3f, 0x00, + 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, + 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/copydlnk_curs.h b/vcl/inc/unx/x11_cursors/copydlnk_curs.h new file mode 100644 index 000000000..df05429e9 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/copydlnk_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define copydlnk_curs_width 32 +#define copydlnk_curs_height 32 +#define copydlnk_curs_x_hot 1 +#define copydlnk_curs_y_hot 1 +static unsigned char copydlnk_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x0e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, + 0x7e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, + 0xfe, 0x03, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, + 0x66, 0x00, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, + 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x10, 0x53, 0x00, 0x00, + 0x28, 0xa3, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, + 0x30, 0xf1, 0x1f, 0x00, 0x10, 0xf1, 0x1f, 0x00, 0xd0, 0xf1, 0x1e, 0x00, + 0xf0, 0xf1, 0x1e, 0x00, 0x00, 0x34, 0x18, 0x00, 0x00, 0xf0, 0x1e, 0x00, + 0x00, 0xf0, 0x1e, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/copydlnk_mask.h b/vcl/inc/unx/x11_cursors/copydlnk_mask.h new file mode 100644 index 000000000..b2ffcca62 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/copydlnk_mask.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define copydlnk_mask_width 32 +#define copydlnk_mask_height 32 +#define copydlnk_mask_x_hot 1 +#define copydlnk_mask_y_hot 1 +static unsigned char copydlnk_mask_bits[] = { + 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, + 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, + 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + 0xff, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xe7, 0x03, 0x00, 0x00, + 0xe0, 0x03, 0x00, 0x00, 0xf8, 0xff, 0x00, 0x00, 0xfc, 0xff, 0x01, 0x00, + 0xfc, 0xff, 0x01, 0x00, 0xfc, 0xff, 0x01, 0x00, 0xf8, 0xff, 0x3f, 0x00, + 0xf8, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x3f, 0x00, + 0xf8, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x3f, 0x00, 0x00, 0xfe, 0x3f, 0x00, + 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, + 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/copyfile_curs.h b/vcl/inc/unx/x11_cursors/copyfile_curs.h new file mode 100644 index 000000000..22d9fc6ff --- /dev/null +++ b/vcl/inc/unx/x11_cursors/copyfile_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define copyfile_curs_width 32 +#define copyfile_curs_height 32 +#define copyfile_curs_x_hot 9 +#define copyfile_curs_y_hot 9 +static unsigned char copyfile_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x02, 0x00, 0x00, + 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, + 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x04, 0x00, 0x00, + 0xfe, 0x02, 0x00, 0x00, 0xfe, 0x06, 0x00, 0x00, 0xfe, 0x0e, 0x00, 0x00, + 0xfe, 0x1e, 0x00, 0x00, 0xfe, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, + 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xfe, 0x03, 0x00, + 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, + 0x00, 0xc2, 0xe0, 0x3f, 0x00, 0xc0, 0xe0, 0x3f, 0x00, 0x80, 0xe1, 0x3d, + 0x00, 0x80, 0xe1, 0x3d, 0x00, 0x00, 0x63, 0x30, 0x00, 0x00, 0xe3, 0x3d, + 0x00, 0x00, 0xe0, 0x3d, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0xe0, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/copyfile_mask.h b/vcl/inc/unx/x11_cursors/copyfile_mask.h new file mode 100644 index 000000000..171d8b7bc --- /dev/null +++ b/vcl/inc/unx/x11_cursors/copyfile_mask.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define copyfile_mask_width 32 +#define copyfile_mask_height 32 +#define copyfile_mask_x_hot 9 +#define copyfile_mask_y_hot 9 +static unsigned char copyfile_mask_bits[] = { + 0xff, 0x01, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, + 0xff, 0x7f, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, + 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, + 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xf1, 0x7f, + 0x00, 0xff, 0xf1, 0x7f, 0x00, 0xe7, 0xf3, 0x7f, 0x00, 0xe0, 0xf3, 0x7f, + 0x00, 0xc0, 0xf7, 0x7f, 0x00, 0xc0, 0xf7, 0x7f, 0x00, 0x80, 0xf7, 0x7f, + 0x00, 0x80, 0xf7, 0x7f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xf0, 0x7f, + 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/copyfiles_curs.h b/vcl/inc/unx/x11_cursors/copyfiles_curs.h new file mode 100644 index 000000000..2a8041795 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/copyfiles_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define copyfiles_curs_width 32 +#define copyfiles_curs_height 32 +#define copyfiles_curs_x_hot 8 +#define copyfiles_curs_y_hot 9 +static unsigned char copyfiles_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xe0, 0x2f, 0x00, 0x00, + 0xe8, 0x0f, 0x00, 0x00, 0xe8, 0x7f, 0x00, 0x00, 0xea, 0x7f, 0x00, 0x00, + 0xea, 0x7f, 0x00, 0x00, 0xea, 0x7f, 0x00, 0x00, 0x6a, 0x7e, 0x00, 0x00, + 0x6a, 0x7d, 0x00, 0x00, 0x6a, 0x7b, 0x00, 0x00, 0x6a, 0x77, 0x00, 0x00, + 0x6a, 0x6f, 0x00, 0x00, 0x6a, 0x5f, 0x00, 0x00, 0x0a, 0x3f, 0x00, 0x00, + 0x7a, 0x7f, 0x00, 0x00, 0x02, 0xff, 0x00, 0x00, 0x7e, 0xff, 0x01, 0x00, + 0x00, 0x3f, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, + 0x00, 0x61, 0xe0, 0x3f, 0x00, 0x60, 0xe0, 0x3f, 0x00, 0xc0, 0xe0, 0x3d, + 0x00, 0xc0, 0xe0, 0x3d, 0x00, 0x80, 0x61, 0x30, 0x00, 0x80, 0xe1, 0x3d, + 0x00, 0x00, 0xe0, 0x3d, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0xe0, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/copyfiles_mask.h b/vcl/inc/unx/x11_cursors/copyfiles_mask.h new file mode 100644 index 000000000..02f2d4c12 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/copyfiles_mask.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define copyfiles_mask_width 32 +#define copyfiles_mask_height 32 +#define copyfiles_mask_x_hot 8 +#define copyfiles_mask_y_hot 9 +static unsigned char copyfiles_mask_bits[] = { + 0xf0, 0x1f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, + 0xfc, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, + 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, + 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, + 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, + 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x03, 0x00, 0xff, 0xff, 0x03, 0x00, + 0xff, 0xff, 0x03, 0x00, 0x80, 0x7f, 0x00, 0x00, 0x80, 0xff, 0xf0, 0x7f, + 0x80, 0xff, 0xf0, 0x7f, 0x80, 0xf3, 0xf1, 0x7f, 0x00, 0xf0, 0xf1, 0x7f, + 0x00, 0xe0, 0xf3, 0x7f, 0x00, 0xe0, 0xf3, 0x7f, 0x00, 0xc0, 0xf3, 0x7f, + 0x00, 0xc0, 0xf3, 0x7f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xf0, 0x7f, + 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/copyflnk_curs.h b/vcl/inc/unx/x11_cursors/copyflnk_curs.h new file mode 100644 index 000000000..43629e23a --- /dev/null +++ b/vcl/inc/unx/x11_cursors/copyflnk_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define copyflnk_curs_width 32 +#define copyflnk_curs_height 32 +#define copyflnk_curs_x_hot 9 +#define copyflnk_curs_y_hot 9 +static unsigned char copyflnk_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x02, 0x00, 0x00, + 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, + 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, + 0xbe, 0x02, 0x00, 0x00, 0xa6, 0x06, 0x00, 0x00, 0xa2, 0x0e, 0x00, 0x00, + 0xba, 0x1e, 0x00, 0x00, 0xbe, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, + 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xfe, 0x03, 0x00, + 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, + 0x00, 0xc2, 0xe0, 0x3f, 0x00, 0xc0, 0xe0, 0x3f, 0x00, 0x80, 0xe1, 0x3d, + 0x00, 0x80, 0xe1, 0x3d, 0x00, 0x00, 0x63, 0x30, 0x00, 0x00, 0xe3, 0x3d, + 0x00, 0x00, 0xe0, 0x3d, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0xe0, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/copyflnk_mask.h b/vcl/inc/unx/x11_cursors/copyflnk_mask.h new file mode 100644 index 000000000..cd17b334c --- /dev/null +++ b/vcl/inc/unx/x11_cursors/copyflnk_mask.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define copyflnk_mask_width 32 +#define copyflnk_mask_height 32 +#define copyflnk_mask_x_hot 9 +#define copyflnk_mask_y_hot 9 +static unsigned char copyflnk_mask_bits[] = { + 0xff, 0x01, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, + 0xff, 0x7f, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, + 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, + 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xf1, 0x7f, + 0x00, 0xff, 0xf1, 0x7f, 0x00, 0xe7, 0xf3, 0x7f, 0x00, 0xe0, 0xf3, 0x7f, + 0x00, 0xc0, 0xf7, 0x7f, 0x00, 0xc0, 0xf7, 0x7f, 0x00, 0x80, 0xf7, 0x7f, + 0x00, 0x80, 0xf7, 0x7f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xf0, 0x7f, + 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/crook_curs.h b/vcl/inc/unx/x11_cursors/crook_curs.h new file mode 100644 index 000000000..989d43b54 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/crook_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define crook_curs_width 32 +#define crook_curs_height 32 +#define crook_curs_x_hot 15 +#define crook_curs_y_hot 14 +static unsigned char crook_curs_bits[] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x7c, 0x3e, 0xff, 0x7f, 0xbb, 0xdd, 0xfe, + 0x7f, 0xbb, 0xdd, 0xfe, 0xf3, 0xb6, 0x6d, 0xcf, 0xed, 0xb6, 0x6d, 0xb7, + 0xdd, 0x75, 0xae, 0xbb, 0xbb, 0x0b, 0xd0, 0xdd, 0xb7, 0xf1, 0x8f, 0xed, + 0x4f, 0x0e, 0x70, 0xf2, 0xbf, 0xf1, 0x8f, 0xfd, 0x5f, 0xfe, 0x7f, 0xfa, + 0xaf, 0xff, 0xff, 0xf5, 0xd7, 0xff, 0xff, 0xeb, 0xef, 0xff, 0xff, 0xf7, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/crook_mask.h b/vcl/inc/unx/x11_cursors/crook_mask.h new file mode 100644 index 000000000..6e30897e5 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/crook_mask.h @@ -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 . + */ +#define crook_mask_width 32 +#define crook_mask_height 32 +static unsigned char crook_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x83, 0xc1, 0x00, 0x80, 0xc7, 0xe3, 0x01, 0xc0, 0xef, 0xf7, 0x03, + 0xcc, 0xef, 0xf7, 0x33, 0x9e, 0xff, 0xff, 0x79, 0xbf, 0xff, 0xff, 0xfd, + 0x77, 0xff, 0xff, 0xee, 0xee, 0xf6, 0x6f, 0x77, 0xfc, 0xff, 0xff, 0x3f, + 0xb8, 0xff, 0xff, 0x1d, 0xf0, 0xff, 0xff, 0x0f, 0xf0, 0x0f, 0xf0, 0x0f, + 0xf8, 0x01, 0x80, 0x1f, 0x7c, 0x00, 0x00, 0x3e, 0x38, 0x00, 0x00, 0x1c, + 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/crop_curs.h b/vcl/inc/unx/x11_cursors/crop_curs.h new file mode 100644 index 000000000..f40842257 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/crop_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define crop_curs_width 32 +#define crop_curs_height 32 +#define crop_curs_x_hot 9 +#define crop_curs_y_hot 9 +static unsigned char crop_curs_bits[] = { + 0xff, 0x0f, 0xff, 0xff, 0xff, 0x6f, 0xff, 0xff, 0xff, 0x6f, 0xff, 0xff, + 0x07, 0x60, 0xf8, 0xff, 0xf7, 0x6f, 0xfb, 0xff, 0xf7, 0x6f, 0xfb, 0xff, + 0x37, 0x60, 0xf8, 0xff, 0xb7, 0x6f, 0xff, 0xff, 0xb7, 0x6f, 0xff, 0xff, + 0xb7, 0x6f, 0xff, 0xff, 0xb7, 0x6f, 0xff, 0xff, 0xb7, 0x6f, 0xff, 0xff, + 0x30, 0x60, 0xff, 0xff, 0xb6, 0x7f, 0xff, 0xff, 0xb6, 0x7f, 0xff, 0xff, + 0x30, 0x00, 0xff, 0xff, 0xb7, 0xff, 0xff, 0xff, 0xb7, 0xff, 0xff, 0xff, + 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/crop_mask.h b/vcl/inc/unx/x11_cursors/crop_mask.h new file mode 100644 index 000000000..10d3598af --- /dev/null +++ b/vcl/inc/unx/x11_cursors/crop_mask.h @@ -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 . + */ +#define crop_mask_width 32 +#define crop_mask_height 32 +static unsigned char crop_mask_bits[] = { + 0x00, 0xf8, 0x01, 0x00, 0x00, 0xf8, 0x01, 0x00, 0xfc, 0xff, 0x0f, 0x00, + 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x0f, 0x00, + 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xf8, 0x01, 0x00, + 0xfc, 0xf8, 0x01, 0x00, 0xfc, 0xf8, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00, + 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00, + 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00, 0xfc, 0x00, 0x00, 0x00, + 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/detective_curs.h b/vcl/inc/unx/x11_cursors/detective_curs.h new file mode 100644 index 000000000..265be0fa2 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/detective_curs.h @@ -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 . + */ +#define detective_curs_width 32 +#define detective_curs_height 32 +#define detective_curs_x_hot 12 +#define detective_curs_y_hot 13 +static unsigned char detective_curs_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x38,0x00, + 0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c, + 0x00,0x00,0x00,0x83,0x01,0x00,0x80,0x00,0x02,0x00,0x80,0x10,0x02,0x00,0x40, + 0x38,0x04,0x00,0x40,0x7c,0x04,0x00,0x40,0xfe,0x04,0x00,0x40,0x38,0x04,0x00, + 0x40,0x38,0x04,0x00,0x80,0x38,0x02,0x00,0x80,0x00,0x02,0x00,0x00,0x83,0x07, + 0x00,0x00,0x7c,0x0e,0x00,0x00,0x00,0x1c,0x00,0x00,0x10,0x38,0x00,0x00,0x38, + 0x70,0x00,0x00,0x10,0x60,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/detective_mask.h b/vcl/inc/unx/x11_cursors/detective_mask.h new file mode 100644 index 000000000..411e8a39d --- /dev/null +++ b/vcl/inc/unx/x11_cursors/detective_mask.h @@ -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 . + */ +#define detective_mask_width 32 +#define detective_mask_height 32 +#define detective_mask_x_hot 12 +#define detective_mask_y_hot 13 +static unsigned char detective_mask_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x38,0x00, + 0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c, + 0x00,0x00,0x00,0xff,0x01,0x00,0x80,0xff,0x03,0x00,0x80,0xff,0x03,0x00,0xc0, + 0xff,0x07,0x00,0xc0,0xff,0x07,0x00,0xc0,0xff,0x07,0x00,0xc0,0xff,0x07,0x00, + 0xc0,0xff,0x07,0x00,0x80,0xff,0x03,0x00,0x80,0xff,0x03,0x00,0x00,0xff,0x07, + 0x00,0x00,0x7c,0x0e,0x00,0x00,0x00,0x1c,0x00,0x00,0x10,0x38,0x00,0x00,0x38, + 0x70,0x00,0x00,0x10,0x60,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawarc_curs.h b/vcl/inc/unx/x11_cursors/drawarc_curs.h new file mode 100644 index 000000000..17edc92db --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawarc_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define drawarc_curs_width 32 +#define drawarc_curs_height 32 +#define drawarc_curs_x_hot 7 +#define drawarc_curs_y_hot 7 +static unsigned char drawarc_curs_bits[] = { + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x42, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawarc_mask.h b/vcl/inc/unx/x11_cursors/drawarc_mask.h new file mode 100644 index 000000000..6c0c01754 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawarc_mask.h @@ -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 . + */ +#define drawarc_mask_width 32 +#define drawarc_mask_height 32 +static unsigned char drawarc_mask_bits[] = { + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0xff, 0x00, + 0x00, 0x80, 0xe7, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, + 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawbezier_curs.h b/vcl/inc/unx/x11_cursors/drawbezier_curs.h new file mode 100644 index 000000000..5470e8d6d --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawbezier_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define drawbezier_curs_width 32 +#define drawbezier_curs_height 32 +#define drawbezier_curs_x_hot 7 +#define drawbezier_curs_y_hot 7 +static unsigned char drawbezier_curs_bits[] = { + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x07, 0x00, 0x00, 0x88, 0x00, + 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, + 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x0e, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawbezier_mask.h b/vcl/inc/unx/x11_cursors/drawbezier_mask.h new file mode 100644 index 000000000..b3b128261 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawbezier_mask.h @@ -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 . + */ +#define drawbezier_mask_width 32 +#define drawbezier_mask_height 32 +static unsigned char drawbezier_mask_bits[] = { + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x0e, 0x0f, 0x00, 0x00, 0x8e, 0x0f, 0x00, 0x00, 0xdc, 0x0f, + 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0xe0, 0x00, + 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, 0xbf, 0x03, 0x00, 0x00, 0x1f, 0x07, + 0x00, 0x00, 0x0f, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawcaption_curs.h b/vcl/inc/unx/x11_cursors/drawcaption_curs.h new file mode 100644 index 000000000..d16c2103b --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawcaption_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define drawcaption_curs_width 32 +#define drawcaption_curs_height 32 +#define drawcaption_curs_x_hot 8 +#define drawcaption_curs_y_hot 8 +static unsigned char drawcaption_curs_bits[] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, + 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, + 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81, 0x02, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, + 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xbe, 0xff, 0xff, + 0xff, 0x7e, 0x1f, 0xe0, 0xff, 0xff, 0xde, 0xef, 0xff, 0xff, 0xc1, 0xef, + 0xff, 0xff, 0xdf, 0xef, 0xff, 0xff, 0x1f, 0xe0, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawcaption_mask.h b/vcl/inc/unx/x11_cursors/drawcaption_mask.h new file mode 100644 index 000000000..24a6643a0 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawcaption_mask.h @@ -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 . + */ +#define drawcaption_mask_width 32 +#define drawcaption_mask_height 32 +static unsigned char drawcaption_mask_bits[] = { + 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, + 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, + 0x80, 0x03, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00, + 0xff, 0xff, 0x01, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, + 0x80, 0x03, 0x00, 0x00, 0x80, 0x43, 0x00, 0x00, 0x80, 0xe3, 0xf0, 0x3f, + 0x80, 0xc3, 0xf1, 0x3f, 0x80, 0x83, 0xff, 0x3f, 0x00, 0x00, 0x7f, 0x38, + 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0xf0, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawcirclecut_curs.h b/vcl/inc/unx/x11_cursors/drawcirclecut_curs.h new file mode 100644 index 000000000..35939eb26 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawcirclecut_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define drawcirclecut_curs_width 32 +#define drawcirclecut_curs_height 32 +#define drawcirclecut_curs_x_hot 7 +#define drawcirclecut_curs_y_hot 7 +static unsigned char drawcirclecut_curs_bits[] = { + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0a, 0x00, + 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x41, 0x00, + 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x3c, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawcirclecut_mask.h b/vcl/inc/unx/x11_cursors/drawcirclecut_mask.h new file mode 100644 index 000000000..eeead07a4 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawcirclecut_mask.h @@ -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 . + */ +#define drawcirclecut_mask_width 32 +#define drawcirclecut_mask_height 32 +static unsigned char drawcirclecut_mask_bits[] = { + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1f, 0x00, + 0x00, 0x80, 0x3b, 0x00, 0x00, 0x80, 0x73, 0x00, 0x00, 0x80, 0xe3, 0x00, + 0x00, 0x80, 0xc3, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x7e, 0x00, + 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawconnect_curs.h b/vcl/inc/unx/x11_cursors/drawconnect_curs.h new file mode 100644 index 000000000..adad711d1 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawconnect_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define drawconnect_curs_width 32 +#define drawconnect_curs_height 32 +#define drawconnect_curs_x_hot 7 +#define drawconnect_curs_y_hot 7 +static unsigned char drawconnect_curs_bits[] = { + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x80, 0x5f, 0x00, 0x00, 0x80, 0x70, + 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0xfd, 0x00, + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawconnect_mask.h b/vcl/inc/unx/x11_cursors/drawconnect_mask.h new file mode 100644 index 000000000..566a134c7 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawconnect_mask.h @@ -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 . + */ +#define drawconnect_mask_width 32 +#define drawconnect_mask_height 32 +static unsigned char drawconnect_mask_bits[] = { + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, + 0x00, 0x00, 0xc0, 0xff, 0x00, 0x00, 0xc0, 0xdf, 0x00, 0x00, 0xc0, 0xff, + 0x00, 0x80, 0xcf, 0xf9, 0x00, 0x80, 0xff, 0x01, 0x00, 0x80, 0xfd, 0x01, + 0x00, 0x80, 0xff, 0x01, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawellipse_curs.h b/vcl/inc/unx/x11_cursors/drawellipse_curs.h new file mode 100644 index 000000000..36e886263 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawellipse_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define drawellipse_curs_width 32 +#define drawellipse_curs_height 32 +#define drawellipse_curs_x_hot 7 +#define drawellipse_curs_y_hot 7 +static unsigned char drawellipse_curs_bits[] = { + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x42, 0x00, + 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x81, 0x00, + 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x3c, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawellipse_mask.h b/vcl/inc/unx/x11_cursors/drawellipse_mask.h new file mode 100644 index 000000000..304db762b --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawellipse_mask.h @@ -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 . + */ +#define drawellipse_mask_width 32 +#define drawellipse_mask_height 32 +static unsigned char drawellipse_mask_bits[] = { + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0xff, 0x00, + 0x00, 0x80, 0xe7, 0x01, 0x00, 0x80, 0xc3, 0x01, 0x00, 0x80, 0xc3, 0x01, + 0x00, 0x80, 0xe7, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x7e, 0x00, + 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawfreehand_curs.h b/vcl/inc/unx/x11_cursors/drawfreehand_curs.h new file mode 100644 index 000000000..b00d9be98 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawfreehand_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define drawfreehand_curs_width 32 +#define drawfreehand_curs_height 32 +#define drawfreehand_curs_x_hot 8 +#define drawfreehand_curs_y_hot 8 +static unsigned char drawfreehand_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xfd, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x70, 0x00, 0x02, + 0x00, 0x88, 0x00, 0x02, 0x00, 0x84, 0x00, 0x01, 0x00, 0x84, 0xc0, 0x00, + 0x00, 0x04, 0x3f, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawfreehand_mask.h b/vcl/inc/unx/x11_cursors/drawfreehand_mask.h new file mode 100644 index 000000000..0e5d38ebd --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawfreehand_mask.h @@ -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 . + */ +#define drawfreehand_mask_width 32 +#define drawfreehand_mask_height 32 +static unsigned char drawfreehand_mask_bits[] = { + 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, + 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, + 0x80, 0x03, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00, + 0xff, 0xff, 0x01, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, + 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x08, + 0x80, 0x03, 0x00, 0x1c, 0x80, 0x73, 0x00, 0x0e, 0x00, 0xf8, 0x00, 0x07, + 0x00, 0xfc, 0x01, 0x07, 0x00, 0xce, 0xc1, 0x03, 0x00, 0xce, 0xff, 0x01, + 0x00, 0x8e, 0xff, 0x00, 0x00, 0x0e, 0x3f, 0x00, 0x00, 0x0e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawline_curs.h b/vcl/inc/unx/x11_cursors/drawline_curs.h new file mode 100644 index 000000000..5376a6600 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawline_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define drawline_curs_width 32 +#define drawline_curs_height 32 +#define drawline_curs_x_hot 7 +#define drawline_curs_y_hot 7 +static unsigned char drawline_curs_bits[] = { + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x0c, 0x00, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawline_mask.h b/vcl/inc/unx/x11_cursors/drawline_mask.h new file mode 100644 index 000000000..f283ac7fa --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawline_mask.h @@ -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 . + */ +#define drawline_mask_width 32 +#define drawline_mask_height 32 +static unsigned char drawline_mask_bits[] = { + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0x3f, 0xfe, 0x00, 0x00, 0xbf, 0xfe, 0x00, 0x00, 0x3f, 0xfe, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x70, + 0xc0, 0x01, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xc0, 0x0f, + 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x3f, 0x00, + 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawpie_curs.h b/vcl/inc/unx/x11_cursors/drawpie_curs.h new file mode 100644 index 000000000..777634e1c --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawpie_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define drawpie_curs_width 32 +#define drawpie_curs_height 32 +#define drawpie_curs_x_hot 7 +#define drawpie_curs_y_hot 7 +static unsigned char drawpie_curs_bits[] = { + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0a, 0x00, + 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0xf9, 0x00, + 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x3c, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawpie_mask.h b/vcl/inc/unx/x11_cursors/drawpie_mask.h new file mode 100644 index 000000000..93ac75c2a --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawpie_mask.h @@ -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 . + */ +#define drawpie_mask_width 32 +#define drawpie_mask_height 32 +static unsigned char drawpie_mask_bits[] = { + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x1f, 0x00, + 0x00, 0x80, 0x1f, 0x00, 0x00, 0x80, 0xff, 0x01, 0x00, 0x80, 0xff, 0x01, + 0x00, 0x80, 0xfb, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x7e, 0x00, + 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawpolygon_curs.h b/vcl/inc/unx/x11_cursors/drawpolygon_curs.h new file mode 100644 index 000000000..7eebead2a --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawpolygon_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define drawpolygon_curs_width 32 +#define drawpolygon_curs_height 32 +#define drawpolygon_curs_x_hot 7 +#define drawpolygon_curs_y_hot 7 +static unsigned char drawpolygon_curs_bits[] = { + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x83, 0x00, + 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, 0xa5, 0x00, 0x00, 0x00, 0x99, 0x00, + 0x00, 0x00, 0x89, 0x03, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x01, 0x01, + 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawpolygon_mask.h b/vcl/inc/unx/x11_cursors/drawpolygon_mask.h new file mode 100644 index 000000000..0865ce1f5 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawpolygon_mask.h @@ -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 . + */ +#define drawpolygon_mask_width 32 +#define drawpolygon_mask_height 32 +static unsigned char drawpolygon_mask_bits[] = { + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1e, 0x06, + 0x00, 0x00, 0x1e, 0x07, 0x00, 0x00, 0xbe, 0x07, 0x00, 0x00, 0xfe, 0x07, + 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0x7e, 0x1f, 0x00, 0x00, 0x3e, 0x1f, + 0x00, 0x00, 0x0e, 0x0e, 0x00, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x0e, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawrect_curs.h b/vcl/inc/unx/x11_cursors/drawrect_curs.h new file mode 100644 index 000000000..4f98f355f --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawrect_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define drawrect_curs_width 32 +#define drawrect_curs_height 32 +#define drawrect_curs_x_hot 7 +#define drawrect_curs_y_hot 7 +static unsigned char drawrect_curs_bits[] = { + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x81, 0x00, + 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x81, 0x00, + 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawrect_mask.h b/vcl/inc/unx/x11_cursors/drawrect_mask.h new file mode 100644 index 000000000..b00b06c91 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawrect_mask.h @@ -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 . + */ +#define drawrect_mask_width 32 +#define drawrect_mask_height 32 +static unsigned char drawrect_mask_bits[] = { + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0x00, 0x80, 0xff, 0x01, 0x00, 0x80, 0xff, 0x01, 0x00, 0x80, 0xff, 0x01, + 0x00, 0x80, 0xc3, 0x01, 0x00, 0x80, 0xc3, 0x01, 0x00, 0x80, 0xff, 0x01, + 0x00, 0x80, 0xff, 0x01, 0x00, 0x80, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawtext_curs.h b/vcl/inc/unx/x11_cursors/drawtext_curs.h new file mode 100644 index 000000000..f530146d7 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawtext_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define drawtext_curs_width 32 +#define drawtext_curs_height 32 +#define drawtext_curs_x_hot 8 +#define drawtext_curs_y_hot 8 +static unsigned char drawtext_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xfd, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x81, 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x00, 0x80, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/drawtext_mask.h b/vcl/inc/unx/x11_cursors/drawtext_mask.h new file mode 100644 index 000000000..75c335bea --- /dev/null +++ b/vcl/inc/unx/x11_cursors/drawtext_mask.h @@ -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 . + */ +#define drawtext_mask_width 32 +#define drawtext_mask_height 32 +static unsigned char drawtext_mask_bits[] = { + 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, + 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, + 0x80, 0x03, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00, + 0xff, 0xff, 0x01, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, + 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0xc3, 0x1f, 0x00, + 0x80, 0xc3, 0x1f, 0x00, 0x80, 0xc3, 0x1f, 0x00, 0x00, 0x00, 0x07, 0x00, + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0xc0, 0x1f, 0x00, + 0x00, 0xc0, 0x1f, 0x00, 0x00, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/fill_curs.h b/vcl/inc/unx/x11_cursors/fill_curs.h new file mode 100644 index 000000000..1cdb63410 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/fill_curs.h @@ -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 . + */ +#define fill_curs_width 32 +#define fill_curs_height 32 +#define fill_curs_x_hot 10 +#define fill_curs_y_hot 22 +static unsigned char fill_curs_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x80,0x02,0x00,0x00,0x5c,0x0c,0x00,0x00, + 0x2e,0x12,0x00,0x00,0x17,0x38,0x00,0x00,0x0b,0x7c,0x00,0x00,0x5b,0xbe,0x00, + 0x00,0x27,0x9f,0x00,0x00,0xa7,0x4f,0x00,0x00,0xc7,0x27,0x00,0x00,0x87,0x13, + 0x00,0x00,0x06,0x09,0x00,0x00,0x06,0x06,0x00,0x00,0x04,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/fill_mask.h b/vcl/inc/unx/x11_cursors/fill_mask.h new file mode 100644 index 000000000..df5d4cdeb --- /dev/null +++ b/vcl/inc/unx/x11_cursors/fill_mask.h @@ -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 . + */ +#define fill_mask_width 32 +#define fill_mask_height 32 +#define fill_mask_x_hot 10 +#define fill_mask_y_hot 22 +static unsigned char fill_mask_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x80,0x03,0x00,0x00,0xdc,0x0f,0x00,0x00, + 0xfe,0x1f,0x00,0x00,0xff,0x3f,0x00,0x00,0xff,0x7f,0x00,0x00,0xff,0xff,0x00, + 0x00,0xe7,0xff,0x00,0x00,0xe7,0x7f,0x00,0x00,0xc7,0x3f,0x00,0x00,0x87,0x1f, + 0x00,0x00,0x06,0x0f,0x00,0x00,0x06,0x06,0x00,0x00,0x04,0x00,0x00,0x00,0x04, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/hshear_curs.h b/vcl/inc/unx/x11_cursors/hshear_curs.h new file mode 100644 index 000000000..5497f0515 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/hshear_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define hshear_curs_width 32 +#define hshear_curs_height 32 +#define hshear_curs_x_hot 15 +#define hshear_curs_y_hot 15 +static unsigned char hshear_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, + 0x00, 0x3c, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x0c, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/hshear_mask.h b/vcl/inc/unx/x11_cursors/hshear_mask.h new file mode 100644 index 000000000..c94277c6a --- /dev/null +++ b/vcl/inc/unx/x11_cursors/hshear_mask.h @@ -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 . + */ +#define hshear_mask_width 32 +#define hshear_mask_height 32 +static unsigned char hshear_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, + 0x80, 0xff, 0xff, 0x01, 0x80, 0xff, 0xff, 0x01, 0x80, 0xff, 0xff, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x01, + 0x80, 0xff, 0xff, 0x01, 0x80, 0xff, 0xff, 0x01, 0x00, 0x00, 0x3e, 0x00, + 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/invert50.h b/vcl/inc/unx/x11_cursors/invert50.h new file mode 100644 index 000000000..cae29c67e --- /dev/null +++ b/vcl/inc/unx/x11_cursors/invert50.h @@ -0,0 +1,40 @@ +/* -*- 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 . + */ +#define invert50_width 32 +#define invert50_height 32 +static unsigned char invert50_bits[] = { + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/linkdata_curs.h b/vcl/inc/unx/x11_cursors/linkdata_curs.h new file mode 100644 index 000000000..8a4e6db38 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/linkdata_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define linkdata_curs_width 32 +#define linkdata_curs_height 32 +#define linkdata_curs_x_hot 1 +#define linkdata_curs_y_hot 1 +static unsigned char linkdata_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x0e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, + 0x7e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, + 0xfe, 0x03, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, + 0x66, 0x00, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, + 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x10, 0x53, 0x00, 0x00, + 0x28, 0xa3, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x10, 0xf0, 0x1f, 0x00, 0x08, 0x70, 0x18, 0x00, 0x10, 0xf0, 0x18, 0x00, + 0xa8, 0x72, 0x18, 0x00, 0x50, 0x35, 0x1a, 0x00, 0x00, 0x30, 0x1f, 0x00, + 0x00, 0xb0, 0x1f, 0x00, 0x00, 0x70, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/linkdata_mask.h b/vcl/inc/unx/x11_cursors/linkdata_mask.h new file mode 100644 index 000000000..a1875a8e0 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/linkdata_mask.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define linkdata_mask_width 32 +#define linkdata_mask_height 32 +#define linkdata_mask_x_hot 1 +#define linkdata_mask_y_hot 1 +static unsigned char linkdata_mask_bits[] = { + 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, + 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, + 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + 0xff, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xe7, 0x03, 0x00, 0x00, + 0xe0, 0x03, 0x00, 0x00, 0xf8, 0xff, 0x00, 0x00, 0xfc, 0xff, 0x01, 0x00, + 0xfc, 0xff, 0x01, 0x00, 0xfc, 0xff, 0x01, 0x00, 0x3c, 0xf8, 0x3f, 0x00, + 0x3c, 0xf8, 0x3f, 0x00, 0x3c, 0xf8, 0x3f, 0x00, 0xfc, 0xff, 0x3f, 0x00, + 0xfc, 0xff, 0x3f, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x3f, 0x00, + 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, + 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/linkfile_curs.h b/vcl/inc/unx/x11_cursors/linkfile_curs.h new file mode 100644 index 000000000..571d928d4 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/linkfile_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define linkfile_curs_width 32 +#define linkfile_curs_height 32 +#define linkfile_curs_x_hot 9 +#define linkfile_curs_y_hot 9 +static unsigned char linkfile_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x02, 0x00, 0x00, + 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, + 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x04, 0x00, 0x00, + 0xfe, 0x02, 0x00, 0x00, 0xfe, 0x06, 0x00, 0x00, 0xfe, 0x0e, 0x00, 0x00, + 0xfe, 0x1e, 0x00, 0x00, 0xfe, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, + 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xfe, 0x03, 0x00, + 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, + 0x00, 0xc2, 0xe0, 0x3f, 0x00, 0xc0, 0xe0, 0x30, 0x00, 0x80, 0xe1, 0x31, + 0x00, 0x80, 0xe1, 0x30, 0x00, 0x00, 0x63, 0x34, 0x00, 0x00, 0x63, 0x3e, + 0x00, 0x00, 0x60, 0x3f, 0x00, 0x00, 0xe0, 0x3e, 0x00, 0x00, 0xe0, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/linkfile_mask.h b/vcl/inc/unx/x11_cursors/linkfile_mask.h new file mode 100644 index 000000000..cbef41368 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/linkfile_mask.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define linkfile_mask_width 32 +#define linkfile_mask_height 32 +#define linkfile_mask_x_hot 9 +#define linkfile_mask_y_hot 9 +static unsigned char linkfile_mask_bits[] = { + 0xff, 0x01, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, + 0xff, 0x7f, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, + 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, + 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xf1, 0x7f, + 0x00, 0xff, 0xf1, 0x7f, 0x00, 0xe7, 0xf3, 0x7f, 0x00, 0xe0, 0xf3, 0x7f, + 0x00, 0xc0, 0xf7, 0x7f, 0x00, 0xc0, 0xf7, 0x7f, 0x00, 0x80, 0xf7, 0x7f, + 0x00, 0x80, 0xf7, 0x7f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xf0, 0x7f, + 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/magnify_curs.h b/vcl/inc/unx/x11_cursors/magnify_curs.h new file mode 100644 index 000000000..4ce3d6e5a --- /dev/null +++ b/vcl/inc/unx/x11_cursors/magnify_curs.h @@ -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 . + */ +#define magnify_curs_width 32 +#define magnify_curs_height 32 +#define magnify_curs_x_hot 12 +#define magnify_curs_y_hot 13 +static unsigned char magnify_curs_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x83, + 0x01,0x00,0x80,0x00,0x02,0x00,0x40,0x00,0x04,0x00,0x40,0x00,0x04,0x00,0x20, + 0x00,0x08,0x00,0x20,0x00,0x08,0x00,0x20,0x00,0x08,0x00,0x20,0x00,0x08,0x00, + 0x20,0x00,0x08,0x00,0x40,0x00,0x04,0x00,0x40,0x00,0x04,0x00,0x80,0x00,0x06, + 0x00,0x00,0x83,0x0f,0x00,0x00,0x7c,0x1c,0x00,0x00,0x00,0x38,0x00,0x00,0x00, + 0x70,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/magnify_mask.h b/vcl/inc/unx/x11_cursors/magnify_mask.h new file mode 100644 index 000000000..fcc34f886 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/magnify_mask.h @@ -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 . + */ +#define magnify_mask_width 32 +#define magnify_mask_height 32 +static unsigned char magnify_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, + 0x00, 0xff, 0x01, 0x00, 0x80, 0xff, 0x03, 0x00, 0xc0, 0x83, 0x07, 0x00, + 0xe0, 0x00, 0x0e, 0x00, 0xe0, 0x00, 0x0e, 0x00, 0x70, 0x00, 0x1c, 0x00, + 0x70, 0x00, 0x1c, 0x00, 0x70, 0x00, 0x1c, 0x00, 0x70, 0x00, 0x1c, 0x00, + 0x70, 0x00, 0x1c, 0x00, 0xe0, 0x00, 0x0e, 0x00, 0xe0, 0x00, 0x0e, 0x00, + 0xc0, 0x83, 0x0f, 0x00, 0x80, 0xff, 0x1f, 0x00, 0x00, 0xff, 0x3f, 0x00, + 0x00, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0xf0, 0x01, + 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/mirror_curs.h b/vcl/inc/unx/x11_cursors/mirror_curs.h new file mode 100644 index 000000000..420ff3147 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/mirror_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define mirror_curs_width 32 +#define mirror_curs_height 32 +#define mirror_curs_x_hot 14 +#define mirror_curs_y_hot 12 +static unsigned char mirror_curs_bits[] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0x03, 0xf8, 0xf5, 0xff, + 0xfb, 0xfb, 0xee, 0xff, 0x0b, 0xfa, 0xf5, 0xff, 0xeb, 0xfa, 0xfa, 0xff, + 0xeb, 0xfa, 0xfa, 0xff, 0xeb, 0x7a, 0xfd, 0xff, 0xeb, 0x7a, 0xfd, 0xff, + 0xeb, 0xba, 0x7e, 0xff, 0xeb, 0xba, 0xbe, 0xfe, 0xeb, 0x5a, 0x5f, 0xfd, + 0x0b, 0x5a, 0xaf, 0xfa, 0xfb, 0xab, 0xd7, 0xf5, 0x03, 0xa8, 0xeb, 0xeb, + 0xff, 0xd7, 0xf5, 0xf5, 0xff, 0xd7, 0xfa, 0xfa, 0xff, 0x6b, 0x7d, 0xfd, + 0xff, 0xeb, 0xba, 0xfe, 0xff, 0xf5, 0x55, 0xff, 0xff, 0xf5, 0xab, 0xff, + 0xff, 0xfa, 0xd7, 0xff, 0x7f, 0xf7, 0xef, 0xff, 0xff, 0xfa, 0xff, 0xff, + 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/mirror_mask.h b/vcl/inc/unx/x11_cursors/mirror_mask.h new file mode 100644 index 000000000..157accb3c --- /dev/null +++ b/vcl/inc/unx/x11_cursors/mirror_mask.h @@ -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 . + */ +#define mirror_mask_width 32 +#define mirror_mask_height 32 +static unsigned char mirror_mask_bits[] = { + 0x00, 0x00, 0x04, 0x00, 0xfe, 0x0f, 0x0e, 0x00, 0xfe, 0x0f, 0x1f, 0x00, + 0xfe, 0x8f, 0x3f, 0x00, 0xfe, 0x0f, 0x1f, 0x00, 0xfe, 0x8f, 0x0f, 0x00, + 0xbe, 0x8f, 0x0f, 0x00, 0xbe, 0xcf, 0x07, 0x00, 0xbe, 0xcf, 0x87, 0x00, + 0xbe, 0xef, 0xc3, 0x01, 0xbe, 0xef, 0xe3, 0x03, 0xfe, 0xff, 0xf1, 0x07, + 0xfe, 0xff, 0x79, 0x0f, 0xfe, 0xff, 0x3c, 0x1e, 0xfe, 0xff, 0x1e, 0x3c, + 0xfe, 0x7f, 0x0f, 0x1e, 0x00, 0xfc, 0x07, 0x0f, 0x00, 0xfe, 0x83, 0x07, + 0x00, 0xbe, 0xc7, 0x03, 0x00, 0x1f, 0xef, 0x01, 0x00, 0x1f, 0xfe, 0x00, + 0x80, 0x0f, 0x7c, 0x00, 0xc0, 0x1d, 0x38, 0x00, 0x80, 0x0f, 0x10, 0x00, + 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movebezierweight_curs.h b/vcl/inc/unx/x11_cursors/movebezierweight_curs.h new file mode 100644 index 000000000..fdae75127 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/movebezierweight_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define movebezierweight_curs_width 32 +#define movebezierweight_curs_height 32 +#define movebezierweight_curs_x_hot 0 +#define movebezierweight_curs_y_hot 0 +static unsigned char movebezierweight_curs_bits[] = { + 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, + 0xf1, 0xff, 0xff, 0xff, 0xe1, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xff, 0xff, + 0x81, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0x01, 0xfe, 0xff, 0xff, + 0x01, 0xfc, 0xff, 0xff, 0x81, 0xff, 0xff, 0xff, 0x91, 0xff, 0xff, 0xff, + 0x99, 0xff, 0xff, 0xef, 0x3d, 0xff, 0xff, 0xef, 0x3f, 0xff, 0xff, 0xef, + 0x7f, 0xfe, 0xff, 0xf7, 0x7f, 0xfe, 0xff, 0xf7, 0xff, 0xfc, 0xff, 0xfb, + 0xff, 0x7c, 0xff, 0xec, 0xff, 0xbf, 0x0e, 0xd7, 0xff, 0x7f, 0xf3, 0xef, + 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, + 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movebezierweight_mask.h b/vcl/inc/unx/x11_cursors/movebezierweight_mask.h new file mode 100644 index 000000000..08203fe76 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/movebezierweight_mask.h @@ -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 . + */ +#define movebezierweight_mask_width 32 +#define movebezierweight_mask_height 32 +static unsigned char movebezierweight_mask_bits[] = { + 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, + 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, + 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, + 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x10, + 0xff, 0x00, 0x00, 0x38, 0xe7, 0x01, 0x00, 0x38, 0xe3, 0x01, 0x00, 0x38, + 0xc0, 0x03, 0x00, 0x1c, 0xc0, 0x03, 0x00, 0x1c, 0x80, 0x87, 0x00, 0x1f, + 0x80, 0xc7, 0xf1, 0x3f, 0x80, 0xe7, 0xff, 0x7f, 0x00, 0xc0, 0xff, 0x38, + 0x00, 0x80, 0x0f, 0x10, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movedata_curs.h b/vcl/inc/unx/x11_cursors/movedata_curs.h new file mode 100644 index 000000000..b253ce70c --- /dev/null +++ b/vcl/inc/unx/x11_cursors/movedata_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define movedata_curs_width 32 +#define movedata_curs_height 32 +#define movedata_curs_x_hot 1 +#define movedata_curs_y_hot 1 +static unsigned char movedata_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x0e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, + 0x7e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, + 0xfe, 0x03, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, + 0x66, 0x00, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, + 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x10, 0x53, 0x00, 0x00, + 0x28, 0xa3, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, + 0x10, 0x40, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00, + 0xa8, 0xaa, 0x00, 0x00, 0x50, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movedata_mask.h b/vcl/inc/unx/x11_cursors/movedata_mask.h new file mode 100644 index 000000000..d317b1556 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/movedata_mask.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define movedata_mask_width 32 +#define movedata_mask_height 32 +#define movedata_mask_x_hot 1 +#define movedata_mask_y_hot 1 +static unsigned char movedata_mask_bits[] = { + 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, + 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, + 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + 0xff, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xe7, 0x03, 0x00, 0x00, + 0xe0, 0x03, 0x00, 0x00, 0xf8, 0xff, 0x00, 0x00, 0xfc, 0xff, 0x01, 0x00, + 0xfc, 0xff, 0x01, 0x00, 0xfc, 0xff, 0x01, 0x00, 0x3c, 0xe0, 0x01, 0x00, + 0x3c, 0xe0, 0x01, 0x00, 0x3c, 0xe0, 0x01, 0x00, 0xfc, 0xff, 0x01, 0x00, + 0xfc, 0xff, 0x01, 0x00, 0xfc, 0xff, 0x01, 0x00, 0xf8, 0xff, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movedlnk_curs.h b/vcl/inc/unx/x11_cursors/movedlnk_curs.h new file mode 100644 index 000000000..1e82e277a --- /dev/null +++ b/vcl/inc/unx/x11_cursors/movedlnk_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define movedlnk_curs_width 32 +#define movedlnk_curs_height 32 +#define movedlnk_curs_x_hot 1 +#define movedlnk_curs_y_hot 1 +static unsigned char movedlnk_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x0e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, + 0x7e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, + 0xfe, 0x03, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, + 0x66, 0x00, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, + 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x10, 0x53, 0x00, 0x00, + 0x28, 0xa3, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf0, 0x81, 0x00, 0x00, + 0x30, 0x41, 0x00, 0x00, 0x10, 0x81, 0x00, 0x00, 0xd0, 0x41, 0x00, 0x00, + 0xf0, 0xa9, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movedlnk_mask.h b/vcl/inc/unx/x11_cursors/movedlnk_mask.h new file mode 100644 index 000000000..e56f9714c --- /dev/null +++ b/vcl/inc/unx/x11_cursors/movedlnk_mask.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define movedlnk_mask_width 32 +#define movedlnk_mask_height 32 +#define movedlnk_mask_x_hot 1 +#define movedlnk_mask_y_hot 1 +static unsigned char movedlnk_mask_bits[] = { + 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, + 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, + 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + 0xff, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xe7, 0x03, 0x00, 0x00, + 0xe0, 0x03, 0x00, 0x00, 0xf8, 0xff, 0x00, 0x00, 0xfc, 0xff, 0x01, 0x00, + 0xfc, 0xff, 0x01, 0x00, 0xfc, 0xff, 0x01, 0x00, 0xf8, 0xe3, 0x01, 0x00, + 0xf8, 0xe3, 0x01, 0x00, 0xf8, 0xe3, 0x01, 0x00, 0xf8, 0xff, 0x01, 0x00, + 0xf8, 0xff, 0x01, 0x00, 0xf8, 0xff, 0x01, 0x00, 0x00, 0xfe, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movefile_curs.h b/vcl/inc/unx/x11_cursors/movefile_curs.h new file mode 100644 index 000000000..3ffea197f --- /dev/null +++ b/vcl/inc/unx/x11_cursors/movefile_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define movefile_curs_width 32 +#define movefile_curs_height 32 +#define movefile_curs_x_hot 9 +#define movefile_curs_y_hot 9 +static unsigned char movefile_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x02, 0x00, 0x00, + 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, + 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x04, 0x00, 0x00, + 0xfe, 0x02, 0x00, 0x00, 0xfe, 0x06, 0x00, 0x00, 0xfe, 0x0e, 0x00, 0x00, + 0xfe, 0x1e, 0x00, 0x00, 0xfe, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, + 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xfe, 0x03, 0x00, + 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, + 0x00, 0xc2, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, + 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movefile_mask.h b/vcl/inc/unx/x11_cursors/movefile_mask.h new file mode 100644 index 000000000..ab74f25d8 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/movefile_mask.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define movefile_mask_width 32 +#define movefile_mask_height 32 +#define movefile_mask_x_hot 9 +#define movefile_mask_y_hot 9 +static unsigned char movefile_mask_bits[] = { + 0xff, 0x01, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, + 0xff, 0x7f, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, + 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, + 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, + 0x00, 0xff, 0x01, 0x00, 0x00, 0xe7, 0x03, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0xc0, 0x07, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x80, 0x07, 0x00, + 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movefiles_curs.h b/vcl/inc/unx/x11_cursors/movefiles_curs.h new file mode 100644 index 000000000..d5c726a2e --- /dev/null +++ b/vcl/inc/unx/x11_cursors/movefiles_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define movefiles_curs_width 32 +#define movefiles_curs_height 32 +#define movefiles_curs_x_hot 8 +#define movefiles_curs_y_hot 9 +static unsigned char movefiles_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xe0, 0x2f, 0x00, 0x00, + 0xe8, 0x0f, 0x00, 0x00, 0xe8, 0x7f, 0x00, 0x00, 0xea, 0x7f, 0x00, 0x00, + 0xea, 0x7f, 0x00, 0x00, 0xea, 0x7f, 0x00, 0x00, 0x6a, 0x7e, 0x00, 0x00, + 0x6a, 0x7d, 0x00, 0x00, 0x6a, 0x7b, 0x00, 0x00, 0x6a, 0x77, 0x00, 0x00, + 0x6a, 0x6f, 0x00, 0x00, 0x6a, 0x5f, 0x00, 0x00, 0x0a, 0x3f, 0x00, 0x00, + 0x7a, 0x7f, 0x00, 0x00, 0x02, 0xff, 0x00, 0x00, 0x7e, 0xff, 0x01, 0x00, + 0x00, 0x3f, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, + 0x00, 0x61, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, + 0x00, 0xc0, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movefiles_mask.h b/vcl/inc/unx/x11_cursors/movefiles_mask.h new file mode 100644 index 000000000..c1683b333 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/movefiles_mask.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define movefiles_mask_width 32 +#define movefiles_mask_height 32 +#define movefiles_mask_x_hot 8 +#define movefiles_mask_y_hot 9 +static unsigned char movefiles_mask_bits[] = { + 0xf0, 0x1f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, + 0xfc, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, + 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, + 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, + 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, + 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x03, 0x00, 0xff, 0xff, 0x03, 0x00, + 0xff, 0xff, 0x03, 0x00, 0x80, 0x7f, 0x00, 0x00, 0x80, 0xff, 0x00, 0x00, + 0x80, 0xff, 0x00, 0x00, 0x80, 0xf3, 0x01, 0x00, 0x00, 0xf0, 0x01, 0x00, + 0x00, 0xe0, 0x03, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x03, 0x00, + 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/moveflnk_curs.h b/vcl/inc/unx/x11_cursors/moveflnk_curs.h new file mode 100644 index 000000000..02d0c8145 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/moveflnk_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define moveflnk_curs_width 32 +#define moveflnk_curs_height 32 +#define moveflnk_curs_x_hot 9 +#define moveflnk_curs_y_hot 9 +static unsigned char moveflnk_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x02, 0x00, 0x00, + 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, + 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, + 0xbe, 0x02, 0x00, 0x00, 0xa6, 0x06, 0x00, 0x00, 0xa2, 0x0e, 0x00, 0x00, + 0xba, 0x1e, 0x00, 0x00, 0xbe, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, + 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xfe, 0x03, 0x00, + 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, + 0x00, 0xc2, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, + 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/moveflnk_mask.h b/vcl/inc/unx/x11_cursors/moveflnk_mask.h new file mode 100644 index 000000000..189c11443 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/moveflnk_mask.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define moveflnk_mask_width 32 +#define moveflnk_mask_height 32 +#define moveflnk_mask_x_hot 9 +#define moveflnk_mask_y_hot 9 +static unsigned char moveflnk_mask_bits[] = { + 0xff, 0x01, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, + 0xff, 0x7f, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, + 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, + 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, + 0x00, 0xff, 0x01, 0x00, 0x00, 0xe7, 0x03, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0xc0, 0x07, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x80, 0x07, 0x00, + 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movepoint_curs.h b/vcl/inc/unx/x11_cursors/movepoint_curs.h new file mode 100644 index 000000000..7f85113ce --- /dev/null +++ b/vcl/inc/unx/x11_cursors/movepoint_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define movepoint_curs_width 32 +#define movepoint_curs_height 32 +#define movepoint_curs_x_hot 0 +#define movepoint_curs_y_hot 0 +static unsigned char movepoint_curs_bits[] = { + 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, + 0xf1, 0xff, 0xff, 0xff, 0xe1, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xff, 0xff, + 0x81, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0x01, 0xfe, 0xff, 0xff, + 0x01, 0xfc, 0xff, 0xff, 0x81, 0xff, 0xff, 0xff, 0x91, 0xff, 0xff, 0xff, + 0x39, 0xff, 0xff, 0xff, 0x3d, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff, + 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xfc, 0x83, 0xff, 0xff, 0xfc, 0x83, 0xff, + 0xff, 0xff, 0x83, 0xff, 0xff, 0xff, 0x83, 0xff, 0xff, 0xff, 0x83, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/movepoint_mask.h b/vcl/inc/unx/x11_cursors/movepoint_mask.h new file mode 100644 index 000000000..aa16b5a56 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/movepoint_mask.h @@ -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 . + */ +#define movepoint_mask_width 32 +#define movepoint_mask_height 32 +static unsigned char movepoint_mask_bits[] = { + 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, + 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, + 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, + 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + 0xef, 0x01, 0x00, 0x00, 0xe7, 0x01, 0x00, 0x00, 0xc3, 0x03, 0x00, 0x00, + 0xc0, 0x03, 0xfe, 0x00, 0x80, 0x07, 0xfe, 0x00, 0x80, 0x07, 0xfe, 0x00, + 0x80, 0x07, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x00, + 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/nodrop_curs.h b/vcl/inc/unx/x11_cursors/nodrop_curs.h new file mode 100644 index 000000000..958257518 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/nodrop_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define nodrop_curs_width 32 +#define nodrop_curs_height 32 +#define nodrop_curs_x_hot 9 +#define nodrop_curs_y_hot 9 +static unsigned char nodrop_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, + 0xf8, 0x7f, 0x00, 0x00, 0x7c, 0xf8, 0x00, 0x00, 0x1c, 0xfc, 0x00, 0x00, + 0x1e, 0xfe, 0x01, 0x00, 0x0e, 0xdf, 0x01, 0x00, 0x8e, 0xcf, 0x01, 0x00, + 0xce, 0xc7, 0x01, 0x00, 0xee, 0xc3, 0x01, 0x00, 0xfe, 0xe1, 0x01, 0x00, + 0xfc, 0xe0, 0x00, 0x00, 0x7c, 0xf8, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, + 0xf0, 0x3f, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/nodrop_mask.h b/vcl/inc/unx/x11_cursors/nodrop_mask.h new file mode 100644 index 000000000..662a30064 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/nodrop_mask.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define nodrop_mask_width 32 +#define nodrop_mask_height 32 +#define nodrop_mask_x_hot 9 +#define nodrop_mask_y_hot 9 +static unsigned char nodrop_mask_bits[] = { + 0xc0, 0x0f, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, + 0xfc, 0xff, 0x00, 0x00, 0xfe, 0xff, 0x01, 0x00, 0x7e, 0xfe, 0x01, 0x00, + 0x3f, 0xff, 0x03, 0x00, 0x9f, 0xff, 0x03, 0x00, 0xdf, 0xff, 0x03, 0x00, + 0xff, 0xef, 0x03, 0x00, 0xff, 0xe7, 0x03, 0x00, 0xff, 0xf3, 0x03, 0x00, + 0xfe, 0xf9, 0x01, 0x00, 0xfe, 0xff, 0x01, 0x00, 0xfc, 0xff, 0x00, 0x00, + 0xf8, 0x7f, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/null_curs.h b/vcl/inc/unx/x11_cursors/null_curs.h new file mode 100644 index 000000000..ebeee4e6f --- /dev/null +++ b/vcl/inc/unx/x11_cursors/null_curs.h @@ -0,0 +1,24 @@ +/* -*- 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 . + */ +#define nullcurs_width 4 +#define nullcurs_height 4 +#define nullcurs_x_hot 2 +#define nullcurs_y_hot 2 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/null_mask.h b/vcl/inc/unx/x11_cursors/null_mask.h new file mode 100644 index 000000000..71f08a94a --- /dev/null +++ b/vcl/inc/unx/x11_cursors/null_mask.h @@ -0,0 +1,22 @@ +/* -*- 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 . + */ +#define nullmask_width 4 +#define nullmask_height 4 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/pivotcol_curs.h b/vcl/inc/unx/x11_cursors/pivotcol_curs.h new file mode 100644 index 000000000..a34520ab0 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/pivotcol_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define pivotcol_curs_width 32 +#define pivotcol_curs_height 32 +#define pivotcol_curs_x_hot 7 +#define pivotcol_curs_y_hot 5 +static unsigned char pivotcol_curs_bits[] = { + 0xff, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x55, 0x01, 0x00, 0x00, + 0x29, 0x01, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, 0xa9, 0x00, 0x00, 0x00, + 0x95, 0x01, 0x00, 0x00, 0xa9, 0x02, 0x00, 0x00, 0x95, 0x04, 0x00, 0x00, + 0xa9, 0x08, 0x00, 0x00, 0x95, 0x10, 0x00, 0x00, 0xa9, 0x20, 0x00, 0x00, + 0x95, 0x40, 0x00, 0x00, 0xa9, 0x80, 0x00, 0x00, 0x95, 0x00, 0x01, 0x00, + 0xa9, 0xe0, 0x03, 0x00, 0x95, 0x2c, 0x00, 0x00, 0xbd, 0x4a, 0x00, 0x00, + 0xbf, 0x51, 0x00, 0x00, 0x80, 0x90, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, + 0x00, 0x20, 0x01, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/pivotcol_mask.h b/vcl/inc/unx/x11_cursors/pivotcol_mask.h new file mode 100644 index 000000000..9571a031c --- /dev/null +++ b/vcl/inc/unx/x11_cursors/pivotcol_mask.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define pivotcol_mask_width 32 +#define pivotcol_mask_height 32 +#define pivotcol_mask_x_hot 7 +#define pivotcol_mask_y_hot 5 +static unsigned char pivotcol_mask_bits[] = { + 0xff, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, + 0xff, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, + 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, + 0xff, 0x7f, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, + 0xff, 0xff, 0x03, 0x00, 0xff, 0x3f, 0x00, 0x00, 0xff, 0x7b, 0x00, 0x00, + 0xff, 0x71, 0x00, 0x00, 0x80, 0xf0, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, + 0x00, 0xe0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/pivotdel_curs.h b/vcl/inc/unx/x11_cursors/pivotdel_curs.h new file mode 100644 index 000000000..d4547e25f --- /dev/null +++ b/vcl/inc/unx/x11_cursors/pivotdel_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define pivotdel_curs_width 32 +#define pivotdel_curs_height 32 +#define pivotdel_curs_x_hot 9 +#define pivotdel_curs_y_hot 8 +static unsigned char pivotdel_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x80, 0x01, 0x00, + 0x3c, 0xc0, 0x00, 0x00, 0x73, 0x6f, 0x07, 0x00, 0xe1, 0x30, 0x04, 0x00, + 0xc1, 0x1d, 0x04, 0x00, 0x81, 0x0f, 0x04, 0x00, 0x01, 0x07, 0x04, 0x00, + 0x81, 0x0f, 0x04, 0x00, 0xc1, 0x1d, 0x04, 0x00, 0xe1, 0x38, 0x04, 0x00, + 0x77, 0xaf, 0x07, 0x00, 0x78, 0x40, 0x00, 0x00, 0x3c, 0x80, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/pivotdel_mask.h b/vcl/inc/unx/x11_cursors/pivotdel_mask.h new file mode 100644 index 000000000..68868aeec --- /dev/null +++ b/vcl/inc/unx/x11_cursors/pivotdel_mask.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define pivotdel_mask_width 32 +#define pivotdel_mask_height 32 +#define pivotdel_mask_x_hot 9 +#define pivotdel_mask_y_hot 8 +static unsigned char pivotdel_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x80, 0x01, 0x00, + 0x3c, 0xc0, 0x00, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, + 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, + 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, + 0xff, 0xff, 0x07, 0x00, 0x78, 0x40, 0x00, 0x00, 0x3c, 0x80, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/pivotfld_curs.h b/vcl/inc/unx/x11_cursors/pivotfld_curs.h new file mode 100644 index 000000000..287bc9709 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/pivotfld_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define pivotfld_curs_width 32 +#define pivotfld_curs_height 32 +#define pivotfld_curs_x_hot 8 +#define pivotfld_curs_y_hot 7 +static unsigned char pivotfld_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x00, + 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x01, 0x00, 0x04, 0x00, 0x01, 0x01, 0x04, 0x00, 0x01, 0x03, 0x04, 0x00, + 0x01, 0x05, 0x04, 0x00, 0x7f, 0xc9, 0x07, 0x00, 0x00, 0x11, 0x00, 0x00, + 0x00, 0x21, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, + 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0xc1, 0x07, 0x00, + 0x00, 0x59, 0x00, 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0xa3, 0x00, 0x00, + 0x00, 0x21, 0x01, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x80, 0x02, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/pivotfld_mask.h b/vcl/inc/unx/x11_cursors/pivotfld_mask.h new file mode 100644 index 000000000..0d5244722 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/pivotfld_mask.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define pivotfld_mask_width 32 +#define pivotfld_mask_height 32 +#define pivotfld_mask_x_hot 8 +#define pivotfld_mask_y_hot 7 +static unsigned char pivotfld_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x00, + 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, + 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, + 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0x00, 0x1f, 0x00, 0x00, + 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, + 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, + 0x00, 0x7f, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, + 0x00, 0xe1, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x03, 0x00, + 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/pivotrow_curs.h b/vcl/inc/unx/x11_cursors/pivotrow_curs.h new file mode 100644 index 000000000..4aec27919 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/pivotrow_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define pivotrow_curs_width 32 +#define pivotrow_curs_height 32 +#define pivotrow_curs_x_hot 8 +#define pivotrow_curs_y_hot 7 +static unsigned char pivotrow_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x00, + 0x01, 0x00, 0x04, 0x00, 0x55, 0x55, 0x07, 0x00, 0xa9, 0xaa, 0x06, 0x00, + 0x55, 0x54, 0x07, 0x00, 0x29, 0xa9, 0x06, 0x00, 0x55, 0x53, 0x07, 0x00, + 0x29, 0xa5, 0x06, 0x00, 0x7f, 0xc9, 0x07, 0x00, 0x00, 0x11, 0x00, 0x00, + 0x00, 0x21, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, + 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0xc1, 0x07, 0x00, + 0x00, 0x59, 0x00, 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0xa3, 0x00, 0x00, + 0x00, 0x21, 0x01, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x80, 0x02, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/pivotrow_mask.h b/vcl/inc/unx/x11_cursors/pivotrow_mask.h new file mode 100644 index 000000000..ec9f7f2ba --- /dev/null +++ b/vcl/inc/unx/x11_cursors/pivotrow_mask.h @@ -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 . + */ +#define pivotrow_mask_width 32 +#define pivotrow_mask_height 32 +static unsigned char pivotrow_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x00, + 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, + 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, + 0xff, 0xff, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0x00, 0x1f, 0x00, 0x00, + 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, + 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, + 0x00, 0x7f, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, + 0x00, 0xe1, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x03, 0x00, + 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/rotate_curs.h b/vcl/inc/unx/x11_cursors/rotate_curs.h new file mode 100644 index 000000000..936f9f12b --- /dev/null +++ b/vcl/inc/unx/x11_cursors/rotate_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define rotate_curs_width 32 +#define rotate_curs_height 32 +#define rotate_curs_x_hot 15 +#define rotate_curs_y_hot 15 +static unsigned char rotate_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, + 0x00, 0xc0, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0xd8, 0x00, 0x00, + 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, + 0x80, 0x00, 0xc0, 0x01, 0x80, 0x00, 0xe0, 0x03, 0x80, 0x00, 0x80, 0x00, + 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x02, 0x20, 0x00, + 0x00, 0x04, 0x10, 0x00, 0x00, 0x18, 0x0c, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/rotate_mask.h b/vcl/inc/unx/x11_cursors/rotate_mask.h new file mode 100644 index 000000000..44804f00f --- /dev/null +++ b/vcl/inc/unx/x11_cursors/rotate_mask.h @@ -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 . + */ +#define rotate_mask_width 32 +#define rotate_mask_height 32 +static unsigned char rotate_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, + 0x00, 0xe0, 0x01, 0x00, 0x00, 0xf8, 0x03, 0x00, 0x00, 0xfc, 0x01, 0x00, + 0x00, 0xfe, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, + 0x80, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01, + 0xc0, 0x01, 0xe0, 0x03, 0xc0, 0x01, 0xf0, 0x07, 0xc0, 0x01, 0xf0, 0x07, + 0x80, 0x03, 0xe0, 0x00, 0x80, 0x03, 0xe0, 0x00, 0x00, 0x07, 0x70, 0x00, + 0x00, 0x1e, 0x3c, 0x00, 0x00, 0xfc, 0x1f, 0x00, 0x00, 0xf8, 0x0f, 0x00, + 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/salcursors.h b/vcl/inc/unx/x11_cursors/salcursors.h new file mode 100644 index 000000000..1b8aa6c08 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/salcursors.h @@ -0,0 +1,151 @@ +/* -*- 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 <unx/x11_cursors/nodrop_curs.h> +#include <unx/x11_cursors/nodrop_mask.h> +#include <unx/x11_cursors/magnify_curs.h> +#include <unx/x11_cursors/magnify_mask.h> +#include <unx/x11_cursors/rotate_curs.h> +#include <unx/x11_cursors/rotate_mask.h> +#include <unx/x11_cursors/hshear_curs.h> +#include <unx/x11_cursors/hshear_mask.h> +#include <unx/x11_cursors/vshear_curs.h> +#include <unx/x11_cursors/vshear_mask.h> +#include <unx/x11_cursors/drawline_curs.h> +#include <unx/x11_cursors/drawline_mask.h> +#include <unx/x11_cursors/drawrect_curs.h> +#include <unx/x11_cursors/drawrect_mask.h> +#include <unx/x11_cursors/drawpolygon_curs.h> +#include <unx/x11_cursors/drawpolygon_mask.h> +#include <unx/x11_cursors/drawbezier_curs.h> +#include <unx/x11_cursors/drawbezier_mask.h> +#include <unx/x11_cursors/drawarc_curs.h> +#include <unx/x11_cursors/drawarc_mask.h> +#include <unx/x11_cursors/drawpie_curs.h> +#include <unx/x11_cursors/drawpie_mask.h> +#include <unx/x11_cursors/drawcirclecut_curs.h> +#include <unx/x11_cursors/drawcirclecut_mask.h> +#include <unx/x11_cursors/drawellipse_curs.h> +#include <unx/x11_cursors/drawellipse_mask.h> +#include <unx/x11_cursors/drawconnect_curs.h> +#include <unx/x11_cursors/drawconnect_mask.h> +#include <unx/x11_cursors/drawtext_curs.h> +#include <unx/x11_cursors/drawtext_mask.h> +#include <unx/x11_cursors/mirror_curs.h> +#include <unx/x11_cursors/mirror_mask.h> +#include <unx/x11_cursors/crook_curs.h> +#include <unx/x11_cursors/crook_mask.h> +#include <unx/x11_cursors/crop_curs.h> +#include <unx/x11_cursors/crop_mask.h> +#include <unx/x11_cursors/movepoint_curs.h> +#include <unx/x11_cursors/movepoint_mask.h> +#include <unx/x11_cursors/movebezierweight_curs.h> +#include <unx/x11_cursors/movebezierweight_mask.h> +#include <unx/x11_cursors/drawfreehand_curs.h> +#include <unx/x11_cursors/drawfreehand_mask.h> +#include <unx/x11_cursors/drawcaption_curs.h> +#include <unx/x11_cursors/drawcaption_mask.h> +#include <unx/x11_cursors/movedata_curs.h> +#include <unx/x11_cursors/movedata_mask.h> +#include <unx/x11_cursors/copydata_curs.h> +#include <unx/x11_cursors/copydata_mask.h> +#include <unx/x11_cursors/linkdata_curs.h> +#include <unx/x11_cursors/linkdata_mask.h> +#include <unx/x11_cursors/movedlnk_curs.h> +#include <unx/x11_cursors/movedlnk_mask.h> +#include <unx/x11_cursors/copydlnk_curs.h> +#include <unx/x11_cursors/copydlnk_mask.h> +#include <unx/x11_cursors/movefile_curs.h> +#include <unx/x11_cursors/movefile_mask.h> +#include <unx/x11_cursors/copyfile_curs.h> +#include <unx/x11_cursors/copyfile_mask.h> +#include <unx/x11_cursors/linkfile_curs.h> +#include <unx/x11_cursors/linkfile_mask.h> +#include <unx/x11_cursors/moveflnk_curs.h> +#include <unx/x11_cursors/moveflnk_mask.h> +#include <unx/x11_cursors/copyflnk_curs.h> +#include <unx/x11_cursors/copyflnk_mask.h> +#include <unx/x11_cursors/movefiles_curs.h> +#include <unx/x11_cursors/movefiles_mask.h> +#include <unx/x11_cursors/copyfiles_curs.h> +#include <unx/x11_cursors/copyfiles_mask.h> + +#include <unx/x11_cursors/chart_curs.h> +#include <unx/x11_cursors/chart_mask.h> +#include <unx/x11_cursors/detective_curs.h> +#include <unx/x11_cursors/detective_mask.h> +#include <unx/x11_cursors/pivotcol_curs.h> +#include <unx/x11_cursors/pivotcol_mask.h> +#include <unx/x11_cursors/pivotfld_curs.h> +#include <unx/x11_cursors/pivotfld_mask.h> +#include <unx/x11_cursors/pivotrow_curs.h> +#include <unx/x11_cursors/pivotrow_mask.h> +#include <unx/x11_cursors/pivotdel_curs.h> +#include <unx/x11_cursors/pivotdel_mask.h> + +#include <unx/x11_cursors/chain_curs.h> +#include <unx/x11_cursors/chain_mask.h> +#include <unx/x11_cursors/chainnot_curs.h> +#include <unx/x11_cursors/chainnot_mask.h> + +#include <unx/x11_cursors/ase_curs.h> +#include <unx/x11_cursors/ase_mask.h> +#include <unx/x11_cursors/asn_curs.h> +#include <unx/x11_cursors/asn_mask.h> +#include <unx/x11_cursors/asne_curs.h> +#include <unx/x11_cursors/asne_mask.h> +#include <unx/x11_cursors/asns_curs.h> +#include <unx/x11_cursors/asns_mask.h> +#include <unx/x11_cursors/asnswe_curs.h> +#include <unx/x11_cursors/asnswe_mask.h> +#include <unx/x11_cursors/asnw_curs.h> +#include <unx/x11_cursors/asnw_mask.h> +#include <unx/x11_cursors/ass_curs.h> +#include <unx/x11_cursors/ass_mask.h> +#include <unx/x11_cursors/asse_curs.h> +#include <unx/x11_cursors/asse_mask.h> +#include <unx/x11_cursors/assw_curs.h> +#include <unx/x11_cursors/assw_mask.h> +#include <unx/x11_cursors/asw_curs.h> +#include <unx/x11_cursors/asw_mask.h> +#include <unx/x11_cursors/aswe_curs.h> +#include <unx/x11_cursors/aswe_mask.h> +#include <unx/x11_cursors/null_curs.h> +#include <unx/x11_cursors/null_mask.h> + +#include <unx/x11_cursors/fill_curs.h> +#include <unx/x11_cursors/fill_mask.h> +#include <unx/x11_cursors/vertcurs_curs.h> +#include <unx/x11_cursors/vertcurs_mask.h> +#include <unx/x11_cursors/tblsele_curs.h> +#include <unx/x11_cursors/tblsele_mask.h> +#include <unx/x11_cursors/tblsels_curs.h> +#include <unx/x11_cursors/tblsels_mask.h> +#include <unx/x11_cursors/tblselse_curs.h> +#include <unx/x11_cursors/tblselse_mask.h> +#include <unx/x11_cursors/tblselw_curs.h> +#include <unx/x11_cursors/tblselw_mask.h> +#include <unx/x11_cursors/tblselsw_curs.h> +#include <unx/x11_cursors/tblselsw_mask.h> +#include <unx/x11_cursors/wshide_curs.h> +#include <unx/x11_cursors/wshide_mask.h> +#include <unx/x11_cursors/wsshow_curs.h> +#include <unx/x11_cursors/wsshow_mask.h> + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/tblsele_curs.h b/vcl/inc/unx/x11_cursors/tblsele_curs.h new file mode 100644 index 000000000..e8ca82dd5 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/tblsele_curs.h @@ -0,0 +1,29 @@ +/* -*- 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 . + */ + +#define tblsele_curs_width 16 +#define tblsele_curs_height 16 +#define tblsele_curs_x_hot 14 +#define tblsele_curs_y_hot 8 +static unsigned char tblsele_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0c, + 0x00, 0x1c, 0xfc, 0x3f, 0xfc, 0x7f, 0xfc, 0x3f, 0x00, 0x1c, 0x00, 0x0c, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/tblsele_mask.h b/vcl/inc/unx/x11_cursors/tblsele_mask.h new file mode 100644 index 000000000..6bb306e73 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/tblsele_mask.h @@ -0,0 +1,27 @@ +/* -*- 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 . + */ + +#define tblsele_mask_width 16 +#define tblsele_mask_height 16 +static unsigned char tblsele_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0e, 0x00, 0x1e, + 0xfe, 0x3f, 0xfe, 0x7f, 0xfe, 0xff, 0xfe, 0x7f, 0xfe, 0x3f, 0x00, 0x1e, + 0x00, 0x0e, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/tblsels_curs.h b/vcl/inc/unx/x11_cursors/tblsels_curs.h new file mode 100644 index 000000000..54d37ddb0 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/tblsels_curs.h @@ -0,0 +1,29 @@ +/* -*- 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 . + */ + +#define tblsels_curs_width 16 +#define tblsels_curs_height 16 +#define tblsels_curs_x_hot 7 +#define tblsels_curs_y_hot 14 +static unsigned char tblsels_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xf8, 0x0f, 0xf0, 0x07, + 0xe0, 0x03, 0xc0, 0x01, 0x80, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/tblsels_mask.h b/vcl/inc/unx/x11_cursors/tblsels_mask.h new file mode 100644 index 000000000..3b6ae7118 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/tblsels_mask.h @@ -0,0 +1,27 @@ +/* -*- 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 . + */ + +#define tblsels_mask_width 16 +#define tblsels_mask_height 16 +static unsigned char tblsels_mask_bits[] = { + 0x00, 0x00, 0xe0, 0x03, 0xe0, 0x03, 0xe0, 0x03, 0xe0, 0x03, 0xe0, 0x03, + 0xe0, 0x03, 0xe0, 0x03, 0xe0, 0x03, 0xfc, 0x1f, 0xfc, 0x1f, 0xf8, 0x0f, + 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, 0x80, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/tblselse_curs.h b/vcl/inc/unx/x11_cursors/tblselse_curs.h new file mode 100644 index 000000000..9bedaabcc --- /dev/null +++ b/vcl/inc/unx/x11_cursors/tblselse_curs.h @@ -0,0 +1,29 @@ +/* -*- 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 . + */ + +#define tblselse_curs_width 16 +#define tblselse_curs_height 16 +#define tblselse_curs_x_hot 14 +#define tblselse_curs_y_hot 14 +static unsigned char tblselse_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0xf0, 0x00, + 0xf0, 0x01, 0xe0, 0x03, 0xc0, 0x47, 0x80, 0x6f, 0x00, 0x7f, 0x00, 0x7e, + 0x00, 0x7c, 0x00, 0x7e, 0x00, 0x7f, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/tblselse_mask.h b/vcl/inc/unx/x11_cursors/tblselse_mask.h new file mode 100644 index 000000000..26cbc3282 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/tblselse_mask.h @@ -0,0 +1,27 @@ +/* -*- 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 . + */ + +#define tblselse_mask_width 16 +#define tblselse_mask_height 16 +static unsigned char tblselse_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0xf0, 0x00, 0xf8, 0x01, + 0xf8, 0x03, 0xf0, 0xc7, 0xe0, 0xef, 0xc0, 0xff, 0x80, 0xff, 0x00, 0xff, + 0x00, 0xfe, 0x00, 0xff, 0x80, 0xff, 0x80, 0xff }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/tblselsw_curs.h b/vcl/inc/unx/x11_cursors/tblselsw_curs.h new file mode 100644 index 000000000..c6f6dedf1 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/tblselsw_curs.h @@ -0,0 +1,29 @@ +/* -*- 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 . + */ + +#define tblselsw_curs_width 16 +#define tblselsw_curs_height 16 +#define tblselsw_curs_x_hot 1 +#define tblselsw_curs_y_hot 14 +static unsigned char tblselsw_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0f, + 0x80, 0x0f, 0xc0, 0x07, 0xe2, 0x03, 0xf6, 0x01, 0xfe, 0x00, 0x7e, 0x00, + 0x3e, 0x00, 0x7e, 0x00, 0xfe, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/tblselsw_mask.h b/vcl/inc/unx/x11_cursors/tblselsw_mask.h new file mode 100644 index 000000000..eb9bd3c2d --- /dev/null +++ b/vcl/inc/unx/x11_cursors/tblselsw_mask.h @@ -0,0 +1,27 @@ +/* -*- 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 . + */ + +#define tblselsw_mask_width 16 +#define tblselsw_mask_height 16 +static unsigned char tblselsw_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0f, 0x80, 0x1f, + 0xc0, 0x1f, 0xe3, 0x0f, 0xf7, 0x07, 0xff, 0x03, 0xff, 0x01, 0xff, 0x00, + 0x7f, 0x00, 0xff, 0x00, 0xff, 0x01, 0xff, 0x01 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/tblselw_curs.h b/vcl/inc/unx/x11_cursors/tblselw_curs.h new file mode 100644 index 000000000..97de23456 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/tblselw_curs.h @@ -0,0 +1,29 @@ +/* -*- 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 . + */ + +#define tblselw_curs_width 16 +#define tblselw_curs_height 16 +#define tblselw_curs_x_hot 1 +#define tblselw_curs_y_hot 8 +static unsigned char tblselw_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x30, 0x00, + 0x38, 0x00, 0xfc, 0x3f, 0xfe, 0x3f, 0xfc, 0x3f, 0x38, 0x00, 0x30, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/tblselw_mask.h b/vcl/inc/unx/x11_cursors/tblselw_mask.h new file mode 100644 index 000000000..601fe5396 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/tblselw_mask.h @@ -0,0 +1,27 @@ +/* -*- 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 . + */ + +#define tblselw_mask_width 16 +#define tblselw_mask_height 16 +static unsigned char tblselw_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x70, 0x00, 0x78, 0x00, + 0xfc, 0x7f, 0xfe, 0x7f, 0xff, 0x7f, 0xfe, 0x7f, 0xfc, 0x7f, 0x78, 0x00, + 0x70, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/vertcurs_curs.h b/vcl/inc/unx/x11_cursors/vertcurs_curs.h new file mode 100644 index 000000000..88cc660ba --- /dev/null +++ b/vcl/inc/unx/x11_cursors/vertcurs_curs.h @@ -0,0 +1,29 @@ +/* -*- 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 . + */ + +#define vertcurs_curs_width 16 +#define vertcurs_curs_height 16 +#define vertcurs_curs_x_hot 8 +#define vertcurs_curs_y_hot 8 +static unsigned char vertcurs_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x02, 0x40, + 0x06, 0x60, 0xfc, 0x3f, 0x06, 0x60, 0x02, 0x40, 0x02, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/vertcurs_mask.h b/vcl/inc/unx/x11_cursors/vertcurs_mask.h new file mode 100644 index 000000000..0fbb5d99e --- /dev/null +++ b/vcl/inc/unx/x11_cursors/vertcurs_mask.h @@ -0,0 +1,29 @@ +/* -*- 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 . + */ + +#define vertcurs_mask_width 16 +#define vertcurs_mask_height 16 +#define vertcurs_mask_x_hot 8 +#define vertcurs_mask_y_hot 8 +static unsigned char vertcurs_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xe0, 0x07, 0xe0, 0x0f, 0xf0, + 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0x0f, 0xf0, 0x07, 0xe0, 0x07, 0xe0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/vshear_curs.h b/vcl/inc/unx/x11_cursors/vshear_curs.h new file mode 100644 index 000000000..3e3859cf6 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/vshear_curs.h @@ -0,0 +1,36 @@ +/* -*- 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 . + */ +#define vshear_curs_width 32 +#define vshear_curs_height 32 +#define vshear_curs_x_hot 15 +#define vshear_curs_y_hot 15 +static unsigned char vshear_curs_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x04, 0x00, + 0x00, 0x20, 0x04, 0x00, 0x00, 0x30, 0x04, 0x00, 0x00, 0x30, 0x04, 0x00, + 0x00, 0x38, 0x04, 0x00, 0x00, 0x38, 0x04, 0x00, 0x00, 0x20, 0x04, 0x00, + 0x00, 0x20, 0x04, 0x00, 0x00, 0x20, 0x04, 0x00, 0x00, 0x20, 0x04, 0x00, + 0x00, 0x20, 0x1c, 0x00, 0x00, 0x20, 0x1c, 0x00, 0x00, 0x20, 0x0c, 0x00, + 0x00, 0x20, 0x0c, 0x00, 0x00, 0x20, 0x04, 0x00, 0x00, 0x20, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/vshear_mask.h b/vcl/inc/unx/x11_cursors/vshear_mask.h new file mode 100644 index 000000000..df7c51a9f --- /dev/null +++ b/vcl/inc/unx/x11_cursors/vshear_mask.h @@ -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 . + */ +#define vshear_mask_width 32 +#define vshear_mask_height 32 +static unsigned char vshear_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x0e, 0x00, 0x00, 0x70, 0x0e, 0x00, + 0x00, 0x70, 0x0e, 0x00, 0x00, 0x78, 0x0e, 0x00, 0x00, 0x78, 0x0e, 0x00, + 0x00, 0x7c, 0x0e, 0x00, 0x00, 0x7c, 0x0e, 0x00, 0x00, 0x7c, 0x0e, 0x00, + 0x00, 0x70, 0x0e, 0x00, 0x00, 0x70, 0x0e, 0x00, 0x00, 0x70, 0x3e, 0x00, + 0x00, 0x70, 0x3e, 0x00, 0x00, 0x70, 0x3e, 0x00, 0x00, 0x70, 0x1e, 0x00, + 0x00, 0x70, 0x1e, 0x00, 0x00, 0x70, 0x0e, 0x00, 0x00, 0x70, 0x0e, 0x00, + 0x00, 0x70, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/wshide_curs.h b/vcl/inc/unx/x11_cursors/wshide_curs.h new file mode 100644 index 000000000..e8fd27230 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/wshide_curs.h @@ -0,0 +1,29 @@ +/* -*- 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 . + */ + +#define hidewhitespace_curs_width 16 +#define hidewhitespace_curs_height 16 +#define hidewhitespace_curs_x_hot 0 +#define hidewhitespace_curs_y_hot 10 +static unsigned char hidewhitespace_curs_bits[] = { + 0x00, 0x01, 0x00, 0x01, 0xC0, 0x07, 0x80, 0x03, 0x00, 0x01, 0xFF, 0xFF, + 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0x00, 0x01, + 0x80, 0x03, 0xC0, 0x07, 0x00, 0x01, 0x00, 0x01, }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/wshide_mask.h b/vcl/inc/unx/x11_cursors/wshide_mask.h new file mode 100644 index 000000000..8547baa25 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/wshide_mask.h @@ -0,0 +1,29 @@ +/* -*- 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 . + */ + +#define hidewhitespace_mask_width 16 +#define hidewhitespace_mask_height 16 +#define hidewhitespace_mask_x_hot 0 +#define hidewhitespace_mask_y_hot 10 +static unsigned char hidewhitespace_mask_bits[] = { + 0x00, 0x01, 0x00, 0x01, 0xC0, 0x07, 0x80, 0x03, 0x00, 0x01, 0xFF, 0xFF, + 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0x00, 0x01, + 0x80, 0x03, 0xC0, 0x07, 0x00, 0x01, 0x00, 0x01, }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/wsshow_curs.h b/vcl/inc/unx/x11_cursors/wsshow_curs.h new file mode 100644 index 000000000..56b705e69 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/wsshow_curs.h @@ -0,0 +1,29 @@ +/* -*- 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 . + */ + +#define showwhitespace_curs_width 16 +#define showwhitespace_curs_height 16 +#define showwhitespace_curs_x_hot 0 +#define showwhitespace_curs_y_hot 10 +static unsigned char showwhitespace_curs_bits[] = { + 0x00, 0x01, 0x80, 0x03, 0xC0, 0x07, 0x00, 0x01, 0xFF, 0xFF, 0x01, 0x81, + 0x01, 0x81, 0x01, 0x81, 0x01, 0x81, 0x01, 0x81, 0x01, 0x81, 0xFF, 0xFF, + 0x00, 0x01, 0xC0, 0x07, 0x80, 0x03, 0x00, 0x01, }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/wsshow_mask.h b/vcl/inc/unx/x11_cursors/wsshow_mask.h new file mode 100644 index 000000000..2da7aea99 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/wsshow_mask.h @@ -0,0 +1,29 @@ +/* -*- 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 . + */ + +#define showwhitespace_mask_width 16 +#define showwhitespace_mask_height 16 +#define showwhitespace_mask_x_hot 0 +#define showwhitespace_mask_y_hot 10 +static unsigned char showwhitespace_mask_bits[] = { + 0x00, 0x01, 0x80, 0x03, 0xC0, 0x07, 0x00, 0x01, 0xFF, 0xFF, 0x01, 0x81, + 0x01, 0x81, 0x01, 0x81, 0x01, 0x81, 0x01, 0x81, 0x01, 0x81, 0xFF, 0xFF, + 0x00, 0x01, 0xC0, 0x07, 0x80, 0x03, 0x00, 0x01, }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcleventlisteners.hxx b/vcl/inc/vcleventlisteners.hxx new file mode 100644 index 000000000..a73349906 --- /dev/null +++ b/vcl/inc/vcleventlisteners.hxx @@ -0,0 +1,37 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_VCLEVENTLISTENERS_HXX +#define INCLUDED_VCL_INC_VCLEVENTLISTENERS_HXX + +#include <vector> + +class VclEventListeners +{ +public: + void Call( VclSimpleEvent& rEvent ) const; + void addListener( const Link<VclSimpleEvent&,void>& rListener ); + void removeListener( const Link<VclSimpleEvent&,void>& rListener ); +private: + std::vector<Link<VclSimpleEvent&,void>> m_aListeners; +}; + +#endif // INCLUDED_VCL_INC_VCLEVENTLISTENERS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vclpluginapi.h b/vcl/inc/vclpluginapi.h new file mode 100644 index 000000000..589d7244d --- /dev/null +++ b/vcl/inc/vclpluginapi.h @@ -0,0 +1,76 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_VCLPLUGINAPI_H +#define INCLUDED_VCL_INC_VCLPLUGINAPI_H + +#include <sal/config.h> +#include <sal/types.h> + +#if defined VCLPLUG_GEN_IMPLEMENTATION +#define VCLPLUG_GEN_PUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define VCLPLUG_GEN_PUBLIC SAL_DLLPUBLIC_IMPORT +#endif + +#if defined VCLPLUG_GTK_IMPLEMENTATION +#define VCLPLUG_GTK_PUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define VCLPLUG_GTK_PUBLIC SAL_DLLPUBLIC_IMPORT +#endif + +#if defined VCLPLUG_KF5_IMPLEMENTATION +#define VCLPLUG_KF5_PUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define VCLPLUG_KF5_PUBLIC SAL_DLLPUBLIC_IMPORT +#endif + +#if defined VCLPLUG_OSX_IMPLEMENTATION +#define VCLPLUG_OSX_PUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define VCLPLUG_OSX_PUBLIC SAL_DLLPUBLIC_IMPORT +#endif + +#if defined VCLPLUG_QT5_IMPLEMENTATION +#define VCLPLUG_QT5_PUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define VCLPLUG_QT5_PUBLIC SAL_DLLPUBLIC_IMPORT +#endif + +#if defined VCLPLUG_SVP_IMPLEMENTATION +#define VCLPLUG_SVP_PUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define VCLPLUG_SVP_PUBLIC SAL_DLLPUBLIC_IMPORT +#endif + +#if defined VCLPLUG_WIN_IMPLEMENTATION +#define VCLPLUG_WIN_PUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define VCLPLUG_WIN_PUBLIC SAL_DLLPUBLIC_IMPORT +#endif + +#if defined DESKTOP_DETECTOR_IMPLEMENTATION +#define DESKTOP_DETECTOR_PUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define DESKTOP_DETECTOR_PUBLIC SAL_DLLPUBLIC_IMPORT +#endif + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vclstatuslistener.hxx b/vcl/inc/vclstatuslistener.hxx new file mode 100644 index 000000000..2652befcd --- /dev/null +++ b/vcl/inc/vclstatuslistener.hxx @@ -0,0 +1,108 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_VCLSTATUSLISTENER_HXX +#define INCLUDED_VCL_VCLSTATUSLISTENER_HXX + +#include <cppuhelper/implbase.hxx> +#include <comphelper/processfactory.hxx> +#include <vcl/vclptr.hxx> + +#include <com/sun/star/frame/Desktop.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/util/URLTransformer.hpp> + +template <class T> class VclStatusListener final : public cppu::WeakImplHelper < css::frame::XStatusListener> +{ +public: + VclStatusListener<T>(T* widget, const OUString& aCommand); + +private: + VclPtr<T> mWidget; /** The widget on which actions are performed */ + + /** Dispatcher. Need to keep a reference to it as long as this StatusListener exists. */ + css::uno::Reference<css::frame::XDispatch> mxDispatch; + css::util::URL maCommandURL; + css::uno::Reference<css::frame::XFrame> mxFrame; + +public: + void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& rEvent) override; + + void SAL_CALL disposing(const css::lang::EventObject& /*Source*/) override; + + const css::uno::Reference<css::frame::XFrame>& getFrame() { return mxFrame; } + + void startListening(); + + void dispose(); +}; + +template<class T> +VclStatusListener<T>::VclStatusListener(T* widget, const OUString& aCommand) { + mWidget = widget; + + css::uno::Reference<css::uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext(); + css::uno::Reference<css::frame::XDesktop2> xDesktop = css::frame::Desktop::create(xContext); + + css::uno::Reference<css::frame::XFrame> xFrame(xDesktop->getActiveFrame()); + if (!xFrame.is()) + xFrame = xDesktop; + + mxFrame = xFrame; + + maCommandURL.Complete = aCommand; + css::uno::Reference<css::util::XURLTransformer> xParser = css::util::URLTransformer::create(xContext); + xParser->parseStrict(maCommandURL); +} + +template<class T> +void VclStatusListener<T>::startListening() +{ + if (mxDispatch.is()) + mxDispatch->removeStatusListener(this, maCommandURL); + + css::uno::Reference<css::frame::XDispatchProvider> xDispatchProvider(mxFrame, css::uno::UNO_QUERY); + if (!xDispatchProvider.is()) + return; + + mxDispatch = xDispatchProvider->queryDispatch(maCommandURL, "", 0); + if (mxDispatch.is()) + mxDispatch->addStatusListener(this, maCommandURL); +} + +template<class T> +void VclStatusListener<T>::statusChanged(const css::frame::FeatureStateEvent& rEvent) +{ + mWidget->statusChanged(rEvent); +} + +template<class T> +void VclStatusListener<T>::disposing(const css::lang::EventObject& /*Source*/) +{ + mxDispatch.clear(); +} + +template<class T> +void VclStatusListener<T>::dispose() +{ + if (mxDispatch.is()) { + mxDispatch->removeStatusListener(this, maCommandURL); + mxDispatch.clear(); + } + mxFrame.clear(); + mWidget.clear(); +} + + +#endif // INCLUDED_VCL_VCLSTATUSLISTENER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/wall2.hxx b/vcl/inc/wall2.hxx new file mode 100644 index 000000000..401593b3f --- /dev/null +++ b/vcl/inc/wall2.hxx @@ -0,0 +1,50 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_WALL2_HXX +#define INCLUDED_VCL_INC_WALL2_HXX + +#include <optional> + +class ImplWallpaper +{ + friend class Wallpaper; + +private: + std::optional<tools::Rectangle> mpRect; + std::unique_ptr<BitmapEx> mpBitmap; + std::unique_ptr<Gradient> mpGradient; + std::unique_ptr<BitmapEx> mpCache; + Color maColor; + WallpaperStyle meStyle; + +public: + ImplWallpaper(); + ImplWallpaper( const ImplWallpaper& rImplWallpaper ); + ~ImplWallpaper(); + + bool operator==( const ImplWallpaper& rImplWallpaper ) const = delete; + + friend SvStream& ReadImplWallpaper( SvStream& rIStm, ImplWallpaper& rImplWallpaper ); + friend SvStream& WriteImplWallpaper( SvStream& rOStm, const ImplWallpaper& rImplWallpaper ); +}; + +#endif // INCLUDED_VCL_INC_WALL2_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/watchdog.hxx b/vcl/inc/watchdog.hxx new file mode 100644 index 000000000..9202e432f --- /dev/null +++ b/vcl/inc/watchdog.hxx @@ -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/. + */ + +#ifndef INCLUDED_VCL_INC_WATCHDOG_H +#define INCLUDED_VCL_INC_WATCHDOG_H + +#include <sal/config.h> +#include <salhelper/thread.hxx> +#include <atomic> +#include <vector> + +class WatchdogThread final : private salhelper::Thread +{ + WatchdogThread(); + virtual void execute() override; + +public: + using salhelper::Thread::acquire; + using salhelper::Thread::release; + static void start(); + static void stop(); +}; + +#endif // INCLUDED_VCL_INC_WATCHDOG_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/widgetdraw/WidgetDefinition.hxx b/vcl/inc/widgetdraw/WidgetDefinition.hxx new file mode 100644 index 000000000..cc3eb6606 --- /dev/null +++ b/vcl/inc/widgetdraw/WidgetDefinition.hxx @@ -0,0 +1,298 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_WIDGETDEFINITION_HXX +#define INCLUDED_VCL_INC_WIDGETDEFINITION_HXX + +#include <vcl/dllapi.h> +#include <memory> +#include <rtl/ustring.hxx> +#include <tools/color.hxx> +#include <unordered_map> +#include <vector> +#include <cstddef> +#include <boost/functional/hash.hpp> +#include <vcl/salnativewidgets.hxx> + +namespace vcl +{ +enum class WidgetDrawActionType +{ + RECTANGLE, + LINE, + IMAGE, + EXTERNAL +}; + +class VCL_DLLPUBLIC WidgetDrawAction +{ +public: + WidgetDrawAction(WidgetDrawActionType aType) + : maType(aType) + { + } + + WidgetDrawActionType maType; +}; + +class VCL_DLLPUBLIC WidgetDrawActionShape : public WidgetDrawAction +{ +public: + WidgetDrawActionShape(WidgetDrawActionType aType) + : WidgetDrawAction(aType) + , mnStrokeWidth(-1) + { + } + + Color maStrokeColor; + Color maFillColor; + sal_Int32 mnStrokeWidth; +}; + +class VCL_DLLPUBLIC WidgetDrawActionRectangle : public WidgetDrawActionShape +{ +public: + sal_Int32 mnRx; + sal_Int32 mnRy; + + float mfX1; + float mfY1; + float mfX2; + float mfY2; + + WidgetDrawActionRectangle() + : WidgetDrawActionShape(WidgetDrawActionType::RECTANGLE) + , mnRx(0) + , mnRy(0) + , mfX1(0.0f) + , mfY1(0.0f) + , mfX2(1.0f) + , mfY2(1.0f) + { + } +}; + +class VCL_DLLPUBLIC WidgetDrawActionLine : public WidgetDrawActionShape +{ +public: + float mfX1; + float mfY1; + float mfX2; + float mfY2; + + WidgetDrawActionLine() + : WidgetDrawActionShape(WidgetDrawActionType::LINE) + , mfX1(0.0) + , mfY1(0.0) + , mfX2(0.0) + , mfY2(0.0) + { + } +}; + +class VCL_DLLPUBLIC WidgetDrawActionImage : public WidgetDrawAction +{ +public: + OUString msSource; + + WidgetDrawActionImage() + : WidgetDrawAction(WidgetDrawActionType::IMAGE) + { + } +}; + +class VCL_DLLPUBLIC WidgetDrawActionExternal : public WidgetDrawAction +{ +public: + OUString msSource; + + WidgetDrawActionExternal() + : WidgetDrawAction(WidgetDrawActionType::EXTERNAL) + { + } +}; + +struct VCL_DLLPUBLIC ControlTypeAndPart +{ + ControlType meType; + ControlPart mePart; + + ControlTypeAndPart(ControlType eType, ControlPart ePart) + : meType(eType) + , mePart(ePart) + { + } + + bool operator==(ControlTypeAndPart const& aOther) const + { + return meType == aOther.meType && mePart == aOther.mePart; + } +}; + +} // end vcl namespace + +namespace std +{ +template <> struct VCL_DLLPUBLIC hash<vcl::ControlTypeAndPart> +{ + std::size_t operator()(vcl::ControlTypeAndPart const& rControlTypeAndPart) const noexcept + { + std::size_t seed = 0; + boost::hash_combine(seed, rControlTypeAndPart.meType); + boost::hash_combine(seed, rControlTypeAndPart.mePart); + return seed; + } +}; + +} // end std namespace + +namespace vcl +{ +class WidgetDefinitionState +{ +public: + OString msEnabled; + OString msFocused; + OString msPressed; + OString msRollover; + OString msDefault; + OString msSelected; + OString msButtonValue; + OString msExtra; + + WidgetDefinitionState(OString const& sEnabled, OString const& sFocused, OString const& sPressed, + OString const& sRollover, OString const& sDefault, + OString const& sSelected, OString const& sButtonValue, + OString const& sExtra); + + std::vector<std::shared_ptr<WidgetDrawAction>> mpWidgetDrawActions; + + void addDrawRectangle(Color aStrokeColor, sal_Int32 nStrokeWidth, Color aFillColor, float fX1, + float fY1, float fX2, float fY2, sal_Int32 nRx, sal_Int32 nRy); + + void addDrawLine(Color aStrokeColor, sal_Int32 nStrokeWidth, float fX1, float fY1, float fX2, + float fY2); + + void addDrawImage(OUString const& sSource); + void addDrawExternal(OUString const& sSource); +}; + +class VCL_DLLPUBLIC WidgetDefinitionPart +{ +public: + sal_Int32 mnWidth; + sal_Int32 mnHeight; + sal_Int32 mnMarginWidth; + sal_Int32 mnMarginHeight; + OString msOrientation; + + std::vector<std::shared_ptr<WidgetDefinitionState>> getStates(ControlType eType, + ControlPart ePart, + ControlState eState, + ImplControlValue const& rValue); + + std::vector<std::shared_ptr<WidgetDefinitionState>> maStates; +}; + +class VCL_DLLPUBLIC WidgetDefinitionSettings +{ +public: + OString msNoActiveTabTextRaise; + OString msCenteredTabs; + OString msListBoxEntryMargin; + OString msDefaultFontSize; + OString msTitleHeight; + OString msFloatTitleHeight; + OString msListBoxPreviewDefaultLogicWidth; + OString msListBoxPreviewDefaultLogicHeight; +}; + +class VCL_DLLPUBLIC WidgetDefinitionStyle +{ +public: + Color maFaceColor; + Color maCheckedColor; + Color maLightColor; + Color maLightBorderColor; + Color maShadowColor; + Color maDarkShadowColor; + Color maDefaultButtonTextColor; + Color maButtonTextColor; + Color maDefaultActionButtonTextColor; + Color maActionButtonTextColor; + Color maFlatButtonTextColor; + Color maDefaultButtonRolloverTextColor; + Color maButtonRolloverTextColor; + Color maDefaultActionButtonRolloverTextColor; + Color maActionButtonRolloverTextColor; + Color maFlatButtonRolloverTextColor; + Color maDefaultButtonPressedRolloverTextColor; + Color maButtonPressedRolloverTextColor; + Color maDefaultActionButtonPressedRolloverTextColor; + Color maActionButtonPressedRolloverTextColor; + Color maFlatButtonPressedRolloverTextColor; + Color maRadioCheckTextColor; + Color maGroupTextColor; + Color maLabelTextColor; + Color maWindowColor; + Color maWindowTextColor; + Color maDialogColor; + Color maDialogTextColor; + Color maWorkspaceColor; + Color maMonoColor; + Color maFieldColor; + Color maFieldTextColor; + Color maFieldRolloverTextColor; + Color maActiveColor; + Color maActiveTextColor; + Color maActiveBorderColor; + Color maDeactiveColor; + Color maDeactiveTextColor; + Color maDeactiveBorderColor; + Color maMenuColor; + Color maMenuBarColor; + Color maMenuBarRolloverColor; + Color maMenuBorderColor; + Color maMenuTextColor; + Color maMenuBarTextColor; + Color maMenuBarRolloverTextColor; + Color maMenuBarHighlightTextColor; + Color maMenuHighlightColor; + Color maMenuHighlightTextColor; + Color maHighlightColor; + Color maHighlightTextColor; + Color maActiveTabColor; + Color maInactiveTabColor; + Color maTabTextColor; + Color maTabRolloverTextColor; + Color maTabHighlightTextColor; + Color maDisableColor; + Color maHelpColor; + Color maHelpTextColor; + Color maLinkColor; + Color maVisitedLinkColor; + Color maToolTextColor; + Color maFontColor; +}; + +class VCL_DLLPUBLIC WidgetDefinition +{ +public: + std::shared_ptr<WidgetDefinitionStyle> mpStyle; + std::shared_ptr<WidgetDefinitionSettings> mpSettings; + std::unordered_map<ControlTypeAndPart, std::shared_ptr<WidgetDefinitionPart>> maDefinitions; + std::shared_ptr<WidgetDefinitionPart> getDefinition(ControlType eType, ControlPart ePart); +}; + +} // end vcl namespace + +#endif // INCLUDED_VCL_INC_WIDGETDEFINITION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/widgetdraw/WidgetDefinitionReader.hxx b/vcl/inc/widgetdraw/WidgetDefinitionReader.hxx new file mode 100644 index 000000000..49ecfac7a --- /dev/null +++ b/vcl/inc/widgetdraw/WidgetDefinitionReader.hxx @@ -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/. + * + */ + +#ifndef INCLUDED_VCL_INC_WIDGETDEFINITIONREADER_HXX +#define INCLUDED_VCL_INC_WIDGETDEFINITIONREADER_HXX + +#include <vcl/dllapi.h> +#include <widgetdraw/WidgetDefinition.hxx> +#include <memory> +#include <rtl/ustring.hxx> +#include <tools/XmlWalker.hxx> + +namespace vcl +{ +class VCL_DLLPUBLIC WidgetDefinitionReader +{ +private: + OUString m_rDefinitionFile; + OUString m_rResourcePath; + + void readDefinition(tools::XmlWalker& rWalker, WidgetDefinition& rWidgetDefinition, + ControlType eType); + + void readPart(tools::XmlWalker& rWalker, std::shared_ptr<WidgetDefinitionPart> rpPart); + + void readDrawingDefinition(tools::XmlWalker& rWalker, + const std::shared_ptr<WidgetDefinitionState>& rStates); + +public: + WidgetDefinitionReader(OUString const& rDefinitionFile, OUString const& rResourcePath); + bool read(WidgetDefinition& rWidgetDefinition); +}; + +} // end vcl namespace + +#endif // INCLUDED_VCL_INC_WIDGETDEFINITIONREADER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/DWriteTextRenderer.hxx b/vcl/inc/win/DWriteTextRenderer.hxx new file mode 100644 index 000000000..9011a951d --- /dev/null +++ b/vcl/inc/win/DWriteTextRenderer.hxx @@ -0,0 +1,101 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_WIN_DWRITERENDERER_HXX +#define INCLUDED_VCL_INC_WIN_DWRITERENDERER_HXX + +#include <usp10.h> +#include <d2d1.h> +#include <dwrite.h> + +#include <win/winlayout.hxx> + +enum class D2DTextAntiAliasMode +{ + Default, + Aliased, + AntiAliased, + ClearType, +}; + +class D2DWriteTextOutRenderer : public TextOutRenderer +{ +public: + explicit D2DWriteTextOutRenderer(); + virtual ~D2DWriteTextOutRenderer() override; + + bool operator ()(GenericSalLayout const &rLayout, + SalGraphics &rGraphics, + HDC hDC) override; + + HRESULT BindDC(HDC hDC, tools::Rectangle const & rRect = tools::Rectangle(0, 0, 1, 1)); + + bool BindFont(HDC hDC) /*override*/; + bool ReleaseFont() /*override*/; + + std::vector<tools::Rectangle> GetGlyphInkBoxes(uint16_t const * pGid, uint16_t const * pGidEnd) const /*override*/; + ID2D1RenderTarget * GetRenderTarget() const { return mpRT; } + IDWriteFontFace * GetFontFace() const { return mpFontFace; } + float GetEmHeight() const { return mlfEmHeight; } + + HRESULT CreateRenderTarget(); + + bool Ready() const; + + void applyTextAntiAliasMode(); + void changeTextAntiAliasMode(D2DTextAntiAliasMode eMode); + +private: + // This is a singleton object disable copy ctor and assignment operator + D2DWriteTextOutRenderer(const D2DWriteTextOutRenderer &) = delete; + D2DWriteTextOutRenderer & operator = (const D2DWriteTextOutRenderer &) = delete; + + bool GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** ppFontFace, float * lfSize) const; + bool performRender(GenericSalLayout const &rLayout, SalGraphics &rGraphics, HDC hDC, bool& bRetry); + + ID2D1Factory * mpD2DFactory; + IDWriteFactory * mpDWriteFactory; + IDWriteGdiInterop * mpGdiInterop; + ID2D1DCRenderTarget * mpRT; + const D2D1_RENDER_TARGET_PROPERTIES mRTProps; + + IDWriteFontFace * mpFontFace; + float mlfEmHeight; + HDC mhDC; + D2DTextAntiAliasMode meTextAntiAliasMode; +}; + +/** + * Sets and unsets the needed DirectWrite transform to support the font's horizontal scaling and + * rotation. + */ +class WinFontTransformGuard +{ +public: + WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, float fHScale, const GenericSalLayout& rLayout, const D2D1_POINT_2F& rBaseline); + ~WinFontTransformGuard(); + +private: + ID2D1RenderTarget* mpRenderTarget; + D2D1::Matrix3x2F maTransform; +}; + +#endif // INCLUDED_VCL_INC_WIN_DWRITERENDERER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salbmp.h b/vcl/inc/win/salbmp.h new file mode 100644 index 000000000..d6acd14e8 --- /dev/null +++ b/vcl/inc/win/salbmp.h @@ -0,0 +1,115 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_WIN_SALBMP_H +#define INCLUDED_VCL_INC_WIN_SALBMP_H + +#include <tools/gen.hxx> +#include <win/wincomp.hxx> +#include <salbmp.hxx> +#include <basegfx/utils/systemdependentdata.hxx> +#include <memory> + + +struct BitmapBuffer; +class BitmapColor; +class BitmapPalette; +class SalGraphics; +namespace Gdiplus { class Bitmap; } + +class WinSalBitmap final: public SalBitmap, public basegfx::SystemDependentDataHolder +{ +private: + Size maSize; + HGLOBAL mhDIB; + HBITMAP mhDDB; + + sal_uInt16 mnBitCount; + + Gdiplus::Bitmap* ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlphaSource); + Gdiplus::Bitmap* ImplCreateGdiPlusBitmap(); + +public: + + HGLOBAL ImplGethDIB() const { return mhDIB; } + HBITMAP ImplGethDDB() const { return mhDDB; } + + std::shared_ptr< Gdiplus::Bitmap > ImplGetGdiPlusBitmap(const WinSalBitmap* pAlphaSource = nullptr) const; + + static HGLOBAL ImplCreateDIB( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal ); + static HANDLE ImplCopyDIBOrDDB( HANDLE hHdl, bool bDIB ); + static sal_uInt16 ImplGetDIBColorCount( HGLOBAL hDIB ); + static void ImplDecodeRLEBuffer( const BYTE* pSrcBuf, BYTE* pDstBuf, + const Size& rSizePixel, bool bRLE4 ); + +public: + + WinSalBitmap(); + virtual ~WinSalBitmap() override; + +public: + + bool Create( HANDLE hBitmap, bool bDIB, bool bCopyHandle ); + virtual bool Create( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal ) override; + virtual bool Create( const SalBitmap& rSalBmpImpl ) override; + virtual bool Create( const SalBitmap& rSalBmpImpl, SalGraphics* pGraphics ) override; + virtual bool Create( const SalBitmap& rSalBmpImpl, sal_uInt16 nNewBitCount ) override; + virtual bool Create( const css::uno::Reference< css::rendering::XBitmapCanvas >& rBitmapCanvas, + Size& rSize, + bool bMask = false ) override; + + virtual void Destroy() override; + + virtual Size GetSize() const override { return maSize; } + virtual sal_uInt16 GetBitCount() const override { return mnBitCount; } + + 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_uInt8 nTol ) override; + + // exclusive management op's for SystemDependentData at WinSalBitmap + template<class T> + std::shared_ptr<T> getSystemDependentData() const + { + return std::static_pointer_cast<T>(basegfx::SystemDependentDataHolder::getSystemDependentData(typeid(T).hash_code())); + } + + template<class T, class... Args> + std::shared_ptr<T> addOrReplaceSystemDependentData(basegfx::SystemDependentDataManager& manager, Args&&... args) const + { + std::shared_ptr<T> r = std::make_shared<T>(manager, std::forward<Args>(args)...); + + // tdf#129845 only add to buffer if a relevant buffer time is estimated + if(r->calculateCombinedHoldCyclesInSeconds() > 0) + { + basegfx::SystemDependentData_SharedPtr r2(r); + const_cast< WinSalBitmap* >(this)->basegfx::SystemDependentDataHolder::addOrReplaceSystemDependentData(r2); + } + + return r; + } +}; + +#endif // INCLUDED_VCL_INC_WIN_SALBMP_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx new file mode 100644 index 000000000..eadc7ade8 --- /dev/null +++ b/vcl/inc/win/saldata.hxx @@ -0,0 +1,305 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_WIN_SALDATA_HXX +#define INCLUDED_VCL_INC_WIN_SALDATA_HXX + +#include <config_features.h> + +#include <memory> +#include <osl/module.h> + +#include <svdata.hxx> +#include <salwtype.hxx> + +#include <win/wincomp.hxx> + +#include <set> +#include <map> + +class AutoTimer; +class WinSalInstance; +class WinSalObject; +class WinSalFrame; +class WinSalVirtualDevice; +class WinSalPrinter; +namespace vcl { class Font; } +struct GlobalWinGlyphCache; +struct HDCCache; +struct TempFontItem; +class TextOutRenderer; +class OpenGLControlsCache; +#if HAVE_FEATURE_SKIA +class SkiaControlsCache; +#endif + +#define MAX_STOCKPEN 4 +#define MAX_STOCKBRUSH 4 +#define SAL_CLIPRECT_COUNT 16 + +struct SalIcon +{ + int nId; + HICON hIcon; + HICON hSmallIcon; + SalIcon *pNext; +}; + +class SalData +{ +public: + SalData(); + ~SalData(); + + // native widget framework + static void initNWF(); + static void deInitNWF(); + + // fill maVKMap; + void initKeyCodeMap(); + + // checks if the menuhandle was created by VCL + bool IsKnownMenuHandle( HMENU hMenu ); + + bool mbResourcesAlreadyFreed; + +public: + HINSTANCE mhInst; // default instance handle + int mnCmdShow; // default frame show style + HPALETTE mhDitherPal; // dither palette + HGLOBAL mhDitherDIB; // dither memory handle + BYTE* mpDitherDIB; // dither memory + BYTE* mpDitherDIBData; // beginning of DIB data + long* mpDitherDiff; // Dither mapping table + BYTE* mpDitherLow; // Dither mapping table + BYTE* mpDitherHigh; // Dither mapping table + HHOOK mhSalObjMsgHook; // hook to get interesting msg for SalObject + HWND mhWantLeaveMsg; // window handle, that want a MOUSELEAVE message + AutoTimer* mpMouseLeaveTimer; // Timer for MouseLeave Test + WinSalInstance* mpInstance; + WinSalFrame* mpFirstFrame; // pointer of first frame + WinSalObject* mpFirstObject; // pointer of first object window + WinSalVirtualDevice* mpFirstVD; // first VirDev + WinSalPrinter* mpFirstPrinter; // first printing printer + HDCCache* mpHDCCache; // Cache for three DC's + HBITMAP mh50Bmp; // 50% Bitmap + HBRUSH mh50Brush; // 50% Brush + COLORREF maStockPenColorAry[MAX_STOCKPEN]; + COLORREF maStockBrushColorAry[MAX_STOCKBRUSH]; + HPEN mhStockPenAry[MAX_STOCKPEN]; + HBRUSH mhStockBrushAry[MAX_STOCKBRUSH]; + sal_uInt16 mnStockPenCount; // count of static pens + sal_uInt16 mnStockBrushCount; // count of static brushes + WPARAM mnSalObjWantKeyEvt; // KeyEvent that should be processed by SalObj-Hook + BYTE mnCacheDCInUse; // count of CacheDC in use + bool mbObjClassInit; // is SALOBJECTCLASS initialised + bool mbInPalChange; // is in WM_QUERYNEWPALETTE + DWORD mnAppThreadId; // Id from Application-Thread + BOOL mbScrSvrEnabled; // ScreenSaver enabled + SalIcon* mpFirstIcon; // icon cache, points to first icon, NULL if none + TempFontItem* mpSharedTempFontItem; // LibreOffice shared fonts + TempFontItem* mpOtherTempFontItem; // other temporary fonts (embedded?) + bool mbThemeChanged; // true if visual theme was changed: throw away theme handles + bool mbThemeMenuSupport; + + // for GdiPlus GdiplusStartup/GdiplusShutdown + ULONG_PTR gdiplusToken; + + std::set< HMENU > mhMenuSet; // keeps track of menu handles created by VCL, used by IsKnownMenuHandle() + std::map< UINT,sal_uInt16 > maVKMap; // map some dynamic VK_* entries + + std::unique_ptr<TextOutRenderer> m_pD2DWriteTextOutRenderer; + // tdf#107205 need 2 instances because D2DWrite can't rotate text + std::unique_ptr<TextOutRenderer> m_pExTextOutRenderer; + std::unique_ptr<GlobalWinGlyphCache> m_pGlobalWinGlyphCache; + std::unique_ptr<OpenGLControlsCache> m_pOpenGLControlsCache; +#if HAVE_FEATURE_SKIA + std::unique_ptr<SkiaControlsCache> m_pSkiaControlsCache; +#endif +}; + +inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = pData; } +inline SalData* GetSalData() { return ImplGetSVData()->mpSalData; } + +struct SalShlData +{ + HINSTANCE mhInst; // Instance of SAL-DLL + UINT mnWheelScrollLines; // WheelScrollLines + UINT mnWheelScrollChars; // WheelScrollChars +}; + +extern SalShlData aSalShlData; + +#define CACHESIZE_HDC 3 +#define CACHED_HDC_1 0 +#define CACHED_HDC_2 1 +#define CACHED_HDC_DRAW 2 +#define CACHED_HDC_DEFEXT 64 + +struct HDCCache +{ + HDC mhDC; + HPALETTE mhDefPal; + HBITMAP mhDefBmp; + HBITMAP mhSelBmp; + HBITMAP mhActBmp; +}; + +void ImplClearHDCCache( SalData* pData ); +HDC ImplGetCachedDC( sal_uLong nID, HBITMAP hBmp = nullptr ); +void ImplReleaseCachedDC( sal_uLong nID ); + +void ImplReleaseTempFonts(SalData&, bool bAll); + +HCURSOR ImplLoadSalCursor( int nId ); +HBITMAP ImplLoadSalBitmap( int nId ); +bool ImplLoadSalIcon( int nId, HICON& rIcon, HICON& rSmallIcon ); + +void ImplInitSalGDI(); +void ImplFreeSalGDI(); + +void ImplSalYieldMutexAcquireWithWait( sal_uInt32 nCount = 1 ); +bool ImplSalYieldMutexTryToAcquire(); +void ImplSalYieldMutexRelease(); + +LRESULT CALLBACK SalFrameWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ); + +void SalTestMouseLeave(); + +bool ImplHandleSalObjKeyMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ); +bool ImplHandleSalObjSysCharMsg( HWND hWnd, WPARAM wParam, LPARAM lParam ); +bool ImplHandleGlobalMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, LRESULT& rlResult ); + +WinSalObject* ImplFindSalObject( HWND hWndChild ); +bool ImplSalPreDispatchMsg( const MSG* pMsg ); +void ImplSalPostDispatchMsg( const MSG* pMsg ); + +void ImplSalLogFontToFontW( HDC hDC, const LOGFONTW& rLogFont, vcl::Font& rFont ); + +rtl_TextEncoding ImplSalGetSystemEncoding(); +OUString ImplSalGetUniString(const char* pStr, sal_Int32 nLen = -1); +int ImplSalWICompareAscii( const wchar_t* pStr1, const char* pStr2 ); + +#define SAL_FRAME_WNDEXTRA sizeof( DWORD ) +#define SAL_FRAME_THIS GWLP_USERDATA +#define SAL_FRAME_CLASSNAMEW L"SALFRAME" +#define SAL_SUBFRAME_CLASSNAMEW L"SALSUBFRAME" +#define SAL_TMPSUBFRAME_CLASSNAMEW L"SALTMPSUBFRAME" +#define SAL_OBJECT_WNDEXTRA sizeof( DWORD ) +#define SAL_OBJECT_THIS GWLP_USERDATA +#define SAL_OBJECT_CLASSNAMEW L"SALOBJECT" +#define SAL_OBJECT_CHILDCLASSNAMEW L"SALOBJECTCHILD" +#define SAL_COM_CLASSNAMEW L"SALCOMWND" + +#define SAL_MOUSELEAVE_TIMEOUT 300 + +// wParam == bWait; lParam == 0 +#define SAL_MSG_THREADYIELD (WM_USER+111) +// wParam == 0; lParam == nMS +#define SAL_MSG_STARTTIMER (WM_USER+113) +// wParam == nFrameStyle; lParam == pParent; lResult == pFrame +#define SAL_MSG_CREATEFRAME (WM_USER+114) +// wParam == 0; lParam == 0 +#define SAL_MSG_DESTROYFRAME (WM_USER+115) +// wParam == 0; lParam == pParent; lResult == pObject +#define SAL_MSG_CREATEOBJECT (WM_USER+116) +// wParam == 0; lParam == pObject; +#define SAL_MSG_DESTROYOBJECT (WM_USER+117) +// wParam == hWnd; lParam == 0; lResult == hDC +#define SAL_MSG_GETCACHEDDC (WM_USER+120) +// wParam == hWnd; lParam == 0 +#define SAL_MSG_RELEASEDC (WM_USER+121) +// wParam == newParentHwnd; lParam == oldHwnd; lResult == newhWnd +#define SAL_MSG_RECREATEHWND (WM_USER+122) +// wParam == newParentHwnd; lParam == oldHwnd; lResult == newhWnd +#define SAL_MSG_RECREATECHILDHWND (WM_USER+123) +// wParam == 0; lParam == HWND; +#define SAL_MSG_DESTROYHWND (WM_USER+124) + +// wParam == 0; lParam == pData +#define SAL_MSG_USEREVENT (WM_USER+130) +// wParam == 0; lParam == MousePosition relative to upper left of screen +#define SAL_MSG_MOUSELEAVE (WM_USER+131) +// NULL-Message, should not be processed +#define SAL_MSG_DUMMY (WM_USER+132) +// Used for SETFOCUS and KILLFOCUS +// wParam == 0; lParam == 0 +#define SAL_MSG_POSTFOCUS (WM_USER+133) +// wParam == wParam; lParam == lParam +#define SAL_MSG_POSTQUERYNEWPAL (WM_USER+134) +// wParam == wParam; lParam == lParam +#define SAL_MSG_POSTPALCHANGED (WM_USER+135) +// wParam == wParam; lParam == lParam +#define SAL_MSG_POSTMOVE (WM_USER+136) +// wParam == wParam; lParam == lParam +#define SAL_MSG_POSTCALLSIZE (WM_USER+137) +// wParam == pRECT; lParam == 0 +#define SAL_MSG_POSTPAINT (WM_USER+138) +// wParam == 0; lParam == pFrame; lResult 0 +#define SAL_MSG_FORCEPALETTE (WM_USER+139) +// wParam == 0; lParam == 0 +#define SAL_MSG_CAPTUREMOUSE (WM_USER+140) +// wParam == 0; lParam == 0 +#define SAL_MSG_RELEASEMOUSE (WM_USER+141) +// wParam == nFlags; lParam == 0 +#define SAL_MSG_TOTOP (WM_USER+142) +// wParam == bVisible; lParam == 0 +#define SAL_MSG_SHOW (WM_USER+143) +// wParam == 0; lParam == SalInputContext +#define SAL_MSG_SETINPUTCONTEXT (WM_USER+144) +// wParam == nFlags; lParam == 0 +#define SAL_MSG_ENDEXTTEXTINPUT (WM_USER+145) + +// SysChild-ToTop; wParam = 0; lParam = 0 +#define SALOBJ_MSG_TOTOP (WM_USER+160) +// Used for SETFOCUS and KILLFOCUS +// POSTFOCUS-Message; wParam == bFocus; lParam == 0 +#define SALOBJ_MSG_POSTFOCUS (WM_USER+161) + +// Call the Timer's callback from the main thread +// wParam = 1 == run when yield is idle instead of direct +#define SAL_MSG_TIMER_CALLBACK (WM_USER+162) +// Stop the timer from the main thread; wParam = 0, lParam = 0 +#define SAL_MSG_STOPTIMER (WM_USER+163) +// Start a real timer while GUI is blocked by native dialog +#define SAL_MSG_FORCE_REAL_TIMER (WM_USER+164) + +inline void SetWindowPtr( HWND hWnd, WinSalFrame* pThis ) +{ + SetWindowLongPtrW( hWnd, SAL_FRAME_THIS, reinterpret_cast<LONG_PTR>(pThis) ); +} + +inline WinSalFrame* GetWindowPtr( HWND hWnd ) +{ + return reinterpret_cast<WinSalFrame*>(GetWindowLongPtrW( hWnd, SAL_FRAME_THIS )); +} + +inline void SetSalObjWindowPtr( HWND hWnd, WinSalObject* pThis ) +{ + SetWindowLongPtrW( hWnd, SAL_OBJECT_THIS, reinterpret_cast<LONG_PTR>(pThis) ); +} + +inline WinSalObject* GetSalObjWindowPtr( HWND hWnd ) +{ + return reinterpret_cast<WinSalObject*>(GetWindowLongPtrW( hWnd, SAL_OBJECT_THIS )); +} + +#endif // INCLUDED_VCL_INC_WIN_SALDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h new file mode 100644 index 000000000..f0c758806 --- /dev/null +++ b/vcl/inc/win/salframe.h @@ -0,0 +1,154 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_WIN_SALFRAME_H +#define INCLUDED_VCL_INC_WIN_SALFRAME_H + +#include <vcl/sysdata.hxx> +#include <salframe.hxx> +#include <svsys.h> + +class WinSalGraphics; + + +class WinSalFrame final: public SalFrame +{ +public: + HWND mhWnd; // Window handle + HCURSOR mhCursor; // cursor handle + HIMC mhDefIMEContext; // default IME-Context + WinSalGraphics* mpLocalGraphics; // current main thread frame graphics + WinSalGraphics* mpThreadGraphics; // current frame graphics for other threads (DCX_CACHE) + WinSalFrame* mpNextFrame; // pointer to next frame + HMENU mSelectedhMenu; // the menu where highlighting is currently going on + HMENU mLastActivatedhMenu; // the menu that was most recently opened + SystemEnvData maSysData; // system data + SalFrameState maState = {}; // frame state + int mnShowState; // show state + long mnWidth; // client width in pixeln + long mnHeight; // client height in pixeln + int mnMinWidth; // min. client width in pixeln + int mnMinHeight; // min. client height in pixeln + int mnMaxWidth; // max. client width in pixeln + int mnMaxHeight; // max. client height in pixeln + RECT maFullScreenRect; // fullscreen rect + int mnFullScreenShowState; // fullscreen restore show state + bool mbFullScreenCaption; // WS_CAPTION reset in full screen mode. + UINT mnInputLang; // current Input Language + UINT mnInputCodePage; // current Input CodePage + SalFrameStyleFlags mnStyle; // style + bool mbGraphics; // is Graphics used + bool mbCaption; // has window a caption + bool mbBorder; // has window a border + bool mbFixBorder; // has window a fixed border + bool mbSizeBorder; // has window a sizeable border + bool mbNoIcon; // is a window without an icon + bool mbFloatWin; // is a FloatingWindow + bool mbFullScreen; // TRUE: in full screen mode + bool mbPresentation; // TRUE: Presentation Mode running + bool mbInShow; // inside a show call + bool mbRestoreMaximize; // Restore-Maximize + bool mbInMoveMsg; // Move-Message is being processed + bool mbInSizeMsg; // Size-Message is being processed + bool mbFullScreenToolWin; // WS_EX_TOOLWINDOW reset in FullScreenMode + bool mbDefPos; // default-position + bool mbOverwriteState; // TRUE: possible to change WindowState + bool mbIME; // TRUE: We are in IME Mode + bool mbHandleIME; // TRUE: We are handling the IME-Messages + bool mbSpezIME; // TRUE: special IME + bool mbAtCursorIME; // TRUE: We are only handling some IME-Messages + bool mbCandidateMode; // TRUE: We are in Candidate-Mode + static bool mbInReparent; // TRUE: ignore focus lost and gain due to reparenting + + RGNDATA* mpClipRgnData; + RECT* mpNextClipRect; + bool mbFirstClipRect; + sal_Int32 mnDisplay; // Display used for Fullscreen, 0 is primary monitor + bool mbPropertiesStored; // has values stored in the window property store + + void updateScreenNumber(); + +private: + void ImplSetParentFrame( HWND hNewParentWnd, bool bAsChild ); + bool InitFrameGraphicsDC( WinSalGraphics *pGraphics, HDC hDC, HWND hWnd ); + bool ReleaseFrameGraphicsDC( WinSalGraphics* pGraphics ); + +public: + WinSalFrame(); + virtual ~WinSalFrame() override; + + virtual SalGraphics* AcquireGraphics() override; + virtual void ReleaseGraphics( SalGraphics* pGraphics ) override; + virtual bool PostEvent(std::unique_ptr<ImplSVEvent> pData) override; + virtual void SetTitle( const OUString& rTitle ) override; + virtual void SetIcon( sal_uInt16 nIcon ) override; + virtual void SetMenu( SalMenu* pSalMenu ) 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; + using SalFrame::Flush; + virtual void Flush() 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 SetScreenNumber( unsigned int ) override; + virtual void SetApplicationID( const OUString &rApplicationID ) override; + virtual void ResetClipRegion() override; + virtual void BeginSetClipRegion( sal_uInt32 nRects ) override; + virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) override; + virtual void EndSetClipRegion() override; +}; + +void ImplSalGetWorkArea( HWND hWnd, RECT *pRect, const RECT *pParentRect ); + +// get foreign key names +namespace vcl_sal { + OUString getKeysReplacementName( + OUString const & pLang, + LONG nSymbol ); +} + +#endif // INCLUDED_VCL_INC_WIN_SALFRAME_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h new file mode 100644 index 000000000..83c6b6f2d --- /dev/null +++ b/vcl/inc/win/salgdi.h @@ -0,0 +1,429 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_WIN_SALGDI_H +#define INCLUDED_VCL_INC_WIN_SALGDI_H + +#include <sallayout.hxx> +#include <salgeom.hxx> +#include <salgdi.hxx> +#include <fontinstance.hxx> +#include <fontattributes.hxx> +#include <PhysicalFontFace.hxx> +#include <impfont.hxx> +#include <vcl/fontcapabilities.hxx> +#include <vcl/fontcharmap.hxx> + +#include <memory> +#include <unordered_set> + +#ifndef INCLUDED_PRE_POST_WIN_H +#define INCLUDED_PRE_POST_WIN_H +# include <prewin.h> +# include <postwin.h> +#endif + +#include <hb-ot.h> +#include <dwrite.h> + +class FontSelectPattern; +class WinFontInstance; +class ImplFontAttrCache; +class PhysicalFontCollection; +class SalGraphicsImpl; +class WinSalGraphicsImplBase; +class ImplFontMetricData; + +#define RGB_TO_PALRGB(nRGB) ((nRGB)|0x02000000) +#define PALRGB_TO_RGB(nPalRGB) ((nPalRGB)&0x00ffffff) + +// win32 specific physically available font face +class WinFontFace : public PhysicalFontFace +{ +public: + explicit WinFontFace( const FontAttributes&, + BYTE eWinCharSet, + BYTE nPitchAndFamily ); + virtual ~WinFontFace() override; + + virtual rtl::Reference<LogicalFontInstance> CreateFontInstance( const FontSelectPattern& ) const override; + virtual sal_IntPtr GetFontId() const override; + void SetFontId( sal_IntPtr nId ) { mnId = nId; } + void UpdateFromHDC( HDC ) const; + + bool HasChar( sal_uInt32 cChar ) const; + + BYTE GetCharSet() const { return meWinCharSet; } + BYTE GetPitchAndFamily() const { return mnPitchAndFamily; } + + FontCharMapRef GetFontCharMap() const; + bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const; + +private: + sal_IntPtr mnId; + + // some members that are initialized lazily when the font gets selected into a HDC + mutable bool mbFontCapabilitiesRead; + mutable FontCharMapRef mxUnicodeMap; + mutable vcl::FontCapabilities maFontCapabilities; + + BYTE meWinCharSet; + BYTE mnPitchAndFamily; + bool mbAliasSymbolsHigh; + bool mbAliasSymbolsLow; + + void ReadCmapTable( HDC ) const; + void GetFontCapabilities( HDC hDC ) const; +}; + +/** Class that creates (and destroys) a compatible Device Context. + +This is to be used for GDI drawing into a DIB that we later use for a different +drawing method, such as a texture for OpenGL drawing or surface for Skia drawing. +*/ +class CompatibleDC +{ +protected: + /// The compatible DC that we create for our purposes. + HDC mhCompatibleDC; + + /// DIBSection that we use for the GDI drawing, and later obtain. + HBITMAP mhBitmap; + + /// Return the previous bitmap to undo the SelectObject. + HBITMAP mhOrigBitmap; + + /// DIBSection data. + sal_uInt32 *mpData; + + /// Mapping between the GDI position and OpenGL, to use for OpenGL drawing. + SalTwoRect maRects; + + /// The SalGraphicsImpl where we will draw. If null, we ignore the drawing, it means it happened directly to the DC... + WinSalGraphicsImplBase *mpImpl; + + // If 'disable' is true, this class is a simple wrapper for drawing directly. Subclasses should use true. + CompatibleDC(SalGraphics &rGraphics, int x, int y, int width, int height, bool disable=true); + +public: + static std::unique_ptr< CompatibleDC > create(SalGraphics &rGraphics, int x, int y, int width, int height); + + virtual ~CompatibleDC(); + + HDC getCompatibleHDC() { return mhCompatibleDC; } + + SalTwoRect getTwoRect() const { return maRects; } + + long getBitmapWidth() const { return maRects.mnSrcWidth; } + long getBitmapHeight() const { return maRects.mnSrcHeight; } + + /// Reset the DC with the defined color. + void fill(sal_uInt32 color); + + /// Base texture class (OpenGL and Skia will provide their implementations). + struct Texture; + + /// Obtain the texture in format for WinSalGraphicsImplBase::DrawTextMask(). + virtual std::unique_ptr<Texture> getAsMaskTexture() const { abort(); }; +}; + +struct CompatibleDC::Texture +{ + virtual ~Texture() {}; + virtual bool isValid() const = 0; + virtual int GetWidth() const = 0; + virtual int GetHeight() const = 0; +}; + +class WinSalGraphics : public SalGraphics +{ + friend class WinSalGraphicsImpl; + friend class WinOpenGLSalGraphicsImpl; + friend class ScopedFont; + +protected: + std::unique_ptr<SalGraphicsImpl> mpImpl; + +private: + HDC mhLocalDC; // HDC + bool mbPrinter : 1; // is Printer + bool mbVirDev : 1; // is VirDev + bool mbWindow : 1; // is Window + bool mbScreen : 1; // is Screen compatible + HWND mhWnd; // Window-Handle, when Window-Graphics + + rtl::Reference<WinFontInstance> + mpWinFontEntry[ MAX_FALLBACK ]; // pointer to the most recent font instance + HRGN mhRegion; // vcl::Region Handle + HPEN mhDefPen; // DefaultPen + HBRUSH mhDefBrush; // DefaultBrush + HFONT mhDefFont; // DefaultFont + HPALETTE mhDefPal; // DefaultPalette + COLORREF mnTextColor; // TextColor + RGNDATA* mpClipRgnData; // ClipRegion-Data + RGNDATA* mpStdClipRgnData; // Cache Standard-ClipRegion-Data + int mnPenWidth; // line width + + bool CacheGlyphs(const GenericSalLayout& rLayout); + bool DrawCachedGlyphs(const GenericSalLayout& rLayout); + +public: + HFONT ImplDoSetFont(FontSelectPattern const & i_rFont, const PhysicalFontFace * i_pFontFace, HFONT& o_rOldFont); + + HDC getHDC() const { return mhLocalDC; } + void setHDC(HDC aNew) { mhLocalDC = aNew; } + + HPALETTE getDefPal() const; + void setDefPal(HPALETTE hDefPal); + + HRGN getRegion() const; + + void InitGraphics(); + void DeInitGraphics(); + + enum Type + { + PRINTER, + VIRTUAL_DEVICE, + WINDOW, + SCREEN + }; + +public: + + HWND gethWnd(); + + +public: + explicit WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hWnd, + SalGeometryProvider *pProvider); + virtual ~WinSalGraphics() override; + + SalGraphicsImpl* GetImpl() const override; + bool isPrinter() const; + bool isVirtualDevice() const; + bool isWindow() const; + bool isScreen() const; + + void setHWND(HWND hWnd); + +protected: + virtual bool setClipRegion( const vcl::Region& ) override; + // draw --> LineColor and FillColor and RasterOp and ClipRegion + virtual void drawPixel( long nX, long nY ) override; + virtual void drawPixel( long nX, long nY, Color nColor ) 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::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolyPolygon&, + double fTransparency) override; + virtual bool drawPolyLine( + const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolygon&, + double fTransparency, + double fLineWidth, + const std::vector< double >* pStroke, // MM01 + basegfx::B2DLineJoin, + css::drawing::LineCap, + double fMiterMinimumAngle, + bool bPixelSnapHairline) 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 drawGradient( const tools::PolyPolygon&, const Gradient& ) override { return false; }; + + // CopyArea --> No RasterOp, but ClipRegion + virtual void copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, + long nSrcHeight, bool bWindowInvalidate ) override; + + // CopyBits and DrawBitmap --> RasterOp and ClipRegion + // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics + 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, + Color nMaskColor ) override; + + virtual std::shared_ptr<SalBitmap> getBitmap( long nX, long nY, long nWidth, long nHeight ) override; + virtual Color getPixel( long nX, long nY ) override; + + // invert --> ClipRegion (only Windows or VirDevs) + 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_uInt32 nSize ) override; + + // native widget rendering methods that require mirroring +protected: + 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, const Color& rBackgroundColor ) 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; + +public: + 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; + virtual 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; + +private: + // local helpers + + void DrawTextLayout(const GenericSalLayout&, HDC, bool bUseDWrite); + +public: + // public SalGraphics methods, the interface to the independent vcl part + + // get device resolution + virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) override; + // get the depth of the device + virtual sal_uInt16 GetBitCount() const override; + // get the width of the device + virtual long GetGraphicsWidth() const override; + + // set the clip region to empty + virtual void ResetClipRegion() override; + + // set the line color to transparent (= don't draw lines) + virtual void SetLineColor() override; + // set the line color to a specific color + virtual void SetLineColor( Color nColor ) override; + // set the fill color to transparent (= don't fill) + virtual void SetFillColor() override; + // set the fill color to a specific color, shapes will be + // filled accordingly + virtual void SetFillColor( Color nColor ) override; + // enable/disable XOR drawing + virtual void SetXORMode( bool bSet, bool ) override; + // set line color for raster operations + virtual void SetROPLineColor( SalROPColor nROPColor ) override; + // set fill color for raster operations + virtual void SetROPFillColor( SalROPColor nROPColor ) override; + // set the text color to a specific color + virtual void SetTextColor( Color nColor ) override; + // set the font + virtual void SetFont( LogicalFontInstance*, int nFallbackLevel ) override; + // get the current font's metrics + virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override; + // get the repertoire of the current font + virtual FontCharMapRef GetFontCharMap() const override; + // get the layout capabilities of the current font + virtual bool GetFontCapabilities(vcl::FontCapabilities &rGetFontCapabilities) const override; + // graphics must fill supplied font list + virtual void GetDevFontList( PhysicalFontCollection* ) override; + // graphics must drop any cached font info + virtual void ClearDevFontCache() override; + virtual bool AddTempDevFont( PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override; + // CreateFontSubset: a method to get a subset of glyhps of a font + // inside a new valid font file + // returns TRUE if creation of subset was successful + // parameters: rToFile: contains an osl file URL to write the subset to + // pFont: describes from which font to create a subset + // pGlyphIDs: the glyph ids to be extracted + // pEncoding: the character code corresponding to each glyph + // pWidths: the advance widths of the corresponding glyphs (in PS font units) + // nGlyphs: the number of glyphs + // rInfo: additional outgoing information + // implementation note: encoding 0 with glyph id 0 should be added implicitly + // as "undefined character" + virtual bool CreateFontSubset( const OUString& rToFile, + const PhysicalFontFace*, + const sal_GlyphId* pGlyphIDs, + const sal_uInt8* pEncoding, + sal_Int32* pWidths, + int nGlyphs, + FontSubsetInfo& rInfo // out parameter + ) override; + + // GetEmbedFontData: gets the font data for a font marked + // embeddable by GetDevFontList or NULL in case of error + // parameters: pFont: describes the font in question + // pDataLen: out parameter, contains the byte length of the returned buffer + virtual const void* GetEmbedFontData(const PhysicalFontFace*, long* pDataLen) override; + // frees the font data again + 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 std::unique_ptr<GenericSalLayout> + GetTextLayout(int nFallbackLevel) override; + virtual void DrawTextLayout( const GenericSalLayout& ) override; + + virtual bool supportsOperation( OutDevSupportType ) const override; + + virtual SystemGraphicsData GetGraphicsData() const override; + + /// Update settings based on the platform values + static void updateSettingsNative( AllSettings& rSettings ); +}; + +// Init/Deinit Graphics +void ImplUpdateSysColorEntries(); +int ImplIsSysColorEntry( Color nColor ); +void ImplGetLogFontFromFontSelect( HDC, const FontSelectPattern&, + const PhysicalFontFace*, LOGFONTW& ); + +#define MAX_64KSALPOINTS ((((sal_uInt16)0xFFFF)-8)/sizeof(POINTS)) + +// called extremely often from just one spot => inline +inline bool WinFontFace::HasChar( sal_uInt32 cChar ) const +{ + if( mxUnicodeMap->HasChar( cChar ) ) + return true; + // second chance to allow symbol aliasing + if( mbAliasSymbolsLow && ((cChar-0xF000) <= 0xFF) ) + cChar -= 0xF000; + else if( mbAliasSymbolsHigh && (cChar <= 0xFF) ) + cChar += 0xF000; + else + return false; + return mxUnicodeMap->HasChar( cChar ); +} + +#endif // INCLUDED_VCL_INC_WIN_SALGDI_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salids.hrc b/vcl/inc/win/salids.hrc new file mode 100644 index 000000000..092a24b52 --- /dev/null +++ b/vcl/inc/win/salids.hrc @@ -0,0 +1,93 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_WIN_SALIDS_HRC +#define INCLUDED_VCL_INC_WIN_SALIDS_HRC + +// Cursor +#define SAL_RESID_POINTER_NULL 10000 +#define SAL_RESID_POINTER_MAGNIFY 10015 +#define SAL_RESID_POINTER_FILL 10016 +#define SAL_RESID_POINTER_ROTATE 10017 +#define SAL_RESID_POINTER_HSHEAR 10018 +#define SAL_RESID_POINTER_VSHEAR 10019 +#define SAL_RESID_POINTER_MIRROR 10020 +#define SAL_RESID_POINTER_CROOK 10021 +#define SAL_RESID_POINTER_CROP 10022 +#define SAL_RESID_POINTER_MOVEPOINT 10023 +#define SAL_RESID_POINTER_MOVEBEZIERWEIGHT 10024 +#define SAL_RESID_POINTER_MOVEDATA 10025 +#define SAL_RESID_POINTER_COPYDATA 10026 +#define SAL_RESID_POINTER_LINKDATA 10027 +#define SAL_RESID_POINTER_MOVEDATALINK 10028 +#define SAL_RESID_POINTER_COPYDATALINK 10029 +#define SAL_RESID_POINTER_MOVEFILE 10030 +#define SAL_RESID_POINTER_COPYFILE 10031 +#define SAL_RESID_POINTER_LINKFILE 10032 +#define SAL_RESID_POINTER_MOVEFILELINK 10033 +#define SAL_RESID_POINTER_COPYFILELINK 10034 +#define SAL_RESID_POINTER_MOVEFILES 10035 +#define SAL_RESID_POINTER_COPYFILES 10036 +#define SAL_RESID_POINTER_DRAW_LINE 10038 +#define SAL_RESID_POINTER_DRAW_RECT 10039 +#define SAL_RESID_POINTER_DRAW_POLYGON 10040 +#define SAL_RESID_POINTER_DRAW_BEZIER 10041 +#define SAL_RESID_POINTER_DRAW_ARC 10042 +#define SAL_RESID_POINTER_DRAW_PIE 10043 +#define SAL_RESID_POINTER_DRAW_CIRCLECUT 10044 +#define SAL_RESID_POINTER_DRAW_ELLIPSE 10045 +#define SAL_RESID_POINTER_DRAW_FREEHAND 10046 +#define SAL_RESID_POINTER_DRAW_CONNECT 10047 +#define SAL_RESID_POINTER_DRAW_TEXT 10048 +#define SAL_RESID_POINTER_DRAW_CAPTION 10049 +#define SAL_RESID_POINTER_CHART 10050 +#define SAL_RESID_POINTER_DETECTIVE 10051 +#define SAL_RESID_POINTER_PIVOT_COL 10052 +#define SAL_RESID_POINTER_PIVOT_ROW 10053 +#define SAL_RESID_POINTER_PIVOT_FIELD 10054 +#define SAL_RESID_POINTER_CHAIN 10055 +#define SAL_RESID_POINTER_CHAIN_NOTALLOWED 10056 +#define SAL_RESID_POINTER_AUTOSCROLL_N 10059 +#define SAL_RESID_POINTER_AUTOSCROLL_S 10060 +#define SAL_RESID_POINTER_AUTOSCROLL_W 10061 +#define SAL_RESID_POINTER_AUTOSCROLL_E 10062 +#define SAL_RESID_POINTER_AUTOSCROLL_NW 10063 +#define SAL_RESID_POINTER_AUTOSCROLL_NE 10064 +#define SAL_RESID_POINTER_AUTOSCROLL_SW 10065 +#define SAL_RESID_POINTER_AUTOSCROLL_SE 10066 +#define SAL_RESID_POINTER_AUTOSCROLL_NS 10067 +#define SAL_RESID_POINTER_AUTOSCROLL_WE 10068 +#define SAL_RESID_POINTER_AUTOSCROLL_NSWE 10069 +#define SAL_RESID_POINTER_TEXT_VERTICAL 10071 +#define SAL_RESID_POINTER_PIVOT_DELETE 10072 +#define SAL_RESID_POINTER_TAB_SELECT_S 10073 +#define SAL_RESID_POINTER_TAB_SELECT_E 10074 +#define SAL_RESID_POINTER_TAB_SELECT_SE 10075 +#define SAL_RESID_POINTER_TAB_SELECT_W 10076 +#define SAL_RESID_POINTER_TAB_SELECT_SW 10077 +#define SAL_RESID_POINTER_HIDEWHITESPACE 10079 +#define SAL_RESID_POINTER_SHOWWHITESPACE 10080 + +#define SAL_RESID_BITMAP_50 11000 + +#define SAL_RESID_ICON_DEFAULT 1 + +#endif // INCLUDED_VCL_INC_WIN_SALIDS_HRC + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salinst.h b/vcl/inc/win/salinst.h new file mode 100644 index 000000000..c06e51c84 --- /dev/null +++ b/vcl/inc/win/salinst.h @@ -0,0 +1,87 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_WIN_SALINST_H +#define INCLUDED_VCL_INC_WIN_SALINST_H + +#include <sal/config.h> + +#include <osl/conditn.hxx> + +#include <salinst.hxx> + +class SalYieldMutex; + +class WinSalInstance : public SalInstance +{ +public: + /// Instance Handle + HINSTANCE mhInst; + /// invisible Window so non-main threads can SendMessage() the main thread + HWND mhComWnd; + + osl::Condition maWaitingYieldCond; + unsigned m_nNoYieldLock; + +public: + WinSalInstance(); + virtual ~WinSalInstance() override; + + virtual SalFrame* CreateChildFrame( SystemParentData* pParent, SalFrameStyleFlags nStyle ) override; + virtual SalFrame* CreateFrame( SalFrame* 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 std::unique_ptr<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 std::unique_ptr<SalPrinter> CreatePrinter( SalInfoPrinter* pInfoPrinter ) override; + virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList ) override; + virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) override; + virtual OUString GetDefaultPrinter() override; + virtual SalTimer* CreateSalTimer() override; + virtual SalSystem* CreateSalSystem() override; + virtual std::shared_ptr<SalBitmap> CreateSalBitmap() override; + virtual bool IsMainThread() const override; + + virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents) override; + virtual bool AnyInput( VclInputFlags nType ) override; + virtual std::unique_ptr<SalMenu> CreateMenu( bool bMenuBar, Menu* ) override; + virtual std::unique_ptr<SalMenuItem> CreateMenuItem( const SalItemParams & rItemData ) override; + virtual OpenGLContext* CreateOpenGLContext() override; + virtual OUString GetConnectionIdentifier() override; + virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) override; + + virtual OUString getOSVersion() override; + virtual std::shared_ptr<vcl::BackendCapabilities> GetBackendCapabilities() override; + + static int WorkaroundExceptionHandlingInUSER32Lib(int nExcept, LPEXCEPTION_POINTERS pExceptionInfo); +}; + +SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, HWND hWndParent, SalFrameStyleFlags nSalFrameStyle ); +SalObject* ImplSalCreateObject( WinSalInstance* pInst, WinSalFrame* pParent ); +HWND ImplSalReCreateHWND( HWND hWndParent, HWND oldhWnd, bool bAsChild ); + +#endif // INCLUDED_VCL_INC_WIN_SALINST_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salmenu.h b/vcl/inc/win/salmenu.h new file mode 100644 index 000000000..7058d9c82 --- /dev/null +++ b/vcl/inc/win/salmenu.h @@ -0,0 +1,68 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_WIN_SALMENU_H +#define INCLUDED_VCL_INC_WIN_SALMENU_H + +#include <vcl/bitmap.hxx> +#include <salmenu.hxx> + +class WinSalMenu : public SalMenu +{ +public: + WinSalMenu(); + virtual ~WinSalMenu() override; + virtual bool VisibleMenuBar() override; // must return TRUE to actually DISPLAY native menu bars + // otherwise only menu messages are processed (eg, OLE on Windows) + + virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) override; + virtual void RemoveItem( unsigned nPos ) override; + virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ) override; + virtual void SetFrame( const SalFrame* pFrame ) override; + virtual void CheckItem( unsigned nPos, bool bCheck ) override; + virtual void EnableItem( unsigned nPos, bool bEnable ) override; + virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OUString& rText ) override; + virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage ) override; + virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& rKeyName ) override; + virtual void GetSystemMenuData( SystemMenuData* pData ) override; + + HMENU mhMenu; // the menu handle + bool mbMenuBar; // true for menu bars + HWND mhWnd; // the window handle where the menubar is attached, may be NULL + WinSalMenu *mpParentMenu; // the parent menu +}; + +class WinSalMenuItem : public SalMenuItem +{ +public: + WinSalMenuItem(); + virtual ~WinSalMenuItem() override; + + MENUITEMINFOW mInfo; + void* mpMenu; // pointer to corresponding VCL menu + OUString mText; // the item text + OUString mAccelText; // the accelerator string + Bitmap maBitmap; // item image + int mnId; // item id + WinSalMenu* mpSalMenu; // the menu where this item is inserted +}; + +#endif // INCLUDED_VCL_INC_WIN_SALMENU_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salobj.h b/vcl/inc/win/salobj.h new file mode 100644 index 000000000..465c9ec77 --- /dev/null +++ b/vcl/inc/win/salobj.h @@ -0,0 +1,55 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_WIN_SALOBJ_H +#define INCLUDED_VCL_INC_WIN_SALOBJ_H + +#include <salobj.hxx> + + +class WinSalObject : public SalObject +{ +public: + HWND mhWnd; // Window handle + HWND mhWndChild; // Child Window handle + HWND mhLastFocusWnd; // Child-Window, which had the last focus + SystemEnvData maSysData; // SystemEnvData + RGNDATA* mpClipRgnData; // ClipRegion-Data + RGNDATA* mpStdClipRgnData; // Cache Standard-ClipRegion-Data + RECT* mpNextClipRect; // next ClipRegion-Rect + bool mbFirstClipRect; // Flag for first cliprect to insert + WinSalObject* mpNextObject; // pointer to next object + + WinSalObject(); + virtual ~WinSalObject() override; + + virtual void ResetClipRegion() override; + virtual void BeginSetClipRegion( sal_uInt32 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 Enable( bool bEnable ) override; + virtual void GrabFocus() override; + virtual const SystemEnvData* GetSystemData() const override; +}; + +#endif // INCLUDED_VCL_INC_WIN_SALOBJ_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salprn.h b/vcl/inc/win/salprn.h new file mode 100644 index 000000000..c0c6e7fb7 --- /dev/null +++ b/vcl/inc/win/salprn.h @@ -0,0 +1,113 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_WIN_SALPRN_H +#define INCLUDED_VCL_INC_WIN_SALPRN_H + +#include <salprn.hxx> + + +// WNT3 +#define SAL_DRIVERDATA_SYSSIGN ((sal_uIntPtr)0x574E5433) + +#pragma pack( 1 ) + +struct SalDriverData +{ + sal_uIntPtr mnSysSignature; + sal_uInt16 mnDriverOffset; + BYTE maDriverData[1]; +}; + +#pragma pack() + + +class WinSalGraphics; + +class WinSalInfoPrinter : public SalInfoPrinter +{ +public: + WinSalGraphics* mpGraphics; // current Printer graphics + OUString maDriverName; // printer driver name + OUString maDeviceName; // printer device name + OUString maPortName; // printer port name + HDC mhDC; // printer hdc + bool mbGraphics; // is Graphics used +public: + WinSalInfoPrinter(); + virtual ~WinSalInfoPrinter() override; + + virtual SalGraphics* AcquireGraphics() override; + virtual void ReleaseGraphics( SalGraphics* pGraphics ) override; + virtual bool Setup( weld::Window* pFrame, ImplJobSetup* pSetupData ) override; + virtual bool SetPrinterData( ImplJobSetup* pSetupData ) override; + virtual bool SetData( JobSetFlags nFlags, ImplJobSetup* pSetupData ) override; + virtual void GetPageInfo( const ImplJobSetup* pSetupData, + long& rOutWidth, long& rOutHeight, + Point& rPageOffset, + Size& rPaperSize ) override; + virtual sal_uInt32 GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) override; + virtual sal_uInt16 GetPaperBinCount( const ImplJobSetup* pSetupData ) override; + virtual OUString GetPaperBinName( const ImplJobSetup* pSetupData, sal_uInt16 nPaperBin ) override; + virtual void InitPaperFormats( const ImplJobSetup* pSetupData ) override; + virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ) override; +}; + + +class WinSalPrinter : public SalPrinter +{ +public: + WinSalGraphics* mpGraphics; // current Printer graphics + WinSalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter + WinSalPrinter* mpNextPrinter; // next printing printer + HDC mhDC; // printer hdc + SalPrinterError mnError; // error code + sal_uIntPtr mnCopies; // copies + bool mbCollate; // collated copies + bool mbAbort; // Job Aborted + + bool mbValid; + +protected: + void DoEndDoc(HDC hDC); + +public: + WinSalPrinter(); + virtual ~WinSalPrinter() override; + + using SalPrinter::StartJob; + virtual bool StartJob( const OUString* pFileName, + const OUString& rJobName, + const OUString& rAppName, + sal_uInt32 nCopies, + bool bCollate, + bool bDirect, + ImplJobSetup* pSetupData ) override; + virtual bool EndJob() override; + virtual SalGraphics* StartPage( ImplJobSetup* pSetupData, bool bNewJobData ) override; + virtual void EndPage() override; + virtual SalPrinterError GetErrorCode() override; + + void markInvalid(); + bool isValid() const { return mbValid; } +}; + +#endif // INCLUDED_VCL_INC_WIN_SALPRN_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salsys.h b/vcl/inc/win/salsys.h new file mode 100644 index 000000000..03f627b5a --- /dev/null +++ b/vcl/inc/win/salsys.h @@ -0,0 +1,70 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_WIN_SALSYS_H +#define INCLUDED_VCL_INC_WIN_SALSYS_H + +#include <salsys.hxx> + +#include <vector> +#include <map> + +class WinSalSystem : public SalSystem +{ +public: + struct DisplayMonitor + { + OUString m_aName; + tools::Rectangle m_aArea; + + DisplayMonitor() {} + DisplayMonitor( const OUString& rName, + const tools::Rectangle& rArea ) + : m_aName( rName ), + m_aArea( rArea ) + { + } + }; +private: + std::vector<DisplayMonitor> m_aMonitors; + std::map<OUString, unsigned int> m_aDeviceNameToMonitor; + unsigned int m_nPrimary; +public: + WinSalSystem() : m_nPrimary( 0 ) {} + virtual ~WinSalSystem() override; + + virtual unsigned int GetDisplayScreenCount() override; + virtual unsigned int GetDisplayBuiltInScreen() override; + virtual tools::Rectangle GetDisplayScreenPosSizePixel( unsigned int nScreen ) override; + virtual int ShowNativeMessageBox( const OUString& rTitle, + const OUString& rMessage) override; + bool initMonitors(); + // discards monitorinfo; used by WM_DISPLAYCHANGED handler + void clearMonitors(); + const std::vector<DisplayMonitor>& getMonitors() + { initMonitors(); return m_aMonitors;} + + bool handleMonitorCallback( sal_IntPtr /*HMONITOR*/, + sal_IntPtr /*HDC*/, + sal_IntPtr /*LPRECT*/ ); +}; + +#endif // INCLUDED_VCL_INC_WIN_SALSYS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/saltimer.h b/vcl/inc/win/saltimer.h new file mode 100644 index 000000000..a467de815 --- /dev/null +++ b/vcl/inc/win/saltimer.h @@ -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 . + */ + +#ifndef INCLUDED_VCL_INC_WIN_SALTIMER_H +#define INCLUDED_VCL_INC_WIN_SALTIMER_H + +#include <saltimer.hxx> + +class WinSalTimer final : public SalTimer, protected VersionedEvent +{ + // for access to Impl* functions + friend LRESULT CALLBACK SalComWndProc( HWND, UINT nMsg, WPARAM wParam, LPARAM lParam, bool& rDef ); + // for access to GetNextVersionedEvent + friend void CALLBACK SalTimerProc( PVOID data, BOOLEAN ); + // for access to ImplHandleElapsedTimer + friend bool ImplSalYield( bool bWait, bool bHandleAllCurrentEvents ); + + /** + * Identifier for our SetTimer based timer + */ + static constexpr UINT_PTR m_aWmTimerId = 0xdeadbeef; + + HANDLE m_nTimerId; ///< Windows timer id + bool m_bDirectTimeout; ///< timeout can be processed directly + bool m_bForceRealTimer; ///< enforce using a real timer for 0ms + bool m_bSetTimerRunning; ///< true, if a SetTimer is running + + void ImplStart( sal_uInt64 nMS ); + void ImplStop(); + void ImplHandleTimerEvent( WPARAM aWPARAM ); + void ImplHandleElapsedTimer(); + void ImplHandle_WM_TIMER( WPARAM aWPARAM ); + +public: + WinSalTimer(); + virtual ~WinSalTimer() override; + + virtual void Start(sal_uInt64 nMS) override; + virtual void Stop() override; + + inline bool IsDirectTimeout() const; + inline bool HasTimerElapsed() const; + + /** + * Enforces the usage of a real timer instead of the message queue + * + * Needed for Window resize processing, as this starts a modal event loop. + */ + void SetForceRealTimer( bool bVal ); + inline bool GetForceRealTimer() const; +}; + +inline bool WinSalTimer::IsDirectTimeout() const +{ + return m_bDirectTimeout; +} + +inline bool WinSalTimer::HasTimerElapsed() const +{ + return m_bDirectTimeout || ExistsValidEvent(); +} + +inline bool WinSalTimer::GetForceRealTimer() const +{ + return m_bForceRealTimer; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salvd.h b/vcl/inc/win/salvd.h new file mode 100644 index 000000000..4121d2c89 --- /dev/null +++ b/vcl/inc/win/salvd.h @@ -0,0 +1,70 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_WIN_SALVD_H +#define INCLUDED_VCL_INC_WIN_SALVD_H + +#include <sal/config.h> +#include <win/scoped_gdi.hxx> + +#include <memory> + +#include <salvd.hxx> + +class WinSalGraphics; + + +class WinSalVirtualDevice : public SalVirtualDevice +{ +private: + HDC mhLocalDC; // HDC or 0 for Cache Device + ScopedHBITMAP mhBmp; // Memory Bitmap + HBITMAP mhDefBmp; // Default Bitmap + std::unique_ptr<WinSalGraphics> mpGraphics; // current VirDev graphics + WinSalVirtualDevice* mpNext; // next VirDev + sal_uInt16 mnBitCount; // BitCount (0 or 1) + bool mbGraphics; // is Graphics used + bool mbForeignDC; // uses a foreign DC instead of a bitmap + long mnWidth; + long mnHeight; + +public: + HDC getHDC() const { return mhLocalDC; } + WinSalGraphics* getGraphics() const { return mpGraphics.get(); } + void setGraphics(WinSalGraphics* pVirGraphics) { mpGraphics.reset(pVirGraphics); } + WinSalVirtualDevice* getNext() const { return mpNext; } + + WinSalVirtualDevice(HDC hDC = nullptr, HBITMAP hBMP = nullptr, sal_uInt16 nBitCount = 0, bool bForeignDC = false, long nWidth = 0, long nHeight = 0); + virtual ~WinSalVirtualDevice() override; + + virtual SalGraphics* AcquireGraphics() override; + virtual void ReleaseGraphics( SalGraphics* pGraphics ) override; + virtual bool SetSize( long nNewDX, long nNewDY ) override; + + static HBITMAP ImplCreateVirDevBitmap(HDC hDC, long nDX, long nDY, sal_uInt16 nBitCount, void **ppDummy); + + // SalGeometryProvider + virtual long GetWidth() const override { return mnWidth; } + virtual long GetHeight() const override { return mnHeight; } +}; + + +#endif // INCLUDED_VCL_INC_WIN_SALVD_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/scoped_gdi.hxx b/vcl/inc/win/scoped_gdi.hxx new file mode 100644 index 000000000..d02ad9545 --- /dev/null +++ b/vcl/inc/win/scoped_gdi.hxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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/. + */ + +#ifndef INCLUDED_VCL_INC_WIN_SCOPED_GDI_HXX +#define INCLUDED_VCL_INC_WIN_SCOPED_GDI_HXX + +#include <win/svsys.h> +#include <win/wincomp.hxx> +#include <win/saldata.hxx> + +#include <memory> + +template <typename H, auto DeleterFunc> struct GDIDeleter +{ + using pointer = H; + void operator()(H h) { DeleterFunc(h); } +}; + +template <typename H, auto DeleterFunc> +using ScopedGDI = std::unique_ptr<H, GDIDeleter<H, DeleterFunc>>; + +using ScopedHBRUSH = ScopedGDI<HBRUSH, DeleteBrush>; +using ScopedHRGN = ScopedGDI<HRGN, DeleteRegion>; +using ScopedHDC = ScopedGDI<HDC, DeleteDC>; +using ScopedHPEN = ScopedGDI<HPEN, DeletePen>; +using ScopedHFONT = ScopedGDI<HFONT, DeleteFont>; +using ScopedHBITMAP = ScopedGDI<HBITMAP, DeleteBitmap>; + +template <typename ScopedH, auto SelectorFunc> class ScopedSelectedGDI +{ +public: + ScopedSelectedGDI(HDC hDC, typename ScopedH::pointer h) + : m_hDC(hDC) + , m_hSelectedH(h) + , m_hOrigH(SelectorFunc(hDC, h)) + { + } + + ~ScopedSelectedGDI() { SelectorFunc(m_hDC, m_hOrigH); } + +private: + HDC m_hDC; + ScopedH m_hSelectedH; + typename ScopedH::pointer m_hOrigH; +}; + +using ScopedSelectedHPEN = ScopedSelectedGDI<ScopedHPEN, SelectPen>; +using ScopedSelectedHFONT = ScopedSelectedGDI<ScopedHFONT, SelectFont>; +using ScopedSelectedHBRUSH = ScopedSelectedGDI<ScopedHBRUSH, SelectBrush>; + +template <sal_uLong ID> class ScopedCachedHDC +{ +public: + explicit ScopedCachedHDC(HBITMAP hBitmap) + : m_hDC(ImplGetCachedDC(ID, hBitmap)) + { + } + + ~ScopedCachedHDC() { ImplReleaseCachedDC(ID); } + + HDC get() const { return m_hDC; } + +private: + HDC m_hDC; +}; + +#endif // INCLUDED_VCL_INC_WIN_SCOPED_GDI_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/win/svsys.h b/vcl/inc/win/svsys.h new file mode 100644 index 000000000..44cae93cf --- /dev/null +++ b/vcl/inc/win/svsys.h @@ -0,0 +1,33 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_WIN_SVSYS_H +#define INCLUDED_VCL_INC_WIN_SVSYS_H + +#ifdef _WIN32 +#ifndef INCLUDED_PRE_POST_WIN_H +#define INCLUDED_PRE_POST_WIN_H +#include <prewin.h> +#include <postwin.h> +#endif +#endif + +#endif // INCLUDED_VCL_INC_WIN_SVSYS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/wincomp.hxx b/vcl/inc/win/wincomp.hxx new file mode 100644 index 000000000..05b4800e1 --- /dev/null +++ b/vcl/inc/win/wincomp.hxx @@ -0,0 +1,234 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_WIN_WINCOMP_HXX +#define INCLUDED_VCL_INC_WIN_WINCOMP_HXX + +#include <string.h> + + +// Adjustments for TypeChecking + +inline HPEN SelectPen( HDC hDC, HPEN hPen ) +{ + return static_cast<HPEN>(SelectObject( hDC, static_cast<HGDIOBJ>(hPen) )); +} + +inline void DeletePen( HPEN hPen ) +{ + DeleteObject( static_cast<HGDIOBJ>(hPen) ); +} + +inline HPEN GetStockPen( int nObject ) +{ + return static_cast<HPEN>(GetStockObject( nObject )); +} + +inline HBRUSH SelectBrush( HDC hDC, HBRUSH hBrush ) +{ + return static_cast<HBRUSH>(SelectObject( hDC, static_cast<HGDIOBJ>(hBrush) )); +} + +inline void DeleteBrush( HBRUSH hBrush ) +{ + DeleteObject( static_cast<HGDIOBJ>(hBrush) ); +} + +inline HBRUSH GetStockBrush( int nObject ) +{ + return static_cast<HBRUSH>(GetStockObject( nObject )); +} + +inline HFONT SelectFont( HDC hDC, HFONT hFont ) +{ + return static_cast<HFONT>(SelectObject( hDC, static_cast<HGDIOBJ>(hFont) )); +} + +inline void DeleteFont( HFONT hFont ) +{ + DeleteObject( static_cast<HGDIOBJ>(hFont) ); +} + +inline HFONT GetStockFont( int nObject ) +{ + return static_cast<HFONT>(GetStockObject( nObject )); +} + +inline HBITMAP SelectBitmap( HDC hDC, HBITMAP hBitmap ) +{ + return static_cast<HBITMAP>(SelectObject( hDC, static_cast<HGDIOBJ>(hBitmap) )); +} + +inline void DeleteBitmap( HBITMAP hBitmap ) +{ + DeleteObject( static_cast<HGDIOBJ>(hBitmap) ); +} + +inline void DeleteRegion( HRGN hRegion ) +{ + DeleteObject( static_cast<HGDIOBJ>(hRegion) ); +} + +inline HPALETTE GetStockPalette( int nObject ) +{ + return static_cast<HPALETTE>(GetStockObject( nObject )); +} + +inline void DeletePalette( HPALETTE hPalette ) +{ + DeleteObject( static_cast<HGDIOBJ>(hPalette) ); +} + +inline void SetWindowStyle( HWND hWnd, DWORD nStyle ) +{ + SetWindowLongPtrW( hWnd, GWL_STYLE, nStyle ); +} + +inline DWORD GetWindowStyle( HWND hWnd ) +{ + return GetWindowLongPtrW( hWnd, GWL_STYLE ); +} + +inline void SetWindowExStyle( HWND hWnd, DWORD nStyle ) +{ + SetWindowLongPtrW( hWnd, GWL_EXSTYLE, nStyle ); +} + +inline DWORD GetWindowExStyle( HWND hWnd ) +{ + return GetWindowLongPtrW( hWnd, GWL_EXSTYLE ); +} + +inline BOOL IsMinimized( HWND hWnd ) +{ + return IsIconic( hWnd ); +} + +inline BOOL IsMaximized( HWND hWnd ) +{ + return IsZoomed( hWnd ); +} + +inline void SetWindowFont( HWND hWnd, HFONT hFont, BOOL bRedraw ) +{ + SendMessageW( hWnd, WM_SETFONT, reinterpret_cast<WPARAM>(hFont), MAKELPARAM(static_cast<UINT>(bRedraw),0) ); +} + +inline HFONT GetWindowFont( HWND hWnd ) +{ + return reinterpret_cast<HFONT>(SendMessageW( hWnd, WM_GETFONT, 0, 0 )); +} + +inline void SetClassCursor( HWND hWnd, HCURSOR hCursor ) +{ + SetClassLongPtr( hWnd, GCLP_HCURSOR, reinterpret_cast<LONG_PTR>(hCursor) ); +} + +inline HCURSOR GetClassCursor( HWND hWnd ) +{ + return reinterpret_cast<HCURSOR>(GetClassLongPtr( hWnd, GCLP_HCURSOR )); +} + +inline void SetClassIcon( HWND hWnd, HICON hIcon ) +{ + SetClassLongPtr( hWnd, GCLP_HICON, reinterpret_cast<LONG_PTR>(hIcon) ); +} + +inline HICON GetClassIcon( HWND hWnd ) +{ + return reinterpret_cast<HICON>(GetClassLongPtr( hWnd, GCLP_HICON )); +} + +inline HBRUSH SetClassBrush( HWND hWnd, HBRUSH hBrush ) +{ + return reinterpret_cast<HBRUSH>(SetClassLongPtr( hWnd, GCLP_HBRBACKGROUND, reinterpret_cast<LONG_PTR>(hBrush) )); +} + +inline HBRUSH GetClassBrush( HWND hWnd ) +{ + return reinterpret_cast<HBRUSH>(GetClassLongPtr( hWnd, GCLP_HBRBACKGROUND )); +} + +inline HINSTANCE GetWindowInstance( HWND hWnd ) +{ + return reinterpret_cast<HINSTANCE>(GetWindowLongPtrW( hWnd, GWLP_HINSTANCE )); +} + + +#define MOUSEZ_CLASSNAME L"MouseZ" // wheel window class +#define MOUSEZ_TITLE L"Magellan MSWHEEL" // wheel window title + +#define MSH_WHEELMODULE_CLASS (MOUSEZ_CLASSNAME) +#define MSH_WHEELMODULE_TITLE (MOUSEZ_TITLE) + +#define MSH_SCROLL_LINES L"MSH_SCROLL_LINES_MSG" + +#ifndef WHEEL_DELTA +#define WHEEL_DELTA 120 +#endif +#ifndef WM_MOUSEWHEEL +#define WM_MOUSEWHEEL 0x020A +#endif +#ifndef SPI_GETWHEELSCROLLLINES +#define SPI_GETWHEELSCROLLLINES 104 +#endif +#ifndef SPI_SETWHEELSCROLLLINES +#define SPI_SETWHEELSCROLLLINES 105 +#endif +#ifndef WHEEL_PAGESCROLL +#define WHEEL_PAGESCROLL (UINT_MAX) +#endif + + +// - 5.0 extensions - + +#ifndef COLOR_GRADIENTACTIVECAPTION +#define COLOR_GRADIENTACTIVECAPTION 27 +#endif +#ifndef COLOR_GRADIENTINACTIVECAPTION +#define COLOR_GRADIENTINACTIVECAPTION 28 +#endif + +#ifndef SPI_GETFLATMENU +#define SPI_GETFLATMENU 0x1022 +#endif +#ifndef COLOR_MENUBAR +#define COLOR_MENUBAR 30 +#endif +#ifndef COLOR_MENUHILIGHT +#define COLOR_MENUHILIGHT 29 +#endif + +#ifndef CS_DROPSHADOW +#define CS_DROPSHADOW 0x00020000 +#endif + +// MT 12/03: From winuser.h, only needed in salframe.cxx +// Better change salframe.cxx to include winuser.h + +#define WS_EX_LAYERED 0x00080000 + +#ifndef WM_UNICHAR +#define WM_UNICHAR 0x0109 +#define UNICODE_NOCHAR 0xFFFF +#endif + +#endif // INCLUDED_VCL_INC_WIN_WINCOMP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/wingdiimpl.hxx b/vcl/inc/win/wingdiimpl.hxx new file mode 100644 index 000000000..679be2c36 --- /dev/null +++ b/vcl/inc/win/wingdiimpl.hxx @@ -0,0 +1,61 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_INC_WIN_WINGDIIMPL_HXX +#define INCLUDED_VCL_INC_WIN_WINGDIIMPL_HXX + +#include <win/salgdi.h> +#include <ControlCacheKey.hxx> + +class ControlCacheKey; + +// Base class for some functionality that OpenGL/Skia/GDI backends must each implement. +class WinSalGraphicsImplBase +{ +public: + virtual ~WinSalGraphicsImplBase(){}; + + // If true is returned, the following functions are used for drawing controls. + virtual bool UseRenderNativeControl() const { return false; } + virtual bool TryRenderCachedNativeControl(const ControlCacheKey& /*rControlCacheKey*/, + int /*nX*/, int /*nY*/) + { + abort(); + }; + virtual bool RenderAndCacheNativeControl(CompatibleDC& /*rWhite*/, CompatibleDC& /*rBlack*/, + int /*nX*/, int /*nY*/, + ControlCacheKey& /*aControlCacheKey*/) + { + abort(); + }; + + virtual void ClearDevFontCache(){}; + + // Implementation for WinSalGraphics::DrawTextLayout(). + // Returns true if handled, if false, then WinSalGraphics will handle it itself. + virtual bool DrawTextLayout(const GenericSalLayout&) { return false; } + // If true is returned, the following functions are used for text rendering. + virtual bool UseTextDraw() const { return false; } + virtual void PreDrawText() {} + virtual void PostDrawText() {} + virtual void DrawTextMask(CompatibleDC::Texture* /*rTexture*/, Color /*nMaskColor*/, + const SalTwoRect& /*rPosAry*/) + { + abort(); + }; + virtual void DeferredTextDraw(const CompatibleDC::Texture* /*pTexture*/, Color /*nMaskColor*/, + const SalTwoRect& /*rPosAry*/) + { + abort(); + }; +}; + +#endif // INCLUDED_VCL_INC_WIN_WINGDIIMPL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx new file mode 100644 index 000000000..35a855a37 --- /dev/null +++ b/vcl/inc/win/winlayout.hxx @@ -0,0 +1,187 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_WIN_WINLAYOUT_HXX +#define INCLUDED_VCL_INC_WIN_WINLAYOUT_HXX + +#include <rtl/ustring.hxx> + +#include <sallayout.hxx> +#include <svsys.h> +#include <win/salgdi.h> +#include <o3tl/sorted_vector.hxx> + +class WinFontInstance; + +namespace +{ +// Extra space at the top and bottom of the glyph in total = tmHeight / GLYPH_SPACE_RATIO; +const int GLYPH_SPACE_RATIO = 8; +// Border size at the top of the glyph = tmHeight / GLYPH_OFFSET_RATIO; +const int GLYPH_OFFSET_RATIO = GLYPH_SPACE_RATIO * 2; +} + +struct WinGlyphDrawElement +{ + tools::Rectangle maLocation; + int maLeftOverhangs; + std::unique_ptr<CompatibleDC::Texture> maTexture; + int mnBaselineOffset; + int mnHeight; + bool mbVertical; + + int getExtraSpace() const + { + return std::max(mnHeight / GLYPH_SPACE_RATIO, 4); + } + + int getExtraOffset() const + { + return std::max(mnHeight / GLYPH_OFFSET_RATIO, 2); + } +}; + +class WinGlyphCache; + +struct GlobalWinGlyphCache +{ + o3tl::sorted_vector<WinGlyphCache*> maWinGlyphCaches; + + static GlobalWinGlyphCache * get(); + + virtual ~GlobalWinGlyphCache() {} + virtual bool AllocateTexture(WinGlyphDrawElement& rElement, CompatibleDC* dc) = 0; + virtual void NotifyElementUsed(WinGlyphDrawElement& /*rElement*/) {} + virtual void Prune() {} +}; + +class WinGlyphCache +{ +protected: + std::unordered_map<int, WinGlyphDrawElement> maWinTextureCache; + +public: + WinGlyphCache() + { + if(GlobalWinGlyphCache* c = GlobalWinGlyphCache::get()) + c->maWinGlyphCaches.insert(this); + } + + virtual ~WinGlyphCache() + { + if(GlobalWinGlyphCache* c = GlobalWinGlyphCache::get()) + c->maWinGlyphCaches.erase(this); + } + + void PutDrawElementInCache(WinGlyphDrawElement&& rElement, int nGlyphIndex) + { + assert(GlobalWinGlyphCache::get()); + assert(!IsGlyphCached(nGlyphIndex)); + maWinTextureCache[nGlyphIndex] = std::move( rElement ); + } + + WinGlyphDrawElement& GetDrawElement(int nGlyphIndex) + { + assert(GlobalWinGlyphCache::get()); + assert(IsGlyphCached(nGlyphIndex)); + WinGlyphDrawElement& element = maWinTextureCache[nGlyphIndex]; + GlobalWinGlyphCache::get()->NotifyElementUsed(element); + return element; + } + + bool IsGlyphCached(int nGlyphIndex) const + { + return maWinTextureCache.find(nGlyphIndex) != maWinTextureCache.end(); + } +}; + +// win32 specific logical font instance +class WinFontInstance : public LogicalFontInstance +{ + friend rtl::Reference<LogicalFontInstance> WinFontFace::CreateFontInstance(const FontSelectPattern&) const; + +public: + ~WinFontInstance() override; + + bool hasHScale() const; + float getHScale() const; + + void SetGraphics(WinSalGraphics*); + WinSalGraphics* GetGraphics() const { return m_pGraphics; } + + HFONT GetHFONT() const { return m_hFont; } + float GetScale() const { return m_fScale; } + + // Prevent deletion of the HFONT in the WinFontInstance destructor + // Used for the ScopedFont handling + void SetHFONT(HFONT hFont) { m_hFont = hFont; } + + const WinFontFace * GetFontFace() const { return static_cast<const WinFontFace *>(LogicalFontInstance::GetFontFace()); } + WinFontFace * GetFontFace() { return static_cast<WinFontFace *>(LogicalFontInstance::GetFontFace()); } + + bool CacheGlyphToAtlas(HDC hDC, HFONT hFont, int nGlyphIndex, SalGraphics& rGraphics, const GenericSalLayout& rLayout); + WinGlyphCache& GetWinGlyphCache() { return maWinGlyphCache; } + + bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const override; + +private: + explicit WinFontInstance(const WinFontFace&, const FontSelectPattern&); + + hb_font_t* ImplInitHbFont() override; + bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const override; + + WinSalGraphics *m_pGraphics; + HFONT m_hFont; + float m_fScale; + WinGlyphCache maWinGlyphCache; +}; + +class TextOutRenderer +{ +protected: + explicit TextOutRenderer() = default; + TextOutRenderer(const TextOutRenderer &) = delete; + TextOutRenderer & operator = (const TextOutRenderer &) = delete; + +public: + static TextOutRenderer & get(bool bUseDWrite); + + virtual ~TextOutRenderer() = default; + + virtual bool operator ()(GenericSalLayout const &rLayout, + SalGraphics &rGraphics, + HDC hDC) = 0; +}; + +class ExTextOutRenderer : public TextOutRenderer +{ + ExTextOutRenderer(const ExTextOutRenderer &) = delete; + ExTextOutRenderer & operator = (const ExTextOutRenderer &) = delete; + +public: + explicit ExTextOutRenderer() = default; + + bool operator ()(GenericSalLayout const &rLayout, + SalGraphics &rGraphics, + HDC hDC) override; +}; + +#endif // INCLUDED_VCL_INC_WIN_WINLAYOUT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/window.h b/vcl/inc/window.h new file mode 100644 index 000000000..6b362e7d3 --- /dev/null +++ b/vcl/inc/window.h @@ -0,0 +1,438 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_INC_WINDOW_H +#define INCLUDED_VCL_INC_WINDOW_H + +#include <sal/config.h> + +#include <tools/fract.hxx> +#include <vcl/commandevent.hxx> +#include <vcl/idle.hxx> +#include <vcl/inputctx.hxx> +#include <vcl/window.hxx> +#include <vcl/settings.hxx> +#include <o3tl/typed_flags_set.hxx> +#include <cppuhelper/weakref.hxx> + +#include <optional> +#include <list> +#include <memory> +#include <vector> +#include <set> + +class FixedText; +class VclSizeGroup; +class VirtualDevice; +class PhysicalFontCollection; +class ImplFontCache; +class VCLXWindow; +class WindowStateData; +class SalFrame; +class SalObject; +enum class MouseEventModifiers; +enum class MouseNotifyEvent; +enum class ActivateModeFlags; +enum class DialogControlFlags; +enum class GetFocusFlags; +enum class ParentClipMode; +enum class SalEvent; + +namespace com::sun::star { + + namespace accessibility { + class XAccessible; + class XAccessibleContext; + class XAccessibleEditableText; + } + + namespace rendering { + class XCanvas; + } + + namespace awt { + class XWindowPeer; + class XWindow; + } + namespace uno { + class Any; + class XInterface; + } + namespace datatransfer { + namespace clipboard { + class XClipboard; + } + namespace dnd { + class XDropTargetListener; + class XDragGestureRecognizer; + class XDragSource; + class XDropTarget; + } + } +} + +VCL_DLLPUBLIC Size bestmaxFrameSizeForScreenSize(const Size &rScreenSize); + +//return true if this window and its stack of containers are all shown +bool isVisibleInLayout(const vcl::Window *pWindow); + +//return true if this window and its stack of containers are all enabled +bool isEnabledInLayout(const vcl::Window *pWindow); + +bool ImplWindowFrameProc( vcl::Window* pInst, SalEvent nEvent, const void* pEvent ); + +struct ImplWinData +{ + std::optional<OUString> + mpExtOldText; + std::unique_ptr<ExtTextInputAttr[]> + mpExtOldAttrAry; + std::optional<tools::Rectangle> + mpCursorRect; + long mnCursorExtWidth; + bool mbVertical; + std::unique_ptr<tools::Rectangle[]> + mpCompositionCharRects; + long mnCompositionCharRects; + std::optional<tools::Rectangle> + mpFocusRect; + std::optional<tools::Rectangle> + mpTrackRect; + ShowTrackFlags mnTrackFlags; + sal_uInt16 mnIsTopWindow; + bool mbMouseOver; //< tracks mouse over for native widget paint effect + bool mbEnableNativeWidget; //< toggle native widget rendering + ::std::list< VclPtr<vcl::Window> > + maTopWindowChildren; + + ImplWinData(); + ~ImplWinData(); +}; + +struct ImplFrameData +{ + Idle maPaintIdle; //< paint idle handler + Idle maResizeIdle; //< resize timer + InputContext maOldInputContext; //< last set Input Context + VclPtr<vcl::Window> mpNextFrame; //< next frame window + VclPtr<vcl::Window> mpFirstOverlap; //< first overlap vcl::Window + VclPtr<vcl::Window> mpFocusWin; //< focus window (is also set, when frame doesn't have the focus) + VclPtr<vcl::Window> mpMouseMoveWin; //< last window, where MouseMove() called + VclPtr<vcl::Window> mpMouseDownWin; //< last window, where MouseButtonDown() called + std::vector<VclPtr<vcl::Window> > maOwnerDrawList; //< List of system windows with owner draw decoration + std::shared_ptr<PhysicalFontCollection> mxFontCollection; //< Font-List for this frame + std::shared_ptr<ImplFontCache> mxFontCache; //< Font-Cache for this frame + sal_Int32 mnDPIX; //< Original Screen Resolution + sal_Int32 mnDPIY; //< Original Screen Resolution + ImplSVEvent * mnFocusId; //< FocusId for PostUserLink + ImplSVEvent * mnMouseMoveId; //< MoveId for PostUserLink + long mnLastMouseX; //< last x mouse position + long mnLastMouseY; //< last y mouse position + long mnBeforeLastMouseX; //< last but one x mouse position + long mnBeforeLastMouseY; //< last but one y mouse position + long mnFirstMouseX; //< first x mouse position by mousebuttondown + long mnFirstMouseY; //< first y mouse position by mousebuttondown + long mnLastMouseWinX; //< last x mouse position, rel. to pMouseMoveWin + long mnLastMouseWinY; //< last y mouse position, rel. to pMouseMoveWin + sal_uInt16 mnModalMode; //< frame based modal count (app based makes no sense anymore) + sal_uInt64 mnMouseDownTime; //< mouse button down time for double click + sal_uInt16 mnClickCount; //< mouse click count + sal_uInt16 mnFirstMouseCode; //< mouse code by mousebuttondown + sal_uInt16 mnMouseCode; //< mouse code + MouseEventModifiers mnMouseMode; //< mouse mode + bool mbHasFocus; //< focus + bool mbInMouseMove; //< is MouseMove on stack + bool mbMouseIn; //> is Mouse inside the frame + bool mbStartDragCalled; //< is command startdrag called + bool mbNeedSysWindow; //< set, when FrameSize <= IMPL_MIN_NEEDSYSWIN + bool mbMinimized; //< set, when FrameSize <= 0 + bool mbStartFocusState; //< FocusState, when sending the event + bool mbInSysObjFocusHdl; //< within a SysChildren's GetFocus handler + bool mbInSysObjToTopHdl; //< within a SysChildren's ToTop handler + bool mbSysObjFocus; //< does a SysChild have focus + sal_Int32 mnTouchPanPosition; + + css::uno::Reference< css::datatransfer::dnd::XDragSource > mxDragSource; + css::uno::Reference< css::datatransfer::dnd::XDropTarget > mxDropTarget; + css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > mxDropTargetListener; + css::uno::Reference< css::datatransfer::clipboard::XClipboard > mxClipboard; + css::uno::Reference< css::datatransfer::clipboard::XClipboard > mxSelection; + + bool mbInternalDragGestureRecognizer; + VclPtr<VirtualDevice> mpBuffer; ///< Buffer for the double-buffering + bool mbInBufferedPaint; ///< PaintHelper is in the process of painting into this buffer. + tools::Rectangle maBufferedRect; ///< Rectangle in the buffer that has to be painted to the screen. + + ImplFrameData( vcl::Window *pWindow ); +}; + +struct ImplAccessibleInfos +{ + sal_uInt16 nAccessibleRole; + std::optional<OUString> + pAccessibleName; + std::optional<OUString> + pAccessibleDescription; + VclPtr<vcl::Window> pLabeledByWindow; + VclPtr<vcl::Window> pLabelForWindow; + VclPtr<vcl::Window> pMemberOfWindow; + + ImplAccessibleInfos(); + ~ImplAccessibleInfos(); +}; + +enum AlwaysInputMode { AlwaysInputNone = 0, AlwaysInputEnabled = 1, AlwaysInputDisabled =2 }; + +enum class ImplPaintFlags { + NONE = 0x0000, + Paint = 0x0001, + PaintAll = 0x0002, + PaintAllChildren = 0x0004, + PaintChildren = 0x0008, + Erase = 0x0010, + CheckRtl = 0x0020, +}; +namespace o3tl { + template<> struct typed_flags<ImplPaintFlags> : is_typed_flags<ImplPaintFlags, 0x003f> {}; +} + + +class WindowImpl +{ +private: + WindowImpl(const WindowImpl&) = delete; + WindowImpl& operator=(const WindowImpl&) = delete; +public: + WindowImpl( WindowType ); + ~WindowImpl(); + + ImplWinData* mpWinData; + ImplFrameData* mpFrameData; + SalFrame* mpFrame; + SalObject* mpSysObj; + VclPtr<vcl::Window> mpFrameWindow; + VclPtr<vcl::Window> mpOverlapWindow; + VclPtr<vcl::Window> mpBorderWindow; + VclPtr<vcl::Window> mpClientWindow; + VclPtr<vcl::Window> mpParent; + VclPtr<vcl::Window> mpRealParent; + VclPtr<vcl::Window> mpFirstChild; + VclPtr<vcl::Window> mpLastChild; + VclPtr<vcl::Window> mpFirstOverlap; + VclPtr<vcl::Window> mpLastOverlap; + VclPtr<vcl::Window> mpPrev; + VclPtr<vcl::Window> mpNext; + VclPtr<vcl::Window> mpNextOverlap; + VclPtr<vcl::Window> mpLastFocusWindow; + VclPtr<vcl::Window> mpDlgCtrlDownWindow; + std::vector<Link<VclWindowEvent&,void>> maEventListeners; + int mnEventListenersIteratingCount; + std::set<Link<VclWindowEvent&,void>> maEventListenersDeleted; + std::vector<Link<VclWindowEvent&,void>> maChildEventListeners; + int mnChildEventListenersIteratingCount; + std::set<Link<VclWindowEvent&,void>> maChildEventListenersDeleted; + Link<vcl::Window&, bool> maHelpRequestHdl; + Link<vcl::Window&, bool> maMnemonicActivateHdl; + Link<boost::property_tree::ptree&, void> maDumpAsPropertyTreeHdl; + + // The canvas interface for this VCL window. Is persistent after the first GetCanvas() call + css::uno::WeakReference< css::rendering::XCanvas > mxCanvas; + + vcl::Cursor* mpCursor; + PointerStyle maPointer; + Fraction maZoom; + OUString maText; + std::unique_ptr<vcl::Font> + mpControlFont; + Color maControlForeground; + Color maControlBackground; + sal_Int32 mnLeftBorder; + sal_Int32 mnTopBorder; + sal_Int32 mnRightBorder; + sal_Int32 mnBottomBorder; + sal_Int32 mnWidthRequest; + sal_Int32 mnHeightRequest; + sal_Int32 mnOptimalWidthCache; + sal_Int32 mnOptimalHeightCache; + long mnX; + long mnY; + long mnAbsScreenX; + Point maPos; + OString maHelpId; + OUString maHelpText; + OUString maQuickHelpText; + OUString maID; + InputContext maInputContext; + css::uno::Reference< css::awt::XWindowPeer > mxWindowPeer; + css::uno::Reference< css::accessibility::XAccessible > mxAccessible; + std::shared_ptr< VclSizeGroup > m_xSizeGroup; + std::vector<VclPtr<FixedText>> m_aMnemonicLabels; + std::unique_ptr<ImplAccessibleInfos> mpAccessibleInfos; + VCLXWindow* mpVCLXWindow; + vcl::Region maWinRegion; //< region to 'shape' the VCL window (frame coordinates) + vcl::Region maWinClipRegion; //< the (clipping) region that finally corresponds to the VCL window (frame coordinates) + vcl::Region maInvalidateRegion; //< region that has to be redrawn (frame coordinates) + std::unique_ptr<vcl::Region> mpChildClipRegion; //< child clip region if CLIPCHILDREN is set (frame coordinates) + vcl::Region* mpPaintRegion; //< only set during Paint() method call (window coordinates) + WinBits mnStyle; + WinBits mnPrevStyle; + WindowExtendedStyle mnExtendedStyle; + WindowType mnType; + ControlPart mnNativeBackground; + sal_uInt16 mnWaitCount; + ImplPaintFlags mnPaintFlags; + GetFocusFlags mnGetFocusFlags; + ParentClipMode mnParentClipMode; + ActivateModeFlags mnActivateMode; + DialogControlFlags mnDlgCtrlFlags; + AlwaysInputMode meAlwaysInputMode; + VclAlign meHalign; + VclAlign meValign; + VclPackType mePackType; + sal_Int32 mnPadding; + sal_Int32 mnGridHeight; + sal_Int32 mnGridLeftAttach; + sal_Int32 mnGridTopAttach; + sal_Int32 mnGridWidth; + sal_Int32 mnBorderWidth; + sal_Int32 mnMarginLeft; + sal_Int32 mnMarginRight; + sal_Int32 mnMarginTop; + sal_Int32 mnMarginBottom; + bool mbFrame:1, + mbBorderWin:1, + mbOverlapWin:1, + mbSysWin:1, + mbDialog:1, + mbDockWin:1, + mbFloatWin:1, + mbPushButton:1, + mbVisible:1, + mbDisabled:1, + mbInputDisabled:1, + mbNoUpdate:1, + mbNoParentUpdate:1, + mbActive:1, + mbReallyVisible:1, + mbReallyShown:1, + mbInInitShow:1, + mbChildPtrOverwrite:1, + mbNoPtrVisible:1, + mbPaintFrame:1, + mbInPaint:1, + mbMouseButtonDown:1, + mbMouseButtonUp:1, + mbKeyInput:1, + mbKeyUp:1, + mbCommand:1, + mbDefPos:1, + mbDefSize:1, + mbCallMove:1, + mbCallResize:1, + mbWaitSystemResize:1, + mbInitWinClipRegion:1, + mbInitChildRegion:1, + mbWinRegion:1, + mbClipChildren:1, + mbClipSiblings:1, + mbChildTransparent:1, + mbPaintTransparent:1, + mbMouseTransparent:1, + mbDlgCtrlStart:1, + mbFocusVisible:1, + mbTrackVisible:1, + mbUseNativeFocus:1, + mbNativeFocusVisible:1, + mbInShowFocus:1, + mbInHideFocus:1, + mbControlForeground:1, + mbControlBackground:1, + mbAlwaysOnTop:1, + mbCompoundControl:1, + mbCompoundControlHasFocus:1, + mbPaintDisabled:1, + mbAllResize:1, + mbInDispose:1, + mbExtTextInput:1, + mbInFocusHdl:1, + mbOverlapVisible:1, + mbCreatedWithToolkit:1, + mbToolBox:1, + mbSplitter:1, + mbSuppressAccessibilityEvents:1, + mbMenuFloatingWindow:1, + mbDrawSelectionBackground:1, + mbIsInTaskPaneList:1, + mbToolbarFloatingWindow:1, + mbCallHandlersDuringInputDisabled:1, + mbHelpTextDynamic:1, + mbFakeFocusSet:1, + mbHexpand:1, + mbVexpand:1, + mbExpand:1, + mbFill:1, + mbSecondary:1, + mbNonHomogeneous:1, + mbDoubleBufferingRequested:1; + + css::uno::Reference< css::uno::XInterface > mxDNDListenerContainer; + + const vcl::ILibreOfficeKitNotifier* mpLOKNotifier; ///< To emit the LOK callbacks eg. for dialog tunneling. + vcl::LOKWindowId mnLOKWindowId; ///< ID of this specific window. + bool mbLOKParentNotifier; +}; + +namespace vcl +{ +/// Sets up the buffer to have settings matching the window, and restores the original state in the dtor. +class VCL_DLLPUBLIC PaintBufferGuard +{ + ImplFrameData* mpFrameData; + VclPtr<vcl::Window> m_pWindow; + bool mbBackground; + Wallpaper maBackground; + AllSettings maSettings; + long mnOutOffX; + long mnOutOffY; + tools::Rectangle m_aPaintRect; +public: + PaintBufferGuard(ImplFrameData* pFrameData, vcl::Window* pWindow); + ~PaintBufferGuard(); + /// If this is called, then the dtor will also copy rRectangle to the window from the buffer, before restoring the state. + void SetPaintRect(const tools::Rectangle& rRectangle); + /// Returns either the frame's buffer or the window, in case of no buffering. + vcl::RenderContext* GetRenderContext(); +}; +} + +// helper methods + +bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent nSVEvent, bool bMouseLeave, + long nX, long nY, sal_uInt64 nMsgTime, + sal_uInt16 nCode, MouseEventModifiers nMode ); +void ImplHandleResize( vcl::Window* pWindow, long nNewWidth, long nNewHeight ); + +VCL_DLLPUBLIC void ImplWindowStateFromStr(WindowStateData& rData, const OString& rStr); + +VCL_DLLPUBLIC css::uno::Reference<css::accessibility::XAccessibleEditableText> +FindFocusedEditableText(css::uno::Reference<css::accessibility::XAccessibleContext> const&); + +#endif // INCLUDED_VCL_INC_WINDOW_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/wizdlg.hxx b/vcl/inc/wizdlg.hxx new file mode 100644 index 000000000..2c82b3ab8 --- /dev/null +++ b/vcl/inc/wizdlg.hxx @@ -0,0 +1,315 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_VCL_WIZDLG_HXX +#define INCLUDED_VCL_WIZDLG_HXX + +#include <memory> +#include <vcl/toolkit/button.hxx> +#include <vcl/toolkit/dialog.hxx> +#include <vcl/roadmapwizard.hxx> +#include <vcl/tabpage.hxx> + +struct ImplWizPageData +{ + ImplWizPageData* mpNext; + VclPtr<TabPage> mpPage; +}; + +namespace vcl +{ + struct RoadmapWizardImpl; + class RoadmapWizard; + + namespace RoadmapWizardTypes + { + typedef VclPtr<TabPage> (* RoadmapPageFactory)( RoadmapWizard& ); + }; + + //= RoadmapWizard + + /** wizard for a roadmap + + The basic new concept introduced is a <em>path</em>:<br/> + A <em>path</em> is a sequence of states, which are to be executed in a linear order. + Elements in the path can be skipped, depending on choices the user makes. + + In the most simple wizards, you will have only one path consisting of <code>n</code> elements, + which are to be visited successively. + + In a slightly more complex wizard, you will have one linear path, were certain + steps might be skipped due to user input. For instance, the user may decide to not specify + certain aspects of the to-be-created object (e.g. by unchecking a check box), + and the wizard then will simply disable the step which corresponds to this step. + + In a yet more advanced wizards, you will have several paths of length <code>n1</code> and + <code>n2</code>, which share at least the first <code>k</code> states (where <code>k</code> + is at least 1), and an arbitrary number of other states. + */ + class RoadmapWizard : public Dialog + { + private: + Idle maWizardLayoutIdle; + Size maPageSize; + ImplWizPageData* mpFirstPage; + ImplWizButtonData* mpFirstBtn; + VclPtr<TabPage> mpCurTabPage; + VclPtr<PushButton> mpPrevBtn; + VclPtr<PushButton> mpNextBtn; + VclPtr<vcl::Window> mpViewWindow; + sal_uInt16 mnCurLevel; + sal_Int16 mnLeftAlignCount; + bool mbEmptyViewMargin; + + DECL_LINK( ImplHandleWizardLayoutTimerHdl, Timer*, void ); + + // IMPORTANT: + // traveling pages should not be done by calling these base class member, some mechanisms of this class + // here (e.g. committing page data) depend on having full control over page traveling. + // So use the travelXXX methods if you need to travel + + protected: + long LogicalCoordinateToPixel(int iCoordinate); + /**sets the number of buttons which should be left-aligned. Normally, buttons are right-aligned. + + only to be used during construction, before any layouting happened + */ + void SetLeftAlignedButtonCount( sal_Int16 _nCount ); + + void CalcAndSetSize(); + + public: + VclPtr<OKButton> m_pFinish; + VclPtr<CancelButton> m_pCancel; + VclPtr<PushButton> m_pNextPage; + VclPtr<PushButton> m_pPrevPage; + VclPtr<HelpButton> m_pHelp; + + private: + std::unique_ptr<WizardMachineImplData> m_xWizardImpl; + // hold members in this structure to allow keeping compatible when members are added + std::unique_ptr<RoadmapWizardImpl> m_xRoadmapImpl; + + public: + RoadmapWizard(vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG, InitFlag eFlag = InitFlag::Default); + virtual ~RoadmapWizard( ) override; + virtual void dispose() override; + + virtual void Resize() override; + virtual void StateChanged( StateChangedType nStateChange ) override; + virtual bool EventNotify( NotifyEvent& rNEvt ) override; + + void ActivatePage(); + + virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override; + + bool ShowPage( sal_uInt16 nLevel ); + bool Finish( long nResult = 0 ); + sal_uInt16 GetCurLevel() const { return mnCurLevel; } + + void AddPage( TabPage* pPage ); + void RemovePage( TabPage* pPage ); + void SetPage( sal_uInt16 nLevel, TabPage* pPage ); + TabPage* GetPage( sal_uInt16 nLevel ) const; + + void AddButton( Button* pButton, long nOffset = 0 ); + void RemoveButton( Button* pButton ); + + void SetPageSizePixel( const Size& rSize ) { maPageSize = rSize; } + const Size& GetPageSizePixel() const { return maPageSize; } + + /// enable (or disable) buttons + void enableButtons(WizardButtonFlags _nWizardButtonFlags, bool _bEnable); + + /// determines whether there is a next state to which we can advance + bool canAdvance() const; + + void SetRoadmapHelpId( const OString& _rId ); + + void InsertRoadmapItem(int nIndex, const OUString& rLabel, int nId, bool bEnabled); + void DeleteRoadmapItems(); + int GetCurrentRoadmapItemID() const; + void SelectRoadmapItemByID(int nId); + void SetItemSelectHdl( const Link<LinkParamNone*,void>& _rHdl ); + void ShowRoadmap(bool bShow); + + FactoryFunction GetUITestFactory() const override; + + protected: + + /// to override to create new pages + VclPtr<TabPage> createPage(WizardTypes::WizardState nState); + + /// will be called when a new page is about to be displayed + void enterState(WizardTypes::WizardState _nState); + + /** will be called when the current state is about to be left for the given reason + + The base implementation in this class will simply call <member>OWizardPage::commitPage</member> + for the current page, and return whatever this call returns. + + @param _eReason + The reason why the state is to be left. + @return + <TRUE/> if and only if the page is allowed to be left + */ + bool prepareLeaveCurrentState( WizardTypes::CommitPageReason eReason ); + + /** determine the next state to travel from the given one + + This method ensures that traveling happens along the active path. + + Return WZS_INVALID_STATE to prevent traveling. + + @see activatePath + */ + WizardTypes::WizardState determineNextState(WizardTypes::WizardState nCurrentState) const; + + /// travel to the next state + bool travelNext(); + + /// travel to the previous state + bool travelPrevious(); + + /** enables the automatic enabled/disabled state of the "Next" button + + If this is <TRUE/>, then upon entering a new state, the "Next" button will automatically be + enabled if and only if determineNextState does not return WZS_INVALID_STATE. + */ + bool isAutomaticNextButtonStateEnabled() const; + + /** removes a page from the history. Should be called when the page is being disabled + */ + void removePageFromHistory(WizardTypes::WizardState nToRemove); + + /** skips one or more states, until a given state is reached + + The method behaves as if from the current state, <method>travelNext</method>s were called + successively, until <arg>_nTargetState</arg> is reached, but without actually creating or + displaying the \EDntermediate pages. + + The skipped states appear in the state history, so <method>travelPrevious</method> will make use of them. + + @return + <TRUE/> if and only if traveling was successful + + @see skip + @see skipBackwardUntil + */ + bool skipUntil(WizardTypes::WizardState nTargetState); + + /** moves back one or more states, until a given state is reached + + This method allows traveling backwards more than one state without actually showing the intermediate + states. + + For instance, if you want to travel two steps backward at a time, you could used + two travelPrevious calls, but this would <em>show</em> both pages, which is not necessary, + since you're interested in the target page only. Using <member>skipBackwardUntil</member> relieves + you of this. + + @return + <TRUE/> if and only if traveling was successful + + @see skipUntil + @see skip + */ + bool skipBackwardUntil(WizardTypes::WizardState nTargetState); + + /** returns the current state of the machine + + Vulgo, this is the identifier of the current tab page :) + */ + WizardTypes::WizardState getCurrentState() const { return GetCurLevel(); } + + static IWizardPageController* getPageController( TabPage* _pCurrentPage ); + + /** returns a human readable name for a given state + + There is a default implementation for this method, which returns the display name + as given in a call to describeState. If there is no description for the given state, + this is worth an assertion in a non-product build, and then an empty string is + returned. + */ + OUString getStateDisplayName(WizardTypes::WizardState nState) const; + + private: + DECL_LINK( OnRoadmapItemSelected, LinkParamNone*, void ); + + /** updates the roadmap control to show the given path, as far as possible + (modulo conflicts with other paths) + */ + void implUpdateRoadmap( ); + + public: + class AccessGuard + { + friend class RoadmapWizardTravelSuspension; + private: + AccessGuard() { } + }; + + void suspendTraveling( AccessGuard ); + void resumeTraveling( AccessGuard ); + bool isTravelingSuspended() const; + + protected: + TabPage* GetOrCreatePage(const WizardTypes::WizardState i_nState); + + private: + void ImplCalcSize( Size& rSize ); + void ImplPosCtrls(); + void ImplPosTabPage(); + void ImplShowTabPage( TabPage* pPage ); + TabPage* ImplGetPage( sal_uInt16 nLevel ) const; + + + DECL_LINK(OnNextPage, Button*, void); + DECL_LINK(OnPrevPage, Button*, void); + DECL_LINK(OnFinish, Button*, void); + + void implUpdateTitle(); + void implConstruct( const WizardButtonFlags _nButtonFlags ); + }; + + /// helper class to temporarily suspend any traveling in the wizard + class RoadmapWizardTravelSuspension + { + public: + RoadmapWizardTravelSuspension(RoadmapWizard& rWizard) + : m_pOWizard(&rWizard) + { + m_pOWizard->suspendTraveling(RoadmapWizard::AccessGuard()); + } + + ~RoadmapWizardTravelSuspension() + { + if (m_pOWizard) + m_pOWizard->resumeTraveling(RoadmapWizard::AccessGuard()); + } + + private: + VclPtr<RoadmapWizard> m_pOWizard; + }; + +} // namespace vcl + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |