LibreOffice Module sfx2 (master) 1
appbas.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 <config_features.h>
21
22#include <sal/config.h>
23
24#include <cassert>
25
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>
32
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>
42#include <sorgitm.hxx>
43#include <appbaslib.hxx>
45
46#define SFX_TYPEMAP
47#include <sfxslots.hxx>
48
49using namespace ::com::sun::star;
50using namespace ::com::sun::star::uno;
51using namespace ::com::sun::star::script;
52
53using ::basic::BasicManagerRepository;
54
55
57{
58 if ( pImpl->pBasicManager->isValid() )
59 pImpl->pBasicManager->storeAllLibraries();
60}
61
63{
64#if !HAVE_FEATURE_SCRIPTING
65 return nullptr;
66#else
68 return nullptr;
69 return BasicManagerRepository::getApplicationBasicManager();
70#endif
71}
72
74{
75#if !HAVE_FEATURE_SCRIPTING
76 return nullptr;
77#else
79 return nullptr;
80 if ( !pImpl->pBasicManager->isValid() )
82 return pImpl->pBasicManager->getLibraryContainer( SfxBasicManagerHolder::DIALOGS );
83#endif
84}
85
86
88{
89#if !HAVE_FEATURE_SCRIPTING
90 return nullptr;
91#else
93 return nullptr;
94 if ( !pImpl->pBasicManager->isValid() )
96 return pImpl->pBasicManager->getLibraryContainer( SfxBasicManagerHolder::SCRIPTS );
97#endif
98}
99
101{
102#if !HAVE_FEATURE_SCRIPTING
103 return nullptr;
104#else
106 return nullptr;
107 return GetBasicManager()->GetLib(0);
108#endif
109}
110
112{
113 sal_uInt16 nSID = rReq.GetSlot();
114 switch ( nSID )
115 {
116 case SID_ATTR_UNDO_COUNT:
117 {
118 if (const SfxUInt16Item* pCountItem = rReq.GetArg<SfxUInt16Item>(nSID))
119 {
120 std::shared_ptr< comphelper::ConfigurationChanges > batch(
122 officecfg::Office::Common::Undo::Steps::set(
123 pCountItem->GetValue(), batch);
124 batch->commit();
125 }
126 break;
127 }
128
129 default:
130 assert(false);
131 }
132}
133
135{
136 SfxWhichIter aIter(rSet);
137 for ( sal_uInt16 nSID = aIter.FirstWhich(); nSID; nSID = aIter.NextWhich() )
138 {
139 switch ( nSID )
140 {
141 case SID_ATTR_UNDO_COUNT:
142 rSet.Put(
144 SID_ATTR_UNDO_COUNT,
145 officecfg::Office::Common::Undo::Steps::get()));
146 break;
147
148 default:
149 assert(false);
150 }
151 }
152}
153
154/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
StarBASIC * GetLib(sal_uInt16 nLib) const
static StarBASIC * GetBasic()
Definition: appbas.cxx:100
static SAL_DLLPRIVATE void PropState_Impl(SfxItemSet &)
Definition: appbas.cxx:134
std::unique_ptr< SfxAppData_Impl > pImpl
Definition: app.hxx:97
css::script::XLibraryContainer * GetBasicContainer()
Definition: appbas.cxx:87
static SAL_DLLPRIVATE void PropExec_Impl(SfxRequest const &)
Definition: appbas.cxx:111
void SaveBasicAndDialogContainer() const
Definition: appbas.cxx:56
static BasicManager * GetBasicManager()
Definition: appbas.cxx:62
css::script::XLibraryContainer * GetDialogContainer()
Definition: appbas.cxx:73
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_uInt16 GetSlot() const
Definition: request.hxx:68
const T * GetArg(sal_uInt16 nSlotId) const
Templatized access to the individual parameters of the SfxRequest.
Definition: request.hxx:84
sal_uInt16 FirstWhich()
sal_uInt16 NextWhich()
static std::shared_ptr< ConfigurationChanges > create()
static bool IsFuzzing()
static SfxItemSet & rSet
Definition: shell.cxx:534