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 : #ifndef INCLUDED_SFX2_SFXBASEMODEL_HXX
21 : #define INCLUDED_SFX2_SFXBASEMODEL_HXX
22 :
23 : #include <sal/config.h>
24 : #include <sfx2/dllapi.h>
25 : #include <sal/types.h>
26 : #include <com/sun/star/lang/XTypeProvider.hpp>
27 : #include <com/sun/star/frame/XModule.hpp>
28 : #include <com/sun/star/frame/XTitle.hpp>
29 : #include <com/sun/star/frame/XTitleChangeBroadcaster.hpp>
30 : #include <com/sun/star/frame/XUntitledNumbers.hpp>
31 : #include <com/sun/star/container/XChild.hpp>
32 : #include <com/sun/star/container/XNameContainer.hpp>
33 : #include <com/sun/star/container/XNameReplace.hpp>
34 : #include <com/sun/star/frame/XController2.hpp>
35 : #include <com/sun/star/document/XCmisDocument.hpp>
36 : #include <com/sun/star/document/CmisVersion.hpp>
37 : #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
38 : #include <com/sun/star/document/XDocumentRecovery.hpp>
39 : #include <com/sun/star/document/XUndoManagerSupplier.hpp>
40 : #include <com/sun/star/rdf/XDocumentMetadataAccess.hpp>
41 : #include <com/sun/star/document/XEventBroadcaster.hpp>
42 : #include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
43 : #include <com/sun/star/document/XEventListener.hpp>
44 : #include <com/sun/star/document/XEventsSupplier.hpp>
45 : #include <com/sun/star/document/XEmbeddedScripts.hpp>
46 : #include <com/sun/star/document/EventObject.hpp>
47 : #include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
48 : #include <com/sun/star/document/XStorageBasedDocument.hpp>
49 : #include <com/sun/star/document/XScriptInvocationContext.hpp>
50 : #include <com/sun/star/lang/XEventListener.hpp>
51 : #include <com/sun/star/lang/NotInitializedException.hpp>
52 : #include <com/sun/star/lang/DisposedException.hpp>
53 : #include <com/sun/star/frame/XModel2.hpp>
54 : #include <com/sun/star/frame/DoubleInitializationException.hpp>
55 : #include <com/sun/star/util/XModifiable2.hpp>
56 : #include <com/sun/star/util/XModifyListener.hpp>
57 : #include <com/sun/star/util/XCloseable.hpp>
58 : #include <com/sun/star/util/XCloseBroadcaster.hpp>
59 : #include <com/sun/star/util/XCloseListener.hpp>
60 : #include <com/sun/star/util/CloseVetoException.hpp>
61 : #include <com/sun/star/view/XPrintable.hpp>
62 : #include <com/sun/star/view/XPrintJobBroadcaster.hpp>
63 : #include <com/sun/star/frame/XStorable.hpp>
64 : #include <com/sun/star/frame/XStorable2.hpp>
65 : #include <com/sun/star/frame/XLoadable.hpp>
66 : #include <com/sun/star/beans/PropertyValue.hpp>
67 : #include <com/sun/star/document/CmisProperty.hpp>
68 : #include <com/sun/star/lang/EventObject.hpp>
69 : #include <com/sun/star/datatransfer/XTransferable.hpp>
70 : #include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
71 : #include <com/sun/star/ui/XUIConfigurationManager2.hpp>
72 : #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
73 : #include <com/sun/star/embed/XVisualObject.hpp>
74 : #include <com/sun/star/uno/Sequence.hxx>
75 : #include <com/sun/star/uno/Reference.hxx>
76 : #include <com/sun/star/uno/Any.hxx>
77 : #include <cppuhelper/weak.hxx>
78 : #include <cppuhelper/basemutex.hxx>
79 : #include <cppuhelper/typeprovider.hxx>
80 : #include <com/sun/star/script/XStarBasicAccess.hpp>
81 : #include <osl/mutex.hxx>
82 : #include <vcl/svapp.hxx>
83 :
84 : #include <com/sun/star/document/XViewDataSupplier.hpp>
85 : #include <com/sun/star/lang/XUnoTunnel.hpp>
86 : #include <com/sun/star/task/XInteractionHandler.hpp>
87 :
88 : #ifndef INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_32
89 : #define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_32
90 : #define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 32
91 : #include <comphelper/implbase_var.hxx>
92 : #endif
93 :
94 : #include <svl/lstner.hxx>
95 :
96 : class SfxMedium;
97 : class SfxPrinter;
98 : class SfxViewShell;
99 : class SfxObjectShell ;
100 : class SfxEventHint;
101 : class SfxViewFrame;
102 : struct IMPL_SfxBaseModel_DataContainer ; // impl. struct to hold member of class SfxBaseModel
103 :
104 : namespace sfx { namespace intern {
105 : class ViewCreationGuard;
106 : } }
107 :
108 : // class declarations
109 :
110 :
111 : /**_______________________________________________________________________________________________________
112 : @implements XChild
113 : XComponent
114 : document::XDocumentPropertiesSupplier
115 : rdf::XDocumentMetadataAccess
116 : XEventListener
117 : XModel
118 : XModifiable2
119 : XPrintable
120 : XStorable2
121 : document::XEventBroadcaster
122 : document::XEventsSupplier
123 : document::XEmbeddedScripts
124 : document::XScriptInvocationContext
125 : XCloseable
126 : XCloseBroadcaster
127 :
128 : @base cppu::BaseMutex
129 : SfxListener
130 : */
131 :
132 : typedef ::comphelper::WeakImplHelper32 < css::container::XChild
133 : , css::document::XDocumentPropertiesSupplier
134 : , css::document::XCmisDocument
135 : , css::rdf::XDocumentMetadataAccess
136 : , css::document::XDocumentRecovery
137 : , css::document::XUndoManagerSupplier
138 : , css::document::XEventBroadcaster
139 : , css::document::XDocumentEventBroadcaster
140 : , css::lang::XEventListener
141 : , css::document::XEventsSupplier
142 : , css::document::XEmbeddedScripts
143 : , css::document::XScriptInvocationContext
144 : , css::frame::XModel2
145 : , css::util::XModifiable2
146 : , css::view::XPrintable
147 : , css::view::XPrintJobBroadcaster
148 : , css::frame::XStorable2
149 : , css::frame::XLoadable
150 : , css::script::XStarBasicAccess
151 : , css::document::XViewDataSupplier
152 : , css::util::XCloseable // => css::util::XCloseBroadcaster
153 : , css::datatransfer::XTransferable
154 : , css::document::XDocumentSubStorageSupplier
155 : , css::document::XStorageBasedDocument
156 : , css::script::provider::XScriptProviderSupplier
157 : , css::ui::XUIConfigurationManagerSupplier
158 : , css::embed::XVisualObject
159 : , css::lang::XUnoTunnel
160 : , css::frame::XModule
161 : , css::frame::XTitle
162 : , css::frame::XTitleChangeBroadcaster
163 : , css::frame::XUntitledNumbers
164 : > SfxBaseModel_Base;
165 :
166 : class SFX2_DLLPUBLIC SfxBaseModel : protected ::cppu::BaseMutex
167 : , public SfxBaseModel_Base
168 : , public SfxListener
169 : {
170 :
171 :
172 : // public methods
173 :
174 :
175 : public:
176 :
177 :
178 : // constructor/destructor
179 :
180 :
181 : SfxBaseModel( SfxObjectShell *pObjectShell = NULL ) ;
182 :
183 : virtual ~SfxBaseModel() ;
184 :
185 :
186 : // XInterface
187 :
188 :
189 : /**___________________________________________________________________________________________________
190 : @short give answer, if interface is supported
191 : @descr The interfaces are searched by type.
192 :
193 : @seealso XInterface
194 :
195 : @param "rType" is the type of searched interface.
196 :
197 : @return Any information about found interface
198 :
199 : @onerror A RuntimeException is thrown.
200 : */
201 :
202 : virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE ;
203 :
204 : /**___________________________________________________________________________________________________
205 : @short increment refcount
206 : @seealso XInterface
207 : @seealso release()
208 : @onerror A RuntimeException is thrown.
209 : */
210 :
211 : virtual void SAL_CALL acquire() throw() SAL_OVERRIDE ;
212 :
213 : /**___________________________________________________________________________________________________
214 : @short decrement refcount
215 : @seealso XInterface
216 : @seealso acquire()
217 : @onerror A RuntimeException is thrown.
218 : */
219 :
220 : virtual void SAL_CALL release() throw() SAL_OVERRIDE ;
221 :
222 :
223 : // XTypeProvider
224 :
225 :
226 : /**___________________________________________________________________________________________________
227 : @short get information about supported interfaces
228 : @seealso XTypeProvider
229 : @return Sequence of types of all supported interfaces
230 :
231 : @onerror A RuntimeException is thrown.
232 : */
233 :
234 : virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE ;
235 :
236 : /**___________________________________________________________________________________________________
237 : @short get implementation id
238 : @descr This ID is necessary for UNO-caching. If there no ID, cache is disabled.
239 : Another way, cache is enabled.
240 :
241 : @seealso XTypeProvider
242 : @return ID as Sequence of byte
243 :
244 : @onerror A RuntimeException is thrown.
245 : */
246 :
247 : virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE ;
248 :
249 :
250 :
251 : // XStarBasicAccess
252 :
253 :
254 : /**___________________________________________________________________________________________________
255 : @seealso XStarBasicAccess
256 : */
257 : virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getLibraryContainer() throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
258 :
259 : /**___________________________________________________________________________________________________
260 : @seealso XStarBasicAccess
261 : */
262 : virtual void SAL_CALL createLibrary( const OUString& LibName, const OUString& Password,
263 : const OUString& ExternalSourceURL, const OUString& LinkTargetURL )
264 : throw(css::container::ElementExistException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
265 :
266 : /**___________________________________________________________________________________________________
267 : @seealso XStarBasicAccess
268 : */
269 : virtual void SAL_CALL addModule( const OUString& LibraryName, const OUString& ModuleName,
270 : const OUString& Language, const OUString& Source )
271 : throw( css::container::NoSuchElementException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
272 :
273 : /**___________________________________________________________________________________________________
274 : @seealso XStarBasicAccess
275 : */
276 : virtual void SAL_CALL addDialog( const OUString& LibraryName, const OUString& DialogName,
277 : const css::uno::Sequence< sal_Int8 >& Data )
278 : throw(css::container::NoSuchElementException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
279 :
280 :
281 :
282 : // XChild
283 :
284 :
285 : virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE ;
286 :
287 : virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& xParent ) throw(css::lang::NoSupportException,
288 : css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
289 :
290 :
291 : // XComponent
292 :
293 :
294 : virtual void SAL_CALL dispose() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
295 :
296 : virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener >& aListener) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
297 :
298 : virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener >& aListener ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
299 :
300 : // XDocumentPropertiesSupplier
301 : virtual css::uno::Reference< css::document::XDocumentProperties >
302 : SAL_CALL getDocumentProperties()
303 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
304 :
305 :
306 : // XEventListener
307 :
308 :
309 : virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
310 :
311 :
312 : // XModel
313 :
314 :
315 : virtual sal_Bool SAL_CALL attachResource(const OUString& sURL,
316 : const css::uno::Sequence< css::beans::PropertyValue >& aArgs)
317 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
318 :
319 : virtual OUString SAL_CALL getURL() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
320 :
321 : virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getArgs() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
322 :
323 : virtual void SAL_CALL connectController( const css::uno::Reference< css::frame::XController >& xController ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
324 :
325 : virtual void SAL_CALL disconnectController( const css::uno::Reference< css::frame::XController >& xController ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
326 :
327 : virtual void SAL_CALL lockControllers() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
328 :
329 : virtual void SAL_CALL unlockControllers() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
330 :
331 : virtual sal_Bool SAL_CALL hasControllersLocked() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
332 :
333 : virtual css::uno::Reference< css::frame::XController > SAL_CALL getCurrentController() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
334 :
335 : virtual void SAL_CALL setCurrentController( const css::uno::Reference< css::frame::XController >& xController )
336 : throw (css::container::NoSuchElementException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
337 :
338 : virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getCurrentSelection() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
339 :
340 :
341 : // XModel2
342 :
343 : virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL getControllers()
344 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
345 :
346 : virtual css::uno::Sequence< OUString > SAL_CALL getAvailableViewControllerNames()
347 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
348 :
349 : virtual css::uno::Reference< css::frame::XController2 > SAL_CALL createDefaultViewController(const css::uno::Reference< css::frame::XFrame >& Frame )
350 : throw (css::uno::RuntimeException ,
351 : css::lang::IllegalArgumentException,
352 : css::uno::Exception, std::exception ) SAL_OVERRIDE;
353 :
354 : virtual css::uno::Reference< css::frame::XController2 > SAL_CALL createViewController(const OUString& ViewName ,
355 : const css::uno::Sequence< css::beans::PropertyValue >& Arguments ,
356 : const css::uno::Reference< css::frame::XFrame >& Frame )
357 : throw (css::uno::RuntimeException ,
358 : css::lang::IllegalArgumentException,
359 : css::uno::Exception, std::exception ) SAL_OVERRIDE;
360 :
361 :
362 : // XModifiable2
363 :
364 :
365 : virtual sal_Bool SAL_CALL disableSetModified( ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
366 : virtual sal_Bool SAL_CALL enableSetModified( ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
367 : virtual sal_Bool SAL_CALL isSetModifiedEnabled( ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
368 :
369 : virtual sal_Bool SAL_CALL isModified() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
370 :
371 : virtual void SAL_CALL setModified( sal_Bool bModified )
372 : throw (css::beans::PropertyVetoException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
373 :
374 : virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& xListener ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE ;
375 :
376 : virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > & xListener) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE ;
377 :
378 :
379 : // XCloseable
380 :
381 :
382 : virtual void SAL_CALL close( sal_Bool bDeliverOwnership ) throw (css::util::CloseVetoException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
383 :
384 :
385 : // XCloseBroadcaster
386 :
387 :
388 : virtual void SAL_CALL addCloseListener( const css::uno::Reference< css::util::XCloseListener >& xListener ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
389 : virtual void SAL_CALL removeCloseListener( const css::uno::Reference< css::util::XCloseListener >& xListener ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
390 :
391 :
392 : // XPrintJobBroadcaster
393 :
394 :
395 : virtual void SAL_CALL addPrintJobListener( const css::uno::Reference< css::view::XPrintJobListener >& xListener ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
396 : virtual void SAL_CALL removePrintJobListener( const css::uno::Reference< css::view::XPrintJobListener >& xListener ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
397 :
398 :
399 : // XPrintable
400 :
401 :
402 : virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPrinter() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
403 :
404 : virtual void SAL_CALL setPrinter( const css::uno::Sequence< css::beans::PropertyValue >& seqPrinter )
405 : throw (css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
406 : virtual void SAL_CALL print( const css::uno::Sequence< css::beans::PropertyValue >& seqOptions )
407 : throw (css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
408 :
409 :
410 : // XStorable2
411 :
412 :
413 : virtual void SAL_CALL storeSelf( const css::uno::Sequence< css::beans::PropertyValue >& seqArguments )
414 : throw (css::lang::IllegalArgumentException, css::io::IOException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
415 :
416 :
417 : // XStorable
418 :
419 :
420 : virtual sal_Bool SAL_CALL hasLocation() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
421 :
422 : virtual OUString SAL_CALL getLocation() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
423 :
424 : virtual sal_Bool SAL_CALL isReadonly() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
425 :
426 : virtual void SAL_CALL store() throw (css::io::IOException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
427 :
428 : virtual void SAL_CALL storeAsURL( const OUString& sURL,
429 : const css::uno::Sequence< css::beans::PropertyValue >& seqArguments )
430 : throw (css::io::IOException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE ;
431 :
432 : virtual void SAL_CALL storeToURL( const OUString& sURL,
433 : const css::uno::Sequence< css::beans::PropertyValue >& seqArguments )
434 : throw (css::io::IOException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
435 :
436 :
437 :
438 :
439 : // XLoadable
440 :
441 :
442 : virtual void SAL_CALL initNew()
443 : throw (css::frame::DoubleInitializationException,
444 : css::io::IOException,
445 : css::uno::RuntimeException,
446 : css::uno::Exception, std::exception) SAL_OVERRIDE;
447 :
448 : virtual void SAL_CALL load( const css::uno::Sequence< css::beans::PropertyValue >& seqArguments )
449 : throw (css::frame::DoubleInitializationException,
450 : css::io::IOException,
451 : css::uno::RuntimeException,
452 : css::uno::Exception, std::exception) SAL_OVERRIDE;
453 :
454 :
455 : // XDocumentSubStorageSupplier
456 :
457 :
458 : virtual css::uno::Reference< css::embed::XStorage > SAL_CALL getDocumentSubStorage( const OUString& aStorageName, sal_Int32 nMode )
459 : throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
460 :
461 : virtual css::uno::Sequence< OUString > SAL_CALL getDocumentSubStoragesNames()
462 : throw ( css::io::IOException, css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
463 :
464 :
465 : // XStorageBasedDocument
466 :
467 :
468 : virtual void SAL_CALL loadFromStorage( const css::uno::Reference< css::embed::XStorage >& xStorage,
469 : const css::uno::Sequence< css::beans::PropertyValue >& aMediaDescriptor )
470 : throw ( css::lang::IllegalArgumentException,
471 : com::sun::star::frame::DoubleInitializationException,
472 : css::io::IOException,
473 : css::uno::Exception,
474 : css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
475 :
476 : virtual void SAL_CALL storeToStorage( const css::uno::Reference< css::embed::XStorage >& xStorage,
477 : const css::uno::Sequence< css::beans::PropertyValue >& aMediaDescriptor )
478 : throw ( css::lang::IllegalArgumentException,
479 : css::io::IOException,
480 : css::uno::Exception,
481 : css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
482 :
483 : virtual void SAL_CALL switchToStorage( const css::uno::Reference< css::embed::XStorage >& xStorage )
484 : throw ( css::lang::IllegalArgumentException,
485 : css::io::IOException,
486 : css::uno::Exception,
487 : css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
488 :
489 : virtual css::uno::Reference< css::embed::XStorage > SAL_CALL getDocumentStorage()
490 : throw ( css::io::IOException,
491 : css::uno::Exception,
492 : css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
493 :
494 : virtual void SAL_CALL addStorageChangeListener(
495 : const css::uno::Reference< css::document::XStorageChangeListener >& xListener )
496 : throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
497 :
498 : virtual void SAL_CALL removeStorageChangeListener(
499 : const css::uno::Reference< css::document::XStorageChangeListener >& xListener )
500 : throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
501 :
502 :
503 : // XVisualObject
504 :
505 :
506 : virtual void SAL_CALL setVisualAreaSize( sal_Int64 nAspect, const css::awt::Size& aSize )
507 : throw ( css::lang::IllegalArgumentException,
508 : css::embed::WrongStateException,
509 : css::uno::Exception,
510 : css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
511 :
512 : virtual css::awt::Size SAL_CALL getVisualAreaSize( sal_Int64 nAspect )
513 : throw ( css::lang::IllegalArgumentException,
514 : css::embed::WrongStateException,
515 : css::uno::Exception,
516 : css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
517 :
518 : virtual css::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect )
519 : throw ( css::lang::IllegalArgumentException,
520 : css::embed::WrongStateException,
521 : css::uno::Exception,
522 : css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
523 :
524 : virtual sal_Int32 SAL_CALL getMapUnit( sal_Int64 nAspect )
525 : throw ( css::uno::Exception,
526 : css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
527 :
528 :
529 : // XScriptProviderSupplier
530 :
531 :
532 : virtual css::uno::Reference< css::script::provider::XScriptProvider > SAL_CALL getScriptProvider() throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
533 :
534 :
535 : // XUIConfigurationManagerSupplier
536 : virtual css::uno::Reference< css::ui::XUIConfigurationManager > SAL_CALL getUIConfigurationManager() throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
537 :
538 :
539 : // XTransferable
540 :
541 :
542 : virtual css::uno::Any SAL_CALL getTransferData( const css::datatransfer::DataFlavor& aFlavor )
543 : throw (css::datatransfer::UnsupportedFlavorException,
544 : css::io::IOException,
545 : css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
546 :
547 : virtual css::uno::Sequence< css::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors()
548 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
549 :
550 : virtual sal_Bool SAL_CALL isDataFlavorSupported( const css::datatransfer::DataFlavor& aFlavor )
551 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
552 :
553 :
554 :
555 : // XEventsSupplier
556 :
557 :
558 : /**___________________________________________________________________________________________________
559 : @descr - offers a list of event handlers which are be bound to events of
560 : this object.
561 : @return - an Events object.
562 : */
563 :
564 : virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
565 :
566 :
567 :
568 : // XEmbeddedScripts
569 :
570 :
571 : virtual css::uno::Reference< css::script::XStorageBasedLibraryContainer > SAL_CALL getBasicLibraries() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
572 : virtual css::uno::Reference< css::script::XStorageBasedLibraryContainer > SAL_CALL getDialogLibraries() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
573 : virtual sal_Bool SAL_CALL getAllowMacroExecution() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
574 :
575 :
576 : // XScriptInvocationContext
577 :
578 :
579 : virtual css::uno::Reference< css::document::XEmbeddedScripts > SAL_CALL getScriptContainer() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
580 :
581 :
582 : // XEventBroadcaster
583 :
584 :
585 : /**___________________________________________________________________________________________________
586 : @descr - registers the given XEventListener.
587 : */
588 :
589 : virtual void SAL_CALL addEventListener( const css::uno::Reference< css::document::XEventListener >& xListener ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
590 :
591 : /**___________________________________________________________________________________________________
592 : @descr - unregisters the given XEventListener.
593 : */
594 :
595 : virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::document::XEventListener >& xListener ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
596 :
597 :
598 : // XDocumentEventBroadcaster
599 :
600 :
601 : virtual void SAL_CALL addDocumentEventListener( const css::uno::Reference< css::document::XDocumentEventListener >& _Listener ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
602 : virtual void SAL_CALL removeDocumentEventListener( const css::uno::Reference< css::document::XDocumentEventListener >& _Listener ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
603 : virtual void SAL_CALL notifyDocumentEvent( const OUString& _EventName, const css::uno::Reference< css::frame::XController2 >& _ViewController, const css::uno::Any& _Supplement ) throw (css::lang::IllegalArgumentException, css::lang::NoSupportException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
604 :
605 :
606 : // XUnoTunnel
607 :
608 :
609 : virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
610 :
611 : // css.frame.XModule
612 : virtual void SAL_CALL setIdentifier(const OUString& sIdentifier)
613 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
614 :
615 : // css.frame.XModule
616 : virtual OUString SAL_CALL getIdentifier()
617 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
618 :
619 : // css.frame.XTitle
620 : virtual OUString SAL_CALL getTitle()
621 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
622 :
623 : // css.frame.XTitle
624 : virtual void SAL_CALL setTitle( const OUString& sTitle )
625 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
626 :
627 : // css.frame.XTitleChangeBroadcaster
628 : virtual void SAL_CALL addTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener )
629 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
630 :
631 : // css.frame.XTitleChangeBroadcaster
632 : virtual void SAL_CALL removeTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener )
633 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
634 :
635 : // css.frame.XUntitledNumbers
636 : virtual ::sal_Int32 SAL_CALL leaseNumber( const css::uno::Reference< css::uno::XInterface >& xComponent )
637 : throw (css::lang::IllegalArgumentException,
638 : css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
639 :
640 : // css.frame.XUntitledNumbers
641 : virtual void SAL_CALL releaseNumber( ::sal_Int32 nNumber )
642 : throw (css::lang::IllegalArgumentException,
643 : css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
644 :
645 : // css.frame.XUntitledNumbers
646 : virtual void SAL_CALL releaseNumberForComponent( const css::uno::Reference< css::uno::XInterface >& xComponent )
647 : throw (css::lang::IllegalArgumentException,
648 : css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
649 :
650 : // css.frame.XUntitledNumbers
651 : virtual OUString SAL_CALL getUntitledPrefix()
652 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
653 :
654 : // css.document.XDocumentRecovery
655 : virtual sal_Bool SAL_CALL wasModifiedSinceLastSave()
656 : throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
657 : virtual void SAL_CALL storeToRecoveryFile( const OUString& i_TargetLocation, const css::uno::Sequence< css::beans::PropertyValue >& i_MediaDescriptor )
658 : throw ( css::uno::RuntimeException,
659 : css::io::IOException,
660 : css::lang::WrappedTargetException, std::exception ) SAL_OVERRIDE;
661 : virtual void SAL_CALL recoverFromFile( const OUString& i_SourceLocation, const OUString& i_SalvagedFile, const css::uno::Sequence< css::beans::PropertyValue >& i_MediaDescriptor )
662 : throw ( css::uno::RuntimeException,
663 : css::io::IOException,
664 : css::lang::WrappedTargetException, std::exception ) SAL_OVERRIDE;
665 :
666 : // css.document.XUndoManagerSupplier
667 : virtual css::uno::Reference< css::document::XUndoManager > SAL_CALL getUndoManager( ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
668 :
669 :
670 :
671 : // css::rdf::XNode:
672 : virtual OUString SAL_CALL getStringValue()
673 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
674 :
675 : // css::rdf::XURI:
676 : virtual OUString SAL_CALL getNamespace()
677 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
678 : virtual OUString SAL_CALL getLocalName()
679 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
680 :
681 : // css::rdf::XRepositorySupplier:
682 : virtual css::uno::Reference<
683 : css::rdf::XRepository > SAL_CALL getRDFRepository()
684 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
685 :
686 : // css::rdf::XDocumentMetadataAccess:
687 : virtual css::uno::Reference<
688 : css::rdf::XMetadatable > SAL_CALL
689 : getElementByMetadataReference(
690 : const css::beans::StringPair & i_rReference)
691 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
692 : virtual css::uno::Reference<
693 : css::rdf::XMetadatable > SAL_CALL
694 : getElementByURI(const css::uno::Reference<
695 : css::rdf::XURI > & i_xURI)
696 : throw (css::uno::RuntimeException,
697 : css::lang::IllegalArgumentException, std::exception) SAL_OVERRIDE;
698 : virtual css::uno::Sequence< css::uno::Reference<
699 : css::rdf::XURI > > SAL_CALL getMetadataGraphsWithType(
700 : const css::uno::Reference<
701 : css::rdf::XURI > & i_xType)
702 : throw (css::uno::RuntimeException,
703 : css::lang::IllegalArgumentException, std::exception) SAL_OVERRIDE;
704 : virtual css::uno::Reference<
705 : css::rdf::XURI> SAL_CALL
706 : addMetadataFile(const OUString & i_rFileName,
707 : const css::uno::Sequence<
708 : css::uno::Reference< css::rdf::XURI >
709 : > & i_rTypes)
710 : throw (css::uno::RuntimeException,
711 : css::lang::IllegalArgumentException,
712 : css::container::ElementExistException, std::exception) SAL_OVERRIDE;
713 : virtual css::uno::Reference<
714 : css::rdf::XURI> SAL_CALL
715 : importMetadataFile(::sal_Int16 i_Format,
716 : const css::uno::Reference<
717 : css::io::XInputStream > & i_xInStream,
718 : const OUString & i_rFileName,
719 : const css::uno::Reference<
720 : css::rdf::XURI > & i_xBaseURI,
721 : const css::uno::Sequence<
722 : css::uno::Reference< css::rdf::XURI >
723 : > & i_rTypes)
724 : throw (css::uno::RuntimeException,
725 : css::lang::IllegalArgumentException,
726 : css::datatransfer::UnsupportedFlavorException,
727 : css::container::ElementExistException,
728 : css::rdf::ParseException,
729 : css::io::IOException, std::exception) SAL_OVERRIDE;
730 : virtual void SAL_CALL removeMetadataFile(
731 : const css::uno::Reference<
732 : css::rdf::XURI > & i_xGraphName)
733 : throw (css::uno::RuntimeException,
734 : css::lang::IllegalArgumentException,
735 : css::container::NoSuchElementException, std::exception) SAL_OVERRIDE;
736 : virtual void SAL_CALL addContentOrStylesFile(
737 : const OUString & i_rFileName)
738 : throw (css::uno::RuntimeException,
739 : css::lang::IllegalArgumentException,
740 : css::container::ElementExistException, std::exception) SAL_OVERRIDE;
741 : virtual void SAL_CALL removeContentOrStylesFile(
742 : const OUString & i_rFileName)
743 : throw (css::uno::RuntimeException,
744 : css::lang::IllegalArgumentException,
745 : css::container::NoSuchElementException, std::exception) SAL_OVERRIDE;
746 :
747 : virtual void SAL_CALL loadMetadataFromStorage(
748 : const css::uno::Reference<
749 : css::embed::XStorage > & i_xStorage,
750 : const css::uno::Reference<
751 : css::rdf::XURI > & i_xBaseURI,
752 : const css::uno::Reference<
753 : css::task::XInteractionHandler> & i_xHandler)
754 : throw (css::uno::RuntimeException,
755 : css::lang::IllegalArgumentException,
756 : css::lang::WrappedTargetException, std::exception) SAL_OVERRIDE;
757 : virtual void SAL_CALL storeMetadataToStorage(
758 : const css::uno::Reference<
759 : css::embed::XStorage > & i_xStorage)
760 : throw (css::uno::RuntimeException,
761 : css::lang::IllegalArgumentException,
762 : css::lang::WrappedTargetException, std::exception) SAL_OVERRIDE;
763 : virtual void SAL_CALL loadMetadataFromMedium(
764 : const css::uno::Sequence<
765 : css::beans::PropertyValue > & i_rMedium)
766 : throw (css::uno::RuntimeException,
767 : css::lang::IllegalArgumentException,
768 : css::lang::WrappedTargetException, std::exception) SAL_OVERRIDE;
769 : virtual void SAL_CALL storeMetadataToMedium(
770 : const css::uno::Sequence<
771 : css::beans::PropertyValue > & i_rMedium)
772 : throw (css::uno::RuntimeException,
773 : css::lang::IllegalArgumentException,
774 : css::lang::WrappedTargetException, std::exception) SAL_OVERRIDE;
775 :
776 : // XCmisDocument
777 :
778 : virtual css::uno::Sequence< css::document::CmisProperty >
779 : SAL_CALL getCmisProperties()
780 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
781 : virtual void SAL_CALL setCmisProperties(
782 : const css::uno::Sequence<
783 : css::document::CmisProperty >& _cmisproperties )
784 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
785 :
786 : virtual void SAL_CALL updateCmisProperties(
787 : const css::uno::Sequence<
788 : css::document::CmisProperty >& _cmisproperties )
789 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
790 :
791 : virtual css::uno::Sequence< css::document::CmisVersion > SAL_CALL getAllVersions ( )
792 : throw (css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
793 :
794 : virtual void SAL_CALL checkOut( ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
795 : virtual void SAL_CALL cancelCheckOut( ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
796 : virtual void SAL_CALL checkIn( sal_Bool bIsMajor, const OUString & rMessage )
797 : throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
798 :
799 : virtual sal_Bool SAL_CALL isVersionable( ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
800 : virtual sal_Bool SAL_CALL canCheckOut( ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
801 : virtual sal_Bool SAL_CALL canCancelCheckOut( ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
802 : virtual sal_Bool SAL_CALL canCheckIn( ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
803 :
804 : bool getBoolPropertyValue( const OUString& rName ) throw ( css::uno::RuntimeException );
805 :
806 :
807 : // SfxListener
808 :
809 :
810 : void Notify( SfxBroadcaster& aBC ,
811 : const SfxHint& aHint ) SAL_OVERRIDE ;
812 :
813 :
814 : // public IMPL?
815 :
816 :
817 : void changing() ;
818 :
819 : SfxObjectShell* GetObjectShell() const ;
820 :
821 : SAL_DLLPRIVATE bool impl_isDisposed() const ;
822 : bool IsInitialized() const;
823 : bool IsDisposed() const { return impl_isDisposed(); }
824 : void MethodEntryCheck( const bool i_mustBeInitialized ) const;
825 : ::osl::Mutex& getMutex() const { return m_aMutex; }
826 :
827 : css::uno::Reference < css::container::XIndexAccess > SAL_CALL getViewData() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
828 : void SAL_CALL setViewData( const css::uno::Reference < css::container::XIndexAccess >& aData ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
829 :
830 : /** calls all XEventListeners */
831 : void notifyEvent( const css::document::EventObject& aEvent ) const;
832 :
833 : /** returns true if someone added a XEventListener to this XEventBroadcaster */
834 : bool hasEventListeners() const;
835 :
836 : protected:
837 :
838 : /* returns a unique id for the model that is valid as long as the document
839 : is loaded. The id is not saved across document close/reload. */
840 : OUString getRuntimeUID() const;
841 :
842 : /* returns true if the document signatures are valid, otherwise false */
843 : bool hasValidSignatures() const;
844 :
845 : /* GrabBagItem for interim interop purposes */
846 : void getGrabBagItem(com::sun::star::uno::Any& rVal) const;
847 :
848 : void setGrabBagItem(const com::sun::star::uno::Any& rVal);
849 :
850 :
851 : // private methods
852 :
853 :
854 : private:
855 :
856 : css::uno::Reference< css::ui::XUIConfigurationManager2 > getUIConfigurationManager2() throw ( css::uno::RuntimeException );
857 : bool impl_getPrintHelper();
858 : SAL_DLLPRIVATE void ListenForStorage_Impl( const css::uno::Reference< css::embed::XStorage >& xStorage );
859 : SAL_DLLPRIVATE OUString GetMediumFilterName_Impl();
860 :
861 : SAL_DLLPRIVATE void impl_store( const OUString& sURL,
862 : const css::uno::Sequence< css::beans::PropertyValue >& seqArguments ,
863 : bool bSaveTo ) ;
864 :
865 : SAL_DLLPRIVATE void postEvent_Impl( const OUString& aName, const css::uno::Reference< css::frame::XController2 >& xController = css::uno::Reference< css::frame::XController2 >() );
866 :
867 : SAL_DLLPRIVATE OUString getEventName_Impl( long nID );
868 : SAL_DLLPRIVATE bool QuerySaveSizeExceededModules( const com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >& xHandler );
869 :
870 : SAL_DLLPRIVATE css::uno::Reference< css::frame::XTitle > impl_getTitleHelper ();
871 : SAL_DLLPRIVATE css::uno::Reference< css::frame::XUntitledNumbers > impl_getUntitledHelper ();
872 :
873 : SAL_DLLPRIVATE SfxViewFrame* FindOrCreateViewFrame_Impl(
874 : const css::uno::Reference< css::frame::XFrame >& i_rFrame,
875 : ::sfx::intern::ViewCreationGuard& i_rGuard
876 : ) const;
877 :
878 : SAL_DLLPRIVATE void NotifyModifyListeners_Impl() const;
879 :
880 : SAL_DLLPRIVATE void loadCmisProperties();
881 :
882 : SAL_DLLPRIVATE void handleLoadError( sal_uInt32 nError, SfxMedium* pMedium );
883 :
884 :
885 : // private variables and methods
886 :
887 :
888 : private:
889 :
890 : IMPL_SfxBaseModel_DataContainer* m_pData ;
891 : // cannot be held in m_pData, since it needs to be accessed in non-threadsafe context
892 : const bool m_bSupportEmbeddedScripts;
893 : const bool m_bSupportDocRecovery;
894 :
895 : } ; // class SfxBaseModel
896 :
897 : /** base class for sub components of an SfxBaseModel, which share their ref count and lifetime with the SfxBaseModel
898 : */
899 : class SFX2_DLLPUBLIC SfxModelSubComponent
900 : {
901 : public:
902 : /** checks whether the instance is alive, i.e. properly initialized, and not yet disposed
903 : */
904 0 : void MethodEntryCheck()
905 : {
906 0 : m_rModel.MethodEntryCheck( true );
907 0 : }
908 :
909 : // called when the SfxBaseModel which the component is superordinate of is being disposed
910 : virtual void disposing();
911 :
912 : protected:
913 0 : SfxModelSubComponent( SfxBaseModel& i_model )
914 0 : :m_rModel( i_model )
915 : {
916 0 : }
917 : virtual ~SfxModelSubComponent();
918 :
919 : // helpers for implementing XInterface - delegates ref counting to the SfxBaseModel
920 0 : void acquire() { m_rModel.acquire(); }
921 0 : void release() { m_rModel.release(); }
922 :
923 : bool isDisposed() const { return m_rModel.IsDisposed(); }
924 :
925 : protected:
926 : const SfxBaseModel& getBaseModel() const { return m_rModel; }
927 0 : SfxBaseModel& getBaseModel() { return m_rModel; }
928 :
929 : ::osl::Mutex& getMutex() { return m_rModel.getMutex(); }
930 :
931 : private:
932 : SfxBaseModel& m_rModel;
933 : };
934 :
935 : class SFX2_DLLPUBLIC SfxModelGuard
936 : {
937 : public:
938 : enum AllowedModelState
939 : {
940 : // not yet initialized
941 : E_INITIALIZING,
942 : // fully alive, i.e. initialized, and not yet disposed
943 : E_FULLY_ALIVE
944 : };
945 :
946 0 : SfxModelGuard( SfxBaseModel& i_rModel, const AllowedModelState i_eState = E_FULLY_ALIVE )
947 0 : : m_aGuard()
948 : {
949 0 : i_rModel.MethodEntryCheck( i_eState != E_INITIALIZING );
950 0 : }
951 0 : SfxModelGuard( SfxModelSubComponent& i_rSubComponent )
952 0 : :m_aGuard()
953 : {
954 0 : i_rSubComponent.MethodEntryCheck();
955 0 : }
956 0 : ~SfxModelGuard()
957 0 : {
958 0 : }
959 :
960 : void reset()
961 : {
962 : m_aGuard.reset();
963 : }
964 :
965 0 : void clear()
966 : {
967 0 : m_aGuard.clear();
968 0 : }
969 :
970 : private:
971 : SolarMutexResettableGuard m_aGuard;
972 : };
973 :
974 : #endif // INCLUDED_SFX2_SFXBASEMODEL_HXX
975 :
976 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|