1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 5 * This Source Code Form is subject to the terms of the Mozilla Public 6 * License, v. 2.0. If a copy of the MPL was not distributed with this 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 11 * Licensed to the Apache Software Foundation (ASF) under one or more 12 * contributor license agreements. See the NOTICE file distributed 13 * with this work for additional information regarding copyright 14 * ownership. The ASF licenses this file to you under the Apache 15 * License, Version 2.0 (the "License"); you may not use this file 16 * except in compliance with the License. You may obtain a copy of 17 * the License at http://www.apache.org/licenses/LICENSE-2.0 . 18 */ 19 20 #include <config_features.h> 21 22 #include <com/sun/star/util/SearchAlgorithms2.hpp> 23 #include <o3tl/any.hxx> 24 #include <vcl/graphicfilter.hxx> 25 #include <com/sun/star/sdb/DatabaseContext.hpp> 26 #include <com/sun/star/ui/dialogs/XFilePicker3.hpp> 27 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> 28 #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> 29 #include <com/sun/star/ui/dialogs/ListboxControlActions.hpp> 30 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> 31 #include <com/sun/star/linguistic2/XProofreadingIterator.hpp> 32 #include <com/sun/star/linguistic2/XDictionary.hpp> 33 #include <officecfg/Office/Common.hxx> 34 #include <SwCapObjType.hxx> 35 #include <SwStyleNameMapper.hxx> 36 #include <docary.hxx> 37 #include <hintids.hxx> 38 #include <SwRewriter.hxx> 39 #include <numrule.hxx> 40 #include <swundo.hxx> 41 #include <svl/PasswordHelper.hxx> 42 #include <svl/urihelper.hxx> 43 #include <sfx2/passwd.hxx> 44 #include <sfx2/sfxdlg.hxx> 45 #include <sfx2/filedlghelper.hxx> 46 #include <editeng/langitem.hxx> 47 #include <svx/viewlayoutitem.hxx> 48 #include <svx/zoomslideritem.hxx> 49 #include <svx/linkwarn.hxx> 50 #include <sfx2/htmlmode.hxx> 51 #include <vcl/svapp.hxx> 52 #include <sfx2/app.hxx> 53 #include <sfx2/request.hxx> 54 #include <sfx2/bindings.hxx> 55 #include <editeng/lrspitem.hxx> 56 #include <unotools/localedatawrapper.hxx> 57 #include <unotools/syslocale.hxx> 58 #include <editeng/unolingu.hxx> 59 #include <vcl/weld.hxx> 60 #include <editeng/tstpitem.hxx> 61 #include <sfx2/event.hxx> 62 #include <sfx2/docfile.hxx> 63 #include <sfx2/docfilt.hxx> 64 #include <sfx2/fcontnr.hxx> 65 #include <editeng/sizeitem.hxx> 66 #include <sfx2/dispatch.hxx> 67 #include <svl/whiter.hxx> 68 #include <svl/ptitem.hxx> 69 #include <sfx2/viewfrm.hxx> 70 #include <vcl/errinf.hxx> 71 #include <tools/urlobj.hxx> 72 #include <svx/svdview.hxx> 73 #include <swtypes.hxx> 74 #include <swwait.hxx> 75 #include <redlndlg.hxx> 76 #include <gotodlg.hxx> 77 #include <view.hxx> 78 #include <uivwimp.hxx> 79 #include <docsh.hxx> 80 #include <doc.hxx> 81 #include <printdata.hxx> 82 #include <IDocumentDeviceAccess.hxx> 83 #include <IDocumentRedlineAccess.hxx> 84 #include <DocumentRedlineManager.hxx> 85 #include <IDocumentUndoRedo.hxx> 86 #include <IDocumentSettingAccess.hxx> 87 #include <IDocumentDrawModelAccess.hxx> 88 #include <IDocumentStatistics.hxx> 89 #include <wrtsh.hxx> 90 #include <viewopt.hxx> 91 #include <basesh.hxx> 92 #include <swmodule.hxx> 93 #include <uitool.hxx> 94 #include <shellio.hxx> 95 #include <fmtinfmt.hxx> 96 #include <mdiexp.hxx> 97 #include <drawbase.hxx> 98 #include <frmatr.hxx> 99 #include <frmmgr.hxx> 100 #include <pagedesc.hxx> 101 #include <section.hxx> 102 #include <tox.hxx> 103 #include <edtwin.hxx> 104 #include <wview.hxx> 105 #include <cmdid.h> 106 #include <sfx2/strings.hrc> 107 #include <sfx2/sfxresid.hxx> 108 #include <strings.hrc> 109 #include <swerror.h> 110 #include <globals.hrc> 111 #include <fmtclds.hxx> 112 #include <sfx2/templatedlg.hxx> 113 #include <dbconfig.hxx> 114 #include <dbmgr.hxx> 115 #include <reffld.hxx> 116 #include <comphelper/lok.hxx> 117 118 #include <PostItMgr.hxx> 119 120 #include <comphelper/processfactory.hxx> 121 #include <LibreOfficeKit/LibreOfficeKitEnums.h> 122 123 #include <svx/svxdlg.hxx> 124 #include <swabstdlg.hxx> 125 #include <fmthdft.hxx> 126 #include <unotextrange.hxx> 127 #include <docstat.hxx> 128 #include <wordcountdialog.hxx> 129 #include <sfx2/sidebar/Sidebar.hxx> 130 131 #include <vcl/GraphicNativeTransform.hxx> 132 #include <vcl/GraphicNativeMetadata.hxx> 133 #include <vcl/settings.hxx> 134 #include <i18nutil/searchopt.hxx> 135 #include <paratr.hxx> 136 #include <rootfrm.hxx> 137 #include <frameformats.hxx> 138 139 #include <viewimp.hxx> 140 #include <pagefrm.hxx> 141 142 #include <memory> 143 #include <string_view> 144 #include <svl/slstitm.hxx> 145 146 #include <basegfx/utils/zoomtools.hxx> 147 148 const char sStatusDelim[] = " : "; 149 150 using namespace sfx2; 151 using namespace ::com::sun::star; 152 using namespace ::com::sun::star::i18n; 153 using namespace ::com::sun::star::util; 154 using namespace ::com::sun::star::uno; 155 using namespace ::com::sun::star::lang; 156 using namespace ::com::sun::star::scanner; 157 using namespace ::com::sun::star::beans; 158 using namespace ::com::sun::star::container; 159 using namespace ::com::sun::star::sdb; 160 using namespace ::com::sun::star::ui::dialogs; 161 162 static void lcl_SetAllTextToDefaultLanguage( SwWrtShell &rWrtSh, sal_uInt16 nWhichId ) 163 { 164 if (!(nWhichId == RES_CHRATR_LANGUAGE || 165 nWhichId == RES_CHRATR_CJK_LANGUAGE || 166 nWhichId == RES_CHRATR_CTL_LANGUAGE)) 167 return; 168 169 rWrtSh.StartAction(); 170 rWrtSh.LockView( true ); 171 rWrtSh.Push(); 172 173 // prepare to apply new language to all text in document 174 rWrtSh.SelAll(); 175 rWrtSh.ExtendedSelectAll(); 176 177 // set language attribute to default for all text 178 rWrtSh.ResetAttr({ nWhichId }); 179 180 rWrtSh.Pop(SwCursorShell::PopMode::DeleteCurrent); 181 rWrtSh.LockView( false ); 182 rWrtSh.EndAction(); 183 184 } 185 186 /** 187 * Create string for showing the page number in the statusbar 188 * 189 * @param nPhyNum The physical page number 190 * @param nVirtNum The logical page number (user-assigned) 191 * @param rPgStr User-defined page name (will be shown if different from logical page number) 192 * 193 * @return OUString Formatted string: Page 1 of 10 (Page 1 of 8 to print OR Page nVirtNumv/rPgStr) 194 **/ 195 OUString SwView::GetPageStr(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString& rPgStr) 196 { 197 // Show user-defined page number in brackets if any. 198 OUString extra; 199 if (!rPgStr.isEmpty() && std::u16string_view(OUString::number(nPhyNum)) != rPgStr) 200 extra = rPgStr; 201 else if (nPhyNum != nVirtNum) 202 extra = OUString::number(nVirtNum); 203 204 sal_uInt16 nPageCount = GetWrtShell().GetPageCnt(); 205 sal_uInt16 nPrintedPhyNum = nPhyNum; 206 sal_uInt16 nPrintedPageCount = nPageCount; 207 if (!GetWrtShell().getIDocumentDeviceAccess().getPrintData().IsPrintEmptyPages()) 208 SwDoc::CalculateNonBlankPages(*m_pWrtShell->GetLayout(), nPrintedPageCount, nPrintedPhyNum); 209 // Show printed page numbers only, when they are different 210 OUString aStr( nPageCount != nPrintedPageCount 211 ? SwResId(STR_PAGE_COUNT_PRINTED) 212 : (extra.isEmpty() ? SwResId(STR_PAGE_COUNT) : SwResId(STR_PAGE_COUNT_CUSTOM))); 213 aStr = aStr.replaceFirst("%1", OUString::number(nPhyNum)); 214 aStr = aStr.replaceFirst("%2", OUString::number(nPageCount)); 215 if (nPageCount != nPrintedPageCount) 216 { 217 aStr = aStr.replaceFirst("%3", OUString::number(nPrintedPhyNum)); 218 aStr = aStr.replaceFirst("%4", OUString::number(nPrintedPageCount)); 219 } 220 else 221 aStr = aStr.replaceFirst("%3", extra); 222 223 return aStr; 224 } 225 226 ErrCode SwView::InsertGraphic( const OUString &rPath, const OUString &rFilter, 227 bool bLink, GraphicFilter *pFilter ) 228 { 229 SwWait aWait( *GetDocShell(), true ); 230 231 Graphic aGraphic; 232 ErrCode aResult = ERRCODE_NONE; 233 if( !pFilter ) 234 { 235 pFilter = &GraphicFilter::GetGraphicFilter(); 236 } 237 aResult = GraphicFilter::LoadGraphic( rPath, rFilter, aGraphic, pFilter ); 238 239 if( ERRCODE_NONE == aResult ) 240 { 241 GraphicNativeMetadata aMetadata; 242 if ( aMetadata.read(aGraphic) ) 243 { 244 const Degree10 aRotation = aMetadata.getRotation(); 245 if (aRotation) 246 { 247 GraphicNativeTransform aTransform( aGraphic ); 248 aTransform.rotate( aRotation ); 249 } 250 } 251 252 SwFlyFrameAttrMgr aFrameManager( true, GetWrtShellPtr(), Frmmgr_Type::GRF, nullptr ); 253 SwWrtShell& rShell = GetWrtShell(); 254 255 // #i123922# determine if we really want to insert or replace the graphic at a selected object 256 const bool bReplaceMode(rShell.HasSelection() && SelectionType::Frame == rShell.GetSelectionType()); 257 258 if(bReplaceMode) 259 { 260 // #i123922# Do same as in D&D, ReRead graphic and all is done 261 rShell.ReRead( 262 bLink ? rPath : OUString(), 263 bLink ? rFilter : OUString(), 264 &aGraphic); 265 } 266 else 267 { 268 rShell.StartAction(); 269 if( bLink ) 270 { 271 SwDocShell* pDocSh = GetDocShell(); 272 INetURLObject aTemp( 273 pDocSh->HasName() ? 274 pDocSh->GetMedium()->GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE ) : 275 OUString()); 276 277 OUString sURL = URIHelper::SmartRel2Abs( 278 aTemp, rPath, URIHelper::GetMaybeFileHdl() ); 279 aGraphic.setOriginURL(sURL); 280 rShell.Insert( sURL, rFilter, aGraphic, &aFrameManager ); 281 } 282 else 283 { 284 rShell.Insert( OUString(), OUString(), aGraphic, &aFrameManager ); 285 } 286 287 // it is too late after "EndAction" because the Shell can already be destroyed. 288 rShell.EndAction(); 289 } 290 } 291 return aResult; 292 } 293 294 bool SwView::InsertGraphicDlg( SfxRequest& rReq ) 295 { 296 bool bReturn = false; 297 SwDocShell* pDocShell = GetDocShell(); 298 SwDoc* pDoc = pDocShell->GetDoc(); 299 300 OUString sGraphicFormat = SwResId(STR_POOLFRM_GRAPHIC); 301 302 // No file pickers in a non-desktop (mobile app) build. 303 304 #if HAVE_FEATURE_DESKTOP 305 // when in HTML mode insert only as a link 306 const sal_uInt16 nHtmlMode = ::GetHtmlMode(pDocShell); 307 std::unique_ptr<FileDialogHelper> pFileDlg(new FileDialogHelper( 308 ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE, 309 FileDialogFlags::Graphic, GetFrameWeld())); 310 pFileDlg->SetTitle(SwResId(STR_INSERT_GRAPHIC )); 311 pFileDlg->SetContext( FileDialogHelper::SW_INSERT_GRAPHIC ); 312 313 uno::Reference < XFilePicker3 > xFP = pFileDlg->GetFilePicker(); 314 uno::Reference < XFilePickerControlAccess > xCtrlAcc(xFP, UNO_QUERY); 315 if(nHtmlMode & HTMLMODE_ON) 316 { 317 xCtrlAcc->setValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, makeAny(true)); 318 xCtrlAcc->enableControl( ExtendedFilePickerElementIds::CHECKBOX_LINK, false); 319 } 320 321 std::vector<OUString> aFormats; 322 const size_t nArrLen = pDoc->GetFrameFormats()->size(); 323 for( size_t i = 0; i < nArrLen; ++i ) 324 { 325 const SwFrameFormat* pFormat = (*pDoc->GetFrameFormats())[ i ]; 326 if(pFormat->IsDefault() || pFormat->IsAuto()) 327 continue; 328 aFormats.push_back(pFormat->GetName()); 329 } 330 331 // pool formats 332 333 const std::vector<OUString>& rFramePoolArr( 334 SwStyleNameMapper::GetFrameFormatUINameArray()); 335 for(const auto & i : rFramePoolArr) 336 { 337 aFormats.push_back(i); 338 } 339 340 std::sort(aFormats.begin(), aFormats.end()); 341 aFormats.erase(std::unique(aFormats.begin(), aFormats.end()), aFormats.end()); 342 343 Sequence<OUString> aListBoxEntries(aFormats.size()); 344 OUString* pEntries = aListBoxEntries.getArray(); 345 sal_Int16 nSelect = 0; 346 for( size_t i = 0; i < aFormats.size(); ++i ) 347 { 348 pEntries[i] = aFormats[i]; 349 if(pEntries[i] == sGraphicFormat) 350 nSelect = i; 351 } 352 try 353 { 354 Any aTemplates(&aListBoxEntries, cppu::UnoType<decltype(aListBoxEntries)>::get()); 355 356 xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE, 357 ListboxControlActions::ADD_ITEMS , aTemplates ); 358 359 Any aSelectPos(&nSelect, cppu::UnoType<decltype(nSelect)>::get()); 360 xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE, 361 ListboxControlActions::SET_SELECT_ITEM, aSelectPos ); 362 } 363 catch (const Exception&) 364 { 365 OSL_FAIL("control access failed"); 366 } 367 #endif 368 369 const SfxStringItem* pName = rReq.GetArg<SfxStringItem>(SID_INSERT_GRAPHIC); 370 bool bShowError = !pName; 371 if( pName 372 #if HAVE_FEATURE_DESKTOP 373 || ERRCODE_NONE == pFileDlg->Execute() 374 #endif 375 ) 376 { 377 378 OUString aFileName, aFilterName; 379 if ( pName ) 380 { 381 aFileName = pName->GetValue(); 382 const SfxStringItem* pFilter = rReq.GetArg<SfxStringItem>(FN_PARAM_FILTER); 383 if ( pFilter ) 384 aFilterName = pFilter->GetValue(); 385 } 386 #if HAVE_FEATURE_DESKTOP 387 else 388 { 389 aFileName = pFileDlg->GetPath(); 390 aFilterName = pFileDlg->GetCurrentFilter(); 391 rReq.AppendItem( SfxStringItem( SID_INSERT_GRAPHIC, aFileName ) ); 392 rReq.AppendItem( SfxStringItem( FN_PARAM_FILTER, aFilterName ) ); 393 394 bool bAsLink = false; 395 if(nHtmlMode & HTMLMODE_ON) 396 bAsLink = true; 397 else 398 { 399 try 400 { 401 Any aVal = xCtrlAcc->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0); 402 OSL_ENSURE(aVal.hasValue(), "Value CBX_INSERT_AS_LINK not found"); 403 bAsLink = !aVal.hasValue() || *o3tl::doAccess<bool>(aVal); 404 Any aTemplateValue = xCtrlAcc->getValue( 405 ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE, 406 ListboxControlActions::GET_SELECTED_ITEM ); 407 OUString sTmpl; 408 aTemplateValue >>= sTmpl; 409 rReq.AppendItem( SfxStringItem( FN_PARAM_2, sTmpl) ); 410 } 411 catch (const Exception&) 412 { 413 OSL_FAIL("control access failed"); 414 } 415 } 416 rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bAsLink ) ); 417 } 418 const SfxBoolItem* pAsLink = rReq.GetArg<SfxBoolItem>(FN_PARAM_1); 419 const SfxStringItem* pStyle = rReq.GetArg<SfxStringItem>(FN_PARAM_2); 420 #endif 421 422 bool bAsLink = false; 423 424 #if HAVE_FEATURE_DESKTOP 425 if( nHtmlMode & HTMLMODE_ON ) 426 bAsLink = true; 427 else 428 { 429 if ( rReq.GetArgs() ) 430 { 431 if ( pAsLink ) 432 bAsLink = pAsLink->GetValue(); 433 if ( pStyle && !pStyle->GetValue().isEmpty() ) 434 sGraphicFormat = pStyle->GetValue(); 435 } 436 else 437 { 438 Any aVal = xCtrlAcc->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0); 439 OSL_ENSURE(aVal.hasValue(), "Value CBX_INSERT_AS_LINK not found"); 440 bAsLink = !aVal.hasValue() || *o3tl::doAccess<bool>(aVal); 441 Any aTemplateValue = xCtrlAcc->getValue( 442 ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE, 443 ListboxControlActions::GET_SELECTED_ITEM ); 444 OUString sTmpl; 445 aTemplateValue >>= sTmpl; 446 if( !sTmpl.isEmpty() ) 447 sGraphicFormat = sTmpl; 448 rReq.AppendItem( SfxStringItem( FN_PARAM_2, sGraphicFormat ) ); 449 rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bAsLink ) ); 450 } 451 452 // really store as link only? 453 if( bAsLink && officecfg::Office::Common::Misc::ShowLinkWarningDialog::get() ) 454 { 455 SvxLinkWarningDialog aWarnDlg(GetFrameWeld(), pFileDlg->GetPath()); 456 if (aWarnDlg.run() != RET_OK) 457 bAsLink=false; // don't store as link 458 } 459 } 460 #endif 461 462 SwWrtShell& rSh = GetWrtShell(); 463 rSh.LockPaint(); 464 rSh.StartAction(); 465 466 SwRewriter aRewriter; 467 aRewriter.AddRule(UndoArg1, SwResId(STR_GRAPHIC_DEFNAME)); 468 469 // #i123922# determine if we really want to insert or replace the graphic at a selected object 470 const bool bReplaceMode(rSh.HasSelection() && SelectionType::Frame == rSh.GetSelectionType()); 471 472 rSh.StartUndo(SwUndoId::INSERT, &aRewriter); 473 474 ErrCode nError = InsertGraphic( aFileName, aFilterName, bAsLink, &GraphicFilter::GetGraphicFilter() ); 475 476 // format not equal to current filter (with autodetection) 477 if( nError == ERRCODE_GRFILTER_FORMATERROR ) 478 nError = InsertGraphic( aFileName, OUString(), bAsLink, &GraphicFilter::GetGraphicFilter() ); 479 480 // #i123922# no new FrameFormat for replace mode, only when new object was created, 481 // else this would reset the current setting for the frame holding the graphic 482 if ( !bReplaceMode && rSh.IsFrameSelected() ) 483 { 484 SwFrameFormat* pFormat = pDoc->FindFrameFormatByName( sGraphicFormat ); 485 if(!pFormat) 486 pFormat = pDoc->MakeFrameFormat(sGraphicFormat, 487 pDocShell->GetDoc()->GetDfltFrameFormat(), 488 true, false); 489 rSh.SetFrameFormat( pFormat ); 490 } 491 492 const char* pResId(nullptr); 493 if( nError == ERRCODE_GRFILTER_OPENERROR ) 494 pResId = STR_GRFILTER_OPENERROR; 495 else if( nError == ERRCODE_GRFILTER_IOERROR ) 496 pResId = STR_GRFILTER_IOERROR; 497 else if( nError ==ERRCODE_GRFILTER_FORMATERROR ) 498 pResId = STR_GRFILTER_FORMATERROR; 499 else if( nError ==ERRCODE_GRFILTER_VERSIONERROR ) 500 pResId = STR_GRFILTER_VERSIONERROR; 501 else if( nError ==ERRCODE_GRFILTER_FILTERERROR ) 502 pResId = STR_GRFILTER_FILTERERROR; 503 else if( nError ==ERRCODE_GRFILTER_TOOBIG ) 504 pResId = STR_GRFILTER_TOOBIG; 505 506 rSh.EndAction(); 507 rSh.UnlockPaint(); 508 if (pResId) 509 { 510 if( bShowError ) 511 { 512 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), 513 VclMessageType::Info, VclButtonsType::Ok, 514 SwResId(pResId))); 515 xInfoBox->run(); 516 } 517 rReq.Ignore(); 518 } 519 else 520 { 521 // set the specific graphic attributes to the graphic 522 bReturn = true; 523 AutoCaption( GRAPHIC_CAP ); 524 rReq.Done(); 525 } 526 527 rSh.EndUndo(); // due to possible change of Shell 528 } 529 530 return bReturn; 531 } 532 533 void SwView::Execute(SfxRequest &rReq) 534 { 535 const sal_uInt16 nSlot = rReq.GetSlot(); 536 const SfxItemSet* pArgs = rReq.GetArgs(); 537 const SfxPoolItem* pItem; 538 bool bIgnore = false; 539 switch( nSlot ) 540 { 541 case SID_INSPECTOR_DECK: 542 { 543 OUString deckId; 544 if (nSlot == SID_INSPECTOR_DECK) 545 deckId = "InspectorDeck"; 546 ::sfx2::sidebar::Sidebar::ToggleDeck(deckId, GetViewFrame()); 547 } 548 break; 549 case SID_CREATE_SW_DRAWVIEW: 550 m_pWrtShell->getIDocumentDrawModelAccess().GetOrCreateDrawModel(); 551 break; 552 553 case FN_LINE_NUMBERING_DLG: 554 { 555 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 556 ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclSwViewDialog(*this)); 557 VclAbstractDialog::AsyncContext aContext; 558 aContext.maEndDialogFn = [](sal_Int32){}; 559 pDlg->StartExecuteAsync(aContext); 560 break; 561 } 562 case FN_EDIT_LINK_DLG: 563 EditLinkDlg(); 564 break; 565 case SID_REFRESH_VIEW: 566 GetEditWin().Invalidate(); 567 m_pWrtShell->Reformat(); 568 break; 569 case FN_PAGEUP: 570 case FN_PAGEUP_SEL: 571 case FN_PAGEDOWN: 572 case FN_PAGEDOWN_SEL: 573 { 574 tools::Rectangle aVis( GetVisArea() ); 575 SwEditWin& rTmpWin = GetEditWin(); 576 if ( FN_PAGEUP == nSlot || FN_PAGEUP_SEL == nSlot ) 577 PageUpCursor(FN_PAGEUP_SEL == nSlot); 578 else 579 PageDownCursor(FN_PAGEDOWN_SEL == nSlot); 580 581 rReq.SetReturnValue(SfxBoolItem(nSlot, 582 aVis != GetVisArea())); 583 //#i42732# - notify the edit window that from now on we do not use the input language 584 rTmpWin.SetUseInputLanguage( false ); 585 } 586 break; 587 case SID_ZOOM_IN: 588 case SID_ZOOM_OUT: 589 { 590 tools::Long nFact = m_pWrtShell->GetViewOptions()->GetZoom(); 591 if (SID_ZOOM_OUT == nSlot) 592 nFact = basegfx::zoomtools::zoomIn(nFact); 593 else 594 nFact = basegfx::zoomtools::zoomOut(nFact); 595 SetZoom(SvxZoomType::PERCENT, nFact); 596 } 597 break; 598 case FN_TO_PREV_PAGE: 599 case FN_TO_NEXT_PAGE: 600 { 601 sal_uInt16 nPage = 0; 602 if (m_pWrtShell->IsCursorVisible()) 603 nPage = m_pWrtShell->GetCursor()->GetPageNum(); 604 else 605 { 606 SwFrame* pPageFrame = m_pWrtShell->Imp()->GetFirstVisPage(m_pWrtShell->GetOut()); 607 if (pPageFrame) 608 nPage = pPageFrame->GetPhyPageNum(); 609 } 610 if (nPage != 0) 611 { 612 sal_uInt16 nOldPage(nPage); 613 if (FN_TO_PREV_PAGE == nSlot && nPage > 1) 614 nPage--; 615 else if (FN_TO_NEXT_PAGE == nSlot && nPage < m_pWrtShell->GetPageCount()) 616 nPage++; 617 if (nPage != nOldPage) 618 { 619 m_pWrtShell->LockPaint(); 620 if (IsDrawMode()) 621 LeaveDrawCreate(); 622 m_pWrtShell->EnterStdMode(); 623 m_pWrtShell->GotoPage(nPage, true); 624 // set visible area (borrowed from SwView::PhyPageUp/Down) 625 const Point aPt(m_aVisArea.Left(), m_pWrtShell->GetPagePos(nPage).Y()); 626 Point aAlPt(AlignToPixel(aPt)); 627 if(aPt.Y() != aAlPt.Y()) 628 aAlPt.AdjustY(3 * GetEditWin().PixelToLogic(Size(0, 1)).Height()); 629 SetVisArea(aAlPt); 630 m_pWrtShell->UnlockPaint(); 631 } 632 } 633 } 634 break; 635 case FN_SELECTION_CYCLE: 636 { 637 if (m_pWrtShell->IsSelFrameMode()) 638 break; 639 if (!m_pWrtShell->IsStdMode()) 640 m_pWrtShell->EnterStdMode(); 641 SwShellCursor *pCursor = m_pWrtShell->SwCursorShell::GetCursor_(); 642 Point CurrMarkPt = pCursor->GetMkPos(); 643 Point CurrPointPt = pCursor->GetPtPos(); 644 sal_uInt16 nStep = m_aSelectCycle.nStep; 645 if (nStep && (CurrMarkPt != m_aSelectCycle.m_MarkPt || CurrPointPt != m_aSelectCycle.m_PointPt)) 646 nStep = 0; 647 switch(nStep) 648 { 649 case 0: 650 m_aSelectCycle.m_pInitialCursor = CurrPointPt; 651 m_pWrtShell->SwCursorShell::ClearMark(); 652 m_pWrtShell->SelWrd(&CurrPointPt); 653 break; 654 case 1: 655 m_pWrtShell->SelSentence(&CurrPointPt); 656 break; 657 case 2: 658 m_pWrtShell->SelPara(&CurrPointPt); 659 break; 660 case 3: 661 m_pWrtShell->SwCursorShell::ClearMark(); 662 m_pWrtShell->SwCursorShell::SetCursor(m_aSelectCycle.m_pInitialCursor); 663 break; 664 } 665 nStep++; 666 nStep %= 4; 667 pCursor = m_pWrtShell->SwCursorShell::GetCursor_(); 668 m_aSelectCycle.m_MarkPt = pCursor->GetMkPos(); 669 m_aSelectCycle.m_PointPt = pCursor->GetPtPos(); 670 m_aSelectCycle.nStep = nStep; 671 } 672 break; 673 case FN_REDLINE_ON: 674 { 675 if( pArgs && 676 SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem )) 677 { 678 IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess(); 679 Sequence <sal_Int8> aPasswd = rIDRA.GetRedlinePassword(); 680 if( aPasswd.hasElements() ) 681 { 682 OSL_ENSURE( !static_cast<const SfxBoolItem*>(pItem)->GetValue(), "SwView::Execute(): password set and redlining off doesn't match!" ); 683 684 // dummy password from OOXML import: only confirmation dialog 685 if (aPasswd.getLength() == 1 && aPasswd[0] == 1) 686 { 687 std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(m_pWrtShell->GetView().GetFrameWeld(), 688 VclMessageType::Warning, VclButtonsType::YesNo, 689 SfxResId(RID_SVXSTR_END_REDLINING_WARNING))); 690 xWarn->set_default_response(RET_NO); 691 if (xWarn->run() == RET_YES) 692 rIDRA.SetRedlinePassword(Sequence <sal_Int8> ()); 693 else 694 break; 695 } 696 else 697 { 698 // xmlsec05: new password dialog 699 SfxPasswordDialog aPasswdDlg(GetFrameWeld()); 700 aPasswdDlg.SetMinLen(1); 701 //#i69751# the result of Execute() can be ignored 702 (void)aPasswdDlg.run(); 703 OUString sNewPasswd(aPasswdDlg.GetPassword()); 704 Sequence <sal_Int8> aNewPasswd = rIDRA.GetRedlinePassword(); 705 SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd ); 706 if(SvPasswordHelper::CompareHashPassword(aPasswd, sNewPasswd)) 707 rIDRA.SetRedlinePassword(Sequence <sal_Int8> ()); 708 else 709 { // xmlsec05: message box for wrong password 710 break; 711 } 712 } 713 } 714 715 SwDocShell* pDocShell = GetDocShell(); 716 pDocShell->SetChangeRecording( static_cast<const SfxBoolItem*>(pItem)->GetValue(), /*bLockAllViews=*/true ); 717 718 // Notify all view shells of this document, as the track changes mode is document-global. 719 for (SfxViewFrame* pViewFrame = SfxViewFrame::GetFirst(pDocShell); pViewFrame; pViewFrame = SfxViewFrame::GetNext(*pViewFrame, pDocShell)) 720 { 721 pViewFrame->GetBindings().Invalidate(FN_REDLINE_ON); 722 pViewFrame->GetBindings().Update(FN_REDLINE_ON); 723 } 724 } 725 } 726 break; 727 case FN_REDLINE_PROTECT : 728 { 729 IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess(); 730 Sequence <sal_Int8> aPasswd = rIDRA.GetRedlinePassword(); 731 if( pArgs && SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem ) 732 && static_cast<const SfxBoolItem*>(pItem)->GetValue() == aPasswd.hasElements() ) 733 break; 734 735 // xmlsec05: new password dialog 736 // message box for wrong password 737 SfxPasswordDialog aPasswdDlg(GetFrameWeld()); 738 aPasswdDlg.SetMinLen(1); 739 if (!aPasswd.hasElements()) 740 aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM); 741 if (aPasswdDlg.run()) 742 { 743 RedlineFlags nOn = RedlineFlags::On; 744 OUString sNewPasswd(aPasswdDlg.GetPassword()); 745 Sequence <sal_Int8> aNewPasswd = 746 rIDRA.GetRedlinePassword(); 747 SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd ); 748 if(!aPasswd.hasElements()) 749 { 750 rIDRA.SetRedlinePassword(aNewPasswd); 751 } 752 else if(SvPasswordHelper::CompareHashPassword(aPasswd, sNewPasswd)) 753 { 754 rIDRA.SetRedlinePassword(Sequence <sal_Int8> ()); 755 nOn = RedlineFlags::NONE; 756 } 757 const RedlineFlags nMode = rIDRA.GetRedlineFlags(); 758 m_pWrtShell->SetRedlineFlagsAndCheckInsMode( (nMode & ~RedlineFlags::On) | nOn); 759 rReq.AppendItem( SfxBoolItem( FN_REDLINE_PROTECT, !(nMode&RedlineFlags::On) ) ); 760 } 761 else 762 bIgnore = true; 763 } 764 break; 765 case FN_REDLINE_SHOW: 766 767 if( pArgs && 768 SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem)) 769 { 770 // tdf#125754 avoid recursive layout 771 // because all views share the layout, have to use AllAction 772 const bool bShow = static_cast<const SfxBoolItem*>(pItem)->GetValue(); 773 m_pWrtShell->StartAllAction(); 774 // always show redline insertions in Hide Changes mode 775 if ( m_pWrtShell->GetViewOptions()->IsShowChangesInMargin() && 776 m_pWrtShell->GetViewOptions()->IsShowChangesInMargin2() ) 777 { 778 GetDocShell()->GetDoc()->GetDocumentRedlineManager().HideAll(/*bDeletion=*/!bShow); 779 } 780 m_pWrtShell->GetLayout()->SetHideRedlines( !bShow ); 781 m_pWrtShell->EndAllAction(); 782 if (m_pWrtShell->IsRedlineOn()) 783 m_pWrtShell->SetInsMode(); 784 } 785 break; 786 case FN_MAILMERGE_SENDMAIL_CHILDWINDOW: 787 case FN_REDLINE_ACCEPT: 788 GetViewFrame()->ToggleChildWindow(nSlot); 789 break; 790 case FN_REDLINE_ACCEPT_DIRECT: 791 case FN_REDLINE_REJECT_DIRECT: 792 case FN_REDLINE_ACCEPT_TONEXT: 793 case FN_REDLINE_REJECT_TONEXT: 794 { 795 SwDoc *pDoc = m_pWrtShell->GetDoc(); 796 SwPaM *pCursor = m_pWrtShell->GetCursor(); 797 const SwRedlineTable& rRedlineTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); 798 SwRedlineTable::size_type nRedline = SwRedlineTable::npos; 799 if (pArgs && pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET) 800 { 801 const sal_Int64 nChangeId = static_cast<const SfxUInt32Item*>(pItem)->GetValue(); 802 for (SwRedlineTable::size_type i = 0; i < rRedlineTable.size(); ++i) 803 { 804 if (nChangeId == rRedlineTable[i]->GetId()) 805 nRedline = i; 806 } 807 } 808 809 if( pCursor->HasMark() && nRedline == SwRedlineTable::npos) 810 { 811 if (FN_REDLINE_ACCEPT_DIRECT == nSlot || FN_REDLINE_ACCEPT_TONEXT == nSlot) 812 m_pWrtShell->AcceptRedlinesInSelection(); 813 else 814 m_pWrtShell->RejectRedlinesInSelection(); 815 } 816 else 817 { 818 // We check for a redline at the start of the selection/cursor, not the point. 819 // This ensures we work properly with FN_REDLINE_NEXT_CHANGE, which leaves the 820 // point at the *end* of the redline and the mark at the start (so GetRedline 821 // would return NULL if called on the point) 822 const SwRangeRedline* pRedline = nullptr; 823 if (nRedline != SwRedlineTable::npos) 824 { 825 // A redline was explicitly requested by specifying an 826 // index, don't guess based on the cursor position. 827 828 if (nRedline < rRedlineTable.size()) 829 pRedline = rRedlineTable[nRedline]; 830 } 831 else 832 pRedline = pDoc->getIDocumentRedlineAccess().GetRedline(*pCursor->Start(), &nRedline); 833 834 assert(pRedline != nullptr); 835 if (pRedline) 836 { 837 if (FN_REDLINE_ACCEPT_DIRECT == nSlot || FN_REDLINE_ACCEPT_TONEXT == nSlot) 838 m_pWrtShell->AcceptRedline(nRedline); 839 else 840 m_pWrtShell->RejectRedline(nRedline); 841 } 842 } 843 if (FN_REDLINE_ACCEPT_TONEXT == nSlot || FN_REDLINE_REJECT_TONEXT == nSlot) 844 { 845 // Go to next change after accepting or rejecting one (tdf#101977) 846 GetViewFrame()->GetDispatcher()->Execute(FN_REDLINE_NEXT_CHANGE, SfxCallMode::ASYNCHRON); 847 } 848 } 849 break; 850 851 case FN_REDLINE_NEXT_CHANGE: 852 { 853 // If a parameter is provided, try going to the nth change, not to 854 // the next one. 855 SwDoc* pDoc = m_pWrtShell->GetDoc(); 856 const SwRedlineTable& rRedlineTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); 857 SwRedlineTable::size_type nRedline = SwRedlineTable::npos; 858 if (pArgs && pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET) 859 { 860 const sal_uInt32 nChangeId = static_cast<const SfxUInt32Item*>(pItem)->GetValue(); 861 for (SwRedlineTable::size_type i = 0; i < rRedlineTable.size(); ++i) 862 { 863 if (nChangeId == rRedlineTable[i]->GetId()) 864 nRedline = i; 865 } 866 } 867 868 const SwRangeRedline *pNext = nullptr; 869 if (nRedline < rRedlineTable.size()) 870 pNext = m_pWrtShell->GotoRedline(nRedline, true); 871 else 872 pNext = m_pWrtShell->SelNextRedline(); 873 874 if (pNext) 875 { 876 if (comphelper::LibreOfficeKit::isActive()) 877 { 878 OString aPayload(".uno:CurrentTrackedChangeId="); 879 sal_uInt32 nRedlineId = pNext->GetId(); 880 aPayload += OString::number(nRedlineId); 881 libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aPayload.getStr()); 882 } 883 884 m_pWrtShell->SetInSelect(); 885 } 886 887 } 888 break; 889 890 case FN_REDLINE_PREV_CHANGE: 891 { 892 const SwRangeRedline *pPrev = m_pWrtShell->SelPrevRedline(); 893 894 if (pPrev) 895 { 896 if (comphelper::LibreOfficeKit::isActive()) 897 { 898 OString aPayload(".uno:CurrentTrackedChangeId="); 899 sal_uInt32 nRedlineId = pPrev->GetId(); 900 aPayload += OString::number(nRedlineId); 901 libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aPayload.getStr()); 902 } 903 904 m_pWrtShell->SetInSelect(); 905 } 906 } 907 break; 908 909 case SID_DOCUMENT_COMPARE: 910 case SID_DOCUMENT_MERGE: 911 { 912 OUString sFileName, sFilterName; 913 sal_Int16 nVersion = 0; 914 bool bHasFileName = false; 915 m_pViewImpl->SetParam( 0 ); 916 bool bNoAcceptDialog = false; 917 918 if( pArgs ) 919 { 920 if( SfxItemState::SET == pArgs->GetItemState( SID_FILE_NAME, false, &pItem )) 921 sFileName = static_cast<const SfxStringItem*>(pItem)->GetValue(); 922 bHasFileName = !sFileName.isEmpty(); 923 924 if( SfxItemState::SET == pArgs->GetItemState( SID_FILTER_NAME, false, &pItem )) 925 sFilterName = static_cast<const SfxStringItem*>(pItem)->GetValue(); 926 927 if( SfxItemState::SET == pArgs->GetItemState( SID_VERSION, false, &pItem )) 928 { 929 nVersion = static_cast<const SfxInt16Item *>(pItem)->GetValue(); 930 m_pViewImpl->SetParam( nVersion ); 931 } 932 if( SfxItemState::SET == pArgs->GetItemState( SID_NO_ACCEPT_DIALOG, false, &pItem )) 933 { 934 bNoAcceptDialog = static_cast<const SfxBoolItem *>(pItem)->GetValue(); 935 } 936 } 937 938 m_pViewImpl->InitRequest( rReq ); 939 tools::Long nFound = InsertDoc( nSlot, sFileName, sFilterName, nVersion ); 940 941 if ( bHasFileName ) 942 { 943 rReq.SetReturnValue( SfxInt32Item( nSlot, nFound )); 944 945 if (nFound > 0 && !bNoAcceptDialog) // show Redline browser 946 { 947 SfxViewFrame* pVFrame = GetViewFrame(); 948 pVFrame->ShowChildWindow(FN_REDLINE_ACCEPT); 949 950 // re-initialize the Redline dialog 951 const sal_uInt16 nId = SwRedlineAcceptChild::GetChildWindowId(); 952 SwRedlineAcceptChild *pRed = static_cast<SwRedlineAcceptChild*>( 953 pVFrame->GetChildWindow(nId)); 954 if (pRed) 955 pRed->ReInitDlg(GetDocShell()); 956 } 957 } 958 else 959 bIgnore = true; 960 } 961 break; 962 case FN_SYNC_LABELS: 963 GetViewFrame()->ShowChildWindow(nSlot); 964 break; 965 case FN_ESCAPE: 966 { 967 if ( m_pWrtShell->HasDrawViewDrag() ) 968 { 969 m_pWrtShell->BreakDrag(); 970 m_pWrtShell->EnterSelFrameMode(); 971 } 972 else if ( m_pWrtShell->IsDrawCreate() ) 973 { 974 GetDrawFuncPtr()->BreakCreate(); 975 AttrChangedNotify(nullptr); // shell change if needed 976 } 977 else if ( m_pWrtShell->HasSelection() || IsDrawMode() ) 978 { 979 SdrView *pSdrView = m_pWrtShell->HasDrawView() ? m_pWrtShell->GetDrawView() : nullptr; 980 if(pSdrView && pSdrView->AreObjectsMarked() && 981 pSdrView->GetHdlList().GetFocusHdl()) 982 { 983 const_cast<SdrHdlList&>(pSdrView->GetHdlList()).ResetFocusHdl(); 984 } 985 else 986 { 987 if(pSdrView) 988 { 989 LeaveDrawCreate(); 990 Point aPt(LONG_MIN, LONG_MIN); 991 //go out of the frame 992 m_pWrtShell->SelectObj(aPt, SW_LEAVE_FRAME); 993 SfxBindings& rBind = GetViewFrame()->GetBindings(); 994 rBind.Invalidate( SID_ATTR_SIZE ); 995 } 996 m_pWrtShell->EnterStdMode(); 997 AttrChangedNotify(nullptr); // shell change if necessary 998 } 999 } 1000 else if ( GetEditWin().GetApplyTemplate() ) 1001 { 1002 GetEditWin().SetApplyTemplate(SwApplyTemplate()); 1003 } 1004 else if( static_cast<SfxObjectShell*>(GetDocShell())->IsInPlaceActive() ) 1005 { 1006 Escape(); 1007 } 1008 else if ( GetEditWin().IsChainMode() ) 1009 { 1010 GetEditWin().SetChainMode( false ); 1011 } 1012 else if( m_pWrtShell->GetFlyFrameFormat() ) 1013 { 1014 const SwFrameFormat* pFormat = m_pWrtShell->GetFlyFrameFormat(); 1015 if(m_pWrtShell->GotoFly( pFormat->GetName(), FLYCNTTYPE_FRM )) 1016 { 1017 m_pWrtShell->HideCursor(); 1018 m_pWrtShell->EnterSelFrameMode(); 1019 } 1020 } 1021 else 1022 { 1023 SfxBoolItem aItem( SID_WIN_FULLSCREEN, false ); 1024 GetViewFrame()->GetDispatcher()->ExecuteList(SID_WIN_FULLSCREEN, 1025 SfxCallMode::RECORD, { &aItem }); 1026 bIgnore = true; 1027 } 1028 } 1029 break; 1030 case SID_ATTR_BORDER_INNER: 1031 case SID_ATTR_BORDER_OUTER: 1032 case SID_ATTR_BORDER_SHADOW: 1033 if(pArgs) 1034 m_pWrtShell->SetAttrSet(*pArgs); 1035 break; 1036 1037 case SID_ATTR_PAGE: 1038 case SID_ATTR_PAGE_SIZE: 1039 case SID_ATTR_PAGE_MAXSIZE: 1040 case SID_ATTR_PAGE_PAPERBIN: 1041 case SID_ATTR_PAGE_EXT1: 1042 case FN_PARAM_FTN_INFO: 1043 { 1044 if(pArgs) 1045 { 1046 const size_t nCurIdx = m_pWrtShell->GetCurPageDesc(); 1047 SwPageDesc aPageDesc( m_pWrtShell->GetPageDesc( nCurIdx ) ); 1048 ::ItemSetToPageDesc( *pArgs, aPageDesc ); 1049 // change the descriptor of the core 1050 m_pWrtShell->ChgPageDesc( nCurIdx, aPageDesc ); 1051 } 1052 } 1053 break; 1054 case FN_GOTO_PAGE: 1055 { 1056 SwGotoPageDlg aDlg(GetViewFrame()->GetWindow().GetFrameWeld(), &GetViewFrame()->GetBindings()); 1057 if (aDlg.run() == RET_OK) 1058 GetWrtShell().GotoPage(aDlg.GetPageSelection(), true); 1059 } 1060 break; 1061 case FN_EDIT_CURRENT_TOX: 1062 { 1063 GetViewFrame()->GetDispatcher()->Execute( 1064 FN_INSERT_MULTI_TOX, SfxCallMode::ASYNCHRON); 1065 } 1066 break; 1067 case FN_UPDATE_CUR_TOX: 1068 { 1069 const SwTOXBase* pBase = m_pWrtShell->GetCurTOX(); 1070 if(pBase) 1071 { 1072 // tdf#106374: don't jump view on the update 1073 const bool bWasLocked = m_pWrtShell->IsViewLocked(); 1074 m_pWrtShell->LockView(true); 1075 m_pWrtShell->StartAction(); 1076 if(TOX_INDEX == pBase->GetType()) 1077 m_pWrtShell->ApplyAutoMark(); 1078 m_pWrtShell->UpdateTableOf( *pBase ); 1079 m_pWrtShell->EndAction(); 1080 if (!bWasLocked) 1081 m_pWrtShell->LockView(false); 1082 } 1083 } 1084 break; 1085 case FN_UPDATE_TOX: 1086 { 1087 m_pWrtShell->StartAction(); 1088 m_pWrtShell->EnterStdMode(); 1089 bool bOldCursorInReadOnly = m_pWrtShell->IsReadOnlyAvailable(); 1090 m_pWrtShell->SetReadOnlyAvailable( true ); 1091 1092 for( int i = 0; i < 2; ++i ) 1093 { 1094 if( m_pWrtShell->GetTOXCount() == 1 ) 1095 ++i; 1096 1097 while( m_pWrtShell->GotoPrevTOXBase() ) 1098 ; // jump to the first "table of ..." 1099 1100 // if we are not in one, jump to next 1101 const SwTOXBase* pBase = m_pWrtShell->GetCurTOX(); 1102 if( !pBase ) 1103 { 1104 m_pWrtShell->GotoNextTOXBase(); 1105 pBase = m_pWrtShell->GetCurTOX(); 1106 } 1107 1108 bool bAutoMarkApplied = false; 1109 while( pBase ) 1110 { 1111 if(TOX_INDEX == pBase->GetType() && !bAutoMarkApplied) 1112 { 1113 m_pWrtShell->ApplyAutoMark(); 1114 bAutoMarkApplied = true; 1115 } 1116 // pBase is needed only for the interface. Should be changed in future! (JP 1996) 1117 m_pWrtShell->UpdateTableOf( *pBase ); 1118 1119 if( m_pWrtShell->GotoNextTOXBase() ) 1120 pBase = m_pWrtShell->GetCurTOX(); 1121 else 1122 pBase = nullptr; 1123 } 1124 } 1125 m_pWrtShell->SetReadOnlyAvailable( bOldCursorInReadOnly ); 1126 m_pWrtShell->EndAction(); 1127 } 1128 break; 1129 case SID_ATTR_BRUSH: 1130 { 1131 if(pArgs && SfxItemState::SET == pArgs->GetItemState(RES_BACKGROUND, false, &pItem)) 1132 { 1133 const size_t nCurIdx = m_pWrtShell->GetCurPageDesc(); 1134 SwPageDesc aDesc( m_pWrtShell->GetPageDesc( nCurIdx )); 1135 SwFrameFormat& rMaster = aDesc.GetMaster(); 1136 rMaster.SetFormatAttr(*pItem); 1137 m_pWrtShell->ChgPageDesc( nCurIdx, aDesc); 1138 } 1139 } 1140 break; 1141 case SID_CLEARHISTORY: 1142 { 1143 m_pWrtShell->DelAllUndoObj(); 1144 } 1145 break; 1146 case SID_UNDO: 1147 { 1148 m_pShell->ExecuteSlot(rReq); 1149 } 1150 break; 1151 #if defined(_WIN32) || defined UNX 1152 case SID_TWAIN_SELECT: 1153 case SID_TWAIN_TRANSFER: 1154 GetViewImpl()->ExecuteScan( rReq ); 1155 break; 1156 #endif 1157 1158 case SID_ATTR_DEFTABSTOP: 1159 { 1160 if(pArgs && SfxItemState::SET == pArgs->GetItemState(SID_ATTR_DEFTABSTOP, false, &pItem)) 1161 { 1162 SvxTabStopItem aDefTabs( 0, 0, SvxTabAdjust::Default, RES_PARATR_TABSTOP ); 1163 const sal_uInt16 nTab = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); 1164 MakeDefTabs( nTab, aDefTabs ); 1165 m_pWrtShell->SetDefault( aDefTabs ); 1166 } 1167 } 1168 break; 1169 case SID_ATTR_LANGUAGE : 1170 if(pArgs && SfxItemState::SET == pArgs->GetItemState(SID_ATTR_LANGUAGE, false, &pItem)) 1171 { 1172 SvxLanguageItem aLang(static_cast<const SvxLanguageItem*>(pItem)->GetLanguage(), RES_CHRATR_LANGUAGE); 1173 m_pWrtShell->SetDefault( aLang ); 1174 lcl_SetAllTextToDefaultLanguage( *m_pWrtShell, RES_CHRATR_LANGUAGE ); 1175 } 1176 break; 1177 case SID_ATTR_CHAR_CTL_LANGUAGE: 1178 if(pArgs && SfxItemState::SET == pArgs->GetItemState(RES_CHRATR_CTL_LANGUAGE, false, &pItem)) 1179 { 1180 m_pWrtShell->SetDefault( *pItem ); 1181 lcl_SetAllTextToDefaultLanguage( *m_pWrtShell, RES_CHRATR_CTL_LANGUAGE ); 1182 } 1183 break; 1184 case SID_ATTR_CHAR_CJK_LANGUAGE: 1185 if(pArgs && SfxItemState::SET == pArgs->GetItemState(RES_CHRATR_CJK_LANGUAGE, false, &pItem)) 1186 { 1187 m_pWrtShell->SetDefault( *pItem ); 1188 lcl_SetAllTextToDefaultLanguage( *m_pWrtShell, RES_CHRATR_CJK_LANGUAGE ); 1189 } 1190 break; 1191 case FN_TOGGLE_OUTLINE_CONTENT_VISIBILITY: 1192 { 1193 m_pWrtShell->EnterStdMode(); 1194 size_t nPos(m_pWrtShell->GetOutlinePos()); 1195 m_pWrtShell->ToggleOutlineContentVisibility(nPos); 1196 m_pWrtShell->GotoOutline(nPos); 1197 } 1198 break; 1199 case FN_NAV_ELEMENT: 1200 { 1201 // nothing here on purpose - if removed only the listbox that changed is changed 1202 } 1203 break; 1204 case FN_SCROLL_PREV: 1205 case FN_SCROLL_NEXT: 1206 { 1207 bool *pbNext = new bool(true); 1208 if (nSlot == FN_SCROLL_PREV) 1209 *pbNext = false; 1210 MoveNavigationHdl(pbNext); 1211 } 1212 break; 1213 case SID_JUMPTOMARK: 1214 if( pArgs && SfxItemState::SET == pArgs->GetItemState(SID_JUMPTOMARK, false, &pItem)) 1215 JumpToSwMark( static_cast<const SfxStringItem*>(pItem)->GetValue() ); 1216 break; 1217 case SID_GALLERY : 1218 // First make sure that the sidebar is visible 1219 GetViewFrame()->ShowChildWindow(SID_SIDEBAR); 1220 1221 ::sfx2::sidebar::Sidebar::ShowPanel( 1222 u"GalleryPanel", 1223 GetViewFrame()->GetFrame().GetFrameInterface()); 1224 break; 1225 case SID_AVMEDIA_PLAYER : 1226 GetViewFrame()->ChildWindowExecute(rReq); 1227 break; 1228 case SID_VIEW_DATA_SOURCE_BROWSER: 1229 { 1230 SfxViewFrame* pVFrame = GetViewFrame(); 1231 pVFrame->ChildWindowExecute(rReq); 1232 if(pVFrame->HasChildWindow(SID_BROWSER)) 1233 { 1234 const SwDBData& rData = GetWrtShell().GetDBData(); 1235 SwModule::ShowDBObj(*this, rData); 1236 } 1237 } 1238 break; 1239 case FN_INSERT_FIELD_DATA_ONLY: 1240 { 1241 bool bShow = false; 1242 if( pArgs && 1243 SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem )) 1244 bShow = static_cast<const SfxBoolItem*>(pItem)->GetValue(); 1245 if((bShow && m_bInMailMerge) != GetViewFrame()->HasChildWindow(nSlot)) 1246 GetViewFrame()->ToggleChildWindow(nSlot); 1247 //if fields have been successfully inserted call the "real" 1248 //mail merge dialog 1249 #if HAVE_FEATURE_DBCONNECTIVITY 1250 SwWrtShell &rSh = GetWrtShell(); 1251 if(m_bInMailMerge && rSh.IsAnyDatabaseFieldInDoc()) 1252 { 1253 SwDBManager* pDBManager = rSh.GetDBManager(); 1254 if (pDBManager) 1255 { 1256 SwDBData aData = rSh.GetDBData(); 1257 rSh.EnterStdMode(); // force change in text shell; necessary for mixing DB fields 1258 AttrChangedNotify(nullptr); 1259 1260 Sequence<PropertyValue> aProperties(3); 1261 PropertyValue* pValues = aProperties.getArray(); 1262 pValues[0].Name = "DataSourceName"; 1263 pValues[1].Name = "Command"; 1264 pValues[2].Name = "CommandType"; 1265 pValues[0].Value <<= aData.sDataSource; 1266 pValues[1].Value <<= aData.sCommand; 1267 pValues[2].Value <<= aData.nCommandType; 1268 pDBManager->ExecuteFormLetter(rSh, aProperties); 1269 } 1270 } 1271 #endif 1272 m_bInMailMerge &= bShow; 1273 GetViewFrame()->GetBindings().Invalidate(FN_INSERT_FIELD); 1274 } 1275 break; 1276 case FN_QRY_MERGE: 1277 { 1278 bool bUseCurrentDocument = true; 1279 bool bQuery = !pArgs || SfxItemState::SET != pArgs->GetItemState(nSlot); 1280 if(bQuery) 1281 { 1282 SfxViewFrame* pTmpFrame = GetViewFrame(); 1283 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 1284 ScopedVclPtr<AbstractMailMergeCreateFromDlg> pDlg(pFact->CreateMailMergeCreateFromDlg(pTmpFrame->GetWindow().GetFrameWeld())); 1285 if (RET_OK == pDlg->Execute()) 1286 bUseCurrentDocument = pDlg->IsThisDocument(); 1287 else 1288 break; 1289 } 1290 GenerateFormLetter(bUseCurrentDocument); 1291 } 1292 break; 1293 case SID_RECHECK_DOCUMENT: 1294 { 1295 SwDocShell* pDocShell = GetDocShell(); 1296 SwDoc* pDoc = pDocShell->GetDoc(); 1297 uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( pDoc->GetGCIterator() ); 1298 if( xGCIterator.is() ) 1299 { 1300 xGCIterator->resetIgnoreRules(); 1301 } 1302 // reset ignore lists 1303 pDoc->SpellItAgainSam( true, false, false ); 1304 // clear ignore dictionary 1305 uno::Reference< linguistic2::XDictionary > xDictionary = LinguMgr::GetIgnoreAllList(); 1306 if( xDictionary.is() ) 1307 xDictionary->clear(); 1308 // put cursor to the start of the document 1309 m_pWrtShell->StartOfSection(); 1310 [[fallthrough]]; // call spell/grammar dialog 1311 } 1312 case FN_SPELL_GRAMMAR_DIALOG: 1313 { 1314 SfxViewFrame* pViewFrame = GetViewFrame(); 1315 if (rReq.GetArgs() != nullptr) 1316 pViewFrame->SetChildWindow (FN_SPELL_GRAMMAR_DIALOG, 1317 static_cast<const SfxBoolItem&>( (rReq.GetArgs()-> 1318 Get(FN_SPELL_GRAMMAR_DIALOG))).GetValue()); 1319 else 1320 pViewFrame->ToggleChildWindow(FN_SPELL_GRAMMAR_DIALOG); 1321 1322 pViewFrame->GetBindings().Invalidate(FN_SPELL_GRAMMAR_DIALOG); 1323 rReq.Ignore (); 1324 } 1325 break; 1326 case SID_ALIGN_ANY_LEFT : 1327 case SID_ALIGN_ANY_HCENTER : 1328 case SID_ALIGN_ANY_RIGHT : 1329 case SID_ALIGN_ANY_JUSTIFIED: 1330 case SID_ALIGN_ANY_TOP : 1331 case SID_ALIGN_ANY_VCENTER : 1332 case SID_ALIGN_ANY_BOTTOM : 1333 case SID_ALIGN_ANY_HDEFAULT : 1334 case SID_ALIGN_ANY_VDEFAULT : 1335 { 1336 sal_uInt16 nAlias = 0; 1337 if( m_nSelectionType & (SelectionType::DrawObjectEditMode|SelectionType::Text) ) 1338 { 1339 switch( nSlot ) 1340 { 1341 case SID_ALIGN_ANY_LEFT : nAlias = SID_ATTR_PARA_ADJUST_LEFT; break; 1342 case SID_ALIGN_ANY_HCENTER : nAlias = SID_ATTR_PARA_ADJUST_CENTER; break; 1343 case SID_ALIGN_ANY_RIGHT : nAlias = SID_ATTR_PARA_ADJUST_RIGHT; break; 1344 case SID_ALIGN_ANY_JUSTIFIED: nAlias = SID_ATTR_PARA_ADJUST_BLOCK; break; 1345 case SID_ALIGN_ANY_TOP : nAlias = SID_TABLE_VERT_NONE; break; 1346 case SID_ALIGN_ANY_VCENTER : nAlias = SID_TABLE_VERT_CENTER; break; 1347 case SID_ALIGN_ANY_BOTTOM : nAlias = SID_TABLE_VERT_BOTTOM; break; 1348 } 1349 } 1350 else 1351 { 1352 switch( nSlot ) 1353 { 1354 case SID_ALIGN_ANY_LEFT : nAlias = SID_OBJECT_ALIGN_LEFT ; break; 1355 case SID_ALIGN_ANY_HCENTER : nAlias = SID_OBJECT_ALIGN_CENTER ; break; 1356 case SID_ALIGN_ANY_RIGHT : nAlias = SID_OBJECT_ALIGN_RIGHT ; break; 1357 case SID_ALIGN_ANY_TOP : nAlias = SID_OBJECT_ALIGN_UP ; break; 1358 case SID_ALIGN_ANY_VCENTER : nAlias = SID_OBJECT_ALIGN_MIDDLE ; break; 1359 case SID_ALIGN_ANY_BOTTOM : nAlias = SID_OBJECT_ALIGN_DOWN ; break; 1360 } 1361 } 1362 //these slots are either re-mapped to text or object alignment 1363 if (nAlias) 1364 GetViewFrame()->GetDispatcher()->Execute( 1365 nAlias, SfxCallMode::ASYNCHRON); 1366 } 1367 break; 1368 case SID_RESTORE_EDITING_VIEW: 1369 { 1370 //#i33307# restore editing position 1371 Point aCursorPos; 1372 bool bSelectObj; 1373 if(m_pViewImpl->GetRestorePosition(aCursorPos, bSelectObj)) 1374 { 1375 m_pWrtShell->SwCursorShell::SetCursor( aCursorPos, !bSelectObj ); 1376 if( bSelectObj ) 1377 { 1378 m_pWrtShell->SelectObj( aCursorPos ); 1379 m_pWrtShell->EnterSelFrameMode( &aCursorPos ); 1380 } 1381 } 1382 } 1383 break; 1384 case SID_INSERT_GRAPHIC: 1385 { 1386 rReq.SetReturnValue(SfxBoolItem(nSlot, InsertGraphicDlg( rReq ))); 1387 } 1388 break; 1389 case SID_MOVE_SHAPE_HANDLE: 1390 { 1391 if (pArgs && pArgs->Count() == 3) 1392 { 1393 SdrView *pSdrView = m_pWrtShell->HasDrawView() ? m_pWrtShell->GetDrawView() : nullptr; 1394 if (pSdrView == nullptr) 1395 break; 1396 const SfxUInt32Item* handleNumItem = rReq.GetArg<SfxUInt32Item>(FN_PARAM_1); 1397 const SfxUInt32Item* newPosXTwips = rReq.GetArg<SfxUInt32Item>(FN_PARAM_2); 1398 const SfxUInt32Item* newPosYTwips = rReq.GetArg<SfxUInt32Item>(FN_PARAM_3); 1399 1400 const sal_uLong handleNum = handleNumItem->GetValue(); 1401 const sal_uLong newPosX = newPosXTwips->GetValue(); 1402 const sal_uLong newPosY = newPosYTwips->GetValue(); 1403 pSdrView->MoveShapeHandle(handleNum, Point(newPosX, newPosY)); 1404 } 1405 break; 1406 } 1407 1408 default: 1409 OSL_ENSURE(false, "wrong dispatcher"); 1410 return; 1411 } 1412 if(!bIgnore) 1413 rReq.Done(); 1414 } 1415 1416 bool SwView::IsConditionalFastCall( const SfxRequest &rReq ) 1417 { 1418 sal_uInt16 nId = rReq.GetSlot(); 1419 bool bRet = false; 1420 1421 if (nId == FN_REDLINE_ACCEPT_DIRECT || nId == FN_REDLINE_REJECT_DIRECT) 1422 { 1423 if (comphelper::LibreOfficeKit::isActive()) 1424 bRet = true; 1425 } 1426 return bRet || SfxShell::IsConditionalFastCall(rReq); 1427 1428 } 1429 1430 /// invalidate page numbering field 1431 void SwView::UpdatePageNums() 1432 { 1433 SfxBindings &rBnd = GetViewFrame()->GetBindings(); 1434 rBnd.Invalidate(FN_STAT_PAGE); 1435 } 1436 1437 void SwView::UpdateDocStats() 1438 { 1439 SfxBindings &rBnd = GetViewFrame()->GetBindings(); 1440 rBnd.Invalidate( FN_STAT_WORDCOUNT ); 1441 rBnd.Update( FN_STAT_WORDCOUNT ); 1442 } 1443 1444 /// get status of the status line 1445 void SwView::StateStatusLine(SfxItemSet &rSet) 1446 { 1447 SwWrtShell& rShell = GetWrtShell(); 1448 1449 SfxWhichIter aIter( rSet ); 1450 sal_uInt16 nWhich = aIter.FirstWhich(); 1451 OSL_ENSURE( nWhich, "empty set"); 1452 1453 //get section change event 1454 const SwSection* CurrSect = rShell.GetCurrSection(); 1455 if( CurrSect ) 1456 { 1457 const OUString& sCurrentSectionName = CurrSect->GetSectionName(); 1458 if(sCurrentSectionName != m_sOldSectionName) 1459 { 1460 SwCursorShell::FireSectionChangeEvent(2, 1); 1461 } 1462 m_sOldSectionName = sCurrentSectionName; 1463 } 1464 else if (!m_sOldSectionName.isEmpty()) 1465 { 1466 SwCursorShell::FireSectionChangeEvent(2, 1); 1467 m_sOldSectionName= OUString(); 1468 } 1469 //get column change event 1470 if(rShell.bColumnChange()) 1471 { 1472 SwCursorShell::FireColumnChangeEvent(2, 1); 1473 } 1474 1475 while( nWhich ) 1476 { 1477 switch( nWhich ) 1478 { 1479 case FN_STAT_PAGE: { 1480 // number of pages, log. page number 1481 sal_uInt16 nPage, nLogPage; 1482 OUString sDisplay; 1483 rShell.GetPageNumber( -1, rShell.IsCursorVisible(), nPage, nLogPage, sDisplay ); 1484 std::vector<OUString> aStringList; 1485 aStringList.push_back(GetPageStr(nPage, nLogPage, sDisplay)); 1486 bool bExtendedTooltip(!sDisplay.isEmpty() && 1487 std::u16string_view(OUString::number(nPage)) != sDisplay && 1488 nPage != nLogPage); 1489 OUString aTooltip = bExtendedTooltip ? SwResId(STR_BOOKCTRL_HINT_EXTENDED) 1490 : SwResId(STR_BOOKCTRL_HINT); 1491 aStringList.push_back(aTooltip); 1492 rSet.Put(SfxStringListItem(FN_STAT_PAGE, &aStringList)); 1493 //if existing page number is not equal to old page number, send out this event. 1494 if (m_nOldPageNum != nLogPage ) 1495 { 1496 if (m_nOldPageNum != 0) 1497 SwCursorShell::FirePageChangeEvent(m_nOldPageNum, nLogPage); 1498 m_nOldPageNum = nLogPage; 1499 } 1500 const sal_uInt16 nCnt = GetWrtShell().GetPageCnt(); 1501 if (m_nPageCnt != nCnt) // notify Basic 1502 { 1503 m_nPageCnt = nCnt; 1504 SfxGetpApp()->NotifyEvent(SfxEventHint(SfxEventHintId::SwEventPageCount, SwDocShell::GetEventName(STR_SW_EVENT_PAGE_COUNT), GetViewFrame()->GetObjectShell()), false); 1505 } 1506 } 1507 break; 1508 1509 case FN_STAT_WORDCOUNT: 1510 { 1511 SwDocStat selectionStats; 1512 SwDocStat documentStats; 1513 rShell.CountWords(selectionStats); 1514 documentStats = rShell.GetDoc()->getIDocumentStatistics().GetUpdatedDocStat( true /* complete-async */, false /* don't update fields */ ); 1515 1516 sal_uLong nWord = selectionStats.nWord ? selectionStats.nWord : documentStats.nWord; 1517 sal_uLong nChar = selectionStats.nChar ? selectionStats.nChar : documentStats.nChar; 1518 const char* pResId = selectionStats.nWord ? STR_WORDCOUNT : STR_WORDCOUNT_NO_SELECTION; 1519 const char* pWordResId = selectionStats.nWord ? STR_WORDCOUNT_WORDARG : STR_WORDCOUNT_WORDARG_NO_SELECTION; 1520 const char* pCharResId = selectionStats.nWord ? STR_WORDCOUNT_CHARARG : STR_WORDCOUNT_CHARARG_NO_SELECTION; 1521 1522 const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetUILocaleDataWrapper(); 1523 OUString aWordArg = SwResId(pWordResId, nWord).replaceAll("$1", rLocaleData.getNum(nWord, 0)); 1524 OUString aCharArg = SwResId(pCharResId, nChar).replaceAll("$1", rLocaleData.getNum(nChar, 0)); 1525 OUString aWordCount(SwResId(pResId)); 1526 aWordCount = aWordCount.replaceAll("$1", aWordArg); 1527 aWordCount = aWordCount.replaceAll("$2", aCharArg); 1528 1529 rSet.Put( SfxStringItem( FN_STAT_WORDCOUNT, aWordCount ) ); 1530 1531 SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(GetViewFrame()->GetChildWindow(SwWordCountWrapper::GetChildWindowId())); 1532 if (pWrdCnt) 1533 pWrdCnt->SetCounts(selectionStats, documentStats); 1534 } 1535 break; 1536 1537 case FN_STAT_TEMPLATE: 1538 { 1539 rSet.Put(SfxStringItem( FN_STAT_TEMPLATE, 1540 rShell.GetCurPageStyle())); 1541 1542 } 1543 break; 1544 case SID_ATTR_ZOOM: 1545 { 1546 if ( ( GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) 1547 { 1548 const SwViewOption* pVOpt = rShell.GetViewOptions(); 1549 SvxZoomType eZoom = pVOpt->GetZoomType(); 1550 SvxZoomItem aZoom(eZoom, 1551 pVOpt->GetZoom()); 1552 if( pVOpt->getBrowseMode() ) 1553 { 1554 aZoom.SetValueSet( 1555 SvxZoomEnableFlags::N50| 1556 SvxZoomEnableFlags::N75| 1557 SvxZoomEnableFlags::N100| 1558 SvxZoomEnableFlags::N150| 1559 SvxZoomEnableFlags::N200); 1560 } 1561 rSet.Put( aZoom ); 1562 } 1563 else 1564 rSet.DisableItem( SID_ATTR_ZOOM ); 1565 } 1566 break; 1567 case SID_ATTR_VIEWLAYOUT: 1568 { 1569 if ( ( GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) 1570 { 1571 const SwViewOption* pVOpt = rShell.GetViewOptions(); 1572 const sal_uInt16 nColumns = pVOpt->GetViewLayoutColumns(); 1573 const bool bBookMode = pVOpt->IsViewLayoutBookMode(); 1574 SvxViewLayoutItem aViewLayout(nColumns, bBookMode); 1575 rSet.Put( aViewLayout ); 1576 } 1577 else 1578 rSet.DisableItem( SID_ATTR_VIEWLAYOUT ); 1579 } 1580 break; 1581 case SID_ATTR_ZOOMSLIDER: 1582 { 1583 if ( ( GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) 1584 { 1585 const SwViewOption* pVOpt = rShell.GetViewOptions(); 1586 const sal_uInt16 nCurrentZoom = pVOpt->GetZoom(); 1587 SvxZoomSliderItem aZoomSliderItem( nCurrentZoom, MINZOOM, MAXZOOM ); 1588 aZoomSliderItem.AddSnappingPoint( 100 ); 1589 1590 if ( !m_pWrtShell->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE) ) 1591 { 1592 const sal_uInt16 nColumns = pVOpt->GetViewLayoutColumns(); 1593 const bool bAutomaticViewLayout = 0 == nColumns; 1594 const SwPostItMgr* pMgr = GetPostItMgr(); 1595 1596 // snapping points: 1597 // automatic mode: 1 Page, 2 Pages, 100% 1598 // n Columns mode: n Pages, 100% 1599 // n Columns book mode: nPages without gaps, 100% 1600 const SwRect aPageRect( m_pWrtShell->GetAnyCurRect( CurRectType::PageCalc ) ); 1601 const SwRect aRootRect( m_pWrtShell->GetAnyCurRect( CurRectType::PagesArea ) ); // width of columns 1602 Size aPageSize( aPageRect.SSize() ); 1603 aPageSize.AdjustWidth(pMgr->HasNotes() && pMgr->ShowNotes() ? 1604 pMgr->GetSidebarWidth() + pMgr->GetSidebarBorderWidth() : 1605 0 ); 1606 1607 Size aRootSize( aRootRect.SSize() ); 1608 1609 const MapMode aTmpMap( MapUnit::MapTwip ); 1610 const Size& rEditSize = GetEditWin().GetOutputSizePixel(); 1611 const Size aWindowSize( GetEditWin().PixelToLogic( rEditSize, aTmpMap ) ); 1612 1613 const tools::Long nOf = pVOpt->GetDocumentBorder() * 2; 1614 tools::Long nTmpWidth = bAutomaticViewLayout ? aPageSize.Width() : aRootSize.Width(); 1615 nTmpWidth += nOf; 1616 aPageSize.AdjustHeight(nOf ); 1617 tools::Long nFac = aWindowSize.Width() * 100 / nTmpWidth; 1618 1619 tools::Long nVisPercent = aWindowSize.Height() * 100 / aPageSize.Height(); 1620 nFac = std::min( nFac, nVisPercent ); 1621 1622 if (nFac >= MINZOOM) 1623 { 1624 aZoomSliderItem.AddSnappingPoint( nFac ); 1625 } 1626 1627 if ( bAutomaticViewLayout ) 1628 { 1629 nTmpWidth += aPageSize.Width() + pVOpt->GetGapBetweenPages(); 1630 nFac = aWindowSize.Width() * 100 / nTmpWidth; 1631 nFac = std::min( nFac, nVisPercent ); 1632 if (nFac >= MINZOOM) 1633 { 1634 aZoomSliderItem.AddSnappingPoint( nFac ); 1635 } 1636 } 1637 } 1638 1639 rSet.Put( aZoomSliderItem ); 1640 } 1641 else 1642 rSet.DisableItem( SID_ATTR_ZOOMSLIDER ); 1643 } 1644 break; 1645 case SID_ATTR_POSITION: 1646 case SID_ATTR_SIZE: 1647 { 1648 if( !rShell.IsFrameSelected() && !rShell.IsObjSelected() ) 1649 SwBaseShell::SetFrameMode_( FLY_DRAG_END ); 1650 else 1651 { 1652 FlyMode eFrameMode = SwBaseShell::GetFrameMode(); 1653 if ( eFrameMode == FLY_DRAG_START || eFrameMode == FLY_DRAG ) 1654 { 1655 if ( nWhich == SID_ATTR_POSITION ) 1656 rSet.Put( SfxPointItem( SID_ATTR_POSITION, 1657 rShell.GetAnchorObjDiff())); 1658 else 1659 rSet.Put( SvxSizeItem( SID_ATTR_SIZE, 1660 rShell.GetObjSize())); 1661 } 1662 } 1663 } 1664 break; 1665 case SID_TABLE_CELL: 1666 1667 if( rShell.IsFrameSelected() || rShell.IsObjSelected() ) 1668 { 1669 // #i39171# Don't put a SvxSizeItem into a slot which is defined as SfxStringItem. 1670 // SvxPosSizeStatusBarControl no longer resets to empty display if only one slot 1671 // has no item, so SID_TABLE_CELL can remain empty (the SvxSizeItem is supplied 1672 // in SID_ATTR_SIZE). 1673 } 1674 else 1675 { 1676 OUString sStr; 1677 if( rShell.IsCursorInTable() ) 1678 { 1679 // table name + cell coordinate 1680 sStr = rShell.GetTableFormat()->GetName() + ":"; 1681 sStr += rShell.GetBoxNms(); 1682 } 1683 else 1684 { 1685 const SwSection* pCurrSect = rShell.GetCurrSection(); 1686 if( pCurrSect ) 1687 { 1688 switch( pCurrSect->GetType() ) 1689 { 1690 case SectionType::ToxHeader: 1691 case SectionType::ToxContent: 1692 { 1693 const SwTOXBase* pTOX = m_pWrtShell->GetCurTOX(); 1694 if( pTOX ) 1695 sStr = pTOX->GetTOXName(); 1696 else 1697 { 1698 OSL_ENSURE( false, 1699 "Unknown kind of section" ); 1700 sStr = pCurrSect->GetSectionName(); 1701 } 1702 } 1703 break; 1704 default: 1705 sStr = pCurrSect->GetSectionName(); 1706 break; 1707 } 1708 } 1709 } 1710 1711 const SwNumRule* pNumRule = rShell.GetNumRuleAtCurrCursorPos(); 1712 const bool bOutlineNum = pNumRule && pNumRule->IsOutlineRule(); 1713 1714 if (pNumRule && !bOutlineNum ) // cursor in numbering 1715 { 1716 sal_uInt8 nNumLevel = rShell.GetNumLevel(); 1717 if ( nNumLevel < MAXLEVEL ) 1718 { 1719 if(!pNumRule->IsAutoRule()) 1720 { 1721 SfxItemSet aSet(GetPool(), 1722 svl::Items<RES_PARATR_NUMRULE, RES_PARATR_NUMRULE>{}); 1723 rShell.GetCurAttr(aSet); 1724 if(SfxItemState::DEFAULT <= 1725 aSet.GetItemState(RES_PARATR_NUMRULE)) 1726 { 1727 const OUString& rNumStyle = 1728 aSet.Get(RES_PARATR_NUMRULE).GetValue(); 1729 if(!rNumStyle.isEmpty()) 1730 { 1731 if(!sStr.isEmpty()) 1732 sStr += sStatusDelim; 1733 sStr += rNumStyle; 1734 } 1735 } 1736 } 1737 if (!sStr.isEmpty()) 1738 sStr += sStatusDelim; 1739 sStr += SwResId(STR_NUM_LEVEL) + OUString::number( nNumLevel + 1 ); 1740 1741 } 1742 } 1743 const int nOutlineLevel = rShell.GetCurrentParaOutlineLevel(); 1744 if( nOutlineLevel != 0 ) 1745 { 1746 if (!sStr.isEmpty()) 1747 sStr += " , "; 1748 if( bOutlineNum ) 1749 { 1750 sStr += SwResId(STR_OUTLINE_NUMBERING) + 1751 sStatusDelim + SwResId(STR_NUM_LEVEL); 1752 } 1753 else 1754 sStr += SwResId(STR_NUM_OUTLINE); 1755 sStr += OUString::number( nOutlineLevel); 1756 } 1757 1758 if( rShell.HasReadonlySel() ) 1759 { 1760 if (!sStr.isEmpty()) 1761 sStr = sStatusDelim + sStr; 1762 sStr = SwResId(SW_STR_READONLY) + sStr; 1763 } 1764 if (!sStr.isEmpty()) 1765 rSet.Put( SfxStringItem( SID_TABLE_CELL, sStr )); 1766 } 1767 break; 1768 case FN_STAT_SELMODE: 1769 { 1770 if(rShell.IsStdMode()) 1771 rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 0)); 1772 else if(rShell.IsAddMode()) 1773 rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 2)); 1774 else if(rShell.IsBlockMode()) 1775 rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 3)); 1776 else 1777 rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 1)); 1778 break; 1779 } 1780 case SID_ATTR_INSERT: 1781 if( rShell.IsRedlineOn() ) 1782 rSet.DisableItem( nWhich ); 1783 else 1784 { 1785 rSet.Put(SfxBoolItem(SID_ATTR_INSERT,rShell.IsInsMode())); 1786 } 1787 break; 1788 } 1789 nWhich = aIter.NextWhich(); 1790 } 1791 } 1792 1793 /** execute method for the status line 1794 * 1795 * @param rReq ??? 1796 */ 1797 void SwView::ExecuteStatusLine(SfxRequest &rReq) 1798 { 1799 SwWrtShell &rSh = GetWrtShell(); 1800 const SfxItemSet* pArgs = rReq.GetArgs(); 1801 const SfxPoolItem* pItem=nullptr; 1802 bool bUp = false; 1803 sal_uInt16 nWhich = rReq.GetSlot(); 1804 switch( nWhich ) 1805 { 1806 case FN_STAT_PAGE: 1807 { 1808 GetViewFrame()->GetDispatcher()->Execute( FN_GOTO_PAGE, 1809 SfxCallMode::SYNCHRON|SfxCallMode::RECORD ); 1810 } 1811 break; 1812 1813 case FN_STAT_WORDCOUNT: 1814 { 1815 GetViewFrame()->GetDispatcher()->Execute(FN_WORDCOUNT_DIALOG, 1816 SfxCallMode::SYNCHRON|SfxCallMode::RECORD ); 1817 } 1818 break; 1819 1820 case FN_STAT_BOOKMARK: 1821 if ( pArgs ) 1822 { 1823 if (SfxItemState::SET == pArgs->GetItemState( nWhich, true, &pItem)) 1824 { 1825 const IDocumentMarkAccess* pMarkAccess = rSh.getIDocumentMarkAccess(); 1826 const sal_Int32 nIdx = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); 1827 if(nIdx < pMarkAccess->getBookmarksCount()) 1828 { 1829 const IDocumentMarkAccess::const_iterator_t ppBookmark = rSh.getIDocumentMarkAccess()->getBookmarksBegin() + nIdx; 1830 rSh.EnterStdMode(); 1831 rSh.GotoMark( *ppBookmark ); 1832 } 1833 else 1834 OSL_FAIL("SwView::ExecuteStatusLine(..)" 1835 " - Ignoring out of range bookmark index"); 1836 } 1837 } 1838 break; 1839 1840 case FN_STAT_TEMPLATE: 1841 { 1842 GetViewFrame()->GetDispatcher()->Execute(FN_FORMAT_PAGE_DLG, 1843 SfxCallMode::SYNCHRON|SfxCallMode::RECORD ); 1844 } 1845 break; 1846 case SID_ATTR_ZOOM: 1847 { 1848 if ( ( GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) 1849 { 1850 const SfxItemSet *pSet = nullptr; 1851 ScopedVclPtr<AbstractSvxZoomDialog> pDlg; 1852 if ( pArgs ) 1853 pSet = pArgs; 1854 else 1855 { 1856 const SwViewOption& rViewOptions = *rSh.GetViewOptions(); 1857 SfxItemSet aCoreSet(m_pShell->GetPool(), svl::Items<SID_ATTR_ZOOM, SID_ATTR_ZOOM, SID_ATTR_VIEWLAYOUT, SID_ATTR_VIEWLAYOUT>{} ); 1858 SvxZoomItem aZoom( rViewOptions.GetZoomType(), rViewOptions.GetZoom() ); 1859 1860 const bool bBrowseMode = rSh.GetViewOptions()->getBrowseMode(); 1861 if( bBrowseMode ) 1862 { 1863 aZoom.SetValueSet( 1864 SvxZoomEnableFlags::N50| 1865 SvxZoomEnableFlags::N75| 1866 SvxZoomEnableFlags::N100| 1867 SvxZoomEnableFlags::N150| 1868 SvxZoomEnableFlags::N200); 1869 } 1870 aCoreSet.Put( aZoom ); 1871 1872 if ( !bBrowseMode ) 1873 { 1874 const SvxViewLayoutItem aViewLayout( rViewOptions.GetViewLayoutColumns(), rViewOptions.IsViewLayoutBookMode() ); 1875 aCoreSet.Put( aViewLayout ); 1876 } 1877 1878 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 1879 pDlg.disposeAndReset(pFact->CreateSvxZoomDialog(GetViewFrame()->GetWindow().GetFrameWeld(), aCoreSet)); 1880 pDlg->SetLimits( MINZOOM, MAXZOOM ); 1881 if( pDlg->Execute() != RET_CANCEL ) 1882 pSet = pDlg->GetOutputItemSet(); 1883 } 1884 1885 const SfxPoolItem* pViewLayoutItem = nullptr; 1886 if ( pSet && SfxItemState::SET == pSet->GetItemState(SID_ATTR_VIEWLAYOUT, true, &pViewLayoutItem)) 1887 { 1888 const sal_uInt16 nColumns = static_cast<const SvxViewLayoutItem *>(pViewLayoutItem)->GetValue(); 1889 const bool bBookMode = static_cast<const SvxViewLayoutItem *>(pViewLayoutItem)->IsBookMode(); 1890 SetViewLayout( nColumns, bBookMode ); 1891 } 1892 1893 if ( pSet && SfxItemState::SET == pSet->GetItemState(SID_ATTR_ZOOM, true, &pItem)) 1894 { 1895 SvxZoomType eType = static_cast<const SvxZoomItem *>(pItem)->GetType(); 1896 SetZoom( eType, static_cast<const SvxZoomItem *>(pItem)->GetValue() ); 1897 } 1898 bUp = true; 1899 if ( pItem ) 1900 rReq.AppendItem( *pItem ); 1901 rReq.Done(); 1902 } 1903 } 1904 break; 1905 1906 case SID_ATTR_VIEWLAYOUT: 1907 { 1908 if ( pArgs && !rSh.getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE) && 1909 ( ( GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) ) 1910 { 1911 if ( SfxItemState::SET == pArgs->GetItemState(SID_ATTR_VIEWLAYOUT, true, &pItem )) 1912 { 1913 const sal_uInt16 nColumns = static_cast<const SvxViewLayoutItem *>(pItem)->GetValue(); 1914 const bool bBookMode = (0 != nColumns && 0 == (nColumns % 2)) && 1915 static_cast<const SvxViewLayoutItem *>(pItem)->IsBookMode(); 1916 1917 SetViewLayout( nColumns, bBookMode ); 1918 } 1919 1920 bUp = true; 1921 rReq.Done(); 1922 1923 InvalidateRulerPos(); 1924 } 1925 } 1926 break; 1927 1928 case SID_ATTR_ZOOMSLIDER: 1929 { 1930 if ( pArgs && ( ( GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) ) 1931 { 1932 if ( SfxItemState::SET == pArgs->GetItemState(SID_ATTR_ZOOMSLIDER, true, &pItem )) 1933 { 1934 const sal_uInt16 nCurrentZoom = static_cast<const SvxZoomSliderItem *>(pItem)->GetValue(); 1935 SetZoom( SvxZoomType::PERCENT, nCurrentZoom ); 1936 } 1937 1938 bUp = true; 1939 rReq.Done(); 1940 } 1941 } 1942 break; 1943 1944 case SID_ATTR_SIZE: 1945 { 1946 sal_uInt16 nId = 0; 1947 if( rSh.IsCursorInTable() ) 1948 nId = FN_FORMAT_TABLE_DLG; 1949 else if( rSh.GetCurTOX() ) 1950 nId = FN_INSERT_MULTI_TOX; 1951 else if( rSh.GetCurrSection() ) 1952 nId = FN_EDIT_REGION; 1953 else 1954 { 1955 const SwNumRule* pNumRule = rSh.GetNumRuleAtCurrCursorPos(); 1956 if( pNumRule ) // cursor in numbering 1957 { 1958 if( pNumRule->IsAutoRule() ) 1959 nId = FN_NUMBER_BULLETS; 1960 else 1961 { 1962 // start dialog of the painter 1963 nId = 0; 1964 } 1965 } 1966 else if( rSh.IsFrameSelected() ) 1967 nId = FN_FORMAT_FRAME_DLG; 1968 else if( rSh.IsObjSelected() ) 1969 nId = SID_ATTR_TRANSFORM; 1970 } 1971 if( nId ) 1972 GetViewFrame()->GetDispatcher()->Execute(nId, 1973 SfxCallMode::SYNCHRON | SfxCallMode::RECORD ); 1974 } 1975 break; 1976 1977 case FN_STAT_SELMODE: 1978 { 1979 if ( pArgs ) 1980 { 1981 if (SfxItemState::SET == pArgs->GetItemState( nWhich, true, &pItem)) 1982 { 1983 switch ( static_cast<const SfxUInt16Item *>(pItem)->GetValue() ) 1984 { 1985 case 0: rSh.EnterStdMode(); break; 1986 case 1: rSh.EnterExtMode(); break; 1987 case 2: rSh.EnterAddMode(); break; 1988 case 3: rSh.EnterBlockMode(); break; 1989 } 1990 } 1991 } 1992 else 1993 { 1994 1995 if( !rSh.IsAddMode() && !rSh.IsExtMode() && !rSh.IsBlockMode() ) 1996 rSh.ToggleExtMode(); 1997 else if ( rSh.IsExtMode() ) 1998 { 1999 rSh.ToggleExtMode(); 2000 rSh.ToggleAddMode(); 2001 } 2002 else if ( rSh.IsAddMode() ) 2003 { 2004 rSh.ToggleAddMode(); 2005 rSh.ToggleBlockMode(); 2006 } 2007 else 2008 rSh.ToggleBlockMode(); 2009 } 2010 bUp = true; 2011 break; 2012 } 2013 case FN_SET_ADD_MODE: 2014 rSh.ToggleAddMode(); 2015 nWhich = FN_STAT_SELMODE; 2016 bUp = true; 2017 break; 2018 case FN_SET_BLOCK_MODE: 2019 rSh.ToggleBlockMode(); 2020 nWhich = FN_STAT_SELMODE; 2021 bUp = true; 2022 break; 2023 case FN_SET_EXT_MODE: 2024 rSh.ToggleExtMode(); 2025 nWhich = FN_STAT_SELMODE; 2026 bUp = true; 2027 break; 2028 case SID_ATTR_INSERT: 2029 SwPostItMgr* pMgr = GetPostItMgr(); 2030 if ( pMgr && pMgr->HasActiveSidebarWin() ) 2031 { 2032 pMgr->ToggleInsModeOnActiveSidebarWin(); 2033 } 2034 else 2035 rSh.ToggleInsMode(); 2036 bUp = true; 2037 break; 2038 2039 } 2040 if ( bUp ) 2041 { 2042 SfxBindings &rBnd = GetViewFrame()->GetBindings(); 2043 rBnd.Invalidate(nWhich); 2044 rBnd.Update(nWhich); 2045 } 2046 } 2047 2048 void SwView::InsFrameMode(sal_uInt16 nCols) 2049 { 2050 if ( m_pWrtShell->HasWholeTabSelection() ) 2051 { 2052 SwFlyFrameAttrMgr aMgr( true, m_pWrtShell.get(), Frmmgr_Type::TEXT, nullptr ); 2053 2054 const SwFrameFormat &rPageFormat = 2055 m_pWrtShell->GetPageDesc(m_pWrtShell->GetCurPageDesc()).GetMaster(); 2056 SwTwips lWidth = rPageFormat.GetFrameSize().GetWidth(); 2057 const SvxLRSpaceItem &rLR = rPageFormat.GetLRSpace(); 2058 lWidth -= rLR.GetLeft() + rLR.GetRight(); 2059 aMgr.SetSize(Size(lWidth, aMgr.GetSize().Height())); 2060 if(nCols > 1) 2061 { 2062 SwFormatCol aCol; 2063 aCol.Init( nCols, aCol.GetGutterWidth(), aCol.GetWishWidth() ); 2064 aMgr.SetCol( aCol ); 2065 } 2066 aMgr.InsertFlyFrame(); 2067 } 2068 else 2069 GetEditWin().InsFrame(nCols); 2070 } 2071 2072 /// show "edit link" dialog 2073 void SwView::EditLinkDlg() 2074 { 2075 bool bWeb = dynamic_cast<SwWebView*>( this ) != nullptr; 2076 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 2077 ScopedVclPtr<SfxAbstractLinksDialog> pDlg(pFact->CreateLinksDialog(GetViewFrame()->GetWindow().GetFrameWeld(), &GetWrtShell().GetLinkManager(), bWeb)); 2078 pDlg->Execute(); 2079 } 2080 2081 static auto JumpToTOXMark(SwWrtShell & rSh, OUString const& rName) -> bool 2082 { 2083 sal_Int32 const first(rName.indexOf(toxMarkSeparator)); 2084 if (first == -1) 2085 { 2086 SAL_WARN("sw.ui", "JumpToTOXMark: missing separator"); 2087 return false; 2088 } 2089 sal_Int32 const counter(rName.copy(0, first).toInt32()); 2090 if (counter <= 0) 2091 { 2092 SAL_WARN("sw.ui", "JumpToTOXMark: invalid counter"); 2093 return false; 2094 } 2095 sal_Int32 const second(rName.indexOf(toxMarkSeparator, first + 1)); 2096 if (second == -1) 2097 { 2098 SAL_WARN("sw.ui", "JumpToTOXMark: missing separator"); 2099 return false; 2100 } 2101 OUString const entry(rName.copy(first + 1, second - (first + 1))); 2102 if (rName.getLength() < second + 2) 2103 { 2104 SAL_WARN("sw.ui", "JumpToTOXMark: invalid tox"); 2105 return false; 2106 } 2107 sal_uInt16 const indexType(rName[second + 1]); 2108 OUString const indexName(rName.copy(second + 2)); 2109 SwTOXType const* pType(nullptr); 2110 switch (indexType) 2111 { 2112 case 'A': 2113 pType = rSh.GetTOXType(TOX_INDEX, 0); 2114 assert(pType); 2115 break; 2116 case 'C': 2117 pType = rSh.GetTOXType(TOX_CONTENT, 0); 2118 assert(pType); 2119 break; 2120 case 'U': 2121 for (auto i = rSh.GetTOXTypeCount(TOX_USER); 0 < i; ) 2122 { 2123 --i; 2124 auto const pTmp(rSh.GetTOXType(TOX_USER, i)); 2125 if (pTmp->GetTypeName() == indexName) 2126 { 2127 pType = pTmp; 2128 break; 2129 } 2130 } 2131 break; 2132 } 2133 if (!pType) 2134 { 2135 SAL_WARN("sw.ui", "JumpToTOXMark: tox doesn't exist"); 2136 return false; 2137 } 2138 // type and alt text are the search keys 2139 SwTOXMark tmp(pType); 2140 tmp.SetAlternativeText(entry); 2141 SwTOXMark const* pMark(&tmp); 2142 // hack: check first if one exists 2143 if (&tmp != &rSh.GetDoc()->GotoTOXMark(tmp, TOX_SAME_NXT, rSh.IsReadOnlyAvailable())) 2144 { 2145 for (sal_Int32 i = 0; i < counter; ++i) 2146 { 2147 pMark = &rSh.GotoTOXMark(*pMark, TOX_SAME_NXT); 2148 } 2149 return true; 2150 } 2151 else 2152 { 2153 SAL_WARN("sw.ui", "JumpToTOXMark: tox mark doesn't exist"); 2154 return false; 2155 } 2156 } 2157 2158 bool SwView::JumpToSwMark( const OUString& rMark ) 2159 { 2160 bool bRet = false; 2161 if( !rMark.isEmpty() ) 2162 { 2163 // place bookmark at top-center 2164 bool bSaveCC = m_bCenterCursor; 2165 bool bSaveCT = m_bTopCursor; 2166 SetCursorAtTop( true ); 2167 2168 // For scrolling the FrameSet, the corresponding shell needs to have the focus. 2169 bool bHasShFocus = m_pWrtShell->HasShellFocus(); 2170 if( !bHasShFocus ) 2171 m_pWrtShell->ShellGetFocus(); 2172 2173 const SwFormatINetFormat* pINet; 2174 OUString sCmp; 2175 OUString sMark( INetURLObject::decode( rMark, 2176 INetURLObject::DecodeMechanism::WithCharset )); 2177 2178 sal_Int32 nLastPos, nPos = sMark.indexOf( cMarkSeparator ); 2179 if( -1 != nPos ) 2180 while( -1 != ( nLastPos = sMark.indexOf( cMarkSeparator, nPos + 1 )) ) 2181 nPos = nLastPos; 2182 2183 IDocumentMarkAccess::const_iterator_t ppMark; 2184 IDocumentMarkAccess* const pMarkAccess = m_pWrtShell->getIDocumentMarkAccess(); 2185 if( -1 != nPos ) 2186 sCmp = sMark.copy(nPos + 1).replaceAll(" ", ""); 2187 2188 if( !sCmp.isEmpty() ) 2189 { 2190 OUString sName( sMark.copy( 0, nPos ) ); 2191 sCmp = sCmp.toAsciiLowerCase(); 2192 FlyCntType eFlyType = FLYCNTTYPE_ALL; 2193 2194 if (sCmp == "drawingobject") 2195 bRet = m_pWrtShell->GotoDrawingObject(sName); 2196 else if( sCmp == "region" ) 2197 { 2198 m_pWrtShell->EnterStdMode(); 2199 bRet = m_pWrtShell->GotoRegion( sName ); 2200 } 2201 else if( sCmp == "outline" ) 2202 { 2203 m_pWrtShell->EnterStdMode(); 2204 bRet = m_pWrtShell->GotoOutline( sName ); 2205 } 2206 else if( sCmp == "frame" ) 2207 eFlyType = FLYCNTTYPE_FRM; 2208 else if( sCmp == "graphic" ) 2209 eFlyType = FLYCNTTYPE_GRF; 2210 else if( sCmp == "ole" ) 2211 eFlyType = FLYCNTTYPE_OLE; 2212 else if( sCmp == "table" ) 2213 { 2214 m_pWrtShell->EnterStdMode(); 2215 bRet = m_pWrtShell->GotoTable( sName ); 2216 } 2217 else if( sCmp == "sequence" ) 2218 { 2219 m_pWrtShell->EnterStdMode(); 2220 sal_Int32 nNoPos = sName.indexOf( cSequenceMarkSeparator ); 2221 if ( nNoPos != -1 ) 2222 { 2223 sal_uInt16 nSeqNo = sName.copy( nNoPos + 1 ).toInt32(); 2224 sName = sName.copy( 0, nNoPos ); 2225 bRet = m_pWrtShell->GotoRefMark(sName, REF_SEQUENCEFLD, nSeqNo); 2226 } 2227 } 2228 else if (sCmp == "toxmark") 2229 { 2230 bRet = JumpToTOXMark(*m_pWrtShell, sName); 2231 } 2232 else if( sCmp == "text" ) 2233 { 2234 // normal text search 2235 m_pWrtShell->EnterStdMode(); 2236 2237 i18nutil::SearchOptions2 aSearchOpt( 2238 SearchAlgorithms_ABSOLUTE, 0, 2239 sName, OUString(), 2240 SvtSysLocale().GetLanguageTag().getLocale(), 2241 0,0,0, 2242 TransliterationFlags::IGNORE_CASE, 2243 SearchAlgorithms2::ABSOLUTE, 2244 '\\' ); 2245 2246 //todo/mba: assuming that notes shouldn't be searched 2247 if( m_pWrtShell->SearchPattern( aSearchOpt, false/*bSearchInNotes*/, SwDocPositions::Start, SwDocPositions::End )) 2248 { 2249 m_pWrtShell->EnterStdMode(); // remove the selection 2250 bRet = true; 2251 } 2252 } 2253 else if( pMarkAccess->getAllMarksEnd() != (ppMark = pMarkAccess->findMark(sMark)) ) 2254 { 2255 bRet = m_pWrtShell->GotoMark( *ppMark, false ); 2256 } 2257 else if( nullptr != ( pINet = m_pWrtShell->FindINetAttr( sMark ) )) { 2258 m_pWrtShell->addCurrentPosition(); 2259 bRet = m_pWrtShell->GotoINetAttr( *pINet->GetTextINetFormat() ); 2260 } 2261 2262 // for all types of Flys 2263 if( FLYCNTTYPE_ALL != eFlyType && m_pWrtShell->GotoFly( sName, eFlyType )) 2264 { 2265 bRet = true; 2266 if( FLYCNTTYPE_FRM == eFlyType ) 2267 { 2268 // TextFrames: set Cursor in the frame 2269 m_pWrtShell->UnSelectFrame(); 2270 m_pWrtShell->LeaveSelFrameMode(); 2271 } 2272 else 2273 { 2274 m_pWrtShell->HideCursor(); 2275 m_pWrtShell->EnterSelFrameMode(); 2276 } 2277 } 2278 } 2279 else if( pMarkAccess->getAllMarksEnd() != (ppMark = pMarkAccess->findMark(sMark))) 2280 { 2281 bRet = m_pWrtShell->GotoMark( *ppMark, false ); 2282 } 2283 else if( nullptr != ( pINet = m_pWrtShell->FindINetAttr( sMark ) )) 2284 bRet = m_pWrtShell->GotoINetAttr( *pINet->GetTextINetFormat() ); 2285 2286 // make selection visible later 2287 if ( m_aVisArea.IsEmpty() ) 2288 m_bMakeSelectionVisible = true; 2289 2290 // reset ViewStatus 2291 SetCursorAtTop( bSaveCT, bSaveCC ); 2292 2293 if(!m_pWrtShell->IsFrameSelected() && !m_pWrtShell->IsObjSelected()) 2294 m_pWrtShell->ShowCursor(); 2295 2296 if( !bHasShFocus ) 2297 m_pWrtShell->ShellLoseFocus(); 2298 } 2299 return bRet; 2300 } 2301 2302 // #i67305# Undo after insert from file: 2303 // Undo "Insert form file" crashes with documents imported from binary filter (.sdw) => disabled 2304 // Undo "Insert form file" crashes with (.odt) documents crashes if these documents contains 2305 // page styles with active header/footer => disabled for those documents 2306 static size_t lcl_PageDescWithHeader( const SwDoc& rDoc ) 2307 { 2308 size_t nRet = 0; 2309 size_t nCnt = rDoc.GetPageDescCnt(); 2310 for( size_t i = 0; i < nCnt; ++i ) 2311 { 2312 const SwPageDesc& rPageDesc = rDoc.GetPageDesc( i ); 2313 const SwFrameFormat& rMaster = rPageDesc.GetMaster(); 2314 const SfxPoolItem* pItem; 2315 if( ( SfxItemState::SET == rMaster.GetAttrSet().GetItemState( RES_HEADER, false, &pItem ) && 2316 static_cast<const SwFormatHeader*>(pItem)->IsActive() ) || 2317 ( SfxItemState::SET == rMaster.GetAttrSet().GetItemState( RES_FOOTER, false, &pItem ) && 2318 static_cast<const SwFormatFooter*>(pItem)->IsActive()) ) 2319 ++nRet; 2320 } 2321 return nRet; // number of page styles with active header/footer 2322 } 2323 2324 void SwView::ExecuteInsertDoc( SfxRequest& rRequest, const SfxPoolItem* pItem ) 2325 { 2326 m_pViewImpl->InitRequest( rRequest ); 2327 m_pViewImpl->SetParam( pItem ? 1 : 0 ); 2328 const sal_uInt16 nSlot = rRequest.GetSlot(); 2329 2330 if ( !pItem ) 2331 { 2332 InsertDoc( nSlot, "", "" ); 2333 } 2334 else 2335 { 2336 OUString sFile, sFilter; 2337 sFile = static_cast<const SfxStringItem *>( pItem )->GetValue(); 2338 if ( SfxItemState::SET == rRequest.GetArgs()->GetItemState( FN_PARAM_1, true, &pItem ) ) 2339 sFilter = static_cast<const SfxStringItem *>(pItem )->GetValue(); 2340 2341 bool bHasFileName = !sFile.isEmpty(); 2342 tools::Long nFound = InsertDoc( nSlot, sFile, sFilter ); 2343 2344 if ( bHasFileName ) 2345 { 2346 rRequest.SetReturnValue( SfxBoolItem( nSlot, nFound != -1 ) ); 2347 rRequest.Done(); 2348 } 2349 } 2350 } 2351 2352 tools::Long SwView::InsertDoc( sal_uInt16 nSlotId, const OUString& rFileName, const OUString& rFilterName, sal_Int16 nVersion ) 2353 { 2354 std::unique_ptr<SfxMedium> pMed; 2355 SwDocShell* pDocSh = GetDocShell(); 2356 2357 if( !rFileName.isEmpty() ) 2358 { 2359 SfxObjectFactory& rFact = pDocSh->GetFactory(); 2360 std::shared_ptr<const SfxFilter> pFilter = rFact.GetFilterContainer()->GetFilter4FilterName( rFilterName ); 2361 if ( !pFilter ) 2362 { 2363 pMed.reset(new SfxMedium(rFileName, StreamMode::READ, nullptr, nullptr )); 2364 SfxFilterMatcher aMatcher( rFact.GetFilterContainer()->GetName() ); 2365 pMed->UseInteractionHandler( true ); 2366 ErrCode nErr = aMatcher.GuessFilter(*pMed, pFilter, SfxFilterFlags::NONE); 2367 if ( nErr ) 2368 pMed.reset(); 2369 else 2370 pMed->SetFilter( pFilter ); 2371 } 2372 else 2373 pMed.reset(new SfxMedium(rFileName, StreamMode::READ, pFilter, nullptr)); 2374 } 2375 else 2376 { 2377 m_pViewImpl->StartDocumentInserter( 2378 // tdf#118578 allow inserting any Writer document except GlobalDoc 2379 SwDocShell::Factory().GetFactoryName(), 2380 LINK( this, SwView, DialogClosedHdl ), 2381 nSlotId 2382 ); 2383 return -1; 2384 } 2385 2386 if( !pMed ) 2387 return -1; 2388 2389 return InsertMedium( nSlotId, std::move(pMed), nVersion ); 2390 } 2391 2392 tools::Long SwView::InsertMedium( sal_uInt16 nSlotId, std::unique_ptr<SfxMedium> pMedium, sal_Int16 nVersion ) 2393 { 2394 bool bInsert = false, bCompare = false; 2395 tools::Long nFound = 0; 2396 SwDocShell* pDocSh = GetDocShell(); 2397 2398 switch( nSlotId ) 2399 { 2400 case SID_DOCUMENT_MERGE: break; 2401 case SID_DOCUMENT_COMPARE: bCompare = true; break; 2402 case SID_INSERTDOC: bInsert = true; break; 2403 2404 default: 2405 OSL_ENSURE( false, "unknown SlotId!" ); 2406 bInsert = true; 2407 break; 2408 } 2409 2410 if( bInsert ) 2411 { 2412 uno::Reference< frame::XDispatchRecorder > xRecorder = 2413 GetViewFrame()->GetBindings().GetRecorder(); 2414 if ( xRecorder.is() ) 2415 { 2416 SfxRequest aRequest(GetViewFrame(), SID_INSERTDOC); 2417 aRequest.AppendItem(SfxStringItem(SID_INSERTDOC, pMedium->GetOrigURL())); 2418 if(pMedium->GetFilter()) 2419 aRequest.AppendItem(SfxStringItem(FN_PARAM_1, pMedium->GetFilter()->GetName())); 2420 aRequest.Done(); 2421 } 2422 2423 SfxObjectShellRef aRef( pDocSh ); 2424 2425 ErrCode nError = SfxObjectShell::HandleFilter( pMedium.get(), pDocSh ); 2426 // #i16722# aborted? 2427 if(nError != ERRCODE_NONE) 2428 { 2429 return -1; 2430 } 2431 2432 pMedium->Download(); // start download if needed 2433 if( aRef.is() && 1 < aRef->GetRefCount() ) // still a valid ref? 2434 { 2435 SwReaderPtr pRdr; 2436 Reader *pRead = pDocSh->StartConvertFrom(*pMedium, pRdr, m_pWrtShell.get()); 2437 if( pRead || 2438 (pMedium->GetFilter()->GetFilterFlags() & SfxFilterFlags::STARONEFILTER) ) 2439 { 2440 size_t nUndoCheck = 0; 2441 SwDoc *pDoc = pDocSh->GetDoc(); 2442 if( pRead && pDocSh->GetDoc() ) 2443 nUndoCheck = lcl_PageDescWithHeader( *pDoc ); 2444 ErrCode nErrno; 2445 { //Scope for SwWait-Object, to be able to execute slots 2446 //outside this scope. 2447 SwWait aWait( *GetDocShell(), true ); 2448 m_pWrtShell->StartAllAction(); 2449 if ( m_pWrtShell->HasSelection() ) 2450 m_pWrtShell->DelRight(); // delete selections 2451 if( pRead ) 2452 { 2453 nErrno = pRdr->Read( *pRead ); // and insert document 2454 pRdr.reset(); 2455 } 2456 else 2457 { 2458 ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo()); 2459 uno::Reference<text::XTextRange> const xInsertPosition( 2460 SwXTextRange::CreateXTextRange(*pDoc, 2461 *m_pWrtShell->GetCursor()->GetPoint(), nullptr)); 2462 nErrno = pDocSh->ImportFrom(*pMedium, xInsertPosition) 2463 ? ERRCODE_NONE : ERR_SWG_READ_ERROR; 2464 } 2465 2466 } 2467 2468 // update all "table of ..." sections if needed 2469 if( m_pWrtShell->IsUpdateTOX() ) 2470 { 2471 SfxRequest aReq( FN_UPDATE_TOX, SfxCallMode::SLOT, GetPool() ); 2472 Execute( aReq ); 2473 m_pWrtShell->SetUpdateTOX( false ); // reset 2474 } 2475 2476 if( pDoc ) 2477 { // Disable Undo for .sdw or 2478 // if the number of page styles with header/footer has changed 2479 if( !pRead || nUndoCheck != lcl_PageDescWithHeader( *pDoc ) ) 2480 { 2481 pDoc->GetIDocumentUndoRedo().DelAllUndoObj(); 2482 } 2483 } 2484 2485 m_pWrtShell->EndAllAction(); 2486 if( nErrno ) 2487 { 2488 ErrorHandler::HandleError( nErrno ); 2489 nFound = nErrno.IsError() ? -1 : 0; 2490 } 2491 else 2492 nFound = 0; 2493 } 2494 } 2495 } 2496 else 2497 { 2498 SfxObjectShellRef xDocSh; 2499 SfxObjectShellLock xLockRef; 2500 2501 const int nRet = SwFindDocShell( xDocSh, xLockRef, pMedium->GetName(), OUString(), 2502 OUString(), nVersion, pDocSh ); 2503 if( nRet ) 2504 { 2505 SwWait aWait( *GetDocShell(), true ); 2506 m_pWrtShell->StartAllAction(); 2507 2508 m_pWrtShell->EnterStdMode(); // delete selections 2509 2510 if( bCompare ) 2511 nFound = m_pWrtShell->CompareDoc( *static_cast<SwDocShell*>( xDocSh.get() )->GetDoc() ); 2512 else 2513 nFound = m_pWrtShell->MergeDoc( *static_cast<SwDocShell*>( xDocSh.get() )->GetDoc() ); 2514 2515 m_pWrtShell->EndAllAction(); 2516 2517 if (!bCompare && !nFound) 2518 { 2519 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetEditWin().GetFrameWeld(), 2520 VclMessageType::Info, VclButtonsType::Ok, 2521 SwResId(STR_NO_MERGE_ENTRY))); 2522 xInfoBox->run(); 2523 } 2524 if( nRet==2 && xDocSh.is() ) 2525 xDocSh->DoClose(); 2526 } 2527 } 2528 2529 return nFound; 2530 } 2531 2532 void SwView::EnableMailMerge() 2533 { 2534 m_bInMailMerge = true; 2535 SfxBindings& rBind = GetViewFrame()->GetBindings(); 2536 rBind.Invalidate(FN_INSERT_FIELD_DATA_ONLY); 2537 rBind.Update(FN_INSERT_FIELD_DATA_ONLY); 2538 } 2539 2540 #if HAVE_FEATURE_DBCONNECTIVITY 2541 2542 namespace 2543 { 2544 bool lcl_NeedAdditionalDataSource( const uno::Reference< XDatabaseContext >& _rDatasourceContext ) 2545 { 2546 Sequence < OUString > aNames = _rDatasourceContext->getElementNames(); 2547 2548 return ( !aNames.hasElements() 2549 || ( ( 1 == aNames.getLength() ) 2550 && aNames.getConstArray()[0] == SW_MOD()->GetDBConfig()->GetBibliographySource().sDataSource 2551 ) 2552 ); 2553 } 2554 } 2555 2556 #endif 2557 2558 void SwView::GenerateFormLetter(bool bUseCurrentDocument) 2559 { 2560 #if !HAVE_FEATURE_DBCONNECTIVITY 2561 (void) bUseCurrentDocument; 2562 #else 2563 if(bUseCurrentDocument) 2564 { 2565 if(!GetWrtShell().IsAnyDatabaseFieldInDoc()) 2566 { 2567 //check availability of data sources (except biblio source) 2568 uno::Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() ); 2569 uno::Reference<XDatabaseContext> xDBContext = DatabaseContext::create(xContext); 2570 bool bCallAddressPilot = false; 2571 if ( lcl_NeedAdditionalDataSource( xDBContext ) ) 2572 { 2573 // no data sources are available - create a new one 2574 std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/datasourcesunavailabledialog.ui")); 2575 std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("DataSourcesUnavailableDialog")); 2576 // no cancel allowed 2577 if (RET_OK != xQuery->run()) 2578 return; 2579 bCallAddressPilot = true; 2580 } 2581 else 2582 { 2583 //take an existing data source or create a new one? 2584 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 2585 ScopedVclPtr<AbstractMailMergeFieldConnectionsDlg> pConnectionsDlg(pFact->CreateMailMergeFieldConnectionsDlg(GetFrameWeld())); 2586 if(RET_OK == pConnectionsDlg->Execute()) 2587 bCallAddressPilot = !pConnectionsDlg->IsUseExistingConnections(); 2588 else 2589 return; 2590 2591 } 2592 if(bCallAddressPilot) 2593 { 2594 GetViewFrame()->GetDispatcher()->Execute( 2595 SID_ADDRESS_DATA_SOURCE, SfxCallMode::SYNCHRON); 2596 if ( lcl_NeedAdditionalDataSource( xDBContext ) ) 2597 // no additional data source has been created 2598 // -> assume that the user has cancelled the pilot 2599 return; 2600 } 2601 2602 //call insert fields with database field page available, only 2603 SfxViewFrame* pVFrame = GetViewFrame(); 2604 //at first hide the default field dialog if currently visible 2605 pVFrame->SetChildWindow(FN_INSERT_FIELD, false); 2606 //enable the status of the db field dialog - it is disabled in the status method 2607 //to prevent creation of the dialog without mail merge active 2608 EnableMailMerge(); 2609 //then show the "Data base only" field dialog 2610 SfxBoolItem aOn(FN_INSERT_FIELD_DATA_ONLY, true); 2611 pVFrame->GetDispatcher()->ExecuteList(FN_INSERT_FIELD_DATA_ONLY, 2612 SfxCallMode::SYNCHRON, { &aOn }); 2613 return; 2614 } 2615 else 2616 { 2617 OUString sSource; 2618 if(!GetWrtShell().IsFieldDataSourceAvailable(sSource)) 2619 { 2620 std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/warndatasourcedialog.ui")); 2621 std::unique_ptr<weld::MessageDialog> xWarning(xBuilder->weld_message_dialog("WarnDataSourceDialog")); 2622 OUString sTmp(xWarning->get_primary_text()); 2623 xWarning->set_primary_text(sTmp.replaceFirst("%1", sSource)); 2624 if (RET_OK == xWarning->run()) 2625 { 2626 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); 2627 ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog( nullptr, SID_OPTIONS_DATABASES )); 2628 pDlg->Execute(); 2629 } 2630 return ; 2631 } 2632 } 2633 SwDBManager* pDBManager = GetWrtShell().GetDBManager(); 2634 2635 SwDBData aData; 2636 SwWrtShell &rSh = GetWrtShell(); 2637 2638 std::vector<OUString> aDBNameList; 2639 std::vector<OUString> aAllDBNames; 2640 rSh.GetAllUsedDB( aDBNameList, &aAllDBNames ); 2641 if(!aDBNameList.empty()) 2642 { 2643 OUString sDBName(aDBNameList[0]); 2644 sal_Int32 nIdx {0}; 2645 aData.sDataSource = sDBName.getToken(0, DB_DELIM, nIdx); 2646 aData.sCommand = sDBName.getToken(0, DB_DELIM, nIdx); 2647 aData.nCommandType = sDBName.getToken(0, DB_DELIM, nIdx).toInt32(); 2648 } 2649 rSh.EnterStdMode(); // force change in text shell; necessary for mixing DB fields 2650 AttrChangedNotify(nullptr); 2651 2652 if (pDBManager) 2653 { 2654 Sequence<PropertyValue> aProperties(3); 2655 PropertyValue* pValues = aProperties.getArray(); 2656 pValues[0].Name = "DataSourceName"; 2657 pValues[1].Name = "Command"; 2658 pValues[2].Name = "CommandType"; 2659 pValues[0].Value <<= aData.sDataSource; 2660 pValues[1].Value <<= aData.sCommand; 2661 pValues[2].Value <<= aData.nCommandType; 2662 pDBManager->ExecuteFormLetter(GetWrtShell(), aProperties); 2663 } 2664 } 2665 else 2666 { 2667 // call documents and template dialog 2668 SfxApplication* pSfxApp = SfxGetpApp(); 2669 weld::Window* pTopWin = pSfxApp->GetTopWindow(); 2670 2671 SfxTemplateManagerDlg aDocTemplDlg(GetFrameWeld()); 2672 int nRet = aDocTemplDlg.run(); 2673 bool bNewWin = false; 2674 if ( nRet == RET_OK ) 2675 { 2676 if ( pTopWin != pSfxApp->GetTopWindow() ) 2677 { 2678 // the dialogue opens a document -> a new TopWindow appears 2679 pTopWin = pSfxApp->GetTopWindow(); 2680 bNewWin = true; 2681 } 2682 } 2683 2684 if (bNewWin) 2685 { 2686 // after the destruction of the dialogue its parent comes to top, 2687 // but we want that the new document is on top 2688 pTopWin->present(); 2689 } 2690 } 2691 #endif 2692 } 2693 2694 IMPL_LINK( SwView, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, void ) 2695 { 2696 if ( ERRCODE_NONE != _pFileDlg->GetError() ) 2697 return; 2698 2699 std::unique_ptr<SfxMedium> pMed = m_pViewImpl->CreateMedium(); 2700 if ( !pMed ) 2701 { 2702 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetEditWin().GetFrameWeld(), 2703 VclMessageType::Info, VclButtonsType::Ok, 2704 SwResId(RID_SVXSTR_TXTFILTER_FILTERERROR))); 2705 xInfoBox->run(); 2706 return; 2707 } 2708 2709 const sal_uInt16 nSlot = m_pViewImpl->GetRequest()->GetSlot(); 2710 tools::Long nFound = InsertMedium( nSlot, std::move(pMed), m_pViewImpl->GetParam() ); 2711 2712 if ( SID_INSERTDOC == nSlot ) 2713 { 2714 if ( m_pViewImpl->GetParam() == 0 ) 2715 { 2716 m_pViewImpl->GetRequest()->SetReturnValue( SfxBoolItem( nSlot, nFound != -1 ) ); 2717 m_pViewImpl->GetRequest()->Ignore(); 2718 } 2719 else 2720 { 2721 m_pViewImpl->GetRequest()->SetReturnValue( SfxBoolItem( nSlot, nFound != -1 ) ); 2722 m_pViewImpl->GetRequest()->Done(); 2723 } 2724 } 2725 else if ( SID_DOCUMENT_COMPARE == nSlot || SID_DOCUMENT_MERGE == nSlot ) 2726 { 2727 m_pViewImpl->GetRequest()->SetReturnValue( SfxInt32Item( nSlot, nFound ) ); 2728 2729 if ( nFound > 0 ) // show Redline browser 2730 { 2731 SfxViewFrame* pVFrame = GetViewFrame(); 2732 pVFrame->ShowChildWindow(FN_REDLINE_ACCEPT); 2733 2734 // re-initialize Redline dialog 2735 sal_uInt16 nId = SwRedlineAcceptChild::GetChildWindowId(); 2736 SwRedlineAcceptChild* pRed = static_cast<SwRedlineAcceptChild*>(pVFrame->GetChildWindow( nId )); 2737 if ( pRed ) 2738 pRed->ReInitDlg( GetDocShell() ); 2739 } 2740 } 2741 } 2742 2743 void SwView::ExecuteScan( SfxRequest& rReq ) 2744 { 2745 if (m_pViewImpl) 2746 m_pViewImpl->ExecuteScan(rReq) ; 2747 } 2748 2749 const OUString& SwView::GetOldGrfCat() 2750 { 2751 return GetCachedString(OldGrfCat); 2752 } 2753 2754 void SwView::SetOldGrfCat(const OUString& sStr) 2755 { 2756 SetCachedString(OldGrfCat, sStr); 2757 } 2758 2759 const OUString& SwView::GetOldTabCat() 2760 { 2761 return GetCachedString(OldTabCat); 2762 } 2763 2764 void SwView::SetOldTabCat(const OUString& sStr) 2765 { 2766 SetCachedString(OldTabCat, sStr); 2767 } 2768 2769 const OUString& SwView::GetOldFrameCat() 2770 { 2771 return GetCachedString(OldFrameCat); 2772 } 2773 2774 void SwView::SetOldFrameCat(const OUString& sStr) 2775 { 2776 SetCachedString(OldFrameCat, sStr); 2777 } 2778 2779 const OUString& SwView::GetOldDrwCat() 2780 { 2781 return GetCachedString(OldDrwCat); 2782 } 2783 2784 void SwView::SetOldDrwCat(const OUString& sStr) 2785 { 2786 SwView::SetCachedString(OldDrwCat, sStr); 2787 } 2788 2789 2790 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 2791
