/src/libreoffice/sfx2/source/appl/appcfg.cxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #include <memory> |
21 | | #include <osl/file.hxx> |
22 | | |
23 | | #include <rtl/ustring.hxx> |
24 | | #include <svl/itempool.hxx> |
25 | | #include <svl/itemset.hxx> |
26 | | #include <svl/slstitm.hxx> |
27 | | #include <svl/stritem.hxx> |
28 | | #include <svl/intitem.hxx> |
29 | | #include <svl/eitem.hxx> |
30 | | #include <svl/undo.hxx> |
31 | | #include <svl/whiter.hxx> |
32 | | |
33 | | #include <sfx2/sfxsids.hrc> |
34 | | |
35 | | #include <officecfg/Inet.hxx> |
36 | | #include <officecfg/Office/Common.hxx> |
37 | | #include <officecfg/Office/Recovery.hxx> |
38 | | #include <unotools/securityoptions.hxx> |
39 | | #include <unotools/pathoptions.hxx> |
40 | | #include <svtools/miscopt.hxx> |
41 | | #include <svtools/imgdef.hxx> |
42 | | #include <sal/log.hxx> |
43 | | #include <vcl/idle.hxx> |
44 | | |
45 | | #include <sfx2/app.hxx> |
46 | | #include <sfx2/event.hxx> |
47 | | #include <sfx2/viewfrm.hxx> |
48 | | #include <sfx2/dispatch.hxx> |
49 | | #include <sfx2/objsh.hxx> |
50 | | #include <comphelper/lok.hxx> |
51 | | #include <objshimp.hxx> |
52 | | #include <shutdownicon.hxx> |
53 | | |
54 | | using namespace ::com::sun::star::uno; |
55 | | |
56 | | namespace { |
57 | | |
58 | | class SfxEventAsyncer_Impl : public SfxListener |
59 | | { |
60 | | SfxEventHint aHint; |
61 | | std::unique_ptr<Idle> pIdle; |
62 | | |
63 | | public: |
64 | | |
65 | | virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; |
66 | | explicit SfxEventAsyncer_Impl(const SfxEventHint& rHint); |
67 | | ~SfxEventAsyncer_Impl(); |
68 | | DECL_LINK( IdleHdl, Timer*, void ); |
69 | | }; |
70 | | |
71 | | } |
72 | | |
73 | | void SfxEventAsyncer_Impl::Notify( SfxBroadcaster&, const SfxHint& rHint ) |
74 | 0 | { |
75 | 0 | if( rHint.GetId() == SfxHintId::Dying && pIdle->IsActive() ) |
76 | 0 | { |
77 | 0 | pIdle->Stop(); |
78 | 0 | delete this; |
79 | 0 | } |
80 | 0 | } |
81 | | |
82 | | |
83 | | SfxEventAsyncer_Impl::SfxEventAsyncer_Impl( const SfxEventHint& rHint ) |
84 | 0 | : aHint( rHint ) |
85 | 0 | { |
86 | 0 | if( rHint.GetObjShell() ) |
87 | 0 | StartListening( *rHint.GetObjShell() ); |
88 | 0 | pIdle.reset( new Idle("sfx::SfxEventAsyncer_Impl pIdle") ); |
89 | 0 | pIdle->SetInvokeHandler( LINK(this, SfxEventAsyncer_Impl, IdleHdl) ); |
90 | 0 | pIdle->SetPriority( TaskPriority::HIGH_IDLE ); |
91 | 0 | pIdle->Start(); |
92 | 0 | } |
93 | | |
94 | | |
95 | | SfxEventAsyncer_Impl::~SfxEventAsyncer_Impl() |
96 | 0 | { |
97 | 0 | if (aHint.GetObjShell()) |
98 | 0 | EndListening(*aHint.GetObjShell()); |
99 | 0 | } |
100 | | |
101 | | |
102 | | IMPL_LINK(SfxEventAsyncer_Impl, IdleHdl, Timer*, pAsyncIdle, void) |
103 | 0 | { |
104 | 0 | SfxObjectShellRef xRef( aHint.GetObjShell() ); |
105 | 0 | pAsyncIdle->Stop(); |
106 | 0 | SAL_INFO_IF(!xRef.is(), "sfx.appl", "SfxEvent: " << aHint.GetEventName()); |
107 | 0 | SfxGetpApp()->Broadcast( aHint ); |
108 | 0 | if ( xRef.is() ) |
109 | 0 | xRef->Broadcast( aHint ); |
110 | 0 | delete this; |
111 | 0 | } |
112 | | |
113 | | namespace |
114 | | { |
115 | | template <class Cfg, class Item> bool toSet(SfxItemSet& rSet, TypedWhichId<Item> wid) |
116 | 0 | { |
117 | 0 | return rSet.Put(Item(wid, Cfg::get())); |
118 | 0 | } Unexecuted instantiation: appcfg.cxx:bool (anonymous namespace)::toSet<officecfg::Office::Common::Save::Document::BackupIntoDocumentFolder, SfxBoolItem>(SfxItemSet&, TypedWhichId<SfxBoolItem>) Unexecuted instantiation: appcfg.cxx:bool (anonymous namespace)::toSet<officecfg::Office::Common::Save::Document::PrettyPrinting, SfxBoolItem>(SfxItemSet&, TypedWhichId<SfxBoolItem>) Unexecuted instantiation: appcfg.cxx:bool (anonymous namespace)::toSet<officecfg::Office::Common::Save::Document::WarnAlienFormat, SfxBoolItem>(SfxItemSet&, TypedWhichId<SfxBoolItem>) Unexecuted instantiation: appcfg.cxx:bool (anonymous namespace)::toSet<officecfg::Office::Recovery::AutoSave::Enabled, SfxBoolItem>(SfxItemSet&, TypedWhichId<SfxBoolItem>) Unexecuted instantiation: appcfg.cxx:bool (anonymous namespace)::toSet<officecfg::Office::Recovery::AutoSave::TimeIntervall, SfxUInt16Item>(SfxItemSet&, TypedWhichId<SfxUInt16Item>) Unexecuted instantiation: appcfg.cxx:bool (anonymous namespace)::toSet<officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled, SfxBoolItem>(SfxItemSet&, TypedWhichId<SfxBoolItem>) Unexecuted instantiation: appcfg.cxx:bool (anonymous namespace)::toSet<officecfg::Office::Common::Save::Document::EditProperty, SfxBoolItem>(SfxItemSet&, TypedWhichId<SfxBoolItem>) Unexecuted instantiation: appcfg.cxx:bool (anonymous namespace)::toSet<officecfg::Office::Common::Save::URL::Internet, SfxBoolItem>(SfxItemSet&, TypedWhichId<SfxBoolItem>) Unexecuted instantiation: appcfg.cxx:bool (anonymous namespace)::toSet<officecfg::Office::Common::Save::URL::FileSystem, SfxBoolItem>(SfxItemSet&, TypedWhichId<SfxBoolItem>) Unexecuted instantiation: appcfg.cxx:bool (anonymous namespace)::toSet<officecfg::Inet::Settings::ooInetHTTPProxyName, SfxStringItem>(SfxItemSet&, TypedWhichId<SfxStringItem>) Unexecuted instantiation: appcfg.cxx:bool (anonymous namespace)::toSet<officecfg::Inet::Settings::ooInetNoProxy, SfxStringItem>(SfxItemSet&, TypedWhichId<SfxStringItem>) |
119 | | template <class Cfg, class Item, class Val> |
120 | | bool toSet_withDefault(SfxItemSet& rSet, TypedWhichId<Item> wid, Val&& defVal) |
121 | 0 | { |
122 | 0 | return rSet.Put(Item(wid, Cfg::get().value_or(std::move(defVal)))); |
123 | 0 | } |
124 | | template <class Cfg, class Item> bool toSet_ifRW(SfxItemSet& rSet, TypedWhichId<Item> wid) |
125 | 0 | { |
126 | 0 | return Cfg::isReadOnly() || toSet<Cfg>(rSet, wid); |
127 | 0 | } Unexecuted instantiation: appcfg.cxx:bool (anonymous namespace)::toSet_ifRW<officecfg::Office::Common::Save::Document::BackupIntoDocumentFolder, SfxBoolItem>(SfxItemSet&, TypedWhichId<SfxBoolItem>) Unexecuted instantiation: appcfg.cxx:bool (anonymous namespace)::toSet_ifRW<officecfg::Office::Common::Save::Document::PrettyPrinting, SfxBoolItem>(SfxItemSet&, TypedWhichId<SfxBoolItem>) Unexecuted instantiation: appcfg.cxx:bool (anonymous namespace)::toSet_ifRW<officecfg::Office::Common::Save::Document::WarnAlienFormat, SfxBoolItem>(SfxItemSet&, TypedWhichId<SfxBoolItem>) Unexecuted instantiation: appcfg.cxx:bool (anonymous namespace)::toSet_ifRW<officecfg::Office::Recovery::AutoSave::Enabled, SfxBoolItem>(SfxItemSet&, TypedWhichId<SfxBoolItem>) Unexecuted instantiation: appcfg.cxx:bool (anonymous namespace)::toSet_ifRW<officecfg::Office::Recovery::AutoSave::TimeIntervall, SfxUInt16Item>(SfxItemSet&, TypedWhichId<SfxUInt16Item>) Unexecuted instantiation: appcfg.cxx:bool (anonymous namespace)::toSet_ifRW<officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled, SfxBoolItem>(SfxItemSet&, TypedWhichId<SfxBoolItem>) Unexecuted instantiation: appcfg.cxx:bool (anonymous namespace)::toSet_ifRW<officecfg::Office::Common::Save::Document::EditProperty, SfxBoolItem>(SfxItemSet&, TypedWhichId<SfxBoolItem>) Unexecuted instantiation: appcfg.cxx:bool (anonymous namespace)::toSet_ifRW<officecfg::Office::Common::Save::URL::Internet, SfxBoolItem>(SfxItemSet&, TypedWhichId<SfxBoolItem>) Unexecuted instantiation: appcfg.cxx:bool (anonymous namespace)::toSet_ifRW<officecfg::Office::Common::Save::URL::FileSystem, SfxBoolItem>(SfxItemSet&, TypedWhichId<SfxBoolItem>) |
128 | | |
129 | | template <class Cfg, class Item> |
130 | | void toCfg_ifSet(const SfxItemSet& rSet, TypedWhichId<Item> wid, |
131 | | std::shared_ptr<comphelper::ConfigurationChanges> const& batch) |
132 | 0 | { |
133 | 0 | if (const auto* pItem = rSet.GetItemIfSet(wid)) |
134 | 0 | Cfg::set(pItem->GetValue(), batch); |
135 | 0 | } Unexecuted instantiation: appcfg.cxx:void (anonymous namespace)::toCfg_ifSet<officecfg::Office::Common::Save::Document::CreateBackup, SfxBoolItem>(SfxItemSet const&, TypedWhichId<SfxBoolItem>, std::__1::shared_ptr<comphelper::ConfigurationChanges> const&) Unexecuted instantiation: appcfg.cxx:void (anonymous namespace)::toCfg_ifSet<officecfg::Office::Common::Save::Document::BackupIntoDocumentFolder, SfxBoolItem>(SfxItemSet const&, TypedWhichId<SfxBoolItem>, std::__1::shared_ptr<comphelper::ConfigurationChanges> const&) Unexecuted instantiation: appcfg.cxx:void (anonymous namespace)::toCfg_ifSet<officecfg::Office::Common::Save::Document::PrettyPrinting, SfxBoolItem>(SfxItemSet const&, TypedWhichId<SfxBoolItem>, std::__1::shared_ptr<comphelper::ConfigurationChanges> const&) Unexecuted instantiation: appcfg.cxx:void (anonymous namespace)::toCfg_ifSet<officecfg::Office::Common::Save::Document::WarnAlienFormat, SfxBoolItem>(SfxItemSet const&, TypedWhichId<SfxBoolItem>, std::__1::shared_ptr<comphelper::ConfigurationChanges> const&) Unexecuted instantiation: appcfg.cxx:void (anonymous namespace)::toCfg_ifSet<officecfg::Office::Recovery::AutoSave::Enabled, SfxBoolItem>(SfxItemSet const&, TypedWhichId<SfxBoolItem>, std::__1::shared_ptr<comphelper::ConfigurationChanges> const&) Unexecuted instantiation: appcfg.cxx:void (anonymous namespace)::toCfg_ifSet<officecfg::Office::Recovery::AutoSave::TimeIntervall, SfxUInt16Item>(SfxItemSet const&, TypedWhichId<SfxUInt16Item>, std::__1::shared_ptr<comphelper::ConfigurationChanges> const&) Unexecuted instantiation: appcfg.cxx:void (anonymous namespace)::toCfg_ifSet<officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled, SfxBoolItem>(SfxItemSet const&, TypedWhichId<SfxBoolItem>, std::__1::shared_ptr<comphelper::ConfigurationChanges> const&) Unexecuted instantiation: appcfg.cxx:void (anonymous namespace)::toCfg_ifSet<officecfg::Office::Common::Save::Document::EditProperty, SfxBoolItem>(SfxItemSet const&, TypedWhichId<SfxBoolItem>, std::__1::shared_ptr<comphelper::ConfigurationChanges> const&) Unexecuted instantiation: appcfg.cxx:void (anonymous namespace)::toCfg_ifSet<officecfg::Office::Common::Help::ExtendedTip, SfxBoolItem>(SfxItemSet const&, TypedWhichId<SfxBoolItem>, std::__1::shared_ptr<comphelper::ConfigurationChanges> const&) Unexecuted instantiation: appcfg.cxx:void (anonymous namespace)::toCfg_ifSet<officecfg::Office::Common::Help::Tip, SfxBoolItem>(SfxItemSet const&, TypedWhichId<SfxBoolItem>, std::__1::shared_ptr<comphelper::ConfigurationChanges> const&) Unexecuted instantiation: appcfg.cxx:void (anonymous namespace)::toCfg_ifSet<officecfg::Office::Common::Save::URL::Internet, SfxBoolItem>(SfxItemSet const&, TypedWhichId<SfxBoolItem>, std::__1::shared_ptr<comphelper::ConfigurationChanges> const&) Unexecuted instantiation: appcfg.cxx:void (anonymous namespace)::toCfg_ifSet<officecfg::Office::Common::Save::URL::FileSystem, SfxBoolItem>(SfxItemSet const&, TypedWhichId<SfxBoolItem>, std::__1::shared_ptr<comphelper::ConfigurationChanges> const&) Unexecuted instantiation: appcfg.cxx:void (anonymous namespace)::toCfg_ifSet<officecfg::Inet::Settings::ooInetProxyType, SfxUInt16Item>(SfxItemSet const&, TypedWhichId<SfxUInt16Item>, std::__1::shared_ptr<comphelper::ConfigurationChanges> const&) Unexecuted instantiation: appcfg.cxx:void (anonymous namespace)::toCfg_ifSet<officecfg::Inet::Settings::ooInetHTTPProxyName, SfxStringItem>(SfxItemSet const&, TypedWhichId<SfxStringItem>, std::__1::shared_ptr<comphelper::ConfigurationChanges> const&) Unexecuted instantiation: appcfg.cxx:void (anonymous namespace)::toCfg_ifSet<officecfg::Inet::Settings::ooInetHTTPProxyPort, SfxInt32Item>(SfxItemSet const&, TypedWhichId<SfxInt32Item>, std::__1::shared_ptr<comphelper::ConfigurationChanges> const&) Unexecuted instantiation: appcfg.cxx:void (anonymous namespace)::toCfg_ifSet<officecfg::Inet::Settings::ooInetNoProxy, SfxStringItem>(SfxItemSet const&, TypedWhichId<SfxStringItem>, std::__1::shared_ptr<comphelper::ConfigurationChanges> const&) |
136 | | } |
137 | | |
138 | | void SfxApplication::GetOptions( SfxItemSet& rSet ) |
139 | 0 | { |
140 | 0 | SfxWhichIter iter(rSet); |
141 | 0 | for (auto nWhich = iter.FirstWhich(); nWhich; nWhich = iter.NextWhich()) |
142 | 0 | { |
143 | 0 | bool bRet = false; |
144 | 0 | switch(nWhich) |
145 | 0 | { |
146 | 0 | case SID_ATTR_BACKUP: |
147 | 0 | bRet = true; |
148 | 0 | if (!officecfg::Office::Common::Save::Document::CreateBackup::isReadOnly()) |
149 | 0 | if (!rSet.Put( SfxBoolItem( SID_ATTR_BACKUP, |
150 | 0 | (officecfg::Office::Common::Save::Document::CreateBackup::get() && !comphelper::LibreOfficeKit::isActive()) ))) |
151 | 0 | bRet = false; |
152 | 0 | break; |
153 | 0 | case SID_ATTR_BACKUP_BESIDE_ORIGINAL: |
154 | 0 | bRet = toSet_ifRW<officecfg::Office::Common::Save::Document::BackupIntoDocumentFolder>( |
155 | 0 | rSet, SID_ATTR_BACKUP_BESIDE_ORIGINAL); |
156 | 0 | break; |
157 | 0 | case SID_ATTR_PRETTYPRINTING: |
158 | 0 | bRet = toSet_ifRW<officecfg::Office::Common::Save::Document::PrettyPrinting>( |
159 | 0 | rSet, SID_ATTR_PRETTYPRINTING); |
160 | 0 | break; |
161 | 0 | case SID_ATTR_WARNALIENFORMAT: |
162 | 0 | bRet = toSet_ifRW<officecfg::Office::Common::Save::Document::WarnAlienFormat>( |
163 | 0 | rSet, SID_ATTR_WARNALIENFORMAT); |
164 | 0 | break; |
165 | 0 | case SID_ATTR_AUTOSAVE: |
166 | 0 | bRet = toSet_ifRW<officecfg::Office::Recovery::AutoSave::Enabled>( |
167 | 0 | rSet, SID_ATTR_AUTOSAVE); |
168 | 0 | break; |
169 | 0 | case SID_ATTR_AUTOSAVEMINUTE: |
170 | 0 | bRet = toSet_ifRW<officecfg::Office::Recovery::AutoSave::TimeIntervall>( |
171 | 0 | rSet, SID_ATTR_AUTOSAVEMINUTE); |
172 | 0 | break; |
173 | 0 | case SID_ATTR_USERAUTOSAVE: |
174 | 0 | bRet = toSet_ifRW<officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled>( |
175 | 0 | rSet, SID_ATTR_USERAUTOSAVE); |
176 | 0 | break; |
177 | 0 | case SID_ATTR_DOCINFO: |
178 | 0 | bRet = toSet_ifRW<officecfg::Office::Common::Save::Document::EditProperty>( |
179 | 0 | rSet, SID_ATTR_DOCINFO); |
180 | 0 | break; |
181 | 0 | case SID_ATTR_QUICKLAUNCHER: |
182 | 0 | if ( ShutdownIcon::IsQuickstarterInstalled() ) |
183 | 0 | { |
184 | 0 | if ( rSet.Put( SfxBoolItem( SID_ATTR_QUICKLAUNCHER, |
185 | 0 | ShutdownIcon::GetAutostart() ) ) ) |
186 | 0 | bRet = true; |
187 | 0 | } |
188 | 0 | else |
189 | 0 | { |
190 | 0 | rSet.DisableItem( SID_ATTR_QUICKLAUNCHER ); |
191 | 0 | bRet = true; |
192 | 0 | } |
193 | 0 | break; |
194 | 0 | case SID_SAVEREL_INET: |
195 | 0 | bRet = toSet_ifRW<officecfg::Office::Common::Save::URL::Internet>( |
196 | 0 | rSet, SID_SAVEREL_INET); |
197 | 0 | break; |
198 | 0 | case SID_SAVEREL_FSYS: |
199 | 0 | bRet = toSet_ifRW<officecfg::Office::Common::Save::URL::FileSystem>( |
200 | 0 | rSet, SID_SAVEREL_FSYS); |
201 | 0 | break; |
202 | 0 | case SID_SECURE_URL: |
203 | 0 | bRet = true; |
204 | 0 | if (!SvtSecurityOptions::IsReadOnly(SvtSecurityOptions::EOption::SecureUrls)) |
205 | 0 | { |
206 | 0 | std::vector< OUString > seqURLs = SvtSecurityOptions::GetSecureURLs(); |
207 | |
|
208 | 0 | if( !rSet.Put( SfxStringListItem( SID_SECURE_URL, &seqURLs ) ) ) |
209 | 0 | bRet = false; |
210 | 0 | } |
211 | 0 | break; |
212 | 0 | case SID_INET_HTTP_PROXY_NAME: |
213 | 0 | bRet = toSet<officecfg::Inet::Settings::ooInetHTTPProxyName>( |
214 | 0 | rSet, SID_INET_HTTP_PROXY_NAME); |
215 | 0 | break; |
216 | 0 | case SID_INET_HTTP_PROXY_PORT: |
217 | 0 | bRet = toSet_withDefault<officecfg::Inet::Settings::ooInetHTTPProxyPort>( |
218 | 0 | rSet, SID_INET_HTTP_PROXY_PORT, 0); |
219 | 0 | break; |
220 | 0 | case SID_INET_NOPROXY: |
221 | 0 | bRet = toSet<officecfg::Inet::Settings::ooInetNoProxy>(rSet, SID_INET_NOPROXY); |
222 | 0 | break; |
223 | | |
224 | 0 | default: |
225 | 0 | SAL_INFO( "sfx.appl", "W1:Wrong ID while getting Options!" ); |
226 | 0 | break; |
227 | 0 | } |
228 | 0 | SAL_WARN_IF(!bRet, "sfx.appl", "Putting options failed!"); |
229 | 0 | } |
230 | 0 | } |
231 | | |
232 | | void SfxApplication::SetOptions(const SfxItemSet &rSet) |
233 | 0 | { |
234 | 0 | std::shared_ptr< comphelper::ConfigurationChanges > batch( |
235 | 0 | comphelper::ConfigurationChanges::create()); |
236 | | |
237 | | // Backup |
238 | 0 | toCfg_ifSet<officecfg::Office::Common::Save::Document::CreateBackup>( |
239 | 0 | rSet, SID_ATTR_BACKUP, batch); |
240 | |
|
241 | 0 | toCfg_ifSet<officecfg::Office::Common::Save::Document::BackupIntoDocumentFolder>( |
242 | 0 | rSet, SID_ATTR_BACKUP_BESIDE_ORIGINAL, batch); |
243 | | |
244 | | // PrettyPrinting |
245 | 0 | toCfg_ifSet<officecfg::Office::Common::Save::Document::PrettyPrinting>( |
246 | 0 | rSet, SID_ATTR_PRETTYPRINTING, batch); |
247 | | |
248 | | // WarnAlienFormat |
249 | 0 | toCfg_ifSet<officecfg::Office::Common::Save::Document::WarnAlienFormat>( |
250 | 0 | rSet, SID_ATTR_WARNALIENFORMAT, batch); |
251 | | |
252 | | // AutoSave |
253 | 0 | toCfg_ifSet<officecfg::Office::Recovery::AutoSave::Enabled>(rSet, SID_ATTR_AUTOSAVE, batch); |
254 | | |
255 | | // AutoSave-Time |
256 | 0 | toCfg_ifSet<officecfg::Office::Recovery::AutoSave::TimeIntervall>( |
257 | 0 | rSet, SID_ATTR_AUTOSAVEMINUTE, batch); |
258 | | |
259 | | // UserAutoSave |
260 | 0 | toCfg_ifSet<officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled>( |
261 | 0 | rSet, SID_ATTR_USERAUTOSAVE, batch); |
262 | | |
263 | | // DocInfo |
264 | 0 | toCfg_ifSet<officecfg::Office::Common::Save::Document::EditProperty>( |
265 | 0 | rSet, SID_ATTR_DOCINFO, batch); |
266 | | |
267 | | // HelpBalloons |
268 | 0 | toCfg_ifSet<officecfg::Office::Common::Help::ExtendedTip>(rSet, SID_HELPBALLOONS, batch); |
269 | | |
270 | | // HelpTips |
271 | 0 | toCfg_ifSet<officecfg::Office::Common::Help::Tip>(rSet, SID_HELPTIPS, batch); |
272 | | |
273 | | // SaveRelINet |
274 | 0 | toCfg_ifSet<officecfg::Office::Common::Save::URL::Internet>(rSet, SID_SAVEREL_INET, batch); |
275 | | |
276 | | // SaveRelFSys |
277 | 0 | toCfg_ifSet<officecfg::Office::Common::Save::URL::FileSystem>(rSet, SID_SAVEREL_FSYS, batch); |
278 | | |
279 | | // Undo-Count |
280 | 0 | if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet(SID_ATTR_UNDO_COUNT)) |
281 | 0 | { |
282 | 0 | sal_uInt16 nUndoCount = pItem->GetValue(); |
283 | 0 | officecfg::Office::Common::Undo::Steps::set(nUndoCount, batch); |
284 | | |
285 | | // To catch all Undo-Managers: Iterate over all Frames |
286 | 0 | for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(); |
287 | 0 | pFrame; |
288 | 0 | pFrame = SfxViewFrame::GetNext(*pFrame) ) |
289 | 0 | { |
290 | | // Get the Dispatcher of the Frames |
291 | 0 | SfxDispatcher *pDispat = pFrame->GetDispatcher(); |
292 | 0 | pDispat->Flush(); |
293 | | |
294 | | // Iterate over all SfxShells on the Dispatchers Stack |
295 | 0 | sal_uInt16 nIdx = 0; |
296 | 0 | for ( SfxShell *pSh = pDispat->GetShell(nIdx); |
297 | 0 | pSh; |
298 | 0 | ++nIdx, pSh = pDispat->GetShell(nIdx) ) |
299 | 0 | { |
300 | 0 | SfxUndoManager *pShUndoMgr = pSh->GetUndoManager(); |
301 | 0 | if ( pShUndoMgr ) |
302 | 0 | pShUndoMgr->SetMaxUndoActionCount( nUndoCount ); |
303 | 0 | } |
304 | 0 | } |
305 | 0 | } |
306 | | |
307 | | // Office autostart |
308 | 0 | if ( const SfxBoolItem *pItem = rSet.GetItemIfSet(SID_ATTR_QUICKLAUNCHER)) |
309 | 0 | { |
310 | 0 | ShutdownIcon::SetAutostart( pItem->GetValue() ); |
311 | 0 | } |
312 | |
|
313 | 0 | toCfg_ifSet<officecfg::Inet::Settings::ooInetProxyType>(rSet, SID_INET_PROXY_TYPE, batch); |
314 | |
|
315 | 0 | toCfg_ifSet<officecfg::Inet::Settings::ooInetHTTPProxyName>( |
316 | 0 | rSet, SID_INET_HTTP_PROXY_NAME, batch); |
317 | 0 | toCfg_ifSet<officecfg::Inet::Settings::ooInetHTTPProxyPort>( |
318 | 0 | rSet, SID_INET_HTTP_PROXY_PORT, batch); |
319 | 0 | toCfg_ifSet<officecfg::Inet::Settings::ooInetNoProxy>(rSet, SID_INET_NOPROXY, batch); |
320 | | |
321 | | // Secure-Referrer |
322 | 0 | if ( const SfxStringListItem *pListItem = rSet.GetItemIfSet(SID_SECURE_URL)) |
323 | 0 | { |
324 | 0 | SvtSecurityOptions::SetSecureURLs( std::vector(pListItem->GetList()) ); |
325 | 0 | } |
326 | | |
327 | | // Store changed data |
328 | 0 | batch->commit(); |
329 | 0 | } |
330 | | |
331 | | |
332 | | void SfxApplication::NotifyEvent( const SfxEventHint& rEventHint, bool bSynchron ) |
333 | 345k | { |
334 | 345k | rtl::Reference<SfxObjectShell> pDoc = rEventHint.GetObjShell(); |
335 | 345k | if ( pDoc && ( pDoc->IsPreview() || !pDoc->Get_Impl()->bInitialized ) ) |
336 | 223k | return; |
337 | | |
338 | 122k | if ( bSynchron ) |
339 | 122k | { |
340 | 122k | SAL_INFO_IF(!pDoc, "sfx.appl", "SfxEvent: " << rEventHint.GetEventName()); |
341 | 122k | Broadcast(rEventHint); |
342 | 122k | if ( pDoc ) |
343 | 122k | pDoc->Broadcast( rEventHint ); |
344 | 122k | } |
345 | 0 | else |
346 | 0 | new SfxEventAsyncer_Impl( rEventHint ); |
347 | 122k | } |
348 | | |
349 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |