Line data Source code
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 : #include <config_options.h>
22 :
23 : #include <sal/config.h>
24 :
25 : #include <cassert>
26 :
27 : #include <com/sun/star/frame/XDesktop.hpp>
28 : #include <com/sun/star/script/XLibraryContainer.hpp>
29 : #include <com/sun/star/uno/Reference.h>
30 : #include <basic/basrdll.hxx>
31 : #include <officecfg/Office/Common.hxx>
32 : #include <svl/macitem.hxx>
33 : #include <basic/sbxfac.hxx>
34 : #include <basic/sbx.hxx>
35 : #include <vcl/gradient.hxx>
36 : #include <svl/rectitem.hxx>
37 : #include <svl/intitem.hxx>
38 : #include <svl/eitem.hxx>
39 : #include <basic/sbmod.hxx>
40 : #include <svl/whiter.hxx>
41 : #include <basic/sbmeth.hxx>
42 : #include <basic/sbstar.hxx>
43 : #include <vcl/wrkwin.hxx>
44 : #include <vcl/msgbox.hxx>
45 : #include <basic/sbuno.hxx>
46 : #include <svtools/sfxecode.hxx>
47 : #include <svtools/ehdl.hxx>
48 :
49 : #include <sfx2/module.hxx>
50 : #include "arrdecl.hxx"
51 : #include <sfx2/app.hxx>
52 : #include "sfxtypes.hxx"
53 : #include <sfx2/sfxresid.hxx>
54 : #include <sfx2/msg.hxx>
55 : #include <sfx2/msgpool.hxx>
56 : #include <sfx2/progress.hxx>
57 : #include <sfx2/objsh.hxx>
58 : #include <sfx2/objitem.hxx>
59 : #include <sfx2/viewfrm.hxx>
60 : #include <sfx2/viewsh.hxx>
61 : #include <sfx2/dispatch.hxx>
62 : #include <sfx2/tplpitem.hxx>
63 : #include <sfx2/minfitem.hxx>
64 : #include "app.hrc"
65 : #include <sfx2/evntconf.hxx>
66 : #include <sfx2/request.hxx>
67 : #include <sfx2/dinfdlg.hxx>
68 : #include "appdata.hxx"
69 : #include <sfx2/sfxhelp.hxx>
70 : #include <basic/basmgr.hxx>
71 : #include <svtools/svtools.hrc>
72 : #include "sorgitm.hxx"
73 : #include "appbaslib.hxx"
74 : #include <basic/basicmanagerrepository.hxx>
75 :
76 : #include <svl/srchitem.hxx>
77 : #include <osl/socket.hxx>
78 :
79 : #define SFX_TYPEMAP
80 : #include "sfxslots.hxx"
81 :
82 : using namespace ::com::sun::star;
83 : using namespace ::com::sun::star::uno;
84 : using namespace ::com::sun::star::frame;
85 : using namespace ::com::sun::star::script;
86 :
87 : using ::basic::BasicManagerRepository;
88 :
89 :
90 119 : sal_uInt16 SfxApplication::SaveBasicAndDialogContainer() const
91 : {
92 119 : if ( pAppData_Impl->pBasicManager->isValid() )
93 46 : pAppData_Impl->pBasicManager->storeAllLibraries();
94 119 : return 0;
95 : }
96 :
97 12535 : BasicManager* SfxApplication::GetBasicManager()
98 : {
99 : #if !HAVE_FEATURE_SCRIPTING
100 : return 0;
101 : #else
102 12535 : return BasicManagerRepository::getApplicationBasicManager( true );
103 : #endif
104 : }
105 :
106 :
107 :
108 0 : XLibraryContainer * SfxApplication::GetDialogContainer()
109 : {
110 : #if !HAVE_FEATURE_SCRIPTING
111 : return NULL;
112 : #else
113 0 : if ( !pAppData_Impl->pBasicManager->isValid() )
114 0 : GetBasicManager();
115 0 : return pAppData_Impl->pBasicManager->getLibraryContainer( SfxBasicManagerHolder::DIALOGS );
116 : #endif
117 : }
118 :
119 :
120 :
121 50 : XLibraryContainer * SfxApplication::GetBasicContainer()
122 : {
123 : #if !HAVE_FEATURE_SCRIPTING
124 : return NULL;
125 : #else
126 50 : if ( !pAppData_Impl->pBasicManager->isValid() )
127 2 : GetBasicManager();
128 50 : return pAppData_Impl->pBasicManager->getLibraryContainer( SfxBasicManagerHolder::SCRIPTS );
129 : #endif
130 : }
131 :
132 2563 : StarBASIC* SfxApplication::GetBasic()
133 : {
134 : #if !HAVE_FEATURE_SCRIPTING
135 : return 0;
136 : #else
137 2563 : return GetBasicManager()->GetLib(0);
138 : #endif
139 : }
140 :
141 0 : void SfxApplication::PropExec_Impl( SfxRequest &rReq )
142 : {
143 0 : sal_uInt16 nSID = rReq.GetSlot();
144 0 : switch ( nSID )
145 : {
146 : case SID_ATTR_UNDO_COUNT:
147 : {
148 0 : SFX_REQUEST_ARG(rReq, pCountItem, SfxUInt16Item, nSID, false);
149 : std::shared_ptr< comphelper::ConfigurationChanges > batch(
150 0 : comphelper::ConfigurationChanges::create());
151 : officecfg::Office::Common::Undo::Steps::set(
152 0 : pCountItem->GetValue(), batch);
153 0 : batch->commit();
154 0 : break;
155 : }
156 :
157 : default:
158 : assert(false);
159 : }
160 0 : }
161 :
162 0 : void SfxApplication::PropState_Impl( SfxItemSet &rSet )
163 : {
164 0 : SfxWhichIter aIter(rSet);
165 0 : for ( sal_uInt16 nSID = aIter.FirstWhich(); nSID; nSID = aIter.NextWhich() )
166 : {
167 0 : switch ( nSID )
168 : {
169 : case SID_ATTR_UNDO_COUNT:
170 : rSet.Put(
171 : SfxUInt16Item(
172 : SID_ATTR_UNDO_COUNT,
173 0 : officecfg::Office::Common::Undo::Steps::get()));
174 0 : break;
175 :
176 : default:
177 : assert(false);
178 : }
179 0 : }
180 648 : }
181 :
182 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|