LibreOffice Module sw (master)  1
unotxvw.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <memory>
21 #include <viscrs.hxx>
22 #include <o3tl/any.hxx>
23 #include <sfx2/frame.hxx>
24 #include <sfx2/printer.hxx>
25 #include <sfx2/viewfrm.hxx>
26 #include <cmdid.h>
27 #include <docsh.hxx>
28 #include <rubylist.hxx>
29 #include <doc.hxx>
31 #include <unotxvw.hxx>
32 #include <unodispatch.hxx>
33 #include <unomap.hxx>
34 #include <unoprnms.hxx>
35 #include <view.hxx>
36 #include <viewopt.hxx>
37 #include <unomod.hxx>
38 #include <unoframe.hxx>
39 #include <unocrsr.hxx>
40 #include <wrtsh.hxx>
41 #include <unotbl.hxx>
42 #include <svx/fmshell.hxx>
43 #include <svx/svdview.hxx>
44 #include <svx/svdpage.hxx>
45 #include <svx/svdouno.hxx>
46 #include <editeng/pbinitem.hxx>
47 #include <pagedesc.hxx>
48 #include <editeng/lrspitem.hxx>
49 #include <editeng/ulspitem.hxx>
50 #include <sfx2/bindings.hxx>
51 #include <sfx2/request.hxx>
52 #include <frmatr.hxx>
53 #include <IMark.hxx>
54 #include <unodraw.hxx>
55 #include <svx/svdpagv.hxx>
56 #include <ndtxt.hxx>
57 #include <SwStyleNameMapper.hxx>
58 #include <com/sun/star/beans/PropertyAttribute.hpp>
59 #include <com/sun/star/drawing/ShapeCollection.hpp>
60 #include <editeng/outliner.hxx>
61 #include <editeng/editview.hxx>
62 #include <unoparagraph.hxx>
63 #include <unocrsrhelper.hxx>
64 #include <unotextrange.hxx>
65 #include <sfx2/docfile.hxx>
66 #include <swdtflvr.hxx>
67 #include <rootfrm.hxx>
68 #include <edtwin.hxx>
69 #include <vcl/svapp.hxx>
75 #include <tools/UnitConversion.hxx>
76 
77 using namespace ::com::sun::star;
78 using namespace ::com::sun::star::uno;
79 using namespace ::com::sun::star::lang;
80 using namespace ::com::sun::star::beans;
81 using namespace ::com::sun::star::text;
82 using namespace ::com::sun::star::view;
83 using namespace ::com::sun::star::frame;
84 
85 using ::com::sun::star::util::URL;
86 
88  SfxBaseController(pSwView),
89  m_SelChangedListeners(m_aMutex),
90  m_pView(pSwView),
91  m_pPropSet( aSwMapProvider.GetPropertySet( PROPERTY_MAP_TEXT_VIEW ) )
92 {
93 
94 }
95 
97 {
98  Invalidate();
99 }
100 
102 {
103  if(mxViewSettings.is())
104  {
106  static_cast < SwXViewSettings* > ( pSettings )->Invalidate();
107  mxViewSettings.clear();
108  }
109  if(mxTextViewCursor.is())
110  {
111  text::XTextViewCursor* pCursor = mxTextViewCursor.get();
112  static_cast<SwXTextViewCursor*>(pCursor)->Invalidate();
113  mxTextViewCursor.clear();
114  }
115 
116  osl_atomic_increment(&m_refCount); //prevent second d'tor call
117 
118  {
119  uno::Reference<uno::XInterface> const xInt(static_cast<
120  cppu::OWeakObject*>(static_cast<SfxBaseController*>(this)));
121  lang::EventObject aEvent(xInt);
123  }
124 
125  osl_atomic_decrement(&m_refCount);
126  m_pView = nullptr;
127 }
128 
129 Sequence< uno::Type > SAL_CALL SwXTextView::getTypes( )
130 {
131  return cppu::OTypeCollection(
142  SfxBaseController::getTypes()
143  ).getTypes();
144 }
145 
146 Sequence< sal_Int8 > SAL_CALL SwXTextView::getImplementationId( )
147 {
148  return css::uno::Sequence<sal_Int8>();
149 }
150 
151 void SAL_CALL SwXTextView::acquire( )noexcept
152 {
153  SfxBaseController::acquire();
154 }
155 
156 void SAL_CALL SwXTextView::release( )noexcept
157 {
158  SfxBaseController::release();
159 }
160 
162 {
163  uno::Any aRet;
165  {
166  uno::Reference<view::XSelectionSupplier> xRet = this;
167  aRet <<= xRet;
168  }
169  else if(aType == cppu::UnoType<lang::XServiceInfo>::get())
170  {
171  uno::Reference<lang::XServiceInfo> xRet = this;
172  aRet <<= xRet;
173  }
174  else if(aType == cppu::UnoType<view::XControlAccess>::get())
175  {
176  uno::Reference<view::XControlAccess> xRet = this;
177  aRet <<= xRet;
178  }
180  {
181  uno::Reference<view::XFormLayerAccess> xRet = this;
182  aRet <<= xRet;
183  }
185  {
186  uno::Reference<text::XTextViewCursorSupplier> xRet = this;
187  aRet <<= xRet;
188  }
190  {
191  uno::Reference<text::XTextViewTextRangeSupplier> xRet = this;
192  aRet <<= xRet;
193  }
195  {
196  uno::Reference<view::XViewSettingsSupplier> xRet = this;
197  aRet <<= xRet;
198  }
199  else if(aType == cppu::UnoType<XRubySelection>::get())
200  {
201  uno::Reference<XRubySelection> xRet = this;
202  aRet <<= xRet;
203  }
204  else if(aType == cppu::UnoType<XPropertySet>::get())
205  {
206  uno::Reference<XPropertySet> xRet = this;
207  aRet <<= xRet;
208  }
210  {
211  uno::Reference<datatransfer::XTransferableSupplier> xRet = this;
212  aRet <<= xRet;
213  }
215  {
216  uno::Reference<datatransfer::XTransferableTextSupplier> xRet = this;
217  aRet <<= xRet;
218  }
219  else
220  aRet = SfxBaseController::queryInterface(aType);
221  return aRet;
222 }
223 
225 {
226  SolarMutexGuard aGuard;
227 
228  uno::Reference< uno::XInterface > xInterface;
229  if (!GetView() || !(aInterface >>= xInterface))
230  {
231  return false;
232  }
233 
234  SwWrtShell& rSh = GetView()->GetWrtShell();
235  SwDoc* pDoc = GetView()->GetDocShell()->GetDoc();
236  std::vector<SdrObject *> sdrObjects;
237  uno::Reference<awt::XControlModel> const xCtrlModel(xInterface,
238  UNO_QUERY);
239  if (xCtrlModel.is())
240  {
241  uno::Reference<awt::XControl> xControl;
242  SdrObject *const pSdrObject = GetControl(xCtrlModel, xControl);
243  if (pSdrObject) // hmm... needs view to verify it's in right doc...
244  {
245  sdrObjects.push_back(pSdrObject);
246  }
247  }
248  else
249  {
250  SwPaM * pPaM(nullptr);
251  std::pair<OUString, FlyCntType> frame;
252  OUString tableName;
253  SwUnoTableCursor const* pTableCursor(nullptr);
254  ::sw::mark::IMark const* pMark(nullptr);
255  SwUnoCursorHelper::GetSelectableFromAny(xInterface, *pDoc,
256  pPaM, frame, tableName, pTableCursor, pMark, sdrObjects);
257  if (pPaM)
258  {
259  rSh.EnterStdMode();
260  rSh.SetSelection(*pPaM);
261  // the pPaM has been copied - delete it
262  while (pPaM->GetNext() != pPaM)
263  delete pPaM->GetNext();
264  delete pPaM;
265  return true;
266  }
267  else if (!frame.first.isEmpty())
268  {
269  bool const bSuccess(rSh.GotoFly(frame.first, frame.second));
270  if (bSuccess)
271  {
272  rSh.HideCursor();
273  rSh.EnterSelFrameMode();
274  }
275  return true;
276  }
277  else if (!tableName.isEmpty())
278  {
279  rSh.EnterStdMode();
280  rSh.GotoTable(tableName);
281  return true;
282  }
283  else if (pTableCursor)
284  {
285  UnoActionRemoveContext const aContext(*pTableCursor);
286  rSh.EnterStdMode();
287  rSh.SetSelection(*pTableCursor);
288  return true;
289  }
290  else if (pMark)
291  {
292  rSh.EnterStdMode();
293  rSh.GotoMark(pMark);
294  return true;
295  }
296  // sdrObjects handled below
297  }
298  bool bRet(false);
299  if (!sdrObjects.empty())
300  {
301 
302  SdrView *const pDrawView = rSh.GetDrawView();
303  SdrPageView *const pPV = pDrawView->GetSdrPageView();
304 
305  pDrawView->SdrEndTextEdit();
306  pDrawView->UnmarkAll();
307 
308  for (SdrObject* pSdrObject : sdrObjects)
309  {
310  // GetSelectableFromAny did not check pSdrObject is in right doc!
311  if (pPV && pSdrObject->getSdrPageFromSdrObject() == pPV->GetPage())
312  {
313  pDrawView->MarkObj(pSdrObject, pPV);
314  bRet = true;
315  }
316  }
317 
318  // tdf#112696 if we selected every individual element of a group, then
319  // select that group instead
320  const SdrMarkList &rMrkList = pDrawView->GetMarkedObjectList();
321  size_t nMarkCount = rMrkList.GetMarkCount();
322  if (nMarkCount > 1)
323  {
324  SdrObject* pObject = rMrkList.GetMark(0)->GetMarkedSdrObj();
325  SdrObject* pGroupParent = pObject->getParentSdrObjectFromSdrObject();
326  for (size_t i = 1; i < nMarkCount; ++i)
327  {
328  pObject = rMrkList.GetMark(i)->GetMarkedSdrObj();
329  SdrObject* pParent = pObject->getParentSdrObjectFromSdrObject();
330  if (pParent != pGroupParent)
331  {
332  pGroupParent = nullptr;
333  break;
334  }
335  }
336 
337  if (pGroupParent && pGroupParent->IsGroupObject() &&
338  pGroupParent->getChildrenOfSdrObject()->GetObjCount() == nMarkCount)
339  {
340  pDrawView->UnmarkAll();
341  pDrawView->MarkObj(pGroupParent, pPV);
342  }
343  }
344  }
345  return bRet;
346 }
347 
349 {
350  SolarMutexGuard aGuard;
351  uno::Reference< uno::XInterface > aRef;
352  if(GetView())
353  {
354  //force immediat shell update
356  //Generating an interface from the current selection.
357  SwWrtShell& rSh = m_pView->GetWrtShell();
358  ShellMode eSelMode = m_pView->GetShellMode();
359  switch(eSelMode)
360  {
361  case ShellMode::TableText :
362  {
363  if(rSh.GetTableCursor())
364  {
365  OSL_ENSURE(rSh.GetTableFormat(), "not a table format?");
366  uno::Reference< text::XTextTableCursor > xCursor = new SwXTextTableCursor(*rSh.GetTableFormat(),
367  rSh.GetTableCursor());
368  aRef.set(xCursor, uno::UNO_QUERY);
369  break;
370  }
371  [[fallthrough]];
372  // without a table selection the text will be delivered
373  }
374  case ShellMode::ListText :
376  case ShellMode::Text :
377  {
378  uno::Reference< container::XIndexAccess > xPos = SwXTextRanges::Create(rSh.GetCursor());
379  aRef.set(xPos, uno::UNO_QUERY);
380  }
381  break;
382  case ShellMode::Frame :
383  {
384  SwFrameFormat *const pFormat = rSh.GetFlyFrameFormat();
385  if (pFormat)
386  {
388  *pFormat->GetDoc(), pFormat);
389  }
390  }
391  break;
392  case ShellMode::Graphic :
393  {
394  SwFrameFormat *const pFormat = rSh.GetFlyFrameFormat();
395  if (pFormat)
396  {
398  *pFormat->GetDoc(), pFormat);
399  }
400  }
401  break;
402  case ShellMode::Object :
403  {
404  SwFrameFormat *const pFormat = rSh.GetFlyFrameFormat();
405  if (pFormat)
406  {
408  *pFormat->GetDoc(), pFormat);
409  }
410  }
411  break;
412  case ShellMode::Draw :
413  case ShellMode::DrawForm :
414  case ShellMode::DrawText :
415  case ShellMode::Bezier :
416  {
417  uno::Reference< drawing::XShapes > xShCol = drawing::ShapeCollection::create(
419 
420  const SdrMarkList& rMarkList = rSh.GetDrawView()->GetMarkedObjectList();
421  for(size_t i = 0; i < rMarkList.GetMarkCount(); ++i)
422  {
423  SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
424  uno::Reference<drawing::XShape> xShape = SwFmDrawPage::GetShape( pObj );
425  xShCol->add(xShape);
426  }
427  aRef.set(xShCol, uno::UNO_QUERY);
428  }
429  break;
430  default:;//prevent warning
431  }
432  }
434  return aRet;
435 }
436 
438  const uno::Reference< view::XSelectionChangeListener > & rxListener)
439 {
440  SolarMutexGuard aGuard;
442 }
443 
445  const uno::Reference< view::XSelectionChangeListener > & rxListener)
446 {
447  SolarMutexGuard aGuard;
449 }
450 
452  const uno::Reference< awt::XControlModel > & xModel,
453  uno::Reference< awt::XControl >& xToFill )
454 {
455  SwView* pView2 = GetView();
456  FmFormShell* pFormShell = pView2 ? pView2->GetFormShell() : nullptr;
457  SdrView* pDrawView = pView2 ? pView2->GetDrawView() : nullptr;
458  vcl::Window* pWindow = pView2 ? pView2->GetWrtShell().GetWin() : nullptr;
459 
460  OSL_ENSURE( pFormShell && pDrawView && pWindow, "SwXTextView::GetControl: how could I?" );
461 
462  SdrObject* pControl = nullptr;
463  if ( pFormShell && pDrawView && pWindow )
464  pControl = pFormShell->GetFormControl( xModel, *pDrawView, *pWindow->GetOutDev(), xToFill );
465  return pControl;
466 }
467 
468 uno::Reference< awt::XControl > SwXTextView::getControl(const uno::Reference< awt::XControlModel > & xModel)
469 {
470  SolarMutexGuard aGuard;
471  uno::Reference< awt::XControl > xRet;
472  GetControl(xModel, xRet);
473  return xRet;
474 }
475 
476 uno::Reference< form::runtime::XFormController > SAL_CALL SwXTextView::getFormController( const uno::Reference< form::XForm >& Form )
477 {
478  SolarMutexGuard aGuard;
479 
480  SwView* pView2 = GetView();
481  FmFormShell* pFormShell = pView2 ? pView2->GetFormShell() : nullptr;
482  SdrView* pDrawView = pView2 ? pView2->GetDrawView() : nullptr;
483  vcl::Window* pWindow = pView2 ? pView2->GetWrtShell().GetWin() : nullptr;
484  OSL_ENSURE( pFormShell && pDrawView && pWindow, "SwXTextView::getFormController: how could I?" );
485 
486  uno::Reference< form::runtime::XFormController > xController;
487  if ( pFormShell && pDrawView && pWindow )
488  xController = FmFormShell::GetFormController( Form, *pDrawView, *pWindow->GetOutDev() );
489  return xController;
490 }
491 
493 {
494  SolarMutexGuard aGuard;
495  SwView* pView2 = GetView();
496  FmFormShell* pFormShell = pView2 ? pView2->GetFormShell() : nullptr;
497  return !pFormShell || pFormShell->IsDesignMode();
498 }
499 
500 void SAL_CALL SwXTextView::setFormDesignMode( sal_Bool DesignMode )
501 {
502  SolarMutexGuard aGuard;
503  SwView* pView2 = GetView();
504  FmFormShell* pFormShell = pView2 ? pView2->GetFormShell() : nullptr;
505  if ( pFormShell )
506  pFormShell->SetDesignMode( DesignMode );
507 }
508 
509 uno::Reference< text::XTextViewCursor > SwXTextView::getViewCursor()
510 {
511  SolarMutexGuard aGuard;
512  comphelper::ProfileZone aZone("getViewCursor");
513  if(!GetView())
514  throw uno::RuntimeException();
515 
516  if(!mxTextViewCursor.is())
517  {
519  }
520  return mxTextViewCursor;
521 }
522 
523 uno::Reference<text::XTextRange>
524 SwXTextView::createTextRangeByPixelPosition(const awt::Point& rPixelPosition)
525 {
526  SolarMutexGuard aGuard;
527 
528  Point aPixelPoint(rPixelPosition.X, rPixelPosition.Y);
529  if (!m_pView)
530  throw RuntimeException();
531 
532  Point aLogicPoint = m_pView->GetEditWin().PixelToLogic(aPixelPoint);
533  SwWrtShell& rSh = m_pView->GetWrtShell();
534  SwPosition aPosition(*rSh.GetCurrentShellCursor().GetPoint());
535  rSh.GetLayout()->GetModelPositionForViewPoint(&aPosition, aLogicPoint);
536  uno::Reference<text::XTextRange> xRet
537  = SwXTextRange::CreateXTextRange(*rSh.GetDoc(), aPosition, /*pMark=*/nullptr);
538 
539  return xRet;
540 }
541 
542 uno::Reference< beans::XPropertySet > SwXTextView::getViewSettings()
543 {
544  SolarMutexGuard aGuard;
545  if(!m_pView)
546  throw uno::RuntimeException();
547 
548  if(!mxViewSettings.is())
549  {
551  }
552 
553  return mxViewSettings;
554 }
555 
556 Sequence< Sequence< PropertyValue > > SwXTextView::getRubyList( sal_Bool /*bAutomatic*/ )
557 {
558  SolarMutexGuard aGuard;
559 
560  if(!GetView())
561  throw RuntimeException();
562  SwWrtShell& rSh = m_pView->GetWrtShell();
563  ShellMode eSelMode = m_pView->GetShellMode();
564  if (eSelMode != ShellMode::ListText &&
565  eSelMode != ShellMode::TableListText &&
566  eSelMode != ShellMode::TableText &&
567  eSelMode != ShellMode::Text )
568  return Sequence< Sequence< PropertyValue > > ();
569 
570  SwRubyList aList;
571 
572  const sal_uInt16 nCount = SwDoc::FillRubyList( *rSh.GetCursor(), aList );
573  Sequence< Sequence< PropertyValue > > aRet(nCount);
574  Sequence< PropertyValue >* pRet = aRet.getArray();
575  OUString aString;
576  for(sal_uInt16 n = 0; n < nCount; n++)
577  {
578  const SwRubyListEntry* pEntry = aList[n].get();
579 
580  const OUString& rEntryText = pEntry->GetText();
581  const SwFormatRuby& rAttr = pEntry->GetRubyAttr();
582 
583  pRet[n].realloc(6);
584  PropertyValue* pValues = pRet[n].getArray();
585  pValues[0].Name = UNO_NAME_RUBY_BASE_TEXT;
586  pValues[0].Value <<= rEntryText;
587  pValues[1].Name = UNO_NAME_RUBY_TEXT;
588  pValues[1].Value <<= rAttr.GetText();
589  pValues[2].Name = UNO_NAME_RUBY_CHAR_STYLE_NAME;
591  pValues[2].Value <<= aString;
592  pValues[3].Name = UNO_NAME_RUBY_ADJUST;
593  pValues[3].Value <<= static_cast<sal_Int16>(rAttr.GetAdjustment());
594  pValues[4].Name = UNO_NAME_RUBY_IS_ABOVE;
595  pValues[4].Value <<= !rAttr.GetPosition();
596  pValues[5].Name = UNO_NAME_RUBY_POSITION;
597  pValues[5].Value <<= rAttr.GetPosition();
598  }
599  return aRet;
600 }
601 
603  const Sequence< Sequence< PropertyValue > >& rRubyList, sal_Bool /*bAutomatic*/ )
604 {
605  SolarMutexGuard aGuard;
606 
607  if(!GetView() || !rRubyList.hasElements())
608  throw RuntimeException();
609  SwWrtShell& rSh = m_pView->GetWrtShell();
610  ShellMode eSelMode = m_pView->GetShellMode();
611  if (eSelMode != ShellMode::ListText &&
612  eSelMode != ShellMode::TableListText &&
613  eSelMode != ShellMode::TableText &&
614  eSelMode != ShellMode::Text )
615  throw RuntimeException();
616 
617  SwRubyList aList;
618 
619  for(const Sequence<PropertyValue>& rPropList : rRubyList)
620  {
621  std::unique_ptr<SwRubyListEntry> pEntry(new SwRubyListEntry);
622  OUString sTmp;
623  for(const PropertyValue& rProperty : rPropList)
624  {
625  if(rProperty.Name == UNO_NAME_RUBY_BASE_TEXT)
626  {
627  rProperty.Value >>= sTmp;
628  pEntry->SetText(sTmp);
629  }
630  else if(rProperty.Name == UNO_NAME_RUBY_TEXT)
631  {
632  rProperty.Value >>= sTmp;
633  pEntry->GetRubyAttr().SetText(sTmp);
634  }
635  else if(rProperty.Name == UNO_NAME_RUBY_CHAR_STYLE_NAME)
636  {
637  if(rProperty.Value >>= sTmp)
638  {
639  OUString sName;
641  const sal_uInt16 nPoolId = sName.isEmpty() ? 0
644 
645  pEntry->GetRubyAttr().SetCharFormatName( sName );
646  pEntry->GetRubyAttr().SetCharFormatId( nPoolId );
647  }
648  }
649  else if(rProperty.Name == UNO_NAME_RUBY_ADJUST)
650  {
651  sal_Int16 nTmp = 0;
652  if(rProperty.Value >>= nTmp)
653  pEntry->GetRubyAttr().SetAdjustment(static_cast<css::text::RubyAdjust>(nTmp));
654  }
655  else if(rProperty.Name == UNO_NAME_RUBY_IS_ABOVE)
656  {
657  bool bValue = !rProperty.Value.hasValue() ||
658  *o3tl::doAccess<bool>(rProperty.Value);
659  pEntry->GetRubyAttr().SetPosition(bValue ? 0 : 1);
660  }
661  else if(rProperty.Name == UNO_NAME_RUBY_POSITION)
662  {
663  sal_Int16 nTmp = 0;
664  if(rProperty.Value >>= nTmp)
665  pEntry->GetRubyAttr().SetPosition( nTmp );
666  }
667  }
668  aList.push_back(std::move(pEntry));
669  }
670  SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
671  pDoc->SetRubyList( *rSh.GetCursor(), aList );
672 }
673 
675 {
676  SwWrtShell& rOldSh = m_pView->GetWrtShell();
677  SfxPrinter *pPrt = rOldSh.getIDocumentDeviceAccess().getPrinter( false );
678  SwDocShell* pDocSh;
679  SfxObjectShellLock xDocSh( pDocSh = new SwDocShell(SfxObjectCreateMode::STANDARD) );
680  xDocSh->DoInitNew();
681  SwDoc *const pTempDoc( pDocSh->GetDoc() );
682  // #i103634#, #i112425#: do not expand numbering and fields on PDF export
683  pTempDoc->SetClipBoard(true);
684  rOldSh.FillPrtDoc(*pTempDoc, pPrt);
686  SwView* pDocView = static_cast<SwView*>( pDocFrame->GetViewShell() );
687  pDocView->AttrChangedNotify(nullptr);//So that SelectShell is called.
688  SwWrtShell* pSh = pDocView->GetWrtShellPtr();
689 
691  SfxPrinter* pTempPrinter = rIDDA.getPrinter( true );
692 
693  const SwPageDesc& rCurPageDesc = rOldSh.GetPageDesc(rOldSh.GetCurPageDesc());
694 
695  IDocumentDeviceAccess& rIDDA_old = rOldSh.getIDocumentDeviceAccess();
696 
697  if( rIDDA_old.getPrinter( false ) )
698  {
699  rIDDA.setJobsetup( *rIDDA_old.getJobsetup() );
700  //#69563# if it isn't the same printer then the pointer has been invalidated!
701  pTempPrinter = rIDDA.getPrinter( true );
702  }
703 
704  pTempPrinter->SetPaperBin(rCurPageDesc.GetMaster().GetPaperBin().GetValue());
705 
706  return xDocSh;
707 }
708 
710 {
711  OSL_ENSURE( m_pView, "view is missing" );
712 
713  uno::Reference<uno::XInterface> const xInt(
714  static_cast<cppu::OWeakObject*>(static_cast<SfxBaseController*>(this)));
715 
716  lang::EventObject const aEvent(xInt);
718  &view::XSelectionChangeListener::selectionChanged, aEvent);
719 }
720 
721 namespace {
722  struct DispatchListener
723  {
724  URL const & m_rURL;
725  Sequence<PropertyValue> const& m_rSeq;
726  explicit DispatchListener(URL const& rURL,
727  Sequence<PropertyValue> const& rSeq)
728  : m_rURL(rURL), m_rSeq(rSeq) { }
729  void operator()(uno::Reference<XDispatch> const & xListener) const
730  {
731  xListener->dispatch(m_rURL, m_rSeq);
732  }
733  };
734 }
735 
737 {
738  URL aURL;
739  aURL.Complete = OUString::createFromAscii(SwXDispatch::GetDBChangeURL());
740 
741  m_SelChangedListeners.forEach<XDispatch>(
742  DispatchListener(aURL, {}));
743 }
744 
745 uno::Reference< beans::XPropertySetInfo > SAL_CALL SwXTextView::getPropertySetInfo( )
746 {
747  SolarMutexGuard aGuard;
748  static uno::Reference< XPropertySetInfo > aRef = m_pPropSet->getPropertySetInfo();
749  return aRef;
750 }
751 
753  const OUString& rPropertyName, const uno::Any& rValue )
754 {
755  SolarMutexGuard aGuard;
756  const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
757  if (!pEntry)
758  throw UnknownPropertyException(rPropertyName);
759  else if (pEntry->nFlags & PropertyAttribute::READONLY)
760  throw PropertyVetoException();
761  else
762  {
763  switch (pEntry->nWID)
764  {
766  // deprecated #i91949
767  break;
769  {
770  bool bVal = false;
771  const SwViewOption *pOpt = m_pView->GetWrtShell().GetViewOptions();
772  if (!pOpt || !(rValue >>= bVal))
773  throw RuntimeException();
774  SwViewOption aNewOpt( *pOpt );
775  if (pEntry->nWID == WID_IS_CONSTANT_SPELLCHECK)
776  aNewOpt.SetOnlineSpell(bVal);
777  m_pView->GetWrtShell().ApplyViewOptions( aNewOpt );
778  }
779  break;
780  default :
781  OSL_FAIL("unknown WID");
782  }
783  }
784 }
785 
787  const OUString& rPropertyName )
788 {
789  SolarMutexGuard aGuard;
790 
791  Any aRet;
792 
793  const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
794  if (!pEntry)
795  throw UnknownPropertyException(rPropertyName);
796 
797  sal_Int16 nWID = pEntry->nWID;
798  switch (nWID)
799  {
800  case WID_PAGE_COUNT :
801  case WID_LINE_COUNT :
802  {
803  // format document completely in order to get meaningful
804  // values for page count and line count
806 
807  sal_Int32 nCount = -1;
808  if (nWID == WID_PAGE_COUNT)
809  nCount = m_pView->GetWrtShell().GetPageCount();
810  else // WID_LINE_COUNT
811  nCount = m_pView->GetWrtShell().GetLineCount();
812  aRet <<= nCount;
813  }
814  break;
816  // deprecated #i91949
817  break;
819  {
820  const SwViewOption *pOpt = m_pView->GetWrtShell().GetViewOptions();
821  if (!pOpt)
822  throw RuntimeException();
823  aRet <<= bool(pOpt->GetCoreOptions() & ViewOptFlags1::OnlineSpell);
824  }
825  break;
826  default :
827  OSL_FAIL("unknown WID");
828  }
829 
830  return aRet;
831 }
832 
834  const OUString& /*rPropertyName*/,
835  const uno::Reference< beans::XPropertyChangeListener >& /*rxListener*/ )
836 {
837  OSL_FAIL("not implemented");
838 }
839 
841  const OUString& /*rPropertyName*/,
842  const uno::Reference< beans::XPropertyChangeListener >& /*rxListener*/ )
843 {
844  OSL_FAIL("not implemented");
845 }
846 
848  const OUString& /*rPropertyName*/,
849  const uno::Reference< beans::XVetoableChangeListener >& /*rxListener*/ )
850 {
851  OSL_FAIL("not implemented");
852 }
853 
855  const OUString& /*rPropertyName*/,
856  const uno::Reference< beans::XVetoableChangeListener >& /*rxListener*/ )
857 {
858  OSL_FAIL("not implemented");
859 }
860 
862 {
863  return "SwXTextView";
864 }
865 
866 sal_Bool SwXTextView::supportsService(const OUString& rServiceName)
867 {
868  return cppu::supportsService(this, rServiceName);
869 }
870 
872 {
873  return { "com.sun.star.text.TextDocumentView", "com.sun.star.view.OfficeDocumentView" };
874 }
875 
877  m_pView(pVw),
878  m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR))
879 {
880 }
881 
883 {
884 }
885 
886 // used to determine if there is a text selection or not.
887 // If there is no text selection the functions that need a working
888 // cursor will be disabled (throw RuntimeException). This will be the case
889 // for the following interfaces:
890 // - XViewCursor
891 // - XTextCursor
892 // - XTextRange
893 // - XLineCursor
894 bool SwXTextViewCursor::IsTextSelection( bool bAllowTables ) const
895 {
896 
897  bool bRes = false;
898  OSL_ENSURE(m_pView, "m_pView is NULL ???");
899  if(m_pView)
900  {
904  bRes = ( (SelectionType::Text & eSelType) ||
905  (SelectionType::NumberList & eSelType) ) &&
906  (!(SelectionType::TableCell & eSelType) || bAllowTables);
907  }
908  return bRes;
909 }
910 
912 {
913  OSL_FAIL("not implemented");
914  return true;
915 }
916 
918 {
919  OSL_FAIL("not implemented");
920 }
921 
923 {
924  SolarMutexGuard aGuard;
925  awt::Point aRet;
926  if(!m_pView)
927  throw uno::RuntimeException();
928 
929  const SwWrtShell& rSh = m_pView->GetWrtShell();
930  const SwRect& aCharRect(rSh.GetCharRect());
931 
932  const SwFrameFormat& rMaster = rSh.GetPageDesc( rSh.GetCurPageDesc() ).GetMaster();
933 
934  const SvxULSpaceItem& rUL = rMaster.GetULSpace();
935  const tools::Long nY = aCharRect.Top() - (rUL.GetUpper() + DOCUMENTBORDER);
936  aRet.Y = convertTwipToMm100(nY);
937 
938  const SvxLRSpaceItem& rLR = rMaster.GetLRSpace();
939  const tools::Long nX = aCharRect.Left() - (rLR.GetLeft() + DOCUMENTBORDER);
940  aRet.X = convertTwipToMm100(nX);
941 
942  return aRet;
943 }
944 
946 {
947  SolarMutexGuard aGuard;
948  if(!m_pView)
949  throw uno::RuntimeException();
950 
951  if (!IsTextSelection())
952  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
953 
954  SwWrtShell& rSh = m_pView->GetWrtShell();
955  if(rSh.HasSelection())
956  {
957  SwPaM* pShellCursor = rSh.GetCursor();
958  if(*pShellCursor->GetPoint() > *pShellCursor->GetMark())
959  pShellCursor->Exchange();
960  pShellCursor->DeleteMark();
961  rSh.EnterStdMode();
962  rSh.SetSelection(*pShellCursor);
963  }
964 
965 }
966 
968 {
969  SolarMutexGuard aGuard;
970  if(!m_pView)
971  throw uno::RuntimeException();
972 
973  if (!IsTextSelection())
974  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
975 
976  SwWrtShell& rSh = m_pView->GetWrtShell();
977  if(rSh.HasSelection())
978  {
979  SwPaM* pShellCursor = rSh.GetCursor();
980  if(*pShellCursor->GetPoint() < *pShellCursor->GetMark())
981  pShellCursor->Exchange();
982  pShellCursor->DeleteMark();
983  rSh.EnterStdMode();
984  rSh.SetSelection(*pShellCursor);
985  }
986 
987 }
988 
990 {
991  SolarMutexGuard aGuard;
992  bool bRet = false;
993  if(!m_pView)
994  throw uno::RuntimeException();
995 
996  if (!IsTextSelection())
997  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
998 
999  const SwWrtShell& rSh = m_pView->GetWrtShell();
1000  bRet = !rSh.HasSelection();
1001 
1002  return bRet;
1003 
1004 }
1005 
1006 sal_Bool SwXTextViewCursor::goLeft(sal_Int16 nCount, sal_Bool bExpand)
1007 {
1008  SolarMutexGuard aGuard;
1009  bool bRet = false;
1010  if(!m_pView)
1011  throw uno::RuntimeException();
1012 
1013  if (!IsTextSelection())
1014  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1015 
1016  bRet = m_pView->GetWrtShell().Left( CRSR_SKIP_CHARS, bExpand, nCount, true );
1017 
1018  return bRet;
1019 }
1020 
1022 {
1023  SolarMutexGuard aGuard;
1024  bool bRet = false;
1025  if(!m_pView)
1026  throw uno::RuntimeException();
1027 
1028  if (!IsTextSelection())
1029  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1030 
1031  bRet = m_pView->GetWrtShell().Right( CRSR_SKIP_CHARS, bExpand, nCount, true );
1032 
1033  return bRet;
1034 
1035 }
1036 
1038  const uno::Reference< text::XTextRange > & xRange,
1039  sal_Bool bExpand)
1040 {
1041  SolarMutexGuard aGuard;
1042  if(!(m_pView && xRange.is()))
1043  throw uno::RuntimeException();
1044 
1045  if (!IsTextSelection())
1046  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1047 
1048  SwUnoInternalPaM rDestPam(*m_pView->GetDocShell()->GetDoc());
1049  if (!::sw::XTextRangeToSwPaM(rDestPam, xRange))
1050  {
1051  throw uno::RuntimeException();
1052  }
1053 
1054  ShellMode eSelMode = m_pView->GetShellMode();
1055  SwWrtShell& rSh = m_pView->GetWrtShell();
1056  // call EnterStdMode in non-text selections only
1057  if(!bExpand ||
1058  (eSelMode != ShellMode::TableText &&
1059  eSelMode != ShellMode::ListText &&
1060  eSelMode != ShellMode::TableListText &&
1061  eSelMode != ShellMode::Text ))
1062  rSh.EnterStdMode();
1063  SwPaM* pShellCursor = rSh.GetCursor();
1064  SwPaM aOwnPaM(*pShellCursor->GetPoint());
1065  if(pShellCursor->HasMark())
1066  {
1067  aOwnPaM.SetMark();
1068  *aOwnPaM.GetMark() = *pShellCursor->GetMark();
1069  }
1070 
1071  uno::Reference<lang::XUnoTunnel> xRangeTunnel( xRange, uno::UNO_QUERY);
1072  SwXTextRange* pRange = comphelper::getFromUnoTunnel<SwXTextRange>(xRangeTunnel);
1073  SwXParagraph* pPara = comphelper::getFromUnoTunnel<SwXParagraph>(xRangeTunnel);
1074  OTextCursorHelper* pCursor = comphelper::getFromUnoTunnel<OTextCursorHelper>(xRangeTunnel);
1075 
1076  const FrameTypeFlags nFrameType = rSh.GetFrameType(nullptr,true);
1077 
1078  SwStartNodeType eSearchNodeType = SwNormalStartNode;
1079  if(nFrameType & FrameTypeFlags::FLY_ANY)
1080  eSearchNodeType = SwFlyStartNode;
1081  else if(nFrameType &FrameTypeFlags::HEADER)
1082  eSearchNodeType = SwHeaderStartNode;
1083  else if(nFrameType & FrameTypeFlags::FOOTER)
1084  eSearchNodeType = SwFooterStartNode;
1085  else if(nFrameType & FrameTypeFlags::TABLE)
1086  eSearchNodeType = SwTableBoxStartNode;
1087  else if(nFrameType & FrameTypeFlags::FOOTNOTE)
1088  eSearchNodeType = SwFootnoteStartNode;
1089 
1090  const SwStartNode* pOwnStartNode = aOwnPaM.GetNode().
1091  FindSttNodeByType(eSearchNodeType);
1092 
1093  const SwNode* pSrcNode = nullptr;
1094  if(pCursor && pCursor->GetPaM())
1095  {
1096  pSrcNode = &pCursor->GetPaM()->GetNode();
1097  }
1098  else if (pRange)
1099  {
1100  SwPaM aPam(pRange->GetDoc().GetNodes());
1101  if (pRange->GetPositions(aPam))
1102  {
1103  pSrcNode = &aPam.GetNode();
1104  }
1105  }
1106  else if (pPara && pPara->GetTextNode())
1107  {
1108  pSrcNode = pPara->GetTextNode();
1109  }
1110  const SwStartNode* pTmp = pSrcNode ? pSrcNode->FindSttNodeByType(eSearchNodeType) : nullptr;
1111 
1112  //Skip SectionNodes
1113  while(pTmp && pTmp->IsSectionNode())
1114  {
1115  pTmp = pTmp->StartOfSectionNode();
1116  }
1117  while(pOwnStartNode && pOwnStartNode->IsSectionNode())
1118  {
1119  pOwnStartNode = pOwnStartNode->StartOfSectionNode();
1120  }
1121  //Without Expand it is allowed to jump out with the ViewCursor everywhere,
1122  //with Expand only in the same environment
1123  if(bExpand &&
1124  (pOwnStartNode != pTmp ||
1125  (eSelMode != ShellMode::TableText &&
1126  eSelMode != ShellMode::ListText &&
1127  eSelMode != ShellMode::TableListText &&
1128  eSelMode != ShellMode::Text)))
1129  throw uno::RuntimeException();
1130 
1131  //Now, the selection must be expanded.
1132  if(bExpand)
1133  {
1134  // The cursor should include everything that has been included
1135  // by him and the transferred Range.
1136  SwPosition aOwnLeft(*aOwnPaM.Start());
1137  SwPosition aOwnRight(*aOwnPaM.End());
1138  SwPosition* pParamLeft = rDestPam.Start();
1139  SwPosition* pParamRight = rDestPam.End();
1140  // Now four SwPositions are there, two of them are needed, but which?
1141  if(aOwnRight > *pParamRight)
1142  *aOwnPaM.GetPoint() = aOwnRight;
1143  else
1144  *aOwnPaM.GetPoint() = *pParamRight;
1145  aOwnPaM.SetMark();
1146  if(aOwnLeft < *pParamLeft)
1147  *aOwnPaM.GetMark() = aOwnLeft;
1148  else
1149  *aOwnPaM.GetMark() = *pParamLeft;
1150  }
1151  else
1152  {
1153  //The cursor shall match the passed range.
1154  *aOwnPaM.GetPoint() = *rDestPam.GetPoint();
1155  if(rDestPam.HasMark())
1156  {
1157  aOwnPaM.SetMark();
1158  *aOwnPaM.GetMark() = *rDestPam.GetMark();
1159  }
1160  else
1161  aOwnPaM.DeleteMark();
1162  }
1163  rSh.SetSelection(aOwnPaM);
1164 
1165 
1166 }
1167 
1169 {
1170  SolarMutexGuard aGuard;
1171  comphelper::ProfileZone aZone("SwXTextViewCursor::gotoStart");
1172  if(!m_pView)
1173  throw uno::RuntimeException();
1174 
1175  if (!IsTextSelection())
1176  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1177 
1178  m_pView->GetWrtShell().StartOfSection( bExpand );
1179 
1180 }
1181 
1183 {
1184  SolarMutexGuard aGuard;
1185  comphelper::ProfileZone aZone("SwXTextViewCursor::gotoEnd");
1186  if(!m_pView)
1187  throw uno::RuntimeException();
1188 
1189  if (!IsTextSelection())
1190  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1191 
1192  m_pView->GetWrtShell().EndOfSection( bExpand );
1193 
1194 }
1195 
1197 {
1198  SolarMutexGuard aGuard;
1199  bool bRet = false;
1200  if(!m_pView)
1201  throw uno::RuntimeException();
1202 
1203  SwWrtShell& rSh = m_pView->GetWrtShell();
1204  if (rSh.IsSelFrameMode())
1205  {
1206  rSh.UnSelectFrame();
1207  rSh.LeaveSelFrameMode();
1208  }
1209  rSh.EnterStdMode();
1210  bRet = rSh.SttEndDoc(true);
1211 
1212  return bRet;
1213 }
1214 
1216 {
1217  SolarMutexGuard aGuard;
1218  bool bRet = false;
1219  if(!m_pView)
1220  throw uno::RuntimeException();
1221 
1222  SwWrtShell& rSh = m_pView->GetWrtShell();
1223  if (rSh.IsSelFrameMode())
1224  {
1225  rSh.UnSelectFrame();
1226  rSh.LeaveSelFrameMode();
1227  }
1228  rSh.EnterStdMode();
1229  bRet = rSh.SttEndDoc(false);
1230  rSh.SttPg();
1231 
1232  return bRet;
1233 }
1234 
1236 {
1237  SolarMutexGuard aGuard;
1238  bool bRet = false;
1239  if(!m_pView)
1240  throw uno::RuntimeException();
1241 
1242  bRet = m_pView->GetWrtShell().GotoPage(nPage, true);
1243 
1244  return bRet;
1245 }
1246 
1248 {
1249  SolarMutexGuard aGuard;
1250  bool bRet = false;
1251  if(!m_pView)
1252  throw uno::RuntimeException();
1253 
1254  bRet = m_pView->GetWrtShell().SttNxtPg();
1255 
1256  return bRet;
1257 }
1258 
1260 {
1261  SolarMutexGuard aGuard;
1262  bool bRet = false;
1263  if(!m_pView)
1264  throw uno::RuntimeException();
1265 
1266  bRet = m_pView->GetWrtShell().EndPrvPg();
1267 
1268  return bRet;
1269 }
1270 
1272 {
1273  SolarMutexGuard aGuard;
1274  bool bRet = false;
1275  if(!m_pView)
1276  throw uno::RuntimeException();
1277 
1278  bRet = m_pView->GetWrtShell().EndPg();
1279 
1280  return bRet;
1281 }
1282 
1284 {
1285  SolarMutexGuard aGuard;
1286  bool bRet = false;
1287  if(!m_pView)
1288  throw uno::RuntimeException();
1289 
1290  bRet = m_pView->GetWrtShell().SttPg();
1291 
1292  return bRet;
1293 }
1294 
1296 {
1297  SolarMutexGuard aGuard;
1298  sal_Int16 nRet = 0;
1299  if(!m_pView)
1300  throw uno::RuntimeException();
1301 
1302  SwWrtShell& rSh = m_pView->GetWrtShell();
1303  SwPaM* pShellCursor = rSh.GetCursor();
1304  nRet = static_cast<sal_Int16>(pShellCursor->GetPageNum());
1305 
1306  return nRet;
1307 }
1308 
1310 {
1311  SolarMutexGuard aGuard;
1312  bool bRet = false;
1313  if(!m_pView)
1314  throw uno::RuntimeException();
1315 
1316  SfxRequest aReq(FN_PAGEDOWN, SfxCallMode::SLOT, m_pView->GetPool());
1317  m_pView->Execute(aReq);
1318  const SfxPoolItem* pRet = aReq.GetReturnValue();
1319  bRet = pRet && static_cast<const SfxBoolItem*>(pRet)->GetValue();
1320 
1321  return bRet;
1322 }
1323 
1325 {
1326  SolarMutexGuard aGuard;
1327  bool bRet = false;
1328  if(!m_pView)
1329  throw uno::RuntimeException();
1330 
1331  SfxRequest aReq(FN_PAGEUP, SfxCallMode::SLOT, m_pView->GetPool());
1332  m_pView->Execute(aReq);
1333  const SfxPoolItem* pRet = aReq.GetReturnValue();
1334  bRet = pRet && static_cast<const SfxBoolItem*>(pRet)->GetValue();
1335 
1336  return bRet;
1337 }
1338 
1339 uno::Reference< text::XText > SwXTextViewCursor::getText()
1340 {
1341  SolarMutexGuard aGuard;
1342  uno::Reference< text::XText > xRet;
1343  if(!m_pView)
1344  throw uno::RuntimeException();
1345 
1346  if (!IsTextSelection( false ))
1347  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1348 
1349  SwWrtShell& rSh = m_pView->GetWrtShell();
1350  SwPaM* pShellCursor = rSh.GetCursor();
1351  SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
1352  xRet = ::sw::CreateParentXText(*pDoc, *pShellCursor->Start());
1353 
1354  return xRet;
1355 }
1356 
1357 uno::Reference< text::XTextRange > SwXTextViewCursor::getStart()
1358 {
1359  SolarMutexGuard aGuard;
1360  uno::Reference< text::XTextRange > xRet;
1361  if(!m_pView)
1362  throw uno::RuntimeException();
1363 
1364  if (!IsTextSelection())
1365  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1366 
1367  SwWrtShell& rSh = m_pView->GetWrtShell();
1368  SwPaM* pShellCursor = rSh.GetCursor();
1369  SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
1370  xRet = SwXTextRange::CreateXTextRange(*pDoc, *pShellCursor->Start(), nullptr);
1371 
1372  return xRet;
1373 }
1374 
1375 uno::Reference< text::XTextRange > SwXTextViewCursor::getEnd()
1376 {
1377  SolarMutexGuard aGuard;
1378  uno::Reference< text::XTextRange > xRet;
1379  if(!m_pView)
1380  throw uno::RuntimeException();
1381 
1382  if (!IsTextSelection())
1383  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1384 
1385  SwWrtShell& rSh = m_pView->GetWrtShell();
1386  SwPaM* pShellCursor = rSh.GetCursor();
1387  SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
1388  xRet = SwXTextRange::CreateXTextRange(*pDoc, *pShellCursor->End(), nullptr);
1389 
1390  return xRet;
1391 }
1392 
1394 {
1395  SolarMutexGuard aGuard;
1396  OUString uRet;
1397  if(m_pView)
1398  {
1399  if (!IsTextSelection( false ))
1400  {
1401  SAL_WARN("sw.uno", "no text selection in getString() " << static_cast<cppu::OWeakObject*>(this));
1402  return uRet;
1403  }
1404 
1405  ShellMode eSelMode = m_pView->GetShellMode();
1406  switch(eSelMode)
1407  {
1412 
1413  case ShellMode::ListText :
1415  case ShellMode::Text :
1416  {
1417  SwWrtShell& rSh = m_pView->GetWrtShell();
1418  SwPaM* pShellCursor = rSh.GetCursor();
1419  SwUnoCursorHelper::GetTextFromPam(*pShellCursor, uRet,
1420  rSh.GetLayout());
1421  break;
1422  }
1423  default:;//prevent warning
1424  }
1425  }
1426  return uRet;
1427 }
1428 
1429 void SwXTextViewCursor::setString(const OUString& aString)
1430 {
1431  SolarMutexGuard aGuard;
1432  if(!m_pView)
1433  return;
1434 
1435  if (!IsTextSelection( false ))
1436  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1437 
1438  ShellMode eSelMode = m_pView->GetShellMode();
1439  switch(eSelMode)
1440  {
1445 
1446  case ShellMode::ListText :
1448  case ShellMode::Text :
1449  {
1450  SwWrtShell& rSh = m_pView->GetWrtShell();
1451  SwCursor* pShellCursor = rSh.GetCursor();
1452  SwUnoCursorHelper::SetString(*pShellCursor, aString);
1453  break;
1454  }
1455  default:;//prevent warning
1456  }
1457 }
1458 
1459 uno::Reference< XPropertySetInfo > SwXTextViewCursor::getPropertySetInfo( )
1460 {
1461  static uno::Reference< XPropertySetInfo > xRef = m_pPropSet->getPropertySetInfo();
1462  return xRef;
1463 }
1464 
1465 void SwXTextViewCursor::setPropertyValue( const OUString& rPropertyName, const Any& aValue )
1466 {
1467  SolarMutexGuard aGuard;
1468  if(!m_pView)
1469  throw RuntimeException();
1470 
1471  SwWrtShell& rSh = m_pView->GetWrtShell();
1472  SwPaM* pShellCursor = rSh.GetCursor();
1473  SwNode& rNode = pShellCursor->GetNode();
1474  if (!rNode.IsTextNode())
1475  throw RuntimeException();
1476 
1478  *pShellCursor, *m_pPropSet, rPropertyName, aValue );
1479 
1480 
1481 }
1482 
1483 Any SwXTextViewCursor::getPropertyValue( const OUString& rPropertyName )
1484 {
1485  SolarMutexGuard aGuard;
1486  Any aRet;
1487  if(!m_pView)
1488  throw RuntimeException();
1489 
1490  SwWrtShell& rSh = m_pView->GetWrtShell();
1491  SwPaM* pShellCursor = rSh.GetCursor();
1493  *pShellCursor, *m_pPropSet, rPropertyName);
1494 
1495  return aRet;
1496 }
1497 
1499  const OUString& /*aPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
1500 {
1501 }
1502 
1504  const OUString& /*aPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*aListener*/ )
1505 {
1506 }
1507 
1509  const OUString& /*PropertyName*/, const uno::Reference< XVetoableChangeListener >& /*aListener*/ )
1510 {
1511 }
1512 
1514  const OUString& /*PropertyName*/, const uno::Reference< XVetoableChangeListener >& /*aListener*/ )
1515 {
1516 }
1517 
1518 PropertyState SwXTextViewCursor::getPropertyState( const OUString& rPropertyName )
1519 {
1520  SolarMutexGuard aGuard;
1521  PropertyState eState;
1522  if(!m_pView)
1523  throw RuntimeException();
1524 
1525  SwWrtShell& rSh = m_pView->GetWrtShell();
1526  SwPaM* pShellCursor = rSh.GetCursor();
1528  *pShellCursor, *m_pPropSet, rPropertyName);
1529 
1530  return eState;
1531 }
1532 
1533 Sequence< PropertyState > SwXTextViewCursor::getPropertyStates(
1534  const Sequence< OUString >& rPropertyNames )
1535 {
1536  SolarMutexGuard aGuard;
1537  Sequence< PropertyState > aRet;
1538  if(m_pView)
1539  {
1540  SwWrtShell& rSh = m_pView->GetWrtShell();
1541  SwPaM* pShellCursor = rSh.GetCursor();
1543  *pShellCursor, *m_pPropSet, rPropertyNames);
1544  }
1545  return aRet;
1546 }
1547 
1548 void SwXTextViewCursor::setPropertyToDefault( const OUString& rPropertyName )
1549 {
1550  SolarMutexGuard aGuard;
1551  if(m_pView)
1552  {
1553  SwWrtShell& rSh = m_pView->GetWrtShell();
1554  SwPaM* pShellCursor = rSh.GetCursor();
1556  *pShellCursor, *m_pPropSet, rPropertyName);
1557  }
1558 }
1559 
1560 Any SwXTextViewCursor::getPropertyDefault( const OUString& rPropertyName )
1561 {
1562  Any aRet;
1563  SolarMutexGuard aGuard;
1564  if(m_pView)
1565  {
1566  SwWrtShell& rSh = m_pView->GetWrtShell();
1567  SwPaM* pShellCursor = rSh.GetCursor();
1569  *pShellCursor, *m_pPropSet, rPropertyName);
1570  }
1571  return aRet;
1572 }
1573 
1574 sal_Bool SwXTextViewCursor::goDown(sal_Int16 nCount, sal_Bool bExpand)
1575 {
1576  SolarMutexGuard aGuard;
1577  comphelper::ProfileZone aZone("SwXTextViewCursor::goDown");
1578  bool bRet = false;
1579  if(!m_pView)
1580  throw uno::RuntimeException();
1581 
1582  if (!IsTextSelection())
1583  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1584 
1585  bRet = m_pView->GetWrtShell().Down( bExpand, nCount, true );
1586 
1587  return bRet;
1588 }
1589 
1590 sal_Bool SwXTextViewCursor::goUp(sal_Int16 nCount, sal_Bool bExpand)
1591 {
1592  SolarMutexGuard aGuard;
1593  comphelper::ProfileZone aZone("SwXTextViewCursor::goUp");
1594  bool bRet = false;
1595  if(!m_pView)
1596  throw uno::RuntimeException();
1597 
1598  if (!IsTextSelection())
1599  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1600 
1601  bRet = m_pView->GetWrtShell().Up( bExpand, nCount, true );
1602 
1603  return bRet;
1604 }
1605 
1607 {
1608  SolarMutexGuard aGuard;
1609  bool bRet = false;
1610  if(!m_pView)
1611  throw uno::RuntimeException();
1612 
1613  if (!IsTextSelection( false ))
1614  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1615 
1616  bRet = m_pView->GetWrtShell().IsAtLeftMargin();
1617 
1618  return bRet;
1619 }
1620 
1622 {
1623  SolarMutexGuard aGuard;
1624  bool bRet = false;
1625  if(!m_pView)
1626  throw uno::RuntimeException();
1627 
1628  if (!IsTextSelection( false ))
1629  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1630 
1631  bRet = m_pView->GetWrtShell().IsAtRightMargin();
1632 
1633  return bRet;
1634 }
1635 
1637 {
1638  SolarMutexGuard aGuard;
1639  if(!m_pView)
1640  throw uno::RuntimeException();
1641 
1642  if (!IsTextSelection( false ))
1643  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1644 
1645  m_pView->GetWrtShell().RightMargin(bExpand, true);
1646 
1647 }
1648 
1650 {
1651  SolarMutexGuard aGuard;
1652  if(!m_pView)
1653  throw uno::RuntimeException();
1654 
1655  if (!IsTextSelection( false ))
1656  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1657 
1658  m_pView->GetWrtShell().LeftMargin(bExpand, true);
1659 
1660 }
1661 
1663 {
1664  return "SwXTextViewCursor";
1665 }
1666 
1667 sal_Bool SwXTextViewCursor::supportsService(const OUString& rServiceName)
1668 {
1669  return cppu::supportsService(this, rServiceName);
1670 }
1671 
1673 {
1674  return { "com.sun.star.text.TextViewCursor",
1675  "com.sun.star.style.CharacterProperties",
1676  "com.sun.star.style.CharacterPropertiesAsian",
1677  "com.sun.star.style.CharacterPropertiesComplex",
1678  "com.sun.star.style.ParagraphProperties",
1679  "com.sun.star.style.ParagraphPropertiesAsian",
1680  "com.sun.star.style.ParagraphPropertiesComplex" };
1681 }
1682 
1683 const uno::Sequence< sal_Int8 > & SwXTextViewCursor::getUnoTunnelId()
1684 {
1685  static const comphelper::UnoIdInit theSwXTextViewCursorUnoTunnelId;
1686  return theSwXTextViewCursorUnoTunnelId.getSeq();
1687 }
1688 
1689 //XUnoTunnel
1691  const uno::Sequence< sal_Int8 >& rId )
1692 {
1693  return comphelper::getSomethingImpl(rId, this,
1695 }
1696 
1698 const SwDoc* SwXTextViewCursor::GetDoc() const
1699 {
1700  SwWrtShell& rSh = m_pView->GetWrtShell();
1701  return rSh.GetCursor() ? &rSh.GetCursor()->GetDoc() : nullptr;
1702 }
1703 
1705 {
1706  SwWrtShell& rSh = m_pView->GetWrtShell();
1707  return rSh.GetCursor() ? &rSh.GetCursor()->GetDoc() : nullptr;
1708 }
1709 
1711 {
1712  SwWrtShell& rSh = m_pView->GetWrtShell();
1713  return rSh.GetCursor();
1714 }
1715 
1717 {
1718  SwWrtShell& rSh = m_pView->GetWrtShell();
1719  return rSh.GetCursor();
1720 }
1721 
1722 uno::Reference<datatransfer::XTransferable> SAL_CALL
1723 SwXTextView::getTransferableForTextRange(uno::Reference<text::XTextRange> const& xTextRange)
1724 {
1725  SolarMutexGuard aGuard;
1726 
1727  // the point is we can copy PaM that wouldn't be legal as shell cursor
1729  if (!::sw::XTextRangeToSwPaM(aPam, xTextRange, ::sw::TextRangeMode::AllowNonTextNode))
1730  {
1731  throw uno::RuntimeException("invalid text range");
1732  }
1733 
1734  //force immediate shell update
1735  GetView()->StopShellTimer();
1736  SwWrtShell& rSh = GetView()->GetWrtShell();
1737  rtl::Reference<SwTransferable> pTransfer = new SwTransferable(rSh);
1738  const bool bLockedView = rSh.IsViewLocked();
1739  rSh.LockView( true );
1740  pTransfer->PrepareForCopyTextRange(aPam);
1741  rSh.LockView( bLockedView );
1742  return pTransfer;
1743 }
1744 
1745 uno::Reference< datatransfer::XTransferable > SAL_CALL SwXTextView::getTransferable()
1746 {
1747  SolarMutexGuard aGuard;
1748 
1749  //force immediat shell update
1750  GetView()->StopShellTimer();
1751  SwWrtShell& rSh = GetView()->GetWrtShell();
1752  if ( GetView()->GetShellMode() == ShellMode::DrawText )
1753  {
1754  SdrView *pSdrView = rSh.GetDrawView();
1755  OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
1756  return pOLV->GetEditView().GetTransferable();
1757  }
1758  else
1759  {
1760  rtl::Reference<SwTransferable> pTransfer = new SwTransferable( rSh );
1761  const bool bLockedView = rSh.IsViewLocked();
1762  rSh.LockView( true ); //lock visible section
1763  pTransfer->PrepareForCopy();
1764  rSh.LockView( bLockedView );
1765  return pTransfer;
1766  }
1767 }
1768 
1769 void SAL_CALL SwXTextView::insertTransferable( const uno::Reference< datatransfer::XTransferable >& xTrans )
1770 {
1771  SolarMutexGuard aGuard;
1772 
1773  //force immediat shell update
1774  GetView()->StopShellTimer();
1775  SwWrtShell& rSh = GetView()->GetWrtShell();
1776  if ( GetView()->GetShellMode() == ShellMode::DrawText )
1777  {
1778  SdrView *pSdrView = rSh.GetDrawView();
1779  OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
1780  pOLV->GetEditView().InsertText( xTrans, GetView()->GetDocShell()->GetMedium()->GetBaseURL(), false );
1781  }
1782  else
1783  {
1784  TransferableDataHelper aDataHelper( xTrans );
1785  if ( SwTransferable::IsPaste( rSh, aDataHelper ) )
1786  {
1787  SwTransferable::Paste( rSh, aDataHelper );
1788  if( rSh.IsFrameSelected() || rSh.IsObjSelected() )
1789  rSh.EnterSelFrameMode();
1790  GetView()->AttrChangedNotify(nullptr);
1791  }
1792  }
1793 }
1794 
1795 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SdrUnoObj * GetFormControl(const css::uno::Reference< css::awt::XControlModel > &_rxModel, const SdrView &_rView, const OutputDevice &_rDevice, css::uno::Reference< css::awt::XControl > &_out_rxControl) const
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: unotxvw.cxx:146
SwStartNode * FindSttNodeByType(SwStartNodeType eTyp)
Definition: node.cxx:764
#define UNO_NAME_RUBY_POSITION
Definition: unoprnms.hxx:565
void StopShellTimer()
Definition: view.cxx:1786
Starts a section of nodes in the document model.
Definition: node.hxx:312
IMPLEMENT_FORWARD_XINTERFACE2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)
const OUString & GetCharFormatName() const
Definition: fmtruby.hxx:64
static rtl::Reference< SwXTextRanges > Create(SwPaM *const pCursor)
Definition: unoobj2.cxx:1620
void DeleteMark()
Definition: pam.hxx:177
bool Right(sal_uInt16 nMode, bool bSelect, sal_uInt16 nCount, bool bBasicCall, bool bVisual=false)
Definition: move.cxx:127
virtual sal_Bool SAL_CALL screenUp() override
Definition: unotxvw.cxx:1324
URL aURL
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:223
sal_uInt16 GetLineCount()
Definition: editsh.cxx:844
bool EndPg(bool bSelect=false)
Definition: move.cxx:350
size_t GetMarkCount() const
Marks a position in the document model.
Definition: pam.hxx:35
static sal_uInt16 FillRubyList(const SwPaM &rPam, SwRubyList &rList)
Definition: docruby.cxx:48
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false)
bool IsSectionNode() const
Definition: node.hxx:645
virtual void SAL_CALL collapseToEnd() override
Definition: unotxvw.cxx:967
SdrView * GetDrawView()
Definition: vnew.cxx:373
#define PROPERTY_MAP_TEXT_CURSOR
Definition: unomap.hxx:27
bool IsTextSelection(bool bAllowTables=true) const
Definition: unotxvw.cxx:894
#define UNO_NAME_RUBY_BASE_TEXT
Definition: unoprnms.hxx:560
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unotxvw.cxx:854
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unotxvw.cxx:1465
virtual void SAL_CALL gotoEnd(sal_Bool bExpand) override
Definition: unotxvw.cxx:1182
bool SttEndDoc(bool bStt)
Definition: crsrsh.cxx:574
virtual OUString SAL_CALL getImplementationName() override
Definition: unotxvw.cxx:861
void notifyEach(void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event)
virtual void SAL_CALL setVisible(sal_Bool bVisible) override
Definition: unotxvw.cxx:917
std::string GetValue
virtual SdrObjList * getChildrenOfSdrObject() const
#define UNO_NAME_RUBY_TEXT
Definition: unoprnms.hxx:561
static void FillUIName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
constexpr SwTwips DOCUMENTBORDER
Definition: swtypes.hxx:80
virtual css::uno::Reference< css::datatransfer::XTransferable > SAL_CALL getTransferable() override
Definition: unotxvw.cxx:1745
css::uno::Reference< css::beans::XPropertySet > mxViewSettings
Definition: unotxvw.hxx:70
ULONG m_refCount
virtual const SwPaM * GetPaM() const override
Definition: unotxvw.cxx:1710
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unotxvw.cxx:1483
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getViewSettings() override
Definition: unotxvw.cxx:542
bool SttNxtPg(bool bSelect=false)
Definition: move.cxx:320
static bool IsPaste(const SwWrtShell &, const TransferableDataHelper &)
Definition: swdtflvr.cxx:1384
SwView * m_pView
Definition: unotxvw.hxx:66
long Long
bool LeftMargin(bool bSelect, bool bBasicCall)
Definition: move.cxx:174
std::vector< std::unique_ptr< SwRubyListEntry >> SwRubyList
Definition: doc.hxx:185
const SwPosition * GetMark() const
Definition: pam.hxx:209
sal_Int32 addInterface(const css::uno::Reference< css::uno::XInterface > &rxIFace)
sal_Int64 n
bool EndPrvPg(bool bSelect=false)
Definition: move.cxx:338
Definition: doc.hxx:188
const SwShellTableCursor * GetTableCursor() const
Definition: crsrsh.hxx:645
size_t GetObjCount() const
void disposeAndClear(const css::lang::EventObject &rEvt)
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unotxvw.cxx:847
#define UNO_NAME_RUBY_CHAR_STYLE_NAME
Definition: unoprnms.hxx:563
virtual OUString SAL_CALL getString() override
Definition: unotxvw.cxx:1393
void EnterStdMode()
Definition: select.cxx:551
SwEditWin & GetEditWin()
Definition: view.hxx:416
SdrMark * GetMark(size_t nNum) const
virtual void SAL_CALL gotoEndOfLine(sal_Bool bExpand) override
Definition: unotxvw.cxx:1636
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: unotxvw.cxx:1690
void GetSelectableFromAny(uno::Reference< uno::XInterface > const &xIfc, SwDoc &rTargetDoc, SwPaM *&o_rpPaM, std::pair< OUString, FlyCntType > &o_rFrame, OUString &o_rTableName, SwUnoTableCursor const *&o_rpTableCursor,::sw::mark::IMark const *&o_rpMark, std::vector< SdrObject * > &o_rSdrObjects)
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
sal_Int32 removeInterface(const css::uno::Reference< css::uno::XInterface > &rxIFace)
css::uno::Any GetPropertyDefault(SwPaM const &rPaM, const SfxItemPropertySet &rPropSet, std::u16string_view rPropertyName)
Definition: unoobj.cxx:2016
void SetClipBoard(bool bNew)
Definition: doc.hxx:965
void SetRubyList(const SwPaM &rPam, const SwRubyList &rList)
Definition: docruby.cxx:94
EmbeddedObjectRef * pObject
bool GotoTable(const OUString &rName)
Definition: move.cxx:693
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
virtual void SAL_CALL setRubyList(const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > &RubyList, sal_Bool bAutomatic) override
Definition: unotxvw.cxx:602
const SfxItemPropertySet * m_pPropSet
Definition: unotxvw.hxx:67
const SfxItemPropertyMapEntry * getByName(std::u16string_view rName) const
SwWrtShell & GetWrtShell() const
Definition: view.hxx:413
virtual sal_Bool SAL_CALL isFormDesignMode() override
Definition: unotxvw.cxx:492
void SetString(SwCursor &rCursor, const OUString &rString)
Definition: unoobj2.cxx:1657
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unotxvw.cxx:745
constexpr auto convertTwipToMm100(N n)
Used by the UI to modify the document model.
Definition: wrtsh.hxx:93
void FillPrtDoc(SwDoc &rPrtDoc, const SfxPrinter *pPrt)
Definition: vprint.cxx:305
virtual sal_Bool SAL_CALL screenDown() override
Definition: unotxvw.cxx:1309
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
Definition: unotxvw.cxx:1357
virtual sal_Bool SAL_CALL goUp(sal_Int16 nCount, sal_Bool bExpand) override
Definition: unotxvw.cxx:1590
virtual bool GetModelPositionForViewPoint(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const override
Primary passes the call to the first page.
Definition: trvlfrm.cxx:425
virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString &PropertyName) override
Definition: unotxvw.cxx:1518
const SwDoc & GetDoc() const
Definition: unoobj2.cxx:767
bool GotoFly(const OUString &rName, FlyCntType eType=FLYCNTTYPE_ALL, bool bSelFrame=true)
Definition: move.cxx:599
constexpr auto SFX_INTERFACE_NONE
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unotxvw.cxx:1672
Reference< XController > xController
SwView * GetView()
Definition: unotxvw.hxx:145
exports com.sun.star. frame
const char * tableName
virtual sal_Bool SAL_CALL goLeft(sal_Int16 nCount, sal_Bool bExpand) override
Definition: unotxvw.cxx:1006
bool GetPositions(SwPaM &rToFill,::sw::TextRangeMode eMode=::sw::TextRangeMode::RequireTextNode) const
Definition: unoobj2.cxx:1066
int nCount
virtual sal_Bool SAL_CALL isCollapsed() override
Definition: unotxvw.cxx:989
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
std::mutex m_aMutex
static SW_DLLPUBLIC sal_uInt16 GetPoolIdFromUIName(const OUString &rName, SwGetPoolIdFromName)
static bool Paste(SwWrtShell &, TransferableDataHelper &, RndStdIds nAnchorType=RndStdIds::FLY_AT_PARA, bool bIgnoreComments=false, PasteTableType ePasteTable=PasteTableType::PASTE_DEFAULT)
Definition: swdtflvr.cxx:1460
void GetTextFromPam(SwPaM &rPam, OUString &rBuffer, SwRootFrame const *pLayout=nullptr)
Definition: unoobj.cxx:126
SwDoc * GetDoc() const
Definition: viewsh.hxx:281
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unotxvw.cxx:833
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: unotxvw.cxx:129
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unotxvw.cxx:1459
ShellMode
Definition: view.hxx:85
void UnmarkAll()
#define WID_IS_CONSTANT_SPELLCHECK
Definition: unomap.hxx:287
virtual css::uno::Any SAL_CALL getSelection() override
Definition: unotxvw.cxx:348
const char * sName
SwPaM * GetNext()
Definition: pam.hxx:264
virtual sal_Bool SAL_CALL jumpToLastPage() override
Definition: unotxvw.cxx:1215
virtual sal_Bool SAL_CALL jumpToPreviousPage() override
Definition: unotxvw.cxx:1259
EditView & GetEditView() const
SfxItemPool & GetPool() const
const css::uno::Sequence< sal_Int8 > & getSeq() const
const OUString & GetText() const
Definition: fmtruby.hxx:61
void SetPropertyToDefault(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, std::u16string_view rPropertyName)
Definition: unoobj.cxx:1977
virtual ~SwXTextViewCursor() override
Definition: unotxvw.cxx:882
virtual sal_Bool SAL_CALL jumpToFirstPage() override
Definition: unotxvw.cxx:1196
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unotxvw.cxx:786
SdrObject * GetMarkedSdrObj() const
virtual void SAL_CALL addSelectionChangeListener(const css::uno::Reference< css::view::XSelectionChangeListener > &xListener) override
Definition: unotxvw.cxx:437
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:203
virtual void SAL_CALL gotoStart(sal_Bool bExpand) override
Definition: unotxvw.cxx:1168
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
const IDocumentDeviceAccess & getIDocumentDeviceAccess() const
Provides access to the document device interface.
Definition: viewsh.cxx:2663
virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString &aPropertyName) override
Definition: unotxvw.cxx:1560
sal_uInt16 GetPosition() const
Definition: fmtruby.hxx:70
virtual void SAL_CALL collapseToStart() override
Definition: unotxvw.cxx:945
#define FN_PAGEUP
Definition: cmdid.h:671
SwXTextView(SwView *pSwView)
Definition: unotxvw.cxx:87
virtual FmFormShell * GetFormShell() override
Definition: view.hxx:578
bool Up(bool bSelect, sal_uInt16 nCount=1, bool bBasicCall=false)
Definition: move.cxx:145
virtual void SAL_CALL setPropertyToDefault(const OUString &PropertyName) override
Definition: unotxvw.cxx:1548
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unotxvw.cxx:1667
Style of a layout element.
Definition: frmfmt.hxx:59
bool HasSelection() const
Definition: wrtsh.hxx:144
virtual void SAL_CALL acquire() noexcept override
Definition: unotxvw.cxx:151
#define WID_IS_HIDE_SPELL_MARKS
Definition: unomap.hxx:288
sal_uInt16 GetPageCount() const
Definition: viewsh.cxx:2556
int i
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:132
const SwPosition * GetPoint() const
Definition: pam.hxx:207
void SetOnlineSpell(bool b)
Definition: viewopt.cxx:339
static const char * GetDBChangeURL()
SelectionType
virtual sal_Bool SAL_CALL isAtStartOfLine() override
Definition: unotxvw.cxx:1606
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unotxvw.cxx:1683
void Exchange()
Definition: pam.cxx:492
#define UNO_NAME_RUBY_IS_ABOVE
Definition: unoprnms.hxx:564
SwView * m_pView
Definition: unotxvw.hxx:165
const SdrMarkList & GetMarkedObjectList() const
const SwPageDesc & GetPageDesc(size_t i) const
Definition: fedesc.cxx:126
virtual void SAL_CALL removeSelectionChangeListener(const css::uno::Reference< css::view::XSelectionChangeListener > &xListener) override
Definition: unotxvw.cxx:444
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:205
FrameTypeFlags
values can be combined via logical or
Definition: fesh.hxx:62
tools::Long GetLeft() const
virtual SwCursor & GetCurrentShellCursor() override
Return the current shell cursor.
Definition: crsrsh.cxx:186
void SetSelection(const SwPaM &rCursor)
Definition: crsrsh.cxx:3538
SwXTextViewCursor(SwView *pVw)
Definition: unotxvw.cxx:876
unsigned char sal_Bool
virtual sal_Bool SAL_CALL isVisible() override
Definition: unotxvw.cxx:911
bool RightMargin(bool bSelect, bool bBasicCall)
Definition: move.cxx:190
const SfxItemPropertyMap & getPropertyMap() const
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unotxvw.cxx:1513
bool IsGroupObject() const
const OutlinerView * GetTextEditOutlinerView() const
virtual sal_Bool SAL_CALL jumpToStartOfPage() override
Definition: unotxvw.cxx:1283
virtual void setJobsetup(const JobSetup &rJobSetup)=0
Sets the Jobsetup.
virtual OUString SAL_CALL getImplementationName() override
Definition: unotxvw.cxx:1662
void NotifySelChanged()
Definition: unotxvw.cxx:709
const SfxItemPropertySet * m_pPropSet
Definition: unotxvw.hxx:166
Point PixelToLogic(const Point &rDevicePt) const
css::uno::Reference< css::datatransfer::XTransferable > GetTransferable() const
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL createTextRangeByPixelPosition(const css::awt::Point &rPixelPosition) override
Definition: unotxvw.cxx:524
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:123
virtual SfxPrinter * getPrinter(bool bCreate) const =0
Return the printer set at the document.
virtual css::awt::Point SAL_CALL getPosition() override
Definition: unotxvw.cxx:922
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unotxvw.cxx:1508
static css::uno::Reference< css::drawing::XShape > GetShape(SdrObject *pObj)
Definition: unodraw.cxx:292
virtual css::uno::Reference< css::awt::XControl > SAL_CALL getControl(const css::uno::Reference< css::awt::XControlModel > &Model) override
Definition: unotxvw.cxx:468
virtual sal_Bool SAL_CALL goRight(sal_Int16 nCount, sal_Bool bExpand) override
Definition: unotxvw.cxx:1021
bool StartOfSection(bool bSelect=false)
Definition: move.cxx:308
SfxViewShell * GetViewShell() const
virtual const JobSetup * getJobsetup() const =0
Returns the Jobsetup.
void Invalidate()
Definition: unotxvw.cxx:101
const SwPosition * Start() const
Definition: pam.hxx:212
SwDocShell * GetDocShell()
Definition: view.cxx:1127
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unotxvw.cxx:1503
SwFrameFormat * GetTableFormat()
Definition: edws.cxx:183
::comphelper::OInterfaceContainerHelper2 m_SelChangedListeners
Definition: unotxvw.hxx:64
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange,::sw::TextRangeMode const eMode)
Definition: unoobj2.cxx:1107
virtual sal_Int16 SAL_CALL getPage() override
Definition: unotxvw.cxx:1295
void InsertText(const OUString &rNew, bool bSelect=false, bool bLOKShowSelect=true)
bool SttPg(bool bSelect=false)
Definition: move.cxx:344
const OUString & m_rURL
virtual sal_Bool SAL_CALL select(const css::uno::Any &rInterface) override
Definition: unotxvw.cxx:224
virtual css::uno::Reference< css::datatransfer::XTransferable > SAL_CALL getTransferableForTextRange(css::uno::Reference< css::text::XTextRange > const &xTextRange) override
Definition: unotxvw.cxx:1723
#define PROPERTY_MAP_TEXT_VIEW
Definition: unomap.hxx:117
virtual void SAL_CALL gotoStartOfLine(sal_Bool bExpand) override
Definition: unotxvw.cxx:1649
virtual css::uno::Reference< css::form::runtime::XFormController > SAL_CALL getFormController(const css::uno::Reference< css::form::XForm > &Form) override
Definition: unotxvw.cxx:476
const SwFormatRuby & GetRubyAttr() const
Definition: rubylist.hxx:35
Provides access to the formatting devices of a document.
virtual sal_Bool SAL_CALL jumpToPage(sal_Int16 nPage) override
Definition: unotxvw.cxx:1235
static css::uno::Reference< css::form::runtime::XFormController > GetFormController(const css::uno::Reference< css::form::XForm > &_rxForm, const SdrView &_rView, const OutputDevice &_rDevice)
css::uno::Any GetPropertyValue(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, std::u16string_view rPropertyName)
Definition: unoobj.cxx:1698
virtual void SAL_CALL setString(const OUString &aString) override
Definition: unotxvw.cxx:1429
void SetDesignMode(bool _bDesignMode)
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:238
const PropertyValue * pValues
void GotoMark(const ::sw::mark::IMark *const pMark)
Definition: wrtsh3.cxx:134
virtual sal_Bool SAL_CALL jumpToEndOfPage() override
Definition: unotxvw.cxx:1271
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unotxvw.cxx:866
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:414
bool IsAtRightMargin() const
Definition: crsrsh.hxx:746
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:195
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unotxvw.cxx:840
bool Left(sal_uInt16 nMode, bool bSelect, sal_uInt16 nCount, bool bBasicCall, bool bVisual=false)
Definition: move.cxx:110
virtual const SwDoc * GetDoc() const override
Definition: unotxvw.cxx:1698
static SfxViewFrame * LoadHiddenDocument(SfxObjectShell const &i_rDoc, SfxInterfaceId i_nViewId)
SdrPage * GetPage() const
void LockView(bool b)
Definition: viewsh.hxx:462
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:423
vcl::Window * GetWin() const
Definition: viewsh.hxx:337
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
css::uno::Sequence< css::beans::PropertyState > GetPropertyStates(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const css::uno::Sequence< OUString > &rPropertyNames, const SwGetPropertyStatesCaller eCaller=SW_PROPERTY_STATE_CALLER_DEFAULT)
virtual void SAL_CALL setFormDesignMode(sal_Bool DesignMode) override
Definition: unotxvw.cxx:500
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unotxvw.cxx:1498
void SetPropertyValue(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName, const css::uno::Any &rValue, const SetAttrMode nAttrMode=SetAttrMode::DEFAULT)
void NotifyDBChanged()
Definition: unotxvw.cxx:736
::OutputDevice const * GetOutDev() const
static void FillProgName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
bool DoInitNew(SfxMedium *pMedium=nullptr)
SwNodes & GetNodes()
Definition: doc.hxx:409
virtual void SAL_CALL release() noexcept override
Definition: unotxvw.cxx:156
virtual void SAL_CALL insertTransferable(const css::uno::Reference< css::datatransfer::XTransferable > &xTrans) override
Definition: unotxvw.cxx:1769
virtual bool IsDesignMode() const override
#define WID_PAGE_COUNT
Definition: unomap.hxx:285
const SwPosition * End() const
Definition: pam.hxx:217
const SvxPaperBinItem & GetPaperBin(bool=true) const
Definition: frmatr.hxx:72
virtual css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > SAL_CALL getRubyList(sal_Bool bAutomatic) override
Definition: unotxvw.cxx:556
static SW_DLLPUBLIC css::uno::Reference< css::text::XTextFrame > CreateXTextFrame(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3179
const SwRect & GetCharRect() const
Definition: crsrsh.hxx:516
void Execute(SfxRequest &)
Definition: view2.cxx:537
size_t IsObjSelected() const
Definition: feshview.cxx:1240
Reference< XComponentContext > getProcessComponentContext()
SwUnoPropertyMapProvider aSwMapProvider
Definition: unomap1.cxx:87
void UnSelectFrame()
Definition: select.cxx:323
virtual sal_Bool SAL_CALL goDown(sal_Int16 nCount, sal_Bool bExpand) override
Definition: unotxvw.cxx:1574
#define FN_PAGEDOWN
Definition: cmdid.h:672
SfxObjectShellLock BuildTmpSelectionDoc()
Definition: unotxvw.cxx:674
css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
Definition: unotxvw.cxx:1375
bool Down(bool bSelect, sal_uInt16 nCount=1, bool bBasicCall=false)
Definition: move.cxx:159
SwStartNodeType
Definition: ndtyp.hxx:50
virtual void CalcLayout() override
To enable set up of StartActions and EndActions.
Definition: edws.cxx:108
SdrObject * getParentSdrObjectFromSdrObject() const
virtual void SAL_CALL gotoRange(const css::uno::Reference< css::text::XTextRange > &xRange, sal_Bool bExpand) override
Definition: unotxvw.cxx:1037
SdrPageView * GetSdrPageView() const
void LeaveSelFrameMode()
Definition: select.cxx:720
css::text::RubyAdjust GetAdjustment() const
Definition: fmtruby.hxx:73
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unotxvw.cxx:871
bool GotoPage(sal_uInt16 nPage, bool bRecord)
Definition: move.cxx:573
const sal_uInt16 CRSR_SKIP_CHARS
Definition: swcrsr.hxx:65
const SwFrameFormat * GetFlyFrameFormat() const
Get FlyFrameFormat; for UI macro linkage at Flys.
Definition: fefly1.cxx:1272
#define SAL_WARN(area, stream)
bool EndOfSection(bool bSelect=false)
Definition: move.cxx:314
SdrObject * GetControl(const css::uno::Reference< css::awt::XControlModel > &Model, css::uno::Reference< css::awt::XControl > &xToFill)
Definition: unotxvw.cxx:451
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
SwDoc & GetDoc() const
Definition: pam.hxx:243
cppu::WeakImplHelper< css::text::XTextViewCursor, css::lang::XServiceInfo, css::text::XPageCursor, css::view::XScreenCursor, css::view::XViewCursor, css::view::XLineCursor, css::beans::XPropertySet, css::beans::XPropertyState > SwXTextViewCursor_Base
Definition: unotxvw.hxx:161
#define WID_LINE_COUNT
Definition: unomap.hxx:286
void EnterSelFrameMode(const Point *pStartDrag=nullptr)
Definition: select.cxx:702
static css::uno::Reference< css::text::XTextContent > CreateXTextEmbeddedObject(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3468
const OUString & GetText() const
Definition: rubylist.hxx:32
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
Definition: unotxvw.cxx:161
static css::uno::Reference< css::text::XTextContent > CreateXTextGraphicObject(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3421
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:478
css::beans::PropertyState GetPropertyState(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName)
Definition: unoobj.cxx:1944
virtual sal_Bool SAL_CALL isAtEndOfLine() override
Definition: unotxvw.cxx:1621
virtual SdrView * GetDrawView() const override
Definition: viewdraw.cxx:621
virtual css::uno::Reference< css::text::XTextViewCursor > SAL_CALL getViewCursor() override
Definition: unotxvw.cxx:509
virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override
Definition: unotxvw.cxx:1339
static css::uno::Reference< css::text::XTextRange > CreateXTextRange(SwDoc &rDoc, const SwPosition &rPos, const SwPosition *const pMark)
Definition: unoobj2.cxx:1214
css::uno::Reference< css::text::XTextViewCursor > mxTextViewCursor
Definition: unotxvw.hxx:71
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1432
virtual void ApplyViewOptions(const SwViewOption &rOpt) override
Apply ViewOptions with Start-/EndAction.
Definition: wrtsh1.cxx:1830
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2067
ShellMode GetShellMode() const
Definition: view0.cxx:106
size_t GetCurPageDesc(const bool bCalcFrame=true) const
Definition: fedesc.cxx:167
bool IsTextNode() const
Definition: node.hxx:637
bool IsAtLeftMargin() const
Definition: crsrsh.hxx:745
FrameTypeFlags GetFrameType(const Point *pPt, bool bStopAtFly) const
For return values see above FrameType.
Definition: fews.cxx:237
bool IsFrameSelected() const
Definition: feshview.cxx:1248
uno::Reference< text::XText > CreateParentXText(SwDoc &rDoc, const SwPosition &rPos)
Definition: unoobj2.cxx:1235
virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates(const css::uno::Sequence< OUString > &aPropertyName) override
Definition: unotxvw.cxx:1533
#define UNO_NAME_RUBY_ADJUST
Definition: unoprnms.hxx:562
ViewOptFlags1 GetCoreOptions() const
Definition: viewopt.hxx:205
virtual ~SwXTextView() override
Definition: unotxvw.cxx:96
AnyEventRef aEvent
bool IsViewLocked() const
Definition: viewsh.hxx:461
void HideCursor()
Definition: crsrsh.cxx:2408
sal_uInt16 GetPageNum(bool bAtPoint=true, const Point *pLayPos=nullptr)
Get number of page which contains cursor.
Definition: pam.cxx:552
virtual sal_Bool SAL_CALL jumpToNextPage() override
Definition: unotxvw.cxx:1247
Definition: view.hxx:144
bool IsSelFrameMode() const
Definition: wrtsh.hxx:173
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:856
sal_uInt16 GetUpper() const
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unotxvw.cxx:752
Base class of the Writer document model elements.
Definition: node.hxx:80