Avoid potential negative array index access to cached text.
[LibreOffice.git] / vcl / inc / unx / salinst.h
blobe8f24e255c912badace56f0e01eee424614a5420
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
22 #include <salinst.hxx>
23 #include <unx/geninst.h>
25 #include <X11/X.h>
27 namespace com::sun::star::datatransfer::clipboard { class XClipboard; }
28 class SalXLib;
29 class X11SalGraphics;
30 class SalX11Display;
32 class X11SalInstance final : public SalGenericInstance
34 private:
35 std::unordered_map< Atom, css::uno::Reference< css::datatransfer::clipboard::XClipboard > > m_aInstances;
37 SalXLib *mpXLib;
39 virtual SalX11Display* CreateDisplay() const;
41 public:
42 explicit X11SalInstance(std::unique_ptr<SalYieldMutex> pMutex);
43 virtual ~X11SalInstance() override;
45 virtual SalFrame* CreateChildFrame( SystemParentData* pParent, SalFrameStyleFlags nStyle ) override;
46 virtual SalFrame* CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ) override;
47 virtual void DestroyFrame( SalFrame* pFrame ) override;
49 virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow ) override;
50 virtual void DestroyObject( SalObject* pObject ) override;
52 /// Gtk vclplug needs to pass GtkSalGraphics to X11SalVirtualDevice, so create it, and pass as pNewGraphics.
53 static std::unique_ptr<SalVirtualDevice> CreateX11VirtualDevice(const SalGraphics& rGraphics, tools::Long &nDX, tools::Long &nDY,
54 DeviceFormat eFormat, const SystemGraphicsData* pData, std::unique_ptr<X11SalGraphics> pNewGraphics);
56 virtual std::unique_ptr<SalVirtualDevice>
57 CreateVirtualDevice( SalGraphics& rGraphics,
58 tools::Long &nDX, tools::Long &nDY,
59 DeviceFormat eFormat, const SystemGraphicsData *pData = nullptr ) override;
60 virtual void PostPrintersChanged() override;
61 virtual std::unique_ptr<GenPspGraphics> CreatePrintGraphics() override;
63 virtual SalTimer* CreateSalTimer() override;
64 virtual SalSystem* CreateSalSystem() override;
65 virtual std::shared_ptr<SalBitmap> CreateSalBitmap() override;
66 virtual std::unique_ptr<SalSession> CreateSalSession() override;
67 virtual OpenGLContext* CreateOpenGLContext() override;
69 virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents) override;
70 virtual bool AnyInput( VclInputFlags nType ) override;
71 virtual bool IsMainThread() const override { return true; }
73 virtual OUString GetConnectionIdentifier() override;
74 void SetLib( SalXLib *pXLib ) { mpXLib = pXLib; }
76 virtual void AfterAppInit() override;
78 // dtrans implementation
79 virtual css::uno::Reference< css::uno::XInterface >
80 CreateClipboard( const css::uno::Sequence< css::uno::Any >& i_rArguments ) override;
81 virtual css::uno::Reference<css::uno::XInterface> ImplCreateDragSource(const SystemEnvData*) override;
82 virtual css::uno::Reference<css::uno::XInterface> ImplCreateDropTarget(const SystemEnvData*) override;
83 virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) override;
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */