LibreOffice Module sfx2 (master) 1
appcfg.cxx
Go to the documentation of this file.
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/aeitem.hxx>
27#include <svl/slstitm.hxx>
28#include <svl/stritem.hxx>
29#include <svl/intitem.hxx>
30#include <svl/eitem.hxx>
31#include <svl/undo.hxx>
32
33#include <sfx2/sfxsids.hrc>
34
35#include <svl/isethint.hxx>
36
37#include <officecfg/Inet.hxx>
38#include <officecfg/Office/Common.hxx>
39#include <officecfg/Office/Recovery.hxx>
42#include <svtools/miscopt.hxx>
43#include <svtools/imgdef.hxx>
44#include <sal/log.hxx>
45#include <vcl/idle.hxx>
46
47#include <sfx2/app.hxx>
48#include <sfx2/event.hxx>
49#include <sfx2/viewfrm.hxx>
50#include <sfx2/dispatch.hxx>
51#include <sfx2/objsh.hxx>
52#include <comphelper/lok.hxx>
53#include <objshimp.hxx>
54#include "shutdownicon.hxx"
55
56using namespace ::com::sun::star::uno;
57using namespace ::com::sun::star::util;
58using namespace ::com::sun::star::beans;
59
60namespace {
61
62class SfxEventAsyncer_Impl : public SfxListener
63{
64 SfxEventHint aHint;
65 std::unique_ptr<Idle> pIdle;
66
67public:
68
69 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
70 explicit SfxEventAsyncer_Impl(const SfxEventHint& rHint);
71 DECL_LINK( IdleHdl, Timer*, void );
72};
73
74}
75
76void SfxEventAsyncer_Impl::Notify( SfxBroadcaster&, const SfxHint& rHint )
77{
78 if( rHint.GetId() == SfxHintId::Dying && pIdle->IsActive() )
79 {
80 pIdle->Stop();
81 delete this;
82 }
83}
84
85
86SfxEventAsyncer_Impl::SfxEventAsyncer_Impl( const SfxEventHint& rHint )
87 : aHint( rHint )
88{
89 if( rHint.GetObjShell() )
90 StartListening( *rHint.GetObjShell() );
91 pIdle.reset( new Idle("sfx::SfxEventAsyncer_Impl pIdle") );
92 pIdle->SetInvokeHandler( LINK(this, SfxEventAsyncer_Impl, IdleHdl) );
93 pIdle->SetPriority( TaskPriority::HIGH_IDLE );
94 pIdle->Start();
95}
96
97
98IMPL_LINK(SfxEventAsyncer_Impl, IdleHdl, Timer*, pAsyncIdle, void)
99{
100 SfxObjectShellRef xRef( aHint.GetObjShell() );
101 pAsyncIdle->Stop();
102 SAL_INFO_IF(!xRef.is(), "sfx.appl", "SfxEvent: " << aHint.GetEventName());
103 SfxGetpApp()->Broadcast( aHint );
104 if ( xRef.is() )
105 xRef->Broadcast( aHint );
106 delete this;
107}
108
109
111{
112 bool bRet = false;
113
114 const WhichRangesContainer& pRanges = rSet.GetRanges();
115 SvtMiscOptions aMiscOptions;
116
117 for (auto const & pRange : pRanges)
118 {
119 for(sal_uInt16 nWhich = pRange.first; nWhich <= pRange.second; ++nWhich)
120 {
121 switch(nWhich)
122 {
123 case SID_ATTR_BUTTON_BIGSIZE :
124 {
125 if( rSet.Put( SfxBoolItem( SID_ATTR_BUTTON_BIGSIZE, aMiscOptions.AreCurrentSymbolsLarge() ) ) )
126 bRet = true;
127 break;
128 }
129 case SID_ATTR_BACKUP :
130 {
131 bRet = true;
132 if (!officecfg::Office::Common::Save::Document::CreateBackup::isReadOnly())
133 if (!rSet.Put( SfxBoolItem( SID_ATTR_BACKUP,
134 (officecfg::Office::Common::Save::Document::CreateBackup::get() && !comphelper::LibreOfficeKit::isActive()) )))
135 bRet = false;
136 }
137 break;
138 case SID_ATTR_PRETTYPRINTING:
139 {
140 bRet = true;
141 if (!officecfg::Office::Common::Save::Document::PrettyPrinting::isReadOnly())
142 if (!rSet.Put( SfxBoolItem( SID_ATTR_PRETTYPRINTING,
143 officecfg::Office::Common::Save::Document::PrettyPrinting::get())))
144 bRet = false;
145 }
146 break;
147 case SID_ATTR_WARNALIENFORMAT:
148 {
149 bRet = true;
150 if (!officecfg::Office::Common::Save::Document::WarnAlienFormat::isReadOnly())
151 if (!rSet.Put( SfxBoolItem( SID_ATTR_WARNALIENFORMAT,
152 officecfg::Office::Common::Save::Document::WarnAlienFormat::get() )))
153 bRet = false;
154 }
155 break;
156 case SID_ATTR_AUTOSAVE :
157 {
158 bRet = true;
159 if (!officecfg::Office::Common::Save::Document::AutoSave::isReadOnly())
160 if (!rSet.Put( SfxBoolItem( SID_ATTR_AUTOSAVE,
161 officecfg::Office::Common::Save::Document::AutoSave::get() )))
162 bRet = false;
163 }
164 break;
165 case SID_ATTR_AUTOSAVEPROMPT :
166 {
167 bRet = true;
168 if (!officecfg::Office::Common::Save::Document::AutoSavePrompt::isReadOnly())
169 if (!rSet.Put( SfxBoolItem( SID_ATTR_AUTOSAVEPROMPT,
170 officecfg::Office::Common::Save::Document::AutoSavePrompt::get())))
171 bRet = false;
172 }
173 break;
174 case SID_ATTR_AUTOSAVEMINUTE :
175 {
176 bRet = true;
177 if (!officecfg::Office::Common::Save::Document::AutoSaveTimeIntervall::isReadOnly())
178 if (!rSet.Put( SfxUInt16Item( SID_ATTR_AUTOSAVEMINUTE,
179 officecfg::Office::Common::Save::Document::AutoSaveTimeIntervall::get() )))
180 bRet = false;
181 }
182 break;
183 case SID_ATTR_USERAUTOSAVE :
184 {
185 bRet = true;
186 if (!officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::isReadOnly())
187 if (!rSet.Put( SfxBoolItem( SID_ATTR_USERAUTOSAVE,
188 officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::get() )))
189 bRet = false;
190 }
191 break;
192 case SID_ATTR_DOCINFO :
193 {
194 bRet = true;
195 if (!officecfg::Office::Common::Save::Document::EditProperty::isReadOnly())
196 if (!rSet.Put( SfxBoolItem( SID_ATTR_DOCINFO,
197 officecfg::Office::Common::Save::Document::EditProperty::get())))
198 bRet = false;
199 }
200 break;
201 case SID_ATTR_WORKINGSET :
202 {
203 bRet = true;
204 if (!officecfg::Office::Common::Save::WorkingSet::isReadOnly())
205 if (!rSet.Put( SfxBoolItem( SID_ATTR_WORKINGSET,
206 officecfg::Office::Common::Save::WorkingSet::get())))
207 bRet = false;
208 }
209 break;
210 case SID_ATTR_SAVEDOCVIEW :
211 {
212 bRet = true;
213 if (!officecfg::Office::Common::Save::Document::ViewInfo::isReadOnly())
214 if (!rSet.Put( SfxBoolItem( SID_ATTR_SAVEDOCVIEW, officecfg::Office::Common::Save::Document::ViewInfo::get())))
215 bRet = false;
216 }
217 break;
218 case SID_ATTR_METRIC :
219 break;
220 case SID_HELPBALLOONS :
221 if(rSet.Put( SfxBoolItem ( SID_HELPBALLOONS,
222 officecfg::Office::Common::Help::ExtendedTip::get() ) ) )
223 bRet = true;
224 break;
225 case SID_HELPTIPS :
226 if(rSet.Put( SfxBoolItem ( SID_HELPTIPS,
227 officecfg::Office::Common::Help::Tip::get() ) ) )
228 bRet = true;
229 break;
230 case SID_HELP_STYLESHEET :
231 if(rSet.Put( SfxStringItem ( SID_HELP_STYLESHEET,
232 officecfg::Office::Common::Help::HelpStyleSheet::get() ) ) )
233 bRet = true;
234 break;
235 case SID_ATTR_UNDO_COUNT :
236 if (rSet.Put(
238 SID_ATTR_UNDO_COUNT,
239 officecfg::Office::Common::Undo::Steps::get())))
240 {
241 bRet = true;
242 }
243 break;
244 case SID_ATTR_QUICKLAUNCHER :
245 {
247 {
248 if ( rSet.Put( SfxBoolItem( SID_ATTR_QUICKLAUNCHER,
250 bRet = true;
251 }
252 else
253 {
254 rSet.DisableItem( SID_ATTR_QUICKLAUNCHER );
255 bRet = true;
256 }
257 break;
258 }
259 case SID_SAVEREL_INET :
260 {
261 bRet = true;
262 if (!officecfg::Office::Common::Save::URL::Internet::isReadOnly())
263 if (!rSet.Put( SfxBoolItem ( SID_SAVEREL_INET,
264 officecfg::Office::Common::Save::URL::Internet::get() )))
265 bRet = false;
266 }
267 break;
268 case SID_SAVEREL_FSYS :
269 {
270 bRet = true;
271 if (!officecfg::Office::Common::Save::URL::FileSystem::isReadOnly())
272 if (!rSet.Put( SfxBoolItem ( SID_SAVEREL_FSYS,
273 officecfg::Office::Common::Save::URL::FileSystem::get() )))
274 bRet = false;
275 }
276 break;
277 case SID_SECURE_URL :
278 {
279 bRet = true;
281 {
282 std::vector< OUString > seqURLs = SvtSecurityOptions::GetSecureURLs();
283
284 if( !rSet.Put( SfxStringListItem( SID_SECURE_URL, &seqURLs ) ) )
285 bRet = false;
286 }
287 }
288 break;
289 case SID_INET_PROXY_TYPE :
290 if (rSet.Put(
292 SID_INET_PROXY_TYPE,
293 (officecfg::Inet::Settings::ooInetProxyType::
294 get().value_or(0)))))
295 {
296 bRet = true;
297 }
298 break;
299 case SID_INET_HTTP_PROXY_NAME :
300 if (rSet.Put(
302 SID_INET_HTTP_PROXY_NAME,
303 officecfg::Inet::Settings::ooInetHTTPProxyName::
304 get())))
305 {
306 bRet = true;
307 }
308 break;
309 case SID_INET_HTTP_PROXY_PORT :
310 if (rSet.Put(
312 SID_INET_HTTP_PROXY_PORT,
313 (officecfg::Inet::Settings::
314 ooInetHTTPProxyPort::get().value_or(0)))))
315 {
316 bRet = true;
317 }
318 break;
319 case SID_INET_FTP_PROXY_NAME :
320 if (rSet.Put(
322 SID_INET_FTP_PROXY_NAME,
323 officecfg::Inet::Settings::ooInetFTPProxyName::
324 get())))
325 {
326 bRet = true;
327 }
328 break;
329 case SID_INET_FTP_PROXY_PORT :
330 if (rSet.Put(
332 SID_INET_FTP_PROXY_PORT,
333 (officecfg::Inet::Settings::ooInetFTPProxyPort::
334 get().value_or(0)))))
335 {
336 bRet = true;
337 }
338 break;
339 case SID_INET_NOPROXY :
340 if (rSet.Put(
342 SID_INET_NOPROXY,
343 (officecfg::Inet::Settings::ooInetNoProxy::
344 get()))))
345 {
346 bRet = true;
347 }
348 break;
349 case SID_ATTR_PATHNAME :
350 {
351 SfxAllEnumItem aValues(SID_ATTR_PATHNAME);
352 SvtPathOptions aPathCfg;
353 for ( sal_uInt16 nProp = static_cast<sal_uInt16>(SvtPathOptions::Paths::AddIn);
354 nProp <= static_cast<sal_uInt16>(SvtPathOptions::Paths::Work); nProp++ )
355 {
356 OUString aValue;
357 switch ( static_cast<SvtPathOptions::Paths>(nProp) )
358 {
359 case SvtPathOptions::Paths::AddIn: osl::FileBase::getFileURLFromSystemPath( aPathCfg.GetAddinPath(), aValue ); break;
360 case SvtPathOptions::Paths::AutoCorrect: aValue = aPathCfg.GetAutoCorrectPath(); break;
361 case SvtPathOptions::Paths::AutoText: aValue = aPathCfg.GetAutoTextPath(); break;
362 case SvtPathOptions::Paths::Backup: aValue = aPathCfg.GetBackupPath(); break;
363 case SvtPathOptions::Paths::Basic: aValue = aPathCfg.GetBasicPath(); break;
364 case SvtPathOptions::Paths::Bitmap: aValue = aPathCfg.GetBitmapPath(); break;
365 case SvtPathOptions::Paths::Config: aValue = aPathCfg.GetConfigPath(); break;
366 case SvtPathOptions::Paths::Dictionary: aValue = aPathCfg.GetDictionaryPath(); break;
367 case SvtPathOptions::Paths::Favorites: aValue = aPathCfg.GetFavoritesPath(); break;
368 case SvtPathOptions::Paths::Filter: osl::FileBase::getFileURLFromSystemPath( aPathCfg.GetFilterPath(), aValue ); break;
369 case SvtPathOptions::Paths::Gallery: aValue = aPathCfg.GetGalleryPath(); break;
370 case SvtPathOptions::Paths::Graphic: aValue = aPathCfg.GetGraphicPath(); break;
371 case SvtPathOptions::Paths::Help: osl::FileBase::getFileURLFromSystemPath( aPathCfg.GetHelpPath(), aValue ); break;
372 case SvtPathOptions::Paths::Linguistic: aValue = aPathCfg.GetLinguisticPath(); break;
373 case SvtPathOptions::Paths::Module: osl::FileBase::getFileURLFromSystemPath( aPathCfg.GetModulePath(), aValue ); break;
374 case SvtPathOptions::Paths::Palette: aValue = aPathCfg.GetPalettePath(); break;
375 case SvtPathOptions::Paths::Plugin: osl::FileBase::getFileURLFromSystemPath( aPathCfg.GetPluginPath(), aValue ); break;
376 case SvtPathOptions::Paths::Storage: osl::FileBase::getFileURLFromSystemPath( aPathCfg.GetStoragePath(), aValue ); break;
377 case SvtPathOptions::Paths::Temp: aValue = aPathCfg.GetTempPath(); break;
378 case SvtPathOptions::Paths::Template: aValue = aPathCfg.GetTemplatePath(); break;
379 case SvtPathOptions::Paths::UserConfig: aValue = aPathCfg.GetUserConfigPath(); break;
380 case SvtPathOptions::Paths::Work: aValue = aPathCfg.GetWorkPath(); break;
381 default: break;
382 }
383 aValues.SetTextByPos( nProp, aValue );
384 }
385
386 if (rSet.Put(aValues))
387 bRet = true;
388 }
389 break;
390
391 default:
392 SAL_INFO( "sfx.appl", "W1:Wrong ID while getting Options!" );
393 break;
394 }
395 SAL_WARN_IF(!bRet, "sfx.appl", "Putting options failed!");
396 }
397 }
398}
399
400// TODO/CLEANUP: Why two SetOptions Methods?
402{
403 SfxItemPool &rPool = GetPool();
404
405 SvtMiscOptions aMiscOptions;
406 std::shared_ptr< comphelper::ConfigurationChanges > batch(
408
409 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet(SID_ATTR_BUTTON_BIGSIZE) )
410 {
411 bool bBigSize = pItem->GetValue();
412 aMiscOptions.SetSymbolsSize(
413 sal::static_int_cast< sal_Int16 >(
415 SfxViewFrame* pCurrViewFrame = SfxViewFrame::GetFirst();
416 while ( pCurrViewFrame )
417 {
418 // update all "final" dispatchers
419 pCurrViewFrame->GetDispatcher()->Update_Impl(true);
420 pCurrViewFrame = SfxViewFrame::GetNext(*pCurrViewFrame);
421 }
422 }
423
424 // Backup
425 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet(SID_ATTR_BACKUP) )
426 {
427 officecfg::Office::Common::Save::Document::CreateBackup::set(
428 pItem->GetValue(),
429 batch );
430 }
431
432 // PrettyPrinting
433 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_ATTR_PRETTYPRINTING ) )
434 {
435 officecfg::Office::Common::Save::Document::PrettyPrinting::set(
436 pItem->GetValue(),
437 batch );
438 }
439
440 // WarnAlienFormat
441 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_ATTR_WARNALIENFORMAT ) )
442 {
443 officecfg::Office::Common::Save::Document::WarnAlienFormat::set(
444 pItem->GetValue(),
445 batch);
446 }
447
448 // AutoSave
449 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_ATTR_AUTOSAVE ))
450 {
451 officecfg::Office::Common::Save::Document::AutoSave::set(
452 pItem->GetValue(),
453 batch);
454 }
455
456 // AutoSave-Prompt
457 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_ATTR_AUTOSAVEPROMPT ))
458 {
459 officecfg::Office::Common::Save::Document::AutoSavePrompt::set(
460 pItem->GetValue(),
461 batch);
462 }
463
464 // AutoSave-Time
465 if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet(SID_ATTR_AUTOSAVEMINUTE ))
466 {
467 officecfg::Office::Common::Save::Document::AutoSaveTimeIntervall::set(
468 pItem->GetValue(),
469 batch);
470 }
471
472 // UserAutoSave
473 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet(SID_ATTR_USERAUTOSAVE))
474 {
475 officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::set(
476 pItem->GetValue(),
477 batch);
478 }
479
480 // DocInfo
481 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet(SID_ATTR_DOCINFO) )
482 {
483 officecfg::Office::Common::Save::Document::EditProperty::set(
484 pItem->GetValue(),
485 batch);
486 }
487
488 // Mark open Documents
489 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet(SID_ATTR_WORKINGSET))
490 {
491 officecfg::Office::Common::Save::WorkingSet::set(
492 pItem->GetValue(),
493 batch);
494 }
495
496 // Save window settings
497 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet(SID_ATTR_SAVEDOCVIEW))
498 {
499 officecfg::Office::Common::Save::Document::ViewInfo::set(pItem->GetValue(), batch);
500 }
501
502 // Metric
503 const SfxPoolItem* pItem1 = nullptr;
504 if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_METRIC), true, &pItem1))
505 {
506 DBG_ASSERT(dynamic_cast< const SfxUInt16Item *>( pItem1 ) != nullptr, "UInt16Item expected");
507 }
508
509 // HelpBalloons
510 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet(SID_HELPBALLOONS))
511 {
512 officecfg::Office::Common::Help::ExtendedTip::set(
513 pItem->GetValue(),
514 batch);
515 }
516
517 // HelpTips
518 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet(SID_HELPTIPS))
519 {
520 officecfg::Office::Common::Help::Tip::set(
521 pItem->GetValue(),
522 batch);
523 }
524
525 if ( const SfxStringItem *pItem = rSet.GetItemIfSet(SID_HELP_STYLESHEET))
526 {
527 OUString sStyleSheet = pItem->GetValue();
528 officecfg::Office::Common::Help::HelpStyleSheet::set(sStyleSheet, batch);
529 }
530
531 // SaveRelINet
532 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet(SID_SAVEREL_INET))
533 {
534 officecfg::Office::Common::Save::URL::Internet::set(
535 pItem->GetValue(),
536 batch);
537 }
538
539 // SaveRelFSys
540 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet(SID_SAVEREL_FSYS))
541 {
542 officecfg::Office::Common::Save::URL::FileSystem::set(
543 pItem->GetValue(),
544 batch);
545 }
546
547 // Undo-Count
548 if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet(SID_ATTR_UNDO_COUNT))
549 {
550 sal_uInt16 nUndoCount = pItem->GetValue();
551 officecfg::Office::Common::Undo::Steps::set(nUndoCount, batch);
552
553 // To catch all Undo-Managers: Iterate over all Frames
554 for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst();
555 pFrame;
556 pFrame = SfxViewFrame::GetNext(*pFrame) )
557 {
558 // Get the Dispatcher of the Frames
559 SfxDispatcher *pDispat = pFrame->GetDispatcher();
560 pDispat->Flush();
561
562 // Iterate over all SfxShells on the Dispatchers Stack
563 sal_uInt16 nIdx = 0;
564 for ( SfxShell *pSh = pDispat->GetShell(nIdx);
565 pSh;
566 ++nIdx, pSh = pDispat->GetShell(nIdx) )
567 {
568 SfxUndoManager *pShUndoMgr = pSh->GetUndoManager();
569 if ( pShUndoMgr )
570 pShUndoMgr->SetMaxUndoActionCount( nUndoCount );
571 }
572 }
573 }
574
575 // Office autostart
576 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet(SID_ATTR_QUICKLAUNCHER))
577 {
578 ShutdownIcon::SetAutostart( pItem->GetValue() );
579 }
580
581 if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet(SID_INET_PROXY_TYPE))
582 {
583 officecfg::Inet::Settings::ooInetProxyType::set(
584 pItem->GetValue(), batch);
585 }
586
587 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_INET_HTTP_PROXY_NAME ) )
588 {
589 officecfg::Inet::Settings::ooInetHTTPProxyName::set(
590 pItem->GetValue(), batch);
591 }
592 if ( const SfxInt32Item *pItem = rSet.GetItemIfSet( SID_INET_HTTP_PROXY_PORT ) )
593 {
594 officecfg::Inet::Settings::ooInetHTTPProxyPort::set(
595 pItem->GetValue(), batch);
596 }
597 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_INET_FTP_PROXY_NAME ) )
598 {
599 officecfg::Inet::Settings::ooInetFTPProxyName::set(
600 pItem->GetValue(), batch);
601 }
602 if (const SfxInt32Item *pItem = rSet.GetItemIfSet( SID_INET_FTP_PROXY_PORT ) )
603 {
604 officecfg::Inet::Settings::ooInetFTPProxyPort::set(
605 pItem->GetValue(), batch);
606 }
607 if ( const SfxStringItem* pStringItem = rSet.GetItemIfSet(SID_INET_NOPROXY))
608 {
609 officecfg::Inet::Settings::ooInetNoProxy::set(
610 pStringItem->GetValue(), batch);
611 }
612
613 // Secure-Referrer
614 if ( const SfxStringListItem *pListItem = rSet.GetItemIfSet(SID_SECURE_URL))
615 {
616 SvtSecurityOptions::SetSecureURLs( std::vector(pListItem->GetList()) );
617 }
618
619 // Store changed data
620 batch->commit();
621}
622
623
625{
626 SvtPathOptions aPathOptions;
627
628 // Data is saved in DocInfo and IniManager
629
630 SfxAllItemSet aSendSet( rSet );
631
632 // PathName
633 if ( const SfxAllEnumItem* pEnumItem = rSet.GetItemIfSet(SID_ATTR_PATHNAME))
634 {
635 sal_uInt32 nCount = pEnumItem->GetTextCount();
636 OUString aNoChangeStr( ' ' );
637 for( sal_uInt32 nPath=0; nPath<nCount; ++nPath )
638 {
639 const OUString& sValue = pEnumItem->GetTextByPos(static_cast<sal_uInt16>(nPath));
640 if ( sValue != aNoChangeStr )
641 {
642 switch( static_cast<SvtPathOptions::Paths>(nPath) )
643 {
645 {
646 OUString aTmp;
647 if( osl::FileBase::getSystemPathFromFileURL( sValue, aTmp ) == osl::FileBase::E_None )
648 aPathOptions.SetAddinPath( aTmp );
649 break;
650 }
651
652 case SvtPathOptions::Paths::AutoCorrect: aPathOptions.SetAutoCorrectPath( sValue );break;
653 case SvtPathOptions::Paths::AutoText: aPathOptions.SetAutoTextPath( sValue );break;
654 case SvtPathOptions::Paths::Backup: aPathOptions.SetBackupPath( sValue );break;
655 case SvtPathOptions::Paths::Basic: aPathOptions.SetBasicPath( sValue );break;
656 case SvtPathOptions::Paths::Bitmap: aPathOptions.SetBitmapPath( sValue );break;
657 case SvtPathOptions::Paths::Config: aPathOptions.SetConfigPath( sValue );break;
658 case SvtPathOptions::Paths::Dictionary: aPathOptions.SetDictionaryPath( sValue );break;
659 case SvtPathOptions::Paths::Favorites: aPathOptions.SetFavoritesPath( sValue );break;
661 {
662 OUString aTmp;
663 if( osl::FileBase::getSystemPathFromFileURL( sValue, aTmp ) == osl::FileBase::E_None )
664 aPathOptions.SetFilterPath( aTmp );
665 break;
666 }
667 case SvtPathOptions::Paths::Gallery: aPathOptions.SetGalleryPath( sValue );break;
668 case SvtPathOptions::Paths::Graphic: aPathOptions.SetGraphicPath( sValue );break;
670 {
671 OUString aTmp;
672 if( osl::FileBase::getSystemPathFromFileURL( sValue, aTmp ) == osl::FileBase::E_None )
673 aPathOptions.SetHelpPath( aTmp );
674 break;
675 }
676
677 case SvtPathOptions::Paths::Linguistic: aPathOptions.SetLinguisticPath( sValue );break;
679 {
680 OUString aTmp;
681 if( osl::FileBase::getSystemPathFromFileURL( sValue, aTmp ) == osl::FileBase::E_None )
682 aPathOptions.SetModulePath( aTmp );
683 break;
684 }
685
686 case SvtPathOptions::Paths::Palette: aPathOptions.SetPalettePath( sValue );break;
688 {
689 OUString aTmp;
690 if( osl::FileBase::getSystemPathFromFileURL( sValue, aTmp ) == osl::FileBase::E_None )
691 aPathOptions.SetPluginPath( aTmp );
692 break;
693 }
694
696 {
697 OUString aTmp;
698 if( osl::FileBase::getSystemPathFromFileURL( sValue, aTmp ) == osl::FileBase::E_None )
699 aPathOptions.SetStoragePath( aTmp );
700 break;
701 }
702
703 case SvtPathOptions::Paths::Temp: aPathOptions.SetTempPath( sValue );break;
704 case SvtPathOptions::Paths::Template: aPathOptions.SetTemplatePath( sValue );break;
705 case SvtPathOptions::Paths::UserConfig: aPathOptions.SetUserConfigPath( sValue );break;
706 case SvtPathOptions::Paths::Work: aPathOptions.SetWorkPath( sValue );break;
707 default: SAL_WARN( "sfx.appl", "SfxApplication::SetOptions_Impl() Invalid path number found for set directories!" );
708 }
709 }
710 }
711
712 aSendSet.ClearItem( SID_ATTR_PATHNAME );
713 }
714
716
717 // Undo-Count
719}
720
721
722void SfxApplication::NotifyEvent( const SfxEventHint& rEventHint, bool bSynchron )
723{
724 SfxObjectShell *pDoc = rEventHint.GetObjShell();
725 if ( pDoc && ( pDoc->IsPreview() || !pDoc->Get_Impl()->bInitialized ) )
726 return;
727
728 if ( bSynchron )
729 {
730 SAL_INFO_IF(!pDoc, "sfx.appl", "SfxEvent: " << rEventHint.GetEventName());
731 Broadcast(rEventHint);
732 if ( pDoc )
733 pDoc->Broadcast( rEventHint );
734 }
735 else
736 new SfxEventAsyncer_Impl( rEventHint );
737}
738
739/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxApplication * SfxGetpApp()
Definition: app.hxx:232
IMPL_LINK(SfxEventAsyncer_Impl, IdleHdl, Timer *, pAsyncIdle, void)
Definition: appcfg.cxx:98
static void GetOptions(SfxItemSet &)
Definition: appcfg.cxx:110
void NotifyEvent(const SfxEventHint &rEvent, bool bSynchron=true)
Definition: appcfg.cxx:722
void SetOptions(const SfxItemSet &)
Definition: appcfg.cxx:624
SAL_DLLPRIVATE void SetOptions_Impl(const SfxItemSet &)
Definition: appcfg.cxx:401
void Broadcast(const SfxHint &rHint)
SAL_DLLPRIVATE void Update_Impl(bool bForce=false)
Definition: dispatch.cxx:1034
SfxShell * GetShell(sal_uInt16 nIdx) const
Returns a pointer to the <SfxShell> which is at the position nIdx (from the top, last pushed is 0) on...
Definition: dispatch.cxx:529
void Flush()
This method performs outstanding push- and pop- commands.
Definition: dispatch.cxx:155
const OUString & GetEventName() const
Definition: event.hxx:208
SfxObjectShell * GetObjShell() const
Definition: event.hxx:211
SfxHintId GetId() const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
const WhichRangesContainer & GetRanges() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void DisableItem(sal_uInt16 nWhich)
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint)
SAL_DLLPRIVATE SfxObjectShell_Impl * Get_Impl()
Definition: objsh.hxx:707
bool IsPreview() const
Definition: objmisc.cxx:1548
The class SfxShell is the base class for all classes, which provide the functionality of the form <Sl...
Definition: shell.hxx:128
SfxItemPool & GetPool() const
Each Subclass of SfxShell must reference a pool.
Definition: shell.hxx:511
void SetMaxUndoActionCount(size_t nMaxUndoActionCount)
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetNext(const SfxViewFrame &rPrev, const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
Definition: viewfrm.cxx:1989
SfxDispatcher * GetDispatcher()
Definition: viewfrm.hxx:109
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
Definition: viewfrm.cxx:1966
static bool IsQuickstarterInstalled()
static bool GetAutostart()
static void SetAutostart(bool bActivate)
void SetSymbolsSize(sal_Int16 eSet)
bool AreCurrentSymbolsLarge() const
void SetPalettePath(const OUString &rPath)
const OUString & GetConfigPath() const
void SetAddinPath(const OUString &rPath)
void SetUserConfigPath(const OUString &rPath)
const OUString & GetGalleryPath() const
const OUString & GetDictionaryPath() const
void SetConfigPath(const OUString &rPath)
const OUString & GetHelpPath() const
void SetDictionaryPath(const OUString &rPath)
void SetBasicPath(const OUString &rPath)
const OUString & GetPalettePath() const
void SetGraphicPath(const OUString &rPath)
void SetModulePath(const OUString &rPath)
const OUString & GetStoragePath() const
const OUString & GetFilterPath() const
const OUString & GetAutoCorrectPath() const
const OUString & GetGraphicPath() const
void SetBitmapPath(const OUString &rPath)
void SetFavoritesPath(const OUString &rPath)
void SetTempPath(const OUString &rPath)
void SetLinguisticPath(const OUString &rPath)
void SetAutoCorrectPath(const OUString &rPath)
void SetWorkPath(const OUString &rPath)
const OUString & GetTemplatePath() const
const OUString & GetLinguisticPath() const
const OUString & GetWorkPath() const
void SetFilterPath(const OUString &rPath)
const OUString & GetFavoritesPath() const
const OUString & GetModulePath() const
void SetHelpPath(const OUString &rPath)
void SetBackupPath(const OUString &rPath)
void SetStoragePath(const OUString &rPath)
void SetAutoTextPath(const OUString &rPath)
const OUString & GetPluginPath() const
const OUString & GetAutoTextPath() const
void SetTemplatePath(const OUString &rPath)
const OUString & GetBitmapPath() const
const OUString & GetAddinPath() const
void SetPluginPath(const OUString &rPath)
const OUString & GetBackupPath() const
const OUString & GetBasicPath() const
void SetGalleryPath(const OUString &rPath)
const OUString & GetTempPath() const
const OUString & GetUserConfigPath() const
static std::shared_ptr< ConfigurationChanges > create()
bool is() const
int nCount
#define DBG_ASSERT(sCon, aError)
DECL_LINK(CheckNameHdl, SvxNameDialog &, bool)
SFX_SYMBOLS_SIZE_SMALL
SFX_SYMBOLS_SIZE_LARGE
#define SAL_INFO_IF(condition, area, stream)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
bool IsReadOnly(EOption eOption)
void SetSecureURLs(std::vector< OUString > &&urlList)
std::vector< OUString > GetSecureURLs()
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
static SfxItemSet & rSet
Definition: shell.cxx:534