20#include <config_feature_desktop.h>
21#include <config_wasm_strip.h>
23#include <osl/file.hxx>
26#include <sfx2/sfxsids.hrc>
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>
53#if !ENABLE_WASM_STRIP_PINGUSER
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>
88#include <com/sun/star/uno/Reference.h>
93#include <svtools/strings.hrc>
109using ::com::sun::star::awt::XWindow;
110using ::com::sun::star::beans::PropertyValue;
111using ::com::sun::star::document::XViewDataSupplier;
112using ::com::sun::star::container::XIndexContainer;
138#include <sfx2/strings.hrc>
143#define ShellClass_SfxViewFrame
144#include <sfxslots.hxx>
146constexpr OUStringLiteral
CHANGES_STR =
u"private:resource/toolbar/changes";
152 GetStaticInterface()->RegisterChildWindow(SID_BROWSER);
153 GetStaticInterface()->RegisterChildWindow(SID_RECORDING_FLOATWINDOW);
154#if HAVE_FEATURE_DESKTOP
168SfxEditDocumentDialog::SfxEditDocumentDialog(
weld::Widget* pParent)
169 : MessageDialogController(pParent,
"sfx/ui/editdocumentdialog.ui",
170 "EditDocumentDialog")
174class SfxQueryOpenAsTemplate
185 = bAllowIgnoreLock && officecfg::Office::Common::Misc::AllowOverrideLocking::get();
186 if (bAllowIgnoreLock)
189 m_xQueryBox->set_primary_text(QueryString(bAllowIgnoreLock, rLockData));
195 static OUString QueryString(
bool bAllowIgnoreLock,
LockFileEntry& rLockData)
197 OUString sLockUserData;
198 if (!rLockData[LockFileComponent::OOOUSERNAME].isEmpty())
199 sLockUserData = rLockData[LockFileComponent::OOOUSERNAME];
201 sLockUserData = rLockData[LockFileComponent::SYSUSERNAME];
203 if (!sLockUserData.isEmpty() && !rLockData[LockFileComponent::EDITTIME].isEmpty())
204 sLockUserData +=
" ( " + rLockData[LockFileComponent::EDITTIME] +
" )";
206 if (!sLockUserData.isEmpty())
207 sLockUserData =
"\n\n" + sLockUserData +
"\n";
209 const bool bUseLockStr = bAllowIgnoreLock || !sLockUserData.isEmpty();
212 SfxResId(bUseLockStr ? STR_QUERY_OPENASTEMPLATE_LOCKED : STR_QUERY_OPENASTEMPLATE));
214 if (bAllowIgnoreLock)
215 sMsg +=
"\n\n" +
SfxResId(STR_QUERY_OPENASTEMPLATE_ALLOW_IGNORE);
217 return sMsg.replaceFirst(
"%LOCKINFO", sLockUserData);
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 )
224 bool bResult = ( !nPasswordHash && !aInfo.hasElements() );
226 SAL_WARN_IF( !(pFilter && ( pFilter->GetFilterFlags() & SfxFilterFlags::PASSWORDTOMODIFY )),
"sfx.view",
227 "PasswordToModify feature is active for a filter that does not support it!");
229 if ( pFilter && xHandler.is() )
231 bool bCancel =
false;
232 bool bFirstTime =
true;
234 while ( !bResult && !bCancel )
236 bool bMSType = !pFilter->IsOwnFormat();
239 new ::comphelper::DocPasswordRequest(
241 bFirstTime ? css::task::PasswordRequestMode_PASSWORD_ENTER : css::task::PasswordRequestMode_PASSWORD_REENTER,
245 xHandler->handle( pPasswordRequest );
247 if ( pPasswordRequest->isPassword() )
249 if ( aInfo.hasElements() )
281 case SID_READONLYDOC:
293 struct ReadOnlyUIGuard
300 : m_pFrame(pFrame), m_pSh(p_Sh), m_bSetRO(p_Sh->
IsReadOnlyUI())
302 ~ReadOnlyUIGuard() COVERITY_NOEXCEPT_FALSE
320 } aReadOnlyUIGuard(
this, pSh);
325 std::unique_lock<std::recursive_mutex> chkEditLock;
326 if (pChkEditMutex !=
nullptr)
327 chkEditLock = std::unique_lock<std::recursive_mutex>(*pChkEditMutex);
340 aSet.
Put( *pReferer );
343 aSet.
Put( *pVersionItem );
350 aSet.
Put( *pOptions );
358 bool bNeedsReload =
false;
359 bool bPasswordEntered =
false;
378 aReadOnlyUIGuard.m_bSetRO =
true;
396 bPasswordEntered =
true;
400 aReadOnlyUIGuard.m_bSetRO =
false;
424 osl::FileBase::getFileURLFromSystemPath( pMed->
GetPhysicalName(), sTemp );
448 if ( ( !bNeedsReload && ( ( aMedObj.
GetProtocol() == INetProtocol::File &&
450 || bPasswordEntered ) &&
451 !physObjIsOlder(aMedObj, aPhysObj))
452 || (bIsWebDAV && !physObjIsOlder(aMedObj, aPhysObj))
453 || ( pMed->
IsRemote() && !bIsWebDAV ) ) )
458 bool bRetryIgnoringLock =
false;
459 bool bOpenTemplate =
false;
460 std::optional<bool> aOrigROVal;
471 if (bRetryIgnoringLock)
498 SfxBoolItem(SID_DOC_READONLY, !(nOpenMode & StreamMode::WRITE)));
499 if ( nOpenMode & StreamMode::WRITE )
502 true,
true, bRetryIgnoringLock, &aLockData);
520 bRetryIgnoringLock, aLockData);
522 short nUserAnswer = aBox.run();
523 bOpenTemplate =
RET_YES == nUserAnswer;
525 bRetryIgnoringLock =
RET_IGNORE == nUserAnswer;
530 bRetryIgnoringLock =
false;
533 while ( !bOK && bRetryIgnoringLock );
564 aSet.
Put( *pReferer );
567 aSet.
Put( *pVersionItem );
574 aSet.
Put( *pOptions );
585 aReadOnlyUIGuard.m_bSetRO =
true;
594 aReadOnlyUIGuard.m_pMed = pMed;
620 if( pForceReloadItem && !pForceReloadItem->
GetValue() &&
628 if ( pAutoLoadItem && pAutoLoadItem->
GetValue() &&
641 if (getenv(
"SAL_NO_QUERYSAVE"))
644 && (!pSilentItem || !pSilentItem->
GetValue()))
655 std::shared_ptr<std::recursive_mutex> pChkEditMutex
657 std::unique_lock<std::recursive_mutex> chkEditLock;
658 if (pChkEditMutex !=
nullptr)
659 chkEditLock = std::unique_lock<std::recursive_mutex>(*pChkEditMutex);
672 typedef ::std::pair< Reference< XFrame >,
SfxInterfaceId > ViewDescriptor;
673 ::std::vector< ViewDescriptor > aViewFrames;
678 SAL_WARN_IF( !
xFrame.is(),
"sfx.view",
"SfxViewFrame::ExecReload_Impl: no XFrame?!");
681 pView =
GetNext( *pView, xOldObj );
686 std::optional<SfxAllItemSet> pNewSet;
687 std::shared_ptr<const SfxFilter> pFilter = pMedium->
GetFilter();
690 pNewSet.emplace( pApp->
GetPool() );
691 pNewSet->Put( *pURLItem );
696 if (refererItem !=
nullptr) {
702 pNewSet->Put(
SfxStringItem( SID_FILTER_NAME, pFilter->GetName() ) );
708 pNewSet->ClearItem( SID_VIEW_ID );
709 pNewSet->ClearItem( SID_STREAM );
710 pNewSet->ClearItem( SID_INPUTSTREAM );
714 pNewSet->Put(
SfxUInt16Item( SID_MACROEXECMODE, document::MacroExecMode::USE_CONFIG ) );
719 pNewSet->Put(
SfxBoolItem( SID_DOC_READONLY,
true ) );
722 pNewSet->ClearItem( SID_DOC_READONLY );
727 const SfxStringItem* pSalvageItem = SfxItemSet::GetItem<SfxStringItem>(&*pNewSet, SID_DOC_SALVAGE,
false);
730 pNewSet->ClearItem( SID_DOC_SALVAGE );
733#if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
747 if ( pSilentItem && pSilentItem->
GetValue() )
750 const SfxUnoAnyItem* pInteractionItem = SfxItemSet::GetItem<SfxUnoAnyItem>(&*pNewSet, SID_INTERACTIONHANDLER,
false);
751 const SfxUInt16Item* pMacroExecItem = SfxItemSet::GetItem<SfxUInt16Item>(&*pNewSet, SID_MACROEXECMODE,
false);
752 const SfxUInt16Item* pDocTemplateItem = SfxItemSet::GetItem<SfxUInt16Item>(&*pNewSet, SID_UPDATEDOCMODE,
false);
754 if (!pInteractionItem)
756 Reference < task::XInteractionHandler2 > xHdl = task::InteractionHandler::createWithParent( ::comphelper::getProcessComponentContext(),
nullptr );
758 pNewSet->Put(
SfxUnoAnyItem(SID_INTERACTIONHANDLER,css::uno::Any(xHdl)) );
762 pNewSet->Put(
SfxUInt16Item(SID_MACROEXECMODE,css::document::MacroExecMode::USE_CONFIG) );
763 if (!pDocTemplateItem)
764 pNewSet->Put(
SfxUInt16Item(SID_UPDATEDOCMODE,css::document::UpdateDocMode::ACCORDING_TO_CONFIG) );
788 uno::Sequence < beans::PropertyValue > aLoadArgs;
792 uno::Reference < frame::XLoadable > xLoad( xNewObj->
GetModel(), uno::UNO_QUERY );
793 xLoad->load( aLoadArgs );
795 catch ( uno::Exception& )
822 else if ( rReq.
GetSlot() == SID_EDITDOC || rReq.
GetSlot() == SID_READONLYDOC )
827#if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
842 OUString sReloadNotebookBar;
843 if (sModule ==
"com.sun.star.text.TextDocument")
844 sReloadNotebookBar =
u"modules/swriter/ui/";
845 else if (sModule ==
"com.sun.star.sheet.SpreadsheetDocument")
846 sReloadNotebookBar =
u"modules/scalc/ui/";
848 && sModule !=
"presentation.PresentationDocument"
849 && sModule !=
"com.sun.star.drawing.DrawingDocument")
851 assert(
false &&
"SID_RELOAD Notebookbar active, but not refreshed here");
856 for (
auto const& viewFrame : aViewFrames)
867 for (
auto const& viewFrame : aViewFrames)
869 Reference< util::XCloseable > xClose( viewFrame.first, UNO_QUERY_THROW );
870 xClose->close(
true );
876 if (pPageNumber && pPageNumber->
GetValue() >= 0)
880 xNewObj->
GetModel()->getCurrentController(), uno::UNO_QUERY);
881 uno::Reference<drawing::XDrawPagesSupplier> xSupplier(xNewObj->
GetModel(),
883 uno::Reference<drawing::XDrawPages> xDrawPages = xSupplier->getDrawPages();
884 uno::Reference<drawing::XDrawPage> xDrawPage(
885 xDrawPages->getByIndex(pPageNumber->
GetValue()), uno::UNO_QUERY);
893 if (!sReloadNotebookBar.isEmpty())
929 case SID_READONLYDOC:
948 if (nWhich==SID_EDITDOC)
950 else if (nWhich==SID_READONLYDOC)
987 case SID_CLEARHISTORY:
1037 if( !pViewSh )
return;
1090 sal_uInt16 nLevel =
m_pDispatcher->GetShellLevel( i_rViewShell );
1091 if ( nLevel != USHRT_MAX )
1126 if (
GetWindow().HasChildPathFocus(
true ) )
1137 delete pDyingViewSh;
1141 OSL_FAIL(
"No Shell");
1161 xDyingObjSh->GetNoSet_Impl().ReleaseIndex(
m_pImpl->nDocViewNo-1);
1164 xDyingObjSh->OwnerLock(
false );
1266 bool bSignPDF =
m_xObjSh->IsSignPDF();
1267 bool bSignWithCert =
false;
1272 bSignWithCert = xCertificate.is();
1276 SfxResId(bSignPDF ? STR_READONLY_PDF : STR_READONLY_DOCUMENT),
1298 bool showEditDocumentButton =
true;
1300 showEditDocumentButton =
false;
1302 if (showEditDocumentButton)
1318 uno::Reference<document::XEventsSupplier> xSupplier(
xModel, uno::UNO_QUERY);
1319 bool bHasBoundConfigEvents(
false);
1322 css::uno::Reference<css::container::XNameReplace> xDocumentEvents = xSupplier->getEvents();
1324 Sequence<OUString> eventNames = xDocumentEvents->getElementNames();
1325 sal_Int32 nEventCount = eventNames.getLength();
1326 for (sal_Int32 nEvent = 0; nEvent < nEventCount; ++nEvent)
1331 Any aAny(xDocumentEvents->getByName(eventNames[nEvent]));
1332 Sequence<beans::PropertyValue>
props;
1344 bHasBoundConfigEvents =
true;
1350 if (bHasDocumentMacros || bHasBoundConfigEvents)
1352 auto aResId = STR_CONTAINS_MACROS;
1354 aResId = STR_MACROS_DISABLED;
1356 aResId = STR_MACROS_DISABLED_CONTENT_UNSIGNED;
1366 if (bHasDocumentMacros)
1373 if (bHasBoundConfigEvents)
1384css::uno::Reference<css::frame::XLayoutManager> getLayoutManager(
const SfxFrame& rFrame)
1386 css::uno::Reference<css::frame::XLayoutManager> xLayoutManager;
1387 css::uno::Reference<css::beans::XPropertySet> xPropSet(rFrame.
GetFrameInterface(),
1393 xLayoutManager.set(xPropSet->getPropertyValue(
"LayoutManager"), uno::UNO_QUERY);
1395 catch (
const Exception& e)
1397 SAL_WARN(
"sfx.view",
"Failure getting layout manager: " + e.Message);
1400 return xLayoutManager;
1409 bool bIsUITest =
false;
1423 const bool bShowTipOfTheDay = officecfg::Office::Common::Misc::ShowTipOfTheDay::get();
1424 if (!bShowTipOfTheDay)
1427 const auto t0 = std::chrono::system_clock::now().time_since_epoch();
1430 const sal_Int32 nLastTipOfTheDay = officecfg::Office::Common::Misc::LastTipOfTheDayShown::get();
1431 const sal_Int32 nDay = std::chrono::duration_cast<std::chrono::hours>(t0).count()/24;
1432 return nDay - nLastTipOfTheDay > 0;
1446 switch ( pEventHint->GetEventId() )
1467#if !ENABLE_WASM_STRIP_PINGUSER
1492 const auto t0 = std::chrono::system_clock::now().time_since_epoch();
1493 const sal_Int64 nLastGetInvolvedShown = officecfg::Setup::Product::LastTimeGetInvolvedShown::get();
1494 const sal_Int64 nNow = std::chrono::duration_cast<std::chrono::seconds>(t0).count();
1495 const sal_Int64 nPeriodSec(60 * 60 * 24 * 180);
1496 bool bUpdateLastTimeGetInvolvedShown =
false;
1498 if (nLastGetInvolvedShown == 0)
1499 bUpdateLastTimeGetInvolvedShown =
true;
1500 else if (nPeriodSec < nNow && nLastGetInvolvedShown < (nNow + nPeriodSec/2) - nPeriodSec)
1502 bUpdateLastTimeGetInvolvedShown =
true;
1508 weld::Button& rGetInvolvedButton = pInfoBar->addButton();
1514 if (bUpdateLastTimeGetInvolvedShown
1515 && !officecfg::Setup::Product::LastTimeGetInvolvedShown::isReadOnly())
1518 officecfg::Setup::Product::LastTimeGetInvolvedShown::set(nNow, batch);
1523 const sal_Int64 nLastDonateShown = officecfg::Setup::Product::LastTimeDonateShown::get();
1524 bool bUpdateLastTimeDonateShown =
false;
1526 if (nLastDonateShown == 0)
1527 bUpdateLastTimeDonateShown =
true;
1528 else if (nPeriodSec < nNow && nLastDonateShown < nNow - nPeriodSec)
1530 bUpdateLastTimeDonateShown =
true;
1541 if (bUpdateLastTimeDonateShown
1542 && !officecfg::Setup::Product::LastTimeDonateShown::isReadOnly())
1545 officecfg::Setup::Product::LastTimeDonateShown::set(nNow, batch);
1549 if (officecfg::Office::Common::Passwords::HasMaster::get() &&
1550 officecfg::Office::Common::Passwords::StorageVersion::get() == 0)
1556 if (pOldMasterPasswordInfoBar)
1558 weld::Button& rButton = pOldMasterPasswordInfoBar->addButton();
1564 weld::Button& rHelp = pOldMasterPasswordInfoBar->addButton();
1577 !
m_xObjSh->IsSecurityOptOpenReadOnly() &&
1584 if (!bEmbedded &&
m_xObjSh->Get_Impl()->getCurrentMacroExecMode() == css::document::MacroExecMode::NEVER_EXECUTE)
1598 std::vector<InfobarData>& aPendingInfobars =
m_xObjSh->getPendingInfobars();
1599 while (!aPendingInfobars.empty())
1601 InfobarData& aInfobarData = aPendingInfobars.back();
1604 if (aInfobarData.
msId ==
"hiddentrackchanges")
1606 if (
auto xLayoutManager = getLayoutManager(
GetFrame()))
1608 if ( xLayoutManager->getElement(
CHANGES_STR).is() )
1610 aPendingInfobars.pop_back();
1619 bool bTrackChanges = aInfobarData.
msId ==
"hiddentrackchanges";
1620 if ( bTrackChanges || aInfobarData.
msId ==
"hyphenationmissing" )
1632 ? STR_TRACK_CHANGES_BUTTON
1633 : STR_HYPHENATION_BUTTON));
1653 aPendingInfobars.pop_back();
1663 switch( rHint.
GetId() )
1665 case SfxHintId::ModeChanged:
1677 bool bIsReadOnly =
m_xObjSh->IsReadOnly();
1678 if ( bWasReadOnly != bIsReadOnly )
1703 case SfxHintId::TitleChanged:
1714 case SfxHintId::DocumentRepair:
1720 case SfxHintId::Deinitializing:
1729 case SfxHintId::Dying:
1741#if !ENABLE_WASM_STRIP_PINGUSER
1760 if (m_xObjSh.is() && m_xObjSh->IsSignPDF())
1762 SfxEditDocumentDialog aDialog(&rButton);
1763 if (aDialog.run() !=
RET_OK)
1778 auto xLayoutManager = getLayoutManager(GetFrame());
1779 if (!xLayoutManager)
1782 if (!xLayoutManager->getElement(
CHANGES_STR).is())
1786 rButton.set_label(
SfxResId(STR_TRACK_CHANGES_BUTTON_HIDE));
1792 RemoveInfoBar(
u"hiddentrackchanges");
1799 RemoveInfoBar(
u"hyphenationmissing");
1807 SfxUnoFrameItem aDocFrame(SID_FILLFRAME, GetFrame().GetFrameInterface());
1809 { &aTabItem, &aCurrentDocItem }, { &aDocFrame });
1814 SfxUnoFrameItem aDocFrame(SID_FILLFRAME, GetFrame().GetFrameInterface());
1816 {}, { &aDocFrame });
1821 bool bChanged =
false;
1824 Reference< task::XPasswordContainer2 > xMasterPasswd(
1827 css::uno::Reference<css::frame::XFrame>
xFrame = GetFrame().GetFrameInterface();
1828 css::uno::Reference<css::awt::XWindow> xContainerWindow =
xFrame->getContainerWindow();
1832 bChanged = xMasterPasswd->changeMasterPassword(xTmpHandler);
1837 RemoveInfoBar(
u"oldmasterpassword");
1843 pHelp->Start(
"cui/ui/optsecuritypage/savepassword");
1848 m_pImpl->bResizeInToOut =
true;
1907 , m_nAdjustPosPixelLock( 0 )
1930 if (
GetFrame().OwnsBindings_Impl() )
1934 m_pImpl->pWindow.disposeAndClear();
1936 if (
GetFrame().GetCurrentViewFrame() ==
this )
1944 auto it = std::find( rFrames.begin(), rFrames.end(),
this );
1945 rFrames.erase( it );
1996 && ( !bOnlyIfVisible || pFrame->IsVisible() )
2021 if ( rFrames[
nPos] == &rPrev )
2029 && ( !bOnlyIfVisible || pFrame->
IsVisible() )
2047 bool inplaceEditModeChange
2052 if( pSh && pSh->GetWindow() && !m_nAdjustPosPixelLock )
2054 m_nAdjustPosPixelLock++;
2055 if (
m_pImpl->bResizeInToOut )
2056 pSh->InnerResizePixel( rPos, rSize, inplaceEditModeChange );
2058 pSh->OuterResizePixel( rPos, rSize );
2059 m_nAdjustPosPixelLock--;
2085 m_pImpl->bResizeInToOut =
false;
2090 m_pImpl->bResizeInToOut =
true;
2102 if ( bEnable ==
m_pImpl->bEnabled )
2110 if ( !bEnable ||
m_pImpl->bWindowWasEnabled )
2141 m_xObjSh->GetMedium()->GetItemSet().ClearItem( SID_HIDDEN );
2146 if ( 0 ==
m_pImpl->nDocViewNo )
2186 bool bPreview =
false;
2197 uno::Reference<frame::XFramesSupplier> xSupp(
xFrame, uno::UNO_QUERY);
2199 xSupp->setActiveFrame(uno::Reference<frame::XFrame>());
2201 css::uno::Reference< css::awt::XWindow > xContainerWindow =
xFrame->getContainerWindow();
2203 if (pWindow && pWindow->HasChildPathFocus() && bGrabFocus)
2231 Reference< XFrame >
xFrame( i_rFrame );
2232 bool bOwnFrame =
false;
2238 Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
2245 ::framework::FrameListAnalyzer aAnalyzer( xDesktop, Reference< XFrame >(), FrameAnalyzerFlags::BackingComponent );
2247 if ( aAnalyzer.m_xBackingComponent.is() )
2248 xFrame = aAnalyzer.m_xBackingComponent;
2250 catch( uno::Exception& )
2255 xFrame.set( xDesktop->findFrame(
"_blank", 0 ), UNO_SET_THROW );
2263 Sequence< PropertyValue >(),
2268 if ( bOwnFrame && !i_bHidden )
2271 Reference< XWindow > xContainerWindow(
xFrame->getContainerWindow(), UNO_SET_THROW );
2272 xContainerWindow->setVisible(
true );
2299 const Sequence< PropertyValue >& i_rLoadArgs,
const SfxInterfaceId i_nViewId,
2300 const bool i_bHidden )
2302 Reference< XModel > xDocument( i_rDoc.
GetModel(), UNO_SET_THROW );
2305 aTransformLoadArgs.
put(
"Model", xDocument );
2307 aTransformLoadArgs.
put(
"ViewId", sal_uInt16( i_nViewId ) );
2309 aTransformLoadArgs.
put(
"Hidden", i_bHidden );
2311 aTransformLoadArgs.
remove(
"Hidden" );
2313 Reference< XComponentLoader > xLoader( i_rFrame, UNO_QUERY_THROW );
2314 xLoader->loadComponentFromURL(
"private:object",
"_self", 0,
2319 "SfxViewFrame::LoadViewIntoFrame_Impl: loading an SFX doc into a frame resulted in a non-SFX view - quite impossible" );
2350 pFrameItem ? pFrameItem->
GetFrame() :
nullptr,
2352 pHiddenItem && pHiddenItem->GetValue()
2358 if ( !i_rController.is() )
2364 Reference< XModel > xDocument( i_rController->getModel() );
2370 if ( pDoc->
GetModel() == xDocument )
2391 ENSURE_OR_RETURN_VOID( pCurrentShell !=
nullptr,
"SfxViewFrame::SaveCurrentViewData_Impl: no current view shell -> no current view data!" );
2397 const sal_uInt16 nNewViewNo = rDocFactory.
GetViewNo_Impl( i_nNewViewId, 0 );
2399 if ( sCurrentViewName.isEmpty() || sNewViewName.isEmpty() )
2403 OSL_FAIL(
"SfxViewFrame::SaveCurrentViewData_Impl: views without API names? Shouldn't happen anymore?" );
2406 SAL_WARN_IF(sNewViewName == sCurrentViewName,
"sfx.view",
"SfxViewFrame::SaveCurrentViewData_Impl: suspicious: new and old view name are identical!");
2409 if ( sNewViewName !=
"PrintPreview" )
2413 Sequence< PropertyValue > aViewData;
2420 const Reference< XViewDataSupplier > xViewDataSupplier(
xController->getModel(), UNO_QUERY_THROW );
2421 const Reference< XIndexContainer > xViewData( xViewDataSupplier->getViewData(), UNO_QUERY_THROW );
2424 const sal_Int32
nCount = xViewData->getCount();
2427 const ::comphelper::NamedValueCollection aCurViewData( xViewData->getByIndex(
i) );
2428 const OUString
sViewId( aCurViewData.getOrDefault(
"ViewId", OUString() ) );
2433 if ( pViewFactory ==
nullptr )
2438 xViewData->removeByIndex(
i);
2444 xViewData->insertByIndex( 0,
Any( aViewData ) );
2471 sal_uInt16 nViewIdOrNo,
2491 OSL_PRECOND( pOldSh,
"SfxViewFrame::SwitchToViewShell_Impl: that's called *switch* (not for *initial-load*) for a reason" );
2516 Sequence< PropertyValue >(),
2530 catch (
const css::uno::Exception& )
2569 case SID_TERMINATE_INPLACEACTIVATION :
2584 const sal_uInt16 nViewId = pItem->
GetValue();
2591 case SID_VIEWSHELL0:
2592 case SID_VIEWSHELL1:
2593 case SID_VIEWSHELL2:
2594 case SID_VIEWSHELL3:
2595 case SID_VIEWSHELL4:
2597 const sal_uInt16 nViewNo = rReq.
GetSlot() - SID_VIEWSHELL0;
2608 OSL_FAIL(
"You should have disabled the 'Window/New Window' slot!" );
2623 Reference < XFrame >
xFrame;
2658 css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
2659 std::optional<sal_Int32>
x(officecfg::Office::Common::Misc::MaxOpenDocuments::get());
2663 sal_Int32 nMaxDocs(*
x);
2664 sal_Int32 nOpenDocs = 0;
2666 css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create(xContext);
2667 css::uno::Reference< css::container::XIndexAccess > xCont(xDesktop->getFrames(), css::uno::UNO_QUERY_THROW);
2669 sal_Int32 c = xCont->getCount();
2676 css::uno::Reference< css::frame::XFrame >
xFrame;
2677 xCont->getByIndex(
i) >>=
xFrame;
2682 if (
xFrame->getName() ==
"OFFICE_HELP_TASK" )
2688 catch(
const css::uno::Exception&)
2695 return (nOpenDocs >= nMaxDocs);
2723 assert(!pRanges.
empty() &&
"Set with no Range");
2724 for (
auto const & pRange : pRanges )
2726 sal_uInt16 nStartWhich = pRange.first;
2727 sal_uInt16 nEndWhich = pRange.second;
2728 for ( sal_uInt16 nWhich = nStartWhich; nWhich <= nEndWhich; ++nWhich )
2738 case SID_VIEWSHELL0:
2739 case SID_VIEWSHELL1:
2740 case SID_VIEWSHELL2:
2741 case SID_VIEWSHELL3:
2742 case SID_VIEWSHELL4:
2744 sal_uInt16 nViewNo = nWhich - SID_VIEWSHELL0;
2810 return m_xObjSh->GetMedium()->GetName();
2825 bModal = pFrame->m_pImpl->bModal;
2826 m_xObjSh->SetModalMode_Impl( bModal );
2838 if ( !bForce && aSize ==
m_pImpl->aSize )
2857#if HAVE_FEATURE_SCRIPTING
2859#define LINE_SEP 0x0A
2861static void CutLines( OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines )
2863 sal_Int32 nStartPos = 0;
2864 sal_Int32 nLine = 0;
2865 while ( nLine < nStartLine )
2867 nStartPos = rStr.indexOf( LINE_SEP, nStartPos );
2868 if( nStartPos == -1 )
2874 SAL_WARN_IF(nStartPos == -1,
"sfx.view",
"CutLines: Start row not found!");
2876 if ( nStartPos != -1 )
2878 sal_Int32 nEndPos = nStartPos;
2879 for ( sal_Int32 i = 0;
i < nLines;
i++ )
2880 nEndPos = rStr.indexOf( LINE_SEP, nEndPos+1 );
2882 if ( nEndPos == -1 )
2883 nEndPos = rStr.getLength();
2887 rStr = OUString::Concat(rStr.subView( 0, nStartPos )) + rStr.subView( nEndPos );
2890 if ( nStartPos != -1 )
2892 sal_Int32
n = nStartPos;
2893 sal_Int32 nLen = rStr.getLength();
2894 while ( ( n < nLen ) && ( rStr[ n ] == LINE_SEP ) )
2897 if ( n > nStartPos )
2898 rStr = OUString::Concat(rStr.subView( 0, nStartPos )) + rStr.subView( n );
2911#if !HAVE_FEATURE_SCRIPTING
2914 if ( sMacro.isEmpty() )
2923 css::uno::Reference< css::frame::XFrame >
xFrame =
2930 OUString aScriptURL;
2933 if ( !aScriptURL.isEmpty() )
2937 OUString aModuleName;
2938 OUString aMacroName;
2940 Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
2941 Reference< css::uri::XUriReferenceFactory >
xFactory =
2942 css::uri::UriReferenceFactory::create( xContext );
2943 Reference< css::uri::XVndSunStarScriptUrl > xUrl(
xFactory->parse( aScriptURL ), UNO_QUERY );
2947 const OUString
aName = xUrl->getName();
2957 aLocation = xUrl->getParameter(
"location" );
2961 if ( aLocation ==
"application" )
2966 else if ( aLocation ==
"document" )
2978 SbMethod* pMethod = pModule ? pModule->
FindMethod(aMacroName, SbxClassType::Method) :
nullptr;
2982 sal_uInt16 nStart, nEnd;
2984 sal_uInt16 nlStart = nStart;
2985 sal_uInt16 nlEnd = nEnd;
2986 CutLines( aOUSource, nlStart-1, nlEnd-nlStart+1 );
2992 css::uno::Reference< css::script::XLibraryContainer > xLibCont;
2993 if ( aLocation ==
"application" )
2997 else if ( aLocation ==
"document" )
3004 SAL_WARN(
"sfx.view",
"couldn't get access to the basic lib container. Adding of macro isn't possible.");
3009 css::uno::Any aTemp;
3011 css::uno::Reference< css::container::XNameAccess > xLib;
3012 if(xLibCont->hasByName(aLibName))
3015 aTemp = xLibCont->getByName(aLibName);
3016 xLibCont->loadLibrary(aLibName);
3021 xLib = xLibCont->createLibrary(aLibName);
3025 OUStringBuffer sRoutine(10000);
3026 bool bReplace =
false;
3029 if(xLib->hasByName(aModuleName))
3031 if ( !aOUSource.isEmpty() )
3033 sRoutine.append( aOUSource );
3038 aTemp = xLib->getByName(aModuleName);
3040 sRoutine.append( sCode );
3047 sRoutine.append(
"\nsub "
3054 aTemp <<= sRoutine.makeStringAndClear();
3057 css::uno::Reference< css::container::XNameContainer > xModulCont(
3059 css::uno::UNO_QUERY);
3060 xModulCont->replaceByName(aModuleName,aTemp);
3064 css::uno::Reference< css::container::XNameContainer > xModulCont(
3066 css::uno::UNO_QUERY);
3067 xModulCont->insertByName(aModuleName,aTemp);
3073 if ( pViewShell->GetName() ==
"BasicIDE" )
3079 SfxMacroInfoItem aInfoItem( SID_BASICIDE_ARG_MACROINFO, pBasMgr, aLibName, aModuleName, OUString(), OUString() );
3080 pDispat->
ExecuteList(SID_BASICIDE_UPDATEMODULESOURCE,
3097 case SID_STOP_RECORDING :
3098 case SID_RECORDMACRO :
3101 static constexpr OUStringLiteral sProperty(
u"DispatchRecorderSupplier");
3102 css::uno::Reference< css::frame::XFrame >
xFrame =
3105 css::uno::Reference< css::beans::XPropertySet > xSet(
xFrame,css::uno::UNO_QUERY);
3106 css::uno::Any aProp = xSet->getPropertyValue(sProperty);
3107 css::uno::Reference< css::frame::XDispatchRecorderSupplier > xSupplier;
3108 aProp >>= xSupplier;
3109 css::uno::Reference< css::frame::XDispatchRecorder > xRecorder;
3111 xRecorder = xSupplier->getDispatchRecorder();
3113 bool bIsRecording = xRecorder.is();
3115 if ( pItem && pItem->
GetValue() == bIsRecording )
3118 if ( xRecorder.is() )
3121 aProp <<= css::uno::Reference< css::frame::XDispatchRecorderSupplier >();
3122 xSet->setPropertyValue(sProperty,aProp);
3125 if ( !pRecordItem || !pRecordItem->
GetValue() )
3129 xRecorder->endRecording();
3130 xRecorder =
nullptr;
3134 if ( rReq.
GetSlot() != SID_RECORDMACRO )
3137 else if ( rReq.
GetSlot() == SID_RECORDMACRO )
3140 css::uno::Reference< css::uno::XComponentContext > xContext(
3141 ::comphelper::getProcessComponentContext());
3143 xRecorder = css::frame::DispatchRecorder::create( xContext );
3145 xSupplier = css::frame::DispatchRecorderSupplier::create( xContext );
3147 xSupplier->setDispatchRecorder(xRecorder);
3148 xRecorder->startRecording(
xFrame);
3149 aProp <<= xSupplier;
3150 xSet->setPropertyValue(sProperty,aProp);
3159 case SID_TOGGLESTATUSBAR:
3161 if (
auto xLayoutManager = getLayoutManager(
GetFrame()) )
3163 static constexpr OUStringLiteral aStatusbarResString(
u"private:resource/statusbar/statusbar" );
3168 bShow = xLayoutManager->isElementVisible( aStatusbarResString );
3174 xLayoutManager->createElement( aStatusbarResString );
3175 xLayoutManager->showElement( aStatusbarResString );
3178 xLayoutManager->hideElement( aStatusbarResString );
3186 case SID_COMMAND_POPUP:
3195 case SID_WIN_FULLSCREEN:
3204 Reference< css::frame::XLayoutManager > xLayoutManager = getLayoutManager(
GetFrame());
3208 if ( bNewFullScreenMode )
3213 Reference< css::beans::XPropertySet > xLMPropSet( xLayoutManager, UNO_QUERY );
3214 if ( xLMPropSet.is() )
3218 xLMPropSet->setPropertyValue(
3220 Any( bNewFullScreenMode ));
3222 catch ( css::beans::UnknownPropertyException& )
3227 pWork->
SetMenuBarMode( bNewFullScreenMode ? MenuBarMode::Hide : MenuBarMode::Normal );
3250 for (
auto const & pRange : pRanges )
3252 for(sal_uInt16 nWhich = pRange.first; nWhich <= pRange.second; ++nWhich)
3256 case SID_CURRENT_URL:
3262 case SID_RECORDMACRO :
3265 bool bMacrosDisabled = officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get();
3266 if (bMacrosDisabled ||
3267 !officecfg::Office::Common::Misc::MacroRecorderMode::get() ||
3275 css::uno::Reference< css::beans::XPropertySet > xSet(
3277 css::uno::UNO_QUERY);
3279 css::uno::Any aProp = xSet->getPropertyValue(
"DispatchRecorderSupplier");
3280 css::uno::Reference< css::frame::XDispatchRecorderSupplier > xSupplier;
3281 if ( aProp >>= xSupplier )
3288 case SID_STOP_RECORDING :
3291 if ( !officecfg::Office::Common::Misc::MacroRecorderMode::get() ||
3298 css::uno::Reference< css::beans::XPropertySet > xSet(
3300 css::uno::UNO_QUERY);
3302 css::uno::Any aProp = xSet->getPropertyValue(
"DispatchRecorderSupplier");
3303 css::uno::Reference< css::frame::XDispatchRecorderSupplier > xSupplier;
3304 if ( !(aProp >>= xSupplier) || !xSupplier.is() )
3309 case SID_TOGGLESTATUSBAR:
3311 css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
3312 css::uno::Reference< css::beans::XPropertySet > xSet(
3314 css::uno::UNO_QUERY);
3315 css::uno::Any aProp = xSet->getPropertyValue(
"LayoutManager" );
3317 if ( !( aProp >>= xLayoutManager ))
3321 bool bShow = xLayoutManager->isElementVisible(
"private:resource/statusbar/statusbar" );
3327 case SID_WIN_FULLSCREEN:
3361 sal_uInt16 nSID = rReq.
GetSlot();
3363 if (nSID == SID_SIDEBAR_DECK)
3368 const OUString aDeckId(pDeckIdItem->
GetValue());
3370 bool bToggle = pToggleItem && pToggleItem->
GetValue();
3378 if ( nSID == SID_VIEW_DATA_SOURCE_BROWSER )
3383 Reference < XFrame > xBeamer(
xFrame->findFrame(
"_beamer", FrameSearchFlag::CHILDREN ) );
3384 bool bHasChild = xBeamer.is();
3385 bool bShow = pShowItem ? pShowItem->
GetValue() : !bHasChild;
3388 if( bShow == bHasChild )
3401 aTargetURL.Complete =
".component:DB/DataSourceBrowser";
3402 Reference < css::util::XURLTransformer > xTrans(
3403 css::util::URLTransformer::create(
3404 ::comphelper::getProcessComponentContext() ) );
3407 Reference < XDispatchProvider > xProv(
xFrame, UNO_QUERY );
3408 Reference < css::frame::XDispatch > xDisp;
3410 xDisp = xProv->queryDispatch(
aTargetURL,
"_beamer", 31 );
3413 Sequence < css::beans::PropertyValue > aArgs(1);
3414 css::beans::PropertyValue* pArg = aArgs.getArray();
3415 pArg[0].Name =
"Referer";
3416 pArg[0].Value <<= OUString(
"private:user");
3424 if (nSID == SID_STYLE_DESIGNER)
3430 GetFrame().GetFrameInterface(),
true);
3434 if (nSID == SID_NAVIGATOR)
3446 bool bShow = pShowItem ? pShowItem->
GetValue() : !bHasChild;
3450 if ( !pShowItem || bShow != bHasChild )
3456 if ( nSID == SID_HYPERLINK_DIALOG || nSID == SID_SEARCH_DLG )
3479 if ( nSID == SID_VIEW_DATA_SOURCE_BROWSER )
3483 else if ( nSID == SID_HYPERLINK_DIALOG )
3487 if ( SfxItemState::DISABLED == eState )
3497 else if ( nSID == SID_BROWSER )
3500 findFrame(
"_beamer", FrameSearchFlag::CHILDREN );
3506 else if ( nSID == SID_SIDEBAR )
3510 SAL_INFO(
"sfx.view",
"SID_SIDEBAR state requested, but no task pane child window exists for this ID!");
3594 const OUString& sPrimaryMessage,
3595 const OUString& sSecondaryMessage,
3606 auto pInfoBar = pInfoBarContainer->
appendInfoBar(
sId, sPrimaryMessage, sSecondaryMessage,
3607 aInfobarType, bShowCloseButton);
3613 const OUString& sSecondaryMessage,
InfobarType eType)
3615 const sal_uInt16
nId = SfxInfoBarContainerChild::GetChildWindowId();
3628 pInfoBar->Update(sPrimaryMessage, sSecondaryMessage,
eType);
3634 const sal_uInt16
nId = SfxInfoBarContainerChild::GetChildWindowId();
3652 const sal_uInt16
nId = SfxInfoBarContainerChild::GetChildWindowId();
SfxApplication * SfxGetpApp()
constexpr OUStringLiteral sViewId
void TransformItems(sal_uInt16 nSlotId, const SfxItemSet &rSet, uno::Sequence< beans::PropertyValue > &rArgs, const SfxSlot *pSlot)
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 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()
OUString msPrimaryMessage
InfobarType maInfobarType
OUString msSecondaryMessage
void GetLineRange(sal_uInt16 &, sal_uInt16 &)
SbMethod * FindMethod(const OUString &, SbxClassType)
const OUString & GetSource32() const
SfxViewFrame * pViewFrame
SAL_DLLPRIVATE SfxAppData_Impl * Get_Impl() const
SAL_DLLPRIVATE void SetViewFrame_Impl(SfxViewFrame *pViewFrame)
static SfxApplication * Get()
css::script::XLibraryContainer * GetBasicContainer()
SAL_DLLPRIVATE std::vector< SfxViewFrame * > & GetViewFrames_Impl() const
static bool IsHeadlessOrUITest()
if true then dialog/infobar notifications like the tip of the day or version change infobar should be...
static BasicManager * GetBasicManager()
void NotifyEvent(const SfxEventHint &rEvent, bool bSynchron=true)
static bool IsTipOfTheDayDue()
void Invalidate(sal_uInt16 nId)
SAL_DLLPRIVATE void SetRecorder_Impl(css::uno::Reference< css::frame::XDispatchRecorder > const &)
void SetActiveFrame(const css::uno::Reference< css::frame::XFrame > &rFrame)
void SetDispatcher(SfxDispatcher *pDisp)
void InvalidateAll(bool bWithMsg)
void Broadcast(const SfxHint &rHint)
vcl::Window * GetWindow() const
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)
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.
SAL_DLLPRIVATE void SetQuietMode_Impl(bool bOn)
With 'bOn' the Dispatcher is quasi dead and transfers everything to the Parent-Dispatcher.
SfxBindings * GetBindings() const
This method returns a pointer to the <SfxBinding> Instance on which the SfxDispatcher is currently bo...
void SetDisableFlags(SfxDisableFlags nFlags)
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.
SAL_DLLPRIVATE bool IsUpdated_Impl() const
SAL_DLLPRIVATE void SetReadOnly_Impl(bool bOn)
void Lock(bool bLock)
With this method the SfxDispatcher can be locked and released.
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...
SAL_DLLPRIVATE bool GetReadOnly_Impl() const
SfxItemState QueryState(sal_uInt16 nSID, const SfxPoolItem *&rpState)
ErrCode GuessFilter(SfxMedium &rMedium, std::shared_ptr< const SfxFilter > &, SfxFilterFlags nMust=SfxFilterFlags::IMPORT, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
SfxFrame * GetFrame() const
SAL_DLLPRIVATE void SetOwnsBindings_Impl(bool bSet)
SAL_DLLPRIVATE void GetViewData_Impl()
SAL_DLLPRIVATE void CreateWorkWindow_Impl()
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
SAL_DLLPRIVATE void GrabFocusOnComponent_Impl()
SAL_DLLPRIVATE SystemWindow * GetTopWindow_Impl() const
SAL_DLLPRIVATE void SetHasTitle(bool)
SAL_DLLPRIVATE void ReleasingComponent_Impl()
SAL_DLLPRIVATE bool DocIsModified_Impl()
SAL_DLLPRIVATE SfxWorkWindow * GetWorkWindow_Impl() const
SAL_DLLPRIVATE bool IsAutoLoadLocked_Impl() const
SAL_DLLPRIVATE void SetCurrentViewFrame_Impl(SfxViewFrame *)
vcl::Window & GetWindow() const
SAL_WARN_UNUSED_RESULT SfxViewFrame * GetCurrentViewFrame() const
bool IsObjectUIActive() const
VclPtr< SfxInfoBarWindow > appendInfoBar(const OUString &sId, const OUString &sPrimaryMessage, const OUString &sSecondaryMessage, InfobarType ibType, bool bShowCloseButton)
bool hasInfoBarWithID(std::u16string_view sId)
void removeInfoBar(VclPtr< SfxInfoBarWindow > const &pInfoBar)
VclPtr< SfxInfoBarWindow > getInfoBar(std::u16string_view sId)
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)
void SetOpenMode(StreamMode nStorOpen, bool bDontClose=false)
const std::shared_ptr< const SfxFilter > & GetFilter() const
const INetURLObject & GetURLObject() const
SfxItemSet & GetItemSet() const
LockFileResult LockOrigFileOnDemand(bool bLoading, bool bNoUI, bool bTryIgnoreLockFile=false, LockFileEntry *pLockData=nullptr)
ErrCode GetErrorCode() const
static sal_uInt32 CreatePasswordToModifyHash(std::u16string_view aPasswd, bool bWriter)
const OUString & GetOrigURL() const
const OUString & GetName() const
const std::shared_ptr< std::recursive_mutex > & GetCheckEditableMutex() const
void CancelCheckEditableEntry(bool bRemoveEvent=true)
SAL_DLLPRIVATE bool HasStorage_Impl() const
css::uno::Reference< css::embed::XStorage > GetStorage(bool bCreateTempFile=true)
void AddToCheckEditableWorkerList()
const OUString & GetPhysicalName() const
css::uno::Reference< css::task::XInteractionHandler > GetInteractionHandler(bool bGetAlways=false)
const OUString & GetFactoryName() const
SfxViewFactory * GetViewFactoryByViewName(std::u16string_view i_rViewName) const
returns the view factory whose GetAPIViewName or GetLegacyViewName delivers the requested logical nam...
SfxViewFactory & GetViewFactory(sal_uInt16 i=0) const
SAL_DLLPRIVATE sal_uInt16 GetViewNo_Impl(const SfxInterfaceId i_nViewId, const sal_uInt16 i_nFallback) const
static SfxObjectShell * CreateObject(const OUString &rServiceName, SfxObjectCreateMode=SfxObjectCreateMode::STANDARD)
SAL_DLLPRIVATE void SetModifyPasswordEntered(bool bEntered=true)
bool IsOriginallyReadOnlyMedium() const
bool isEditDocLocked() const
virtual bool PrepareClose(bool bUI=true)
virtual void CancelTransfers()
css::uno::Reference< css::script::XLibraryContainer > GetBasicContainer()
SAL_DLLPRIVATE void SetNamedVisibility_Impl()
virtual bool DoSaveCompleted(SfxMedium *pNewStor=nullptr, bool bRegisterRecent=true)
virtual SfxObjectShell * GetObjectShell() override
SAL_DLLPRIVATE bool CanReload_Impl()
bool IsInModalMode() const
bool IsLoadingFinished() const
bool IsReadOnlyMedium() const
OUString GetSharedFileURL() const
sal_uInt32 GetModifyPasswordHash() const
SfxProgress * GetProgress() const
BasicManager * GetBasicManager() const
bool IsEnableSetModified() const
static SAL_WARN_UNUSED_RESULT SfxObjectShell * GetNext(const SfxObjectShell &rPrev, const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
virtual SfxObjectFactory & GetFactory() const =0
bool IsOriginallyLoadedReadOnlyMedium() const
bool IsReadOnlyUI() const
SAL_DLLPRIVATE SfxObjectShell_Impl * Get_Impl()
SfxMedium * GetMedium() const
void SetReadOnlyUI(bool bReadOnly=true)
SAL_DLLPRIVATE void CheckSecurityOnLoading_Impl()
css::uno::Reference< css::frame::XModel3 > GetModel() const
css::uno::Reference< css::embed::XStorage > const & GetStorage()
SAL_DLLPRIVATE void UpdateFromTemplate_Impl()
void EnableSetModified(bool bEnable=true)
SAL_DLLPRIVATE IndexBitSet & GetNoSet_Impl()
css::uno::Reference< css::security::XCertificate > GetSignPDFCertificate() const
Gets the certificate that is already picked by the user but not yet used for signing.
static SAL_WARN_UNUSED_RESULT SfxObjectShell * GetFirst(const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
SfxObjectCreateMode GetCreateMode() const
SAL_DLLPRIVATE bool IsModifyPasswordEntered() const
const css::uno::Sequence< css::beans::PropertyValue > & GetModifyPasswordInfo() const
SAL_DLLPRIVATE bool ConnectTmpStorage_Impl(const css::uno::Reference< css::embed::XStorage > &xStorage, SfxMedium *pMedium)
SAL_DLLPRIVATE void DoNotCleanShareControlFile()
virtual void SetModified(bool bModified=true)
virtual bool operator==(const SfxPoolItem &) const=0
sal_uInt16 GetSlot() const
const SfxItemSet * GetArgs() const
const T * GetArg(sal_uInt16 nSlotId) const
Templatized access to the individual parameters of the SfxRequest.
void AppendItem(const SfxPoolItem &)
void SetReturnValue(const SfxPoolItem &)
void SetInternalArgs_Impl(const SfxAllItemSet &rArgs)
void Done(bool bRemove=false)
The class SfxShell is the base class for all classes, which provide the functionality of the form <Sl...
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.
SfxItemPool & GetPool() const
Each Subclass of SfxShell must reference a pool.
void SetViewShell_Impl(SfxViewShell *pView)
SfxRepeatTarget * GetRepeatTarget() const
Returns a pointer to the <SfxRepeatTarget> instance that is used in SID_REPEAT as repeat target when ...
virtual bool IsDesignMode() const
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
This method allows you to forward a <SfxRequest> to the specified base <SfxShell>.
virtual SfxUndoManager * GetUndoManager()
Each Subclass of SfxShell can have a <SfxUndoManager>.
SfxViewShell * GetViewShell() const
Returns the SfxViewShell in which they are located in the subshells.
void SetPool(SfxItemPool *pNewPool)
With this method, the subclasses register their special <SfxItemPool> in the SfxShell.
virtual ViewShellId GetViewShellId() const
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 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
OUString GetAPIViewName() const
returns an API-compatible view name.
SfxInterfaceId GetOrdinal() const
virtual bool operator==(const SfxPoolItem &) const override
virtual SfxViewFrameItem * Clone(SfxItemPool *pPool=nullptr) const override
SfxViewFrameItem(SfxViewFrame *pViewFrame)
void LockAdjustPosSizePixel()
ImplSVHelpData * m_pHelpData
SAL_DLLPRIVATE const SvBorder & GetBorderPixelImpl() const
SAL_DLLPRIVATE void InvalidateBorderImpl(const SfxViewShell *pSh)
SfxViewFrame(SfxFrame &rFrame, SfxObjectShell *pDoc)
SAL_DLLPRIVATE void StateHistory_Impl(SfxItemSet &rSet)
SAL_DLLPRIVATE void UpdateDocument_Impl()
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
SAL_DLLPRIVATE void SaveCurrentViewData_Impl(const SfxInterfaceId i_nNewViewId)
void DoDeactivate(bool bMDI, SfxViewFrame const *pOld)
void ToggleChildWindow(sal_uInt16)
static SfxViewFrame * LoadDocument(SfxObjectShell const &i_rDoc, SfxInterfaceId i_nViewId)
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Current()
void RemoveInfoBar(std::u16string_view sId)
SAL_DLLPRIVATE bool SwitchToViewShell_Impl(sal_uInt16 nNo, bool bIsIndex=false)
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
vcl::Window & GetWindow() const
void ExecReload_Impl(SfxRequest &rReq)
SAL_DLLPRIVATE void SetViewShell_Impl(SfxViewShell *pVSh)
SAL_DLLPRIVATE void KillDispatcher_Impl()
bool IsInModalMode() const
SAL_DLLPRIVATE void GetDocNumber_Impl()
SfxBindings & GetBindings()
SAL_DLLPRIVATE void LockObjectShell_Impl()
SAL_DLLPRIVATE void SetBorderPixelImpl(const SfxViewShell *pSh, const SvBorder &rBorder)
static SfxViewFrame * LoadDocumentIntoFrame(SfxObjectShell const &i_rDoc, const SfxFrameItem *i_pFrameItem, SfxInterfaceId i_nViewId)
SAL_DLLPRIVATE void StateView_Impl(SfxItemSet &rSet)
bool HasChildWindow(sal_uInt16)
void Resize(bool bForce=false)
void AppendReadOnlyInfobar()
SfxProgress * GetProgress() const
SfxInterfaceId GetCurViewId() const
void SetChildWindow(sal_uInt16 nId, bool bVisible, bool bSetFocus=true)
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetNext(const SfxViewFrame &rPrev, const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
SfxDispatcher * GetDispatcher()
std::unique_ptr< CommandPopupHandler > m_pCommandPopupHandler
SAL_DLLPRIVATE void ExecHistory_Impl(SfxRequest &rReq)
SfxViewFrame * GetTopViewFrame() const
SfxChildWindow * GetChildWindow(sal_uInt16)
SAL_DLLPRIVATE SfxWorkWindow * GetWorkWindow_Impl()
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
SAL_DLLPRIVATE void AddDispatchMacroToBasic_Impl(const OUString &sMacro)
void DoActivate(bool bMDI)
SAL_DLLPRIVATE void ReleaseObjectShell_Impl()
SfxFrame & GetFrame() const
virtual SfxObjectShell * GetObjectShell() override
SAL_DLLPRIVATE OUString GetActualPresentationURL_Impl() const
weld::Window * GetFrameWeld() const
SAL_DLLPRIVATE void MiscExec_Impl(SfxRequest &)
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Get(const css::uno::Reference< css::frame::XController > &i_rController, const SfxObjectShell *i_pDoc)
sal_uInt16 m_nAdjustPosPixelLock
SAL_DLLPRIVATE void MiscState_Impl(SfxItemSet &)
bool HasInfoBarWithID(std::u16string_view sId)
virtual ~SfxViewFrame() override
bool KnowsChildWindow(sal_uInt16)
SAL_DLLPRIVATE void ForceOuterResize_Impl()
SAL_DLLPRIVATE void PopShellAndSubShells_Impl(SfxViewShell &i_rViewShell)
SAL_DLLPRIVATE const Size & GetMargin_Impl() const
void DoAdjustPosSizePixel(SfxViewShell *pSh, const Point &rPos, const Size &rSize, bool inplaceEditModeChange)
divide on Inner.../Outer...
SfxObjectShellRef m_xObjSh
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).
SAL_DLLPRIVATE void StateReload_Impl(SfxItemSet &rSet)
void ChildWindowState(SfxItemSet &)
static SfxViewFrame * LoadHiddenDocument(SfxObjectShell const &i_rDoc, SfxInterfaceId i_nViewId)
void AppendContainsMacrosInfobar()
std::unique_ptr< SfxDispatcher > m_pDispatcher
SAL_DLLPRIVATE void Construct_Impl(SfxObjectShell *pObjSh)
void Enable(bool bEnable)
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
SAL_DLLPRIVATE void MakeActive_Impl(bool bActivate)
static SfxViewFrame * DisplayNewDocument(SfxObjectShell const &i_rDoc, const SfxRequest &i_rCreateDocRequest)
void ShowChildWindow(sal_uInt16, bool bVisible=true)
static void SetViewFrame(SfxViewFrame *)
ImplSVWinData * m_pWinData
SAL_DLLPRIVATE void SetCurViewId_Impl(const SfxInterfaceId i_nID)
SAL_DLLPRIVATE void ExecView_Impl(SfxRequest &rReq)
void ChildWindowExecute(SfxRequest &)
void UnlockAdjustPosSizePixel()
std::unique_ptr< struct SfxViewFrame_Impl > m_pImpl
void UpdateInfoBar(std::u16string_view sId, const OUString &sPrimaryMessage, const OUString &sSecondaryMessage, InfobarType eType)
One SfxViewShell more or less represents one edit window for a document, there can be multiple ones f...
virtual bool PrepareClose(bool bUI=true)
Initialize is called after the frame has been loaded and the controller has been set.
SfxInPlaceClient * GetUIActiveClient() const
css::uno::Reference< css::frame::XController > GetController() const
virtual void ShowCursor(bool bOn=true)
void DisconnectAllClients()
ViewShellId GetViewShellId() const override
See OutlinerViewShell::GetViewShellId().
SfxViewFrame & GetViewFrame() const
static SAL_WARN_UNUSED_RESULT SfxViewShell * Get(const css::uno::Reference< css::frame::XController > &i_rController)
SAL_DLLPRIVATE void PopSubShells_Impl()
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
virtual void WriteUserDataSequence(css::uno::Sequence< css::beans::PropertyValue > &)
virtual ErrCode DoVerb(sal_Int32 nVerb)
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
virtual SfxObjectShell * GetObjectShell() override
virtual SfxShell * GetFormShell()
vcl::Window * GetWindow() const
bool HasChildWindow_Impl(sal_uInt16)
bool KnowsChildWindow_Impl(sal_uInt16)
void SetChildWindow_Impl(sal_uInt16, bool bOn, bool bSetFocus)
void ShowChildWindow_Impl(sal_uInt16, bool bVisible, bool bSetFocus)
SfxChildWindow * GetChildWindow_Impl(sal_uInt16)
void SetFullScreen_Impl(bool bSet)
void ToggleChildWindow_Impl(sal_uInt16, bool)
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)
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 bool IsActive(bool bConsiderSingleToolbar=false)
vcl::Window * GetParent() const
bool IsInputEnabled() const
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)
#define DBG_ASSERT(sCon, aError)
#define ENSURE_OR_THROW(c, m)
#define DBG_UNHANDLED_EXCEPTION(...)
#define ENSURE_OR_RETURN_VOID(c, m)
#define ERRCODE_IO_ACCESSDENIED
Reference< XSingleServiceFactory > xFactory
#define LINK(Instance, Class, Member)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
def run(arg=None, arg2=-1)
SfxDispatcher * GetDispatcher()
void CutLines(OUString &rStr, sal_Int32 nStartLine, sal_Int32 nLines)
Reference< XComponentContext > getProcessComponentContext()
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
#define SFX_OBJECTBAR_FULLSCREEN
#define SFX_STREAM_READONLY
#define SFX_STREAM_READWRITE
OUString SfxResId(TranslateId aId)
#define SFX_IMPL_SUPERCLASS_INTERFACE(Class, SuperClass)
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...
constexpr auto SFX_INTERFACE_NONE
OUString VCL_DLLPUBLIC GetStandardText(StandardButtonType eButton)
::sfx2::DocumentMacroMode aMacroMode
std::unique_ptr< AutoReloadTimer_Impl > pReloadTimer
SfxLoadedFlags nLoadedFlags
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)
constexpr OUStringLiteral CHANGES_STR
static bool impl_maxOpenDocCountReached()
IMPL_LINK_NOARG(SfxViewFrame, WhatsNewHandler, weld::Button &, void)
IMPL_LINK(SfxViewFrame, SwitchReadOnlyHandler, weld::Button &, rButton, void)
IMPL_STATIC_LINK_NOARG(SfxViewFrame, HelpMasterPasswordHdl, weld::Button &, void)