20 #include <config_features.h>
22 #include <com/sun/star/drawing/ModuleDispatcher.hpp>
23 #include <com/sun/star/frame/DispatchHelper.hpp>
24 #include <ooo/vba/word/XDocument.hpp>
51 #include <svx/dialogs.hrc>
99 #include <strings.hrc>
100 #include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
101 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
102 #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
103 #include <com/sun/star/ui/dialogs/ListboxControlActions.hpp>
104 #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
105 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
106 #include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
107 #include <com/sun/star/script/vba/VBAEventId.hpp>
109 #include <officecfg/Office/Security.hxx>
127 using namespace ::
sfx2;
132 std::shared_ptr<SfxDocumentInfoDialog> xDlg = std::make_shared<SfxDocumentInfoDialog>(pParent, rSet);
140 if ( pVSh && dynamic_cast< const SwSrcView *>( pVSh ) ==
nullptr )
143 xDlg->AddFontTabPage();
152 OSL_ENSURE( pView,
"SwDocShell::ToggleLayoutMode, pView is null." );
189 bool bUnlockView(
true);
211 using namespace com::sun::star::script::vba::VBAEventId;
213 if ( !pSfxEventHint )
216 uno::Sequence< uno::Any > aArgs;
219 case SfxEventHintId::CreateDoc:
220 xVbaEvents->processVbaEvent( DOCUMENT_NEW, aArgs );
222 case SfxEventHintId::OpenDoc:
223 xVbaEvents->processVbaEvent( DOCUMENT_OPEN, aArgs );
237 uno::Reference< script::vba::XVBAEventProcessor >
const xVbaEvents =
238 m_xDoc->GetVbaEventProcessor();
239 if( xVbaEvents.is() )
242 if (
const SfxEventHint* pSfxEventHint = dynamic_cast<const SfxEventHint*>(&rHint) )
244 switch( pSfxEventHint->GetEventId() )
246 case SfxEventHintId::ActivateDoc:
247 case SfxEventHintId::CreateDoc:
248 case SfxEventHintId::OpenDoc:
250 uno::Sequence< css::uno::Any > aArgs;
251 SW_MOD()->CallAutomationApplicationEventSinks(
"DocumentChange", aArgs );
258 switch( pSfxEventHint->GetEventId() )
260 case SfxEventHintId::CreateDoc:
264 uno::Sequence< uno::Any > aArgs(1);
265 aArgs[0] = aDocument;
266 SW_MOD()->CallAutomationApplicationEventSinks(
"NewDocument", aArgs );
269 case SfxEventHintId::OpenDoc:
273 uno::Sequence< uno::Any > aArgs(1);
274 aArgs[0] = aDocument;
275 SW_MOD()->CallAutomationApplicationEventSinks(
"DocumentOpen", aArgs );
283 sal_uInt16 nAction = 0;
284 auto pEventHint =
dynamic_cast<const SfxEventHint*
>(&rHint);
285 if( pEventHint && pEventHint->GetEventId() == SfxEventHintId::LoadFinished )
293 if( rHint.
GetId() == SfxHintId::TitleChanged)
303 bool bUnlockView =
true;
323 if ( bResetModified )
326 const bool bIsDocModified =
m_xDoc->getIDocumentState().IsModified();
329 m_xDoc->getIDocumentStatistics().DocInfoChgd(
false);
332 if ( !bIsDocModified )
333 m_xDoc->getIDocumentState().ResetModified();
334 if ( bResetModified )
360 uno::Sequence< uno::Any > aArgs(2);
362 aArgs[0] = aDocument;
366 SW_MOD()->CallAutomationApplicationEventSinks(
"DocumentBeforeClose", aArgs );
370 aArgs[1] >>= bCancel;
380 uno::Reference< script::vba::XVBAEventProcessor >
const xVbaEvents =
381 m_xDoc->GetVbaEventProcessor();
382 if( xVbaEvents.is() )
384 using namespace com::sun::star::script::vba::VBAEventId;
385 uno::Sequence< uno::Any > aNoArgs;
386 xVbaEvents->processVbaEvent( DOCUMENT_CLOSE, aNoArgs );
396 sal_uInt16 nWhich = rReq.
GetSlot();
400 case SID_AUTO_CORRECT_DLG:
414 SfxRequest aAppReq(SID_AUTO_CORRECT_DLG, SfxCallMode::SYNCHRON, pApp->
GetPool());
415 SfxBoolItem aSwOptions( SID_AUTO_CORRECT_DLG,
true );
416 aAppReq.AppendItem(aSwOptions);
421 aSet.Put( aSwOptions );
423 const SfxPoolItem* pOpenSmartTagOptionsItem =
nullptr;
424 if( pArgs && SfxItemState::SET == pArgs->
GetItemState( SID_OPEN_SMARTTAGOPTIONS,
false, &pOpenSmartTagOptionsItem ) )
425 aSet.Put( *static_cast<const SfxBoolItem*>(pOpenSmartTagOptionsItem) );
445 if( !bOldAutoCmpltCollectWords && bOldAutoCmpltCollectWords !=
454 SwDoc* pTmp = pDocSh->GetDoc();
462 case SID_PRINTPREVIEW:
465 bool bFound =
false, bOnly =
true;
468 SwView* pCurrView =
dynamic_cast< SwView *
> ( pViewShell );
469 bool bCurrent =
typeid(
SwPagePreview) ==
typeid( pViewShell );
480 if( bFound && !bOnly )
485 if( pArgs && SfxItemState::SET ==
487 bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue();
491 sal_uInt16 nSlotId = 0;
492 if( bSet && !bFound )
493 nSlotId = SID_VIEWSHELL1;
494 else if( bFound && !bSet )
495 nSlotId = bOnly ? SID_VIEWSHELL0 : SID_VIEWSHELL1;
501 if( dynamic_cast< const SwWebDocShell *>(
this ) !=
nullptr && SID_VIEWSHELL1 == nSlotId )
502 nSlotId = SID_VIEWSHELL2;
504 if( pCurrView && pCurrView->
GetDocShell() == this )
516 case SID_TEMPLATE_LOAD:
519 static bool bText =
true;
520 static bool bFrame =
false;
521 static bool bPage =
false;
522 static bool bNum =
false;
523 static bool bMerge =
false;
525 SfxTemplateFlags nFlags = bFrame ? SfxTemplateFlags::LOAD_FRAME_STYLES : SfxTemplateFlags::NONE;
527 nFlags |= SfxTemplateFlags::LOAD_PAGE_STYLES;
529 nFlags |= SfxTemplateFlags::LOAD_NUM_STYLES;
530 if(nFlags == SfxTemplateFlags::NONE || bText)
531 nFlags |= SfxTemplateFlags::LOAD_TEXT_STYLES;
533 nFlags |= SfxTemplateFlags::MERGE_STYLES;
540 aFileName = pTemplateItem->
GetValue();
547 if ( aFileName.isEmpty() )
553 sal_uInt16 nRet = aNewFileDlg.run();
556 FileDialogHelper aDlgHelper(TemplateDescription::FILEOPEN_SIMPLE,
558 uno::Reference < XFilePicker3 > xFP = aDlgHelper.GetFilePicker();
560 xFP->setDisplayDirectory( aPathOpt.
GetWorkPath() );
565 std::shared_ptr<const SfxFilter> pFlt = aIter.First();
569 if( pFlt && pFlt->IsAllowedAsTemplate() &&
570 ( pFlt->GetUserData() ==
"CXML" ||
571 pFlt->GetUserData() ==
"CXMLV" ) )
573 const OUString sWild = pFlt->GetWildcard().getGlob();
574 xFP->appendFilter( pFlt->GetUIName(), sWild );
578 bool bWeb =
dynamic_cast< SwWebDocShell *
>( this ) !=
nullptr;
579 std::shared_ptr<const SfxFilter> pOwnFlt =
580 SwDocShell::Factory().GetFilterContainer()->
581 GetFilter4FilterName(
"writer8");
586 const OUString sWild = pOwnFlt->GetWildcard().getGlob();
587 xFP->appendFilter( pOwnFlt->GetUIName(), sWild );
594 xFP->setCurrentFilter( pOwnFlt->GetUIName() );
596 catch (
const uno::Exception&)
603 aFileName = xFP->getSelectedFiles().getConstArray()[0];
616 if( !aFileName.isEmpty() )
619 bText = bool(nFlags & SfxTemplateFlags::LOAD_TEXT_STYLES );
621 bFrame = bool(nFlags & SfxTemplateFlags::LOAD_FRAME_STYLES);
623 bPage = bool(nFlags & SfxTemplateFlags::LOAD_PAGE_STYLES );
625 bNum = bool(nFlags & SfxTemplateFlags::LOAD_NUM_STYLES );
628 bMerge = bool(nFlags & SfxTemplateFlags::MERGE_STYLES);
650 std::shared_ptr<const SfxFilter> pHtmlFlt =
653 SwWebDocShell::Factory().GetFilterContainer() );
654 bool bLocalHasName =
HasName();
659 if(!pFlt || pFlt->GetUserData() != pHtmlFlt->GetUserData())
662 std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog(
"SaveAsHTMLDialog"));
664 bLocalHasName =
false;
671 FileDialogHelper aDlgHelper(TemplateDescription::FILESAVE_AUTOEXTENSION,
672 FileDialogFlags::NONE,
674 aDlgHelper.AddFilter( pHtmlFlt->GetFilterName(), pHtmlFlt->GetDefaultExtension() );
675 aDlgHelper.SetCurrentFilter( pHtmlFlt->GetFilterName() );
680 OUString sPath = aDlgHelper.GetPath();
685 SID_SAVEASDOC, SfxCallMode::SYNCHRON,
686 { &aName, &aFilter }));
687 if(!pBool || !pBool->GetValue())
692 OSL_ENSURE(dynamic_cast<SwWebDocShell*>(
this),
693 "SourceView only in WebDocShell");
696 sal_uInt16 nSlot = SID_VIEWSHELL1;
697 bool bSetModified =
false;
699 if(
nullptr != pSrcView)
721 nSlot = SID_VIEWSHELL0;
739 case SID_GET_COLORLIST:
751 if(
RET_OK == pDlg->Execute())
760 m_xDoc->Summary(*pSmryDoc, nLevel, nPara, bImpress);
772 uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
773 uno::Reference< frame::XDispatchProvider > xProv = drawing::ModuleDispatcher::create( xContext );
775 uno::Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) );
785 sal_uInt32 nLen = aStat.
nSize;
786 std::size_t nRead = 0;
787 uno::Sequence< sal_Int8 >
aSeq( nLen );
788 aLockBytes.
ReadAt( 0, aSeq.getArray(), nLen, &nRead );
790 uno::Sequence< beans::PropertyValue > aArgs(1);
791 aArgs[0].Name =
"RtfOutline";
792 aArgs[0].Value <<= aSeq;
793 xHelper->executeDispatch( xProv,
"SendOutlineToImpress", OUString(), 0, aArgs );
825 pStrm->SetBufferSize( 16348 );
832 pStrm->WriteChar(
'\0' );
836 uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
837 uno::Reference< frame::XDispatchProvider > xProv = drawing::ModuleDispatcher::create( xContext );
839 uno::Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) );
841 pStrm->WriteChar(
'\0' );
849 sal_uInt32 nLen = aStat.
nSize;
850 std::size_t nRead = 0;
851 uno::Sequence< sal_Int8 >
aSeq( nLen );
852 aLockBytes.ReadAt( 0, aSeq.getArray(), nLen, &nRead );
854 uno::Sequence< beans::PropertyValue > aArgs(1);
855 aArgs[0].Name =
"RtfOutline";
856 aArgs[0].Value <<= aSeq;
857 xHelper->executeDispatch( xProv,
"SendOutlineToImpress", OUString(), 0, aArgs );
864 pClipCntnr->CopyAnyData( SotClipboardFormatId::RTF, static_cast<char const *>(
865 pStrm->GetData()), pStrm->GetEndOfData() );
866 pClipCntnr->CopyToClipboard(
874 case SID_SPELLCHECKER_CHANGED:
879 case SID_MAIL_PREPAREEXPORT:
884 m_xDoc->getIDocumentFieldsAccess().UpdateFields(
false );
885 m_xDoc->getIDocumentLinksAdministration().EmbedAllLinks();
889 m_xDoc->RemoveInvisibleContent();
895 case SID_MAIL_EXPORT_FINISHED:
901 m_xDoc->RestoreInvisibleContent();
912 bool bCreateByOutlineLevel =
false;
913 sal_Int32 nTemplateOutlineLevel = 0;
915 OUString aFileName, aTemplateName;
916 if( pArgs && SfxItemState::SET == pArgs->
GetItemState( nWhich,
false, &pItem ) )
919 const SfxStringItem* pTemplItem = SfxItemSet::GetItem<SfxStringItem>(pArgs, SID_TEMPLATE_NAME,
false);
921 aTemplateName = pTemplItem->
GetValue();
923 if ( aFileName.isEmpty() )
927 FileDialogHelper aDlgHelper(TemplateDescription::FILESAVE_AUTOEXTENSION_TEMPLATE, FileDialogFlags::NONE,
930 const sal_Int16 nControlIds[] = {
931 CommonFilePickerElementIds::PUSHBUTTON_OK,
932 CommonFilePickerElementIds::PUSHBUTTON_CANCEL,
933 CommonFilePickerElementIds::LISTBOX_FILTER,
934 CommonFilePickerElementIds::CONTROL_FILEVIEW,
935 CommonFilePickerElementIds::EDIT_FILEURL,
936 ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION,
937 ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
943 const char* aHTMLHelpIds[] =
954 aDlgHelper.SetControlHelpIds( nControlIds, aHTMLHelpIds );
958 const char* aMasterHelpIds[] =
969 aDlgHelper.SetControlHelpIds( nControlIds, aMasterHelpIds );
971 uno::Reference < XFilePicker3 > xFP = aDlgHelper.GetFilePicker();
973 std::shared_ptr<const SfxFilter> pFlt;
981 SwWebDocShell::Factory().GetFilterContainer() );
982 pStrId = STR_LOAD_HTML_DOC;
987 pFlt = SwGlobalDocShell::Factory().GetFilterContainer()->
988 GetFilter4Extension(
"odm" );
989 pStrId = STR_LOAD_GLOBAL_DOC;
994 const OUString sWild = pFlt->GetWildcard().getGlob();
995 xFP->appendFilter( pFlt->GetUIName(), sWild );
998 xFP->setCurrentFilter( pFlt->GetUIName() ) ;
1000 catch (
const uno::Exception&)
1007 uno::Reference<XFilePickerControlAccess> xCtrlAcc(xFP, UNO_QUERY);
1011 for(
size_t n = 0;
n < rOutlNds.
size(); ++
n )
1013 const int nLevel = rOutlNds[
n]->GetTextNode()->GetAttrOutlineLevel();
1014 if( nLevel > 0 && ! bOutline[nLevel-1] )
1016 bOutline[nLevel-1] =
true;
1020 const sal_uInt16 nStyleCount =
m_xDoc->GetTextFormatColls()->size();
1022 OUString* pEntries = aListBoxEntries.getArray();
1023 sal_Int32 nIdx = 0 ;
1025 OUString sOutline(
SwResId(STR_FDLG_OUTLINE_LEVEL) );
1029 pEntries[nIdx++] = sOutline + OUString::number( i+1 );
1032 OUString sStyle(
SwResId(STR_FDLG_STYLE) );
1033 for(sal_uInt16
i = 0;
i < nStyleCount; ++
i)
1038 pEntries[nIdx++] = sStyle + rTextColl.
GetName();
1042 aListBoxEntries.realloc(nIdx);
1043 sal_Int16 nSelect = 0;
1047 Any aTemplates(&aListBoxEntries,
cppu::UnoType<decltype(aListBoxEntries)>::
get());
1049 xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
1050 ListboxControlActions::ADD_ITEMS , aTemplates );
1052 xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
1053 ListboxControlActions::SET_SELECT_ITEM, aSelectPos );
1054 xCtrlAcc->setLabel( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
1055 SwResId( STR_FDLG_TEMPLATE_NAME ));
1059 OSL_FAIL(
"control access failed");
1062 xFP->setTitle(
SwResId(pStrId));
1064 xFP->setDisplayDirectory( aPathOpt.
GetWorkPath() );
1067 aFileName = xFP->getSelectedFiles().getConstArray()[0];
1068 Any aTemplateValue = xCtrlAcc->getValue(
1069 ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
1070 ListboxControlActions::GET_SELECTED_ITEM );
1072 aTemplateValue >>= sTmpl;
1074 OUString aStyle(
SwResId(STR_FDLG_STYLE));
1075 OUString aOutline(
SwResId(STR_FDLG_OUTLINE_LEVEL));
1077 if ( sTmpl.startsWith(aStyle) )
1079 aTemplateName = sTmpl.copy( aStyle.getLength() );
1081 else if ( sTmpl.startsWith(aOutline) )
1083 nTemplateOutlineLevel = sTmpl.copy(aOutline.getLength()).
toInt32();
1084 bCreateByOutlineLevel =
true;
1087 if ( !aFileName.isEmpty() )
1090 if( !aTemplateName.isEmpty() )
1097 if( !aFileName.isEmpty() )
1101 SwWait aWait( *
this,
true );
1103 if ( bCreateByOutlineLevel )
1106 ?
m_xDoc->GenerateHTMLDoc( aFileName, nTemplateOutlineLevel )
1107 :
m_xDoc->GenerateGlobalDoc( aFileName, nTemplateOutlineLevel );
1112 if ( !aTemplateName.isEmpty() )
1113 pSplitColl =
m_xDoc->FindTextFormatCollByName(aTemplateName);
1115 ?
m_xDoc->GenerateHTMLDoc( aFileName, pSplitColl )
1116 :
m_xDoc->GenerateGlobalDoc( aFileName, pSplitColl );
1128 std::unique_ptr<SfxFrameItem> pFrameItem(
new SfxFrameItem( SID_DOCFRAME,
1132 SfxCallMode::ASYNCHRON,
1133 { &aName, &aReferer, pFrameItem.get() });
1140 if( !bDone && !rReq.
IsAPI() )
1143 VclMessageType::Info, VclButtonsType::Ok,
1156 case SID_ATTR_YEAR2000:
1157 if ( pArgs && SfxItemState::SET == pArgs->
GetItemState( nWhich ,
false, &pItem ))
1159 OSL_ENSURE(dynamic_cast< const SfxUInt16Item *>( pItem ) !=
nullptr,
"wrong Item");
1165 SwView* pCurrView =
dynamic_cast< SwView*
>( pViewShell );
1172 pViewShell = pVFrame ? pVFrame->
GetViewShell() :
nullptr;
1173 pCurrView =
dynamic_cast<SwView*
>( pViewShell );
1175 m_xDoc->GetNumberFormatter()->SetYear2000(nYear2K);
1188 SfxStringItem aApp(SID_DOC_SERVICE,
"com.sun.star.text.TextDocument");
1191 SfxCallMode::API|SfxCallMode::SYNCHRON,
1192 { &aApp, &aTarget });
1195 case SID_CLASSIFICATION_APPLY:
1197 if (pArgs && pArgs->
GetItemState(nWhich,
false, &pItem) == SfxItemState::SET)
1201 auto eType = SfxClassificationPolicyType::IntellectualProperty;
1202 if (pArgs->
GetItemState(SID_TYPE_NAME,
false, &pItem) == SfxItemState::SET)
1210 SAL_WARN(
"sw.ui",
"missing parameter for SID_CLASSIFICATION_APPLY");
1213 case SID_CLASSIFICATION_DIALOG:
1215 auto xDialog = std::make_shared<svx::ClassificationDialog>(
GetView()->
GetFrameWeld(),
false);
1218 std::vector<svx::ClassificationResult> aInput = pShell->CollectAdvancedClassification();
1219 xDialog->setupValues(aInput);
1223 pShell->ApplyAdvancedClassification(xDialog->getResult());
1227 case SID_PARAGRAPH_SIGN_CLASSIFY_DLG:
1230 auto xDialog = std::make_shared<svx::ClassificationDialog>(
GetView()->
GetFrameWeld(),
true, [pShell]()
1236 xDialog->setupValues(aInput);
1249 if (pArgs && pArgs->
GetItemState( SID_WATERMARK,
false, &pItem ) == SfxItemState::SET)
1252 aItem.
SetText( static_cast<const SfxStringItem*>( pItem )->
GetValue() );
1254 if ( pArgs->
GetItemState( SID_WATERMARK_FONT,
false, &pItem ) == SfxItemState::SET )
1255 aItem.
SetFont( static_cast<const SfxStringItem*>( pItem )->GetValue() );
1256 if ( pArgs->
GetItemState( SID_WATERMARK_ANGLE,
false, &pItem ) == SfxItemState::SET )
1257 aItem.
SetAngle( static_cast<const SfxInt16Item*>( pItem )->GetValue() );
1258 if ( pArgs->
GetItemState( SID_WATERMARK_TRANSPARENCY,
false, &pItem ) == SfxItemState::SET )
1259 aItem.
SetTransparency( static_cast<const SfxInt16Item*>( pItem )->GetValue() );
1260 if ( pArgs->
GetItemState( SID_WATERMARK_COLOR,
false, &pItem ) == SfxItemState::SET )
1276 case SID_NOTEBOOKBAR:
1280 SfxBindings& rBindings( pViewShell->GetViewFrame()->GetBindings() );
1282 if ( SfxNotebookBar::IsActive() )
1313 Broadcast(
SfxHint(SfxHintId::RedlineChanged));
1318 default: OSL_FAIL(
"wrong Dispatcher");
1323 bool SwDocShell::DdeGetData(
const OUString& rItem,
const OUString& rMimeType,
1326 return m_xDoc->getIDocumentLinksAdministration().GetData( rItem, rMimeType, rValue );
1329 bool SwDocShell::DdeSetData(
const OUString& rItem,
const OUString& ,
1332 m_xDoc->getIDocumentLinksAdministration().SetData( rItem );
1340 return m_xDoc->getIDocumentLinksAdministration().CreateLinkSource( rItem );
1354 OUString * pLongUserName,
1356 bool bTemplate )
const
1361 *pClipFormat = SotClipboardFormatId::STARWRITER_60;
1362 *pLongUserName =
SwResId(STR_WRITER_DOCUMENT_FULLTYPE);
1367 *pClipFormat = bTemplate ? SotClipboardFormatId::STARWRITER_8_TEMPLATE : SotClipboardFormatId::STARWRITER_8;
1368 *pLongUserName =
SwResId(STR_WRITER_DOCUMENT_FULLTYPE);
1372 uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper =
m_xDoc->GetVbaEventsHelper();
1373 if( xVbaEventsHelper.is() )
1386 if (!
m_xDoc->getIDocumentState().IsInCallModified())
1391 bool const bOld =
m_xDoc->getIDocumentState().IsModified();
1392 m_xDoc->getIDocumentState().SetModified();
1395 m_xDoc->GetIDocumentUndoRedo().SetUndoNoResetModified();
1399 m_xDoc->getIDocumentState().ResetModified();
1405 Broadcast(
SfxHint(SfxHintId::DocChanged));
1415 GetChildWindow( SwFieldDlgWrapper::GetChildWindowId() ));
1421 GetChildWindow( SwRedlineAcceptChild::GetChildWindowId() ));
1429 class SwReloadFromHtmlReader :
public SwReader
1432 SwReloadFromHtmlReader(
SfxMedium& _rTmpMedium,
1433 const OUString& _rFilename,
1435 :
SwReader( _rTmpMedium, _rFilename, _pDoc )
1437 SetBaseURL( _rFilename );
1451 #if HAVE_FEATURE_SCRIPTING
1473 OUString aLibName( pBasic->
GetName() );
1474 SfxStringItem aLibNameItem( SID_BASICIDE_ARG_LIBNAME, aLibName );
1476 SID_BASICIDE_LIBREMOVED,
1477 SfxCallMode::SYNCHRON,
1478 { &aShellItem, &aLibNameItem });
1482 pBasicMan->
RemoveLib( nLibCount,
true );
1489 "Deleting Basics didn't work" );
1497 uno::Reference<text::XTextDocument> xDoc(
GetBaseModel(), uno::UNO_QUERY);
1498 text::XTextDocument* pxDoc = xDoc.get();
1519 SfxMedium aMed( rStreamName, StreamMode::READ );
1524 SwReloadFromHtmlReader aReader( aMed, rMedname,
m_xDoc.get() );
1531 if(!bWasBrowseMode && pCurrView)
1546 m_xDoc->getIDocumentState().ResetModified();
1557 SfxMedium aMed( rURL, StreamMode::STD_READ );
1558 if (rURL ==
"private:stream")
1560 std::shared_ptr<const SfxFilter> pFlt;
1568 bool bImport(
false );
1574 uno::Reference< embed::XStorage > xStorage = aMed.
GetStorage();
1575 if ( xStorage.is() )
1581 uno::Reference< beans::XPropertySet > xProps( xStorage, uno::UNO_QUERY_THROW );
1582 xProps->getPropertyValue(
"MediaType" );
1585 catch (
const uno::Exception&)
1595 std::unique_ptr<SwPaM> pPam;
1601 pPam.reset(
new SwPaM( aIdx ));
1602 pReader.reset(
new SwReader( aMed, rURL, *pPam ));
1618 nErr = pReader->Read( *pRead );
1623 nErr = pReader->Read( *pRead );
1649 const OUString& rFileName,
1650 const OUString& rPasswd,
1651 const OUString& rFilter,
1655 if ( rFileName.isEmpty() )
1660 aTmpObj.
SetMark( OUString() );
1665 bool bFirst =
nullptr != pShell;
1679 SID_VERSION,
false, &pItem ) )
1680 ? (nVersion == static_cast<const SfxInt16Item*>(pItem)->GetValue())
1704 std::shared_ptr<const SfxFilter> pSfxFlt;
1705 if (!xMed->GetError())
1708 ? SwGlobalDocShell::Factory().GetFactoryName()
1709 : SwDocShell::Factory().GetFactoryName() );
1712 if( !rFilter.isEmpty() )
1718 xMed->GetItemSet()->Put(
SfxInt16Item( SID_VERSION, nVersion ));
1720 if( !rPasswd.isEmpty() )
1721 xMed->GetItemSet()->Put(
SfxStringItem( SID_PASSWORD, rPasswd ));
1729 xMed->SetFilter( pSfxFlt );
1735 if (xDocSh->
DoLoad(xMed.release()))
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
SfxViewFrame * GetViewFrame() const
void SetText(const OUString &aText)
#define FN_ABSTRACT_NEWDOC
sal_Int32 GetValue() const
#define FN_REDLINE_ACCEPT_ALL
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 * >())
#define HID_SEND_HTML_CTRL_PUSHBUTTON_OK
SAL_DLLPRIVATE void SubInitNew()
for InitNew and HtmlSourceMode.
virtual SfxObjectFactory & GetFactory() const =0
virtual void SetModified(bool=true) override
#define FN_REDLINE_REJECT_ALL
#define FN_NEW_GLOBAL_DOC
Represents the style of a paragraph.
static SvxAutoCorrCfg & Get()
bool HasSourceSaved() const
SfxInPlaceClient * GetIPClient(const ::svt::EmbeddedObjectRef &xObjRef)
SwPaM * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
void SaveContent(const OUString &rTmpFile)
const OUString & GetName(SbxNameType=SbxNameType::NONE) const
std::vector< svx::ClassificationResult > CollectParagraphClassification()
virtual ::sfx2::SvLinkSource * DdeCreateLinkSource(const OUString &rItem) override
#define HID_SEND_MASTER_CTRL_EDIT_FILEURL
static SfxAbstractDialogFactory * Create()
OUString GetTitle(sal_uInt16 nMaxLen=0) const
void SetState(const SfxItemSet &rSet)
const OUString & GetFactoryName() const
static SwAutoCompleteWord & GetAutoCompleteWords()
void SetPageDescs(const bool bNew)
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
void ToggleLayoutMode(SwView *pView)
#define HID_SEND_MASTER_CTRL_CHECKBOX_AUTOEXTENSION
bool IsFrameFormats() const
ErrCode IgnoreWarning() const
SfxDispatcher * GetDispatcher()
static SfxViewFrame * LoadDocument(SfxObjectShell const &i_rDoc, SfxInterfaceId i_nViewId)
virtual void SetModified(bool bModified=true)
const OUString & GetName() const
virtual void SetModified()=0
Must be called manually at changes of format.
void SetHeaderAttributesForSourceViewHack()
sal_Int32 toInt32(OUString const &rStr)
sal_uInt16 GetLibCount() const
#define HID_SEND_MASTER_CTRL_LISTBOX_FILTER
void ReloadFromHtml(const OUString &rStreamName, SwSrcView *pSrcView)
Re-read Doc from Html-source.
static void ConfigureEvent(const OUString &aName, const SvxMacro &, SfxObjectShell const *pObjSh)
static weld::Builder * CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false)
#define STREAM_SEEK_TO_END
#define FN_ABSTRACT_STARIMPRESS
sal_uInt64 Seek(sal_uInt64 nPos)
void Done(bool bRemove=false)
ErrCode Write(WriterRef const &rxWriter, const OUString *=nullptr)
static SfxObjectShell * Current()
css::uno::Reference< css::frame::XModel > GetModel() const
void SignParagraph()
Sign the paragraph at the cursor.
virtual bool ReInitDlg(SwDocShell *pDocSh) override
const SfxItemSet * GetArgs() const
void Invalidate(sal_uInt16 nId)
SfxInPlaceClient * FindIPClient(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, vcl::Window *pObjParentWin) const
int SwFindDocShell(SfxObjectShellRef &xDocSh, SfxObjectShellLock &xLockRef, const OUString &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...
#define HID_SEND_HTML_CTRL_LISTBOX_TEMPLATE
bool IsInPrepareClose() const
#define RET_TEMPLATE_LOAD
SwWrtShell & GetWrtShell() const
virtual ErrCode ReadAt(sal_uInt64 nPos, void *pBuffer, std::size_t nCount, std::size_t *pRead) const
void SetTextFormats(const bool bNew)
SfxApplication * SfxGetpApp()
Used by the UI to modify the document model.
virtual bool PrepareClose(bool bUI=true)
css::uno::Any const & rValue
void SetWatermark(const SfxWatermarkItem &rText)
static void CheckSpellChanges(bool bOnlineSpelling, bool bIsSpellWrongAgain, bool bIsSpellAllAgain, bool bSmartTags)
static bool runAsync(const std::shared_ptr< DialogController > &rController, const std::function< void(sal_Int32)> &)
weld::Window * GetFrameWeld() const
virtual void set(DocumentSettingId id, bool value)=0
Set the specified document setting.
vcl::Window & GetWindow() const
constexpr auto SFX_INTERFACE_NONE
const SwView & GetView() const
virtual VclPtr< AbstractSwInsertAbstractDlg > CreateSwInsertAbstractDlg(weld::Window *pParent)=0
bool getBrowseMode() const
void InvalidateLayout(bool bSizeChanged)
SfxFrame & GetFrame() const
static SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
static SfxViewShell * Current()
SvxSwAutoFormatFlags & GetSwFlags()
void SetTransparency(const sal_Int16 nTransparency)
css::uno::Reference< css::frame::XModel > GetBaseModel() const
SfxItemPool & GetPool() const
std::unique_ptr< SwReader, o3tl::default_delete< SwReader > > SwReaderPtr
virtual VclPtr< SfxAbstractTabDialog > CreateAutoCorrTabDialog(weld::Window *pParent, const SfxItemSet *pAttrSet)=0
static SvxHtmlOptions & Get()
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
#define HID_SEND_HTML_CTRL_CONTROL_FILEVIEW
virtual void FillClass(SvGlobalName *pClassName, SotClipboardFormatId *pClipFormat, OUString *pLongUserName, sal_Int32 nFileFormat, bool bTemplate=false) const override
SwDoc * GetDoc()
returns Doc. But be careful!
bool IsAtDocNodeSet() const
PaM is Point and Mark: a selection of the document model.
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
void CheckDefaultPageFormat()
The html import sometimes overwrites the page sizes set in the page descriptions. ...
void CheckChangedList(const editeng::SortedAutoCompleteStrings &rNewLst)
SwgReaderOption & GetReaderOpt()
#define HID_SEND_MASTER_CTRL_PUSHBUTTON_CANCEL
virtual FmFormShell * GetFormShell() 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
SwDocShell(SfxObjectCreateMode eMode=SfxObjectCreateMode::EMBEDDED)
Doc is required for SO data exchange!
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
SfxDispatcher * GetDispatcher() const
css::uno::Reference< css::io::XInputStream > & GetInputStream()
#define HID_SEND_HTML_CTRL_PUSHBUTTON_CANCEL
OUString const & GetURL() const
static SwSmartTagMgr & Get()
#define STREAM_SEEK_TO_BEGIN
static OUString GetEventName(GlobalEventId nID)
void SetColor(Color nColor)
SAL_DLLPRIVATE void RemoveLink()
static DialogMask HandleError(ErrCode nId, weld::Window *pParent=nullptr, DialogMask nMask=DialogMask::MAX)
void ReconnectDdeLink(SfxObjectShell &rServer)
SvxAutoCorrect * GetAutoCorrect()
SfxBindings & GetBindings()
virtual void AcceptAllRedline(bool bAcceptReject)=0
const OUString & GetValue() const
void SetTitle(const OUString &rTitle)
#define HID_SEND_MASTER_CTRL_PUSHBUTTON_OK
void UpdateChildWindows()
static SfxClassificationPolicyType stringToPolicyType(const OUString &rType)
virtual void Clear() override
const T * GetArg(sal_uInt16 nSlotId) const
static SfxViewFrame * GetNext(const SfxViewFrame &rPrev, const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
void SetPool(SfxItemPool *pNewPool)
#define SO3_SW_CLASSID_60
void ApplyParagraphClassification(std::vector< svx::ClassificationResult > aResult)
Apply the classification to the paragraph at cursor.
void ClearHeaderAttributesForSourceViewHack()
virtual SAL_DLLPRIVATE std::shared_ptr< SfxDocumentInfoDialog > CreateDocumentInfoDialog(weld::Window *pParent, const SfxItemSet &rSet) override
Make DocInfo known to the Doc.
IDocumentState const & getIDocumentState() const
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
SfxItemSet * GetItemSet() const
SortedAutoCompleteStrings createNonOwningCopy() const
void Execute(SfxRequest &)
Dispatcher.
void SetLockWordLstLocked(bool bFlag)
static SwAbstractDialogFactory * Create()
Marks a node in the document model.
const editeng::SortedAutoCompleteStrings & GetWordList() const
#define HID_SEND_HTML_CTRL_CHECKBOX_AUTOEXTENSION
void SetBufferSize(sal_uInt16 m_nBufSize)
OUString GetTemplateFileName() const
rtl::Reference< SwDoc > m_xDoc
Document.
OUString SwResId(const char *pId)
const XColorListRef & GetColorList() const
void SetClassification(const OUString &rName, SfxClassificationPolicyType eType)
static SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
bool SetHTMLTemplate(SwDoc &rDoc)
bool IsTextFormats() const
virtual SfxPrinter * getPrinter(bool bCreate) const =0
Return the printer set at the document.
const std::shared_ptr< const SfxFilter > & GetFilter() const
virtual void setPrinter(SfxPrinter *pP, bool bDeleteOld, bool bCallPrtDataChanged)=0
Set the printer at the document.
SfxViewShell * GetViewShell() const
virtual SAL_DLLPRIVATE void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Catch hint for DocInfo.
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
virtual sal_uInt16 SetPrinter(SfxPrinter *pNew, SfxPrinterChangeFlags nDiff=SFX_PRINTER_ALL) override
SwDocShell * GetDocShell()
bool m_IsRemovedInvisibleContent
whether SID_MAIL_PREPAREEXPORT removed content that SID_MAIL_EXPORT_FINISHED needs to restore ...
void SetReturnValue(const SfxPoolItem &)
ErrCode LoadStylesFromFile(const OUString &rURL, SwgReaderOption &rOpt, bool bUnoCall)
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
#define HID_SEND_HTML_CTRL_EDIT_FILEURL
IDocumentDeviceAccess & getIDocumentDeviceAccess()
virtual ErrCode Stat(SvLockBytesStat *pStat) const
virtual void ReconnectDdeLink(SfxObjectShell &rServer) override
void GetRTFWriter(const OUString &rFltName, const OUString &rBaseURL, WriterRef &xRet)
const OUString & GetWorkPath() const
sal_uInt16 GetSlot() const
#define HID_SEND_MASTER_CTRL_LISTBOX_TEMPLATE
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
void SetMinWordLen(sal_uInt16 n)
weld::Window * GetFrameWeld() const
css::uno::Reference< css::embed::XStorage > GetStorage(bool bCreateTempFile=true)
static BasicManager * GetBasicManager()
#define HID_SEND_HTML_CTRL_LISTBOX_FILTER
void SetTemplateFlags(SfxTemplateFlags nSet)
SfxEventHintId GetEventId() const
static SfxObjectShell * GetFirst(const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
const SwViewOption * GetViewOptions() const
std::shared_ptr< const SfxFilter > GetFilter4FilterName(const OUString &rName, SfxFilterFlags nMust=SfxFilterFlags::NONE, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
#define FN_OUTLINE_TO_CLIPBOARD
virtual bool ReInitDlg(SwDocShell *pDocSh) override
INetProtocol GetProtocol() const
bool DoInitNew(SfxMedium *pMedium=nullptr)
IDocumentSettingAccess const & getIDocumentSettingAccess() const
static VclPtr< reference_type > Create(Arg &&...arg)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
static void ExecMethod(SfxBindings &rBindings, const OUString &rUIName)
const INetURLObject & GetURLObject() const
bool IsLockWordLstLocked() const
void SetFont(const OUString &aFont)
Sequence< sal_Int8 > aSeq
bool SetMark(OUString const &rTheFragment, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
bool RemoveLib(sal_uInt16 nLib, bool bDelBasicFromStorage)
SvStream & WriteChar(char nChar)
void SetMaxCount(editeng::SortedAutoCompleteStrings::size_type n)
#define HID_SEND_MASTER_CTRL_CONTROL_FILEVIEW
static void lcl_processCompatibleSfxHint(const uno::Reference< script::vba::XVBAEventProcessor > &xVbaEvents, const SfxHint &rHint)
virtual CreateTabPage GetTabPageCreatorFunc(sal_uInt16 nId)=0
void SetNewDoc()
Optimizing UI.
virtual SAL_DLLPRIVATE bool PrepareClose(bool bUI=true) override
bool IsEnableSetModified() const
virtual SfxObjectShell * GetObjectShell() override
static SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
void AppendItem(const SfxPoolItem &)
#define SAL_WARN(area, stream)
static SfxObjectShell * GetNext(const SfxObjectShell &rPrev, const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
const SwView * GetView() const
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
SAL_DLLPRIVATE void AddLink()
Methods for access to doc.
bool DoLoad(SfxMedium *pMedium)
virtual void DoFlushDocInfo() override
override to update text fields
void EnableSetModified(bool bEnable=true)
virtual const SwRedlineTable & GetRedlineTable() const =0
void SetAngle(const sal_Int16 nAngle)
void StartAllAction()
For all views of this document.
static void SetAutoFormatFlags(SvxSwAutoFormatFlags const *)
SwRootFrame * GetLayout() const
void SetFrameFormats(const bool bNew)
void SetError(ErrCode rErr)
void EnableKillingFile(bool bEnable=true)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
bool IsViewLocked() const
ErrCode DetectFilter(SfxMedium &rMedium, std::shared_ptr< const SfxFilter > &) const
BasicManager * GetBasicManager() const
SfxTemplateFlags GetTemplateFlags() const
void SetNewWindowAllowed(bool bSet)
static void CloseMethod(SfxBindings &rBindings)
void InvalidateAutoCompleteFlag()
#define FN_OUTLINE_TO_IMPRESS
void SetMerge(const bool bNew)
void SetNumRules(const bool bNew)
StarBASIC * GetLib(sal_uInt16 nLib) const
void setStreamToLoadFrom(const css::uno::Reference< css::io::XInputStream > &xInputStream, bool bIsReadOnly)
css::uno::Reference< ooo::vba::word::XDocument > mxAutomationDocumentObject
SfxMedium * GetMedium() const
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)