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 168 : sal_uInt16 SfxApplication::SaveBasicAndDialogContainer() const
91 : {
92 168 : if ( pAppData_Impl->pBasicManager->isValid() )
93 64 : pAppData_Impl->pBasicManager->storeAllLibraries();
94 168 : return 0;
95 : }
96 :
97 20790 : BasicManager* SfxApplication::GetBasicManager()
98 : {
99 : #if !HAVE_FEATURE_SCRIPTING
100 : return 0;
101 : #else
102 20790 : 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 96 : XLibraryContainer * SfxApplication::GetBasicContainer()
122 : {
123 : #if !HAVE_FEATURE_SCRIPTING
124 : return NULL;
125 : #else
126 96 : if ( !pAppData_Impl->pBasicManager->isValid() )
127 4 : GetBasicManager();
128 96 : return pAppData_Impl->pBasicManager->getLibraryContainer( SfxBasicManagerHolder::SCRIPTS );
129 : #endif
130 : }
131 :
132 :
133 :
134 3430 : StarBASIC* SfxApplication::GetBasic()
135 : {
136 : #if !HAVE_FEATURE_SCRIPTING
137 : return 0;
138 : #else
139 3430 : return GetBasicManager()->GetLib(0);
140 : #endif
141 : }
142 :
143 :
144 0 : void SfxApplication::PropExec_Impl( SfxRequest &rReq )
145 : {
146 0 : rReq.GetArgs();
147 0 : sal_uInt16 nSID = rReq.GetSlot();
148 0 : switch ( nSID )
149 : {
150 : case SID_ATTR_UNDO_COUNT:
151 : {
152 0 : SFX_REQUEST_ARG(rReq, pCountItem, SfxUInt16Item, nSID, false);
153 : boost::shared_ptr< comphelper::ConfigurationChanges > batch(
154 0 : comphelper::ConfigurationChanges::create());
155 : officecfg::Office::Common::Undo::Steps::set(
156 0 : pCountItem->GetValue(), batch);
157 0 : batch->commit();
158 0 : break;
159 : }
160 :
161 : default:
162 : assert(false);
163 : }
164 0 : }
165 :
166 :
167 0 : void SfxApplication::PropState_Impl( SfxItemSet &rSet )
168 : {
169 0 : SfxWhichIter aIter(rSet);
170 0 : for ( sal_uInt16 nSID = aIter.FirstWhich(); nSID; nSID = aIter.NextWhich() )
171 : {
172 0 : switch ( nSID )
173 : {
174 : case SID_ATTR_UNDO_COUNT:
175 : rSet.Put(
176 : SfxUInt16Item(
177 : SID_ATTR_UNDO_COUNT,
178 0 : officecfg::Office::Common::Undo::Steps::get()));
179 0 : break;
180 :
181 : default:
182 : assert(false);
183 : }
184 0 : }
185 951 : }
186 :
187 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|