1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #include <config_features.h>
22 #include <sal/config.h>
26 #include <com/sun/star/script/XLibraryContainer.hpp>
27 #include <officecfg/Office/Common.hxx>
28 #include <svl/intitem.hxx>
29 #include <svl/eitem.hxx>
30 #include <svl/whiter.hxx>
31 #include <basic/sbstar.hxx>
33 #include <sfx2/frame.hxx>
34 #include <sfx2/dinfdlg.hxx>
35 #include <sfx2/app.hxx>
36 #include <sfx2/msg.hxx>
37 #include <sfx2/request.hxx>
38 #include <sfx2/sfxsids.hrc>
39 #include <appdata.hxx>
40 #include <basic/basmgr.hxx>
41 #include <unotools/configmgr.hxx>
42 #include <sorgitm.hxx>
43 #include <appbaslib.hxx>
44 #include <basic/basicmanagerrepository.hxx>
47 #include <sfxslots.hxx>
49 using namespace ::com::sun::star
;
50 using namespace ::com::sun::star::uno
;
51 using namespace ::com::sun::star::script
;
53 using ::basic::BasicManagerRepository
;
56 void SfxApplication::SaveBasicAndDialogContainer() const
58 if ( pImpl
->pBasicManager
->isValid() )
59 pImpl
->pBasicManager
->storeAllLibraries();
62 BasicManager
* SfxApplication::GetBasicManager()
64 #if !HAVE_FEATURE_SCRIPTING
67 if (utl::ConfigManager::IsFuzzing())
69 return BasicManagerRepository::getApplicationBasicManager();
73 XLibraryContainer
* SfxApplication::GetDialogContainer()
75 #if !HAVE_FEATURE_SCRIPTING
78 if (utl::ConfigManager::IsFuzzing())
80 if ( !pImpl
->pBasicManager
->isValid() )
82 return pImpl
->pBasicManager
->getLibraryContainer( SfxBasicManagerHolder::DIALOGS
);
87 XLibraryContainer
* SfxApplication::GetBasicContainer()
89 #if !HAVE_FEATURE_SCRIPTING
92 if (utl::ConfigManager::IsFuzzing())
94 if ( !pImpl
->pBasicManager
->isValid() )
96 return pImpl
->pBasicManager
->getLibraryContainer( SfxBasicManagerHolder::SCRIPTS
);
100 StarBASIC
* SfxApplication::GetBasic()
102 #if !HAVE_FEATURE_SCRIPTING
105 if (utl::ConfigManager::IsFuzzing())
107 return GetBasicManager()->GetLib(0);
111 void SfxApplication::PropExec_Impl( SfxRequest
const &rReq
)
113 sal_uInt16 nSID
= rReq
.GetSlot();
116 case SID_ATTR_UNDO_COUNT
:
118 if (const SfxUInt16Item
* pCountItem
= rReq
.GetArg
<SfxUInt16Item
>(nSID
))
120 std::shared_ptr
< comphelper::ConfigurationChanges
> batch(
121 comphelper::ConfigurationChanges::create());
122 officecfg::Office::Common::Undo::Steps::set(
123 pCountItem
->GetValue(), batch
);
134 void SfxApplication::PropState_Impl( SfxItemSet
&rSet
)
136 SfxWhichIter
aIter(rSet
);
137 for ( sal_uInt16 nSID
= aIter
.FirstWhich(); nSID
; nSID
= aIter
.NextWhich() )
141 case SID_ATTR_UNDO_COUNT
:
145 officecfg::Office::Common::Undo::Steps::get()));
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */