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/frame/XModule.hpp>
27 #include <com/sun/star/frame/XTitle.hpp>
28 #include <com/sun/star/frame/XTitleChangeBroadcaster.hpp>
29 #include <com/sun/star/frame/XUntitledNumbers.hpp>
30 #include <com/sun/star/container/XChild.hpp>
31 #include <com/sun/star/document/XCmisDocument.hpp>
32 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
33 #include <com/sun/star/document/XDocumentRecovery.hpp>
34 #include <com/sun/star/document/XUndoManagerSupplier.hpp>
35 #include <com/sun/star/rdf/XDocumentMetadataAccess.hpp>
36 #include <com/sun/star/document/XEventBroadcaster.hpp>
37 #include <com/sun/star/document/XShapeEventBroadcaster.hpp>
38 #include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
39 #include <com/sun/star/document/XEventsSupplier.hpp>
40 #include <com/sun/star/document/XEmbeddedScripts.hpp>
41 #include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
42 #include <com/sun/star/document/XStorageBasedDocument.hpp>
43 #include <com/sun/star/document/XScriptInvocationContext.hpp>
44 #include <com/sun/star/lang/XEventListener.hpp>
45 #include <com/sun/star/frame/XModel2.hpp>
46 #include <com/sun/star/util/XModifiable2.hpp>
47 #include <com/sun/star/util/XCloseable.hpp>
48 #include <com/sun/star/view/XPrintable.hpp>
49 #include <com/sun/star/view/XPrintJobBroadcaster.hpp>
50 #include <com/sun/star/frame/XStorable2.hpp>
51 #include <com/sun/star/frame/XLoadable.hpp>
52 #include <com/sun/star/lang/EventObject.hpp>
53 #include <com/sun/star/datatransfer/XTransferable.hpp>
54 #include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
55 #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
56 #include <com/sun/star/embed/XVisualObject.hpp>
57 #include <com/sun/star/uno/Sequence.hxx>
58 #include <com/sun/star/uno/Reference.hxx>
59 #include <com/sun/star/uno/Any.hxx>
60 #include <cppuhelper/basemutex.hxx>
61 #include <com/sun/star/script/XStarBasicAccess.hpp>
62 
63 #include <com/sun/star/document/XViewDataSupplier.hpp>
64 #include <com/sun/star/lang/XUnoTunnel.hpp>
65 #include <cppuhelper/implbase.hxx>
66 #include <svl/lstner.hxx>
67 
68 #include <memory>
69 
70 class ErrCode;
71 class SfxMedium;
72 class   SfxObjectShell                      ;
73 class   SfxViewFrame;
74 struct  IMPL_SfxBaseModel_DataContainer     ;   // impl. struct to hold member of class SfxBaseModel
75 
76 namespace sfx { namespace intern {
77     class ViewCreationGuard;
78 } }
79 
80 namespace com::sun::star::beans { struct PropertyValue; }
81 namespace com::sun::star::container { class XNameContainer; }
82 namespace com::sun::star::container { class XNameReplace; }
83 namespace com::sun::star::document { class XEventListener; }
84 namespace com::sun::star::document { struct CmisProperty; }
85 namespace com::sun::star::document { struct CmisVersion; }
86 namespace com::sun::star::document { struct EventObject; }
87 namespace com::sun::star::frame { class XController2; }
88 namespace com::sun::star::task { class XInteractionHandler; }
89 namespace com::sun::star::ui { class XUIConfigurationManager2; }
90 namespace com::sun::star::util { class XCloseListener; }
91 namespace com::sun::star::util { class XModifyListener; }
92 
93 //  class declarations
94 
95 
96 /**_______________________________________________________________________________________________________
97     @implements XChild
98                 XComponent
99                 document::XDocumentPropertiesSupplier
100                 rdf::XDocumentMetadataAccess
101                 XEventListener
102                 XModel
103                 XModifiable2
104                 XPrintable
105                 XStorable2
106                 document::XEventBroadcaster
107                 document::XEventsSupplier
108                 document::XEmbeddedScripts
109                 document::XScriptInvocationContext
110                 XCloseable
111                 XCloseBroadcaster
112 
113     @base       cppu::BaseMutex
114                  SfxListener
115 */
116 
117 typedef ::cppu::WeakImplHelper  <   css::container::XChild
118                                         ,   css::document::XDocumentPropertiesSupplier
119                                         ,   css::document::XCmisDocument
120                                         ,   css::rdf::XDocumentMetadataAccess
121                                         ,   css::document::XDocumentRecovery
122                                         ,   css::document::XUndoManagerSupplier
123                                         ,   css::document::XShapeEventBroadcaster
124                                         ,   css::document::XDocumentEventBroadcaster
125                                         ,   css::lang::XEventListener
126                                         ,   css::document::XEventsSupplier
127                                         ,   css::document::XEmbeddedScripts
128                                         ,   css::document::XScriptInvocationContext
129                                         ,   css::frame::XModel2
130                                         ,   css::util::XModifiable2
131                                         ,   css::view::XPrintable
132                                         ,   css::view::XPrintJobBroadcaster
133                                         ,   css::frame::XStorable2
134                                         ,   css::frame::XLoadable
135                                         ,   css::script::XStarBasicAccess
136                                         ,   css::document::XViewDataSupplier
137                                         ,   css::util::XCloseable           // => css::util::XCloseBroadcaster
138                                         ,   css::datatransfer::XTransferable
139                                         ,   css::document::XDocumentSubStorageSupplier
140                                         ,   css::document::XStorageBasedDocument
141                                         ,   css::script::provider::XScriptProviderSupplier
142                                         ,   css::ui::XUIConfigurationManagerSupplier
143                                         ,   css::embed::XVisualObject
144                                         ,   css::lang::XUnoTunnel
145                                         ,   css::frame::XModule
146                                         ,   css::frame::XTitle
147                                         ,   css::frame::XTitleChangeBroadcaster
148                                         ,   css::frame::XUntitledNumbers
149                                         >   SfxBaseModel_Base;
150 
151 class SFX2_DLLPUBLIC SfxBaseModel   :   protected ::cppu::BaseMutex
152                                     ,   public SfxBaseModel_Base
153                                     ,   public SfxListener
154 {
155 
156 
157 //  public methods
158 
159 
160 public:
161 
162 
163     //  constructor/destructor
164 
165 
166     SfxBaseModel( SfxObjectShell *pObjectShell ) ;
167 
168     virtual ~SfxBaseModel() override ;
169 
170 
171     //  XInterface
172 
173 
174     /**___________________________________________________________________________________________________
175         @short      give answer, if interface is supported
176         @descr      The interfaces are searched by type.
177 
178         @seealso    XInterface
179 
180         @param      "rType" is the type of searched interface.
181 
182         @return     Any     information about found interface
183 
184         @onerror    A RuntimeException is thrown.
185     */
186 
187     virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType ) override ;
188 
189     /**___________________________________________________________________________________________________
190         @short      increment refcount
191         @seealso    XInterface
192         @seealso    release()
193         @onerror    A RuntimeException is thrown.
194     */
195 
196     virtual void SAL_CALL acquire() throw() override ;
197 
198     /**___________________________________________________________________________________________________
199         @short      decrement refcount
200         @seealso    XInterface
201         @seealso    acquire()
202         @onerror    A RuntimeException is thrown.
203     */
204 
205     virtual void SAL_CALL release() throw() override ;
206 
207 
208     //  XTypeProvider
209 
210 
211     /**___________________________________________________________________________________________________
212         @short      get information about supported interfaces
213         @seealso    XTypeProvider
214         @return     Sequence of types of all supported interfaces
215 
216         @onerror    A RuntimeException is thrown.
217     */
218 
219     virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override ;
220 
221     /**___________________________________________________________________________________________________
222         @short      get implementation id
223         @descr      This ID is necessary for UNO-caching. If there no ID, cache is disabled.
224                     Another way, cache is enabled.
225 
226         @seealso    XTypeProvider
227         @return     ID as Sequence of byte
228 
229         @onerror    A RuntimeException is thrown.
230     */
231 
232     virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override ;
233 
234 
235     //  XStarBasicAccess
236 
237 
238     /**___________________________________________________________________________________________________
239         @seealso    XStarBasicAccess
240     */
241     virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getLibraryContainer() override;
242 
243     /**___________________________________________________________________________________________________
244         @seealso    XStarBasicAccess
245     */
246     virtual void SAL_CALL createLibrary( const OUString& LibName, const OUString& Password,
247         const OUString& ExternalSourceURL, const OUString& LinkTargetURL ) override;
248 
249     /**___________________________________________________________________________________________________
250         @seealso    XStarBasicAccess
251     */
252     virtual void SAL_CALL addModule( const OUString& LibraryName, const OUString& ModuleName,
253         const OUString& Language, const OUString& Source ) override;
254 
255     /**___________________________________________________________________________________________________
256         @seealso    XStarBasicAccess
257     */
258     virtual void SAL_CALL addDialog( const OUString& LibraryName, const OUString& DialogName,
259         const css::uno::Sequence< sal_Int8 >& Data ) override;
260 
261 
262     //  XChild
263 
264 
265     virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override ;
266 
267     virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& xParent ) override;
268 
269 
270     //  XComponent
271 
272 
273     virtual void SAL_CALL dispose() override;
274 
275     virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener >& aListener) override;
276 
277     virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
278 
279     // XDocumentPropertiesSupplier
280     virtual css::uno::Reference< css::document::XDocumentProperties >
281         SAL_CALL getDocumentProperties() override;
282 
283 
284     //  XEventListener
285 
286 
287     virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) override;
288 
289 
290     //  XModel
291 
292 
293     virtual sal_Bool SAL_CALL attachResource(const OUString& sURL,
294                                              const css::uno::Sequence< css::beans::PropertyValue >& aArgs) override;
295 
296     virtual OUString SAL_CALL getURL() override;
297 
298     virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getArgs() override;
299 
300     virtual void SAL_CALL connectController( const css::uno::Reference< css::frame::XController >& xController ) override;
301 
302     virtual void SAL_CALL disconnectController( const css::uno::Reference< css::frame::XController >& xController ) override;
303 
304     virtual void SAL_CALL lockControllers() override;
305 
306     virtual void SAL_CALL unlockControllers() override;
307 
308     virtual sal_Bool SAL_CALL hasControllersLocked() override;
309 
310     virtual css::uno::Reference< css::frame::XController > SAL_CALL getCurrentController() override;
311 
312     virtual void SAL_CALL setCurrentController( const css::uno::Reference< css::frame::XController >& xController ) override;
313 
314     virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getCurrentSelection() override;
315 
316 
317     //  XModel2
318 
319     virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL getControllers() override;
320 
321     virtual css::uno::Sequence< OUString > SAL_CALL getAvailableViewControllerNames() override;
322 
323     virtual css::uno::Reference< css::frame::XController2 > SAL_CALL createDefaultViewController(const css::uno::Reference< css::frame::XFrame >& Frame ) override;
324 
325     virtual css::uno::Reference< css::frame::XController2 > SAL_CALL createViewController(const OUString&                                 ViewName       ,
326                                                                                           const css::uno::Sequence< css::beans::PropertyValue >& Arguments      ,
327                                                                                           const css::uno::Reference< css::frame::XFrame >&       Frame          ) override;
328 
329     virtual void SAL_CALL setArgs(const css::uno::Sequence<css::beans::PropertyValue>& aArgs) override;
330 
331 
332     //  XModifiable2
333 
334 
335     virtual sal_Bool SAL_CALL disableSetModified(  ) override;
336     virtual sal_Bool SAL_CALL enableSetModified(  ) override;
337     virtual sal_Bool SAL_CALL isSetModifiedEnabled(  ) override;
338 
339     virtual sal_Bool SAL_CALL isModified() override;
340 
341     virtual void SAL_CALL setModified( sal_Bool bModified ) override;
342 
343     virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& xListener ) override ;
344 
345     virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > & xListener) override ;
346 
347 
348     //  XCloseable
349 
350 
351     virtual void SAL_CALL close( sal_Bool bDeliverOwnership ) override;
352 
353 
354     //  XCloseBroadcaster
355 
356 
357     virtual void SAL_CALL addCloseListener( const css::uno::Reference< css::util::XCloseListener >& xListener ) override;
358     virtual void SAL_CALL removeCloseListener( const css::uno::Reference< css::util::XCloseListener >& xListener ) override;
359 
360 
361     //  XPrintJobBroadcaster
362 
363 
364     virtual void SAL_CALL addPrintJobListener( const css::uno::Reference< css::view::XPrintJobListener >& xListener ) override;
365     virtual void SAL_CALL removePrintJobListener( const css::uno::Reference< css::view::XPrintJobListener >& xListener ) override;
366 
367 
368     //  XPrintable
369 
370 
371     virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPrinter() override;
372 
373     virtual void SAL_CALL setPrinter( const css::uno::Sequence< css::beans::PropertyValue >& seqPrinter ) override;
374     virtual void SAL_CALL print( const css::uno::Sequence< css::beans::PropertyValue >& seqOptions ) override;
375 
376 
377     //  XStorable2
378 
379 
380     virtual void SAL_CALL storeSelf( const  css::uno::Sequence< css::beans::PropertyValue >&   seqArguments    ) override;
381 
382 
383     //  XStorable
384 
385 
386     virtual sal_Bool SAL_CALL hasLocation() override;
387 
388     virtual OUString SAL_CALL getLocation() override;
389 
390     virtual sal_Bool SAL_CALL isReadonly() override;
391 
392     virtual void SAL_CALL store() override;
393 
394     virtual void SAL_CALL storeAsURL(   const   OUString& sURL,
395                                         const   css::uno::Sequence< css::beans::PropertyValue >&   seqArguments    ) override ;
396 
397     virtual void SAL_CALL storeToURL(   const   OUString& sURL,
398                                         const   css::uno::Sequence< css::beans::PropertyValue >&   seqArguments    ) override;
399 
400     SAL_DLLPRIVATE void
401     impl_store(const OUString& sURL,
402                const css::uno::Sequence<css::beans::PropertyValue>& seqArguments, bool bSaveTo);
403 
404     //  XLoadable
405 
406 
407     virtual void SAL_CALL initNew() override;
408 
409     virtual void SAL_CALL load( const   css::uno::Sequence< css::beans::PropertyValue >&   seqArguments ) override;
410 
411 
412     //  XDocumentSubStorageSupplier
413 
414 
415     virtual css::uno::Reference< css::embed::XStorage > SAL_CALL getDocumentSubStorage( const OUString& aStorageName, sal_Int32 nMode ) override;
416 
417     virtual css::uno::Sequence< OUString > SAL_CALL getDocumentSubStoragesNames() override;
418 
419 
420     //  XStorageBasedDocument
421 
422 
423     virtual void SAL_CALL loadFromStorage( const css::uno::Reference< css::embed::XStorage >& xStorage,
424                                             const css::uno::Sequence< css::beans::PropertyValue >& aMediaDescriptor ) override;
425 
426     virtual void SAL_CALL storeToStorage( const css::uno::Reference< css::embed::XStorage >& xStorage,
427                                             const css::uno::Sequence< css::beans::PropertyValue >& aMediaDescriptor ) override;
428 
429     virtual void SAL_CALL switchToStorage( const css::uno::Reference< css::embed::XStorage >& xStorage ) override;
430 
431     virtual css::uno::Reference< css::embed::XStorage > SAL_CALL getDocumentStorage() override;
432 
433     virtual void SAL_CALL addStorageChangeListener(
434             const css::uno::Reference< css::document::XStorageChangeListener >& xListener ) override;
435 
436     virtual void SAL_CALL removeStorageChangeListener(
437             const css::uno::Reference< css::document::XStorageChangeListener >& xListener ) override;
438 
439 
440     //  XVisualObject
441 
442 
443     virtual void SAL_CALL setVisualAreaSize( sal_Int64 nAspect, const css::awt::Size& aSize ) override;
444 
445     virtual css::awt::Size SAL_CALL getVisualAreaSize( sal_Int64 nAspect ) override;
446 
447     virtual css::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect ) override;
448 
449     virtual sal_Int32 SAL_CALL getMapUnit( sal_Int64 nAspect ) override;
450 
451 
452     //  XScriptProviderSupplier
453 
454 
455     virtual css::uno::Reference< css::script::provider::XScriptProvider > SAL_CALL getScriptProvider() override;
456 
457 
458     //  XUIConfigurationManagerSupplier
459     virtual css::uno::Reference< css::ui::XUIConfigurationManager > SAL_CALL getUIConfigurationManager() override;
460 
461 
462     //  XTransferable
463 
464 
465     virtual css::uno::Any SAL_CALL getTransferData( const css::datatransfer::DataFlavor& aFlavor ) override;
466 
467     virtual css::uno::Sequence< css::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors() override;
468 
469     virtual sal_Bool SAL_CALL isDataFlavorSupported( const css::datatransfer::DataFlavor& aFlavor ) override;
470 
471 
472     //  XEventsSupplier
473 
474 
475     /**___________________________________________________________________________________________________
476         @descr      -   offers a list of event handlers which are be bound to events of
477                         this object.
478         @return     -   an Events object.
479     */
480 
481     virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() override;
482 
483 
484     //  XEmbeddedScripts
485 
486 
487     virtual css::uno::Reference< css::script::XStorageBasedLibraryContainer > SAL_CALL getBasicLibraries() override;
488     virtual css::uno::Reference< css::script::XStorageBasedLibraryContainer > SAL_CALL getDialogLibraries() override;
489     virtual sal_Bool SAL_CALL getAllowMacroExecution() override;
490 
491 
492     //  XScriptInvocationContext
493 
494 
495     virtual css::uno::Reference< css::document::XEmbeddedScripts > SAL_CALL getScriptContainer() override;
496 
497 
498     //  document::XEventBroadcaster
499 
500     /**___________________________________________________________________________________________________
501         @descr      -   registers the given XEventListener.
502     */
503     virtual void SAL_CALL addEventListener( const css::uno::Reference< css::document::XEventListener >& xListener ) override;
504 
505     /**___________________________________________________________________________________________________
506         @descr      -   unregisters the given XEventListener.
507     */
508     virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::document::XEventListener >& xListener ) override;
509 
510 
511     //  document::XShapeEventBroadcaster
512 
513     /**___________________________________________________________________________________________________
514         @descr      -   registers the given XEventListener.
515     */
516     virtual void SAL_CALL addShapeEventListener( const css::uno::Reference< css::drawing::XShape >& xShape, const css::uno::Reference< css::document::XShapeEventListener >& xListener ) override;
517 
518     /**___________________________________________________________________________________________________
519         @descr      -   unregisters the given XEventListener.
520     */
521     virtual void SAL_CALL removeShapeEventListener( const css::uno::Reference< css::drawing::XShape >& xShape, const css::uno::Reference< css::document::XShapeEventListener >& xListener ) override;
522 
523 
524     //  XDocumentEventBroadcaster
525 
526     virtual void SAL_CALL addDocumentEventListener( const css::uno::Reference< css::document::XDocumentEventListener >& Listener ) override;
527     virtual void SAL_CALL removeDocumentEventListener( const css::uno::Reference< css::document::XDocumentEventListener >& Listener ) override;
528     virtual void SAL_CALL notifyDocumentEvent( const OUString& EventName, const css::uno::Reference< css::frame::XController2 >& ViewController, const css::uno::Any& Supplement ) override;
529 
530 
531     //  XUnoTunnel
532 
533 
534     virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
535 
536     // css.frame.XModule
537     virtual void SAL_CALL setIdentifier(const OUString& sIdentifier) override;
538 
539     // css.frame.XModule
540     virtual OUString SAL_CALL getIdentifier() override;
541 
542     // css.frame.XTitle
543     virtual OUString SAL_CALL getTitle() override;
544 
545     // css.frame.XTitle
546     virtual void SAL_CALL setTitle( const OUString& sTitle ) override;
547 
548     // css.frame.XTitleChangeBroadcaster
549     virtual void SAL_CALL addTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) override;
550 
551     // css.frame.XTitleChangeBroadcaster
552     virtual void SAL_CALL removeTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) override;
553 
554     // css.frame.XUntitledNumbers
555     virtual ::sal_Int32 SAL_CALL leaseNumber( const css::uno::Reference< css::uno::XInterface >& xComponent ) override;
556 
557     // css.frame.XUntitledNumbers
558     virtual void SAL_CALL releaseNumber( ::sal_Int32 nNumber ) override;
559 
560     // css.frame.XUntitledNumbers
561     virtual void SAL_CALL releaseNumberForComponent( const css::uno::Reference< css::uno::XInterface >& xComponent ) override;
562 
563     // css.frame.XUntitledNumbers
564     virtual OUString SAL_CALL getUntitledPrefix() override;
565 
566     // css.document.XDocumentRecovery
567     virtual sal_Bool SAL_CALL wasModifiedSinceLastSave() override;
568     virtual void SAL_CALL storeToRecoveryFile( const OUString& i_TargetLocation, const css::uno::Sequence< css::beans::PropertyValue >& i_MediaDescriptor ) override;
569     virtual void SAL_CALL recoverFromFile( const OUString& i_SourceLocation, const OUString& i_SalvagedFile, const css::uno::Sequence< css::beans::PropertyValue >& i_MediaDescriptor ) override;
570 
571     // css.document.XUndoManagerSupplier
572     virtual css::uno::Reference< css::document::XUndoManager > SAL_CALL getUndoManager(  ) override;
573 
574 
575     // css::rdf::XNode:
576     virtual OUString SAL_CALL getStringValue() override;
577 
578     // css::rdf::XURI:
579     virtual OUString SAL_CALL getNamespace() override;
580     virtual OUString SAL_CALL getLocalName() override;
581 
582     // css::rdf::XRepositorySupplier:
583     virtual css::uno::Reference<
584         css::rdf::XRepository > SAL_CALL getRDFRepository() override;
585 
586     // css::rdf::XDocumentMetadataAccess:
587     virtual css::uno::Reference<
588                 css::rdf::XMetadatable > SAL_CALL
589         getElementByMetadataReference(
590             const css::beans::StringPair & i_rReference) override;
591     virtual css::uno::Reference<
592                 css::rdf::XMetadatable > SAL_CALL
593         getElementByURI(const css::uno::Reference<
594             css::rdf::XURI > & i_xURI) override;
595     virtual css::uno::Sequence< css::uno::Reference<
596             css::rdf::XURI > > SAL_CALL getMetadataGraphsWithType(
597             const css::uno::Reference<
598                 css::rdf::XURI > & i_xType) override;
599     virtual css::uno::Reference<
600                 css::rdf::XURI> SAL_CALL
601         addMetadataFile(const OUString & i_rFileName,
602             const css::uno::Sequence<
603                 css::uno::Reference< css::rdf::XURI >
604                 > & i_rTypes) override;
605     virtual css::uno::Reference<
606                 css::rdf::XURI> SAL_CALL
607         importMetadataFile(::sal_Int16 i_Format,
608             const css::uno::Reference<
609                 css::io::XInputStream > & i_xInStream,
610             const OUString & i_rFileName,
611             const css::uno::Reference<
612                 css::rdf::XURI > & i_xBaseURI,
613             const css::uno::Sequence<
614                 css::uno::Reference< css::rdf::XURI >
615                 > & i_rTypes) override;
616     virtual void SAL_CALL removeMetadataFile(
617             const css::uno::Reference<
618                 css::rdf::XURI > & i_xGraphName) override;
619     virtual void SAL_CALL addContentOrStylesFile(
620             const OUString & i_rFileName) override;
621     virtual void SAL_CALL removeContentOrStylesFile(
622             const OUString & i_rFileName) override;
623 
624     virtual void SAL_CALL loadMetadataFromStorage(
625             const css::uno::Reference<
626                 css::embed::XStorage > & i_xStorage,
627             const css::uno::Reference<
628                 css::rdf::XURI > & i_xBaseURI,
629             const css::uno::Reference<
630                 css::task::XInteractionHandler> & i_xHandler) override;
631     virtual void SAL_CALL storeMetadataToStorage(
632             const css::uno::Reference<
633                 css::embed::XStorage > & i_xStorage) override;
634     virtual void SAL_CALL loadMetadataFromMedium(
635             const css::uno::Sequence<
636                 css::beans::PropertyValue > & i_rMedium) override;
637     virtual void SAL_CALL storeMetadataToMedium(
638             const css::uno::Sequence<
639                 css::beans::PropertyValue > & i_rMedium) override;
640 
641     // XCmisDocument
642 
643     virtual css::uno::Sequence< css::document::CmisProperty >
644             SAL_CALL getCmisProperties() override;
645     virtual void SAL_CALL setCmisProperties(
646             const css::uno::Sequence<
647                 css::document::CmisProperty >& _cmisproperties ) override;
648 
649     virtual void SAL_CALL updateCmisProperties(
650             const css::uno::Sequence<
651                 css::document::CmisProperty >& _cmisproperties ) override;
652 
653     virtual css::uno::Sequence< css::document::CmisVersion > SAL_CALL getAllVersions ( ) override;
654 
655     virtual void SAL_CALL checkOut(  ) override;
656     virtual void SAL_CALL cancelCheckOut(  ) override;
657     virtual void SAL_CALL checkIn( sal_Bool bIsMajor, const OUString & rMessage  ) override;
658 
659     virtual sal_Bool SAL_CALL isVersionable( ) override;
660     virtual sal_Bool SAL_CALL canCheckOut( ) override;
661     virtual sal_Bool SAL_CALL canCancelCheckOut( ) override;
662     virtual sal_Bool SAL_CALL canCheckIn( ) override;
663 
664     /// @throws css::uno::RuntimeException
665     bool getBoolPropertyValue( const OUString& rName );
666 
667 
668     //  SfxListener
669 
670 
671     void Notify(            SfxBroadcaster& aBC     ,
672                     const   SfxHint&        aHint   ) override ;
673 
674 
675     //  public IMPL?
676 
677 
678     void changing() ;
679 
680     SfxObjectShell* GetObjectShell() const ;
681 
682     SAL_DLLPRIVATE bool impl_isDisposed() const ;
683     bool IsInitialized() const;
684     void MethodEntryCheck( const bool i_mustBeInitialized ) const;
685 
686     css::uno::Reference < css::container::XIndexAccess > SAL_CALL getViewData() override;
687     void SAL_CALL setViewData( const css::uno::Reference < css::container::XIndexAccess >& aData ) override;
688 
689     /** calls all XEventListeners */
690     void notifyEvent( const css::document::EventObject& aEvent ) const;
691 
692     /** returns true if someone added a XEventListener to this XEventBroadcaster */
693     bool hasEventListeners() const;
694 
695 protected:
696 
697     /* returns a unique id for the model that is valid as long as the document
698        is loaded. The id is not saved across document close/reload. */
699     OUString const & getRuntimeUID() const;
700 
701     /* returns true if the document signatures are valid, otherwise false */
702     bool hasValidSignatures() const;
703 
704     /* GrabBagItem for interim interop purposes */
705     void getGrabBagItem(css::uno::Any& rVal) const;
706 
707     void setGrabBagItem(const css::uno::Any& rVal);
708 
709 
710 //  private methods
711 
712 
713 private:
714     /// @throws css::uno::RuntimeException
715     css::uno::Reference< css::ui::XUIConfigurationManager2 > getUIConfigurationManager2();
716     void impl_getPrintHelper();
717     SAL_DLLPRIVATE void ListenForStorage_Impl( const css::uno::Reference< css::embed::XStorage >& xStorage );
718     SAL_DLLPRIVATE OUString GetMediumFilterName_Impl() const;
719 
720     SAL_DLLPRIVATE void postEvent_Impl( const OUString& aName, const css::uno::Reference< css::frame::XController2 >& xController = css::uno::Reference< css::frame::XController2 >() );
721 
722     SAL_DLLPRIVATE css::uno::Reference< css::frame::XTitle > impl_getTitleHelper ();
723     SAL_DLLPRIVATE css::uno::Reference< css::frame::XUntitledNumbers > impl_getUntitledHelper ();
724 
725     SAL_DLLPRIVATE SfxViewFrame* FindOrCreateViewFrame_Impl(
726                         const css::uno::Reference< css::frame::XFrame >& i_rFrame,
727                         ::sfx::intern::ViewCreationGuard& i_rGuard
728                     ) const;
729 
730     SAL_DLLPRIVATE void NotifyModifyListeners_Impl() const;
731 
732     SAL_DLLPRIVATE void loadCmisProperties();
733 
734     SAL_DLLPRIVATE SfxMedium* handleLoadError( ErrCode nError, SfxMedium* pMedium );
735 
736 
737 //  private variables and methods
738 
739 
740 private:
741 
742     std::shared_ptr<IMPL_SfxBaseModel_DataContainer> m_pData;
743     // cannot be held in m_pData, since it needs to be accessed in non-threadsafe context
744     const bool                          m_bSupportEmbeddedScripts;
745     const bool                          m_bSupportDocRecovery;
746 
747 } ; // class SfxBaseModel
748 
749 #endif // INCLUDED_SFX2_SFXBASEMODEL_HXX
750 
751 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
752