LibreOffice Module sfx2 (master) 1
viewfrm.cxx
Go to the documentation of this file.
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_feature_desktop.h>
21#include <config_wasm_strip.h>
22
23#include <osl/file.hxx>
24#include <sfx2/docfilt.hxx>
25#include <sfx2/infobar.hxx>
26#include <sfx2/sfxsids.hrc>
27#include <sfx2/viewfrm.hxx>
30#include <com/sun/star/document/MacroExecMode.hpp>
31#include <com/sun/star/frame/Desktop.hpp>
32#include <com/sun/star/frame/DispatchRecorder.hpp>
33#include <com/sun/star/frame/DispatchRecorderSupplier.hpp>
34#include <com/sun/star/frame/XLoadable.hpp>
35#include <com/sun/star/frame/XLayoutManager.hpp>
36#include <com/sun/star/frame/XComponentLoader.hpp>
37#include <com/sun/star/task/PasswordContainer.hpp>
38#include <officecfg/Office/Common.hxx>
39#include <officecfg/Setup.hxx>
41#include <vcl/wrkwin.hxx>
43#include <svl/intitem.hxx>
44#include <svl/visitem.hxx>
45#include <svl/stritem.hxx>
46#include <svl/eitem.hxx>
47#include <svl/whiter.hxx>
48#include <svl/undo.hxx>
49#include <vcl/help.hxx>
50#include <vcl/stdtext.hxx>
51#include <vcl/weld.hxx>
52#include <vcl/weldutils.hxx>
53#if !ENABLE_WASM_STRIP_PINGUSER
55#endif
57#include <svtools/miscopt.hxx>
59#include <com/sun/star/container/XIndexAccess.hpp>
60#include <com/sun/star/frame/XFramesSupplier.hpp>
61#include <com/sun/star/frame/FrameSearchFlag.hpp>
62#include <com/sun/star/frame/XFrame.hpp>
63#include <com/sun/star/awt/XWindow.hpp>
64#include <com/sun/star/frame/XController.hpp>
65#include <com/sun/star/util/URLTransformer.hpp>
66#include <com/sun/star/util/XURLTransformer.hpp>
67#include <com/sun/star/util/XCloseable.hpp>
68#include <com/sun/star/frame/XDispatchRecorderSupplier.hpp>
69#include <com/sun/star/document/UpdateDocMode.hpp>
70#include <com/sun/star/beans/XPropertySet.hpp>
71#include <com/sun/star/uri/UriReferenceFactory.hpp>
72#include <com/sun/star/uri/XVndSunStarScriptUrl.hpp>
73#include <com/sun/star/document/XViewDataSupplier.hpp>
74#include <com/sun/star/container/XIndexContainer.hpp>
75#include <com/sun/star/task/InteractionHandler.hpp>
76#include <com/sun/star/drawing/XDrawView.hpp>
77#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
78#include <rtl/ustrbuf.hxx>
79#include <sal/log.hxx>
80
82#include <comphelper/lok.hxx>
87
88#include <com/sun/star/uno/Reference.h>
89
90#include <basic/basmgr.hxx>
91#include <basic/sbmod.hxx>
92#include <basic/sbmeth.hxx>
93#include <svtools/strings.hrc>
94#include <svtools/svtresid.hxx>
96
97#include <optional>
98
100
102
103
104using namespace ::com::sun::star;
105using namespace ::com::sun::star::uno;
106using namespace ::com::sun::star::ucb;
107using namespace ::com::sun::star::frame;
108using namespace ::com::sun::star::lang;
109using ::com::sun::star::awt::XWindow;
110using ::com::sun::star::beans::PropertyValue;
111using ::com::sun::star::document::XViewDataSupplier;
112using ::com::sun::star::container::XIndexContainer;
113
114// Due to ViewFrame::Current
115#include <appdata.hxx>
116#include <sfx2/app.hxx>
117#include <sfx2/objface.hxx>
118#include <openflag.hxx>
119#include <objshimp.hxx>
120#include <sfx2/viewsh.hxx>
121#include <sfx2/objsh.hxx>
122#include <sfx2/bindings.hxx>
123#include <sfx2/dispatch.hxx>
124#include <sfx2/request.hxx>
125#include <sfx2/docfac.hxx>
126#include <sfx2/ipclient.hxx>
127#include <sfx2/sfxresid.hxx>
128#include <sfx2/viewfac.hxx>
129#include <sfx2/event.hxx>
130#include <sfx2/fcontnr.hxx>
131#include <sfx2/docfile.hxx>
132#include <sfx2/module.hxx>
133#include <sfx2/sfxuno.hxx>
134#include <sfx2/progress.hxx>
136#include <workwin.hxx>
137#include <sfx2/minfitem.hxx>
138#include <sfx2/strings.hrc>
139#include "impviewframe.hxx"
141#include <vcl/svapp.hxx>
142
143#define ShellClass_SfxViewFrame
144#include <sfxslots.hxx>
145
146constexpr OUStringLiteral CHANGES_STR = u"private:resource/toolbar/changes";
147
149
150void SfxViewFrame::InitInterface_Impl()
151{
152 GetStaticInterface()->RegisterChildWindow(SID_BROWSER);
153 GetStaticInterface()->RegisterChildWindow(SID_RECORDING_FLOATWINDOW);
154#if HAVE_FEATURE_DESKTOP
156 GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_APPLICATION, SfxVisibilityFlags::Standard, ToolbarId::EnvToolbox);
157#endif
158}
159
160namespace {
162class SfxEditDocumentDialog : public weld::MessageDialogController
163{
164public:
165 SfxEditDocumentDialog(weld::Widget* pParent);
166};
167
168SfxEditDocumentDialog::SfxEditDocumentDialog(weld::Widget* pParent)
169 : MessageDialogController(pParent, "sfx/ui/editdocumentdialog.ui",
170 "EditDocumentDialog")
171{
172}
173
174class SfxQueryOpenAsTemplate
175{
176private:
177 std::unique_ptr<weld::MessageDialog> m_xQueryBox;
178public:
179 SfxQueryOpenAsTemplate(weld::Window* pParent, bool bAllowIgnoreLock, LockFileEntry& rLockData)
180 : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question,
181 VclButtonsType::NONE, ""))
182 {
183 m_xQueryBox->add_button(SfxResId(STR_QUERY_OPENASTEMPLATE_OPENCOPY_BTN), RET_YES);
184 bAllowIgnoreLock
185 = bAllowIgnoreLock && officecfg::Office::Common::Misc::AllowOverrideLocking::get();
186 if (bAllowIgnoreLock)
187 m_xQueryBox->add_button(SfxResId(STR_QUERY_OPENASTEMPLATE_OPEN_BTN), RET_IGNORE);
188 m_xQueryBox->add_button(GetStandardText( StandardButtonType::Cancel ), RET_CANCEL);
189 m_xQueryBox->set_primary_text(QueryString(bAllowIgnoreLock, rLockData));
190 m_xQueryBox->set_default_response(RET_YES);
191 }
192 short run() { return m_xQueryBox->run(); }
193
194private:
195 static OUString QueryString(bool bAllowIgnoreLock, LockFileEntry& rLockData)
196 {
197 OUString sLockUserData;
198 if (!rLockData[LockFileComponent::OOOUSERNAME].isEmpty())
199 sLockUserData = rLockData[LockFileComponent::OOOUSERNAME];
200 else
201 sLockUserData = rLockData[LockFileComponent::SYSUSERNAME];
202
203 if (!sLockUserData.isEmpty() && !rLockData[LockFileComponent::EDITTIME].isEmpty())
204 sLockUserData += " ( " + rLockData[LockFileComponent::EDITTIME] + " )";
205
206 if (!sLockUserData.isEmpty())
207 sLockUserData = "\n\n" + sLockUserData + "\n";
208
209 const bool bUseLockStr = bAllowIgnoreLock || !sLockUserData.isEmpty();
210
211 OUString sMsg(
212 SfxResId(bUseLockStr ? STR_QUERY_OPENASTEMPLATE_LOCKED : STR_QUERY_OPENASTEMPLATE));
213
214 if (bAllowIgnoreLock)
215 sMsg += "\n\n" + SfxResId(STR_QUERY_OPENASTEMPLATE_ALLOW_IGNORE);
216
217 return sMsg.replaceFirst("%LOCKINFO", sLockUserData);
218 }
219};
220
221bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHandler >& xHandler, const OUString& aPath, const std::shared_ptr<const SfxFilter>& pFilter, sal_uInt32 nPasswordHash, const uno::Sequence< beans::PropertyValue >& aInfo )
222{
223 // TODO/LATER: In future the info should replace the direct hash completely
224 bool bResult = ( !nPasswordHash && !aInfo.hasElements() );
225
226 SAL_WARN_IF( !(pFilter && ( pFilter->GetFilterFlags() & SfxFilterFlags::PASSWORDTOMODIFY )), "sfx.view",
227 "PasswordToModify feature is active for a filter that does not support it!");
228
229 if ( pFilter && xHandler.is() )
230 {
231 bool bCancel = false;
232 bool bFirstTime = true;
233
234 while ( !bResult && !bCancel )
235 {
236 bool bMSType = !pFilter->IsOwnFormat();
237
239 new ::comphelper::DocPasswordRequest(
240 bMSType ? ::comphelper::DocPasswordRequestType::MS : ::comphelper::DocPasswordRequestType::Standard,
241 bFirstTime ? css::task::PasswordRequestMode_PASSWORD_ENTER : css::task::PasswordRequestMode_PASSWORD_REENTER,
242 aPath,
243 true ) );
244
245 xHandler->handle( pPasswordRequest );
246
247 if ( pPasswordRequest->isPassword() )
248 {
249 if ( aInfo.hasElements() )
250 {
251 bResult = ::comphelper::DocPasswordHelper::IsModifyPasswordCorrect( pPasswordRequest->getPasswordToModify(), aInfo );
252 }
253 else
254 {
255 // the binary format
256 bResult = ( SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), pFilter->GetServiceName()=="com.sun.star.text.TextDocument" ) == nPasswordHash );
257 }
258 }
259 else
260 bCancel = true;
261
262 bFirstTime = false;
263 }
264 }
265
266 return bResult;
267}
268
269bool physObjIsOlder(INetURLObject const & aMedObj, INetURLObject const & aPhysObj) {
270 return ::utl::UCBContentHelper::IsYounger(aMedObj.GetMainURL( INetURLObject::DecodeMechanism::NONE),
272}
273}
274
276{
278 switch ( rReq.GetSlot() )
279 {
280 case SID_EDITDOC:
281 case SID_READONLYDOC:
282 {
283 // Due to Double occupancy in toolboxes (with or without Ctrl),
284 // it is also possible that the slot is enabled, but Ctrl-click
285 // despite this is not!
286 if( !pSh || !pSh->HasName() || !(pSh->Get_Impl()->nLoadedFlags & SfxLoadedFlags::MAINDOCUMENT ))
287 break;
288
289 if (pSh->isEditDocLocked())
290 break;
291
292 // Only change read-only UI and remove info bar when we succeed
293 struct ReadOnlyUIGuard
294 {
295 SfxViewFrame* m_pFrame;
296 SfxObjectShell* m_pSh;
297 SfxMedium* m_pMed = nullptr;
298 bool m_bSetRO;
299 ReadOnlyUIGuard(SfxViewFrame* pFrame, SfxObjectShell* p_Sh)
300 : m_pFrame(pFrame), m_pSh(p_Sh), m_bSetRO(p_Sh->IsReadOnlyUI())
301 {}
302 ~ReadOnlyUIGuard() COVERITY_NOEXCEPT_FALSE
303 {
304 if (m_bSetRO != m_pSh->IsReadOnlyUI())
305 {
306 m_pSh->SetReadOnlyUI(m_bSetRO);
307 if (!m_bSetRO)
308 m_pFrame->RemoveInfoBar(u"readonly");
309 if (m_pMed)
310 {
311 // tdf#116066: DoSaveCompleted should be called after SetReadOnlyUI
312 m_pSh->DoSaveCompleted(m_pMed);
313 m_pSh->Broadcast(SfxHint(SfxHintId::ModeChanged));
314 }
315 }
316 }
317 } aReadOnlyUIGuard(this, pSh);
318
319 SfxMedium* pMed = pSh->GetMedium();
320
321 std::shared_ptr<std::recursive_mutex> pChkEditMutex = pMed->GetCheckEditableMutex();
322 std::unique_lock<std::recursive_mutex> chkEditLock;
323 if (pChkEditMutex != nullptr)
324 chkEditLock = std::unique_lock<std::recursive_mutex>(*pChkEditMutex);
326
327 const SfxBoolItem* pItem = SfxItemSet::GetItem<SfxBoolItem>(pSh->GetMedium()->GetItemSet(), SID_VIEWONLY, false);
328 if ( pItem && pItem->GetValue() )
329 {
330 SfxApplication* pApp = SfxGetpApp();
331 SfxAllItemSet aSet( pApp->GetPool() );
333 aSet.Put( SfxBoolItem( SID_TEMPLATE, true ) );
334 aSet.Put( SfxStringItem( SID_TARGETNAME, "_blank" ) );
335 const SfxStringItem* pReferer = SfxItemSet::GetItem<SfxStringItem>(pMed->GetItemSet(), SID_REFERER, false);
336 if ( pReferer )
337 aSet.Put( *pReferer );
338 const SfxInt16Item* pVersionItem = SfxItemSet::GetItem<SfxInt16Item>(pSh->GetMedium()->GetItemSet(), SID_VERSION, false);
339 if ( pVersionItem )
340 aSet.Put( *pVersionItem );
341
342 if( pMed->GetFilter() )
343 {
344 aSet.Put( SfxStringItem( SID_FILTER_NAME, pMed->GetFilter()->GetFilterName() ) );
345 const SfxStringItem* pOptions = SfxItemSet::GetItem<SfxStringItem>(pMed->GetItemSet(), SID_FILE_FILTEROPTIONS, false);
346 if ( pOptions )
347 aSet.Put( *pOptions );
348 }
349
350 GetDispatcher()->Execute( SID_OPENDOC, SfxCallMode::ASYNCHRON, aSet );
351 return;
352 }
353
354 StreamMode nOpenMode;
355 bool bNeedsReload = false;
356 bool bPasswordEntered = false;
357 if ( !pSh->IsReadOnly() )
358 {
359 // Save and reload Readonly
360 if( pSh->IsModified() )
361 {
362 if ( pSh->PrepareClose() )
363 {
364 // the storing could let the medium be changed
365 pMed = pSh->GetMedium();
366 bNeedsReload = true;
367 }
368 else
369 {
370 rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), false ) );
371 return;
372 }
373 }
374 nOpenMode = SFX_STREAM_READONLY;
375 aReadOnlyUIGuard.m_bSetRO = true;
376 }
377 else
378 {
379 if ( pSh->IsReadOnlyMedium()
380 && ( pSh->GetModifyPasswordHash() || pSh->GetModifyPasswordInfo().hasElements() )
381 && !pSh->IsModifyPasswordEntered() )
382 {
383 const OUString aDocumentName = INetURLObject( pMed->GetOrigURL() ).GetMainURL( INetURLObject::DecodeMechanism::WithCharset );
384 if( !AskPasswordToModify_Impl( pMed->GetInteractionHandler(), aDocumentName, pMed->GetFilter(), pSh->GetModifyPasswordHash(), pSh->GetModifyPasswordInfo() ) )
385 {
386 // this is a read-only document, if it has "Password to modify"
387 // the user should enter password before he can edit the document
388 rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), false ) );
389 return;
390 }
391
393 bPasswordEntered = true;
394 }
395
397 aReadOnlyUIGuard.m_bSetRO = false;
398
399 // if only the view was in the readonly mode then there is no need to do the reload
400 if ( !pSh->IsReadOnlyMedium() )
401 {
402 // SetReadOnlyUI causes recomputation of window title, using
403 // open mode among other things, so call SetOpenMode before
404 // SetReadOnlyUI:
405 pMed->SetOpenMode( nOpenMode );
406 return;
407 }
408 }
409
410 if ( rReq.IsAPI() )
411 {
412 // Control through API if r/w or r/o
413 const SfxBoolItem* pEditItem = rReq.GetArg<SfxBoolItem>(SID_EDITDOC);
414 if ( pEditItem )
415 nOpenMode = pEditItem->GetValue() ? SFX_STREAM_READWRITE : SFX_STREAM_READONLY;
416 }
417
418 // doing
419
420 OUString sTemp;
421 osl::FileBase::getFileURLFromSystemPath( pMed->GetPhysicalName(), sTemp );
422 INetURLObject aPhysObj( sTemp );
423 const SfxInt16Item* pVersionItem = SfxItemSet::GetItem<SfxInt16Item>(pSh->GetMedium()->GetItemSet(), SID_VERSION, false);
424
425 INetURLObject aMedObj( pMed->GetName() );
426
427 // -> tdf#82744
428 // the logic below is following:
429 // if the document seems not to need to be reloaded
430 // and the physical name is different to the logical one,
431 // then on file system it can be checked that the copy is still newer than the original and no document reload is required.
432 // Did some semplification to enhance readability of the 'if' expression
433 //
434 // when the 'http/https' protocol is active, the bool bPhysObjIsYounger relies upon the getlastmodified Property of a WebDAV resource.
435 // Said property should be implemented, but sometimes it's not.
436 // implemented. On this case the reload activated here will not work properly.
437 // TODO: change the check age method for WebDAV to etag (entity-tag) property value, need some rethinking, since the
438 // etag tells that the cache representation (e.g. in LO) is different from the one on the server,
439 // but tells nothing about the age
440 // Details at this link: http://tools.ietf.org/html/rfc4918#section-15, section 15.7
441 bool bIsWebDAV = aMedObj.isAnyKnownWebDAVScheme();
442
443 // tdf#118938 Reload the document when the user enters the editing password,
444 // even if the physical name isn't different to the logical name.
445 if ( ( !bNeedsReload && ( ( aMedObj.GetProtocol() == INetProtocol::File &&
446 ( aMedObj.getFSysPath( FSysStyle::Detect ) != aPhysObj.getFSysPath( FSysStyle::Detect )
447 || bPasswordEntered ) &&
448 !physObjIsOlder(aMedObj, aPhysObj))
449 || (bIsWebDAV && !physObjIsOlder(aMedObj, aPhysObj))
450 || ( pMed->IsRemote() && !bIsWebDAV ) ) )
451 || pVersionItem )
452 // <- tdf#82744
453 {
454 bool bOK = false;
455 bool bRetryIgnoringLock = false;
456 bool bOpenTemplate = false;
457 std::optional<bool> aOrigROVal;
458 if (!pVersionItem)
459 {
460 auto pRO = pMed->GetItemSet()->GetItem<SfxBoolItem>(SID_DOC_READONLY, false);
461 if (pRO)
462 aOrigROVal = pRO->GetValue();
463 }
464 do {
465 LockFileEntry aLockData;
466 if ( !pVersionItem )
467 {
468 if (bRetryIgnoringLock)
469 pMed->ResetError();
470
471 bool bHasStorage = pMed->HasStorage_Impl();
472 // switching edit mode could be possible without reload
473 if ( bHasStorage && pMed->GetStorage() == pSh->GetStorage() )
474 {
475 // TODO/LATER: faster creation of copy
476 if ( !pSh->ConnectTmpStorage_Impl( pMed->GetStorage(), pMed ) )
477 return;
478 }
479
480 pMed->CloseAndRelease();
481 pMed->SetOpenMode( nOpenMode );
482 // We need to clear the SID_DOC_READONLY item from the set, to allow
483 // MediaDescriptor::impl_openStreamWithURL (called indirectly by
484 // SfxMedium::CompleteReOpen) to properly fill input stream of the
485 // descriptor, even when the file can't be open in read-write mode.
486 // Only then can following call to SfxMedium::LockOrigFileOnDemand
487 // return proper information about who has locked the file, to show
488 // in the SfxQueryOpenAsTemplate box below; otherwise it exits right
489 // after call to SfxMedium::GetMedium_Impl. This mimics what happens
490 // when the file is opened initially, when filter detection code also
491 // calls MediaDescriptor::impl_openStreamWithURL without the item set.
492 pMed->GetItemSet()->ClearItem(SID_DOC_READONLY);
493 pMed->CompleteReOpen();
494 pMed->GetItemSet()->Put(
495 SfxBoolItem(SID_DOC_READONLY, !(nOpenMode & StreamMode::WRITE)));
496 if ( nOpenMode & StreamMode::WRITE )
497 {
498 auto eResult = pMed->LockOrigFileOnDemand(
499 true, true, bRetryIgnoringLock, &aLockData);
500 bRetryIgnoringLock
502 }
503
504 // LockOrigFileOnDemand might set the readonly flag itself, it should be set back
505 pMed->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, !( nOpenMode & StreamMode::WRITE ) ) );
506
507 if ( !pMed->GetErrorCode() )
508 bOK = true;
509 }
510
511 if( !bOK )
512 {
513 if (nOpenMode == SFX_STREAM_READWRITE && !rReq.IsAPI())
514 {
515 // css::sdbcx::User offering to open it as a template
516 SfxQueryOpenAsTemplate aBox(GetWindow().GetFrameWeld(),
517 bRetryIgnoringLock, aLockData);
518
519 short nUserAnswer = aBox.run();
520 bOpenTemplate = RET_YES == nUserAnswer;
521 // Always reset this here to avoid infinite loop
522 bRetryIgnoringLock = RET_IGNORE == nUserAnswer;
523 if (RET_CANCEL == nUserAnswer)
525 }
526 else
527 bRetryIgnoringLock = false;
528 }
529 }
530 while ( !bOK && bRetryIgnoringLock );
531
532 if( !bOK )
533 {
534 ErrCode nErr = pMed->GetErrorCode();
535 if ( pVersionItem )
537 else
538 {
539 pMed->ResetError();
541 if (aOrigROVal)
542 pMed->GetItemSet()->Put(SfxBoolItem(SID_DOC_READONLY, *aOrigROVal));
543 else
544 pMed->GetItemSet()->ClearItem(SID_DOC_READONLY);
545 pMed->ReOpen();
546 pSh->DoSaveCompleted( pMed );
547 }
548
549 // Readonly document can not be switched to edit mode?
550 rReq.Done();
551
552 if ( nOpenMode == SFX_STREAM_READWRITE && !rReq.IsAPI() )
553 {
554 if ( bOpenTemplate )
555 {
556 SfxApplication* pApp = SfxGetpApp();
557 SfxAllItemSet aSet( pApp->GetPool() );
558 aSet.Put( SfxStringItem( SID_FILE_NAME, pMed->GetName() ) );
559 const SfxStringItem* pReferer = SfxItemSet::GetItem<SfxStringItem>(pMed->GetItemSet(), SID_REFERER, false);
560 if ( pReferer )
561 aSet.Put( *pReferer );
562 aSet.Put( SfxBoolItem( SID_TEMPLATE, true ) );
563 if ( pVersionItem )
564 aSet.Put( *pVersionItem );
565
566 if( pMed->GetFilter() )
567 {
568 aSet.Put( SfxStringItem( SID_FILTER_NAME, pMed->GetFilter()->GetFilterName() ) );
569 const SfxStringItem* pOptions = SfxItemSet::GetItem<SfxStringItem>(pMed->GetItemSet(), SID_FILE_FILTEROPTIONS, false);
570 if ( pOptions )
571 aSet.Put( *pOptions );
572 }
573
574 GetDispatcher()->Execute( SID_OPENDOC, SfxCallMode::ASYNCHRON, aSet );
575 return;
576 }
577
578 nErr = ERRCODE_NONE;
579 }
580
581 // Keep the read-only UI
582 aReadOnlyUIGuard.m_bSetRO = true;
583
585 rReq.SetReturnValue(
586 SfxBoolItem( rReq.GetSlot(), false ) );
587 return;
588 }
589 else
590 {
591 aReadOnlyUIGuard.m_pMed = pMed;
592 rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), true ) );
593 rReq.Done( true );
594 return;
595 }
596 }
597
598 rReq.AppendItem( SfxBoolItem(SID_FORCERELOAD,
599 (rReq.GetSlot() == SID_EDITDOC
600 // tdf#151715 exclude files loaded from /tmp to avoid Notebookbar bugs
602 || bNeedsReload) );
603 rReq.AppendItem( SfxBoolItem( SID_SILENT, true ));
604
605 [[fallthrough]]; //TODO ???
606 }
607
608 case SID_RELOAD:
609 {
610 // Due to Double occupancy in toolboxes (with or without Ctrl),
611 // it is also possible that the slot is enabled, but Ctrl-click
612 // despite this is not!
613 if ( !pSh || !pSh->CanReload_Impl() )
614 break;
615 SfxApplication* pApp = SfxGetpApp();
616 const SfxBoolItem* pForceReloadItem = rReq.GetArg<SfxBoolItem>(SID_FORCERELOAD);
617 if( pForceReloadItem && !pForceReloadItem->GetValue() &&
618 !pSh->GetMedium()->IsExpired() )
619 return;
620 if( m_pImpl->bReloading || pSh->IsInModalMode() )
621 return;
622
623 // AutoLoad is prohibited if possible
624 const SfxBoolItem* pAutoLoadItem = rReq.GetArg<SfxBoolItem>(SID_AUTOLOAD);
625 if ( pAutoLoadItem && pAutoLoadItem->GetValue() &&
627 return;
628
629 SfxObjectShellLock xOldObj( pSh );
630 m_pImpl->bReloading = true;
631 const SfxStringItem* pURLItem = rReq.GetArg<SfxStringItem>(SID_FILE_NAME);
632 // Open as editable?
633 bool bForEdit = !pSh->IsReadOnly();
634
635 // If possible ask the User
636 bool bDo = GetViewShell()->PrepareClose();
637 const SfxBoolItem* pSilentItem = rReq.GetArg<SfxBoolItem>(SID_SILENT);
638 if (getenv("SAL_NO_QUERYSAVE"))
639 bDo = true;
640 else if (bDo && GetFrame().DocIsModified_Impl() && !rReq.IsAPI()
641 && (!pSilentItem || !pSilentItem->GetValue()))
642 {
643 std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(
644 GetWindow().GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo,
645 SfxResId(STR_QUERY_LASTVERSION)));
646 bDo = RET_YES == xBox->run();
647 }
648
649 if ( bDo )
650 {
651 SfxMedium *pMedium = xOldObj->GetMedium();
652 std::shared_ptr<std::recursive_mutex> pChkEditMutex
653 = pMedium->GetCheckEditableMutex();
654 std::unique_lock<std::recursive_mutex> chkEditLock;
655 if (pChkEditMutex != nullptr)
656 chkEditLock = std::unique_lock<std::recursive_mutex>(*pChkEditMutex);
657 pMedium->CancelCheckEditableEntry();
658
659 bool bHandsOff =
660 ( pMedium->GetURLObject().GetProtocol() == INetProtocol::File && !xOldObj->IsDocShared() );
661
662 // Empty existing SfxMDIFrames for this Document
663 // in native format or R/O, open it now for editing?
664 SfxObjectShellLock xNewObj;
665
666 // collect the views of the document
667 // TODO: when UNO ViewFactories are available for SFX-based documents, the below code should
668 // be UNOized, too
669 typedef ::std::pair< Reference< XFrame >, SfxInterfaceId > ViewDescriptor;
670 ::std::vector< ViewDescriptor > aViewFrames;
671 SfxViewFrame *pView = GetFirst( xOldObj );
672 while ( pView )
673 {
674 Reference< XFrame > xFrame( pView->GetFrame().GetFrameInterface() );
675 SAL_WARN_IF( !xFrame.is(), "sfx.view", "SfxViewFrame::ExecReload_Impl: no XFrame?!");
676 aViewFrames.emplace_back( xFrame, pView->GetCurViewId() );
677
678 pView = GetNext( *pView, xOldObj );
679 }
680
681 xOldObj->Get_Impl()->pReloadTimer.reset();
682
683 std::optional<SfxAllItemSet> pNewSet;
684 std::shared_ptr<const SfxFilter> pFilter = pMedium->GetFilter();
685 if( pURLItem )
686 {
687 pNewSet.emplace( pApp->GetPool() );
688 pNewSet->Put( *pURLItem );
689
690 // Filter Detection
691 OUString referer;
692 const SfxStringItem* refererItem = rReq.GetArg<SfxStringItem>(SID_REFERER);
693 if (refererItem != nullptr) {
694 referer = refererItem->GetValue();
695 }
696 SfxMedium aMedium( pURLItem->GetValue(), referer, SFX_STREAM_READWRITE );
697 SfxFilterMatcher().GuessFilter( aMedium, pFilter );
698 if ( pFilter )
699 pNewSet->Put( SfxStringItem( SID_FILTER_NAME, pFilter->GetName() ) );
700 pNewSet->Put( *aMedium.GetItemSet() );
701 }
702 else
703 {
704 pNewSet.emplace( *pMedium->GetItemSet() );
705 pNewSet->ClearItem( SID_VIEW_ID );
706 pNewSet->ClearItem( SID_STREAM );
707 pNewSet->ClearItem( SID_INPUTSTREAM );
708 pNewSet->Put( SfxStringItem( SID_FILTER_NAME, pMedium->GetFilter()->GetName() ) );
709
710 // let the current security settings be checked again
711 pNewSet->Put( SfxUInt16Item( SID_MACROEXECMODE, document::MacroExecMode::USE_CONFIG ) );
712
715 // edit mode is switched or reload of readonly document
716 pNewSet->Put( SfxBoolItem( SID_DOC_READONLY, true ) );
717 else
718 // Reload of file opened for writing
719 pNewSet->ClearItem( SID_DOC_READONLY );
720 }
721
722 // If a salvaged file is present, do not enclose the OrigURL
723 // again, since the Template is invalid after reload.
724 const SfxStringItem* pSalvageItem = SfxItemSet::GetItem<SfxStringItem>(&*pNewSet, SID_DOC_SALVAGE, false);
725 if( pSalvageItem )
726 {
727 pNewSet->ClearItem( SID_DOC_SALVAGE );
728 }
729
730#if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
731 // TODO/LATER: Temporary solution, the SfxMedium must know the original URL as aLogicName
732 // SfxMedium::Transfer_Impl() will be forbidden then.
733 if ( xOldObj->IsDocShared() )
734 pNewSet->Put( SfxStringItem( SID_FILE_NAME, xOldObj->GetSharedFileURL() ) );
735#endif
736 if ( pURLItem )
737 pNewSet->Put( SfxStringItem( SID_REFERER, pMedium->GetName() ) );
738 else
739 pNewSet->Put( SfxStringItem( SID_REFERER, OUString() ) );
740
741 xOldObj->CancelTransfers();
742
743
744 if ( pSilentItem && pSilentItem->GetValue() )
745 pNewSet->Put( SfxBoolItem( SID_SILENT, true ) );
746
747 const SfxUnoAnyItem* pInteractionItem = SfxItemSet::GetItem<SfxUnoAnyItem>(&*pNewSet, SID_INTERACTIONHANDLER, false);
748 const SfxUInt16Item* pMacroExecItem = SfxItemSet::GetItem<SfxUInt16Item>(&*pNewSet, SID_MACROEXECMODE, false);
749 const SfxUInt16Item* pDocTemplateItem = SfxItemSet::GetItem<SfxUInt16Item>(&*pNewSet, SID_UPDATEDOCMODE, false);
750
751 if (!pInteractionItem)
752 {
753 Reference < task::XInteractionHandler2 > xHdl = task::InteractionHandler::createWithParent( ::comphelper::getProcessComponentContext(), nullptr );
754 if (xHdl.is())
755 pNewSet->Put( SfxUnoAnyItem(SID_INTERACTIONHANDLER,css::uno::Any(xHdl)) );
756 }
757
758 if (!pMacroExecItem)
759 pNewSet->Put( SfxUInt16Item(SID_MACROEXECMODE,css::document::MacroExecMode::USE_CONFIG) );
760 if (!pDocTemplateItem)
761 pNewSet->Put( SfxUInt16Item(SID_UPDATEDOCMODE,css::document::UpdateDocMode::ACCORDING_TO_CONFIG) );
762
763 xOldObj->SetModified( false );
764 // Do not cache the old Document! Is invalid when loading
765 // another document.
766
767 bool bHasStorage = pMedium->HasStorage_Impl();
768 if( bHandsOff )
769 {
770 if ( bHasStorage && pMedium->GetStorage() == xOldObj->GetStorage() )
771 {
772 // TODO/LATER: faster creation of copy
773 if ( !xOldObj->ConnectTmpStorage_Impl( pMedium->GetStorage(), pMedium ) )
774 return;
775 }
776
777 pMedium->CloseAndRelease();
778 }
779
780 xNewObj = SfxObjectShell::CreateObject( pFilter->GetServiceName() );
781
782 if ( xOldObj->IsModifyPasswordEntered() )
783 xNewObj->SetModifyPasswordEntered();
784
785 uno::Sequence < beans::PropertyValue > aLoadArgs;
786 TransformItems( SID_OPENDOC, *pNewSet, aLoadArgs );
787 try
788 {
789 uno::Reference < frame::XLoadable > xLoad( xNewObj->GetModel(), uno::UNO_QUERY );
790 xLoad->load( aLoadArgs );
791 }
792 catch ( uno::Exception& )
793 {
794 xNewObj->DoClose();
795 xNewObj = nullptr;
797 }
798
799 pNewSet.reset();
800
801 if( !xNewObj.Is() )
802 {
803 if( bHandsOff )
804 {
805 // back to old medium
806 pMedium->ReOpen();
807 pMedium->LockOrigFileOnDemand( false, true );
808
809 xOldObj->DoSaveCompleted( pMedium );
810 }
811 }
812 else
813 {
814 if ( xNewObj->GetModifyPasswordHash() && xNewObj->GetModifyPasswordHash() != xOldObj->GetModifyPasswordHash() )
815 {
816 xNewObj->SetModifyPasswordEntered( false );
817 xNewObj->SetReadOnly();
818 }
819 else if ( rReq.GetSlot() == SID_EDITDOC || rReq.GetSlot() == SID_READONLYDOC )
820 {
821 xNewObj->SetReadOnlyUI( !bForEdit );
822 }
823
824#if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
825 if ( xNewObj->IsDocShared() )
826 {
827 // the file is shared but the closing can change the sharing control file
829 }
830#endif
831 // the Reload and Silent items were only temporary, remove them
832 xNewObj->GetMedium()->GetItemSet()->ClearItem( SID_RELOAD );
833 xNewObj->GetMedium()->GetItemSet()->ClearItem( SID_SILENT );
834 TransformItems( SID_OPENDOC, *xNewObj->GetMedium()->GetItemSet(), aLoadArgs );
835
837
838 if (vcl::CommandInfoProvider::GetModuleIdentifier(GetFrame().GetFrameInterface()) == "com.sun.star.text.TextDocument")
839 sfx2::SfxNotebookBar::ReloadNotebookBar(u"modules/swriter/ui/");
840
841 try
842 {
843 for (auto const& viewFrame : aViewFrames)
844 {
845 LoadViewIntoFrame_Impl( *xNewObj, viewFrame.first, aLoadArgs, viewFrame.second, false );
846 }
847 aViewFrames.clear();
848 }
849 catch( const Exception& )
850 {
851 // close the remaining frames
852 // Don't catch exceptions herein, if this fails, then we're left in an indetermined state, and
853 // crashing is better than trying to proceed
854 for (auto const& viewFrame : aViewFrames)
855 {
856 Reference< util::XCloseable > xClose( viewFrame.first, UNO_QUERY_THROW );
857 xClose->close( true );
858 }
859 aViewFrames.clear();
860 }
861
862 const SfxInt32Item* pPageNumber = rReq.GetArg<SfxInt32Item>(SID_PAGE_NUMBER);
863 if (pPageNumber && pPageNumber->GetValue() >= 0)
864 {
865 // Restore current page after reload.
866 uno::Reference<drawing::XDrawView> xController(
867 xNewObj->GetModel()->getCurrentController(), uno::UNO_QUERY);
868 uno::Reference<drawing::XDrawPagesSupplier> xSupplier(xNewObj->GetModel(),
869 uno::UNO_QUERY);
870 uno::Reference<drawing::XDrawPages> xDrawPages = xSupplier->getDrawPages();
871 uno::Reference<drawing::XDrawPage> xDrawPage(
872 xDrawPages->getByIndex(pPageNumber->GetValue()), uno::UNO_QUERY);
873 xController->setCurrentPage(xDrawPage);
874 }
875
876 // Propagate document closure.
878 }
879
880 // Record as done
881 rReq.Done( true );
882 rReq.SetReturnValue(SfxBoolItem(rReq.GetSlot(), true));
883 return;
884 }
885 else
886 {
887 // Record as not done
888 rReq.Done();
889 rReq.SetReturnValue(SfxBoolItem(rReq.GetSlot(), false));
890 m_pImpl->bReloading = false;
891 return;
892 }
893 }
894 }
895}
896
898{
900 if ( !pSh )
901 {
902 // I'm just on reload and am yielding myself ...
903 return;
904 }
905
906 SfxWhichIter aIter( rSet );
907 for ( sal_uInt16 nWhich = aIter.FirstWhich(); nWhich; nWhich = aIter.NextWhich() )
908 {
909 switch ( nWhich )
910 {
911 case SID_EDITDOC:
912 case SID_READONLYDOC:
913 {
914 const SfxViewShell *pVSh;
915 const SfxShell *pFSh;
916 if ( !pSh->HasName() ||
918 (pSh->isEditDocLocked()) ||
920 ( !(pVSh = pSh->GetViewShell()) ||
921 !(pFSh = pVSh->GetFormShell()) ||
922 !pFSh->IsDesignMode())))
923 rSet.DisableItem( nWhich );
924 else
925 {
926 const SfxBoolItem* pItem = SfxItemSet::GetItem<SfxBoolItem>(pSh->GetMedium()->GetItemSet(), SID_EDITDOC, false);
927 if ( pItem && !pItem->GetValue() )
928 rSet.DisableItem( nWhich );
929 else
930 {
931 if (nWhich==SID_EDITDOC)
932 rSet.Put( SfxBoolItem( nWhich, !pSh->IsReadOnly() ) );
933 else if (nWhich==SID_READONLYDOC)
934 rSet.Put( SfxBoolItem( nWhich, pSh->IsReadOnly() ) );
935 }
936 }
937 break;
938 }
939
940 case SID_RELOAD:
941 {
943 rSet.DisableItem(nWhich);
944 else
945 {
946 // If any ChildFrame is reloadable, the slot is enabled,
947 // so you can perform CTRL-Reload
948 rSet.Put( SfxBoolItem( nWhich, false));
949 }
950
951 break;
952 }
953 }
954 }
955}
956
958{
959 // Is there an Undo-Manager on the top Shell?
960 SfxShell *pSh = GetDispatcher()->GetShell(0);
961 if (!pSh)
962 return;
963
964 SfxUndoManager* pShUndoMgr = pSh->GetUndoManager();
965 bool bOK = false;
966 if ( pShUndoMgr )
967 {
968 switch ( rReq.GetSlot() )
969 {
970 case SID_CLEARHISTORY:
971 pShUndoMgr->Clear();
972 bOK = true;
973 break;
974
975 case SID_UNDO:
976 pShUndoMgr->Undo();
977 GetBindings().InvalidateAll(false);
978 bOK = true;
979 break;
980
981 case SID_REDO:
982 pShUndoMgr->Redo();
983 GetBindings().InvalidateAll(false);
984 bOK = true;
985 break;
986
987 case SID_REPEAT:
988 if ( pSh->GetRepeatTarget() )
989 pShUndoMgr->Repeat( *pSh->GetRepeatTarget() );
990 bOK = true;
991 break;
992 }
993 }
994 else if ( GetViewShell() )
995 {
996 // The SW has its own undo in the View
997 const SfxPoolItem *pRet = GetViewShell()->ExecuteSlot( rReq );
998 if ( pRet )
999 bOK = static_cast<const SfxBoolItem*>(pRet)->GetValue();
1000 }
1001
1002 rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bOK ) );
1003 rReq.Done();
1004}
1005
1007{
1008 // Search for Undo-Manager
1009 SfxShell *pSh = GetDispatcher()->GetShell(0);
1010 if ( !pSh )
1011 // I'm just on reload and am yielding myself ...
1012 return;
1013
1014 SfxUndoManager *pShUndoMgr = pSh->GetUndoManager();
1015 if ( !pShUndoMgr )
1016 {
1017 // The SW has its own undo in the View
1018 SfxWhichIter aIter( rSet );
1019 SfxViewShell *pViewSh = GetViewShell();
1020 if( !pViewSh ) return;
1021 for ( sal_uInt16 nSID = aIter.FirstWhich(); nSID; nSID = aIter.NextWhich() )
1022 pViewSh->GetSlotState( nSID, nullptr, &rSet );
1023 return;
1024 }
1025
1026 if ( pShUndoMgr->GetUndoActionCount() == 0 &&
1027 pShUndoMgr->GetRedoActionCount() == 0 &&
1028 pShUndoMgr->GetRepeatActionCount() == 0 )
1029 rSet.DisableItem( SID_CLEARHISTORY );
1030
1031 if (pShUndoMgr->GetUndoActionCount())
1032 {
1033 const SfxUndoAction* pAction = pShUndoMgr->GetUndoAction();
1034 SfxViewShell *pViewSh = GetViewShell();
1035 if (pViewSh && pAction->GetViewShellId() != pViewSh->GetViewShellId())
1036 {
1037 rSet.Put(SfxUInt32Item(SID_UNDO, static_cast<sal_uInt32>(SID_REPAIRPACKAGE)));
1038 }
1039 else
1040 {
1041 rSet.Put( SfxStringItem( SID_UNDO, SvtResId(STR_UNDO)+pShUndoMgr->GetUndoActionComment() ) );
1042 }
1043 }
1044 else
1045 rSet.DisableItem( SID_UNDO );
1046
1047 if (pShUndoMgr->GetRedoActionCount())
1048 {
1049 const SfxUndoAction* pAction = pShUndoMgr->GetRedoAction();
1050 SfxViewShell *pViewSh = GetViewShell();
1051 if (pViewSh && pAction->GetViewShellId() != pViewSh->GetViewShellId())
1052 {
1053 rSet.Put(SfxUInt32Item(SID_REDO, static_cast<sal_uInt32>(SID_REPAIRPACKAGE)));
1054 }
1055 else
1056 {
1057 rSet.Put(SfxStringItem(SID_REDO, SvtResId(STR_REDO) + pShUndoMgr->GetRedoActionComment()));
1058 }
1059 }
1060 else
1061 rSet.DisableItem( SID_REDO );
1062
1063 SfxRepeatTarget *pTarget = pSh->GetRepeatTarget();
1064 if (pTarget && pShUndoMgr->GetRepeatActionCount() && pShUndoMgr->CanRepeat(*pTarget))
1065 rSet.Put( SfxStringItem( SID_REPEAT, SvtResId(STR_REPEAT)+pShUndoMgr->GetRepeatActionComment(*pTarget) ) );
1066 else
1067 rSet.DisableItem( SID_REPEAT );
1068}
1069
1071{
1072 i_rViewShell.PopSubShells_Impl();
1073 sal_uInt16 nLevel = m_pDispatcher->GetShellLevel( i_rViewShell );
1074 if ( nLevel != USHRT_MAX )
1075 {
1076 if ( nLevel )
1077 {
1078 // more sub shells on the stack, which were not affected by PopSubShells_Impl
1079 SfxShell *pSubShell = m_pDispatcher->GetShell( nLevel-1 );
1081 }
1082 m_pDispatcher->Pop( i_rViewShell );
1083 m_pDispatcher->Flush();
1084 }
1085
1086}
1087
1088/* [Description]
1089
1090 This method empties the SfxViewFrame, i.e. takes the <SfxObjectShell>
1091 from the dispatcher and ends its <SfxListener> Relationship to this
1092 SfxObjectShell (by which they may even destroy themselves).
1093
1094 Thus, by invoking ReleaseObjectShell() and SetObjectShell() the
1095 SfxObjectShell can be replaced.
1096
1097 Between ReleaseObjectShell() and SetObjectShell() the control cannot
1098 be handed over to the system.
1099
1100 [Cross-reference]
1101
1102 <SfxViewFrame::SetObjectShell(SfxObjectShell&)>
1103*/
1105{
1106 DBG_ASSERT( m_xObjSh.is(), "no SfxObjectShell to release!" );
1107
1109 if ( GetWindow().HasChildPathFocus( true ) )
1110 {
1111 GetWindow().GrabFocus();
1112 }
1113
1114 SfxViewShell *pDyingViewSh = GetViewShell();
1115 if ( pDyingViewSh )
1116 {
1117 PopShellAndSubShells_Impl( *pDyingViewSh );
1118 pDyingViewSh->DisconnectAllClients();
1119 SetViewShell_Impl(nullptr);
1120 delete pDyingViewSh;
1121 }
1122#ifdef DBG_UTIL
1123 else
1124 OSL_FAIL("No Shell");
1125#endif
1126
1127 if ( m_xObjSh.is() )
1128 {
1129 m_pDispatcher->Pop( *m_xObjSh );
1130 SfxModule* pModule = m_xObjSh->GetModule();
1131 if( pModule )
1132 m_pDispatcher->RemoveShell_Impl( *pModule );
1133 m_pDispatcher->Flush();
1135
1136 Notify( *m_xObjSh, SfxHint(SfxHintId::TitleChanged) );
1137 Notify( *m_xObjSh, SfxHint(SfxHintId::DocChanged) );
1138
1139 if ( 1 == m_xObjSh->GetOwnerLockCount() && m_pImpl->bObjLocked && m_xObjSh->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
1140 m_xObjSh->DoClose();
1141 SfxObjectShellRef xDyingObjSh = m_xObjSh;
1142 m_xObjSh.clear();
1143 if( GetFrame().GetHasTitle() && m_pImpl->nDocViewNo )
1144 xDyingObjSh->GetNoSet_Impl().ReleaseIndex(m_pImpl->nDocViewNo-1);
1145 if ( m_pImpl->bObjLocked )
1146 {
1147 xDyingObjSh->OwnerLock( false );
1148 m_pImpl->bObjLocked = false;
1149 }
1150 }
1151
1153}
1154
1156{
1157
1158 DBG_ASSERT( GetFrame().IsClosing_Impl() || !GetFrame().GetFrameInterface().is(), "ViewFrame closed too early!" );
1159
1160 // If no saving have been made up until now, then embedded Objects should
1161 // not be saved automatically anymore.
1162 if ( GetViewShell() )
1164 Broadcast( SfxHint( SfxHintId::Dying ) );
1165
1166 if (SfxViewFrame::Current() == this)
1167 SfxViewFrame::SetViewFrame( nullptr );
1168
1169 // Since the Dispatcher is emptied, it can not be used in any reasonable
1170 // manner, thus it is better to let the dispatcher be.
1171 GetDispatcher()->Lock(true);
1172 delete this;
1173}
1174
1176{
1177 m_pDispatcher->DoActivate_Impl( bUI );
1178}
1179
1180void SfxViewFrame::DoDeactivate(bool bUI, SfxViewFrame const * pNewFrame )
1181{
1182 m_pDispatcher->DoDeactivate_Impl( bUI, pNewFrame );
1183}
1184
1186{
1187 if( !pSh || m_nAdjustPosPixelLock )
1188 return;
1189
1190 if ( GetViewShell() && GetWindow().IsVisible() )
1191 {
1192 if ( GetFrame().IsInPlace() )
1193 {
1194 return;
1195 }
1196
1198 GetWindow().GetOutputSizePixel(),
1199 false );
1200 }
1201}
1202
1204(
1205 const SfxViewShell* pVSh,
1206 const SvBorder& rBorder
1207)
1208
1209{
1210 m_pImpl->aBorder = rBorder;
1211
1212 if ( m_pImpl->bResizeInToOut && !GetFrame().IsInPlace() )
1213 {
1214 Size aSize = pVSh->GetWindow()->GetOutputSizePixel();
1215 if ( aSize.Width() && aSize.Height() )
1216 {
1217 aSize.AdjustWidth(rBorder.Left() + rBorder.Right() );
1218 aSize.AdjustHeight(rBorder.Top() + rBorder.Bottom() );
1219
1220 Size aOldSize = GetWindow().GetOutputSizePixel();
1221 GetWindow().SetOutputSizePixel( aSize );
1222 vcl::Window* pParent = &GetWindow();
1223 while ( pParent->GetParent() )
1224 pParent = pParent->GetParent();
1225 Size aOuterSize = pParent->GetOutputSizePixel();
1226 aOuterSize.AdjustWidth( aSize.Width() - aOldSize.Width() );
1227 aOuterSize.AdjustHeight( aSize.Height() - aOldSize.Height() );
1228 pParent->SetOutputSizePixel( aOuterSize );
1229 }
1230 }
1231 else
1232 {
1233 tools::Rectangle aEditArea( Point(), GetWindow().GetOutputSizePixel() );
1234 aEditArea.AdjustLeft(rBorder.Left() );
1235 aEditArea.AdjustRight( -(rBorder.Right()) );
1236 aEditArea.AdjustTop(rBorder.Top() );
1237 aEditArea.AdjustBottom( -(rBorder.Bottom()) );
1238 pVSh->GetWindow()->SetPosSizePixel( aEditArea.TopLeft(), aEditArea.GetSize() );
1239 }
1240}
1241
1243{
1244 return m_pImpl->aBorder;
1245}
1246
1248{
1249 bool bSignPDF = m_xObjSh->IsSignPDF();
1250 bool bSignWithCert = false;
1251 if (bSignPDF)
1252 {
1253 SfxObjectShell* pObjectShell = GetObjectShell();
1254 uno::Reference<security::XCertificate> xCertificate = pObjectShell->GetSignPDFCertificate();
1255 bSignWithCert = xCertificate.is();
1256 }
1257
1258 auto pInfoBar = AppendInfoBar("readonly", "",
1259 SfxResId(bSignPDF ? STR_READONLY_PDF : STR_READONLY_DOCUMENT),
1261 if (!pInfoBar)
1262 return;
1263
1264 if (bSignPDF)
1265 {
1266 // SID_SIGNPDF opened a read-write PDF
1267 // read-only for signing purposes.
1268 weld::Button& rSignButton = pInfoBar->addButton();
1269 if (bSignWithCert)
1270 {
1271 rSignButton.set_label(SfxResId(STR_READONLY_FINISH_SIGN));
1272 }
1273 else
1274 {
1275 rSignButton.set_label(SfxResId(STR_READONLY_SIGN));
1276 }
1277
1278 rSignButton.connect_clicked(LINK(this, SfxViewFrame, SignDocumentHandler));
1279 }
1280
1281 bool showEditDocumentButton = true;
1282 if (m_xObjSh->isEditDocLocked())
1283 showEditDocumentButton = false;
1284
1285 if (showEditDocumentButton)
1286 {
1287 weld::Button& rBtn = pInfoBar->addButton();
1288 rBtn.set_label(SfxResId(STR_READONLY_EDIT));
1289 rBtn.connect_clicked(LINK(this, SfxViewFrame, SwitchReadOnlyHandler));
1290 }
1291}
1292
1294{
1295 SfxObjectShell_Impl* pObjImpl = m_xObjSh->Get_Impl();
1296
1297 // what's the difference between pObjImpl->documentStorageHasMacros() and pObjImpl->aMacroMode.hasMacroLibrary() ?
1298 bool bHasDocumentMacros = pObjImpl->aMacroMode.hasMacroLibrary();
1299
1300 Reference<XModel> xModel = m_xObjSh->GetModel();
1301 uno::Reference<document::XEventsSupplier> xSupplier(xModel, uno::UNO_QUERY);
1302 bool bHasBoundConfigEvents(false);
1303 if (xSupplier.is())
1304 {
1305 css::uno::Reference<css::container::XNameReplace> xDocumentEvents = xSupplier->getEvents();
1306
1307 Sequence<OUString> eventNames = xDocumentEvents->getElementNames();
1308 sal_Int32 nEventCount = eventNames.getLength();
1309 for (sal_Int32 nEvent = 0; nEvent < nEventCount; ++nEvent)
1310 {
1311 OUString url;
1312 try
1313 {
1314 Any aAny(xDocumentEvents->getByName(eventNames[nEvent]));
1315 Sequence<beans::PropertyValue> props;
1316 if (aAny >>= props)
1317 {
1319 url = aProps.getOrDefault("Script", url);
1320 }
1321 }
1322 catch (const Exception&)
1323 {
1324 }
1325 if (!url.isEmpty())
1326 {
1327 bHasBoundConfigEvents = true;
1328 break;
1329 }
1330 }
1331 }
1332
1333 if (bHasDocumentMacros || bHasBoundConfigEvents)
1334 {
1335 auto aResId = STR_CONTAINS_MACROS;
1337 aResId = STR_MACROS_DISABLED;
1338 else if (pObjImpl->aMacroMode.hasUnsignedContentError())
1339 aResId = STR_MACROS_DISABLED_CONTENT_UNSIGNED;
1340 auto pInfoBar = AppendInfoBar("macro", SfxResId(STR_MACROS_DISABLED_TITLE),
1342 if (!pInfoBar)
1343 return;
1344
1345 // No access to macro dialog when macros are disabled globally.
1347 return;
1348
1349 if (bHasDocumentMacros)
1350 {
1351 weld::Button& rMacroButton = pInfoBar->addButton();
1352 rMacroButton.set_label(SfxResId(STR_MACROS));
1353 rMacroButton.connect_clicked(LINK(this, SfxViewFrame, MacroButtonHandler));
1354 }
1355
1356 if (bHasBoundConfigEvents)
1357 {
1358 weld::Button& rEventButton = pInfoBar->addButton();
1359 rEventButton.set_label(SfxResId(STR_EVENTS));
1360 rEventButton.connect_clicked(LINK(this, SfxViewFrame, EventButtonHandler));
1361 }
1362 }
1363}
1364
1365namespace
1366{
1367css::uno::Reference<css::frame::XLayoutManager> getLayoutManager(const SfxFrame& rFrame)
1368{
1369 css::uno::Reference<css::frame::XLayoutManager> xLayoutManager;
1370 css::uno::Reference<css::beans::XPropertySet> xPropSet(rFrame.GetFrameInterface(),
1371 uno::UNO_QUERY);
1372 if (xPropSet.is())
1373 {
1374 try
1375 {
1376 xLayoutManager.set(xPropSet->getPropertyValue("LayoutManager"), uno::UNO_QUERY);
1377 }
1378 catch (const Exception& e)
1379 {
1380 SAL_WARN("sfx.view", "Failure getting layout manager: " + e.Message);
1381 }
1382 }
1383 return xLayoutManager;
1384}
1385}
1386
1388{
1390 return true;
1391
1392 bool bIsUITest = false; //uitest.uicheck fails when the dialog is open
1393 for (sal_uInt16 i = 0, nCount = Application::GetCommandLineParamCount(); i < nCount; ++i)
1394 {
1395 if (Application::GetCommandLineParam(i) == "--nologo")
1396 {
1397 bIsUITest = true;
1398 break;
1399 }
1400 }
1401 return bIsUITest;
1402}
1403
1405{
1406 const bool bShowTipOfTheDay = officecfg::Office::Common::Misc::ShowTipOfTheDay::get();
1407 if (!bShowTipOfTheDay)
1408 return false;
1409
1410 const auto t0 = std::chrono::system_clock::now().time_since_epoch();
1411
1412 // show tip-of-the-day dialog ?
1413 const sal_Int32 nLastTipOfTheDay = officecfg::Office::Common::Misc::LastTipOfTheDayShown::get();
1414 const sal_Int32 nDay = std::chrono::duration_cast<std::chrono::hours>(t0).count()/24; // days since 1970-01-01
1415 return nDay - nLastTipOfTheDay > 0; //only once per day
1416}
1417
1418void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
1419{
1420 if(m_pImpl->bIsDowning)
1421 return;
1422
1423 // we know only SfxEventHint or simple SfxHint
1424 if (const SfxEventHint* pEventHint = dynamic_cast<const SfxEventHint*>(&rHint))
1425 {
1426 // When the Document is loaded asynchronously, was the Dispatcher
1427 // set as ReadOnly, to what must be returned when the document itself
1428 // is not read only, and the loading is finished.
1429 switch ( pEventHint->GetEventId() )
1430 {
1432 {
1433 SfxBindings& rBind = GetBindings();
1434 rBind.Invalidate( SID_DOC_MODIFIED );
1435 rBind.Invalidate( SID_RELOAD );
1436 rBind.Invalidate( SID_EDITDOC );
1437 break;
1438 }
1439
1442 {
1443 if ( !m_xObjSh.is() )
1444 break;
1445
1446 SfxBindings& rBind = GetBindings();
1447 rBind.Invalidate( SID_RELOAD );
1448 rBind.Invalidate( SID_EDITDOC );
1449
1450#if !ENABLE_WASM_STRIP_PINGUSER
1451 bool bIsHeadlessOrUITest = SfxApplication::IsHeadlessOrUITest(); //uitest.uicheck fails when the dialog is open
1452
1453 //what's new infobar
1454 if (utl::isProductVersionUpgraded(true) && !bIsHeadlessOrUITest)
1455 {
1456 VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("whatsnew", "", SfxResId(STR_WHATSNEW_TEXT), InfobarType::INFO);
1457 if (pInfoBar)
1458 {
1459 weld::Button& rWhatsNewButton = pInfoBar->addButton();
1460 rWhatsNewButton.set_label(SfxResId(STR_WHATSNEW_BUTTON));
1461 rWhatsNewButton.connect_clicked(LINK(this, SfxViewFrame, WhatsNewHandler));
1462 }
1463 }
1464
1465 // show tip-of-the-day dialog if it due, but not if there is the impress modal template dialog
1466 // open where SdModule::ExecuteNewDocument will launch it instead when that dialog is dismissed
1467 if (SfxApplication::IsTipOfTheDayDue() && !bIsHeadlessOrUITest && !IsInModalMode())
1468 {
1469 // tdf#127946 pass in argument for dialog parent
1470 SfxUnoFrameItem aDocFrame(SID_FILLFRAME, GetFrame().GetFrameInterface());
1471 GetDispatcher()->ExecuteList(SID_TIPOFTHEDAY, SfxCallMode::SLOT, {}, { &aDocFrame });
1472 }
1473
1474 // inform about the community involvement
1475 const auto t0 = std::chrono::system_clock::now().time_since_epoch();
1476 const sal_Int64 nLastGetInvolvedShown = officecfg::Setup::Product::LastTimeGetInvolvedShown::get();
1477 const sal_Int64 nNow = std::chrono::duration_cast<std::chrono::seconds>(t0).count();
1478 const sal_Int64 nPeriodSec(60 * 60 * 24 * 180); // 180 days in seconds
1479 bool bUpdateLastTimeGetInvolvedShown = false;
1480
1481 if (nLastGetInvolvedShown == 0)
1482 bUpdateLastTimeGetInvolvedShown = true;
1483 else if (nPeriodSec < nNow && nLastGetInvolvedShown < (nNow + nPeriodSec/2) - nPeriodSec) // 90d alternating with donation
1484 {
1485 bUpdateLastTimeGetInvolvedShown = true;
1486
1487 VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("getinvolved", "", SfxResId(STR_GET_INVOLVED_TEXT), InfobarType::INFO);
1488
1489 if (pInfoBar)
1490 {
1491 weld::Button& rGetInvolvedButton = pInfoBar->addButton();
1492 rGetInvolvedButton.set_label(SfxResId(STR_GET_INVOLVED_BUTTON));
1493 rGetInvolvedButton.connect_clicked(LINK(this, SfxViewFrame, GetInvolvedHandler));
1494 }
1495 }
1496
1497 if (bUpdateLastTimeGetInvolvedShown
1498 && !officecfg::Setup::Product::LastTimeGetInvolvedShown::isReadOnly())
1499 {
1500 std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
1501 officecfg::Setup::Product::LastTimeGetInvolvedShown::set(nNow, batch);
1502 batch->commit();
1503 }
1504
1505 // inform about donations
1506 const sal_Int64 nLastDonateShown = officecfg::Setup::Product::LastTimeDonateShown::get();
1507 bool bUpdateLastTimeDonateShown = false;
1508
1509 if (nLastDonateShown == 0)
1510 bUpdateLastTimeDonateShown = true;
1511 else if (nPeriodSec < nNow && nLastDonateShown < nNow - nPeriodSec) // 90d alternating with getinvolved
1512 {
1513 bUpdateLastTimeDonateShown = true;
1514
1515 VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("donate", "", SfxResId(STR_DONATE_TEXT), InfobarType::INFO);
1516 if (pInfoBar)
1517 {
1518 weld::Button& rDonateButton = pInfoBar->addButton();
1519 rDonateButton.set_label(SfxResId(STR_DONATE_BUTTON));
1520 rDonateButton.connect_clicked(LINK(this, SfxViewFrame, DonationHandler));
1521 }
1522 }
1523
1524 if (bUpdateLastTimeDonateShown
1525 && !officecfg::Setup::Product::LastTimeDonateShown::isReadOnly())
1526 {
1527 std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
1528 officecfg::Setup::Product::LastTimeDonateShown::set(nNow, batch);
1529 batch->commit();
1530 }
1531#endif
1532 if (officecfg::Office::Common::Passwords::HasMaster::get() &&
1533 officecfg::Office::Common::Passwords::StorageVersion::get() == 0)
1534 {
1535 // master password stored in deprecated format
1536 VclPtr<SfxInfoBarWindow> pOldMasterPasswordInfoBar =
1537 AppendInfoBar("oldmasterpassword", "",
1538 SfxResId(STR_REFRESH_MASTER_PASSWORD), InfobarType::DANGER, false);
1539 if (pOldMasterPasswordInfoBar)
1540 {
1541 weld::Button& rButton = pOldMasterPasswordInfoBar->addButton();
1542 rButton.set_label(SfxResId(STR_REFRESH_PASSWORD));
1543 rButton.connect_clicked(LINK(this,
1544 SfxViewFrame, RefreshMasterPasswordHdl));
1546 {
1547 weld::Button& rHelp = pOldMasterPasswordInfoBar->addButton();
1548 rHelp.set_label(SfxResId(RID_STR_HELP));
1549 rHelp.connect_clicked(LINK(this, SfxViewFrame, HelpMasterPasswordHdl));
1550 }
1551 }
1552 }
1553
1554 const bool bEmbedded = m_xObjSh->GetCreateMode() == SfxObjectCreateMode::EMBEDDED;
1555
1556 // read-only infobar if necessary
1557 const SfxViewShell *pVSh;
1558 const SfxShell *pFSh;
1559 if ( m_xObjSh->IsReadOnly() &&
1560 ! m_xObjSh->IsSecurityOptOpenReadOnly() &&
1561 ( !bEmbedded ||
1562 (( pVSh = m_xObjSh->GetViewShell()) && (pFSh = pVSh->GetFormShell()) && pFSh->IsDesignMode())))
1563 {
1565 }
1566
1567 if (!bEmbedded && m_xObjSh->Get_Impl()->getCurrentMacroExecMode() == css::document::MacroExecMode::NEVER_EXECUTE)
1569
1570 if (vcl::CommandInfoProvider::GetModuleIdentifier(GetFrame().GetFrameInterface()) == "com.sun.star.text.TextDocument")
1571 sfx2::SfxNotebookBar::ReloadNotebookBar(u"modules/swriter/ui/");
1572
1573 if (SfxClassificationHelper::IsClassified(m_xObjSh->getDocProperties()))
1574 {
1575 // Document has BAILS properties, display an infobar accordingly.
1576 SfxClassificationHelper aHelper(m_xObjSh->getDocProperties());
1577 aHelper.UpdateInfobar(*this);
1578 }
1579
1580 // Add pending infobars
1581 std::vector<InfobarData>& aPendingInfobars = m_xObjSh->getPendingInfobars();
1582 while (!aPendingInfobars.empty())
1583 {
1584 InfobarData& aInfobarData = aPendingInfobars.back();
1585
1586 // don't show Track Changes infobar, if Track Changes toolbar is visible
1587 if (aInfobarData.msId == "hiddentrackchanges")
1588 {
1589 if (auto xLayoutManager = getLayoutManager(GetFrame()))
1590 {
1591 if ( xLayoutManager->getElement(CHANGES_STR).is() )
1592 {
1593 aPendingInfobars.pop_back();
1594 continue;
1595 }
1596 }
1597 }
1598
1599 // Track Changes infobar: add a button to show/hide Track Changes functions
1600 // Hyphenation infobar: add a button to get more information
1601 // tdf#148913 limit VclPtr usage for these
1602 bool bTrackChanges = aInfobarData.msId == "hiddentrackchanges";
1603 if ( bTrackChanges || aInfobarData.msId == "hyphenationmissing" )
1604 {
1605 VclPtr<SfxInfoBarWindow> pInfoBar =
1606 AppendInfoBar(aInfobarData.msId, aInfobarData.msPrimaryMessage,
1607 aInfobarData.msSecondaryMessage, aInfobarData.maInfobarType,
1608 aInfobarData.mbShowCloseButton);
1609
1610 // tdf#148913 don't extend this condition to keep it thread-safe
1611 if (pInfoBar)
1612 {
1613 weld::Button& rButton = pInfoBar->addButton();
1614 rButton.set_label(SfxResId(bTrackChanges
1615 ? STR_TRACK_CHANGES_BUTTON
1616 : STR_HYPHENATION_BUTTON));
1617 if (bTrackChanges)
1618 {
1619 rButton.connect_clicked(LINK(this,
1620 SfxViewFrame, HiddenTrackChangesHandler));
1621 }
1622 else
1623 {
1624 rButton.connect_clicked(LINK(this,
1625 SfxViewFrame, HyphenationMissingHandler));
1626 }
1627 }
1628 }
1629 else
1630 {
1631 AppendInfoBar(aInfobarData.msId, aInfobarData.msPrimaryMessage,
1632 aInfobarData.msSecondaryMessage, aInfobarData.maInfobarType,
1633 aInfobarData.mbShowCloseButton);
1634 }
1635
1636 aPendingInfobars.pop_back();
1637 }
1638
1639 break;
1640 }
1641 default: break;
1642 }
1643 }
1644 else
1645 {
1646 switch( rHint.GetId() )
1647 {
1648 case SfxHintId::ModeChanged:
1649 {
1650 UpdateTitle();
1651
1652 if ( !m_xObjSh.is() )
1653 break;
1654
1655 // Switch r/o?
1656 SfxBindings& rBind = GetBindings();
1657 rBind.Invalidate( SID_RELOAD );
1658 SfxDispatcher *pDispat = GetDispatcher();
1659 bool bWasReadOnly = pDispat->GetReadOnly_Impl();
1660 bool bIsReadOnly = m_xObjSh->IsReadOnly();
1661 if ( bWasReadOnly != bIsReadOnly )
1662 {
1663 // Then also TITLE_CHANGED
1664 UpdateTitle();
1665 rBind.Invalidate( SID_FILE_NAME );
1666 rBind.Invalidate( SID_DOCINFO_TITLE );
1667 rBind.Invalidate( SID_EDITDOC );
1668
1669 pDispat->GetBindings()->InvalidateAll(true);
1670 pDispat->SetReadOnly_Impl( bIsReadOnly );
1671
1672 // Only force and Dispatcher-Update, if it is done next
1673 // anyway, otherwise flickering or GPF is possible since
1674 // the Writer for example prefers in Resize perform some
1675 // actions which has a SetReadOnlyUI in Dispatcher as a
1676 // result!
1677
1678 if ( pDispat->IsUpdated_Impl() )
1679 pDispat->Update_Impl(true);
1680 }
1681
1682 Enable( !m_xObjSh->IsInModalMode() );
1683 break;
1684 }
1685
1686 case SfxHintId::TitleChanged:
1687 {
1688 UpdateTitle();
1689 SfxBindings& rBind = GetBindings();
1690 rBind.Invalidate( SID_FILE_NAME );
1691 rBind.Invalidate( SID_DOCINFO_TITLE );
1692 rBind.Invalidate( SID_EDITDOC );
1693 rBind.Invalidate( SID_RELOAD );
1694 break;
1695 }
1696
1697 case SfxHintId::DocumentRepair:
1698 {
1699 GetBindings().Invalidate( SID_DOC_REPAIR );
1700 break;
1701 }
1702
1703 case SfxHintId::Deinitializing:
1704 {
1705 vcl::Window* pFrameWin = GetWindow().GetFrameWindow();
1706 if (pFrameWin && pFrameWin->GetLOKNotifier())
1707 pFrameWin->ReleaseLOKNotifier();
1708
1709 GetFrame().DoClose();
1710 break;
1711 }
1712 case SfxHintId::Dying:
1713 // when the Object is being deleted, destroy the view too
1714 if ( m_xObjSh.is() )
1716 else
1717 GetFrame().DoClose();
1718 break;
1719 default: break;
1720 }
1721 }
1722}
1723
1724#if !ENABLE_WASM_STRIP_PINGUSER
1726{
1727 GetDispatcher()->Execute(SID_WHATSNEW);
1728}
1729
1730IMPL_LINK_NOARG(SfxViewFrame, GetInvolvedHandler, weld::Button&, void)
1731{
1732 GetDispatcher()->Execute(SID_GETINVOLVED);
1733}
1734
1736{
1737 GetDispatcher()->Execute(SID_DONATION);
1738}
1739#endif
1740
1741IMPL_LINK(SfxViewFrame, SwitchReadOnlyHandler, weld::Button&, rButton, void)
1742{
1743 if (m_xObjSh.is() && m_xObjSh->IsSignPDF())
1744 {
1745 SfxEditDocumentDialog aDialog(&rButton);
1746 if (aDialog.run() != RET_OK)
1747 return;
1748 }
1749 GetDispatcher()->Execute(SID_EDITDOC);
1750}
1751
1752IMPL_LINK_NOARG(SfxViewFrame, SignDocumentHandler, weld::Button&, void)
1753{
1754 GetDispatcher()->Execute(SID_SIGNATURE);
1755}
1756
1757IMPL_LINK(SfxViewFrame, HiddenTrackChangesHandler, weld::Button&, rButton, void)
1758{
1759 // enable Track Changes toolbar, if it is disabled.
1760 // Otherwise disable the toolbar, and close the infobar
1761 auto xLayoutManager = getLayoutManager(GetFrame());
1762 if (!xLayoutManager)
1763 return;
1764
1765 if (!xLayoutManager->getElement(CHANGES_STR).is())
1766 {
1767 xLayoutManager->createElement(CHANGES_STR);
1768 xLayoutManager->showElement(CHANGES_STR);
1769 rButton.set_label(SfxResId(STR_TRACK_CHANGES_BUTTON_HIDE));
1770 }
1771 else
1772 {
1773 xLayoutManager->hideElement(CHANGES_STR);
1774 xLayoutManager->destroyElement(CHANGES_STR);
1775 RemoveInfoBar(u"hiddentrackchanges");
1776 }
1777}
1778
1779IMPL_LINK_NOARG(SfxViewFrame, HyphenationMissingHandler, weld::Button&, void)
1780{
1781 GetDispatcher()->Execute(SID_HYPHENATIONMISSING);
1782 RemoveInfoBar(u"hyphenationmissing");
1783}
1784
1785IMPL_LINK_NOARG(SfxViewFrame, MacroButtonHandler, weld::Button&, void)
1786{
1787 // start with tab 0 displayed
1788 SfxUInt16Item aTabItem(SID_MACROORGANIZER, 0);
1789 SfxBoolItem aCurrentDocItem(FN_PARAM_2, true);
1790 SfxUnoFrameItem aDocFrame(SID_FILLFRAME, GetFrame().GetFrameInterface());
1791 GetDispatcher()->ExecuteList(SID_MACROORGANIZER, SfxCallMode::ASYNCHRON,
1792 { &aTabItem, &aCurrentDocItem }, { &aDocFrame });
1793}
1794
1795IMPL_LINK_NOARG(SfxViewFrame, EventButtonHandler, weld::Button&, void)
1796{
1797 SfxUnoFrameItem aDocFrame(SID_FILLFRAME, GetFrame().GetFrameInterface());
1799 {}, { &aDocFrame });
1800}
1801
1802IMPL_LINK_NOARG(SfxViewFrame, RefreshMasterPasswordHdl, weld::Button&, void)
1803{
1804 bool bChanged = false;
1805 try
1806 {
1807 Reference< task::XPasswordContainer2 > xMasterPasswd(
1808 task::PasswordContainer::create(comphelper::getProcessComponentContext()));
1809
1810 css::uno::Reference<css::frame::XFrame> xFrame = GetFrame().GetFrameInterface();
1811 css::uno::Reference<css::awt::XWindow> xContainerWindow = xFrame->getContainerWindow();
1812
1813 uno::Reference<task::XInteractionHandler> xTmpHandler(task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(),
1814 xContainerWindow));
1815 bChanged = xMasterPasswd->changeMasterPassword(xTmpHandler);
1816 }
1817 catch (const Exception&)
1818 {}
1819 if (bChanged)
1820 RemoveInfoBar(u"oldmasterpassword");
1821}
1822
1823IMPL_STATIC_LINK_NOARG(SfxViewFrame, HelpMasterPasswordHdl, weld::Button&, void)
1824{
1825 if (Help* pHelp = Application::GetHelp())
1826 pHelp->Start("cui/ui/optsecuritypage/savepassword");
1827}
1828
1830{
1831 m_pImpl->bResizeInToOut = true;
1832 m_pImpl->bObjLocked = false;
1833 m_pImpl->nCurViewId = SFX_INTERFACE_NONE;
1834 m_pImpl->bReloading = false;
1835 m_pImpl->bIsDowning = false;
1836 m_pImpl->bModal = false;
1837 m_pImpl->bEnabled = true;
1838 m_pImpl->nDocViewNo = 0;
1839 m_pImpl->aMargin = Size( -1, -1 );
1840 m_pImpl->pWindow = nullptr;
1841
1842 SetPool( &SfxGetpApp()->GetPool() );
1843 m_pDispatcher.reset( new SfxDispatcher(this) );
1844 if ( !GetBindings().GetDispatcher() )
1846
1847 m_xObjSh = pObjSh;
1848 if ( m_xObjSh.is() && m_xObjSh->IsPreview() )
1850
1851 if ( pObjSh )
1852 {
1853 m_pDispatcher->Push( *SfxGetpApp() );
1854 SfxModule* pModule = m_xObjSh->GetModule();
1855 if( pModule )
1856 m_pDispatcher->Push( *pModule );
1857 m_pDispatcher->Push( *this );
1858 m_pDispatcher->Push( *pObjSh );
1859 m_pDispatcher->Flush();
1860 StartListening( *pObjSh );
1861 Notify( *pObjSh, SfxHint(SfxHintId::TitleChanged) );
1862 Notify( *pObjSh, SfxHint(SfxHintId::DocChanged) );
1863 m_pDispatcher->SetReadOnly_Impl( pObjSh->IsReadOnly() );
1864 }
1865 else
1866 {
1867 m_pDispatcher->Push( *SfxGetpApp() );
1868 m_pDispatcher->Push( *this );
1869 m_pDispatcher->Flush();
1870 }
1871
1872 SfxGetpApp()->GetViewFrames_Impl().push_back(this);
1873}
1874
1875/* [Description]
1876
1877 Constructor of SfxViewFrame for a <SfxObjectShell> from the Resource.
1878 The 'nViewId' to the created <SfxViewShell> can be returned.
1879 (default is the SfxViewShell-Subclass that was registered first).
1880*/
1882(
1883 SfxFrame& rFrame,
1884 SfxObjectShell* pObjShell
1885)
1886 : m_pImpl( new SfxViewFrame_Impl( rFrame ) )
1887 , m_pBindings( new SfxBindings )
1888 , m_pHelpData(CreateSVHelpData())
1889 , m_pWinData(CreateSVWinData())
1890 , m_nAdjustPosPixelLock( 0 )
1891 , m_pCommandPopupHandler(new CommandPopupHandler)
1892{
1893
1894 rFrame.SetCurrentViewFrame_Impl( this );
1895 rFrame.SetHasTitle( true );
1896 Construct_Impl( pObjShell );
1897
1898 m_pImpl->pWindow = VclPtr<SfxFrameViewWindow_Impl>::Create( this, rFrame.GetWindow() );
1899 m_pImpl->pWindow->SetSizePixel( rFrame.GetWindow().GetOutputSizePixel() );
1900 rFrame.SetOwnsBindings_Impl( true );
1901 rFrame.CreateWorkWindow_Impl();
1902}
1903
1905{
1906 m_pImpl->bIsDowning = true;
1907
1908 if ( SfxViewFrame::Current() == this )
1909 SfxViewFrame::SetViewFrame( nullptr );
1910
1912
1913 if ( GetFrame().OwnsBindings_Impl() )
1914 // The Bindings delete the Frame!
1916
1917 m_pImpl->pWindow.disposeAndClear();
1918
1919 if ( GetFrame().GetCurrentViewFrame() == this )
1921
1922 // Unregister from the Frame List.
1924 if (pSfxApp)
1925 {
1926 auto &rFrames = pSfxApp->GetViewFrames_Impl();
1927 auto it = std::find( rFrames.begin(), rFrames.end(), this );
1928 rFrames.erase( it );
1929 }
1930
1931 // Delete Member
1933
1935 m_pHelpData = nullptr;
1936
1938 m_pWinData = nullptr;
1939}
1940
1941// Remove and delete the Dispatcher.
1943{
1944
1945 SfxModule* pModule = m_xObjSh.is() ? m_xObjSh->GetModule() : nullptr;
1946 if ( m_xObjSh.is() )
1948 if ( m_pDispatcher )
1949 {
1950 if( pModule )
1952 else
1953 m_pDispatcher->Pop( *this );
1954 m_pDispatcher.reset();
1955 }
1956}
1957
1959{
1961 return pApp ? pApp->Get_Impl()->pViewFrame : nullptr;
1962}
1963
1964// returns the first window of spec. type viewing the specified doc.
1966(
1967 const SfxObjectShell* pDoc,
1968 bool bOnlyIfVisible
1969)
1970{
1972 if (!pSfxApp)
1973 return nullptr;
1974
1975 // search for a SfxDocument of the specified type
1976 for (SfxViewFrame* pFrame : pSfxApp->GetViewFrames_Impl())
1977 {
1978 if ( ( !pDoc || pDoc == pFrame->GetObjectShell() )
1979 && ( !bOnlyIfVisible || pFrame->IsVisible() )
1980 )
1981 return pFrame;
1982 }
1983
1984 return nullptr;
1985}
1986
1987// returns the next window of spec. type viewing the specified doc.
1989(
1990 const SfxViewFrame& rPrev,
1991 const SfxObjectShell* pDoc,
1992 bool bOnlyIfVisible
1993)
1994{
1996 if (!pSfxApp)
1997 return nullptr;
1998
1999 auto &rFrames = pSfxApp->GetViewFrames_Impl();
2000
2001 // refind the specified predecessor
2002 size_t nPos;
2003 for ( nPos = 0; nPos < rFrames.size(); ++nPos )
2004 if ( rFrames[nPos] == &rPrev )
2005 break;
2006
2007 // search for a Frame of the specified type
2008 for ( ++nPos; nPos < rFrames.size(); ++nPos )
2009 {
2010 SfxViewFrame *pFrame = rFrames[nPos];
2011 if ( ( !pDoc || pDoc == pFrame->GetObjectShell() )
2012 && ( !bOnlyIfVisible || pFrame->IsVisible() )
2013 )
2014 return pFrame;
2015 }
2016 return nullptr;
2017}
2018
2020{
2021 SfxObjectShell *pObjSh = m_xObjSh.get();
2022 return pObjSh ? pObjSh->GetProgress() : nullptr;
2023}
2024
2026(
2027 SfxViewShell* pSh,
2028 const Point& rPos,
2029 const Size& rSize,
2030 bool inplaceEditModeChange
2031)
2032{
2033
2034 // Components do not use this Method!
2035 if( pSh && pSh->GetWindow() && !m_nAdjustPosPixelLock )
2036 {
2037 m_nAdjustPosPixelLock++;
2038 if ( m_pImpl->bResizeInToOut )
2039 pSh->InnerResizePixel( rPos, rSize, inplaceEditModeChange );
2040 else
2041 pSh->OuterResizePixel( rPos, rSize );
2042 m_nAdjustPosPixelLock--;
2043 }
2044}
2045
2047{
2048 return SfxPoolItem::operator==(rItem) &&
2049 static_cast<const SfxViewFrameItem&>(rItem).pFrame == pFrame;
2050}
2051
2053{
2054 return new SfxViewFrameItem( *this );
2055}
2056
2058/* [Description]
2059
2060 Internal Method to set the current <SfxViewShell> Instance,
2061 that is active int this SfxViewFrame at the moment.
2062*/
2063{
2065
2066 // Hack: InPlaceMode
2067 if ( pVSh )
2068 m_pImpl->bResizeInToOut = false;
2069}
2070
2072{
2073 m_pImpl->bResizeInToOut = true;
2074}
2075
2077{
2078 DBG_ASSERT( GetObjectShell(), "No Document!" );
2080 m_pImpl->nDocViewNo = GetObjectShell()->GetNoSet_Impl().GetFreeIndex()+1;
2081}
2082
2083void SfxViewFrame::Enable( bool bEnable )
2084{
2085 if ( bEnable == m_pImpl->bEnabled )
2086 return;
2087
2088 m_pImpl->bEnabled = bEnable;
2089
2090 vcl::Window *pWindow = &GetFrame().GetWindow();
2091 if ( !bEnable )
2092 m_pImpl->bWindowWasEnabled = pWindow->IsInputEnabled();
2093 if ( !bEnable || m_pImpl->bWindowWasEnabled )
2094 pWindow->EnableInput( bEnable );
2095
2096 // cursor and focus
2097 SfxViewShell* pViewSh = GetViewShell();
2098 if ( bEnable )
2099 {
2100 // show cursor
2101 if ( pViewSh )
2102 pViewSh->ShowCursor();
2103 }
2104 else
2105 {
2106 // hide cursor
2107 if ( pViewSh )
2108 pViewSh->ShowCursor(false);
2109 }
2110}
2111
2112/* [Description]
2113
2114 This method makes the Frame-Window visible and before transmits the
2115 window name. In addition, the document is held. In general one can never
2116 show the window directly!
2117*/
2119{
2120 // First lock the objectShell so that UpdateTitle() is valid:
2121 // IsVisible() == true (:#)
2122 if ( m_xObjSh.is() )
2123 {
2124 m_xObjSh->GetMedium()->GetItemSet()->ClearItem( SID_HIDDEN );
2125 if ( !m_pImpl->bObjLocked )
2127
2128 // Adjust Doc-Shell title number, get unique view-no
2129 if ( 0 == m_pImpl->nDocViewNo )
2130 {
2132 UpdateTitle();
2133 }
2134 }
2135 else
2136 UpdateTitle();
2137
2138 // Display Frame-window, but only if the ViewFrame has no window of its
2139 // own or if it does not contain a Component
2140 GetWindow().Show();
2141 GetFrame().GetWindow().Show();
2142}
2143
2144
2146{
2147 return m_pImpl->bObjLocked;
2148}
2149
2150
2152{
2153 DBG_ASSERT( !m_pImpl->bObjLocked, "Wrong Locked status!" );
2154
2155 DBG_ASSERT( GetObjectShell(), "No Document!" );
2156 GetObjectShell()->OwnerLock(true);
2157 m_pImpl->bObjLocked = true;
2158}
2159
2160
2161void SfxViewFrame::MakeActive_Impl( bool bGrabFocus )
2162{
2163 if ( !GetViewShell() || GetFrame().IsClosing_Impl() )
2164 return;
2165
2166 if ( !IsVisible() )
2167 return;
2168
2169 bool bPreview = false;
2170 if (GetObjectShell()->IsPreview())
2171 {
2172 bPreview = true;
2173 }
2174
2175 css::uno::Reference<css::frame::XFrame> xFrame = GetFrame().GetFrameInterface();
2176 if (!bPreview)
2177 {
2178 SetViewFrame(this);
2179 GetBindings().SetActiveFrame(css::uno::Reference<css::frame::XFrame>());
2180 uno::Reference<frame::XFramesSupplier> xSupp(xFrame, uno::UNO_QUERY);
2181 if (xSupp.is())
2182 xSupp->setActiveFrame(uno::Reference<frame::XFrame>());
2183
2184 css::uno::Reference< css::awt::XWindow > xContainerWindow = xFrame->getContainerWindow();
2185 VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xContainerWindow);
2186 if (pWindow && pWindow->HasChildPathFocus() && bGrabFocus)
2187 {
2189 if (!pCli || !pCli->IsObjectUIActive())
2191 }
2192 }
2193 else
2194 {
2196 GetBindings().SetActiveFrame(css::uno::Reference<css::frame::XFrame>());
2198 }
2199}
2200
2202{
2203 return m_xObjSh.get();
2204}
2205
2207{
2208 return m_pImpl->aMargin;
2209}
2210
2211SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame,
2212 const SfxInterfaceId i_nViewId, const bool i_bHidden )
2213{
2214 Reference< XFrame > xFrame( i_rFrame );
2215 bool bOwnFrame = false;
2216 SfxViewShell* pSuccessView = nullptr;
2217 try
2218 {
2219 if ( !xFrame.is() )
2220 {
2221 Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
2222
2223 if ( !i_bHidden )
2224 {
2225 try
2226 {
2227 // if there is a backing component, use it
2228 ::framework::FrameListAnalyzer aAnalyzer( xDesktop, Reference< XFrame >(), FrameAnalyzerFlags::BackingComponent );
2229
2230 if ( aAnalyzer.m_xBackingComponent.is() )
2231 xFrame = aAnalyzer.m_xBackingComponent;
2232 }
2233 catch( uno::Exception& )
2234 {}
2235 }
2236
2237 if ( !xFrame.is() )
2238 xFrame.set( xDesktop->findFrame( "_blank", 0 ), UNO_SET_THROW );
2239
2240 bOwnFrame = true;
2241 }
2242
2243 pSuccessView = LoadViewIntoFrame_Impl(
2244 i_rDoc,
2245 xFrame,
2246 Sequence< PropertyValue >(), // means "reuse existing model's args"
2247 i_nViewId,
2248 i_bHidden
2249 );
2250
2251 if ( bOwnFrame && !i_bHidden )
2252 {
2253 // ensure the frame/window is visible
2254 Reference< XWindow > xContainerWindow( xFrame->getContainerWindow(), UNO_SET_THROW );
2255 xContainerWindow->setVisible( true );
2256 }
2257 }
2258 catch( const Exception& )
2259 {
2260 DBG_UNHANDLED_EXCEPTION("sfx.view");
2261 }
2262
2263 if ( pSuccessView )
2264 return &pSuccessView->GetViewFrame();
2265
2266 if ( bOwnFrame )
2267 {
2268 try
2269 {
2270 xFrame->dispose();
2271 }
2272 catch( const Exception& )
2273 {
2274 DBG_UNHANDLED_EXCEPTION("sfx.view");
2275 }
2276 }
2277
2278 return nullptr;
2279}
2280
2281SfxViewShell* SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame,
2282 const Sequence< PropertyValue >& i_rLoadArgs, const SfxInterfaceId i_nViewId,
2283 const bool i_bHidden )
2284{
2285 Reference< XModel > xDocument( i_rDoc.GetModel(), UNO_SET_THROW );
2286
2287 ::comphelper::NamedValueCollection aTransformLoadArgs( i_rLoadArgs.hasElements() ? i_rLoadArgs : xDocument->getArgs() );
2288 aTransformLoadArgs.put( "Model", xDocument );
2289 if ( i_nViewId )
2290 aTransformLoadArgs.put( "ViewId", sal_uInt16( i_nViewId ) );
2291 if ( i_bHidden )
2292 aTransformLoadArgs.put( "Hidden", i_bHidden );
2293 else
2294 aTransformLoadArgs.remove( "Hidden" );
2295
2296 Reference< XComponentLoader > xLoader( i_rFrame, UNO_QUERY_THROW );
2297 xLoader->loadComponentFromURL( "private:object", "_self", 0,
2298 aTransformLoadArgs.getPropertyValues() );
2299
2300 SfxViewShell* pViewShell = SfxViewShell::Get( i_rFrame->getController() );
2301 ENSURE_OR_THROW( pViewShell,
2302 "SfxViewFrame::LoadViewIntoFrame_Impl: loading an SFX doc into a frame resulted in a non-SFX view - quite impossible" );
2303 return pViewShell;
2304}
2305
2307{
2308 return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, Reference< XFrame >(), i_nViewId, true );
2309}
2310
2312{
2313 return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, Reference< XFrame >(), i_nViewId, false );
2314}
2315
2316SfxViewFrame* SfxViewFrame::LoadDocumentIntoFrame( SfxObjectShell const & i_rDoc, const Reference< XFrame >& i_rTargetFrame )
2317{
2318 return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, i_rTargetFrame, SFX_INTERFACE_NONE, false );
2319}
2320
2322{
2323 return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, i_pFrameItem && i_pFrameItem->GetFrame() ? i_pFrameItem->GetFrame()->GetFrameInterface() : nullptr, i_nViewId, false );
2324}
2325
2326SfxViewFrame* SfxViewFrame::DisplayNewDocument( SfxObjectShell const & i_rDoc, const SfxRequest& i_rCreateDocRequest )
2327{
2328 const SfxUnoFrameItem* pFrameItem = i_rCreateDocRequest.GetArg<SfxUnoFrameItem>(SID_FILLFRAME);
2329 const SfxBoolItem* pHiddenItem = i_rCreateDocRequest.GetArg<SfxBoolItem>(SID_HIDDEN);
2330
2332 i_rDoc,
2333 pFrameItem ? pFrameItem->GetFrame() : nullptr,
2335 pHiddenItem && pHiddenItem->GetValue()
2336 );
2337}
2338
2339SfxViewFrame* SfxViewFrame::Get( const Reference< XController>& i_rController, const SfxObjectShell* i_pDoc )
2340{
2341 if ( !i_rController.is() )
2342 return nullptr;
2343
2344 const SfxObjectShell* pDoc = i_pDoc;
2345 if ( !pDoc )
2346 {
2347 Reference< XModel > xDocument( i_rController->getModel() );
2348 for ( pDoc = SfxObjectShell::GetFirst( nullptr, false );
2349 pDoc;
2350 pDoc = SfxObjectShell::GetNext( *pDoc, nullptr, false )
2351 )
2352 {
2353 if ( pDoc->GetModel() == xDocument )
2354 break;
2355 }
2356 }
2357
2358 SfxViewFrame* pViewFrame = nullptr;
2359 for ( pViewFrame = SfxViewFrame::GetFirst( pDoc, false );
2360 pViewFrame;
2361 pViewFrame = SfxViewFrame::GetNext( *pViewFrame, pDoc, false )
2362 )
2363 {
2364 if ( pViewFrame->GetViewShell()->GetController() == i_rController )
2365 break;
2366 }
2367
2368 return pViewFrame;
2369}
2370
2372{
2373 SfxViewShell* pCurrentShell = GetViewShell();
2374 ENSURE_OR_RETURN_VOID( pCurrentShell != nullptr, "SfxViewFrame::SaveCurrentViewData_Impl: no current view shell -> no current view data!" );
2375
2376 // determine the logical (API) view name
2377 const SfxObjectFactory& rDocFactory( pCurrentShell->GetObjectShell()->GetFactory() );
2378 const sal_uInt16 nCurViewNo = rDocFactory.GetViewNo_Impl( GetCurViewId(), 0 );
2379 const OUString sCurrentViewName = rDocFactory.GetViewFactory( nCurViewNo ).GetAPIViewName();
2380 const sal_uInt16 nNewViewNo = rDocFactory.GetViewNo_Impl( i_nNewViewId, 0 );
2381 const OUString sNewViewName = rDocFactory.GetViewFactory( nNewViewNo ).GetAPIViewName();
2382 if ( sCurrentViewName.isEmpty() || sNewViewName.isEmpty() )
2383 {
2384 // can't say anything about the view, the respective application did not yet migrate its code to
2385 // named view factories => bail out
2386 OSL_FAIL( "SfxViewFrame::SaveCurrentViewData_Impl: views without API names? Shouldn't happen anymore?" );
2387 return;
2388 }
2389 SAL_WARN_IF(sNewViewName == sCurrentViewName, "sfx.view", "SfxViewFrame::SaveCurrentViewData_Impl: suspicious: new and old view name are identical!");
2390
2391 // save the view data only when we're moving from a non-print-preview to the print-preview view
2392 if ( sNewViewName != "PrintPreview" )
2393 return;
2394
2395 // retrieve the view data from the view
2396 Sequence< PropertyValue > aViewData;
2397 pCurrentShell->WriteUserDataSequence( aViewData );
2398
2399 try
2400 {
2401 // retrieve view data (for *all* views) from the model
2402 const Reference< XController > xController( pCurrentShell->GetController(), UNO_SET_THROW );
2403 const Reference< XViewDataSupplier > xViewDataSupplier( xController->getModel(), UNO_QUERY_THROW );
2404 const Reference< XIndexContainer > xViewData( xViewDataSupplier->getViewData(), UNO_QUERY_THROW );
2405
2406 // look up the one view data item which corresponds to our current view, and remove it
2407 const sal_Int32 nCount = xViewData->getCount();
2408 for ( sal_Int32 i=0; i<nCount; ++i )
2409 {
2410 const ::comphelper::NamedValueCollection aCurViewData( xViewData->getByIndex(i) );
2411 const OUString sViewId( aCurViewData.getOrDefault( "ViewId", OUString() ) );
2412 if ( sViewId.isEmpty() )
2413 continue;
2414
2415 const SfxViewFactory* pViewFactory = rDocFactory.GetViewFactoryByViewName( sViewId );
2416 if ( pViewFactory == nullptr )
2417 continue;
2418
2419 if ( pViewFactory->GetOrdinal() == GetCurViewId() )
2420 {
2421 xViewData->removeByIndex(i);
2422 break;
2423 }
2424 }
2425
2426 // then replace it with the most recent view data we just obtained
2427 xViewData->insertByIndex( 0, Any( aViewData ) );
2428 }
2429 catch( const Exception& )
2430 {
2431 DBG_UNHANDLED_EXCEPTION("sfx.view");
2432 }
2433}
2434
2435/* [Description]
2436
2437 Internal Method for switching to another <SfxViewShell> subclass,
2438 which should be created in this SfxMDIFrame. If no SfxViewShell exist
2439 in this SfxMDIFrame, then one will first be created.
2440
2441
2442 [Return Value]
2443
2444 bool true
2445 requested SfxViewShell was created and a
2446 possibly existing one deleted
2447
2448 false
2449 SfxViewShell requested could not be created,
2450 the existing SfxViewShell thus continue to exist
2451*/
2453(
2454 sal_uInt16 nViewIdOrNo, /* > 0
2455 Registration-Id of the View, to which the
2456 method should switch, for example the one
2457 that will be created.
2458
2459 == 0
2460 First use the Default view. */
2461
2462 bool bIsIndex /* true
2463 'nViewIdOrNo' is no Registration-Id instead
2464 an Index of <SfxViewFrame> in <SfxObjectShell>.
2465 */
2466)
2467{
2468 try
2469 {
2470 ENSURE_OR_THROW( GetObjectShell() != nullptr, "not possible without a document" );
2471
2472 // if we already have a view shell, remove it
2473 SfxViewShell* pOldSh = GetViewShell();
2474 OSL_PRECOND( pOldSh, "SfxViewFrame::SwitchToViewShell_Impl: that's called *switch* (not for *initial-load*) for a reason" );
2475 if ( pOldSh )
2476 {
2477 // ask whether it can be closed
2478 if ( !pOldSh->PrepareClose() )
2479 return false;
2480
2481 // remove sub shells from Dispatcher before switching to new ViewShell
2482 PopShellAndSubShells_Impl( *pOldSh );
2483 }
2484
2485 GetBindings().ENTERREGISTRATIONS();
2487
2488 // ID of the new view
2490 const SfxInterfaceId nViewId = ( bIsIndex || !nViewIdOrNo ) ? rDocFact.GetViewFactory( nViewIdOrNo ).GetOrdinal() : SfxInterfaceId(nViewIdOrNo);
2491
2492 // save the view data of the old view, so it can be restored later on (when needed)
2493 SaveCurrentViewData_Impl( nViewId );
2494
2495 // create and load new ViewShell
2497 *GetObjectShell(),
2498 GetFrame().GetFrameInterface(),
2499 Sequence< PropertyValue >(), // means "reuse existing model's args"
2500 nViewId,
2501 false
2502 );
2503
2504 // allow resize events to be processed
2506
2507 if ( GetWindow().IsReallyVisible() )
2508 DoAdjustPosSizePixel( pNewSh, Point(), GetWindow().GetOutputSizePixel(), false );
2509
2510 GetBindings().LEAVEREGISTRATIONS();
2511 delete pOldSh;
2512 }
2513 catch ( const css::uno::Exception& )
2514 {
2515 // the SfxCode is not able to cope with exceptions thrown while creating views
2516 // the code will crash in the stack unwinding procedure, so we shouldn't let exceptions go through here
2517 DBG_UNHANDLED_EXCEPTION("sfx.view");
2518 return false;
2519 }
2520
2521 DBG_ASSERT( SfxGetpApp()->GetViewFrames_Impl().size() == SfxGetpApp()->GetViewShells_Impl().size(), "Inconsistent view arrays!" );
2522 return true;
2523}
2524
2526{
2527 m_pImpl->nCurViewId = i_nID;
2528}
2529
2531{
2532 return m_pImpl->nCurViewId;
2533}
2534
2535/* [Description]
2536
2537 Internal method to run the slot for the <SfxShell> Subclass in the
2538 SfxViewFrame <SVIDL> described slots.
2539*/
2541(
2542 SfxRequest& rReq // The executable <SfxRequest>
2543)
2544{
2545
2546 // If the Shells are just being replaced...
2547 if ( !GetObjectShell() || !GetViewShell() )
2548 return;
2549
2550 switch ( rReq.GetSlot() )
2551 {
2552 case SID_TERMINATE_INPLACEACTIVATION :
2553 {
2555 if ( pClient )
2556 pClient->DeactivateObject();
2557 break;
2558 }
2559
2560 case SID_VIEWSHELL:
2561 {
2562 const SfxUInt16Item *pItem = nullptr;
2563 if ( rReq.GetArgs()
2564 && (pItem = rReq.GetArgs()->GetItemIfSet( SID_VIEWSHELL, false ))
2565 )
2566 {
2567 const sal_uInt16 nViewId = pItem->GetValue();
2568 bool bSuccess = SwitchToViewShell_Impl( nViewId );
2569 rReq.SetReturnValue( SfxBoolItem( 0, bSuccess ) );
2570 }
2571 break;
2572 }
2573
2574 case SID_VIEWSHELL0:
2575 case SID_VIEWSHELL1:
2576 case SID_VIEWSHELL2:
2577 case SID_VIEWSHELL3:
2578 case SID_VIEWSHELL4:
2579 {
2580 const sal_uInt16 nViewNo = rReq.GetSlot() - SID_VIEWSHELL0;
2581 bool bSuccess = SwitchToViewShell_Impl( nViewNo, true );
2582 rReq.SetReturnValue( SfxBoolItem( 0, bSuccess ) );
2583 break;
2584 }
2585
2586 case SID_NEWWINDOW:
2587 {
2588 // Hack. at the moment a virtual Function
2589 if ( !GetViewShell()->NewWindowAllowed() )
2590 {
2591 OSL_FAIL( "You should have disabled the 'Window/New Window' slot!" );
2592 return;
2593 }
2594
2595 // Get ViewData of FrameSets recursively.
2597 SfxMedium* pMed = GetObjectShell()->GetMedium();
2598
2599 // do not open the new window hidden
2600 pMed->GetItemSet()->ClearItem( SID_HIDDEN );
2601
2602 // the view ID (optional arg. TODO: this is currently not supported in the slot definition ...)
2603 const SfxUInt16Item* pViewIdItem = rReq.GetArg<SfxUInt16Item>(SID_VIEW_ID);
2604 const SfxInterfaceId nViewId = pViewIdItem ? SfxInterfaceId(pViewIdItem->GetValue()) : GetCurViewId();
2605
2606 Reference < XFrame > xFrame;
2607 // the frame (optional arg. TODO: this is currently not supported in the slot definition ...)
2608 const SfxUnoFrameItem* pFrameItem = rReq.GetArg<SfxUnoFrameItem>(SID_FILLFRAME);
2609 if ( pFrameItem )
2610 xFrame = pFrameItem->GetFrame();
2611
2613
2614 rReq.Done();
2615 break;
2616 }
2617
2618 case SID_OBJECT:
2619 {
2620 const SfxInt16Item* pItem = rReq.GetArg<SfxInt16Item>(SID_OBJECT);
2621
2622 if (pItem)
2623 {
2624 GetViewShell()->DoVerb( pItem->GetValue() );
2625 rReq.Done();
2626 break;
2627 }
2628 }
2629 }
2630}
2631
2632/* TODO as96863:
2633 This method try to collect information about the count of currently open documents.
2634 But the algorithm is implemented very simple ...
2635 E.g. hidden documents should be ignored here ... but they are counted.
2636 TODO: export special helper "framework::FrameListAnalyzer" within the framework module
2637 and use it here.
2638*/
2640{
2641 css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
2642 std::optional<sal_Int32> x(officecfg::Office::Common::Misc::MaxOpenDocuments::get());
2643 // NIL means: count of allowed documents = infinite !
2644 if (!x)
2645 return false;
2646 sal_Int32 nMaxDocs(*x);
2647 sal_Int32 nOpenDocs = 0;
2648
2649 css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create(xContext);
2650 css::uno::Reference< css::container::XIndexAccess > xCont(xDesktop->getFrames(), css::uno::UNO_QUERY_THROW);
2651
2652 sal_Int32 c = xCont->getCount();
2653 sal_Int32 i = 0;
2654
2655 for (i=0; i<c; ++i)
2656 {
2657 try
2658 {
2659 css::uno::Reference< css::frame::XFrame > xFrame;
2660 xCont->getByIndex(i) >>= xFrame;
2661 if ( ! xFrame.is())
2662 continue;
2663
2664 // a) do not count the help window
2665 if ( xFrame->getName() == "OFFICE_HELP_TASK" )
2666 continue;
2667
2668 // b) count all other frames
2669 ++nOpenDocs;
2670 }
2671 catch(const css::uno::Exception&)
2672 // An IndexOutOfBoundsException can happen in multithreaded
2673 // environments, where any other thread can change this
2674 // container !
2675 { continue; }
2676 }
2677
2678 return (nOpenDocs >= nMaxDocs);
2679}
2680
2681/* [Description]
2682
2683 This internal method returns in 'rSet' the Status for the <SfxShell>
2684 Subclass SfxViewFrame in the <SVIDL> described <Slots>.
2685
2686 Thus exactly those Slots-IDs that are recognized as being invalid by Sfx
2687 are included as Which-ranges in 'rSet'. If there exists a mapping for
2688 single slot-IDs of the <SfxItemPool> set in the shell, then the respective
2689 Which-IDs are used so that items can be replaced directly with a working
2690 Core::sun::com::star::script::Engine of the Which-IDs if possible. .
2691*/
2693(
2694 SfxItemSet& rSet /* empty <SfxItemSet> with <Which-Ranges>,
2695 which describes the Slot Ids */
2696)
2697{
2698
2699 SfxObjectShell *pDocSh = GetObjectShell();
2700
2701 if ( !pDocSh )
2702 // I'm just on reload and am yielding myself ...
2703 return;
2704
2705 const WhichRangesContainer & pRanges = rSet.GetRanges();
2706 assert(!pRanges.empty() && "Set with no Range");
2707 for ( auto const & pRange : pRanges )
2708 {
2709 sal_uInt16 nStartWhich = pRange.first;
2710 sal_uInt16 nEndWhich = pRange.second;
2711 for ( sal_uInt16 nWhich = nStartWhich; nWhich <= nEndWhich; ++nWhich )
2712 {
2713 switch(nWhich)
2714 {
2715 case SID_VIEWSHELL:
2716 {
2717 rSet.Put( SfxUInt16Item( nWhich, sal_uInt16(m_pImpl->nCurViewId )) );
2718 break;
2719 }
2720
2721 case SID_VIEWSHELL0:
2722 case SID_VIEWSHELL1:
2723 case SID_VIEWSHELL2:
2724 case SID_VIEWSHELL3:
2725 case SID_VIEWSHELL4:
2726 {
2727 sal_uInt16 nViewNo = nWhich - SID_VIEWSHELL0;
2728 if ( GetObjectShell()->GetFactory().GetViewFactoryCount() >
2729 nViewNo && !GetObjectShell()->IsInPlaceActive() )
2730 {
2731 SfxViewFactory &rViewFactory =
2734 nWhich, m_pImpl->nCurViewId == rViewFactory.GetOrdinal() ) );
2735 }
2736 else
2737 rSet.DisableItem( nWhich );
2738 break;
2739 }
2740
2741 case SID_NEWWINDOW:
2742 {
2743 if ( !GetViewShell()->NewWindowAllowed()
2745 )
2746 rSet.DisableItem( nWhich );
2747 break;
2748 }
2749 }
2750 }
2751 }
2752}
2753
2754
2756{
2757 GetFrame().Appear();
2758}
2759
2760
2761/* [Description]
2762
2763 GetFrame returns the Frame, in which the ViewFrame is located.
2764*/
2766{
2767 return m_pImpl->rFrame;
2768}
2769
2771{
2772 return GetFrame().GetCurrentViewFrame();
2773}
2774
2776{
2777 return m_pImpl->pWindow ? *m_pImpl->pWindow : GetFrame().GetWindow();
2778}
2779
2781{
2782 return GetWindow().GetFrameWeld();
2783}
2784
2786{
2787 return GetFrame().DoClose();
2788}
2789
2791{
2792 if ( m_xObjSh.is() )
2793 return m_xObjSh->GetMedium()->GetName();
2794 return OUString();
2795}
2796
2798{
2799 // no real modality for LOK
2801 return;
2802
2803 m_pImpl->bModal = bModal;
2804 if ( m_xObjSh.is() )
2805 {
2806 for ( SfxViewFrame* pFrame = SfxViewFrame::GetFirst( m_xObjSh.get() );
2807 !bModal && pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, m_xObjSh.get() ) )
2808 bModal = pFrame->m_pImpl->bModal;
2809 m_xObjSh->SetModalMode_Impl( bModal );
2810 }
2811}
2812
2814{
2815 return m_pImpl->bModal || GetFrame().GetWindow().IsInModalMode();
2816}
2817
2818void SfxViewFrame::Resize( bool bForce )
2819{
2820 Size aSize = GetWindow().GetOutputSizePixel();
2821 if ( !bForce && aSize == m_pImpl->aSize )
2822 return;
2823
2824 m_pImpl->aSize = aSize;
2825 SfxViewShell *pShell = GetViewShell();
2826 if ( pShell )
2827 {
2828 if ( GetFrame().IsInPlace() )
2829 {
2830 Point aPoint = GetWindow().GetPosPixel();
2831 DoAdjustPosSizePixel( pShell, aPoint, aSize, true );
2832 }
2833 else
2834 {
2835 DoAdjustPosSizePixel( pShell, Point(), aSize, false );
2836 }
2837 }
2838}
2839
2840#if HAVE_FEATURE_SCRIPTING
2841
2842#define LINE_SEP 0x0A
2843
2844static void CutLines( OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines )
2845{
2846 sal_Int32 nStartPos = 0;
2847 sal_Int32 nLine = 0;
2848 while ( nLine < nStartLine )
2849 {
2850 nStartPos = rStr.indexOf( LINE_SEP, nStartPos );
2851 if( nStartPos == -1 )
2852 break;
2853 nStartPos++; // not the \n.
2854 nLine++;
2855 }
2856
2857 SAL_WARN_IF(nStartPos == -1, "sfx.view", "CutLines: Start row not found!");
2858
2859 if ( nStartPos != -1 )
2860 {
2861 sal_Int32 nEndPos = nStartPos;
2862 for ( sal_Int32 i = 0; i < nLines; i++ )
2863 nEndPos = rStr.indexOf( LINE_SEP, nEndPos+1 );
2864
2865 if ( nEndPos == -1 ) // Can happen at the last row.
2866 nEndPos = rStr.getLength();
2867 else
2868 nEndPos++;
2869
2870 rStr = OUString::Concat(rStr.subView( 0, nStartPos )) + rStr.subView( nEndPos );
2871 }
2872 // erase trailing lines
2873 if ( nStartPos != -1 )
2874 {
2875 sal_Int32 n = nStartPos;
2876 sal_Int32 nLen = rStr.getLength();
2877 while ( ( n < nLen ) && ( rStr[ n ] == LINE_SEP ) )
2878 n++;
2879
2880 if ( n > nStartPos )
2881 rStr = OUString::Concat(rStr.subView( 0, nStartPos )) + rStr.subView( n );
2882 }
2883}
2884
2885#endif
2886
2887/*
2888 add new recorded dispatch macro script into the application global basic
2889 lib container. It generates a new unique id for it and insert the macro
2890 by using this number as name for the module
2891 */
2893{
2894#if !HAVE_FEATURE_SCRIPTING
2895 (void) sMacro;
2896#else
2897 if ( sMacro.isEmpty() )
2898 return;
2899
2900 SfxApplication* pSfxApp = SfxGetpApp();
2901 SfxItemPool& rPool = pSfxApp->GetPool();
2902 SfxRequest aReq(SID_BASICCHOOSER, SfxCallMode::SYNCHRON, rPool);
2903
2904 //seen in tdf#122598, no parent for subsequent dialog
2905 SfxAllItemSet aSet(rPool);
2906 css::uno::Reference< css::frame::XFrame > xFrame =
2908 aSet.Put(SfxUnoFrameItem(SID_FILLFRAME, xFrame));
2909 aReq.SetInternalArgs_Impl(aSet);
2910
2911 aReq.AppendItem( SfxBoolItem(SID_RECORDMACRO,true) );
2912 const SfxPoolItem* pRet = SfxGetpApp()->ExecuteSlot( aReq );
2913 OUString aScriptURL;
2914 if ( pRet )
2915 aScriptURL = static_cast<const SfxStringItem*>(pRet)->GetValue();
2916 if ( !aScriptURL.isEmpty() )
2917 {
2918 // parse scriptURL
2919 OUString aLibName;
2920 OUString aModuleName;
2921 OUString aMacroName;
2922 OUString aLocation;
2923 Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
2924 Reference< css::uri::XUriReferenceFactory > xFactory =
2925 css::uri::UriReferenceFactory::create( xContext );
2926 Reference< css::uri::XVndSunStarScriptUrl > xUrl( xFactory->parse( aScriptURL ), UNO_QUERY );
2927 if ( xUrl.is() )
2928 {
2929 // get name
2930 const OUString aName = xUrl->getName();
2931 const sal_Unicode cTok = '.';
2932 sal_Int32 nIndex = 0;
2933 aLibName = aName.getToken( 0, cTok, nIndex );
2934 if ( nIndex != -1 )
2935 aModuleName = aName.getToken( 0, cTok, nIndex );
2936 if ( nIndex != -1 )
2937 aMacroName = aName.getToken( 0, cTok, nIndex );
2938
2939 // get location
2940 aLocation = xUrl->getParameter( "location" );
2941 }
2942
2943 BasicManager* pBasMgr = nullptr;
2944 if ( aLocation == "application" )
2945 {
2946 // application basic
2948 }
2949 else if ( aLocation == "document" )
2950 {
2951 pBasMgr = GetObjectShell()->GetBasicManager();
2952 }
2953
2954 OUString aOUSource;
2955 if ( pBasMgr)
2956 {
2957 StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
2958 if ( pBasic )
2959 {
2960 SbModule* pModule = pBasic->FindModule( aModuleName );
2961 SbMethod* pMethod = pModule ? pModule->FindMethod(aMacroName, SbxClassType::Method) : nullptr;
2962 if (pMethod)
2963 {
2964 aOUSource = pModule->GetSource32();
2965 sal_uInt16 nStart, nEnd;
2966 pMethod->GetLineRange( nStart, nEnd );
2967 sal_uInt16 nlStart = nStart;
2968 sal_uInt16 nlEnd = nEnd;
2969 CutLines( aOUSource, nlStart-1, nlEnd-nlStart+1 );
2970 }
2971 }
2972 }
2973
2974 // open lib container and break operation if it couldn't be opened
2975 css::uno::Reference< css::script::XLibraryContainer > xLibCont;
2976 if ( aLocation == "application" )
2977 {
2978 xLibCont = SfxGetpApp()->GetBasicContainer();
2979 }
2980 else if ( aLocation == "document" )
2981 {
2982 xLibCont = GetObjectShell()->GetBasicContainer();
2983 }
2984
2985 if(!xLibCont.is())
2986 {
2987 SAL_WARN("sfx.view", "couldn't get access to the basic lib container. Adding of macro isn't possible.");
2988 return;
2989 }
2990
2991 // get LibraryContainer
2992 css::uno::Any aTemp;
2993
2994 css::uno::Reference< css::container::XNameAccess > xLib;
2995 if(xLibCont->hasByName(aLibName))
2996 {
2997 // library must be loaded
2998 aTemp = xLibCont->getByName(aLibName);
2999 xLibCont->loadLibrary(aLibName);
3000 aTemp >>= xLib;
3001 }
3002 else
3003 {
3004 xLib = xLibCont->createLibrary(aLibName);
3005 }
3006
3007 // pack the macro as direct usable "sub" routine
3008 OUStringBuffer sRoutine(10000);
3009 bool bReplace = false;
3010
3011 // get module
3012 if(xLib->hasByName(aModuleName))
3013 {
3014 if ( !aOUSource.isEmpty() )
3015 {
3016 sRoutine.append( aOUSource );
3017 }
3018 else
3019 {
3020 OUString sCode;
3021 aTemp = xLib->getByName(aModuleName);
3022 aTemp >>= sCode;
3023 sRoutine.append( sCode );
3024 }
3025
3026 bReplace = true;
3027 }
3028
3029 // append new method
3030 sRoutine.append( "\nsub "
3031 + aMacroName
3032 + "\n"
3033 + sMacro
3034 + "\nend sub\n" );
3035
3036 // create the module inside the library and insert the macro routine
3037 aTemp <<= sRoutine.makeStringAndClear();
3038 if ( bReplace )
3039 {
3040 css::uno::Reference< css::container::XNameContainer > xModulCont(
3041 xLib,
3042 css::uno::UNO_QUERY);
3043 xModulCont->replaceByName(aModuleName,aTemp);
3044 }
3045 else
3046 {
3047 css::uno::Reference< css::container::XNameContainer > xModulCont(
3048 xLib,
3049 css::uno::UNO_QUERY);
3050 xModulCont->insertByName(aModuleName,aTemp);
3051 }
3052
3053 // #i17355# update the Basic IDE
3054 for ( SfxViewShell* pViewShell = SfxViewShell::GetFirst(); pViewShell; pViewShell = SfxViewShell::GetNext( *pViewShell ) )
3055 {
3056 if ( pViewShell->GetName() == "BasicIDE" )
3057 {
3058 SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
3059 SfxDispatcher* pDispat = rViewFrame.GetDispatcher();
3060 if ( pDispat )
3061 {
3062 SfxMacroInfoItem aInfoItem( SID_BASICIDE_ARG_MACROINFO, pBasMgr, aLibName, aModuleName, OUString(), OUString() );
3063 pDispat->ExecuteList(SID_BASICIDE_UPDATEMODULESOURCE,
3064 SfxCallMode::SYNCHRON, { &aInfoItem });
3065 }
3066 }
3067 }
3068 }
3069 else
3070 {
3071 // add code for "session only" macro
3072 }
3073#endif
3074}
3075
3077{
3078 switch ( rReq.GetSlot() )
3079 {
3080 case SID_STOP_RECORDING :
3081 case SID_RECORDMACRO :
3082 {
3083 // try to find any active recorder on this frame
3084 static const OUStringLiteral sProperty(u"DispatchRecorderSupplier");
3085 css::uno::Reference< css::frame::XFrame > xFrame =
3087
3088 css::uno::Reference< css::beans::XPropertySet > xSet(xFrame,css::uno::UNO_QUERY);
3089 css::uno::Any aProp = xSet->getPropertyValue(sProperty);
3090 css::uno::Reference< css::frame::XDispatchRecorderSupplier > xSupplier;
3091 aProp >>= xSupplier;
3092 css::uno::Reference< css::frame::XDispatchRecorder > xRecorder;
3093 if (xSupplier.is())
3094 xRecorder = xSupplier->getDispatchRecorder();
3095
3096 bool bIsRecording = xRecorder.is();
3097 const SfxBoolItem* pItem = rReq.GetArg<SfxBoolItem>(SID_RECORDMACRO);
3098 if ( pItem && pItem->GetValue() == bIsRecording )
3099 return;
3100
3101 if ( xRecorder.is() )
3102 {
3103 // disable active recording
3104 aProp <<= css::uno::Reference< css::frame::XDispatchRecorderSupplier >();
3105 xSet->setPropertyValue(sProperty,aProp);
3106
3107 const SfxBoolItem* pRecordItem = rReq.GetArg<SfxBoolItem>(FN_PARAM_1);
3108 if ( !pRecordItem || !pRecordItem->GetValue() )
3109 // insert script into basic library container of application
3110 AddDispatchMacroToBasic_Impl(xRecorder->getRecordedMacro());
3111
3112 xRecorder->endRecording();
3113 xRecorder = nullptr;
3114 GetBindings().SetRecorder_Impl( xRecorder );
3115
3116 SetChildWindow( SID_RECORDING_FLOATWINDOW, false );
3117 if ( rReq.GetSlot() != SID_RECORDMACRO )
3118 GetBindings().Invalidate( SID_RECORDMACRO );
3119 }
3120 else if ( rReq.GetSlot() == SID_RECORDMACRO )
3121 {
3122 // enable recording
3123 css::uno::Reference< css::uno::XComponentContext > xContext(
3124 ::comphelper::getProcessComponentContext());
3125
3126 xRecorder = css::frame::DispatchRecorder::create( xContext );
3127
3128 xSupplier = css::frame::DispatchRecorderSupplier::create( xContext );
3129
3130 xSupplier->setDispatchRecorder(xRecorder);
3131 xRecorder->startRecording(xFrame);
3132 aProp <<= xSupplier;
3133 xSet->setPropertyValue(sProperty,aProp);
3134 GetBindings().SetRecorder_Impl( xRecorder );
3135 SetChildWindow( SID_RECORDING_FLOATWINDOW, true );
3136 }
3137
3138 rReq.Done();
3139 break;
3140 }
3141
3142 case SID_TOGGLESTATUSBAR:
3143 {
3144 if ( auto xLayoutManager = getLayoutManager(GetFrame()) )
3145 {
3146 static const OUStringLiteral aStatusbarResString( u"private:resource/statusbar/statusbar" );
3147 // Evaluate parameter.
3148 const SfxBoolItem* pShowItem = rReq.GetArg<SfxBoolItem>(rReq.GetSlot());
3149 bool bShow( true );
3150 if ( !pShowItem )
3151 bShow = xLayoutManager->isElementVisible( aStatusbarResString );
3152 else
3153 bShow = pShowItem->GetValue();
3154
3155 if ( bShow )
3156 {
3157 xLayoutManager->createElement( aStatusbarResString );
3158 xLayoutManager->showElement( aStatusbarResString );
3159 }
3160 else
3161 xLayoutManager->hideElement( aStatusbarResString );
3162
3163 if ( !pShowItem )
3164 rReq.AppendItem( SfxBoolItem( SID_TOGGLESTATUSBAR, bShow ) );
3165 }
3166 rReq.Done();
3167 break;
3168 }
3169 case SID_COMMAND_POPUP:
3170 {
3171 tools::Rectangle aRectangle(Point(0,0), GetWindow().GetSizePixel());
3172 weld::Window* pParent = weld::GetPopupParent(GetWindow(), aRectangle);
3173 m_pCommandPopupHandler->showPopup(pParent, GetFrame().GetFrameInterface());
3174
3175 rReq.Done();
3176 break;
3177 }
3178 case SID_WIN_FULLSCREEN:
3179 {
3180 const SfxBoolItem* pItem = rReq.GetArg<SfxBoolItem>(rReq.GetSlot());
3181 SfxViewFrame *pTop = GetTopViewFrame();
3182 if ( pTop )
3183 {
3184 WorkWindow* pWork = static_cast<WorkWindow*>( pTop->GetFrame().GetTopWindow_Impl() );
3185 if ( pWork )
3186 {
3187 Reference< css::frame::XLayoutManager > xLayoutManager = getLayoutManager(GetFrame());
3188 bool bNewFullScreenMode = pItem ? pItem->GetValue() : !pWork->IsFullScreenMode();
3189 if ( bNewFullScreenMode != pWork->IsFullScreenMode() )
3190 {
3191 if ( bNewFullScreenMode )
3193 else
3195
3196 Reference< css::beans::XPropertySet > xLMPropSet( xLayoutManager, UNO_QUERY );
3197 if ( xLMPropSet.is() )
3198 {
3199 try
3200 {
3201 xLMPropSet->setPropertyValue(
3202 "HideCurrentUI",
3203 Any( bNewFullScreenMode ));
3204 }
3205 catch ( css::beans::UnknownPropertyException& )
3206 {
3207 }
3208 }
3209 pWork->ShowFullScreenMode( bNewFullScreenMode );
3210 pWork->SetMenuBarMode( bNewFullScreenMode ? MenuBarMode::Hide : MenuBarMode::Normal );
3211 GetFrame().GetWorkWindow_Impl()->SetFullScreen_Impl( bNewFullScreenMode );
3212 if ( !pItem )
3213 rReq.AppendItem( SfxBoolItem( SID_WIN_FULLSCREEN, bNewFullScreenMode ) );
3214 rReq.Done();
3215 }
3216 else
3217 rReq.Ignore();
3218 }
3219 }
3220 else
3221 rReq.Ignore();
3222
3223 GetDispatcher()->Update_Impl( true );
3224 break;
3225 }
3226 }
3227}
3228
3230{
3231 const WhichRangesContainer & pRanges = rSet.GetRanges();
3232 DBG_ASSERT(!pRanges.empty(), "Set without range");
3233 for ( auto const & pRange : pRanges )
3234 {
3235 for(sal_uInt16 nWhich = pRange.first; nWhich <= pRange.second; ++nWhich)
3236 {
3237 switch(nWhich)
3238 {
3239 case SID_CURRENT_URL:
3240 {
3242 break;
3243 }
3244
3245 case SID_RECORDMACRO :
3246 {
3247 const OUString& sName{GetObjectShell()->GetFactory().GetFactoryName()};
3248 bool bMacrosDisabled = officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get();
3249 if (bMacrosDisabled ||
3250 !officecfg::Office::Common::Misc::MacroRecorderMode::get() ||
3251 ( sName!="swriter" && sName!="scalc" ) )
3252 {
3253 rSet.DisableItem( nWhich );
3254 rSet.Put(SfxVisibilityItem(nWhich, false));
3255 break;
3256 }
3257
3258 css::uno::Reference< css::beans::XPropertySet > xSet(
3259 GetFrame().GetFrameInterface(),
3260 css::uno::UNO_QUERY);
3261
3262 css::uno::Any aProp = xSet->getPropertyValue("DispatchRecorderSupplier");
3263 css::uno::Reference< css::frame::XDispatchRecorderSupplier > xSupplier;
3264 if ( aProp >>= xSupplier )
3265 rSet.Put( SfxBoolItem( nWhich, xSupplier.is() ) );
3266 else
3267 rSet.DisableItem( nWhich );
3268 break;
3269 }
3270
3271 case SID_STOP_RECORDING :
3272 {
3273 const OUString& sName{GetObjectShell()->GetFactory().GetFactoryName()};
3274 if ( !officecfg::Office::Common::Misc::MacroRecorderMode::get() ||
3275 ( sName!="swriter" && sName!="scalc" ) )
3276 {
3277 rSet.DisableItem( nWhich );
3278 break;
3279 }
3280
3281 css::uno::Reference< css::beans::XPropertySet > xSet(
3282 GetFrame().GetFrameInterface(),
3283 css::uno::UNO_QUERY);
3284
3285 css::uno::Any aProp = xSet->getPropertyValue("DispatchRecorderSupplier");
3286 css::uno::Reference< css::frame::XDispatchRecorderSupplier > xSupplier;
3287 if ( !(aProp >>= xSupplier) || !xSupplier.is() )
3288 rSet.DisableItem( nWhich );
3289 break;
3290 }
3291
3292 case SID_TOGGLESTATUSBAR:
3293 {
3294 css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
3295 css::uno::Reference< css::beans::XPropertySet > xSet(
3296 GetFrame().GetFrameInterface(),
3297 css::uno::UNO_QUERY);
3298 css::uno::Any aProp = xSet->getPropertyValue( "LayoutManager" );
3299
3300 if ( !( aProp >>= xLayoutManager ))
3301 rSet.Put( SfxBoolItem( nWhich, false ));
3302 else
3303 {
3304 bool bShow = xLayoutManager->isElementVisible( "private:resource/statusbar/statusbar" );
3305 rSet.Put( SfxBoolItem( nWhich, bShow ));
3306 }
3307 break;
3308 }
3309
3310 case SID_WIN_FULLSCREEN:
3311 {
3312 SfxViewFrame* pTop = GetTopViewFrame();
3313 if ( pTop )
3314 {
3315 WorkWindow* pWork = static_cast<WorkWindow*>( pTop->GetFrame().GetTopWindow_Impl() );
3316 if ( pWork )
3317 {
3318 rSet.Put( SfxBoolItem( nWhich, pWork->IsFullScreenMode() ) );
3319 break;
3320 }
3321 }
3322
3323 rSet.DisableItem( nWhich );
3324 break;
3325 }
3326
3327 default:
3328 break;
3329 }
3330 }
3331 }
3332}
3333
3334/* [Description]
3335
3336 This method can be included in the Execute method for the on- and off-
3337 switching of ChildWindows, to implement this and API-bindings.
3338
3339 Simply include as 'ExecuteMethod' in the IDL.
3340*/
3342{
3343 // Evaluate Parameter
3344 sal_uInt16 nSID = rReq.GetSlot();
3345
3346 if (nSID == SID_SIDEBAR_DECK)
3347 {
3348 const SfxStringItem* pDeckIdItem = rReq.GetArg<SfxStringItem>(SID_SIDEBAR_DECK);
3349 if (pDeckIdItem)
3350 {
3351 const OUString aDeckId(pDeckIdItem->GetValue());
3352 const SfxBoolItem* pToggleItem = rReq.GetArg<SfxBoolItem>(SID_SIDEBAR_DECK_TOGGLE);
3353 bool bToggle = pToggleItem && pToggleItem->GetValue();
3354 ::sfx2::sidebar::Sidebar::ShowDeck(aDeckId, this, bToggle);
3355 }
3356 rReq.Done();
3357 return;
3358 }
3359
3360 const SfxBoolItem* pShowItem = rReq.GetArg<SfxBoolItem>(nSID);
3361 if ( nSID == SID_VIEW_DATA_SOURCE_BROWSER )
3362 {
3364 return;
3365 Reference < XFrame > xFrame = GetFrame().GetFrameInterface();
3366 Reference < XFrame > xBeamer( xFrame->findFrame( "_beamer", FrameSearchFlag::CHILDREN ) );
3367 bool bHasChild = xBeamer.is();
3368 bool bShow = pShowItem ? pShowItem->GetValue() : !bHasChild;
3369 if ( pShowItem )
3370 {
3371 if( bShow == bHasChild )
3372 return;
3373 }
3374 else
3375 rReq.AppendItem( SfxBoolItem( nSID, bShow ) );
3376
3377 if ( !bShow )
3378 {
3379 SetChildWindow( SID_BROWSER, false );
3380 }
3381 else
3382 {
3383 css::util::URL aTargetURL;
3384 aTargetURL.Complete = ".component:DB/DataSourceBrowser";
3385 Reference < css::util::XURLTransformer > xTrans(
3386 css::util::URLTransformer::create(
3387 ::comphelper::getProcessComponentContext() ) );
3388 xTrans->parseStrict( aTargetURL );
3389
3390 Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY );
3391 Reference < css::frame::XDispatch > xDisp;
3392 if ( xProv.is() )
3393 xDisp = xProv->queryDispatch( aTargetURL, "_beamer", 31 );
3394 if ( xDisp.is() )
3395 {
3396 Sequence < css::beans::PropertyValue > aArgs(1);
3397 css::beans::PropertyValue* pArg = aArgs.getArray();
3398 pArg[0].Name = "Referer";
3399 pArg[0].Value <<= OUString("private:user");
3400 xDisp->dispatch( aTargetURL, aArgs );
3401 }
3402 }
3403
3404 rReq.Done();
3405 return;
3406 }
3407 if (nSID == SID_STYLE_DESIGNER)
3408 {
3409 // First make sure that the sidebar is visible
3410 ShowChildWindow(SID_SIDEBAR);
3411
3412 ::sfx2::sidebar::Sidebar::ShowPanel(u"StyleListPanel",
3413 GetFrame().GetFrameInterface(), true);
3414 rReq.Done();
3415 return;
3416 }
3417 if (nSID == SID_NAVIGATOR)
3418 {
3420 {
3421 ShowChildWindow(SID_SIDEBAR);
3422 ::sfx2::sidebar::Sidebar::ShowDeck(u"NavigatorDeck", this, true);
3423 rReq.Done();
3424 return;
3425 }
3426 }
3427
3428 bool bHasChild = HasChildWindow(nSID);
3429 bool bShow = pShowItem ? pShowItem->GetValue() : !bHasChild;
3430 GetDispatcher()->Update_Impl( true );
3431
3432 // Perform action.
3433 if ( !pShowItem || bShow != bHasChild )
3434 ToggleChildWindow( nSID );
3435
3436 GetBindings().Invalidate( nSID );
3437
3438 // Record if possible.
3439 if ( nSID == SID_HYPERLINK_DIALOG || nSID == SID_SEARCH_DLG )
3440 {
3441 rReq.Ignore();
3442 }
3443 else
3444 {
3445 rReq.AppendItem( SfxBoolItem( nSID, bShow ) );
3446 rReq.Done();
3447 }
3448}
3449
3450/* [Description]
3451
3452 This method can be used in the state method for the on and off-state
3453 of child-windows, in order to implement this.
3454
3455 Just register the IDL as 'StateMethod'.
3456*/
3458{
3459 SfxWhichIter aIter( rState );
3460 for ( sal_uInt16 nSID = aIter.FirstWhich(); nSID; nSID = aIter.NextWhich() )
3461 {
3462 if ( nSID == SID_VIEW_DATA_SOURCE_BROWSER )
3463 {
3464 rState.Put( SfxBoolItem( nSID, HasChildWindow( SID_BROWSER ) ) );
3465 }
3466 else if ( nSID == SID_HYPERLINK_DIALOG )
3467 {
3468 const SfxPoolItem* pDummy = nullptr;
3469 SfxItemState eState = GetDispatcher()->QueryState( SID_HYPERLINK_SETLINK, pDummy );
3470 if ( SfxItemState::DISABLED == eState )
3471 rState.DisableItem(nSID);
3472 else
3473 {
3474 if ( KnowsChildWindow(nSID) )
3475 rState.Put( SfxBoolItem( nSID, HasChildWindow(nSID)) );
3476 else
3477 rState.DisableItem(nSID);
3478 }
3479 }
3480 else if ( nSID == SID_BROWSER )
3481 {
3482 Reference < XFrame > xFrame = GetFrame().GetFrameInterface()->
3483 findFrame( "_beamer", FrameSearchFlag::CHILDREN );
3484 if ( !xFrame.is() )
3485 rState.DisableItem( nSID );
3486 else if ( KnowsChildWindow(nSID) )
3487 rState.Put( SfxBoolItem( nSID, HasChildWindow(nSID) ) );
3488 }
3489 else if ( nSID == SID_SIDEBAR )
3490 {
3491 if ( !KnowsChildWindow( nSID ) )
3492 {
3493 SAL_INFO("sfx.view", "SID_SIDEBAR state requested, but no task pane child window exists for this ID!");
3494 rState.DisableItem( nSID );
3495 }
3496 else
3497 {
3498 rState.Put( SfxBoolItem( nSID, HasChildWindow( nSID ) ) );
3499 }
3500 }
3501 else if ( KnowsChildWindow(nSID) )
3502 rState.Put( SfxBoolItem( nSID, HasChildWindow(nSID) ) );
3503 else
3504 rState.DisableItem(nSID);
3505 }
3506}
3507
3509{
3511 return pWork;
3512}
3513
3514void SfxViewFrame::SetChildWindow(sal_uInt16 nId, bool bOn, bool bSetFocus )
3515{
3517 if ( pWork )
3518 pWork->SetChildWindow_Impl( nId, bOn, bSetFocus );
3519}
3520
3522{
3524 if ( pWork )
3525 pWork->ToggleChildWindow_Impl( nId, true );
3526}
3527
3528bool SfxViewFrame::HasChildWindow( sal_uInt16 nId )
3529{
3531 return pWork && pWork->HasChildWindow_Impl(nId);
3532}
3533
3535{
3537 return pWork && pWork->KnowsChildWindow_Impl(nId);
3538}
3539
3540void SfxViewFrame::ShowChildWindow( sal_uInt16 nId, bool bVisible )
3541{
3543 if ( pWork )
3544 {
3545 GetDispatcher()->Update_Impl(true);
3546 pWork->ShowChildWindow_Impl(nId, bVisible, true );
3547 }
3548}
3549
3551{
3553 return pWork ? pWork->GetChildWindow_Impl(nId) : nullptr;
3554}
3555
3557{
3559 if ( pDoc->IsLoadingFinished() )
3561
3562 // check if document depends on a template
3564}
3565
3567{
3568 if(pFrame)
3569 SetSVHelpData(pFrame->m_pHelpData);
3570
3571 SetSVWinData(pFrame ? pFrame->m_pWinData : nullptr);
3572
3573 SfxGetpApp()->SetViewFrame_Impl( pFrame );
3574}
3575
3577 const OUString& sPrimaryMessage,
3578 const OUString& sSecondaryMessage,
3579 InfobarType aInfobarType, bool bShowCloseButton)
3580{
3581 SfxChildWindow* pChild = GetChildWindow(SfxInfoBarContainerChild::GetChildWindowId());
3582 if (!pChild)
3583 return nullptr;
3584
3585 if (HasInfoBarWithID(sId))
3586 return nullptr;
3587
3588 SfxInfoBarContainerWindow* pInfoBarContainer = static_cast<SfxInfoBarContainerWindow*>(pChild->GetWindow());
3589 auto pInfoBar = pInfoBarContainer->appendInfoBar(sId, sPrimaryMessage, sSecondaryMessage,
3590 aInfobarType, bShowCloseButton);
3591 ShowChildWindow(SfxInfoBarContainerChild::GetChildWindowId());
3592 return pInfoBar;
3593}
3594
3595void SfxViewFrame::UpdateInfoBar(std::u16string_view sId, const OUString& sPrimaryMessage,
3596 const OUString& sSecondaryMessage, InfobarType eType)
3597{
3598 const sal_uInt16 nId = SfxInfoBarContainerChild::GetChildWindowId();
3599
3600 // Make sure the InfoBar container is visible
3601 if (!HasChildWindow(nId))
3603
3605 if (pChild)
3606 {
3607 SfxInfoBarContainerWindow* pInfoBarContainer = static_cast<SfxInfoBarContainerWindow*>(pChild->GetWindow());
3608 auto pInfoBar = pInfoBarContainer->getInfoBar(sId);
3609
3610 if (pInfoBar)
3611 pInfoBar->Update(sPrimaryMessage, sSecondaryMessage, eType);
3612 }
3613}
3614
3615void SfxViewFrame::RemoveInfoBar( std::u16string_view sId )
3616{
3617 const sal_uInt16 nId = SfxInfoBarContainerChild::GetChildWindowId();
3618
3619 // Make sure the InfoBar container is visible
3620 if (!HasChildWindow(nId))
3622
3624 if (pChild)
3625 {
3626 SfxInfoBarContainerWindow* pInfoBarContainer = static_cast<SfxInfoBarContainerWindow*>(pChild->GetWindow());
3627 auto pInfoBar = pInfoBarContainer->getInfoBar(sId);
3628 pInfoBarContainer->removeInfoBar(pInfoBar);
3630 }
3631}
3632
3633bool SfxViewFrame::HasInfoBarWithID( std::u16string_view sId )
3634{
3635 const sal_uInt16 nId = SfxInfoBarContainerChild::GetChildWindowId();
3636
3638 if (pChild)
3639 {
3640 SfxInfoBarContainerWindow* pInfoBarContainer = static_cast<SfxInfoBarContainerWindow*>(pChild->GetWindow());
3641 return pInfoBarContainer->hasInfoBarWithID(sId);
3642 }
3643
3644 return false;
3645}
3646
3647/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl
SfxApplication * SfxGetpApp()
Definition: app.hxx:232
static BasicDLL * pBasic
Definition: appdata.cxx:44
constexpr OUStringLiteral sViewId
Definition: appuno.cxx:102
void TransformItems(sal_uInt16 nSlotId, const SfxItemSet &rSet, uno::Sequence< beans::PropertyValue > &rArgs, const SfxSlot *pSlot)
Definition: appuno.cxx:908
std::unique_ptr< weld::MessageDialog > m_xQueryBox
static sal_uInt16 GetCommandLineParamCount()
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
static Help * GetHelp()
static OUString GetCommandLineParam(sal_uInt16 nParam)
static bool IsHeadlessModeEnabled()
StarBASIC * GetLib(sal_uInt16 nLib) const
sal_Int32 GetValue() const
sal_uInt16 GetValue() const
const OUString & GetValue() const
static DialogMask HandleError(ErrCode nId, weld::Window *pParent=nullptr, DialogMask nMask=DialogMask::MAX)
static OUString GetEventName(GlobalEventId nID)
bool isAnyKnownWebDAVScheme() const
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
INetProtocol GetProtocol() const
OUString getFSysPath(FSysStyle eStyle, sal_Unicode *pDelimiter=nullptr) const
sal_uInt16 GetFreeIndex()
Definition: bitset.cxx:95
OUString msId
Definition: infobar.hxx:32
OUString msPrimaryMessage
Definition: infobar.hxx:33
bool mbShowCloseButton
Definition: infobar.hxx:36
InfobarType maInfobarType
Definition: infobar.hxx:35
OUString msSecondaryMessage
Definition: infobar.hxx:34
void GetLineRange(sal_uInt16 &, sal_uInt16 &)
SbMethod * FindMethod(const OUString &, SbxClassType)
const OUString & GetSource32() const
SfxViewFrame * pViewFrame
Definition: appdata.hxx:109
SAL_DLLPRIVATE SfxAppData_Impl * Get_Impl() const
Definition: app.hxx:170
SAL_DLLPRIVATE void SetViewFrame_Impl(SfxViewFrame *pViewFrame)
Definition: app.cxx:234
static SfxApplication * Get()
Definition: app.cxx:70
css::script::XLibraryContainer * GetBasicContainer()
Definition: appbas.cxx:87
SAL_DLLPRIVATE std::vector< SfxViewFrame * > & GetViewFrames_Impl() const
Definition: app.cxx:360
static bool IsHeadlessOrUITest()
if true then dialog/infobar notifications like the tip of the day or version change infobar should be...
Definition: viewfrm.cxx:1387
static BasicManager * GetBasicManager()
Definition: appbas.cxx:62
void NotifyEvent(const SfxEventHint &rEvent, bool bSynchron=true)
Definition: appcfg.cxx:722
static bool IsTipOfTheDayDue()
Definition: viewfrm.cxx:1404
void Invalidate(sal_uInt16 nId)
Definition: bindings.cxx:639
SAL_DLLPRIVATE void SetRecorder_Impl(css::uno::Reference< css::frame::XDispatchRecorder > const &)
Definition: bindings.cxx:1739
void SetActiveFrame(const css::uno::Reference< css::frame::XFrame > &rFrame)
Definition: bindings.cxx:1703
void SetDispatcher(SfxDispatcher *pDisp)
Definition: bindings.cxx:1420
void InvalidateAll(bool bWithMsg)
Definition: bindings.cxx:498
bool GetValue() const
void Broadcast(const SfxHint &rHint)
vcl::Window * GetWindow() const
Definition: childwin.hxx:117
Shared code to handle Business Authorization Identification and Labeling Scheme (BAILS) properties.
static bool IsClassified(const css::uno::Reference< css::document::XDocumentProperties > &xDocumentProperties)
Does the document have any BAILS properties?
SAL_DLLPRIVATE void Update_Impl(bool bForce=false)
Definition: dispatch.cxx:1034
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
Method to execute a <SfxSlot>s over the Slot-Id.
Definition: dispatch.cxx:833
SAL_DLLPRIVATE void SetQuietMode_Impl(bool bOn)
With 'bOn' the Dispatcher is quasi dead and transfers everything to the Parent-Dispatcher.
Definition: dispatch.cxx:1962
SfxBindings * GetBindings() const
This method returns a pointer to the <SfxBinding> Instance on which the SfxDispatcher is currently bo...
Definition: dispatch.cxx:545
void SetDisableFlags(SfxDisableFlags nFlags)
Definition: dispatch.cxx:2078
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
Method to execute a <SfxSlot>s over the Slot-Id.
Definition: dispatch.cxx:931
SAL_DLLPRIVATE bool IsUpdated_Impl() const
Definition: dispatch.cxx:2073
SAL_DLLPRIVATE void SetReadOnly_Impl(bool bOn)
Definition: dispatch.cxx:1949
void Lock(bool bLock)
With this method the SfxDispatcher can be locked and released.
Definition: dispatch.cxx:1895
SfxShell * GetShell(sal_uInt16 nIdx) const
Returns a pointer to the <SfxShell> which is at the position nIdx (from the top, last pushed is 0) on...
Definition: dispatch.cxx:529
SAL_DLLPRIVATE bool GetReadOnly_Impl() const
Definition: dispatch.cxx:1954
SfxItemState QueryState(sal_uInt16 nSID, const SfxPoolItem *&rpState)
Definition: dispatch.cxx:1970
ErrCode GuessFilter(SfxMedium &rMedium, std::shared_ptr< const SfxFilter > &, SfxFilterFlags nMust=SfxFilterFlags::IMPORT, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
Definition: fltfnc.cxx:341
SfxFrame * GetFrame() const
Definition: frame.hxx:166
void Appear()
Definition: frame.cxx:528
SAL_DLLPRIVATE void SetOwnsBindings_Impl(bool bSet)
Definition: frame.cxx:548
SAL_DLLPRIVATE void GetViewData_Impl()
Definition: frame.cxx:272
SAL_DLLPRIVATE void CreateWorkWindow_Impl()
Definition: frame.cxx:593
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
Definition: frame.cxx:515
SAL_DLLPRIVATE void GrabFocusOnComponent_Impl()
Definition: frame.cxx:636
SAL_DLLPRIVATE SystemWindow * GetTopWindow_Impl() const
Definition: frame2.cxx:341
SAL_DLLPRIVATE void SetHasTitle(bool)
Definition: frame.cxx:267
SAL_DLLPRIVATE void ReleasingComponent_Impl()
Definition: frame.cxx:652
SAL_DLLPRIVATE bool DocIsModified_Impl()
Definition: frame.cxx:149
SAL_DLLPRIVATE SfxWorkWindow * GetWorkWindow_Impl() const
Definition: frame.cxx:588
SAL_DLLPRIVATE bool IsAutoLoadLocked_Impl() const
Definition: frame.cxx:239
SAL_DLLPRIVATE void SetCurrentViewFrame_Impl(SfxViewFrame *)
Definition: frame.cxx:257
bool DoClose()
Definition: frame.cxx:89
vcl::Window & GetWindow() const
Definition: frame.hxx:85
SAL_WARN_UNUSED_RESULT SfxViewFrame * GetCurrentViewFrame() const
Definition: frame.cxx:234
SfxHintId GetId() const
bool IsObjectUIActive() const
Definition: ipclient.cxx:844
void DeactivateObject()
Definition: ipclient.cxx:1062
VclPtr< SfxInfoBarWindow > appendInfoBar(const OUString &sId, const OUString &sPrimaryMessage, const OUString &sSecondaryMessage, InfobarType ibType, bool bShowCloseButton)
Definition: infobar.cxx:370
bool hasInfoBarWithID(std::u16string_view sId)
Definition: infobar.cxx:404
void removeInfoBar(VclPtr< SfxInfoBarWindow > const &pInfoBar)
Definition: infobar.cxx:409
VclPtr< SfxInfoBarWindow > getInfoBar(std::u16string_view sId)
Definition: infobar.cxx:394
sal_Int16 GetValue() const
const WhichRangesContainer & GetRanges() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void DisableItem(sal_uInt16 nWhich)
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
bool IsExpired() const
Definition: docfile.cxx:3596
void SetOpenMode(StreamMode nStorOpen, bool bDontClose=false)
Definition: docfile.cxx:1962
const std::shared_ptr< const SfxFilter > & GetFilter() const
Definition: docfile.cxx:3089
void ResetError()
Definition: docfile.cxx:483
const INetURLObject & GetURLObject() const
Definition: docfile.cxx:3575
void CloseAndRelease()
Definition: docfile.cxx:3127
LockFileResult LockOrigFileOnDemand(bool bLoading, bool bNoUI, bool bTryIgnoreLockFile=false, LockFileEntry *pLockData=nullptr)
Definition: docfile.cxx:1293
ErrCode GetErrorCode() const
Definition: docfile.cxx:512
SfxItemSet * GetItemSet() const
Definition: docfile.cxx:3625
static sal_uInt32 CreatePasswordToModifyHash(std::u16string_view aPasswd, bool bWriter)
Definition: docfile.cxx:3094
const OUString & GetOrigURL() const
Definition: docfile.cxx:3342
const OUString & GetName() const
Definition: docfile.cxx:3570
const std::shared_ptr< std::recursive_mutex > & GetCheckEditableMutex() const
Definition: docfile.cxx:4524
void CancelCheckEditableEntry(bool bRemoveEvent=true)
Definition: docfile.cxx:4593
bool IsRemote() const
Definition: docfile.cxx:2892
SAL_DLLPRIVATE bool HasStorage_Impl() const
Definition: docfile.cxx:4306
void ReOpen()
Definition: docfile.cxx:3363
void CompleteReOpen()
Definition: docfile.cxx:3371
css::uno::Reference< css::embed::XStorage > GetStorage(bool bCreateTempFile=true)
Definition: docfile.cxx:1703
void AddToCheckEditableWorkerList()
Definition: docfile.cxx:4542
const OUString & GetPhysicalName() const
Definition: docfile.cxx:809
css::uno::Reference< css::task::XInteractionHandler > GetInteractionHandler(bool bGetAlways=false)
Definition: docfile.cxx:3054
const OUString & GetFactoryName() const
Definition: docfac.hxx:52
SfxViewFactory * GetViewFactoryByViewName(std::u16string_view i_rViewName) const
returns the view factory whose GetAPIViewName or GetLegacyViewName delivers the requested logical nam...
Definition: docfac.cxx:339
SfxViewFactory & GetViewFactory(sal_uInt16 i=0) const
Definition: docfac.cxx:117
SAL_DLLPRIVATE sal_uInt16 GetViewNo_Impl(const SfxInterfaceId i_nViewId, const sal_uInt16 i_nFallback) const
Definition: docfac.cxx:328
bool Is() const
Definition: objsh.hxx:836
static SfxObjectShell * CreateObject(const OUString &rServiceName, SfxObjectCreateMode=SfxObjectCreateMode::STANDARD)
Definition: objxtor.cxx:988
SAL_DLLPRIVATE void SetModifyPasswordEntered(bool bEntered=true)
Definition: objcont.cxx:702
bool IsOriginallyReadOnlyMedium() const
Definition: objmisc.cxx:358
bool DoClose()
Definition: objxtor.cxx:810
bool isEditDocLocked() const
Definition: objmisc.cxx:1880
virtual bool PrepareClose(bool bUI=true)
Definition: objxtor.cxx:504
virtual void CancelTransfers()
Definition: objmisc.cxx:1260
css::uno::Reference< css::script::XLibraryContainer > GetBasicContainer()
Definition: objxtor.cxx:723
SAL_DLLPRIVATE void SetNamedVisibility_Impl()
Definition: objmisc.cxx:851
virtual bool DoSaveCompleted(SfxMedium *pNewStor=nullptr, bool bRegisterRecent=true)
Definition: objstor.cxx:1948
virtual SfxObjectShell * GetObjectShell() override
Definition: objxtor.cxx:816
SAL_DLLPRIVATE bool CanReload_Impl()
Definition: objstor.cxx:3060
bool IsInModalMode() const
Definition: objmisc.cxx:418
bool IsLoadingFinished() const
Definition: objmisc.cxx:1029
bool IsReadOnlyMedium() const
Definition: objmisc.cxx:345
OUString GetSharedFileURL() const
Definition: objmisc.cxx:640
sal_uInt32 GetModifyPasswordHash() const
Definition: objcont.cxx:664
SfxProgress * GetProgress() const
Definition: objmisc.cxx:873
BasicManager * GetBasicManager() const
Definition: objxtor.cxx:636
bool HasName() const
Definition: objsh.hxx:261
static SAL_WARN_UNUSED_RESULT SfxObjectShell * GetNext(const SfxObjectShell &rPrev, const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
Definition: objxtor.cxx:450
virtual SfxObjectFactory & GetFactory() const =0
bool IsReadOnly() const
Definition: objmisc.cxx:412
bool IsOriginallyLoadedReadOnlyMedium() const
Definition: objmisc.cxx:363
bool IsReadOnlyUI() const
Definition: objmisc.cxx:332
bool IsDocShared() const
Definition: objmisc.cxx:630
bool IsModified() const
Definition: objmisc.cxx:255
SAL_DLLPRIVATE SfxObjectShell_Impl * Get_Impl()
Definition: objsh.hxx:707
SfxMedium * GetMedium() const
Definition: objsh.hxx:256
void SetReadOnlyUI(bool bReadOnly=true)
Definition: objmisc.cxx:369
SAL_DLLPRIVATE void CheckSecurityOnLoading_Impl()
Definition: objmisc.cxx:940
css::uno::Reference< css::frame::XModel3 > GetModel() const
Definition: objxtor.cxx:830
css::uno::Reference< css::embed::XStorage > const & GetStorage()
Definition: objstor.cxx:3261
SAL_DLLPRIVATE void UpdateFromTemplate_Impl()
Definition: objcont.cxx:421
SAL_DLLPRIVATE IndexBitSet & GetNoSet_Impl()
Definition: objmisc.cxx:655
css::uno::Reference< css::security::XCertificate > GetSignPDFCertificate() const
Gets the certificate that is already picked by the user but not yet used for signing.
Definition: objserv.cxx:415
static SAL_WARN_UNUSED_RESULT SfxObjectShell * GetFirst(const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
Definition: objxtor.cxx:425
SfxObjectCreateMode GetCreateMode() const
Definition: objsh.hxx:479
SAL_DLLPRIVATE bool IsModifyPasswordEntered() const
Definition: objcont.cxx:707
const css::uno::Sequence< css::beans::PropertyValue > & GetModifyPasswordInfo() const
Definition: objcont.cxx:683
SAL_DLLPRIVATE bool ConnectTmpStorage_Impl(const css::uno::Reference< css::embed::XStorage > &xStorage, SfxMedium *pMedium)
Definition: objstor.cxx:1804
SAL_DLLPRIVATE void DoNotCleanShareControlFile()
void SetReadOnly()
Definition: objmisc.cxx:386
virtual void SetModified(bool bModified=true)
Definition: objmisc.cxx:297
virtual bool operator==(const SfxPoolItem &) const=0
sal_uInt16 GetSlot() const
Definition: request.hxx:68
void Ignore()
Definition: request.cxx:521
const SfxItemSet * GetArgs() const
Definition: request.hxx:75
const T * GetArg(sal_uInt16 nSlotId) const
Templatized access to the individual parameters of the SfxRequest.
Definition: request.hxx:84
void AppendItem(const SfxPoolItem &)
Definition: request.cxx:404
void SetReturnValue(const SfxPoolItem &)
Definition: request.cxx:422
bool IsAPI() const
Definition: request.cxx:705
void SetInternalArgs_Impl(const SfxAllItemSet &rArgs)
Definition: request.cxx:309
void Done(bool bRemove=false)
Definition: request.cxx:484
The class SfxShell is the base class for all classes, which provide the functionality of the form <Sl...
Definition: shell.hxx:128
const SfxPoolItem * GetSlotState(sal_uInt16 nSlotId, const SfxInterface *pIF=nullptr, SfxItemSet *pStateSet=nullptr)
This method returns the status of the slot with the specified slot ID on the specified interface.
Definition: shell.cxx:462
SfxItemPool & GetPool() const
Each Subclass of SfxShell must reference a pool.
Definition: shell.hxx:511
void SetViewShell_Impl(SfxViewShell *pView)
Definition: shell.cxx:708
SfxRepeatTarget * GetRepeatTarget() const
Returns a pointer to the <SfxRepeatTarget> instance that is used in SID_REPEAT as repeat target when ...
Definition: shell.cxx:224
virtual bool IsDesignMode() const
Definition: shell.hxx:337
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
This method allows you to forward a <SfxRequest> to the specified base <SfxShell>.
Definition: shell.cxx:438
virtual SfxUndoManager * GetUndoManager()
Each Subclass of SfxShell can have a <SfxUndoManager>.
Definition: shell.cxx:203
SfxViewShell * GetViewShell() const
Returns the SfxViewShell in which they are located in the subshells.
Definition: shell.cxx:129
void SetPool(SfxItemPool *pNewPool)
With this method, the subclasses register their special <SfxItemPool> in the SfxShell.
Definition: shell.hxx:525
virtual ViewShellId GetViewShellId() const
virtual bool Undo()
virtual void Clear()
SfxUndoAction * GetRedoAction(size_t nNo=0) const
OUString GetRedoActionComment(size_t nNo=0, bool const i_currentLevel=CurrentLevel) const
OUString GetUndoActionComment(size_t nNo=0, bool const i_currentLevel=CurrentLevel) const
bool CanRepeat(SfxRepeatTarget &rTarget) const
bool Repeat(SfxRepeatTarget &rTarget)
virtual bool Redo()
virtual size_t GetRedoActionCount(bool const i_currentLevel=CurrentLevel) const
OUString GetRepeatActionComment(SfxRepeatTarget &rTarget) const
size_t GetRepeatActionCount() const
virtual size_t GetUndoActionCount(bool const i_currentLevel=CurrentLevel) const
SfxUndoAction * GetUndoAction(size_t nNo=0) const
const css::uno::Reference< css::frame::XFrame > & GetFrame() const
Definition: frame.hxx:193
OUString GetAPIViewName() const
returns an API-compatible view name.
Definition: viewfac.cxx:34
SfxInterfaceId GetOrdinal() const
Definition: viewfac.hxx:40
virtual bool operator==(const SfxPoolItem &) const override
Definition: viewfrm.cxx:2046
SfxViewFrame * pFrame
Definition: viewfrm.hxx:264
virtual SfxViewFrameItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: viewfrm.cxx:2052
SfxViewFrameItem(SfxViewFrame *pViewFrame)
Definition: viewfrm.hxx:267
void LockAdjustPosSizePixel()
Definition: viewfrm.hxx:117
ImplSVHelpData * m_pHelpData
Definition: viewfrm.hxx:56
SAL_DLLPRIVATE const SvBorder & GetBorderPixelImpl() const
Definition: viewfrm.cxx:1242
SAL_DLLPRIVATE void InvalidateBorderImpl(const SfxViewShell *pSh)
Definition: viewfrm.cxx:1185
SfxViewFrame(SfxFrame &rFrame, SfxObjectShell *pDoc)
Definition: viewfrm.cxx:1882
SAL_DLLPRIVATE void StateHistory_Impl(SfxItemSet &rSet)
Definition: viewfrm.cxx:1006
SAL_DLLPRIVATE void UpdateDocument_Impl()
Definition: viewfrm.cxx:3556
static SAL_DLLPRIVATE SfxViewShell * LoadViewIntoFrame_Impl(const SfxObjectShell &i_rDoc, const css::uno::Reference< css::frame::XFrame > &i_rFrame, const css::uno::Sequence< css::beans::PropertyValue > &i_rLoadArgs, const SfxInterfaceId i_nViewId, const bool i_bHidden)
loads the given existing document into the given frame
Definition: viewfrm.cxx:2281
SAL_DLLPRIVATE void SaveCurrentViewData_Impl(const SfxInterfaceId i_nNewViewId)
Definition: viewfrm.cxx:2371
void DoDeactivate(bool bMDI, SfxViewFrame const *pOld)
Definition: viewfrm.cxx:1180
void ToggleChildWindow(sal_uInt16)
Definition: viewfrm.cxx:3521
static SfxViewFrame * LoadDocument(SfxObjectShell const &i_rDoc, SfxInterfaceId i_nViewId)
Definition: viewfrm.cxx:2311
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Current()
Definition: viewfrm.cxx:1958
void SetModalMode(bool)
Definition: viewfrm.cxx:2797
void RemoveInfoBar(std::u16string_view sId)
Definition: viewfrm.cxx:3615
SAL_DLLPRIVATE bool SwitchToViewShell_Impl(sal_uInt16 nNo, bool bIsIndex=false)
Definition: viewfrm.cxx:2453
static SAL_DLLPRIVATE SfxViewFrame * LoadViewIntoFrame_Impl_NoThrow(const SfxObjectShell &i_rDoc, const css::uno::Reference< css::frame::XFrame > &i_rFrame, const SfxInterfaceId i_nViewId, const bool i_bHidden)
loads the given existing document into the given frame
Definition: viewfrm.cxx:2211
vcl::Window & GetWindow() const
Definition: viewfrm.cxx:2775
void ExecReload_Impl(SfxRequest &rReq)
Definition: viewfrm.cxx:275
SAL_DLLPRIVATE void SetViewShell_Impl(SfxViewShell *pVSh)
Definition: viewfrm.cxx:2057
SAL_DLLPRIVATE void KillDispatcher_Impl()
Definition: viewfrm.cxx:1942
bool DoClose()
Definition: viewfrm.cxx:2785
bool IsInModalMode() const
Definition: viewfrm.cxx:2813
SAL_DLLPRIVATE void GetDocNumber_Impl()
Definition: viewfrm.cxx:2076
SfxBindings & GetBindings()
Definition: viewfrm.hxx:110
SAL_DLLPRIVATE void LockObjectShell_Impl()
Definition: viewfrm.cxx:2151
SAL_DLLPRIVATE void SetBorderPixelImpl(const SfxViewShell *pSh, const SvBorder &rBorder)
Definition: viewfrm.cxx:1204
static SfxViewFrame * LoadDocumentIntoFrame(SfxObjectShell const &i_rDoc, const SfxFrameItem *i_pFrameItem, SfxInterfaceId i_nViewId)
Definition: viewfrm.cxx:2321
SAL_DLLPRIVATE void StateView_Impl(SfxItemSet &rSet)
Definition: viewfrm.cxx:2693
void ToTop()
Definition: viewfrm.cxx:2755
bool HasChildWindow(sal_uInt16)
Definition: viewfrm.cxx:3528
void Resize(bool bForce=false)
Definition: viewfrm.cxx:2818
void AppendReadOnlyInfobar()
Definition: viewfrm.cxx:1247
SfxProgress * GetProgress() const
Definition: viewfrm.cxx:2019
SfxInterfaceId GetCurViewId() const
Definition: viewfrm.cxx:2530
void SetChildWindow(sal_uInt16 nId, bool bVisible, bool bSetFocus=true)
Definition: viewfrm.cxx:3514
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetNext(const SfxViewFrame &rPrev, const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
Definition: viewfrm.cxx:1989
SfxDispatcher * GetDispatcher()
Definition: viewfrm.hxx:109
std::unique_ptr< CommandPopupHandler > m_pCommandPopupHandler
Definition: viewfrm.hxx:60
SAL_DLLPRIVATE void ExecHistory_Impl(SfxRequest &rReq)
Definition: viewfrm.cxx:957
SfxViewFrame * GetTopViewFrame() const
Definition: viewfrm.cxx:2770
SfxChildWindow * GetChildWindow(sal_uInt16)
Definition: viewfrm.cxx:3550
SAL_DLLPRIVATE SfxWorkWindow * GetWorkWindow_Impl()
Definition: viewfrm.cxx:3508
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
Definition: viewfrm.cxx:1966
SAL_DLLPRIVATE void AddDispatchMacroToBasic_Impl(const OUString &sMacro)
Definition: viewfrm.cxx:2892
void DoActivate(bool bMDI)
Definition: viewfrm.cxx:1175
SAL_DLLPRIVATE void ReleaseObjectShell_Impl()
Definition: viewfrm.cxx:1104
SfxFrame & GetFrame() const
Definition: viewfrm.cxx:2765
virtual SfxObjectShell * GetObjectShell() override
Definition: viewfrm.cxx:2201
SAL_DLLPRIVATE OUString GetActualPresentationURL_Impl() const
Definition: viewfrm.cxx:2790
weld::Window * GetFrameWeld() const
Definition: viewfrm.cxx:2780
SAL_DLLPRIVATE void MiscExec_Impl(SfxRequest &)
Definition: viewfrm.cxx:3076
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Get(const css::uno::Reference< css::frame::XController > &i_rController, const SfxObjectShell *i_pDoc)
Definition: viewfrm.cxx:2339
sal_uInt16 m_nAdjustPosPixelLock
Definition: viewfrm.hxx:58
SAL_DLLPRIVATE void MiscState_Impl(SfxItemSet &)
Definition: viewfrm.cxx:3229
bool HasInfoBarWithID(std::u16string_view sId)
Definition: viewfrm.cxx:3633
void Close()
Definition: viewfrm.cxx:1155
virtual ~SfxViewFrame() override
Definition: viewfrm.cxx:1904
bool KnowsChildWindow(sal_uInt16)
Definition: viewfrm.cxx:3534
SAL_DLLPRIVATE void ForceOuterResize_Impl()
Definition: viewfrm.cxx:2071
SAL_DLLPRIVATE void PopShellAndSubShells_Impl(SfxViewShell &i_rViewShell)
Definition: viewfrm.cxx:1070
SAL_DLLPRIVATE const Size & GetMargin_Impl() const
Definition: viewfrm.cxx:2206
void DoAdjustPosSizePixel(SfxViewShell *pSh, const Point &rPos, const Size &rSize, bool inplaceEditModeChange)
divide on Inner.../Outer...
Definition: viewfrm.cxx:2026
SfxObjectShellRef m_xObjSh
Definition: viewfrm.hxx:53
VclPtr< SfxInfoBarWindow > AppendInfoBar(const OUString &sId, const OUString &sPrimaryMessage, const OUString &sSecondaryMessage, InfobarType aInfobarType, bool bShowCloseButton=true)
Append a new InfoBar (see https://wiki.documentfoundation.org/Design/Whiteboards/Infobar).
Definition: viewfrm.cxx:3576
SAL_DLLPRIVATE void StateReload_Impl(SfxItemSet &rSet)
Definition: viewfrm.cxx:897
void UpdateTitle()
Definition: viewfrm2.cxx:76
void ChildWindowState(SfxItemSet &)
Definition: viewfrm.cxx:3457
void Show()
Definition: viewfrm.cxx:2118
static SfxViewFrame * LoadHiddenDocument(SfxObjectShell const &i_rDoc, SfxInterfaceId i_nViewId)
Definition: viewfrm.cxx:2306
void AppendContainsMacrosInfobar()
Definition: viewfrm.cxx:1293
std::unique_ptr< SfxDispatcher > m_pDispatcher
Definition: viewfrm.hxx:54
bool IsVisible() const
Definition: viewfrm.cxx:2145
SAL_DLLPRIVATE void Construct_Impl(SfxObjectShell *pObjSh)
Definition: viewfrm.cxx:1829
void Enable(bool bEnable)
Definition: viewfrm.cxx:2083
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: viewfrm.cxx:1418
SAL_DLLPRIVATE void MakeActive_Impl(bool bActivate)
Definition: viewfrm.cxx:2161
static SfxViewFrame * DisplayNewDocument(SfxObjectShell const &i_rDoc, const SfxRequest &i_rCreateDocRequest)
Definition: viewfrm.cxx:2326
void ShowChildWindow(sal_uInt16, bool bVisible=true)
Definition: viewfrm.cxx:3540
static void SetViewFrame(SfxViewFrame *)
Definition: viewfrm.cxx:3566
ImplSVWinData * m_pWinData
Definition: viewfrm.hxx:57
SAL_DLLPRIVATE void SetCurViewId_Impl(const SfxInterfaceId i_nID)
Definition: viewfrm.cxx:2525
SAL_DLLPRIVATE void ExecView_Impl(SfxRequest &rReq)
Definition: viewfrm.cxx:2541
void ChildWindowExecute(SfxRequest &)
Definition: viewfrm.cxx:3341
void UnlockAdjustPosSizePixel()
Definition: viewfrm.hxx:119
std::unique_ptr< struct SfxViewFrame_Impl > m_pImpl
Definition: viewfrm.hxx:51
void UpdateInfoBar(std::u16string_view sId, const OUString &sPrimaryMessage, const OUString &sSecondaryMessage, InfobarType eType)
Definition: viewfrm.cxx:3595
One SfxViewShell more or less represents one edit window for a document, there can be multiple ones f...
Definition: viewsh.hxx:164
virtual bool PrepareClose(bool bUI=true)
Initialize is called after the frame has been loaded and the controller has been set.
Definition: viewsh.cxx:1816
SfxInPlaceClient * GetUIActiveClient() const
Definition: viewsh.cxx:1515
css::uno::Reference< css::frame::XController > GetController() const
Definition: viewsh.cxx:2649
virtual void ShowCursor(bool bOn=true)
Definition: viewsh.cxx:2488
void DisconnectAllClients()
Definition: viewsh.cxx:2515
ViewShellId GetViewShellId() const override
See OutlinerViewShell::GetViewShellId().
Definition: viewsh.cxx:2413
SfxViewFrame & GetViewFrame() const
Definition: viewsh.hxx:289
static SAL_WARN_UNUSED_RESULT SfxViewShell * Get(const css::uno::Reference< css::frame::XController > &i_rController)
Definition: viewsh.cxx:1854
SAL_DLLPRIVATE void PopSubShells_Impl()
Definition: viewsh.hxx:376
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
Definition: viewsh.cxx:2045
virtual void WriteUserDataSequence(css::uno::Sequence< css::beans::PropertyValue > &)
Definition: viewsh.cxx:2009
virtual ErrCode DoVerb(sal_Int32 nVerb)
Definition: viewsh.cxx:1432
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
Definition: viewsh.cxx:2016
virtual SfxObjectShell * GetObjectShell() override
Definition: viewsh.cxx:2578
virtual SfxShell * GetFormShell()
Definition: viewsh.hxx:259
vcl::Window * GetWindow() const
Definition: viewsh.hxx:271
sal_uInt16 FirstWhich()
sal_uInt16 NextWhich()
bool HasChildWindow_Impl(sal_uInt16)
Definition: workwin.cxx:1883
bool KnowsChildWindow_Impl(sal_uInt16)
Definition: workwin.cxx:1937
void SetChildWindow_Impl(sal_uInt16, bool bOn, bool bSetFocus)
Definition: workwin.cxx:1960
void ShowChildWindow_Impl(sal_uInt16, bool bVisible, bool bSetFocus)
Definition: workwin.cxx:1994
SfxChildWindow * GetChildWindow_Impl(sal_uInt16)
Definition: workwin.cxx:2075
void SetFullScreen_Impl(bool bSet)
Definition: workwin.hxx:262
void ToggleChildWindow_Impl(sal_uInt16, bool)
Definition: workwin.cxx:1788
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
tools::Long AdjustWidth(tools::Long n)
constexpr tools::Long Width() const
void OwnerLock(bool bLock)
tools::Long & Left()
tools::Long & Top()
tools::Long & Right()
tools::Long & Bottom()
bool IsModuleInstalled(EModule eModule) const
void SetMenuBarMode(MenuBarMode nMode)
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
static VclPtr< reference_type > Create(Arg &&... arg)
bool IsFullScreenMode() const
void ShowFullScreenMode(bool bFullScreenMode, sal_Int32 nDisplayScreen)
static std::shared_ptr< ConfigurationChanges > create()
static bool IsModifyPasswordCorrect(std::u16string_view aPassword, const css::uno::Sequence< css::beans::PropertyValue > &aInfo)
bool remove(const OUString &_rValueName)
bool put(const OUString &_rValueName, const VALUE_TYPE &_rValue)
css::uno::Sequence< css::beans::PropertyValue > getPropertyValues() const
VALUE_TYPE getOrDefault(const OUString &_rValueName, const VALUE_TYPE &_rDefault) const
bool hasUnsignedContentError() const
bool hasMacroLibrary() const
determines whether the document actually has a macros library
static void UnlockNotebookBar()
Method restores normal behaviour of the Notebookbar.
static void LockNotebookBar()
Method temporarily blocks showing of the NotebookBar.
static void ReloadNotebookBar(std::u16string_view sUIPath)
static void ShowPanel(std::u16string_view rsPanelId, const css::uno::Reference< css::frame::XFrame > &rxFrame, bool bFocus=false)
Switch to the deck that contains the specified panel and make sure that the panel is visible (expande...
Definition: Sidebar.cxx:64
static void ShowDeck(std::u16string_view rsDeckId, SfxViewFrame *pViewFrame, bool bToggle)
Definition: Sidebar.cxx:34
constexpr Point TopLeft() const
constexpr Size GetSize() const
tools::Long AdjustTop(tools::Long nVertMoveDelta)
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
T * get() const
bool is() const
vcl::Window * GetParent() const
bool IsInputEnabled() const
void GrabFocus()
void ReleaseLOKNotifier()
virtual Point GetPosPixel() const
virtual void SetOutputSizePixel(const Size &rNewSize)
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
const vcl::ILibreOfficeKitNotifier * GetLOKNotifier() const
bool IsInModalMode() const
Size GetOutputSizePixel() const
weld::Window * GetFrameWeld() const
vcl::Window * GetFrameWindow() const
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
void EnableInput(bool bEnable=true, bool bChild=true)
virtual void set_label(const OUString &rText)=0
void connect_clicked(const Link< Button &, void > &rLink)
int nCount
#define DBG_ASSERT(sCon, aError)
#define ENSURE_OR_THROW(c, m)
#define DBG_UNHANDLED_EXCEPTION(...)
#define ENSURE_OR_RETURN_VOID(c, m)
float u
float x
#define ERRCODE_IO_ACCESSDENIED
#define ERRCODE_NONE
Any aHelper
Reference< XSingleServiceFactory > xFactory
DocumentType eType
InfobarType
Definition: infobar.hxx:22
sal_Int32 nIndex
OUString aName
sal_Int64 n
sal_uInt16 nPos
Definition: linksrc.cxx:118
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
const char * sName
def run(arg=None, arg2=-1)
NONE
SfxDispatcher * GetDispatcher()
void CutLines(OUString &rStr, sal_Int32 nStartLine, sal_Int32 nLines)
size
@ Exception
Reference< XComponentContext > getProcessComponentContext()
int i
dictionary props
SwAbstractDialogFactory & GetFactory()
static bool isProductVersionUpgraded(bool aUpdateVersion)
OUString GetModuleIdentifier(const Reference< frame::XFrame > &rxFrame)
weld::Window * GetPopupParent(vcl::Window &rOutWin, tools::Rectangle &rRect)
#define SFX_OBJECTBAR_APPLICATION
Definition: objface.hxx:33
#define SFX_OBJECTBAR_FULLSCREEN
Definition: objface.hxx:37
sal_Int16 nId
const char GetValue[]
#define SFX_STREAM_READONLY
Definition: openflag.hxx:26
#define SFX_STREAM_READWRITE
Definition: openflag.hxx:23
SfxItemState
OUString SfxResId(TranslateId aId)
Definition: sfxresid.cxx:22
static SfxItemSet & rSet
Definition: shell.cxx:534
#define SFX_IMPL_SUPERCLASS_INTERFACE(Class, SuperClass)
Definition: shell.hxx:570
o3tl::strong_int< sal_uInt16, struct SfxInterfaceIdTag > SfxInterfaceId
Id for <SfxInterface>s, gives a quasi-static access to the interface through an array to <SfxApplicat...
Definition: shell.hxx:52
constexpr auto SFX_INTERFACE_NONE
Definition: shell.hxx:60
OUString VCL_DLLPUBLIC GetStandardText(StandardButtonType eButton)
StreamMode
::sfx2::DocumentMacroMode aMacroMode
Definition: objshimp.hxx:61
std::unique_ptr< AutoReloadTimer_Impl > pReloadTimer
Definition: objshimp.hxx:99
SfxLoadedFlags nLoadedFlags
Definition: objshimp.hxx:100
bool empty() const noexcept
Reference< XController > xController
Reference< XFrame > xFrame
Reference< XModel > xModel
VCL_DLLPUBLIC ImplSVHelpData * CreateSVHelpData()
VCL_DLLPUBLIC void DestroySVHelpData(ImplSVHelpData *)
VCL_DLLPUBLIC void SetSVHelpData(ImplSVHelpData *)
VCL_DLLPUBLIC void SetSVWinData(ImplSVWinData *)
VCL_DLLPUBLIC ImplSVWinData * CreateSVWinData()
VCL_DLLPUBLIC void DestroySVWinData(ImplSVWinData *)
SVT_DLLPUBLIC OUString SvtResId(TranslateId aId)
@ FullScreenToolbox
bool bVisible
sal_uInt16 sal_Unicode
OUString aTargetURL
OUString sId
RET_OK
RET_CANCEL
RET_IGNORE
RET_YES
VclMessageType
VclButtonsType
constexpr OUStringLiteral CHANGES_STR
Definition: viewfrm.cxx:146
static bool impl_maxOpenDocCountReached()
Definition: viewfrm.cxx:2639
IMPL_LINK_NOARG(SfxViewFrame, WhatsNewHandler, weld::Button &, void)
Definition: viewfrm.cxx:1725
IMPL_LINK(SfxViewFrame, SwitchReadOnlyHandler, weld::Button &, rButton, void)
Definition: viewfrm.cxx:1741
IMPL_STATIC_LINK_NOARG(SfxViewFrame, HelpMasterPasswordHdl, weld::Button &, void)
Definition: viewfrm.cxx:1823