Coverage Report

Created: 2025-12-08 09:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sfx2/source/doc/objxtor.cxx
Line
Count
Source
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_fuzzers.h>
22
23
#include <map>
24
25
#include <cppuhelper/implbase.hxx>
26
#include <cppuhelper/weakref.hxx>
27
28
#include <com/sun/star/util/XCloseable.hpp>
29
#include <com/sun/star/frame/XComponentLoader.hpp>
30
#include <com/sun/star/frame/Desktop.hpp>
31
#include <com/sun/star/util/CloseVetoException.hpp>
32
#include <com/sun/star/util/XCloseListener.hpp>
33
#include <com/sun/star/beans/XPropertySet.hpp>
34
#include <com/sun/star/frame/XTitle.hpp>
35
#include <osl/file.hxx>
36
#include <sal/log.hxx>
37
#include <vcl/weld.hxx>
38
#include <vcl/svapp.hxx>
39
#include <svl/eitem.hxx>
40
#include <basic/sbstar.hxx>
41
#include <svl/stritem.hxx>
42
#include <unotools/configmgr.hxx>
43
#include <unotools/eventcfg.hxx>
44
45
#include <sfx2/objsh.hxx>
46
#include <sfx2/signaturestate.hxx>
47
#include <sfx2/sfxmodelfactory.hxx>
48
49
#include <comphelper/configuration.hxx>
50
#include <comphelper/processfactory.hxx>
51
#include <comphelper/servicehelper.hxx>
52
53
#include <com/sun/star/document/XStorageBasedDocument.hpp>
54
#include <com/sun/star/script/DocumentDialogLibraryContainer.hpp>
55
#include <com/sun/star/script/DocumentScriptLibraryContainer.hpp>
56
#include <com/sun/star/document/XEmbeddedScripts.hpp>
57
#include <com/sun/star/document/XScriptInvocationContext.hpp>
58
#include <com/sun/star/ucb/ContentCreationException.hpp>
59
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
60
61
#include <unotools/ucbhelper.hxx>
62
#include <comphelper/diagnose_ex.hxx>
63
#include <tools/globname.hxx>
64
#include <tools/debug.hxx>
65
66
#include <sfx2/app.hxx>
67
#include <sfx2/bindings.hxx>
68
#include <sfx2/docfile.hxx>
69
#include <sfx2/event.hxx>
70
#include <sfx2/viewsh.hxx>
71
#include <sfx2/viewfrm.hxx>
72
#include <sfx2/sfxresid.hxx>
73
#include <objshimp.hxx>
74
#include <sfx2/strings.hrc>
75
#include <sfx2/sfxsids.hrc>
76
#include <basic/basmgr.hxx>
77
#include <sfx2/QuerySaveDocument.hxx>
78
#include <appbaslib.hxx>
79
#include <sfx2/sfxbasemodel.hxx>
80
#include <sfx2/sfxuno.hxx>
81
#include <sfx2/notebookbar/SfxNotebookBar.hxx>
82
#include <sfx2/infobar.hxx>
83
#include <svtools/svparser.hxx>
84
85
#include <basic/basicmanagerrepository.hxx>
86
87
using namespace ::com::sun::star;
88
using namespace ::com::sun::star::uno;
89
using namespace ::com::sun::star::script;
90
using namespace ::com::sun::star::frame;
91
using namespace ::com::sun::star::document;
92
93
using ::basic::BasicManagerRepository;
94
95
namespace {
96
97
WeakReference< XInterface > theCurrentComponent;
98
99
#if HAVE_FEATURE_SCRIPTING
100
101
// remember all registered components for VBA compatibility, to be able to remove them on disposing the model
102
typedef ::std::map< XInterface*, OUString > VBAConstantNameMap;
103
VBAConstantNameMap s_aRegisteredVBAConstants;
104
105
OUString lclGetVBAGlobalConstName( const Reference< XInterface >& rxComponent )
106
{
107
    OSL_ENSURE( rxComponent.is(), "lclGetVBAGlobalConstName - missing component" );
108
109
    VBAConstantNameMap::iterator aIt = s_aRegisteredVBAConstants.find( rxComponent.get() );
110
    if( aIt != s_aRegisteredVBAConstants.end() )
111
        return aIt->second;
112
113
    uno::Reference< beans::XPropertySet > xProps( rxComponent, uno::UNO_QUERY );
114
    if( xProps.is() ) try
115
    {
116
        OUString aConstName;
117
        xProps->getPropertyValue(u"VBAGlobalConstantName"_ustr) >>= aConstName;
118
        return aConstName;
119
    }
120
    catch (const uno::Exception&) // not supported
121
    {
122
    }
123
    return OUString();
124
}
125
126
#endif
127
128
class SfxModelListener_Impl : public ::cppu::WeakImplHelper< css::util::XCloseListener >
129
{
130
    SfxObjectShell* mpDoc;
131
public:
132
237k
    explicit SfxModelListener_Impl( SfxObjectShell* pDoc ) : mpDoc(pDoc) {};
133
    virtual void SAL_CALL queryClosing( const css::lang::EventObject& aEvent, sal_Bool bDeliverOwnership ) override ;
134
    virtual void SAL_CALL notifyClosing( const css::lang::EventObject& aEvent ) override ;
135
    virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) override ;
136
137
};
138
139
} // namespace
140
141
void SAL_CALL SfxModelListener_Impl::queryClosing( const css::lang::EventObject& , sal_Bool bDeliverOwnership)
142
237k
{
143
237k
    if (mpDoc->Get_Impl()->m_nClosingLockLevel)
144
0
    {
145
0
        if (bDeliverOwnership)
146
0
            mpDoc->Get_Impl()->m_bCloseModelScheduled = true;
147
0
        throw util::CloseVetoException(u"Closing document is blocked"_ustr, getXWeak());
148
0
    }
149
237k
}
150
151
void SAL_CALL SfxModelListener_Impl::notifyClosing( const css::lang::EventObject& )
152
237k
{
153
237k
    SolarMutexGuard aSolarGuard;
154
237k
    mpDoc->Broadcast( SfxHint(SfxHintId::Deinitializing) );
155
237k
}
156
157
void SAL_CALL SfxModelListener_Impl::disposing( const css::lang::EventObject& _rEvent )
158
237k
{
159
    // am I ThisComponent in AppBasic?
160
237k
    SolarMutexGuard aSolarGuard;
161
237k
    if ( SfxObjectShell::GetCurrentComponent() == _rEvent.Source )
162
0
    {
163
        // remove ThisComponent reference from AppBasic
164
0
        SfxObjectShell::SetCurrentComponent( Reference< XInterface >() );
165
0
    }
166
167
#if HAVE_FEATURE_SCRIPTING
168
    /*  Remove VBA component from AppBasic. As every application registers its
169
        own current component, the disposed component may not be the "current
170
        component" of the SfxObjectShell. */
171
    if ( _rEvent.Source.is() )
172
    {
173
        VBAConstantNameMap::iterator aIt = s_aRegisteredVBAConstants.find( _rEvent.Source.get() );
174
        if ( aIt != s_aRegisteredVBAConstants.end() )
175
        {
176
            if ( BasicManager* pAppMgr = SfxApplication::GetBasicManager() )
177
                pAppMgr->SetGlobalUNOConstant( aIt->second, Any( Reference< XInterface >() ) );
178
            s_aRegisteredVBAConstants.erase( aIt );
179
        }
180
    }
181
#endif
182
183
237k
    if ( !mpDoc->Get_Impl()->bClosing )
184
        // GCC crashes when already in the destructor, so first query the Flag
185
3.59k
        mpDoc->DoClose();
186
237k
}
187
188
189
SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell )
190
237k
    :rDocShell( _rDocShell )
