bump product version to 6.4.0.3
[LibreOffice.git] / vcl / inc / svdata.hxx
blobe41ec23488b3bc61c1eab09cf3a63dbb827f88e4
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 #ifndef INCLUDED_VCL_INC_SVDATA_HXX
21 #define INCLUDED_VCL_INC_SVDATA_HXX
23 #include <config_version.h>
25 #include <o3tl/lru_map.hxx>
26 #include <tools/fldunit.hxx>
27 #include <unotools/options.hxx>
28 #include <vcl/bitmapex.hxx>
29 #include <vcl/svapp.hxx>
30 #include <vcl/window.hxx>
31 #include <vcl/task.hxx>
32 #include <LibreOfficeKit/LibreOfficeKitTypes.h>
34 #include <com/sun/star/lang/XComponent.hpp>
35 #include <com/sun/star/i18n/XCharacterClassification.hpp>
37 #include "vcleventlisteners.hxx"
38 #include "salwtype.hxx"
39 #include "displayconnectiondispatch.hxx"
41 #include <vector>
42 #include <unordered_map>
43 #include <boost/functional/hash.hpp>
44 #include "ControlCacheKey.hxx"
45 #include "schedulerimpl.hxx"
46 #include <basegfx/DrawCommands.hxx>
48 struct ImplPostEventData;
49 struct ImplTimerData;
50 struct ImplIdleData;
51 struct ImplConfigData;
52 class ImplDirectFontSubstitution;
53 struct ImplHotKey;
54 struct ImplEventHook;
55 class Point;
56 class ImplAccelManager;
57 class PhysicalFontCollection;
58 class ImplFontCache;
59 class HelpTextWindow;
60 class ImplTBDragMgr;
61 class ImplIdleMgr;
62 class FloatingWindow;
63 class AllSettings;
64 class NotifyEvent;
65 class Timer;
66 class AutoTimer;
67 class Idle;
68 class Help;
69 class Image;
70 class PopupMenu;
71 class Application;
72 class OutputDevice;
73 class SvFileStream;
74 class SystemWindow;
75 class WorkWindow;
76 class Dialog;
77 class VirtualDevice;
78 class Printer;
79 class SalFrame;
80 class SalInstance;
81 class SalSystem;
82 class ImplPrnQueueList;
83 class UnoWrapperBase;
84 class GraphicConverter;
85 class ImplWheelWindow;
86 class SalTimer;
87 class DockingManager;
88 class VclEventListeners2;
89 class SalData;
90 class OpenGLContext;
91 class UITestLogger;
93 #define SV_ICON_ID_OFFICE 1
94 #define SV_ICON_ID_TEXT 2
95 #define SV_ICON_ID_TEXT_TEMPLATE 3
96 #define SV_ICON_ID_SPREADSHEET 4
97 #define SV_ICON_ID_SPREADSHEET_TEMPLATE 5
98 #define SV_ICON_ID_DRAWING 6
99 #define SV_ICON_ID_PRESENTATION 8
100 #define SV_ICON_ID_MASTER_DOCUMENT 10
101 #define SV_ICON_ID_TEMPLATE 11
102 #define SV_ICON_ID_DATABASE 12
103 #define SV_ICON_ID_FORMULA 13
105 namespace vcl
107 class DisplayConnectionDispatch;
108 class SettingsConfigItem;
109 class DeleteOnDeinitBase;
110 class Window;
113 namespace basegfx
115 class SystemDependentDataManager;
118 class LocaleConfigurationListener : public utl::ConfigurationListener
120 public:
121 virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, ConfigurationHints ) override;
124 typedef std::vector<Link<VclWindowEvent&,bool> > SVAppKeyListeners;
126 typedef std::pair<VclPtr<vcl::Window>, ImplPostEventData *> ImplPostEventPair;
128 struct ImplSVAppData
130 ~ImplSVAppData();
132 std::unique_ptr<AllSettings> mpSettings; // Application settings
133 LocaleConfigurationListener* mpCfgListener = nullptr;
134 VclEventListeners maEventListeners; // listeners for vcl events (eg, extended toolkit)
135 SVAppKeyListeners maKeyListeners; // listeners for key events only (eg, extended toolkit)
136 std::vector<ImplPostEventPair> maPostedEventList;
137 ImplAccelManager* mpAccelMgr; // Accelerator Manager
138 boost::optional<OUString> mxAppName; // Application name
139 boost::optional<OUString> mxAppFileName; // Abs. Application FileName
140 boost::optional<OUString> mxDisplayName; // Application Display Name
141 boost::optional<OUString> mxToolkitName; // Toolkit Name
142 Help* mpHelp = nullptr; // Application help
143 VclPtr<PopupMenu> mpActivePopupMenu; // Actives Popup-Menu (in Execute)
144 VclPtr<ImplWheelWindow> mpWheelWindow; // WheelWindow
145 sal_uInt64 mnLastInputTime = 0; // GetLastInputTime()
146 sal_uInt16 mnDispatchLevel = 0; // DispatchLevel
147 sal_uInt16 mnModalMode = 0; // ModalMode Count
148 SystemWindowFlags mnSysWinMode = SystemWindowFlags(0); // Mode, when SystemWindows should be created
149 bool mbInAppMain = false; // is Application::Main() on stack
150 bool mbInAppExecute = false; // is Application::Execute() on stack
151 bool mbAppQuit = false; // is Application::Quit() called
152 bool mbSettingsInit = false; // true: Settings are initialized
153 DialogCancelMode meDialogCancel = DialogCancelMode::Off; // true: All Dialog::Execute() calls will be terminated immediately with return false
154 bool mbRenderToBitmaps = false; // set via svp / headless plugin
156 SvFileStream* mpEventTestInput = nullptr;
157 Idle* mpEventTestingIdle = nullptr;
158 int mnEventTestLimit = 0;
160 DECL_STATIC_LINK(ImplSVAppData, ImplQuitMsg, void*, void);
161 DECL_STATIC_LINK(ImplSVAppData, ImplPrepareExitMsg, void*, void);
162 DECL_STATIC_LINK(ImplSVAppData, ImplEndAllDialogsMsg, void*, void);
163 DECL_STATIC_LINK(ImplSVAppData, ImplEndAllPopupsMsg, void*, void);
164 DECL_STATIC_LINK(ImplSVAppData, ImplVclEventTestingHdl, void*, void);
165 DECL_LINK(VclEventTestingHdl, Timer*, void);
168 struct ImplSVGDIData
170 ~ImplSVGDIData();
172 VclPtr<OutputDevice> mpFirstWinGraphics; // First OutputDevice with a Frame Graphics
173 VclPtr<OutputDevice> mpLastWinGraphics; // Last OutputDevice with a Frame Graphics
174 VclPtr<OutputDevice> mpFirstVirGraphics; // First OutputDevice with a VirtualDevice Graphics
175 VclPtr<OutputDevice> mpLastVirGraphics; // Last OutputDevice with a VirtualDevice Graphics
176 VclPtr<OutputDevice> mpFirstPrnGraphics; // First OutputDevice with an InfoPrinter Graphics
177 VclPtr<OutputDevice> mpLastPrnGraphics; // Last OutputDevice with an InfoPrinter Graphics
178 VclPtr<VirtualDevice> mpFirstVirDev; // First VirtualDevice
179 OpenGLContext* mpLastContext = nullptr; // Last OpenGLContext
180 VclPtr<Printer> mpFirstPrinter; // First Printer
181 std::unique_ptr<ImplPrnQueueList> mpPrinterQueueList; // List of all printer queue
182 std::shared_ptr<PhysicalFontCollection> mxScreenFontList; // Screen-Font-List
183 std::shared_ptr<ImplFontCache> mxScreenFontCache; // Screen-Font-Cache
184 o3tl::lru_map<SalBitmap*, BitmapEx> maScaleCache = o3tl::lru_map<SalBitmap*, BitmapEx>(10); // Cache for scaled images
185 ImplDirectFontSubstitution* mpDirectFontSubst = nullptr; // Font-Substitutions defined in Tools->Options->Fonts
186 GraphicConverter* mpGrfConverter = nullptr; // Converter for graphics
187 long mnAppFontX = 0; // AppFont X-Numenator for 40/tel Width
188 long mnAppFontY = 0; // AppFont Y-Numenator for 80/tel Height
189 bool mbFontSubChanged = false; // true: FontSubstitution was changed between Begin/End
191 o3tl::lru_map<OUString, BitmapEx> maThemeImageCache = o3tl::lru_map<OUString, BitmapEx>(10);
192 o3tl::lru_map<OUString, gfx::DrawRoot> maThemeDrawCommandsCache = o3tl::lru_map<OUString, gfx::DrawRoot>(50);
195 struct ImplSVWinData
197 ~ImplSVWinData();
198 VclPtr<vcl::Window> mpFirstFrame; // First FrameWindow
199 VclPtr<WorkWindow> mpAppWin; // Application-Window
200 VclPtr<vcl::Window> mpFocusWin; // window, that has the focus
201 VclPtr<vcl::Window> mpActiveApplicationFrame; // the last active application frame, can be used as DefModalDialogParent if no focuswin set
202 VclPtr<vcl::Window> mpCaptureWin; // window, that has the mouse capture
203 VclPtr<vcl::Window> mpLastDeacWin; // Window, that need a deactivate (FloatingWindow-Handling)
204 VclPtr<FloatingWindow> mpFirstFloat; // First FloatingWindow in PopupMode
205 std::vector<VclPtr<Dialog>> mpExecuteDialogs; ///< Stack of dialogs that are Execute()'d - the last one is the top most one.
206 VclPtr<vcl::Window> mpExtTextInputWin; // Window, which is in ExtTextInput
207 VclPtr<vcl::Window> mpTrackWin; // window, that is in tracking mode
208 AutoTimer* mpTrackTimer = nullptr; // tracking timer
209 std::vector<Image> maMsgBoxImgList; // ImageList for MessageBox
210 VclPtr<vcl::Window> mpAutoScrollWin; // window, that is in AutoScrollMode mode
211 VclPtr<vcl::Window> mpLastWheelWindow; // window, that last received a mouse wheel event
212 SalWheelMouseEvent maLastWheelEvent; // the last received mouse wheel event
214 StartTrackingFlags mnTrackFlags = StartTrackingFlags::NONE; // tracking flags
215 StartAutoScrollFlags mnAutoScrollFlags = StartAutoScrollFlags::NONE; // auto scroll flags
216 bool mbNoDeactivate = false; // true: do not execute Deactivate
217 bool mbNoSaveFocus = false; // true: menus must not save/restore focus
219 std::unique_ptr<UITestLogger> m_pUITestLogger;
222 typedef std::vector< std::pair< OUString, FieldUnit > > FieldUnitStringList;
224 struct ImplSVCtrlData
226 std::vector<Image> maCheckImgList; // ImageList for CheckBoxes
227 std::vector<Image> maRadioImgList; // ImageList for RadioButtons
228 std::unique_ptr<Image> mpDisclosurePlus;
229 std::unique_ptr<Image> mpDisclosureMinus;
230 ImplTBDragMgr* mpTBDragMgr = nullptr; // DragMgr for ToolBox
231 sal_uInt16 mnCheckStyle = 0; // CheckBox-Style for ImageList-Update
232 sal_uInt16 mnRadioStyle = 0; // Radio-Style for ImageList-Update
233 Color mnLastCheckFColor; // Last FaceColor for CheckImage
234 Color mnLastCheckWColor; // Last WindowColor for CheckImage
235 Color mnLastCheckLColor; // Last LightColor for CheckImage
236 Color mnLastRadioFColor; // Last FaceColor for RadioImage
237 Color mnLastRadioWColor; // Last WindowColor for RadioImage
238 Color mnLastRadioLColor; // Last LightColor for RadioImage
239 FieldUnitStringList maFieldUnitStrings; // list with field units
240 FieldUnitStringList maCleanUnitStrings; // same list but with some "fluff" like spaces removed
243 struct ImplSVHelpData
245 ~ImplSVHelpData();
246 bool mbContextHelp = false; // is ContextHelp enabled
247 bool mbExtHelp = false; // is ExtendedHelp enabled
248 bool mbExtHelpMode = false; // is in ExtendedHelp Mode
249 bool mbOldBalloonMode = false; // BalloonMode, before ExtHelpMode started
250 bool mbBalloonHelp = false; // is BalloonHelp enabled
251 bool mbQuickHelp = false; // is QuickHelp enabled
252 bool mbSetKeyboardHelp = false; // tiphelp was activated by keyboard
253 bool mbKeyboardHelp = false; // tiphelp was activated by keyboard
254 bool mbRequestingHelp = false; // In Window::RequestHelp
255 VclPtr<HelpTextWindow> mpHelpWin; // HelpWindow
256 sal_uInt64 mnLastHelpHideTime = 0; // ticks of last show
259 // "NWF" means "Native Widget Framework" and was the term used for the
260 // idea that StarView/OOo "widgets" should *look* (and feel) like the
261 // "native widgets" on each platform, even if not at all implemented
262 // using them. See http://people.redhat.com/dcbw/ooo-nwf.html .
264 struct ImplSVNWFData
266 int mnStatusBarLowerRightOffset = 0; // amount in pixel to avoid in the lower righthand corner
267 int mnMenuFormatBorderX = 0; // horizontal inner popup menu border
268 int mnMenuFormatBorderY = 0; // vertical inner popup menu border
269 ::Color maMenuBarHighlightTextColor = COL_TRANSPARENT; // override highlight text color
270 // in menubar if not transparent
271 bool mbMenuBarDockingAreaCommonBG = false; // e.g. WinXP default theme
272 bool mbDockingAreaSeparateTB = false; // individual toolbar backgrounds
273 // instead of one for docking area
274 bool mbDockingAreaAvoidTBFrames = false; ///< don't draw frames around the individual toolbars if mbDockingAreaSeparateTB is false
275 bool mbFlatMenu = false; // no popup 3D border
276 bool mbNoFocusRects = false; // on Aqua/Gtk3 use native focus rendering, except for flat buttons
277 bool mbNoFocusRectsForFlatButtons = false; // on Gtk3 native focusing is also preferred for flat buttons
278 bool mbCenteredTabs = false; // on Aqua, tabs are centered
279 bool mbNoActiveTabTextRaise = false; // on Aqua the text for the selected tab
280 // should not "jump up" a pixel
281 bool mbProgressNeedsErase = false; // set true for platforms that should draw the
282 // window background before drawing the native
283 // progress bar
284 bool mbCanDrawWidgetAnySize = false; // set to true currently on gtk
286 /// entire drop down listbox resembles a button, no textarea/button parts (as currently on Windows)
287 bool mbDDListBoxNoTextArea = false;
288 bool mbAutoAccel = false; // whether accelerators are only shown when Alt is held down
289 bool mbRolloverMenubar = false; // theming engine supports rollover in menubar
290 // gnome#768128 I cannot see a route under wayland at present to support
291 // floating toolbars that can be redocked because there's no way to track
292 // that the toolbar is over a dockable area.
293 bool mbCanDetermineWindowPosition = true;
295 int mnListBoxEntryMargin = 0;
298 struct BlendFrameCache
300 Size m_aLastSize;
301 sal_uInt8 m_nLastAlpha;
302 Color m_aLastColorTopLeft;
303 Color m_aLastColorTopRight;
304 Color m_aLastColorBottomRight;
305 Color m_aLastColorBottomLeft;
306 BitmapEx m_aLastResult;
308 BlendFrameCache()
309 : m_aLastSize(0, 0)
310 , m_nLastAlpha(0)
311 , m_aLastColorTopLeft(COL_BLACK)
312 , m_aLastColorTopRight(COL_BLACK)
313 , m_aLastColorBottomRight(COL_BLACK)
314 , m_aLastColorBottomLeft(COL_BLACK)
319 struct ImplSchedulerContext
321 ImplSchedulerData* mpFirstSchedulerData[PRIO_COUNT] = { nullptr, }; ///< list of all active tasks per priority
322 ImplSchedulerData* mpLastSchedulerData[PRIO_COUNT] = { nullptr, }; ///< last item of each mpFirstSchedulerData list
323 ImplSchedulerData* mpSchedulerStack = nullptr; ///< stack of invoked tasks
324 ImplSchedulerData* mpSchedulerStackTop = nullptr; ///< top most stack entry to detect needed rescheduling during pop
325 SalTimer* mpSalTimer = nullptr; ///< interface to sal event loop / system timer
326 sal_uInt64 mnTimerStart = 0; ///< start time of the timer
327 sal_uInt64 mnTimerPeriod = SAL_MAX_UINT64; ///< current timer period
328 SchedulerMutex maMutex; ///< lock counting mutex for scheduler locking
329 bool mbActive = true; ///< is the scheduler active?
332 struct ImplSVData
334 ~ImplSVData();
335 SalData* mpSalData = nullptr;
336 SalInstance* mpDefInst = nullptr; // Default SalInstance
337 Application* mpApp = nullptr; // pApp
338 VclPtr<WorkWindow> mpDefaultWin; // Default-Window
339 bool mbDeInit = false; // Is VCL deinitializing
340 std::unique_ptr<SalSystem> mpSalSystem; // SalSystem interface
341 int mnFontUpdatesLockCount = 0; // avoid repeated font updates
342 bool mbFontUpdatesPending = false; // need to update font data after unlock
343 bool mbFontUpdatesNewLists = false; // generate new font lists
344 bool mbResLocaleSet = false; // SV-Resource-Manager
345 std::locale maResLocale; // Resource locale
346 ImplSchedulerContext maSchedCtx; // indepen data for class Scheduler
347 ImplSVAppData maAppData; // indepen data for class Application
348 ImplSVGDIData maGDIData; // indepen data for Output classes
349 ImplSVWinData maWinData; // indepen data for Windows classes
350 ImplSVCtrlData maCtrlData; // indepen data for Control classes
351 ImplSVHelpData maHelpData; // indepen data for Help classes
352 ImplSVNWFData maNWFData;
353 UnoWrapperBase* mpUnoWrapper = nullptr;
354 VclPtr<vcl::Window> mpIntroWindow; // the splash screen
355 std::unique_ptr<DockingManager> mpDockingManager;
356 std::unique_ptr<BlendFrameCache> mpBlendFrameCache;
358 oslThreadIdentifier mnMainThreadId = 0;
359 rtl::Reference< vcl::DisplayConnectionDispatch > mxDisplayConnection;
361 css::uno::Reference< css::lang::XComponent > mxAccessBridge;
362 std::unique_ptr<vcl::SettingsConfigItem> mpSettingsConfigItem;
363 std::vector< vcl::DeleteOnDeinitBase* > maDeinitDeleteList;
364 std::unordered_map< int, OUString > maPaperNames;
366 css::uno::Reference<css::i18n::XCharacterClassification> m_xCharClass;
368 Link<LinkParamNone*,void> maDeInitHook;
370 // LOK & headless backend specific hooks
371 LibreOfficeKitPollCallback mpPollCallback = nullptr;
372 LibreOfficeKitWakeCallback mpWakeCallback = nullptr;
373 void *mpPollClosure = nullptr;
376 css::uno::Reference<css::i18n::XCharacterClassification> const& ImplGetCharClass();
378 void ImplDeInitSVData();
379 VCL_PLUGIN_PUBLIC basegfx::SystemDependentDataManager& ImplGetSystemDependentDataManager();
380 VCL_PLUGIN_PUBLIC vcl::Window* ImplGetDefaultWindow();
381 vcl::Window* ImplGetDefaultContextWindow();
382 const std::locale& ImplGetResLocale();
383 VCL_PLUGIN_PUBLIC OUString VclResId(const char* pId);
384 DockingManager* ImplGetDockingManager();
385 BlendFrameCache* ImplGetBlendFrameCache();
387 VCL_DLLPUBLIC bool ImplCallPreNotify( NotifyEvent& rEvt );
389 VCL_PLUGIN_PUBLIC ImplSVData* ImplGetSVData();
390 VCL_PLUGIN_PUBLIC void ImplHideSplash();
392 #ifdef _WIN32
393 bool ImplInitAccessBridge();
394 #endif
396 const FieldUnitStringList& ImplGetFieldUnits();
397 const FieldUnitStringList& ImplGetCleanedFieldUnits();
399 struct ImplSVEvent
401 void* mpData;
402 Link<void*,void> maLink;
403 VclPtr<vcl::Window> mpInstanceRef;
404 VclPtr<vcl::Window> mpWindow;
405 bool mbCall;
408 extern int nImplSysDialog;
410 #endif // INCLUDED_VCL_INC_SVDATA_HXX
412 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */