20#include <config_features.h>
22#include <osl/diagnose.h>
23#include <com/sun/star/drawing/ModuleDispatcher.hpp>
24#include <com/sun/star/frame/DispatchHelper.hpp>
25#include <ooo/vba/word/XDocument.hpp>
53#include <svx/dialogs.hrc>
102#include <strings.hrc>
103#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
104#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
105#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
106#include <com/sun/star/ui/dialogs/ListboxControlActions.hpp>
107#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
108#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
109#include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
110#include <com/sun/star/script/vba/VBAEventId.hpp>
112#include <officecfg/Office/Security.hxx>
113#include <officecfg/Office/Common.hxx>
131using namespace ::
sfx2;
136 std::shared_ptr<SfxDocumentInfoDialog> xDlg = std::make_shared<SfxDocumentInfoDialog>(pParent,
rSet);
144 if ( pVSh &&
dynamic_cast< const SwSrcView *
>( pVSh ) ==
nullptr )
147 xDlg->AddFontTabPage();
156 OSL_ENSURE( pView,
"SwDocShell::ToggleLayoutMode, pView is null." );
193 bool bUnlockView(
true);
215 using namespace com::sun::star::script::vba::VBAEventId;
217 if ( !pSfxEventHint )
220 uno::Sequence< uno::Any > aArgs;
223 case SfxEventHintId::CreateDoc:
224 xVbaEvents->processVbaEvent(AUTO_NEW, aArgs);
225 xVbaEvents->processVbaEvent(DOCUMENT_NEW, aArgs);
227 case SfxEventHintId::OpenDoc:
228 xVbaEvents->processVbaEvent(AUTO_OPEN, aArgs);
229 xVbaEvents->processVbaEvent(DOCUMENT_OPEN, aArgs);
243 uno::Reference< script::vba::XVBAEventProcessor >
const xVbaEvents =
244 m_xDoc->GetVbaEventProcessor();
245 if( xVbaEvents.is() )
250 switch( pSfxEventHint->GetEventId() )
252 case SfxEventHintId::ActivateDoc:
253 case SfxEventHintId::CreateDoc:
254 case SfxEventHintId::OpenDoc:
256 uno::Sequence< css::uno::Any > aArgs;
257 SW_MOD()->CallAutomationApplicationEventSinks(
"DocumentChange", aArgs );
264 switch( pSfxEventHint->GetEventId() )
266 case SfxEventHintId::CreateDoc:
270 uno::Sequence< uno::Any > aArgs{
aDocument };
271 SW_MOD()->CallAutomationApplicationEventSinks(
"NewDocument", aArgs );
274 case SfxEventHintId::OpenDoc:
278 uno::Sequence< uno::Any > aArgs{
aDocument };
279 SW_MOD()->CallAutomationApplicationEventSinks(
"DocumentOpen", aArgs );
287 sal_uInt16 nAction = 0;
288 auto pEventHint =
dynamic_cast<const SfxEventHint*
>(&rHint);
289 if( pEventHint && pEventHint->GetEventId() == SfxEventHintId::LoadFinished )
297 if( rHint.
GetId() == SfxHintId::TitleChanged)
307 bool bUnlockView =
true;
327 if ( bResetModified )
330 const bool bIsDocModified =
m_xDoc->getIDocumentState().IsModified();
333 m_xDoc->getIDocumentStatistics().DocInfoChgd(
false);
336 if ( !bIsDocModified )
337 m_xDoc->getIDocumentState().ResetModified();
338 if ( bResetModified )
364 uno::Sequence<uno::Any> aArgs{
370 SW_MOD()->CallAutomationApplicationEventSinks(
"DocumentBeforeClose", aArgs );
374 aArgs[1] >>= bCancel;
384 uno::Reference< script::vba::XVBAEventProcessor >
const xVbaEvents =
385 m_xDoc->GetVbaEventProcessor();
386 if( xVbaEvents.is() )
388 using namespace com::sun::star::script::vba::VBAEventId;
389 uno::Sequence< uno::Any > aNoArgs;
390 xVbaEvents->processVbaEvent(AUTO_CLOSE, aNoArgs);
391 xVbaEvents->processVbaEvent(DOCUMENT_CLOSE, aNoArgs);
401 sal_uInt16 nWhich = rReq.
GetSlot();
405 case SID_AUTO_CORRECT_DLG:
419 SfxRequest aAppReq(SID_AUTO_CORRECT_DLG, SfxCallMode::SYNCHRON, pApp->
GetPool());
420 SfxBoolItem aSwOptions( SID_AUTO_CORRECT_DLG,
true );
426 aSet.
Put( aSwOptions );
428 const SfxBoolItem* pOpenSmartTagOptionsItem =
nullptr;
429 if( pArgs && (pOpenSmartTagOptionsItem = pArgs->
GetItemIfSet( SID_OPEN_SMARTTAGOPTIONS,
false )) )
430 aSet.
Put( *pOpenSmartTagOptionsItem );
450 if( !bOldAutoCmpltCollectWords && bOldAutoCmpltCollectWords !=
459 SwDoc* pTmp = pDocSh->GetDoc();
467 case SID_PRINTPREVIEW:
470 bool bFound =
false, bOnly =
true;
473 SwView* pCurrView =
dynamic_cast< SwView *
> ( pViewShell );
474 bool bCurrent = isType<SwPagePreview>( pViewShell );
480 else if( isType<SwPagePreview>( pTmpFrame->
GetViewShell()))
485 if( bFound && !bOnly )
490 if( pArgs && SfxItemState::SET ==
496 sal_uInt16 nSlotId = 0;
497 if( bSet && !bFound )
498 nSlotId = SID_VIEWSHELL1;
499 else if( bFound && !bSet )
500 nSlotId = bOnly ? SID_VIEWSHELL0 : SID_VIEWSHELL1;
506 if(
dynamic_cast< const SwWebDocShell *
>(
this ) !=
nullptr && SID_VIEWSHELL1 == nSlotId )
507 nSlotId = SID_VIEWSHELL2;
509 if( pCurrView && pCurrView->
GetDocShell() == this )
521 case SID_TEMPLATE_LOAD:
524 static bool bText =
true;
525 static bool bFrame =
false;
526 static bool bPage =
false;
527 static bool bNum =
false;
528 static bool bMerge =
false;
530 SfxTemplateFlags nFlags = bFrame ? SfxTemplateFlags::LOAD_FRAME_STYLES : SfxTemplateFlags::NONE;
532 nFlags |= SfxTemplateFlags::LOAD_PAGE_STYLES;
534 nFlags |= SfxTemplateFlags::LOAD_NUM_STYLES;
535 if(nFlags == SfxTemplateFlags::NONE || bText)
536 nFlags |= SfxTemplateFlags::LOAD_TEXT_STYLES;
538 nFlags |= SfxTemplateFlags::MERGE_STYLES;
545 aFileName = pTemplateItem->
GetValue();
552 if ( aFileName.isEmpty() )
557 sal_uInt16 nRet = aNewFileDlg.run();
560 FileDialogHelper aDlgHelper(TemplateDescription::FILEOPEN_SIMPLE,
562 aDlgHelper.SetContext(FileDialogHelper::WriterLoadTemplate);
563 uno::Reference < XFilePicker3 > xFP = aDlgHelper.GetFilePicker();
568 std::shared_ptr<const SfxFilter> pFlt = aIter.
First();
572 if( pFlt && pFlt->IsAllowedAsTemplate() &&
573 ( pFlt->GetUserData() ==
"CXML" ||
574 pFlt->GetUserData() ==
"CXMLV" ) )
576 const OUString sWild = pFlt->GetWildcard().getGlob();
577 xFP->appendFilter( pFlt->GetUIName(), sWild );
581 bool bWeb =
dynamic_cast< SwWebDocShell *
>( this ) !=
nullptr;
582 std::shared_ptr<const SfxFilter> pOwnFlt =
583 SwDocShell::Factory().GetFilterContainer()->
584 GetFilter4FilterName(
"writer8");
589 const OUString sWild = pOwnFlt->GetWildcard().getGlob();
590 xFP->appendFilter( pOwnFlt->GetUIName(), sWild );
597 xFP->setCurrentFilter( pOwnFlt->GetUIName() );
599 catch (
const uno::Exception&)
606 aFileName = xFP->getSelectedFiles().getConstArray()[0];
619 if( !aFileName.isEmpty() )
622 bText = bool(nFlags & SfxTemplateFlags::LOAD_TEXT_STYLES );
624 bFrame = bool(nFlags & SfxTemplateFlags::LOAD_FRAME_STYLES);
626 bPage = bool(nFlags & SfxTemplateFlags::LOAD_PAGE_STYLES );
628 bNum = bool(nFlags & SfxTemplateFlags::LOAD_NUM_STYLES );
631 bMerge = bool(nFlags & SfxTemplateFlags::MERGE_STYLES);
653 std::shared_ptr<const SfxFilter> pHtmlFlt =
656 SwWebDocShell::Factory().GetFilterContainer() );
657 bool bLocalHasName =
HasName();
662 if(!pFlt || pFlt->GetUserData() != pHtmlFlt->GetUserData())
665 std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog(
"SaveAsHTMLDialog"));
667 bLocalHasName =
false;
674 FileDialogHelper aDlgHelper(TemplateDescription::FILESAVE_AUTOEXTENSION,
675 FileDialogFlags::NONE,
677 aDlgHelper.SetContext(FileDialogHelper::WriterSaveHTML);
678 aDlgHelper.AddFilter( pHtmlFlt->GetFilterName(), pHtmlFlt->GetDefaultExtension() );
679 aDlgHelper.SetCurrentFilter( pHtmlFlt->GetFilterName() );
684 OUString sPath = aDlgHelper.GetPath();
689 SID_SAVEASDOC, SfxCallMode::SYNCHRON,
690 { &
aName, &aFilter }));
696 assert(
dynamic_cast<SwWebDocShell*
>(
this) &&
"SourceView only in WebDocShell");
699 sal_uInt16 nSlot = SID_VIEWSHELL1;
700 bool bSetModified =
false;
702 if(
nullptr != pSrcView)
724 nSlot = SID_VIEWSHELL0;
742 case SID_GET_COLORLIST:
754 if(
RET_OK == pDlg->Execute())
763 m_xDoc->Summary(*pSmryDoc, nLevel, nPara, bImpress);
775 uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
776 uno::Reference< frame::XDispatchProvider > xProv = drawing::ModuleDispatcher::create( xContext );
778 uno::Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) );
788 sal_uInt32 nLen = aStat.
nSize;
789 std::size_t nRead = 0;
790 uno::Sequence< sal_Int8 >
aSeq( nLen );
791 aLockBytes.
ReadAt( 0,
aSeq.getArray(), nLen, &nRead );
793 uno::Sequence< beans::PropertyValue > aArgs{
796 xHelper->executeDispatch( xProv,
"SendOutlineToImpress", OUString(), 0, aArgs );
828 pStrm->SetBufferSize( 16348 );
835 pStrm->WriteChar(
'\0' );
839 uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
840 uno::Reference< frame::XDispatchProvider > xProv = drawing::ModuleDispatcher::create( xContext );
842 uno::Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) );
844 pStrm->WriteChar(
'\0' );
852 sal_uInt32 nLen = aStat.
nSize;
853 std::size_t nRead = 0;
854 uno::Sequence< sal_Int8 >
aSeq( nLen );
855 aLockBytes.
ReadAt( 0,
aSeq.getArray(), nLen, &nRead );
857 uno::Sequence< beans::PropertyValue > aArgs{
860 xHelper->executeDispatch( xProv,
"SendOutlineToImpress", OUString(), 0, aArgs );
867 pClipCntnr->CopyAnyData( SotClipboardFormatId::RTF,
static_cast<char const *
>(
868 pStrm->GetData()), pStrm->GetEndOfData() );
869 pClipCntnr->CopyToClipboard(
877 case SID_SPELLCHECKER_CHANGED:
881 Broadcast(
SfxHint(SfxHintId::LanguageChanged));
885 case SID_MAIL_PREPAREEXPORT:
895 if (!pNoUpdate || !pNoUpdate->
GetValue())
897 m_xDoc->getIDocumentFieldsAccess().UpdateFields(
false );
898 m_xDoc->getIDocumentLinksAdministration().EmbedAllLinks();
904 m_xDoc->RemoveInvisibleContent();
910 case SID_MAIL_EXPORT_FINISHED:
916 m_xDoc->RestoreInvisibleContent();
927 bool bCreateByOutlineLevel =
false;
928 sal_Int32 nTemplateOutlineLevel = 0;
930 OUString aFileName, aTemplateName;
931 if( pArgs && SfxItemState::SET == pArgs->
GetItemState( nWhich,
false, &pItem ) )
934 const SfxStringItem* pTemplItem = SfxItemSet::GetItem<SfxStringItem>(pArgs, SID_TEMPLATE_NAME,
false);
936 aTemplateName = pTemplItem->
GetValue();
938 if ( aFileName.isEmpty() )
942 FileDialogHelper aDlgHelper(TemplateDescription::FILESAVE_AUTOEXTENSION_TEMPLATE, FileDialogFlags::NONE,
944 aDlgHelper.SetContext(FileDialogHelper::WriterNewHTMLGlobalDoc);
946 const sal_Int16 nControlIds[] = {
947 CommonFilePickerElementIds::PUSHBUTTON_OK,
948 CommonFilePickerElementIds::PUSHBUTTON_CANCEL,
949 CommonFilePickerElementIds::LISTBOX_FILTER,
950 CommonFilePickerElementIds::CONTROL_FILEVIEW,
951 CommonFilePickerElementIds::EDIT_FILEURL,
952 ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION,
953 ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
959 const char* aHTMLHelpIds[] =
970 aDlgHelper.SetControlHelpIds( nControlIds, aHTMLHelpIds );
974 const char* aMasterHelpIds[] =
985 aDlgHelper.SetControlHelpIds( nControlIds, aMasterHelpIds );
987 uno::Reference < XFilePicker3 > xFP = aDlgHelper.GetFilePicker();
989 std::shared_ptr<const SfxFilter> pFlt;
997 SwWebDocShell::Factory().GetFilterContainer() );
998 pStrId = STR_LOAD_HTML_DOC;
1003 pFlt = SwGlobalDocShell::Factory().GetFilterContainer()->
1004 GetFilter4Extension(
"odm" );
1005 pStrId = STR_LOAD_GLOBAL_DOC;
1010 const OUString sWild = pFlt->GetWildcard().getGlob();
1011 xFP->appendFilter( pFlt->GetUIName(), sWild );
1014 xFP->setCurrentFilter( pFlt->GetUIName() ) ;
1016 catch (
const uno::Exception&)
1023 uno::Reference<XFilePickerControlAccess> xCtrlAcc(xFP, UNO_QUERY);
1027 for(
size_t n = 0;
n < rOutlNds.
size(); ++
n )
1029 const int nLevel = rOutlNds[
n]->GetTextNode()->GetAttrOutlineLevel();
1030 if( nLevel > 0 && ! bOutline[nLevel-1] )
1032 bOutline[nLevel-1] =
true;
1036 const sal_uInt16 nStyleCount =
m_xDoc->GetTextFormatColls()->size();
1037 Sequence<OUString> aListBoxEntries(
MAXLEVEL + nStyleCount);
1038 OUString* pEntries = aListBoxEntries.getArray();
1039 sal_Int32 nIdx = 0 ;
1041 OUString sOutline(
SwResId(STR_FDLG_OUTLINE_LEVEL) );
1045 pEntries[nIdx++] = sOutline + OUString::number(
i+1 );
1048 OUString sStyle(
SwResId(STR_FDLG_STYLE) );
1049 for(sal_uInt16
i = 0;
i < nStyleCount; ++
i)
1054 pEntries[nIdx++] = sStyle + rTextColl.
GetName();
1058 aListBoxEntries.realloc(nIdx);
1059 sal_Int16 nSelect = 0;
1065 xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
1066 ListboxControlActions::ADD_ITEMS , aTemplates );
1068 xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
1069 ListboxControlActions::SET_SELECT_ITEM, aSelectPos );
1070 xCtrlAcc->setLabel( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
1071 SwResId( STR_FDLG_TEMPLATE_NAME ));
1075 OSL_FAIL(
"control access failed");
1078 xFP->setTitle(
SwResId(pStrId));
1080 xFP->setDisplayDirectory( aPathOpt.
GetWorkPath() );
1083 aFileName = xFP->getSelectedFiles().getConstArray()[0];
1084 Any aTemplateValue = xCtrlAcc->getValue(
1085 ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
1086 ListboxControlActions::GET_SELECTED_ITEM );
1088 aTemplateValue >>= sTmpl;
1090 OUString aStyle(
SwResId(STR_FDLG_STYLE));
1091 OUString aOutline(
SwResId(STR_FDLG_OUTLINE_LEVEL));
1093 if ( sTmpl.startsWith(aStyle) )
1095 aTemplateName = sTmpl.copy( aStyle.getLength() );
1097 else if ( sTmpl.startsWith(aOutline) )
1099 nTemplateOutlineLevel =
o3tl::toInt32(sTmpl.subView(aOutline.getLength()));
1100 bCreateByOutlineLevel =
true;
1103 if ( !aFileName.isEmpty() )
1106 if( !aTemplateName.isEmpty() )
1113 if( !aFileName.isEmpty() )
1117 SwWait aWait( *
this,
true );
1119 if ( bCreateByOutlineLevel )
1122 ?
m_xDoc->GenerateHTMLDoc( aFileName, nTemplateOutlineLevel )
1123 :
m_xDoc->GenerateGlobalDoc( aFileName, nTemplateOutlineLevel );
1128 if ( !aTemplateName.isEmpty() )
1129 pSplitColl =
m_xDoc->FindTextFormatCollByName(aTemplateName);
1131 ?
m_xDoc->GenerateHTMLDoc( aFileName, pSplitColl )
1132 :
m_xDoc->GenerateGlobalDoc( aFileName, pSplitColl );
1147 SfxCallMode::ASYNCHRON,
1148 { &
aName, &aReferer, &aFrameItem });
1155 if( !bDone && !rReq.
IsAPI() )
1158 VclMessageType::Info, VclButtonsType::Ok,
1171 case SID_ATTR_YEAR2000:
1172 if ( pArgs && SfxItemState::SET == pArgs->
GetItemState( nWhich ,
false, &pItem ))
1174 assert(
dynamic_cast< const SfxUInt16Item *
>( pItem ) &&
"wrong Item");
1180 SwView* pCurrView =
dynamic_cast< SwView*
>( pViewShell );
1187 pViewShell = pVFrame ? pVFrame->
GetViewShell() :
nullptr;
1188 pCurrView =
dynamic_cast<SwView*
>( pViewShell );
1190 m_xDoc->GetNumberFormatter()->SetYear2000(nYear2K);
1205 SfxStringItem aApp(SID_DOC_SERVICE,
"com.sun.star.text.TextDocument");
1207 pDispatch->ExecuteList(SID_OPENDOC, SfxCallMode::API|SfxCallMode::SYNCHRON, { &aApp, &aTarget });
1211 case SID_CLASSIFICATION_APPLY:
1213 if (pArgs && pArgs->
GetItemState(nWhich,
false, &pItem) == SfxItemState::SET)
1217 auto eType = SfxClassificationPolicyType::IntellectualProperty;
1220 const OUString& rType = pTypeNameItem->GetValue();
1226 SAL_WARN(
"sw.ui",
"missing parameter for SID_CLASSIFICATION_APPLY");
1229 case SID_CLASSIFICATION_DIALOG:
1232 auto xDialog = std::make_shared<svx::ClassificationDialog>(
GetView()->
GetFrameWeld(), pObjSh->getDocProperties(),
false);
1236 xDialog->setupValues(std::move(aInput));
1244 case SID_PARAGRAPH_SIGN_CLASSIFY_DLG:
1248 auto xDialog = std::make_shared<svx::ClassificationDialog>(
GetView()->
GetFrameWeld(), pObjSh->getDocProperties(),
true, [pShell]()
1250 pShell->SignParagraph();
1254 xDialog->setupValues(std::move(aInput));
1267 if (pArgs && pArgs->
GetItemState( SID_WATERMARK,
false, &pItem ) == SfxItemState::SET)
1273 aItem.
SetFont( pFontItem->GetValue() );
1275 aItem.
SetAngle( pAngleItem->GetValue() );
1294 case SID_NOTEBOOKBAR:
1298 SfxBindings& rBindings( pViewShell->GetViewFrame().GetBindings() );
1300 if ( SfxNotebookBar::IsActive() )
1320 bool bHideChanges = pWrtShell && pWrtShell->
GetLayout() &&
1322 bool bChangedHideChanges =
false;
1330 if ( pRedline->
GetType() == RedlineType::Delete )
1334 if ( pTableNd && pTableNd !=
1344 bChangedHideChanges =
true;
1347 pOldTableNd = pTableNd;
1364 if ( bChangedHideChanges )
1369 FN_REDLINE_SHOW, SfxCallMode::SYNCHRON|SfxCallMode::RECORD, { &aShow });
1372 Broadcast(
SfxHint(SfxHintId::RedlineChanged));
1377 default: OSL_FAIL(
"wrong Dispatcher");
1382bool SwDocShell::DdeGetData(
const OUString& rItem,
const OUString& rMimeType,
1385 return m_xDoc->getIDocumentLinksAdministration().GetData( rItem, rMimeType, rValue );
1388bool SwDocShell::DdeSetData(
const OUString& rItem,
const OUString& ,
1391 m_xDoc->getIDocumentLinksAdministration().SetData( rItem );
1399 return m_xDoc->getIDocumentLinksAdministration().CreateLinkSource( rItem );
1413 OUString * pLongUserName,
1415 bool bTemplate )
const
1420 *pClipFormat = SotClipboardFormatId::STARWRITER_60;
1421 *pLongUserName =
SwResId(STR_WRITER_DOCUMENT_FULLTYPE);
1426 *pClipFormat = bTemplate ? SotClipboardFormatId::STARWRITER_8_TEMPLATE : SotClipboardFormatId::STARWRITER_8;
1427 *pLongUserName =
SwResId(STR_WRITER_DOCUMENT_FULLTYPE);
1431 uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper =
m_xDoc->GetVbaEventsHelper();
1432 if( xVbaEventsHelper.is() )
1445 if (!
m_xDoc->getIDocumentState().IsInCallModified())
1450 bool const bOld =
m_xDoc->getIDocumentState().IsModified();
1451 m_xDoc->getIDocumentState().SetModified();
1454 m_xDoc->GetIDocumentUndoRedo().SetUndoNoResetModified();
1458 m_xDoc->getIDocumentState().ResetModified();
1464 Broadcast(
SfxHint(SfxHintId::DocChanged));
1474 GetChildWindow( SwFieldDlgWrapper::GetChildWindowId() ));
1480 GetChildWindow( SwRedlineAcceptChild::GetChildWindowId() ));
1488class SwReloadFromHtmlReader :
public SwReader
1491 SwReloadFromHtmlReader(
SfxMedium& _rTmpMedium,
1492 const OUString& _rFilename,
1494 :
SwReader( _rTmpMedium, _rFilename, _pDoc )
1510#if HAVE_FEATURE_SCRIPTING
1531 OUString aLibName( pBasic->
GetName() );
1532 SfxStringItem aLibNameItem( SID_BASICIDE_ARG_LIBNAME, aLibName );
1534 SID_BASICIDE_LIBREMOVED,
1535 SfxCallMode::SYNCHRON,
1536 { &aShellItem, &aLibNameItem });
1540 pBasicMan->
RemoveLib( nLibCount,
true );
1547 "Deleting Basics didn't work" );
1555 uno::Reference<text::XTextDocument> xDoc(
GetBaseModel(), uno::UNO_QUERY);
1556 text::XTextDocument* pxDoc = xDoc.get();
1577 SfxMedium aMed( rStreamName, StreamMode::READ );
1582 SwReloadFromHtmlReader aReader( aMed, rMedname,
m_xDoc.get() );
1589 if(!bWasBrowseMode && pCurrView)
1604 m_xDoc->getIDocumentState().ResetModified();
1615 SfxMedium aMed( rURL, StreamMode::STD_READ );
1616 if (rURL ==
"private:stream")
1618 std::shared_ptr<const SfxFilter> pFlt;
1626 bool bImport(
false );
1632 uno::Reference< embed::XStorage > xStorage = aMed.
GetStorage();
1633 if ( xStorage.is() )
1639 uno::Reference< beans::XPropertySet > xProps( xStorage, uno::UNO_QUERY_THROW );
1640 xProps->getPropertyValue(
"MediaType" );
1643 catch (
const uno::Exception&)
1653 std::optional<SwPaM> pPam;
1659 pPam.emplace( aIdx );
1660 pReader.reset(
new SwReader( aMed, rURL, *pPam ));
1676 nErr = pReader->Read( *pRead );
1681 nErr = pReader->Read( *pRead );
1707 std::u16string_view rFileName,
1708 const OUString& rPasswd,
1709 const OUString& rFilter,
1713 if ( rFileName.empty() )
1723 bool bFirst =
nullptr != pShell;
1737 SID_VERSION,
false, &pItem ) )
1762 std::shared_ptr<const SfxFilter> pSfxFlt;
1763 if (!xMed->GetError())
1766 ? SwGlobalDocShell::Factory().GetFactoryName()
1767 : SwDocShell::Factory().GetFactoryName() );
1770 if( !rFilter.isEmpty() )
1778 if( !rPasswd.isEmpty() )
1779 xMed->GetItemSet().Put(
SfxStringItem( SID_PASSWORD, rPasswd ));
1787 xMed->SetFilter( pSfxFlt );
1793 if (xDocSh->DoLoad(xMed.release()))
SfxApplication * SfxGetpApp()
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
StarBASIC * GetLib(sal_uInt16 nLib) const
sal_uInt16 GetLibCount() const
bool RemoveLib(sal_uInt16 nLib, bool bDelBasicFromStorage)
sal_Int32 GetValue() const
const OUString & GetValue() const
ErrCode IgnoreWarning() const
static DialogMask HandleError(ErrCode nId, weld::Window *pParent=nullptr, DialogMask nMask=DialogMask::MAX)
static OUString GetEventName(GlobalEventId nID)
virtual SfxPrinter * getPrinter(bool bCreate) const =0
Return the printer set at the document.
virtual void setPrinter(SfxPrinter *pP, bool bDeleteOld, bool bCallPrtDataChanged)=0
Set the printer at the document.
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
virtual void AcceptAllRedline(bool bAcceptReject)=0
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual void set(DocumentSettingId id, bool value)=0
Set the specified document setting.
virtual void SetModified()=0
Must be called manually at changes of format.
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
INetProtocol GetProtocol() const
bool SetMark(std::u16string_view rTheFragment, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
SwgReaderOption & GetReaderOpt()
const OUString & GetName(SbxNameType=SbxNameType::NONE) const
virtual VclPtr< SfxAbstractTabDialog > CreateAutoCorrTabDialog(weld::Window *pParent, const SfxItemSet *pAttrSet)=0
static SfxAbstractDialogFactory * Create()
static BasicManager * GetBasicManager()
void SetState(const SfxItemSet &rSet)
void Invalidate(sal_uInt16 nId)
static SfxClassificationPolicyType stringToPolicyType(std::u16string_view rType)
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
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 * >())
static void ConfigureEvent(const OUString &aName, const SvxMacro &, SfxObjectShell const *pObjSh)
SfxEventHintId GetEventId() const
std::shared_ptr< const SfxFilter > First()
std::shared_ptr< const SfxFilter > Next()
std::shared_ptr< const SfxFilter > GetFilter4FilterName(const OUString &rName, SfxFilterFlags nMust=SfxFilterFlags::NONE, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
ErrCode DetectFilter(SfxMedium &rMedium, std::shared_ptr< const SfxFilter > &) const
sal_Int16 GetValue() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
const std::shared_ptr< const SfxFilter > & GetFilter() const
void setStreamToLoadFrom(const css::uno::Reference< css::io::XInputStream > &xInputStream, bool bIsReadOnly)
const INetURLObject & GetURLObject() const
SfxItemSet & GetItemSet() const
const OUString & GetName() const
css::uno::Reference< css::embed::XStorage > GetStorage(bool bCreateTempFile=true)
OUString GetTemplateFileName() const
SfxTemplateFlags GetTemplateFlags() const
void SetTemplateFlags(SfxTemplateFlags nSet)
const OUString & GetFactoryName() const
virtual bool PrepareClose(bool bUI=true)
void SetError(ErrCode rErr)
void SetTitle(const OUString &rTitle)
bool IsInPrepareClose() const
void SetHeaderAttributesForSourceViewHack()
void ClearHeaderAttributesForSourceViewHack()
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
SfxMedium * GetMedium() const
css::uno::Reference< css::frame::XModel3 > GetModel() const
OUString GetTitle(sal_uInt16 nMaxLen=0) const
css::uno::Reference< css::frame::XModel3 > GetBaseModel() const
void EnableSetModified(bool bEnable=true)
static SAL_WARN_UNUSED_RESULT SfxObjectShell * GetFirst(const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
virtual void SetModified(bool bModified=true)
sal_uInt16 GetSlot() const
const SfxItemSet * GetArgs() const
const T * GetArg(sal_uInt16 nSlotId) const
void AppendItem(const SfxPoolItem &)
void SetReturnValue(const SfxPoolItem &)
void Done(bool bRemove=false)
SfxItemPool & GetPool() const
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
SfxViewShell * GetViewShell() const
void SetPool(SfxItemPool *pNewPool)
SfxDispatcher * GetDispatcher() const
static SfxViewFrame * LoadDocument(SfxObjectShell const &i_rDoc, SfxInterfaceId i_nViewId)
SfxBindings & GetBindings()
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetNext(const SfxViewFrame &rPrev, const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
SfxDispatcher * GetDispatcher()
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
SfxFrame & GetFrame() const
weld::Window * GetFrameWeld() const
SfxViewFrame & GetViewFrame() const
SfxInPlaceClient * FindIPClient(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, vcl::Window *pObjParentWin) const
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
virtual SfxObjectShell * GetObjectShell() override
static SAL_WARN_UNUSED_RESULT SfxViewShell * Current()
void SetNewWindowAllowed(bool bSet)
void SetFont(const OUString &aFont)
void SetAngle(const sal_Int16 nAngle)
void SetTransparency(const sal_Int16 nTransparency)
void SetColor(Color nColor)
void SetText(const OUString &aText)
virtual void Clear() override
virtual ErrCode ReadAt(sal_uInt64 nPos, void *pBuffer, std::size_t nCount, std::size_t *pRead) const
virtual ErrCode Stat(SvLockBytesStat *pStat) const
void SetBufferSize(sal_uInt16 m_nBufSize)
sal_uInt64 Seek(sal_uInt64 nPos)
SvStream & WriteChar(char nChar)
const OUString & GetWorkPath() const
SvxAutoCorrect * GetAutoCorrect()
static SvxAutoCorrCfg & Get()
SvxSwAutoFormatFlags & GetSwFlags()
const XColorListRef & GetColorList() const
virtual VclPtr< AbstractSwInsertAbstractDlg > CreateSwInsertAbstractDlg(weld::Window *pParent)=0
virtual CreateTabPage GetTabPageCreatorFunc(sal_uInt16 nId)=0
static SwAbstractDialogFactory * Create()
void SetMinWordLen(sal_uInt16 n)
void SetMaxCount(editeng::SortedAutoCompleteStrings::size_type n)
void CheckChangedList(const editeng::SortedAutoCompleteStrings &rNewLst)
bool IsLockWordLstLocked() const
const editeng::SortedAutoCompleteStrings & GetWordList() const
void SetLockWordLstLocked(bool bFlag)
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
ErrCode LoadStylesFromFile(const OUString &rURL, SwgReaderOption &rOpt, bool bUnoCall)
bool m_IsRemovedInvisibleContent
whether SID_MAIL_PREPAREEXPORT removed content that SID_MAIL_EXPORT_FINISHED needs to restore
rtl::Reference< SwDoc > m_xDoc
Document.
virtual SAL_DLLPRIVATE bool PrepareClose(bool bUI=true) override
virtual void ReconnectDdeLink(SfxObjectShell &rServer) override
SAL_DLLPRIVATE void RemoveLink()
virtual void DoFlushDocInfo() override
override to update text fields
IDocumentDeviceAccess & getIDocumentDeviceAccess()
SwDocShell(SfxObjectCreateMode eMode=SfxObjectCreateMode::EMBEDDED)
Doc is required for SO data exchange!
virtual void FillClass(SvGlobalName *pClassName, SotClipboardFormatId *pClipFormat, OUString *pLongUserName, sal_Int32 nFileFormat, bool bTemplate=false) const override
virtual ::sfx2::SvLinkSource * DdeCreateLinkSource(const OUString &rItem) override
const SwView * GetView() const
void Execute(SfxRequest &)
Dispatcher.
void ReloadFromHtml(const OUString &rStreamName, SwSrcView *pSrcView)
Re-read Doc from Html-source.
SfxInPlaceClient * GetIPClient(const ::svt::EmbeddedObjectRef &xObjRef)
virtual SAL_DLLPRIVATE void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Catch hint for DocInfo.
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
SAL_DLLPRIVATE void SubInitNew()
for InitNew and HtmlSourceMode.
SAL_DLLPRIVATE void AddLink()
Methods for access to doc.
void UpdateChildWindows()
virtual void SetModified(bool=true) override
virtual SAL_DLLPRIVATE std::shared_ptr< SfxDocumentInfoDialog > CreateDocumentInfoDialog(weld::Window *pParent, const SfxItemSet &rSet) override
Make DocInfo known to the Doc.
void ToggleLayoutMode(SwView *pView)
css::uno::Reference< ooo::vba::word::XDocument > mxAutomationDocumentObject
SwDoc * GetDoc()
returns Doc. But be careful!
void CheckDefaultPageFormat()
The html import sometimes overwrites the page sizes set in the page descriptions.
IDocumentState const & getIDocumentState() const
static SwAutoCompleteWord & GetAutoCompleteWords()
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
void InvalidateAutoCompleteFlag()
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
IDocumentSettingAccess const & getIDocumentSettingAccess() const
std::vector< svx::ClassificationResult > CollectAdvancedClassification()
void ApplyParagraphClassification(std::vector< svx::ClassificationResult > aResult)
Apply the classification to the paragraph at cursor.
void StartAllAction()
For all views of this document.
void SetWatermark(const SfxWatermarkItem &rText)
void SetNewDoc()
Optimizing UI.
static void SetAutoFormatFlags(SvxSwAutoFormatFlags const *)
std::vector< svx::ClassificationResult > CollectParagraphClassification()
void SetClassification(const OUString &rName, SfxClassificationPolicyType eType)
void ApplyAdvancedClassification(std::vector< svx::ClassificationResult > const &rResult)
virtual bool ReInitDlg(SwDocShell *pDocSh) override
static SW_DLLPUBLIC std::shared_ptr< const SfxFilter > GetFilterOfFormat(std::u16string_view rFormat, const SfxFilterContainer *pCnt=nullptr)
find for an internal format name the corresponding filter entry
static void CheckSpellChanges(bool bOnlineSpelling, bool bIsSpellWrongAgain, bool bIsSpellAllAgain, bool bSmartTags)
Marks a node in the document model.
SwTableNode * FindTableNode()
Search table node, in which it is.
const SwPosition * GetPoint() const
RedlineType GetType(sal_uInt16 nPos=0) const
void SetBaseURL(const OUString &rURL)
virtual bool ReInitDlg(SwDocShell *pDocSh) override
vector_type::size_type size_type
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding).
static SwSmartTagMgr & Get()
void SaveContent(const OUString &rTmpFile)
bool HasSourceSaved() const
const SwTable & GetTable() const
bool HasDeletedRowOrCell() const
Represents the style of a paragraph.
bool IsAtDocNodeSet() const
bool getBrowseMode() const
bool IsViewLocked() const
const SwViewOption * GetViewOptions() const
void InvalidateLayout(bool bSizeChanged)
SwRootFrame * GetLayout() const
SwWrtShell & GetWrtShell() const
virtual FmFormShell * GetFormShell() override
virtual sal_uInt16 SetPrinter(SfxPrinter *pNew, SfxPrinterChangeFlags nDiff=SFX_PRINTER_ALL) override
SwDocShell * GetDocShell()
ErrCode Write(WriterRef const &rxWriter, const OUString *=nullptr)
Used by the UI to modify the document model.
const SwView & GetView() const
void SetNumRules(const bool bNew)
void SetTextFormats(const bool bNew)
css::uno::Reference< css::io::XInputStream > & GetInputStream()
void SetMerge(const bool bNew)
void SetPageDescs(const bool bNew)
bool IsFrameFormats() const
bool IsTextFormats() const
void SetFrameFormats(const bool bNew)
static VclPtr< reference_type > Create(Arg &&... arg)
SortedAutoCompleteStrings createNonOwningCopy() const
#define SO3_SW_CLASSID_60
void ReconnectDdeLink(SfxObjectShell &rServer)
static void ExecMethod(SfxBindings &rBindings, const OUString &rUIName)
static void CloseMethod(SfxBindings &rBindings)
void EnableKillingFile(bool bEnable=true)
OUString const & GetURL() const
static bool runAsync(const std::shared_ptr< DialogController > &rController, const std::function< void(sal_Int32)> &)
#define FN_OUTLINE_TO_CLIPBOARD
#define FN_REDLINE_ACCEPT_ALL
#define FN_ABSTRACT_NEWDOC
#define FN_NEW_GLOBAL_DOC
#define FN_ABSTRACT_STARIMPRESS
#define FN_REDLINE_REJECT_ALL
#define FN_OUTLINE_TO_IMPRESS
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
static void lcl_processCompatibleSfxHint(const uno::Reference< script::vba::XVBAEventProcessor > &xVbaEvents, const SfxHint &rHint)
int SwFindDocShell(SfxObjectShellRef &xDocSh, SfxObjectShellLock &xLockRef, std::u16string_view rFileName, const OUString &rPasswd, const OUString &rFilter, sal_Int16 nVersion, SwDocShell *pDestSh)
Find the right DocShell and create a new one: The return value specifies what should happen to the Sh...
std::unique_ptr< SwReader, o3tl::default_delete< SwReader > > SwReaderPtr
void GetRTFWriter(std::u16string_view rFltName, const OUString &rBaseURL, WriterRef &xRet)
#define HID_SEND_MASTER_CTRL_PUSHBUTTON_CANCEL
#define HID_SEND_HTML_CTRL_EDIT_FILEURL
#define HID_SEND_MASTER_CTRL_CHECKBOX_AUTOEXTENSION
#define HID_SEND_MASTER_CTRL_EDIT_FILEURL
#define HID_SEND_HTML_CTRL_PUSHBUTTON_CANCEL
#define HID_SEND_HTML_CTRL_PUSHBUTTON_OK
#define HID_SEND_HTML_CTRL_LISTBOX_TEMPLATE
#define HID_SEND_MASTER_CTRL_LISTBOX_FILTER
#define HID_SEND_MASTER_CTRL_CONTROL_FILEVIEW
#define HID_SEND_HTML_CTRL_CONTROL_FILEVIEW
#define HID_SEND_HTML_CTRL_LISTBOX_FILTER
#define HID_SEND_MASTER_CTRL_PUSHBUTTON_OK
#define HID_SEND_HTML_CTRL_CHECKBOX_AUTOEXTENSION
#define HID_SEND_MASTER_CTRL_LISTBOX_TEMPLATE
Sequence< sal_Int8 > aSeq
#define SAL_WARN(area, stream)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
#define RET_TEMPLATE_LOAD
constexpr auto SFX_INTERFACE_NONE
bool SetHTMLTemplate(SwDoc &rDoc)
#define STREAM_SEEK_TO_END
#define STREAM_SEEK_TO_BEGIN
OUString SwResId(TranslateId aId)
constexpr sal_uInt8 MAXLEVEL