191
237k
    ,aMacroMode( *this )
192
237k
    ,pProgress( nullptr)
193
237k
    ,nTime( DateTime::SYSTEM )
194
237k
    ,nVisualDocumentNumber( USHRT_MAX)
195
237k
    ,nDocumentSignatureState( SignatureState::UNKNOWN )
196
237k
    ,nScriptingSignatureState( SignatureState::UNKNOWN )
197
237k
    ,bClosing( false)
198
237k
    ,bIsSaving( false)
199
237k
    ,bIsNamedVisible( false)
200
237k
    ,bIsAbortingImport ( false)
201
237k
    ,bInPrepareClose( false )
202
237k
    ,bPreparedForClose( false )
203
237k
    ,bForbidReload( false )
204
237k
    ,bBasicInitialized( false )
205
237k
    ,bIsPrintJobCancelable( true )
206
237k
    ,bOwnsStorage( true )
207
237k
    ,bInitialized( false )
208
237k
    ,bModelInitialized( false )
209
237k
    ,bPreserveVersions( true )
210
237k
    ,m_bMacroSignBroken( false )
211
237k
    ,m_bNoBasicCapabilities( false )
212
237k
    ,m_bDocRecoverySupport( true )
213
237k
    ,bQueryLoadTemplate( true )
214
237k
    ,bLoadReadonly( false )
215
237k
    ,bUseUserData( true )
216
237k
    ,bUseThumbnailSave( true )
217
237k
    ,bSaveVersionOnClose( false )
218
237k
    ,m_bSharedXMLFlag( false )
219
237k
    ,m_bAllowShareControlFileClean( true )
220
237k
    ,m_bConfigOptionsChecked( false )
221
237k
    ,m_bMacroCallsSeenWhileLoading( false )
222
237k
    ,m_bHadCheckedMacrosOnLoad( false )
223
237k
    ,lErr(ERRCODE_NONE)
224
237k
    ,nEventId ( SfxEventHintId::NONE )
225
237k
    ,nLoadedFlags ( SfxLoadedFlags::ALL )
226
237k
    ,nFlagsInProgress( SfxLoadedFlags::NONE )
227
237k
    ,bModalMode( false )
228
237k
    ,bRunningMacro( false )
229
237k
    ,bReadOnlyUI( false )
230
237k
    ,nStyleFilter( 0 )
231
237k
    ,m_bEnableSetModified( true )
232
237k
    ,m_bIsModified( false )
233
237k
    ,m_nMapUnit( MapUnit::Map100thMM )
234
237k
    ,m_bCreateTempStor( false )
235
237k
    ,m_bIsInit( false )
236
237k
    ,m_bIncomplEncrWarnShown( false )
237
237k
    ,m_nModifyPasswordHash( 0 )
238
237k
    ,m_bModifyPasswordEntered( false )
239
237k
    ,m_bSavingForSigning( false )
240
237k
    ,m_bAllowModifiedBackAfterSigning( false )
241
237k
{
242
237k
    SfxObjectShell* pDoc = &_rDocShell;
243
237k
    std::vector<SfxObjectShell*> &rArr = SfxGetpApp()->GetObjectShells_Impl();
244
237k
    rArr.push_back( pDoc );
245
237k
}
246
247
248
SfxObjectShell_Impl::~SfxObjectShell_Impl()
249
236k
{
250
236k
}
251
252
253
SfxObjectShell::SfxObjectShell( const SfxModelFlags i_nCreationFlags )
254
110k
    : pImpl(new SfxObjectShell_Impl(*this))
255
110k
    , pMedium(nullptr)
256
110k
    , eCreateMode(SfxObjectCreateMode::STANDARD)
257
110k
    , bHasName(false)
258
110k
    , bIsInGenerateThumbnail (false)
259
110k
    , mbAvoidRecentDocs(false)
260
110k
    , bRememberSignature(false)
261
110k
{
262
110k
    if (i_nCreationFlags & SfxModelFlags::EMBEDDED_OBJECT)
263
103k
        eCreateMode = SfxObjectCreateMode::EMBEDDED;
264
7.86k
    else if (i_nCreationFlags & SfxModelFlags::EXTERNAL_LINK)
265
0
        eCreateMode = SfxObjectCreateMode::INTERNAL;
266
267
110k
    const bool bScriptSupport = ( i_nCreationFlags & SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS ) == SfxModelFlags::NONE;
268
110k
    if ( !bScriptSupport )
269
23.9k
        pImpl->m_bNoBasicCapabilities = true;
270
271
110k
    const bool bDocRecovery = ( i_nCreationFlags & SfxModelFlags::DISABLE_DOCUMENT_RECOVERY ) == SfxModelFlags::NONE;
272
110k
    if ( !bDocRecovery )
273
23.9k
        pImpl->m_bDocRecoverySupport = false;
274
110k
}
275
276
/** Constructor of the class SfxObjectShell.
277
278
    @param eMode Purpose, to which the SfxObjectShell is created:
279
                 SfxObjectCreateMode::EMBEDDED (default) as SO-Server from within another Document
280
                 SfxObjectCreateMode::STANDARD, as a normal Document open stand-alone
281
                 SfxObjectCreateMode::ORGANIZER to be displayed in the Organizer, here nothing of the contents is used
282
*/
283
SfxObjectShell::SfxObjectShell(SfxObjectCreateMode eMode)
284
126k
    : pImpl(new SfxObjectShell_Impl(*this))
285
126k
    , pMedium(nullptr)
286
126k
    , eCreateMode(eMode)
287
126k
    , bHasName(false)
288
126k
    , bIsInGenerateThumbnail(false)
289
126k
    , mbAvoidRecentDocs(false)
290
126k
    , bRememberSignature(false)
291
126k
{
292
126k
}
293
294
SfxObjectShell::~SfxObjectShell()
295
236k
{
296
297
236k
    if ( IsEnableSetModified() )
298
138k
        EnableSetModified( false );
299
300
236k
    SfxObjectShell::CloseInternal();
301
236k
    pImpl->pBaseModel.clear();
302
303
236k
    pImpl->pReloadTimer.reset();
304
305
236k
    SfxApplication *pSfxApp = SfxGetpApp();
306
236k
    if ( USHRT_MAX != pImpl->nVisualDocumentNumber && pSfxApp )
307
4.26k
        pSfxApp->ReleaseIndex(pImpl->nVisualDocumentNumber);
308
309
    // Destroy Basic-Manager
310
236k
    pImpl->aBasicManager.reset(nullptr);
311
312
236k
    if ( pSfxApp && pSfxApp->GetDdeService() )
313
0
        pSfxApp->RemoveDdeTopic( this );
314
315
236k
    InternalCloseAndRemoveFiles();
316
236k
}
317
318
void SfxObjectShell::InternalCloseAndRemoveFiles()
319
236k
{
320
    // don't call GetStorage() here, in case of Load Failure it's possible that a storage was never assigned!
321
236k
    if ( pMedium && pMedium->HasStorage_Impl() && pMedium->GetStorage( false ) == pImpl->m_xDocStorage )
322
0
        pMedium->CanDisposeStorage_Impl( false );
323
324
236k
    if ( pImpl->mxObjectContainer )
325
66.3k
    {
326
66.3k
        pImpl->mxObjectContainer->CloseEmbeddedObjects();
327
66.3k
        pImpl->mxObjectContainer.reset();
328
66.3k
    }
329
330
236k
    if ( pImpl->bOwnsStorage && pImpl->m_xDocStorage.is() )
331
146k
        pImpl->m_xDocStorage->dispose();
332
333
236k
    if ( pMedium )
334
218k
    {
335
218k
        pMedium->CloseAndReleaseStreams_Impl();
336
337
#if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
338
        if (IsDocShared())
339
            FreeSharedFile( pMedium->GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
340
#endif
341
218k
        delete pMedium;
342
218k
        pMedium = nullptr;
343
218k
    }
344
345
    // The removing of the temporary file must be done as the latest step in the document destruction
346
236k
    if ( !pImpl->aTempName.isEmpty() )
347
0
    {
348
0
        OUString aTmp;
349
0
        osl::FileBase::getFileURLFromSystemPath( pImpl->aTempName, aTmp );
350
0
        ::utl::UCBContentHelper::Kill( aTmp );
351
0
    }
352
236k
}
353
354
SfxCloseVetoLock::SfxCloseVetoLock(const SfxObjectShell* pDocShell)
355
1.01k
    : mpDocShell(pDocShell)
356
1.01k
{
357
1.01k
    if (mpDocShell)
358
1.01k
        osl_atomic_increment(&mpDocShell->Get_Impl()->m_nClosingLockLevel);
359
1.01k
}
360
361
SfxCloseVetoLock::~SfxCloseVetoLock()
362
1.01k
{
363
1.01k
    if (mpDocShell && osl_atomic_decrement(&mpDocShell->Get_Impl()->m_nClosingLockLevel) == 0)
364
1.01k
    {
365
1.01k
        if (mpDocShell->Get_Impl()->m_bCloseModelScheduled)
366
0
        {
367
0
            mpDocShell->Get_Impl()->m_bCloseModelScheduled = false; // pass ownership
368
0
            if (rtl::Reference model = static_cast<SfxBaseModel*>(mpDocShell->GetBaseModel().get()))
369
0
            {
370
0
                try
371
0
                {
372
0
                    model->close(true);
373
0
                }
374
0
                catch (const util::CloseVetoException&)
375
0
                {
376
0
                    DBG_UNHANDLED_EXCEPTION("sfx.doc");
377
0
                }
378
0
            }
379
0
        }
380
1.01k
    }
381
1.01k
}
382
383
void SfxObjectShell::Stamp_SetPrintCancelState(bool bState)
384
1.47k
{
385
1.47k
    pImpl->bIsPrintJobCancelable = bState;
386
1.47k
}
387
388
389
bool SfxObjectShell::Stamp_GetPrintCancelState() const
390
0
{
391
0
    return pImpl->bIsPrintJobCancelable;
392
0
}
393
394
395
// closes the Object and all its views
396
397
bool SfxObjectShell::Close()
398
349k
{
399
349k
    SfxObjectShellRef xKeepAlive(this);
400
349k
    return CloseInternal();
401
349k
}
402
403
// variant that does not take a reference to itself, so we can call it during object destruction
404
bool SfxObjectShell::CloseInternal()
405
586k
{
406
586k
    if ( !pImpl->bClosing )
407
237k
    {
408
        // Do not close if a progress is still running
409
237k
        if ( GetProgress() )
410
0
            return false;
411
412
237k
        pImpl->bClosing = true;
413
237k
        Reference< util::XCloseable > xCloseable( GetBaseModel(), UNO_QUERY );
414
415
237k
        if ( xCloseable.is() )
416
237k
        {
417
237k
            try
418
237k
            {
419
237k
                xCloseable->close( true );
420
237k
            }
421
237k
            catch (const Exception&)
422
237k
            {
423
0
                pImpl->bClosing = false;
424
0
            }
425
237k
        }
426
427
237k
        if ( pImpl->bClosing )
428
237k
        {
429
            // remove from Document list
430
            // If there is no App, there is no document to remove
431
            // no need to call GetOrCreate here
432
237k
            SfxApplication *pSfxApp = SfxApplication::Get();
433
237k
            if(pSfxApp)
434
237k
            {
435
237k
                std::vector<SfxObjectShell*> &rDocs = pSfxApp->GetObjectShells_Impl();
436
237k
                auto it = std::find( rDocs.begin(), rDocs.end(), this );
437
237k
                if ( it != rDocs.end() )
438
237k
                    rDocs.erase( it );
439
237k
            }
440
237k
        }
441
237k
    }
442
443
586k
    return true;
444
586k
}
445
446
OUString SfxObjectShell::CreateShellID( const SfxObjectShell* pShell )
447
17.3k
{
448
17.3k
    if (!pShell)
449
0
        return OUString();
450
451
17.3k
    OUString aShellID;
452
453
17.3k
    SfxMedium* pMedium = pShell->GetMedium();
454
17.3k
    if (pMedium)
455
17.3k
        aShellID = pMedium->GetBaseURL();
456
457
17.3k
    if (!aShellID.isEmpty())
458
0
        return aShellID;
459
460
17.3k
    sal_Int64 nShellID = reinterpret_cast<sal_Int64>(pShell);
461
17.3k
    aShellID = "0x" + OUString::number(nShellID, 16);
462
17.3k
    return aShellID;
463
17.3k
}
464
465
// returns a pointer the first SfxDocument of specified type
466
467
SfxObjectShell* SfxObjectShell::GetFirst
468
(
469
    const std::function<bool ( const SfxObjectShell* )>& isObjectShell,
470
    bool          bOnlyVisible
471
)
472
299k
{
473
299k
    std::vector<SfxObjectShell*> &rDocs = SfxGetpApp()->GetObjectShells_Impl();
474
475
    // search for a SfxDocument of the specified type
476
299k
    for (SfxObjectShell* pSh : rDocs)
477
80.2k
    {
478
80.2k
        if ( bOnlyVisible && pSh->IsPreview() && pSh->IsReadOnly() )
479
0
            continue;
480
481
80.2k
        if ( (!isObjectShell || isObjectShell( pSh)) &&
482
80.2k
             ( !bOnlyVisible || SfxViewFrame::GetFirst( pSh  )))
483
78.4k
            return pSh;
484
80.2k
    }
485
486
221k
    return nullptr;
487
299k
}
488
489
490
// returns a pointer to the next SfxDocument of specified type behind *pDoc
491
492
SfxObjectShell* SfxObjectShell::GetNext
493
(
494
    const SfxObjectShell&   rPrev,
495
    const std::function<bool ( const SfxObjectShell* )>& isObjectShell,
496
    bool                    bOnlyVisible
497
)
498
75.9k
{
499
75.9k
    std::vector<SfxObjectShell*> &rDocs = SfxGetpApp()->GetObjectShells_Impl();
500
501
    // refind the specified predecessor
502
75.9k
    size_t nPos;
503
75.9k
    for ( nPos = 0; nPos < rDocs.size(); ++nPos )
504
75.9k
        if ( rDocs[nPos] == &rPrev )
505
75.9k
            break;
506
507
    // search for the next SfxDocument of the specified type
508
75.9k
    for ( ++nPos; nPos < rDocs.size(); ++nPos )
509
0
    {
510
0
        SfxObjectShell* pSh = rDocs[ nPos ];
511
0
        if ( bOnlyVisible && pSh->IsPreview() && pSh->IsReadOnly() )
512
0
            continue;
513
514
0
        if ( (!isObjectShell || isObjectShell( pSh)) &&
515
0
             ( !bOnlyVisible || SfxViewFrame::GetFirst( pSh )))
516
0
            return pSh;
517
0
    }
518
75.9k
    return nullptr;
519
75.9k
}
520
521
SfxObjectShell* SfxObjectShell::Current()
522
584k
{
523
584k
    SfxViewFrame *pFrame = SfxViewFrame::Current();
524
584k
    return pFrame ? pFrame->GetObjectShell() : nullptr;
525
584k
}
526
527
bool SfxObjectShell::IsInPrepareClose() const
528
0
{
529
0
    return pImpl->bInPrepareClose;
530
0
}
531
532
namespace {
533
534
struct BoolEnv_Impl
535
{
536
    SfxObjectShell_Impl& rImpl;
537
0
    explicit BoolEnv_Impl( SfxObjectShell_Impl& rImplP) : rImpl( rImplP )
538
0
    { rImplP.bInPrepareClose = true; }
539
0
    ~BoolEnv_Impl() { rImpl.bInPrepareClose = false; }
540
};
541
542
}
543
544
bool SfxObjectShell::PrepareClose
545
(
546
    bool bUI   // true: Dialog and so on is allowed
547
               // false: silent-mode
548
)
549
0
{
550
0
    if( pImpl->bInPrepareClose || pImpl->bPreparedForClose )
551
0
        return true;
552
0
    BoolEnv_Impl aBoolEnv( *pImpl );
553
554
    // DocModalDialog?
555
0
    if ( IsInModalMode() )
556
0
        return false;
557
558
0
    SfxViewFrame* pFirst = SfxViewFrame::GetFirst( this );
559
0
    if( pFirst && !pFirst->GetFrame().PrepareClose_Impl( bUI ) )
560
0
        return false;
561
562
    // prepare views for closing
563
0
    for ( SfxViewFrame* pFrm = SfxViewFrame::GetFirst( this );
564
0
          pFrm; pFrm = SfxViewFrame::GetNext( *pFrm, this ) )
565
0
    {
566
0
        DBG_ASSERT(pFrm->GetViewShell(),"No Shell");
567
0
        if ( pFrm->GetViewShell() )
568
0
        {
569
0
            bool bRet = pFrm->GetViewShell()->PrepareClose( bUI );
570
0
            if ( !bRet )
571
0
                return bRet;
572
0
        }
573
0
    }
574
575
0
    SfxApplication *pSfxApp = SfxGetpApp();
576
0
    pSfxApp->NotifyEvent( SfxEventHint(SfxEventHintId::PrepareCloseDoc, GlobalEventConfig::GetEventName(GlobalEventId::PREPARECLOSEDOC), this) );
577
578
0
    if( GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
579
0
    {
580
0
        pImpl->bPreparedForClose = true;
581
0
        return true;
582
0
    }
583
584
    // Ask if possible if it should be saved
585
    // only ask for the Document in the visible window
586
0
    SfxViewFrame *pFrame = SfxObjectShell::Current() == this
587
0
        ? SfxViewFrame::Current() : SfxViewFrame::GetFirst( this );
588
589
0
    if ( bUI && IsModified() && pFrame )
590
0
    {
591
        // restore minimized
592
0
        SfxFrame& rTop = pFrame->GetFrame();
593
0
        SfxViewFrame::SetViewFrame( rTop.GetCurrentViewFrame() );
594
0
        pFrame->GetFrame().Appear();
595
596
        // Ask if to save
597
0
        short nRet = RET_YES;
598
0
        {
599
0
            const Reference<XTitle> xTitle(*pImpl->pBaseModel, UNO_QUERY_THROW);
600
0
            const OUString     sTitle = xTitle->getTitle ();
601
0
            nRet = ExecuteQuerySaveDocument(pFrame->GetFrameWeld(), sTitle);
602
0
        }
603
        /*HACK for plugin::destroy()*/
604
605
0
        if ( RET_YES == nRet )
606
0
        {
607
            // Save by each Dispatcher
608
0
            SfxPoolItemHolder aPoolItem;
609
0
            if (IsReadOnly())
610
0
            {
611
0
                SfxBoolItem aWarnItem( SID_FAIL_ON_WARNING, bUI );
612
0
                const SfxPoolItem* ppArgs[] = { &aWarnItem, nullptr };
613
0
                aPoolItem = pFrame->GetBindings().ExecuteSynchron(SID_SAVEASDOC, ppArgs);
614
0
            }
615
0
            else if (IsSaveVersionOnClose())
616
0
            {
617
0
                SfxStringItem aItem( SID_DOCINFO_COMMENTS, SfxResId(STR_AUTOMATICVERSION) );
618
0
                SfxBoolItem aWarnItem( SID_FAIL_ON_WARNING, bUI );
619
0
                const SfxPoolItem* ppArgs[] = { &aItem, &aWarnItem, nullptr };
620
0
                aPoolItem = pFrame->GetBindings().ExecuteSynchron( SID_SAVEDOC, ppArgs );
621
0
            }
622
0
            else
623
0
            {
624
0
                SfxBoolItem aWarnItem( SID_FAIL_ON_WARNING, bUI );
625
0
                const SfxPoolItem* ppArgs[] = { &aWarnItem, nullptr };
626
0
                aPoolItem = pFrame->GetBindings().ExecuteSynchron( SID_SAVEDOC, ppArgs );
627
0
            }
628
629
0
            if (!aPoolItem || IsDisabledItem(aPoolItem.getItem()) )
630
0
                return false;
631
0
            if ( auto pBoolItem = dynamic_cast< const SfxBoolItem *>( aPoolItem.getItem() ) )
632
0
                if ( !pBoolItem->GetValue() )
633
0
                    return false;
634
0
        }
635
0
        else if ( RET_CANCEL == nRet )
636
            // Cancelled
637
0
            return false;
638
0
    }
639
640
0
    if ( pFrame )
641
0
        sfx2::SfxNotebookBar::CloseMethod(pFrame->GetBindings());
642
0
    pImpl->bPreparedForClose = true;
643
0
    return true;
644
0
}
645
646
647
#if HAVE_FEATURE_SCRIPTING
648
namespace
649
{
650
    BasicManager* lcl_getBasicManagerForDocument( const SfxObjectShell& _rDocument )
651
    {
652
        if ( !_rDocument.Get_Impl()->m_bNoBasicCapabilities )
653
        {
654
            if ( !_rDocument.Get_Impl()->bBasicInitialized )
655
                const_cast< SfxObjectShell& >( _rDocument ).InitBasicManager_Impl();
656
            return _rDocument.Get_Impl()->aBasicManager.get();
657
        }
658
659
        // assume we do not have Basic ourself, but we can refer to another
660
        // document which does (by our model's XScriptInvocationContext::getScriptContainer).
661
        // In this case, we return the BasicManager of this other document.
662
663
        OSL_ENSURE( !Reference< XEmbeddedScripts >( _rDocument.GetModel(), UNO_QUERY ).is(),
664
            "lcl_getBasicManagerForDocument: inconsistency: no Basic, but an XEmbeddedScripts?" );
665
        Reference< XModel > xForeignDocument;
666
        Reference< XScriptInvocationContext > xContext( _rDocument.GetModel(), UNO_QUERY );
667
        if ( xContext.is() )
668
        {
669
            xForeignDocument.set( xContext->getScriptContainer(), UNO_QUERY );
670
            OSL_ENSURE( xForeignDocument.is() && xForeignDocument != _rDocument.GetModel(),
671
                "lcl_getBasicManagerForDocument: no Basic, but providing ourself as script container?" );
672
        }
673
674
        BasicManager* pBasMgr = nullptr;
675
        if ( xForeignDocument.is() )
676
            pBasMgr = ::basic::BasicManagerRepository::getDocumentBasicManager( xForeignDocument );
677
678
        return pBasMgr;
679
    }
680
}
681
#endif
682
683
BasicManager* SfxObjectShell::GetBasicManager() const
684
0
{
685
0
    BasicManager* pBasMgr = nullptr;
686
#if HAVE_FEATURE_SCRIPTING
687
    try
688
    {
689
        pBasMgr = lcl_getBasicManagerForDocument( *this );
690
        if ( !pBasMgr )
691
            pBasMgr = SfxApplication::GetBasicManager();
692
    }
693
    catch (const css::ucb::ContentCreationException&)
694
    {
695
        TOOLS_WARN_EXCEPTION("sfx.doc", "");
696
    }
697
#endif
698
0
    return pBasMgr;
699
0
}
700
701
bool SfxObjectShell::HasBasic() const
702
0
{
703
0
#if !HAVE_FEATURE_SCRIPTING
704
0
    return false;
705
#else
706
    if ( pImpl->m_bNoBasicCapabilities )
707
        return false;
708
709
    if ( !pImpl->bBasicInitialized )
710
        const_cast< SfxObjectShell* >( this )->InitBasicManager_Impl();
711
712
    return pImpl->aBasicManager.isValid();
713
#endif
714
0
}
715
716
717
#if HAVE_FEATURE_SCRIPTING
718
namespace
719
{
720
    const Reference< XStorageBasedLibraryContainer >&
721
    lcl_getOrCreateLibraryContainer( bool _bScript, Reference< XStorageBasedLibraryContainer >& _rxContainer,
722
        const Reference< XModel >& _rxDocument )
723
    {
724
        if ( !_rxContainer.is() )
725
        {
726
            try
727
            {
728
                Reference< XStorageBasedDocument > xStorageDoc( _rxDocument, UNO_QUERY );
729
                const Reference< XComponentContext >& xContext(
730
                    ::comphelper::getProcessComponentContext() );
731
                _rxContainer.set (   _bScript
732
                                ?   DocumentScriptLibraryContainer::create(
733
                                        xContext, xStorageDoc )
734
                                :   DocumentDialogLibraryContainer::create(
735
                                        xContext, xStorageDoc ));
736
            }
737
            catch (const Exception&)
738
            {
739
                DBG_UNHANDLED_EXCEPTION("sfx.doc");
740
            }
741
        }
742
        return _rxContainer;
743
    }
744
}
745
#endif
746
747
Reference< XStorageBasedLibraryContainer > SfxObjectShell::GetDialogContainer()
748
0
{
749
#if HAVE_FEATURE_SCRIPTING
750
    try
751
    {
752
        if ( !pImpl->m_bNoBasicCapabilities )
753
            return lcl_getOrCreateLibraryContainer( false, pImpl->xDialogLibraries, GetModel() );
754
755
        BasicManager* pBasMgr = lcl_getBasicManagerForDocument( *this );
756
        if ( pBasMgr )
757
            return pBasMgr->GetDialogLibraryContainer();
758
    }
759
    catch (const css::ucb::ContentCreationException&)
760
    {
761
        TOOLS_WARN_EXCEPTION("sfx.doc", "");
762
    }
763
764
    SAL_WARN("sfx.doc", "SfxObjectShell::GetDialogContainer: falling back to the application - is this really expected here?");
765
#endif
766
0
    return SfxGetpApp()->GetDialogContainer();
767
0
}
768
769
Reference< XStorageBasedLibraryContainer > SfxObjectShell::GetBasicContainer()
770
31.7k
{
771
#if HAVE_FEATURE_SCRIPTING
772
    if (!comphelper::IsFuzzing())
773
    {
774
        try
775
        {
776
            if ( !pImpl->m_bNoBasicCapabilities )
777
                return lcl_getOrCreateLibraryContainer( true, pImpl->xBasicLibraries, GetModel() );
778
779
            BasicManager* pBasMgr = lcl_getBasicManagerForDocument( *this );
780
            if ( pBasMgr )
781
                return pBasMgr->GetScriptLibraryContainer();
782
        }
783
        catch (const css::ucb::ContentCreationException&)
784
        {
785
            TOOLS_WARN_EXCEPTION("sfx.doc", "");
786
        }
787
    }
788
    SAL_WARN("sfx.doc", "SfxObjectShell::GetBasicContainer: falling back to the application - is this really expected here?");
789
#endif
790
31.7k
    return SfxGetpApp()->GetBasicContainer();
791
31.7k
}
792
793
StarBASIC* SfxObjectShell::GetBasic() const
794
0
{
795
0
#if !HAVE_FEATURE_SCRIPTING
796
0
    return nullptr;
797
#else
798
    BasicManager * pMan = GetBasicManager();
799
    return pMan ? pMan->GetLib(0) : nullptr;
800
#endif
801
0
}
802
803
void SfxObjectShell::InitBasicManager_Impl()
804
/*  [Description]
805
806
    Creates a document's BasicManager and loads it, if we are already based on
807
    a storage.
808
809
    [Note]
810
811
    This method has to be called by implementations of <SvPersist::Load()>
812
    (with its pStor parameter) and by implementations of <SvPersist::InitNew()>
813
    (with pStor = 0).
814
*/
815
816
0
{
817
    /*  #163556# (DR) - Handling of recursive calls while creating the Basic
818
        manager.
819
820
        It is possible that (while creating the Basic manager) the code that
821
        imports the Basic storage wants to access the Basic manager again.
822
        Especially in VBA compatibility mode, there is code that wants to
823
        access the "VBA Globals" object which is stored as global UNO constant
824
        in the Basic manager.
825
826
        To achieve correct handling of the recursive calls of this function
827
        from lcl_getBasicManagerForDocument(), the implementation of the
828
        function BasicManagerRepository::getDocumentBasicManager() has been
829
        changed to return the Basic manager currently under construction, when
830
        called repeatedly.
831
832
        The variable pImpl->bBasicInitialized will be set to sal_True after
833
        construction now, to ensure that the recursive call of the function
834
        lcl_getBasicManagerForDocument() will be routed into this function too.
835
836
        Calling BasicManagerHolder::reset() twice is not a big problem, as it
837
        does not take ownership but stores only the raw pointer. Owner of all
838
        Basic managers is the global BasicManagerRepository instance.
839
     */
840
#if HAVE_FEATURE_SCRIPTING
841
    DBG_ASSERT( !pImpl->bBasicInitialized && !pImpl->aBasicManager.isValid(), "Local BasicManager already exists");
842
    try
843
    {
844
        pImpl->aBasicManager.reset( BasicManagerRepository::getDocumentBasicManager( GetModel() ) );
845
    }
846
    catch (const css::ucb::ContentCreationException&)
847
    {
848
        TOOLS_WARN_EXCEPTION("sfx.doc", "");
849
    }
850
    DBG_ASSERT( pImpl->aBasicManager.isValid(), "SfxObjectShell::InitBasicManager_Impl: did not get a BasicManager!" );
851
    pImpl->bBasicInitialized = true;
852
#endif
853
0
}
854
855
856
bool SfxObjectShell::DoClose()
857
186k
{
858
186k
    return Close();
859
186k
}
860
861
862
SfxObjectShell* SfxObjectShell::GetObjectShell()
863
4.26k
{
864
4.26k
    return this;
865
4.26k
}
866
867
868
uno::Sequence< OUString > SfxObjectShell::GetEventNames()
869
104
{
870
104
    static uno::Sequence< OUString > s_EventNameContainer(rtl::Reference<GlobalEventConfig>(new GlobalEventConfig)->getElementNames());
871
872
104
    return s_EventNameContainer;
873
104
}
874
875
876
css::uno::Reference< css::frame::XModel3 > SfxObjectShell::GetModel() const
877
1.47M
{
878
1.47M
    return GetBaseModel();
879
1.47M
}
880
881
void SfxObjectShell::SetBaseModel( SfxBaseModel* pModel )
882
237k
{
883
237k
    OSL_ENSURE( !pImpl->pBaseModel.is() || pModel == nullptr, "Model already set!" );
884
237k
    pImpl->pBaseModel.set( pModel );
885
237k
    if ( pImpl->pBaseModel.is() )
886
237k
    {
887
237k
        pImpl->pBaseModel->addCloseListener( new SfxModelListener_Impl(this) );
888
237k
    }
889
237k
}
890
891
892
css::uno::Reference< css::frame::XModel3 > SfxObjectShell::GetBaseModel() const
893
2.09M
{
894
2.09M
    return pImpl->pBaseModel;
895
2.09M
}
896
897
void SfxObjectShell::SetAutoStyleFilterIndex(sal_uInt16 nSet)
898
87.2k
{
899
87.2k
    pImpl->nStyleFilter = nSet;
900
87.2k
}
901
902
sal_uInt16 SfxObjectShell::GetAutoStyleFilterIndex() const
903
0
{
904
0
    return pImpl->nStyleFilter;
905
0
}
906
907
908
void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComponent )
909
8.52k
{
910
8.52k
    WeakReference< XInterface >& rTheCurrentComponent = theCurrentComponent;
911
912
8.52k
    Reference< XInterface > xOldCurrentComp(rTheCurrentComponent);
913
8.52k
    if ( _rxComponent == xOldCurrentComp )
914
        // nothing to do
915
0
        return;
916
    // note that "_rxComponent.get() == s_xCurrentComponent.get().get()" is /sufficient/, but not
917
    // /required/ for "_rxComponent == s_xCurrentComponent.get()".
918
    // In other words, it's still possible that we here do something which is not necessary,
919
    // but we should have filtered quite some unnecessary calls already.
920
921
#if HAVE_FEATURE_SCRIPTING
922
    BasicManager* pAppMgr = SfxApplication::GetBasicManager();
923
    rTheCurrentComponent = _rxComponent;
924
    if ( !pAppMgr )
925
        return;
926
927
    // set "ThisComponent" for Basic
928
    pAppMgr->SetGlobalUNOConstant( u"ThisComponent"_ustr, Any( _rxComponent ) );
929
930
    // set new current component for VBA compatibility
931
    if ( _rxComponent.is() )
932
    {
933
        OUString aVBAConstName = lclGetVBAGlobalConstName( _rxComponent );
934
        if ( !aVBAConstName.isEmpty() )
935
        {
936
            pAppMgr->SetGlobalUNOConstant( aVBAConstName, Any( _rxComponent ) );
937
            s_aRegisteredVBAConstants[ _rxComponent.get() ] = aVBAConstName;
938
        }
939
    }
940
    // no new component passed -> remove last registered VBA component
941
    else if ( xOldCurrentComp.is() )
942
    {
943
        OUString aVBAConstName = lclGetVBAGlobalConstName( xOldCurrentComp );
944
        if ( !aVBAConstName.isEmpty() )
945
        {
946
            pAppMgr->SetGlobalUNOConstant( aVBAConstName, Any( Reference< XInterface >() ) );
947
            s_aRegisteredVBAConstants.erase( xOldCurrentComp.get() );
948
        }
949
    }
950
#endif
951
8.52k
}
952
953
Reference< XInterface > SfxObjectShell::GetCurrentComponent()
954
237k
{
955
237k
    return theCurrentComponent;
956
237k
}
957
958
959
OUString SfxObjectShell::GetServiceNameFromFactory( const OUString& rFact )
960
0
{
961
    //! Remove everything behind name!
962
0
    OUString aFact( rFact );
963
0
    OUString aPrefix(u"private:factory/"_ustr);
964
0
    if ( aFact.startsWith( aPrefix ) )
965
0
        aFact = aFact.copy( aPrefix.getLength() );
966
0
    sal_Int32 nPos = aFact.indexOf( '?' );
967
0
    if ( nPos != -1 )
968
0
    {
969
0
        aFact = aFact.copy( 0, nPos );
970
0
    }
971
0
    aFact = aFact.replaceAll("4", "");
972
0
    aFact = aFact.toAsciiLowerCase();
973
974
    // HACK: sometimes a real document service name is given here instead of
975
    // a factory short name. Set return value directly to this service name as fallback
976
    // in case next lines of code does nothing ...
977
    // use rFact instead of normed aFact value !
978
0
    OUString aServiceName = rFact;
979
980
0
    if ( aFact == "swriter" )
981
0
    {
982
0
        aServiceName = "com.sun.star.text.TextDocument";
983
0
    }
984
0
    else if ( aFact == "sweb" || aFact == "swriter/web" )
985
0
    {
986
0
        aServiceName = "com.sun.star.text.WebDocument";
987
0
    }
988
0
    else if ( aFact == "sglobal" || aFact == "swriter/globaldocument" )
989
0
    {
990
0
        aServiceName = "com.sun.star.text.GlobalDocument";
991
0
    }
992
0
    else if ( aFact == "scalc" )
993
0
    {
994
0
        aServiceName = "com.sun.star.sheet.SpreadsheetDocument";
995
0
    }
996
0
    else if ( aFact == "sdraw" )
997
0
    {
998
0
        aServiceName = "com.sun.star.drawing.DrawingDocument";
999
0
    }
1000
0
    else if ( aFact == "simpress" )
1001
0
    {
1002
0
        aServiceName = "com.sun.star.presentation.PresentationDocument";
1003
0
    }
1004
0
    else if ( aFact == "schart" )
1005
0
    {
1006
0
        aServiceName = "com.sun.star.chart.ChartDocument";
1007
0
    }
1008
0
    else if ( aFact == "smath" )
1009
0
    {
1010
0
        aServiceName = "com.sun.star.formula.FormulaProperties";
1011
0
    }
1012
#if HAVE_FEATURE_SCRIPTING
1013
    else if ( aFact == "sbasic" )
1014
    {
1015
        aServiceName = "com.sun.star.script.BasicIDE";
1016
    }
1017
#endif
1018
#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
1019
    else if ( aFact == "sdatabase" )
1020
    {
1021
        aServiceName = "com.sun.star.sdb.OfficeDatabaseDocument";
1022
    }
1023
#endif
1024
1025
0
    return aServiceName;
1026
0
}
1027
1028
SfxObjectShell* SfxObjectShell::CreateObjectByFactoryName( const OUString& rFact, SfxObjectCreateMode eMode )
1029
0
{
1030
0
    return CreateObject( GetServiceNameFromFactory( rFact ), eMode );
1031
0
}
1032
1033
1034
SfxObjectShell* SfxObjectShell::CreateObject( const OUString& rServiceName, SfxObjectCreateMode eCreateMode )
1035
0
{
1036
0
    if ( !rServiceName.isEmpty() )
1037
0
    {
1038
0
        uno::Reference < frame::XModel > xDoc( ::comphelper::getProcessServiceFactory()->createInstance( rServiceName ), UNO_QUERY );
1039
0
        if (SfxObjectShell* pRet = SfxObjectShell::GetShellFromComponent(xDoc))
1040
0
        {
1041
0
            pRet->SetCreateMode_Impl(eCreateMode);
1042
0
            return pRet;
1043
0
        }
1044
0
    }
1045
1046
0
    return nullptr;
1047
0
}
1048
1049
Reference<lang::XComponent> SfxObjectShell::CreateAndLoadComponent( const SfxItemSet& rSet )
1050
0
{
1051
0
    comphelper::SequenceAsHashMap aProps = TransformItems(SID_OPENDOC, rSet);
1052
0
    const SfxStringItem* pFileNameItem = rSet.GetItem<SfxStringItem>(SID_FILE_NAME, false);
1053
0
    const SfxStringItem* pTargetItem = rSet.GetItem<SfxStringItem>(SID_TARGETNAME, false);
1054
0
    OUString aURL;
1055
0
    OUString aTarget(u"_blank"_ustr);
1056
0
    if ( pFileNameItem )
1057
0
        aURL = pFileNameItem->GetValue();
1058
0
    if ( pTargetItem )
1059
0
        aTarget = pTargetItem->GetValue();
1060
1061
0
    uno::Reference < frame::XComponentLoader > xLoader =
1062
0
            frame::Desktop::create(comphelper::getProcessComponentContext());
1063
1064
0
    Reference <lang::XComponent> xComp;
1065
0
    try
1066
0
    {
1067
0
        xComp = xLoader->loadComponentFromURL(aURL, aTarget, 0, aProps.getAsConstPropertyValueList());
1068
0
    }
1069
0
    catch (const uno::Exception&)
1070
0
    {
1071
0
    }
1072
1073
0
    return xComp;
1074
0
}
1075
1076
SfxObjectShell* SfxObjectShell::GetShellFromComponent(const Reference<uno::XInterface>& xComp)
1077
16.8k
{
1078
16.8k
    try
1079
16.8k
    {
1080
16.8k
        Reference<lang::XUnoTunnel> xTunnel(xComp, UNO_QUERY);
1081
16.8k
        if (!xTunnel)
1082
15.5k
            return nullptr;
1083
1.28k
        static const Sequence <sal_Int8> aSeq( SvGlobalName( SFX_GLOBAL_CLASSID ).GetByteSequence() );
1084
1.28k
        return comphelper::getSomething_cast<SfxObjectShell>(xTunnel->getSomething(aSeq));
1085
16.8k
    }
1086
16.8k
    catch (const Exception&)
1087
16.8k
    {
1088
0
    }
1089
1090
0
    return nullptr;
1091
16.8k
}
1092
1093
SfxObjectShell* SfxObjectShell::GetParentShell(const css::uno::Reference<css::uno::XInterface>& xChild)
1094
15.5k
{
1095
15.5k
    SfxObjectShell* pResult = nullptr;
1096
1097
15.5k
    try
1098
15.5k
    {
1099
15.5k
        if (css::uno::Reference<css::container::XChild> xChildModel{ xChild, css::uno::UNO_QUERY })
1100
15.5k
            pResult = GetShellFromComponent(xChildModel->getParent());
1101
15.5k
    }
1102
15.5k
    catch (const Exception&)
1103
15.5k
    {
1104
0
    }
1105
1106
15.5k
    return pResult;
1107
15.5k
}
1108
1109
void SfxObjectShell::SetInitialized_Impl( const bool i_fromInitNew )
1110
218k
{
1111
218k
    pImpl->bInitialized = true;
1112
218k
    if (comphelper::IsFuzzing())
1113
218k
        return;
1114
0
    if ( i_fromInitNew )
1115
0
    {
1116
0
        SetActivateEvent_Impl( SfxEventHintId::CreateDoc );
1117
0
        SfxGetpApp()->NotifyEvent( SfxEventHint( SfxEventHintId::DocCreated, GlobalEventConfig::GetEventName(GlobalEventId::DOCCREATED), this ) );
1118
0
    }
1119
0
    else
1120
0
    {
1121
0
        SfxGetpApp()->NotifyEvent( SfxEventHint( SfxEventHintId::LoadFinished, GlobalEventConfig::GetEventName(GlobalEventId::LOADFINISHED), this ) );
1122
0
    }
1123
0
}
1124
1125
1126
bool SfxObjectShell::IsChangeRecording(SfxViewShell* /*pViewShell*/, bool /*bRecordAllViews*/) const
1127
0
{
1128
    // currently this function needs to be overwritten by Writer and Calc only
1129
0
    SAL_WARN( "sfx.doc", "function not implemented" );
1130
0
    return false;
1131
0
}
1132
1133
1134
bool SfxObjectShell::HasChangeRecordProtection() const
1135
0
{
1136
    // currently this function needs to be overwritten by Writer and Calc only
1137
0
    SAL_WARN( "sfx.doc", "function not implemented" );
1138
0
    return false;
1139
0
}
1140
1141
1142
void SfxObjectShell::SetChangeRecording( bool /*bActivate*/, bool /*bLockAllViews*/, SfxRedlineRecordingMode /*eRedlineRecordingMode*/)
1143
0
{
1144
    // currently this function needs to be overwritten by Writer and Calc only
1145
0
    SAL_WARN( "sfx.doc", "function not implemented" );
1146
0
}
1147
1148
1149
void SfxObjectShell::SetProtectionPassword( const OUString & /*rPassword*/ )
1150
0
{
1151
    // currently this function needs to be overwritten by Writer and Calc only
1152
0
    SAL_WARN( "sfx.doc", "function not implemented" );
1153
0
}
1154
1155
1156
bool SfxObjectShell::GetProtectionHash( /*out*/ css::uno::Sequence< sal_Int8 > & /*rPasswordHash*/ )
1157
0
{
1158
    // currently this function needs to be overwritten by Writer and Calc only
1159
0
    SAL_WARN( "sfx.doc", "function not implemented" );
1160
0
    return false;
1161
0
}
1162
1163
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */