cid#1636690 Dereference after null check
[LibreOffice.git] / sfx2 / source / inc / appdata.hxx
blob400dcae776d6e2bc88643b8bcb63e8aa524cedc9
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 .
19 #ifndef INCLUDED_SFX2_SOURCE_INC_APPDATA_HXX
20 #define INCLUDED_SFX2_SOURCE_INC_APPDATA_HXX
22 #include <config_features.h>
24 #include <rtl/ref.hxx>
25 #include <rtl/ustring.hxx>
26 #include <svl/svdde.hxx>
27 #include <svtools/ehdl.hxx>
28 #include <sfx2/app.hxx>
29 #include <sfx2/dispatch.hxx>
30 #include <sfx2/doctempl.hxx>
31 #include <sfx2/fcontnr.hxx>
32 #include <sfx2/msgpool.hxx>
33 #include <o3tl/enumarray.hxx>
34 #include "sfxpicklist.hxx"
35 #include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
37 #include <bitset.hxx>
38 #include <memory>
39 #include <vector>
41 class SfxApplication;
42 class SfxProgress;
43 class SfxDdeDocTopic_Impl;
44 class DdeService;
45 class SfxItemPool;
46 class SfxFilterMatcher;
47 class ISfxTemplateCommon;
48 class SfxStatusDispatcher;
49 class SfxDdeTriggerTopic_Impl;
50 class SfxFrame;
51 class SfxViewFrame;
52 class SfxInterface;
53 class BasicManager;
54 class SfxBasicManagerHolder;
55 class SfxBasicManagerCreationListener;
56 namespace sfx2::sidebar { class Theme; }
60 class SfxAppData_Impl
62 public:
63 IndexBitSet aIndexBitSet; // for counting noname documents
64 OUString aLastDir; // for IO dialog
66 // DDE stuff
67 std::unique_ptr<DdeService> pDdeService;
68 std::vector<SfxDdeDocTopic_Impl*> maDocTopics;
69 std::unique_ptr<SfxDdeTriggerTopic_Impl> pTriggerTopic;
70 std::unique_ptr<DdeService> pDdeService2;
72 // single instance classes
73 std::vector<SfxChildWinFactory> maFactories;
74 std::vector<SfxFrame*> vTopFrames;
76 // application members
77 std::optional<SfxFilterMatcher> pMatcher;
78 std::optional<SfxErrorHandler> m_pToolsErrorHdl;
79 std::optional<SfxErrorHandler> m_pSoErrorHdl;
80 #if HAVE_FEATURE_SCRIPTING
81 std::optional<SfxErrorHandler> m_pSbxErrorHdl;
82 #endif
83 rtl::Reference<SfxStatusDispatcher> mxAppDispatch;
84 std::optional<SfxPickList> mxAppPickList;
85 std::optional<SfxDocumentTemplates> pTemplates;
87 // global pointers
88 SfxItemPool* pPool;
90 // "current" functionality
91 SfxProgress* pProgress;
93 sal_uInt16 nDocModalMode; // counts documents in modal mode
94 sal_uInt16 nRescheduleLocks;
96 std::vector<SfxTbxCtrlFactory>
97 maTbxCtrlFactories;
98 std::vector<SfxStbCtrlFactory>
99 maStbCtrlFactories;
100 std::vector<SfxViewFrame*> maViewFrames;
101 std::vector<SfxViewShell*> maViewShells;
102 std::unordered_map<OUString, css::uno::Reference<css::ui::XAcceleratorConfiguration>> maAcceleratorConfs;
103 std::vector<SfxObjectShell*>
104 maObjShells;
105 std::unique_ptr<SfxBasicManagerHolder>
106 pBasicManager;
107 std::unique_ptr<SfxBasicManagerCreationListener>
108 pBasMgrListener;
109 SfxViewFrame* pViewFrame;
110 std::optional<SfxSlotPool> pSlotPool;
111 std::optional<SfxDispatcher>
112 pAppDispat; // Dispatcher if no document
113 ::rtl::Reference<sfx2::sidebar::Theme> m_pSidebarTheme;
115 bool bDowning:1; // sal_True on Exit and afterwards
116 bool bInQuit : 1;
117 bool bClosingDocs : 1;
119 SfxAppData_Impl();
120 ~SfxAppData_Impl();
122 SfxDocumentTemplates* GetDocumentTemplates();
123 void DeInitDDE();
125 o3tl::enumarray<SfxToolsModule, std::unique_ptr<SfxModule>> aModules;
127 /** called when the Application's BasicManager has been created. This can happen
128 explicitly in SfxApplication::GetBasicManager, or implicitly if a document's
129 BasicManager is created before the application's BasicManager exists.
131 void OnApplicationBasicManagerCreated( BasicManager& _rManager );
134 class SfxDdeTriggerTopic_Impl final : public DdeTopic
136 #if defined(_WIN32)
137 public:
138 SfxDdeTriggerTopic_Impl()
139 : DdeTopic( "TRIGGER" )
142 virtual bool Execute( const OUString* ) override { return true; }
143 #endif
146 #endif // INCLUDED_SFX2_SOURCE_INC_APPDATA_HXX
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */