diff options
Diffstat (limited to 'vcl/inc')
513 files changed, 46382 insertions, 0 deletions
diff --git a/vcl/inc/BitmapSymmetryCheck.hxx b/vcl/inc/BitmapSymmetryCheck.hxx new file mode 100644 index 0000000000..917b8b6d13 --- /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> + +class BitmapReadAccess; + +class VCL_DLLPUBLIC BitmapSymmetryCheck final +{ +public: + 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/ContextVBox.hxx b/vcl/inc/ContextVBox.hxx new file mode 100644 index 0000000000..0f88e4f232 --- /dev/null +++ b/vcl/inc/ContextVBox.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 . + */ + +#include <sal/config.h> + +#include <vcl/NotebookbarContextControl.hxx> +#include <vcl/layout.hxx> + +/* + * ContextVBox is a VclVBox which shows own children depending on current context. + * This control can be used in the notebookbar .ui files + */ + +class ContextVBox final : public VclVBox, public NotebookbarContextControl +{ +public: + explicit ContextVBox(vcl::Window* pParent); + virtual ~ContextVBox() override; + void SetContext(vcl::EnumContext::Context eContext) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ControlCacheKey.hxx b/vcl/inc/ControlCacheKey.hxx new file mode 100644 index 0000000000..e422004ca5 --- /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 <o3tl/hash_combine.hxx> + +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::LevelBar: + 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; + o3tl::hash_combine(seed, aCache.mnType); + o3tl::hash_combine(seed, aCache.mnPart); + o3tl::hash_combine(seed, aCache.mnState); + o3tl::hash_combine(seed, aCache.maSize.Width()); + o3tl::hash_combine(seed, aCache.maSize.Height()); + return seed; + } +}; + +#endif // INCLUDED_VCL_INC_CONTROLCACHEKEY_HXX diff --git a/vcl/inc/DropdownBox.hxx b/vcl/inc/DropdownBox.hxx new file mode 100644 index 0000000000..a6530babca --- /dev/null +++ b/vcl/inc/DropdownBox.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_SFX2_NOTEBOOKBAR_DROPDOWNBOX_HXX +#define INCLUDED_SFX2_NOTEBOOKBAR_DROPDOWNBOX_HXX + +#include <vcl/layout.hxx> +#include "IPrioritable.hxx" +#include "NotebookbarPopup.hxx" + +class Button; + +class DropdownBox final : public VclHBox, public vcl::IPrioritable +{ +private: + bool m_bInFullView; + VclPtr<PushButton> m_pButton; + VclPtr<NotebookbarPopup> m_pPopup; + +public: + explicit DropdownBox(vcl::Window* pParent); + virtual ~DropdownBox() override; + virtual void dispose() override; + + void HideContent() override; + void ShowContent() override; + bool IsHidden() override; + +private: + DECL_LINK(PBClickHdl, Button*, void); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/FileDefinitionWidgetDraw.hxx b/vcl/inc/FileDefinitionWidgetDraw.hxx new file mode 100644 index 0000000000..881316c2f4 --- /dev/null +++ b/vcl/inc/FileDefinitionWidgetDraw.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/. + * + */ + +#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, tools::Long nX, tools::Long nY, + tools::Long nWidth, tools::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; + + static void drawPolyPolygon(SalGraphics& rGraphics, + const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolyPolygon& i_rPolyPolygon, + double i_fTransparency); + + static void drawPolyLine(SalGraphics& rGraphics, const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolygon& i_rPolygon, double i_fTransparency, + double i_fLineWidth, const std::vector<double>* i_pStroke, + basegfx::B2DLineJoin i_eLineJoin, css::drawing::LineCap i_eLineCap, + double i_fMiterMinimumAngle, bool bPixelSnapHairline); + + static void drawBitmap(SalGraphics& rGraphics, const SalTwoRect& rPosAry, + const SalBitmap& rSalBitmap); + + static void drawBitmap(SalGraphics& rGraphics, const SalTwoRect& rPosAry, + const SalBitmap& rSalBitmap, const SalBitmap& rTransparentBitmap); + + static void implDrawGradient(SalGraphics& rGraphics, + const basegfx::B2DPolyPolygon& rPolyPolygon, + const SalGradient& rGradient); +}; + +} // end vcl namespace + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/IPrioritable.hxx b/vcl/inc/IPrioritable.hxx new file mode 100644 index 0000000000..559fbc982f --- /dev/null +++ b/vcl/inc/IPrioritable.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_IPRIORITABLE_HXX +#define INCLUDED_VCL_IPRIORITABLE_HXX + +#include <vcl/dllapi.h> + +#define VCL_PRIORITY_DEFAULT -1 + +namespace vcl +{ + +class VCL_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") IPrioritable +{ +protected: + IPrioritable() : m_nPriority(VCL_PRIORITY_DEFAULT) + { + } + +public: + virtual ~IPrioritable() + { + } + + int GetPriority() const + { + return m_nPriority; + } + + void SetPriority(int nPriority) + { + m_nPriority = nPriority; + } + + virtual void HideContent() = 0; + virtual void ShowContent() = 0; + virtual bool IsHidden() = 0; + +private: + int m_nPriority; +}; + +} // namespace vcl + +#endif // INCLUDED_VCL_IPRIORITABLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/IconThemeScanner.hxx b/vcl/inc/IconThemeScanner.hxx new file mode 100644 index 0000000000..80f2405479 --- /dev/null +++ b/vcl/inc/IconThemeScanner.hxx @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#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(std::u16string_view 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(std::u16string_view 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 0000000000..65bfdf0063 --- /dev/null +++ b/vcl/inc/IconThemeSelector.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/. + */ + +#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); + + /** Returns true if the PreferredIconTheme was changed */ + bool + 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 themes which are used as fallbacks */ + static constexpr OUString FALLBACK_LIGHT_ICON_THEME_ID = u"colibre"_ustr; + static constexpr OUString FALLBACK_DARK_ICON_THEME_ID = u"colibre_dark"_ustr; + + static OUString + GetIconThemeForDesktopEnvironment(const OUString& desktopEnvironment, bool bPreferDarkIconTheme); + + 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/ImplLayoutArgs.hxx b/vcl/inc/ImplLayoutArgs.hxx new file mode 100644 index 0000000000..faf170ca72 --- /dev/null +++ b/vcl/inc/ImplLayoutArgs.hxx @@ -0,0 +1,77 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <i18nlangtag/languagetag.hxx> +#include <vcl/outdev.hxx> + +#include "impglyphitem.hxx" +#include "ImplLayoutRuns.hxx" + +namespace vcl::text +{ +class VCL_DLLPUBLIC ImplLayoutArgs +{ +public: + // string related inputs + LanguageTag maLanguageTag; + SalLayoutFlags mnFlags; + const OUString& mrStr; + int mnMinCharPos; + int mnEndCharPos; + + // performance hack + vcl::text::TextLayoutCache const* m_pTextLayoutCache; + + // positioning related inputs + const double* mpDXArray; // in floating point pixel units + const sal_Bool* mpKashidaArray; + double mnLayoutWidth; // in pixel units + Degree10 mnOrientation; // in 0-3600 system + + // data for bidi and glyph+script fallback + ImplLayoutRuns maRuns; + ImplLayoutRuns maFallbackRuns; + + ImplLayoutArgs(OUString const& rStr, int nMinCharPos, int nEndCharPos, SalLayoutFlags nFlags, + LanguageTag aLanguageTag, vcl::text::TextLayoutCache const* pLayoutCache); + + void SetLayoutWidth(double nWidth); + void SetDXArray(const double* pDXArray); + void SetKashidaArray(const sal_Bool* pKashidaArray); + void SetOrientation(Degree10 nOrientation); + + void ResetPos(); + bool GetNextPos(int* nCharPos, bool* bRTL); + bool GetNextRun(int* nMinRunPos, int* nEndRunPos, bool* bRTL); + void AddFallbackRun(int nMinRunPos, int nEndRunPos, bool bRTL); + bool HasDXArray() const { return mpDXArray; } + + // methods used by BiDi and glyph fallback + bool HasFallbackRun() const; + bool PrepareFallback(const SalLayoutGlyphsImpl* pGlyphsImpl); + +private: + void AddRun(int nMinCharPos, int nEndCharPos, bool bRTL); +}; +} + +// For nice SAL_INFO logging of ImplLayoutArgs values +std::ostream& operator<<(std::ostream& s, vcl::text::ImplLayoutArgs const& rArgs); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/ImplLayoutRuns.hxx b/vcl/inc/ImplLayoutRuns.hxx new file mode 100644 index 0000000000..dec9ca59dc --- /dev/null +++ b/vcl/inc/ImplLayoutRuns.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <boost/container/small_vector.hpp> + +// used for managing runs e.g. for BiDi, glyph and script fallback +class VCL_DLLPUBLIC ImplLayoutRuns +{ +private: + int mnRunIndex; + boost::container::small_vector<int, 8> maRuns; + +public: + ImplLayoutRuns() { mnRunIndex = 0; } + + 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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ImplOutDevData.hxx b/vcl/inc/ImplOutDevData.hxx new file mode 100644 index 0000000000..f56caba1c3 --- /dev/null +++ b/vcl/inc/ImplOutDevData.hxx @@ -0,0 +1,51 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <tools/gen.hxx> + +#include <vcl/virdev.hxx> +#include <vcl/vclptr.hxx> + +class VirtualDevice; + +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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/NotebookbarPopup.hxx b/vcl/inc/NotebookbarPopup.hxx new file mode 100644 index 0000000000..8c3bcfee1c --- /dev/null +++ b/vcl/inc/NotebookbarPopup.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <vcl/layout.hxx> +#include <vcl/toolkit/floatwin.hxx> + +/* + * Popup - shows hidden content, controls are moved to this popup + * and after close moved to the original parent + */ + +class NotebookbarPopup final : public FloatingWindow +{ +private: + VclPtr<VclHBox> m_pBox; + ScopedVclPtr<VclHBox> m_pParent; + +public: + explicit NotebookbarPopup(const VclPtr<VclHBox>& pParent); + + virtual ~NotebookbarPopup() override; + + VclHBox* getBox(); + + virtual void PopupModeEnd() override; + + void hideSeparators(bool bHide); + + void dispose() override; + + void ApplyBackground(vcl::Window* pWindow); + + void RemoveBackground(vcl::Window* pWindow); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/OptionalBox.hxx b/vcl/inc/OptionalBox.hxx new file mode 100644 index 0000000000..05ab1cbf0c --- /dev/null +++ b/vcl/inc/OptionalBox.hxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <vcl/layout.hxx> +#include "IPrioritable.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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/PriorityHBox.hxx b/vcl/inc/PriorityHBox.hxx new file mode 100644 index 0000000000..8c5529ec88 --- /dev/null +++ b/vcl/inc/PriorityHBox.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <vcl/layout.hxx> +#include "IPrioritable.hxx" + +#include <vector> + +/* + * PriorityHBox is a VclHBox which hides its own children if there is no sufficient space. + * Hiding order can be modified using child's priorities. If a control have default + * priority assigned (VCL_PRIORITY_DEFAULT), it is always shown. + */ + +class PriorityHBox : public VclHBox +{ +protected: + bool m_bInitialized; + + std::vector<vcl::IPrioritable*> m_aSortedChildren; + + virtual int GetHiddenCount() const; + + virtual void GetChildrenWithPriorities(); + +public: + explicit PriorityHBox(vcl::Window* pParent); + + virtual ~PriorityHBox() override; + + void Initialize(); + + void SetSizeFromParent(); + + virtual Size calculateRequisition() const override; + + virtual void Resize() override; + + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/PriorityMergedHBox.hxx b/vcl/inc/PriorityMergedHBox.hxx new file mode 100644 index 0000000000..ed2f105f20 --- /dev/null +++ b/vcl/inc/PriorityMergedHBox.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/. +* +* This file incorporates work covered by the following license notice: +* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed +* with this work for additional information regarding copyright +* ownership. The ASF licenses this file to you under the Apache +* License, Version 2.0 (the "License"); you may not use this 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 <vcl/toolkit/button.hxx> +#include "NotebookbarPopup.hxx" +#include "PriorityHBox.hxx" + +class PriorityMergedHBox final : public PriorityHBox +{ +private: + VclPtr<PushButton> m_pButton; + VclPtr<NotebookbarPopup> m_pPopup; + + DECL_LINK(PBClickHdl, Button*, void); + +public: + explicit PriorityMergedHBox(vcl::Window* pParent); + + virtual ~PriorityMergedHBox() override { disposeOnce(); } + + virtual void Resize() override; + + virtual void dispose() override; + + int GetHiddenCount() const override; + + Size calculateRequisition() const override; + + void GetChildrenWithPriorities() override{}; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ResampleKernel.hxx b/vcl/inc/ResampleKernel.hxx new file mode 100644 index 0000000000..ca54213f54 --- /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 0000000000..c183d75506 --- /dev/null +++ b/vcl/inc/SalGradient.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/. + */ + +#ifndef INCLUDED_VCL_INC_SALGRADIENT_HXX +#define INCLUDED_VCL_INC_SALGRADIENT_HXX + +#include <basegfx/point/b2dpoint.hxx> +#include <tools/color.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/TextLayoutCache.hxx b/vcl/inc/TextLayoutCache.hxx new file mode 100644 index 0000000000..304c6d51eb --- /dev/null +++ b/vcl/inc/TextLayoutCache.hxx @@ -0,0 +1,87 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <sal/types.h> +#include <rtl/ustring.hxx> +#include <o3tl/hash_combine.hxx> + +#include <vcl/dllapi.h> + +#include <unicode/uscript.h> + +#include <vector> + +namespace vcl::text +{ +struct Run +{ + int32_t nStart; + int32_t nEnd; + UScriptCode nCode; + Run(int32_t nStart_, int32_t nEnd_, UScriptCode nCode_) + : nStart(nStart_) + , nEnd(nEnd_) + , nCode(nCode_) + { + } +}; + +class VCL_DLLPUBLIC TextLayoutCache +{ +public: + std::vector<vcl::text::Run> runs; + TextLayoutCache(sal_Unicode const* pStr, sal_Int32 const nEnd); + // Creates a cached instance. + static std::shared_ptr<const vcl::text::TextLayoutCache> Create(OUString const&); +}; + +struct FirstCharsStringHash +{ + size_t operator()(const OUString& str) const + { + // Strings passed to GenericSalLayout::CreateTextLayoutCache() may be very long, + // and computing an entire hash could almost negate the gain of hashing. Hash just first + // characters, that should be good enough. + size_t hash + = rtl_ustr_hashCode_WithLength(str.getStr(), std::min<size_t>(100, str.getLength())); + o3tl::hash_combine(hash, str.getLength()); + return hash; + } +}; + +struct FastStringCompareEqual +{ + bool operator()(const OUString& str1, const OUString& str2) const + { + // Strings passed to GenericSalLayout::CreateTextLayoutCache() may be very long, + // and OUString operator == compares backwards and using hard-written code, while + // memcmp() compares much faster. + if (str1.getLength() != str2.getLength()) + return false; + if (str1.getStr() == str2.getStr()) + return true; + return memcmp(str1.getStr(), str2.getStr(), str1.getLength() * sizeof(str1.getStr()[0])) + == 0; + } +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/WidgetDrawInterface.hxx b/vcl/inc/WidgetDrawInterface.hxx new file mode 100644 index 0000000000..78d5d76254 --- /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/WidgetThemeLibraryTypes.hxx b/vcl/inc/WidgetThemeLibraryTypes.hxx new file mode 100644 index 0000000000..b3270bf23e --- /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.hxx b/vcl/inc/accel.hxx new file mode 100644 index 0000000000..c7140db221 --- /dev/null +++ b/vcl/inc/accel.hxx @@ -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 . + */ + +#pragma once + +#include <tools/solar.h> +#include <tools/link.hxx> +#include <vcl/keycod.hxx> +#include <memory> +#include <map> +#include <vector> + +class CommandEvent; + +class Accelerator; + +class ImplAccelEntry +{ +public: + Accelerator* mpAccel; + Accelerator* mpAutoAccel; + vcl::KeyCode maKeyCode; + sal_uInt16 mnId; + bool mbEnabled; +}; + +typedef ::std::vector< std::unique_ptr<ImplAccelEntry> > ImplAccelList; + +class Accelerator +{ + friend class ImplAccelManager; + +private: + typedef ::std::map< sal_uLong, ImplAccelEntry* > ImplAccelMap; + ImplAccelMap maKeyMap; // for keycodes, generated with a code + ImplAccelList maIdList; // Id-List + Link<Accelerator&,void> maActivateHdl; + Link<Accelerator&,void> maSelectHdl; + + // Will be set by AcceleratorManager + sal_uInt16 mnCurId; + bool* mpDel; + + void ImplInit(); + void ImplCopyData( const Accelerator& rAccelData ); + void ImplDeleteData(); + void ImplInsertAccel(sal_uInt16 nItemId, const vcl::KeyCode& rKeyCode, + bool bEnable, Accelerator* pAutoAccel); + + ImplAccelEntry* ImplGetAccelData( const vcl::KeyCode& rKeyCode ) const; + +public: + Accelerator(); + Accelerator( const Accelerator& rAccel ); + ~Accelerator(); + + void Activate(); + void Select(); + + void InsertItem( sal_uInt16 nItemId, const vcl::KeyCode& rKeyCode ); + + sal_uInt16 GetCurItemId() const { return mnCurId; } + + sal_uInt16 GetItemCount() const; + sal_uInt16 GetItemId( sal_uInt16 nPos ) const; + + Accelerator* GetAccel( sal_uInt16 nItemId ) const; + + void SetActivateHdl( const Link<Accelerator&,void>& rLink ) { maActivateHdl = rLink; } + void SetSelectHdl( const Link<Accelerator&,void>& rLink ) { maSelectHdl = rLink; } + + Accelerator& operator=( const Accelerator& rAccel ); +}; + +bool ImplGetKeyCode( KeyFuncType eFunc, sal_uInt16& rCode1, sal_uInt16& rCode2, sal_uInt16& rCode3, sal_uInt16& rCode4 ); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accmgr.hxx b/vcl/inc/accmgr.hxx new file mode 100644 index 0000000000..55e028f69a --- /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 <optional> + +#include <vcl/keycod.hxx> + +class Accelerator; + +class ImplAccelManager +{ +private: + std::optional<std::vector< Accelerator* >> mxAccelList; + std::optional<std::vector< Accelerator* >> mxSequenceList; + +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 0000000000..58ebdbb253 --- /dev/null +++ b/vcl/inc/android/androidinst.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/. + */ + +#pragma once + +#include <jni.h> +#include <android/input.h> +#include <android/log.h> +#include <android/native_window.h> +#include <headless/svpinst.hxx> +#include <headless/svpframe.hxx> + +#define LOGTAG "LibreOffice/androidinst" +#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, LOGTAG, __VA_ARGS__)) +#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, LOGTAG, __VA_ARGS__)) + +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(AbsoluteScreenPixelRectangle& 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(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/animate/AnimationRenderer.hxx b/vcl/inc/animate/AnimationRenderer.hxx new file mode 100644 index 0000000000..bc86e65e3f --- /dev/null +++ b/vcl/inc/animate/AnimationRenderer.hxx @@ -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 . + */ + +#pragma once + +#include <vcl/dllapi.h> +#include <vcl/animate/Animation.hxx> +#include <vcl/vclptr.hxx> + +class Animation; +class OutputDevice; +class VirtualDevice; +struct AnimationFrame; + +struct AnimationData +{ + Point maOriginStartPt; + Size maStartSize; + VclPtr<OutputDevice> mpRenderContext; + AnimationRenderer* mpRendererData; + tools::Long mnRendererId; + bool mbIsPaused; + + AnimationData(); +}; + + +class VCL_DLLPUBLIC AnimationRenderer +{ +private: + Animation* mpParent; + VclPtr<OutputDevice> mpRenderContext; + tools::Long mnRendererId; + Point maOriginPt; + Point maDispPt; + Point maRestPt; + Size maLogicalSize; + Size maSizePx; + Size maDispSz; + Size maRestSz; + vcl::Region maClip; + VclPtr<VirtualDevice> mpBackground; + VclPtr<VirtualDevice> mpRestore; + sal_uLong mnActIndex; + Disposal meLastDisposal; + bool mbIsPaused; + bool mbIsMarked; + bool mbIsMirroredHorizontally; + bool mbIsMirroredVertically; + +public: + AnimationRenderer( Animation* pParent, OutputDevice* pOut, + const Point& rPt, const Size& rSz, sal_uLong nRendererId, + OutputDevice* pFirstFrameOutDev = nullptr ); + AnimationRenderer(AnimationRenderer&&) = delete; + ~AnimationRenderer(); + + bool matches(const OutputDevice* pOut, tools::Long nRendererId) const; + void drawToIndex( sal_uLong nIndex ); + void draw( sal_uLong nIndex, VirtualDevice* pVDev=nullptr ); + void repaint(); + AnimationData* createAnimationData() const; + + void getPosSize( const AnimationFrame& rAnm, Point& rPosPix, Size& rSizePix ); + + const Point& getOriginPosition() const { return maOriginPt; } + + const Size& getOutSizePix() const { return maSizePx; } + + void pause( bool bIsPaused ) { mbIsPaused = bIsPaused; } + bool isPaused() const { return mbIsPaused; } + + void setMarked( bool bIsMarked ) { mbIsMarked = bIsMarked; } + bool isMarked() const { return mbIsMarked; } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/bitmap/BitmapColorizeFilter.hxx b/vcl/inc/bitmap/BitmapColorizeFilter.hxx new file mode 100644 index 0000000000..ae511b322d --- /dev/null +++ b/vcl/inc/bitmap/BitmapColorizeFilter.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 <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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/bitmap/BitmapDisabledImageFilter.hxx b/vcl/inc/bitmap/BitmapDisabledImageFilter.hxx new file mode 100644 index 0000000000..e1d9d21a9d --- /dev/null +++ b/vcl/inc/bitmap/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_BITMAP_BITMAPDISABLEDIMAGEFILTER_HXX +#define INCLUDED_VCL_INC_BITMAP_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/bitmap/BitmapFastScaleFilter.hxx b/vcl/inc/bitmap/BitmapFastScaleFilter.hxx new file mode 100644 index 0000000000..bea516c9e0 --- /dev/null +++ b/vcl/inc/bitmap/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_BITMAP_BITMAPFASTSCALEFILTER_HXX +#define VCL_INC_BITMAP_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/bitmap/BitmapInterpolateScaleFilter.hxx b/vcl/inc/bitmap/BitmapInterpolateScaleFilter.hxx new file mode 100644 index 0000000000..7d17c97d16 --- /dev/null +++ b/vcl/inc/bitmap/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_BITMAP_BITMAPINTERPOLATESCALEFILTER_HXX +#define VCL_INC_BITMAP_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/bitmap/BitmapLightenFilter.hxx b/vcl/inc/bitmap/BitmapLightenFilter.hxx new file mode 100644 index 0000000000..98f2493285 --- /dev/null +++ b/vcl/inc/bitmap/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_BITMAP_BITMAPLIGHTENFILTER_HXX +#define INCLUDED_VCL_INC_BITMAP_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/bitmap/BitmapMaskToAlphaFilter.hxx b/vcl/inc/bitmap/BitmapMaskToAlphaFilter.hxx new file mode 100644 index 0000000000..355d066846 --- /dev/null +++ b/vcl/inc/bitmap/BitmapMaskToAlphaFilter.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/. + * + */ + +#pragma once + +#include <vcl/BitmapFilter.hxx> + +class BitmapMaskToAlphaFilter final : public BitmapFilter +{ +public: + virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/bitmap/BitmapScaleConvolutionFilter.hxx b/vcl/inc/bitmap/BitmapScaleConvolutionFilter.hxx new file mode 100644 index 0000000000..1c9bb8e330 --- /dev/null +++ b/vcl/inc/bitmap/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_BITMAP_BITMAPSCALECONVOLUTIONFILTER_HXX +#define VCL_INC_BITMAP_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/bitmap/BitmapScaleSuperFilter.hxx b/vcl/inc/bitmap/BitmapScaleSuperFilter.hxx new file mode 100644 index 0000000000..46c21d8d78 --- /dev/null +++ b/vcl/inc/bitmap/BitmapScaleSuperFilter.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_BITMAP_BITMAPSCALESUPER_HXX +#define INCLUDED_VCL_INC_BITMAP_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/bitmap/Octree.hxx b/vcl/inc/bitmap/Octree.hxx new file mode 100644 index 0000000000..3c9b5eb270 --- /dev/null +++ b/vcl/inc/bitmap/Octree.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_OCTREE_HXX +#define INCLUDED_VCL_INC_OCTREE_HXX + +#include <vcl/dllapi.h> +#include <vcl/BitmapColor.hxx> +#include <vcl/BitmapPalette.hxx> +#include <tools/solar.h> + +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, BitmapColor const& color); + + SAL_DLLPRIVATE void add(std::unique_ptr<OctreeNode>& rpNode, BitmapColor const& color); + SAL_DLLPRIVATE void reduce(); + + BitmapPalette maPalette; + sal_uLong mnLeafCount; + sal_uLong mnLevel; + std::unique_ptr<OctreeNode> pTree; + std::vector<OctreeNode*> mpReduce; + 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 0000000000..99ce5dc33a --- /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(ColorAlpha, pData[4], pData[1], pData[2], pData[3]); + pData += 4; + return aColor; + } + + virtual void writePixel(Color nColor) override + { + *pData++ = nColor.GetAlpha(); + *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/bmpfast.hxx b/vcl/inc/bitmap/bmpfast.hxx new file mode 100644 index 0000000000..3234f7a840 --- /dev/null +++ b/vcl/inc/bitmap/bmpfast.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_BMPFAST_HXX +#define INCLUDED_VCL_INC_BMPFAST_HXX + +#include <vcl/dllapi.h> +#include <vcl/Scanline.hxx> +#include <tools/long.hxx> + +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 ImplFastCopyScanline( tools::Long nY, BitmapBuffer& rDst, const BitmapBuffer& rSrc); +bool ImplFastCopyScanline( tools::Long nY, BitmapBuffer& rDst, ConstScanline aSrcScanline, + ScanlineFormat nSrcScanlineFormat, sal_uInt32 nSrcScanlineSize); + +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/bitmap/impoctree.hxx b/vcl/inc/bitmap/impoctree.hxx new file mode 100644 index 0000000000..7581b91088 --- /dev/null +++ b/vcl/inc/bitmap/impoctree.hxx @@ -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_IMPOCTREE_HXX +#define INCLUDED_VCL_INC_IMPOCTREE_HXX + +#include <vcl/BitmapColor.hxx> + +class ImpErrorQuad +{ + sal_Int16 nRed; + sal_Int16 nGreen; + sal_Int16 nBlue; + +public: + ImpErrorQuad() + : nRed(0) + , nGreen(0) + , nBlue(0) + { + } + + ImpErrorQuad(const BitmapColor& rColor) + : nRed(rColor.GetRed() << 5) + , nGreen(rColor.GetGreen() << 5) + , nBlue(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() const; +}; + +inline void ImpErrorQuad::operator=(const BitmapColor& rColor) +{ + nRed = rColor.GetRed() << 5; + nGreen = rColor.GetGreen() << 5; + nBlue = rColor.GetBlue() << 5; +} + +inline ImpErrorQuad& ImpErrorQuad::operator-=(const BitmapColor& rColor) +{ + nRed -= rColor.GetRed() << 5; + nGreen -= rColor.GetGreen() << 5; + nBlue -= 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() const +{ + return BitmapColor(std::clamp(nRed, sal_Int16(0), sal_Int16(8160)) >> 5, + std::clamp(nGreen, sal_Int16(0), sal_Int16(8160)) >> 5, + std::clamp(nBlue, sal_Int16(0), sal_Int16(8160)) >> 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 0000000000..f4ccaaa46a --- /dev/null +++ b/vcl/inc/bitmaps.hlst @@ -0,0 +1,229 @@ +/* -*- 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 <rtl/ustring.hxx> + +inline constexpr OUString SV_RESID_BITMAP_CHECK1 = u"vcl/res/check1.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_CHECK2 = u"vcl/res/check2.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_CHECK3 = u"vcl/res/check3.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_CHECK4 = u"vcl/res/check4.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_CHECK5 = u"vcl/res/check5.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_CHECK6 = u"vcl/res/check6.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_CHECK7 = u"vcl/res/check7.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_CHECK8 = u"vcl/res/check8.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_CHECK9 = u"vcl/res/check9.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_CHECKMONO1 = u"vcl/res/checkmono1.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_CHECKMONO2 = u"vcl/res/checkmono2.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_CHECKMONO3 = u"vcl/res/checkmono3.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_CHECKMONO4 = u"vcl/res/checkmono4.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_CHECKMONO5 = u"vcl/res/checkmono5.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_CHECKMONO6 = u"vcl/res/checkmono6.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_CHECKMONO7 = u"vcl/res/checkmono7.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_CHECKMONO8 = u"vcl/res/checkmono8.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_CHECKMONO9 = u"vcl/res/checkmono9.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_RADIO1 = u"vcl/res/radio1.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_RADIO2 = u"vcl/res/radio2.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_RADIO3 = u"vcl/res/radio3.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_RADIO4 = u"vcl/res/radio4.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_RADIO5 = u"vcl/res/radio5.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_RADIO6 = u"vcl/res/radio6.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_RADIOMONO1 = u"vcl/res/radiomono1.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_RADIOMONO2 = u"vcl/res/radiomono2.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_RADIOMONO3 = u"vcl/res/radiomono3.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_RADIOMONO4 = u"vcl/res/radiomono4.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_RADIOMONO5 = u"vcl/res/radiomono5.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_RADIOMONO6 = u"vcl/res/radiomono6.png"_ustr; + +inline constexpr OUString SV_RESID_BITMAP_ERRORBOX = u"vcl/res/errorbox.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_QUERYBOX = u"vcl/res/querybox.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_WARNINGBOX = u"vcl/res/warningbox.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_INFOBOX = u"vcl/res/infobox.png"_ustr; + +inline constexpr OUString SV_RESID_BITMAP_SCROLLMSK = u"vcl/res/scrmsk.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_WHEELVH = u"vcl/res/wheelvh.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_WHEELV = u"vcl/res/wheelv.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_WHEELH = u"vcl/res/wheelh.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_SCROLLVH = u"vcl/res/scrollvh.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_SCROLLV = u"vcl/res/scrollv.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_SCROLLH = u"vcl/res/scrollh.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_CLOSEDOC = u"vcl/res/closedoc.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_REFRESH = u"res/reload.png"_ustr; +inline constexpr OUString SV_RESID_BITMAP_NOTEBOOKBAR = u"res/notebookbar.png"_ustr; + +inline constexpr OUString SV_DISCLOSURE_PLUS = u"res/plus.png"_ustr; +inline constexpr OUString SV_DISCLOSURE_MINUS = u"res/minus.png"_ustr; + +inline constexpr OUString SV_PRINT_COLLATE_BMP = u"vcl/res/collate.png"_ustr; +inline constexpr OUString SV_PRINT_NOCOLLATE_BMP = u"vcl/res/ncollate.png"_ustr; + +inline constexpr OUString MAINAPP_48_8 = u"res/mainapp_48_8.png"_ustr; +inline constexpr OUString ODT_48_8 = u"res/odt_48_8.png"_ustr; +inline constexpr OUString OTT_48_8 = u"res/ott_48_8.png"_ustr; +inline constexpr OUString ODS_48_8 = u"res/ods_48_8.png"_ustr; +inline constexpr OUString OTS_48_8 = u"res/ots_48_8.png"_ustr; +inline constexpr OUString ODG_48_8 = u"res/odg_48_8.png"_ustr; +inline constexpr OUString ODP_48_8 = u"res/odp_48_8.png"_ustr; +inline constexpr OUString ODM_48_8 = u"res/odm_48_8.png"_ustr; +inline constexpr OUString ODB_48_8 = u"res/odb_48_8.png"_ustr; +inline constexpr OUString ODF_48_8 = u"res/odf_48_8.png"_ustr; + +inline constexpr OUString MAINAPP_32_8 = u"res/mainapp_32_8.png"_ustr; +inline constexpr OUString ODT_32_8 = u"res/odt_32_8.png"_ustr; +inline constexpr OUString OTT_32_8 = u"res/ott_32_8.png"_ustr; +inline constexpr OUString ODS_32_8 = u"res/ods_32_8.png"_ustr; +inline constexpr OUString OTS_32_8 = u"res/ots_32_8.png"_ustr; +inline constexpr OUString ODG_32_8 = u"res/odg_32_8.png"_ustr; +inline constexpr OUString ODP_32_8 = u"res/odp_32_8.png"_ustr; +inline constexpr OUString ODM_32_8 = u"res/odm_32_8.png"_ustr; +inline constexpr OUString ODB_32_8 = u"res/odb_32_8.png"_ustr; +inline constexpr OUString ODF_32_8 = u"res/odf_32_8.png"_ustr; + +inline constexpr OUString MAINAPP_16_8 = u"res/mainapp_16_8.png"_ustr; +inline constexpr OUString ODT_16_8 = u"res/odt_16_8.png"_ustr; +inline constexpr OUString OTT_16_8 = u"res/ott_16_8.png"_ustr; +inline constexpr OUString ODS_16_8 = u"res/ods_16_8.png"_ustr; +inline constexpr OUString OTS_16_8 = u"res/ots_16_8.png"_ustr; +inline constexpr OUString ODG_16_8 = u"res/odg_16_8.png"_ustr; +inline constexpr OUString ODP_16_8 = u"res/odp_16_8.png"_ustr; +inline constexpr OUString ODM_16_8 = u"res/odm_16_8.png"_ustr; +inline constexpr OUString ODB_16_8 = u"res/odb_16_8.png"_ustr; +inline constexpr OUString ODF_16_8 = u"res/odf_16_8.png"_ustr; + +//start, Throbber::getDefaultImageURLs constructs these dynamically (not unused) +#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 + +inline constexpr OUString IMG_WARN = u"dbaccess/res/exwarning.png"_ustr; +inline constexpr OUString IMG_ERROR = u"dbaccess/res/exerror.png"_ustr; +inline constexpr OUString IMG_INFO = u"dbaccess/res/exinfo.png"_ustr; +inline constexpr OUString IMG_ADD = u"extensions/res/scanner/plus.png"_ustr; +inline constexpr OUString IMG_REMOVE = u"extensions/res/scanner/minus.png"_ustr; +inline constexpr OUString IMG_COPY = u"cmd/sc_copy.png"_ustr; +inline constexpr OUString IMG_PASTE = u"cmd/sc_paste.png"_ustr; +inline constexpr OUString IMG_MENU = u"sfx2/res/menu.png"_ustr; +inline constexpr OUString IMG_CALENDAR = u"sc/res/date.png"_ustr; +inline constexpr OUString IMG_OPEN = u"cmd/sc_open.png"_ustr; + +inline constexpr OUString RID_BMP_TREENODE_COLLAPSED = u"res/plus.png"_ustr; +inline constexpr OUString RID_BMP_TREENODE_EXPANDED = u"res/minus.png"_ustr; + +inline constexpr OUString RID_CURSOR_AUTOSCROLL_E = u"vcl/res/autoscroll_e.png"_ustr; +inline constexpr OUString RID_CURSOR_AUTOSCROLL_N = u"vcl/res/autoscroll_n.png"_ustr; +inline constexpr OUString RID_CURSOR_AUTOSCROLL_NE = u"vcl/res/autoscroll_ne.png"_ustr; +inline constexpr OUString RID_CURSOR_AUTOSCROLL_NS = u"vcl/res/autoscroll_ns.png"_ustr; +inline constexpr OUString RID_CURSOR_AUTOSCROLL_NSWE = u"vcl/res/autoscroll_nswe.png"_ustr; +inline constexpr OUString RID_CURSOR_AUTOSCROLL_NW = u"vcl/res/autoscroll_nw.png"_ustr; +inline constexpr OUString RID_CURSOR_AUTOSCROLL_S = u"vcl/res/autoscroll_s.png"_ustr; +inline constexpr OUString RID_CURSOR_AUTOSCROLL_SE = u"vcl/res/autoscroll_se.png"_ustr; +inline constexpr OUString RID_CURSOR_AUTOSCROLL_SW = u"vcl/res/autoscroll_sw.png"_ustr; +inline constexpr OUString RID_CURSOR_AUTOSCROLL_W = u"vcl/res/autoscroll_w.png"_ustr; +inline constexpr OUString RID_CURSOR_AUTOSCROLL_WE = u"vcl/res/autoscroll_we.png"_ustr; +inline constexpr OUString RID_CURSOR_CHAIN = u"vcl/res/chain.png"_ustr; +inline constexpr OUString RID_CURSOR_CHAIN_NOT_ALLOWED = u"vcl/res/chain_not_allowed.png"_ustr; +inline constexpr OUString RID_CURSOR_CHART = u"vcl/res/chart.png"_ustr; +inline constexpr OUString RID_CURSOR_COPY_DATA = u"vcl/res/copy_data.png"_ustr; +inline constexpr OUString RID_CURSOR_COPY_DATA_LINK = u"vcl/res/copy_data_link.png"_ustr; +inline constexpr OUString RID_CURSOR_COPY_FILE = u"vcl/res/copy_file.png"_ustr; +inline constexpr OUString RID_CURSOR_COPY_FILES = u"vcl/res/copy_files.png"_ustr; +inline constexpr OUString RID_CURSOR_COPY_FILE_LINK = u"vcl/res/copy_file_link.png"_ustr; +inline constexpr OUString RID_CURSOR_CROOK = u"vcl/res/crook.png"_ustr; +inline constexpr OUString RID_CURSOR_CROP = u"vcl/res/crop.png"_ustr; +inline constexpr OUString RID_CURSOR_DRAW_ARC = u"vcl/res/draw_arc.png"_ustr; +inline constexpr OUString RID_CURSOR_DRAW_BEZIER = u"vcl/res/draw_bezier.png"_ustr; +inline constexpr OUString RID_CURSOR_DRAW_CAPTION = u"vcl/res/draw_caption.png"_ustr; +inline constexpr OUString RID_CURSOR_DRAW_CIRCLE_CUT = u"vcl/res/draw_circle_cut.png"_ustr; +inline constexpr OUString RID_CURSOR_DRAW_CONNECT = u"vcl/res/draw_connect.png"_ustr; +inline constexpr OUString RID_CURSOR_DRAW_ELLIPSE = u"vcl/res/draw_ellipse.png"_ustr; +inline constexpr OUString RID_CURSOR_DETECTIVE = u"vcl/res/detective.png"_ustr; +inline constexpr OUString RID_CURSOR_DRAW_FREEHAND = u"vcl/res/draw_freehand.png"_ustr; +inline constexpr OUString RID_CURSOR_DRAW_LINE = u"vcl/res/draw_line.png"_ustr; +inline constexpr OUString RID_CURSOR_DRAW_PIE = u"vcl/res/draw_pie.png"_ustr; +inline constexpr OUString RID_CURSOR_DRAW_POLYGON = u"vcl/res/draw_polygon.png"_ustr; +inline constexpr OUString RID_CURSOR_DRAW_RECT = u"vcl/res/draw_rect.png"_ustr; +inline constexpr OUString RID_CURSOR_DRAW_TEXT = u"vcl/res/draw_text.png"_ustr; +inline constexpr OUString RID_CURSOR_FILL = u"vcl/res/fill.png"_ustr; +#define RID_CURSOR_HELP "vcl/res/help.png" +inline constexpr OUString RID_CURSOR_H_SHEAR = u"vcl/res/h_shear.png"_ustr; +inline constexpr OUString RID_CURSOR_LINK_DATA = u"vcl/res/link_data.png"_ustr; +inline constexpr OUString RID_CURSOR_LINK_FILE = u"vcl/res/link_file.png"_ustr; +inline constexpr OUString RID_CURSOR_MAGNIFY = u"vcl/res/magnify.png"_ustr; +inline constexpr OUString RID_CURSOR_MIRROR = u"vcl/res/mirror.png"_ustr; +inline constexpr OUString RID_CURSOR_MOVE_BEZIER_WEIGHT = u"vcl/res/move_bezier_weight.png"_ustr; +inline constexpr OUString RID_CURSOR_MOVE_DATA = u"vcl/res/move_data.png"_ustr; +inline constexpr OUString RID_CURSOR_MOVE_DATA_LINK = u"vcl/res/move_data_link.png"_ustr; +inline constexpr OUString RID_CURSOR_MOVE_FILE = u"vcl/res/move_file.png"_ustr; +inline constexpr OUString RID_CURSOR_MOVE_FILES = u"vcl/res/move_files.png"_ustr; +inline constexpr OUString RID_CURSOR_MOVE_FILE_LINK = u"vcl/res/move_file_link.png"_ustr; +inline constexpr OUString RID_CURSOR_MOVE_POINT = u"vcl/res/move_point.png"_ustr; +inline constexpr OUString RID_CURSOR_NOT_ALLOWED = u"vcl/res/not_allowed.png"_ustr; +inline constexpr OUString RID_CURSOR_NULL = u"vcl/res/null.png"_ustr; +#define RID_CURSOR_PEN "vcl/res/pen.png" +inline constexpr OUString RID_CURSOR_PIVOT_COLUMN = u"vcl/res/pivot_column.png"_ustr; +inline constexpr OUString RID_CURSOR_PIVOT_DELETE = u"vcl/res/pivot_delete.png"_ustr; +inline constexpr OUString RID_CURSOR_PIVOT_FIELD = u"vcl/res/pivot_field.png"_ustr; +inline constexpr OUString RID_CURSOR_PIVOT_ROW = u"vcl/res/pivot_row.png"_ustr; +inline constexpr OUString RID_CURSOR_ROTATE = u"vcl/res/rotate.png"_ustr; +inline constexpr OUString RID_CURSOR_TAB_SELECT_E = u"vcl/res/tab_select_e.png"_ustr; +inline constexpr OUString RID_CURSOR_TAB_SELECT_S = u"vcl/res/tab_select_s.png"_ustr; +inline constexpr OUString RID_CURSOR_TAB_SELECT_SE = u"vcl/res/tab_select_se.png"_ustr; +inline constexpr OUString RID_CURSOR_TAB_SELECT_SW = u"vcl/res/tab_select_sw.png"_ustr; +inline constexpr OUString RID_CURSOR_TAB_SELECT_W = u"vcl/res/tab_select_w.png"_ustr; +inline constexpr OUString RID_CURSOR_V_SHEAR = u"vcl/res/v_shear.png"_ustr; +inline constexpr OUString RID_CURSOR_TEXT_VERTICAL = u"vcl/res/text_vertical.png"_ustr; +inline constexpr OUString RID_CURSOR_HIDE_WHITESPACE = u"vcl/res/hide_whitespace.png"_ustr; +inline constexpr OUString RID_CURSOR_SHOW_WHITESPACE = u"vcl/res/show_whitespace.png"_ustr; +#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" +inline constexpr OUString RID_CURSOR_FATCROSS = u"vcl/res/fatcross.png"_ustr; + +inline constexpr OUString CHEVRON = u"sfx2/res/chevron.png"_ustr; + +inline constexpr OUString RID_UPDATE_AVAILABLE_16 = u"extensions/res/update/ui/onlineupdate_16.png"_ustr; +inline constexpr OUString RID_UPDATE_AVAILABLE_26 = u"extensions/res/update/ui/onlineupdate_26.png"_ustr; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/brdwin.hxx b/vcl/inc/brdwin.hxx new file mode 100644 index 0000000000..f9c8a8edb8 --- /dev/null +++ b/vcl/inc/brdwin.hxx @@ -0,0 +1,290 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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/notebookbar.hxx> +#include <vcl/window.hxx> +#include <o3tl/typed_flags_set.hxx> +#include <vcl/notebookbar/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, + Dock = 0x0800, + Hide = 0x1000, + Help = 0x2000, +}; +namespace o3tl { + template<> struct typed_flags<BorderWindowHitTest> : is_typed_flags<BorderWindowHitTest, 0x3fff> {}; +}; + +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 final : public vcl::Window +{ + friend class vcl::Window; + friend class vcl::WindowOutputDevice; + friend class ImplBorderWindowView; + friend class ImplSmallBorderWindowView; + friend class ImplStdBorderWindowView; + +private: + std::unique_ptr<ImplBorderWindowView> mpBorderView; + VclPtr<vcl::Window> mpMenuBarWindow; + VclPtr<NotebookBar> mpNotebookBar; + tools::Long mnMinWidth; + tools::Long mnMinHeight; + tools::Long mnMaxWidth; + tools::Long mnMaxHeight; + tools::Long mnOrgMenuHeight; + BorderWindowTitleType mnTitleType; + WindowBorderStyle mnBorderStyle; + bool mbFloatWindow; + bool mbSmallOutBorder; + bool mbFrameBorder; + 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 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( tools::Long nWidth, tools::Long nHeight ) + { mnMinWidth = nWidth; mnMinHeight = nHeight; } + void SetMaxOutputSize( tools::Long nWidth, tools::Long nHeight ) + { mnMaxWidth = nWidth; mnMaxHeight = nHeight; } + + void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, + sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const; + tools::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 maDockRect; + tools::Rectangle maMenuRect; + tools::Rectangle maHideRect; + tools::Rectangle maHelpRect; + Point maMouseOff; + tools::Long mnWidth; + tools::Long mnHeight; + tools::Long mnTrackX; + tools::Long mnTrackY; + tools::Long mnTrackWidth; + tools::Long mnTrackHeight; + sal_Int32 mnLeftBorder; + sal_Int32 mnTopBorder; + sal_Int32 mnRightBorder; + sal_Int32 mnBottomBorder; + tools::Long mnNoTitleTop; + tools::Long mnBorderSize; + tools::Long mnTitleHeight; + BorderWindowHitTest mnHitTest; + DrawButtonFlags mnCloseState; + 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, tools::Long nWidth, tools::Long nHeight ) = 0; + virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, + sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const = 0; + virtual tools::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 tools::Long ImplCalcTitleWidth( const ImplBorderFrameData* pData ); +}; + +class ImplNoBorderWindowView final : public ImplBorderWindowView +{ +public: + ImplNoBorderWindowView(); + + virtual void Init( OutputDevice* pDev, tools::Long nWidth, tools::Long nHeight ) override; + virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, + sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const override; + virtual tools::Long CalcTitleWidth() const override; + virtual void DrawWindow(vcl::RenderContext& rRenderContext, const Point* pOffset = nullptr) override; +}; + +class ImplSmallBorderWindowView final : public ImplBorderWindowView +{ + VclPtr<ImplBorderWindow> mpBorderWindow; + VclPtr<OutputDevice> mpOutDev; + tools::Long mnWidth; + tools::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, tools::Long nWidth, tools::Long nHeight ) override; + virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, + sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const override; + virtual tools::Long CalcTitleWidth() const override; + virtual void DrawWindow(vcl::RenderContext& rRenderContext, const Point* pOffset = nullptr) override; +}; + +class ImplStdBorderWindowView final : 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, tools::Long nWidth, tools::Long nHeight ) override; + virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, + sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const override; + virtual tools::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/bubblewindow.hxx b/vcl/inc/bubblewindow.hxx new file mode 100644 index 0000000000..12254d2dbb --- /dev/null +++ b/vcl/inc/bubblewindow.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 <vcl/toolkit/floatwin.hxx> +#include <vcl/image.hxx> +#include <vcl/menu.hxx> + +class BubbleWindow final : public FloatingWindow +{ + Point maTipPos; + vcl::Region maBounds; + tools::Polygon maRectPoly; + tools::Polygon maTriPoly; + OUString maBubbleTitle; + OUString maBubbleText; + Image maBubbleImage; + Size maMaxTextSize; + tools::Rectangle maTitleRect; + tools::Rectangle maTextRect; + tools::Long mnTipOffset; + +private: + void RecalcTextRects(); + +public: + BubbleWindow( vcl::Window* pParent, OUString aTitle, + OUString aText, Image aImage ); + + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; + void Resize() override; + void Show( bool bVisible = true ); + void SetTipPosPixel( const Point& rTipPos ) { maTipPos = rTipPos; } + void SetTitleAndText( const OUString& rTitle, const OUString& rText, + const Image& rImage ); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/calendar.hxx b/vcl/inc/calendar.hxx new file mode 100644 index 0000000000..b727039cee --- /dev/null +++ b/vcl/inc/calendar.hxx @@ -0,0 +1,228 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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_CALENDAR_HXX +#define INCLUDED_VCL_CALENDAR_HXX + +#include <unotools/calendarwrapper.hxx> + +#include <vcl/ctrl.hxx> +#include <memory> +#include <set> + +class MouseEvent; +class TrackingEvent; +class KeyEvent; +class HelpEvent; +class DataChangedEvent; + +/************************************************************************* + +Description +============ + +class Calendar + +This class allows for the selection of a date. The displayed date range is +the one specified by the Date class. We display as many months as we have +space in the control. The user can switch between months using a ContextMenu +(clicking on the month's name) or via two ScrollButtons in-between the months. + +-------------------------------------------------------------------------- + +WinBits + +WB_BORDER We draw a border around the window. +WB_TABSTOP Keyboard control is possible. We get the focus, when + the user clicks in the Control. + +-------------------------------------------------------------------------- + +We set and get the selected date by SetCurDate()/GetCurDate(). +If the user selects a date Select() is called. If the user double clicks +DoubleClick() is called. + +-------------------------------------------------------------------------- + +CalcWindowSizePixel() calculates the window size in pixel that is needed +to display a certain number of months. + +-------------------------------------------------------------------------- + +SetSaturdayColor() and SetSundayColor() set a special color for Saturdays +and Sundays. +AddDateInfo() marks special days. With that we can set e.g. public holidays +to another color or encircle them (for e.g. appointments). +If we do not supply a year in the date, the day is used in EVERY year. + +AddDateInfo() can also add text for every date, which is displayed if the +BalloonHelp is enabled. +In order to not have to supply all years with the relevant data, we call +the RequestDateInfo() handler if a new year is displayed. We can then query +the year in the handler with GetRequestYear(). + +-------------------------------------------------------------------------- + +In order to display a ContextMenu for a date, we need to override the +Command handler. GetDate() can infer the date from the mouse's position. +If we use the keyboard, the current date should be use. + +If a ContextMenu is displayed, the baseclass' handler must not be called. + +-------------------------------------------------------------------------- + +SetNoSelection() deselects everything. +SetCurDate() does not select the current date, but only defines the focus +rectangle. +GetSelectDateCount()/GetSelectDate() query the selected range. +IsDateSelected() queries for the status of a date. + +The SelectionChanging() handler is being called while a user selects a +date. In it, we can change the selected range. E.g. if we want to limit +or extend the selected range. The selected range is realised via SelectDate() +and SelectDateRange() and queried with GetSelectDateCount()/GetSelectDate(). + +IsSelectLeft() returns the direction of the selection: +sal_True is a selection to the left or up +sal_False is a selection to the right or down + +-------------------------------------------------------------------------- + +If the DateRange area changes and we want to take over the selection, we +should only do this is if IsScrollDateRangeChanged() returns sal_True. +This method returns sal_True if the area change was triggered by using the +ScrollButtons and sal_False if it was triggered by Resize(), other method +calls or by ending a selection. + +*************************************************************************/ + +typedef std::set<sal_Int32> IntDateSet; + +class Calendar final : public Control +{ + std::unique_ptr<IntDateSet> mpSelectTable; + std::unique_ptr<IntDateSet> mpOldSelectTable; + OUString maDayTexts[31]; + OUString maDayText; + OUString maWeekText; + CalendarWrapper maCalendarWrapper; + tools::Rectangle maPrevRect; + tools::Rectangle maNextRect; + OUString maDayOfWeekText; + sal_Int32 mnDayOfWeekAry[8]; + Date maOldFormatFirstDate; + Date maOldFormatLastDate; + Date maFirstDate; + Date maOldFirstDate; + Date maCurDate; + Date maOldCurDate; + Color maSelColor; + Color maOtherColor; + sal_Int32 mnDayCount; + tools::Long mnDaysOffX; + tools::Long mnWeekDayOffY; + tools::Long mnDaysOffY; + tools::Long mnMonthHeight; + tools::Long mnMonthWidth; + tools::Long mnMonthPerLine; + tools::Long mnLines; + tools::Long mnDayWidth; + tools::Long mnDayHeight; + WinBits mnWinStyle; + sal_Int16 mnFirstYear; + sal_Int16 mnLastYear; + bool mbCalc:1, + mbFormat:1, + mbDrag:1, + mbMenuDown:1, + mbSpinDown:1, + mbPrevIn:1, + mbNextIn:1; + Link<Calendar*,void> maSelectHdl; + Link<Calendar*,void> maActivateHdl; + + using Control::ImplInitSettings; + using Window::ImplInit; + void ImplInit( WinBits nWinStyle ); + void ImplInitSettings(); + + virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; + + void ImplFormat(); + sal_uInt16 ImplDoHitTest( const Point& rPos, Date& rDate ) const; + void ImplDrawSpin(vcl::RenderContext& rRenderContext); + void ImplDrawDate(vcl::RenderContext& rRenderContext, tools::Long nX, tools::Long nY, + sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear, + bool bOther, sal_Int32 nToday); + void ImplDraw(vcl::RenderContext& rRenderContext); + void ImplUpdateDate( const Date& rDate ); + void ImplUpdateSelection( IntDateSet* pOld ); + void ImplMouseSelect( const Date& rDate, sal_uInt16 nHitTest ); + void ImplUpdate( bool bCalcNew = false ); + void ImplScrollCalendar( bool bPrev ); + void ImplShowMenu( const Point& rPos, const Date& rDate ); + void ImplTracking( const Point& rPos, bool bRepeat ); + void ImplEndTracking( bool bCancel ); + DayOfWeek ImplGetWeekStart() const; + + virtual Size GetOptimalSize() const override; +public: + Calendar( vcl::Window* pParent, WinBits nWinStyle ); + virtual ~Calendar() override; + virtual void dispose() override; + + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual void Tracking( const TrackingEvent& rMEvt ) 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 GetFocus() override; + virtual void LoseFocus() override; + virtual void RequestHelp( const HelpEvent& rHEvt ) override; + virtual void Command( const CommandEvent& rCEvt ) override; + virtual void StateChanged( StateChangedType nStateChange ) override; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + + void Select(); + + Date GetFirstSelectedDate() const; + + void SetCurDate( const Date& rNewDate ); + void SetFirstDate( const Date& rNewFirstDate ); + const Date& GetFirstDate() const { return maFirstDate; } + Date GetLastDate() const { return GetFirstDate() + mnDayCount; } + Date GetFirstMonth() const; + Date GetLastMonth() const; + sal_uInt16 GetMonthCount() const; + bool GetDate( const Point& rPos, Date& rDate ) const; + tools::Rectangle GetDateRect( const Date& rDate ) const; + + void EndSelection(); + + Size CalcWindowSizePixel() const; + + void SetSelectHdl( const Link<Calendar*,void>& rLink ) { maSelectHdl = rLink; } + void SetActivateHdl( const Link<Calendar*,void>& rLink ) { maActivateHdl = rLink; } + + virtual void DumpAsPropertyTree(tools::JsonWriter&) override; +}; + +#endif // INCLUDED_VCL_CALENDAR_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 0000000000..9460dcec96 --- /dev/null +++ b/vcl/inc/canvasbitmap.hxx @@ -0,0 +1,123 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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> +#include <vcl/BitmapReadAccess.hxx> + +namespace vcl::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; + BitmapScopedInfoAccess m_pBmpAcc; + BitmapScopedInfoAccess m_pAlphaAcc; + std::optional<BitmapScopedReadAccess> m_pBmpReadAcc; + std::optional<BitmapScopedReadAccess> m_pAlphaReadAcc; + 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; + bool m_bPalette; + + SAL_DLLPRIVATE void setComponentInfo( sal_uInt32 redShift, sal_uInt32 greenShift, sal_uInt32 blueShift ); + BitmapScopedReadAccess& getBitmapReadAccess(); + BitmapScopedReadAccess& getAlphaReadAccess(); + + 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 0000000000..ea6cf65740 --- /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/cursor_hotspots.hxx b/vcl/inc/cursor_hotspots.hxx new file mode 100644 index 0000000000..7f356fa956 --- /dev/null +++ b/vcl/inc/cursor_hotspots.hxx @@ -0,0 +1,171 @@ +/* -*- 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 +#define fatcross_curs_x_hot 15 +#define fatcross_curs_y_hot 15 + +#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 0000000000..b3d93c5e16 --- /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 0000000000..89010face2 --- /dev/null +++ b/vcl/inc/debugevent.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 INCLUDED_VCL_DEBUGEVENT_HXX +#define INCLUDED_VCL_DEBUGEVENT_HXX + +#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 0000000000..a763ccd469 --- /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 <com/sun/star/uno/Reference.hxx> +#include <mutex> +#include <vector> + +namespace vcl { + +class DisplayConnectionDispatch final : + public cppu::WeakImplHelper< css::awt::XDisplayConnection > +{ + std::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 0000000000..0b3f585602 --- /dev/null +++ b/vcl/inc/dndeventdispatcher.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_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> +#include <mutex> + +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); + + std::recursive_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/dndhelper.hxx b/vcl/inc/dndhelper.hxx new file mode 100644 index 0000000000..f79382f4ee --- /dev/null +++ b/vcl/inc/dndhelper.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/. + */ + +#pragma once + +#include <sal/types.h> +#include <vcl/dllapi.h> +#include <com/sun/star/uno/Reference.hxx> + +namespace com::sun::star::lang +{ +class XInitialization; +} +namespace com::sun::star::uno +{ +class XInterface; +} + +namespace vcl +{ +// Ole and X11 refer to the UNO DnD interface names and their expected XInitialization arguments. + +enum class DragOrDrop +{ + Drag, + Drop +}; +VCL_DLLPUBLIC css::uno::Reference<css::uno::XInterface> +OleDnDHelper(const css::uno::Reference<css::lang::XInitialization>&, sal_IntPtr pWin, DragOrDrop); + +VCL_DLLPUBLIC css::uno::Reference<css::uno::XInterface> +X11DnDHelper(const css::uno::Reference<css::lang::XInitialization>&, sal_IntPtr pWin); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/dndlistenercontainer.hxx b/vcl/inc/dndlistenercontainer.hxx new file mode 100644 index 0000000000..bc4109d5e4 --- /dev/null +++ b/vcl/inc/dndlistenercontainer.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_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 <comphelper/compbase.hxx> +#include <comphelper/interfacecontainer4.hxx> + +class GenericDropTargetDropContext : + public ::cppu::WeakImplHelper<css::datatransfer::dnd::XDropTargetDropContext> +{ +public: + GenericDropTargetDropContext(); + + // XDropTargetDropContext + virtual void SAL_CALL acceptDrop( sal_Int8 dragOperation ) override; + virtual void SAL_CALL rejectDrop() override; + virtual void SAL_CALL dropComplete( sal_Bool success ) override; +}; + +class GenericDropTargetDragContext : + public ::cppu::WeakImplHelper<css::datatransfer::dnd::XDropTargetDragContext> +{ +public: + GenericDropTargetDragContext(); + + // XDropTargetDragContext + virtual void SAL_CALL acceptDrag( sal_Int8 dragOperation ) override; + virtual void SAL_CALL rejectDrag() override; +}; + +class DNDListenerContainer final : + public ::comphelper::WeakComponentImplHelper< + css::datatransfer::dnd::XDragGestureRecognizer, + css::datatransfer::dnd::XDropTargetDragContext, + css::datatransfer::dnd::XDropTargetDropContext, + css::datatransfer::dnd::XDropTarget > +{ + bool m_bActive; + sal_Int8 m_nDefaultActions; + comphelper::OInterfaceContainerHelper4<css::datatransfer::dnd::XDragGestureListener> maDragGestureListeners; + comphelper::OInterfaceContainerHelper4<css::datatransfer::dnd::XDropTargetListener> maDropTargetListeners; + 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/drawmode.hxx b/vcl/inc/drawmode.hxx new file mode 100644 index 0000000000..4c1647e0e1 --- /dev/null +++ b/vcl/inc/drawmode.hxx @@ -0,0 +1,50 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <tools/color.hxx> + +#include <vcl/bitmapex.hxx> +#include <vcl/font.hxx> +#include <vcl/rendercontext/DrawModeFlags.hxx> + +class StyleSettings; + +namespace vcl::drawmode +{ +VCL_DLLPUBLIC Color GetLineColor(Color const& rColor, DrawModeFlags nDrawMode, + StyleSettings const& rStyleSettings); + +VCL_DLLPUBLIC Color GetFillColor(Color const& rColor, DrawModeFlags nDrawMode, + StyleSettings const& rStyleSettings); + +VCL_DLLPUBLIC Color GetHatchColor(Color const& rColor, DrawModeFlags nDrawMode, + StyleSettings const& rStyleSettings); + +VCL_DLLPUBLIC Color GetTextColor(Color const& rColor, DrawModeFlags nDrawMode, + StyleSettings const& rStyleSettings); + +VCL_DLLPUBLIC vcl::Font GetFont(vcl::Font const& rFont, DrawModeFlags nDrawMode, + StyleSettings const& rStyleSettings); + +VCL_DLLPUBLIC BitmapEx GetBitmapEx(BitmapEx const& rBitmapEx, DrawModeFlags nDrawMode); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/driverblocklist.hxx b/vcl/inc/driverblocklist.hxx new file mode 100644 index 0000000000..f3fc81c664 --- /dev/null +++ b/vcl/inc/driverblocklist.hxx @@ -0,0 +1,179 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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 <string_view> +#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, + std::u16string_view driverVersion, std::u16string_view 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 std::string_view 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, OUString vendor, VersionComparisonOp op, uint64_t driverVersion, + bool bAllowListed = false, const char* suggestedVersion = nullptr); + + DriverInfo(); + + OperatingSystem meOperatingSystem; + OUString maAdapterVendor; + std::vector<OUString> maDevices; + + bool mbAllowlisted; + + VersionComparisonOp meComparisonOp; + + /* versions are assumed to be A.B.C.D packed as 0xAAAABBBBCCCCDDDD */ + uint64_t mnDriverVersion; + uint64_t mnDriverVersionMax; + + OUString maSuggestedVersion; + OUString maMsg; +}; + +class VCL_DLLPUBLIC Parser +{ +public: + Parser(OUString aURL, 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(std::string_view rString); + + enum class BlockType + { + ALLOWLIST, + DENYLIST, + 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, + std::u16string_view sDriverVersion, + std::u16string_view 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 0000000000..4a808d29c7 --- /dev/null +++ b/vcl/inc/factory.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_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; } +} + +namespace vcl { + +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/filter/BmpReader.hxx b/vcl/inc/filter/BmpReader.hxx new file mode 100644 index 0000000000..4b6733eeb7 --- /dev/null +++ b/vcl/inc/filter/BmpReader.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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/graph.hxx> + +VCL_DLLPUBLIC bool BmpReader(SvStream& rStream, Graphic& rGraphic); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/filter/BmpWriter.hxx b/vcl/inc/filter/BmpWriter.hxx new file mode 100644 index 0000000000..745aeb6b69 --- /dev/null +++ b/vcl/inc/filter/BmpWriter.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 + +#include <tools/stream.hxx> +#include <vcl/graph.hxx> +#include <vcl/FilterConfigItem.hxx> + +VCL_DLLPUBLIC bool BmpWriter(SvStream& rStream, const Graphic& rGraphic, + FilterConfigItem* pFilterConfigItem); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/filter/DxfReader.hxx b/vcl/inc/filter/DxfReader.hxx new file mode 100644 index 0000000000..f1e89bf4b1 --- /dev/null +++ b/vcl/inc/filter/DxfReader.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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/graph.hxx> + +VCL_DLLPUBLIC bool ImportDxfGraphic(SvStream& rStream, Graphic& rGraphic); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/filter/EpsReader.hxx b/vcl/inc/filter/EpsReader.hxx new file mode 100644 index 0000000000..8cc945ee8e --- /dev/null +++ b/vcl/inc/filter/EpsReader.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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/graph.hxx> + +VCL_DLLPUBLIC bool ImportEpsGraphic(SvStream& rStream, Graphic& rGraphic); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/filter/EpsWriter.hxx b/vcl/inc/filter/EpsWriter.hxx new file mode 100644 index 0000000000..104b5ff6bf --- /dev/null +++ b/vcl/inc/filter/EpsWriter.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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/graph.hxx> +#include <vcl/FilterConfigItem.hxx> + +VCL_DLLPUBLIC bool ExportEpsGraphic(SvStream& rStream, const Graphic& rGraphic, + FilterConfigItem* pFilterConfigItem); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/filter/GifWriter.hxx b/vcl/inc/filter/GifWriter.hxx new file mode 100644 index 0000000000..1b67039f7e --- /dev/null +++ b/vcl/inc/filter/GifWriter.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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/graph.hxx> +#include <vcl/FilterConfigItem.hxx> + +VCL_DLLPUBLIC bool ExportGifGraphic(SvStream& rStream, const Graphic& rGraphic, + FilterConfigItem* pFilterConfigItem); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/filter/MetReader.hxx b/vcl/inc/filter/MetReader.hxx new file mode 100644 index 0000000000..6855cf7a3f --- /dev/null +++ b/vcl/inc/filter/MetReader.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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/graph.hxx> + +VCL_DLLPUBLIC bool ImportMetGraphic(SvStream& rStream, Graphic& rGraphic); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/filter/PbmReader.hxx b/vcl/inc/filter/PbmReader.hxx new file mode 100644 index 0000000000..5fe4d8a295 --- /dev/null +++ b/vcl/inc/filter/PbmReader.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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/graph.hxx> + +VCL_DLLPUBLIC bool ImportPbmGraphic(SvStream& rStream, Graphic& rGraphic); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/filter/PcdReader.hxx b/vcl/inc/filter/PcdReader.hxx new file mode 100644 index 0000000000..216a14b890 --- /dev/null +++ b/vcl/inc/filter/PcdReader.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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/graph.hxx> +#include <vcl/FilterConfigItem.hxx> + +VCL_DLLPUBLIC bool ImportPcdGraphic(SvStream& rStream, Graphic& rGraphic, + FilterConfigItem* pFilterConfigItem); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/filter/PcxReader.hxx b/vcl/inc/filter/PcxReader.hxx new file mode 100644 index 0000000000..73e182c628 --- /dev/null +++ b/vcl/inc/filter/PcxReader.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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/graph.hxx> + +VCL_DLLPUBLIC bool ImportPcxGraphic(SvStream& rStream, Graphic& rGraphic); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/filter/PictReader.hxx b/vcl/inc/filter/PictReader.hxx new file mode 100644 index 0000000000..fa3fb09a00 --- /dev/null +++ b/vcl/inc/filter/PictReader.hxx @@ -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 . + */ + +#pragma once + +#include <vcl/graph.hxx> +#include <sal/config.h> + +class GDIMetaFile; +class SvStream; + +VCL_DLLPUBLIC bool ImportPictGraphic(SvStream& rStream, Graphic& rGraphic); + +/// Function to access PictReader::ReadPict for unit testing. +VCL_DLLPUBLIC void ReadPictFile(SvStream& rStreamPict, GDIMetaFile& rGDIMetaFile); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/filter/PsdReader.hxx b/vcl/inc/filter/PsdReader.hxx new file mode 100644 index 0000000000..a257f04d43 --- /dev/null +++ b/vcl/inc/filter/PsdReader.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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/graph.hxx> + +VCL_DLLPUBLIC bool ImportPsdGraphic(SvStream& rStream, Graphic& rGraphic); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/filter/RasReader.hxx b/vcl/inc/filter/RasReader.hxx new file mode 100644 index 0000000000..ea658cb317 --- /dev/null +++ b/vcl/inc/filter/RasReader.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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/graph.hxx> + +VCL_DLLPUBLIC bool ImportRasGraphic(SvStream& rStream, Graphic& rGraphic); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/filter/TgaReader.hxx b/vcl/inc/filter/TgaReader.hxx new file mode 100644 index 0000000000..34f7564871 --- /dev/null +++ b/vcl/inc/filter/TgaReader.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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/graph.hxx> + +VCL_DLLPUBLIC bool ImportTgaGraphic(SvStream& rStream, Graphic& rGraphic); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/filter/TiffReader.hxx b/vcl/inc/filter/TiffReader.hxx new file mode 100644 index 0000000000..3c9922895a --- /dev/null +++ b/vcl/inc/filter/TiffReader.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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/graph.hxx> + +VCL_DLLPUBLIC bool ImportTiffGraphicImport(SvStream& rStream, Graphic& rGraphic); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/filter/TiffWriter.hxx b/vcl/inc/filter/TiffWriter.hxx new file mode 100644 index 0000000000..71bad2554f --- /dev/null +++ b/vcl/inc/filter/TiffWriter.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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/graph.hxx> +#include <vcl/FilterConfigItem.hxx> + +VCL_DLLPUBLIC bool ExportTiffGraphicImport(SvStream& rStream, const Graphic& rGraphic, + const FilterConfigItem* pFilterConfigItem); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/filter/WebpReader.hxx b/vcl/inc/filter/WebpReader.hxx new file mode 100644 index 0000000000..fd8cc4894a --- /dev/null +++ b/vcl/inc/filter/WebpReader.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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/graph.hxx> + +VCL_DLLPUBLIC bool ImportWebpGraphic(SvStream& rStream, Graphic& rGraphic); + +bool ReadWebpInfo(SvStream& rStream, Size& pixelSize, sal_uInt16& bitsPerPixel, bool& hasAlpha); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/filter/WebpWriter.hxx b/vcl/inc/filter/WebpWriter.hxx new file mode 100644 index 0000000000..d3b6431c63 --- /dev/null +++ b/vcl/inc/filter/WebpWriter.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 + +#include <tools/stream.hxx> +#include <vcl/graph.hxx> +#include <vcl/FilterConfigItem.hxx> + +VCL_DLLPUBLIC bool ExportWebpGraphic(SvStream& rStream, const Graphic& rGraphic, + FilterConfigItem* pFilterConfigItem); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/filter/XpmReader.hxx b/vcl/inc/filter/XpmReader.hxx new file mode 100644 index 0000000000..6928a10be8 --- /dev/null +++ b/vcl/inc/filter/XpmReader.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_SOURCE_FILTER_IXPM_XPMREAD_HXX +#define INCLUDED_VCL_SOURCE_FILTER_IXPM_XPMREAD_HXX + +#include <tools/stream.hxx> +#include <vcl/dllapi.h> + +class Graphic; + +VCL_DLLPUBLIC bool ImportXPM(SvStream& rStream, Graphic& rGraphic); + +#endif // INCLUDED_VCL_SOURCE_FILTER_IXPM_XPMREAD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/fltcall.hxx b/vcl/inc/fltcall.hxx new file mode 100644 index 0000000000..f10e72b070 --- /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/DirectFontSubstitution.hxx b/vcl/inc/font/DirectFontSubstitution.hxx new file mode 100644 index 0000000000..150bc37281 --- /dev/null +++ b/vcl/inc/font/DirectFontSubstitution.hxx @@ -0,0 +1,68 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <sal/config.h> + +#include <rtl/ustring.hxx> +#include <unotools/fontdefs.hxx> + +#include <vcl/rendercontext/AddFontSubstituteFlags.hxx> + +#include <font/fontsubstitution.hxx> + +#include <string_view> +#include <vector> + +namespace vcl::font +{ +struct FontSubstEntry +{ + FontSubstEntry(std::u16string_view rFontName, std::u16string_view rSubstFontName, + AddFontSubstituteFlags nSubstFlags) + : maSearchName(GetEnglishSearchFontName(rFontName)) + , maSearchReplaceName(GetEnglishSearchFontName(rSubstFontName)) + , mnFlags(nSubstFlags) + { + } + + OUString maSearchName; + OUString maSearchReplaceName; + AddFontSubstituteFlags mnFlags; +}; + +/** DirectFontSubstitution 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 +class DirectFontSubstitution final : public FontSubstitution +{ +private: + std::vector<FontSubstEntry> maFontSubstList; + +public: + void AddFontSubstitute(const OUString& rFontName, const OUString& rSubstName, + AddFontSubstituteFlags nFlags); + void RemoveFontsSubstitute(); + bool FindFontSubstitute(OUString& rSubstName, std::u16string_view rFontName) const; +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/font/EmphasisMark.hxx b/vcl/inc/font/EmphasisMark.hxx new file mode 100644 index 0000000000..5e902da262 --- /dev/null +++ b/vcl/inc/font/EmphasisMark.hxx @@ -0,0 +1,45 @@ +/* -*- 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 <sal/config.h> + +#include <tools/fontenum.hxx> +#include <tools/gen.hxx> +#include <tools/long.hxx> +#include <tools/poly.hxx> + +#include <vcl/dllapi.h> + +namespace vcl::font +{ +class VCL_DLLPUBLIC EmphasisMark +{ +public: + EmphasisMark(FontEmphasisMark eEmphasis, tools::Long nHeight, sal_Int32 nDPIY); + + tools::PolyPolygon GetShape() const { return maPolyPoly; } + bool IsShapePolyLine() const { return mbIsPolyLine; } + tools::Rectangle GetRect1() const { return maRect1; } + tools::Rectangle GetRect2() const { return maRect2; } + tools::Long GetYOffset() const { return mnYOff; } + tools::Long GetWidth() const { return mnWidth; } + +private: + tools::PolyPolygon maPolyPoly; + bool mbIsPolyLine; + tools::Rectangle maRect1; + tools::Rectangle maRect2; + tools::Long mnYOff; + tools::Long mnWidth; +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/font/FeatureCollector.hxx b/vcl/inc/font/FeatureCollector.hxx new file mode 100644 index 0000000000..1b71d02159 --- /dev/null +++ b/vcl/inc/font/FeatureCollector.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#pragma once + +#include <vcl/font/Feature.hxx> +#include <hb.h> +#include <i18nlangtag/languagetag.hxx> + +#include <font/PhysicalFontFace.hxx> + +namespace vcl::font +{ +class FeatureCollector +{ +private: + const PhysicalFontFace* m_pFace; + hb_face_t* m_pHbFace; + std::vector<vcl::font::Feature>& m_rFontFeatures; + const LanguageTag& m_rLanguageTag; + +public: + FeatureCollector(const PhysicalFontFace* pFace, std::vector<vcl::font::Feature>& rFontFeatures, + const LanguageTag& rLanguageTag) + : m_pFace(pFace) + , m_pHbFace(pFace->GetHbFace()) + , m_rFontFeatures(rFontFeatures) + , m_rLanguageTag(rLanguageTag) + { + } + +private: + void collectForTable(hb_tag_t aTableTag); + bool collectGraphite(); + +public: + bool collect(); +}; + +} // namespace vcl::font + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/font/FontMetricData.hxx b/vcl/inc/font/FontMetricData.hxx new file mode 100644 index 0000000000..83eb77d54c --- /dev/null +++ b/vcl/inc/font/FontMetricData.hxx @@ -0,0 +1,155 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <sal/config.h> + +#include <vcl/dllapi.h> +#include <tools/degree.hxx> +#include <tools/long.hxx> +#include <tools/ref.hxx> +#include <fontattributes.hxx> + +class FontMetricData; +typedef tools::SvRef<FontMetricData> FontMetricDataRef; + +class OutputDevice; +namespace vcl::font +{ +class FontSelectPattern; +} +class LogicalFontInstance; + +class VCL_DLLPUBLIC FontMetricData final : public FontAttributes, public SvRefBase +{ +public: + explicit FontMetricData( const vcl::font::FontSelectPattern& ); + + // font instance attributes from the font request + tools::Long GetWidth() const { return mnWidth; } + Degree10 GetOrientation() const { return mnOrientation; } + + void SetWidth(tools::Long nWidth) { mnWidth=nWidth; } + void SetOrientation(Degree10 nOrientation) { mnOrientation=nOrientation; } + + // font metrics measured for the font instance + tools::Long GetAscent() const { return mnAscent; } + tools::Long GetDescent() const { return mnDescent; } + tools::Long GetInternalLeading() const { return mnIntLeading; } + tools::Long GetExternalLeading() const { return mnExtLeading; } + int GetSlant() const { return mnSlant; } + double GetMinKashida() const { return mnMinKashida; } + tools::Long GetHangingBaseline() const { return mnHangingBaseline; } + + void SetSlant(int nSlant) { mnSlant=nSlant; } + void SetMinKashida(double nMinKashida ) { mnMinKashida=nMinKashida; } + + // font attributes queried from the font instance + bool IsFullstopCentered() const { return mbFullstopCentered; } + tools::Long GetBulletOffset() const { return mnBulletOffset; } + + void SetFullstopCenteredFlag(bool bFullstopCentered) { mbFullstopCentered = bFullstopCentered; } + + // font metrics that are usually derived from the measurements + tools::Long GetUnderlineSize() const { return mnUnderlineSize; } + tools::Long GetUnderlineOffset() const { return mnUnderlineOffset; } + tools::Long GetBoldUnderlineSize() const { return mnBUnderlineSize; } + tools::Long GetBoldUnderlineOffset() const { return mnBUnderlineOffset; } + tools::Long GetDoubleUnderlineSize() const { return mnDUnderlineSize; } + tools::Long GetDoubleUnderlineOffset1() const { return mnDUnderlineOffset1; } + tools::Long GetDoubleUnderlineOffset2() const { return mnDUnderlineOffset2; } + tools::Long GetWavelineUnderlineSize() const { return mnWUnderlineSize; } + tools::Long GetWavelineUnderlineOffset() const { return mnWUnderlineOffset; } + tools::Long GetAboveUnderlineSize() const { return mnAboveUnderlineSize; } + tools::Long GetAboveUnderlineOffset() const { return mnAboveUnderlineOffset; } + tools::Long GetAboveBoldUnderlineSize() const { return mnAboveBUnderlineSize; } + tools::Long GetAboveBoldUnderlineOffset() const { return mnAboveBUnderlineOffset; } + tools::Long GetAboveDoubleUnderlineSize() const { return mnAboveDUnderlineSize; } + tools::Long GetAboveDoubleUnderlineOffset1() const { return mnAboveDUnderlineOffset1; } + tools::Long GetAboveDoubleUnderlineOffset2() const { return mnAboveDUnderlineOffset2; } + tools::Long GetAboveWavelineUnderlineSize() const { return mnAboveWUnderlineSize; } + tools::Long GetAboveWavelineUnderlineOffset() const { return mnAboveWUnderlineOffset; } + tools::Long GetStrikeoutSize() const { return mnStrikeoutSize; } + tools::Long GetStrikeoutOffset() const { return mnStrikeoutOffset; } + tools::Long GetBoldStrikeoutSize() const { return mnBStrikeoutSize; } + tools::Long GetBoldStrikeoutOffset() const { return mnBStrikeoutOffset; } + tools::Long GetDoubleStrikeoutSize() const { return mnDStrikeoutSize; } + tools::Long GetDoubleStrikeoutOffset1() const { return mnDStrikeoutOffset1; } + tools::Long GetDoubleStrikeoutOffset2() const { return mnDStrikeoutOffset2; } + + void ImplInitTextLineSize( const OutputDevice* pDev ); + void ImplInitAboveTextLineSize( const OutputDevice* pDev ); + void ImplInitFlags( const OutputDevice* pDev ); + void ImplCalcLineSpacing(LogicalFontInstance *pFontInstance); + void ImplInitBaselines(LogicalFontInstance *pFontInstance); + +private: + bool ShouldNotUseUnderlineMetrics() const; + bool ImplInitTextLineSizeHarfBuzz(LogicalFontInstance *pFontInstance); + bool ShouldUseWinMetrics(int, int, int, int, int, int) const; + + // font instance attributes from the font request + tools::Long mnHeight; // Font size + tools::Long mnWidth; // Reference Width + Degree10 mnOrientation; // Rotation in 1/10 degrees + + // font metrics measured for the font instance + tools::Long mnAscent; // Ascent + tools::Long mnDescent; // Descent + tools::Long mnIntLeading; // Internal Leading + tools::Long mnExtLeading; // External Leading + int mnSlant; // Slant (Italic/Oblique) + double mnMinKashida; // Minimal width of kashida (Arabic) + tools::Long mnHangingBaseline; // Offset of hanging baseline to Romn baseline + + // font attributes queried from the font instance + bool mbFullstopCentered; + tools::Long mnBulletOffset; // Offset to position non-print character + + // font metrics that are usually derived from the measurements + tools::Long mnUnderlineSize; // Lineheight of Underline + tools::Long mnUnderlineOffset; // Offset from Underline to Baseline + tools::Long mnBUnderlineSize; // Height of bold underline + tools::Long mnBUnderlineOffset; // Offset from bold underline to baseline + tools::Long mnDUnderlineSize; // Height of double underline + tools::Long mnDUnderlineOffset1; // Offset from double underline to baseline + tools::Long mnDUnderlineOffset2; // Offset from double underline to baseline + tools::Long mnWUnderlineSize; // Height of WaveLine underline + tools::Long mnWUnderlineOffset; // Offset from WaveLine underline to baseline, but centrered to WaveLine + tools::Long mnAboveUnderlineSize; // Height of single underline (for Vertical Right) + tools::Long mnAboveUnderlineOffset; // Offset from single underline to baseline (for Vertical Right) + tools::Long mnAboveBUnderlineSize; // Height of bold underline (for Vertical Right) + tools::Long mnAboveBUnderlineOffset; // Offset from bold underline to baseline (for Vertical Right) + tools::Long mnAboveDUnderlineSize; // Height of double underline (for Vertical Right) + tools::Long mnAboveDUnderlineOffset1; // Offset from double underline to baseline (for Vertical Right) + tools::Long mnAboveDUnderlineOffset2; // Offset from double underline to baseline (for Vertical Right) + tools::Long mnAboveWUnderlineSize; // Height of WaveLine-strike-out (for Vertical Right) + tools::Long mnAboveWUnderlineOffset; // Offset from WaveLine-strike-out to baseline, but centrered to the WaveLine (for Vertical Right) + tools::Long mnStrikeoutSize; // Height of single strike-out + tools::Long mnStrikeoutOffset; // Offset from single strike-out to baseline + tools::Long mnBStrikeoutSize; // Height of bold strike-out + tools::Long mnBStrikeoutOffset; // Offset of bold strike-out to baseline + tools::Long mnDStrikeoutSize; // Height of double strike-out + tools::Long mnDStrikeoutOffset1; // Offset of double strike-out to baseline + tools::Long mnDStrikeoutOffset2; // Offset of double strike-out to baseline + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/font/FontSelectPattern.hxx b/vcl/inc/font/FontSelectPattern.hxx new file mode 100644 index 0000000000..8e21cf5696 --- /dev/null +++ b/vcl/inc/font/FontSelectPattern.hxx @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <i18nlangtag/lang.h> +#include <tools/degree.hxx> + +#include <vcl/vclenum.hxx> + +#include <fontattributes.hxx> + +#include <ostream> + +namespace vcl { class Font; } + +class LogicalFontInstance; +class Size; + +namespace vcl::font +{ +class PhysicalFontFace; + +class VCL_DLLPUBLIC FontSelectPattern : public FontAttributes +{ +public: + FontSelectPattern(const vcl::Font&, OUString aSearchName, + 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) + Degree10 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 vcl::font::FontSelectPattern & rFSP) +{ + stream << (rFSP.maTargetName.isEmpty() ? "<default>" : rFSP.maTargetName) + << " (" << rFSP.maSearchName << ") w: " << rFSP.mnWidth << " h: " + << rFSP.mnHeight << " alias: " << rFSP.mbNonAntialiased; + return stream; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/font/LogicalFontInstance.hxx b/vcl/inc/font/LogicalFontInstance.hxx new file mode 100644 index 0000000000..40d3c57c4e --- /dev/null +++ b/vcl/inc/font/LogicalFontInstance.hxx @@ -0,0 +1,167 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <sal/config.h> + +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <o3tl/hash_combine.hxx> +#include <rtl/ref.hxx> +#include <salhelper/simplereferenceobject.hxx> +#include <tools/gen.hxx> +#include <tools/fontenum.hxx> +#include <tools/degree.hxx> + +#include <font/FontSelectPattern.hxx> +#include <font/FontMetricData.hxx> +#include <glyphid.hxx> + +#include <optional> +#include <unordered_map> + +#include <hb.h> + +class ConvertChar; +class ImplFontCache; + +constexpr float ARTIFICIAL_ITALIC_MATRIX_XX = 1 << 16; +constexpr float ARTIFICIAL_ITALIC_MATRIX_XY = (1 << 16) / 3.f; +constexpr float ARTIFICIAL_ITALIC_SKEW = ARTIFICIAL_ITALIC_MATRIX_XY / ARTIFICIAL_ITALIC_MATRIX_XX; + +// extend std namespace to add custom hash needed for LogicalFontInstance + +namespace std +{ +template <> struct hash<pair<sal_UCS4, FontWeight>> +{ + size_t operator()(const pair<sal_UCS4, FontWeight>& rData) const + { + std::size_t seed = 0; + o3tl::hash_combine(seed, rData.first); + o3tl::hash_combine(seed, rData.second); + return seed; + } +}; +} + +// 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 vcl::font::PhysicalFontFace; + friend class ImplFontCache; + +public: // TODO: make data members private + virtual ~LogicalFontInstance() override; + + FontMetricDataRef mxFontMetric; // Font attributes + const ConvertChar* mpConversion; // used e.g. for StarBats->StarSymbol + + tools::Long mnLineHeight; + Degree10 mnOwnOrientation; // text angle if lower layers don't rotate text themselves + Degree10 mnOrientation; // text angle in 3600 system + bool mbInit; // true if maFontMetric member is valid + + void AddFallbackForUnicode(sal_UCS4 cChar, FontWeight eWeight, const OUString& rFontName, + bool bEmbolden, const ItalicMatrix& rMatrix); + bool GetFallbackForUnicode(sal_UCS4 cInChar, FontWeight eInWeight, OUString* pOutFontName, + bool* pOutEmbolden, ItalicMatrix* pOutItalicMatrix) const; + void IgnoreFallbackForUnicode(sal_UCS4, FontWeight eWeight, std::u16string_view rFontName); + + inline hb_font_t* GetHbFont(); + bool IsGraphiteFont(); + // NeedOffsetCorrection: Return if the font need offset correction in TTB direction. + // nYOffset is the original offset. It is used to check if the correction is necessary. + bool NeedOffsetCorrection(sal_Int32 nYOffset); + void SetAverageWidthFactor(double nFactor) { m_nAveWidthFactor = std::abs(nFactor); } + double GetAverageWidthFactor() const { return m_nAveWidthFactor; } + const vcl::font::FontSelectPattern& GetFontSelectPattern() const { return m_aFontSelData; } + + const vcl::font::PhysicalFontFace* GetFontFace() const { return m_pFontFace.get(); } + vcl::font::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; + basegfx::B2DPolyPolygon GetGlyphOutlineUntransformed(sal_GlyphId) const; + + sal_GlyphId GetGlyphIndex(uint32_t, uint32_t = 0) const; + + double GetGlyphWidth(sal_GlyphId, bool = false, bool = true) const; + + double GetKashidaWidth() const; + + void GetScale(double* nXScale, double* nYScale) const; + + bool NeedsArtificialItalic() const; + bool NeedsArtificialBold() const; + +protected: + explicit LogicalFontInstance(const vcl::font::PhysicalFontFace&, + const vcl::font::FontSelectPattern&); + + hb_font_t* InitHbFont(); + virtual void ImplInitHbFont(hb_font_t*) {} + +private: + hb_font_t* GetHbFontUntransformed() const; + + struct MapEntry + { + OUString sFontName; + bool bEmbolden; + ItalicMatrix aItalicMatrix; + }; + // cache of Unicode characters and replacement font names and attributes + // 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>, MapEntry> UnicodeFallbackList; + UnicodeFallbackList maUnicodeFallbackList; + mutable ImplFontCache* mpFontCache; + const vcl::font::FontSelectPattern m_aFontSelData; + hb_font_t* m_pHbFont; + mutable hb_font_t* m_pHbFontUntransformed = nullptr; + double m_nAveWidthFactor; + rtl::Reference<vcl::font::PhysicalFontFace> m_pFontFace; + std::optional<bool> m_xbIsGraphiteFont; + + enum class FontFamilyEnum + { + Unclassified, + DFKaiSB + }; + + // The value is initialized and used in NeedOffsetCorrection(). + std::optional<FontFamilyEnum> m_xeFontFamilyEnum; + + mutable hb_draw_funcs_t* m_pHbDrawFuncs = nullptr; + basegfx::B2DPolygon m_aDrawPolygon; +}; + +inline hb_font_t* LogicalFontInstance::GetHbFont() +{ + if (!m_pHbFont) + m_pHbFont = InitHbFont(); + return m_pHbFont; +} + +/* 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 0000000000..1ae634deab --- /dev/null +++ b/vcl/inc/font/OpenTypeFeatureDefinitionList.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 <vcl/dllapi.h> +#include <vcl/font/Feature.hxx> +#include <vector> +#include <unordered_map> + +namespace vcl::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(); + +public: + OpenTypeFeatureDefinitionListPrivate(); + FeatureDefinition getDefinition(vcl::font::Feature& rFeature); + bool isRequired(sal_uInt32 nFeatureCode); +}; + +VCL_DLLPUBLIC OpenTypeFeatureDefinitionListPrivate& OpenTypeFeatureDefinitionList(); + +} // namespace vcl::font + +/* 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 0000000000..086d7d500c --- /dev/null +++ b/vcl/inc/font/OpenTypeFeatureStrings.hrc @@ -0,0 +1,104 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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) TranslateId(Context, 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_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") +#define STR_FONT_FEATURE_PARAM_NONE NC_("STR_FONT_FEATURE_PARAM_NONE", "None") + +#endif // INCLUDED_VCL_INC_STRINGS_HRC + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/font/PhysicalFontCollection.hxx b/vcl/inc/font/PhysicalFontCollection.hxx new file mode 100644 index 0000000000..d791f7b692 --- /dev/null +++ b/vcl/inc/font/PhysicalFontCollection.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 <sal/config.h> + +#include <vcl/dllapi.h> + +#include <font/LogicalFontInstance.hxx> + +#include "PhysicalFontFamily.hxx" + +#include <array> +#include <string_view> + +#define MAX_GLYPHFALLBACK 16 + +namespace vcl::font +{ +class GlyphFallbackFontSubstitution; +class PreMatchFontSubstitution; +} + +// TODO: merge with ImplFontCache +// TODO: rename to LogicalFontManager + +namespace vcl::font +{ + +class VCL_PLUGIN_PUBLIC PhysicalFontCollection final +{ +public: + explicit PhysicalFontCollection(); + ~PhysicalFontCollection(); + + // fill the list with device font faces + void Add( vcl::font::PhysicalFontFace* ); + void Clear(); + int Count() const { return maPhysicalFontFamilies.size(); } + + // find the device font family + vcl::font::PhysicalFontFamily* FindFontFamily( std::u16string_view rFontName ) const; + vcl::font::PhysicalFontFamily* FindOrCreateFontFamily( const OUString &rFamilyName ); + vcl::font::PhysicalFontFamily* FindFontFamily( vcl::font::FontSelectPattern& ) const; + vcl::font::PhysicalFontFamily* FindFontFamilyByTokenNames(std::u16string_view rTokenStr) const; + vcl::font::PhysicalFontFamily* FindFontFamilyByAttributes(ImplFontAttrs nSearchType, FontWeight, FontWidth, + FontItalic, std::u16string_view rSearchFamily) const; + + // suggest fonts for glyph fallback + vcl::font::PhysicalFontFamily* GetGlyphFallbackFont( vcl::font::FontSelectPattern&, + LogicalFontInstance* pLogicalFont, + OUString& rMissingCodes, int nFallbackLevel ) const; + + // prepare platform specific font substitutions + void SetPreMatchHook( vcl::font::PreMatchFontSubstitution* ); + void SetFallbackHook( vcl::font::GlyphFallbackFontSubstitution* ); + + // misc utilities + std::shared_ptr<PhysicalFontCollection> Clone() const; + std::unique_ptr<vcl::font::PhysicalFontFaceCollection> GetFontFaceCollection() const; + +private: + mutable bool mbMatchData; // true if matching attributes are initialized + + typedef std::unordered_map<OUString, std::unique_ptr<vcl::font::PhysicalFontFamily>> PhysicalFontFamilies; + PhysicalFontFamilies maPhysicalFontFamilies; + + vcl::font::PreMatchFontSubstitution* mpPreMatchHook; // device specific prematch substitution + vcl::font::GlyphFallbackFontSubstitution* mpFallbackHook; // device specific glyph fallback substitution + + mutable std::unique_ptr<std::array<vcl::font::PhysicalFontFamily*,MAX_GLYPHFALLBACK>> mpFallbackList; + mutable int mnFallbackCount; + + void ImplInitMatchData() const; + void ImplInitGenericGlyphFallback() const; + + vcl::font::PhysicalFontFamily* ImplFindFontFamilyBySearchName( const OUString& ) const; + vcl::font::PhysicalFontFamily* ImplFindFontFamilyBySubstFontAttr( const utl::FontNameAttr& ) const; + + vcl::font::PhysicalFontFamily* ImplFindFontFamilyOfDefaultFont() const; + +}; + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/font/PhysicalFontFace.hxx b/vcl/inc/font/PhysicalFontFace.hxx new file mode 100644 index 0000000000..1fce6a6cba --- /dev/null +++ b/vcl/inc/font/PhysicalFontFace.hxx @@ -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 . + */ + +#pragma once + +#include <sal/config.h> + +#include <i18nlangtag/languagetag.hxx> +#include <rtl/ref.hxx> +#include <salhelper/simplereferenceobject.hxx> +#include <tools/color.hxx> +#include <vcl/dllapi.h> +#include <vcl/fontcapabilities.hxx> +#include <vcl/fontcharmap.hxx> + +#include <fontattributes.hxx> +#include <fontsubset.hxx> + +#include <hb.h> +#include <hb-ot.h> + +class LogicalFontInstance; +struct FontMatchStatus; +namespace vcl::font +{ +class FontSelectPattern; +} + +namespace vcl +{ +class PhysicalFontFamily; +} + +namespace vcl::font +{ +class FontSelectPattern; + +struct FontMatchStatus +{ +public: + int mnFaceMatch; + const OUString* mpTargetStyleName; +}; + +struct RawFontData +{ +public: + RawFontData(hb_blob_t* pBlob = nullptr) + : mpBlob(pBlob ? pBlob : hb_blob_get_empty()) + { + } + + RawFontData(const RawFontData& rOther) + : mpBlob(hb_blob_reference(rOther.mpBlob)) + { + } + + ~RawFontData() { hb_blob_destroy(mpBlob); } + + RawFontData& operator=(const RawFontData& rOther) + { + hb_blob_destroy(mpBlob); + mpBlob = hb_blob_reference(rOther.mpBlob); + return *this; + } + + size_t size() const { return hb_blob_get_length(mpBlob); } + bool empty() const { return size() == 0; } + const uint8_t* data() const + { + return reinterpret_cast<const uint8_t*>(hb_blob_get_data(mpBlob, nullptr)); + } + +private: + hb_blob_t* mpBlob; +}; + +struct ColorLayer +{ + sal_GlyphId nGlyphIndex; + uint32_t nColorIndex; +}; + +typedef std::vector<Color> ColorPalette; + +// https://learn.microsoft.com/en-us/typography/opentype/spec/name#name-ids +typedef enum : hb_ot_name_id_t { + NAME_ID_COPYRIGHT = 0, + NAME_ID_FONT_FAMILY = 1, + NAME_ID_FONT_SUBFAMILY = 2, + NAME_ID_UNIQUE_ID = 3, + NAME_ID_FULL_NAME = 4, + NAME_ID_VERSION_STRING = 5, + NAME_ID_POSTSCRIPT_NAME = 6, + NAME_ID_TRADEMARK = 7, + NAME_ID_MANUFACTURER = 8, + NAME_ID_DESIGNER = 9, + NAME_ID_DESCRIPTION = 10, + NAME_ID_VENDOR_URL = 11, + NAME_ID_DESIGNER_URL = 12, + NAME_ID_LICENSE = 13, + NAME_ID_LICENSE_URL = 14, + //NAME_ID_RESERVED = 15, + NAME_ID_TYPOGRAPHIC_FAMILY = 16, + NAME_ID_TYPOGRAPHIC_SUBFAMILY = 17, + NAME_ID_MAC_FULL_NAME = 18, + NAME_ID_SAMPLE_TEXT = 19, + NAME_ID_CID_FINDFONT_NAME = 20, + NAME_ID_WWS_FAMILY = 21, + NAME_ID_WWS_SUBFAMILY = 22, + NAME_ID_LIGHT_BACKGROUND = 23, + NAME_ID_DARK_BACKGROUND = 24, + NAME_ID_VARIATIONS_PS_PREFIX = 25, +} NameID; + +// 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: + ~PhysicalFontFace(); + + virtual rtl::Reference<LogicalFontInstance> + CreateFontInstance(const vcl::font::FontSelectPattern&) const = 0; + + virtual sal_IntPtr GetFontId() const = 0; + virtual FontCharMapRef GetFontCharMap() const; + virtual bool GetFontCapabilities(vcl::FontCapabilities&) const; + + RawFontData GetRawFontData(uint32_t) const; + + bool IsBetterMatch(const vcl::font::FontSelectPattern&, FontMatchStatus&) const; + sal_Int32 CompareIgnoreSize(const PhysicalFontFace&) const; + + // CreateFontSubset: a method to get a subset of glyphs of a font inside a + // new valid font file + // returns true if creation of subset was successful + // parameters: rOutBuffer: vector to write the subset to + // pGlyphIDs: the glyph ids to be extracted + // pEncoding: the character code corresponding to each glyph + // nGlyphs: the number of glyphs + // rInfo: additional outgoing information + // implementation note: encoding 0 with glyph id 0 should be added implicitly + // as "undefined character" + bool CreateFontSubset(std::vector<sal_uInt8>&, const sal_GlyphId*, const sal_uInt8*, const int, + FontSubsetInfo&) const; + + bool IsColorFont() const { return HasColorLayers() || HasColorBitmaps(); } + + bool HasColorLayers() const; + std::vector<ColorLayer> GetGlyphColorLayers(sal_GlyphId) const; + + const std::vector<ColorPalette>& GetColorPalettes() const; + + bool HasColorBitmaps() const; + RawFontData GetGlyphColorBitmap(sal_GlyphId, tools::Rectangle&) const; + + OString GetGlyphName(sal_GlyphId, bool = false) const; + + uint32_t UnitsPerEm() const { return hb_face_get_upem(GetHbFace()); } + + OUString GetName(NameID, const LanguageTag&) const; + OUString GetName(NameID aNameID) const { return GetName(aNameID, LanguageTag(LANGUAGE_NONE)); } + + virtual hb_face_t* GetHbFace() const; + virtual hb_blob_t* GetHbTable(hb_tag_t) const + { + assert(false); + return nullptr; + } + + virtual const std::vector<hb_variation_t>& GetVariations(const LogicalFontInstance&) const; + +protected: + mutable hb_face_t* mpHbFace; + mutable hb_font_t* mpHbUnscaledFont; + mutable FontCharMapRef mxCharMap; + mutable std::optional<vcl::FontCapabilities> mxFontCapabilities; + mutable std::optional<std::vector<ColorPalette>> mxColorPalettes; + mutable std::optional<std::vector<hb_variation_t>> mxVariations; + + explicit PhysicalFontFace(const FontAttributes&); + + hb_font_t* GetHbUnscaledFont() const; +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/font/PhysicalFontFaceCollection.hxx b/vcl/inc/font/PhysicalFontFaceCollection.hxx new file mode 100644 index 0000000000..8208af44c4 --- /dev/null +++ b/vcl/inc/font/PhysicalFontFaceCollection.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <sal/config.h> + +#include "PhysicalFontFace.hxx" + +#include <vector> + +/** + A PhysicalFontFaceCollection is created by a PhysicalFontCollection and + becomes invalid when original PhysicalFontCollection is modified. + */ + +namespace vcl::font +{ +class PhysicalFontFaceCollection +{ +private: + std::vector<rtl::Reference<PhysicalFontFace>> maDevFontVector; + +public: + PhysicalFontFaceCollection() { 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(); } +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/font/PhysicalFontFamily.hxx b/vcl/inc/font/PhysicalFontFamily.hxx new file mode 100644 index 0000000000..a944ed72fe --- /dev/null +++ b/vcl/inc/font/PhysicalFontFamily.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 . + */ + +#pragma once + +#include <sal/config.h> + +#include <vcl/dllapi.h> +#include <vcl/outdev.hxx> + +#include <unotools/fontcfg.hxx> + +namespace vcl::font +{ +// 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<vcl::font::FontTypeFaces> : is_typed_flags<vcl::font::FontTypeFaces, 0xff> +{ +}; +}; + +namespace vcl::font +{ +class FontSelectPattern; +class PhysicalFontCollection; +class PhysicalFontFace; +class PhysicalFontFaceCollection; + +class VCL_PLUGIN_PUBLIC PhysicalFontFamily +{ +public: + PhysicalFontFamily(OUString aSearchName); + ~PhysicalFontFamily(); + + // Avoid implicitly defined copy constructors/assignments for the DLLPUBLIC class (they may + // require forward-declared classes used internally to be defined in places using this) + PhysicalFontFamily(const PhysicalFontFamily&) = delete; + PhysicalFontFamily(PhysicalFontFamily&&) = delete; + PhysicalFontFamily& operator=(const PhysicalFontFamily&) = delete; + PhysicalFontFamily& operator=(PhysicalFontFamily&&) = delete; + + const OUString& GetFamilyName() const { return maFamilyName; } + const OUString& GetSearchName() const { return maSearchName; } + int GetMinQuality() const { return mnMinQuality; } + FontTypeFaces GetTypeFaces() const { return mnTypeFaces; } + + 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 vcl::font::FontSelectPattern& rFSD) const; + + void UpdateDevFontList(PhysicalFontFaceCollection&) 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 + 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 +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/font/fontsubstitution.hxx b/vcl/inc/font/fontsubstitution.hxx new file mode 100644 index 0000000000..f7befca4c3 --- /dev/null +++ b/vcl/inc/font/fontsubstitution.hxx @@ -0,0 +1,68 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +// 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 + +#pragma once + +#include <sal/config.h> + +#include <rtl/ustring.hxx> + +#include <font/FontSelectPattern.hxx> + +namespace vcl::font +{ +class FontSelectPattern; + +class FontSubstitution +{ + // TODO: there is more commonality between the different substitutions +protected: + virtual ~FontSubstitution() {} +}; + +/// Abstracts the concept of finding the best font to support an incomplete font +class GlyphFallbackFontSubstitution : public FontSubstitution +{ +public: + virtual bool FindFontSubstitute(vcl::font::FontSelectPattern&, + LogicalFontInstance* pLogicalFont, + OUString& rMissingCodes) const = 0; +}; + +/** Abstracts the concept of a configured font substitution before the + availability of the originally selected font has been checked. + */ +class PreMatchFontSubstitution : public FontSubstitution +{ +public: + virtual bool FindFontSubstitute(vcl::font::FontSelectPattern&) const = 0; +}; + +void ImplFontSubstitute(OUString& rFontName); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/fontattributes.hxx b/vcl/inc/fontattributes.hxx new file mode 100644 index 0000000000..6d2983222b --- /dev/null +++ b/vcl/inc/fontattributes.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_FONTATTRIBUTES_HXX +#define INCLUDED_VCL_INC_FONTATTRIBUTES_HXX + +#include <vcl/dllapi.h> +#include <rtl/ustring.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; } + + bool IsMicrosoftSymbolEncoded() const { return mbMicrosoftSymbolEncoded; } + + 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 SetMicrosoftSymbolEncoded(const bool ); + + bool CompareDeviceIndependentFontAttributes(const FontAttributes& rOther) const; + + // Device dependent functions + int GetQuality() const { return mnQuality; } + + + void SetQuality( int nQuality ) { mnQuality = nQuality; } + void IncreaseQualityBy( int nQualityAmount ) { mnQuality += nQualityAmount; } + +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 + bool mbMicrosoftSymbolEncoded; // Is font microsoft symbol encoded? + + // device dependent variables + int mnQuality; // Quality (used when similar fonts compete) + +}; + +inline void FontAttributes::SetMicrosoftSymbolEncoded(const bool bMicrosoftSymbolEncoded) +{ + mbMicrosoftSymbolEncoded = bMicrosoftSymbolEncoded; +} + +#endif // INCLUDED_VCL_INC_FONTATTRIBUTES_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 0000000000..beec3f2fb5 --- /dev/null +++ b/vcl/inc/fontsubset.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 . + */ + +#pragma once + +#include <rtl/ustring.hxx> +#include <tools/gen.hxx> +#include <o3tl/typed_flags_set.hxx> + +#include <vcl/dllapi.h> + +#include "glyphid.hxx" + +namespace vcl { class TrueTypeFont; } ///< SFT's idea of a TTF font +class SvStream; + +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 + 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 ); + + bool CreateFontSubset( FontType nOutFontTypeMask, + SvStream* pOutFile, const char* pOutFontName, + const sal_GlyphId* pGlyphIds, const sal_uInt8* pEncodedIds, + int nReqGlyphCount); + +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 + bool m_bFilled; + +private: + // input-font-specific details + unsigned const char* mpInFontBytes; + int mnInByteLength; + FontType meInFontType; ///< allowed mask of input font-types + + // subset-request details + FontType mnReqFontTypeMask; ///< allowed subset-target font types + SvStream* mpOutFile; + const char* mpReqFontName; + const sal_GlyphId* mpReqGlyphIds; + const sal_uInt8* mpReqEncodedIds; + int mnReqGlyphCount; + + bool CreateFontSubsetFromCff(); +}; + +int VCL_DLLPUBLIC TestFontSubset(const void* data, sal_uInt32 size); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/glyphid.hxx b/vcl/inc/glyphid.hxx new file mode 100644 index 0000000000..6bffe2722e --- /dev/null +++ b/vcl/inc/glyphid.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <cstdint> + +typedef uint32_t sal_GlyphId; + +/* 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 0000000000..3a3bae012e --- /dev/null +++ b/vcl/inc/graphic/DetectorTools.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#pragma once + +#include <rtl/string.hxx> + +#include <vector> + +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 0000000000..d6791e377f --- /dev/null +++ b/vcl/inc/graphic/GraphicFormatDetector.hxx @@ -0,0 +1,208 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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> +#include <vcl/graphic/GraphicMetadata.hxx> + +namespace vcl +{ +static inline OUString getImportFormatShortName(GraphicFileFormat nFormat) +{ + const char* pKeyName = nullptr; + + switch (nFormat) + { + case GraphicFileFormat::BMP: + pKeyName = "BMP"; + break; + case GraphicFileFormat::GIF: + pKeyName = "GIF"; + break; + case GraphicFileFormat::JPG: + pKeyName = "JPG"; + break; + case GraphicFileFormat::PCD: + pKeyName = "PCD"; + break; + case GraphicFileFormat::PCX: + pKeyName = "PCX"; + break; + case GraphicFileFormat::PNG: + pKeyName = "PNG"; + break; + case GraphicFileFormat::APNG: + pKeyName = "APNG"; + break; + case GraphicFileFormat::XBM: + pKeyName = "XBM"; + break; + case GraphicFileFormat::XPM: + pKeyName = "XPM"; + break; + case GraphicFileFormat::PBM: + pKeyName = "PBM"; + break; + case GraphicFileFormat::PGM: + pKeyName = "PGM"; + break; + case GraphicFileFormat::PPM: + pKeyName = "PPM"; + break; + case GraphicFileFormat::RAS: + pKeyName = "RAS"; + break; + case GraphicFileFormat::TGA: + pKeyName = "TGA"; + break; + case GraphicFileFormat::PSD: + pKeyName = "PSD"; + break; + case GraphicFileFormat::EPS: + pKeyName = "EPS"; + break; + case GraphicFileFormat::TIF: + pKeyName = "TIF"; + break; + case GraphicFileFormat::DXF: + pKeyName = "DXF"; + break; + case GraphicFileFormat::MET: + pKeyName = "MET"; + break; + case GraphicFileFormat::PCT: + pKeyName = "PCT"; + break; + case GraphicFileFormat::SVM: + pKeyName = "SVM"; + break; + case GraphicFileFormat::WMF: + pKeyName = "WMF"; + break; + case GraphicFileFormat::EMF: + pKeyName = "EMF"; + break; + case GraphicFileFormat::SVG: + pKeyName = "SVG"; + break; + case GraphicFileFormat::WMZ: + pKeyName = "WMZ"; + break; + case GraphicFileFormat::EMZ: + pKeyName = "EMZ"; + break; + case GraphicFileFormat::SVGZ: + pKeyName = "SVGZ"; + break; + case GraphicFileFormat::WEBP: + pKeyName = "WEBP"; + break; + case GraphicFileFormat::MOV: + pKeyName = "MOV"; + break; + case GraphicFileFormat::PDF: + pKeyName = "PDF"; + break; + default: + assert(false); + } + + return OUString::createFromAscii(pKeyName); +} +/*** + * This function is has two modes: + * - determine the file format when bTest = false + * returns true, success + * out rFormatExtension - on success: file format string + * - verify file format when bTest = true + * returns false, if file type can't be verified + * true, if the format is verified or the format is not known + */ +VCL_DLLPUBLIC bool peekGraphicFormat(SvStream& rStream, OUString& rFormatExtension, bool bTest); + +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; + + GraphicFormatDetector(SvStream& rStream, OUString aFormatExtension, bool bExtendedInfo = false); + + bool detect(); + + bool checkMET(); + bool checkBMP(); + bool checkWMF(); + bool checkEMF(); + bool checkPCX(); + bool checkTIF(); + bool checkGIF(); + bool checkPNG(); + bool checkAPNG(); + bool checkJPG(); + bool checkSVM(); + bool checkPCD(); + bool checkPSD(); + bool checkEPS(); + bool checkDXF(); + bool checkPCT(); + bool checkPBM(); + bool checkPGM(); + bool checkPPM(); + bool checkRAS(); + bool checkXPM(); + bool checkXBM(); + bool checkSVG(); + bool checkTGA(); + bool checkMOV(); + bool checkPDF(); + bool checkWEBP(); + const GraphicMetadata& getMetadata(); + +private: + /** + * @brief Checks whether mrStream needs to be uncompressed and returns a pointer to the + * to aUncompressedBuffer or a pointer to maFirstBytes if it doesn't need to be uncompressed + * + * @param aUncompressedBuffer the buffer to hold the uncompressed data + * @param nSize the amount of bytes to uncompress + * @param nRetSize the amount of bytes actually uncompressed + * @return sal_uInt8* a pointer to maFirstBytes or aUncompressed buffer + */ + sal_uInt8* checkAndUncompressBuffer(sal_uInt8* aUncompressedBuffer, sal_uInt32 nSize, + sal_uInt64& nDecompressedSize); + bool mbExtendedInfo; + bool mbWasCompressed; + GraphicMetadata maMetadata; +}; +} + +#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 0000000000..f2f156affe --- /dev/null +++ b/vcl/inc/graphic/GraphicID.hxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <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 0000000000..0faf5a7fe9 --- /dev/null +++ b/vcl/inc/graphic/GraphicReader.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 . + */ + +#pragma once + +#include <rtl/ustring.hxx> + +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 0000000000..65e9214649 --- /dev/null +++ b/vcl/inc/graphic/Manager.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/. + */ + +#ifndef INCLUDED_VCL_INC_GRAPHIC_MANAGER_HXX +#define INCLUDED_VCL_INC_GRAPHIC_MANAGER_HXX + +#include <sal/types.h> +#include <rtl/strbuf.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/animate/Animation.hxx> +#include <vcl/vectorgraphicdata.hxx> +#include <vcl/timer.hxx> +#include <vcl/GraphicExternalLink.hxx> +#include <vcl/gfxlink.hxx> + +#include <memory> +#include <mutex> +#include <chrono> +#include <o3tl/sorted_vector.hxx> + +class ImpGraphic; + +namespace vcl::graphic +{ +class Manager final +{ +private: + std::mutex maMutex; // instead of SolarMutex because graphics can live past vcl main + o3tl::sorted_vector<ImpGraphic*> m_pImpGraphicList; + std::chrono::seconds mnAllowedIdleTime; + bool mbSwapEnabled; + bool mbReducingGraphicMemory; + sal_Int64 mnMemoryLimit; + sal_Int64 mnUsedSize; + Timer maSwapOutTimer; + + Manager(); + + void registerGraphic(const std::shared_ptr<ImpGraphic>& rImpGraphic); + void loopGraphicsAndSwapOut(std::unique_lock<std::mutex>& rGuard, bool bDropAll); + + DECL_LINK(SwapOutTimerHandler, Timer*, void); + + static sal_Int64 getGraphicSizeBytes(const ImpGraphic* pImpGraphic); + void reduceGraphicMemory(std::unique_lock<std::mutex>& rGuard, bool bDropAll = false); + +public: + static Manager& get(); + + void dropCache(); + void dumpState(rtl::OStringBuffer& rState); + + void swappedIn(const ImpGraphic* pImpGraphic, sal_Int64 nSizeBytes); + void swappedOut(const ImpGraphic* pImpGraphic, sal_Int64 nSizeBytes); + + 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 BitmapEx& rBitmapEx); + std::shared_ptr<ImpGraphic> newInstance(std::shared_ptr<GfxLink> const& rLink, + sal_Int32 nPageIndex = 0); + 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/UnoBinaryDataContainer.hxx b/vcl/inc/graphic/UnoBinaryDataContainer.hxx new file mode 100644 index 0000000000..f4a63ce60d --- /dev/null +++ b/vcl/inc/graphic/UnoBinaryDataContainer.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: + * + */ + +#pragma once + +#include <cppuhelper/implbase.hxx> + +#include <com/sun/star/util/XBinaryDataContainer.hpp> + +#include <utility> +#include <vcl/BinaryDataContainer.hxx> + +class UnoBinaryDataContainer final : public cppu::WeakImplHelper<css::util::XBinaryDataContainer> +{ +private: + BinaryDataContainer maBinaryDataContainer; + +public: + UnoBinaryDataContainer(BinaryDataContainer aBinaryDataContainer) + : maBinaryDataContainer(std::move(aBinaryDataContainer)) + { + } + + BinaryDataContainer const& getBinaryDataContainer() const { return maBinaryDataContainer; } + + // XBinaryDataContainer + css::uno::Sequence<sal_Int8> SAL_CALL getCopyAsByteSequence() override; +}; + +/* 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 0000000000..ce060c98f4 --- /dev/null +++ b/vcl/inc/graphic/UnoGraphic.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_SOURCE_GRAPHIC_GRAPHIC_HXX +#define INCLUDED_VCL_SOURCE_GRAPHIC_GRAPHIC_HXX + +#include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/awt/XBitmap.hpp> +#include <com/sun/star/graphic/XGraphicTransformer.hpp> + +#include <graphic/UnoGraphicDescriptor.hxx> + +#include <vcl/graph.hxx> + +namespace unographic { + +class Graphic final : public css::graphic::XGraphic, + public css::awt::XBitmap, + public css::graphic::XGraphicTransformer, + public ::unographic::GraphicDescriptor +{ +public: + Graphic(); + virtual ~Graphic() noexcept override; + + using ::unographic::GraphicDescriptor::init; + void init(const ::Graphic& rGraphic); + + const ::Graphic& GetGraphic() const { return maGraphic; } + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; +private: + // 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; + + // 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; + + ::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 0000000000..2adc19dac0 --- /dev/null +++ b/vcl/inc/graphic/UnoGraphicDescriptor.hxx @@ -0,0 +1,119 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <comphelper/propertysetinfo.hxx> +#include <vcl/graph.hxx> + +inline constexpr OUString MIMETYPE_BMP = u"image/x-MS-bmp"_ustr; +inline constexpr OUString MIMETYPE_GIF = u"image/gif"_ustr; +inline constexpr OUString MIMETYPE_JPG = u"image/jpeg"_ustr; +inline constexpr OUString MIMETYPE_PCD = u"image/x-photo-cd"_ustr; +inline constexpr OUString MIMETYPE_PCX = u"image/x-pcx"_ustr; +inline constexpr OUString MIMETYPE_PNG = u"image/png"_ustr; +inline constexpr OUString MIMETYPE_TIF = u"image/tiff"_ustr; +inline constexpr OUString MIMETYPE_XBM = u"image/x-xbitmap"_ustr; +inline constexpr OUString MIMETYPE_XPM = u"image/x-xpixmap"_ustr; +inline constexpr OUString MIMETYPE_PBM = u"image/x-portable-bitmap"_ustr; +inline constexpr OUString MIMETYPE_PGM = u"image/x-portable-graymap"_ustr; +inline constexpr OUString MIMETYPE_PPM = u"image/x-portable-pixmap"_ustr; +inline constexpr OUString MIMETYPE_RAS = u"image/x-cmu-raster"_ustr; +inline constexpr OUString MIMETYPE_TGA = u"image/x-targa"_ustr; +inline constexpr OUString MIMETYPE_PSD = u"image/vnd.adobe.photoshop"_ustr; +inline constexpr OUString MIMETYPE_EPS = u"image/x-eps"_ustr; +inline constexpr OUString MIMETYPE_DXF = u"image/vnd.dxf"_ustr; +inline constexpr OUString MIMETYPE_MET = u"image/x-met"_ustr; +inline constexpr OUString MIMETYPE_PCT = u"image/x-pict"_ustr; +inline constexpr OUString MIMETYPE_SVM = u"image/x-svm"_ustr; +inline constexpr OUString MIMETYPE_WMF = u"image/x-wmf"_ustr; +inline constexpr OUString MIMETYPE_EMF = u"image/x-emf"_ustr; +inline constexpr OUString MIMETYPE_SVG = u"image/svg+xml"_ustr; +inline constexpr OUString MIMETYPE_PDF = u"application/pdf"_ustr; +inline constexpr OUString MIMETYPE_WEBP = u"image/webp"_ustr; +inline constexpr OUString MIMETYPE_VCLGRAPHIC = u"image/x-vclgraphic"_ustr; + +namespace comphelper { class PropertySetInfo; } +namespace com::sun::star::io { class XInputStream; } + +class Graphic; + +namespace unographic { + +class GraphicDescriptor : public ::cppu::OWeakObject, + public css::lang::XServiceInfo, + public css::lang::XTypeProvider, + public ::comphelper::PropertySetHelper +{ +public: + + GraphicDescriptor(); + virtual ~GraphicDescriptor() noexcept override; + + void init( const ::Graphic& rGraphic ); + void init( const OUString& rURL ); + void init( const css::uno::Reference< css::io::XInputStream >& rxIStm, const OUString& rURL ); + + static rtl::Reference<::comphelper::PropertySetInfo> createPropertySetInfo(); + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + +protected: + // 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/VectorGraphicLoader.hxx b/vcl/inc/graphic/VectorGraphicLoader.hxx new file mode 100644 index 0000000000..55714fd2be --- /dev/null +++ b/vcl/inc/graphic/VectorGraphicLoader.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 <vcl/vectorgraphicdata.hxx> +#include <vcl/BinaryDataContainer.hxx> +#include <memory> + +namespace vcl +{ +std::shared_ptr<VectorGraphicData> loadVectorGraphic(BinaryDataContainer const& rDataContainer, + VectorGraphicDataType eType); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/headless/BitmapHelper.hxx b/vcl/inc/headless/BitmapHelper.hxx new file mode 100644 index 0000000000..2b65984647 --- /dev/null +++ b/vcl/inc/headless/BitmapHelper.hxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <headless/CairoCommon.hxx> +#include <headless/svpbmp.hxx> +#include <basegfx/utils/systemdependentdata.hxx> + +class VCL_DLLPUBLIC BitmapHelper : public SurfaceHelper +{ +private: +#ifdef HAVE_CAIRO_FORMAT_RGB24_888 + const bool m_bForceARGB32; +#endif + SvpSalBitmap aTmpBmp; + +public: + explicit BitmapHelper(const SalBitmap& rSourceBitmap, const bool bForceARGB32 = false); + void mark_dirty(); + unsigned char* getBits(sal_Int32& rStride); +}; + +class VCL_DLLPUBLIC MaskHelper : public SurfaceHelper +{ +public: + explicit MaskHelper(const SalBitmap& rAlphaBitmap); +}; + +class SystemDependentData_BitmapHelper : public basegfx::SystemDependentData +{ +private: + std::shared_ptr<BitmapHelper> maBitmapHelper; + +public: + SystemDependentData_BitmapHelper(std::shared_ptr<BitmapHelper> xBitmapHelper); + + const std::shared_ptr<BitmapHelper>& getBitmapHelper() const { return maBitmapHelper; }; + virtual sal_Int64 estimateUsageInBytes() const override; +}; + +class SystemDependentData_MaskHelper : public basegfx::SystemDependentData +{ +private: + std::shared_ptr<MaskHelper> maMaskHelper; + +public: + SystemDependentData_MaskHelper(std::shared_ptr<MaskHelper> xMaskHelper); + + const std::shared_ptr<MaskHelper>& getMaskHelper() const { return maMaskHelper; }; + virtual sal_Int64 estimateUsageInBytes() const override; +}; + +VCL_DLLPUBLIC void tryToUseSourceBuffer(const SalBitmap& rSourceBitmap, + std::shared_ptr<BitmapHelper>& rSurface); +VCL_DLLPUBLIC void tryToUseMaskBuffer(const SalBitmap& rMaskBitmap, + std::shared_ptr<MaskHelper>& rMask); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/headless/CairoCommon.hxx b/vcl/inc/headless/CairoCommon.hxx new file mode 100644 index 0000000000..13e0398dd6 --- /dev/null +++ b/vcl/inc/headless/CairoCommon.hxx @@ -0,0 +1,269 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <sal/config.h> + +#include <cairo.h> + +#include <vcl/dllapi.h> +#include <vcl/region.hxx> +#include <vcl/salgtype.hxx> +#include <vcl/vclenum.hxx> +#include <vcl/BitmapBuffer.hxx> + +#include <com/sun/star/drawing/LineCap.hpp> + +#include <basegfx/utils/systemdependentdata.hxx> +#include <basegfx/range/b2drange.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> + +#include <optional> +#include <unordered_map> + +typedef struct _cairo cairo_t; +typedef struct _cairo_surface cairo_surface_t; +typedef struct _cairo_user_data_key cairo_user_data_key_t; + +class Gradient; +class SalBitmap; +struct SalGradient; + +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); + +VCL_DLLPUBLIC basegfx::B2DRange getFillDamage(cairo_t* cr); +VCL_DLLPUBLIC basegfx::B2DRange getClipBox(cairo_t* cr); +VCL_DLLPUBLIC basegfx::B2DRange getClippedFillDamage(cairo_t* cr); +VCL_DLLPUBLIC basegfx::B2DRange getClippedStrokeDamage(cairo_t* cr); +VCL_DLLPUBLIC basegfx::B2DRange getStrokeDamage(cairo_t* cr); + +class SystemDependentData_CairoPath final : public basegfx::SystemDependentData +{ +private: + // the path data itself + cairo_path_t* mpCairoPath; + + // all other values the path data is based on and + // need to be compared with to check for data validity + bool mbNoJoin; + bool mbAntiAlias; + std::vector<double> maStroke; + +public: + SystemDependentData_CairoPath(size_t nSizeMeasure, cairo_t* cr, bool bNoJoin, bool bAntiAlias, + const std::vector<double>* pStroke); // MM01 + virtual ~SystemDependentData_CairoPath() override; + + // read access + cairo_path_t* getCairoPath() { return mpCairoPath; } + bool getNoJoin() const { return mbNoJoin; } + bool getAntiAlias() const { return mbAntiAlias; } + const std::vector<double>& getStroke() const { return maStroke; } + + virtual sal_Int64 estimateUsageInBytes() const override; +}; + +VCL_DLLPUBLIC size_t AddPolygonToPath(cairo_t* cr, const basegfx::B2DPolygon& rPolygon, + const basegfx::B2DHomMatrix& rObjectToDevice, bool bPixelSnap, + bool bPixelSnapHairline); + +class VCL_DLLPUBLIC PixelSnapper +{ +public: + basegfx::B2DPoint snap(const basegfx::B2DPolygon& rPolygon, + const basegfx::B2DHomMatrix& rObjectToDevice, + basegfx::B2DHomMatrix& rObjectToDeviceInv, sal_uInt32 nIndex); + +private: + basegfx::B2DPoint maPrevPoint, maCurrPoint, maNextPoint; + basegfx::B2ITuple maPrevTuple, maCurrTuple, maNextTuple; +}; + +VCL_DLLPUBLIC void add_polygon_path(cairo_t* cr, const basegfx::B2DPolyPolygon& rPolyPolygon, + const basegfx::B2DHomMatrix& rObjectToDevice, bool bPixelSnap); + +VCL_DLLPUBLIC cairo_format_t getCairoFormat(const BitmapBuffer& rBuffer); + +VCL_DLLPUBLIC std::optional<BitmapBuffer> FastConvert24BitRgbTo32BitCairo(const BitmapBuffer* pSrc); + +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; +}; + +struct VCL_DLLPUBLIC CairoCommon +{ + cairo_surface_t* m_pSurface; + basegfx::B2IVector m_aFrameSize; + vcl::Region m_aClipRegion; + std::optional<Color> m_oLineColor; + std::optional<Color> m_oFillColor; + PaintMode m_ePaintMode; + double m_fScale; + + CairoCommon() + : m_pSurface(nullptr) + , m_oLineColor(Color(0x00, 0x00, 0x00)) + , m_oFillColor(Color(0xFF, 0xFF, 0XFF)) + , m_ePaintMode(PaintMode::Over) + , m_fScale(1.0) + { + } + + static cairo_user_data_key_t* getDamageKey(); + + cairo_surface_t* getSurface() const { return m_pSurface; } + + sal_uInt16 GetBitCount() const; + + cairo_t* getCairoContext(bool bXorModeAllowed, bool bAntiAlias) const; + void releaseCairoContext(cairo_t* cr, bool bXorModeAllowed, + const basegfx::B2DRange& rExtents) const; + + cairo_t* createTmpCompatibleCairoContext() const; + + static void applyColor(cairo_t* cr, Color rColor, double fTransparency = 0.0); + void clipRegion(cairo_t* cr); + static void clipRegion(cairo_t* cr, const vcl::Region& rClipRegion); + + void SetXORMode(bool bSet, bool bInvertOnly); + void SetROPLineColor(SalROPColor nROPColor); + void SetROPFillColor(SalROPColor nROPColor); + + void drawPixel(const std::optional<Color>& rLineColor, tools::Long nX, tools::Long nY, + bool bAntiAlias); + + static Color getPixel(cairo_surface_t* pSurface, tools::Long nX, tools::Long nY); + + void drawLine(tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2, + bool bAntiAlias); + + void drawRect(double nX, double nY, double nWidth, double nHeight, bool bAntiAlias); + + void drawPolygon(sal_uInt32 nPoints, const Point* pPtAry, bool bAntiAlias); + + void drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point** pPtAry, + bool bAntiAlias); + + void drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolyPolygon&, double fTransparency, bool bAntiAlias); + + void drawPolyLine(sal_uInt32 nPoints, const Point* pPtAry, bool bAntiAlias); + + bool drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolygon& rPolyLine, double fTransparency, double fLineWidth, + const std::vector<double>* pStroke, basegfx::B2DLineJoin eLineJoin, + css::drawing::LineCap eLineCap, double fMiterMinimumAngle, + bool bPixelSnapHairline, bool bAntiAlias); + + bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, + sal_uInt8 nTransparency, bool bAntiAlias); + + bool drawGradient(const tools::PolyPolygon& rPolyPolygon, const Gradient& rGradient, + bool bAntiAlias); + + bool implDrawGradient(basegfx::B2DPolyPolygon const& rPolyPolygon, SalGradient const& rGradient, + bool bAntiAlias); + + void copyWithOperator(const SalTwoRect& rTR, cairo_surface_t* source, cairo_operator_t eOp, + bool bAntiAlias); + + void copySource(const SalTwoRect& rTR, cairo_surface_t* source, bool bAntiAlias); + + static basegfx::B2DRange renderSource(cairo_t* cr, const SalTwoRect& rTR, + cairo_surface_t* source); + + void copyBitsCairo(const SalTwoRect& rTR, cairo_surface_t* pSourceSurface, bool bAntiAlias); + + void invert(const basegfx::B2DPolygon& rPoly, SalInvert nFlags, bool bAntiAlias); + + void invert(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, + SalInvert nFlags, bool bAntiAlias); + + void invert(sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags, bool bAntiAlias); + + void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, bool bAntiAlias); + + bool drawAlphaBitmap(const SalTwoRect& rTR, const SalBitmap& rSourceBitmap, + const SalBitmap& rAlphaBitmap, bool bAntiAlias); + + bool drawTransformedBitmap(const basegfx::B2DPoint& rNull, const basegfx::B2DPoint& rX, + const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap, + const SalBitmap* pAlphaBitmap, double fAlpha, bool bAntiAlias); + + void drawMask(const SalTwoRect& rTR, const SalBitmap& rSalBitmap, Color nMaskColor, + bool bAntiAlias); + + std::shared_ptr<SalBitmap> getBitmap(tools::Long nX, tools::Long nY, tools::Long nWidth, + tools::Long nHeight); + + static cairo_surface_t* createCairoSurface(const BitmapBuffer* pBuffer); + + static bool supportsOperation(OutDevSupportType eType); + static bool hasFastDrawTransformedBitmap(); + +private: + void doXorOnRelease(sal_Int32 nExtentsLeft, sal_Int32 nExtentsTop, sal_Int32 nExtentsRight, + sal_Int32 nExtentsBottom, cairo_surface_t* const surface, + sal_Int32 nWidth) const; +}; + +class VCL_DLLPUBLIC SurfaceHelper +{ +private: + cairo_surface_t* pSurface; + std::unordered_map<sal_uInt64, cairo_surface_t*> maDownscaled; + + SurfaceHelper(const SurfaceHelper&) = delete; + SurfaceHelper& operator=(const SurfaceHelper&) = delete; + + cairo_surface_t* implCreateOrReuseDownscale(unsigned long nTargetWidth, + unsigned long nTargetHeight); + +protected: + cairo_surface_t* implGetSurface() const { return pSurface; } + void implSetSurface(cairo_surface_t* pNew) { pSurface = pNew; } + + bool isTrivial() const; + +public: + explicit SurfaceHelper(); + ~SurfaceHelper(); + + cairo_surface_t* getSurface(unsigned long nTargetWidth = 0, + unsigned long nTargetHeight = 0) const; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/headless/SvpGraphicsBackend.hxx b/vcl/inc/headless/SvpGraphicsBackend.hxx new file mode 100644 index 0000000000..6a68899c8a --- /dev/null +++ b/vcl/inc/headless/SvpGraphicsBackend.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 . + */ + +#pragma once + +#include <vcl/dllapi.h> +#include <tools/long.hxx> +#include <tools/color.hxx> +#include <salgdiimpl.hxx> +#include <salgdi.hxx> + +#include <headless/CairoCommon.hxx> + +class VCL_DLLPUBLIC SvpGraphicsBackend final : public SalGraphicsImpl +{ + CairoCommon& m_rCairoCommon; + +public: + SvpGraphicsBackend(CairoCommon& rCairoCommon); + + void Init() override; + + void freeResources() override; + + OUString getRenderBackendName() const override { return "svp"; } + + void setClipRegion(vcl::Region const& rRegion) override; + void ResetClipRegion() override; + + sal_uInt16 GetBitCount() const override; + + tools::Long GetGraphicsWidth() const override; + + void SetLineColor() override; + void SetLineColor(Color nColor) override; + void SetFillColor() override; + void SetFillColor(Color nColor) override; + void SetXORMode(bool bSet, bool bInvertOnly) override; + void SetROPLineColor(SalROPColor nROPColor) override; + void SetROPFillColor(SalROPColor nROPColor) override; + + void drawPixel(tools::Long nX, tools::Long nY) override; + void drawPixel(tools::Long nX, tools::Long nY, Color nColor) override; + + void drawLine(tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2) override; + void drawRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight) override; + void drawPolyLine(sal_uInt32 nPoints, const Point* pPointArray) override; + void drawPolygon(sal_uInt32 nPoints, const Point* pPointArray) override; + void drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints, + const Point** pPointArray) override; + + void drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolyPolygon&, double fTransparency) override; + + 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; + + bool drawPolyLineBezier(sal_uInt32 nPoints, const Point* pPointArray, + const PolyFlags* pFlagArray) override; + + bool drawPolygonBezier(sal_uInt32 nPoints, const Point* pPointArray, + const PolyFlags* pFlagArray) override; + + bool drawPolyPolygonBezier(sal_uInt32 nPoly, const sal_uInt32* pPoints, + const Point* const* pPointArray, + const PolyFlags* const* pFlagArray) override; + + void copyArea(tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX, tools::Long nSrcY, + tools::Long nSrcWidth, tools::Long nSrcHeight, bool bWindowInvalidate) override; + + void copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics) override; + + void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) override; + + void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, + const SalBitmap& rMaskBitmap) override; + + void drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, + Color nMaskColor) override; + + std::shared_ptr<SalBitmap> getBitmap(tools::Long nX, tools::Long nY, tools::Long nWidth, + tools::Long nHeight) override; + + Color getPixel(tools::Long nX, tools::Long nY) override; + + void invert(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, + SalInvert nFlags) override; + + void invert(sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags) override; + + bool drawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, + void* pPtr, sal_uInt32 nSize) override; + + bool blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap) override; + + bool blendAlphaBitmap(const SalTwoRect&, const SalBitmap& rSrcBitmap, + const SalBitmap& rMaskBitmap, const SalBitmap& rAlphaBitmap) override; + + 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, double fAlpha) override; + + bool hasFastDrawTransformedBitmap() const override; + + bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, + sal_uInt8 nTransparency) override; + + bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) override; + bool implDrawGradient(basegfx::B2DPolyPolygon const& rPolyPolygon, + SalGradient const& rGradient) override; + + bool supportsOperation(OutDevSupportType eType) const override; + + void drawBitmapBuffer(const SalTwoRect& rPosAry, const BitmapBuffer* pBuffer, + cairo_operator_t eOp); +}; + +/* 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 0000000000..b7fdb230f9 --- /dev/null +++ b/vcl/inc/headless/svpbmp.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_HEADLESS_SVPBMP_HXX +#define INCLUDED_VCL_INC_HEADLESS_SVPBMP_HXX + +#include <sal/config.h> + +#include <salbmp.hxx> +#include <basegfx/utils/systemdependentdata.hxx> +#include <optional> + +class VCL_DLLPUBLIC SvpSalBitmap final : public SalBitmap, public basegfx::SystemDependentDataHolder // MM02 +{ + std::optional<BitmapBuffer> moDIB; +public: + SvpSalBitmap(); + virtual ~SvpSalBitmap() override; + + bool ImplCreate(const Size& rSize, + vcl::PixelFormat ePixelFormat, + const BitmapPalette& rPalette, + bool bClear); + + // SalBitmap + virtual bool Create(const Size& rSize, + vcl::PixelFormat ePixelFormat, + const BitmapPalette& rPalette) override; + virtual bool Create( const SalBitmap& rSalBmp ) override; + virtual bool Create( const SalBitmap& rSalBmp, + SalGraphics* pGraphics ) override; + virtual bool Create(const SalBitmap& rSalBmp, + vcl::PixelFormat eNewPixelFormat) override; + virtual bool Create( const css::uno::Reference< css::rendering::XBitmapCanvas >& rBitmapCanvas, + Size& rSize, + bool bMask = false ) override; + void Create(const std::optional<BitmapBuffer> & pBuf); + const BitmapBuffer* GetBuffer() const + { + return moDIB ? &*moDIB : nullptr; + } + 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 const basegfx::SystemDependentDataHolder* accessSystemDependentDataHolder() const override; +}; + +#endif // INCLUDED_VCL_INC_HEADLESS_SVPBMP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/headless/svpdata.hxx b/vcl/inc/headless/svpdata.hxx new file mode 100644 index 0000000000..f995d7ef39 --- /dev/null +++ b/vcl/inc/headless/svpdata.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/. + */ + +#pragma once + +#include <unx/gendata.hxx> + +class SvpSalData : public GenericUnixSalData +{ +public: + explicit SvpSalData() + : GenericUnixSalData() + { + } + virtual void ErrorTrapPush() override {} + virtual bool ErrorTrapPop(bool /*bIgnoreError*/ = true) override { return false; } +}; + +/* 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 0000000000..92958f8d55 --- /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 +{ + SystemEnvData m_aSystemChildData; + +public: + virtual ~SvpSalObject() override; + + // override all pure virtual methods + virtual void ResetClipRegion() override; + virtual void BeginSetClipRegion( sal_uInt32 nRects ) override; + virtual void UnionClipRegion( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; + virtual void EndSetClipRegion() override; + + virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::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 AbsoluteScreenPixelRectangle 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 0000000000..3789e44745 --- /dev/null +++ b/vcl/inc/headless/svpframe.hxx @@ -0,0 +1,145 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <vector> + +#ifdef IOS +#include <quartz/salgdi.h> +#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::vector< SvpSalFrame* > m_aChildren; // Vector of child frames + SalFrameStyleFlags m_nStyle; + bool m_bVisible; +#ifndef IOS + cairo_surface_t* m_pSurface; +#endif + tools::Long m_nMinWidth; + tools::Long m_nMinHeight; + tools::Long m_nMaxWidth; + tools::Long m_nMaxHeight; + + SystemEnvData m_aSystemChildData; + + std::vector< SvpSalGraphics* > m_aGraphics; + + static SvpSalFrame* s_pFocusFrame; + OUString m_sTitle; + +public: + SvpSalFrame( SvpSalInstance* pInstance, + SalFrame* pParent, + SalFrameStyleFlags nSalFrameStyle ); + virtual ~SvpSalFrame() override; + + void GetFocus(); + void LoseFocus(); + void PostPaint() const; + + const OUString& title() const { return m_sTitle; } + SalFrameStyleFlags style() const { return m_nStyle; } + bool isVisible() const { return m_bVisible; } + bool hasFocus() const { return s_pFocusFrame == this; } + + // 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 SetExtendedFrameStyle( SalExtStyle nExtStyle ) override; + virtual void Show( bool bVisible, bool bNoActivate = false ) override; + virtual void SetMinClientSize( tools::Long nWidth, tools::Long nHeight ) override; + virtual void SetMaxClientSize( tools::Long nWidth, tools::Long nHeight ) override; + virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags ) override; + virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) override; + virtual void GetWorkArea( AbsoluteScreenPixelRectangle& rRect ) override; + virtual SalFrame* GetParent() const override; + virtual void SetWindowState(const vcl::WindowData*) override; + virtual bool GetWindowState(vcl::WindowData*) 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( tools::Long nX, tools::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 void SetPluginParent( SystemParentData* pNewParent ) override; + virtual void ResetClipRegion() override; + virtual void BeginSetClipRegion( sal_uInt32 nRects ) override; + virtual void UnionClipRegion( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; + virtual void EndSetClipRegion() override; + + /*TODO: functional implementation */ + virtual void SetScreenNumber( unsigned int ) override {} + virtual void SetApplicationID(const OUString &) override {} + +private: + basegfx::B2IVector GetSurfaceFrameSize() const; +}; + +template <typename charT, typename traits> +inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream, + const SvpSalFrame& frame) +{ + stream << &frame << " (vis " << frame.isVisible() << " focus " << frame.hasFocus(); + stream << " style " << std::hex << std::setfill('0') << std::setw(8) << static_cast<sal_uInt32>(frame.style()); + OUString sTitle = frame.title(); + if (!sTitle.isEmpty()) + stream << " '" << sTitle << "'"; + stream << ")"; + return stream; +} + +#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 0000000000..a68c1b974c --- /dev/null +++ b/vcl/inc/headless/svpgdi.hxx @@ -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 . + */ + +#pragma once + +#ifdef IOS +#error This file is not for iOS +#endif + +#include <sal/config.h> + +#include <osl/endian.h> +#include <vcl/sysdata.hxx> +#include <config_cairo_canvas.h> + +#include <salgdi.hxx> +#include <sallayout.hxx> +#include <unx/cairotextrender.hxx> +#include <font/FontMetricData.hxx> + +#include <headless/SvpGraphicsBackend.hxx> +#include <headless/CairoCommon.hxx> + +struct BitmapBuffer; +class FreetypeFont; + +class VCL_DLLPUBLIC SvpSalGraphics : public SalGraphicsAutoDelegateToImpl +{ + CairoCommon m_aCairoCommon; + CairoTextRender m_aTextRenderImpl; + std::unique_ptr<SvpGraphicsBackend> m_pBackend; + +public: + void setSurface(cairo_surface_t* pSurface, const basegfx::B2IVector& rSize); + cairo_surface_t* getSurface() const { return m_aCairoCommon.m_pSurface; } + static cairo_user_data_key_t* getDamageKey() + { + return CairoCommon::getDamageKey(); + } + +protected: + + cairo_t* createTmpCompatibleCairoContext() const; + +public: + SvpSalGraphics(); + virtual ~SvpSalGraphics() override; + + virtual SalGraphicsImpl* GetImpl() const override { return m_pBackend.get(); } + std::unique_ptr<SvpGraphicsBackend> const& getSvpBackend() { return m_pBackend; } + + virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) override; + + virtual void SetTextColor( Color nColor ) override; + virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) override; + virtual void GetFontMetric( FontMetricDataRef&, int nFallbackLevel ) override; + virtual FontCharMapRef GetFontCharMap() const override; + virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override; + virtual void GetDevFontList( vcl::font::PhysicalFontCollection* ) override; + virtual void ClearDevFontCache() override; + virtual bool AddTempDevFont( vcl::font::PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override; + virtual std::unique_ptr<GenericSalLayout> + GetTextLayout(int nFallbackLevel) override; + virtual void DrawTextLayout( const GenericSalLayout& ) override; + + virtual bool ShouldDownscaleIconsAtSurface(double* pScaleOut) const 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; +#endif // ENABLE_CAIRO_CANVAS + + cairo_t* getCairoContext() const + { + return m_aCairoCommon.getCairoContext(/*bXorModeAllowed*/false, getAntiAlias()); + } + + void clipRegion(cairo_t* cr) + { + m_aCairoCommon.clipRegion(cr); + } + + void copySource(const SalTwoRect& rTR, cairo_surface_t* source) + { + m_aCairoCommon.copySource(rTR, source, getAntiAlias()); + } +}; + +/* 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 0000000000..efe32761f5 --- /dev/null +++ b/vcl/inc/headless/svpinst.hxx @@ -0,0 +1,192 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <mutex> +#include <queue> + +#include <sys/time.h> + +#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 + std::mutex m_FeedbackMutex; + std::queue<bool> m_FeedbackPipe; + std::condition_variable m_FeedbackCV; + 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; +}; + +// 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; + bool ImplYield(bool bWait, bool bHandleAllCurrentEvents); + +public: + static SvpSalInstance* s_pDefaultInstance; + + SvpSalInstance( std::unique_ptr<SalYieldMutex> pMutex ); + virtual ~SvpSalInstance() override; + + void CloseWakeupPipe(); + 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& rGraphics, + tools::Long &nDX, tools::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; + + // 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 OUString GetConnectionIdentifier() override; + + virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) override; + + virtual std::unique_ptr<GenPspGraphics> CreatePrintGraphics() override; + + virtual const cairo_font_options_t* GetCairoFontOptions() 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 0000000000..e1dd1e15f9 --- /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 0000000000..f1666b689a --- /dev/null +++ b/vcl/inc/headless/svpvd.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_INC_HEADLESS_SVPVD_HXX +#define INCLUDED_VCL_INC_HEADLESS_SVPVD_HXX + +#include <salvd.hxx> +#include <basegfx/vector/b2ivector.hxx> + +#include <vector> + +class SvpSalGraphics; +typedef struct _cairo_surface cairo_surface_t; + +class VCL_DLLPUBLIC SvpSalVirtualDevice : public SalVirtualDevice +{ + 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; + + bool CreateSurface(tools::Long nNewDX, tools::Long nNewDY, sal_uInt8 *const pBuffer); + +protected: + SvpSalGraphics* AddGraphics(SvpSalGraphics* aGraphics); + +public: + SvpSalVirtualDevice(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( tools::Long nNewDX, tools::Long nNewDY ) override; + virtual bool SetSizeUsingBuffer( tools::Long nNewDX, tools::Long nNewDY, + sal_uInt8 * pBuffer + ) override; + + cairo_surface_t* GetSurface() const { return m_pSurface; } + + // SalGeometryProvider + virtual tools::Long GetWidth() const override; + virtual tools::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 0000000000..5a9975cee8 --- /dev/null +++ b/vcl/inc/helpwin.hxx @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_INC_HELPWIN_HXX +#define INCLUDED_VCL_INC_HELPWIN_HXX + +#include <vcl/toolkit/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 ResetHideTimer(); +}; + +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 0000000000..6415742616 --- /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 <vcl/toolkit/fixed.hxx> + +namespace vcl +{ + class HyperLabel final : public FixedText + { + 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 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( tools::Long nMaxWidth ); + private: + sal_Int16 ID; + sal_Int32 Index; + bool bInteractive; + Size m_aMinSize; + bool m_bHyperMode; + }; +} + +#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 0000000000..54c2681a9e --- /dev/null +++ b/vcl/inc/iconview.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <tools/json_writer.hxx> +#include <vcl/toolkit/treelistbox.hxx> + +class IconView final : public SvTreeListBox +{ +public: + IconView(vcl::Window* pParent, WinBits nBits); + + Size GetEntrySize(const SvTreeListEntry&) const; + + virtual void Resize() override; + + virtual tools::Rectangle GetFocusRect(const SvTreeListEntry*, tools::Long) override; + + void PaintEntry(SvTreeListEntry&, tools::Long nX, tools::Long nY, + vcl::RenderContext& rRenderContext); + + virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override; + + virtual OUString GetEntryAccessibleDescription(SvTreeListEntry* pEntry) const override; + void SetEntryAccessibleDescriptionHdl(const Link<SvTreeListEntry*, OUString>& rLink) + { + maEntryAccessibleDescriptionHdl = rLink; + } + + virtual FactoryFunction GetUITestFactory() const override; + virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override; + + typedef std::tuple<tools::JsonWriter&, SvTreeListEntry*, std::string_view> json_prop_query; + + void SetDumpElemToPropertyTreeHdl(const Link<const json_prop_query&, bool>& rLink) + { + maDumpElemToPropertyTreeHdl = rLink; + } + +protected: + virtual void CalcEntryHeight(SvTreeListEntry const* pEntry) override; + +private: + Link<SvTreeListEntry*, OUString> maEntryAccessibleDescriptionHdl; + Link<const json_prop_query&, bool> maDumpElemToPropertyTreeHdl; + void DumpEntryAndSiblings(tools::JsonWriter& rJsonWriter, SvTreeListEntry* pEntry); +}; + +#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 0000000000..cb75b45b83 --- /dev/null +++ b/vcl/inc/image.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_IMAGE_H +#define INCLUDED_VCL_INC_IMAGE_H + +#include <vcl/bitmapex.hxx> +#include <vcl/gdimtf.hxx> + +class SalGraphics; + +class ImplImage +{ +private: + BitmapChecksum maBitmapChecksum; + /// if non-empty: cached original size of maStockName else Size of maBitmap + Size maSizePixel; + /// If set - defines the bitmap via images.zip* + OUString maStockName; + /// rare case of dynamically created Image contents + std::unique_ptr<GDIMetaFile> mxMetaFile; + + /// Original bitmap - or cache of a potentially scaled bitmap + BitmapEx maBitmapEx; + BitmapEx maDisabledBitmapEx; + + bool loadStockAtScale(SalGraphics* pGraphics, BitmapEx &rBitmapEx); + +public: + ImplImage(const BitmapEx& rBitmapEx); + ImplImage(const GDIMetaFile& rMetaFile); + ImplImage(OUString aStockName); + + bool isStock() const + { + return maStockName.getLength() > 0; + } + + const 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, SalGraphics* pGraphics); + + 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 0000000000..5e1b87595b --- /dev/null +++ b/vcl/inc/imagerepository.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_IMAGEREPOSITORY_HXX +#define INCLUDED_VCL_IMAGEREPOSITORY_HXX + +#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/impdel.hxx b/vcl/inc/impdel.hxx new file mode 100644 index 0000000000..b387c34a09 --- /dev/null +++ b/vcl/inc/impdel.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_IMPDEL_HXX +#define INCLUDED_VCL_IMPDEL_HXX + +#include <algorithm> +#include <vector> + +namespace vcl +{ + +class DeletionListener; + +class DeletionNotifier +{ + std::vector< DeletionListener* > m_aListeners; + protected: + DeletionNotifier() {} + + ~DeletionNotifier() + { notifyDelete(); } + + inline void notifyDelete(); + + public: + void addDel( DeletionListener* pListener ) + { m_aListeners.push_back( pListener ); } + + void removeDel( DeletionListener* pListener ) + { std::erase(m_aListeners, 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 0000000000..1e697b9ee3 --- /dev/null +++ b/vcl/inc/impfont.hxx @@ -0,0 +1,148 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <sal/config.h> + +#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 <vcl/font.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; } + + 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 ) + { + if(rSize.Height() != maAverageFontSize.Height()) + { + // reset evtl. buffered calculated AverageFontSize, it depends + // on Font::Height + mnCalculatedAverageFontWidth = 0; + } + maAverageFontSize = rSize; + } + + // 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; } + + tools::Long GetCalculatedAverageFontWidth() const { return mnCalculatedAverageFontWidth; } + void SetCalculatedAverageFontWidth(tools::Long nNew) { mnCalculatedAverageFontWidth = nNew; } + + bool operator==( const ImplFont& ) const; + bool EqualIgnoreColor( const ImplFont& ) const; + + size_t GetHashValue() const; + size_t GetHashValueIgnoreColor() const; + +private: + friend class vcl::Font; + friend SvStream& ReadImplFont( SvStream& rIStm, ImplFont&, tools::Long& ); + friend SvStream& WriteImplFont( SvStream& rOStm, const ImplFont&, tools::Long ); + + 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; + short mnSpacing; + Size maAverageFontSize; + rtl_TextEncoding meCharSet; + + LanguageTag maLanguageTag; + LanguageTag maCJKLanguageTag; + + // Flags - device independent + bool 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 + Degree10 mnOrientation; + + int mnQuality; + + tools::Long mnCalculatedAverageFontWidth; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/impfontcache.hxx b/vcl/inc/impfontcache.hxx new file mode 100644 index 0000000000..5ea19b05d9 --- /dev/null +++ b/vcl/inc/impfontcache.hxx @@ -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 . + */ + +#pragma once + +#include <sal/config.h> + +#include <rtl/ref.hxx> +#include <o3tl/lru_map.hxx> +#include <o3tl/hash_combine.hxx> +#include <tools/gen.hxx> + +#include "font/FontSelectPattern.hxx" +#include "glyphid.hxx" + +class Size; +namespace vcl { class Font; } +namespace vcl::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; + o3tl::hash_combine(seed, aCache.m_pFont); + o3tl::hash_combine(seed, aCache.m_nId); + return seed; + } +}; + +typedef o3tl::lru_map<GlyphBoundRectCacheKey, tools::Rectangle, + GlyphBoundRectCacheHash> GlyphBoundRectCache; + +class ImplFontCache +{ +private: + // cache of recently used font instances + struct IFSD_Equal { bool operator()( const vcl::font::FontSelectPattern&, const vcl::font::FontSelectPattern& ) const; }; + struct IFSD_Hash { size_t operator()( const vcl::font::FontSelectPattern& ) const; }; + typedef o3tl::lru_map<vcl::font::FontSelectPattern, rtl::Reference<LogicalFontInstance>, IFSD_Hash, IFSD_Equal> FontInstanceList; + + LogicalFontInstance* mpLastHitCacheEntry; ///< keeps the last hit cache entry + FontInstanceList maFontInstanceList; + GlyphBoundRectCache m_aBoundRectCache; + + rtl::Reference<LogicalFontInstance> GetFontInstance(vcl::font::PhysicalFontCollection const*, vcl::font::FontSelectPattern&); + +public: + ImplFontCache(); + ~ImplFontCache(); + + rtl::Reference<LogicalFontInstance> GetFontInstance(vcl::font::PhysicalFontCollection const *, + const vcl::Font&, const Size& rPixelSize, float fExactHeight, bool bNonAntialias = false); + rtl::Reference<LogicalFontInstance> GetGlyphFallbackFont( vcl::font::PhysicalFontCollection const *, vcl::font::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(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/impfontcharmap.hxx b/vcl/inc/impfontcharmap.hxx new file mode 100644 index 0000000000..59f9f3baa0 --- /dev/null +++ b/vcl/inc/impfontcharmap.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 . + */ + +#ifndef INCLUDED_VCL_INC_IMPFONTCHARMAP_HXX +#define INCLUDED_VCL_INC_IMPFONTCHARMAP_HXX + +#include <tools/ref.hxx> +#include <vcl/dllapi.h> +#include <vector> + +class ImplFontCharMap; +typedef tools::SvRef<ImplFontCharMap> ImplFontCharMapRef; + +class ImplFontCharMap final : public SvRefBase +{ +public: + explicit ImplFontCharMap(bool bMicrosoftSymbolMap, + std::vector<sal_uInt32> aRangeCodes); + virtual ~ImplFontCharMap() override; + +private: + friend class FontCharMap; + + ImplFontCharMap( const ImplFontCharMap& ) = delete; + void operator=( const ImplFontCharMap& ) = delete; + + static ImplFontCharMapRef const & getDefaultMap(bool bMicrosoftSymbolMap = false); + bool isDefaultMap() const; + +private: + std::vector<sal_uInt32> maRangeCodes; // pairs of StartCode/(EndCode+1) + int mnCharCount; // covered codepoints + const bool m_bMicrosoftSymbolMap; +}; + +bool VCL_DLLPUBLIC HasMicrosoftSymbolCmap(const unsigned char* pRawData, int nRawLength); + +#endif // INCLUDED_VCL_INC_IMPFONTCHARMAP_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 0000000000..1fa8454e2e --- /dev/null +++ b/vcl/inc/impglyphitem.hxx @@ -0,0 +1,166 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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/rendercontext/SalLayoutFlags.hxx> +#include <rtl/math.hxx> +#include <vector> + +#include "font/LogicalFontInstance.hxx" +#include "glyphid.hxx" + +enum class GlyphItemFlags : sal_uInt8 +{ + NONE = 0, + IS_IN_CLUSTER = 0x01, + IS_RTL_GLYPH = 0x02, + IS_VERTICAL = 0x04, + IS_SPACING = 0x08, + IS_DROPPED = 0x10, + IS_CLUSTER_START = 0x20, + IS_UNSAFE_TO_BREAK = 0x40, // HB_GLYPH_FLAG_UNSAFE_TO_BREAK from harfbuzz + IS_SAFE_TO_INSERT_KASHIDA = 0x80 // HB_GLYPH_FLAG_SAFE_TO_INSERT_TATWEEL from harfbuzz +}; +namespace o3tl +{ +template <> struct typed_flags<GlyphItemFlags> : is_typed_flags<GlyphItemFlags, 0xff> +{ +}; +}; + +class VCL_DLLPUBLIC GlyphItem +{ + basegfx::B2DPoint m_aLinearPos; // absolute position of non rotated string + double m_nOrigWidth; // original glyph width + sal_Int32 m_nCharPos; // index in string + double m_nXOffset; + double m_nYOffset; + double m_nNewWidth; // width after adjustments + sal_GlyphId m_aGlyphId; + GlyphItemFlags m_nFlags; + sal_Int8 m_nCharCount; // number of characters making up this glyph + +public: + GlyphItem(int nCharPos, int nCharCount, sal_GlyphId aGlyphId, + const basegfx::B2DPoint& rLinearPos, GlyphItemFlags nFlags, double nOrigWidth, + double nXOffset, double nYOffset) + : m_aLinearPos(rLinearPos) + , m_nOrigWidth(nOrigWidth) + , m_nCharPos(nCharPos) + , m_nXOffset(nXOffset) + , m_nYOffset(nYOffset) + , m_nNewWidth(nOrigWidth) + , m_aGlyphId(aGlyphId) + , m_nFlags(nFlags) + , m_nCharCount(nCharCount) + { + } + + bool IsInCluster() const { return bool(m_nFlags & GlyphItemFlags::IS_IN_CLUSTER); } + bool IsRTLGlyph() const { return bool(m_nFlags & GlyphItemFlags::IS_RTL_GLYPH); } + bool IsVertical() const { return bool(m_nFlags & GlyphItemFlags::IS_VERTICAL); } + bool IsSpacing() const { return bool(m_nFlags & GlyphItemFlags::IS_SPACING); } + bool IsDropped() const { return bool(m_nFlags & GlyphItemFlags::IS_DROPPED); } + bool IsClusterStart() const { return bool(m_nFlags & GlyphItemFlags::IS_CLUSTER_START); } + bool IsUnsafeToBreak() const { return bool(m_nFlags & GlyphItemFlags::IS_UNSAFE_TO_BREAK); } + bool IsSafeToInsertKashida() const + { + return bool(m_nFlags & GlyphItemFlags::IS_SAFE_TO_INSERT_KASHIDA); + } + + inline bool GetGlyphBoundRect(const LogicalFontInstance*, tools::Rectangle&) const; + inline bool GetGlyphOutline(const LogicalFontInstance*, basegfx::B2DPolyPolygon&) const; + inline void dropGlyph(); + + sal_GlyphId glyphId() const { return m_aGlyphId; } + int charCount() const { return m_nCharCount; } + double origWidth() const { return m_nOrigWidth; } + int charPos() const { return m_nCharPos; } + double xOffset() const { return m_nXOffset; } + double yOffset() const { return m_nYOffset; } + double newWidth() const { return m_nNewWidth; } + const basegfx::B2DPoint& linearPos() const { return m_aLinearPos; } + + void setNewWidth(double width) { m_nNewWidth = width; } + void addNewWidth(double width) { m_nNewWidth += width; } + void setLinearPos(const basegfx::B2DPoint& point) { m_aLinearPos = point; } + void setLinearPosX(double x) { m_aLinearPos.setX(x); } + void adjustLinearPosX(double diff) { m_aLinearPos.adjustX(diff); } + bool isLayoutEquivalent(const GlyphItem& other) const + { + return rtl::math::approxEqual(m_aLinearPos.getX(), other.m_aLinearPos.getX(), 8) + && rtl::math::approxEqual(m_aLinearPos.getY(), other.m_aLinearPos.getY(), 8) + && m_nOrigWidth == other.m_nOrigWidth && m_nCharPos == other.m_nCharPos + && m_nXOffset == other.m_nXOffset && m_nYOffset == other.m_nYOffset + && m_nNewWidth == other.m_nNewWidth && m_aGlyphId == other.m_aGlyphId + && m_nCharCount == other.m_nCharCount + && (m_nFlags & ~GlyphItemFlags::IS_UNSAFE_TO_BREAK) + == (other.m_nFlags & ~GlyphItemFlags::IS_UNSAFE_TO_BREAK); + } +}; + +bool GlyphItem::GetGlyphBoundRect(const LogicalFontInstance* pFontInstance, + tools::Rectangle& rRect) const +{ + return pFontInstance->GetGlyphBoundRect(m_aGlyphId, rRect, IsVertical()); +} + +bool GlyphItem::GetGlyphOutline(const LogicalFontInstance* pFontInstance, + basegfx::B2DPolyPolygon& rPoly) const +{ + return pFontInstance->GetGlyphOutline(m_aGlyphId, rPoly, IsVertical()); +} + +void GlyphItem::dropGlyph() +{ + m_nCharPos = -1; + m_nFlags |= GlyphItemFlags::IS_DROPPED; +} + +class SalLayoutGlyphsImpl : public std::vector<GlyphItem> +{ +public: + SalLayoutGlyphsImpl(LogicalFontInstance& rFontInstance) + : m_rFontInstance(&rFontInstance) + { + } + SalLayoutGlyphsImpl* clone() const; + SalLayoutGlyphsImpl* cloneCharRange(sal_Int32 index, sal_Int32 length) const; + const rtl::Reference<LogicalFontInstance>& GetFont() const { return m_rFontInstance; } + bool IsValid() const; + void SetFlags(SalLayoutFlags flags) { mnFlags = flags; } + SalLayoutFlags GetFlags() const { return mnFlags; } +#ifdef DBG_UTIL + bool isLayoutEquivalent(const SalLayoutGlyphsImpl* other) const; +#endif + +private: + bool isSafeToBreak(const_iterator pos, bool rtl) const; + rtl::Reference<LogicalFontInstance> m_rFontInstance; + SalLayoutFlags mnFlags = SalLayoutFlags::NONE; +}; + +#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 0000000000..2e2b00640a --- /dev/null +++ b/vcl/inc/impgraph.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 . + */ + +#pragma once + +#include <vcl/dllapi.h> +#include <vcl/GraphicExternalLink.hxx> +#include <vcl/gdimtf.hxx> +#include <vcl/graph.hxx> +#include "graphic/Manager.hxx" +#include "graphic/GraphicID.hxx" +#include <optional> + +struct ImpSwapInfo +{ + MapMode maPrefMapMode; + Size maPrefSize; + Size maSizePixel; + + bool mbIsAnimated; + bool mbIsEPS; + bool mbIsTransparent; + bool mbIsAlpha; + + sal_uInt32 mnAnimationLoopCount; + sal_Int32 mnPageIndex; +}; + +class OutputDevice; +class GfxLink; +class ImpSwapFile; +class GraphicConversionParameters; +class ImpGraphic; +namespace rtl { class OStringBuffer; } + +enum class GraphicContentType : sal_Int32 +{ + Bitmap, + Animation, + Vector +}; + +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::optional<GraphicID> mxGraphicID; + GraphicExternalLink maGraphicExternalLink; + + std::chrono::high_resolution_clock::time_point maLastUsed; + bool mbPrepared; + +public: + ImpGraphic(); + ImpGraphic( const ImpGraphic& rImpGraphic ); + ImpGraphic( ImpGraphic&& rImpGraphic ) noexcept; + ImpGraphic( GraphicExternalLink aExternalLink); + ImpGraphic(std::shared_ptr<GfxLink> xGfxLink, sal_Int32 nPageIndex = 0); + ImpGraphic( const BitmapEx& rBmpEx ); + ImpGraphic(const std::shared_ptr<VectorGraphicData>& rVectorGraphicDataPtr); + ImpGraphic( const Animation& rAnimation ); + ImpGraphic( const GDIMetaFile& rMtf ); + ~ImpGraphic(); + + void setPrepared(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 (!mxGraphicID) + mxGraphicID.emplace(*this); + return mxGraphicID->getIDString(); + } + + void createSwapInfo(); + void restoreFromSwapInfo(); + + void clearGraphics(); + void clear(); + + GraphicType getType() const { return meType;} + void setDefaultType(); + bool isSupportedGraphic() const; + + bool isTransparent() const; + bool isAlpha() const; + bool isAnimated() const; + bool isEPS() const; + + bool isAvailable() const; + bool makeAvailable(); + + Bitmap getBitmap(const GraphicConversionParameters& rParameters) const; + BitmapEx getBitmapEx(const GraphicConversionParameters& rParameters) const; + /// Gives direct access to the contained BitmapEx. + const BitmapEx& getBitmapExRef() const; + Animation getAnimation() const; + const GDIMetaFile& getGDIMetaFile() const; + + Size getSizePixel() const; + + Size getPrefSize() const; + void setPrefSize( const Size& rPrefSize ); + + MapMode getPrefMapMode() const; + void setPrefMapMode( const MapMode& rPrefMapMode ); + + sal_uLong getSizeBytes() const; + + void draw(OutputDevice& rOutDev, const Point& rDestPt) const; + void draw(OutputDevice& rOutDev, const Point& rDestPt, + const Size& rDestSize) const; + + void startAnimation(OutputDevice& rOutDev, + const Point& rDestPt, + const Size& rDestSize, + tools::Long nRendererId, + OutputDevice* pFirstFrameOutDev); + void stopAnimation( const OutputDevice* pOutputDevice, + tools::Long nRendererId ); + + void setAnimationNotifyHdl( const Link<Animation*,void>& rLink ); + Link<Animation*,void> getAnimationNotifyHdl() const; + + sal_uInt32 getAnimationLoopCount() const; + +private: + // swapping methods + bool swapInFromStream(SvStream& rStream); + bool swapInGraphic(SvStream& rStream); + + bool swapInContent(SvStream& rStream); + bool swapOutContent(SvStream& rStream); + bool swapOutGraphic(SvStream& rStream); + // end swapping + + std::shared_ptr<GraphicReader>& getContext() { return mpContext;} + void setContext( const std::shared_ptr<GraphicReader>& pReader ); + void setDummyContext( bool value ) { mbDummyContext = value; } + bool isDummyContext() const { return mbDummyContext; } + void setGfxLink( const std::shared_ptr<GfxLink>& ); + const std::shared_ptr<GfxLink> & getSharedGfxLink() const; + GfxLink getGfxLink() const; + bool isGfxLink() const; + + BitmapChecksum getChecksum() const; + + const std::shared_ptr<VectorGraphicData>& getVectorGraphicData() const; + + /// Gets the bitmap replacement for a vector graphic. + BitmapEx getVectorGraphicReplacement() const; + + bool ensureAvailable () const; + + sal_Int32 getPageNumber() const; + + // Set the pref size, but don't force swap-in + void setValuesForPrefSize(const Size& rPrefSize); + // Set the pref map mode, but don't force swap-in + void setValuesForPrefMapMod(const MapMode& rPrefMapMode); + +public: + void resetChecksum() { mnChecksum = 0; } + bool swapIn(); + bool swapOut(); + bool isSwappedOut() const { return mbSwapOut; } + SvStream* getSwapFileStream() const; + // public only because of use in GraphicFilter + void updateFromLoadedGraphic(const ImpGraphic* graphic); + void dumpState(rtl::OStringBuffer &rState); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/implimagetree.hxx b/vcl/inc/implimagetree.hxx new file mode 100644 index 0000000000..beecb233e1 --- /dev/null +++ b/vcl/inc/implimagetree.hxx @@ -0,0 +1,169 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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; +} + +namespace com::sun::star::io { + class XInputStream; +} + +struct ImageRequestParameters +{ + OUString msName; + OUString msStyle; + BitmapEx& mrBitmap; + bool mbLocalized; + ImageLoadFlags meFlags; + bool mbWriteImageToCache; + sal_Int32 mnScalePercentage; + + ImageRequestParameters(OUString aName, OUString aStyle, BitmapEx& rBitmap, bool bLocalized, + ImageLoadFlags eFlags, sal_Int32 nScalePercentage) + : msName(std::move(aName)) + , msStyle(std::move(aStyle)) + , 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); + + css::uno::Reference<css::io::XInputStream> getImageXInputStream(OUString const & rName, + OUString const & rStyle, OUString const & rLang); + + 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, 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() + { + maLinkHash.reserve(50); + } + + IconSet(OUString aURL) + : maURL(std::move(aURL)) + { + maLinkHash.reserve(50); + } + }; + + /// 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(std::u16string_view 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 0000000000..63182bcd0c --- /dev/null +++ b/vcl/inc/ios/iosinst.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_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 SystemFontList; + +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(AbsoluteScreenPixelRectangle& rRect); + SalFrame* CreateFrame(SalFrame* pParent, SalFrameStyleFlags nStyle) override; + SalFrame* CreateChildFrame(SystemParentData* pParent, SalFrameStyleFlags nStyle) override; +}; + +class SalData +{ +public: + std::unique_ptr<SystemFontList> mpFontList; + CGColorSpaceRef mxRGBSpace; + CGColorSpaceRef mxGraySpace; + + static void ensureThreadAutoreleasePool(){}; + + explicit SalData(); + virtual ~SalData(); +}; + +#endif // INCLUDED_VCL_INC_IOS_IOSINST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/jobdata.hxx b/vcl/inc/jobdata.hxx new file mode 100644 index 0000000000..46110057a8 --- /dev/null +++ b/vcl/inc/jobdata.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_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_nColorDevice; // 0: no override, -1 grey scale, +1 color + 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_nColorDevice( 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 ); + + // creates a new buffer using new + // it is up to the user to delete it again + bool getStreamBuffer( std::unique_ptr<sal_uInt8[]>& 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 0000000000..7c0d0b55a4 --- /dev/null +++ b/vcl/inc/jobset.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_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> +#include <memory> + +// 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 + tools::Long mnPaperWidth; //< paper width (100th mm) + tools::Long mnPaperHeight; //< paper height (100th mm) + sal_uInt32 mnDriverDataLen; //< length of system specific data + std::unique_ptr<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); + + tools::Long GetPaperWidth() const { return mnPaperWidth; } + void SetPaperWidth(tools::Long nWidth); + + tools::Long GetPaperHeight() const { return mnPaperHeight; } + void SetPaperHeight(tools::Long nHeight); + + sal_uInt32 GetDriverDataLen() const { return mnDriverDataLen; } + const sal_uInt8* GetDriverData() const { return mpDriverData.get(); } + void SetDriverData(std::unique_ptr<sal_uInt8[]> pDriverData, sal_uInt32 nDriverDataLen); + + 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/enabled.hxx b/vcl/inc/jsdialog/enabled.hxx new file mode 100644 index 0000000000..6354b70a8d --- /dev/null +++ b/vcl/inc/jsdialog/enabled.hxx @@ -0,0 +1,22 @@ +/* -*- 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 <string_view> + +namespace jsdialog +{ +bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile); +bool isBuilderEnabledForPopup(std::u16string_view rUIFile); +bool isBuilderEnabledForSidebar(std::u16string_view rUIFile); +bool isInterimBuilderEnabledForNotebookbar(std::u16string_view rUIFile); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx new file mode 100644 index 0000000000..6e611c4f96 --- /dev/null +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -0,0 +1,894 @@ +/* -*- 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 <utility> +#include <vcl/weld.hxx> +#include <vcl/jsdialog/executor.hxx> +#include <vcl/virdev.hxx> +#include <salvtables.hxx> +#include <vcl/toolkit/button.hxx> +#include <vcl/toolkit/fmtfield.hxx> + +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp> +#include <comphelper/compbase.hxx> + +#include <deque> +#include <list> +#include <mutex> + +#define ACTION_TYPE "action_type" +#define PARENT_ID "parent_id" +#define WINDOW_ID "id" +#define CLOSE_ID "close_id" + +class ToolBox; +class ComboBox; +class VclMultiLineEdit; +class SvTabListBox; +class IconView; +class VclScrolledWindow; + +namespace vcl +{ +class ILibreOfficeKitNotifier; +} + +typedef std::map<OUString, weld::Widget*> WidgetMap; + +namespace jsdialog +{ +enum MessageType +{ + FullUpdate, + WidgetUpdate, + Close, + Action, + Popup, + PopupClose +}; +} + +/// Class with the message description for storing in the queue +class JSDialogMessageInfo +{ +public: + jsdialog::MessageType m_eType; + VclPtr<vcl::Window> m_pWindow; + std::unique_ptr<jsdialog::ActionDataMap> m_pData; + +private: + void copy(const JSDialogMessageInfo& rInfo) + { + this->m_eType = rInfo.m_eType; + this->m_pWindow = rInfo.m_pWindow; + if (rInfo.m_pData) + { + std::unique_ptr<jsdialog::ActionDataMap> pData( + new jsdialog::ActionDataMap(*rInfo.m_pData)); + this->m_pData = std::move(pData); + } + } + +public: + JSDialogMessageInfo(jsdialog::MessageType eType, VclPtr<vcl::Window> pWindow, + std::unique_ptr<jsdialog::ActionDataMap> pData) + : m_eType(eType) + , m_pWindow(std::move(pWindow)) + , m_pData(std::move(pData)) + { + } + + JSDialogMessageInfo(const JSDialogMessageInfo& rInfo) { copy(rInfo); } + + JSDialogMessageInfo& operator=(JSDialogMessageInfo aInfo) + { + if (this == &aInfo) + return *this; + + copy(aInfo); + return *this; + } +}; + +class JSDialogNotifyIdle final : public Idle +{ + // used to send message + VclPtr<vcl::Window> m_aNotifierWindow; + // used to generate JSON + VclPtr<vcl::Window> m_aContentWindow; + OUString m_sTypeOfJSON; + OString m_LastNotificationMessage; + bool m_bForce; + + std::deque<JSDialogMessageInfo> m_aMessageQueue; + std::mutex m_aQueueMutex; + +public: + JSDialogNotifyIdle(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow, + const OUString& sTypeOfJSON); + + void Invoke() override; + + void clearQueue(); + void forceUpdate(); + void sendMessage(jsdialog::MessageType eType, VclPtr<vcl::Window> pWindow, + std::unique_ptr<jsdialog::ActionDataMap> pData = nullptr); + +private: + void send(tools::JsonWriter& aJsonWriter); + std::unique_ptr<tools::JsonWriter> generateFullUpdate() const; + std::unique_ptr<tools::JsonWriter> generateWidgetUpdate(VclPtr<vcl::Window> pWindow) const; + std::unique_ptr<tools::JsonWriter> generateCloseMessage() const; + std::unique_ptr<tools::JsonWriter> + generateActionMessage(VclPtr<vcl::Window> pWindow, + std::unique_ptr<jsdialog::ActionDataMap> pData) const; + std::unique_ptr<tools::JsonWriter> + generatePopupMessage(VclPtr<vcl::Window> pWindow, OUString sParentId, OUString sCloseId) const; + std::unique_ptr<tools::JsonWriter> generateClosePopupMessage(OUString sWindowId) const; +}; + +class JSDialogSender +{ + std::unique_ptr<JSDialogNotifyIdle> mpIdleNotify; + +protected: + bool m_bCanClose; // specifies if can send a close message + +public: + JSDialogSender() + : m_bCanClose(true) + { + } + JSDialogSender(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow, + const OUString& sTypeOfJSON) + : m_bCanClose(true) + { + initializeSender(aNotifierWindow, aContentWindow, sTypeOfJSON); + } + + virtual ~JSDialogSender() COVERITY_NOEXCEPT_FALSE; + + virtual void sendFullUpdate(bool bForce = false); + void sendClose(); + void sendUpdate(VclPtr<vcl::Window> pWindow, bool bForce = false); + virtual void sendAction(VclPtr<vcl::Window> pWindow, + std::unique_ptr<jsdialog::ActionDataMap> pData); + virtual void sendPopup(VclPtr<vcl::Window> pWindow, OUString sParentId, OUString sCloseId); + virtual void sendClosePopup(vcl::LOKWindowId nWindowId); + void flush() { mpIdleNotify->Invoke(); } + +protected: + void initializeSender(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow, + const OUString& sTypeOfJSON) + { + mpIdleNotify.reset(new JSDialogNotifyIdle(aNotifierWindow, aContentWindow, sTypeOfJSON)); + } +}; + +class JSDropTarget final + : public comphelper::WeakComponentImplHelper< + css::datatransfer::dnd::XDropTarget, css::lang::XInitialization, css::lang::XServiceInfo> +{ + std::vector<css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>> m_aListeners; + +public: + JSDropTarget(); + + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArgs) override; + + // 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_drop(const css::datatransfer::dnd::DropTargetDropEvent& dtde); + + void fire_dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent& dtde); +}; + +class JSInstanceBuilder final : public SalInstanceBuilder, public JSDialogSender +{ + sal_uInt64 m_nWindowId; + /// used in case of tab pages where dialog is not a direct top level + VclPtr<vcl::Window> m_aParentDialog; + VclPtr<vcl::Window> m_aContentWindow; + std::list<OUString> m_aRememberedWidgets; + OUString m_sTypeOfJSON; + bool m_bHasTopLevelDialog; + bool m_bIsNotebookbar; + /// used to detect when we have to send Full Update in container handler + bool m_bSentInitialUpdate; + /// is true for tabpages, prevents from closing parent window on destroy + bool m_bIsNestedBuilder; + /// When LOKNotifier is set by jsdialogs code we need to release it + VclPtr<vcl::Window> m_aWindowToRelease; + + friend class JSMessageDialog; // static message boxes have to be registered outside + friend class JSDialog; + friend class JSAssistant; + + friend VCL_DLLPUBLIC bool jsdialog::ExecuteAction(const OUString& nWindowId, + const OUString& rWidget, StringMap& rData); + friend VCL_DLLPUBLIC void jsdialog::SendFullUpdate(const OUString& nWindowId, + const OUString& rWidget); + friend VCL_DLLPUBLIC void jsdialog::SendAction(const OUString& nWindowId, + const OUString& rWidget, + std::unique_ptr<jsdialog::ActionDataMap> pData); + + static std::map<OUString, WidgetMap>& GetLOKWeldWidgetsMap(); + static void InsertWindowToMap(const OUString& nWindowId); + void RememberWidget(OUString id, weld::Widget* pWidget); + static void RememberWidget(const OUString& nWindowId, const OUString& id, + weld::Widget* pWidget); + static weld::Widget* FindWeldWidgetsMap(const OUString& nWindowId, const OUString& rWidget); + + OUString getMapIdFromWindowId() const; + +public: + /// used for dialogs or popups + JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile, + bool bPopup = false); + /// used for sidebar panels + JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile, + sal_uInt64 nLOKWindowId); + /// used for notebookbar, optional nWindowId is used if getting parent id failed + JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, + const css::uno::Reference<css::frame::XFrame>& rFrame, + sal_uInt64 nWindowId = 0); + /// used for formulabar + JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, + sal_uInt64 nLOKWindowId); + + static std::unique_ptr<JSInstanceBuilder> + CreateDialogBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile); + static std::unique_ptr<JSInstanceBuilder> + CreateNotebookbarBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, + const css::uno::Reference<css::frame::XFrame>& rFrame, + sal_uInt64 nWindowId = 0); + static std::unique_ptr<JSInstanceBuilder> CreateSidebarBuilder(weld::Widget* pParent, + const OUString& rUIRoot, + const OUString& rUIFile, + sal_uInt64 nLOKWindowId = 0); + static std::unique_ptr<JSInstanceBuilder> + CreatePopupBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile); + static std::unique_ptr<JSInstanceBuilder> CreateFormulabarBuilder(vcl::Window* pParent, + const OUString& rUIRoot, + const OUString& rUIFile, + sal_uInt64 nLOKWindowId); + + virtual ~JSInstanceBuilder() override; + virtual std::unique_ptr<weld::MessageDialog> weld_message_dialog(const OUString& id) override; + virtual std::unique_ptr<weld::Dialog> weld_dialog(const OUString& id) override; + virtual std::unique_ptr<weld::Assistant> weld_assistant(const OUString& id) override; + virtual std::unique_ptr<weld::Container> weld_container(const OUString& id) override; + virtual std::unique_ptr<weld::Label> weld_label(const OUString& id) override; + virtual std::unique_ptr<weld::Button> weld_button(const OUString& id) override; + virtual std::unique_ptr<weld::LinkButton> weld_link_button(const OUString& id) override; + virtual std::unique_ptr<weld::ToggleButton> weld_toggle_button(const OUString& id) override; + virtual std::unique_ptr<weld::Entry> weld_entry(const OUString& id) override; + virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OUString& id) override; + virtual std::unique_ptr<weld::Notebook> weld_notebook(const OUString& id) override; + virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OUString& id) override; + virtual std::unique_ptr<weld::FormattedSpinButton> + weld_formatted_spin_button(const OUString& id) override; + virtual std::unique_ptr<weld::CheckButton> weld_check_button(const OUString& id) override; + virtual std::unique_ptr<weld::DrawingArea> + weld_drawing_area(const OUString& id, const a11yref& rA11yImpl = nullptr, + FactoryFunction pUITestFactoryFunction = nullptr, + void* pUserData = nullptr) override; + virtual std::unique_ptr<weld::Toolbar> weld_toolbar(const OUString& id) override; + virtual std::unique_ptr<weld::TextView> weld_text_view(const OUString& id) override; + virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OUString& id) override; + virtual std::unique_ptr<weld::Expander> weld_expander(const OUString& id) override; + virtual std::unique_ptr<weld::IconView> weld_icon_view(const OUString& id) override; + virtual std::unique_ptr<weld::ScrolledWindow> + weld_scrolled_window(const OUString& id, bool bUserManagedScrolling = false) override; + virtual std::unique_ptr<weld::RadioButton> weld_radio_button(const OUString& id) override; + virtual std::unique_ptr<weld::Frame> weld_frame(const OUString& id) override; + virtual std::unique_ptr<weld::MenuButton> weld_menu_button(const OUString& id) override; + virtual std::unique_ptr<weld::Popover> weld_popover(const OUString& id) override; + virtual std::unique_ptr<weld::Box> weld_box(const OUString& id) override; + virtual std::unique_ptr<weld::Widget> weld_widget(const OUString& id) override; + virtual std::unique_ptr<weld::Image> weld_image(const OUString& id) override; + virtual std::unique_ptr<weld::Calendar> weld_calendar(const OUString& id) override; + + static weld::MessageDialog* + CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, + VclButtonsType eButtonType, const OUString& rPrimaryMessage, + const vcl::ILibreOfficeKitNotifier* pNotifier = nullptr); + + static void AddChildWidget(const OUString& nWindowId, const OUString& id, + weld::Widget* pWidget); + static void RemoveWindowWidget(const OUString& nWindowId); + + // we need to remember original popup window to close it properly (its handled by vcl) + static void RememberPopup(const OUString& nWindowId, VclPtr<vcl::Window> pWidget); + static void ForgetPopup(const OUString& nWindowId); + static vcl::Window* FindPopup(const OUString& nWindowId); + +private: + const OUString& GetTypeOfJSON() const; + VclPtr<vcl::Window>& GetContentWindow(); + VclPtr<vcl::Window>& GetNotifierWindow(); +}; + +class SAL_LOPLUGIN_ANNOTATE("crosscast") BaseJSWidget +{ +public: + virtual ~BaseJSWidget() = default; + + virtual void sendClose() = 0; + + virtual void sendUpdate(bool bForce = false) = 0; + + virtual void sendFullUpdate(bool bForce = false) = 0; + + virtual void sendAction(std::unique_ptr<jsdialog::ActionDataMap> pData) = 0; + + virtual void sendPopup(vcl::Window* pPopup, OUString sParentId, OUString sCloseId) = 0; + + virtual void sendClosePopup(vcl::LOKWindowId nWindowId) = 0; +}; + +template <class BaseInstanceClass, class VclClass> +class JSWidget : public BaseInstanceClass, public BaseJSWidget +{ +protected: + rtl::Reference<JSDropTarget> m_xDropTarget; + bool m_bIsFreezed; + + JSDialogSender* m_pSender; + +public: + JSWidget(JSDialogSender* pSender, VclClass* pObject, SalInstanceBuilder* pBuilder, + bool bTakeOwnership) + : BaseInstanceClass(pObject, pBuilder, bTakeOwnership) + , m_bIsFreezed(false) + , m_pSender(pSender) + { + } + + JSWidget(JSDialogSender* pSender, VclClass* pObject, SalInstanceBuilder* pBuilder, + bool bTakeOwnership, bool bUserManagedScrolling) + : BaseInstanceClass(pObject, pBuilder, bTakeOwnership, bUserManagedScrolling) + , m_bIsFreezed(false) + , m_pSender(pSender) + { + } + + JSWidget(JSDialogSender* pSender, VclClass* pObject, SalInstanceBuilder* pBuilder, + const a11yref& rAlly, FactoryFunction pUITestFactoryFunction, void* pUserData, + bool bTakeOwnership) + : BaseInstanceClass(pObject, pBuilder, rAlly, pUITestFactoryFunction, pUserData, + bTakeOwnership) + , m_bIsFreezed(false) + , m_pSender(pSender) + { + } + + virtual void show() override + { + bool bWasVisible = BaseInstanceClass::get_visible(); + BaseInstanceClass::show(); + if (!bWasVisible) + { + std::unique_ptr<jsdialog::ActionDataMap> pMap + = std::make_unique<jsdialog::ActionDataMap>(); + (*pMap)[ACTION_TYPE ""_ostr] = "show"; + sendAction(std::move(pMap)); + } + } + + virtual void hide() override + { + bool bWasVisible = BaseInstanceClass::get_visible(); + BaseInstanceClass::hide(); + if (bWasVisible) + { + std::unique_ptr<jsdialog::ActionDataMap> pMap + = std::make_unique<jsdialog::ActionDataMap>(); + (*pMap)[ACTION_TYPE ""_ostr] = "hide"; + sendAction(std::move(pMap)); + } + } + + using BaseInstanceClass::set_sensitive; + virtual void set_sensitive(bool sensitive) override + { + bool bIsSensitive = BaseInstanceClass::get_sensitive(); + BaseInstanceClass::set_sensitive(sensitive); + if (bIsSensitive != sensitive) + sendUpdate(); + } + + virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> get_drop_target() override + { + if (!m_xDropTarget) + m_xDropTarget.set(new JSDropTarget); + + return m_xDropTarget; + } + + virtual void freeze() override + { + BaseInstanceClass::freeze(); + m_bIsFreezed = true; + } + + virtual void thaw() override + { + BaseInstanceClass::thaw(); + m_bIsFreezed = false; + sendUpdate(); + } + + virtual void grab_focus() override + { + BaseInstanceClass::grab_focus(); + std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); + (*pMap)[ACTION_TYPE ""_ostr] = "grab_focus"; + sendAction(std::move(pMap)); + } + + virtual void sendClose() override + { + if (m_pSender) + m_pSender->sendClose(); + } + + virtual void sendUpdate(bool bForce = false) override + { + if (!m_bIsFreezed && m_pSender) + m_pSender->sendUpdate(BaseInstanceClass::m_xWidget, bForce); + } + + virtual void sendFullUpdate(bool bForce = false) override + { + if ((!m_bIsFreezed || bForce) && m_pSender) + m_pSender->sendFullUpdate(bForce); + } + + virtual void sendAction(std::unique_ptr<jsdialog::ActionDataMap> pData) override + { + if (!m_bIsFreezed && m_pSender && pData) + m_pSender->sendAction(BaseInstanceClass::m_xWidget, std::move(pData)); + } + + virtual void sendPopup(vcl::Window* pPopup, OUString sParentId, OUString sCloseId) override + { + if (!m_bIsFreezed && m_pSender) + m_pSender->sendPopup(pPopup, sParentId, sCloseId); + } + + virtual void sendClosePopup(vcl::LOKWindowId nWindowId) override + { + if (!m_bIsFreezed && m_pSender) + m_pSender->sendClosePopup(nWindowId); + } + + virtual void set_buildable_name(const OUString& rName) override + { + SalInstanceWidget::set_buildable_name(rName); + assert(false); // we remember old name in GetLOKWeldWidgetsMap() + // TODO: implement renaming or avoid it for LOK + } +}; + +class JSDialog final : public JSWidget<SalInstanceDialog, ::Dialog> +{ +public: + JSDialog(JSDialogSender* pSender, ::Dialog* pDialog, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual void collapse(weld::Widget* pEdit, weld::Widget* pButton) override; + virtual void undo_collapse() override; + virtual void response(int response) override; + virtual weld::Button* weld_widget_for_response(int response) override; + virtual int run() override; + 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)>& func) override; +}; + +class JSAssistant final : public JSWidget<SalInstanceAssistant, vcl::RoadmapWizard> +{ +public: + JSAssistant(JSDialogSender* pSender, vcl::RoadmapWizard* pDialog, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual void set_current_page(int nPage) override; + virtual void set_current_page(const OUString& rIdent) override; + virtual void response(int response) override; + virtual weld::Button* weld_widget_for_response(int response) override; + virtual int run() override; + 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)>& func) override; +}; + +class JSContainer final : public JSWidget<SalInstanceContainer, vcl::Window> +{ +public: + JSContainer(JSDialogSender* pSender, vcl::Window* pContainer, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); +}; + +class JSScrolledWindow final : public JSWidget<SalInstanceScrolledWindow, ::VclScrolledWindow> +{ +public: + JSScrolledWindow(JSDialogSender* pSender, ::VclScrolledWindow* pWindow, + SalInstanceBuilder* pBuilder, bool bTakeOwnership, bool bUserManagedScrolling); + + virtual void vadjustment_configure(int value, int lower, int upper, int step_increment, + int page_increment, int page_size) override; + virtual void vadjustment_set_value(int value) override; + void vadjustment_set_value_no_notification(int value); + virtual void vadjustment_set_page_size(int size) override; + virtual void set_vpolicy(VclPolicyType eVPolicy) override; + + virtual void hadjustment_configure(int value, int lower, int upper, int step_increment, + int page_increment, int page_size) override; + virtual void hadjustment_set_value(int value) override; + void hadjustment_set_value_no_notification(int value); + virtual void hadjustment_set_page_size(int size) override; + virtual void set_hpolicy(VclPolicyType eVPolicy) override; +}; + +class JSLabel final : public JSWidget<SalInstanceLabel, Control> +{ +public: + JSLabel(JSDialogSender* pSender, Control* pLabel, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + virtual void set_label(const OUString& rText) override; +}; + +class JSButton final : public JSWidget<SalInstanceButton, ::Button> +{ +public: + JSButton(JSDialogSender* pSender, ::Button* pButton, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); +}; + +class JSLinkButton final : public JSWidget<SalInstanceLinkButton, ::FixedHyperlink> +{ +public: + JSLinkButton(JSDialogSender* pSender, ::FixedHyperlink* pButton, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); +}; + +class JSToggleButton final : public JSWidget<SalInstanceToggleButton, ::PushButton> +{ +public: + JSToggleButton(JSDialogSender* pSender, ::PushButton* pButton, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); +}; + +class JSEntry final : public JSWidget<SalInstanceEntry, ::Edit> +{ +public: + JSEntry(JSDialogSender* pSender, ::Edit* pEntry, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + virtual void set_text(const OUString& rText) override; + void set_text_without_notify(const OUString& rText); + virtual void replace_selection(const OUString& rText) override; +}; + +class JSListBox final : public JSWidget<SalInstanceComboBoxWithoutEdit, ::ListBox> +{ +public: + JSListBox(JSDialogSender* pSender, ::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; + virtual void set_active(int pos) override; +}; + +class JSComboBox final : public JSWidget<SalInstanceComboBoxWithEdit, ::ComboBox> +{ +public: + JSComboBox(JSDialogSender* pSender, ::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_without_notify(const OUString& rText); + virtual void set_entry_text(const OUString& rText) override; + virtual void set_active(int pos) override; + virtual void set_active_id(const OUString& rText) override; + virtual bool changed_by_direct_pick() const override; + + void render_entry(int pos, int dpix, int dpiy); +}; + +class JSNotebook final : public JSWidget<SalInstanceNotebook, ::TabControl> +{ +public: + JSNotebook(JSDialogSender* pSender, ::TabControl* pControl, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual void remove_page(const OUString& rIdent) override; + virtual void insert_page(const OUString& rIdent, const OUString& rLabel, int nPos) override; +}; + +class JSVerticalNotebook final : public JSWidget<SalInstanceVerticalNotebook, ::VerticalTabControl> +{ +public: + JSVerticalNotebook(JSDialogSender* pSender, ::VerticalTabControl* pControl, + SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void remove_page(const OUString& rIdent) override; + virtual void insert_page(const OUString& rIdent, const OUString& rLabel, int nPos) override; +}; + +class JSSpinButton final : public JSWidget<SalInstanceSpinButton, ::FormattedField> +{ +public: + JSSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual void set_value(sal_Int64 value) override; +}; + +class JSFormattedSpinButton final + : public JSWidget<SalInstanceFormattedSpinButton, ::FormattedField> +{ +public: + JSFormattedSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin, + SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void set_text(const OUString& rText) override; + void set_text_without_notify(const OUString& rText); +}; + +class JSMessageDialog final : public JSWidget<SalInstanceMessageDialog, ::MessageDialog> +{ + std::unique_ptr<JSDialogSender> m_pOwnedSender; + std::unique_ptr<JSButton> m_pOK; + std::unique_ptr<JSButton> m_pCancel; + + // used for message dialogs created using static functions + OUString m_sWindowId; + + DECL_LINK(OKHdl, weld::Button&, void); + DECL_LINK(CancelHdl, weld::Button&, void); + + void RememberMessageDialog(); + +public: + JSMessageDialog(JSDialogSender* pSender, ::MessageDialog* pDialog, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + JSMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + virtual ~JSMessageDialog(); + + virtual void set_primary_text(const OUString& rText) override; + + virtual void set_secondary_text(const OUString& rText) override; + + virtual void response(int response) override; + + virtual int run() override; + // TODO: move to dialog class so we will not send json when built but on run + bool runAsync(std::shared_ptr<weld::DialogController> aOwner, + const std::function<void(sal_Int32)>& rEndDialogFn) override; + + bool runAsync(std::shared_ptr<Dialog> const& rxSelf, + const std::function<void(sal_Int32)>& rEndDialogFn) override; +}; + +class JSCheckButton final : public JSWidget<SalInstanceCheckButton, ::CheckBox> +{ +public: + JSCheckButton(JSDialogSender* pSender, ::CheckBox* pCheckBox, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual void set_active(bool active) override; +}; + +class JSDrawingArea final : public JSWidget<SalInstanceDrawingArea, VclDrawingArea> +{ +public: + JSDrawingArea(JSDialogSender* pSender, VclDrawingArea* pDrawingArea, + SalInstanceBuilder* pBuilder, const a11yref& rAlly, + FactoryFunction pUITestFactoryFunction, void* pUserData); + + virtual void queue_draw() override; + virtual void queue_draw_area(int x, int y, int width, int height) override; +}; + +class JSToolbar final : public JSWidget<SalInstanceToolbar, ::ToolBox> +{ + std::map<sal_uInt16, weld::Widget*> m_pPopovers; + +public: + JSToolbar(JSDialogSender* pSender, ::ToolBox* pToolbox, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual void set_menu_item_active(const OUString& rIdent, bool bActive) override; + virtual void set_item_sensitive(const OUString& rIdent, bool bSensitive) override; + virtual void set_item_icon_name(const OUString& rIdent, const OUString& rIconName) override; +}; + +class JSTextView final : public JSWidget<SalInstanceTextView, ::VclMultiLineEdit> +{ +public: + JSTextView(JSDialogSender* pSender, ::VclMultiLineEdit* pTextView, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + virtual void set_text(const OUString& rText) override; + void set_text_without_notify(const OUString& rText); + virtual void replace_selection(const OUString& rText) override; +}; + +class JSTreeView final : public JSWidget<SalInstanceTreeView, ::SvTabListBox> +{ +public: + JSTreeView(JSDialogSender* pSender, ::SvTabListBox* pTextView, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + using SalInstanceTreeView::set_toggle; + /// pos is used differently here, it defines how many steps of iterator we need to perform to take entry + virtual void set_toggle(int pos, TriState eState, int col = -1) override; + virtual void set_toggle(const weld::TreeIter& rIter, TriState bOn, int col = -1) override; + + using SalInstanceTreeView::select; + /// pos is used differently here, it defines how many steps of iterator we need to perform to take entry + virtual void select(int pos) override; + + virtual weld::TreeView* get_drag_source() const override; + + using SalInstanceTreeView::insert; + virtual void insert(const weld::TreeIter* pParent, int pos, const OUString* pStr, + const OUString* pId, const OUString* pIconName, + VirtualDevice* pImageSurface, bool bChildrenOnDemand, + weld::TreeIter* pRet) override; + + virtual void set_text(int row, const OUString& rText, int col = -1) override; + virtual void set_text(const weld::TreeIter& rIter, const OUString& rStr, int col = -1) override; + + virtual void expand_row(const weld::TreeIter& rIter) override; + virtual void collapse_row(const weld::TreeIter& rIter) override; + + virtual void set_cursor(const weld::TreeIter& rIter) override; + void set_cursor_without_notify(const weld::TreeIter& rIter); + virtual void set_cursor(int pos) override; + + using SalInstanceTreeView::remove; + virtual void remove(int pos) override; + virtual void remove(const weld::TreeIter& rIter) override; + + virtual void clear() override; + + void drag_start(); + void drag_end(); +}; + +class JSExpander final : public JSWidget<SalInstanceExpander, ::VclExpander> +{ +public: + JSExpander(JSDialogSender* pSender, ::VclExpander* pExpander, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual void set_expanded(bool bExpand) override; +}; + +class JSIconView final : public JSWidget<SalInstanceIconView, ::IconView> +{ +public: + JSIconView(JSDialogSender* pSender, ::IconView* pIconView, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual void insert(int pos, const OUString* pStr, const OUString* pId, + const OUString* pIconName, weld::TreeIter* pRet) override; + + virtual void insert(int pos, const OUString* pStr, const OUString* pId, + const VirtualDevice* pIcon, weld::TreeIter* pRet) override; + + virtual void insert_separator(int pos, const OUString* pId) override; + + virtual void clear() override; + virtual void select(int pos) override; + virtual void unselect(int pos) override; +}; + +class JSRadioButton final : public JSWidget<SalInstanceRadioButton, ::RadioButton> +{ +public: + JSRadioButton(JSDialogSender* pSender, ::RadioButton* pRadioButton, + SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void set_active(bool active) override; +}; + +class JSFrame : public JSWidget<SalInstanceFrame, ::VclFrame> +{ +public: + JSFrame(JSDialogSender* pSender, ::VclFrame* pFrame, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); +}; + +class JSMenuButton : public JSWidget<SalInstanceMenuButton, ::MenuButton> +{ +public: + JSMenuButton(JSDialogSender* pSender, ::MenuButton* pMenuButton, 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_active(bool active) override; +}; + +class JSPopover : public JSWidget<SalInstancePopover, DockingWindow> +{ + vcl::LOKWindowId mnWindowId; + +public: + JSPopover(JSDialogSender* pSender, DockingWindow* pPopover, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual void popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect, + weld::Placement ePlace = weld::Placement::Under) override; + virtual void popdown() override; + + void set_window_id(vcl::LOKWindowId nWindowId) { mnWindowId = nWindowId; } +}; + +class JSBox : public JSWidget<SalInstanceBox, VclBox> +{ +public: + JSBox(JSDialogSender* pSender, VclBox* pBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + void reorder_child(weld::Widget* pWidget, int nNewPosition) override; +}; + +class JSWidgetInstance : public JSWidget<SalInstanceWidget, vcl::Window> +{ +public: + JSWidgetInstance(JSDialogSender* pSender, vcl::Window* pObject, SalInstanceBuilder* pBuilder, + bool bTakeOwnership) + : JSWidget<SalInstanceWidget, vcl::Window>(pSender, pObject, pBuilder, bTakeOwnership) + { + } +}; + +class JSImage : public JSWidget<SalInstanceImage, FixedImage> +{ +public: + JSImage(JSDialogSender* pSender, FixedImage* pImage, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + virtual void set_image(VirtualDevice* pDevice) override; + virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) override; +}; + +class JSCalendar : public JSWidget<SalInstanceCalendar, ::Calendar> +{ +public: + JSCalendar(JSDialogSender* pSender, ::Calendar* pCalendar, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/langboost.hxx b/vcl/inc/langboost.hxx new file mode 100644 index 0000000000..77553de05c --- /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 0000000000..8b37562971 --- /dev/null +++ b/vcl/inc/listbox.hxx @@ -0,0 +1,599 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <utility> +#include <vcl/glyphitem.hxx> +#include <vcl/toolkit/button.hxx> +#include <vcl/toolkit/floatwin.hxx> +#include <vcl/toolkit/lstbox.hxx> +#include <vcl/quickselectionengine.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; + tools::Long mnHeight; + + tools::Long getHeightWithMargin() const; + + ImplEntryType( OUString aStr, Image aImage ) : + maStr(std::move( aStr )), + maImage(std::move( aImage )), + mnFlags( ListBoxEntryFlags::NONE ), + mnHeight( 0 ) + { + mbIsSelected = false; + mpUserData = nullptr; + } + + ImplEntryType( OUString aStr ) : + maStr(std::move( aStr )), + 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(); + void dispose(); + + sal_Int32 FindMatchingEntry( const OUString& rStr, sal_Int32 nStart, bool bLazy ) const; + sal_Int32 FindEntry( std::u16string_view 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 ) + tools::Long GetAddedHeight( sal_Int32 nEndIndex, sal_Int32 nBeginIndex ) const; + tools::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 ) const; +}; + +class ImplListBoxWindow final : public Control, public vcl::ISearchableStringList +{ +private: + ImplEntryList maEntryList; ///< EntryList + tools::Rectangle maFocusRect; + + Size maUserItemSize; + + tools::Long mnMaxTxtHeight; ///< Maximum height of a text item + tools::Long mnMaxTxtWidth; ///< Maximum width of a text item + ///< Entry without Image + tools::Long mnMaxImgTxtWidth;///< Maximum width of a text item + ///< Entry AND Image + tools::Long mnMaxImgWidth; ///< Maximum width of an image item + tools::Long mnMaxImgHeight; ///< Maximum height of an image item + tools::Long mnMaxWidth; ///< Maximum width of an entry + tools::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 + tools::Long mnLeft; ///< output from column on + tools::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 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 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; + + 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; + + const ImplEntryList& GetEntryList() const { return maEntryList; } + ImplEntryList& GetEntryList() { return maEntryList; } + + 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; + + tools::Long GetLeftIndent() const { return mnLeft; } + void SetLeftIndent( tools::Long n ); + void ScrollHorz( tools::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 ) { mbMulti = bMulti; } + bool IsMultiSelectionEnabled() const { return mbMulti; } + + void SetMultiSelectionSimpleMode( bool bSimple ) { mbSimpleMode = bSimple; } + + void EnableMouseMoveSelect( bool bMouseMoveSelect ) { mbMouseMoveSelect = bMouseMoveSelect; } + bool IsMouseMoveSelect() const { return mbMouseMoveSelect; } + + Size CalcSize(sal_Int32 nMaxLines) const; + tools::Rectangle GetBoundingRectangle( sal_Int32 nItem ) const; + + tools::Long GetEntryHeight() const { return mnMaxHeight; } + tools::Long GetEntryHeightWithMargin() const; + tools::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; + + bool GetEdgeBlending() const { return mbEdgeBlending; } + void SetEdgeBlending(bool bNew) { mbEdgeBlending = bNew; } + + using Control::ImplInitSettings; + virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; + +private: + // 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 final : 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 + + 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, Control& rControl); + + /** + * 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 ); } + + tools::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 ) { maLBWindow->EnableMultiSelection( bMulti ); } + 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 ); } + tools::Long GetEntryHeight() const { return maLBWindow->GetEntryHeight(); } + tools::Long GetEntryHeightWithMargin() const{ return maLBWindow->GetEntryHeightWithMargin(); } + tools::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 SetHighlightColor(const Color& rColor); + void SetHighlightTextColor(const Color& rColor); + + void SetMRUEntries( std::u16string_view 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); +}; + +class ImplListBoxFloatingWindow final : public FloatingWindow +{ +private: + VclPtr<ImplListBox> mpImplLB; + Size maPrefSz; + sal_uInt16 mnDDLineCount; + sal_Int32 mnPopupModeStartSaveSelection; + bool mbAutoWidth; + + 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() const; + void StartFloat( bool bStartTracking ); + + virtual void setPosSizePixel( tools::Long nX, tools::Long nY, + tools::Long nWidth, tools::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 final : 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); + 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; + + 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 final : 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/managedmenubutton.hxx b/vcl/inc/managedmenubutton.hxx new file mode 100644 index 0000000000..0f6492b6fd --- /dev/null +++ b/vcl/inc/managedmenubutton.hxx @@ -0,0 +1,31 @@ +/* -*- 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/toolkit/menubtn.hxx> +#include <com/sun/star/awt/XPopupMenu.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> + +class ManagedMenuButton final : public MenuButton +{ +public: + ManagedMenuButton(vcl::Window* pParent, WinBits nStyle); + ~ManagedMenuButton() override; + + void dispose() override; + +private: + void PrepareExecute() override; + + css::uno::Reference<css::awt::XPopupMenu> m_xPopupMenu; + css::uno::Reference<css::frame::XPopupMenuController> m_xPopupController; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/menubarvalue.hxx b/vcl/inc/menubarvalue.hxx new file mode 100644 index 0000000000..0b9f0dbbec --- /dev/null +++ b/vcl/inc/menubarvalue.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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_MENUBARVALUE_HXX +#define INCLUDED_VCL_INC_MENUBARVALUE_HXX + +#include <vcl/salnativewidgets.hxx> + +/* MenubarValue: + * + * Value container for menubars specifying height of adjacent docking area + */ +class MenubarValue final : public ImplControlValue +{ +public: + MenubarValue() + : ImplControlValue(ControlType::Menubar, 0) + { + maTopDockingAreaHeight = 0; + } + virtual ~MenubarValue() override; + virtual MenubarValue* clone() const override; + MenubarValue(MenubarValue const&) = default; + MenubarValue(MenubarValue&&) = default; + MenubarValue& operator=(MenubarValue const&) = delete; // due to ImplControlValue + MenubarValue& operator=(MenubarValue&&) = delete; // due to ImplControlValue + int maTopDockingAreaHeight; +}; + +#endif // INCLUDED_VCL_INC_MENUBARVALUE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/menutogglebutton.hxx b/vcl/inc/menutogglebutton.hxx new file mode 100644 index 0000000000..c1b5aef544 --- /dev/null +++ b/vcl/inc/menutogglebutton.hxx @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <vcl/toolkit/menubtn.hxx> + +class MenuToggleButton final : public MenuButton +{ +public: + explicit MenuToggleButton(vcl::Window* pParent, WinBits nStyle); + virtual ~MenuToggleButton() override; + + void SetActive(bool bSel); + bool GetActive() const; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/messagedialog.hxx b/vcl/inc/messagedialog.hxx new file mode 100644 index 0000000000..9c265c0570 --- /dev/null +++ b/vcl/inc/messagedialog.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/. + */ + +#ifndef INCLUDED_VCL_INC_MESSAGEDIALOG_HXX +#define INCLUDED_VCL_INC_MESSAGEDIALOG_HXX + +#include <vcl/toolkit/dialog.hxx> +#include <vcl/toolkit/vclmedit.hxx> +#include <vcl/layout.hxx> +#include <vcl/toolkit/fixed.hxx> + +class MessageDialog final : 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, OUString aMessage, VclMessageType eMessageType, + VclButtonsType eButtonsType); + virtual bool set_property(const OUString& 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/win/WinDeviceInfo.hxx b/vcl/inc/opengl/win/WinDeviceInfo.hxx new file mode 100644 index 0000000000..2f9a52596b --- /dev/null +++ b/vcl/inc/opengl/win/WinDeviceInfo.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/. + */ + +#ifndef INCLUDED_VCL_OPENGL_WIN_WINDEVICEINFO_HXX +#define INCLUDED_VCL_OPENGL_WIN_WINDEVICEINFO_HXX + +#include <vcl/dllapi.h> + +#include <rtl/ustring.hxx> + +class VCL_DLLPUBLIC WinOpenGLDeviceInfo +{ +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(); + + bool isDeviceBlocked(); + + 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/zone.hxx b/vcl/inc/opengl/zone.hxx new file mode 100644 index 0000000000..f03e07ccfd --- /dev/null +++ b/vcl/inc/opengl/zone.hxx @@ -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/. + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_ZONE_H +#define INCLUDED_VCL_INC_OPENGL_ZONE_H + +#include <sal/config.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"; } +}; + +#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 0000000000..9ef837dfaa --- /dev/null +++ b/vcl/inc/osx/a11yfactory.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 . + */ + +#pragma once + +#include "osxvcltypes.h" +#include "a11ywrapper.h" +#include <com/sun/star/accessibility/XAccessibleContext.hpp> + +@interface AquaA11yFactory : NSObject +{ +} ++(void)insertIntoWrapperRepository: (AquaA11yWrapper *) element 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)registerWrapper: (AquaA11yWrapper *) theWrapper; ++(void)revokeWrapper: (AquaA11yWrapper *) theWrapper; +@end + + +/* 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 0000000000..aafa9944de --- /dev/null +++ b/vcl/inc/osx/a11yfocustracker.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 <com/sun/star/accessibility/XAccessible.hpp> + +#include "keyboardfocuslistener.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; +}; + +AquaA11yFocusTracker& TheAquaA11yFocusTracker(); + + +/* 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 0000000000..7211e81d46 --- /dev/null +++ b/vcl/inc/osx/a11ylistener.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once +#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; +}; + +/* 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 0000000000..1eb4039c57 --- /dev/null +++ b/vcl/inc/osx/a11ywrapper.h @@ -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 . + */ + +#pragma once + +#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 : NSAccessibilityElement + <NSAccessibilityElement, + NSAccessibilityGroup, + NSAccessibilityButton, + NSAccessibilitySwitch, + NSAccessibilityRadioButton, + NSAccessibilityCheckBox, + NSAccessibilityStaticText, + NSAccessibilityNavigableStaticText, + NSAccessibilityProgressIndicator, + NSAccessibilityStepper, + NSAccessibilitySlider, + NSAccessibilityImage> +{ + ReferenceWrapper maReferenceWrapper; + 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; +-(BOOL)performAction:(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)init; +-(id)initWithAccessibleContext: (css::uno::Reference < css::accessibility::XAccessibleContext >) anAccessibleContext; +-(void) setDefaults: (css::uno::Reference < css::accessibility::XAccessibleContext >) rxAccessibleContext; ++(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 + + +/* 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 0000000000..f94afaaf4f --- /dev/null +++ b/vcl/inc/osx/keyboardfocuslistener.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <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; +}; + +/* 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 0000000000..bf3f4ec46f --- /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 0000000000..a2a6e5454e --- /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 0000000000..e68bc4d350 --- /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 0000000000..ba4d6e8c85 --- /dev/null +++ b/vcl/inc/osx/saldata.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_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 <memory> +#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 + std::unique_ptr<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; + sal_Int32 mnDPIX; // #i100617# read DPI only once per office life + sal_Int32 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(); +}; + +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 0000000000..717e5f3101 --- /dev/null +++ b/vcl/inc/osx/salframe.h @@ -0,0 +1,233 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <tools/long.hxx> +#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 + + 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; + + // tdf#155266 force flush after scrolling + bool mbForceFlush; + +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 Show( bool bVisible, bool bNoActivate = false ) override; + virtual void SetMinClientSize( tools::Long nWidth, tools::Long nHeight ) + override; + virtual void SetMaxClientSize( tools::Long nWidth, tools::Long nHeight ) + override; + virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags ) override; + virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) override; + virtual void GetWorkArea( AbsoluteScreenPixelRectangle& rRect ) override; + virtual SalFrame* GetParent() const override; + virtual void SetWindowState(const vcl::WindowData*) override; + virtual bool GetWindowState(vcl::WindowData*) 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( tools::Long nX, tools::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 void 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( + tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; + // done setting up the clipregion + virtual void EndSetClipRegion() override; + virtual void UpdateDarkMode() override; + virtual bool GetUseDarkMode() const override; + virtual bool GetUseReducedAnimation() const 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( + tools::Long nX, tools::Long nY, tools::Long nWidth, tools::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 0000000000..2b1a3f9baa --- /dev/null +++ b/vcl/inc/osx/salframeview.h @@ -0,0 +1,278 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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; + BOOL mbInWindowDidResize; + NSTimer* mpLiveResizeTimer; +} +-(id)initWithSalFrame: (AquaSalFrame*)pFrame; +-(void)clearLiveResizeTimer; +-(void)dealloc; +-(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)windowDidChangeBackingProperties:(NSNotification *)pNotification; +-(void)windowWillStartLiveResize:(NSNotification *)pNotification; +-(void)windowDidEndLiveResize:(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; + +-(void)endExtTextInput; +-(void)endExtTextInput:(EndExtTextInputFlags)nFlags; + +-(void)windowDidResizeWithTimer:(NSTimer *)pTimer; + +-(BOOL)isIgnoredWindow; + +// NSAccessibilityElement overrides +-(id)accessibilityApplicationFocusedUIElement; +-(id)accessibilityFocusedUIElement; +-(BOOL)accessibilityIsIgnored; +-(BOOL)isAccessibilityElement; + +@end + +@interface SalFrameView : NSView <NSTextInputClient> +{ + AquaSalFrame* mpFrame; + AquaA11yWrapper* mpChildWrapper; + BOOL mbNeedChildWrapper; + + // 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; + + BOOL mbInEndExtTextInput; + BOOL mbInCommitMarkedText; + NSAttributedString* mpLastMarkedText; + BOOL mbTextInputWantsNonRepeatKeyDown; +} ++(void)unsetMouseFrame: (AquaSalFrame*)pFrame; +-(id)initWithSalFrame: (AquaSalFrame*)pFrame; +-(void)dealloc; +-(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; +-(void)clearLastMarkedText; +/* + 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; + +-(void)endExtTextInput; +-(void)endExtTextInput:(EndExtTextInputFlags)nFlags; +-(void)deleteTextInputWantsNonRepeatKeyDown; + +-(void)insertRegisteredWrapperIntoWrapperRepository; +-(void)registerWrapper; +-(void)revokeWrapper; + +// NSAccessibilityElement overrides +-(id)accessibilityAttributeValue:(NSString *)pAttribute; +-(BOOL)accessibilityIsIgnored; +-(NSArray *)accessibilityAttributeNames; +-(BOOL)accessibilityIsAttributeSettable:(NSString *)pAttribute; +-(NSArray *)accessibilityParameterizedAttributeNames; +-(BOOL)accessibilitySetOverrideValue:(id)pValue forAttribute:(NSString *)pAttribute; +-(void)accessibilitySetValue:(id)pValue forAttribute:(NSString *)pAttribute; +-(id)accessibilityAttributeValue:(NSString *)pAttribute forParameter:(id)pParameter; +-(id)accessibilityFocusedUIElement; +-(NSString *)accessibilityActionDescription:(NSString *)pAction; +-(void)accessibilityPerformAction:(NSString *)pAction; +-(NSArray *)accessibilityActionNames; +-(id)accessibilityHitTest:(NSPoint)aPoint; +-(NSArray *)accessibilityVisibleChildren; +-(NSArray *)accessibilitySelectedChildren; +-(NSArray *)accessibilityChildren; +-(NSArray <id<NSAccessibilityElement>> *)accessibilityChildrenInNavigationOrder; + +@end + +@interface SalFrameViewA11yWrapper : AquaA11yWrapper +{ + SalFrameView* mpParentView; +} +-(id)initWithParent:(SalFrameView*)pParentView accessibleContext:(::com::sun::star::uno::Reference<::com::sun::star::accessibility::XAccessibleContext>&)rxAccessibleContext; +-(void)dealloc; +@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 0000000000..8811fa3c9c --- /dev/null +++ b/vcl/inc/osx/salinst.h @@ -0,0 +1,168 @@ + +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <sal/config.h> + +#include <condition_variable> +#include <list> +#include <mutex> + +#include <comphelper/solarmutex.hxx> +#include <osl/conditn.hxx> +#include <osl/thread.hxx> +#include <tools/long.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; + + NSButtonCell* mpButtonCell; + NSButtonCell* mpCheckCell; + NSButtonCell* mpRadioCell; + NSTextFieldCell* mpTextFieldCell; + NSComboBoxCell* mpComboBoxCell; + NSPopUpButtonCell* mpPopUpButtonCell; + NSStepperCell* mpStepperCell; + NSButtonCell* mpListNodeCell; + OUString maDefaultPrinter; + oslThreadIdentifier maMainThread; + int mnActivePrintJobs; + osl::Mutex maUserEventListMutex; + osl::Condition maWaitingYieldCond; + 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& rGraphics, + tools::Long &nDX, tools::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> ImplCreateDragSource(const SystemEnvData*) override; + virtual css::uno::Reference<css::uno::XInterface> ImplCreateDropTarget(const SystemEnvData*) 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 NSEventTypeApplicationDefined 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& ); + + +/* 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 0000000000..597180cc1a --- /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 0000000000..86675e0623 --- /dev/null +++ b/vcl/inc/osx/salnativewidgets.h @@ -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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 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 0000000000..696abca2fc --- /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 0000000000..5c831cdf45 --- /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 0000000000..4c2ac88be6 --- /dev/null +++ b/vcl/inc/osx/salobj.h @@ -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_OSX_SALOBJ_H +#define INCLUDED_VCL_INC_OSX_SALOBJ_H + +#include <sal/config.h> + +#include <tools/long.hxx> +#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; + + CGFloat mnClipX; + CGFloat mnClipY; + CGFloat mnClipWidth; + CGFloat mnClipHeight; + bool mbClip; + + CGFloat mnX; + CGFloat mnY; + CGFloat mnWidth; + CGFloat 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( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; + virtual void EndSetClipRegion() override; + virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::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 0000000000..7bfd41787e --- /dev/null +++ b/vcl/inc/osx/salprn.h @@ -0,0 +1,156 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <sal/config.h> + +#include <tools/long.hxx> + +#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, + tools::Long& o_rOutWidth, tools::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, + 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( + tools::Long i_nWidth, tools::Long i_nHeight, Orientation& o_rOrientation ) const; + void setPaperSize( tools::Long i_nWidth, tools::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 0000000000..4b8b077088 --- /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 AbsoluteScreenPixelRectangle 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 0000000000..cdde3ec847 --- /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 0000000000..9fcabe074f --- /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 0000000000..e3329f554c --- /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 . + */ + +#pragma once + +#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)observeValueForKeyPath: (NSString*) keyPath ofObject:(id)object + change: (NSDictionary<NSKeyValueChangeKey, id>*)change + context: (void*)context; +-(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 + +/* 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 0000000000..79285a8f96 --- /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 0000000000..fac11693cf --- /dev/null +++ b/vcl/inc/pch/precompiled_vcl.hxx @@ -0,0 +1,406 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If 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 2023-07-19 09:24:26 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 +*/ + +#include <sal/config.h> +#if PCH_LEVEL >= 1 +#include <algorithm> +#include <array> +#include <atomic> +#include <cassert> +#include <chrono> +#include <cmath> +#include <cstddef> +#include <cstdio> +#include <cstdlib> +#include <cstring> +#include <deque> +#include <float.h> +#include <functional> +#include <hb.h> +#include <initializer_list> +#include <iomanip> +#include <iterator> +#include <limits> +#include <list> +#include <map> +#include <math.h> +#include <memory> +#include <mutex> +#include <new> +#include <numeric> +#include <optional> +#include <ostream> +#include <set> +#include <stddef.h> +#include <string.h> +#include <string> +#include <string_view> +#include <type_traits> +#include <unordered_map> +#include <unordered_set> +#include <utility> +#include <vector> +#include <boost/container/small_vector.hpp> +#include <boost/math/special_functions/sinc.hpp> +#include <boost/multi_array.hpp> +#include <boost/property_tree/json_parser.hpp> +#include <boost/property_tree/ptree.hpp> +#include <boost/property_tree/ptree_fwd.hpp> +#include <boost/rational.hpp> +#endif // PCH_LEVEL >= 1 +#if PCH_LEVEL >= 2 +#include <osl/conditn.hxx> +#include <osl/diagnose.h> +#include <osl/doublecheckedlocking.h> +#include <osl/endian.h> +#include <osl/file.h> +#include <osl/file.hxx> +#include <osl/getglobalmutex.hxx> +#include <osl/interlck.h> +#include <osl/module.hxx> +#include <osl/mutex.h> +#include <osl/mutex.hxx> +#include <osl/nlsupport.h> +#include <osl/security.h> +#include <osl/signal.h> +#include <osl/socket.h> +#include <osl/socket.hxx> +#include <osl/thread.h> +#include <osl/time.h> +#include <rtl/alloc.h> +#include <rtl/bootstrap.hxx> +#include <rtl/byteseq.hxx> +#include <rtl/character.hxx> +#include <rtl/cipher.h> +#include <rtl/crc.h> +#include <rtl/digest.h> +#include <rtl/instance.hxx> +#include <rtl/locale.h> +#include <rtl/math.h> +#include <rtl/math.hxx> +#include <rtl/process.h> +#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/backtrace.hxx> +#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/Range2D.hxx> +#include <basegfx/range/b2drange.hxx> +#include <basegfx/range/basicrange.hxx> +#include <basegfx/tuple/Size2D.hxx> +#include <basegfx/tuple/Tuple2D.hxx> +#include <basegfx/tuple/Tuple3D.hxx> +#include <basegfx/tuple/b2dtuple.hxx> +#include <basegfx/tuple/b2ituple.hxx> +#include <basegfx/tuple/b3dtuple.hxx> +#include <basegfx/utils/common.hxx> +#include <basegfx/vector/b2dsize.hxx> +#include <basegfx/vector/b2dvector.hxx> +#include <basegfx/vector/b2enums.hxx> +#include <basegfx/vector/b2isize.hxx> +#include <basegfx/vector/b2ivector.hxx> +#include <vcl/BitmapWriteAccess.hxx> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/XPropertySet.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/io/XInputStream.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/io/XSeekable.hpp> +#include <com/sun/star/io/XStream.hpp> +#include <com/sun/star/io/XTruncate.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/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/XComponentContext.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/diagnose_ex.hxx> +#include <comphelper/fileformat.h> +#include <comphelper/interfacecontainer4.hxx> +#include <comphelper/lok.hxx> +#include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> +#include <comphelper/scopeguard.hxx> +#include <comphelper/sequence.hxx> +#include <comphelper/string.hxx> +#include <comphelper/unoimplbase.hxx> +#include <cppu/cppudllapi.h> +#include <cppu/unotype.hxx> +#include <cppuhelper/cppuhelperdllapi.h> +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/queryinterface.hxx> +#include <cppuhelper/supportsservice.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/weakagg.hxx> +#include <cppuhelper/weakref.hxx> +#include <font/FontSelectPattern.hxx> +#include <font/PhysicalFontCollection.hxx> +#include <font/PhysicalFontFace.hxx> +#include <font/PhysicalFontFaceCollection.hxx> +#include <i18nlangtag/lang.h> +#include <i18nlangtag/languagetag.hxx> +#include <i18nlangtag/mslangid.hxx> +#include <i18nutil/i18nutildllapi.h> +#include <o3tl/cow_wrapper.hxx> +#include <o3tl/hash_combine.hxx> +#include <o3tl/safeint.hxx> +#include <o3tl/sorted_vector.hxx> +#include <o3tl/string_view.hxx> +#include <o3tl/strong_int.hxx> +#include <o3tl/typed_flags_set.hxx> +#include <o3tl/underlyingenumvalue.hxx> +#include <o3tl/unit_conversion.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 <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/color.hxx> +#include <tools/contnr.hxx> +#include <tools/date.hxx> +#include <tools/datetime.hxx> +#include <tools/debug.hxx> +#include <tools/degree.hxx> +#include <tools/fldunit.hxx> +#include <tools/fontenum.hxx> +#include <tools/fract.hxx> +#include <tools/gen.hxx> +#include <tools/globname.hxx> +#include <tools/helpers.hxx> +#include <tools/json_writer.hxx> +#include <tools/link.hxx> +#include <tools/long.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/calendarwrapper.hxx> +#include <unotools/configmgr.hxx> +#include <unotools/fontdefs.hxx> +#include <unotools/localedatawrapper.hxx> +#include <unotools/resmgr.hxx> +#include <unotools/syslocale.hxx> +#include <unotools/tempfile.hxx> +#include <unotools/ucbstreamhelper.hxx> +#include <unotools/unotoolsdllapi.h> +#endif // PCH_LEVEL >= 3 +#if PCH_LEVEL >= 4 +#include <ImplOutDevData.hxx> +#include <accel.hxx> +#include <brdwin.hxx> +#include <configsettings.hxx> +#include <drawmode.hxx> +#include <fontattributes.hxx> +#include <glyphid.hxx> +#include <impfontcache.hxx> +#include <impglyphitem.hxx> +#include <ppdparser.hxx> +#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 <sft.hxx> +#include <svdata.hxx> +#include <vcl/AccessibleBrowseBoxObjType.hxx> +#include <vcl/BinaryDataContainer.hxx> +#include <vcl/BitmapColor.hxx> +#include <vcl/BitmapFilter.hxx> +#include <vcl/BitmapReadAccess.hxx> +#include <vcl/BitmapTools.hxx> +#include <vcl/FilterConfigItem.hxx> +#include <vcl/QueueInfo.hxx> +#include <vcl/TypeSerializer.hxx> +#include <vcl/bitmap.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/builder.hxx> +#include <vcl/canvastools.hxx> +#include <vcl/checksum.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/event.hxx> +#include <vcl/filter/PngImageReader.hxx> +#include <vcl/filter/PngImageWriter.hxx> +#include <vcl/filter/SvmReader.hxx> +#include <vcl/filter/SvmWriter.hxx> +#include <vcl/fntstyle.hxx> +#include <vcl/font.hxx> +#include <vcl/formatter.hxx> +#include <vcl/gdimtf.hxx> +#include <vcl/gfxlink.hxx> +#include <vcl/glyphitem.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/lazydelete.hxx> +#include <vcl/lineinfo.hxx> +#include <vcl/menu.hxx> +#include <vcl/metaact.hxx> +#include <vcl/mnemonic.hxx> +#include <vcl/outdev.hxx> +#include <vcl/ptrstyle.hxx> +#include <vcl/quickselectionengine.hxx> +#include <vcl/region.hxx> +#include <vcl/salnativewidgets.hxx> +#include <vcl/scheduler.hxx> +#include <vcl/settings.hxx> +#include <vcl/svapp.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/combobox.hxx> +#include <vcl/toolkit/dialog.hxx> +#include <vcl/toolkit/edit.hxx> +#include <vcl/toolkit/fixed.hxx> +#include <vcl/toolkit/floatwin.hxx> +#include <vcl/toolkit/lstbox.hxx> +#include <vcl/toolkit/scrbar.hxx> +#include <vcl/toolkit/spinfld.hxx> +#include <vcl/toolkit/svlbitm.hxx> +#include <vcl/toolkit/treelist.hxx> +#include <vcl/toolkit/treelistbox.hxx> +#include <vcl/toolkit/treelistentries.hxx> +#include <vcl/toolkit/treelistentry.hxx> +#include <vcl/toolkit/unowrap.hxx> +#include <vcl/toolkit/vclmedit.hxx> +#include <vcl/toolkit/viewdataentry.hxx> +#include <vcl/transfer.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/vcllayout.hxx> +#include <vcl/vclptr.hxx> +#include <vcl/virdev.hxx> +#include <vcl/weld.hxx> +#include <vcl/weldutils.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 0000000000..34f99944dc --- /dev/null +++ b/vcl/inc/pdf/BitmapID.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/. + * + */ + +#pragma once + +#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); + } +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/pdf/ExternalPDFStreams.hxx b/vcl/inc/pdf/ExternalPDFStreams.hxx new file mode 100644 index 0000000000..b2936f01a8 --- /dev/null +++ b/vcl/inc/pdf/ExternalPDFStreams.hxx @@ -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/. + */ + +#pragma once + +#include <sal/types.h> +#include <sal/log.hxx> +#include <vcl/dllapi.h> + +#include <map> +#include <vector> +#include <memory> + +#include <vcl/filter/pdfdocument.hxx> +#include <vcl/BinaryDataContainer.hxx> + +namespace vcl +{ +// A external PDF stream, which stores the PDF stream data as byte array. +// This struct is also responsible to parsing the stream as a PDFDocument, +// and store its instance for the life-cycle of the struct, so that it +// reused to avoid unnecessary parsing. +struct VCL_DLLPUBLIC ExternalPDFStream +{ + BinaryDataContainer maDataContainer; + std::shared_ptr<filter::PDFDocument> mpPDFDocument; + std::map<sal_Int32, sal_Int32> maCopiedResources; + + std::map<sal_Int32, sal_Int32>& getCopiedResources() { return maCopiedResources; } + + std::shared_ptr<filter::PDFDocument>& getPDFDocument() + { + if (!mpPDFDocument) + { + std::shared_ptr<SvStream> aPDFStream = maDataContainer.getAsStream(); + auto pPDFDocument = std::make_shared<filter::PDFDocument>(); + if (!pPDFDocument->ReadWithPossibleFixup(*aPDFStream)) + { + SAL_WARN("vcl.pdfwriter", + "PDFWriterImpl::writeReferenceXObject: reading the PDF document failed"); + } + else + { + mpPDFDocument = pPDFDocument; + } + } + return mpPDFDocument; + } +}; + +// Class to manage external PDF streams, for the de-duplication purpose. +class ExternalPDFStreams +{ +private: + std::map<std::vector<sal_uInt8>, sal_Int32> maStreamIndexMap; + std::vector<ExternalPDFStream> maStreamList; + +public: + ExternalPDFStreams() {} + + sal_Int32 store(BinaryDataContainer const& rDataContainer); + + ExternalPDFStream& get(sal_uInt32 nIndex); +}; +} + +/* 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 0000000000..226235f526 --- /dev/null +++ b/vcl/inc/pdf/Matrix3.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/. + * + */ + +#pragma once + +#include <basegfx/point/b2dpoint.hxx> +#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; + basegfx::B2DPoint transform(const basegfx::B2DPoint& rPoint) const; +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/pdf/PdfConfig.hxx b/vcl/inc/pdf/PdfConfig.hxx new file mode 100644 index 0000000000..235fd008ea --- /dev/null +++ b/vcl/inc/pdf/PdfConfig.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/. + * + */ + +#pragma once + +namespace vcl::pdf +{ +double getDefaultPdfResolutionDpi(); +} + +/* 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 0000000000..119d9314f4 --- /dev/null +++ b/vcl/inc/pdf/ResourceDict.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 <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); +}; +} + +/* 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 0000000000..33fce97a21 --- /dev/null +++ b/vcl/inc/pdf/XmpMetadata.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/. + * + */ + +#pragma once + +#include <rtl/string.hxx> +#include <tools/stream.hxx> +#include <memory> +#include <vector> + +namespace vcl::pdf +{ +class XmpMetadata +{ +private: + bool mbWritten; + std::unique_ptr<SvMemoryStream> mpMemoryStream; + +public: + OString msTitle; + OString msAuthor; + OString msSubject; + OString msProducer; + OString msPDFVersion; + OString msKeywords; + std::vector<OString> maContributor; + OString msCoverage; + OString msIdentifier; + std::vector<OString> maPublisher; + std::vector<OString> maRelation; + OString msRights; + OString msSource; + OString msType; + OString m_sCreatorTool; + OString m_sCreateDate; + + sal_Int32 mnPDF_A; + bool mbPDF_UA; + +public: + XmpMetadata(); + sal_uInt64 getSize(); + const void* getData(); + +private: + void write(); +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/pdf/objectcopier.hxx b/vcl/inc/pdf/objectcopier.hxx new file mode 100644 index 0000000000..0168f69717 --- /dev/null +++ b/vcl/inc/pdf/objectcopier.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/. + */ + +#pragma once + +#include <map> +#include <vector> + +#include <rtl/strbuf.hxx> +#include <rtl/string.hxx> +#include <sal/types.h> + +class SvMemoryStream; + +namespace vcl +{ +class PDFObjectContainer; +namespace filter +{ +class PDFObjectElement; +class PDFElement; +} + +/// Copies objects from one PDF file into another one. +class PDFObjectCopier +{ + PDFObjectContainer& m_rContainer; + + void copyRecursively(OStringBuffer& rLine, filter::PDFElement& rInputElement, + SvMemoryStream& rDocBuffer, + std::map<sal_Int32, sal_Int32>& rCopiedResources); + +public: + PDFObjectCopier(PDFObjectContainer& rContainer); + + /// Copies resources of a given kind from an external page to the output, + /// returning what has to be included in the new resource dictionary. + OString copyExternalResources(filter::PDFObjectElement& rPage, const OString& rKind, + std::map<sal_Int32, sal_Int32>& rCopiedResources); + + /// Copies a single resource from an external document, returns the new + /// object ID in our document. + sal_Int32 copyExternalResource(SvMemoryStream& rDocBuffer, filter::PDFObjectElement& rObject, + std::map<sal_Int32, sal_Int32>& rCopiedResources); + + /// Copies resources of pPage into rLine. + void copyPageResources(filter::PDFObjectElement* pPage, OStringBuffer& rLine); + + void copyPageResources(filter::PDFObjectElement* pPage, OStringBuffer& rLine, + std::map<sal_Int32, sal_Int32>& rCopiedResources); + + /// Copies page one or more page streams from rContentStreams into rStream. + static sal_Int32 copyPageStreams(std::vector<filter::PDFObjectElement*>& rContentStreams, + SvMemoryStream& rStream, bool& rCompressed); +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/pdf/pdfbuildin_fonts.hxx b/vcl/inc/pdf/pdfbuildin_fonts.hxx new file mode 100644 index 0000000000..a0c2fc0628 --- /dev/null +++ b/vcl/inc/pdf/pdfbuildin_fonts.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 <sal/config.h> + +#include <font/PhysicalFontFace.hxx> +#include <font/LogicalFontInstance.hxx> + +namespace vcl::pdf +{ +struct BuildinFont +{ + const char* m_pName; + const char* m_pStyleName; + const char* m_pPSName; + int const m_nAscent; + int const m_nDescent; + FontFamily const m_eFamily; + rtl_TextEncoding const m_eCharSet; + FontPitch const m_ePitch; + FontWidth const m_eWidthType; + FontWeight const m_eWeight; + FontItalic const m_eItalic; + int const m_aWidths[256]; + mutable FontCharMapRef m_xFontCharMap; + + OString getNameObject() const; + const FontCharMapRef& GetFontCharMap() const; + FontAttributes GetFontAttributes() const; +}; + +class BuildinFontInstance final : public LogicalFontInstance +{ +public: + BuildinFontInstance(const vcl::font::PhysicalFontFace&, const vcl::font::FontSelectPattern&); + + bool GetGlyphOutline(sal_GlyphId nId, basegfx::B2DPolyPolygon& rPoly, bool) const override; +}; + +class BuildinFontFace final : public vcl::font::PhysicalFontFace +{ + static const BuildinFont m_aBuildinFonts[14]; + const BuildinFont& mrBuildin; + + rtl::Reference<LogicalFontInstance> + CreateFontInstance(const vcl::font::FontSelectPattern& rFSD) const override; + +public: + explicit BuildinFontFace(int nId); + + const BuildinFont& GetBuildinFont() const { return mrBuildin; } + sal_IntPtr GetFontId() const override { return reinterpret_cast<sal_IntPtr>(&mrBuildin); } + FontCharMapRef GetFontCharMap() const override { return mrBuildin.GetFontCharMap(); } + bool GetFontCapabilities(vcl::FontCapabilities&) const override { return false; } + + static const BuildinFont& Get(int nId) { return m_aBuildinFonts[nId]; } +}; + +} // namespace vcl::pdf + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/pdf/pdfcompat.hxx b/vcl/inc/pdf/pdfcompat.hxx new file mode 100644 index 0000000000..0664a400f9 --- /dev/null +++ b/vcl/inc/pdf/pdfcompat.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/. + */ + +#pragma once + +#include <o3tl/unit_conversion.hxx> +#include <tools/stream.hxx> +#include <vcl/BinaryDataContainer.hxx> + +namespace vcl::pdf +{ +/// Convert to inch, then apply custom resolution. +inline double pointToPixel(const double fPoint, const double fResolutionDPI) +{ + return o3tl::convert(fPoint, o3tl::Length::pt, o3tl::Length::in) * fResolutionDPI; +} + +/// Decide if PDF data is old enough to be compatible. +bool isCompatible(SvStream& rInStream, sal_uInt64 nPos, sal_uInt64 nSize); + +/// Converts to highest supported format version (currently 1.6). +/// Usually used to deal with missing referenced objects in the +/// source pdf stream. +bool convertToHighestSupported(SvStream& rInStream, SvStream& rOutStream); + +/// Takes care of transparently downgrading the version of the PDF stream in +/// case it's too new for our PDF export. +bool getCompatibleStream(SvStream& rInStream, SvStream& rOutStream); + +BinaryDataContainer createBinaryDataContainer(SvStream& rStream); + +} // end of vcl::filter::ipdf namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx new file mode 100644 index 0000000000..090f3e090c --- /dev/null +++ b/vcl/inc/pdf/pdfwriter_impl.hxx @@ -0,0 +1,1358 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <sal/config.h> + +#include <map> +#include <list> +#include <unordered_map> +#include <unordered_set> +#include <memory> +#include <string_view> +#include <vector> +#include <stack> +#include <variant> + +#include <pdf/ResourceDict.hxx> +#include <pdf/BitmapID.hxx> +#include <pdf/Matrix3.hxx> + +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <osl/file.hxx> +#include <rtl/cipher.h> +#include <rtl/strbuf.hxx> +#include <rtl/ustring.hxx> +#include <tools/gen.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/gradient.hxx> +#include <vcl/graphictools.hxx> +#include <vcl/hatch.hxx> +#include <vcl/virdev.hxx> +#include <vcl/pdfwriter.hxx> +#include <vcl/wall.hxx> +#include <o3tl/safeint.hxx> +#include <o3tl/typed_flags_set.hxx> +#include <o3tl/lru_map.hxx> +#include <comphelper/hash.hxx> +#include <tools/stream.hxx> +#include <vcl/BinaryDataContainer.hxx> + +#include <vcl/filter/pdfobjectcontainer.hxx> +#include <vcl/settings.hxx> +#include <pdf/ExternalPDFStreams.hxx> +#include <pdf/pdfbuildin_fonts.hxx> +#include <salgdi.hxx> + +class FontSubsetInfo; +class ZCodec; +class EncHashTransporter; +struct BitStreamState; +namespace vcl::font { class PhysicalFontFace; } +class SvStream; +class SvMemoryStream; + +// the maximum password length +constexpr sal_Int32 ENCRYPTED_PWD_SIZE = 32; +constexpr sal_Int32 MD5_DIGEST_SIZE = 16; +// security 128 bit +constexpr sal_Int32 SECUR_128BIT_KEY = 16; +// maximum length of MD5 digest input, in step 2 of algorithm 3.1 +// PDF spec ver. 1.4: see there for details +constexpr sal_Int32 MAXIMUM_RC4_KEY_LENGTH = SECUR_128BIT_KEY + 3 + 2; + +namespace vcl::pdf +{ + +enum class GraphicsStateUpdateFlags { + Font = 0x0001, + MapMode = 0x0002, + LineColor = 0x0004, + FillColor = 0x0008, + ClipRegion = 0x0040, + LayoutMode = 0x0100, + TransparentPercent = 0x0200, + DigitLanguage = 0x0400, + All = 0x077f +}; + +} // end vcl::pdf + +namespace o3tl { + template<> struct typed_flags<vcl::pdf::GraphicsStateUpdateFlags> : is_typed_flags<vcl::pdf::GraphicsStateUpdateFlags, 0x077f> {}; +} + +namespace vcl +{ + +using namespace vcl::pdf; + +class PDFStreamIf; + +namespace filter +{ +class PDFObjectElement; +} + +namespace pdf +{ +struct PDFPage +{ + VclPtr<PDFWriterImpl> m_pWriter; + double m_nPageWidth; // in inch/72 + double m_nPageHeight; // in inch/72 + /** + * A positive number that gives the size of default user space units, in multiples of points. + * Typically 1, larger if page size is > 508 cm. + */ + sal_Int32 m_nUserUnit; + PDFWriter::Orientation m_eOrientation; + sal_Int32 m_nPageObject; + std::vector<sal_Int32> m_aStreamObjects; + sal_Int32 m_nStreamLengthObject; + sal_uInt64 m_nBeginStreamPos; + std::vector<sal_Int32> m_aAnnotations; + std::vector<sal_Int32> m_aMCIDParents; + PDFWriter::PageTransition m_eTransition; + sal_uInt32 m_nTransTime; + + PDFPage( PDFWriterImpl* pWriter, double nPageWidth, double nPageHeight, PDFWriter::Orientation eOrientation ); + + void beginStream(); + void endStream(); + bool emit( sal_Int32 nParentPage ); + + // converts point from ref device coordinates to + // page coordinates and appends the point to the buffer + // if pOutPoint is set it will be updated to the emitted point + // (in PDF map mode, that is 10th of point) + void appendPoint( const Point& rPoint, OStringBuffer& rBuffer ) const; + // appends a B2DPoint without further transformation + void appendPixelPoint( const basegfx::B2DPoint& rPoint, OStringBuffer& rBuffer ) const; + // appends a rectangle + void appendRect( const tools::Rectangle& rRect, OStringBuffer& rBuffer ) const; + // converts a rectangle to 10th points page space + void convertRect( tools::Rectangle& rRect ) const; + // appends a polygon optionally closing it + void appendPolygon( const tools::Polygon& rPoly, OStringBuffer& rBuffer, bool bClose = true ) const; + // appends a polygon optionally closing it + void appendPolygon( const basegfx::B2DPolygon& rPoly, OStringBuffer& rBuffer ) const; + // appends a polypolygon optionally closing the subpaths + void appendPolyPolygon( const tools::PolyPolygon& rPolyPoly, OStringBuffer& rBuffer ) const; + // appends a polypolygon optionally closing the subpaths + void appendPolyPolygon( const basegfx::B2DPolyPolygon& rPolyPoly, OStringBuffer& rBuffer ) const; + // converts a length (either vertical or horizontal; this + // can be important if the source MapMode is not + // symmetrical) to page length and appends it to the buffer + // if pOutLength is set it will be updated to the emitted length + // (in PDF map mode, that is 10th of point) + void appendMappedLength( sal_Int32 nLength, OStringBuffer& rBuffer, bool bVertical = true, sal_Int32* pOutLength = nullptr ) const; + // the same for double values + void appendMappedLength( double fLength, OStringBuffer& rBuffer, bool bVertical = true, sal_Int32 nPrecision = 5 ) const; + // appends LineInfo + // returns false if too many dash array entry were created for + // the implementation limits of some PDF readers + bool appendLineInfo( const LineInfo& rInfo, OStringBuffer& rBuffer ) const; + // appends a horizontal waveline with vertical offset (helper for drawWaveLine) + void appendWaveLine( sal_Int32 nLength, sal_Int32 nYOffset, sal_Int32 nDelta, OStringBuffer& rBuffer ) const; + + void appendMatrix3(Matrix3 const & rMatrix, OStringBuffer& rBuffer); + + double getHeight() const; +}; + +/// Contains information to emit a reference XObject. +struct ReferenceXObjectEmit +{ + /// ID of the Form XObject, if any. + sal_Int32 m_nFormObject; + /// ID of the vector/embedded object, if m_nFormObject is used. + sal_Int32 m_nEmbeddedObject; + /// ID of the bitmap object, if m_nFormObject is used. + sal_Int32 m_nBitmapObject; + /// Size of the bitmap replacement, in pixels. + Size m_aPixelSize; + /// PDF data from the graphic object, if not writing a reference XObject. + sal_Int32 m_nExternalPDFDataIndex; + sal_Int32 m_nExternalPDFPageIndex; + + ReferenceXObjectEmit() + : m_nFormObject(0) + , m_nEmbeddedObject(0) + , m_nBitmapObject(0) + , m_nExternalPDFDataIndex(-1) + , m_nExternalPDFPageIndex(-1) + { + } + + /// Returns the ID one should use when referring to this bitmap. + sal_Int32 getObject() const; + + bool hasExternalPDFData() const + { + return m_nExternalPDFDataIndex >= 0; + } +}; + +struct BitmapEmit +{ + BitmapID m_aID; + BitmapEx m_aBitmap; + sal_Int32 m_nObject; + ReferenceXObjectEmit m_aReferenceXObject; + + BitmapEmit() + : m_nObject(0) + { + } +}; + +struct JPGEmit +{ + BitmapID m_aID; + std::unique_ptr<SvMemoryStream> + m_pStream; + AlphaMask m_aAlphaMask; + sal_Int32 m_nObject; + bool m_bTrueColor; + ReferenceXObjectEmit m_aReferenceXObject; + + JPGEmit() + : m_nObject(0) + , m_bTrueColor(false) + { + } +}; + +struct GradientEmit +{ + Gradient m_aGradient; + Size m_aSize; + sal_Int32 m_nObject; +}; + +// for tilings (drawWallpaper, begin/endPattern) +struct TilingEmit +{ + sal_Int32 m_nObject; + tools::Rectangle m_aRectangle; + Size m_aCellSize; + SvtGraphicFill::Transform m_aTransform; + ResourceDict m_aResources; + std::unique_ptr<SvMemoryStream> m_pTilingStream; + + TilingEmit() + : m_nObject( 0 ) + {} +}; + +// for transparency group XObjects +struct TransparencyEmit +{ + sal_Int32 m_nObject; + sal_Int32 m_nExtGStateObject; + double m_fAlpha; + tools::Rectangle m_aBoundRect; + std::unique_ptr<SvMemoryStream> m_pContentStream; + + TransparencyEmit() + : m_nObject( 0 ), + m_nExtGStateObject( -1 ), + m_fAlpha( 0.0 ) + {} +}; + +// font subsets + +struct ColorLayer +{ + sal_Int32 m_nFontID; + sal_uInt8 m_nSubsetGlyphID; + uint32_t m_nColorIndex; +}; + +class GlyphEmit +{ + // performance: actually this should probably a vector; + std::vector<sal_Ucs> m_CodeUnits; + sal_uInt8 m_nSubsetGlyphID; + sal_Int32 m_nGlyphWidth; + std::vector<ColorLayer> m_aColorLayers; + font::RawFontData m_aColorBitmap; + tools::Rectangle m_aRect; + basegfx::B2DPolyPolygon m_aOutline; + +public: + GlyphEmit() : m_nSubsetGlyphID(0), m_nGlyphWidth(0) + { + } + + void setGlyphId( sal_uInt8 i_nId ) { m_nSubsetGlyphID = i_nId; } + sal_uInt8 getGlyphId() const { return m_nSubsetGlyphID; } + + void setGlyphWidth( sal_Int32 nWidth ) { m_nGlyphWidth = nWidth; } + sal_Int32 getGlyphWidth() const { return m_nGlyphWidth; } + + void addColorLayer(ColorLayer aLayer) { m_aColorLayers.push_back(aLayer); } + const std::vector<ColorLayer>& getColorLayers() const { return m_aColorLayers; } + + void setColorBitmap(font::RawFontData aData, tools::Rectangle aRect) + { + m_aColorBitmap = aData; + m_aRect = aRect; + } + const font::RawFontData& getColorBitmap(tools::Rectangle& rRect) const + { + rRect = m_aRect; + return m_aColorBitmap; + } + + void setOutline(const basegfx::B2DPolyPolygon& rOutline) { m_aOutline = rOutline; } + const basegfx::B2DPolyPolygon& getOutline() const { return m_aOutline; } + + void addCode( sal_Ucs i_cCode ) + { + m_CodeUnits.push_back(i_cCode); + } + sal_Int32 countCodes() const { return m_CodeUnits.size(); } + const std::vector<sal_Ucs>& codes() const { return m_CodeUnits; } + sal_Ucs getCode( sal_Int32 i_nIndex ) const + { + sal_Ucs nRet = 0; + if (o3tl::make_unsigned(i_nIndex) < m_CodeUnits.size()) + nRet = m_CodeUnits[i_nIndex]; + return nRet; + } +}; + +struct FontEmit +{ + sal_Int32 m_nFontID; + std::map<sal_GlyphId, GlyphEmit> m_aMapping; + + explicit FontEmit( sal_Int32 nID ) : m_nFontID( nID ) {} +}; + +struct Glyph +{ + sal_Int32 m_nFontID; + sal_uInt8 m_nSubsetGlyphID; +}; + +struct FontSubset +{ + std::vector< FontEmit > m_aSubsets; + std::map<sal_GlyphId, Glyph> m_aMapping; +}; + +struct EmbedFont +{ + sal_Int32 m_nNormalFontID; + LogicalFontInstance* m_pFontInstance; + + EmbedFont() + : m_nNormalFontID(0) + , m_pFontInstance(nullptr) {} +}; + +struct PDFDest +{ + sal_Int32 m_nPage; + PDFWriter::DestAreaType m_eType; + tools::Rectangle m_aRect; +}; + +//--->i56629 +struct PDFNamedDest +{ + OUString m_aDestName; + sal_Int32 m_nPage; + PDFWriter::DestAreaType m_eType; + tools::Rectangle m_aRect; +}; + +struct PDFOutlineEntry +{ + sal_Int32 m_nObject; + sal_Int32 m_nParentObject; + sal_Int32 m_nNextObject; + sal_Int32 m_nPrevObject; + std::vector< sal_Int32 > m_aChildren; + OUString m_aTitle; + sal_Int32 m_nDestID; + + PDFOutlineEntry() + : m_nObject( 0 ), + m_nParentObject( 0 ), + m_nNextObject( 0 ), + m_nPrevObject( 0 ), + m_nDestID( -1 ) + {} +}; + +struct PDFAnnotation +{ + sal_Int32 m_nObject; + tools::Rectangle m_aRect; + sal_Int32 m_nPage; + + PDFAnnotation() + : m_nObject( -1 ), + m_nPage( -1 ) + {} +}; + +struct PDFLink : public PDFAnnotation +{ + sal_Int32 m_nDest; // set to -1 for URL, to a dest else + OUString m_aURL; + sal_Int32 m_nStructParent; // struct parent entry + OUString m_AltText; + + PDFLink(OUString const& rAltText) + : m_nDest( -1 ), + m_nStructParent( -1 ) + , m_AltText(rAltText) + {} +}; + +/// A PDF embedded file. +struct PDFEmbeddedFile +{ + /// ID of the file. + sal_Int32 m_nObject; + OUString m_aSubType; + /// Contents of the file. + BinaryDataContainer m_aDataContainer; + std::unique_ptr<PDFOutputStream> m_pStream; + + PDFEmbeddedFile() + : m_nObject(0) + { + } +}; + +struct PDFPopupAnnotation : public PDFAnnotation +{ + /// ID of the parent object. + sal_Int32 m_nParentObject; +}; + +struct PDFNoteEntry : public PDFAnnotation +{ + PDFNote m_aContents; + + PDFPopupAnnotation m_aPopUpAnnotation; + + PDFNoteEntry() + {} +}; + +/// A PDF Screen annotation. +struct PDFScreen : public PDFAnnotation +{ + /// Linked video. + OUString m_aURL; + /// Embedded video. + OUString m_aTempFileURL; + /// ID of the EmbeddedFile object. + sal_Int32 m_nTempFileObject; + /// alternative text description + OUString m_AltText; + sal_Int32 m_nStructParent; + OUString m_MimeType; + + PDFScreen(OUString const& rAltText, OUString const& rMimeType) + : m_nTempFileObject(0) + , m_AltText(rAltText) + , m_nStructParent(-1) + , m_MimeType(rMimeType) + { + } +}; + +struct PDFWidget : public PDFAnnotation +{ + PDFWriter::WidgetType m_eType; + OString m_aName; + OUString m_aDescription; + OUString m_aText; + DrawTextFlags m_nTextStyle; + OUString m_aValue; + OString m_aDAString; + OString m_aDRDict; + OString m_aMKDict; + OString m_aMKDictCAString; // i12626, added to be able to encrypt the /CA text string + // since the object number is not known at the moment + // of filling m_aMKDict, the string will be encrypted when emitted. + // the /CA string MUST BE the last added to m_aMKDict + // see code for details + sal_Int32 m_nFlags; + sal_Int32 m_nParent; // if not 0, parent's object number + std::vector<sal_Int32> m_aKids; // widget children, contains object numbers + std::vector<sal_Int32> m_aKidsIndex; // widget children, contains index to m_aWidgets + OUString m_aOnValue; + OUString m_aOffValue; + sal_Int32 m_nTabOrder; // lowest number gets first in tab order + sal_Int32 m_nRadioGroup; + sal_Int32 m_nMaxLen; + PDFWriter::FormatType m_nFormat; + OUString m_aCurrencySymbol; + sal_Int32 m_nDecimalAccuracy; + bool m_bPrependCurrencySymbol; + OUString m_aTimeFormat; + OUString m_aDateFormat; + bool m_bSubmit; + bool m_bSubmitGet; + sal_Int32 m_nDest; + std::vector<OUString> m_aListEntries; + std::vector<sal_Int32> m_aSelectedEntries; + typedef std::unordered_map<OString, SvMemoryStream*> PDFAppearanceStreams; + std::unordered_map<OString, PDFAppearanceStreams> m_aAppearances; + sal_Int32 m_nStructParent = -1; + + PDFWidget() + : m_eType( PDFWriter::PushButton ), + m_nTextStyle( DrawTextFlags::NONE ), + m_nFlags( 0 ), + m_nParent( 0 ), + m_nTabOrder( 0 ), + m_nRadioGroup( -1 ), + m_nMaxLen( 0 ), + m_nFormat( PDFWriter::FormatType::Text ), + m_nDecimalAccuracy ( 0 ), + m_bPrependCurrencySymbol( false ), + m_bSubmit( false ), + m_bSubmitGet( false ), + m_nDest( -1 ) + {} +}; + +struct PDFStructureAttribute +{ + PDFWriter::StructAttributeValue eValue; + sal_Int32 nValue; + + PDFStructureAttribute() + : eValue( PDFWriter::Invalid ), + nValue( 0 ) + {} + + explicit PDFStructureAttribute( PDFWriter::StructAttributeValue eVal ) + : eValue( eVal ), + nValue( 0 ) + {} + + explicit PDFStructureAttribute( sal_Int32 nVal ) + : eValue( PDFWriter::Invalid ), + nValue( nVal ) + {} +}; + +struct ObjReference { sal_Int32 const nObject; }; +struct ObjReferenceObj { sal_Int32 const nObject; }; +struct MCIDReference { sal_Int32 const nPageObj; sal_Int32 const nMCID; }; +typedef ::std::variant<ObjReference, ObjReferenceObj, MCIDReference> PDFStructureElementKid; + +struct PDFStructureElement +{ + sal_Int32 m_nObject; + ::std::optional<PDFWriter::StructElement> m_oType; + OString m_aAlias; + sal_Int32 m_nOwnElement; // index into structure vector + sal_Int32 m_nParentElement; // index into structure vector + sal_Int32 m_nFirstPageObject; + bool m_bOpenMCSeq; + std::vector< sal_Int32 > m_aChildren; // indexes into structure vector + std::list< PDFStructureElementKid > m_aKids; + std::map<PDFWriter::StructAttribute, PDFStructureAttribute > + m_aAttributes; + ::std::vector<sal_Int32> m_AnnotIds; + tools::Rectangle m_aBBox; + OUString m_aActualText; + OUString m_aAltText; + css::lang::Locale m_aLocale; + + // m_aContents contains the element's marked content sequence + // as pairs of (page nr, MCID) + + PDFStructureElement() + : m_nObject( 0 ), + m_nOwnElement( -1 ), + m_nParentElement( -1 ), + m_nFirstPageObject( 0 ), + m_bOpenMCSeq( false ) + { + } + +}; + +// helper structure for drawLayout and friends +struct PDFGlyph +{ + basegfx::B2DPoint const m_aPos; + const GlyphItem* m_pGlyph; + const LogicalFontInstance* m_pFont; + sal_Int32 const m_nNativeWidth; + sal_Int32 const m_nMappedFontId; + sal_uInt8 const m_nMappedGlyphId; + int const m_nCharPos; + + PDFGlyph( const basegfx::B2DPoint& rPos, + const GlyphItem* pGlyph, + const LogicalFontInstance* pFont, + sal_Int32 nNativeWidth, + sal_Int32 nFontId, + sal_uInt8 nMappedGlyphId, + int nCharPos ) + : m_aPos( rPos ), m_pGlyph(pGlyph), m_pFont(pFont), m_nNativeWidth( nNativeWidth ), + m_nMappedFontId( nFontId ), m_nMappedGlyphId( nMappedGlyphId ), + m_nCharPos(nCharPos) + {} +}; + +struct StreamRedirect +{ + SvStream* m_pStream; + MapMode m_aMapMode; + tools::Rectangle m_aTargetRect; + ResourceDict m_aResourceDict; +}; + +// graphics state +struct GraphicsState +{ + vcl::Font m_aFont; + MapMode m_aMapMode; + Color m_aLineColor; + Color m_aFillColor; + Color m_aTextLineColor; + Color m_aOverlineColor; + basegfx::B2DPolyPolygon m_aClipRegion; + bool m_bClipRegion; + vcl::text::ComplexTextLayoutFlags m_nLayoutMode; + LanguageType m_aDigitLanguage; + PushFlags m_nFlags; + GraphicsStateUpdateFlags m_nUpdateFlags; + + GraphicsState() : + m_aLineColor( COL_TRANSPARENT ), + m_aFillColor( COL_TRANSPARENT ), + m_aTextLineColor( COL_TRANSPARENT ), + m_aOverlineColor( COL_TRANSPARENT ), + m_bClipRegion( false ), + m_nLayoutMode( vcl::text::ComplexTextLayoutFlags::Default ), + m_aDigitLanguage( 0 ), + m_nFlags( PushFlags::ALL ), + m_nUpdateFlags( GraphicsStateUpdateFlags::All ) + {} +}; + +enum class Mode { DEFAULT, NOWRITE }; + +struct PDFDocumentAttachedFile +{ + OUString maFilename; + OUString maMimeType; + OUString maDescription; + sal_Int32 mnEmbeddedFileObjectId; + sal_Int32 mnObjectId; +}; + +} // end pdf namespace + +class PDFWriterImpl final : public VirtualDevice, public PDFObjectContainer +{ + friend class PDFStreamIf; + +public: + friend struct vcl::pdf::PDFPage; + + const char* getStructureTag( PDFWriter::StructElement ); + static const char* getAttributeTag( PDFWriter::StructAttribute eAtr ); + static const char* getAttributeValueTag( PDFWriter::StructAttributeValue eVal ); + + // returns true if compression was done + // else false + static bool compressStream( SvMemoryStream* ); + + static void convertLineInfoToExtLineInfo( const LineInfo& rIn, PDFWriter::ExtLineInfo& rOut ); + +private: + bool ImplNewFont() const override; + void ImplClearFontData(bool bNewFontLists) override; + void ImplRefreshFontData(bool bNewFontLists) override; + vcl::Region ClipToDeviceBounds(vcl::Region aRegion) const override; + void DrawHatchLine_DrawLine(const Point& rStartPoint, const Point& rEndPoint) override; + + MapMode m_aMapMode; // PDFWriterImpl scaled units + StyleSettings m_aWidgetStyleSettings; + std::vector< PDFPage > m_aPages; + /* maps object numbers to file offsets (needed for xref) */ + std::vector< sal_uInt64 > m_aObjects; + /* contains Bitmaps until they are written to the + * file stream as XObjects*/ + std::list< BitmapEmit > m_aBitmaps; + /* contains JPG streams until written to file */ + std::vector<JPGEmit> m_aJPGs; + /*--->i56629 contains all named destinations ever set during the PDF creation, + destination id is always the destination's position in this vector + */ + std::vector<PDFNamedDest> m_aNamedDests; + /* contains all dests ever set during the PDF creation, + dest id is always the dest's position in this vector + */ + std::vector<PDFDest> m_aDests; + /** contains destinations accessible via a public Id, instead of being linked to by an ordinary link + */ + ::std::map< sal_Int32, sal_Int32 > m_aDestinationIdTranslation; + /* contains all links ever set during PDF creation, + link id is always the link's position in this vector + */ + std::vector<PDFLink> m_aLinks; + /// Contains all screen annotations. + std::vector<PDFScreen> m_aScreens; + /// Contains embedded files. + std::vector<PDFEmbeddedFile> m_aEmbeddedFiles; + + std::vector<PDFDocumentAttachedFile> m_aDocumentAttachedFiles; + + /* makes correctly encoded for export to PDF URLS + */ + css::uno::Reference< css::util::XURLTransformer > m_xTrans; + /* maps arbitrary link ids for structure attributes to real link ids + (for setLinkPropertyId) + */ + std::map<sal_Int32, sal_Int32> m_aLinkPropertyMap; + /* contains all outline items, + object 0 is the outline root + */ + std::vector<PDFOutlineEntry> m_aOutline; + /* contains all notes set during PDF creation + */ + std::vector<PDFNoteEntry> m_aNotes; + /* the root of the structure tree + */ + std::vector<PDFStructureElement> m_aStructure; + /* current object in the structure hierarchy + */ + sal_Int32 m_nCurrentStructElement; + std::stack<sal_Int32> m_StructElementStack; + /* structure parent tree */ + std::vector< OString > m_aStructParentTree; + /* emit structure marks currently (aka. NonStructElement or not) + */ + bool m_bEmitStructure; + /* role map of struct tree root */ + std::unordered_map< OString, OString > + m_aRoleMap; + /* structure elements (object ids) that should have ID */ + std::unordered_set<sal_Int32> m_StructElemObjsWithID; + + /* contains all widgets used in the PDF + */ + std::vector<PDFWidget> m_aWidgets; + /* maps radio group id to index of radio group control in m_aWidgets */ + std::map< sal_Int32, sal_Int32 > m_aRadioGroupWidgets; + /* unordered_map for field names, used to ensure unique field names */ + std::unordered_map< OString, sal_Int32 > m_aFieldNameMap; + + /* contains Bitmaps for gradient functions until they are written + * to the file stream */ + std::list< GradientEmit > m_aGradients; + /* contains bitmap tiling patterns */ + std::vector< TilingEmit > m_aTilings; + std::vector< TransparencyEmit > m_aTransparentObjects; + /* contains all font subsets in use */ + std::map<const vcl::font::PhysicalFontFace*, FontSubset> m_aSubsets; + std::map<const vcl::font::PhysicalFontFace*, EmbedFont> m_aSystemFonts; + std::map<const vcl::font::PhysicalFontFace*, FontSubset> m_aType3Fonts; + sal_Int32 m_nNextFID; + + /// Cache some most recent bitmaps we've exported, in case we encounter them again.. + o3tl::lru_map<BitmapChecksum, + std::shared_ptr<SvMemoryStream>> m_aPDFBmpCache; + + sal_Int32 m_nCurrentPage; + + sal_Int32 m_nCatalogObject; + // object number of the main signature dictionary + sal_Int32 m_nSignatureObject; + sal_Int64 m_nSignatureContentOffset; + sal_Int64 m_nSignatureLastByteRangeNoOffset; + sal_Int32 m_nResourceDict; + ResourceDict m_aGlobalResourceDict; + sal_Int32 m_nFontDictObject; + std::map< sal_Int32, sal_Int32 > m_aBuildinFontToObjectMap; + + PDFWriter::PDFWriterContext m_aContext; + osl::File m_aFile; + bool m_bOpen; + + ExternalPDFStreams m_aExternalPDFStreams; + + /* output redirection; e.g. to accumulate content streams for + XObjects + */ + std::list< StreamRedirect > m_aOutputStreams; + + std::list< GraphicsState > m_aGraphicsStack; + GraphicsState m_aCurrentPDFState; + + std::unique_ptr<ZCodec> m_pCodec; + std::unique_ptr<SvMemoryStream> m_pMemStream; + + std::set< PDFWriter::ErrorCode > m_aErrors; + + ::comphelper::Hash m_DocDigest; + + sal_uInt64 getCurrentFilePosition() + { + sal_uInt64 nPosition{}; + if (osl::File::E_None != m_aFile.getPos(nPosition)) + { + m_aFile.close(); + m_bOpen = false; + } + return nPosition; + } +/* +variables for PDF security +i12626 +*/ +/* used to cipher the stream data and for password management */ + rtlCipher m_aCipher; + /* pad string used for password in Standard security handler */ + static const sal_uInt8 s_nPadString[ENCRYPTED_PWD_SIZE]; + + /* the encryption key, formed with the user password according to algorithm 3.2, maximum length is 16 bytes + 3 + 2 + for 128 bit security */ + sal_Int32 m_nKeyLength; // key length, 16 or 5 + sal_Int32 m_nRC4KeyLength; // key length, 16 or 10, to be input to the algorithm 3.1 + + /* set to true if the following stream must be encrypted, used inside writeBuffer() */ + bool m_bEncryptThisStream; + + /* the numerical value of the access permissions, according to PDF spec, must be signed */ + sal_Int32 m_nAccessPermissions; + /* string to hold the PDF creation date */ + OString m_aCreationDateString; + /* string to hold the PDF creation date, for PDF/A metadata */ + OString m_aCreationMetaDateString; + /* the buffer where the data are encrypted, dynamically allocated */ + std::vector<sal_uInt8> m_vEncryptionBuffer; + + void addRoleMap(OString aAlias, PDFWriter::StructElement eType); + + /* this function implements part of the PDF spec algorithm 3.1 in encryption, the rest (the actual encryption) is in PDFWriterImpl::writeBuffer */ + void checkAndEnableStreamEncryption( sal_Int32 nObject ) override; + + void disableStreamEncryption() override { m_bEncryptThisStream = false; }; + + /* */ + void enableStringEncryption( sal_Int32 nObject ); + +// test if the encryption is active, if yes than encrypt the unicode string and add to the OStringBuffer parameter + void appendUnicodeTextStringEncrypt( const OUString& rInString, const sal_Int32 nInObjectNumber, OStringBuffer& rOutBuffer ); + + void appendLiteralStringEncrypt( std::u16string_view rInString, const sal_Int32 nInObjectNumber, OStringBuffer& rOutBuffer, rtl_TextEncoding nEnc = RTL_TEXTENCODING_ASCII_US ); + void appendLiteralStringEncrypt( std::string_view rInString, const sal_Int32 nInObjectNumber, OStringBuffer& rOutBuffer ); + + /* creates fonts and subsets that will be emitted later */ + void registerGlyph(const sal_GlyphId, const vcl::font::PhysicalFontFace*, const LogicalFontInstance* pFont, const std::vector<sal_Ucs>&, sal_Int32, sal_uInt8&, sal_Int32&); + void registerSimpleGlyph(const sal_GlyphId, const vcl::font::PhysicalFontFace*, const std::vector<sal_Ucs>&, sal_Int32, sal_uInt8&, sal_Int32&); + + /* emits a text object according to the passed layout */ + /* TODO: remove rText as soon as SalLayout will change so that rText is not necessary anymore */ + void drawVerticalGlyphs( const std::vector<PDFGlyph>& rGlyphs, OStringBuffer& rLine, const Point& rAlignOffset, const Matrix3& rRotScale, double fAngle, double fXScale, sal_Int32 nFontHeight ); + void drawHorizontalGlyphs( const std::vector<PDFGlyph>& rGlyphs, OStringBuffer& rLine, const Point& rAlignOffset, bool bFirst, double fAngle, double fXScale, sal_Int32 nFontHeight, sal_Int32 nPixelFontHeight ); + void drawLayout( SalLayout& rLayout, const OUString& rText, bool bTextLines ); + void drawRelief( SalLayout& rLayout, const OUString& rText, bool bTextLines ); + void drawShadow( SalLayout& rLayout, const OUString& rText, bool bTextLines ); + + /* writes differences between graphics stack and current real PDF + * state to the file + */ + void updateGraphicsState(Mode mode = Mode::DEFAULT); + + /* writes a transparency group object */ + void writeTransparentObject( TransparencyEmit& rObject ); + + /* writes an XObject of type image, may create + a second for the mask + */ + bool writeBitmapObject( const BitmapEmit& rObject, bool bMask = false ); + + void writeJPG( const JPGEmit& rEmit ); + /// Writes the form XObject proxy for the image. + void writeReferenceXObject(const ReferenceXObjectEmit& rEmit); + + /* tries to find the bitmap by its id and returns its emit data if exists, + else creates a new emit data block */ + const BitmapEmit& createBitmapEmit( const BitmapEx& rBitmapEx, const Graphic& rGraphic, std::list<BitmapEmit>& rBitmaps, ResourceDict& rResourceDict, std::list<StreamRedirect>& rOutputStreams ); + const BitmapEmit& createBitmapEmit( const BitmapEx& rBitmapEx, const Graphic& rGraphic ); + + /* writes the Do operation inside the content stream */ + void drawBitmap( const Point& rDestPt, const Size& rDestSize, const BitmapEmit& rBitmap, const Color& rFillColor ); + /* write the function object for a Gradient */ + bool writeGradientFunction( GradientEmit const & rObject ); + /* creates a GradientEmit and returns its object number */ + sal_Int32 createGradient( const Gradient& rGradient, const Size& rSize ); + + /* writes all tilings */ + bool emitTilings(); + /* writes all gradient patterns */ + bool emitGradients(); + /* writes a builtin font object and returns its objectid (or 0 in case of failure ) */ + sal_Int32 emitBuildinFont( const pdf::BuildinFontFace*, sal_Int32 nObject ); + /* writes a type1 system font object and returns its mapping from font ids to object ids (or 0 in case of failure ) */ + std::map< sal_Int32, sal_Int32 > emitSystemFont(const vcl::font::PhysicalFontFace*, EmbedFont const &); + /* writes a type3 font object and appends it to the font id mapping, or returns false in case of failure */ + bool emitType3Font(const vcl::font::PhysicalFontFace*, const FontSubset&, std::map<sal_Int32, sal_Int32>&); + /* writes a font descriptor and returns its object id (or 0) */ + sal_Int32 emitFontDescriptor(const vcl::font::PhysicalFontFace*, FontSubsetInfo const &, sal_Int32 nSubsetID, sal_Int32 nStream); + /* writes a ToUnicode cmap, returns the corresponding stream object */ + sal_Int32 createToUnicodeCMap( sal_uInt8 const * pEncoding, const std::vector<sal_Ucs>& CodeUnits, const sal_Int32* pCodeUnitsPerGlyph, + const sal_Int32* pEncToUnicodeIndex, uint32_t nGlyphs ); + + /* get resource dict object number */ + sal_Int32 getResourceDictObj() + { + if( m_nResourceDict <= 0 ) + m_nResourceDict = createObject(); + return m_nResourceDict; + } + /* get the font dict object */ + sal_Int32 getFontDictObject() + { + if( m_nFontDictObject <= 0 ) + m_nFontDictObject = createObject(); + return m_nFontDictObject; + } + /* push resource into current (redirected) resource dict */ + static void pushResource( ResourceKind eKind, const OString& rResource, sal_Int32 nObject, ResourceDict& rResourceDict, std::list<StreamRedirect>& rOutputStreams ); + void pushResource( ResourceKind eKind, const OString& rResource, sal_Int32 nObject ); + + void appendBuildinFontsToDict( OStringBuffer& rDict ) const; + /* writes the font dictionary and emits all font objects + * returns object id of font directory (or 0 on error) + */ + bool emitFonts(); + /* writes the Resource dictionary; + * returns dict object id (or 0 on error) + */ + sal_Int32 emitResources(); + // appends a dest + bool appendDest( sal_Int32 nDestID, OStringBuffer& rBuffer ); + // write all links + bool emitLinkAnnotations(); + // Write all screen annotations. + bool emitScreenAnnotations(); + + void emitTextAnnotationLine(OStringBuffer & aLine, PDFNoteEntry const & rNote); + static void emitPopupAnnotationLine(OStringBuffer & aLine, PDFPopupAnnotation const & rPopUp); + // write all notes + bool emitNoteAnnotations(); + + // write the appearance streams of a widget + bool emitAppearances( PDFWidget& rWidget, OStringBuffer& rAnnotDict ); + // clean up radio button "On" values + void ensureUniqueRadioOnValues(); + // write all widgets + bool emitWidgetAnnotations(); + // writes all annotation objects + bool emitAnnotations(); + /// Writes embedded files. + bool emitEmbeddedFiles(); + //write the named destination stuff + sal_Int32 emitNamedDestinations();//i56629 + // writes outline dict and tree + sal_Int32 emitOutline(); + template<typename T> void AppendAnnotKid(PDFStructureElement& i_rEle, T & rAnnot); + // puts the attribute objects of a structure element into the returned string, + // helper for emitStructure + OString emitStructureAttributes( PDFStructureElement& rEle ); + //--->i94258 + // the maximum array elements allowed for PDF array object + static const sal_uInt32 ncMaxPDFArraySize = 8191; + //check if internal dummy container are needed in the structure elements + void addInternalStructureContainer( PDFStructureElement& rEle ); + //<---i94258 + // writes document structure + sal_Int32 emitStructure( PDFStructureElement& rEle ); + // writes structure parent tree + sal_Int32 emitStructParentTree( sal_Int32 nTreeObject ); + // writes structure IDTree + sal_Int32 emitStructIDTree(sal_Int32 nTreeObject); + // writes page tree and catalog + bool emitCatalog(); + // writes signature dictionary object + bool emitSignature(); + // creates a PKCS7 object using the ByteRange and overwrite /Contents + // of the signature dictionary + bool finalizeSignature(); + // writes xref and trailer + bool emitTrailer(); + // emits info dict (if applicable) + sal_Int32 emitInfoDict( ); + + // acrobat reader 5 and 6 use the order of the annotations + // as their tab order; since PDF1.5 one can make the + // tab order explicit by using the structure tree + void sortWidgets(); + + // updates the count numbers of outline items + sal_Int32 updateOutlineItemCount( std::vector< sal_Int32 >& rCounts, + sal_Int32 nItemLevel, + sal_Int32 nCurrentItemId ); + // default appearances for widgets + sal_Int32 findRadioGroupWidget( const PDFWriter::RadioButtonWidget& rRadio ); + Font replaceFont( const Font& rControlFont, const Font& rAppSetFont ); + sal_Int32 getBestBuildinFont( const Font& rFont ); + sal_Int32 getSystemFont( const Font& i_rFont ); + + // used for edit and listbox + Font drawFieldBorder( PDFWidget&, const PDFWriter::AnyWidget&, const StyleSettings& ); + + void createDefaultPushButtonAppearance( PDFWidget&, const PDFWriter::PushButtonWidget& rWidget ); + void createDefaultCheckBoxAppearance( PDFWidget&, const PDFWriter::CheckBoxWidget& rWidget ); + void createDefaultRadioButtonAppearance( PDFWidget&, const PDFWriter::RadioButtonWidget& rWidget ); + void createDefaultEditAppearance( PDFWidget&, const PDFWriter::EditWidget& rWidget ); + void createDefaultListBoxAppearance( PDFWidget&, const PDFWriter::ListBoxWidget& rWidget ); + + /* ensure proper escapement and uniqueness of field names */ + void createWidgetFieldName( sal_Int32 i_nWidgetsIndex, const PDFWriter::AnyWidget& i_rInWidget ); + /// See vcl::PDFObjectContainer::createObject(). + sal_Int32 createObject() override; + /// See vcl::PDFObjectContainer::updateObject(). + bool updateObject( sal_Int32 n ) override; + + /// See vcl::PDFObjectContainer::writeBuffer(). + bool writeBufferBytes( const void* pBuffer, sal_uInt64 nBytes ) override; + void beginCompression(); + void endCompression(); + void beginRedirect( SvStream* pStream, const tools::Rectangle& ); + SvStream* endRedirect(); + + void endPage(); + + void beginStructureElementMCSeq(); + enum class EndMode { Default, OnlyStruct }; + void endStructureElementMCSeq(EndMode = EndMode::Default); + /** checks whether a non struct element lies in the ancestor hierarchy + of the current structure element + + @returns + true if no NonStructElement was found in ancestor path and tagged + PDF output is enabled + false else + */ + bool checkEmitStructure(); + + /* draws an emphasis mark */ + void drawEmphasisMark( tools::Long nX, tools::Long nY, const tools::PolyPolygon& rPolyPoly, bool bPolyLine, const tools::Rectangle& rRect1, const tools::Rectangle& rRect2 ); + + /* true if PDF/A-1a or PDF/A-1b is output */ + bool m_bIsPDF_A1; + /* true if PDF/A-2a is output */ + bool m_bIsPDF_A2; + + /* PDF/UA support enabled */ + bool m_bIsPDF_UA; + + bool m_bIsPDF_A3; + + PDFWriter& m_rOuterFace; + + /* + i12626 + methods for PDF security + + pad a password according algorithm 3.2, step 1 */ + static void padPassword( std::u16string_view i_rPassword, sal_uInt8* o_pPaddedPW ); + /* algorithm 3.2: compute an encryption key */ + static bool computeEncryptionKey( EncHashTransporter*, + vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, + sal_Int32 i_nAccessPermissions + ); + /* algorithm 3.3: computing the encryption dictionary'ss owner password value ( /O ) */ + static bool computeODictionaryValue( const sal_uInt8* i_pPaddedOwnerPassword, const sal_uInt8* i_pPaddedUserPassword, + std::vector< sal_uInt8 >& io_rOValue, + sal_Int32 i_nKeyLength + ); + /* algorithm 3.4 or 3.5: computing the encryption dictionary's user password value ( /U ) revision 2 or 3 of the standard security handler */ + static bool computeUDictionaryValue( EncHashTransporter* i_pTransporter, + vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, + sal_Int32 i_nKeyLength, + sal_Int32 i_nAccessPermissions + ); + + static void computeDocumentIdentifier( std::vector< sal_uInt8 >& o_rIdentifier, + const vcl::PDFWriter::PDFDocInfo& i_rDocInfo, + const OString& i_rCString1, + const css::util::DateTime& rCreationMetaDate, + OString& o_rCString2 + ); + static sal_Int32 computeAccessPermissions( const vcl::PDFWriter::PDFEncryptionProperties& i_rProperties, + sal_Int32& o_rKeyLength, sal_Int32& o_rRC4KeyLength ); + void setupDocInfo(); + bool prepareEncryption( const css::uno::Reference< css::beans::XMaterialHolder >& ); + + // helper for playMetafile + void implWriteGradient( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient, + VirtualDevice* pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& ); + void implWriteBitmapEx( const Point& rPoint, const Size& rSize, const BitmapEx& rBitmapEx, const Graphic& i_pGraphic, + VirtualDevice const * pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& ); + + // helpers for CCITT 1bit bitmap stream + void putG4Bits( sal_uInt32 i_nLength, sal_uInt32 i_nCode, BitStreamState& io_rState ); + void putG4Span( tools::Long i_nSpan, bool i_bWhitePixel, BitStreamState& io_rState ); + void writeG4Stream( BitmapReadAccess const * i_pBitmap ); + + // color helper functions + void appendStrokingColor( const Color& rColor, OStringBuffer& rBuffer ); + void appendNonStrokingColor( const Color& rColor, OStringBuffer& rBuffer ); +public: + PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext, const css::uno::Reference< css::beans::XMaterialHolder >&, PDFWriter& ); + ~PDFWriterImpl() override; + void dispose() override; + + static css::uno::Reference< css::beans::XMaterialHolder > + initEncryption( const OUString& i_rOwnerPassword, + const OUString& i_rUserPassword ); + + /* document structure */ + void newPage( double nPageWidth , double nPageHeight, PDFWriter::Orientation eOrientation ); + bool emit(); + const std::set< PDFWriter::ErrorCode > & getErrors() const { return m_aErrors;} + void insertError( PDFWriter::ErrorCode eErr ) { m_aErrors.insert( eErr ); } + void playMetafile( const GDIMetaFile&, vcl::PDFExtOutDevData*, const vcl::PDFWriter::PlayMetafileContext&, VirtualDevice* pDummyDev = nullptr ); + + Size getCurPageSize() const + { + Size aSize; + if( m_nCurrentPage >= 0 && o3tl::make_unsigned(m_nCurrentPage) < m_aPages.size() ) + aSize = Size( m_aPages[ m_nCurrentPage ].m_nPageWidth, m_aPages[ m_nCurrentPage ].m_nPageHeight ); + return aSize; + } + + void setDocumentLocale( const css::lang::Locale& rLoc ) + { m_aContext.DocumentLocale = rLoc; } + + /* graphics state */ + void push( PushFlags nFlags ); + void pop(); + + void setFont( const Font& rFont ); + + void setMapMode( const MapMode& rMapMode ); + + const MapMode& getMapMode() { return m_aGraphicsStack.front().m_aMapMode; } + + void setLineColor( const Color& rColor ) + { + m_aGraphicsStack.front().m_aLineColor = rColor.IsTransparent() ? COL_TRANSPARENT : rColor; + m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsStateUpdateFlags::LineColor; + } + + void setFillColor( const Color& rColor ) + { + m_aGraphicsStack.front().m_aFillColor = rColor.IsTransparent() ? COL_TRANSPARENT : rColor; + m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsStateUpdateFlags::FillColor; + } + + void setTextLineColor() + { + m_aGraphicsStack.front().m_aTextLineColor = COL_TRANSPARENT; + } + + void setTextLineColor( const Color& rColor ) + { + m_aGraphicsStack.front().m_aTextLineColor = rColor; + } + + void setOverlineColor() + { + m_aGraphicsStack.front().m_aOverlineColor = COL_TRANSPARENT; + } + + void setOverlineColor( const Color& rColor ) + { + m_aGraphicsStack.front().m_aOverlineColor = rColor; + } + + void setTextFillColor( const Color& rColor ) + { + m_aGraphicsStack.front().m_aFont.SetFillColor( rColor ); + m_aGraphicsStack.front().m_aFont.SetTransparent( rColor.IsTransparent() ); + m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsStateUpdateFlags::Font; + } + void setTextFillColor() + { + m_aGraphicsStack.front().m_aFont.SetFillColor( COL_TRANSPARENT ); + m_aGraphicsStack.front().m_aFont.SetTransparent( true ); + m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsStateUpdateFlags::Font; + } + void setTextColor( const Color& rColor ) + { + m_aGraphicsStack.front().m_aFont.SetColor( rColor ); + m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsStateUpdateFlags::Font; + } + + void clearClipRegion() + { + m_aGraphicsStack.front().m_aClipRegion.clear(); + m_aGraphicsStack.front().m_bClipRegion = false; + m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsStateUpdateFlags::ClipRegion; + } + + void setClipRegion( const basegfx::B2DPolyPolygon& rRegion ); + + void moveClipRegion( sal_Int32 nX, sal_Int32 nY ); + + void intersectClipRegion( const tools::Rectangle& rRect ); + + void intersectClipRegion( const basegfx::B2DPolyPolygon& rRegion ); + + void setLayoutMode( vcl::text::ComplexTextLayoutFlags nLayoutMode ) + { + m_aGraphicsStack.front().m_nLayoutMode = nLayoutMode; + m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsStateUpdateFlags::LayoutMode; + } + + void setDigitLanguage( LanguageType eLang ) + { + m_aGraphicsStack.front().m_aDigitLanguage = eLang; + m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsStateUpdateFlags::DigitLanguage; + } + + void setTextAlign( TextAlign eAlign ) + { + m_aGraphicsStack.front().m_aFont.SetAlignment( eAlign ); + m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsStateUpdateFlags::Font; + } + + /* actual drawing functions */ + void drawText( const Point& rPos, const OUString& rText, sal_Int32 nIndex, sal_Int32 nLen, bool bTextLines = true ); + void drawTextArray( const Point& rPos, const OUString& rText, KernArraySpan pDXArray, std::span<const sal_Bool> pKashidaArray, sal_Int32 nIndex, sal_Int32 nLen ); + void drawStretchText( const Point& rPos, sal_Int32 nWidth, const OUString& rText, + sal_Int32 nIndex, sal_Int32 nLen ); + void drawText( const tools::Rectangle& rRect, const OUString& rOrigStr, DrawTextFlags nStyle ); + void drawTextLine( const Point& rPos, tools::Long nWidth, FontStrikeout eStrikeout, FontLineStyle eUnderline, FontLineStyle eOverline, bool bUnderlineAbove ); + void drawWaveTextLine( OStringBuffer& aLine, tools::Long nWidth, FontLineStyle eTextLine, Color aColor, bool bIsAbove ); + void drawStraightTextLine( OStringBuffer& aLine, tools::Long nWidth, FontLineStyle eTextLine, Color aColor, bool bIsAbove ); + void drawStrikeoutLine( OStringBuffer& aLine, tools::Long nWidth, FontStrikeout eStrikeout, Color aColor ); + void drawStrikeoutChar( const Point& rPos, tools::Long nWidth, FontStrikeout eStrikeout ); + + void drawLine( const Point& rStart, const Point& rStop ); + void drawLine( const Point& rStart, const Point& rStop, const LineInfo& rInfo ); + void drawPolygon( const tools::Polygon& rPoly ); + void drawPolyPolygon( const tools::PolyPolygon& rPolyPoly ); + void drawPolyLine( const tools::Polygon& rPoly ); + void drawPolyLine( const tools::Polygon& rPoly, const LineInfo& rInfo ); + void drawPolyLine( const tools::Polygon& rPoly, const PDFWriter::ExtLineInfo& rInfo ); + + void drawPixel( const Point& rPt, const Color& rColor ); + + void drawRectangle( const tools::Rectangle& rRect ); + void drawRectangle( const tools::Rectangle& rRect, sal_uInt32 nHorzRound, sal_uInt32 nVertRound ); + void drawEllipse( const tools::Rectangle& rRect ); + void drawArc( const tools::Rectangle& rRect, const Point& rStart, const Point& rStop, bool bWithPie, bool bWidthChord ); + + void drawBitmap( const Point& rDestPoint, const Size& rDestSize, const Bitmap& rBitmap, const Graphic& rGraphic ); + void drawBitmap( const Point& rDestPoint, const Size& rDestSize, const BitmapEx& rBitmap ); + void drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const Size& rSizePixel, const tools::Rectangle& rTargetArea, const AlphaMask& rAlphaMask, const Graphic& rGraphic ); + /// Stores the original PDF data from rGraphic as an embedded file. + void createEmbeddedFile(const Graphic& rGraphic, ReferenceXObjectEmit& rEmit, sal_Int32 nBitmapObject); + + void drawGradient( const tools::Rectangle& rRect, const Gradient& rGradient ); + void drawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& rHatch ); + void drawWallpaper( const tools::Rectangle& rRect, const Wallpaper& rWall ); + void drawTransparent( const tools::PolyPolygon& rPolyPoly, sal_uInt32 nTransparentPercent ); + void beginTransparencyGroup(); + void endTransparencyGroup( const tools::Rectangle& rBoundingBox, sal_uInt32 nTransparentPercent ); + + void emitComment( const char* pComment ); + + //--->i56629 named destinations + sal_Int32 createNamedDest( const OUString& sDestName, const tools::Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType ); + + //--->i59651 + //emits output intent + sal_Int32 emitOutputIntent(); + + //emits the document metadata + sal_Int32 emitDocumentMetadata(); + + // links + sal_Int32 createLink(const tools::Rectangle& rRect, sal_Int32 nPageNr, OUString const& rAltText); + sal_Int32 createDest( const tools::Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType ); + sal_Int32 registerDestReference( sal_Int32 nDestId, const tools::Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType ); + void setLinkDest( sal_Int32 nLinkId, sal_Int32 nDestId ); + void setLinkURL( sal_Int32 nLinkId, const OUString& rURL ); + void setLinkPropertyId( sal_Int32 nLinkId, sal_Int32 nPropertyId ); + + // screens + sal_Int32 createScreen(const tools::Rectangle& rRect, sal_Int32 nPageNr, OUString const& rAltText, OUString const& rMimeType); + void setScreenURL(sal_Int32 nScreenId, const OUString& rURL); + void setScreenStream(sal_Int32 nScreenId, const OUString& rURL); + + // outline + sal_Int32 createOutlineItem( sal_Int32 nParent, std::u16string_view rText, sal_Int32 nDestID ); + void setOutlineItemParent( sal_Int32 nItem, sal_Int32 nNewParent ); + void setOutlineItemText( sal_Int32 nItem, std::u16string_view rText ); + void setOutlineItemDest( sal_Int32 nItem, sal_Int32 nDestID ); + + // notes + void createNote( const tools::Rectangle& rRect, const PDFNote& rNote, sal_Int32 nPageNr ); + // structure elements + sal_Int32 ensureStructureElement(); + void initStructureElement(sal_Int32 id, PDFWriter::StructElement eType, std::u16string_view rAlias); + void beginStructureElement(sal_Int32 id); + void endStructureElement(); + bool setCurrentStructureElement( sal_Int32 nElement ); + bool setStructureAttribute( enum PDFWriter::StructAttribute eAttr, enum PDFWriter::StructAttributeValue eVal ); + bool setStructureAttributeNumerical( enum PDFWriter::StructAttribute eAttr, sal_Int32 nValue ); + void setStructureBoundingBox( const tools::Rectangle& rRect ); + void setStructureAnnotIds(::std::vector<sal_Int32> const& rAnnotIds); + void setActualText( const OUString& rText ); + void setAlternateText( const OUString& rText ); + + // transitional effects + void setPageTransition( PDFWriter::PageTransition eType, sal_uInt32 nMilliSec, sal_Int32 nPageNr ); + + // controls + sal_Int32 createControl( const PDFWriter::AnyWidget& rControl, sal_Int32 nPageNr = -1 ); + + // attached file + void addDocumentAttachedFile(OUString const& rFileName, OUString const& rMimeType, OUString const& rDescription, std::unique_ptr<PDFOutputStream> rStream); + + sal_Int32 addEmbeddedFile(BinaryDataContainer const & rDataContainer); + sal_Int32 addEmbeddedFile(std::unique_ptr<PDFOutputStream> rStream, OUString const& rMimeType); + + // helper: eventually begin marked content sequence and + // emit a comment in debug case + void MARK( const char* pString ); +}; + +} // namespace vcl + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ppdparser.hxx b/vcl/inc/ppdparser.hxx new file mode 100644 index 0000000000..cbc1b94b4e --- /dev/null +++ b/vcl/inc/ppdparser.hxx @@ -0,0 +1,269 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <string_view> +#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 { + +enum class orientation; + +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 bool m_bCustomOptionSetViaApp; + 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; + +private: + + bool m_bUIOption; + int m_nOrderDependency; + + void eraseValue( const OUString& rOption ); +public: + PPDKey( OUString aKey ); + ~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; } + 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 + 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( OUString aFile ); + PPDParser(OUString aFile, const std::vector<PPDKey*>& keys); + + void parseOrderDependency(const OString& rLine); + void parseOpenUI(const OString& rLine, std::string_view 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 ); + + OUString matchPaperImpl(int nWidth, int nHeight, bool bDontSwap = false, psp::orientation* pOrientation = nullptr) const; + +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; } + + OUString getDefaultPaperDimension() const; + void getDefaultPaperDimension( int& rWidth, int& rHeight ) const + { getPaperDimension( getDefaultPaperDimension(), rWidth, rHeight ); } + bool getPaperDimension( std::u16string_view 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, psp::orientation* pOrientation = nullptr ) const; + + bool getMargins( std::u16string_view 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( std::u16string_view, int&, int& ); + // helper function + + OUString translateKey( const OUString& i_rKey ) const; + OUString translateOption( std::u16string_view 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 0000000000..dc61c9cd96 --- /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/QueueInfo.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 0000000000..661e881690 --- /dev/null +++ b/vcl/inc/print.hrc @@ -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_PRINT_HRC +#define INCLUDED_VCL_INC_PRINT_HRC + +#include <unotools/resmgr.hxx> + +#define NC_(Context, String) TranslateId(Context, u8##String) + +const TranslateId RID_STR_PAPERNAMES[] = +{ + // To translators: This is the first entry of a sequence of paper size names + + // This array must (probably) match exactly the enum Paper in <i18nutil/paper.hxx> + + 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)"), + NC_("RID_STR_PAPERNAMES", "16k (197 x 273)"), + NC_("RID_STR_PAPERNAMES", "Widescreen"), + NC_("RID_STR_PAPERNAMES", "On-screen Show (4:3)"), + NC_("RID_STR_PAPERNAMES", "On-screen Show (16:9)"), + // To translators: This is the last entry of the sequence of paper size names + NC_("RID_STR_PAPERNAMES", "On-screen Show (16:10)") +}; + +#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 0000000000..9d94654b4c --- /dev/null +++ b/vcl/inc/printaccessoryview.hrc @@ -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_PRINTACCESSORYVIEW_HRC +#define INCLUDED_VCL_INC_PRINTACCESSORYVIEW_HRC + +#include <unotools/resmgr.hxx> + +#define NC_(Context, String) TranslateId(Context, u8##String) + +const TranslateId 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 0000000000..bf058b0797 --- /dev/null +++ b/vcl/inc/printdlg.hxx @@ -0,0 +1,275 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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/idle.hxx> +#include <vcl/print.hxx> +#include <vcl/customweld.hxx> +#include <vcl/weld.hxx> +#include <map> + +namespace vcl { + class PrintDialog; +} + +namespace vcl +{ + class PrintDialog final : 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 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, + std::u16string_view 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*, std::shared_ptr<PrinterController> ); + virtual ~PrintDialog() override; + + bool isPrintToFile() const; + bool isCollate() const; + bool isSingleJobs() const; + 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<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> mxSingleJobsBox; + std::unique_ptr<weld::CheckButton> mxReverseOrderBox; + + std::unique_ptr<weld::Button> mxOKButton; + std::unique_ptr<weld::Button> mxCancelButton; + + 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; + + Paper mePaper; + + Idle maUpdatePreviewIdle; + DECL_LINK(updatePreviewIdle, Timer*, void); + Idle maUpdatePreviewNoCacheIdle; + DECL_LINK(updatePreviewNoCacheIdle, Timer*, void); + + 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::Toggleable&, void ); + + DECL_LINK( UIOption_CheckHdl, weld::Toggleable&, void ); + DECL_LINK( UIOption_RadioHdl, weld::Toggleable&, void ); + DECL_LINK( UIOption_SelectHdl, weld::ComboBox&, void ); + DECL_LINK( UIOption_SpinModifyHdl, weld::SpinButton&, void ); + DECL_LINK( UIOption_EntryModifyHdl, weld::Entry&, void ); + + css::beans::PropertyValue* getValueForWindow(weld::Widget*) const; + + void preparePreview( bool i_bMayUseCache ); + void setupPaperSidesBox(); + void storeToSettings(); + void readFromSettings(); + void setPaperOrientation( Orientation eOrientation, bool fromUser ); + void updateOrientationBox( bool bAutomatic = true ); + bool hasOrientationChanged() const; + 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 0000000000..67dd8e59b2 --- /dev/null +++ b/vcl/inc/printerinfomanager.hxx @@ -0,0 +1,168 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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; + 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(); + + // 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 ); + + // check whether a printer's feature string contains a subfeature + bool checkFeatureToken( const OUString& rPrinterName, std::string_view pToken ) const; + + virtual ~PrinterInfoManager(); +}; + +} // namespace + +#endif // INCLUDED_VCL_PRINTERINFOMANAGER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtAccessibleEventListener.hxx b/vcl/inc/qt5/QtAccessibleEventListener.hxx new file mode 100644 index 0000000000..f6c7c4866e --- /dev/null +++ b/vcl/inc/qt5/QtAccessibleEventListener.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 "QtAccessibleWidget.hxx" + +#include <cppuhelper/implbase.hxx> + +class QtAccessibleEventListener final + : public cppu::WeakImplHelper<css::accessibility::XAccessibleEventListener> +{ +public: + explicit QtAccessibleEventListener(QtAccessibleWidget* pAccessibleWidget); + + virtual void SAL_CALL + notifyEvent(const css::accessibility::AccessibleEventObject& aEvent) override; + + virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override; + +private: + QtAccessibleWidget* m_pAccessibleWidget; + + static void HandleStateChangedEvent(QAccessibleInterface* pQAccessibleInterface, + const css::accessibility::AccessibleEventObject& rEvent); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtAccessibleRegistry.hxx b/vcl/inc/qt5/QtAccessibleRegistry.hxx new file mode 100644 index 0000000000..87781752f7 --- /dev/null +++ b/vcl/inc/qt5/QtAccessibleRegistry.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/. + */ + +#pragma once + +#include <map> + +#include <QtCore/QObject> + +#include <com/sun/star/accessibility/XAccessible.hpp> + +using namespace css::accessibility; + +/** + * Maintains a mapping between XAccessible objects and the + * associated QObjects. The corresponding QObject can be + * passed to the QAccessible::queryAccessibleInterface method in + * order to retrieve the QAccessibleInterface for the + * XAccessible object. + */ +class QtAccessibleRegistry +{ +private: + static std::map<css::accessibility::XAccessible*, QObject*> m_aMapping; + QtAccessibleRegistry() = delete; + +public: + /** Returns the related QObject* for the XAccessible. Creates a new one if none exists yet. */ + static QObject* getQObject(css::uno::Reference<XAccessible> xAcc); + static void insert(css::uno::Reference<XAccessible> xAcc, QObject* pQObject); + /** Removes the entry for the given XAccessible. */ + static void remove(css::uno::Reference<XAccessible> xAcc); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtAccessibleWidget.hxx b/vcl/inc/qt5/QtAccessibleWidget.hxx new file mode 100644 index 0000000000..8d71ecd0ea --- /dev/null +++ b/vcl/inc/qt5/QtAccessibleWidget.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/. + */ + +#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/QAccessibleTableCellInterface> +#include <QtGui/QAccessibleTableInterface> +#include <QtGui/QAccessibleTextInterface> +#include <QtGui/QAccessibleValueInterface> +#include <QtGui/QColor> +#include <QtGui/QWindow> + +#include <com/sun/star/accessibility/XAccessible.hpp> + +namespace com::sun::star::accessibility +{ +class XAccessibleTable; +} + +class QtFrame; +class QtWidget; + +class QtAccessibleWidget final : public QAccessibleInterface, + public QAccessibleActionInterface, + public QAccessibleTextInterface, + public QAccessibleEditableTextInterface, +#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) + public QAccessibleSelectionInterface, +#endif + public QAccessibleTableCellInterface, + public QAccessibleTableInterface, + public QAccessibleValueInterface +{ +public: + QtAccessibleWidget(const css::uno::Reference<css::accessibility::XAccessible> xAccessible, + QObject* pObject); + + void invalidate(); + + // QAccessibleInterface + 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; + + // 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; + + // QAccessibleTableCellInterface + virtual QList<QAccessibleInterface*> columnHeaderCells() const override; + virtual int columnIndex() const override; + virtual bool isSelected() const override; + virtual int columnExtent() const override; + virtual QList<QAccessibleInterface*> rowHeaderCells() const override; + virtual int rowExtent() const override; + virtual int rowIndex() const override; + virtual QAccessibleInterface* table() const override; + +#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) + // QAccessibleSelectionInterface + virtual int selectedItemCount() const override; + virtual QList<QAccessibleInterface*> selectedItems() const override; + virtual QAccessibleInterface* selectedItem(int selectionIndex) const override; + virtual bool isSelected(QAccessibleInterface* item) const override; + virtual bool select(QAccessibleInterface* item) override; + virtual bool unselect(QAccessibleInterface* item) override; + virtual bool selectAll() override; + virtual bool clear() override; +#else + // no override, but used in QAccessibleTableInterface methods + int selectedItemCount() const; + QList<QAccessibleInterface*> selectedItems() const; +#endif + + // 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; + css::uno::Reference<css::accessibility::XAccessibleTable> getAccessibleTableForParent() const; + + template <class Interface> bool accessibleProvidesInterface() const + { + css::uno::Reference<css::accessibility::XAccessibleContext> xContext + = getAccessibleContextImpl(); + css::uno::Reference<Interface> xInterface(xContext, css::uno::UNO_QUERY); + return xInterface.is(); + } + + QObject* m_pObject; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtBitmap.hxx b/vcl/inc/qt5/QtBitmap.hxx new file mode 100644 index 0000000000..a15deab294 --- /dev/null +++ b/vcl/inc/qt5/QtBitmap.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 QtBitmap final : public SalBitmap +{ + std::unique_ptr<QImage> m_pImage; + BitmapPalette m_aPalette; + +public: + QtBitmap(); + QtBitmap(const QImage& rQImage); + + const QImage* GetQImage() const { return m_pImage.get(); } + + virtual bool Create(const Size& rSize, vcl::PixelFormat ePixelFormat, + 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, vcl::PixelFormat eNewPixelFormat) 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/QtClipboard.hxx b/vcl/inc/qt5/QtClipboard.hxx new file mode 100644 index 0000000000..f07414bfbc --- /dev/null +++ b/vcl/inc/qt5/QtClipboard.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 QtClipboard 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 QtClipboardTransferable + 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 QtClipboard(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 QtClipboard 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/QtData.hxx b/vcl/inc/qt5/QtData.hxx new file mode 100644 index 0000000000..82cfecd57e --- /dev/null +++ b/vcl/inc/qt5/QtData.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <unx/gendata.hxx> + +#include <o3tl/enumarray.hxx> +#include <vcl/ptrstyle.hxx> +#include <memory> +#include <vclpluginapi.h> + +class QCursor; + +class VCLPLUG_QT_PUBLIC QtData final : public GenericUnixSalData +{ + o3tl::enumarray<PointerStyle, std::unique_ptr<QCursor>> m_aCursors; + +public: + explicit QtData(); + virtual ~QtData() override; + + virtual void ErrorTrapPush() override; + virtual bool ErrorTrapPop(bool bIgnoreError = true) override; + + QCursor& getCursor(PointerStyle ePointerStyle); + + static bool noNativeControls(); +}; + +inline QtData* GetQtData() { return static_cast<QtData*>(GetSalData()); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtDragAndDrop.hxx b/vcl/inc/qt5/QtDragAndDrop.hxx new file mode 100644 index 0000000000..0ca1ebfb83 --- /dev/null +++ b/vcl/inc/qt5/QtDragAndDrop.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 QtFrame; + +class QtDragSource final + : public cppu::WeakComponentImplHelper<css::datatransfer::dnd::XDragSource, + css::lang::XInitialization, css::lang::XServiceInfo> +{ + osl::Mutex m_aMutex; + QtFrame* m_pFrame; + css::uno::Reference<css::datatransfer::dnd::XDragSourceListener> m_xListener; + +public: + QtDragSource() + : WeakComponentImplHelper(m_aMutex) + , m_pFrame(nullptr) + { + } + + virtual ~QtDragSource() 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 QtDropTarget 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; + QtFrame* 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: + QtDropTarget(); + virtual ~QtDropTarget() 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/QtFilePicker.hxx b/vcl/inc/qt5/QtFilePicker.hxx new file mode 100644 index 0000000000..58824adbbd --- /dev/null +++ b/vcl/inc/qt5/QtFilePicker.hxx @@ -0,0 +1,186 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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/XAsynchronousExecutableDialog.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 <unotools/resmgr.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::XAsynchronousExecutableDialog, css::ui::dialogs::XFolderPicker2> + QtFilePicker_Base; + +class VCLPLUG_QT_PUBLIC QtFilePicker : public QObject, public QtFilePicker_Base +{ + Q_OBJECT + +private: + css::uno::Reference<css::uno::XComponentContext> m_context; + + css::uno::Reference<css::ui::dialogs::XFilePickerListener> m_xListener; + css::uno::Reference<css::ui::dialogs::XDialogClosedListener> m_xClosedListener; + + 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 QtFilePicker(css::uno::Reference<css::uno::XComponentContext> context, + QFileDialog::FileMode, bool bUseNative = false); + virtual ~QtFilePicker() 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; + + // XAsynchronousExecutableDialog functions + virtual void SAL_CALL setDialogTitle(const OUString&) override; + virtual void SAL_CALL + startExecuteModal(const css::uno::Reference<css::ui::dialogs::XDialogClosedListener>&) 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: + QtFilePicker(const QtFilePicker&) = delete; + QtFilePicker& operator=(const QtFilePicker&) = delete; + + static QString getResString(TranslateId 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); + + void prepareExecute(); + +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(); + void finished(int); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtFont.hxx b/vcl/inc/qt5/QtFont.hxx new file mode 100644 index 0000000000..7d0b338c93 --- /dev/null +++ b/vcl/inc/qt5/QtFont.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 <sal/config.h> + +#include <font/LogicalFontInstance.hxx> + +#include <QtGui/QFont> + +#include "QtFontFace.hxx" + +class QtFont final : public QFont, public LogicalFontInstance +{ + friend rtl::Reference<LogicalFontInstance> + QtFontFace::CreateFontInstance(const vcl::font::FontSelectPattern&) const; + + bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const override; + + explicit QtFont(const vcl::font::PhysicalFontFace&, const vcl::font::FontSelectPattern&); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtFontFace.hxx b/vcl/inc/qt5/QtFontFace.hxx new file mode 100644 index 0000000000..06260468cb --- /dev/null +++ b/vcl/inc/qt5/QtFontFace.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 . + */ + +#pragma once + +#include <sal/config.h> + +#include <vclpluginapi.h> +#include <font/PhysicalFontFace.hxx> + +#include <tools/ref.hxx> + +#include <QtCore/QString> +#include <QtGui/QFont> + +class FontAttributes; +namespace vcl::font +{ +class FontSelectPattern; +} + +class QtFontFace final : public vcl::font::PhysicalFontFace +{ +public: + static QtFontFace* fromQFont(const QFont& rFont); + static QtFontFace* fromQFontDatabase(const QString& aFamily, const QString& aStyle); + static void fillAttributesFromQFont(const QFont& rFont, FontAttributes& rFA); + + VCLPLUG_QT_PUBLIC static FontWeight toFontWeight(const int nWeight); + VCLPLUG_QT_PUBLIC static FontWidth toFontWidth(const int nStretch); + VCLPLUG_QT_PUBLIC static FontItalic toFontItalic(const QFont::Style eStyle); + + sal_IntPtr GetFontId() const override; + + QFont CreateFont() const; + + rtl::Reference<LogicalFontInstance> + CreateFontInstance(const vcl::font::FontSelectPattern& rFSD) const override; + + hb_blob_t* GetHbTable(hb_tag_t nTag) const override; + +private: + typedef enum { Font, FontDB } FontIdType; + + QtFontFace(const QtFontFace&); + QtFontFace(const FontAttributes&, QString rFontID, const FontIdType); + + const QString m_aFontId; + const FontIdType m_eFontIdType; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx new file mode 100644 index 0000000000..b80818687c --- /dev/null +++ b/vcl/inc/qt5/QtFrame.hxx @@ -0,0 +1,237 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 "QtTools.hxx" +#include "QtWidget.hxx" + +#include <headless/svpgdi.hxx> +#include <vcl/svapp.hxx> +#include <vcl/sysdata.hxx> + +#include <QtCore/QObject> + +#if CHECK_ANY_QT_USING_X11 +#include <unx/sessioninhibitor.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 QtDragSource; +class QtDropTarget; +class QtGraphics; +class QtInstance; +class QtMainWindow; +class QtMenu; +class QtSvpGraphics; + +class QDragMoveEvent; +class QDropEvent; +class QImage; +class QMimeData; +class QPaintDevice; +class QScreen; +class QWidget; + +class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public SalFrame +{ + Q_OBJECT + + friend class QtWidget; + + QtWidget* m_pQWidget; + QtMainWindow* m_pTopLevel; + + const bool m_bUseCairo; + std::unique_ptr<QImage> m_pQImage; + std::unique_ptr<QtGraphics> m_pQtGraphics; + UniqueCairoSurface m_pSurface; + std::unique_ptr<QtSvpGraphics> m_pSvpGraphics; + DamageHandler m_aDamageHandler; + QRegion m_aRegion; + bool m_bNullRegion; + + bool m_bGraphicsInUse; + SalFrameStyleFlags m_nStyle; + QtFrame* m_pParent; + PointerStyle m_ePointerStyle; + + SystemEnvData m_aSystemData; + + QtDragSource* m_pDragSource; + QtDropTarget* 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 CHECK_ANY_QT_USING_X11 + SessionManagerInhibitor m_SessionManagerInhibitor; + ModKeyFlags m_nKeyModifiers; +#endif + + LanguageType m_nInputLanguage; + + OUString m_aTooltipText; + QRect m_aTooltipArea; + + 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); + +private Q_SLOTS: + void screenChanged(QScreen*); + +public: + QtFrame(QtFrame* pParent, SalFrameStyleFlags nSalFrameStyle, bool bUseCairo); + virtual ~QtFrame() override; + + QWidget* GetQWidget() const { return m_pQWidget; } + QtMainWindow* GetTopLevelWindow() const { return m_pTopLevel; } + QWidget* asChild() const; + qreal devicePixelRatioF() const; + int menuBarOffset() const; + + void Damage(sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 nExtentsWidth, + sal_Int32 nExtentsHeight) const; + + 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 registerDragSource(QtDragSource* pDragSource); + virtual void deregisterDragSource(QtDragSource const* pDragSource); + virtual void registerDropTarget(QtDropTarget* pDropTarget); + virtual void deregisterDropTarget(QtDropTarget 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(tools::Long nWidth, tools::Long nHeight) override; + virtual void SetMaxClientSize(tools::Long nWidth, tools::Long nHeight) override; + virtual void SetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, + sal_uInt16 nFlags) override; + virtual void GetClientSize(tools::Long& rWidth, tools::Long& rHeight) override; + virtual void GetWorkArea(AbsoluteScreenPixelRectangle& rRect) override; + virtual SalFrame* GetParent() const override; + virtual void SetModal(bool bModal) override; + virtual bool GetModal() const override; + virtual void SetWindowState(const vcl::WindowData*) override; + virtual bool GetWindowState(vcl::WindowData*) 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(tools::Long nX, tools::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 void SetPluginParent(SystemParentData* pNewParent) override; + virtual void ResetClipRegion() override; + virtual void BeginSetClipRegion(sal_uInt32 nRects) override; + virtual void UnionClipRegion(tools::Long nX, tools::Long nY, tools::Long nWidth, + tools::Long nHeight) override; + virtual void EndSetClipRegion() override; + + virtual void SetScreenNumber(unsigned int) override; + virtual void SetApplicationID(const OUString&) override; + virtual void ResolveWindowHandle(SystemEnvData& rData) const override; + virtual bool GetUseDarkMode() const override; + virtual bool GetUseReducedAnimation() const override; + + inline bool CallCallback(SalEvent nEvent, const void* pEvent) const; + + void setInputLanguage(LanguageType); + inline bool isPopup() const; + static void FillSystemEnvData(SystemEnvData&, sal_IntPtr pWindow, QWidget* pWidget); +}; + +inline bool QtFrame::CallCallback(SalEvent nEvent, const void* pEvent) const +{ + SolarMutexGuard aGuard; + return SalFrame::CallCallback(nEvent, pEvent); +} + +inline bool QtFrame::isPopup() const +{ + return ((m_nStyle & SalFrameStyleFlags::FLOAT) + && !(m_nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtGraphics.hxx b/vcl/inc/qt5/QtGraphics.hxx new file mode 100644 index 0000000000..fce2b0d9b5 --- /dev/null +++ b/vcl/inc/qt5/QtGraphics.hxx @@ -0,0 +1,240 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <sal/config.h> + +#include <salgdi.hxx> + +#include <memory> +#include <optional> + +#include <QtGui/QPainter> +#include <QtGui/QPainterPath> +#include <QtGui/QRegion> + +#include "QtGraphicsBase.hxx" + +namespace vcl::font +{ +class PhysicalFontCollection; +} +class QImage; +class QPushButton; +class QtFont; +class QtFontFace; +class QtFrame; +class QtPainter; + +class QtGraphicsBackend final : public SalGraphicsImpl, public QtGraphicsBase +{ + friend class QtPainter; + + QtFrame* m_pFrame; + QImage* m_pQImage; + QRegion m_aClipRegion; + QPainterPath m_aClipPath; + std::optional<Color> m_oLineColor; + std::optional<Color> m_oFillColor; + QPainter::CompositionMode m_eCompositionMode; + +public: + QtGraphicsBackend(QtFrame* pFrame, QImage* pQImage); + ~QtGraphicsBackend() override; + + void Init() override {} + + QImage* getQImage() { return m_pQImage; } + + void setQImage(QImage* pQImage) { m_pQImage = pQImage; } + + void freeResources() override {} + + OUString getRenderBackendName() const override { return "qt5"; } + + void setClipRegion(vcl::Region const& rRegion) override; + void ResetClipRegion() override; + + sal_uInt16 GetBitCount() const override; + + tools::Long GetGraphicsWidth() const override; + + void SetLineColor() override; + void SetLineColor(Color nColor) override; + void SetFillColor() override; + void SetFillColor(Color nColor) override; + void SetXORMode(bool bSet, bool bInvertOnly) override; + void SetROPLineColor(SalROPColor nROPColor) override; + void SetROPFillColor(SalROPColor nROPColor) override; + + void drawPixel(tools::Long nX, tools::Long nY) override; + void drawPixel(tools::Long nX, tools::Long nY, Color nColor) override; + + void drawLine(tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2) override; + void drawRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight) override; + void drawPolyLine(sal_uInt32 nPoints, const Point* pPointArray) override; + void drawPolygon(sal_uInt32 nPoints, const Point* pPointArray) override; + void drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints, + const Point** pPointArray) override; + + void drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolyPolygon&, double fTransparency) override; + + 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; + + bool drawPolyLineBezier(sal_uInt32 nPoints, const Point* pPointArray, + const PolyFlags* pFlagArray) override; + + bool drawPolygonBezier(sal_uInt32 nPoints, const Point* pPointArray, + const PolyFlags* pFlagArray) override; + + bool drawPolyPolygonBezier(sal_uInt32 nPoly, const sal_uInt32* pPoints, + const Point* const* pPointArray, + const PolyFlags* const* pFlagArray) override; + + void copyArea(tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX, tools::Long nSrcY, + tools::Long nSrcWidth, tools::Long nSrcHeight, bool bWindowInvalidate) override; + + void copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics) override; + + void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) override; + + void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, + const SalBitmap& rMaskBitmap) override; + + void drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, + Color nMaskColor) override; + + std::shared_ptr<SalBitmap> getBitmap(tools::Long nX, tools::Long nY, tools::Long nWidth, + tools::Long nHeight) override; + + Color getPixel(tools::Long nX, tools::Long nY) override; + + void invert(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, + SalInvert nFlags) override; + + void invert(sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags) override; + + bool drawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, + void* pPtr, sal_uInt32 nSize) override; + + bool blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap) override; + + bool blendAlphaBitmap(const SalTwoRect&, const SalBitmap& rSrcBitmap, + const SalBitmap& rMaskBitmap, const SalBitmap& rAlphaBitmap) override; + + 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, double fAlpha) override; + + bool hasFastDrawTransformedBitmap() const override; + + bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, + sal_uInt8 nTransparency) override; + + bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) override; + bool implDrawGradient(basegfx::B2DPolyPolygon const& rPolyPolygon, + SalGradient const& rGradient) override; + + bool supportsOperation(OutDevSupportType eType) const override; + +private: + void drawScaledImage(const SalTwoRect& rPosAry, const QImage& rImage); +}; + +class QtGraphics final : public SalGraphicsAutoDelegateToImpl, public QtGraphicsBase +{ + friend class QtBitmap; + + std::unique_ptr<QtGraphicsBackend> m_pBackend; + + QtFrame* m_pFrame; + + rtl::Reference<QtFont> m_pTextStyle[MAX_FALLBACK]; + Color m_aTextColor; + + QtGraphics(QtFrame* pFrame, QImage* pQImage); + + void drawScaledImage(const SalTwoRect& rPosAry, const QImage& rImage); + + void handleDamage(const tools::Rectangle&) override; + +public: + QtGraphics(QtFrame* pFrame) + : QtGraphics(pFrame, nullptr) + { + } + QtGraphics(QImage* pQImage) + : QtGraphics(nullptr, pQImage) + { + } + virtual ~QtGraphics() override; + + QImage* getQImage() { return m_pBackend->getQImage(); } + + void ChangeQImage(QImage* pImage); + + virtual SalGraphicsImpl* GetImpl() const override; + virtual SystemGraphicsData GetGraphicsData() const override; + virtual OUString getRenderBackendName() const override + { + return m_pBackend->getRenderBackendName(); + } + +#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; +#endif // ENABLE_CAIRO_CANVAS + + // GDI + + virtual void GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) override; + + // Text rendering + font support + + virtual void SetTextColor(Color nColor) override; + virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) override; + virtual void GetFontMetric(FontMetricDataRef&, int nFallbackLevel) override; + virtual FontCharMapRef GetFontCharMap() const override; + virtual bool GetFontCapabilities(vcl::FontCapabilities& rFontCapabilities) const override; + virtual void GetDevFontList(vcl::font::PhysicalFontCollection*) override; + virtual void ClearDevFontCache() override; + virtual bool AddTempDevFont(vcl::font::PhysicalFontCollection*, const OUString& rFileURL, + const OUString& rFontName) 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/QtGraphicsBase.hxx b/vcl/inc/qt5/QtGraphicsBase.hxx new file mode 100644 index 0000000000..73c39fb5ba --- /dev/null +++ b/vcl/inc/qt5/QtGraphicsBase.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/. + */ + +#pragma once + +#include <QtWidgets/QApplication> + +class QtGraphicsBase +{ + qreal m_fDPR; + +public: + QtGraphicsBase() + : m_fDPR(qApp ? qApp->devicePixelRatio() : 1.0) + { + } + + void setDevicePixelRatioF(qreal fDPR) { m_fDPR = fDPR; } + + qreal devicePixelRatioF() const { return m_fDPR; } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtGraphics_Controls.hxx b/vcl/inc/qt5/QtGraphics_Controls.hxx new file mode 100644 index 0000000000..dd1865e340 --- /dev/null +++ b/vcl/inc/qt5/QtGraphics_Controls.hxx @@ -0,0 +1,100 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#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 QtGraphicsBase; + +class QtGraphics_Controls final : public vcl::WidgetDrawInterface +{ + std::unique_ptr<QImage> m_image; + QRect m_lastPopupRect; + QtGraphicsBase const& m_rGraphics; + +public: + QtGraphics_Controls(const QtGraphicsBase& 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, + const QWidget* pWidget = 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& rOption, QImage* image, + const Color& rBackgroundColor, QStyle::State const state = QStyle::State_None, + QRect rect = QRect()); + void draw(QStyle::PrimitiveElement element, QStyleOption& rOption, QImage* image, + const Color& rBackgroundColor, QStyle::State const state = QStyle::State_None, + QRect rect = QRect()); + void draw(QStyle::ComplexControl element, QStyleOptionComplex& rOption, QImage* image, + const Color& rBackgroundColor, QStyle::State const state = QStyle::State_None); + void drawFrame(QStyle::PrimitiveElement element, QImage* image, const Color& rBackGroundColor, + 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/QtInstance.hxx b/vcl/inc/qt5/QtInstance.hxx new file mode 100644 index 0000000000..2073c8ac05 --- /dev/null +++ b/vcl/inc/qt5/QtInstance.hxx @@ -0,0 +1,192 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 "QtFilePicker.hxx" + +class QtFrame; +class QtTimer; + +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_QT_PUBLIC QtInstance : public QObject, + public SalGenericInstance, + public SalUserEventList +{ + Q_OBJECT + + osl::Condition m_aWaitingYieldCond; + const bool m_bUseCairo; + QtTimer* m_pTimer; + bool m_bSleeping; + 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; + + QtFrame* m_pActivePopup; + + DECL_DLLPRIVATE_LINK(updateStyleHdl, Timer*, void); + void AfterAppInit() override; + +private Q_SLOTS: + bool ImplYield(bool bWait, bool bHandleAllCurrentEvents); + static void deleteObjectLater(QObject* pObject); + static void localeChanged(); + + void orientationChanged(Qt::ScreenOrientation); + void primaryScreenChanged(QScreen*); + void screenAdded(QScreen*); + void screenRemoved(QScreen*); + void virtualGeometryChanged(const QRect&); + +Q_SIGNALS: + bool ImplYieldSignal(bool bWait, bool bHandleAllCurrentEvents); + void deleteObjectLaterSignal(QObject* pObject); + +protected: + virtual rtl::Reference<QtFilePicker> + createPicker(css::uno::Reference<css::uno::XComponentContext> const& context, + QFileDialog::FileMode); + bool useCairo() const { return m_bUseCairo; } + // encodes cairo usage and Qt platform name into the ToolkitName + OUString constructToolkitID(std::u16string_view sTKname); + void connectQScreenSignals(const QScreen*); + void notifyDisplayChanged(); + +public: + explicit QtInstance(std::unique_ptr<QApplication>& pQApp); + virtual ~QtInstance() 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& rGraphics, tools::Long& nDX, tools::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; + +// so we fall back to the default abort, instead of duplicating it... +#ifndef EMSCRIPTEN + virtual OpenGLContext* CreateOpenGLContext() override; +#endif + + 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> + ImplCreateDragSource(const SystemEnvData*) override; + virtual css::uno::Reference<css::uno::XInterface> + ImplCreateDropTarget(const SystemEnvData*) override; + + // whether to reduce animations; KFSalInstance overrides this to read Plasma settings + virtual bool GetUseReducedAnimation() { return false; } + void UpdateStyle(bool bFontsChanged); + + void* CreateGStreamerSink(const SystemChildWindow*) override; + + bool DoExecute(int& nExitCode) override; + void DoQuit() override; + + QtFrame* activePopup() const { return m_pActivePopup; } + void setActivePopup(QtFrame*); +}; + +inline QtInstance* GetQtInstance() { return static_cast<QtInstance*>(GetSalInstance()); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtMainWindow.hxx b/vcl/inc/qt5/QtMainWindow.hxx new file mode 100644 index 0000000000..29621310b7 --- /dev/null +++ b/vcl/inc/qt5/QtMainWindow.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 "QtFrame.hxx" + +class QtMainWindow final : public QMainWindow +{ + Q_OBJECT + + QtFrame& m_rFrame; + + virtual void closeEvent(QCloseEvent* pEvent) override; + void moveEvent(QMoveEvent*) override; + +public: + QtMainWindow(QtFrame& rFrame, Qt::WindowFlags f = Qt::WindowFlags()); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtMenu.hxx b/vcl/inc/qt5/QtMenu.hxx new file mode 100644 index 0000000000..587e1cfea8 --- /dev/null +++ b/vcl/inc/qt5/QtMenu.hxx @@ -0,0 +1,138 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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 QAbstractButton; +class QAction; +class QActionGroup; +class QButtonGroup; +class QMenu; +class QMenuBar; +class QPushButton; +class QtMenuItem; +class QtFrame; + +/* + * QtMenu 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 QtMenu (held in 'mpOwnedQMenu'). + * (3) a "submenu" in an existing menu (like (1)), in which case the corresponding + * QMenu object is owned by the corresponding QtMenuItem. + * + * For (2) and (3), member 'mpQMenu' points to the corresponding QMenu object. + */ +class QtMenu : public QObject, public SalMenu +{ + Q_OBJECT +private: + std::vector<QtMenuItem*> maItems; + VclPtr<Menu> mpVCLMenu; + QtMenu* mpParentSalMenu; + QtFrame* mpFrame; + bool mbMenuBar; + QMenuBar* mpQMenuBar; + // self-created QMenu that this QtMenu represents, if applicable (s. comment for class) + std::unique_ptr<QMenu> mpOwnedQMenu; + // pointer to QMenu owned by the corresponding QtMenuItem or self (-> mpOwnedQMenu) + QMenu* mpQMenu; + QButtonGroup* m_pButtonGroup; + + // help ID of currently/last selected item + static OUString m_sCurrentHelpId; + + void DoFullMenuUpdate(Menu* pMenuBar); + static void NativeItemText(OUString& rItemText); + + void InsertMenuItem(QtMenuItem* pSalMenuItem, unsigned nPos); + + void ReinitializeActionGroup(unsigned nPos); + void ResetAllActionGroups(); + void UpdateActionGroupItem(const QtMenuItem* pSalMenuItem); + bool validateQMenuBar() const; + QPushButton* ImplAddMenuBarButton(const QIcon& rIcon, const QString& rToolTip, int nId); + void ImplRemoveMenuBarButton(int nId); + void connectHelpShortcut(QMenu* pMenu); + // set slots that handle signals relevant for help menu + void connectHelpSignalSlots(QMenu* pMenu, QtMenuItem* pSalMenuItem); + +public: + QtMenu(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; + virtual void ShowMenuBar(bool bVisible) override; + virtual bool ShowNativePopupMenu(FloatingWindow* pWin, const tools::Rectangle& rRect, + FloatWinPopupFlags nFlags) override; + QtMenu* 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; + virtual bool AddMenuBarButton(const SalMenuButtonItem&) override; + virtual void RemoveMenuBarButton(sal_uInt16 nId) override; + virtual tools::Rectangle GetMenuBarButtonRectPixel(sal_uInt16 nId, SalFrame*) override; + virtual int GetMenuBarHeight() const override; + + void SetMenu(Menu* pMenu) { mpVCLMenu = pMenu; } + Menu* GetMenu() { return mpVCLMenu; } + unsigned GetItemCount() const { return maItems.size(); } + QtMenuItem* GetItemAtPos(unsigned nPos) { return maItems[nPos]; } + +private slots: + static void slotShowHelp(); + static void slotMenuHovered(QtMenuItem* pItem); + static void slotMenuTriggered(QtMenuItem* pQItem); + static void slotMenuAboutToShow(QtMenuItem* pQItem); + static void slotMenuAboutToHide(QtMenuItem* pQItem); + void slotCloseDocument(); + void slotMenuBarButtonClicked(QAbstractButton*); +}; + +class QtMenuItem : public SalMenuItem +{ +public: + QtMenuItem(const SalItemParams*); + + QAction* getAction() const; + + QtMenu* mpParentMenu; // The menu into which this menu item is inserted + QtMenu* 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/QtObject.hxx b/vcl/inc/qt5/QtObject.hxx new file mode 100644 index 0000000000..bc5a8e584b --- /dev/null +++ b/vcl/inc/qt5/QtObject.hxx @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <salobj.hxx> +#include <vcl/sysdata.hxx> + +#include <QtCore/QObject> +#include <QtGui/QRegion> +#include <QtWidgets/QWidget> + +class QtFrame; +class QtObjectWidget; +class QWindow; + +class QtObject final : public QObject, public SalObject +{ + Q_OBJECT + + SystemEnvData m_aSystemData; + QtFrame* m_pParent; + QtObjectWidget* m_pQWidget; + QRegion m_pRegion; + bool m_bForwardKey; + +public: + QtObject(QtFrame* pParent, bool bShow); + ~QtObject() override; + + QtFrame* frame() const { return m_pParent; } + inline QWidget* widget() const; + QWindow* windowHandle() const; + bool forwardKey() const { return m_bForwardKey; } + + virtual void ResetClipRegion() override; + virtual void BeginSetClipRegion(sal_uInt32 nRects) override; + virtual void UnionClipRegion(tools::Long nX, tools::Long nY, tools::Long nWidth, + tools::Long nHeight) override; + virtual void EndSetClipRegion() override; + + virtual void SetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, + tools::Long nHeight) override; + virtual void Show(bool bVisible) override; + + virtual void SetForwardKey(bool bEnable) override; + + virtual const SystemEnvData* GetSystemData() const override { return &m_aSystemData; } + + virtual void Reparent(SalFrame* pFrame) override; +}; + +class QtObjectWidget final : public QWidget +{ + QtObject& m_rParent; + + void focusInEvent(QFocusEvent*) override; + void focusOutEvent(QFocusEvent*) override; + void mousePressEvent(QMouseEvent*) override; + void mouseReleaseEvent(QMouseEvent*) override; + void keyPressEvent(QKeyEvent*) override; + void keyReleaseEvent(QKeyEvent*) override; + +public: + explicit QtObjectWidget(QtObject& rParent); +}; + +QWidget* QtObject::widget() const { return m_pQWidget; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtOpenGLContext.hxx b/vcl/inc/qt5/QtOpenGLContext.hxx new file mode 100644 index 0000000000..8036d50777 --- /dev/null +++ b/vcl/inc/qt5/QtOpenGLContext.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 QtOpenGLContext 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/QtPainter.hxx b/vcl/inc/qt5/QtPainter.hxx new file mode 100644 index 0000000000..9702a19bdb --- /dev/null +++ b/vcl/inc/qt5/QtPainter.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 . + */ + +#pragma once + +#include <QtCore/QRectF> +#include <QtGui/QPainter> +#include <QtWidgets/QWidget> + +#include "QtFrame.hxx" +#include "QtGraphics.hxx" + +class QtPainter final : public QPainter +{ + QtGraphicsBackend& m_rGraphics; + QRegion m_aRegion; + +public: + QtPainter(QtGraphicsBackend& rGraphics, bool bPrepareBrush = false, + sal_uInt8 nTransparency = 255); + ~QtPainter() + { + 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/QtPrinter.hxx b/vcl/inc/qt5/QtPrinter.hxx new file mode 100644 index 0000000000..5aacfd44ec --- /dev/null +++ b/vcl/inc/qt5/QtPrinter.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 QtPrinter final : public PspSalPrinter +{ +public: + QtPrinter(SalInfoPrinter* pInfoPrinter); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtSvpGraphics.hxx b/vcl/inc/qt5/QtSvpGraphics.hxx new file mode 100644 index 0000000000..da3786eee1 --- /dev/null +++ b/vcl/inc/qt5/QtSvpGraphics.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <vclpluginapi.h> +#include <headless/svpgdi.hxx> + +#include "QtGraphicsBase.hxx" + +class QtFrame; + +class VCLPLUG_QT_PUBLIC QtSvpGraphics final : public SvpSalGraphics, public QtGraphicsBase +{ + QtFrame* const m_pFrame; + + void handleDamage(const tools::Rectangle&) override; + +public: + QtSvpGraphics(QtFrame* pFrame); + ~QtSvpGraphics() 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/QtSvpSurface.hxx b/vcl/inc/qt5/QtSvpSurface.hxx new file mode 100644 index 0000000000..d86553643e --- /dev/null +++ b/vcl/inc/qt5/QtSvpSurface.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 QtSvpGraphics; +class OutputDevice; + +namespace cairo +{ +class QtSvpSurface final : public Surface +{ + const QtSvpGraphics* m_pGraphics; + cairo_t* const m_pCairoContext; + CairoSurfaceSharedPtr m_pSurface; + +public: + /// takes over ownership of passed cairo_surface + explicit QtSvpSurface(CairoSurfaceSharedPtr pSurface); + /// create surface on subarea of given drawable + explicit QtSvpSurface(const QtSvpGraphics* pGraphics, int x, int y, int width, int height); + ~QtSvpSurface() 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/QtSystem.hxx b/vcl/inc/qt5/QtSystem.hxx new file mode 100644 index 0000000000..760520f42a --- /dev/null +++ b/vcl/inc/qt5/QtSystem.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/. + */ + +#pragma once + +#include <unx/gensys.h> + +class QtSystem final : public SalGenericSystem +{ +public: + virtual unsigned int GetDisplayScreenCount() override; + virtual AbsoluteScreenPixelRectangle + 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/QtTimer.hxx b/vcl/inc/qt5/QtTimer.hxx new file mode 100644 index 0000000000..204b1bfe43 --- /dev/null +++ b/vcl/inc/qt5/QtTimer.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <saltimer.hxx> +#include <QtCore/QTimer> + +class QtTimer 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: + QtTimer(); + + int remainingTime() const { return m_aTimer.remainingTime(); } + + virtual void Start(sal_uInt64 nMS) override; + virtual void Stop() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtTools.hxx b/vcl/inc/qt5/QtTools.hxx new file mode 100644 index 0000000000..5a0032ccc3 --- /dev/null +++ b/vcl/inc/qt5/QtTools.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <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 <vcl/bitmap/BitmapTypes.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(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 AbsoluteScreenPixelRectangle& 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(), rColor.GetAlpha()); +} + +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; +} + +constexpr QImage::Format Qt_DefaultFormat32 = QImage::Format_ARGB32; + +inline QImage::Format getBitFormat(vcl::PixelFormat ePixelFormat) +{ + switch (ePixelFormat) + { + case vcl::PixelFormat::N8_BPP: + return QImage::Format_Indexed8; + case vcl::PixelFormat::N24_BPP: + return QImage::Format_RGB888; + case vcl::PixelFormat::N32_BPP: + return Qt_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 Qt_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); + +template <typename charT, typename traits> +inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream, + const QString& rString) +{ + return stream << toOUString(rString); +} + +template <typename charT, typename traits> +inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream, + const QRect& rRect) +{ + return stream << toRectangle(rRect); +} + +template <typename charT, typename traits> +inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream, + const QSize& rSize) +{ + return stream << toSize(rSize); +} + +template <typename charT, typename traits> +inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream, + const QPoint& rPoint) +{ + return stream << toPoint(rPoint); +} + +#define CHECK_QT5_USING_X11 (QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT5_USING_X11) + +#define CHECK_QT6_USING_X11 (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && QT6_USING_X11) + +#define CHECK_ANY_QT_USING_X11 CHECK_QT5_USING_X11 || CHECK_QT6_USING_X11 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtTransferable.hxx b/vcl/inc/qt5/QtTransferable.hxx new file mode 100644 index 0000000000..5f1533dd59 --- /dev/null +++ b/vcl/inc/qt5/QtTransferable.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/. + * + */ + +#pragma once + +#include <cppuhelper/compbase.hxx> +#include <com/sun/star/datatransfer/XTransferable.hpp> + +#include <QtCore/QMimeData> +#include <QtCore/QStringList> +#include <QtGui/QClipboard> + +/** + * QtTransferable classes are used to read QMimeData via the XTransferable + * interface. All the functionality is already implemented in the QtTransferable. + * + * 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 QtMimeData, which is defined below. + **/ +class QtTransferable : public cppu::WeakImplHelper<css::datatransfer::XTransferable> +{ + QtTransferable(const QtTransferable&) = delete; + + const QMimeData* m_pMimeData; + osl::Mutex m_aMutex; + bool m_bProvideUTF16FromOtherEncoding; + css::uno::Sequence<css::datatransfer::DataFlavor> m_aMimeTypeSeq; + +public: + QtTransferable(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 QtClipboardTransferable final : public QtTransferable +{ + // to detect in-flight QMimeData changes + const QClipboard::Mode m_aMode; + + bool hasInFlightChanged() const; + +public: + explicit QtClipboardTransferable(const QClipboard::Mode aMode, const QMimeData* pMimeData); + + // these are the same then QtTransferable, 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 QtTransferable QtDnDTransferable; + +/** + * 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 QtTransferable. + **/ +class QtMimeData final : public QMimeData +{ + friend class QtClipboardTransferable; + + 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; + +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + QVariant retrieveData(const QString& mimeType, QVariant::Type type) const override; +#else + QVariant retrieveData(const QString& mimeType, QMetaType type) const override; +#endif + +public: + explicit QtMimeData(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/QtVirtualDevice.hxx b/vcl/inc/qt5/QtVirtualDevice.hxx new file mode 100644 index 0000000000..2481f63d06 --- /dev/null +++ b/vcl/inc/qt5/QtVirtualDevice.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 <vector> + +#include <QtCore/QSize> + +class QtGraphics; +class QImage; +enum class DeviceFormat; + +class QtVirtualDevice final : public SalVirtualDevice +{ + std::vector<QtGraphics*> m_aGraphics; + std::unique_ptr<QImage> m_pImage; + QSize m_aFrameSize; + double m_fScale; + +public: + QtVirtualDevice(double fScale); + + // SalVirtualDevice + virtual SalGraphics* AcquireGraphics() override; + virtual void ReleaseGraphics(SalGraphics* pGraphics) override; + + virtual bool SetSize(tools::Long nNewDX, tools::Long nNewDY) override; + virtual bool SetSizeUsingBuffer(tools::Long nNewDX, tools::Long nNewDY, + sal_uInt8* pBuffer) override; + + // SalGeometryProvider + virtual tools::Long GetWidth() const override; + virtual tools::Long GetHeight() const override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx new file mode 100644 index 0000000000..ca0165401e --- /dev/null +++ b/vcl/inc/qt5/QtWidget.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 . + */ + +#pragma once + +#include <QtCore/QRect> +#include <QtWidgets/QGestureEvent> +#include <QtWidgets/QWidget> +#include <rtl/ustring.hxx> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/accessibility/XAccessibleEditableText.hpp> + +class QInputEvent; +class QtFrame; +class QtObject; +struct SalAbstractMouseEvent; + +class QtWidget : public QWidget +{ + Q_OBJECT + + QtFrame& m_rFrame; + bool m_bNonEmptyIMPreeditSeen; + mutable bool m_bInInputMethodQueryCursorRectangle; + mutable QRect m_aImCursorRectangle; + int m_nDeltaX; + int m_nDeltaY; + + static void commitText(QtFrame&, const QString& aText); + static void deleteReplacementText(QtFrame& rFrame, int nReplacementStart, + int nReplacementLength); + static bool handleGestureEvent(QtFrame& rFrame, QGestureEvent* pGestureEvent); + static bool handleKeyEvent(QtFrame&, const QWidget&, QKeyEvent*); + static void handleMouseEnterLeaveEvents(const QtFrame&, QEvent*); + static void fillSalAbstractMouseEvent(const QtFrame& rFrame, const QInputEvent* pQEvent, + const QPoint& rPos, Qt::MouseButtons eButtons, int nWidth, + SalAbstractMouseEvent& aSalEvent); + + 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 hideEvent(QHideEvent*) override; + virtual void wheelEvent(QWheelEvent*) override; + virtual void closeEvent(QCloseEvent*) override; + virtual void changeEvent(QEvent*) override; + virtual void leaveEvent(QEvent*) override; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent*) override; +#else + virtual void enterEvent(QEvent*) override; +#endif + + void inputMethodEvent(QInputMethodEvent*) override; + QVariant inputMethodQuery(Qt::InputMethodQuery) const override; + static void closePopup(); + +public: + QtWidget(QtFrame& rFrame, Qt::WindowFlags f = Qt::WindowFlags()); + + QtFrame& frame() const { return m_rFrame; } + void endExtTextInput(); + void fakeResize(); + + static bool handleEvent(QtFrame&, QWidget&, QEvent*); + // key events might be propagated further down => call base on false + static inline bool handleKeyReleaseEvent(QtFrame&, const QWidget&, QKeyEvent*); + // mouse events are always accepted + static void handleMouseButtonEvent(const QtFrame&, const QMouseEvent*); +}; + +bool QtWidget::handleKeyReleaseEvent(QtFrame& rFrame, const QWidget& rWidget, QKeyEvent* pEvent) +{ + return handleKeyEvent(rFrame, rWidget, pEvent); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtX11Support.hxx b/vcl/inc/qt5/QtX11Support.hxx new file mode 100644 index 0000000000..17696a8952 --- /dev/null +++ b/vcl/inc/qt5/QtX11Support.hxx @@ -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/. + */ + +#pragma once + +#include <string_view> + +#include <xcb/xcb.h> + +class QtX11Support final +{ +public: + static void setApplicationID(xcb_window_t nWinId, std::u16string_view rWMClass); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtXAccessible.hxx b/vcl/inc/qt5/QtXAccessible.hxx new file mode 100644 index 0000000000..ddb7849b64 --- /dev/null +++ b/vcl/inc/qt5/QtXAccessible.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/. + */ + +#pragma once + +#include <vclpluginapi.h> + +#include <QtCore/QObject> + +#include <com/sun/star/accessibility/XAccessible.hpp> + +#include <vcl/window.hxx> + +class QtFrame; +class QtWidget; + +// Wrapper class to hold a css::accessibility::XAccessible object +// while being able to pass it as a QObject +class QtXAccessible : public QObject +{ + Q_OBJECT + +public: + QtXAccessible(css::uno::Reference<css::accessibility::XAccessible> xAccessible); + + /** Reference to the XAccessible. + * This is cleared once it has been passed to the QtAccessibleWidget, + * which then keeps an own reference and takes care of all required + * access to the XAccessible for the Qt a11y bridge. */ + css::uno::Reference<css::accessibility::XAccessible> m_xAccessible; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtAccessibleEventListener.hxx b/vcl/inc/qt6/QtAccessibleEventListener.hxx new file mode 100644 index 0000000000..7f67ea9fe9 --- /dev/null +++ b/vcl/inc/qt6/QtAccessibleEventListener.hxx @@ -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 "../qt5/QtAccessibleEventListener.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtAccessibleRegistry.hxx b/vcl/inc/qt6/QtAccessibleRegistry.hxx new file mode 100644 index 0000000000..b29fbb3263 --- /dev/null +++ b/vcl/inc/qt6/QtAccessibleRegistry.hxx @@ -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 "../qt5/QtAccessibleRegistry.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtAccessibleWidget.hxx b/vcl/inc/qt6/QtAccessibleWidget.hxx new file mode 100644 index 0000000000..937012308d --- /dev/null +++ b/vcl/inc/qt6/QtAccessibleWidget.hxx @@ -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 "../qt5/QtAccessibleWidget.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtBitmap.hxx b/vcl/inc/qt6/QtBitmap.hxx new file mode 100644 index 0000000000..78332058e3 --- /dev/null +++ b/vcl/inc/qt6/QtBitmap.hxx @@ -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 "../qt5/QtBitmap.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtClipboard.hxx b/vcl/inc/qt6/QtClipboard.hxx new file mode 100644 index 0000000000..0f3b718b88 --- /dev/null +++ b/vcl/inc/qt6/QtClipboard.hxx @@ -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 "../qt5/QtClipboard.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtData.hxx b/vcl/inc/qt6/QtData.hxx new file mode 100644 index 0000000000..827f3b6af6 --- /dev/null +++ b/vcl/inc/qt6/QtData.hxx @@ -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 "../qt5/QtData.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtDragAndDrop.hxx b/vcl/inc/qt6/QtDragAndDrop.hxx new file mode 100644 index 0000000000..9f8056d9cf --- /dev/null +++ b/vcl/inc/qt6/QtDragAndDrop.hxx @@ -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 "../qt5/QtDragAndDrop.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtFilePicker.hxx b/vcl/inc/qt6/QtFilePicker.hxx new file mode 100644 index 0000000000..20a3f6d5ce --- /dev/null +++ b/vcl/inc/qt6/QtFilePicker.hxx @@ -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 "../qt5/QtFilePicker.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtFont.hxx b/vcl/inc/qt6/QtFont.hxx new file mode 100644 index 0000000000..a477a46bbe --- /dev/null +++ b/vcl/inc/qt6/QtFont.hxx @@ -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 "../qt5/QtFont.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtFontFace.hxx b/vcl/inc/qt6/QtFontFace.hxx new file mode 100644 index 0000000000..875fa08127 --- /dev/null +++ b/vcl/inc/qt6/QtFontFace.hxx @@ -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 "../qt5/QtFontFace.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtFrame.hxx b/vcl/inc/qt6/QtFrame.hxx new file mode 100644 index 0000000000..6b6bae498c --- /dev/null +++ b/vcl/inc/qt6/QtFrame.hxx @@ -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 "../qt5/QtFrame.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtGraphics.hxx b/vcl/inc/qt6/QtGraphics.hxx new file mode 100644 index 0000000000..91e0808075 --- /dev/null +++ b/vcl/inc/qt6/QtGraphics.hxx @@ -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 "../qt5/QtGraphics.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtGraphicsBase.hxx b/vcl/inc/qt6/QtGraphicsBase.hxx new file mode 100644 index 0000000000..31bcfc3242 --- /dev/null +++ b/vcl/inc/qt6/QtGraphicsBase.hxx @@ -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 "../qt5/QtGraphicsBase.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtGraphics_Controls.hxx b/vcl/inc/qt6/QtGraphics_Controls.hxx new file mode 100644 index 0000000000..9601a2ace4 --- /dev/null +++ b/vcl/inc/qt6/QtGraphics_Controls.hxx @@ -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 "../qt5/QtGraphics_Controls.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtInstance.hxx b/vcl/inc/qt6/QtInstance.hxx new file mode 100644 index 0000000000..65eec7db32 --- /dev/null +++ b/vcl/inc/qt6/QtInstance.hxx @@ -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 "../qt5/QtInstance.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtMainWindow.hxx b/vcl/inc/qt6/QtMainWindow.hxx new file mode 100644 index 0000000000..bef22b2b61 --- /dev/null +++ b/vcl/inc/qt6/QtMainWindow.hxx @@ -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 "../qt5/QtMainWindow.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtMenu.hxx b/vcl/inc/qt6/QtMenu.hxx new file mode 100644 index 0000000000..42df15e37b --- /dev/null +++ b/vcl/inc/qt6/QtMenu.hxx @@ -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 "../qt5/QtMenu.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtObject.hxx b/vcl/inc/qt6/QtObject.hxx new file mode 100644 index 0000000000..b4a7f51212 --- /dev/null +++ b/vcl/inc/qt6/QtObject.hxx @@ -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 "../qt5/QtObject.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtOpenGLContext.hxx b/vcl/inc/qt6/QtOpenGLContext.hxx new file mode 100644 index 0000000000..1a82e2dba4 --- /dev/null +++ b/vcl/inc/qt6/QtOpenGLContext.hxx @@ -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 "../qt5/QtOpenGLContext.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtPainter.hxx b/vcl/inc/qt6/QtPainter.hxx new file mode 100644 index 0000000000..791d633355 --- /dev/null +++ b/vcl/inc/qt6/QtPainter.hxx @@ -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 "../qt5/QtPainter.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtPrinter.hxx b/vcl/inc/qt6/QtPrinter.hxx new file mode 100644 index 0000000000..f9caeb40fc --- /dev/null +++ b/vcl/inc/qt6/QtPrinter.hxx @@ -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 "../qt5/QtPrinter.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtSvpGraphics.hxx b/vcl/inc/qt6/QtSvpGraphics.hxx new file mode 100644 index 0000000000..ab002c09b9 --- /dev/null +++ b/vcl/inc/qt6/QtSvpGraphics.hxx @@ -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 "../qt5/QtSvpGraphics.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtSvpSurface.hxx b/vcl/inc/qt6/QtSvpSurface.hxx new file mode 100644 index 0000000000..952bb4de55 --- /dev/null +++ b/vcl/inc/qt6/QtSvpSurface.hxx @@ -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 "../qt5/QtSvpSurface.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtSystem.hxx b/vcl/inc/qt6/QtSystem.hxx new file mode 100644 index 0000000000..1a91f678a2 --- /dev/null +++ b/vcl/inc/qt6/QtSystem.hxx @@ -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 "../qt5/QtSystem.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtTimer.hxx b/vcl/inc/qt6/QtTimer.hxx new file mode 100644 index 0000000000..9ef6563ebc --- /dev/null +++ b/vcl/inc/qt6/QtTimer.hxx @@ -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 "../qt5/QtTimer.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtTools.hxx b/vcl/inc/qt6/QtTools.hxx new file mode 100644 index 0000000000..e6078fb143 --- /dev/null +++ b/vcl/inc/qt6/QtTools.hxx @@ -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 "../qt5/QtTools.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtTransferable.hxx b/vcl/inc/qt6/QtTransferable.hxx new file mode 100644 index 0000000000..f3cd0a9107 --- /dev/null +++ b/vcl/inc/qt6/QtTransferable.hxx @@ -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 "../qt5/QtTransferable.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtVirtualDevice.hxx b/vcl/inc/qt6/QtVirtualDevice.hxx new file mode 100644 index 0000000000..3e57fb2b03 --- /dev/null +++ b/vcl/inc/qt6/QtVirtualDevice.hxx @@ -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 "../qt5/QtVirtualDevice.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtWidget.hxx b/vcl/inc/qt6/QtWidget.hxx new file mode 100644 index 0000000000..486af7c19f --- /dev/null +++ b/vcl/inc/qt6/QtWidget.hxx @@ -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 "../qt5/QtWidget.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtX11Support.hxx b/vcl/inc/qt6/QtX11Support.hxx new file mode 100644 index 0000000000..df4ae0d1e0 --- /dev/null +++ b/vcl/inc/qt6/QtX11Support.hxx @@ -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 "../qt5/QtX11Support.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtXAccessible.hxx b/vcl/inc/qt6/QtXAccessible.hxx new file mode 100644 index 0000000000..e591a77647 --- /dev/null +++ b/vcl/inc/qt6/QtXAccessible.hxx @@ -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 "../qt5/QtXAccessible.hxx" + +/* 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 0000000000..a43b3e9751 --- /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 divided 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() const { 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/CoreTextFont.hxx b/vcl/inc/quartz/CoreTextFont.hxx new file mode 100644 index 0000000000..90cf641677 --- /dev/null +++ b/vcl/inc/quartz/CoreTextFont.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 . + */ + +#pragma once + +#include <sal/config.h> + +#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> + +#ifdef IOS +// iOS defines a different Point class so include salgeom.hxx after postmac.h +// so that it will use the Point class in tools/gen.hxx +#include "salgeom.hxx" +#endif + +#include <font/LogicalFontInstance.hxx> +#include <font/FontMetricData.hxx> +#include <salgdi.hxx> + +#include <quartz/salgdicommon.hxx> + +#include <quartz/CGHelpers.hxx> +#include <quartz/CoreTextFontFace.hxx> + +class CoreTextFont final : public LogicalFontInstance +{ + friend rtl::Reference<LogicalFontInstance> + CoreTextFontFace::CreateFontInstance(const vcl::font::FontSelectPattern&) const; + +public: + ~CoreTextFont() override; + + void GetFontMetric(FontMetricDataRef const&); + bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const override; + + CTFontRef GetCTFont() const { return mpCTFont; } + + /// <1.0: font is squeezed, >1.0 font is stretched, else 1.0 + float mfFontStretch; + /// text rotation in radian + float mfFontRotation; + +private: + explicit CoreTextFont(const CoreTextFontFace&, const vcl::font::FontSelectPattern&); + + CTFontRef mpCTFont; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/quartz/CoreTextFontFace.hxx b/vcl/inc/quartz/CoreTextFontFace.hxx new file mode 100644 index 0000000000..482b0b700d --- /dev/null +++ b/vcl/inc/quartz/CoreTextFontFace.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <sal/config.h> + +#include <vector> + +#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 <font/LogicalFontInstance.hxx> +#include <font/PhysicalFontFace.hxx> +#include <salgdi.hxx> + +#include <quartz/salgdicommon.hxx> +#include <hb.h> + +class AquaSalFrame; +class FontAttributes; + +// CoreText-specific physically available font face +class CoreTextFontFace final : public vcl::font::PhysicalFontFace +{ +public: + CoreTextFontFace(const FontAttributes&, CTFontDescriptorRef xRef); + ~CoreTextFontFace() override; + + sal_IntPtr GetFontId() const override; + + CTFontDescriptorRef GetFontDescriptorRef() const { return mxFontDescriptor; } + + rtl::Reference<LogicalFontInstance> + CreateFontInstance(const vcl::font::FontSelectPattern&) const override; + + hb_blob_t* GetHbTable(hb_tag_t nTag) const override; + + const std::vector<hb_variation_t>& GetVariations(const LogicalFontInstance&) const override; + +private: + CTFontDescriptorRef mxFontDescriptor; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/quartz/SystemFontList.hxx b/vcl/inc/quartz/SystemFontList.hxx new file mode 100644 index 0000000000..4f62380470 --- /dev/null +++ b/vcl/inc/quartz/SystemFontList.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 . + */ + +#pragma once + +#include <sal/config.h> + +#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 <font/PhysicalFontFace.hxx> +#ifdef IOS +#include <font/PhysicalFontCollection.hxx> +#endif + +#include <unordered_map> + +// TODO: move into cross-platform headers + +class CoreTextFontFace; + +class SystemFontList +{ +public: + SystemFontList(); + ~SystemFontList(); + + bool Init(); + void AddFont(CoreTextFontFace*); + + void AnnounceFonts(vcl::font::PhysicalFontCollection&) const; + CoreTextFontFace* GetFontDataFromId(sal_IntPtr nFontId) const; + + CTFontCollectionRef fontCollection() { return mpCTFontCollection; } + +private: + CTFontCollectionRef mpCTFontCollection; + CFArrayRef mpCTFontArray; + + std::unordered_map<sal_IntPtr, rtl::Reference<CoreTextFontFace>> maFontContainer; +}; + +FontAttributes DevFontFromCTFontDescriptor(CTFontDescriptorRef, bool*); +std::unique_ptr<SystemFontList> GetCoretextFontList(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/quartz/cgutils.h b/vcl/inc/quartz/cgutils.h new file mode 100644 index 0000000000..786b21458d --- /dev/null +++ b/vcl/inc/quartz/cgutils.h @@ -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 . + */ + +#pragma once + +#include <vcl/dllapi.h> + +#include <premac.h> +#include <CoreGraphics/CoreGraphics.h> +#include <postmac.h> + +class SalBitmap; + +CGImageRef VCL_DLLPUBLIC CreateWithSalBitmapAndMask(const SalBitmap& rBitmap, + const SalBitmap& rMask, int nX, int nY, + int nWidth, int nHeight); + +#ifdef MACOSX +bool VCL_DLLPUBLIC DefaultMTLDeviceIsSupported(); +#endif + +/* 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 0000000000..851fa5d7a7 --- /dev/null +++ b/vcl/inc/quartz/common.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_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> +#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/salbmp.h b/vcl/inc/quartz/salbmp.h new file mode 100644 index 0000000000..8f4e6a34ee --- /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, vcl::PixelFormat ePixelFormat, const BitmapPalette& rPal ) override; + bool Create( const SalBitmap& rSalBmp ) override; + bool Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics ) override; + bool Create( const SalBitmap& rSalBmp, vcl::PixelFormat eNewPixelFormat) 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: + virtual CGImageRef CreateWithMask( const SalBitmap& rMask, int nX, int nY, int nWidth, int nHeight ) const override; + virtual CGImageRef CreateColorMask( int nX, int nY, int nWidth, int nHeight, Color nMaskColor ) const override; + virtual CGImageRef CreateCroppedImage( int nX, int nY, int nWidth, int nHeight ) const override; + + 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 0000000000..c8befcc502 --- /dev/null +++ b/vcl/inc/quartz/salgdi.h @@ -0,0 +1,480 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <sal/config.h> + +#include <vector> + +#include <tools/long.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> + +#ifdef IOS +// iOS defines a different Point class so include salgeom.hxx after postmac.h +// so that it will use the Point class in tools/gen.hxx +#include "salgeom.hxx" +#endif + +#include <vcl/fontcapabilities.hxx> +#include <vcl/metric.hxx> + + +#include <font/LogicalFontInstance.hxx> +#include <font/FontMetricData.hxx> +#include <salgdi.hxx> + +#include <quartz/salgdicommon.hxx> + +#include <quartz/CGHelpers.hxx> + +class AquaSalFrame; +class XorEmulation; +class CoreTextFont; + +namespace sal::aqua +{ +#ifdef MACOSX +NSRect getTotalScreenBounds(); +void resetTotalScreenBounds(); +#endif +float getWindowScaling(); +void resetWindowScaling(); +} + +struct AquaSharedAttributes +{ + /// path representing current clip region + CGMutablePathRef mxClipPath; + + /// Drawing colors + /// pen color RGBA + RGBAColor maLineColor; + + /// brush color RGBA + RGBAColor maFillColor; + + // Graphics types +#ifdef MACOSX + AquaSalFrame* mpFrame; + /// is this a window graphics + bool mbWindow; +#else // IOS + // mirror AquaSalVirtualDevice::mbForeignContext for SvpSalGraphics objects related to such + bool mbForeignContext; +#endif + /// is this a printer graphics + bool mbPrinter; + /// is this a virtual device graphics + bool mbVirDev; + + 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 + int mnWidth; + int mnHeight; + int mnXorMode; // 0: off 1: on 2: invert only + int mnBitmapDepth; // zero unless bitmap + + Color maTextColor; + /// allows text to be rendered without antialiasing + bool mbNonAntialiasedText; + + std::unique_ptr<XorEmulation> mpXorEmulation; + + AquaSharedAttributes() + : mxClipPath(nullptr) + , maLineColor(COL_WHITE) + , maFillColor(COL_BLACK) +#ifdef MACOSX + , mpFrame(nullptr) + , mbWindow(false) +#else + , mbForeignContext(false) +#endif + , mbPrinter(false) + , mbVirDev(false) + , mnWidth(0) + , mnHeight(0) + , mnXorMode(0) + , mnBitmapDepth(0) + , maTextColor( COL_BLACK ) + , mbNonAntialiasedText( false ) + {} + + void unsetClipPath() + { + if (mxClipPath) + { + CGPathRelease(mxClipPath); + mxClipPath = nullptr; + } + } + + void unsetState() + { + unsetClipPath(); + } + + bool checkContext(); + void setState(); + + bool isPenVisible() const + { + return maLineColor.IsVisible(); + } + bool isBrushVisible() const + { + return maFillColor.IsVisible(); + } + + void refreshRect(float lX, float lY, float lWidth, float lHeight) + { +#ifdef MACOSX + if (!mbWindow) // view only on Window graphics + return; + + if (mpFrame) + { + // update a little more around the designated rectangle + // this helps with antialiased rendering + // Rounding down x and width can accumulate a rounding error of up to 2 + // The decrementing of x, the rounding error and the antialiasing border + // require that the width and the height need to be increased by four + const tools::Rectangle aVclRect( + Point(tools::Long(lX - 1), tools::Long(lY - 1)), + Size(tools::Long(lWidth + 4), tools::Long(lHeight + 4))); + + mpFrame->maInvalidRect.Union(aVclRect); + } +#else + (void) lX; + (void) lY; + (void) lWidth; + (void) lHeight; + return; +#endif + } + + // apply the XOR mask to the target context if active and dirty + void applyXorContext() + { + if (!mpXorEmulation) + return; + if (mpXorEmulation->UpdateTarget()) + { + refreshRect(0, 0, mnWidth, mnHeight); // TODO: refresh minimal changerect + } + } + + // differences between VCL, Quartz and kHiThemeOrientation coordinate systems + // make some graphics seem to be vertically-mirrored from a VCL perspective + bool isFlipped() const + { + #ifdef MACOSX + return mbWindow; + #else + return false; + #endif + } +}; + +class AquaGraphicsBackendBase +{ +public: + virtual ~AquaGraphicsBackendBase() = 0; + AquaSharedAttributes& GetShared() { return mrShared; } + SalGraphicsImpl* GetImpl() + { + return mpImpl; + } + virtual void UpdateGeometryProvider(SalGeometryProvider*) {}; + virtual bool drawNativeControl(ControlType nType, + ControlPart nPart, + const tools::Rectangle &rControlRegion, + ControlState nState, + const ImplControlValue &aValue) = 0; + virtual void drawTextLayout(const GenericSalLayout& layout) = 0; + virtual void Flush() {} + virtual void Flush( const tools::Rectangle& ) {} + virtual void WindowBackingPropertiesChanged() {}; +protected: + AquaGraphicsBackendBase(AquaSharedAttributes& rShared, SalGraphicsImpl * impl) + : mrShared( rShared ), mpImpl(impl) + {} + static bool performDrawNativeControl(ControlType nType, + ControlPart nPart, + const tools::Rectangle &rControlRegion, + ControlState nState, + const ImplControlValue &aValue, + CGContextRef context, + AquaSalFrame* mpFrame); + AquaSharedAttributes& mrShared; +private: + SalGraphicsImpl* mpImpl; +}; + +inline AquaGraphicsBackendBase::~AquaGraphicsBackendBase() {} + +class AquaGraphicsBackend final : public SalGraphicsImpl, public AquaGraphicsBackendBase +{ +private: + void drawPixelImpl( tools::Long nX, tools::Long nY, const RGBAColor& rColor); // helper to draw single pixels + +#ifdef MACOSX + void refreshRect(const NSRect& rRect) + { + mrShared.refreshRect(rRect.origin.x, rRect.origin.y, rRect.size.width, rRect.size.height); + } +#else + void refreshRect(const CGRect& /*rRect*/) + {} +#endif + + void pattern50Fill(); + +#ifdef MACOSX + void copyScaledArea(tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX, tools::Long nSrcY, + tools::Long nSrcWidth, tools::Long nSrcHeight, AquaSharedAttributes* pSrcShared); +#endif + +public: + AquaGraphicsBackend(AquaSharedAttributes & rShared); + ~AquaGraphicsBackend() override; + + void Init() override; + + void freeResources() override; + + OUString getRenderBackendName() const override + { + return "aqua"; + } + + void setClipRegion(vcl::Region const& rRegion) override; + void ResetClipRegion() override; + + sal_uInt16 GetBitCount() const override; + + tools::Long GetGraphicsWidth() const override; + + void SetLineColor() override; + void SetLineColor(Color nColor) override; + void SetFillColor() override; + void SetFillColor(Color nColor) override; + void SetXORMode(bool bSet, bool bInvertOnly) override; + void SetROPLineColor(SalROPColor nROPColor) override; + void SetROPFillColor(SalROPColor nROPColor) override; + + void drawPixel(tools::Long nX, tools::Long nY) override; + void drawPixel(tools::Long nX, tools::Long nY, Color nColor) override; + + void drawLine(tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2) override; + void drawRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight) override; + void drawPolyLine(sal_uInt32 nPoints, const Point* pPointArray) override; + void drawPolygon(sal_uInt32 nPoints, const Point* pPointArray) override; + void drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints, + const Point** pPointArray) override; + + void drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolyPolygon&, double fTransparency) override; + + 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; + + bool drawPolyLineBezier(sal_uInt32 nPoints, const Point* pPointArray, + const PolyFlags* pFlagArray) override; + + bool drawPolygonBezier(sal_uInt32 nPoints, const Point* pPointArray, + const PolyFlags* pFlagArray) override; + + bool drawPolyPolygonBezier(sal_uInt32 nPoly, const sal_uInt32* pPoints, + const Point* const* pPointArray, + const PolyFlags* const* pFlagArray) override; + + void copyArea(tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX, tools::Long nSrcY, + tools::Long nSrcWidth, tools::Long nSrcHeight, bool bWindowInvalidate) override; + + void copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics) override; + + void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) override; + + void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, + const SalBitmap& rMaskBitmap) override; + + void drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, + Color nMaskColor) override; + + std::shared_ptr<SalBitmap> getBitmap(tools::Long nX, tools::Long nY, tools::Long nWidth, + tools::Long nHeight) override; + + Color getPixel(tools::Long nX, tools::Long nY) override; + + void invert(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, + SalInvert nFlags) override; + + void invert(sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags) override; + + bool drawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, + void* pPtr, sal_uInt32 nSize) override; + + bool blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap) override; + + bool blendAlphaBitmap(const SalTwoRect&, const SalBitmap& rSrcBitmap, + const SalBitmap& rMaskBitmap, const SalBitmap& rAlphaBitmap) override; + + 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, double fAlpha) override; + + bool hasFastDrawTransformedBitmap() const override; + + bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, + sal_uInt8 nTransparency) override; + + bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) override; + bool implDrawGradient(basegfx::B2DPolyPolygon const& rPolyPolygon, + SalGradient const& rGradient) override; + + virtual bool drawNativeControl(ControlType nType, + ControlPart nPart, + const tools::Rectangle &rControlRegion, + ControlState nState, + const ImplControlValue &aValue) override; + + virtual void drawTextLayout(const GenericSalLayout& layout) override; + + bool supportsOperation(OutDevSupportType eType) const override; +}; + +class AquaSalGraphics : public SalGraphicsAutoDelegateToImpl +{ + AquaSharedAttributes maShared; + std::unique_ptr<AquaGraphicsBackendBase> mpBackend; + + /// device resolution of this graphics + sal_Int32 mnRealDPIX; + sal_Int32 mnRealDPIY; + + // Device Font settings + rtl::Reference<CoreTextFont> mpFont[MAX_FALLBACK]; + +public: + AquaSalGraphics(bool bPrinter = false); + virtual ~AquaSalGraphics() override; + + void SetVirDevGraphics(SalVirtualDevice* pVirDev,CGLayerHolder const &rLayer, CGContextRef, int nBitDepth = 0); +#ifdef MACOSX + void initResolution( NSWindow* ); + void copyResolution( AquaSalGraphics& ); + void updateResolution(); + + void SetWindowGraphics( AquaSalFrame* pFrame ); + bool IsWindowGraphics() const { return maShared.mbWindow; } + void SetPrinterGraphics(CGContextRef, sal_Int32 nRealDPIX, sal_Int32 nRealDPIY); + AquaSalFrame* getGraphicsFrame() const { return maShared.mpFrame; } + void setGraphicsFrame( AquaSalFrame* pFrame ) { maShared.mpFrame = pFrame; } +#endif + +#ifdef MACOSX + void UpdateWindow( NSRect& ); // delivered in NSView coordinates + void RefreshRect(const NSRect& rRect) + { + maShared.refreshRect(rRect.origin.x, rRect.origin.y, rRect.size.width, rRect.size.height); + } +#else + void RefreshRect( const CGRect& ) {} +#endif + + void Flush(); + void Flush( const tools::Rectangle& ); + void WindowBackingPropertiesChanged(); + + void UnsetState(); + // InvalidateContext does an UnsetState and sets mrContext to 0 + void InvalidateContext(); + + AquaGraphicsBackendBase* getAquaGraphicsBackend() const + { + return mpBackend.get(); + } + + virtual SalGraphicsImpl* GetImpl() const override; + +#ifdef MACOSX + +protected: + + // native widget rendering methods that require mirroring + + 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; +#endif + +public: + // get device resolution + virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) 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( FontMetricDataRef&, 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( vcl::font::PhysicalFontCollection* ) override; + // graphics must drop any cached font info + virtual void ClearDevFontCache() override; + virtual bool AddTempDevFont( vcl::font::PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override; + + virtual std::unique_ptr<GenericSalLayout> + GetTextLayout(int nFallbackLevel) override; + virtual void DrawTextLayout( const GenericSalLayout& ) override; + + virtual SystemGraphicsData + GetGraphicsData() const override; +}; + +/* 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 0000000000..71c40acdfa --- /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 0000000000..939bd041ce --- /dev/null +++ b/vcl/inc/quartz/salvd.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_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 <tools/long.hxx> + +#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; + AquaSalGraphics* mpGraphics; // current VirDev graphics + + tools::Long mnWidth; + tools::Long mnHeight; + + void Destroy(); + +public: + AquaSalVirtualDevice( AquaSalGraphics* pGraphic, tools::Long &nDX, tools::Long &nDY, DeviceFormat eFormat, const SystemGraphicsData *pData ); + virtual ~AquaSalVirtualDevice() override; + + virtual SalGraphics* AcquireGraphics() override; + virtual void ReleaseGraphics( SalGraphics* pGraphics ) override; + virtual bool SetSize( tools::Long nNewDX, tools::Long nNewDY ) override; + + tools::Long GetWidth() const override + { + return mnWidth; + } + + tools::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 0000000000..759e47f72f --- /dev/null +++ b/vcl/inc/quartz/utils.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_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& ); +OUString NSStringArrayToOUString(NSArray* array); +OUString NSDictionaryKeysToOUString(NSDictionary* dict); + +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); +std::ostream &operator <<(std::ostream& s, CGColorSpaceRef cs); + +#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 0000000000..33cedcd309 --- /dev/null +++ b/vcl/inc/regband.hxx @@ -0,0 +1,131 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 + +#include <tools/long.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; + tools::Long mnXLeft; + tools::Long mnXRight; + bool mbRemoved; +}; + +enum class LineType { Ascending, Descending }; + +// element for the list with x-separations +struct ImplRegionBandPoint +{ + ImplRegionBandPoint* mpNextBandPoint; + tools::Long mnX; + tools::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 + tools::Long mnYTop; // actual boundary of the band + tools::Long mnYBottom; + + bool mbTouched : 1; + + // create y-band with boundaries + ImplRegionBand( tools::Long nYTop, tools::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(); + + tools::Long GetXLeftBoundary() const; + tools::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( tools::Long nX, tools::Long nLineID, + bool bEndPoint, LineType eLineType ); + + void Union( tools::Long nXLeft, tools::Long nXRight ); + void Intersect( tools::Long nXLeft, tools::Long nXRight ); + void Exclude( tools::Long nXLeft, tools::Long nXRight ); + void XOr( tools::Long nXLeft, tools::Long nXRight ); + + void MoveX( tools::Long nHorzMove ); + void ScaleX( double fHorzScale ); + + bool Contains( tools::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 0000000000..c25b5dd648 --- /dev/null +++ b/vcl/inc/regionband.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_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 tools::Long nTop, const tools::Long nBottom); + void InsertBand(ImplRegionBand* pPreviousBand, ImplRegionBand* pBandToInsert); + void processPoints(); + void CreateBandRange(tools::Long nYTop, tools::Long nYBottom); + void InsertLine(const Point& rStartPt, const Point& rEndPt, tools::Long nLineId); + void InsertPoint(const Point& rPoint, tools::Long nLineID, bool bEndPoint, LineType eLineType); + bool OptimizeBandList(); + void Move(tools::Long nHorzMove, tools::Long nVertMove); + void Scale(double fScaleX, double fScaleY); + void InsertBands(tools::Long nTop, tools::Long nBottom); + static bool InsertSingleBand(ImplRegionBand* pBand, tools::Long nYBandPosition); + void Union(tools::Long nLeft, tools::Long nTop, tools::Long nRight, tools::Long nBottom); + void Intersect(tools::Long nLeft, tools::Long nTop, tools::Long nRight, tools::Long nBottom); + void Union(const RegionBand& rSource); + void Exclude(tools::Long nLeft, tools::Long nTop, tools::Long nRight, tools::Long nBottom); + void XOr(tools::Long nLeft, tools::Long nTop, tools::Long nRight, tools::Long nBottom); + void Intersect(const RegionBand& rSource); + bool Exclude(const RegionBand& rSource); + void XOr(const RegionBand& rSource); + tools::Rectangle GetBoundRect() const; + bool Contains(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 0000000000..3f9dafab15 --- /dev/null +++ b/vcl/inc/salbmp.hxx @@ -0,0 +1,199 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <vcl/bitmap/BitmapTypes.hxx> +#include <com/sun/star/rendering/XBitmapCanvas.hpp> +#include <basegfx/utils/systemdependentdata.hxx> + +#if defined MACOSX || defined IOS +#include <premac.h> +#include <CoreGraphics/CoreGraphics.h> +#include <postmac.h> +#endif + +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, + vcl::PixelFormat ePixelFormat, + 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, + vcl::PixelFormat eNewPixelFormat) = 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; + } + + virtual bool Erase( const Color& /*color*/ ) + { + return false; + } + // Optimized case for AlphaMask::BlendWith(). + virtual bool AlphaBlendWith( const SalBitmap& /*rSalBmp*/ ) + { + return false; + } + + virtual bool Invert() + { + return false; + } + +#if defined MACOSX || defined IOS + // Related: tdf#146842 Eliminate temporary copies of SkiaSalBitmap when + // printing + // Commit 9eb732a32023e74c44ac8c3b5af9f5424273bb6c fixed crashing when + // printing SkiaSalBitmaps to a non-Skia SalGraphics. However, the fix + // almost always makes two copies of the SkiaSalBitmap's bitmap data: the + // first copy is made in SkiaSalBitmap::AcquireBuffer() and then + // QuartzSalBitmap makes a copy of the first copy. + // By making QuartzSalBitmap's methods that return a CGImageRef virtual, + // a non-Skia SalGraphics can now create a CGImageRef directly from a + // SkiaSalBitmap's Skia bitmap data without copying to any intermediate + // buffers. + // Note: these methods are not pure virtual as the SvpSalBitmap class + // extends this class directly. + virtual CGImageRef CreateWithMask( const SalBitmap&, int, int, int, int ) const { return nullptr; } + virtual CGImageRef CreateColorMask( int, int, int, int, Color ) const { return nullptr; } + virtual CGImageRef CreateCroppedImage( int, int, int, int ) const { return nullptr; } +#endif + + BitmapChecksum GetChecksum() const + { + updateChecksum(); + if (!mbChecksumValid) + return 0; // back-compat + return mnChecksum; + } + + void InvalidateChecksum() + { + mbChecksumValid = false; + } + +protected: + void updateChecksum() const; + // helper function to convert data in 1,2,4 bpp formats to a 8/24/32bpp format + enum class BitConvert + { + A8, + RGBA, + BGRA, + LAST = 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 ); + +public: + // access to SystemDependentDataHolder, to support overload in derived class(es) + virtual const basegfx::SystemDependentDataHolder* accessSystemDependentDataHolder() const; + + // exclusive management op's for SystemDependentData at SalBitmap + template<class T> + std::shared_ptr<T> getSystemDependentData() const + { + const basegfx::SystemDependentDataHolder* pDataHolder(accessSystemDependentDataHolder()); + if(pDataHolder) + return std::static_pointer_cast<T>(pDataHolder->getSystemDependentData(typeid(T).hash_code())); + return std::shared_ptr<T>(); + } + + template<class T, class... Args> + std::shared_ptr<T> addOrReplaceSystemDependentData(Args&&... args) const + { + const basegfx::SystemDependentDataHolder* pDataHolder(accessSystemDependentDataHolder()); + if(!pDataHolder) + return std::shared_ptr<T>(); + + std::shared_ptr<T> r = std::make_shared<T>(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< basegfx::SystemDependentDataHolder* >(pDataHolder)->addOrReplaceSystemDependentData(r2); + } + + return r; + } + +private: + BitmapChecksum mnChecksum; + bool mbChecksumValid; + +}; + +#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 0000000000..f25f8de927 --- /dev/null +++ b/vcl/inc/salframe.hxx @@ -0,0 +1,325 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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; + +namespace vcl { class WindowData; } +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, + // tdf#144624: don't set icon + NOICON = 0x01000000, + // 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, 0x798001ff> {}; +}; + +// 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 tools::Long GetWidth() const override { return maGeometry.width(); } + virtual tools::Long GetHeight() const override { return maGeometry.height(); } + 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 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( tools::Long nWidth, tools::Long nHeight ) = 0; + virtual void SetMaxClientSize( tools::Long nWidth, tools::Long nHeight ) = 0; + virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags ) = 0; + static OUString DumpSetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags); + virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) = 0; + virtual void GetWorkArea( AbsoluteScreenPixelRectangle& 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 vcl::WindowData*) = 0; + // return the absolute, unmirrored system frame state + // if this returns false the structure is uninitialised + [[nodiscard]] + virtual bool GetWindowState(vcl::WindowData*) = 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( tools::Long nX, tools::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; + + // tdf#139609 SystemEnvData::GetWindowHandle() calls this to on-demand fill the aWindow + // member of SystemEnvData for backends that want to defer doing that + virtual void ResolveWindowHandle(SystemEnvData& /*rData*/) const {}; + + // get current modifier, button mask and mouse position + struct SalPointerState + { + sal_Int32 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 void 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( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::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); } + + virtual void UpdateDarkMode() {} + virtual bool GetUseDarkMode() const { return false; } + virtual bool GetUseReducedAnimation() const { return false; }; + + // 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 ); } + + // Helper method for input method handling: Calculate cursor index in (UTF-16) OUString, + // starting at nCursorIndex, moving number of characters (not UTF-16 codepoints) specified + // in nOffset, nChars. + static Selection CalcDeleteSurroundingSelection(const OUString& rSurroundingText, + sal_Int32 nCursorIndex, int nOffset, int nChars); +}; + +#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 0000000000..7e73e59daf --- /dev/null +++ b/vcl/inc/salgdi.hxx @@ -0,0 +1,891 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <sal/config.h> + +#include <vcl/outdev.hxx> + +#include "font/FontMetricData.hxx" +#include "salgdiimpl.hxx" +#include "sallayout.hxx" +#include "SalGradient.hxx" +#include <basegfx/matrix/b2dhommatrix.hxx> +#include "WidgetDrawInterface.hxx" + +#include <config_cairo_canvas.h> + +#include <vector> + +class SalBitmap; +class FontAttributes; +namespace vcl::font { + class FontSelectPattern; + class PhysicalFontFace; + class PhysicalFontCollection; +} +class SalLayout; +namespace tools { class Rectangle; } +class OutputDevice; +class FreetypeFont; +struct SystemGraphicsData; + +namespace basegfx { + class B2DVector; + class B2DPolygon; + class B2DPolyPolygon; +} + +namespace vcl +{ +class AbstractTrueTypeFont; +class FileDefinitionWidgetDraw; +typedef struct TTGlobalFontInfo_ TTGlobalFontInfo; +} + +typedef sal_Unicode sal_Ucs; // TODO: use sal_UCS4 instead of sal_Unicode + +// 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; + + void setAntiAlias(bool bNew) + { + m_bAntiAlias = bNew; + + // Temporary store in both + if (GetImpl()) + GetImpl()->setAntiAlias(bNew); + } + + bool getAntiAlias() const + { + return m_bAntiAlias; + } + + // 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 tools::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( FontMetricDataRef&, 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( vcl::font::PhysicalFontCollection* ) = 0; + + // graphics must drop any cached font info + virtual void ClearDevFontCache() = 0; + + virtual bool AddTempDevFont( + vcl::font::PhysicalFontCollection*, + const OUString& rFileURL, + const OUString& rFontName ) = 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( tools::Long& nX, const OutputDevice& rOutDev ) const; + // only called mirror2 to avoid ambiguity + [[nodiscard]] tools::Long mirror2( tools::Long nX, const OutputDevice& rOutDev ) const; + void mirror( tools::Long& nX, tools::Long nWidth, const OutputDevice& rOutDev, bool bBack = false ) const; + bool mirror( sal_uInt32 nPoints, const Point *pPtAry, Point *pPtAry2, const OutputDevice& rOutDev ) const; + void mirror( tools::Rectangle& rRect, const OutputDevice&, bool bBack = false ) const; + void mirror( vcl::Region& rRgn, const OutputDevice& rOutDev ) const; + void mirror( ImplControlValue&, const OutputDevice& ) const; + basegfx::B2DPolyPolygon mirror( const basegfx::B2DPolyPolygon& i_rPoly, const OutputDevice& rOutDev ) const; + const basegfx::B2DHomMatrix& getMirror( const OutputDevice& rOutDev ) const; + + // non virtual methods; these do possible coordinate mirroring and + // then delegate to protected virtual methods + void SetClipRegion( const vcl::Region&, const OutputDevice& rOutDev ); + + // draw --> LineColor and FillColor and RasterOp and ClipRegion + void DrawPixel( tools::Long nX, tools::Long nY, const OutputDevice& rOutDev ); + void DrawPixel( tools::Long nX, tools::Long nY, Color nColor, const OutputDevice& rOutDev ); + + void DrawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2, const OutputDevice& rOutDev ); + + void DrawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, const OutputDevice& rOutDev ); + + void DrawPolyLine( sal_uInt32 nPoints, Point const * pPtAry, const OutputDevice& rOutDev ); + + void DrawPolygon( sal_uInt32 nPoints, const Point* pPtAry, const OutputDevice& rOutDev ); + + void DrawPolyPolygon( + sal_uInt32 nPoly, + const sal_uInt32* pPoints, + const Point** pPtAry, + const OutputDevice& rOutDev ); + + void DrawPolyPolygon( + const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolyPolygon &i_rPolyPolygon, + double i_fTransparency, + const OutputDevice& i_rOutDev); + + 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_rOutDev); + + bool DrawPolyLineBezier( + sal_uInt32 nPoints, + const Point* pPtAry, + const PolyFlags* pFlgAry, + const OutputDevice& rOutDev ); + + bool DrawPolygonBezier( + sal_uInt32 nPoints, + const Point* pPtAry, + const PolyFlags* pFlgAry, + const OutputDevice& rOutDev ); + + bool DrawPolyPolygonBezier( + sal_uInt32 nPoly, + const sal_uInt32* pPoints, + const Point* const* pPtAry, + const PolyFlags* const* pFlgAry, + const OutputDevice& rOutDev ); + + bool DrawGradient( + const tools::PolyPolygon& rPolyPoly, + const Gradient& rGradient, + const OutputDevice& rOutDev); + + // CopyArea --> No RasterOp, but ClipRegion + void CopyArea( + tools::Long nDestX, tools::Long nDestY, + tools::Long nSrcX, tools::Long nSrcY, + tools::Long nSrcWidth, tools::Long nSrcHeight, + const OutputDevice& rOutDev ); + + // CopyBits --> RasterOp and ClipRegion + // CopyBits() CopyBits on same Graphics + void CopyBits( + const SalTwoRect& rPosAry, + const OutputDevice& rOutDev); + + // CopyBits --> RasterOp and ClipRegion + // CopyBits() CopyBits on different Graphics + void CopyBits( + const SalTwoRect& rPosAry, + SalGraphics& rSrcGraphics, + const OutputDevice& rOutDev, + const OutputDevice& rSrcOutDev ); + + + void DrawBitmap( + const SalTwoRect& rPosAry, + const SalBitmap& rSalBitmap, + const OutputDevice& rOutDev ); + + void DrawBitmap( + const SalTwoRect& rPosAry, + const SalBitmap& rSalBitmap, + const SalBitmap& rTransparentBitmap, + const OutputDevice& rOutDev ); + + void DrawMask( + const SalTwoRect& rPosAry, + const SalBitmap& rSalBitmap, + Color nMaskColor, + const OutputDevice& rOutDev ); + + std::shared_ptr<SalBitmap> GetBitmap( + tools::Long nX, tools::Long nY, + tools::Long nWidth, tools::Long nHeight, + const OutputDevice& rOutDev ); + + Color GetPixel( + tools::Long nX, tools::Long nY, + const OutputDevice& rOutDev ); + + // invert --> ClipRegion (only Windows) + void Invert( + tools::Long nX, tools::Long nY, + tools::Long nWidth, tools::Long nHeight, + SalInvert nFlags, + const OutputDevice& rOutDev ); + + void Invert( + sal_uInt32 nPoints, + const Point* pPtAry, + SalInvert nFlags, + const OutputDevice& rOutDev ); + + bool DrawEPS( + tools::Long nX, tools::Long nY, + tools::Long nWidth, tools::Long nHeight, + void* pPtr, + sal_uInt32 nSize, + const OutputDevice& rOutDev ); + + // 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& rOutDev); + + /** + * @see WidgetDrawInterface::drawNativeControl + */ + bool DrawNativeControl( + ControlType nType, + ControlPart nPart, + const tools::Rectangle& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + const OUString& aCaption, + const OutputDevice& rOutDev, + 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& rOutDev ); + + /** + * @see WidgetDrawInterface::updateSettings + */ + inline bool UpdateSettings(AllSettings&); + + bool BlendBitmap( + const SalTwoRect& rPosAry, + const SalBitmap& rSalBitmap, + const OutputDevice& rOutDev ); + + bool BlendAlphaBitmap( + const SalTwoRect& rPosAry, + const SalBitmap& rSalSrcBitmap, + const SalBitmap& rSalMaskBitmap, + const SalBitmap& rSalAlphaBitmap, + const OutputDevice& rOutDev ); + + bool DrawAlphaBitmap( + const SalTwoRect&, + const SalBitmap& rSourceBitmap, + const SalBitmap& rAlphaBitmap, + const OutputDevice& rOutDev ); + + bool DrawTransformedBitmap( + const basegfx::B2DPoint& rNull, + const basegfx::B2DPoint& rX, + const basegfx::B2DPoint& rY, + const SalBitmap& rSourceBitmap, + const SalBitmap* pAlphaBitmap, + double fAlpha, + const OutputDevice& rOutDev ); + + bool HasFastDrawTransformedBitmap() const; + + bool DrawAlphaRect( + tools::Long nX, tools::Long nY, + tools::Long nWidth, tools::Long nHeight, + sal_uInt8 nTransparency, + const OutputDevice& rOutDev ); + + virtual OUString getRenderBackendName() const; + + virtual SystemGraphicsData GetGraphicsData() const = 0; + + // Backends like the svp/gtk ones use cairo and hidpi scale at the surface + // but bitmaps aren't hidpi, so if this returns true for the case that the + // surface is hidpi then pScaleOut contains the scaling factor. So we can + // create larger hires bitmaps which we know will be logically scaled down + // by this factor but physically just copied + virtual bool ShouldDownscaleIconsAtSurface(double* pScaleOut) const; + + +#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; + +#endif // ENABLE_CAIRO_CANVAS + +protected: + + friend class vcl::FileDefinitionWidgetDraw; + + virtual void setClipRegion( const vcl::Region& ) = 0; + + // draw --> LineColor and FillColor and RasterOp and ClipRegion + virtual void drawPixel( tools::Long nX, tools::Long nY ) = 0; + virtual void drawPixel( tools::Long nX, tools::Long nY, Color nColor ) = 0; + + virtual void drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) = 0; + + virtual void drawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) = 0; + + virtual void drawPolyLine( sal_uInt32 nPoints, const Point* pPtAry ) = 0; + + virtual void drawPolygon( sal_uInt32 nPoints, const Point* pPtAry ) = 0; + + virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point** pPtAry ) = 0; + + virtual void 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 Point* pPtAry, + const PolyFlags* pFlgAry ) = 0; + + virtual bool drawPolygonBezier( + sal_uInt32 nPoints, + const Point* pPtAry, + const PolyFlags* pFlgAry ) = 0; + + virtual bool drawPolyPolygonBezier( + sal_uInt32 nPoly, + const sal_uInt32* pPoints, + const Point* 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( + tools::Long nDestX, tools::Long nDestY, + tools::Long nSrcX, tools::Long nSrcY, + tools::Long nSrcWidth, tools::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( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) = 0; + + virtual Color getPixel( tools::Long nX, tools::Long nY ) = 0; + + // invert --> ClipRegion (only Windows or VirDevs) + virtual void invert( + tools::Long nX, tools::Long nY, + tools::Long nWidth, tools::Long nHeight, + SalInvert nFlags) = 0; + + virtual void invert( sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags ) = 0; + + virtual bool drawEPS( + tools::Long nX, tools::Long nY, + tools::Long nWidth, tools::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 + + @param fAlpha additional alpha (0 to 1) to apply while drawing + */ + virtual bool drawTransformedBitmap( + const basegfx::B2DPoint& rNull, + const basegfx::B2DPoint& rX, + const basegfx::B2DPoint& rY, + const SalBitmap& rSourceBitmap, + const SalBitmap* pAlphaBitmap, + double fAlpha) = 0; + + /// Returns true if the drawTransformedBitmap() call is fast, and so it should + /// be used directly without trying to optimize some calls e.g. by calling drawBitmap() + /// instead (which is faster for most VCL backends). These optimizations are not + /// done unconditionally because they may be counter-productive for some fast VCL backends + /// (for example, some OutputDevice optimizations could try access the pixels, which + /// would make performance worse for GPU-backed backends). + /// See also tdf#138068. + virtual bool hasFastDrawTransformedBitmap() const = 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( + tools::Long nX, tools::Long nY, + tools::Long nWidth, tools::Long nHeight, + sal_uInt8 nTransparency ) = 0; + +private: + SalLayoutFlags m_nLayout; //< 0: mirroring off, 1: mirror x-axis + + // for buffering the Mirror-Matrix, see ::getMirror + enum class MirrorMode + { + NONE, + Antiparallel, + AntiparallelBiDi, + BiDi + }; + MirrorMode m_eLastMirrorMode; + tools::Long m_nLastMirrorTranslation; + basegfx::B2DHomMatrix m_aLastMirror; + + MirrorMode GetMirrorMode(const OutputDevice& rOutDev) const; + +protected: + /// flags which hold the SetAntialiasing() value from OutputDevice + bool m_bAntiAlias : 1; + + inline tools::Long GetDeviceWidth(const OutputDevice& rOutDev) 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&) {} + + +class VCL_DLLPUBLIC SalGraphicsAutoDelegateToImpl : public SalGraphics +{ +public: + sal_uInt16 GetBitCount() const override + { + return GetImpl()->GetBitCount(); + } + + tools::Long GetGraphicsWidth() const override + { + return GetImpl()->GetGraphicsWidth(); + } + + void ResetClipRegion() override + { + GetImpl()->ResetClipRegion(); + } + + void setClipRegion( const vcl::Region& i_rClip ) override + { + GetImpl()->setClipRegion(i_rClip); + } + + void SetLineColor() override + { + GetImpl()->SetLineColor(); + } + + void SetLineColor( Color nColor ) override + { + GetImpl()->SetLineColor(nColor); + } + + void SetFillColor() override + { + GetImpl()->SetFillColor(); + } + + void SetFillColor( Color nColor ) override + { + GetImpl()->SetFillColor (nColor); + } + + void SetROPLineColor(SalROPColor aColor) override + { + GetImpl()->SetROPLineColor(aColor); + } + + void SetROPFillColor( SalROPColor aColor) override + { + GetImpl()->SetROPFillColor(aColor); + } + + void SetXORMode(bool bSet, bool bInvertOnly) override + { + GetImpl()->SetXORMode(bSet, bInvertOnly); + } + + void drawPixel( tools::Long nX, tools::Long nY ) override + { + GetImpl()->drawPixel(nX, nY); + } + + void drawPixel( tools::Long nX, tools::Long nY, Color nColor ) override + { + GetImpl()->drawPixel(nX, nY, nColor); + } + + void drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) override + { + GetImpl()->drawLine(nX1, nY1, nX2, nY2); + } + + void drawRect( tools::Long nX, tools::Long nY, tools::Long nDX, tools::Long nDY ) override + { + GetImpl()->drawRect(nX, nY, nDX, nDY); + } + + void drawPolyLine( sal_uInt32 nPoints, const Point *pPtAry ) override + { + GetImpl()->drawPolyLine(nPoints, pPtAry); + } + + void drawPolygon( sal_uInt32 nPoints, const Point* pPtAry ) override + { + GetImpl()->drawPolygon(nPoints, pPtAry); + } + + void drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point** pPtAry) override + { + GetImpl()->drawPolyPolygon (nPoly, pPoints, pPtAry); + } + + void drawPolyPolygon( + const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolyPolygon& rPolyPolygon, + double fTransparency) override + { + GetImpl()->drawPolyPolygon(rObjectToDevice, rPolyPolygon, fTransparency); + } + + bool drawPolyLine( + const basegfx::B2DHomMatrix& rObjectToDevice, + const basegfx::B2DPolygon& rPolygon, + double fTransparency, + double fLineWidth, + const std::vector< double >* pStroke, + basegfx::B2DLineJoin eJoin, + css::drawing::LineCap eLineCap, + double fMiterMinimumAngle, + bool bPixelSnapHairline) override + { + return GetImpl()->drawPolyLine(rObjectToDevice, rPolygon, fTransparency, fLineWidth, pStroke, eJoin, eLineCap, fMiterMinimumAngle, bPixelSnapHairline); + } + + bool drawPolyLineBezier( sal_uInt32 nPoints, const Point* pPtAry, const PolyFlags* pFlgAry ) override + { + return GetImpl()->drawPolyLineBezier(nPoints, pPtAry, pFlgAry); + } + + bool drawPolygonBezier( sal_uInt32 nPoints, const Point* pPtAry, const PolyFlags* pFlgAry ) override + { + return GetImpl()->drawPolygonBezier(nPoints, pPtAry, pFlgAry); + } + + bool drawPolyPolygonBezier( sal_uInt32 nPoly, + const sal_uInt32* pPoints, + const Point* const* pPtAry, + const PolyFlags* const* pFlgAry) override + { + return GetImpl()->drawPolyPolygonBezier(nPoly, pPoints, pPtAry, pFlgAry); + } + + void invert(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, + SalInvert nFlags) override + { + GetImpl()->invert(nX, nY, nWidth, nHeight, nFlags); + } + + void invert(sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags) override + { + GetImpl()->invert(nPoints, pPtAry, nFlags); + } + + bool drawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, + tools::Long nHeight, void* pPtr, sal_uInt32 nSize) override + { + return GetImpl()->drawEPS(nX, nY, nWidth, nHeight, pPtr, nSize); + } + + void copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics) override + { + GetImpl()->copyBits(rPosAry, pSrcGraphics); + } + + void copyArea (tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX, + tools::Long nSrcY, tools::Long nSrcWidth, tools::Long nSrcHeight, + bool bWindowInvalidate) override + { + GetImpl()->copyArea(nDestX, nDestY, nSrcX, nSrcY, nSrcWidth, nSrcHeight, bWindowInvalidate); + } + + void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) override + { + GetImpl()->drawBitmap(rPosAry, rSalBitmap); + } + + void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, const SalBitmap& rMaskBitmap) override + { + GetImpl()->drawBitmap(rPosAry, rSalBitmap, rMaskBitmap); + } + + void drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, Color nMaskColor) override + { + GetImpl()->drawMask(rPosAry, rSalBitmap, nMaskColor); + } + + std::shared_ptr<SalBitmap> getBitmap(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight) override + { + return GetImpl()->getBitmap(nX, nY, nWidth, nHeight); + } + + Color getPixel(tools::Long nX, tools::Long nY) override + { + return GetImpl()->getPixel(nX, nY); + } + + bool blendBitmap(const SalTwoRect& rPosAry, const SalBitmap& rBitmap) override + { + return GetImpl()->blendBitmap(rPosAry, rBitmap); + } + + bool blendAlphaBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSourceBitmap, + const SalBitmap& rMaskBitmap, const SalBitmap& rAlphaBitmap) override + { + return GetImpl()->blendAlphaBitmap(rPosAry, rSourceBitmap, rMaskBitmap, rAlphaBitmap); + } + + bool drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSourceBitmap, + const SalBitmap& rAlphaBitmap) override + { + return GetImpl()->drawAlphaBitmap(rPosAry, rSourceBitmap, rAlphaBitmap); + } + + bool drawTransformedBitmap(const basegfx::B2DPoint& rNull, + const basegfx::B2DPoint& rX, + const basegfx::B2DPoint& rY, + const SalBitmap& rSourceBitmap, + const SalBitmap* pAlphaBitmap, double fAlpha) override + { + return GetImpl()->drawTransformedBitmap(rNull, rX, rY, rSourceBitmap, pAlphaBitmap, fAlpha); + } + + bool hasFastDrawTransformedBitmap() const override + { + return GetImpl()->hasFastDrawTransformedBitmap(); + } + + bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, + tools::Long nHeight, sal_uInt8 nTransparency) override + { + return GetImpl()->drawAlphaRect(nX, nY, nWidth, nHeight, nTransparency); + } + + bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) override + { + return GetImpl()->drawGradient(rPolygon, rGradient); + } + + bool implDrawGradient(basegfx::B2DPolyPolygon const& rPolyPolygon, + SalGradient const& rGradient) override + { + return GetImpl()->implDrawGradient(rPolyPolygon, rGradient); + } + + bool supportsOperation(OutDevSupportType eType) const override + { + return GetImpl()->supportsOperation(eType); + } + + OUString getRenderBackendName() const override + { + return GetImpl()->getRenderBackendName(); + } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx new file mode 100644 index 0000000000..fd3a13378b --- /dev/null +++ b/vcl/inc/salgdiimpl.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 . + */ + +#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 SalVirtualDevice; +struct SalGradient; + +/** +Implementation class for SalGraphics. + +This class allows having an implementation of drawing calls that is separate from SalGraphics, +and SalGraphics can forward all such calls to SalGraphicsImpl. For example X11SalGraphics +may internally use either Cairo-based X11CairoSalGraphicsImpl or Skia-based SkiaSalGraphicsImpl, +and the latter may be used also by other SalGraphics implementations. All the functions +here should be implementations of the relevant SalGraphics functions. +*/ +class VCL_PLUGIN_PUBLIC SalGraphicsImpl +{ + bool m_bAntiAlias; +public: + + void setAntiAlias(bool bNew) + { + m_bAntiAlias = bNew; + } + + bool getAntiAlias() const + { + return m_bAntiAlias; + } + + SalGraphicsImpl() + : m_bAntiAlias(false) + {} + + virtual ~SalGraphicsImpl(); + + // All the functions are implementations of functions from the SalGraphics class, + // so see the SalGraphics class for documentation (both uppercase and lowercase + // function variants). + + virtual void Init() = 0; + + virtual void DeInit() {} + + virtual void freeResources() = 0; + + virtual OUString getRenderBackendName() const = 0; + + virtual void setClipRegion( const vcl::Region& ) = 0; + + virtual sal_uInt16 GetBitCount() const = 0; + + virtual tools::Long GetGraphicsWidth() const = 0; + + virtual void ResetClipRegion() = 0; + + virtual void SetLineColor() = 0; + + virtual void SetLineColor( Color nColor ) = 0; + + virtual void SetFillColor() = 0; + + virtual void SetFillColor( Color nColor ) = 0; + + virtual void SetXORMode( bool bSet, bool bInvertOnly ) = 0; + + virtual void SetROPLineColor( SalROPColor nROPColor ) = 0; + + virtual void SetROPFillColor( SalROPColor nROPColor ) = 0; + + virtual void drawPixel( tools::Long nX, tools::Long nY ) = 0; + virtual void drawPixel( tools::Long nX, tools::Long nY, Color nColor ) = 0; + + virtual void drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) = 0; + + virtual void drawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) = 0; + + virtual void drawPolyLine( sal_uInt32 nPoints, const Point* pPtAry ) = 0; + + virtual void drawPolygon( sal_uInt32 nPoints, const Point* pPtAry ) = 0; + + virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point** pPtAry ) = 0; + + virtual void 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, + basegfx::B2DLineJoin, + css::drawing::LineCap, + double fMiterMinimumAngle, + bool bPixelSnapHairline) = 0; + + virtual bool drawPolyLineBezier( + sal_uInt32 nPoints, + const Point* pPtAry, + const PolyFlags* pFlgAry ) = 0; + + virtual bool drawPolygonBezier( + sal_uInt32 nPoints, + const Point* pPtAry, + const PolyFlags* pFlgAry ) = 0; + + virtual bool drawPolyPolygonBezier( + sal_uInt32 nPoly, + const sal_uInt32* pPoints, + const Point* const* pPtAry, + const PolyFlags* const* pFlgAry ) = 0; + + virtual void copyArea( + tools::Long nDestX, tools::Long nDestY, + tools::Long nSrcX, tools::Long nSrcY, + tools::Long nSrcWidth, tools::Long nSrcHeight, + bool bWindowInvalidate ) = 0; + + 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( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) = 0; + + virtual Color getPixel( tools::Long nX, tools::Long nY ) = 0; + + virtual void invert( + tools::Long nX, tools::Long nY, + tools::Long nWidth, tools::Long nHeight, + SalInvert nFlags) = 0; + + virtual void invert( sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags ) = 0; + + virtual bool drawEPS( + tools::Long nX, tools::Long nY, + tools::Long nWidth, tools::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; + + virtual bool drawTransformedBitmap( + const basegfx::B2DPoint& rNull, + const basegfx::B2DPoint& rX, + const basegfx::B2DPoint& rY, + const SalBitmap& rSourceBitmap, + const SalBitmap* pAlphaBitmap, + double fAlpha) = 0; + + virtual bool hasFastDrawTransformedBitmap() const = 0; + + virtual bool drawAlphaRect( + tools::Long nX, tools::Long nY, + tools::Long nWidth, tools::Long nHeight, + sal_uInt8 nTransparency ) = 0; + + virtual bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) = 0; + virtual bool implDrawGradient(basegfx::B2DPolyPolygon const & rPolyPolygon, SalGradient const & 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 0000000000..418b1cf375 --- /dev/null +++ b/vcl/inc/salgeom.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_SALGEOM_HXX +#define INCLUDED_VCL_INC_SALGEOM_HXX + +#include <iostream> + +#include <vcl/dllapi.h> +#include <vcl/WindowPosSize.hxx> +#include <tools/long.hxx> + +// There are some unused functions, which I would keep to ease understanding. +class SalFrameGeometry : public vcl::WindowPosSize +{ + // non-drawable area / margins / frame / decorations around the client area + sal_uInt32 m_nLeftDecoration, m_nTopDecoration, m_nRightDecoration, m_nBottomDecoration; + unsigned int m_nDisplayScreenNumber; + +public: + SalFrameGeometry() + : m_nLeftDecoration(0) + , m_nTopDecoration(0) + , m_nRightDecoration(0) + , m_nBottomDecoration(0) + , m_nDisplayScreenNumber(0) + { + } + + constexpr sal_uInt32 leftDecoration() const { return m_nLeftDecoration; } + void setLeftDecoration(sal_uInt32 nLeftDecoration) { m_nLeftDecoration = nLeftDecoration; } + constexpr sal_uInt32 topDecoration() const { return m_nTopDecoration; } + void setTopDecoration(sal_uInt32 nTopDecoration) { m_nTopDecoration = nTopDecoration; } + constexpr sal_uInt32 rightDecoration() const { return m_nRightDecoration; } + void setRightDecoration(sal_uInt32 nRightDecoration) { m_nRightDecoration = nRightDecoration; } + constexpr sal_uInt32 bottomDecoration() const { return m_nBottomDecoration; } + void setBottomDecoration(sal_uInt32 nBottomDecoration) + { + m_nBottomDecoration = nBottomDecoration; + } + void setDecorations(sal_uInt32 nLeft, sal_uInt32 nTop, sal_uInt32 nRight, sal_uInt32 nBottom) + { + m_nLeftDecoration = nLeft; + m_nTopDecoration = nTop; + m_nRightDecoration = nRight; + m_nBottomDecoration = nBottom; + } + + unsigned int screen() const { return m_nDisplayScreenNumber; } + void setScreen(unsigned int nScreen) { m_nDisplayScreenNumber = nScreen; } +}; + +inline std::ostream& operator<<(std::ostream& s, const SalFrameGeometry& rGeom) +{ + s << *static_cast<const vcl::WindowPosSize*>(&rGeom) << ":{" << rGeom.leftDecoration() << "," + << rGeom.topDecoration() << "," << rGeom.rightDecoration() << "," << rGeom.bottomDecoration() + << "}s" << rGeom.screen(); + return s; +} + +/// Interface used to share logic on sizing between +/// SalVirtualDevices and SalFrames +class VCL_PLUGIN_PUBLIC SalGeometryProvider +{ +public: + virtual ~SalGeometryProvider() {} + virtual tools::Long GetWidth() const = 0; + virtual tools::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 0000000000..124118f4e6 --- /dev/null +++ b/vcl/inc/salinst.hxx @@ -0,0 +1,232 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 "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::sun::star::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 SystemEnvData; +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; + +protected: + bool m_bSupportsBitmap32 = false; + bool m_bSupportsOpenGL = false; + +public: + SalInstance(std::unique_ptr<comphelper::SolarMutex> pMutex); + virtual ~SalInstance(); + + bool supportsBitmap32() const { return m_bSupportsBitmap32; } + bool supportsOpenGL() const { return m_bSupportsOpenGL; } + + //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& rGraphics, + tools::Long &rDX, tools::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; + + // 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(); + + // also needs to set m_bSupportsOpenGL = true in your SalInstance implementation! + virtual OpenGLContext* CreateOpenGLContext(); + + virtual std::unique_ptr<weld::Builder> CreateBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile); + virtual std::unique_ptr<weld::Builder> CreateInterimBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, + bool bAllowCycleFocusOut, sal_uInt64 nLOKWindowId = 0); + 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> ImplCreateDragSource(const SystemEnvData*); + virtual css::uno::Reference<css::uno::XInterface> ImplCreateDropTarget(const SystemEnvData*); + css::uno::Reference<css::uno::XInterface> CreateDragSource(const SystemEnvData* = nullptr); + css::uno::Reference<css::uno::XInterface> CreateDropTarget(const SystemEnvData* = nullptr); + 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 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; } + + virtual void BeforeAbort(const OUString& /* rErrorText */, bool /* bDumpCore */) {} + + // Note: we cannot make this a global variable, because it might be initialised BEFORE the putenv() call in cppunittester. + static bool IsRunningUnitTest() { return getenv("LO_TESTNAME") != nullptr; } + + // both must be implemented, if the VCL plugin needs to run via system event loop + virtual bool DoExecute(int &nExitCode); + virtual void DoQuit(); +}; + +// 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 0000000000..bdbd451890 --- /dev/null +++ b/vcl/inc/sallayout.hxx @@ -0,0 +1,167 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_INC_SALLAYOUT_HXX +#define INCLUDED_VCL_INC_SALLAYOUT_HXX + +#include <sal/config.h> + +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> + +#include <vcl/dllapi.h> +#include <vcl/vclenum.hxx> // for typedef sal_UCS4 +#include <vcl/vcllayout.hxx> + +#include "ImplLayoutRuns.hxx" +#include "impglyphitem.hxx" + +#include <com/sun/star/i18n/XBreakIterator.hpp> + +#include <hb.h> + +#include <memory> +#include <vector> + +#define MAX_FALLBACK 16 + +class GenericSalLayout; +class SalGraphics; +enum class SalLayoutFlags; + +namespace vcl::font { + class PhysicalFontFace; +} + +namespace vcl::text { + class TextLayoutCache; +} + +class VCL_DLLPUBLIC MultiSalLayout final : public SalLayout +{ +public: + void DrawText(SalGraphics&) const override; + sal_Int32 GetTextBreak(double nMaxWidth, double nCharExtra, int nFactor) const override; + double GetTextWidth() const final override; + double FillDXArray(std::vector<double>* pDXArray, const OUString& rStr) const override; + void GetCaretPositions(std::vector<double>& rCaretPositions, const OUString& rStr) const override; + bool GetNextGlyph(const GlyphItem** pGlyph, basegfx::B2DPoint& rPos, int& nStart, + const LogicalFontInstance** ppGlyphFont = nullptr) const override; + bool GetOutline(basegfx::B2DPolyPolygonVector&) const override; + bool IsKashidaPosValid(int nCharPos, int nNextCharPos) const override; + SalLayoutGlyphs GetGlyphs() const final 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 &); + // give up ownership of the initial pBaseLayout taken by the ctor + std::unique_ptr<SalLayout> ReleaseBaseLayout(); + bool LayoutText(vcl::text::ImplLayoutArgs&, const SalLayoutGlyphsImpl*) override; + void AdjustLayout(vcl::text::ImplLayoutArgs&) override; + void InitFont() const override; + + void SetIncomplete(bool bIncomplete); + + void ImplAdjustMultiLayout(vcl::text::ImplLayoutArgs& rArgs, + vcl::text::ImplLayoutArgs& rMultiArgs, + const double* pMultiDXArray); + + SAL_DLLPRIVATE ImplLayoutRuns* GetFallbackRuns() { return maFallbackRuns; } + + 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::ImplAdjustMultiLayout( + vcl::text::ImplLayoutArgs& rArgs, + vcl::text::ImplLayoutArgs& rMultiArgs, + const double* pMultiDXArray); + +public: + GenericSalLayout(LogicalFontInstance&); + ~GenericSalLayout() override; + + void AdjustLayout(vcl::text::ImplLayoutArgs&) final override; + bool LayoutText(vcl::text::ImplLayoutArgs&, const SalLayoutGlyphsImpl*) final override; + void DrawText(SalGraphics&) const final override; + SalLayoutGlyphs GetGlyphs() const final override; + + bool IsKashidaPosValid(int nCharPos, int nNextCharPos) const final override; + + // used by upper layers + double GetTextWidth() const final override; + double FillDXArray(std::vector<double>* pDXArray, const OUString& rStr) const final override; + sal_Int32 GetTextBreak(double nMaxWidth, double nCharExtra, int nFactor) const final override; + void GetCaretPositions(std::vector<double>& rCaretPositions, const OUString& rStr) const override; + + // used by display layers + LogicalFontInstance& GetFont() const + { return *m_GlyphItems.GetFont(); } + + bool GetNextGlyph(const GlyphItem** pGlyph, basegfx::B2DPoint& rPos, int& nStart, + const LogicalFontInstance** ppGlyphFont = nullptr) const override; + + const SalLayoutGlyphsImpl& GlyphsImpl() const { return m_GlyphItems; } + +private: + // for glyph+font+script fallback + void MoveGlyph(int nStart, double nNewXPos); + void DropGlyph(int nStart); + void Simplify(bool bIsBase); + + GenericSalLayout( const GenericSalLayout& ) = delete; + GenericSalLayout& operator=( const GenericSalLayout& ) = delete; + + void ApplyDXArray(const double*, const sal_Bool*); + void Justify(double nNewWidth); + void ApplyAsianKerning(std::u16string_view rStr); + + void GetCharWidths(std::vector<double>& rCharWidths, + const OUString& rStr) const; + + void SetNeedFallback(vcl::text::ImplLayoutArgs&, sal_Int32, bool); + + bool HasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 aNextChar); + + void ParseFeatures(std::u16string_view name); + + css::uno::Reference<css::i18n::XBreakIterator> mxBreak; + + SalLayoutGlyphsImpl m_GlyphItems; + + OString msLanguage; + std::vector<hb_feature_t> maFeatures; + + hb_set_t* mpVertGlyphs; + const bool mbFuzzing; +}; + +#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 0000000000..975df9391e --- /dev/null +++ b/vcl/inc/salmenu.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_SALMENU_HXX +#define INCLUDED_VCL_INC_SALMENU_HXX + +#include <utility> +#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, Image aImg, OUString i_TTText ) + : mnId( i_nId ), maImage(std::move( aImg )), maToolTipText(std::move( i_TTText )) {} +}; + +class VCL_PLUGIN_PUBLIC SalMenuItem +{ +public: + virtual ~SalMenuItem(); +}; + +class VCL_PLUGIN_PUBLIC SalMenu +{ +public: + 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 0000000000..b5d9d64f82 --- /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( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) = 0; + virtual void EndSetClipRegion() = 0; + + virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::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 0000000000..97a0fe13aa --- /dev/null +++ b/vcl/inc/salprn.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_SALPRN_HXX +#define INCLUDED_VCL_INC_SALPRN_HXX + +#include <i18nutil/paper.hxx> +#include <rtl/ustring.hxx> +#include <vcl/prntypes.hxx> +#include <vcl/dllapi.h> +#include <tools/gen.hxx> + +#include "salptype.hxx" + +#include <vector> +#include <optional> + +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::optional<OUString> moPortName; // 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, + tools::Long& rOutWidth, tools::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 0000000000..32405aaf24 --- /dev/null +++ b/vcl/inc/salptype.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_SALPTYPE_HXX +#define INCLUDED_VCL_INC_SALPTYPE_HXX + +#include <sal/config.h> + +#include <sal/types.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 0000000000..fb9763bb68 --- /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 0000000000..d7cf10edb1 --- /dev/null +++ b/vcl/inc/salsys.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_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: + 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 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 AbsoluteScreenPixelRectangle 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(); + +#define VIRTUAL_DESKTOP_WIDTH 1024 +#define VIRTUAL_DESKTOP_HEIGHT 768 + +#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 0000000000..69545ac96b --- /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 0000000000..864802c50a --- /dev/null +++ b/vcl/inc/salusereventlist.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_SALUSEREVENTLIST_HXX +#define INCLUDED_VCL_INC_SALUSEREVENTLIST_HXX + +#include <sal/config.h> +#include <vcl/dllapi.h> +#include <mutex> +#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 std::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() {} + + inline bool HasUserEvents_NoLock() const; +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 +{ + std::unique_lock aGuard( m_aUserEventsMutex ); + return HasUserEvents_NoLock(); +} + +inline bool SalUserEventList::HasUserEvents_NoLock() const +{ + return !(m_aUserEvents.empty() && m_aProcessingUserEvents.empty()); +} + +inline void SalUserEventList::PostEvent( SalFrame* pFrame, void* pData, SalEvent nEvent ) +{ + std::unique_lock 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 0000000000..d1035feaeb --- /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( tools::Long nNewDX, tools::Long nNewDY ) = 0; + + // Set new size using a buffer at the given address + virtual bool SetSizeUsingBuffer( tools::Long nNewDX, tools::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 0000000000..4074e097a4 --- /dev/null +++ b/vcl/inc/salvtables.hxx @@ -0,0 +1,2298 @@ +/* -*- 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/builder.hxx> +#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/toolkit/edit.hxx> +#include <vcl/formatter.hxx> +#include <vcl/toolkit/spinfld.hxx> +#include <vcl/toolkit/fixed.hxx> +#include <vcl/toolkit/fixedhyper.hxx> +#include <vcl/toolkit/lstbox.hxx> +#include <vcl/toolkit/menubtn.hxx> +#include <vcl/toolkit/combobox.hxx> +#include <vcl/tabctrl.hxx> +#include <vcl/layout.hxx> +#include <vcl/toolkit/svtabbx.hxx> +#include <vcl/toolkit/svlbitm.hxx> +#include <o3tl/sorted_vector.hxx> +#include "calendar.hxx" +#include "iconview.hxx" +#include "messagedialog.hxx" +#include "verticaltabctrl.hxx" + +namespace vcl +{ +class RoadmapWizard; +}; + +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, + const css::uno::Reference<css::frame::XFrame>& rFrame + = css::uno::Reference<css::frame::XFrame>()); + + virtual std::unique_ptr<weld::MessageDialog> weld_message_dialog(const OUString& id) override; + + virtual std::unique_ptr<weld::Dialog> weld_dialog(const OUString& id) override; + + virtual std::unique_ptr<weld::Assistant> weld_assistant(const OUString& id) override; + + virtual std::unique_ptr<weld::Window> create_screenshot_window() override; + + virtual std::unique_ptr<weld::Widget> weld_widget(const OUString& id) override; + + virtual std::unique_ptr<weld::Container> weld_container(const OUString& id) override; + + virtual std::unique_ptr<weld::Box> weld_box(const OUString& id) override; + + virtual std::unique_ptr<weld::Paned> weld_paned(const OUString& id) override; + + virtual std::unique_ptr<weld::Frame> weld_frame(const OUString& id) override; + + virtual std::unique_ptr<weld::ScrolledWindow> + weld_scrolled_window(const OUString& id, bool bUserManagedScrolling = false) override; + + virtual std::unique_ptr<weld::Notebook> weld_notebook(const OUString& id) override; + + virtual std::unique_ptr<weld::Button> weld_button(const OUString& id) override; + + virtual std::unique_ptr<weld::MenuButton> weld_menu_button(const OUString& id) override; + + virtual std::unique_ptr<weld::MenuToggleButton> + weld_menu_toggle_button(const OUString& id) override; + + virtual std::unique_ptr<weld::LinkButton> weld_link_button(const OUString& id) override; + + virtual std::unique_ptr<weld::ToggleButton> weld_toggle_button(const OUString& id) override; + + virtual std::unique_ptr<weld::RadioButton> weld_radio_button(const OUString& id) override; + + virtual std::unique_ptr<weld::CheckButton> weld_check_button(const OUString& id) override; + + virtual std::unique_ptr<weld::Scale> weld_scale(const OUString& id) override; + + virtual std::unique_ptr<weld::ProgressBar> weld_progress_bar(const OUString& id) override; + + virtual std::unique_ptr<weld::LevelBar> weld_level_bar(const OUString& id) override; + + virtual std::unique_ptr<weld::Spinner> weld_spinner(const OUString& id) override; + + virtual std::unique_ptr<weld::Image> weld_image(const OUString& id) override; + + virtual std::unique_ptr<weld::Calendar> weld_calendar(const OUString& id) override; + + virtual std::unique_ptr<weld::Entry> weld_entry(const OUString& id) override; + + virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OUString& id) override; + + virtual std::unique_ptr<weld::MetricSpinButton> + weld_metric_spin_button(const OUString& id, FieldUnit eUnit) override; + + virtual std::unique_ptr<weld::FormattedSpinButton> + weld_formatted_spin_button(const OUString& id) override; + + virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OUString& id) override; + + virtual std::unique_ptr<weld::EntryTreeView> + weld_entry_tree_view(const OUString& containerid, const OUString& entryid, + const OUString& treeviewid) override; + + virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OUString& id) override; + + virtual std::unique_ptr<weld::IconView> weld_icon_view(const OUString& id) override; + + virtual std::unique_ptr<weld::Label> weld_label(const OUString& id) override; + + virtual std::unique_ptr<weld::TextView> weld_text_view(const OUString& id) override; + + virtual std::unique_ptr<weld::Expander> weld_expander(const OUString& id) override; + + virtual std::unique_ptr<weld::DrawingArea> + weld_drawing_area(const OUString& id, const a11yref& rA11yImpl = nullptr, + FactoryFunction pUITestFactoryFunction = nullptr, + void* pUserData = nullptr) override; + + virtual std::unique_ptr<weld::Menu> weld_menu(const OUString& id) override; + + virtual std::unique_ptr<weld::Popover> weld_popover(const OUString& id) override; + + virtual std::unique_ptr<weld::Toolbar> weld_toolbar(const OUString& id) override; + + virtual std::unique_ptr<weld::Scrollbar> weld_scrollbar(const OUString& id) override; + + virtual std::unique_ptr<weld::SizeGroup> create_size_group() override; + + OUString get_current_page_help_id() const; + + virtual ~SalInstanceBuilder() override; +}; + +class SAL_DLLPUBLIC_RTTI SalInstanceMenu final : public weld::Menu +{ +private: + VclPtr<PopupMenu> m_xMenu; + + bool m_bTakeOwnership; + sal_uInt16 m_nLastId; + + DECL_DLLPRIVATE_LINK(SelectMenuHdl, ::Menu*, bool); + +public: + SalInstanceMenu(PopupMenu* pMenu, bool bTakeOwnership); + virtual OUString popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect, + weld::Placement ePlace = weld::Placement::Under) override; + virtual void set_sensitive(const OUString& rIdent, bool bSensitive) override; + virtual bool get_sensitive(const OUString& rIdent) const override; + virtual void set_active(const OUString& rIdent, bool bActive) override; + virtual bool get_active(const OUString& rIdent) const override; + virtual void set_label(const OUString& rIdent, const OUString& rLabel) override; + virtual OUString get_label(const OUString& rIdent) const override; + virtual void set_visible(const OUString& rIdent, bool bShow) override; + virtual void clear() override; + virtual void insert(int pos, const OUString& rId, const OUString& rStr, + const OUString* pIconName, VirtualDevice* pImageSurface, + const css::uno::Reference<css::graphic::XGraphic>& rImage, + TriState eCheckRadioFalse) override; + virtual void insert_separator(int pos, const OUString& rId) override; + virtual void set_item_help_id(const OUString& rIdent, const OUString& rHelpId) override; + virtual void remove(const OUString& rId) override; + virtual OUString get_id(int pos) const override; + virtual int n_children() const override; + PopupMenu* getMenu() const; + virtual ~SalInstanceMenu() override; +}; + +class SalFlashAttention; + +class SalInstanceWidget : public virtual weld::Widget +{ +protected: + VclPtr<vcl::Window> m_xWidget; + std::unique_ptr<SalFlashAttention> m_xFlashAttention; + SalInstanceBuilder* m_pBuilder; + +private: + DECL_LINK(EventListener, VclWindowEvent&, void); + DECL_LINK(KeyEventListener, VclWindowEvent&, bool); + DECL_LINK(MouseEventListener, VclWindowEvent&, void); + DECL_LINK(SettingsChangedHdl, VclWindowEvent&, void); + DECL_LINK(MnemonicActivateHdl, vcl::Window&, bool); + + static void DoRecursivePaint(vcl::Window* pWindow, const Point& rPos, OutputDevice& rOutput); + + const bool m_bTakeOwnership; + bool m_bEventListener; + bool m_bKeyEventListener; + bool m_bMouseEventListener; + int m_nBlockNotify; + int m_nFreezeCount; + +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(); + + bool IsFirstFreeze() const { return m_nFreezeCount == 0; } + bool IsLastThaw() const { return m_nFreezeCount == 1; } + + virtual void HandleEventListener(VclWindowEvent& rEvent); + virtual bool HandleKeyEventListener(VclWindowEvent& rEvent); + virtual void HandleMouseEventListener(VclWindowEvent& rEvent); + +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 bool has_child_focus() 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 OUString get_buildable_name() const override; + + virtual void set_buildable_name(const OUString& rId) override; + + virtual void set_help_id(const OUString& rId) override; + + virtual OUString 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_margin_top(int nMargin) override; + + virtual void set_margin_bottom(int nMargin) override; + + virtual void set_margin_start(int nMargin) override; + + virtual void set_margin_end(int nMargin) override; + + virtual int get_margin_top() const override; + + virtual int get_margin_bottom() const override; + + virtual int get_margin_start() const override; + + virtual int get_margin_end() const override; + + virtual void set_accessible_name(const OUString& rName) override; + + virtual void set_accessible_description(const OUString& rDescription) 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_tooltip_text(const OUString& rTip) override; + + virtual OUString get_tooltip_text() const override; + + virtual void set_cursor_data(void* pData) 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 void connect_style_updated(const Link<Widget&, void>& rLink) override; + + virtual bool get_extents_relative_to(const Widget& rRelative, int& x, int& y, int& width, + int& height) const 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 void set_busy_cursor(bool bBusy) override; + + virtual std::unique_ptr<weld::Container> weld_parent() const override; + + virtual ~SalInstanceWidget() override; + + vcl::Window* getWidget() const; + + void disable_notify_events(); + + bool notify_events_disabled() const; + + void enable_notify_events(); + + virtual void queue_resize() override; + + virtual void help_hierarchy_foreach(const std::function<bool(const OUString&)>& 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 css::uno::Reference<css::datatransfer::clipboard::XClipboard> + get_clipboard() const override; + + virtual void connect_get_property_tree(const Link<tools::JsonWriter&, void>& rLink) override; + + virtual void get_property_tree(tools::JsonWriter& rJsonWriter) override; + + virtual void call_attention_to() override; + + virtual void set_stack_background() override; + + virtual void set_title_background() override; + + virtual void set_toolbar_background() override; + + virtual void set_highlight_background() override; + + virtual void set_background(const Color& rColor) override; + + virtual void draw(OutputDevice& rOutput, const Point& rPos, const Size& rSizePixel) 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_label_type(weld::LabelType eType) override; + + virtual void set_font(const vcl::Font& rFont) override; + + virtual void set_font_color(const Color& rColor) override; +}; + +class SalInstanceContainer : public SalInstanceWidget, public virtual weld::Container +{ + VclPtr<vcl::Window> m_xContainer; + +public: + SalInstanceContainer(vcl::Window* pContainer, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + virtual void HandleEventListener(VclWindowEvent& rEvent) override; + virtual void connect_container_focus_changed(const Link<Container&, void>& rLink) override; + virtual void child_grab_focus() override; + virtual void move(weld::Widget* pWidget, weld::Container* pNewParent) 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); + + void recursively_unset_default_buttons(); + + void implResetDefault(const vcl::Window* _pWindow); + +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 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 AbsoluteScreenPixelRectangle 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 change_default_widget(weld::Widget* pOld, weld::Widget* pNew) override; + + virtual bool is_default_widget(const weld::Widget* pCandidate) const override; + + virtual void set_window_state(const OUString& rStr) override; + + virtual OUString get_window_state(vcl::WindowDataMask nMask) const override; + + virtual SystemEnvData get_system_data() const override; + + virtual weld::ScreenShotCollection collect_screenshot_data() override; + + virtual VclPtr<VirtualDevice> screenshot() override; + + virtual const vcl::ILibreOfficeKitNotifier* GetLOKNotifier() override; + + virtual ~SalInstanceWindow() override; +}; + +class SalInstanceDialog : public SalInstanceWindow, public virtual weld::Dialog +{ +protected: + VclPtr<::Dialog> m_xDialog; + +private: + // 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 + tools::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 OUString& rHelpId = {}) 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 SalInstanceAssistant : public SalInstanceDialog, public virtual weld::Assistant +{ +protected: + VclPtr<vcl::RoadmapWizard> m_xWizard; + +private: + std::vector<std::unique_ptr<SalInstanceContainer>> m_aPages; + std::vector<VclPtr<TabPage>> m_aAddedPages; + std::vector<int> m_aIds; + std::vector<VclPtr<VclGrid>> m_aAddedGrids; + Idle m_aUpdateRoadmapIdle; + + int find_page(std::u16string_view rIdent) const; + int find_id(int nId) const; + + DECL_LINK(OnRoadmapItemSelected, LinkParamNone*, void); + DECL_LINK(UpdateRoadmap_Hdl, Timer*, void); + +public: + SalInstanceAssistant(vcl::RoadmapWizard* pDialog, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + virtual int get_current_page() const override; + virtual int get_n_pages() const override; + virtual OUString get_page_ident(int nPage) const override; + virtual OUString get_current_page_ident() const override; + virtual void set_current_page(int nPage) override; + virtual void set_current_page(const OUString& rIdent) override; + virtual void set_page_index(const OUString& rIdent, int nNewIndex) override; + virtual weld::Container* append_page(const OUString& rIdent) override; + virtual OUString get_page_title(const OUString& rIdent) const override; + virtual void set_page_title(const OUString& rIdent, const OUString& rTitle) override; + virtual void set_page_sensitive(const OUString& rIdent, bool bSensitive) override; + virtual void set_page_side_help_id(const OUString& rHelpId) override; + virtual void set_page_side_image(const OUString& rImage) override; + weld::Button* weld_widget_for_response(int nResponse) override; + + virtual ~SalInstanceAssistant() 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_overwrite_mode(bool bOn) override; + + virtual bool get_overwrite_mode() const override; + + virtual void set_message_type(weld::EntryMessageType eType) override; + + virtual void set_font(const vcl::Font& rFont) override; + + virtual void set_font_color(const Color& rColor) 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 void set_alignment(TxtAlign eXAlign) override; + + virtual ~SalInstanceEntry() override; +}; + +class SalInstanceSpinButton : public SalInstanceEntry, public virtual weld::SpinButton +{ + VclPtr<FormattedField> m_xButton; + +protected: + Formatter& m_rFormatter; + +private: + DECL_LINK(UpDownHdl, SpinField&, void); + DECL_LINK(LoseFocusHdl, Control&, void); + DECL_LINK(OutputHdl, LinkParamNone*, bool); + DECL_LINK(InputHdl, sal_Int64*, TriState); + DECL_LINK(ActivateHdl, Edit&, bool); + + double toField(sal_Int64 nValue) const; + + sal_Int64 fromField(double fValue) const; + +public: + SalInstanceSpinButton(FormattedField* pButton, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual sal_Int64 get_value() const override; + + virtual void set_value(sal_Int64 value) override; + + virtual void set_range(sal_Int64 min, sal_Int64 max) override; + + virtual void get_range(sal_Int64& min, sal_Int64& 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; + + //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 SalInstanceWidget, 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) + : SalInstanceWidget(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 + { + assert(m_xComboBox->IsUpdateMode() + && "don't set_active when frozen, set_active after thaw. Note selection doesn't " + "survive a " + "freeze"); + 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) + { + vcl::Window* pEventWindow = m_xComboBox->GetMainWindow(); + if (m_xMenuButton->GetParent() != pEventWindow) + m_xMenuButton->SetParent(pEventWindow); + int nButtonWidth = get_menu_button_width(); + m_xMenuButton->SetSizePixel(Size(nButtonWidth, rRect.GetHeight())); + m_xMenuButton->SetPosPixel(Point(rRect.GetWidth() - nButtonWidth, rRect.Top())); + } + } + + 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 OUString& 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 = rIdent; + } + + int get_menu_button_width() const override + { + OutputDevice* pDefault = Application::GetDefaultDevice(); + return 20 * (pDefault ? pDefault->GetDPIScaleFactor() : 1.0); + } + + void CallHandleEventListener(VclWindowEvent& rEvent) + { + if (rEvent.GetId() == VclEventId::DropdownPreOpen + || rEvent.GetId() == VclEventId::DropdownClose) + { + signal_popup_toggled(); + return; + } + SalInstanceWidget::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_font(const vcl::Font& rFont) 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_font(const vcl::Font& rFont) 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 void call_attention_to() override; + + virtual ~SalInstanceComboBoxWithEdit() override; +}; + +class SalInstanceButton : public SalInstanceWidget, 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 OUString get_label() const override; + + virtual void set_font(const vcl::Font& rFont) override; + + virtual void set_custom_button(VirtualDevice* pDevice) override; + + virtual ~SalInstanceButton() override; +}; + +class SalInstanceToggleButton : public SalInstanceButton, public virtual weld::ToggleButton +{ +private: + VclPtr<PushButton> m_xToggleButton; + + DECL_LINK(ToggleListener, VclWindowEvent&, void); + +public: + SalInstanceToggleButton(PushButton* pButton, SalInstanceBuilder* pBuilder, bool bTakeOwnership) + : SalInstanceButton(pButton, pBuilder, bTakeOwnership) + , m_xToggleButton(pButton) + { + m_xToggleButton->setToggleButton(true); + } + + virtual void connect_toggled(const Link<Toggleable&, void>& rLink) override + { + assert(!m_aToggleHdl.IsSet()); + m_xToggleButton->AddEventListener(LINK(this, SalInstanceToggleButton, ToggleListener)); + weld::ToggleButton::connect_toggled(rLink); + } + + virtual void set_active(bool active) override + { + disable_notify_events(); + m_xToggleButton->Check(active); + enable_notify_events(); + } + + virtual bool get_active() const override { return m_xToggleButton->IsChecked(); } + + virtual void set_inconsistent(bool inconsistent) override + { + disable_notify_events(); + m_xToggleButton->SetState(inconsistent ? TRISTATE_INDET : TRISTATE_FALSE); + enable_notify_events(); + } + + virtual bool get_inconsistent() const override + { + return m_xToggleButton->GetState() == TRISTATE_INDET; + } + + virtual ~SalInstanceToggleButton() override + { + if (m_aToggleHdl.IsSet()) + m_xToggleButton->RemoveEventListener( + LINK(this, SalInstanceToggleButton, ToggleListener)); + } +}; + +class SalInstanceNotebook : public SalInstanceWidget, public virtual weld::Notebook +{ +private: + VclPtr<TabControl> m_xNotebook; + mutable std::vector<std::shared_ptr<SalInstanceContainer>> m_aPages; + std::map<OUString, 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 int get_page_index(const OUString& rIdent) const override; + + virtual OUString get_page_ident(int nPage) const override; + + virtual OUString get_current_page_ident() const override; + + virtual weld::Container* get_page(const OUString& rIdent) const override; + + virtual void set_current_page(int nPage) override; + + virtual void set_current_page(const OUString& rIdent) override; + + virtual void remove_page(const OUString& rIdent) override; + + virtual void insert_page(const OUString& rIdent, const OUString& rLabel, int nPos) override; + + virtual int get_n_pages() const override; + + virtual OUString get_tab_label_text(const OUString& rIdent) const override; + + virtual void set_tab_label_text(const OUString& rIdent, const OUString& rText) override; + + virtual void set_show_tabs(bool bShow) override; + + virtual ~SalInstanceNotebook() override; +}; + +class SalInstanceMessageDialog : public SalInstanceDialog, public virtual weld::MessageDialog +{ +protected: + 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 SalInstanceLinkButton : public SalInstanceWidget, public virtual weld::LinkButton +{ +private: + VclPtr<FixedHyperlink> m_xButton; + Link<FixedHyperlink&, void> m_aOrigClickHdl; + + DECL_LINK(ClickHdl, FixedHyperlink&, void); + +public: + SalInstanceLinkButton(FixedHyperlink* pButton, SalInstanceBuilder* pBuilder, + bool bTakeOwnership) + : SalInstanceWidget(pButton, pBuilder, bTakeOwnership) + , m_xButton(pButton) + { + m_aOrigClickHdl = m_xButton->GetClickHdl(); + m_xButton->SetClickHdl(LINK(this, SalInstanceLinkButton, ClickHdl)); + } + + virtual void set_label(const OUString& rText) override { m_xButton->SetText(rText); } + + virtual OUString get_label() const override { return m_xButton->GetText(); } + + virtual void set_uri(const OUString& rUri) override { m_xButton->SetURL(rUri); } + + virtual OUString get_uri() const override { return m_xButton->GetURL(); } + + virtual void set_label_wrap(bool wrap) override; + + virtual ~SalInstanceLinkButton() override { m_xButton->SetClickHdl(m_aOrigClickHdl); } +}; + +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 void set_label(const OUString& rText) override { SalInstanceButton::set_label(rText); } + + virtual OUString get_label() const override { return SalInstanceButton::get_label(); } + + virtual void set_label_wrap(bool wrap) override; + + virtual ~SalInstanceCheckButton() override; +}; + +class SalInstanceDrawingArea : public SalInstanceWidget, public virtual weld::DrawingArea +{ +private: + VclPtr<VclDrawingArea> m_xDrawingArea; + + typedef std::pair<vcl::RenderContext&, const tools::Rectangle&> target_and_area; + DECL_LINK(PaintHdl, target_and_area, void); + DECL_LINK(ResizeHdl, const Size&, void); + DECL_LINK(MousePressHdl, const MouseEvent&, bool); + DECL_LINK(MouseMoveHdl, const MouseEvent&, bool); + DECL_LINK(MouseReleaseHdl, const MouseEvent&, bool); + DECL_LINK(KeyPressHdl, const KeyEvent&, bool); + DECL_LINK(KeyReleaseHdl, const KeyEvent&, bool); + DECL_LINK(StyleUpdatedHdl, VclDrawingArea&, void); + DECL_LINK(CommandHdl, const CommandEvent&, bool); + DECL_LINK(QueryTooltipHdl, tools::Rectangle&, OUString); + DECL_LINK(GetSurroundingHdl, OUString&, int); + DECL_LINK(DeleteSurroundingHdl, const Selection&, bool); + DECL_LINK(StartDragHdl, VclDrawingArea*, bool); + + // SalInstanceWidget has a generic listener for all these + // events, ignore the ones we have specializations for + // in VclDrawingArea + virtual void HandleEventListener(VclWindowEvent& rEvent) override; + + virtual void HandleMouseEventListener(VclWindowEvent& rEvent) override; + + virtual bool HandleKeyEventListener(VclWindowEvent& /*rEvent*/) override; + +public: + SalInstanceDrawingArea(VclDrawingArea* pDrawingArea, SalInstanceBuilder* pBuilder, + const a11yref& rAlly, FactoryFunction pUITestFactoryFunction, + void* pUserData, bool bTakeOwnership); + + virtual void queue_draw() override; + + virtual void queue_draw_area(int x, int y, int width, int height) override; + + virtual void connect_size_allocate(const Link<const Size&, void>& 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 void connect_style_updated(const Link<Widget&, void>& rLink) override; + + virtual void set_cursor(PointerStyle ePointerStyle) override; + + virtual Point get_pointer_position() const override; + + virtual void set_input_context(const InputContext& rInputContext) override; + + virtual void im_context_set_cursor_location(const tools::Rectangle& rCursorRect, + int nExtTextInputWidth) override; + + virtual a11yref get_accessible_parent() override; + + virtual a11yrelationset get_accessible_relation_set() override; + + virtual AbsoluteScreenPixelPoint get_accessible_location_on_screen() override; + + virtual void enable_drag_source(rtl::Reference<TransferDataContainer>& rHelper, + sal_uInt8 eDNDConstants) override; + + virtual ~SalInstanceDrawingArea() override; + + virtual OutputDevice& get_ref_device() override; + + virtual void click(const Point& rPos) override; + + virtual void dblclick(const Point& rPos) override; + + virtual void mouse_up(const Point& rPos) override; + + virtual void mouse_down(const Point& rPos) override; + + virtual void mouse_move(const Point& rPos) override; +}; + +class SalInstanceToolbar : public SalInstanceWidget, public virtual weld::Toolbar +{ +protected: + VclPtr<ToolBox> m_xToolBox; + std::map<ToolBoxItemId, VclPtr<vcl::Window>> m_aFloats; + std::map<ToolBoxItemId, VclPtr<PopupMenu>> m_aMenus; + + OUString m_sStartShowIdent; + + DECL_LINK(ClickHdl, ToolBox*, void); + DECL_LINK(DropdownClick, ToolBox*, void); + DECL_LINK(MenuToggleListener, VclWindowEvent&, void); + +public: + SalInstanceToolbar(ToolBox* pToolBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void set_item_sensitive(const OUString& rIdent, bool bSensitive) override; + + virtual bool get_item_sensitive(const OUString& rIdent) const override; + + virtual void set_item_visible(const OUString& rIdent, bool bVisible) override; + + virtual void set_item_help_id(const OUString& rIdent, const OUString& rHelpId) override; + + virtual bool get_item_visible(const OUString& rIdent) const override; + + virtual void set_item_active(const OUString& rIdent, bool bActive) override; + + virtual bool get_item_active(const OUString& rIdent) const override; + + void set_menu_item_active(const OUString& rIdent, bool bActive) override; + + bool get_menu_item_active(const OUString& rIdent) const override; + + virtual void set_item_popover(const OUString& rIdent, weld::Widget* pPopover) override; + + virtual void set_item_menu(const OUString& rIdent, weld::Menu* pMenu) override; + + virtual void insert_item(int pos, const OUString& rId) override; + + virtual void insert_separator(int pos, const OUString& /*rId*/) override; + + virtual int get_n_items() const override; + + virtual OUString get_item_ident(int nIndex) const override; + + virtual void set_item_ident(int nIndex, const OUString& rIdent) override; + + virtual void set_item_label(int nIndex, const OUString& rLabel) override; + + virtual OUString get_item_label(const OUString& rIdent) const override; + + virtual void set_item_label(const OUString& rIdent, const OUString& rLabel) override; + + virtual void set_item_icon_name(const OUString& rIdent, const OUString& rIconName) override; + + virtual void set_item_image_mirrored(const OUString& rIdent, bool bMirrored) override; + + virtual void set_item_image(const OUString& rIdent, + const css::uno::Reference<css::graphic::XGraphic>& rIcon) override; + + virtual void set_item_image(const OUString& rIdent, VirtualDevice* pDevice) override; + + virtual void set_item_image(int nIndex, + const css::uno::Reference<css::graphic::XGraphic>& rIcon) override; + + virtual void set_item_tooltip_text(int nIndex, const OUString& rTip) override; + + virtual void set_item_tooltip_text(const OUString& rIdent, const OUString& rTip) override; + + virtual OUString get_item_tooltip_text(const OUString& rIdent) const override; + + virtual vcl::ImageType get_icon_size() const override; + + virtual void set_icon_size(vcl::ImageType eType) override; + + virtual sal_uInt16 get_modifier_state() const override; + + virtual int get_drop_index(const Point& rPoint) const override; + + virtual ~SalInstanceToolbar() override; +}; + +class SalInstanceTextView : public SalInstanceWidget, public virtual weld::TextView +{ +private: + VclPtr<VclMultiLineEdit> m_xTextView; + Link<ScrollBar*, void> m_aOrigVScrollHdl; + + DECL_LINK(ChangeHdl, Edit&, void); + DECL_LINK(VscrollHdl, ScrollBar*, void); + DECL_LINK(CursorListener, VclWindowEvent&, void); + +public: + SalInstanceTextView(VclMultiLineEdit* pTextView, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual void set_text(const OUString& rText) override; + + virtual void replace_selection(const OUString& rText) override; + + virtual OUString get_text() const override; + + bool get_selection_bounds(int& rStartPos, int& rEndPos) override; + + virtual void select_region(int nStartPos, int nEndPos) override; + + virtual void set_editable(bool bEditable) override; + virtual bool get_editable() const override; + virtual void set_max_length(int nChars) override; + + virtual void set_monospace(bool bMonospace) override; + + virtual void set_font(const vcl::Font& rFont) override; + + virtual void set_font_color(const Color& rColor) override; + + virtual void connect_cursor_position(const Link<TextView&, void>& rLink) override; + + virtual bool can_move_cursor_with_up() const override; + + virtual bool can_move_cursor_with_down() const override; + + virtual void cut_clipboard() override; + + virtual void copy_clipboard() override; + + virtual void paste_clipboard() override; + + virtual void set_alignment(TxtAlign eXAlign) override; + + virtual int vadjustment_get_value() const override; + + virtual void vadjustment_set_value(int value) override; + + virtual int vadjustment_get_upper() const override; + + virtual int vadjustment_get_lower() const override; + + virtual int vadjustment_get_page_size() const override; + + virtual bool has_focus() const override; + + virtual ~SalInstanceTextView() override; +}; + +struct SalInstanceTreeIter final : public weld::TreeIter +{ + SalInstanceTreeIter(const SalInstanceTreeIter* pOrig) + : iter(pOrig ? pOrig->iter : nullptr) + { + } + SalInstanceTreeIter(SvTreeListEntry* pIter) + : iter(pIter) + { + } + virtual bool equal(const TreeIter& rOther) const override + { + return iter == static_cast<const SalInstanceTreeIter&>(rOther).iter; + } + SvTreeListEntry* iter; +}; + +class SalInstanceTreeView : public SalInstanceWidget, public virtual weld::TreeView +{ +protected: + // owner for UserData + std::vector<std::unique_ptr<OUString>> m_aUserData; + VclPtr<SvTabListBox> m_xTreeView; + SvLBoxButtonData m_aCheckButtonData; + SvLBoxButtonData m_aRadioButtonData; + // currently expanding parent that logically, but not currently physically, + // contain placeholders + o3tl::sorted_vector<SvTreeListEntry*> m_aExpandingPlaceHolderParents; + // which columns should be custom rendered + o3tl::sorted_vector<int> m_aCustomRenders; + bool m_bTogglesAsRadio; + int m_nSortColumn; + + DECL_LINK(SelectHdl, SvTreeListBox*, void); + DECL_LINK(DeSelectHdl, SvTreeListBox*, void); + DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool); + DECL_LINK(ExpandingHdl, SvTreeListBox*, bool); + DECL_LINK(EndDragHdl, HeaderBar*, void); + DECL_LINK(HeaderBarClickedHdl, HeaderBar*, void); + DECL_LINK(ToggleHdl, SvLBoxButtonData*, void); + DECL_LINK(ModelChangedHdl, SvTreeListBox*, void); + DECL_LINK(StartDragHdl, SvTreeListBox*, bool); + DECL_STATIC_LINK(SalInstanceTreeView, FinishDragHdl, SvTreeListBox*, void); + DECL_LINK(EditingEntryHdl, SvTreeListEntry*, bool); + typedef std::pair<SvTreeListEntry*, OUString> IterString; + DECL_LINK(EditedEntryHdl, IterString, bool); + DECL_LINK(VisibleRangeChangedHdl, SvTreeListBox*, void); + DECL_LINK(CompareHdl, const SvSortData&, sal_Int32); + DECL_LINK(PopupMenuHdl, const CommandEvent&, bool); + DECL_LINK(TooltipHdl, SvTreeListEntry*, OUString); + DECL_LINK(CustomRenderHdl, svtree_render_args, void); + DECL_LINK(CustomMeasureHdl, svtree_measure_args, Size); + + bool ExpandRow(const SalInstanceTreeIter& rIter); + + // Each row has a cell for the expander image, (and an optional cell for a + // checkbutton if enable_toggle_buttons has been called) which precede + // index 0 + int to_internal_model(int col) const; + + int to_external_model(int col) const; + + bool IsDummyEntry(SvTreeListEntry* pEntry) const; + + SvTreeListEntry* GetPlaceHolderChild(SvTreeListEntry* pEntry) const; + + static void set_font_color(SvTreeListEntry* pEntry, const Color& rColor); + + void AddStringItem(SvTreeListEntry* pEntry, const OUString& rStr, int nCol); + + void do_insert(const weld::TreeIter* pParent, int pos, const OUString* pStr, + const OUString* pId, const OUString* pIconName, + const VirtualDevice* pImageSurface, bool bChildrenOnDemand, weld::TreeIter* pRet, + bool bIsSeparator); + + void update_checkbutton_column_width(SvTreeListEntry* pEntry); + + void InvalidateModelEntry(SvTreeListEntry* pEntry); + + void do_set_toggle(SvTreeListEntry* pEntry, TriState eState, int col); + + static TriState do_get_toggle(SvTreeListEntry* pEntry, int col); + static bool do_get_sensitive(SvTreeListEntry* pEntry, int col); + + TriState get_toggle(SvTreeListEntry* pEntry, int col) const; + + void set_toggle(SvTreeListEntry* pEntry, TriState eState, int col); + + bool get_text_emphasis(SvTreeListEntry* pEntry, int col) const; + + void set_header_item_width(const std::vector<int>& rWidths); + +public: + SalInstanceTreeView(SvTabListBox* pTreeView, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void connect_query_tooltip(const Link<const weld::TreeIter&, OUString>& rLink) override; + + virtual void columns_autosize() override; + + virtual void freeze() override; + + virtual void thaw() override; + + virtual void set_column_fixed_widths(const std::vector<int>& rWidths) override; + + virtual void set_column_editables(const std::vector<bool>& rEditables) override; + + virtual void set_centered_column(int nCol) override; + + virtual int get_column_width(int nColumn) const override; + + virtual OUString get_column_title(int nColumn) const override; + + virtual void set_column_title(int nColumn, const OUString& rTitle) override; + + virtual void set_column_custom_renderer(int nColumn, bool bEnable) override; + + virtual void queue_draw() override; + + virtual void show() override; + + virtual void hide() override; + + virtual void insert(const weld::TreeIter* pParent, int pos, const OUString* pStr, + const OUString* pId, const OUString* pIconName, + VirtualDevice* pImageSurface, bool bChildrenOnDemand, + weld::TreeIter* pRet) override; + + virtual void insert_separator(int pos, const OUString& /*rId*/) override; + + virtual void + bulk_insert_for_each(int nSourceCount, + const std::function<void(weld::TreeIter&, int nSourceIndex)>& func, + const weld::TreeIter* pParent = nullptr, + const std::vector<int>* pFixedWidths = nullptr) override; + + virtual void set_font_color(int pos, const Color& rColor) override; + + virtual void set_font_color(const weld::TreeIter& rIter, const Color& rColor) override; + + virtual void remove(int pos) override; + + virtual int find_text(const OUString& rText) const override; + + virtual int find_id(const OUString& rId) const override; + + virtual void swap(int pos1, int pos2) override; + + virtual void clear() override; + + virtual int n_children() const override; + + virtual int iter_n_children(const weld::TreeIter& rIter) const override; + + virtual void select(int pos) override; + + virtual int get_cursor_index() const override; + + virtual void set_cursor(int pos) override; + + virtual void scroll_to_row(int pos) override; + + virtual bool is_selected(int pos) const override; + + virtual void unselect(int pos) override; + + virtual std::vector<int> get_selected_rows() const override; + + OUString get_text(SvTreeListEntry* pEntry, int col) const; + + virtual OUString get_text(int pos, int col = -1) const override; + + void set_text(SvTreeListEntry* pEntry, const OUString& rText, int col); + + virtual void set_text(int pos, const OUString& rText, int col = -1) override; + + using SalInstanceWidget::set_sensitive; + using SalInstanceWidget::get_sensitive; + + void set_sensitive(SvTreeListEntry* pEntry, bool bSensitive, int col); + bool get_sensitive(SvTreeListEntry* pEntry, int col) const; + + virtual void set_sensitive(int pos, bool bSensitive, int col = -1) override; + + virtual void set_sensitive(const weld::TreeIter& rIter, bool bSensitive, int col = -1) override; + + virtual bool get_sensitive(int pos, int col) const override; + + virtual bool get_sensitive(const weld::TreeIter& rIter, int col) const override; + + virtual TriState get_toggle(int pos, int col = -1) const override; + + virtual TriState get_toggle(const weld::TreeIter& rIter, int col = -1) const override; + + virtual void enable_toggle_buttons(weld::ColumnToggleType eType) override; + + virtual void set_toggle(int pos, TriState eState, int col = -1) override; + + virtual void set_toggle(const weld::TreeIter& rIter, TriState eState, int col = -1) override; + + virtual void set_clicks_to_toggle(int nToggleBehavior) override; + + virtual void set_extra_row_indent(const weld::TreeIter& rIter, int nIndentLevel) override; + + void set_text_emphasis(SvTreeListEntry* pEntry, bool bOn, int col = -1); + + virtual void set_text_emphasis(const weld::TreeIter& rIter, bool bOn, int col) override; + + virtual void set_text_emphasis(int pos, bool bOn, int col) override; + + virtual bool get_text_emphasis(const weld::TreeIter& rIter, int col) const override; + + virtual bool get_text_emphasis(int pos, int col) const override; + + void set_text_align(SvTreeListEntry* pEntry, double fAlign, int col); + + virtual void set_text_align(const weld::TreeIter& rIter, double fAlign, int col) override; + + virtual void set_text_align(int pos, double fAlign, int col) override; + + virtual void connect_editing(const Link<const weld::TreeIter&, bool>& rStartLink, + const Link<const iter_string&, bool>& rEndLink) override; + + virtual void start_editing(const weld::TreeIter& rIter) override; + + virtual void end_editing() override; + + void set_image(SvTreeListEntry* pEntry, const Image& rImage, int col); + + virtual void set_image(int pos, const OUString& rImage, int col = -1) override; + + virtual void set_image(int pos, const css::uno::Reference<css::graphic::XGraphic>& rImage, + int col = -1) override; + + virtual void set_image(int pos, VirtualDevice& rImage, int col = -1) override; + + virtual void set_image(const weld::TreeIter& rIter, const OUString& rImage, + int col = -1) override; + + virtual void set_image(const weld::TreeIter& rIter, + const css::uno::Reference<css::graphic::XGraphic>& rImage, + int col = -1) override; + + virtual void set_image(const weld::TreeIter& rIter, VirtualDevice& rImage, + int col = -1) override; + + const OUString* getEntryData(int index) const; + + virtual OUString get_id(int pos) const override; + + void set_id(SvTreeListEntry* pEntry, const OUString& rId); + + virtual void set_id(int pos, const OUString& rId) override; + + virtual int get_selected_index() const override; + + virtual OUString get_selected_text() const override; + + virtual OUString get_selected_id() const override; + + virtual std::unique_ptr<weld::TreeIter> make_iterator(const weld::TreeIter* pOrig + = nullptr) const override; + + virtual void copy_iterator(const weld::TreeIter& rSource, weld::TreeIter& rDest) const override; + + virtual bool get_selected(weld::TreeIter* pIter) const override; + + virtual bool get_cursor(weld::TreeIter* pIter) const override; + + virtual void set_cursor(const weld::TreeIter& rIter) override; + + virtual bool get_iter_first(weld::TreeIter& rIter) const override; + + bool get_iter_abs_pos(weld::TreeIter& rIter, int nPos) const; + + virtual bool iter_next_sibling(weld::TreeIter& rIter) const override; + + virtual bool iter_previous_sibling(weld::TreeIter& rIter) const override; + + virtual bool iter_next(weld::TreeIter& rIter) const override; + + virtual bool iter_previous(weld::TreeIter& rIter) const override; + + virtual bool iter_children(weld::TreeIter& rIter) const override; + + virtual bool iter_parent(weld::TreeIter& rIter) const override; + + virtual void remove(const weld::TreeIter& rIter) override; + + virtual void select(const weld::TreeIter& rIter) override; + + virtual void scroll_to_row(const weld::TreeIter& rIter) override; + + virtual void unselect(const weld::TreeIter& rIter) override; + + virtual int get_iter_depth(const weld::TreeIter& rIter) const override; + + virtual bool iter_has_child(const weld::TreeIter& rIter) const override; + + virtual bool get_row_expanded(const weld::TreeIter& rIter) const override; + + virtual bool get_children_on_demand(const weld::TreeIter& rIter) const override; + + virtual void set_children_on_demand(const weld::TreeIter& rIter, + bool bChildrenOnDemand) override; + + virtual void expand_row(const weld::TreeIter& rIter) override; + + virtual void collapse_row(const weld::TreeIter& rIter) override; + + virtual OUString get_text(const weld::TreeIter& rIter, int col = -1) const override; + + virtual void set_text(const weld::TreeIter& rIter, const OUString& rText, + int col = -1) override; + + virtual OUString get_id(const weld::TreeIter& rIter) const override; + + virtual void set_id(const weld::TreeIter& rIter, const OUString& rId) override; + + virtual void enable_drag_source(rtl::Reference<TransferDataContainer>& rHelper, + sal_uInt8 eDNDConstants) override; + + virtual void set_selection_mode(SelectionMode eMode) override; + + virtual void all_foreach(const std::function<bool(weld::TreeIter&)>& func) override; + + virtual void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) override; + + virtual void visible_foreach(const std::function<bool(weld::TreeIter&)>& func) override; + + virtual void connect_visible_range_changed(const Link<weld::TreeView&, void>& rLink) override; + + virtual void remove_selection() override; + + virtual bool is_selected(const weld::TreeIter& rIter) const override; + + virtual int get_iter_index_in_parent(const weld::TreeIter& rIter) const override; + + virtual int iter_compare(const weld::TreeIter& a, const weld::TreeIter& b) const override; + + virtual void move_subtree(weld::TreeIter& rNode, const weld::TreeIter* pNewParent, + int nIndexInNewParent) override; + + virtual int count_selected_rows() const override; + + virtual int get_height_rows(int nRows) const override; + + virtual void make_sorted() override; + + virtual void set_sort_func( + const std::function<int(const weld::TreeIter&, const weld::TreeIter&)>& func) override; + + virtual void make_unsorted() override; + + virtual void set_sort_order(bool bAscending) override; + + virtual bool get_sort_order() const override; + + virtual void set_sort_indicator(TriState eState, int col) override; + + virtual TriState get_sort_indicator(int col) const override; + + virtual int get_sort_column() const override; + + virtual void set_sort_column(int nColumn) override; + + SvTabListBox& getTreeView(); + + virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult, bool bDnDMode, + bool bAutoScroll = true) override; + + virtual void unset_drag_dest_row() override; + + virtual tools::Rectangle get_row_area(const weld::TreeIter& rIter) const override; + + virtual TreeView* get_drag_source() const override; + + virtual int vadjustment_get_value() const override; + + virtual void vadjustment_set_value(int nValue) override; + + virtual void set_show_expanders(bool bShow) override; + + virtual bool changed_by_hover() const override; + + virtual ~SalInstanceTreeView() override; +}; + +class SalInstanceExpander : public SalInstanceWidget, public virtual weld::Expander +{ +private: + VclPtr<VclExpander> m_xExpander; + + DECL_LINK(ExpandedHdl, VclExpander&, void); + +public: + SalInstanceExpander(VclExpander* pExpander, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void set_label(const OUString& rText) override; + + virtual OUString get_label() const override; + + virtual bool get_expanded() const override; + + virtual void set_expanded(bool bExpand) override; + + virtual bool has_focus() const override; + + virtual void grab_focus() override; + + virtual ~SalInstanceExpander() override; +}; + +class SalInstanceIconView : public SalInstanceWidget, public virtual weld::IconView +{ +private: + // owner for UserData + std::vector<std::unique_ptr<OUString>> m_aUserData; + VclPtr<::IconView> m_xIconView; + + DECL_LINK(SelectHdl, SvTreeListBox*, void); + DECL_LINK(DeSelectHdl, SvTreeListBox*, void); + DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool); + DECL_LINK(CommandHdl, const CommandEvent&, bool); + DECL_LINK(TooltipHdl, SvTreeListEntry*, OUString); + DECL_LINK(EntryAccessibleDescriptionHdl, SvTreeListEntry*, OUString); + DECL_LINK(DumpElemToPropertyTreeHdl, const ::IconView::json_prop_query&, bool); + +public: + SalInstanceIconView(::IconView* pIconView, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual int get_item_width() const override; + virtual void set_item_width(int width) override; + + virtual void freeze() override; + + virtual void thaw() override; + + virtual void insert(int pos, const OUString* pStr, const OUString* pId, + const OUString* pIconName, weld::TreeIter* pRet) override; + + virtual void insert(int pos, const OUString* pStr, const OUString* pId, + const VirtualDevice* pIcon, weld::TreeIter* pRet) override; + + virtual void insert_separator(int pos, const OUString* pId) override; + + virtual void connect_query_tooltip(const Link<const weld::TreeIter&, OUString>& rLink) override; + + virtual void + connect_get_property_tree_elem(const Link<const weld::json_prop_query&, bool>& rLink) override; + + virtual OUString get_selected_id() const override; + + virtual OUString get_selected_text() const override; + + virtual int count_selected_items() const override; + + virtual void select(int pos) override; + + virtual void unselect(int pos) override; + + virtual int n_children() const override; + + virtual std::unique_ptr<weld::TreeIter> make_iterator(const weld::TreeIter* pOrig + = nullptr) const override; + + virtual bool get_selected(weld::TreeIter* pIter) const override; + + virtual bool get_cursor(weld::TreeIter* pIter) const override; + + virtual void set_cursor(const weld::TreeIter& rIter) override; + + virtual bool get_iter_first(weld::TreeIter& rIter) const override; + + virtual void scroll_to_item(const weld::TreeIter& rIter) override; + + virtual void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) override; + + virtual OUString get_id(const weld::TreeIter& rIter) const override; + + virtual OUString get_text(const weld::TreeIter& rIter) const override; + + virtual void clear() override; + + virtual ~SalInstanceIconView() override; +}; + +class SalInstanceRadioButton : public SalInstanceButton, public virtual weld::RadioButton +{ +private: + VclPtr<::RadioButton> m_xRadioButton; + + DECL_LINK(ToggleHdl, ::RadioButton&, void); + +public: + SalInstanceRadioButton(::RadioButton* pButton, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual void set_active(bool active) override; + + virtual bool get_active() const 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_inconsistent(bool /*inconsistent*/) override; + + virtual bool get_inconsistent() const override; + + virtual void set_label(const OUString& rText) override { SalInstanceButton::set_label(rText); } + + virtual OUString get_label() const override { return SalInstanceButton::get_label(); } + + virtual void set_label_wrap(bool wrap) override; + + virtual ~SalInstanceRadioButton() override; +}; + +class SalInstanceFrame : public SalInstanceContainer, public virtual weld::Frame +{ +private: + VclPtr<VclFrame> m_xFrame; + +public: + SalInstanceFrame(VclFrame* pFrame, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void set_label(const OUString& rText) override; + + virtual OUString get_label() const override; + + virtual std::unique_ptr<weld::Label> weld_label_widget() const override; +}; + +class SalInstanceMenuButton : public SalInstanceButton, public virtual weld::MenuButton +{ +protected: + VclPtr<::MenuButton> m_xMenuButton; + sal_uInt16 m_nLastId; + + DECL_LINK(MenuSelectHdl, ::MenuButton*, void); + DECL_LINK(ActivateHdl, ::MenuButton*, void); + +public: + SalInstanceMenuButton(::MenuButton* 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 void insert_item(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 set_item_sensitive(const OUString& rIdent, bool bSensitive) override; + + virtual void remove_item(const OUString& rId) override; + + virtual void clear() override; + + virtual void set_item_active(const OUString& rIdent, bool bActive) override; + + virtual void set_item_label(const OUString& rIdent, const OUString& rText) override; + + virtual OUString get_item_label(const OUString& rIdent) const override; + + virtual void set_item_visible(const OUString& rIdent, bool bShow) override; + + virtual void set_popover(weld::Widget* pPopover) override; + + virtual ~SalInstanceMenuButton() override; +}; + +class SalInstancePopover : public SalInstanceContainer, public virtual weld::Popover +{ +private: + VclPtr<DockingWindow> m_xPopover; + + DECL_LINK(PopupModeEndHdl, FloatingWindow*, void); + + void ImplPopDown(); + +public: + SalInstancePopover(DockingWindow* pPopover, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + ~SalInstancePopover(); + + virtual void popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect, + weld::Placement ePlace = weld::Placement::Under) override; + + virtual void popdown() override; + + virtual void resize_to_request() override; +}; + +class SalInstanceBox : public SalInstanceContainer, public virtual weld::Box +{ +private: + VclPtr<VclBox> m_xBox; + +public: + SalInstanceBox(VclBox* pContainer, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + virtual void reorder_child(weld::Widget* pWidget, int nNewPosition) override; + virtual void sort_native_button_order() override; +}; + +class SalInstanceImage : public SalInstanceWidget, public virtual weld::Image +{ +private: + VclPtr<FixedImage> m_xImage; + +public: + SalInstanceImage(FixedImage* pImage, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void set_from_icon_name(const OUString& rIconName) override; + + virtual void set_image(VirtualDevice* pDevice) override; + + virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) override; +}; + +class SalInstanceScrolledWindow : public SalInstanceContainer, public virtual weld::ScrolledWindow +{ +private: + VclPtr<VclScrolledWindow> m_xScrolledWindow; + Link<ScrollBar*, void> m_aOrigVScrollHdl; + Link<ScrollBar*, void> m_aOrigHScrollHdl; + bool m_bUserManagedScrolling; + + DECL_LINK(VscrollHdl, ScrollBar*, void); + DECL_LINK(HscrollHdl, ScrollBar*, void); + + static void customize_scrollbars(ScrollBar& rScrollBar, const Color& rButtonTextColor, + const Color& rBackgroundColor, const Color& rShadowColor, + const Color& rFaceColor); + +public: + SalInstanceScrolledWindow(VclScrolledWindow* pScrolledWindow, SalInstanceBuilder* pBuilder, + bool bTakeOwnership, bool bUserManagedScrolling); + + virtual void hadjustment_configure(int value, int lower, int upper, int step_increment, + int page_increment, int page_size) override; + virtual int hadjustment_get_value() const override; + virtual void hadjustment_set_value(int value) override; + virtual int hadjustment_get_upper() const override; + virtual void hadjustment_set_upper(int upper) override; + virtual int hadjustment_get_page_size() const override; + virtual void hadjustment_set_page_size(int size) override; + virtual void hadjustment_set_page_increment(int size) override; + virtual void hadjustment_set_step_increment(int size) override; + virtual void set_hpolicy(VclPolicyType eHPolicy) override; + virtual VclPolicyType get_hpolicy() const override; + + virtual void vadjustment_configure(int value, int lower, int upper, int step_increment, + int page_increment, int page_size) override; + virtual int vadjustment_get_value() const override; + virtual void vadjustment_set_value(int value) override; + virtual int vadjustment_get_upper() const override; + virtual void vadjustment_set_upper(int upper) override; + virtual int vadjustment_get_lower() const override; + virtual void vadjustment_set_lower(int lower) override; + virtual int vadjustment_get_page_size() const override; + virtual void vadjustment_set_page_size(int size) override; + virtual void vadjustment_set_page_increment(int size) override; + virtual void vadjustment_set_step_increment(int size) override; + + virtual void set_vpolicy(VclPolicyType eVPolicy) override; + virtual VclPolicyType get_vpolicy() const override; + virtual int get_scroll_thickness() const override; + virtual void set_scroll_thickness(int nThickness) override; + virtual void customize_scrollbars(const Color& rBackgroundColor, const Color& rShadowColor, + const Color& rFaceColor) override; + virtual ~SalInstanceScrolledWindow() override; +}; + +class SalInstanceCalendar : public SalInstanceWidget, public virtual weld::Calendar +{ +private: + VclPtr<::Calendar> m_xCalendar; + + DECL_LINK(SelectHdl, ::Calendar*, void); + DECL_LINK(ActivateHdl, ::Calendar*, void); + +public: + SalInstanceCalendar(::Calendar* pCalendar, SalInstanceBuilder* pBuilder, bool bTakeOwnership) + : SalInstanceWidget(pCalendar, pBuilder, bTakeOwnership) + , m_xCalendar(pCalendar) + { + m_xCalendar->SetSelectHdl(LINK(this, SalInstanceCalendar, SelectHdl)); + m_xCalendar->SetActivateHdl(LINK(this, SalInstanceCalendar, ActivateHdl)); + } + + virtual void set_date(const Date& rDate) override { m_xCalendar->SetCurDate(rDate); } + + virtual Date get_date() const override { return m_xCalendar->GetFirstSelectedDate(); } + + virtual ~SalInstanceCalendar() override + { + m_xCalendar->SetSelectHdl(Link<::Calendar*, void>()); + m_xCalendar->SetActivateHdl(Link<::Calendar*, void>()); + } +}; + +class SalInstanceFormattedSpinButton : public SalInstanceEntry, + public virtual weld::FormattedSpinButton +{ +private: + VclPtr<FormattedField> m_xButton; + weld::EntryFormatter* m_pFormatter; + Link<weld::Widget&, void> m_aLoseFocusHdl; + + DECL_LINK(UpDownHdl, SpinField&, void); + DECL_LINK(LoseFocusHdl, Control&, void); + +public: + SalInstanceFormattedSpinButton(FormattedField* pButton, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual void set_text(const OUString& rText) override; + + virtual void connect_changed(const Link<weld::Entry&, void>& rLink) override; + + virtual void connect_focus_out(const Link<weld::Widget&, void>& rLink) override; + + virtual void SetFormatter(weld::EntryFormatter* pFormatter) override; + + virtual void sync_value_from_formatter() override + { + // no-op for gen + } + + virtual void sync_range_from_formatter() override + { + // no-op for gen + } + + virtual void sync_increments_from_formatter() override + { + // no-op for gen + } + + virtual Formatter& GetFormatter() override; + + virtual ~SalInstanceFormattedSpinButton() override; +}; + +class SalInstanceVerticalNotebook : public SalInstanceWidget, public virtual weld::Notebook +{ +private: + VclPtr<VerticalTabControl> m_xNotebook; + mutable std::vector<std::unique_ptr<SalInstanceContainer>> m_aPages; + + DECL_LINK(DeactivatePageHdl, VerticalTabControl*, bool); + DECL_LINK(ActivatePageHdl, VerticalTabControl*, void); + +public: + SalInstanceVerticalNotebook(VerticalTabControl* pNotebook, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual int get_current_page() const override; + + virtual OUString get_page_ident(int nPage) const override; + + virtual OUString get_current_page_ident() const override; + + virtual int get_page_index(const OUString& rIdent) const override; + + virtual weld::Container* get_page(const OUString& rIdent) const override; + + virtual void set_current_page(int nPage) override; + + virtual void set_current_page(const OUString& rIdent) override; + + virtual void remove_page(const OUString& rIdent) override; + + virtual void insert_page(const OUString& rIdent, const OUString& rLabel, int nPos) override; + + virtual int get_n_pages() const override; + + virtual void set_tab_label_text(const OUString& rIdent, const OUString& rText) override; + + virtual OUString get_tab_label_text(const OUString& rIdent) const override; + + virtual void set_show_tabs(bool /*bShow*/) override; + + virtual ~SalInstanceVerticalNotebook() 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 0000000000..d197f17fe4 --- /dev/null +++ b/vcl/inc/salwtype.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_SALWTYPE_HXX +#define INCLUDED_VCL_INC_SALWTYPE_HXX + +#include <rtl/ref.hxx> +#include <rtl/ustring.hxx> +#include <tools/gen.hxx> +#include <tools/solar.h> +#include <tools/long.hxx> +#include <vcl/GestureEventPan.hxx> +#include <vcl/GestureEventZoom.hxx> +#include <vcl/GestureEventRotate.hxx> + +class LogicalFontInstance; +class SalGraphics; +class SalFrame; +class SalObject; +namespace vcl +{ + class Window; + enum class WindowState; +} +enum class InputContextFlags; +enum class WindowStateMask; +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, + DeleteSurroundingTextRequest, + SurroundingTextSelectionChange, + StartReconversion, + QueryCharPosition, + GestureSwipe, + GestureLongPress, + ExternalGesture, + GesturePan, + GestureZoom, + GestureRotate, +}; + +struct SalAbstractMouseEvent +{ + sal_uInt64 mnTime; // Time in ms, when event is created + tools::Long mnX; // X-Position (Pixel, TopLeft-Output) + tools::Long mnY; // Y-Position (Pixel, TopLeft-Output) + sal_uInt16 mnCode; // SV-Modifiercode (KEY_SHIFT|KEY_MOD1|KEY_MOD2|MOUSE_LEFT|MOUSE_MIDDLE|MOUSE_RIGHT) + +protected: + SalAbstractMouseEvent() : mnTime(0), mnX(0), mnY(0), mnCode(0) {} +}; + +// 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 final : public SalAbstractMouseEvent +{ + sal_uInt16 mnButton; // 0-MouseMove/MouseLeave, MOUSE_LEFT, MOUSE_RIGHT, MOUSE_MIDDLE + + SalMouseEvent() : mnButton(0) {} +}; + +// 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 +{ + tools::Long mnBoundX; // BoundRect - X + tools::Long mnBoundY; // BoundRect - Y + tools::Long mnBoundWidth; // BoundRect - Width + tools::Long mnBoundHeight; // BoundRect - Height + bool mbImmediateUpdate; // set to true to force an immediate update + + SalPaintEvent( tools::Long x, tools::Long y, tools::Long w, tools::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 final : public SalAbstractMouseEvent +{ + tools::Long mnDelta; // Number of rotations + tools::Long mnNotchDelta; // Number of fixed rotations + double mnScrollLines; // Actual number of lines to scroll + bool mbHorz; // Horizontal + bool mbDeltaIsPixel; // delta value is a pixel value (on touch devices) + + SalWheelMouseEvent() + : mnDelta(0), mnNotchDelta(0), mnScrollLines(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 +{ + tools::Long mnX; // Cursor-X-Position to upper left corner of frame + tools::Long mnY; // Cursor-Y-Position to upper left corner of frame + tools::Long mnWidth; // Cursor-Width in Pixel + tools::Long mnHeight; // Cursor-Height in Pixel + tools::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 +{ + sal_uLong mnCharPos; // The index of character in a composition. + AbsoluteScreenPixelRectangle maCursorBound; // The cursor bounds corresponding to the character specified by mnCharPos - X + bool mbValid; // The data is valid or not. + bool mbVertical; // The text is vertical or not. +}; + +typedef bool (*SALFRAMEPROC)( vcl::Window* pInst, SalEvent nEvent, const void* pEvent ); + +enum class SalObjEvent { + GetFocus = 1, + LoseFocus = 2, + ToTop = 3 +}; + +struct SalInputContext +{ + rtl::Reference<LogicalFontInstance> mpFont; + InputContextFlags mnOptions; +}; + +struct SalGestureSwipeEvent +{ + double mnVelocityX; + double mnVelocityY; + tools::Long mnX; + tools::Long mnY; +}; + +struct SalGestureLongPressEvent +{ + tools::Long mnX; + tools::Long mnY; +}; + +struct SalGestureEvent +{ + GestureEventPanType meEventType; + PanningOrientation meOrientation; + double mfOffset; + tools::Long mnX; + tools::Long mnY; +}; + +struct SalGestureZoomEvent +{ + GestureEventZoomType meEventType = GestureEventZoomType::Begin; + tools::Long mnX = 0; + tools::Long mnY = 0; + double mfScaleDelta = 0; +}; + +struct SalGestureRotateEvent +{ + GestureEventRotateType meEventType = GestureEventRotateType::Begin; + tools::Long mnX = 0; + tools::Long mnY = 0; + double mfAngleDelta = 0; +}; + +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 0000000000..87a7827b7a --- /dev/null +++ b/vcl/inc/scanlinewriter.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_SCANLINEWRITER_HXX +#define INCLUDED_VCL_INC_SCANLINEWRITER_HXX + +#include <tools/long.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; + tools::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 + tools::Long nScanlineIndex = mnX / mnColorsPerByte; + + // calculate the number of shifts to get the color information to the right place + tools::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 0000000000..e7968c8f50 --- /dev/null +++ b/vcl/inc/schedulerimpl.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_SCHEDULERIMPL_HXX +#define INCLUDED_VCL_INC_SCHEDULERIMPL_HXX + +#include <vcl/scheduler.hxx> +#include <vcl/task.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 + sal_uInt64 mnUpdateTime; ///< Last Update Time + TaskPriority mePriority; ///< Task priority + /** + * Is the Task currently processed / on the stack? + * + * Since the introduction of the scheduler stack, this became merely a + * debugging and assertion hint. No decisions are anymore made based on + * this, because invoked Tasks are removed from the scheduler lists and + * placed on the stack, so no code should actually ever find one, where + * mbInScheduler is true (I don't see a reason to walk the stack for + * normal Scheduler usage, that is). + * + * This was originally used to prevent invoking Tasks recursively. + **/ + bool mbInScheduler; ///< Task currently processed? + + const char *GetDebugName() const; +}; + +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 0000000000..d2dee3e155 --- /dev/null +++ b/vcl/inc/scrptrun.h @@ -0,0 +1,153 @@ +/* + ******************************************************************************* + * + * 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 <vcl/dllapi.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 VCL_DLLPUBLIC 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) +{ + parenStack.reserve(128); + 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.clear(); +} + +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 0000000000..f92ebe556c --- /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/toolkit/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; + tools::Long mnActDeltaX; + tools::Long mnActDeltaY; + void ImplCreateImageList(); + void ImplSetRegion(const Bitmap& rRegionBmp); + using Window::ImplGetMousePointer; + PointerStyle ImplGetMousePointer( tools::Long nDistX, tools::Long nDistY ) const; + 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 0000000000..96553ba7d8 --- /dev/null +++ b/vcl/inc/sft.hxx @@ -0,0 +1,725 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <rtl/ustring.hxx> +#include <vcl/dllapi.h> +#include <vcl/fontcapabilities.hxx> +#include <vcl/fontcharmap.hxx> +#include <i18nlangtag/lang.h> + +#include "fontsubset.hxx" +#include "glyphid.hxx" + +#include <array> +#include <memory> +#include <vector> + +class SvStream; + +namespace vcl +{ + +/*@{*/ + typedef sal_Int32 F16Dot16; /**< fixed: 16.16 */ +/*@}*/ + +/** Return value of OpenTTFont() */ + 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 */ + std::unique_ptr<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() */ + struct NameRecord { + sal_uInt16 platformID; /**< Platform ID */ + sal_uInt16 encodingID; /**< Platform-specific encoding ID */ + LanguageType languageID; /**< Language ID */ + sal_uInt16 nameID; /**< Name ID */ + std::vector<sal_uInt8> sptr; /**< string data (not zero-terminated!) */ + }; + +/** Return value of GetTTGlobalFontInfo() */ + + typedef struct TTGlobalFontInfo_ { + OString family; /**< family name */ + OUString ufamily; /**< family name UCS2 */ + OString subfamily; /**< subfamily name */ + OUString usubfamily; /**< subfamily name UCS2 */ + OString psname; /**< PostScript name */ + sal_uInt16 macStyle = 0; /**< macstyle bits from 'HEAD' table */ + int weight = 0; /**< value of WeightClass or 0 if can't be determined */ + int width = 0; /**< value of WidthClass or 0 if can't be determined */ + int pitch = 0; /**< 0: proportional font, otherwise: monospaced */ + int italicAngle = 0; /**< in counter-clockwise degrees * 65536 */ + int xMin = 0; /**< global bounding box: xMin */ + int yMin = 0; /**< global bounding box: yMin */ + int xMax = 0; /**< global bounding box: xMax */ + int yMax = 0; /**< global bounding box: yMax */ + int ascender = 0; /**< typographic ascent. */ + int descender = 0; /**< typographic descent. */ + int linegap = 0; /**< typographic line gap.\ Negative values are treated as + zero in Win 3.1, System 6 and System 7. */ + int typoAscender = 0; /**< OS/2 portable typographic ascender */ + int typoDescender = 0; /**< OS/2 portable typographic descender */ + int typoLineGap = 0; /**< OS/2 portable typographic line gap */ + int winAscent = 0; /**< ascender metric for Windows */ + int winDescent = 0; /**< descender metric for Windows */ + bool microsoftSymbolEncoded = false; /**< true: MS symbol encoded */ + sal_uInt8 panose[10] = {}; /**< PANOSE classification number */ + sal_uInt32 typeFlags = 0; /**< type flags (copyright bits) */ + sal_uInt16 fsSelection = 0; /**< 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; + + +/* + 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_CFF = 0x43464620; + +class AbstractTrueTypeFont; +class TrueTypeFont; + +/** + * @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 - returns the opened TrueTypeFont + * @param xCharMap - optional parsed character map + * @return value of SFErrCodes enum + * @ingroup sft + */ + SFErrCodes VCL_DLLPUBLIC OpenTTFontBuffer(const void* pBuffer, sal_uInt32 nLen, sal_uInt32 facenum, + TrueTypeFont** ttf, const FontCharMapRef xCharMap = nullptr); +#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 - returns the opened TrueTypeFont + * @param xCharMap - optional parsed character map + * @return value of SFErrCodes enum + * @ingroup sft + */ + SFErrCodes VCL_DLLPUBLIC OpenTTFontFile(const char *fname, sal_uInt32 facenum, TrueTypeFont** ttf, + const FontCharMapRef xCharMap = nullptr); +#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(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID, std::vector<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 + * + */ + std::unique_ptr<GlyphData> GetTTRawGlyphData(AbstractTrueTypeFont *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(AbstractTrueTypeFont *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 reference to the vector of NameRecord structs + * + * @ingroup sft + */ + + void GetTTNameRecords(AbstractTrueTypeFont const *ttf, std::vector<NameRecord>& nr); + +/** + * 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(AbstractTrueTypeFont *ttf, + std::vector<sal_uInt8>& rOutBuffer, + sal_uInt16 const *glyphArray, + sal_uInt8 const *encoding, + int nGlyphs); + + VCL_DLLPUBLIC bool CreateTTFfontSubset(AbstractTrueTypeFont& aTTF, + std::vector<sal_uInt8>& rOutBuffer, + const sal_GlyphId* pGlyphIds, + const sal_uInt8* pEncoding, + int nGlyphCount, FontSubsetInfo& rInfo); + +/** + * 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(AbstractTrueTypeFont *ttf, TTGlobalFontInfo *info); + +/** + * Returns part of the head table info, normally collected by GetTTGlobalFontInfo. + * + * Just implemented separate, because this info not available via Qt API. + * + * @param ttf pointer to a AbstractTrueTypeFont structure + * @param xMin global glyph bounding box min X + * @param yMin global glyph bounding box min Y + * @param xMax global glyph bounding box max X + * @param yMax global glyph bounding box max Y + * @param macStyle encoded Mac style flags of the font + * @return true, if table data could be decoded + * @ingroup sft + */ + VCL_DLLPUBLIC bool GetTTGlobalFontHeadInfo(const AbstractTrueTypeFont *ttf, int& xMin, int& yMin, int& xMax, int& yMax, sal_uInt16& macStyle); + +/*- 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_CFF = 15; /* 'CFF' */ +constexpr int NUM_TAGS = 16; + +class VCL_DLLPUBLIC AbstractTrueTypeFont +{ + std::string m_sFileName; + sal_uInt32 m_nGlyphs; + sal_uInt32 m_nHorzMetrics; + sal_uInt32 m_nVertMetrics; /* if not 0 => font has vertical metrics information */ + sal_uInt32 m_nUnitsPerEm; + std::vector<sal_uInt32> m_aGlyphOffsets; + FontCharMapRef m_xCharMap; + bool m_bMicrosoftSymbolEncoded; + +protected: + SFErrCodes indexGlyphData(); + +public: + AbstractTrueTypeFont(const char* fileName = nullptr, const FontCharMapRef xCharMap = nullptr); + virtual ~AbstractTrueTypeFont(); + + SFErrCodes initialize(); + + std::string const & fileName() const { return m_sFileName; } + sal_uInt32 glyphCount() const { return m_nGlyphs; } + sal_uInt32 glyphOffset(sal_uInt32 glyphID) const; + sal_uInt32 horzMetricCount() const { return m_nHorzMetrics; } + sal_uInt32 vertMetricCount() const { return m_nVertMetrics; } + sal_uInt32 unitsPerEm() const { return m_nUnitsPerEm; } + bool IsMicrosoftSymbolEncoded() const { return m_bMicrosoftSymbolEncoded; } + + virtual bool hasTable(sal_uInt32 ord) const = 0; + virtual const sal_uInt8* table(sal_uInt32 ord, sal_uInt32& size) const = 0; + + OString psname; + OString family; + OUString ufamily; + OString subfamily; + OUString usubfamily; +}; + +class TrueTypeFont final : public AbstractTrueTypeFont +{ + struct TTFontTable_ + { + const sal_uInt8* pData = nullptr; /* pointer to a raw subtable in the SFNT file */ + sal_uInt32 nSize = 0; /* table size */ + }; + + std::array<struct TTFontTable_, NUM_TAGS> m_aTableList; + +public: + sal_Int32 fsize; + sal_uInt8 *ptr; + sal_uInt32 ntables; + + TrueTypeFont(const char* pFileName = nullptr, const FontCharMapRef xCharMap = nullptr); + ~TrueTypeFont() override; + + SFErrCodes open(sal_uInt32 facenum); + + bool hasTable(sal_uInt32 ord) const override { return m_aTableList[ord].pData != nullptr; } + inline const sal_uInt8* table(sal_uInt32 ord, sal_uInt32& size) const override; +}; + +const sal_uInt8* TrueTypeFont::table(sal_uInt32 ord, sal_uInt32& size) const +{ + if (ord >= NUM_TAGS) + { + size = 0; + return nullptr; + } + + auto& rTable = m_aTableList[ord]; + size = rTable.nSize; + return rTable.pData; +} + +} // 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 0000000000..b879872a8b --- /dev/null +++ b/vcl/inc/skia/gdiimpl.hxx @@ -0,0 +1,441 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <skia/utils.hxx> + +#include <SkPaint.h> +#include <SkBlendMode.h> +#include <optional> + +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 void setClipRegion(const vcl::Region&) override; + + // + // get the depth of the device + virtual sal_uInt16 GetBitCount() const override; + + // get the width of the device + virtual tools::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(tools::Long nX, tools::Long nY) override; + virtual void drawPixel(tools::Long nX, tools::Long nY, Color nColor) override; + + virtual void drawLine(tools::Long nX1, tools::Long nY1, tools::Long nX2, + tools::Long nY2) override; + + virtual void drawRect(tools::Long nX, tools::Long nY, tools::Long nWidth, + tools::Long nHeight) override; + + virtual void drawPolyLine(sal_uInt32 nPoints, const Point* pPtAry) override; + + virtual void drawPolygon(sal_uInt32 nPoints, const Point* pPtAry) override; + + virtual void drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints, + const Point** pPtAry) override; + + virtual void 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 Point* pPtAry, + const PolyFlags* pFlgAry) override; + + virtual bool drawPolygonBezier(sal_uInt32 nPoints, const Point* pPtAry, + const PolyFlags* pFlgAry) override; + + virtual bool drawPolyPolygonBezier(sal_uInt32 nPoly, const sal_uInt32* pPoints, + const Point* const* pPtAry, + const PolyFlags* const* pFlgAry) override; + + // CopyArea --> No RasterOp, but ClipRegion + virtual void copyArea(tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX, + tools::Long nSrcY, tools::Long nSrcWidth, tools::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(tools::Long nX, tools::Long nY, tools::Long nWidth, + tools::Long nHeight) override; + + virtual Color getPixel(tools::Long nX, tools::Long nY) override; + + // invert --> ClipRegion (only Windows or VirDevs) + virtual void invert(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, + SalInvert nFlags) override; + + virtual void invert(sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags) override; + + virtual bool drawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::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, double fAlpha) override; + + virtual bool hasFastDrawTransformedBitmap() const 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(tools::Long nX, tools::Long nY, tools::Long nWidth, + tools::Long nHeight, sal_uInt8 nTransparency) override; + + virtual bool drawGradient(const tools::PolyPolygon& rPolygon, + const Gradient& rGradient) override; + virtual bool implDrawGradient(const basegfx::B2DPolyPolygon& rPolyPolygon, + const SalGradient& rGradient) override; + + virtual bool supportsOperation(OutDevSupportType eType) const override; + + // Dump contents to a file for debugging. + void dump(const char* file) const; + + // Default blend mode for SkPaint is SkBlendMode::kSrcOver + void drawBitmap(const SalTwoRect& rPosAry, const SkiaSalBitmap& bitmap, + SkBlendMode blendMode = SkBlendMode::kSrcOver); + + void drawImage(const SalTwoRect& rPosAry, const sk_sp<SkImage>& aImage, int srcScaling = 1, + SkBlendMode eBlendMode = SkBlendMode::kSrcOver); + + void drawShader(const SalTwoRect& rPosAry, const sk_sp<SkShader>& shader, + SkBlendMode blendMode = SkBlendMode::kSrcOver); + + void drawGenericLayout(const GenericSalLayout& layout, Color textColor, const SkFont& font, + const SkFont& verticalFont); + +protected: + // To be called before any drawing. + void preDraw(); + // To be called after any drawing. + void postDraw(); + // The canvas to draw to. + SkCanvas* getDrawCanvas() { return 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; + void createWindowSurface(bool forceRaster = false); + virtual void createWindowSurfaceInternal(bool forceRaster = false) = 0; + void createOffscreenSurface(); + virtual void flushSurfaceToWindowContext(); + + void privateDrawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, + tools::Long nHeight, double nTransparency, bool blockAA = false); + void privateCopyBits(const SalTwoRect& rPosAry, SkiaSalGraphicsImpl* src); + + void setProvider(SalGeometryProvider* provider) { mProvider = provider; } + + bool isOffscreen() const; + bool isGPU() const { return mIsGPU; } + + void invert(basegfx::B2DPolygon const& rPoly, SalInvert eFlags); + + // Called by SkiaFlushIdle. + void performFlush(); + 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; } + // Get the global HiDPI scaling factor. + virtual int getWindowScaling() const; + + void addUpdateRegion(const SkRect& rect) + { + // Make slightly larger, just in case (rounding, antialiasing,...). + SkIRect addedRect = rect.makeOutset(2, 2).round(); + // Using SkIRect should be enough, SkRegion would be too slow with many operations + // and swapping to the screen is not _that_slow. + mDirtyRect.join(addedRect); + } + void setCanvasScalingAndClipping(); + void resetCanvasScalingAndClipping(); + static void setCanvasClipRegion(SkCanvas* canvas, const vcl::Region& region); + sk_sp<SkImage> mergeCacheBitmaps(const SkiaSalBitmap& bitmap, const SkiaSalBitmap* alphaBitmap, + const Size& targetSize); + using DirectImage = SkiaHelper::DirectImage; + static OString makeCachedImageKey(const SkiaSalBitmap& bitmap, const SkiaSalBitmap* alphaBitmap, + const Size& targetSize, DirectImage bitmapType, + DirectImage alphaBitmapType); + + // 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(tools::Long x) { return x + 0.495; } + static constexpr SkScalar toSkY(tools::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); + + BmpScaleFlag goodScalingQuality() const { return SkiaHelper::goodScalingQuality(isGPU()); } + SkSamplingOptions makeSamplingOptions(const SalTwoRect& rPosAry, int scalingFactor, + int srcScalingFactor = 1) + { + return SkiaHelper::makeSamplingOptions(rPosAry, scalingFactor, srcScalingFactor, isGPU()); + } + SkSamplingOptions makeSamplingOptions(const SkMatrix& matrix, int scalingFactor) + { + return SkiaHelper::makeSamplingOptions(goodScalingQuality(), matrix, scalingFactor); + } + + // Create SkPaint to use when drawing to the surface. It is not to be used + // when doing internal drawing such as when merging two bitmaps together. + // This may apply some default settings to the paint as necessary. + SkPaint makePaintInternal() const; + // Create SkPaint set up for drawing lines (using mLineColor etc.). + SkPaint makeLinePaint(double transparency = 0) const; + // Create SkPaint set up for filling (using mFillColor etc.). + SkPaint makeFillPaint(double transparency = 0) const; + // Create SkPaint set up for bitmap drawing. + SkPaint makeBitmapPaint() const; + // Create SkPaint set up for gradient drawing. + SkPaint makeGradientPaint() const; + // Create SkPaint set up for text drawing. + SkPaint makeTextPaint(std::optional<Color> color) const; + // Create SkPaint for unspecified pixel drawing. Avoid if possible. + SkPaint makePixelPaint(std::optional<Color> color) const; + + template <typename charT, typename traits> + friend inline std::basic_ostream<charT, traits>& + operator<<(std::basic_ostream<charT, traits>& stream, const SkiaSalGraphicsImpl* graphics) + { + if (graphics == nullptr) + return stream << "(null)"; + // O - offscreen, G - GPU-based, R - raster + stream << static_cast<const void*>(graphics) << " " + << Size(graphics->GetWidth(), graphics->GetHeight()); + if (graphics->mScaling != 1) + stream << "*" << graphics->mScaling; + stream << (graphics->isGPU() ? "G" : "R") << (graphics->isOffscreen() ? "O" : ""); + return stream; + } + + void windowBackingPropertiesChanged(); + + SalGraphics& mParent; + /// Pointer to the SalFrame or SalVirtualDevice + SalGeometryProvider* mProvider; + // The Skia surface that is target of all the rendering. + sk_sp<SkSurface> mSurface; + // Note that mSurface may be a proxy surface and not the one from the window context. + std::unique_ptr<sk_app::WindowContext> mWindowContext; + bool mIsGPU; // whether the surface is GPU-backed + // Note that we generally use VCL coordinates, which is not mSurface coordinates if mScaling!=1. + SkIRect mDirtyRect; // The area that has been changed since the last performFlush(). + vcl::Region mClipRegion; + std::optional<Color> moLineColor; + std::optional<Color> moFillColor; + enum class XorMode + { + None, + Invert, + Xor + }; + XorMode mXorMode; + 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; + inline static int pendingOperationsToFlush = 0; + int mScaling; // The scale factor for HiDPI screens. + bool mInWindowBackingPropertiesChanged; +}; + +inline SkPaint SkiaSalGraphicsImpl::makePaintInternal() const +{ + SkPaint paint; + // Invert could be done using a blend mode like invert() does, but + // intentionally use SkBlender to make sure it's not overwritten + // by a blend mode set later (which would be probably a mistake), + // and so that the drawing color does not actually matter. + if (mXorMode == XorMode::Invert) + SkiaHelper::setBlenderInvert(&paint); + else if (mXorMode == XorMode::Xor) + SkiaHelper::setBlenderXor(&paint); + return paint; +} + +inline SkPaint SkiaSalGraphicsImpl::makeLinePaint(double transparency) const +{ + assert(moLineColor.has_value()); + SkPaint paint = makePaintInternal(); + paint.setColor(transparency == 0 + ? SkiaHelper::toSkColor(*moLineColor) + : SkiaHelper::toSkColorWithTransparency(*moLineColor, transparency)); + paint.setStyle(SkPaint::kStroke_Style); + return paint; +} + +inline SkPaint SkiaSalGraphicsImpl::makeFillPaint(double transparency) const +{ + assert(moFillColor.has_value()); + SkPaint paint = makePaintInternal(); + paint.setColor(transparency == 0 + ? SkiaHelper::toSkColor(*moFillColor) + : SkiaHelper::toSkColorWithTransparency(*moFillColor, transparency)); + if (moLineColor == moFillColor) + paint.setStyle(SkPaint::kStrokeAndFill_Style); + else + paint.setStyle(SkPaint::kFill_Style); + return paint; +} + +inline SkPaint SkiaSalGraphicsImpl::makeBitmapPaint() const { return makePaintInternal(); } + +inline SkPaint SkiaSalGraphicsImpl::makeGradientPaint() const { return makePaintInternal(); } + +inline SkPaint SkiaSalGraphicsImpl::makeTextPaint(std::optional<Color> color) const +{ + assert(color.has_value()); + SkPaint paint = makePaintInternal(); + paint.setColor(SkiaHelper::toSkColor(*color)); + return paint; +} + +inline SkPaint SkiaSalGraphicsImpl::makePixelPaint(std::optional<Color> color) const +{ + assert(color.has_value()); + SkPaint paint = makePaintInternal(); + paint.setColor(SkiaHelper::toSkColor(*color)); + return paint; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/skia/osx/bitmap.hxx b/vcl/inc/skia/osx/bitmap.hxx new file mode 100644 index 0000000000..0c0b1ee09b --- /dev/null +++ b/vcl/inc/skia/osx/bitmap.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_SKIA_OSX_BITMAP_HXX +#define INCLUDED_VCL_INC_SKIA_OSX_BITMAP_HXX + +#include <vcl/dllapi.h> + +#include <osx/osxvcltypes.h> + +class Image; + +namespace SkiaHelper +{ +VCL_PLUGIN_PUBLIC CGImageRef createCGImage(const Image& rImage); +}; + +#endif // INCLUDED_VCL_INC_SKIA_OSX_BITMAP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/skia/osx/gdiimpl.hxx b/vcl/inc/skia/osx/gdiimpl.hxx new file mode 100644 index 0000000000..b97245e86e --- /dev/null +++ b/vcl/inc/skia/osx/gdiimpl.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_SKIA_OSX_GDIIMPL_HXX +#define INCLUDED_VCL_INC_SKIA_OSX_GDIIMPL_HXX + +#include <vcl/dllapi.h> + +#include <quartz/salgdi.h> + +#include <skia/gdiimpl.hxx> +#include <skia/utils.hxx> + +#include <SkFontMgr.h> + +class VCL_PLUGIN_PUBLIC AquaSkiaSalGraphicsImpl final : public SkiaSalGraphicsImpl, + public AquaGraphicsBackendBase +{ +public: + AquaSkiaSalGraphicsImpl(AquaSalGraphics& rParent, AquaSharedAttributes& rShared); + virtual ~AquaSkiaSalGraphicsImpl() override; + + virtual void freeResources() override; + + virtual void UpdateGeometryProvider(SalGeometryProvider* provider) override + { + setProvider(provider); + } + static void prepareSkia(); + + virtual bool drawNativeControl(ControlType nType, ControlPart nPart, + const tools::Rectangle& rControlRegion, ControlState nState, + const ImplControlValue& aValue) override; + + virtual void drawTextLayout(const GenericSalLayout& layout) override; + + virtual void Flush() override; + virtual void Flush(const tools::Rectangle&) override; + virtual void WindowBackingPropertiesChanged() override; + +private: + virtual int getWindowScaling() const override; + virtual void createWindowSurfaceInternal(bool forceRaster = false) override; + virtual void flushSurfaceToWindowContext() override; + void flushSurfaceToScreenCG(); + static inline sk_sp<SkFontMgr> fontManager; +}; + +#endif // INCLUDED_VCL_INC_SKIA_OSX_GDIIMPL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/skia/quartz/cgutils.h b/vcl/inc/skia/quartz/cgutils.h new file mode 100644 index 0000000000..cb43a31dcd --- /dev/null +++ b/vcl/inc/skia/quartz/cgutils.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 . + */ + +#pragma once + +constexpr uint32_t SkiaToCGBitmapType(SkColorType color, SkAlphaType alpha) +{ + if (alpha == kPremul_SkAlphaType) + { + return color == kBGRA_8888_SkColorType + ? (uint32_t(kCGImageAlphaPremultipliedFirst) + | uint32_t(kCGBitmapByteOrder32Little)) + : (uint32_t(kCGImageAlphaPremultipliedLast) | uint32_t(kCGBitmapByteOrder32Big)); + } + else + { + assert(alpha == kOpaque_SkAlphaType); + return color == kBGRA_8888_SkColorType + ? (uint32_t(kCGImageAlphaNoneSkipFirst) | uint32_t(kCGBitmapByteOrder32Little)) + : (uint32_t(kCGImageAlphaNoneSkipLast) | uint32_t(kCGBitmapByteOrder32Big)); + } +} + +/* 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 0000000000..c42aa30f46 --- /dev/null +++ b/vcl/inc/skia/salbmp.hxx @@ -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_SKIA_SALBMP_H +#define INCLUDED_VCL_INC_SKIA_SALBMP_H + +#include <salbmp.hxx> +#include <vcl/bitmap.hxx> + +#include <boost/shared_ptr.hpp> + +#include <skia/utils.hxx> + +#include <SkImage.h> + +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, vcl::PixelFormat ePixelFormat, + 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, vcl::PixelFormat eNewPixelFormat) 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; + virtual bool Erase(const Color& color) override; + virtual bool AlphaBlendWith(const SalBitmap& rSalBmp) override; + virtual bool Invert() override; +#if defined MACOSX || defined IOS + virtual CGImageRef CreateWithMask(const SalBitmap& rMask, int nX, int nY, int nWidth, + int nHeight) const override; + virtual CGImageRef CreateColorMask(int nX, int nY, int nWidth, int nHeight, + Color nMaskColor) const override; + virtual CGImageRef CreateCroppedImage(int nX, int nY, int nWidth, int nHeight) const override; +#endif + + const BitmapPalette& Palette() const { return mPalette; } + + // True if GetSkShader() should be preferred to GetSkImage() (or the Alpha variants). + bool PreferSkShader() const; + + // Direct image means direct access to the stored SkImage, without checking + // if its size is up to date. This should be used only in special cases with care. + using DirectImage = SkiaHelper::DirectImage; + // Returns the contents as SkImage (possibly GPU-backed). + const sk_sp<SkImage>& GetSkImage(DirectImage direct = DirectImage::No) const; + sk_sp<SkShader> GetSkShader(const SkSamplingOptions& samplingOptions, + DirectImage direct = DirectImage::No) const; + // Returns the contents as alpha SkImage (possibly GPU-backed) + const sk_sp<SkImage>& GetAlphaSkImage(DirectImage direct = DirectImage::No) const; + sk_sp<SkShader> GetAlphaSkShader(const SkSamplingOptions& samplingOptions, + DirectImage direct = DirectImage::No) const; + + // Key for caching/hashing. + OString GetImageKey(DirectImage direct = DirectImage::No) const; + OString GetAlphaImageKey(DirectImage direct = DirectImage::No) const; + + // Returns true if it is known that this bitmap can be ignored if it's to be used + // as an alpha bitmap. An optimization, not guaranteed to return true for all such cases. + bool IsFullyOpaqueAsAlpha() const; + // Alpha type best suitable for the content. + SkAlphaType alphaType() const; + + // Tries to create direct GetAlphaSkImage() from direct GetSkImage(). + void TryDirectConvertToAlphaNoScaling(); + + // Dump contents to a file for debugging. + void dump(const char* file) const; + + // These are to be used only by unittests. + bool unittestHasBuffer() const { return mBuffer.get(); } + bool unittestHasImage() const { return mImage.get(); } + bool unittestHasAlphaImage() const { return mAlphaImage.get(); } + bool unittestHasEraseColor() const { return mEraseColorSet; } + bool unittestHasPendingScale() const { return mSize != mPixelsSize; } + const sal_uInt8* unittestGetBuffer() const { return mBuffer.get(); } + const SkImage* unittestGetImage() const { return mImage.get(); } + const SkImage* unittestGetAlphaImage() const { return mAlphaImage.get(); } + void unittestResetToImage() { ResetToSkImage(GetSkImage()); } + +private: + // This should be called whenever the contents have (possibly) changed. + // It may reset some cached data such as the checksum. + void DataChanged(); + // Reset the state to pixel data (resets cached images allocated in GetSkImage()/GetAlphaSkImage()). + void ResetToBuffer(); + // Sets the data only as SkImage (will be converted as needed). + void ResetToSkImage(sk_sp<SkImage> image); + // Resets all data (buffer and images). + void ResetAllData(); + // 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). + void CreateBitmapData(); + // Should be called whenever mPixelsSize or mBitCount is set/changed. + bool ComputeScanlineSize(); + // Resets information about pending scaling. To be called when mBuffer is resized or created. + void ResetPendingScaling(); + // Sets bitmap to be erased on demand. + void EraseInternal(const Color& color); + // Sets pixels to the erase color. + void PerformErase(); + // Try to find out if the content is completely black. Used for optimizations, + // not guaranteed to always return true for such bitmaps. + bool IsAllBlack() const; + void ReleaseBuffer(BitmapBuffer* pBuffer, BitmapAccessMode nMode, bool dontChangeToErase); + SkBitmap GetAsSkBitmap() const; + bool ConserveMemory() const; + void verify() const +#ifdef DBG_UTIL + ; +#else + { + } +#endif + + template <typename charT, typename traits> + friend std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream, + const SkiaSalBitmap* bitmap) + { + if (bitmap == nullptr) + return stream << "(null)"; + // p - has (non-trivial) palette + // I/i - has SkImage (on GPU/CPU), + // A/a - has alpha SkImage (on GPU/CPU) + // E - has erase color + // B - has pixel buffer + // (wxh) - has pending scaling (after each item) + stream << static_cast<const void*>(bitmap) << " " << bitmap->GetSize() << "x" + << bitmap->GetBitCount(); + if (bitmap->GetBitCount() <= 8 && !bitmap->Palette().IsGreyPalette8Bit()) + stream << "p"; + stream << "/"; + if (bitmap->mImage) + { + stream << (bitmap->mImage->isTextureBacked() ? "I" : "i"); + if (SkiaHelper::imageSize(bitmap->mImage) != bitmap->mSize) + stream << "(" << SkiaHelper::imageSize(bitmap->mImage) << ")"; + } + if (bitmap->mAlphaImage) + { + stream << (bitmap->mAlphaImage->isTextureBacked() ? "A" : "a"); + if (SkiaHelper::imageSize(bitmap->mAlphaImage) != bitmap->mSize) + stream << "(" << SkiaHelper::imageSize(bitmap->mAlphaImage) << ")"; + } + if (bitmap->mEraseColorSet) + stream << "E" << bitmap->mEraseColor; + if (bitmap->mBuffer) + { + stream << "B"; + if (bitmap->mSize != bitmap->mPixelsSize) + stream << "(" << bitmap->mPixelsSize << ")"; + } + return stream; + } + + 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 (based on mPixelsSize) + sk_sp<SkImage> mImage; // possibly GPU-backed + bool mImageImmutable = false; + 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; + BmpScaleFlag mScaleQuality = BmpScaleFlag::BestQuality; // quality for on-demand scaling + // Erase() is delayed, just sets these two instead of filling the buffer. + bool mEraseColorSet = false; + Color mEraseColor; + int mReadAccessCount = 0; // number of read AcquireAccess() that have not been released +#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 0000000000..3c19192e1c --- /dev/null +++ b/vcl/inc/skia/utils.hxx @@ -0,0 +1,341 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <vcl/bitmap.hxx> +#include <vcl/salgtype.hxx> + +#include <test/GraphicsRenderTests.hxx> + +#include <premac.h> +#include <SkRegion.h> +#include <SkSurface.h> +#if defined __GNUC__ && !defined __clang__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wattributes" +#pragma GCC diagnostic ignored "-Wshadow" +#endif +#include <tools/sk_app/WindowContext.h> +#if defined __GNUC__ && !defined __clang__ +#pragma GCC diagnostic pop +#endif +#include <postmac.h> + +#include <string_view> + +namespace SkiaHelper +{ +// Get the one shared GrDirectContext instance. +GrDirectContext* getSharedGrDirectContext(); + +void disableRenderMethod(RenderMethod method); + +// Create SkSurface, GPU-backed if possible. +VCL_DLLPUBLIC sk_sp<SkSurface> createSkSurface(int width, int height, + SkColorType type = kN32_SkColorType, + SkAlphaType alpha = kPremul_SkAlphaType); + +inline sk_sp<SkSurface> createSkSurface(const Size& size, SkColorType type = kN32_SkColorType, + SkAlphaType alpha = kPremul_SkAlphaType) +{ + return createSkSurface(size.Width(), size.Height(), type, alpha); +} + +inline sk_sp<SkSurface> createSkSurface(int width, int height, SkAlphaType alpha) +{ + return createSkSurface(width, height, kN32_SkColorType, alpha); +} + +inline sk_sp<SkSurface> createSkSurface(const Size& size, SkAlphaType alpha) +{ + return createSkSurface(size.Width(), size.Height(), kN32_SkColorType, alpha); +} + +// 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); + +inline Size imageSize(const sk_sp<SkImage>& image) { return Size(image->width(), image->height()); } + +inline SkColor toSkColor(Color color) +{ + return SkColorSetARGB(color.GetAlpha(), color.GetRed(), color.GetGreen(), color.GetBlue()); +} + +inline SkColor toSkColorWithTransparency(Color aColor, double fTransparency) +{ + return SkColorSetA(toSkColor(aColor), 255 * (1.0 - fTransparency)); +} + +inline SkColor toSkColorWithIntensity(Color color, int intensity) +{ + return SkColorSetARGB(color.GetAlpha(), color.GetRed() * intensity / 100, + color.GetGreen() * intensity / 100, color.GetBlue() * intensity / 100); +} + +inline Color fromSkColor(SkColor color) +{ + return Color(ColorAlpha, SkColorGetA(color), SkColorGetR(color), SkColorGetG(color), + SkColorGetB(color)); +} + +// Whether to use GetSkImage() that checks for delayed scaling or whether to access +// the stored image directly without checks. +enum DirectImage +{ + Yes, + No +}; + +// Sets SkBlender that will do an invert operation. +void setBlenderInvert(SkPaint* paint); +// Sets SkBlender that will do a xor operation. +void setBlenderXor(SkPaint* paint); + +// 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> (*createGpuWindowContext)(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); +tools::Long maxImageCacheSize(); + +// Get checksum of the image content, only for raster images. Is cached, +// but may still be somewhat expensive. +uint32_t getSkImageChecksum(sk_sp<SkImage> image); + +// SkSurfaceProps to be used by all Skia surfaces. +VCL_DLLPUBLIC const SkSurfaceProps* surfaceProps(); +// Set pixel geometry to be used by SkSurfaceProps. +VCL_DLLPUBLIC void setPixelGeometry(SkPixelGeometry pixelGeometry); + +inline bool isUnitTestRunning(const char* name = nullptr) +{ + if (name == nullptr) + { + static const char* const testname = getenv("LO_TESTNAME"); + if (testname != nullptr) + return true; + return !vcl::test::activeGraphicsRenderTest().isEmpty(); + } + const char* const testname = getenv("LO_TESTNAME"); + if (testname != nullptr && std::string_view(name) == testname) + return true; + return vcl::test::activeGraphicsRenderTest().equalsAscii(name); +} + +// Scaling done on the GPU is fast, but bicubic done in raster mode can be slow +// if done too much, and it generally shouldn't be needed for to-screen drawing. +// In that case use only BmpScaleFlag::Default, which is bilinear+mipmap, +// which should be good enough (and that's what the "super" bitmap scaling +// algorithm done by VCL does as well). +inline BmpScaleFlag goodScalingQuality(bool isGPU) +{ + return isGPU ? BmpScaleFlag::BestQuality : BmpScaleFlag::Default; +} + +// Normal scaling algorithms have a poor quality when downscaling a lot. +// https://bugs.chromium.org/p/skia/issues/detail?id=11810 suggests to use mipmaps +// in such a case, which is annoying to do explicitly instead of Skia deciding which +// algorithm would be the best, but now with Skia removing SkFilterQuality and requiring +// explicitly being told what algorithm to use this appears to be the best we can do. +// Anything scaled down at least this ratio will use linear+mipmaps. +constexpr int downscaleRatioThreshold = 4; + +inline SkSamplingOptions makeSamplingOptions(BmpScaleFlag scalingType, SkMatrix matrix, + int scalingFactor) +{ + switch (scalingType) + { + case BmpScaleFlag::BestQuality: + if (scalingFactor != 1) + matrix.postScale(scalingFactor, scalingFactor); + if (matrix.getScaleX() <= 1.0 / downscaleRatioThreshold + || matrix.getScaleY() <= 1.0 / downscaleRatioThreshold) + return SkSamplingOptions(SkFilterMode::kLinear, SkMipmapMode::kLinear); + return SkSamplingOptions(SkCubicResampler::Mitchell()); + case BmpScaleFlag::Default: + // Use SkMipmapMode::kNearest for better quality when downscaling. SkMipmapMode::kLinear + // would be even better, but it is not specially optimized in raster mode. + return SkSamplingOptions(SkFilterMode::kLinear, SkMipmapMode::kNearest); + case BmpScaleFlag::Fast: + case BmpScaleFlag::NearestNeighbor: + return SkSamplingOptions(SkFilterMode::kNearest, SkMipmapMode::kNone); + default: + assert(false); + return SkSamplingOptions(); + } +} + +inline SkSamplingOptions makeSamplingOptions(BmpScaleFlag scalingType, const Size& srcSize, + Size destSize, int scalingFactor) +{ + switch (scalingType) + { + case BmpScaleFlag::BestQuality: + if (scalingFactor != 1) + destSize *= scalingFactor; + if (srcSize.Width() / destSize.Width() >= downscaleRatioThreshold + || srcSize.Height() / destSize.Height() >= downscaleRatioThreshold) + return SkSamplingOptions(SkFilterMode::kLinear, SkMipmapMode::kLinear); + return SkSamplingOptions(SkCubicResampler::Mitchell()); + case BmpScaleFlag::Default: + // As in the first overload, use kNearest. + return SkSamplingOptions(SkFilterMode::kLinear, SkMipmapMode::kNearest); + case BmpScaleFlag::Fast: + case BmpScaleFlag::NearestNeighbor: + return SkSamplingOptions(SkFilterMode::kNearest, SkMipmapMode::kNone); + default: + assert(false); + return SkSamplingOptions(); + } +} + +inline SkSamplingOptions makeSamplingOptions(const SalTwoRect& rPosAry, int scalingFactor, + int srcScalingFactor, bool isGPU) +{ + // If there will be scaling, make it smooth, but not in unittests, as those often + // require exact color values and would be confused by this. + if (isUnitTestRunning()) + return SkSamplingOptions(); // none + Size srcSize(rPosAry.mnSrcWidth, rPosAry.mnSrcHeight); + Size destSize(rPosAry.mnDestWidth, rPosAry.mnDestHeight); + if (scalingFactor != 1) + destSize *= scalingFactor; + if (srcScalingFactor != 1) + srcSize *= srcScalingFactor; + if (srcSize != destSize) + return makeSamplingOptions(goodScalingQuality(isGPU), srcSize, destSize, 1); + return SkSamplingOptions(); // none +} + +inline SkRect scaleRect(const SkRect& rect, int scaling) +{ + return SkRect::MakeXYWH(rect.x() * scaling, rect.y() * scaling, rect.width() * scaling, + rect.height() * scaling); +} + +inline SkIRect scaleRect(const SkIRect& rect, int scaling) +{ + return SkIRect::MakeXYWH(rect.x() * scaling, rect.y() * scaling, rect.width() * scaling, + rect.height() * scaling); +} + +#ifdef DBG_UTIL +void prefillSurface(const sk_sp<SkSurface>& surface); +#endif + +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); + +VCL_DLLPUBLIC extern uint32_t vendorId; + +inline DriverBlocklist::DeviceVendor getVendor() +{ + return DriverBlocklist::GetVendorFromId(vendorId); +} + +} // namespace SkiaHelper + +// For unittests. +namespace SkiaTests +{ +VCL_DLLPUBLIC bool matrixNeedsHighQuality(const SkMatrix& matrix); +} + +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 SkMatrix& matrix) +{ + return stream << "[" << matrix[0] << " " << matrix[1] << " " << matrix[2] << "]" + << "[" << matrix[3] << " " << matrix[4] << " " << matrix[5] << "]" + << "[" << matrix[6] << " " << matrix[7] << " " << matrix[8] << "]"; +} + +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) +{ + if (image == nullptr) + return stream << "(null)"; + return stream << *image; +} + +#endif // INCLUDED_VCL_INC_SKIA_UTILS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/skia/win/font.hxx b/vcl/inc/skia/win/font.hxx new file mode 100644 index 0000000000..b63c5cba47 --- /dev/null +++ b/vcl/inc/skia/win/font.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/. + * + */ + +#pragma once + +#include <sal/config.h> + +#include <win/winlayout.hxx> + +#include <SkTypeface.h> + +// This class only adds SkTypeface in order to allow its caching. +class SkiaWinFontInstance : public WinFontInstance +{ + friend rtl::Reference<LogicalFontInstance> + WinFontFace::CreateFontInstance(const vcl::font::FontSelectPattern&) const; + +public: + sk_sp<SkTypeface> GetSkiaTypeface() const { return m_skiaTypeface; } + bool GetSkiaDWrite() const { return m_skiaDWrite; } + void SetSkiaTypeface(const sk_sp<SkTypeface>& typeface, bool dwrite) + { + m_skiaTypeface = typeface; + m_skiaDWrite = dwrite; + } + +private: + using WinFontInstance::WinFontInstance; + sk_sp<SkTypeface> m_skiaTypeface; + bool m_skiaDWrite; +}; + +/* 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 0000000000..c5b12d0881 --- /dev/null +++ b/vcl/inc/skia/win/gdiimpl.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/. + */ + +#ifndef INCLUDED_VCL_INC_SKIA_WIN_GDIIMPL_HXX +#define INCLUDED_VCL_INC_SKIA_WIN_GDIIMPL_HXX + +#include <memory> +#include <systools/win32/comtools.hxx> + +#include <vcl/dllapi.h> +#include <skia/gdiimpl.hxx> +#include <skia/utils.hxx> +#include <win/salgdi.h> +#include <win/wingdiimpl.hxx> +#include <o3tl/lru_map.hxx> +#include <ControlCacheKey.hxx> +#include <svdata.hxx> + +#include <SkFont.h> +#include <SkFontMgr.h> + +#include <dwrite_3.h> + +class SkTypeface; +class ControlCacheKey; + +class SkiaCompatibleDC : public CompatibleDC +{ +public: + SkiaCompatibleDC(SalGraphics& rGraphics, int x, int y, int width, int height); + + sk_sp<SkImage> getAsImageDiff(const SkiaCompatibleDC& white) const; +}; + +class WinSkiaSalGraphicsImpl : public SkiaSalGraphicsImpl, public WinSalGraphicsImplBase +{ +private: + WinSalGraphics& mWinParent; + +public: + WinSkiaSalGraphicsImpl(WinSalGraphics& rGraphics, SalGeometryProvider* mpProvider); + + 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; + virtual void ClearNativeControlCache() override; + + virtual void freeResources() override; + virtual void Flush() override; + + static void prepareSkia(); + +protected: + virtual void createWindowSurfaceInternal(bool forceRaster = false) override; + static sk_sp<SkTypeface> createDirectWriteTypeface(const WinFontInstance* pWinFont); + static void initFontInfo(); + inline static sal::systools::COMReference<IDWriteFontSetBuilder> dwriteFontSetBuilder; + inline static sal::systools::COMReference<IDWriteFontCollection1> dwritePrivateCollection; + inline static sk_sp<SkFontMgr> dwriteFontMgr; + inline static bool dwriteDone = false; + static SkFont::Edging fontEdging; +}; + +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 0000000000..f7198671b4 --- /dev/null +++ b/vcl/inc/skia/x11/gdiimpl.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_SKIA_X11_GDIIMPL_HXX +#define INCLUDED_VCL_INC_SKIA_X11_GDIIMPL_HXX + +#include <vcl/dllapi.h> + +#include <skia/gdiimpl.hxx> +#include <unx/salgdi.h> +#include <unx/x11/x11gdiimpl.h> + +class VCL_PLUGIN_PUBLIC X11SkiaSalGraphicsImpl final : public SkiaSalGraphicsImpl, + public X11GraphicsImpl +{ +private: + X11SalGraphics& mX11Parent; + +public: + X11SkiaSalGraphicsImpl(X11SalGraphics& rParent); + + virtual void Init() override; + virtual void freeResources() override; + virtual void Flush() override; + + static void prepareSkia(); + +private: + virtual void createWindowSurfaceInternal(bool forceRaster = false) 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 0000000000..137a58ae67 --- /dev/null +++ b/vcl/inc/skia/x11/salvd.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_SALVD_H +#define INCLUDED_VCL_INC_SKIA_X11_SALVD_H + +#include <salvd.hxx> +#include <unx/saldisp.hxx> +#include <unx/salgdi.h> + +class X11SkiaSalVirtualDevice final : public SalVirtualDevice +{ + SalDisplay* mpDisplay; + std::unique_ptr<X11SalGraphics> mpGraphics; + bool mbGraphics; // is Graphics used + SalX11Screen mnXScreen; + int mnWidth; + int mnHeight; + +public: + X11SkiaSalVirtualDevice(const SalGraphics& rGraphics, tools::Long nDX, tools::Long nDY, + const SystemGraphicsData* pData, + std::unique_ptr<X11SalGraphics> pNewGraphics); + virtual ~X11SkiaSalVirtualDevice() override; + + // SalGeometryProvider + virtual tools::Long GetWidth() const override { return mnWidth; } + virtual tools::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(tools::Long nNewDX, tools::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 0000000000..623e229e8e --- /dev/null +++ b/vcl/inc/skia/x11/textrender.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_SKIA_TEXTRENDER_HXX +#define INCLUDED_VCL_INC_SKIA_TEXTRENDER_HXX + +#include <unx/freetypetextrender.hxx> + +#include <SkFontMgr.h> + +class VCL_DLLPUBLIC SkiaTextRender final : public FreeTypeTextRenderImpl +{ +public: + virtual void DrawTextLayout(const GenericSalLayout&, const SalGraphics&) override; + virtual void ClearDevFontCache() override; + +private: + static inline 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 0000000000..6d503e7eb8 --- /dev/null +++ b/vcl/inc/skia/zone.hxx @@ -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/. + */ + +#ifndef INCLUDED_VCL_INC_SKIA_ZONE_H +#define INCLUDED_VCL_INC_SKIA_ZONE_H + +#include <comphelper/crashzone.hxx> + +#include <vcl/dllapi.h> + +#include <comphelper/solarmutex.hxx> + +// Used around calls to Skia code to detect crashes in drivers. +class VCL_DLLPUBLIC SkiaZone : public CrashZone<SkiaZone> +{ +public: + SkiaZone() { assert(comphelper::SolarMutex::get()->IsCurrentThread()); } + 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 0000000000..73a0dc0a20 --- /dev/null +++ b/vcl/inc/slider.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_SLIDER_HXX +#define INCLUDED_VCL_SLIDER_HXX + +#include <vcl/ctrl.hxx> + +class Slider final : public Control +{ +private: + tools::Rectangle maChannel1Rect; + tools::Rectangle maChannel2Rect; + tools::Rectangle maThumbRect; + tools::Long mnStartPos; + tools::Long mnMouseOff; + tools::Long mnThumbPixOffset; + tools::Long mnThumbPixRange; + tools::Long mnThumbPixPos; + tools::Long mnThumbSize; + tools::Long mnChannelPixRange; + tools::Long mnChannelPixTop; + tools::Long mnChannelPixBottom; + tools::Long mnMinRange; + tools::Long mnMaxRange; + tools::Long mnThumbPos; + tools::Long mnLineSize; + tools::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 ); + tools::Long ImplCalcThumbPos( tools::Long nPixPos ) const; + tools::Long ImplCalcThumbPosPix( tools::Long nPos ) const; + void ImplCalc( bool bUpdate = true ); + void ImplDraw(vcl::RenderContext& rRenderContext); + bool ImplIsPageUp( const Point& rPos ) const; + bool ImplIsPageDown( const Point& rPos ) const; + tools::Long ImplSlide( tools::Long nNewPos ); + tools::Long ImplDoAction( ); + void ImplDoMouseAction( const Point& rPos, bool bCallAction ); + void ImplDoSlide( tools::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(tools::Long nNewRange); + tools::Long GetRangeMin() const { return mnMinRange; } + void SetRangeMax(tools::Long nNewRange); + tools::Long GetRangeMax() const { return mnMaxRange; } + void SetRange( const Range& rRange ); + void SetThumbPos( tools::Long nThumbPos ); + tools::Long GetThumbPos() const { return mnThumbPos; } + void SetLineSize( tools::Long nNewSize ) { mnLineSize = nNewSize; } + tools::Long GetLineSize() const { return mnLineSize; } + void SetPageSize( tools::Long nNewSize ) { mnPageSize = nNewSize; } + tools::Long GetPageSize() const { return mnPageSize; } + + Size CalcWindowSizePixel() const; + + 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 0000000000..7b7fbe11bd --- /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 0000000000..7793418334 --- /dev/null +++ b/vcl/inc/strhelper.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_STRHELPER_HXX +#define INCLUDED_VCL_STRHELPER_HXX + +#include <rtl/math.hxx> +#include <rtl/ustring.hxx> + +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( std::u16string_view, bool bProtect = true ); + OString WhitespaceToSpace(std::string_view); + // 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( std::u16string_view rStr ) + { + return rtl::math::stringToDouble(rStr, u'.', u'\0'); + } + +} // 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 0000000000..6ce4854deb --- /dev/null +++ b/vcl/inc/strings.hrc @@ -0,0 +1,132 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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) TranslateId(Context, 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_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_SAVE NC_("SV_BUTTONTEXT_SAVE", "~Save") +#define SV_BUTTONTEXT_OPEN NC_("SV_BUTTONTEXT_OPEN", "~Open") +#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 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_SKIA_VULKAN NC_("SV_APP_SKIA_VULKAN", "Skia/Vulkan") +#define SV_APP_SKIA_METAL NC_("SV_APP_SKIA_METAL", "Skia/Metal") +#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") + +#define STR_SEPARATOR NC_("STR_SEPARATOR", "Separator") + +#define STR_FILEEXT_NONDEFAULT_ASK_TITLE NC_("STR_FILEEXT_NONDEFAULT_ASK_TITLE", "Default file formats not registered") +#define STR_FILEEXT_NONDEFAULT_ASK_MSG NC_("STR_FILEEXT_NONDEFAULT_ASK_MSG", "The following file formats are not registered to be opened by default in %PRODUCTNAME:\n$1\nSelect OK if you want to change default file format registrations.") + +#define KEY_VERSION_CHECK NC_("KEY_VERSION_CHECK", "Warning: Not all of the imported EPS graphics could be saved at level1\nas some are at a higher level!") + +#define STR_GBU NC_("STR_GBU", "Graphics Backend used: %1") +#define STR_PASSED NC_("STR_PASSED", "Passed Tests: %1") +#define STR_QUIRKY NC_("STR_QUIRKY", "Quirky Tests: %1") +#define STR_FAILED NC_("STR_FAILED", "Failed Tests: %1") +#define STR_SKIPPED NC_("STR_SKIPPED", "Skipped Tests: %1") + +#define STR_UNSAVED_DOCUMENTS NC_("STR_UNSAVED_DOCUMENTS", "There are unsaved documents") + +#define STR_SPECIAL_CHARACTER_MENU_ENTRY NC_("editmenu|specialchar", "_Special Character...") + +#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 0000000000..45e9b2af43 --- /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 0000000000..fd7ae855b5 --- /dev/null +++ b/vcl/inc/svdata.hxx @@ -0,0 +1,483 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <sal/config.h> + +#include <o3tl/lru_map.hxx> +#include <o3tl/hash_combine.hxx> +#include <tools/fldunit.hxx> +#include <unotools/options.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/cvtgrf.hxx> +#include <vcl/image.hxx> +#include <vcl/settings.hxx> +#include <vcl/svapp.hxx> +#include <vcl/print.hxx> +#include <vcl/uitest/logger.hxx> +#include <vcl/virdev.hxx> +#include <vcl/wrkwin.hxx> +#include <vcl/window.hxx> +#include <vcl/task.hxx> +#include <LibreOfficeKit/LibreOfficeKitTypes.h> +#include <unotools/resmgr.hxx> + +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/i18n/XCharacterClassification.hpp> +#include "vcleventlisteners.hxx" +#include "print.h" +#include "salwtype.hxx" +#include "windowdev.hxx" +#include "displayconnectiondispatch.hxx" + +#include <atomic> +#include <mutex> +#include <optional> +#include <vector> +#include <unordered_map> +#include "schedulerimpl.hxx" +#include <basegfx/DrawCommands.hxx> + +struct ImplPostEventData; +struct ImplTimerData; +struct ImplIdleData; +struct ImplConfigData; +namespace rtl +{ + class OStringBuffer; +} +namespace vcl::font +{ + class DirectFontSubstitution; + class PhysicalFontCollection; +} +struct ImplHotKey; +struct ImplEventHook; +class Point; +class ImplAccelManager; +class ImplFontCache; +class HelpTextWindow; +class ImplTBDragMgr; +class ImplIdleMgr; +class FloatingWindow; +class AllSettings; +class NotifyEvent; +class Timer; +class AutoTimer; +class Idle; +class Help; +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 + +const FloatWinPopupFlags LISTBOX_FLOATWINPOPUPFLAGS = FloatWinPopupFlags::Down | + FloatWinPopupFlags::NoHorzPlacement | FloatWinPopupFlags::AllMouseButtonClose; + +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::pair<VclPtr<vcl::Window>, ImplPostEventData *> ImplPostEventPair; + +struct ImplSVAppData +{ + ImplSVAppData(); + ~ImplSVAppData(); + + std::optional<AllSettings> mxSettings; // Application settings + LocaleConfigurationListener* mpCfgListener = nullptr; + VclEventListeners maEventListeners; // listeners for vcl events (eg, extended toolkit) + std::vector<Link<VclWindowEvent&,bool> > + maKeyListeners; // listeners for key events only (eg, extended toolkit) + std::vector<ImplPostEventPair> maPostedEventList; + ImplAccelManager* mpAccelMgr = nullptr; // 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 + std::atomic<bool> mbAppQuit = false; // is Application::Quit() called, volatile because we read/write from different threads + 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 + bool m_bUseSystemLoop = false; + + DECL_STATIC_LINK(ImplSVAppData, ImplQuitMsg, void*, 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; + o3tl::hash_combine(seed, k.mpBitmap); + o3tl::hash_combine(seed, k.maDestSize.getWidth()); + o3tl::hash_combine(seed, k.maDestSize.getHeight()); + return seed; + } +}; + +} // end std namespace + +typedef o3tl::lru_map<ScaleCacheKey, BitmapEx> lru_scale_cache; + +struct ImplSVGDIData +{ + ~ImplSVGDIData(); + + VclPtr<vcl::WindowOutputDevice> mpFirstWinGraphics; // First OutputDevice with a Frame Graphics + VclPtr<vcl::WindowOutputDevice> 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<Printer> mpFirstPrnGraphics; // First OutputDevice with an InfoPrinter Graphics + VclPtr<Printer> 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<vcl::font::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 + vcl::font::DirectFontSubstitution* mpDirectFontSubst = nullptr; // Font-Substitutions defined in Tools->Options->Fonts + std::unique_ptr<GraphicConverter> mxGrfConverter; // Converter for graphics + tools::Long mnAppFontX = 0; // AppFont X-Numenator for 40/tel Width + tools::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 + std::unique_ptr<AutoTimer> mpTrackTimer; // 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 + bool mbIsLiveResize = false; // true: skip waiting for events and low priority timers +}; + +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::optional<Image> moDisclosurePlus; + std::optional<Image> moDisclosureMinus; + 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 mbNoFrameJunctionForPopups = false; // on Gtk4 popups are done via popovers and a toolbar menu won't align to its toolitem, so + // omit the effort the creation a visual junction + 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 + std::mutex maMutex; ///< the "scheduler mutex" (see + ///< vcl/README.scheduler) + 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; + + void dropCaches(); + void dumpState(rtl::OStringBuffer &rState); +}; + +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(TranslateId sContextAndId); +DockingManager* ImplGetDockingManager(); +BlendFrameCache* ImplGetBlendFrameCache(); +void GenerateAutoMnemonicsOnHierarchy(const vcl::Window* pWindow); + +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; + +inline SalData* GetSalData() { return ImplGetSVData()->mpSalData; } +inline void SetSalData(SalData* pData) { ImplGetSVData()->mpSalData = pData; } +inline SalInstance* GetSalInstance() { return ImplGetSVData()->mpDefInst; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/svimpbox.hxx b/vcl/inc/svimpbox.hxx new file mode 100644 index 0000000000..2274f2b811 --- /dev/null +++ b/vcl/inc/svimpbox.hxx @@ -0,0 +1,388 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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/seleng.hxx> +#include <vcl/idle.hxx> +#include <vcl/image.hxx> +#include <vcl/svtaccessiblefactory.hxx> +#include <vcl/vclevent.hxx> +#include <vcl/toolkit/scrbar.hxx> +#include <vcl/toolkit/treelistbox.hxx> +#include <o3tl/enumarray.hxx> +#include <memory> +#include <vector> + +class SvLBoxButton; +class SvTreeList; +class SvImpLBox; +class SvTreeListEntry; +namespace comphelper::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, + 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, 0x07fe> {}; +} + +#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<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 ) + EntryDefExpanded, // default for expanded entries + EntryDefCollapsed, // default for collapsed entries + LAST = EntryDefCollapsed + }; + + // all our images + o3tl::enumarray<ImageType, Image> + m_aNodeAndEntryImages; + + ImpLBSelEng m_aFctSet; + + tools::Long m_nNodeBmpWidth; + tools::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 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( tools::Long nY ) const; + bool IsLineVisible( tools::Long nY ) const; + void KeyLeftRight( tools::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, tools::Long nLine); + void InitScrollBarBox(); + SvLBoxTab* NextTab( SvLBoxTab const * ); + + void 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_aHorSBar; + VclPtr<ScrollBar> m_aVerSBar; + SvTreeListEntry* m_pCursor; + SvTreeListEntry* m_pCursorOld; + 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 + tools::Long m_nNextVerVisSize; + tools::Long m_nNodeBmpTabDistance; // typical smaller than 0 + + virtual tools::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( tools::Long nY ) const; + + tools::Rectangle GetVisibleArea() const; + void SetCursor( SvTreeListEntry* pEntry, bool bForceNoSelect = false ); + 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(); + 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( tools::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 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 ); + bool IsNodeButton( const Point& rPosPixel, const 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 CallEventListeners( VclEventId nEvent, void* pData = nullptr ); + + bool IsSelectable( const SvTreeListEntry* pEntry ) const; + void SetForceMakeVisible(bool bEnable) { mbForceMakeVisible = bEnable; } + + // tdf#143114 allow to ask if CaptureOnButton is active + // (MouseButtonDown hit on SvLBoxButton, CaptureMouse() active) + bool IsCaptureOnButtonActive() const; +}; + +inline bool SvImpLBox::IsCaptureOnButtonActive() const +{ + return nullptr != m_pActiveButton && nullptr != m_pActiveEntry; +} + +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::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( tools::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/svsys.h b/vcl/inc/svsys.h new file mode 100644 index 0000000000..3277c18cf1 --- /dev/null +++ b/vcl/inc/svsys.h @@ -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_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 +#elif defined ANDROID +#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/GraphicsRenderTests.hxx b/vcl/inc/test/GraphicsRenderTests.hxx new file mode 100644 index 0000000000..cdf835f48e --- /dev/null +++ b/vcl/inc/test/GraphicsRenderTests.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/. + * + */ + +#pragma once + +#include <rtl/ustring.hxx> + +namespace vcl::test +{ +// Set and get currently running graphic render test. Some of them may need +// special handling in the backend code, just like unittests do. +void setActiveGraphicsRenderTest(const OUString& name); +const OUString& activeGraphicsRenderTest(); + +} // end namespace vcl::test + +/* 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 0000000000..8412dbaf8a --- /dev/null +++ b/vcl/inc/test/outputdevice.hxx @@ -0,0 +1,316 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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> +#include <vcl/test/TestResult.hxx> + +namespace vcl::test { + +/** 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(tools::Long nWidth, tools::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 checkRectangles(Bitmap& rBitmap, bool aEnableAA = false); + + 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 TestResult checkLinearGradient(Bitmap& bitmap); + static TestResult checkLinearGradientAngled(Bitmap& bitmap); + static TestResult checkLinearGradientBorder(Bitmap& bitmap); + static TestResult checkLinearGradientIntensity(Bitmap& bitmap); + static TestResult checkLinearGradientSteps(Bitmap& bitmap); + static TestResult checkAxialGradient(Bitmap& bitmap); + static TestResult checkRadialGradient(Bitmap& bitmap); + static TestResult checkRadialGradientOfs(Bitmap& bitmap); + + static void createDiamondPoints(tools::Rectangle rRect, int nOffset, + Point& rPoint1, Point& rPoint2, + Point& rPoint3, Point& rPoint4); + + static tools::Polygon createDropShapePolygon(); + static basegfx::B2DPolygon createHalfEllipsePolygon(); + static tools::Polygon createClosedBezierLoop(const tools::Rectangle& rRect); + static basegfx::B2DPolygon createOpenPolygon(const tools::Rectangle& rRect, int nOffset = 4); + static basegfx::B2DPolygon createOpenBezier(); + + 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); + + static TestResult checkLineCapRound(Bitmap& rBitmap) { return checkLineCap(rBitmap, css::drawing::LineCap_ROUND); } + static TestResult checkLineCapSquare(Bitmap& rBitmap) { return checkLineCap(rBitmap, css::drawing::LineCap_SQUARE); } + static TestResult checkLineCapButt(Bitmap& rBitmap) { return checkLineCap(rBitmap, css::drawing::LineCap_BUTT); } + + static TestResult checkLineJoinBevel(Bitmap& rBitmap) { return checkLineJoin(rBitmap, basegfx::B2DLineJoin::Bevel); } + static TestResult checkLineJoinRound(Bitmap& rBitmap) { return checkLineJoin(rBitmap, basegfx::B2DLineJoin::Round); } + static TestResult checkLineJoinMiter(Bitmap& rBitmap) { return checkLineJoin(rBitmap, basegfx::B2DLineJoin::Miter); } + static TestResult checkLineJoinNone(Bitmap& rBitmap) { return checkLineJoin(rBitmap, basegfx::B2DLineJoin::NONE); } + static TestResult checkDropShape(Bitmap& rBitmap, bool aEnableAA = false); + static TestResult checkHalfEllipse(Bitmap& rBitmap, bool aEnableAA = false); + static TestResult checkClosedBezier(Bitmap& rBitmap); + static TestResult checkFilledAsymmetricalDropShape(Bitmap& rBitmap); + static TestResult checkTextLocation(Bitmap& rBitmap); + static TestResult checkEvenOddRuleInIntersectingRecs(Bitmap &rBitmap); + static TestResult checkIntersectingRecs(Bitmap& rBitmap,int aLayerNumber, Color aExpectedColor); + static TestResult checkOpenPolygon(Bitmap& rBitmap, bool aEnableAA = false); + static TestResult checkOpenBezier(Bitmap& rBitmap); +private: + static TestResult checkLineCap(Bitmap& rBitmap, css::drawing::LineCap lineCap); + static TestResult checkLineJoin(Bitmap& rBitmap, basegfx::B2DLineJoin lineJoin); +}; + +class VCL_DLLPUBLIC OutputDeviceTestBitmap : public OutputDeviceTestCommon +{ +public: + OutputDeviceTestBitmap() = default; + + Bitmap setupDrawTransformedBitmap(vcl::PixelFormat aBitmapFormat, + bool isBitmapGreyScale = false); + Bitmap setupComplexDrawTransformedBitmap(vcl::PixelFormat aBitmapFormat, + bool isBitmapGreyScale = false); + Bitmap setupDrawBitmap(vcl::PixelFormat aBitmapFormat, bool isBitmapGreyScale = false); + Bitmap setupDrawBitmapExWithAlpha(vcl::PixelFormat aBitmapFormat); + Bitmap setupDrawMask(vcl::PixelFormat aBitmapFormat); + BitmapEx setupDrawBlend(vcl::PixelFormat aBitmapFormat); + + static TestResult checkTransformedBitmap(Bitmap& rBitmap); + static TestResult checkComplexTransformedBitmap(Bitmap& rBitmap); + static TestResult checkBitmapExWithAlpha(Bitmap& rBitmap); + static TestResult checkMask(Bitmap& rBitmap); + static TestResult checkBlend(const BitmapEx& rBitmap); + + static TestResult checkTransformedBitmap8bppGreyScale(Bitmap& rBitmap); +}; + +class VCL_DLLPUBLIC OutputDeviceTestAnotherOutDev : public OutputDeviceTestCommon +{ +public: + OutputDeviceTestAnotherOutDev() = default; + + Bitmap setupDrawOutDev(); + Bitmap setupDrawOutDevScaledClipped(); + Bitmap setupDrawOutDevSelf(); + Bitmap setupXOR(); + + static TestResult checkDrawOutDev(Bitmap& rBitmap); + static TestResult checkDrawOutDevScaledClipped(Bitmap& rBitmap); + static TestResult checkDrawOutDevSelf(Bitmap& rBitmap); + static TestResult checkXOR(Bitmap& rBitmap); +}; + +class VCL_DLLPUBLIC OutputDeviceTestPixel : public OutputDeviceTestCommon +{ +public: + OutputDeviceTestPixel() = default; + + Bitmap setupRectangle(bool bEnableAA); + Bitmap setupRectangleOnSize1028(); + Bitmap setupRectangleOnSize4096(); +}; + +class VCL_DLLPUBLIC OutputDeviceTestLine : public OutputDeviceTestCommon +{ +public: + OutputDeviceTestLine() = default; + + Bitmap setupRectangle(bool bEnableAA); + Bitmap setupRectangleOnSize1028(); + Bitmap setupRectangleOnSize4096(); + Bitmap setupDiamond(); + Bitmap setupLines(); + Bitmap setupAALines(); + + Bitmap setupDashedLine(); + static TestResult checkDashedLine(Bitmap& rBitmap); + + Bitmap setupLineCapRound() { return setupLineCap(css::drawing::LineCap_ROUND); } + Bitmap setupLineCapSquare() { return setupLineCap(css::drawing::LineCap_SQUARE); } + Bitmap setupLineCapButt() { return setupLineCap(css::drawing::LineCap_BUTT); } + + Bitmap setupLineJoinBevel() { return setupLineJoin(basegfx::B2DLineJoin::Bevel); } + Bitmap setupLineJoinRound() { return setupLineJoin(basegfx::B2DLineJoin::Round); } + Bitmap setupLineJoinMiter() { return setupLineJoin(basegfx::B2DLineJoin::Miter); } + Bitmap setupLineJoinNone() { return setupLineJoin(basegfx::B2DLineJoin::NONE); } +private: + Bitmap setupLineCap( css::drawing::LineCap lineCap ); + Bitmap setupLineJoin( basegfx::B2DLineJoin lineJoin ); +}; + +class VCL_DLLPUBLIC OutputDeviceTestPolyLine : public OutputDeviceTestCommon +{ +public: + OutputDeviceTestPolyLine() = default; + + Bitmap setupRectangle(bool bEnableAA); + Bitmap setupDiamond(); + Bitmap setupLines(); + Bitmap setupAALines(); + Bitmap setupDropShape(); + Bitmap setupAADropShape(); + Bitmap setupHalfEllipse(bool aEnableAA = false); + Bitmap setupClosedBezier(); + Bitmap setupRectangleOnSize1028(); + Bitmap setupRectangleOnSize4096(); + Bitmap setupOpenPolygon(); + Bitmap setupOpenBezier(); +}; + +class VCL_DLLPUBLIC OutputDeviceTestPolyLineB2D : public OutputDeviceTestCommon +{ +public: + OutputDeviceTestPolyLineB2D() = default; + + Bitmap setupRectangle(bool bEnableAA); + Bitmap setupDiamond(); + Bitmap setupBezier(); + Bitmap setupAABezier(); + Bitmap setupHalfEllipse(bool aEnableAA = false); + Bitmap setupRectangleOnSize1028(); + Bitmap setupRectangleOnSize4096(); + Bitmap setupOpenPolygon(); + Bitmap setupOpenBezier(); +}; + +class VCL_DLLPUBLIC OutputDeviceTestRect : public OutputDeviceTestCommon +{ +public: + OutputDeviceTestRect() = default; + + Bitmap setupRectangle(bool bEnableAA); + Bitmap setupFilledRectangle(bool useLineColor); + Bitmap setupRectangleOnSize1028(); + Bitmap setupRectangleOnSize4096(); + 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(); + Bitmap setupDropShape(); + Bitmap setupAADropShape(); + Bitmap setupHalfEllipse(bool aEnableAA = false); + Bitmap setupClosedBezier(); + Bitmap setupFilledAsymmetricalDropShape(); + Bitmap setupRectangleOnSize1028(); + Bitmap setupRectangleOnSize4096(); + Bitmap setupOpenPolygon(); +}; + +class VCL_DLLPUBLIC OutputDeviceTestPolyPolygon : public OutputDeviceTestCommon +{ +public: + OutputDeviceTestPolyPolygon() = default; + + Bitmap setupRectangle(bool bEnableAA); + Bitmap setupFilledRectangle(bool useLineColor); + Bitmap setupIntersectingRectangles(); + Bitmap setupRectangleOnSize1028(); + Bitmap setupRectangleOnSize4096(); + Bitmap setupOpenPolygon(); +}; + +class VCL_DLLPUBLIC OutputDeviceTestPolyPolygonB2D : public OutputDeviceTestCommon +{ +public: + OutputDeviceTestPolyPolygonB2D() = default; + + Bitmap setupRectangle(bool bEnableAA); + Bitmap setupFilledRectangle(bool useLineColor); + Bitmap setupIntersectingRectangles(); + Bitmap setupRectangleOnSize1028(); + Bitmap setupRectangleOnSize4096(); + Bitmap setupOpenPolygon(); +}; + +class VCL_DLLPUBLIC OutputDeviceTestGradient : public OutputDeviceTestCommon +{ +public: + OutputDeviceTestGradient() = default; + + Bitmap setupLinearGradient(); + Bitmap setupLinearGradientAngled(); + Bitmap setupLinearGradientBorder(); + Bitmap setupLinearGradientIntensity(); + Bitmap setupLinearGradientSteps(); + Bitmap setupAxialGradient(); + Bitmap setupRadialGradient(); + Bitmap setupRadialGradientOfs(); +}; + +class VCL_DLLPUBLIC OutputDeviceTestClip : public OutputDeviceTestCommon +{ +public: + Bitmap setupClipRectangle(); + Bitmap setupClipPolygon(); + Bitmap setupClipPolyPolygon(); + Bitmap setupClipB2DPolyPolygon(); + + static TestResult checkClip(Bitmap& rBitmap); +}; + +class VCL_DLLPUBLIC OutputDeviceTestText : public OutputDeviceTestCommon +{ +public: + Bitmap setupTextBitmap(); +}; + +} // 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 0000000000..53462d0cc1 --- /dev/null +++ b/vcl/inc/textlayout.hxx @@ -0,0 +1,143 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <tools/long.hxx> +#include <vcl/outdev.hxx> + +#include <memory> +#include <vector> + +#include <com/sun/star/i18n/WordType.hpp> +#include <com/sun/star/i18n/XBreakIterator.hpp> +#include <com/sun/star/linguistic2/LinguServiceManager.hpp> + +class Control; + +namespace vcl +{ + class SAL_NO_VTABLE ITextLayout + { + public: + virtual tools::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, + std::vector< tools::Rectangle >* _pVector, OUString* _pDisplayText ) = 0; + virtual tools::Long GetTextArray( const OUString& _rText, KernArray* _pDXArray, sal_Int32 _nStartIndex, sal_Int32 _nLength, bool bCaret = false ) const = 0; + virtual sal_Int32 GetTextBreak( const OUString& _rText, tools::Long _nMaxTextWidth, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const = 0; + virtual bool DecomposeTextRectAction() const = 0; + + protected: + ~ITextLayout() COVERITY_NOEXCEPT_FALSE {} + }; + + class TextLayoutCommon : public ITextLayout + { + public: + OUString GetEllipsisString(OUString const& rOrigStr, tools::Long nMaxWidth, DrawTextFlags nStyle); + + sal_Int32 BreakLinesWithIterator(const tools::Long nWidth, OUString const& rStr, + css::uno::Reference< css::linguistic2::XHyphenator > const& xHyph, + css::uno::Reference<css::i18n::XBreakIterator> const& xBI, + const bool bHyphenate, + const sal_Int32 nPos, sal_Int32 nBreakPos); + + sal_Int32 BreakLinesSimple(const tools::Long nWidth, OUString const& rStr, + const sal_Int32 nPos, sal_Int32 nBreakPos, tools::Long& nLineWidth); + + tools::Long GetTextLines(tools::Rectangle const& rRect, const tools::Long nTextHeight, + ImplMultiTextLineInfo& rLineInfo, + tools::Long nWidth, OUString const& rStr, + DrawTextFlags nStyle); + + private: + OUString GetCenterEllipsisString(OUString const& rOrigStr, sal_Int32 nIndex, tools::Long nMaxWidth); + OUString GetEndEllipsisString(OUString const& rOrigStr, sal_Int32 nIndex, tools::Long nMaxWidth, bool bClipText); + OUString GetNewsEllipsisString(OUString const& rOrigStr, tools::Long nMaxWidth, DrawTextFlags nStyle); + }; + + /** 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 TextLayoutCommon + { + public: + DefaultTextLayout( OutputDevice& _rTargetDevice ) + : m_rTargetDevice( _rTargetDevice ) + { + } + virtual ~DefaultTextLayout(); + + // ITextLayout overridables + virtual tools::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, + std::vector< tools::Rectangle >* _pVector, + OUString* _pDisplayText ) override; + + virtual tools::Long GetTextArray( const OUString& _rText, + KernArray* _pDXArray, + sal_Int32 _nStartIndex, + sal_Int32 _nLength, + bool bCaret = false ) const override; + + virtual sal_Int32 GetTextBreak( const OUString& _rText, + tools::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, + std::vector< tools::Rectangle >* _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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/textlineinfo.hxx b/vcl/inc/textlineinfo.hxx new file mode 100644 index 0000000000..0d5f442892 --- /dev/null +++ b/vcl/inc/textlineinfo.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_TEXTLINEINFO_HXX +#define INCLUDED_VCL_INC_TEXTLINEINFO_HXX + +#include <tools/long.hxx> + +#include <vector> + +class ImplTextLineInfo +{ +private: + tools::Long mnWidth; + sal_Int32 mnIndex; + sal_Int32 mnLen; + +public: + ImplTextLineInfo( tools::Long nWidth, sal_Int32 nIndex, sal_Int32 nLen ) + { + mnWidth = nWidth; + mnIndex = nIndex; + mnLen = nLen; + } + + tools::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( const ImplTextLineInfo& ); + void Clear(); + + const ImplTextLineInfo& GetLine( sal_Int32 nLine ) const + { return mvLines[nLine]; } + ImplTextLineInfo& GetLine( sal_Int32 nLine ) + { return mvLines[nLine]; } + sal_Int32 Count() const { return mvLines.size(); } + +private: + ImplMultiTextLineInfo( const ImplMultiTextLineInfo& ) = delete; + ImplMultiTextLineInfo& operator=( const ImplMultiTextLineInfo& ) = delete; + + std::vector<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 0000000000..eb4af536e4 --- /dev/null +++ b/vcl/inc/textrender.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 . + */ + +#pragma once + +#include <sal/config.h> + +#include "salgdi.hxx" + +class FontMetricData; +class PhysicalFontCollection; +namespace vcl::font { 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( FontMetricDataRef&, int nFallbackLevel ) = 0; + virtual FontCharMapRef GetFontCharMap() const = 0; + virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const = 0; + virtual void GetDevFontList( vcl::font::PhysicalFontCollection* ) = 0; + virtual void ClearDevFontCache() = 0; + virtual bool AddTempDevFont( vcl::font::PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) = 0; + + virtual std::unique_ptr<GenericSalLayout> + GetTextLayout(int nFallbackLevel) = 0; + virtual void DrawTextLayout(const GenericSalLayout&, const SalGraphics&) = 0; +}; + +/* vim:set tabstop=4 shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/toolbarvalue.hxx b/vcl/inc/toolbarvalue.hxx new file mode 100644 index 0000000000..b2c2d6dcb1 --- /dev/null +++ b/vcl/inc/toolbarvalue.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_TOOLBARVALUE_HXX +#define INCLUDED_VCL_INC_TOOLBARVALUE_HXX + +#include <tools/gen.hxx> +#include <vcl/salnativewidgets.hxx> + +/* Toolbarvalue: + * + * Value container for toolbars detailing the grip position + */ +class ToolbarValue final : public ImplControlValue +{ +public: + ToolbarValue() + : ImplControlValue(ControlType::Toolbar, 0) + { + mbIsTopDockingArea = false; + } + virtual ~ToolbarValue() override; + virtual ToolbarValue* clone() const override; + ToolbarValue(ToolbarValue const&) = default; + ToolbarValue(ToolbarValue&&) = default; + ToolbarValue& operator=(ToolbarValue const&) = delete; // due to ImplControlValue + ToolbarValue& operator=(ToolbarValue&&) = delete; // due to ImplControlValue + tools::Rectangle maGripRect; + // indicates that this is the top aligned dockingarea + // adjacent to the menubar, only used on Windows + bool mbIsTopDockingArea; +}; + +#endif // INCLUDED_VCL_INC_TOOLBARVALUE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/toolbox.h b/vcl/inc/toolbox.h new file mode 100644 index 0000000000..bda27560cb --- /dev/null +++ b/vcl/inc/toolbox.h @@ -0,0 +1,160 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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/ctrl.hxx> +#include <vcl/toolbox.hxx> + +#include <optional> +#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; + Degree10 mnImageAngle; + bool mbMirrorMode; + OUString maText; + OUString maQuickHelpText; + OUString maHelpText; + OUString maCommandStr; + OUString 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; + tools::Long mnSepSize; + tools::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; + ToolBoxItemId 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( ToolBoxItemId nItemId, Image aImage, + ToolBoxItemBits nItemBits ); + ImplToolItem( ToolBoxItemId nItemId, OUString aTxt, + OUString aCommand, + ToolBoxItemBits nItemBits ); + ImplToolItem( ToolBoxItemId nItemId, Image aImage, + OUString aTxt, + 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, tools::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(ToolBoxItemId nItemId, ToolBoxItemBits nItemBits, bool bEmptyBtn); +}; + +namespace vcl +{ + +struct ToolBoxLayoutData : public ControlLayoutData +{ + std::vector< ToolBoxItemId > m_aLineItemIds; +}; + +} /* namespace vcl */ + +struct ImplToolBoxPrivateData +{ + std::optional<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 { "vcl::ToolBox mpData->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; + tools::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 0000000000..d445a533b4 --- /dev/null +++ b/vcl/inc/treeglue.hxx @@ -0,0 +1,171 @@ +/* -*- 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() override { return GetDragDropMode(); } + + virtual bool EditingEntry(SvTreeListEntry* pEntry) 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() 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, bool bScroll = true) + { + SvTreeListEntry* pOldTargetEntry = pTargetEntry; + pTargetEntry = PosOverBody(rPos) ? pImpl->GetEntry(rPos) : nullptr; + if (pOldTargetEntry != pTargetEntry) + ImplShowTargetEmphasis(pOldTargetEntry, false); + + if (bScroll) + { + // 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) 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 0000000000..accecb2e8f --- /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 0000000000..677f9f5cef --- /dev/null +++ b/vcl/inc/units.hrc @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_INC_UNITS_HRC +#define INCLUDED_VCL_INC_UNITS_HRC + +#include <tools/fldunit.hxx> +#include <unotools/resmgr.hxx> + +#define NC_(Context, String) TranslateId(Context, u8##String) + +std::pair<TranslateId, 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/cairotextrender.hxx b/vcl/inc/unx/cairotextrender.hxx new file mode 100644 index 0000000000..50848ed19f --- /dev/null +++ b/vcl/inc/unx/cairotextrender.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 . + */ + +#pragma once + +#include <unx/freetypetextrender.hxx> + +class GenericSalLayout; +class SalGraphics; +struct CairoCommon; +typedef struct _cairo cairo_t; +typedef struct _cairo_font_options cairo_font_options_t; + +class VCL_DLLPUBLIC CairoTextRender final : public FreeTypeTextRenderImpl +{ +private: + CairoCommon& mrCairoCommon; +protected: + cairo_t* getCairoContext(); + void releaseCairoContext(cairo_t* cr); + void clipRegion(cairo_t* cr); + +public: + virtual void DrawTextLayout(const GenericSalLayout&, const SalGraphics&) override; + CairoTextRender(CairoCommon& rCairoCommon); + virtual ~CairoTextRender(); +}; + +/* 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 0000000000..2806f1d09b --- /dev/null +++ b/vcl/inc/unx/cpdmgr.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 . + */ + +#pragma once + +#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 final : 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 + +/* 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 0000000000..fb172103bb --- /dev/null +++ b/vcl/inc/unx/cupsmgr.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 . + */ + +#pragma once + +#include <printerinfomanager.hxx> +#include <osl/thread.h> +#include <osl/mutex.hxx> + +class cups_dest_s; + +namespace psp +{ + +class PPDParser; + +struct FPtrHash +{ + size_t operator()(const FILE* pPtr) const + { return reinterpret_cast<size_t>(pPtr); } +}; + +class CUPSManager final : public PrinterInfoManager +{ + std::unordered_map< FILE*, OString, FPtrHash > m_aSpoolFiles; + int m_nDests; + cups_dest_s* 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 + +/* 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 0000000000..b40004230f --- /dev/null +++ b/vcl/inc/unx/desktops.hxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <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_PLASMA6, + DESKTOP_LXQT +}; // keep in sync with desktop_strings[] in salplug.cxx + +/* 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 0000000000..73bcf3421b --- /dev/null +++ b/vcl/inc/unx/fc_fontoptions.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 <rtl/string.hxx> +#include <vcl/dllapi.h> + +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; +}; + +/* 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 0000000000..d39795dfa4 --- /dev/null +++ b/vcl/inc/unx/fontmanager.hxx @@ -0,0 +1,204 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <sal/config.h> + +#include <o3tl/sorted_vector.hxx> +#include <tools/fontenum.hxx> +#include <vcl/dllapi.h> +#include <vcl/timer.hxx> +#include <com/sun/star/lang/Locale.hpp> +#include <unx/fc_fontoptions.hxx> + +#include <font/PhysicalFontFace.hxx> + +#include <set> +#include <memory> +#include <string_view> +#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 FontAttributes; +class FontConfigFontOptions; +namespace vcl::font +{ +class FontSelectPattern; +} +namespace vcl { struct NameRecord; } +class GenericUnixSalData; + +namespace psp { +class PPDParser; + +typedef int fontID; + +// a class to manage printable fonts + +class VCL_PLUGIN_PUBLIC PrintFontManager +{ + struct PrintFont; + friend struct PrintFont; + + struct VCL_DLLPRIVATE PrintFont + { + FontAttributes m_aFontAttributes; + + 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, PrintFont > m_aFonts; + // for speeding up findFontFileID + std::unordered_map< OString, o3tl::sorted_vector< fontID > > + m_aFontFileToFontID; + + std::unordered_map< OString, int > + m_aDirToAtom; + std::unordered_map< int, OString > m_aAtomToDir; + int m_nNextDirAtom; + + OString getFontFile(const PrintFont& rFont) const; + + std::vector<PrintFont> analyzeFontFile(int nDirID, const OString& rFileName, const char *pFormat=nullptr) const; + bool analyzeSfntFile(PrintFont& rFont) 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( std::u16string_view rFamily ); + + 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(); + /* 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); + + /* register an application specific font file for libfontconfig */ + static void addFontconfigFile(const OString& rFile); + + std::set<OString> m_aPreviousLangSupportRequests; + std::vector<OUString> m_aCurrentRequests; + Timer m_aFontInstallerTimer; + + DECL_DLLPRIVATE_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( std::u16string_view rFileUrl ); + + void initialize(); + + const PrintFont* getFont( fontID nID ) const + { + auto it = m_aFonts.find( nID ); + return it == m_aFonts.end() ? nullptr : &it->second; + } + + // returns the ids of all managed fonts. + void getFontList( std::vector< fontID >& rFontIDs ); + + // routines to get font info in small pieces + + // 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; + + // 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 + it will update rDFA to the found matching font. + </p> + <p> + implementation note: currently the function is only implemented + for fontconfig. + </p> + + @param rDFA + out of the FontAttributes 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 + */ + bool matchFont(FontAttributes& rDFA, const css::lang::Locale& rLocale); + + static std::unique_ptr<FontConfigFontOptions> getFontOptions(const FontAttributes& rFontAttributes, int nSize); + + void Substitute(vcl::font::FontSelectPattern &rPattern, OUString& rMissingCodes); + +}; + +} // namespace + +/* 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 0000000000..7a13fca832 --- /dev/null +++ b/vcl/inc/unx/freetype_glyphcache.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 . + */ + +#pragma once + +#include <sal/config.h> + +#include <unx/glyphcache.hxx> +#include <font/PhysicalFontFace.hxx> +#include <font/LogicalFontInstance.hxx> + +#include <glyphid.hxx> + +// 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( OString aNativeFileName ); + + const OString maNativeFileName; + unsigned char* mpFileMap; + int mnFileSize; + int mnRefCount; + int mnLangBoost; +}; + +// FreetypeFontInfo corresponds to an unscaled font face +class FreetypeFontInfo final +{ +public: + ~FreetypeFontInfo(); + + FT_FaceRec_* GetFaceFT(); + void ReleaseFaceFT(); + + FreetypeFontFile* GetFontFile() const { return mpFontFile; } + const OString& GetFontFileName() const { return mpFontFile->GetFileName(); } + int GetFontFaceIndex() const { return mnFaceNum; } + int GetFontFaceVariation() const { return mnFaceVariation; } + sal_IntPtr GetFontId() const { return mnFontId; } + const FontAttributes& GetFontAttributes() const { return maDevFontAttributes; } + + void AnnounceFont( vcl::font::PhysicalFontCollection* ); + +private: + friend class FreetypeManager; + explicit FreetypeFontInfo(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; + +}; + +class FreetypeFontFace final : public vcl::font::PhysicalFontFace +{ +private: + FreetypeFontInfo* mpFreetypeFontInfo; + +public: + FreetypeFontFace( FreetypeFontInfo*, const FontAttributes& ); + + virtual rtl::Reference<LogicalFontInstance> CreateFontInstance(const vcl::font::FontSelectPattern&) const override; + virtual sal_IntPtr GetFontId() const override { return mpFreetypeFontInfo->GetFontId(); } + + virtual hb_face_t* GetHbFace() const override; + virtual hb_blob_t* GetHbTable(hb_tag_t nTag) const override; + + const std::vector<hb_variation_t>& GetVariations(const LogicalFontInstance&) const override; +}; + +class SAL_DLLPUBLIC_RTTI FreetypeFontInstance final : public LogicalFontInstance +{ + friend rtl::Reference<LogicalFontInstance> FreetypeFontFace::CreateFontInstance(const vcl::font::FontSelectPattern&) const; + + std::unique_ptr<FreetypeFont> mxFreetypeFont; + + explicit FreetypeFontInstance(const vcl::font::PhysicalFontFace& rPFF, const vcl::font::FontSelectPattern& rFSP); + +public: + virtual ~FreetypeFontInstance() override; + + FreetypeFont& GetFreetypeFont() const { return *mxFreetypeFont; } + + virtual bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const override; +}; + +/* 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 0000000000..63568db498 --- /dev/null +++ b/vcl/inc/unx/freetypetextrender.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 <sal/config.h> + +#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( FontMetricDataRef&, int nFallbackLevel ) override; + virtual FontCharMapRef GetFontCharMap() const override; + virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override; + virtual void GetDevFontList( vcl::font::PhysicalFontCollection* ) override; + virtual void ClearDevFontCache() override; + virtual bool AddTempDevFont( vcl::font::PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override; + + virtual std::unique_ptr<GenericSalLayout> + GetTextLayout(int nFallbackLevel) override; +}; + +/* 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 0000000000..4949613c0b --- /dev/null +++ b/vcl/inc/unx/gendata.hxx @@ -0,0 +1,118 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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 <osl/socket.hxx> + +#include <svdata.hxx> + +#include <memory> + +#ifndef IOS +class FreetypeManager; +#endif +class SalGenericDisplay; + +#ifndef IOS + +namespace psp +{ +class PrintFontManager; +class PrinterInfoManager; +} + +// SalData is a bit of a mess. For ImplSVData we need a SalData base class. +// Windows, MacOS and iOS implement their own SalData class, so there is no +// way to do inheritance from the "top" in all plugins. We also really don't +// want to rename GenericUnixSalData and don't want to reinterpret_cast some +// dummy pointer everywhere, so this seems the only sensible solution. +class VCL_PLUGIN_PUBLIC SalData +{ +protected: + SalData(); + +public: + virtual ~SalData(); +}; + +#endif + +// This class is kind of a misnomer. What this class is mainly about is the +// usage of Freetype and Fontconfig, which happens to match all *nix backends; +// except that the osx and ios backends are *nix but don't use this. +class VCL_PLUGIN_PUBLIC GenericUnixSalData : public SalData +{ +#ifndef IOS + friend class ::psp::PrinterInfoManager; +#endif + + 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; + +#ifndef IOS + std::unique_ptr<FreetypeManager> m_pFreetypeManager; + std::unique_ptr<psp::PrintFontManager> m_pPrintFontManager; + std::unique_ptr<psp::PrinterInfoManager> m_pPrinterInfoManager; +#endif + + void InitFreetypeManager(); + void InitPrintFontManager(); + +public: + GenericUnixSalData(); + 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; } + +#ifndef IOS + + 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(); + } + +#endif + + // 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); +} + +/* 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 0000000000..5ef7d445b2 --- /dev/null +++ b/vcl/inc/unx/gendisp.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 . + */ + +#pragma once + +#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; } +}; + +/* 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 0000000000..32f0a61d1c --- /dev/null +++ b/vcl/inc/unx/geninst.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 . + */ + +#pragma once + +#include <sal/config.h> + +#include <memory> +#include <comphelper/solarmutex.hxx> +#include <salinst.hxx> +#include <svdata.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; +namespace vcl::font +{ + 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 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( vcl::font::PhysicalFontCollection* pFontCollection ); + +protected: + static void configurePspInfoPrinter( PspSalInfoPrinter* pInfoPrinter, + SalPrinterQueueInfo const * pQueueInfo, + ImplJobSetup* pSetupData ); +}; + +inline SalGenericInstance *GetGenericInstance() +{ + return static_cast<SalGenericInstance*>(GetSalInstance()); +} + +/* 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 0000000000..d030c46143 --- /dev/null +++ b/vcl/inc/unx/genprn.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 . + */ + +#pragma once + +#include <jobdata.hxx> +#include <salprn.hxx> + +class GenPspGraphics; +class VCL_DLLPUBLIC PspSalInfoPrinter : public SalInfoPrinter +{ +public: + std::unique_ptr<GenPspGraphics> m_pGraphics; + psp::JobData m_aJobData; + + 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, + tools::Long& rOutWidth, tools::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: + SalInfoPrinter* m_pInfoPrinter; + psp::JobData m_aJobData; + + 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; +}; + +/* 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 0000000000..cad46f77f5 --- /dev/null +++ b/vcl/inc/unx/genpspgraphics.h @@ -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 <sal/config.h> + +#include <config_cairo_canvas.h> + +#include <salgdi.hxx> +#include <sallayout.hxx> + +#include <unx/cairotextrender.hxx> + +#include <headless/SvpGraphicsBackend.hxx> +#include <headless/CairoCommon.hxx> + +namespace vcl::font +{ +class PhysicalFontFace; +class PhysicalFontCollection; +} + +namespace psp { struct JobData; } + +class FreetypeFontInstance; +class FontAttributes; +class SalInfoPrinter; +class FontMetricData; + +class VCL_DLLPUBLIC GenPspGraphics final : public SalGraphicsAutoDelegateToImpl +{ + + psp::JobData* m_pJobData; + + CairoCommon m_aCairoCommon; + CairoTextRender m_aTextRenderImpl; + std::unique_ptr<SvpGraphicsBackend> m_pBackend; + +public: + GenPspGraphics(); + virtual ~GenPspGraphics() override; + + void Init(psp::JobData* pJob); + + // override all pure virtual methods + virtual SalGraphicsImpl* GetImpl() const override + { + return m_pBackend.get(); + } + + virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) override; + + virtual void SetTextColor( Color nColor ) override; + virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) override; + virtual void GetFontMetric( FontMetricDataRef&, int nFallbackLevel ) override; + virtual FontCharMapRef GetFontCharMap() const override; + virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override; + virtual void GetDevFontList( vcl::font::PhysicalFontCollection* ) override; + // graphics must drop any cached font info + virtual void ClearDevFontCache() override; + virtual bool AddTempDevFont( vcl::font::PhysicalFontCollection*, + const OUString& rFileURL, + const OUString& rFontName ) override; + + virtual std::unique_ptr<GenericSalLayout> + GetTextLayout(int nFallbackLevel) override; + virtual void DrawTextLayout( const GenericSalLayout& ) 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; +#endif // ENABLE_CAIRO_CANVAS +}; + +/* 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 0000000000..ab240f05ec --- /dev/null +++ b/vcl/inc/unx/gensys.h @@ -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 <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 +}; + +/* 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 0000000000..122e880228 --- /dev/null +++ b/vcl/inc/unx/glyphcache.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 . + */ + +#pragma once + +#include <sal/config.h> + +#include <memory> +#include <freetype/config/ftheader.h> +#include FT_FREETYPE_H +#include FT_GLYPH_H + +#include <vcl/dllapi.h> +#include <vcl/outdev.hxx> + +#include <fontattributes.hxx> +#include <font/FontMetricData.hxx> +#include <glyphid.hxx> + +#include <unordered_map> + +class FreetypeFont; +class FreetypeFontFile; +class FreetypeFontInstance; +class FreetypeFontInfo; +class FontConfigFontOptions; +namespace vcl::font +{ +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( vcl::font::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; + + 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; + const FontConfigFontOptions* GetFontOptions() const; + + void GetFontMetric(FontMetricDataRef const &) const; + + bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const; + bool GetAntialiasAdvice() const; + +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 + tools::Long mnCos; + tools::Long mnSin; + + int mnWidth; + int mnPrioAntiAlias; + std::shared_ptr<FreetypeFontInfo> mxFontInfo; + double mfStretch; + FT_FaceRec_* maFaceFT; + FT_SizeRec_* maSizeFT; + + mutable std::unique_ptr<FontConfigFontOptions> mxFontOptions; + + bool mbFaceOk; +}; + +/* 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 0000000000..2dff94b02c --- /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 0000000000..e77a9ab571 --- /dev/null +++ b/vcl/inc/unx/gtk/atkbridge.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 + +bool InitAtkBridge(); +void DeInitAtkBridge(); + +/* 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 0000000000..fb84122a60 --- /dev/null +++ b/vcl/inc/unx/gtk/gloactiongroup.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/. + */ + +#pragma once + +#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 + +/* 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 0000000000..da41e9e4b8 --- /dev/null +++ b/vcl/inc/unx/gtk/glomenu.h @@ -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/. + */ + +#pragma once + +#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 + +/* 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 0000000000..1317ad6f72 --- /dev/null +++ b/vcl/inc/unx/gtk/gtkbackend.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 <gtk/gtk.h> +#if defined(GDK_WINDOWING_X11) +#if GTK_CHECK_VERSION(4, 0, 0) +#include <gdk/x11/gdkx.h> +#else +#include <gdk/gdkx.h> +#endif +bool DLSYM_GDK_IS_X11_DISPLAY(GdkDisplay* pDisplay); +#endif +#if defined(GDK_WINDOWING_WAYLAND) +#if GTK_CHECK_VERSION(4, 0, 0) +#include <gdk/wayland/gdkwayland.h> +#else +#include <gdk/gdkwayland.h> +#endif +bool DLSYM_GDK_IS_WAYLAND_DISPLAY(GdkDisplay* pDisplay); +#endif + +/* 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 0000000000..704490e821 --- /dev/null +++ b/vcl/inc/unx/gtk/gtkdata.hxx @@ -0,0 +1,367 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 + +#define GLIB_DISABLE_DEPRECATION_WARNINGS +#include <gtk/gtk.h> +#include <gdk/gdk.h> +#if GTK_CHECK_VERSION(4,0,0) +#include <gdk/x11/gdkx.h> +#else +#include <gdk/gdkx.h> +#endif + +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> +#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 <unotools/weakref.hxx> + +#include <exception> +#include <string_view> +#include <vector> + +namespace com::sun::star::accessibility { class XAccessibleEventListener; } + +class GtkSalDisplay; +class DocumentFocusListener; + +#if !GTK_CHECK_VERSION(4,0,0) +typedef GdkWindow GdkSurface; +typedef GdkWindowState GdkToplevelState; +#endif + +inline void main_loop_run(GMainLoop* pLoop) +{ +#if !GTK_CHECK_VERSION(4, 0, 0) + gdk_threads_leave(); +#endif + g_main_loop_run(pLoop); +#if !GTK_CHECK_VERSION(4, 0, 0) + gdk_threads_enter(); +#endif +} + +inline void css_provider_load_from_data(GtkCssProvider *css_provider, + const gchar *data, + gssize length) +{ +#if GTK_CHECK_VERSION(4, 0, 0) + gtk_css_provider_load_from_data(css_provider, data, length); +#else + gtk_css_provider_load_from_data(css_provider, data, length, nullptr); +#endif +} + +inline GtkWidget* widget_get_toplevel(GtkWidget* pWidget) +{ +#if GTK_CHECK_VERSION(4, 0, 0) + GtkRoot* pRoot = gtk_widget_get_root(pWidget); + return pRoot ? GTK_WIDGET(pRoot) : pWidget; +#else + return gtk_widget_get_toplevel(pWidget); +#endif +} + +inline const char* image_get_icon_name(GtkImage *pImage) +{ +#if GTK_CHECK_VERSION(4, 0, 0) + return gtk_image_get_icon_name(pImage); +#else + const gchar* icon_name; + gtk_image_get_icon_name(pImage, &icon_name, nullptr); + return icon_name; +#endif +} + +inline GtkWidget* widget_get_first_child(GtkWidget *pWidget) +{ +#if GTK_CHECK_VERSION(4, 0, 0) + return gtk_widget_get_first_child(pWidget); +#else + GList* pChildren = gtk_container_get_children(GTK_CONTAINER(pWidget)); + GList* pChild = g_list_first(pChildren); + GtkWidget* pRet = pChild ? static_cast<GtkWidget*>(pChild->data) : nullptr; + g_list_free(pChildren); + return pRet; +#endif +} + +inline void style_context_get_color(GtkStyleContext *pStyle, GdkRGBA *pColor) +{ +#if GTK_CHECK_VERSION(4, 0, 0) + return gtk_style_context_get_color(pStyle, pColor); +#else + return gtk_style_context_get_color(pStyle, gtk_style_context_get_state(pStyle), pColor); +#endif +} + +inline GdkSurface* widget_get_surface(GtkWidget* pWidget) +{ +#if GTK_CHECK_VERSION(4,0,0) + return gtk_native_get_surface(gtk_widget_get_native(pWidget)); +#else + return gtk_widget_get_window(pWidget); +#endif +} + +inline void widget_set_cursor(GtkWidget *pWidget, GdkCursor *pCursor) +{ +#if GTK_CHECK_VERSION(4, 0, 0) + gtk_widget_set_cursor(pWidget, pCursor); +#else + gdk_window_set_cursor(gtk_widget_get_window(pWidget), pCursor); +#endif +} + +inline cairo_surface_t * surface_create_similar_surface(GdkSurface *pSurface, + cairo_content_t eContent, + int nWidth, + int nHeight) +{ +#if GTK_CHECK_VERSION(4, 0, 0) + return gdk_surface_create_similar_surface(pSurface, eContent, nWidth, nHeight); +#else + return gdk_window_create_similar_surface(pSurface, eContent, nWidth, nHeight); +#endif +} + +inline void im_context_set_client_widget(GtkIMContext *pIMContext, GtkWidget *pWidget) +{ +#if GTK_CHECK_VERSION(4, 0, 0) + gtk_im_context_set_client_widget(pIMContext, pWidget); +#else + gtk_im_context_set_client_window(pIMContext, pWidget ? gtk_widget_get_window(pWidget) : nullptr); +#endif +} + +#if GTK_CHECK_VERSION(4, 0, 0) +typedef double gtk_coord; +#else +typedef int gtk_coord; +#endif + +inline bool surface_get_device_position(GdkSurface* pSurface, + GdkDevice* pDevice, + double& x, + double& y, + GdkModifierType* pMask) +{ +#if GTK_CHECK_VERSION(4, 0, 0) + return gdk_surface_get_device_position(pSurface, pDevice, + &x, &y, + pMask); +#else + int nX(x), nY(y); + bool bRet = gdk_window_get_device_position(pSurface, pDevice, + &nX, &nY, + pMask); + x = nX; + y = nY; + return bRet; +#endif +} + +inline GdkGLContext* surface_create_gl_context(GdkSurface* pSurface) +{ +#if GTK_CHECK_VERSION(4, 0, 0) + return gdk_surface_create_gl_context(pSurface, nullptr); +#else + return gdk_window_create_gl_context(pSurface, nullptr); +#endif +} + +void set_buildable_id(GtkBuildable* pWidget, const OUString& rId); +OUString get_buildable_id(GtkBuildable* pWidget); + +void container_remove(GtkWidget* pContainer, GtkWidget* pChild); +void container_add(GtkWidget* pContainer, GtkWidget* pChild); + +#if !GTK_CHECK_VERSION(4, 0, 0) +typedef GtkClipboard GdkClipboard; +#endif + +int getButtonPriority(std::u16string_view rType); + +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 DocumentFocusListener final : + public ::cppu::WeakImplHelper< css::accessibility::XAccessibleEventListener > +{ + + o3tl::sorted_vector< css::uno::Reference< css::uno::XInterface > > m_aRefList; + +public: + /// @throws lang::IndexOutOfBoundsException + /// @throws uno::RuntimeException + void attachRecursive( + const css::uno::Reference< css::accessibility::XAccessible >& xAccessible + ); + + /// @throws lang::IndexOutOfBoundsException + /// @throws uno::RuntimeException + void attachRecursive( + const css::uno::Reference< css::accessibility::XAccessible >& xAccessible, + const css::uno::Reference< css::accessibility::XAccessibleContext >& xContext + ); + + /// @throws lang::IndexOutOfBoundsException + /// @throws uno::RuntimeException + void attachRecursive( + const css::uno::Reference< css::accessibility::XAccessible >& xAccessible, + const css::uno::Reference< css::accessibility::XAccessibleContext >& xContext, + sal_Int64 nStateSet + ); + + /// @throws lang::IndexOutOfBoundsException + /// @throws uno::RuntimeException + void detachRecursive( + const css::uno::Reference< css::accessibility::XAccessible >& xAccessible + ); + + /// @throws lang::IndexOutOfBoundsException + /// @throws uno::RuntimeException + void detachRecursive( + const css::uno::Reference< css::accessibility::XAccessibleContext >& xContext + ); + + /// @throws lang::IndexOutOfBoundsException + /// @throws uno::RuntimeException + void detachRecursive( + const css::uno::Reference< css::accessibility::XAccessibleContext >& xContext, + sal_Int64 nStateSet + ); + + /// @throws lang::IndexOutOfBoundsException + /// @throws uno::RuntimeException + static css::uno::Reference< css::accessibility::XAccessible > getAccessible(const css::lang::EventObject& aEvent ); + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // XAccessibleEventListener + virtual void SAL_CALL notifyEvent( const css::accessibility::AccessibleEventObject& aEvent ) override; +}; + +class GtkSalData final : public GenericUnixSalData +{ + GSource* m_pUserEvent; + osl::Mutex m_aDispatchMutex; + osl::Condition m_aDispatchCondition; + std::exception_ptr m_aException; + + unotools::WeakReference<DocumentFocusListener> m_xDocumentFocusListener; + +public: + GtkSalData(); + virtual ~GtkSalData() override; + + rtl::Reference<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 final : public SalGenericDisplay +{ + GtkSalSystem* m_pSys; + GdkDisplay* m_pGdkDisplay; + o3tl::enumarray<PointerStyle, GdkCursor*> m_aCursors; + bool m_bStartupCompleted; + + GdkCursor* getFromSvg( OUString const & name, int nXHot, int nYHot ); + +public: + GtkSalDisplay( GdkDisplay* pDisplay ); + virtual ~GtkSalDisplay() override; + + GdkDisplay* GetGdkDisplay() const { return m_pGdkDisplay; } + + 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(); } + AbsoluteScreenPixelSize GetScreenSize( int nDisplayScreen ); + + void startupNotificationCompleted() { m_bStartupCompleted = true; } + +#if !GTK_CHECK_VERSION(4,0,0) + void screenSizeChanged( GdkScreen const * ); + void monitorsChanged( GdkScreen const * ); +#endif + + 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()); +} + + +/* 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 0000000000..5fbf441310 --- /dev/null +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -0,0 +1,694 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <cairo.h> +#include <gdk/gdk.h> +#include <gtk/gtk.h> +#if !GTK_CHECK_VERSION(4,0,0) +#include <gtk/gtkx.h> +#endif +#include <gdk/gdkkeysyms.h> + +#include <salframe.hxx> +#include <vcl/idle.hxx> +#include <vcl/sysdata.hxx> +#include <unx/saltype.h> +#include <unx/sessioninhibitor.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> + +#include "gtkdata.hxx" + +class GtkSalGraphics; +class GtkSalDisplay; + +typedef sal_uIntPtr GdkNativeWindow; +class GtkInstDropTarget; +class GtkInstDragSource; +class GtkDnDTransferable; + +class GtkSalMenu; + +struct VclToGtkHelper; + +class GtkSalFrame final : public SalFrame +{ + struct IMHandler + { + +#if !GTK_CHECK_VERSION(4, 0, 0) + // 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) + ; + } + }; +#endif + + GtkSalFrame* m_pFrame; +#if !GTK_CHECK_VERSION(4, 0, 0) + std::list< PreviousKeyPress > m_aPrevKeyPresses; +#endif + 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 ); +#if !GTK_CHECK_VERSION(4, 0, 0) + bool handleKeyEvent( GdkEventKey* pEvent ); +#endif + 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; +#if !GTK_CHECK_VERSION(4, 0, 0) + GtkEventBox* m_pEventBox; + GtkFixed* m_pFixedContainer; + GtkFixed* m_pDrawingArea; +#else + GtkOverlay* m_pOverlay; + GtkFixed* m_pFixedContainer; + GtkDrawingArea* m_pDrawingArea; + GtkEventControllerKey* m_pKeyController; + gulong m_nSettingChangedSignalId; +#endif + gulong m_nPortalSettingChangedSignalId; + GDBusProxy* m_pSettingsPortal; + gulong m_nSessionClientSignalId; + GDBusProxy* m_pSessionManager; + GDBusProxy* m_pSessionClient; +#if !GTK_CHECK_VERSION(4, 0, 0) + GdkWindow* m_pForeignParent; + GdkNativeWindow m_aForeignParentWindow; + GdkWindow* m_pForeignTopLevel; + GdkNativeWindow m_aForeignTopLevelWindow; +#endif + SalFrameStyleFlags m_nStyle; + GtkSalFrame* m_pParent; + std::list< GtkSalFrame* > m_aChildren; + GdkToplevelState m_nState; + SystemEnvData m_aSystemData; + std::unique_ptr<GtkSalGraphics> m_pGraphics; + bool m_bGraphics; + ModKeyFlags m_nKeyModifiers; + PointerStyle m_ePointerStyle; + SessionManagerInhibitor m_SessionManagerInhibitor; + gulong m_nSetFocusSignalId; + bool m_bFullscreen; + 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; + tools::Long m_nWidthRequest; + tools::Long m_nHeightRequest; + cairo_region_t* m_pRegion; + GtkInstDropTarget* m_pDropTarget; + GtkInstDragSource* m_pDragSource; + bool m_bGeometryIsProvisional; + bool m_bIconSetWhileUnmapped; + + GtkSalMenu* m_pSalMenu; + +#if ENABLE_DBUS && ENABLE_GIO + private: + 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 +#if !GTK_CHECK_VERSION(4, 0, 0) + static gboolean signalButton( GtkWidget*, GdkEventButton*, gpointer ); + static void signalStyleUpdated(GtkWidget*, gpointer); +#else + static void signalStyleUpdated(GtkWidget*, const gchar* pSetting, gpointer); +#endif + void DrawingAreaResized(GtkWidget* pWidget, int nWidth, int nHeight); + void DrawingAreaDraw(cairo_t *cr); +#if !GTK_CHECK_VERSION(4, 0, 0) + static gboolean signalDraw( GtkWidget*, cairo_t *cr, gpointer ); + static void sizeAllocated(GtkWidget*, GdkRectangle *pAllocation, gpointer frame); +#else + static void signalDraw(GtkDrawingArea*, cairo_t *cr, int width, int height, gpointer); + static void sizeAllocated(GtkWidget*, int nWidth, int nHeight, gpointer frame); +#endif + static void signalRealize(GtkWidget*, gpointer frame); + static gboolean signalTooltipQuery(GtkWidget*, gint x, gint y, + gboolean keyboard_mode, GtkTooltip *tooltip, + gpointer frame); +#if GTK_CHECK_VERSION(4, 0, 0) + static GdkDragAction signalDragMotion(GtkDropTargetAsync *dest, GdkDrop *drop, double x, double y, gpointer frame); + static void signalDragLeave(GtkDropTargetAsync *dest, GdkDrop *drop, gpointer frame); + static gboolean signalDragDrop(GtkDropTargetAsync* context, GdkDrop* drop, double x, double y, gpointer frame); + + static void signalDragFailed(GdkDrag* drag, GdkDragCancelReason reason, gpointer frame); + static void signalDragDelete(GdkDrag* drag, gpointer frame); + static void signalDragEnd(GdkDrag* drag, gpointer frame); +#else + 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); + +#endif + static void gestureSwipe(GtkGestureSwipe* gesture, gdouble velocity_x, gdouble velocity_y, gpointer frame); + static void gestureLongPress(GtkGestureLongPress* gesture, gdouble x, gdouble y, gpointer frame); + bool DrawingAreaButton(SalEvent nEventType, int nEventX, int nEventY, int nButton, guint32 nTime, guint nState); +#if GTK_CHECK_VERSION(4, 0, 0) + static void gesturePressed(GtkGestureClick* gesture, int n_press, gdouble x, gdouble y, gpointer frame); + static void gestureReleased(GtkGestureClick* gesture, int n_press, gdouble x, gdouble y, gpointer frame); + void gestureButton(GtkGestureClick* gesture, SalEvent nEventType, gdouble x, gdouble y); +#endif + void DrawingAreaFocusInOut(SalEvent nEventType); +#if GTK_CHECK_VERSION(4, 0, 0) + static void signalFocusEnter(GtkEventControllerFocus* pController, gpointer frame); + static void signalFocusLeave(GtkEventControllerFocus* pController, gpointer frame); +#else + static gboolean signalFocus( GtkWidget*, GdkEventFocus*, gpointer ); +#endif +#if !GTK_CHECK_VERSION(4, 0, 0) + static void signalSetFocus(GtkWindow* pWindow, GtkWidget* pWidget, gpointer frame); +#else + static void signalSetFocus(GtkWindow* pWindow, GParamSpec* pSpec, gpointer frame); +#endif + void WindowMap(); + void WindowUnmap(); + bool WindowCloseRequest(); + void DrawingAreaMotion(int nEventX, int nEventY, guint32 nTime, guint nState); + void DrawingAreaCrossing(SalEvent nEventType, int nEventX, int nEventY, guint32 nTime, guint nState); + void DrawingAreaScroll(double delta_x, double delta_y, int nEventX, int nEventY, guint32 nTime, guint nState); +#if GTK_CHECK_VERSION(4, 0, 0) + bool DrawingAreaKey(GtkEventControllerKey* pController, SalEvent nEventType, guint keyval, guint keycode, guint nState); + + static void signalMap(GtkWidget*, gpointer); + static void signalUnmap(GtkWidget*, gpointer); + + static gboolean signalDelete(GtkWidget*, gpointer); + + static void signalMotion(GtkEventControllerMotion *controller, double x, double y, gpointer); + + static gboolean signalScroll(GtkEventControllerScroll* pController, double delta_x, double delta_y, gpointer); + + static void signalEnter(GtkEventControllerMotion *controller, double x, double y, gpointer); + static void signalLeave(GtkEventControllerMotion *controller, gpointer); + + static gboolean signalKeyPressed(GtkEventControllerKey *controller, guint keyval, guint keycode, GdkModifierType state, gpointer); + static gboolean signalKeyReleased(GtkEventControllerKey *controller, guint keyval, guint keycode, GdkModifierType state, gpointer); + + static void signalWindowState(GdkToplevel*, GParamSpec*, gpointer); +#else + static gboolean signalMap( GtkWidget*, GdkEvent*, gpointer ); + static gboolean signalUnmap( GtkWidget*, GdkEvent*, gpointer ); + + static gboolean signalDelete( GtkWidget*, GdkEvent*, gpointer ); + + static gboolean signalMotion( GtkWidget*, GdkEventMotion*, gpointer ); + + static gboolean signalScroll( GtkWidget*, GdkEvent*, gpointer ); + + static gboolean signalCrossing( GtkWidget*, GdkEventCrossing*, gpointer ); + + static gboolean signalKey( GtkWidget*, GdkEventKey*, gpointer ); + + static gboolean signalWindowState( GtkWidget*, GdkEvent*, gpointer ); +#endif + + static bool signalZoomBegin(GtkGesture*, GdkEventSequence*, gpointer); + static bool signalZoomUpdate(GtkGesture*, GdkEventSequence*, gpointer); + static bool signalZoomEnd(GtkGesture*, GdkEventSequence*, gpointer); + + static bool signalRotateBegin(GtkGesture*, GdkEventSequence*, gpointer); + static bool signalRotateUpdate(GtkGesture*, GdkEventSequence*, gpointer); + static bool signalRotateEnd(GtkGesture*, GdkEventSequence*, gpointer); + +#if !GTK_CHECK_VERSION(4, 0, 0) + static gboolean signalConfigure( GtkWidget*, GdkEventConfigure*, gpointer ); +#endif + 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 + ); + +#if !GTK_CHECK_VERSION(4, 0, 0) + static GdkNativeWindow findTopLevelSystemWindow( GdkNativeWindow aWindow ); +#endif + + 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(tools::Long nWidth, tools::Long nHeight); + //call gtk_widget_set_size_request + void widget_set_size_request(tools::Long nWidth, tools::Long nHeight); + + void resizeWindow( tools::Long nWidth, tools::Long nHeight ); + void moveWindow( tools::Long nX, tools::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); + + bool HandleMenubarMnemonic(guint eState, guint nKeyval); + + void ListenPortalSettings(); + + void ListenSessionManager(); + + void UpdateGeometryFromEvent(int x_root, int y_root, int nEventX, int nEventY); + +public: + cairo_surface_t* m_pSurface; + basegfx::B2IVector m_aFrameSize; + DamageHandler m_aDamageHandler; + std::vector<GdkEvent*> m_aPendingScrollEvents; +#if !GTK_CHECK_VERSION(4, 0, 0) + Idle m_aSmoothScrollIdle; +#endif + 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 GTK_FIXED(m_pFixedContainer); } + GtkWidget* getMouseEventWidget() const; + GtkGrid* getTopLevelGridWidget() const { return m_pTopLevelGrid; } + const SalX11Screen& getXScreenNumber() const { return m_nXScreen; } + int GetDisplayScreen() const { return maGeometry.screen(); } + void updateScreenNumber(); + + cairo_t* getCairoContext() const; + void damaged(sal_Int32 nExtentsLeft, sal_Int32 nExtentsTop, + sal_Int32 nExtentsRight, sal_Int32 nExtentsBottom) const; + + void registerDropTarget(GtkInstDropTarget* pDropTarget) + { + assert(!m_pDropTarget); + m_pDropTarget = pDropTarget; + } + + void deregisterDropTarget(GtkInstDropTarget const * pDropTarget) + { + assert(m_pDropTarget == pDropTarget); (void)pDropTarget; + m_pDropTarget = nullptr; + } + + void registerDragSource(GtkInstDragSource* pDragSource) + { + assert(!m_pDragSource); + m_pDragSource = pDragSource; + } + + void deregisterDragSource(GtkInstDragSource const * pDragSource) + { + assert(m_pDragSource == pDragSource); (void)pDragSource; + m_pDragSource = nullptr; + } + + void startDrag(const css::datatransfer::dnd::DragGestureEvent& rEvent, + const css::uno::Reference<css::datatransfer::XTransferable>& rTrans, + VclToGtkHelper& rConversionHelper, + GdkDragAction sourceActions); + + void closePopup(); + + void addGrabLevel(); + void removeGrabLevel(); + +#if !GTK_CHECK_VERSION(4, 0, 0) + void nopaint_container_resize_children(GtkContainer*); + + void LaunchAsyncScroll(GdkEvent const * pEvent); + DECL_LINK(AsyncScroll, Timer *, void); +#endif + + 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(); + 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( tools::Long nWidth, tools::Long nHeight ) override; + virtual void SetMaxClientSize( tools::Long nWidth, tools::Long nHeight ) override; + virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags ) override; + virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) override; + virtual void GetWorkArea( AbsoluteScreenPixelRectangle& rRect ) override; + virtual SalFrame* GetParent() const override; + virtual void SetWindowState(const vcl::WindowData*) override; + virtual bool GetWindowState(vcl::WindowData*) 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( tools::Long nX, tools::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; + + virtual void ResolveWindowHandle(SystemEnvData& rData) 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 void 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( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::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; + virtual void UpdateDarkMode() override; + virtual bool GetUseDarkMode() const override; + virtual bool GetUseReducedAnimation() const override; + + static GtkSalFrame *getFromWindow( GtkWidget *pWindow ); + + static sal_uIntPtr GetNativeWindowHandle(GtkWidget *pWidget); + + //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; + + // call gtk_widget_queue_draw on the drawing widget + void queue_draw(); + + 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); +#if !GTK_CHECK_VERSION(4, 0, 0) + static guint GetKeyValFor(GdkKeymap* pKeyMap, guint16 hardware_keycode, guint8 group); +#endif + static sal_uInt16 GetKeyModCode(guint nState); + static GdkEvent* makeFakeKeyPress(GtkWidget* pWidget); +#if !GTK_CHECK_VERSION(4, 0, 0) + static SalWheelMouseEvent GetWheelEvent(const GdkEventScroll& rEvent); + static gboolean NativeWidgetHelpPressed(GtkAccelGroup*, GObject*, guint, + GdkModifierType, gpointer pFrame); +#endif + static OUString GetPreeditDetails(GtkIMContext* pIMContext, std::vector<ExtTextInputAttr>& rInputFlags, sal_Int32& rCursorPos, sal_uInt8& rCursorFlags); + +#if GTK_CHECK_VERSION(4, 0, 0) + gboolean event_controller_scroll_forward(GtkEventControllerScroll* pController, double delta_x, double delta_y); +#endif + + const cairo_font_options_t* get_font_options(); + + void SetColorScheme(GVariant* variant); + + void SessionManagerInhibit(bool bStart, ApplicationInhibitFlags eType, std::u16string_view sReason, const char* application_id); + + void DisallowCycleFocusOut(); + bool IsCycleFocusOutDisallowed() const; + void AllowCycleFocusOut(); +}; + +extern "C" { + +GType ooo_fixed_get_type(); +#if !GTK_CHECK_VERSION(4, 0, 0) +AtkObject* ooo_fixed_get_accessible(GtkWidget *obj); +#endif + +} // extern "C" + +#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 + + +/* 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 0000000000..9d8bb26ce7 --- /dev/null +++ b/vcl/inc/unx/gtk/gtkgdi.hxx @@ -0,0 +1,245 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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_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, + 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, +}; + +class GtkSalGraphics final : public SvpSalGraphics +{ + GtkSalFrame * const mpFrame; + +#if !GTK_CHECK_VERSION(4, 0, 0) + 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; +#endif + 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(GtkControlPart ePart); +#if !GTK_CHECK_VERSION(4, 0, 0) + GtkStyleContext* makeContext(GtkWidgetPath *pPath, GtkStyleContext *pParent); +#endif +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 *mpToolbarSeparatorStyle; + static GtkStyleContext *mpCheckButtonStyle; + static GtkStyleContext *mpCheckButtonCheckStyle; + static GtkStyleContext *mpRadioButtonStyle; + static GtkStyleContext *mpRadioButtonRadioStyle; + static GtkStyleContext *mpSpinStyle; + 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 gint mnVerticalSeparatorMinWidth; + +#if !GTK_CHECK_VERSION(4, 0, 0) + 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); +#endif + + static bool style_loaded; +}; + + +/* 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 0000000000..1f9e328bb8 --- /dev/null +++ b/vcl/inc/unx/gtk/gtkinst.hxx @@ -0,0 +1,349 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <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> + +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; + +#if GTK_CHECK_VERSION(4, 0, 0) +gint gtk_dialog_run(GtkDialog *dialog); + +struct read_transfer_result +{ + enum { BlockSize = 8192 }; + size_t nRead = 0; + bool bDone = false; + + std::vector<sal_Int8> aVector; + + static void read_block_async_completed(GObject* source, GAsyncResult* res, gpointer user_data); + + OUString get_as_string() const; + css::uno::Sequence<sal_Int8> get_as_sequence() const; +}; + +#endif + +struct VclToGtkHelper +{ + std::vector<css::datatransfer::DataFlavor> aInfoToFlavor; +#if GTK_CHECK_VERSION(4, 0, 0) + std::vector<OString> FormatsToGtk(const css::uno::Sequence<css::datatransfer::DataFlavor> &rFormats); +#else + std::vector<GtkTargetEntry> FormatsToGtk(const css::uno::Sequence<css::datatransfer::DataFlavor> &rFormats); +#endif +#if GTK_CHECK_VERSION(4, 0, 0) + void setSelectionData(const css::uno::Reference<css::datatransfer::XTransferable> &rTrans, + GdkContentProvider* provider, + const char* mime_type, + GOutputStream* stream, + int io_priority, + GCancellable* cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +#else + void setSelectionData(const css::uno::Reference<css::datatransfer::XTransferable> &rTrans, + GtkSelectionData *selection_data, guint info); +#endif +private: +#if GTK_CHECK_VERSION(4, 0, 0) + OString makeGtkTargetEntry(const css::datatransfer::DataFlavor& rFlavor); +#else + GtkTargetEntry makeGtkTargetEntry(const css::datatransfer::DataFlavor& rFlavor); +#endif +}; + +class GtkTransferable : public cppu::WeakImplHelper<css::datatransfer::XTransferable> +{ +protected: +#if GTK_CHECK_VERSION(4, 0, 0) + std::map<OUString, OString> m_aMimeTypeToGtkType; +#else + std::map<OUString, GdkAtom> m_aMimeTypeToGtkType; +#endif + +#if GTK_CHECK_VERSION(4, 0, 0) + std::vector<css::datatransfer::DataFlavor> getTransferDataFlavorsAsVector(const char * const *targets, gint n_targets); +#else + std::vector<css::datatransfer::DataFlavor> getTransferDataFlavorsAsVector(GdkAtom *targets, gint n_targets); +#endif + +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 GtkInstDropTarget 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: + GtkInstDropTarget(); + virtual ~GtkInstDropTarget() 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; + } + +#if !GTK_CHECK_VERSION(4, 0, 0) + gboolean signalDragMotion(GtkWidget* pWidget, GdkDragContext* context, gint x, gint y, guint time); + gboolean signalDragDrop(GtkWidget* pWidget, GdkDragContext* context, gint x, gint y, guint time); +#else + GdkDragAction signalDragMotion(GtkDropTargetAsync *context, GdkDrop *drop, double x, double y); + gboolean signalDragDrop(GtkDropTargetAsync *context, GdkDrop *drop, double x, double y); +#endif + + void signalDragLeave(GtkWidget* pWidget); + +#if !GTK_CHECK_VERSION(4, 0, 0) + void signalDragDropReceived(GtkWidget* pWidget, GdkDragContext* context, gint x, gint y, GtkSelectionData* data, guint ttype, guint time); +#endif +}; + +class GtkInstDragSource 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: + GtkInstDragSource() + : 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); + +#if !GTK_CHECK_VERSION(4, 0, 0) + std::vector<GtkTargetEntry> FormatsToGtk(const css::uno::Sequence<css::datatransfer::DataFlavor> &rFormats); +#endif + + void setActiveDragSource(); + + virtual ~GtkInstDragSource() 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(); +#if GTK_CHECK_VERSION(4, 0, 0) + void dragEnd(GdkDrag* drag); +#else + void dragEnd(GdkDragContext* context); + void dragDataGet(GtkSelectionData *data, guint info); +#endif + + // 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 GtkInstDragSource* g_ActiveDragSource; + css::uno::Reference<css::datatransfer::XTransferable> const & GetTransferable() const { return m_xTrans; } +}; + +enum SelectionType { SELECTION_CLIPBOARD = 0, SELECTION_PRIMARY = 1 }; + +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&, + tools::Long &nDX, tools::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> ImplCreateDragSource(const SystemEnvData*) override; + virtual css::uno::Reference<css::uno::XInterface> ImplCreateDropTarget(const SystemEnvData*) override; + virtual OpenGLContext* CreateOpenGLContext() override; + virtual std::unique_ptr<weld::Builder> CreateBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile) override; + virtual std::unique_ptr<weld::Builder> CreateInterimBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, + bool bAllowCycleFocusOut, sal_uInt64 nLOKWindowId = 0) 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 (); + + void* CreateGStreamerSink(const SystemChildWindow*) override; + +private: + GtkSalTimer *m_pTimer; + css::uno::Reference<css::uno::XInterface> m_aClipboards[2]; + bool IsTimerExpired(); + bool bNeedsInit; + cairo_font_options_t* m_pLastCairoFontOptions; +}; + +inline GtkInstance* GetGtkInstance() { return static_cast<GtkInstance*>(GetSalInstance()); } + +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); + +/* 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 0000000000..63544f56f8 --- /dev/null +++ b/vcl/inc/unx/gtk/gtkobject.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <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( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; + + virtual void SetForwardKey( bool bEnable ) override; + + virtual const SystemEnvData* GetSystemData() const override; + + virtual Size GetOptimalSize() const override; + +private: + // signals +#if !GTK_CHECK_VERSION(4, 0, 0) + static gboolean signalButton( GtkWidget*, GdkEventButton*, gpointer ); + static gboolean signalFocus( GtkWidget*, GdkEventFocus*, gpointer ); +#endif +}; + +// 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( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::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; + GtkWidget* m_pViewPort; + GtkCssProvider* m_pBgCssProvider; + + // signals +#if !GTK_CHECK_VERSION(4, 0, 0) + static gboolean signalScroll(GtkWidget*, GdkEvent*, gpointer); +#else + static gboolean signalScroll(GtkEventControllerScroll* pController, double delta_x, double delta_y, gpointer object); +#endif + static void signalDestroy( GtkWidget*, gpointer ); + +#if !GTK_CHECK_VERSION(4, 0, 0) + bool signal_scroll(GtkWidget* pScrolledWindow, GdkEvent* pEvent); +#else + bool signal_scroll(GtkEventControllerScroll* pController, double delta_x, double delta_y); +#endif + + void ApplyClipRegion(); + + void SetViewPortBackground(); + + DECL_LINK(SettingsChangedHdl, VclWindowEvent&, void); + +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( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; + virtual void Show( bool bVisible ) override; + virtual void Reparent(SalFrame* pFrame) override; +}; + +/* 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 0000000000..4157df9d3b --- /dev/null +++ b/vcl/inc/unx/gtk/gtksalmenu.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/. + */ + +#pragma once + +#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 final : public SalMenu +{ +private: + std::vector< GtkSalMenuItem* > maItems; + std::vector<std::pair<sal_uInt16, GtkWidget*>> maExtraButtons; + 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::TempFileNamed> mxPersonaImage; + BitmapEx maPersonaBitmap; + GtkWidget* mpMenuAllowShrinkWidget; + GtkWidget* mpMenuBarWidget; + GtkWidget* mpMenuWidget; + 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); + + static GtkWidget* AddButton(GtkWidget *pImage); + +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, std::u16string_view 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() const; + virtual void Update() override; // Update this menu only. + // Update full menu hierarchy from this menu. + void UpdateFull () { ActivateAllSubmenus(mpVCLMenu); } + // Clear ActionGroup and MenuModel from full menu hierarchy + void ClearActionGroupAndMenuModel(); + GtkSalMenu* GetTopLevel(); + void SetNeedsUpdate(); + + GtkWidget* GetMenuBarWidget() const { return mpMenuBarWidget; } + GtkWidget* GetMenuBarContainerWidget() const { return mpMenuBarContainerWidget; } + + void CreateMenuBarWidget(); + void DestroyMenuBarWidget(); +#if !GTK_CHECK_VERSION(4, 0, 0) + gboolean SignalKey(GdkEventKey const * pEvent); +#endif + void ReturnFocus(); + + virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const tools::Rectangle& rRect, FloatWinPopupFlags nFlags) override; + virtual void ShowCloseButton(bool bShow) override; + virtual bool AddMenuBarButton( const SalMenuButtonItem& rNewItem ) override; + virtual void RemoveMenuBarButton( sal_uInt16 nId ) override; + virtual tools::Rectangle GetMenuBarButtonRectPixel( sal_uInt16 i_nItemId, SalFrame* i_pReferenceFrame ) override; + virtual bool CanGetFocus() const override; + virtual bool TakeFocus() override; + virtual int GetMenuBarHeight() const override; + virtual void ApplyPersona() override; +}; + +class GtkSalMenuItem final : 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. +}; + +/* 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 0000000000..0dd756f7a7 --- /dev/null +++ b/vcl/inc/unx/gtk/gtksys.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/. + */ + +#pragma once + +#include <unx/gensys.h> +#include <gtk/gtk.h> +#include <unx/saltype.h> +#include <deque> + +class GtkSalSystem final : public SalGenericSystem +{ + GdkDisplay *mpDisplay; +#if !GTK_CHECK_VERSION(4,0,0) + // Number of monitors for every active screen. + std::deque<std::pair<GdkScreen*, int> > maScreenMonitors; +#endif +public: + GtkSalSystem(); + virtual ~GtkSalSystem() override; + static GtkSalSystem *GetSingleton(); + + virtual unsigned int GetDisplayScreenCount() override; + virtual unsigned int GetDisplayBuiltInScreen() override; + virtual AbsoluteScreenPixelRectangle 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); +#if !GTK_CHECK_VERSION(4,0,0) + 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 +}; + +/* 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 0000000000..6c9c015d6a --- /dev/null +++ b/vcl/inc/unx/gtk/hudawareness.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/. + */ + +#pragma once + +#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 diff --git a/vcl/inc/unx/helper.hxx b/vcl/inc/unx/helper.hxx new file mode 100644 index 0000000000..97da8339e3 --- /dev/null +++ b/vcl/inc/unx/helper.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 <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 + +/* 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 0000000000..4b498f3878 --- /dev/null +++ b/vcl/inc/unx/i18n_cb.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 . + */ + +#pragma once + +#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) + { + } +}; + +/* 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 0000000000..303b3fb2e4 --- /dev/null +++ b/vcl/inc/unx/i18n_ic.hxx @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 "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() const { return mbUseable; } + bool IsPreeditMode() const { return maClientData.eState == PreeditStatus::Active; } + XIC GetContext() const { 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(); +}; + +/* 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 0000000000..d283f54451 --- /dev/null +++ b/vcl/inc/unx/i18n_im.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <X11/Xlib.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() const { return mbUseable; } + XIM GetMethod() const { return maMethod; } + void HandleDestroyIM(); + void CreateMethod( Display *pDisplay ); + XIMStyles *GetSupportedStyles() { return mpStyles; } + void SetLocale(); + bool FilterEvent( XEvent *pEvent, ::Window window ); + + SalI18N_InputMethod(); + ~SalI18N_InputMethod(); +}; + +/* 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 0000000000..ca4e25e982 --- /dev/null +++ b/vcl/inc/unx/i18n_keysym.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 . + */ + +#pragma once + +#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); + +/* 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 0000000000..2fe9712458 --- /dev/null +++ b/vcl/inc/unx/i18n_xkb.hxx @@ -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 . + */ + +#pragma once + +#include <X11/Xlib.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; +} + +/* 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 0000000000..0e5928cb45 --- /dev/null +++ b/vcl/inc/unx/saldata.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 . + */ + +#pragma once + +#include <X11/Xlib.h> + +#include <unx/saldisp.hxx> +#include <unx/gendata.hxx> + +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(); + 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(); + +/* 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 0000000000..0d642cb386 --- /dev/null +++ b/vcl/inc/unx/saldisp.hxx @@ -0,0 +1,381 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <X11/Xlib.h> +#include <X11/Xutil.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 <vector> +#include <tools/gen.hxx> +#include <salwtype.hxx> +#include <unx/gendata.hxx> +#include <unx/gendisp.hxx> +#include <o3tl/enumarray.hxx> + +#include <vclpluginapi.h> + +class SalDisplay; +class SalColormap; +class SalVisual; +class SalXLib; + + +/* 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) + +class SalVisual : public XVisualInfo +{ +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; } +}; + +// 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; + Pixel m_nWhitePixel; + Pixel m_nBlackPixel; + Pixel m_nUsed; // Pseudocolor + +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; } + Pixel GetWhitePixel() const { return m_nWhitePixel; } + Pixel GetBlackPixel() const { return m_nBlackPixel; } + + bool GetXPixels( XColor &rColor, + int r, + int g, + int b ) const; + inline bool GetXPixel( XColor &rColor, + int r, + int g, + int b ) const; +}; + +class SalI18N_InputMethod; + +typedef int(*YieldFunc)(int fd, void* data); + +class SalXLib +{ + 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(); + ~SalXLib(); + void Init(); + + bool Yield( bool bWait, bool bHandleAllCurrentEvents ); + void Wakeup(); + void TriggerUserEventProcessing(); + + void Insert( int fd, void* data, + YieldFunc pending, + YieldFunc queued, + YieldFunc handle ); + void Remove( int fd ); + + void StartTimer( sal_uInt64 nMS ); + void StopTimer(); + + 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 ScreenData + { + bool m_bInit; + + ::Window m_aRoot; + ::Window m_aRefWindow; + AbsoluteScreenPixelSize 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; + + 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 ) + {} + }; + +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< AbsoluteScreenPixelRectangle > m_aXineramaScreens; + std::vector< int > m_aXineramaScreenIndexMap; + std::list<SalObject*> m_aSalObjects; + + mutable Time m_nLastUserEventTime; // mutable because changed on first access + + virtual void Dispatch( XEvent *pEvent ) = 0; + void InitXinerama(); + void InitRandR( ::Window aRoot ) const; + static void DeInitRandR(); + void processRandREvent( XEvent* ); + + void doDestruct(); + void addXineramaScreenUnique( int i, tools::Long i_nX, tools::Long i_nY, tools::Long i_nWidth, tools::Long i_nHeight ); + Time GetEventTimeImpl( bool bAlwaysReget = false ) const; +public: + 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, const 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 AbsoluteScreenPixelSize& GetScreenSize( SalX11Screen nXScreen ) const { return getDataForScreen( nXScreen ).m_aSize; } + srv_vendor_t GetServerVendor() const { return meServerVendor; } + bool IsDisplay() const { return !!pXLib_; } + const SalColormap& GetColormap( SalX11Screen nXScreen ) const { return getDataForScreen(nXScreen).m_aColormap; } + const SalVisual& GetVisual( SalX11Screen nXScreen ) const { return getDataForScreen(nXScreen).m_aVisual; } + const Pair &GetResolution() const { return aResolution_; } + Time GetLastUserEventTime() const { return GetEventTimeImpl(); } + // this is an equivalent of gdk_x11_get_server_time() + Time GetX11ServerTime() const { return GetEventTimeImpl( true ); } + + 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< AbsoluteScreenPixelRectangle >& 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 void Dispatch( XEvent *pEvent ) override; + virtual void Yield(); + virtual void TriggerUserEventProcessing() override; + + bool IsEvent(); + void SetupInput(); +}; + +namespace vcl_sal { + // get foreign key names + OUString getKeysymReplacementName( + std::u16string_view pLang, + KeySym nSymbol ); + + inline SalDisplay *getSalDisplay(GenericUnixSalData const * data) + { + assert(data != nullptr); + return static_cast<SalDisplay *>(data->GetDisplay()); + } +} + +/* 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 0000000000..a6603f6777 --- /dev/null +++ b/vcl/inc/unx/salframe.h @@ -0,0 +1,266 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <X11/Xlib.h> + +#include <unx/saltype.h> +#include <unx/saldisp.hxx> +#include <unx/sessioninhibitor.hxx> +#include <salframe.hxx> +#include <salwtype.hxx> + +#include <vcl/ptrstyle.hxx> +#include <vcl/sysdata.hxx> +#include <vcl/timer.hxx> + +#include <list> + +class X11SalGraphics; +class SalI18N_InputContext; + +namespace vcl_sal { class WMAdaptor; class NetWMAdaptor; class GnomeWMAdaptor; } + +// X11SalFrame +enum class X11ShowState +{ + Unknown = -1, + Minimized = 0, + Normal = 1, + Hidden = 2 +}; + +enum class WMWindowType +{ + Normal, + ModelessDialogue, + Utility, + Splash, + Toolbar, + Dock +}; + +class X11SalFrame final : public SalFrame +{ + 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; + cairo_surface_t* mpSurface; + ::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; + + X11ShowState nShowState_; // show state + int nWidth_; // client width + int nHeight_; // client height + AbsoluteScreenPixelRectangle 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; + + SessionManagerInhibitor maSessionManagerInhibitor; + tools::Rectangle maPaintRegion; + + Timer maAlwaysOnTopRaiseTimer; + + // data for WMAdaptor + WMWindowType meWindowType; + bool mbMaximizedVert; + bool mbMaximizedHorz; + bool mbFullScreen; + bool m_bIsPartialFullScreen; + + // 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( AbsoluteScreenPixelRectangle &rPosSize ); + void SetSize ( const Size &rSize ); + void Center(); + void SetPosSize( const AbsoluteScreenPixelRectangle &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; } + cairo_surface_t* GetSurface() const { return mpSurface; } + ::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 SetExtendedFrameStyle( SalExtStyle nExtStyle ) override; + virtual void Show( bool bVisible, bool bNoActivate = false ) override; + virtual void SetMinClientSize( tools::Long nWidth, tools::Long nHeight ) override; + virtual void SetMaxClientSize( tools::Long nWidth, tools::Long nHeight ) override; + virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags ) override; + virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) override; + virtual void GetWorkArea( AbsoluteScreenPixelRectangle& rRect ) override; + virtual SalFrame* GetParent() const override; + virtual void SetWindowState(const vcl::WindowData*) override; + virtual bool GetWindowState(vcl::WindowData*) 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( tools::Long nX, tools::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 void 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( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; + // done setting up the clipregion + virtual void EndSetClipRegion() override; + + /// @internal + void setPendingSizeEvent(); +}; + +/* 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 0000000000..261dd36651 --- /dev/null +++ b/vcl/inc/unx/salgdi.h @@ -0,0 +1,148 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <sal/config.h> + +#include <X11/Xlib.h> + +#include <salgdi.hxx> +#include <salgeom.hxx> +#include <sallayout.hxx> + +#include <headless/CairoCommon.hxx> + +#include "saltype.h" +#include "saldisp.hxx" + +#include <memory> + +/* From <X11/Intrinsic.h> */ +typedef unsigned long Pixel; + +class SalBitmap; +class SalColormap; +class SalDisplay; +class SalFrame; +class X11SalFrame; +class X11SalVirtualDevice; +class X11SkiaSalVirtualDevice; +namespace vcl::font +{ +class PhysicalFontCollection; +class PhysicalFontFace; +} +class SalGraphicsImpl; +class TextRenderImpl; + +namespace basegfx { + class B2DTrapezoid; +} + +class X11Common +{ +public: + Drawable m_hDrawable; + const SalColormap* m_pColormap; + + X11Common(); + + const SalColormap& GetColormap() const { return *m_pColormap; } + const SalDisplay* GetDisplay() const { return GetColormap().GetDisplay(); } + const SalVisual& GetVisual() const { return GetColormap().GetVisual(); } + Display* GetXDisplay() const { return GetColormap().GetXDisplay(); } + Drawable GetDrawable() const { return m_hDrawable; } +}; + +class X11SalGraphics final : public SalGraphicsAutoDelegateToImpl +{ + friend class X11CairoSalGraphicsImpl; + friend class X11CairoTextRender; + +public: + X11SalGraphics(); + virtual ~X11SalGraphics() COVERITY_NOEXCEPT_FALSE override; + + void Init(X11SalFrame& rFrame, Drawable aDrawable, SalX11Screen nXScreen); + void Init(X11SalVirtualDevice *pVirtualDevice, SalColormap* pColormap = nullptr, + bool bDeleteColormap = false); + void Init( X11SkiaSalVirtualDevice *pVirtualDevice ); + void DeInit(); + + virtual SalGraphicsImpl* GetImpl() const override; + SalGeometryProvider* GetGeometryProvider() const; + void SetDrawable(Drawable d, cairo_surface_t* surface, SalX11Screen nXScreen); + + const SalX11Screen& GetScreenNumber() const { return m_nXScreen; } + + void Flush(); + + // override all pure virtual methods + virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) override; + + virtual void SetTextColor( Color nColor ) override; + virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) override; + virtual void GetFontMetric( FontMetricDataRef&, int nFallbackLevel ) override; + virtual FontCharMapRef GetFontCharMap() const override; + virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override; + virtual void GetDevFontList( vcl::font::PhysicalFontCollection* ) override; + virtual void ClearDevFontCache() override; + virtual bool AddTempDevFont( vcl::font::PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override; + + virtual std::unique_ptr<GenericSalLayout> + GetTextLayout(int nFallbackLevel) override; + virtual void DrawTextLayout( const GenericSalLayout& ) 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; +#endif // ENABLE_CAIRO_CANVAS + +private: + using SalGraphics::GetPixel; + + void freeResources(); + + SalFrame* m_pFrame; // the SalFrame which created this Graphics or NULL + SalVirtualDevice* m_pVDev; // the SalVirtualDevice which created this Graphics or NULL + + + std::unique_ptr<SalColormap> m_pDeleteColormap; + + SalX11Screen m_nXScreen; + + std::unique_ptr<SalGraphicsImpl> mxImpl; + std::unique_ptr<TextRenderImpl> mxTextRenderImpl; + X11Common maX11Common; + CairoCommon maCairoCommon; + +public: + Drawable GetDrawable() const { return maX11Common.GetDrawable(); } + const SalDisplay* GetDisplay() const { return maX11Common.GetDisplay(); } + const SalVisual& GetVisual() const { return maX11Common.GetVisual(); } + Display* GetXDisplay() const { return maX11Common.GetXDisplay(); } +}; + +/* 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 0000000000..e8f24e255c --- /dev/null +++ b/vcl/inc/unx/salinst.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 . + */ + +#pragma once + +#include <salinst.hxx> +#include <unx/geninst.h> + +#include <X11/X.h> + +namespace com::sun::star::datatransfer::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(const SalGraphics& rGraphics, tools::Long &nDX, tools::Long &nDY, + DeviceFormat eFormat, const SystemGraphicsData* pData, std::unique_ptr<X11SalGraphics> pNewGraphics); + + virtual std::unique_ptr<SalVirtualDevice> + CreateVirtualDevice( SalGraphics& rGraphics, + tools::Long &nDX, tools::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; + + // 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> ImplCreateDragSource(const SystemEnvData*) override; + virtual css::uno::Reference<css::uno::XInterface> ImplCreateDropTarget(const SystemEnvData*) override; + virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) override; +}; + +/* 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 0000000000..f14af351eb --- /dev/null +++ b/vcl/inc/unx/salobj.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 . + */ + +#pragma once + +#include <X11/Xlib.h> + +#include <salobj.hxx> +#include <vcl/sysdata.hxx> +#include <memory> + +class SalClipRegion +{ + +public: + + SalClipRegion(); + ~SalClipRegion(); + + void BeginSetClipRegion( sal_uInt32 nRects ); + void UnionClipRegion( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::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 +{ + SystemEnvData maSystemChildData; + SalFrame* mpParent; + ::Window maParentWin; + ::Window maPrimary; + ::Window maSecondary; + Colormap maColormap; + SalClipRegion maClipRegion; + bool mbVisible; + +public: + 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( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; + virtual void EndSetClipRegion() override; + + virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::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; +}; + +/* 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 0000000000..a83401f5b9 --- /dev/null +++ b/vcl/inc/unx/saltimer.h @@ -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 . + */ + +#pragma once + +#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; +}; + +/* 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 0000000000..1fde4bd779 --- /dev/null +++ b/vcl/inc/unx/saltype.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/. + */ + +#pragma once + +// 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; } +}; + +/* 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 0000000000..a633378998 --- /dev/null +++ b/vcl/inc/unx/salunx.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 . + */ + +#pragma once + +#include <tools/long.hxx> + +inline tools::Long Divide(tools::Long nDividend, tools::Long nDivisor) +{ + return (nDividend + nDivisor / 2) / nDivisor; +} + +/* 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 0000000000..b1fe0d8102 --- /dev/null +++ b/vcl/inc/unx/salunxtime.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 . + */ + +#pragma once + +#if defined LINUX || defined FREEBSD || \ + defined NETBSD || defined OPENBSD || defined DRAGONFLY +#include <sys/time.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; +} + +/* 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 0000000000..f85d536358 --- /dev/null +++ b/vcl/inc/unx/salvd.h @@ -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 . + */ + +#pragma once + +#include <X11/Xlib.h> + +#include <vcl/salgtype.hxx> + +#include <unx/saldisp.hxx> +#include <unx/saltype.h> +#include <salvd.hxx> + +#include <memory> + +class SalDisplay; +class X11SalGraphics; +typedef struct _cairo_surface cairo_surface_t; + +class X11SalVirtualDevice final : 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_; + cairo_surface_t* m_pSurface; + bool m_bOwnsSurface; // nearly always true, except for edge case of tdf#127529 + +public: + X11SalVirtualDevice(const SalGraphics& rGraphics, tools::Long &nDX, tools::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_; } + cairo_surface_t* GetSurface() const { return m_pSurface; } + 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( tools::Long nNewDX, tools::Long nNewDY ) override; + + // SalGeometryProvider + virtual tools::Long GetWidth() const override { return nDX_; } + virtual tools::Long GetHeight() const override { return nDY_; } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/sessioninhibitor.hxx b/vcl/inc/unx/sessioninhibitor.hxx new file mode 100644 index 0000000000..ca4dc6a93a --- /dev/null +++ b/vcl/inc/unx/sessioninhibitor.hxx @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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 <X11/Xlib.h> +#include <X11/Xmd.h> + +#include <vcl/dllapi.h> + +#include <optional> +#include <string_view> + +enum ApplicationInhibitFlags +{ + APPLICATION_INHIBIT_LOGOUT = (1 << 0), + APPLICATION_INHIBIT_IDLE = (1 << 3) // Inhibit the session being marked as idle +}; + +class VCL_PLUGIN_PUBLIC SessionManagerInhibitor +{ +public: + void inhibit(bool bInhibit, std::u16string_view sReason, ApplicationInhibitFlags eType, + unsigned int window_system_id, std::optional<Display*> pDisplay, + const char* application_id = nullptr); + +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> mnFDOSSCookie; // 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) + 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) + // FDSSO: 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 FDOSS (UnInhibit) vs GSM (Uninhibit) + void inhibitFDOSS(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, + ApplicationInhibitFlags eType, unsigned int window_system_id); + void inhibitMSM(bool bInhibit, const char* appname, const char* reason, + ApplicationInhibitFlags eType, unsigned int window_system_id); + + void inhibitXScreenSaver(bool bInhibit, Display* pDisplay); + static void inhibitXAutoLock(bool bInhibit, Display* pDisplay); + void inhibitDPMS(bool bInhibit, Display* pDisplay); +}; + +/* 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 0000000000..16a3daff80 --- /dev/null +++ b/vcl/inc/unx/sm.hxx @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <sal/config.h> + +#include <X11/SM/SMlib.h> + +#include <tools/link.hxx> +#include <rtl/ustring.hxx> +#include <memory> + +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(); +}; + +/* 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 0000000000..00aec18a34 --- /dev/null +++ b/vcl/inc/unx/svsys.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/XKBlib.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 0000000000..6d3ee56277 --- /dev/null +++ b/vcl/inc/unx/wmadaptor.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 . + */ + +#pragma once + +#include <rtl/ustring.hxx> +#include <tools/gen.hxx> + +#include <X11/Xlib.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_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< AbsoluteScreenPixelRectangle > + 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 AbsoluteScreenPixelRectangle& 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, tools::Long i_nUserTime ) const; + + /* + * tells whether fullscreen mode is supported by WM + */ + bool supportsFullScreen() const { return m_aWMAtoms[ NET_WM_STATE_FULLSCREEN ] != 0; } + + /* + * 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 + +/* 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 0000000000..f7c07a7e86 --- /dev/null +++ b/vcl/inc/unx/x11/x11gdiimpl.h @@ -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 <sal/types.h> + +class ControlCacheKey; + +class SAL_LOPLUGIN_ANNOTATE("crosscast") X11GraphicsImpl +{ +public: + virtual ~X11GraphicsImpl(){}; + virtual void Flush(){}; +}; + +/* 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 0000000000..b48cf26e6a --- /dev/null +++ b/vcl/inc/unx/x11/x11sys.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_X11_X11SYS_HXX +#define INCLUDED_VCL_INC_UNX_X11_X11SYS_HXX + +#include <unx/gensys.h> + +class X11SalSystem final : public SalGenericSystem +{ +public: + X11SalSystem() {} + virtual ~X11SalSystem() override; + + // override pure virtual methods + virtual unsigned int GetDisplayScreenCount() override; + virtual unsigned int GetDisplayBuiltInScreen() override; + virtual AbsoluteScreenPixelRectangle 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 0000000000..35cbd647e0 --- /dev/null +++ b/vcl/inc/unx/x11/xlimits.hxx @@ -0,0 +1,16 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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 <X11/Xlib.h> + +Pixmap limitXCreatePixmap(Display *display, Drawable d, unsigned int width, unsigned int height, unsigned int depth); + +/* 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 0000000000..878d1ff571 --- /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 0000000000..258b2bc93e --- /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 0000000000..1e6170af49 --- /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 0000000000..c44b5eeb94 --- /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 0000000000..cc757474e2 --- /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 0000000000..ebb80c0ba6 --- /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 0000000000..27c0ce7e7c --- /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 0000000000..d7d8a12534 --- /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 0000000000..e746fc59b9 --- /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 0000000000..69bb087d31 --- /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 0000000000..67df6fb7b8 --- /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 0000000000..15bc43bcff --- /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 0000000000..4335c18218 --- /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 0000000000..1ba699bc42 --- /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 0000000000..ea3607beaa --- /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 0000000000..3d366d8e12 --- /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 0000000000..fe5645c285 --- /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 0000000000..959a0600c1 --- /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 0000000000..b3b4a56c4a --- /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 0000000000..ad85d47f7c --- /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 0000000000..0f7ed0fc1a --- /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 0000000000..24e1050582 --- /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 0000000000..26c055225d --- /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 0000000000..4b25c9c4b3 --- /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 0000000000..9af6f79d35 --- /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 0000000000..e5e24e0c7e --- /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 0000000000..367f6b05c9 --- /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 0000000000..6f69770628 --- /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 0000000000..4cc36ebdeb --- /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 0000000000..a3538c9522 --- /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 0000000000..df05429e95 --- /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 0000000000..b2ffcca622 --- /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 0000000000..22d9fc6ffa --- /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 0000000000..171d8b7bc3 --- /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 0000000000..2a80417958 --- /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 0000000000..02f2d4c12d --- /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 0000000000..43629e23a8 --- /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 0000000000..cd17b334c8 --- /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 0000000000..989d43b549 --- /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 0000000000..6e30897e59 --- /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 0000000000..f408422571 --- /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 0000000000..10d3598af6 --- /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 0000000000..265be0fa2f --- /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 0000000000..411e8a39d2 --- /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 0000000000..17edc92db6 --- /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 0000000000..6c0c01754d --- /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 0000000000..5470e8d6dc --- /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 0000000000..b3b1282618 --- /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 0000000000..d16c2103b8 --- /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 0000000000..24a6643a00 --- /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 0000000000..35939eb26f --- /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 0000000000..eeead07a42 --- /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 0000000000..adad711d14 --- /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 0000000000..566a134c77 --- /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 0000000000..36e8862634 --- /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 0000000000..304db762bd --- /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 0000000000..b00d9be980 --- /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 0000000000..0e5d38ebd7 --- /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 0000000000..5376a66002 --- /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 0000000000..f283ac7fad --- /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 0000000000..777634e1c0 --- /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 0000000000..93ac75c2a8 --- /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 0000000000..7eebead2a8 --- /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 0000000000..0865ce1f5d --- /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 0000000000..4f98f355fb --- /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 0000000000..b00b06c915 --- /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 0000000000..f530146d7a --- /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 0000000000..75c335bea4 --- /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/fatcross_curs.h b/vcl/inc/unx/x11_cursors/fatcross_curs.h new file mode 100644 index 0000000000..64322342a3 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/fatcross_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 fatcross_curs_width 32 +#define fatcross_curs_height 32 +#define fatcross_curs_x_hot 15 +#define fatcross_curs_y_hot 15 +static unsigned char fatcross_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, 0xf8, + 0x0f, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x80, + 0x0f, 0xf8, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, + 0x00, 0x80, 0x0f, 0xf8, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x08, + 0x08, 0x00, 0x00, 0xf8, 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 }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/x11_cursors/fatcross_mask.h b/vcl/inc/unx/x11_cursors/fatcross_mask.h new file mode 100644 index 0000000000..d3db67d647 --- /dev/null +++ b/vcl/inc/unx/x11_cursors/fatcross_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 fatcross_mask_width 32 +#define fatcross_mask_height 32 +#define fatcross_mask_x_hot 15 +#define fatcross_mask_y_hot 15 +static unsigned char fatcross_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, 0xf8, + 0x0f, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x80, + 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, + 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, + 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf8, + 0x0f, 0x00, 0x00, 0xf8, 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 }; + +/* 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 0000000000..1cdb63410f --- /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 0000000000..df5d4cdebf --- /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 0000000000..5497f05158 --- /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 0000000000..c94277c6ab --- /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 0000000000..cae29c67e9 --- /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 0000000000..8a4e6db387 --- /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 0000000000..a1875a8e0a --- /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 0000000000..571d928d4e --- /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 0000000000..cbef413689 --- /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 0000000000..4ce3d6e5ae --- /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 0000000000..fcc34f8868 --- /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 0000000000..420ff31470 --- /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 0000000000..157accb3cd --- /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 0000000000..fdae751275 --- /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 0000000000..08203fe767 --- /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 0000000000..b253ce70ca --- /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 0000000000..d317b1556e --- /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 0000000000..1e82e277a4 --- /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 0000000000..e56f9714ce --- /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 0000000000..3ffea197ff --- /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 0000000000..ab74f25d80 --- /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 0000000000..d5c726a2ea --- /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 0000000000..c1683b3336 --- /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 0000000000..02d0c8145c --- /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 0000000000..189c114431 --- /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 0000000000..7f85113ce8 --- /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 0000000000..aa16b5a56c --- /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 0000000000..9582575180 --- /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 0000000000..662a300645 --- /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 0000000000..ebeee4e6ff --- /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 0000000000..71f08a94af --- /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 0000000000..a34520ab0c --- /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 0000000000..9571a031c8 --- /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 0000000000..d4547e25f2 --- /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 0000000000..68868aeec8 --- /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 0000000000..287bc97091 --- /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 0000000000..0d52447229 --- /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 0000000000..4aec279194 --- /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 0000000000..ec9f7f2ba2 --- /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 0000000000..936f9f12b4 --- /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 0000000000..44804f00f9 --- /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 0000000000..afe8fc756f --- /dev/null +++ b/vcl/inc/unx/x11_cursors/salcursors.h @@ -0,0 +1,153 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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> +#include <unx/x11_cursors/fatcross_curs.h> +#include <unx/x11_cursors/fatcross_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 0000000000..e8ca82dd51 --- /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 0000000000..6bb306e73c --- /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 0000000000..54d37ddb0c --- /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 0000000000..3b6ae71184 --- /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 0000000000..9bedaabcc5 --- /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 0000000000..26cbc3282b --- /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 0000000000..c6f6dedf17 --- /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 0000000000..eb9bd3c2d4 --- /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 0000000000..97de234561 --- /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 0000000000..601fe5396e --- /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 0000000000..88cc660bad --- /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 0000000000..0fbb5d99e5 --- /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 0000000000..3e3859cf62 --- /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 0000000000..df7c51a9f9 --- /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 0000000000..8f6d815415 --- /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 0000000000..50bd0c3f02 --- /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 0000000000..8b30f6e8f4 --- /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 0000000000..bba14181d8 --- /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 0000000000..5064e9170d --- /dev/null +++ b/vcl/inc/vcleventlisteners.hxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <tools/link.hxx> +#include <vcl/vclevent.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; + mutable bool m_updated = false; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vclpluginapi.h b/vcl/inc/vclpluginapi.h new file mode 100644 index 0000000000..4211a581c9 --- /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_KF_IMPLEMENTATION +#define VCLPLUG_KF_PUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define VCLPLUG_KF_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_QT_IMPLEMENTATION +#define VCLPLUG_QT_PUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define VCLPLUG_QT_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 0000000000..bc10456650 --- /dev/null +++ b/vcl/inc/vclstatuslistener.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/. + */ + +#pragma once + +#include <cppuhelper/implbase.hxx> +#include <comphelper/processfactory.hxx> +#include <vcl/vclptr.hxx> + +#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/frame/XFrame.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* widget, const css::uno::Reference<css::frame::XFrame>& rFrame, 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; + + void startListening(); + + void dispose(); +}; + +template<class T> +VclStatusListener<T>::VclStatusListener(T* widget, const css::uno::Reference<css::frame::XFrame>& rFrame, const OUString& aCommand) : + mWidget(widget), + mxFrame(rFrame) +{ + css::uno::Reference<css::uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext(); + 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() +{ + 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(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/verticaltabctrl.hxx b/vcl/inc/verticaltabctrl.hxx new file mode 100644 index 0000000000..c5942799b3 --- /dev/null +++ b/vcl/inc/verticaltabctrl.hxx @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <memory> +#include <string_view> + +#include <tools/json_writer.hxx> + +#include <vcl/toolkit/ivctrl.hxx> +#include <vcl/layout.hxx> + +struct VerticalTabPageData; + +class VerticalTabControl final : public VclHBox +{ + VclPtr<SvtIconChoiceCtrl> m_xChooser; + VclPtr<VclVBox> m_xBox; + + std::vector<std::unique_ptr<VerticalTabPageData>> maPageList; + OUString m_sCurrentPageId; + + Link<VerticalTabControl*, void> m_aActivateHdl; + Link<VerticalTabControl*, bool> m_aDeactivateHdl; + + DECL_LINK(ChosePageHdl_Impl, SvtIconChoiceCtrl*, void); + + void ActivatePage(); + bool DeactivatePage(); + + VerticalTabPageData* GetPageData(std::u16string_view rId) const; + VerticalTabPageData* GetPageData(const SvxIconChoiceCtrlEntry* pEntry) const; + +public: + VerticalTabControl(vcl::Window* pParent); + virtual ~VerticalTabControl() override; + virtual void dispose() override; + + sal_uInt16 GetPageCount() const { return m_xChooser->GetEntryCount(); } + + const OUString& GetCurPageId() const { return m_sCurrentPageId; } + void SetCurPageId(const OUString& rId); + + sal_uInt16 GetPagePos(std::u16string_view rPageId) const; + const OUString& GetPageId(sal_uInt16 nIndex) const; + VclPtr<vcl::Window> GetPage(std::u16string_view rPageId) const; + + void RemovePage(std::u16string_view rPageId); + void InsertPage(const OUString& rPageId, const OUString& rLabel, const Image& rImage, + const OUString& rTooltip, VclPtr<vcl::Window> xPage, int nPos = -1); + + void SetActivatePageHdl(const Link<VerticalTabControl*, void>& rLink) + { + m_aActivateHdl = rLink; + } + void SetDeactivatePageHdl(const Link<VerticalTabControl*, bool>& rLink) + { + m_aDeactivateHdl = rLink; + } + + OUString GetPageText(std::u16string_view rPageId) const; + void SetPageText(std::u16string_view rPageId, const OUString& rText); + + vcl::Window* GetPageParent() { return m_xBox.get(); } + + virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override; + + virtual FactoryFunction GetUITestFactory() const override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/watchdog.hxx b/vcl/inc/watchdog.hxx new file mode 100644 index 0000000000..2555104a6b --- /dev/null +++ b/vcl/inc/watchdog.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 <sal/config.h> +#include <salhelper/thread.hxx> + +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(); +}; + +/* 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 0000000000..4176cc6614 --- /dev/null +++ b/vcl/inc/widgetdraw/WidgetDefinition.hxx @@ -0,0 +1,293 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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 <memory> +#include <rtl/ustring.hxx> +#include <tools/color.hxx> +#include <unordered_map> +#include <vector> +#include <cstddef> +#include <o3tl/hash_combine.hxx> +#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; + o3tl::hash_combine(seed, rControlTypeAndPart.meType); + o3tl::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 sEnabled, OString sFocused, OString sPressed, OString sRollover, + OString sDefault, OString sSelected, OString sButtonValue, + OString 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; +}; + +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 + +/* 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 0000000000..98e8154e15 --- /dev/null +++ b/vcl/inc/widgetdraw/WidgetDefinitionReader.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/. + * + */ + +#pragma once + +#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 aDefinitionFile, OUString aResourcePath); + bool read(WidgetDefinition& rWidgetDefinition); +}; + +} // end vcl namespace + +/* 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 0000000000..d4bb45e589 --- /dev/null +++ b/vcl/inc/win/DWriteTextRenderer.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 . + */ + +#pragma once + +#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(bool bRenderingModeNatural); + virtual ~D2DWriteTextOutRenderer() override; + + bool operator()(GenericSalLayout const &rLayout, + SalGraphics &rGraphics, + HDC hDC, + bool bRenderingModeNatural) override; + + HRESULT BindDC(HDC hDC, tools::Rectangle const & rRect = tools::Rectangle(0, 0, 1, 1)); + + HRESULT CreateRenderTarget(bool bRenderingModeNatural); + + bool Ready() const; + + void applyTextAntiAliasMode(bool bRenderingModeNatural); + + bool GetRenderingModeNatural() const { return mbRenderingModeNatural; } + +private: + // This is a singleton object disable copy ctor and assignment operator + D2DWriteTextOutRenderer(const D2DWriteTextOutRenderer &) = delete; + D2DWriteTextOutRenderer & operator = (const D2DWriteTextOutRenderer &) = delete; + + IDWriteFontFace* GetDWriteFace(const WinFontInstance& rWinFont, float * lfSize) const; + bool performRender(GenericSalLayout const &rLayout, SalGraphics &rGraphics, HDC hDC, bool& bRetry, bool bRenderingModeNatural); + + ID2D1Factory * mpD2DFactory; + IDWriteFactory * mpDWriteFactory; + ID2D1DCRenderTarget * mpRT; + const D2D1_RENDER_TARGET_PROPERTIES mRTProps; + + bool mbRenderingModeNatural; + 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, bool bIsVertical); + ~WinFontTransformGuard(); + +private: + ID2D1RenderTarget* mpRenderTarget; + D2D1::Matrix3x2F maTransform; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/dnd_source.hxx b/vcl/inc/win/dnd_source.hxx new file mode 100644 index 0000000000..ea794f069f --- /dev/null +++ b/vcl/inc/win/dnd_source.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 . + */ + +#pragma once + +#include <com/sun/star/datatransfer/dnd/XDragSource.hpp> +#include <com/sun/star/datatransfer/dnd/XDragSourceContext.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <osl/mutex.hxx> +#include <cppuhelper/basemutex.hxx> +#include <cppuhelper/compbase.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <oleidl.h> + +#include <systools/win32/comtools.hxx> + +namespace com::sun::star::uno { class XComponentContext; } + +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::uno; +using namespace cppu; +using namespace osl; +using namespace ::com::sun::star::datatransfer; +using namespace ::com::sun::star::datatransfer::dnd; + +class SourceContext; +// RIGHT MOUSE BUTTON drag and drop not supported currently. +// ALT modifier is considered to effect a user selection of effects +class DragSource: + public cppu::BaseMutex, + public WeakComponentImplHelper<XDragSource, XInitialization, XServiceInfo>, + public IDropSource + +{ + Reference<XComponentContext> m_xContext; + HWND m_hAppWindow; + + // The mouse button that set off the drag and drop operation + short m_MouseButton; + + // First starting a new drag and drop thread if + // the last one has finished + void StartDragImpl( + const DragGestureEvent& trigger, + sal_Int8 sourceActions, + sal_Int32 cursor, + sal_Int32 image, + const Reference<XTransferable >& trans, + const Reference<XDragSourceListener >& listener); + +public: + LONG m_RunningDndOperationCount; + +public: + // only valid for one dnd operation + // the thread ID of the thread which created the window + DWORD m_threadIdWindow; + // The context notifies the XDragSourceListener s + Reference<XDragSourceContext> m_currentContext; + + // the wrapper for the Transferable ( startDrag) + IDataObjectPtr m_spDataObject; + + sal_Int8 m_sourceActions; + +public: + explicit DragSource(const Reference<XComponentContext>& rxContext); + virtual ~DragSource() override; + DragSource(const DragSource&) = delete; + DragSource &operator= ( const DragSource&) = delete; + + // XInitialization + virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) 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 DragGestureEvent& trigger, + sal_Int8 sourceActions, + sal_Int32 cursor, + sal_Int32 image, + const Reference<XTransferable >& trans, + const Reference<XDragSourceListener >& listener ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + virtual HRESULT STDMETHODCALLTYPE QueryInterface( + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject) override; + + virtual ULONG STDMETHODCALLTYPE AddRef( ) override; + + virtual ULONG STDMETHODCALLTYPE Release( ) override; + + // IDropSource + virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag( + /* [in] */ BOOL fEscapePressed, + /* [in] */ DWORD grfKeyState) override; + + virtual HRESULT STDMETHODCALLTYPE GiveFeedback( + /* [in] */ DWORD dwEffect) override; + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/dnd_target.hxx b/vcl/inc/win/dnd_target.hxx new file mode 100644 index 0000000000..d9d4d43d83 --- /dev/null +++ b/vcl/inc/win/dnd_target.hxx @@ -0,0 +1,177 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp> +#include <com/sun/star/datatransfer/dnd/DropTargetDragEnterEvent.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + +#include <cppuhelper/basemutex.hxx> +#include <cppuhelper/compbase.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <osl/mutex.hxx> + +#include <oleidl.h> + +namespace com::sun::star::uno +{ +class XComponentContext; +} + +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::uno; +using namespace cppu; +using namespace osl; +using namespace ::com::sun::star::datatransfer; +using namespace ::com::sun::star::datatransfer::dnd; + +// The client +// has to call XComponent::dispose. The thread that calls initialize +// must also execute the destruction of the instance. This is because +// initialize calls OleInitialize and the destructor calls OleUninitialize. +// If the service calls OleInitialize then it also calls OleUnitialize when +// it is destroyed. Therefore no second instance may exist which was +// created in the same thread and still needs OLE. +class DropTarget : public cppu::BaseMutex, + public WeakComponentImplHelper<XInitialization, XDropTarget, XServiceInfo> + +{ +private: + friend unsigned __stdcall DndTargetOleSTAFunc(void* pParams); + // The native window which acts as drop target. + // It is set in initialize. In case RegisterDragDrop fails it is set + // to NULL + HWND m_hWnd; // set by initialize + // Holds the thread id of the thread which created the window that is the + // drop target. Only used when DropTarget::initialize is called from an MTA + // thread + DWORD m_threadIdWindow; + // This is the thread id of the OLE thread that is created in DropTarget::initialize + // when the calling thread is an MTA + unsigned m_threadIdTarget; + // The handle of the thread that is created in DropTarget::initialize + // when the calling thread is an MTA + HANDLE m_hOleThread; + // The thread id of the thread which called initialize. When the service dies + // than m_oleThreadId is used to determine if the service successfully called + // OleInitialize. If so then OleUninitialize has to be called. + DWORD m_oleThreadId; + // An Instance of IDropTargetImpl which receives calls from the system's drag + // and drop implementation. It delegate the calls to name alike functions in + // this class. + IDropTarget* m_pDropTarget; + + Reference<XComponentContext> m_xContext; + // If m_bActive == sal_True then events are fired to XDropTargetListener s, + // none otherwise. The default value is sal_True. + bool m_bActive; + sal_Int8 m_nDefaultActions; + + // This value is set when a XDropTargetListener calls accept or reject on + // the XDropTargetDropContext or XDropTargetDragContext. + // The values are from the DNDConstants group. + sal_Int8 m_nCurrentDropAction; + // This value is manipulated by the XDropTargetListener + sal_Int8 m_nLastDropAction; + + Reference<XTransferable> m_currentData; + // The current action is used to determine if the USER + // action has changed (dropActionChanged) + // sal_Int8 m_userAction; + // Set by listeners when they call XDropTargetDropContext::dropComplete + bool m_bDropComplete; + Reference<XDropTargetDragContext> m_currentDragContext; + Reference<XDropTargetDropContext> m_currentDropContext; + +public: + explicit DropTarget(const Reference<XComponentContext>& rxContext); + virtual ~DropTarget() override; + DropTarget(DropTarget const&) = delete; + DropTarget& operator=(DropTarget const&) = delete; + + // Overrides WeakComponentImplHelper::disposing which is called by + // WeakComponentImplHelper::dispose + // Must be called. + virtual void SAL_CALL disposing() override; + // XInitialization + virtual void SAL_CALL initialize(const Sequence<Any>& aArguments) override; + + // XDropTarget + virtual void SAL_CALL addDropTargetListener(const Reference<XDropTargetListener>& dtl) override; + virtual void SAL_CALL + removeDropTargetListener(const Reference<XDropTargetListener>& dtl) override; + // Default is not active + virtual sal_Bool SAL_CALL isActive() override; + virtual void SAL_CALL setActive(sal_Bool isActive) override; + virtual sal_Int8 SAL_CALL getDefaultActions() override; + virtual void SAL_CALL setDefaultActions(sal_Int8 actions) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + // Functions called from the IDropTarget implementation ( m_pDropTarget) + virtual HRESULT DragEnter( + /* [unique][in] */ IDataObject* pDataObj, + /* [in] */ DWORD grfKeyState, + /* [in] */ POINTL pt, + /* [out][in] */ DWORD* pdwEffect); + + virtual HRESULT STDMETHODCALLTYPE DragOver( + /* [in] */ DWORD grfKeyState, + /* [in] */ POINTL pt, + /* [out][in] */ DWORD* pdwEffect); + + virtual HRESULT STDMETHODCALLTYPE DragLeave(); + + virtual HRESULT STDMETHODCALLTYPE Drop( + /* [unique][in] */ IDataObject* pDataObj, + /* [in] */ DWORD grfKeyState, + /* [in] */ POINTL pt, + /* [out][in] */ DWORD* pdwEffect); + + // Non - interface functions -------------------------------------------------- + // XDropTargetDropContext delegated from DropContext + + void _acceptDrop(sal_Int8 dropOperation, const Reference<XDropTargetDropContext>& context); + void _rejectDrop(const Reference<XDropTargetDropContext>& context); + void _dropComplete(bool success, const Reference<XDropTargetDropContext>& context); + + // XDropTargetDragContext delegated from DragContext + void _acceptDrag(sal_Int8 dragOperation, const Reference<XDropTargetDragContext>& context); + void _rejectDrag(const Reference<XDropTargetDragContext>& context); + +protected: + // Gets the current action dependent on the pressed modifiers, the effects + // supported by the drop source (IDropSource) and the default actions of the + // drop target (XDropTarget, this class)) + inline sal_Int8 getFilteredActions(DWORD grfKeyState, DWORD sourceActions); + // Only filters with the default actions + inline sal_Int8 getFilteredActions(DWORD grfKeyState); + + void fire_drop(const DropTargetDropEvent& dte); + void fire_dragEnter(const DropTargetDragEnterEvent& dtde); + void fire_dragExit(const DropTargetEvent& dte); + void fire_dragOver(const DropTargetDragEvent& dtde); + void fire_dropActionChanged(const DropTargetDragEvent& dtde); +}; + +/* 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 0000000000..2edf291342 --- /dev/null +++ b/vcl/inc/win/salbmp.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 . + */ + +#pragma once + +#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; + + std::shared_ptr<Gdiplus::Bitmap> ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlphaSource); + std::shared_ptr<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, vcl::PixelFormat ePixelFormat, const BitmapPalette& rPal ); + static HANDLE ImplCopyDIBOrDDB( HANDLE hHdl, bool bDIB ); + static sal_uInt16 ImplGetDIBColorCount( HGLOBAL hDIB ); + +public: + + WinSalBitmap(); + virtual ~WinSalBitmap() override; + + using SalBitmap::addOrReplaceSystemDependentData; + using SalBitmap::getSystemDependentData; + using SystemDependentDataHolder::addOrReplaceSystemDependentData; + using SystemDependentDataHolder::getSystemDependentData; + +public: + + bool Create( HANDLE hBitmap ); + virtual bool Create( const Size& rSize, vcl::PixelFormat ePixelFormat, 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, vcl::PixelFormat eNewPixelFormat ) 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; + + virtual const basegfx::SystemDependentDataHolder* accessSystemDependentDataHolder() const override; +}; + +/* 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 0000000000..80acfaabec --- /dev/null +++ b/vcl/inc/win/saldata.hxx @@ -0,0 +1,295 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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_features.h> + +#include <array> +#include <memory> +#include <osl/module.h> + +#include <svdata.hxx> +#include <salwtype.hxx> + +#include <systools/win32/comtools.hxx> +#include <tools/long.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 HDCCache; +struct TempFontItem; +class TextOutRenderer; +#if HAVE_FEATURE_SKIA +class SkiaControlsCache; +#endif + +#define MAX_STOCKPEN 4 +#define MAX_STOCKBRUSH 4 +#define SAL_CLIPRECT_COUNT 16 + +#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 = nullptr; + HPALETTE mhDefPal = nullptr; + HBITMAP mhDefBmp = nullptr; + HBITMAP mhSelBmp = nullptr; + HBITMAP mhActBmp = nullptr; +}; + +struct SalIcon +{ + int nId; + HICON hIcon; + HICON hSmallIcon; + SalIcon *pNext; +}; + +class SalData : public sal::systools::CoInitializeGuard +{ +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 + std::unique_ptr<tools::Long[]> mpDitherDiff; // Dither mapping table + std::unique_ptr<BYTE[]> mpDitherLow; // Dither mapping table + std::unique_ptr<BYTE[]> mpDitherHigh; // Dither mapping table + HHOOK mhSalObjMsgHook; // hook to get interesting msg for SalObject + HWND mhWantLeaveMsg; // window handle, that want a MOUSELEAVE message + WinSalInstance* mpInstance; + WinSalFrame* mpFirstFrame; // pointer of first frame + WinSalObject* mpFirstObject; // pointer of first object window + WinSalVirtualDevice* mpFirstVD; // first VirDev + WinSalPrinter* mpFirstPrinter; // first printing printer + std::array<HDCCache, CACHESIZE_HDC> maHDCCache; // 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 + 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; +#if HAVE_FEATURE_SKIA + std::unique_ptr<SkiaControlsCache> m_pSkiaControlsCache; +#endif +}; + +struct SalShlData +{ + HINSTANCE mhInst; // Instance of SAL-DLL + UINT mnWheelScrollLines; // WheelScrollLines + UINT mnWheelScrollChars; // WheelScrollChars +}; + +extern SalShlData aSalShlData; + +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" + +// 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 )); +} + +/* 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 0000000000..de72c089b5 --- /dev/null +++ b/vcl/inc/win/salframe.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 . + */ + +#pragma once + +#include <sal/config.h> + +#include <string_view> + +#include <vcl/sysdata.hxx> +#include <vcl/windowstate.hxx> +#include <salframe.hxx> +#include <svsys.h> + +class WinSalGraphics; + +class WinSalFrame final: public SalFrame +{ + vcl::WindowState m_eState; + +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 + int mnShowState; // show state + 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 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 SetExtendedFrameStyle( SalExtStyle nExtStyle ) override; + virtual void Show( bool bVisible, bool bNoActivate = false ) override; + virtual void SetMinClientSize( tools::Long nWidth, tools::Long nHeight ) override; + virtual void SetMaxClientSize( tools::Long nWidth, tools::Long nHeight ) override; + virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags ) override; + virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) override; + virtual void GetWorkArea( AbsoluteScreenPixelRectangle& rRect ) override; + virtual SalFrame* GetParent() const override; + virtual void SetWindowState(const vcl::WindowData*) override; + virtual bool GetWindowState(vcl::WindowData*) 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( tools::Long nX, tools::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 void 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( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; + virtual void EndSetClipRegion() override; + virtual void UpdateDarkMode() override; + virtual bool GetUseDarkMode() const override; + virtual bool GetUseReducedAnimation() const override; + + constexpr vcl::WindowState state() const { return m_eState; } + void UpdateFrameState(); + constexpr bool isFullScreen() const { return bool(m_eState & vcl::WindowState::FullScreen); } +}; + +void ImplSalGetWorkArea( HWND hWnd, RECT *pRect, const RECT *pParentRect ); + +bool UseDarkMode(); +bool OSSupportsDarkMode(); + +// get foreign key names +namespace vcl_sal { + OUString getKeysReplacementName( + std::u16string_view pLang, + LONG nSymbol ); +} + +/* 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 0000000000..80fafdeba5 --- /dev/null +++ b/vcl/inc/win/salgdi.h @@ -0,0 +1,382 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <sal/config.h> + +#include <sallayout.hxx> +#include <salgeom.hxx> +#include <salgdi.hxx> +#include <font/LogicalFontInstance.hxx> +#include <fontattributes.hxx> +#include <font/PhysicalFontFace.hxx> +#include <impfont.hxx> +#include <vcl/fontcapabilities.hxx> +#include <vcl/fontcharmap.hxx> +#include <systools/win32/comtools.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> + +namespace vcl::font +{ +class PhysicalFontCollection; +class FontSelectPattern; +} +class WinFontInstance; +class ImplFontAttrCache; +class SalGraphicsImpl; +class WinSalGraphicsImplBase; +class FontMetricData; + +#define RGB_TO_PALRGB(nRGB) ((nRGB)|0x02000000) +#define PALRGB_TO_RGB(nPalRGB) ((nPalRGB)&0x00ffffff) + +// win32 specific physically available font face +class WinFontFace final : public vcl::font::PhysicalFontFace +{ +public: + explicit WinFontFace(const ENUMLOGFONTEXW&, const NEWTEXTMETRICW&); + ~WinFontFace() override; + + rtl::Reference<LogicalFontInstance> CreateFontInstance( const vcl::font::FontSelectPattern& ) const override; + sal_IntPtr GetFontId() const override; + void SetFontId( sal_IntPtr nId ) { mnId = nId; } + + BYTE GetCharSet() const { return meWinCharSet; } + BYTE GetPitchAndFamily() const { return mnPitchAndFamily; } + + hb_blob_t* GetHbTable(hb_tag_t nTag) const override; + + const std::vector<hb_variation_t>& GetVariations(const LogicalFontInstance&) const override; + +private: + sal_IntPtr mnId; + + BYTE meWinCharSet; + BYTE mnPitchAndFamily; + LOGFONTW maLogFont; + mutable sal::systools::COMReference<IDWriteFontFace> mxDWFontFace; +}; + +/** 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; } + + tools::Long getBitmapWidth() const { return maRects.mnSrcWidth; } + tools::Long getBitmapHeight() const { return maRects.mnSrcHeight; } + + /// Reset the DC with the defined color. + void fill(sal_uInt32 color); +}; + +/** + * WinSalGraphics never owns the HDC it uses to draw, because the HDC can have + * various origins with different ways to correctly free it. And WinSalGraphics + * stores all default values (mhDef*) of the HDC, which must be restored when + * the HDC changes (setHDC) or the SalGraphics is destructed. So think of the + * HDC in terms of Rust's Borrowing semantics. + */ +class WinSalGraphics : public SalGraphics +{ + friend class WinSalGraphicsImpl; + friend class ScopedFont; + +protected: + std::unique_ptr<SalGraphicsImpl> mpImpl; + WinSalGraphicsImplBase * mWinSalGraphicsImplBase; + +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 + + inline static sal::systools::COMReference<IDWriteFactory> mxDWriteFactory; + inline static sal::systools::COMReference<IDWriteGdiInterop> mxDWriteGdiInterop; + inline static bool bDWriteDone = false; + + // just call both from setHDC! + void InitGraphics(); + void DeInitGraphics(); + +public: + // Return HFONT, and whether the font is for vertical writing ( prefixed with '@' ) + // and tmDescent value for adjusting offset in vertical writing mode. + std::tuple<HFONT,bool,sal_Int32> ImplDoSetFont(HDC hDC, vcl::font::FontSelectPattern const & i_rFont, const vcl::font::PhysicalFontFace * i_pFontFace, HFONT& o_rOldFont); + + HDC getHDC() const { return mhLocalDC; } + // NOTE: this doesn't transfer ownership! See class comment. + void setHDC(HDC aNew); + + HPALETTE getDefPal() const; + // returns the result from RealizePalette, otherwise 0 on success or GDI_ERROR + UINT setPalette(HPALETTE, BOOL bForceBkgd = TRUE); + + HRGN getRegion() const; + + + enum Type + { + PRINTER, + VIRTUAL_DEVICE, + WINDOW, + SCREEN + }; + + static void getDWriteFactory(IDWriteFactory** pFactory, IDWriteGdiInterop** pInterop = nullptr); + +public: + + HWND gethWnd(); + + +public: + explicit WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hWnd, + SalGeometryProvider *pProvider); + virtual ~WinSalGraphics() override; + + SalGraphicsImpl* GetImpl() const override; + WinSalGraphicsImplBase * getWinSalGraphicsImplBase() const { return mWinSalGraphicsImplBase; } + bool isPrinter() const; + bool isVirtualDevice() const; + bool isWindow() const; + bool isScreen() const; + + void setHWND(HWND hWnd); + void Flush(); + +protected: + virtual void setClipRegion( const vcl::Region& ) override; + // draw --> LineColor and FillColor and RasterOp and ClipRegion + virtual void drawPixel( tools::Long nX, tools::Long nY ) override; + virtual void drawPixel( tools::Long nX, tools::Long nY, Color nColor ) override; + virtual void drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) override; + virtual void drawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; + virtual void drawPolyLine( sal_uInt32 nPoints, const Point* pPtAry ) override; + virtual void drawPolygon( sal_uInt32 nPoints, const Point* pPtAry ) override; + virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point** pPtAry ) override; + virtual void 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 Point* pPtAry, const PolyFlags* pFlgAry ) override; + virtual bool drawPolygonBezier( sal_uInt32 nPoints, const Point* pPtAry, const PolyFlags* pFlgAry ) override; + virtual bool drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point* const* pPtAry, const PolyFlags* const* pFlgAry ) override; + virtual bool drawGradient( const tools::PolyPolygon&, const Gradient& ) override; + virtual bool implDrawGradient(basegfx::B2DPolyPolygon const & rPolyPolygon, SalGradient const & rGradient) override; + + // CopyArea --> No RasterOp, but ClipRegion + virtual void copyArea( tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX, tools::Long nSrcY, tools::Long nSrcWidth, + tools::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( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; + virtual Color getPixel( tools::Long nX, tools::Long nY ) override; + + // invert --> ClipRegion (only Windows or VirDevs) + virtual void invert( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, SalInvert nFlags) override; + virtual void invert( sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags ) override; + + virtual bool drawEPS( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::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, + double fAlpha) override; + + virtual bool hasFastDrawTransformedBitmap() const override; + + virtual bool drawAlphaRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency ) override; + +private: + // local helpers + + void DrawTextLayout(const GenericSalLayout&, HDC, bool bUseDWrite, bool bRenderingModeNatural); + +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 tools::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( FontMetricDataRef&, 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( vcl::font::PhysicalFontCollection* ) override; + // graphics must drop any cached font info + virtual void ClearDevFontCache() override; + virtual bool AddTempDevFont( vcl::font::PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) 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( const vcl::font::FontSelectPattern&, + const vcl::font::PhysicalFontFace*, LOGFONTW& ); + +#define MAX_64KSALPOINTS ((((sal_uInt16)0xFFFF)-8)/sizeof(POINTS)) + +/* 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 0000000000..7212ee9022 --- /dev/null +++ b/vcl/inc/win/salids.hrc @@ -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_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_POINTER_FATCROSS 10081 + +#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 0000000000..9c6ca82d38 --- /dev/null +++ b/vcl/inc/win/salinst.h @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <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 void AfterAppInit() 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& rGraphics, + tools::Long &nDX, tools::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 void BeforeAbort(const OUString&, bool) override; + + static int WorkaroundExceptionHandlingInUSER32Lib(int nExcept, LPEXCEPTION_POINTERS pExceptionInfo); + + virtual css::uno::Reference<css::uno::XInterface> ImplCreateDragSource(const SystemEnvData*) override; + virtual css::uno::Reference<css::uno::XInterface> ImplCreateDropTarget(const SystemEnvData*) override; +}; + +SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, HWND hWndParent, SalFrameStyleFlags nSalFrameStyle ); +SalObject* ImplSalCreateObject( WinSalInstance* pInst, WinSalFrame* pParent ); +HWND ImplSalReCreateHWND( HWND hWndParent, HWND oldhWnd, bool bAsChild ); + +/* 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 0000000000..7058d9c82b --- /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 0000000000..37bcf03178 --- /dev/null +++ b/vcl/inc/win/salobj.h @@ -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 . + */ + +#pragma once + +#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( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight) override; + virtual void EndSetClipRegion() override; + virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::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; +}; + +/* 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 0000000000..e1bbb665e2 --- /dev/null +++ b/vcl/inc/win/salprn.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 . + */ + +#pragma once + +#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 final : public SalInfoPrinter +{ +public: + OUString maDriverName; // printer driver name + OUString maDeviceName; // printer device name + OUString maPortName; // printer port name + +private: + HDC m_hDC; ///< printer hdc + WinSalGraphics* m_pGraphics; ///< current Printer graphics + bool m_bGraphics; ///< is Graphics used + +public: + WinSalInfoPrinter(); + virtual ~WinSalInfoPrinter() override; + + void setHDC(HDC); + + 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, + tools::Long& rOutWidth, tools::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: + std::unique_ptr<WinSalGraphics> mxGraphics; // current Printer graphics + WinSalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter + WinSalPrinter* mpNextPrinter; // next printing printer + HDC mhDC; // printer hdc + SalPrinterError mnError; // error code + sal_uInt32 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 && mhDC; } +}; + +/* 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 0000000000..ae94bb9e1a --- /dev/null +++ b/vcl/inc/win/salsys.h @@ -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 <salsys.hxx> + +#include <vector> +#include <map> + +class WinSalSystem : public SalSystem +{ +public: + struct DisplayMonitor + { + OUString m_aName; + AbsoluteScreenPixelRectangle m_aArea; + + DisplayMonitor() {} + DisplayMonitor( const OUString& rName, + const AbsoluteScreenPixelRectangle& 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 AbsoluteScreenPixelRectangle 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*/ ); +}; + +/* 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 0000000000..827c08ab83 --- /dev/null +++ b/vcl/inc/win/saltimer.h @@ -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 . + */ + +#pragma once + +#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; +} + +/* 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 0000000000..66833f99f1 --- /dev/null +++ b/vcl/inc/win/salvd.h @@ -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 <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 + tools::Long mnWidth; + tools::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, tools::Long nWidth = 0, tools::Long nHeight = 0); + virtual ~WinSalVirtualDevice() override; + + virtual SalGraphics* AcquireGraphics() override; + virtual void ReleaseGraphics( SalGraphics* pGraphics ) override; + virtual bool SetSize( tools::Long nNewDX, tools::Long nNewDY ) override; + + static HBITMAP ImplCreateVirDevBitmap(HDC hDC, tools::Long nDX, tools::Long nDY, sal_uInt16 nBitCount, void **ppDummy); + + // SalGeometryProvider + virtual tools::Long GetWidth() const override { return mnWidth; } + virtual tools::Long GetHeight() const override { return mnHeight; } +}; + +/* 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 0000000000..86846e9860 --- /dev/null +++ b/vcl/inc/win/scoped_gdi.hxx @@ -0,0 +1,72 @@ +/* -*- 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 <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; +}; + +/* 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 0000000000..8a26bf6699 --- /dev/null +++ b/vcl/inc/win/svsys.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 . + */ + +#pragma once + +#ifdef _WIN32 +#ifndef INCLUDED_PRE_POST_WIN_H +#define INCLUDED_PRE_POST_WIN_H +#include <prewin.h> +#include <postwin.h> +#endif +#endif + +/* 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 0000000000..4383bc5b77 --- /dev/null +++ b/vcl/inc/win/wincomp.hxx @@ -0,0 +1,181 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <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" + +/* 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 0000000000..94a1ec8f84 --- /dev/null +++ b/vcl/inc/win/wingdiimpl.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 <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() {} + + virtual void Flush() {} + + // Implementation for WinSalGraphics::DrawTextLayout(). + // Returns true if handled, if false, then WinSalGraphics will handle it itself. + virtual bool DrawTextLayout(const GenericSalLayout&) { return false; } + + virtual void ClearNativeControlCache() {} +}; + +/* 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 0000000000..e1d66a0e1a --- /dev/null +++ b/vcl/inc/win/winlayout.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 . + */ + +#pragma once + +#include <sal/config.h> + +#include <rtl/ustring.hxx> + +#include <sallayout.hxx> +#include <svsys.h> +#include <win/salgdi.h> +#include <o3tl/sorted_vector.hxx> + +// win32 specific logical font instance +class WinFontInstance : public LogicalFontInstance +{ + friend rtl::Reference<LogicalFontInstance> WinFontFace::CreateFontInstance(const vcl::font::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; } + // Return true if the font is for vertical writing. + // I.e. the font name of the LOGFONT is prefixed with '@'. + bool IsCJKVerticalFont() const { return m_bIsCJKVerticalFont; } + sal_Int32 GetTmDescent() const { return m_nTmDescent; } + + const WinFontFace * GetFontFace() const { return static_cast<const WinFontFace *>(LogicalFontInstance::GetFontFace()); } + WinFontFace * GetFontFace() { return static_cast<WinFontFace *>(LogicalFontInstance::GetFontFace()); } + + bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const override; + + IDWriteFontFace* GetDWFontFace() const; + +private: + explicit WinFontInstance(const WinFontFace&, const vcl::font::FontSelectPattern&); + + virtual void ImplInitHbFont(hb_font_t*) override; + + WinSalGraphics *m_pGraphics; + HFONT m_hFont; + bool m_bIsCJKVerticalFont; + sal_Int32 m_nTmDescent; + mutable sal::systools::COMReference<IDWriteFontFace> mxDWFontFace; +}; + +class TextOutRenderer +{ +protected: + explicit TextOutRenderer() = default; + TextOutRenderer(const TextOutRenderer &) = delete; + TextOutRenderer & operator = (const TextOutRenderer &) = delete; + +public: + static TextOutRenderer & get(bool bUseDWrite, bool bRenderingModeNatural); + + virtual ~TextOutRenderer() = default; + + virtual bool operator ()(GenericSalLayout const &rLayout, + SalGraphics &rGraphics, + HDC hDC, + bool bRenderingModeNatural) = 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, + bool bRenderingModeNatural) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/window.h b/vcl/inc/window.h new file mode 100644 index 0000000000..199fed977c --- /dev/null +++ b/vcl/inc/window.h @@ -0,0 +1,440 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <sal/config.h> + +#include <tools/fract.hxx> +#include <vcl/commandevent.hxx> +#include <vcl/idle.hxx> +#include <vcl/inputctx.hxx> +#include <vcl/virdev.hxx> +#include <vcl/window.hxx> +#include <vcl/settings.hxx> +#include <o3tl/deleter.hxx> +#include <o3tl/typed_flags_set.hxx> +#include "windowdev.hxx" +#include "salwtype.hxx" + +#include <optional> +#include <list> +#include <memory> +#include <vector> +#include <set> + +class FixedText; +class VclSizeGroup; +class VirtualDevice; +namespace vcl::font { class PhysicalFontCollection; } +class ImplFontCache; +class VCLXWindow; +namespace vcl { class WindowData; } +class SalFrame; +class SalObject; +enum class MouseEventModifiers; +enum class NotifyEventType; +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 awt { + class XVclWindowPeer; + 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 ); + +MouseEventModifiers ImplGetMouseMoveMode( SalMouseEvent const * pEvent ); + +MouseEventModifiers ImplGetMouseButtonMode( SalMouseEvent const * pEvent ); + +struct ImplWinData +{ + std::optional<OUString> + mpExtOldText; + std::unique_ptr<ExtTextInputAttr[]> + mpExtOldAttrAry; + std::optional<tools::Rectangle> + mpCursorRect; + tools::Long mnCursorExtWidth; + bool mbVertical; + std::unique_ptr<tools::Rectangle[]> + mpCompositionCharRects; + tools::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 + VclPtr<vcl::Window> mpTrackWin; //< window, that is in tracking mode + std::vector<VclPtr<vcl::Window> > maOwnerDrawList; //< List of system windows with owner draw decoration + std::shared_ptr<vcl::font::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 + tools::Long mnLastMouseX; //< last x mouse position + tools::Long mnLastMouseY; //< last y mouse position + tools::Long mnBeforeLastMouseX; //< last but one x mouse position + tools::Long mnBeforeLastMouseY; //< last but one y mouse position + tools::Long mnFirstMouseX; //< first x mouse position by mousebuttondown + tools::Long mnFirstMouseY; //< first y mouse position by mousebuttondown + tools::Long mnLastMouseWinX; //< last x mouse position, rel. to pMouseMoveWin + tools::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; + + bool mbInternalDragGestureRecognizer; + bool mbDragging; + 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; + + ImplAccessibleInfos(); + ~ImplAccessibleInfos(); +}; + +enum AlwaysInputMode { AlwaysInputNone = 0, AlwaysInputEnabled = 1 }; + +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( vcl::Window& rWindow, WindowType ); + ~WindowImpl(); + + VclPtr<vcl::WindowOutputDevice> mxOutDev; + std::unique_ptr<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<PushButton> 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<tools::JsonWriter&, void> maDumpAsPropertyTreeHdl; + + vcl::Cursor* mpCursor; + PointerStyle maPointer; + Fraction maZoom; + double mfPartialScrollX; + double mfPartialScrollY; + OUString maText; + std::optional<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; + tools::Long mnX; + tools::Long mnY; + tools::Long mnAbsScreenX; + Point maPos; + OUString maHelpId; + OUString maHelpText; + OUString maQuickHelpText; + OUString maID; + InputContext maInputContext; + css::uno::Reference< css::awt::XVclWindowPeer > 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, + 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 mbUseFrameData; +}; + +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; + tools::Long mnOutOffX; + tools::Long mnOutOffY; + tools::Rectangle m_aPaintRect; +public: + PaintBufferGuard(ImplFrameData* pFrameData, vcl::Window* pWindow); + ~PaintBufferGuard() COVERITY_NOEXCEPT_FALSE; + /// 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(); +}; +typedef std::unique_ptr<PaintBufferGuard, o3tl::default_delete<PaintBufferGuard>> PaintBufferGuardPtr; +} + +// helper methods + +bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, NotifyEventType nSVEvent, bool bMouseLeave, + tools::Long nX, tools::Long nY, sal_uInt64 nMsgTime, + sal_uInt16 nCode, MouseEventModifiers nMode ); + +bool ImplLOKHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, NotifyEventType nSVEvent, bool bMouseLeave, + tools::Long nX, tools::Long nY, sal_uInt64 nMsgTime, + sal_uInt16 nCode, MouseEventModifiers nMode, sal_uInt16 nClicks); + +void ImplHandleResize( vcl::Window* pWindow, tools::Long nNewWidth, tools::Long nNewHeight ); + +VCL_DLLPUBLIC css::uno::Reference<css::accessibility::XAccessibleEditableText> +FindFocusedEditableText(css::uno::Reference<css::accessibility::XAccessibleContext> const&); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/windowdev.hxx b/vcl/inc/windowdev.hxx new file mode 100644 index 0000000000..a3d535646c --- /dev/null +++ b/vcl/inc/windowdev.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 . + */ + +#pragma once + +#include <vcl/outdev.hxx> + +namespace vcl +{ +class WindowOutputDevice final : public ::OutputDevice +{ +public: + WindowOutputDevice(vcl::Window& rOwnerWindow); + virtual ~WindowOutputDevice() override; + virtual void dispose() override; + + size_t GetSyncCount() const override { return 0x000000ff; } + virtual void EnableRTL(bool bEnable = true) override; + + void Flush() override; + + void SaveBackground(VirtualDevice& rSaveDevice, const Point& rPos, const Size& rSize, + const Size&) const override; + + css::awt::DeviceInfo GetDeviceInfo() const override; + + virtual vcl::Region GetActiveClipRegion() const override; + virtual vcl::Region GetOutputBoundsClipRegion() const override; + + virtual bool AcquireGraphics() const override; + virtual void ReleaseGraphics(bool bRelease = true) override; + + Color GetBackgroundColor() const override; + + using ::OutputDevice::SetSettings; + virtual void SetSettings(const AllSettings& rSettings) override; + void SetSettings(const AllSettings& rSettings, bool bChild); + + bool CanEnableNativeWidget() const override; + + /** Get the vcl::Window that this OutputDevice belongs to, if any */ + virtual vcl::Window* GetOwnerWindow() const override { return mxOwnerWindow.get(); } + + virtual css::uno::Reference<css::rendering::XCanvas> + ImplGetCanvas(bool bSpriteCanvas) const override; + +private: + virtual void InitClipRegion() override; + + void ImplClearFontData(bool bNewFontLists) override; + void ImplRefreshFontData(bool bNewFontLists) override; + void ImplInitMapModeObjects() override; + + virtual void CopyDeviceArea(SalTwoRect& aPosAry, bool bWindowInvalidate) override; + virtual const OutputDevice* DrawOutDevDirectCheck(const OutputDevice& rSrcDev) const override; + virtual void DrawOutDevDirectProcess(const OutputDevice& rSrcDev, SalTwoRect& rPosAry, + SalGraphics* pSrcGraphics) override; + virtual void ClipToPaintRegion(tools::Rectangle& rDstRect) override; + virtual bool UsePolyPolygonForComplexGradient() override; + + VclPtr<vcl::Window> mxOwnerWindow; +}; + +}; // namespace vcl + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/wizdlg.hxx b/vcl/inc/wizdlg.hxx new file mode 100644 index 0000000000..56a9ed5261 --- /dev/null +++ b/vcl/inc/wizdlg.hxx @@ -0,0 +1,284 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 <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 final : 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 + + tools::Long LogicalCoordinateToPixel(int iCoordinate) const; + /**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 ); + void Finish( tools::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, tools::Long nOffset = 0 ); + void RemoveButton( Button* pButton ); + void AddButtonResponse( Button* pButton, int response); + + void SetPageSizePixel( const Size& rSize ) { maPageSize = rSize; } + const Size& GetPageSizePixel() const { return maPageSize; } + + void SetRoadmapHelpId( const OUString& _rId ); + void SetRoadmapBitmap( const BitmapEx& maBitmap ); + + void InsertRoadmapItem(int nIndex, const OUString& rLabel, int nId, bool bEnabled); + void DeleteRoadmapItems(); + int GetCurrentRoadmapItemID() const; + void SelectRoadmapItemByID(int nId, bool bGrabFocus = true); + void SetItemSelectHdl( const Link<LinkParamNone*,void>& _rHdl ); + void ShowRoadmap(bool bShow); + + FactoryFunction GetUITestFactory() const override; + + private: + + /// 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); + + /** 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 + void travelNext(); + + /// travel to the previous state + void travelPrevious(); + + /** 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(); } + + /** 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; + + 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; + + private: + void GetOrCreatePage(const WizardTypes::WizardState i_nState); + + 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 implConstruct( const WizardButtonFlags _nButtonFlags ); + + virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override; + }; + + /// 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 +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |