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 
722 {
723  URL aURL;
724  aURL.Complete = OUString::createFromAscii(SwXDispatch::GetDBChangeURL());
725 
727  [&aURL] (const uno::Reference<XSelectionChangeListener>& xListener)
728  {
729  uno::Reference<XDispatch> xDispatch(xListener, UNO_QUERY);
730  if (xDispatch)
731  xDispatch->dispatch(aURL, {});
732  });
733 }
734 
735 uno::Reference< beans::XPropertySetInfo > SAL_CALL SwXTextView::getPropertySetInfo( )
736 {
737  SolarMutexGuard aGuard;
738  static uno::Reference< XPropertySetInfo > aRef = m_pPropSet->getPropertySetInfo();
739  return aRef;
740 }
741 
743  const OUString& rPropertyName, const uno::Any& rValue )
744 {
745  SolarMutexGuard aGuard;
746  const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
747  if (!pEntry)
748  throw UnknownPropertyException(rPropertyName);
749  else if (pEntry->nFlags & PropertyAttribute::READONLY)
750  throw PropertyVetoException();
751  else
752  {
753  switch (pEntry->nWID)
754  {
756  // deprecated #i91949
757  break;
759  {
760  bool bVal = false;
761  const SwViewOption *pOpt = m_pView->GetWrtShell().GetViewOptions();
762  if (!pOpt || !(rValue >>= bVal))
763  throw RuntimeException();
764  SwViewOption aNewOpt( *pOpt );
765  if (pEntry->nWID == WID_IS_CONSTANT_SPELLCHECK)
766  aNewOpt.SetOnlineSpell(bVal);
767  m_pView->GetWrtShell().ApplyViewOptions( aNewOpt );
768  }
769  break;
770  default :
771  OSL_FAIL("unknown WID");
772  }
773  }
774 }
775 
777  const OUString& rPropertyName )
778 {
779  SolarMutexGuard aGuard;
780 
781  Any aRet;
782 
783  const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
784  if (!pEntry)
785  throw UnknownPropertyException(rPropertyName);
786 
787  sal_Int16 nWID = pEntry->nWID;
788  switch (nWID)
789  {
790  case WID_PAGE_COUNT :
791  case WID_LINE_COUNT :
792  {
793  // format document completely in order to get meaningful
794  // values for page count and line count
796 
797  sal_Int32 nCount = -1;
798  if (nWID == WID_PAGE_COUNT)
799  nCount = m_pView->GetWrtShell().GetPageCount();
800  else // WID_LINE_COUNT
801  nCount = m_pView->GetWrtShell().GetLineCount();
802  aRet <<= nCount;
803  }
804  break;
806  // deprecated #i91949
807  break;
809  {
810  const SwViewOption *pOpt = m_pView->GetWrtShell().GetViewOptions();
811  if (!pOpt)
812  throw RuntimeException();
813  aRet <<= bool(pOpt->GetCoreOptions() & ViewOptFlags1::OnlineSpell);
814  }
815  break;
816  default :
817  OSL_FAIL("unknown WID");
818  }
819 
820  return aRet;
821 }
822 
824  const OUString& /*rPropertyName*/,
825  const uno::Reference< beans::XPropertyChangeListener >& /*rxListener*/ )
826 {
827  OSL_FAIL("not implemented");
828 }
829 
831  const OUString& /*rPropertyName*/,
832  const uno::Reference< beans::XPropertyChangeListener >& /*rxListener*/ )
833 {
834  OSL_FAIL("not implemented");
835 }
836 
838  const OUString& /*rPropertyName*/,
839  const uno::Reference< beans::XVetoableChangeListener >& /*rxListener*/ )
840 {
841  OSL_FAIL("not implemented");
842 }
843 
845  const OUString& /*rPropertyName*/,
846  const uno::Reference< beans::XVetoableChangeListener >& /*rxListener*/ )
847 {
848  OSL_FAIL("not implemented");
849 }
850 
852 {
853  return "SwXTextView";
854 }
855 
856 sal_Bool SwXTextView::supportsService(const OUString& rServiceName)
857 {
858  return cppu::supportsService(this, rServiceName);
859 }
860 
862 {
863  return { "com.sun.star.text.TextDocumentView", "com.sun.star.view.OfficeDocumentView" };
864 }
865 
867  m_pView(pVw),
868  m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR))
869 {
870 }
871 
873 {
874 }
875 
876 // used to determine if there is a text selection or not.
877 // If there is no text selection the functions that need a working
878 // cursor will be disabled (throw RuntimeException). This will be the case
879 // for the following interfaces:
880 // - XViewCursor
881 // - XTextCursor
882 // - XTextRange
883 // - XLineCursor
884 bool SwXTextViewCursor::IsTextSelection( bool bAllowTables ) const
885 {
886 
887  bool bRes = false;
888  OSL_ENSURE(m_pView, "m_pView is NULL ???");
889  if(m_pView)
890  {
894  bRes = ( (SelectionType::Text & eSelType) ||
895  (SelectionType::NumberList & eSelType) ) &&
896  (!(SelectionType::TableCell & eSelType) || bAllowTables);
897  }
898  return bRes;
899 }
900 
902 {
903  OSL_FAIL("not implemented");
904  return true;
905 }
906 
908 {
909  OSL_FAIL("not implemented");
910 }
911 
913 {
914  SolarMutexGuard aGuard;
915  awt::Point aRet;
916  if(!m_pView)
917  throw uno::RuntimeException();
918 
919  const SwWrtShell& rSh = m_pView->GetWrtShell();
920  const SwRect& aCharRect(rSh.GetCharRect());
921 
922  const SwFrameFormat& rMaster = rSh.GetPageDesc( rSh.GetCurPageDesc() ).GetMaster();
923 
924  const SvxULSpaceItem& rUL = rMaster.GetULSpace();
925  const tools::Long nY = aCharRect.Top() - (rUL.GetUpper() + DOCUMENTBORDER);
926  aRet.Y = convertTwipToMm100(nY);
927 
928  const SvxLRSpaceItem& rLR = rMaster.GetLRSpace();
929  const tools::Long nX = aCharRect.Left() - (rLR.GetLeft() + DOCUMENTBORDER);
930  aRet.X = convertTwipToMm100(nX);
931 
932  return aRet;
933 }
934 
936 {
937  SolarMutexGuard aGuard;
938  if(!m_pView)
939  throw uno::RuntimeException();
940 
941  if (!IsTextSelection())
942  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
943 
944  SwWrtShell& rSh = m_pView->GetWrtShell();
945  if(rSh.HasSelection())
946  {
947  SwPaM* pShellCursor = rSh.GetCursor();
948  if(*pShellCursor->GetPoint() > *pShellCursor->GetMark())
949  pShellCursor->Exchange();
950  pShellCursor->DeleteMark();
951  rSh.EnterStdMode();
952  rSh.SetSelection(*pShellCursor);
953  }
954 
955 }
956 
958 {
959  SolarMutexGuard aGuard;
960  if(!m_pView)
961  throw uno::RuntimeException();
962 
963  if (!IsTextSelection())
964  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
965 
966  SwWrtShell& rSh = m_pView->GetWrtShell();
967  if(rSh.HasSelection())
968  {
969  SwPaM* pShellCursor = rSh.GetCursor();
970  if(*pShellCursor->GetPoint() < *pShellCursor->GetMark())
971  pShellCursor->Exchange();
972  pShellCursor->DeleteMark();
973  rSh.EnterStdMode();
974  rSh.SetSelection(*pShellCursor);
975  }
976 
977 }
978 
980 {
981  SolarMutexGuard aGuard;
982  bool bRet = false;
983  if(!m_pView)
984  throw uno::RuntimeException();
985 
986  if (!IsTextSelection())
987  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
988 
989  const SwWrtShell& rSh = m_pView->GetWrtShell();
990  bRet = !rSh.HasSelection();
991 
992  return bRet;
993 
994 }
995 
996 sal_Bool SwXTextViewCursor::goLeft(sal_Int16 nCount, sal_Bool bExpand)
997 {
998  SolarMutexGuard aGuard;
999  bool bRet = false;
1000  if(!m_pView)
1001  throw uno::RuntimeException();
1002 
1003  if (!IsTextSelection())
1004  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1005 
1006  bRet = m_pView->GetWrtShell().Left( CRSR_SKIP_CHARS, bExpand, nCount, true );
1007 
1008  return bRet;
1009 }
1010 
1012 {
1013  SolarMutexGuard aGuard;
1014  bool bRet = false;
1015  if(!m_pView)
1016  throw uno::RuntimeException();
1017 
1018  if (!IsTextSelection())
1019  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1020 
1021  bRet = m_pView->GetWrtShell().Right( CRSR_SKIP_CHARS, bExpand, nCount, true );
1022 
1023  return bRet;
1024 
1025 }
1026 
1028  const uno::Reference< text::XTextRange > & xRange,
1029  sal_Bool bExpand)
1030 {
1031  SolarMutexGuard aGuard;
1032  if(!(m_pView && xRange.is()))
1033  throw uno::RuntimeException();
1034 
1035  if (!IsTextSelection())
1036  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1037 
1038  SwUnoInternalPaM rDestPam(*m_pView->GetDocShell()->GetDoc());
1039  if (!::sw::XTextRangeToSwPaM(rDestPam, xRange))
1040  {
1041  throw uno::RuntimeException();
1042  }
1043 
1044  ShellMode eSelMode = m_pView->GetShellMode();
1045  SwWrtShell& rSh = m_pView->GetWrtShell();
1046  // call EnterStdMode in non-text selections only
1047  if(!bExpand ||
1048  (eSelMode != ShellMode::TableText &&
1049  eSelMode != ShellMode::ListText &&
1050  eSelMode != ShellMode::TableListText &&
1051  eSelMode != ShellMode::Text ))
1052  rSh.EnterStdMode();
1053  SwPaM* pShellCursor = rSh.GetCursor();
1054  SwPaM aOwnPaM(*pShellCursor->GetPoint());
1055  if(pShellCursor->HasMark())
1056  {
1057  aOwnPaM.SetMark();
1058  *aOwnPaM.GetMark() = *pShellCursor->GetMark();
1059  }
1060 
1061  uno::Reference<lang::XUnoTunnel> xRangeTunnel( xRange, uno::UNO_QUERY);
1062  SwXTextRange* pRange = comphelper::getFromUnoTunnel<SwXTextRange>(xRangeTunnel);
1063  SwXParagraph* pPara = comphelper::getFromUnoTunnel<SwXParagraph>(xRangeTunnel);
1064  OTextCursorHelper* pCursor = comphelper::getFromUnoTunnel<OTextCursorHelper>(xRangeTunnel);
1065 
1066  const FrameTypeFlags nFrameType = rSh.GetFrameType(nullptr,true);
1067 
1068  SwStartNodeType eSearchNodeType = SwNormalStartNode;
1069  if(nFrameType & FrameTypeFlags::FLY_ANY)
1070  eSearchNodeType = SwFlyStartNode;
1071  else if(nFrameType &FrameTypeFlags::HEADER)
1072  eSearchNodeType = SwHeaderStartNode;
1073  else if(nFrameType & FrameTypeFlags::FOOTER)
1074  eSearchNodeType = SwFooterStartNode;
1075  else if(nFrameType & FrameTypeFlags::TABLE)
1076  eSearchNodeType = SwTableBoxStartNode;
1077  else if(nFrameType & FrameTypeFlags::FOOTNOTE)
1078  eSearchNodeType = SwFootnoteStartNode;
1079 
1080  const SwStartNode* pOwnStartNode = aOwnPaM.GetNode().
1081  FindSttNodeByType(eSearchNodeType);
1082 
1083  const SwNode* pSrcNode = nullptr;
1084  if(pCursor && pCursor->GetPaM())
1085  {
1086  pSrcNode = &pCursor->GetPaM()->GetNode();
1087  }
1088  else if (pRange)
1089  {
1090  SwPaM aPam(pRange->GetDoc().GetNodes());
1091  if (pRange->GetPositions(aPam))
1092  {
1093  pSrcNode = &aPam.GetNode();
1094  }
1095  }
1096  else if (pPara && pPara->GetTextNode())
1097  {
1098  pSrcNode = pPara->GetTextNode();
1099  }
1100  const SwStartNode* pTmp = pSrcNode ? pSrcNode->FindSttNodeByType(eSearchNodeType) : nullptr;
1101 
1102  //Skip SectionNodes
1103  while(pTmp && pTmp->IsSectionNode())
1104  {
1105  pTmp = pTmp->StartOfSectionNode();
1106  }
1107  while(pOwnStartNode && pOwnStartNode->IsSectionNode())
1108  {
1109  pOwnStartNode = pOwnStartNode->StartOfSectionNode();
1110  }
1111  //Without Expand it is allowed to jump out with the ViewCursor everywhere,
1112  //with Expand only in the same environment
1113  if(bExpand &&
1114  (pOwnStartNode != pTmp ||
1115  (eSelMode != ShellMode::TableText &&
1116  eSelMode != ShellMode::ListText &&
1117  eSelMode != ShellMode::TableListText &&
1118  eSelMode != ShellMode::Text)))
1119  throw uno::RuntimeException();
1120 
1121  //Now, the selection must be expanded.
1122  if(bExpand)
1123  {
1124  // The cursor should include everything that has been included
1125  // by him and the transferred Range.
1126  SwPosition aOwnLeft(*aOwnPaM.Start());
1127  SwPosition aOwnRight(*aOwnPaM.End());
1128  SwPosition* pParamLeft = rDestPam.Start();
1129  SwPosition* pParamRight = rDestPam.End();
1130  // Now four SwPositions are there, two of them are needed, but which?
1131  if(aOwnRight > *pParamRight)
1132  *aOwnPaM.GetPoint() = aOwnRight;
1133  else
1134  *aOwnPaM.GetPoint() = *pParamRight;
1135  aOwnPaM.SetMark();
1136  if(aOwnLeft < *pParamLeft)
1137  *aOwnPaM.GetMark() = aOwnLeft;
1138  else
1139  *aOwnPaM.GetMark() = *pParamLeft;
1140  }
1141  else
1142  {
1143  //The cursor shall match the passed range.
1144  *aOwnPaM.GetPoint() = *rDestPam.GetPoint();
1145  if(rDestPam.HasMark())
1146  {
1147  aOwnPaM.SetMark();
1148  *aOwnPaM.GetMark() = *rDestPam.GetMark();
1149  }
1150  else
1151  aOwnPaM.DeleteMark();
1152  }
1153  rSh.SetSelection(aOwnPaM);
1154 
1155 
1156 }
1157 
1159 {
1160  SolarMutexGuard aGuard;
1161  comphelper::ProfileZone aZone("SwXTextViewCursor::gotoStart");
1162  if(!m_pView)
1163  throw uno::RuntimeException();
1164 
1165  if (!IsTextSelection())
1166  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1167 
1168  m_pView->GetWrtShell().StartOfSection( bExpand );
1169 
1170 }
1171 
1173 {
1174  SolarMutexGuard aGuard;
1175  comphelper::ProfileZone aZone("SwXTextViewCursor::gotoEnd");
1176  if(!m_pView)
1177  throw uno::RuntimeException();
1178 
1179  if (!IsTextSelection())
1180  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1181 
1182  m_pView->GetWrtShell().EndOfSection( bExpand );
1183 
1184 }
1185 
1187 {
1188  SolarMutexGuard aGuard;
1189  bool bRet = false;
1190  if(!m_pView)
1191  throw uno::RuntimeException();
1192 
1193  SwWrtShell& rSh = m_pView->GetWrtShell();
1194  if (rSh.IsSelFrameMode())
1195  {
1196  rSh.UnSelectFrame();
1197  rSh.LeaveSelFrameMode();
1198  }
1199  rSh.EnterStdMode();
1200  bRet = rSh.SttEndDoc(true);
1201 
1202  return bRet;
1203 }
1204 
1206 {
1207  SolarMutexGuard aGuard;
1208  bool bRet = false;
1209  if(!m_pView)
1210  throw uno::RuntimeException();
1211 
1212  SwWrtShell& rSh = m_pView->GetWrtShell();
1213  if (rSh.IsSelFrameMode())
1214  {
1215  rSh.UnSelectFrame();
1216  rSh.LeaveSelFrameMode();
1217  }
1218  rSh.EnterStdMode();
1219  bRet = rSh.SttEndDoc(false);
1220  rSh.SttPg();
1221 
1222  return bRet;
1223 }
1224 
1226 {
1227  SolarMutexGuard aGuard;
1228  bool bRet = false;
1229  if(!m_pView)
1230  throw uno::RuntimeException();
1231 
1232  bRet = m_pView->GetWrtShell().GotoPage(nPage, true);
1233 
1234  return bRet;
1235 }
1236 
1238 {
1239  SolarMutexGuard aGuard;
1240  bool bRet = false;
1241  if(!m_pView)
1242  throw uno::RuntimeException();
1243 
1244  bRet = m_pView->GetWrtShell().SttNxtPg();
1245 
1246  return bRet;
1247 }
1248 
1250 {
1251  SolarMutexGuard aGuard;
1252  bool bRet = false;
1253  if(!m_pView)
1254  throw uno::RuntimeException();
1255 
1256  bRet = m_pView->GetWrtShell().EndPrvPg();
1257 
1258  return bRet;
1259 }
1260 
1262 {
1263  SolarMutexGuard aGuard;
1264  bool bRet = false;
1265  if(!m_pView)
1266  throw uno::RuntimeException();
1267 
1268  bRet = m_pView->GetWrtShell().EndPg();
1269 
1270  return bRet;
1271 }
1272 
1274 {
1275  SolarMutexGuard aGuard;
1276  bool bRet = false;
1277  if(!m_pView)
1278  throw uno::RuntimeException();
1279 
1280  bRet = m_pView->GetWrtShell().SttPg();
1281 
1282  return bRet;
1283 }
1284 
1286 {
1287  SolarMutexGuard aGuard;
1288  sal_Int16 nRet = 0;
1289  if(!m_pView)
1290  throw uno::RuntimeException();
1291 
1292  SwWrtShell& rSh = m_pView->GetWrtShell();
1293  SwPaM* pShellCursor = rSh.GetCursor();
1294  nRet = static_cast<sal_Int16>(pShellCursor->GetPageNum());
1295 
1296  return nRet;
1297 }
1298 
1300 {
1301  SolarMutexGuard aGuard;
1302  bool bRet = false;
1303  if(!m_pView)
1304  throw uno::RuntimeException();
1305 
1306  SfxRequest aReq(FN_PAGEDOWN, SfxCallMode::SLOT, m_pView->GetPool());
1307  m_pView->Execute(aReq);
1308  const SfxPoolItem* pRet = aReq.GetReturnValue();
1309  bRet = pRet && static_cast<const SfxBoolItem*>(pRet)->GetValue();
1310 
1311  return bRet;
1312 }
1313 
1315 {
1316  SolarMutexGuard aGuard;
1317  bool bRet = false;
1318  if(!m_pView)
1319  throw uno::RuntimeException();
1320 
1321  SfxRequest aReq(FN_PAGEUP, SfxCallMode::SLOT, m_pView->GetPool());
1322  m_pView->Execute(aReq);
1323  const SfxPoolItem* pRet = aReq.GetReturnValue();
1324  bRet = pRet && static_cast<const SfxBoolItem*>(pRet)->GetValue();
1325 
1326  return bRet;
1327 }
1328 
1329 uno::Reference< text::XText > SwXTextViewCursor::getText()
1330 {
1331  SolarMutexGuard aGuard;
1332  uno::Reference< text::XText > xRet;
1333  if(!m_pView)
1334  throw uno::RuntimeException();
1335 
1336  if (!IsTextSelection( false ))
1337  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1338 
1339  SwWrtShell& rSh = m_pView->GetWrtShell();
1340  SwPaM* pShellCursor = rSh.GetCursor();
1341  SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
1342  xRet = ::sw::CreateParentXText(*pDoc, *pShellCursor->Start());
1343 
1344  return xRet;
1345 }
1346 
1347 uno::Reference< text::XTextRange > SwXTextViewCursor::getStart()
1348 {
1349  SolarMutexGuard aGuard;
1350  uno::Reference< text::XTextRange > xRet;
1351  if(!m_pView)
1352  throw uno::RuntimeException();
1353 
1354  if (!IsTextSelection())
1355  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1356 
1357  SwWrtShell& rSh = m_pView->GetWrtShell();
1358  SwPaM* pShellCursor = rSh.GetCursor();
1359  SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
1360  xRet = SwXTextRange::CreateXTextRange(*pDoc, *pShellCursor->Start(), nullptr);
1361 
1362  return xRet;
1363 }
1364 
1365 uno::Reference< text::XTextRange > SwXTextViewCursor::getEnd()
1366 {
1367  SolarMutexGuard aGuard;
1368  uno::Reference< text::XTextRange > xRet;
1369  if(!m_pView)
1370  throw uno::RuntimeException();
1371 
1372  if (!IsTextSelection())
1373  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1374 
1375  SwWrtShell& rSh = m_pView->GetWrtShell();
1376  SwPaM* pShellCursor = rSh.GetCursor();
1377  SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
1378  xRet = SwXTextRange::CreateXTextRange(*pDoc, *pShellCursor->End(), nullptr);
1379 
1380  return xRet;
1381 }
1382 
1384 {
1385  SolarMutexGuard aGuard;
1386  OUString uRet;
1387  if(m_pView)
1388  {
1389  if (!IsTextSelection( false ))
1390  {
1391  SAL_WARN("sw.uno", "no text selection in getString() " << static_cast<cppu::OWeakObject*>(this));
1392  return uRet;
1393  }
1394 
1395  ShellMode eSelMode = m_pView->GetShellMode();
1396  switch(eSelMode)
1397  {
1402 
1403  case ShellMode::ListText :
1405  case ShellMode::Text :
1406  {
1407  SwWrtShell& rSh = m_pView->GetWrtShell();
1408  SwPaM* pShellCursor = rSh.GetCursor();
1409  SwUnoCursorHelper::GetTextFromPam(*pShellCursor, uRet,
1410  rSh.GetLayout());
1411  break;
1412  }
1413  default:;//prevent warning
1414  }
1415  }
1416  return uRet;
1417 }
1418 
1419 void SwXTextViewCursor::setString(const OUString& aString)
1420 {
1421  SolarMutexGuard aGuard;
1422  if(!m_pView)
1423  return;
1424 
1425  if (!IsTextSelection( false ))
1426  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1427 
1428  ShellMode eSelMode = m_pView->GetShellMode();
1429  switch(eSelMode)
1430  {
1435 
1436  case ShellMode::ListText :
1438  case ShellMode::Text :
1439  {
1440  SwWrtShell& rSh = m_pView->GetWrtShell();
1441  SwCursor* pShellCursor = rSh.GetCursor();
1442  SwUnoCursorHelper::SetString(*pShellCursor, aString);
1443  break;
1444  }
1445  default:;//prevent warning
1446  }
1447 }
1448 
1449 uno::Reference< XPropertySetInfo > SwXTextViewCursor::getPropertySetInfo( )
1450 {
1451  static uno::Reference< XPropertySetInfo > xRef = m_pPropSet->getPropertySetInfo();
1452  return xRef;
1453 }
1454 
1455 void SwXTextViewCursor::setPropertyValue( const OUString& rPropertyName, const Any& aValue )
1456 {
1457  SolarMutexGuard aGuard;
1458  if(!m_pView)
1459  throw RuntimeException();
1460 
1461  SwWrtShell& rSh = m_pView->GetWrtShell();
1462  SwPaM* pShellCursor = rSh.GetCursor();
1463  SwNode& rNode = pShellCursor->GetNode();
1464  if (!rNode.IsTextNode())
1465  throw RuntimeException();
1466 
1468  *pShellCursor, *m_pPropSet, rPropertyName, aValue );
1469 
1470 
1471 }
1472 
1473 Any SwXTextViewCursor::getPropertyValue( const OUString& rPropertyName )
1474 {
1475  SolarMutexGuard aGuard;
1476  Any aRet;
1477  if(!m_pView)
1478  throw RuntimeException();
1479 
1480  SwWrtShell& rSh = m_pView->GetWrtShell();
1481  SwPaM* pShellCursor = rSh.GetCursor();
1483  *pShellCursor, *m_pPropSet, rPropertyName);
1484 
1485  return aRet;
1486 }
1487 
1489  const OUString& /*aPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
1490 {
1491 }
1492 
1494  const OUString& /*aPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*aListener*/ )
1495 {
1496 }
1497 
1499  const OUString& /*PropertyName*/, const uno::Reference< XVetoableChangeListener >& /*aListener*/ )
1500 {
1501 }
1502 
1504  const OUString& /*PropertyName*/, const uno::Reference< XVetoableChangeListener >& /*aListener*/ )
1505 {
1506 }
1507 
1508 PropertyState SwXTextViewCursor::getPropertyState( const OUString& rPropertyName )
1509 {
1510  SolarMutexGuard aGuard;
1511  PropertyState eState;
1512  if(!m_pView)
1513  throw RuntimeException();
1514 
1515  SwWrtShell& rSh = m_pView->GetWrtShell();
1516  SwPaM* pShellCursor = rSh.GetCursor();
1518  *pShellCursor, *m_pPropSet, rPropertyName);
1519 
1520  return eState;
1521 }
1522 
1523 Sequence< PropertyState > SwXTextViewCursor::getPropertyStates(
1524  const Sequence< OUString >& rPropertyNames )
1525 {
1526  SolarMutexGuard aGuard;
1527  Sequence< PropertyState > aRet;
1528  if(m_pView)
1529  {
1530  SwWrtShell& rSh = m_pView->GetWrtShell();
1531  SwPaM* pShellCursor = rSh.GetCursor();
1533  *pShellCursor, *m_pPropSet, rPropertyNames);
1534  }
1535  return aRet;
1536 }
1537 
1538 void SwXTextViewCursor::setPropertyToDefault( const OUString& rPropertyName )
1539 {
1540  SolarMutexGuard aGuard;
1541  if(m_pView)
1542  {
1543  SwWrtShell& rSh = m_pView->GetWrtShell();
1544  SwPaM* pShellCursor = rSh.GetCursor();
1546  *pShellCursor, *m_pPropSet, rPropertyName);
1547  }
1548 }
1549 
1550 Any SwXTextViewCursor::getPropertyDefault( const OUString& rPropertyName )
1551 {
1552  Any aRet;
1553  SolarMutexGuard aGuard;
1554  if(m_pView)
1555  {
1556  SwWrtShell& rSh = m_pView->GetWrtShell();
1557  SwPaM* pShellCursor = rSh.GetCursor();
1559  *pShellCursor, *m_pPropSet, rPropertyName);
1560  }
1561  return aRet;
1562 }
1563 
1564 sal_Bool SwXTextViewCursor::goDown(sal_Int16 nCount, sal_Bool bExpand)
1565 {
1566  SolarMutexGuard aGuard;
1567  comphelper::ProfileZone aZone("SwXTextViewCursor::goDown");
1568  bool bRet = false;
1569  if(!m_pView)
1570  throw uno::RuntimeException();
1571 
1572  if (!IsTextSelection())
1573  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1574 
1575  bRet = m_pView->GetWrtShell().Down( bExpand, nCount, true );
1576 
1577  return bRet;
1578 }
1579 
1580 sal_Bool SwXTextViewCursor::goUp(sal_Int16 nCount, sal_Bool bExpand)
1581 {
1582  SolarMutexGuard aGuard;
1583  comphelper::ProfileZone aZone("SwXTextViewCursor::goUp");
1584  bool bRet = false;
1585  if(!m_pView)
1586  throw uno::RuntimeException();
1587 
1588  if (!IsTextSelection())
1589  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1590 
1591  bRet = m_pView->GetWrtShell().Up( bExpand, nCount, true );
1592 
1593  return bRet;
1594 }
1595 
1597 {
1598  SolarMutexGuard aGuard;
1599  bool bRet = false;
1600  if(!m_pView)
1601  throw uno::RuntimeException();
1602 
1603  if (!IsTextSelection( false ))
1604  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1605 
1606  bRet = m_pView->GetWrtShell().IsAtLeftMargin();
1607 
1608  return bRet;
1609 }
1610 
1612 {
1613  SolarMutexGuard aGuard;
1614  bool bRet = false;
1615  if(!m_pView)
1616  throw uno::RuntimeException();
1617 
1618  if (!IsTextSelection( false ))
1619  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1620 
1621  bRet = m_pView->GetWrtShell().IsAtRightMargin();
1622 
1623  return bRet;
1624 }
1625 
1627 {
1628  SolarMutexGuard aGuard;
1629  if(!m_pView)
1630  throw uno::RuntimeException();
1631 
1632  if (!IsTextSelection( false ))
1633  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1634 
1635  m_pView->GetWrtShell().RightMargin(bExpand, true);
1636 
1637 }
1638 
1640 {
1641  SolarMutexGuard aGuard;
1642  if(!m_pView)
1643  throw uno::RuntimeException();
1644 
1645  if (!IsTextSelection( false ))
1646  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1647 
1648  m_pView->GetWrtShell().LeftMargin(bExpand, true);
1649 
1650 }
1651 
1653 {
1654  return "SwXTextViewCursor";
1655 }
1656 
1657 sal_Bool SwXTextViewCursor::supportsService(const OUString& rServiceName)
1658 {
1659  return cppu::supportsService(this, rServiceName);
1660 }
1661 
1663 {
1664  return { "com.sun.star.text.TextViewCursor",
1665  "com.sun.star.style.CharacterProperties",
1666  "com.sun.star.style.CharacterPropertiesAsian",
1667  "com.sun.star.style.CharacterPropertiesComplex",
1668  "com.sun.star.style.ParagraphProperties",
1669  "com.sun.star.style.ParagraphPropertiesAsian",
1670  "com.sun.star.style.ParagraphPropertiesComplex" };
1671 }
1672 
1673 const uno::Sequence< sal_Int8 > & SwXTextViewCursor::getUnoTunnelId()
1674 {
1675  static const comphelper::UnoIdInit theSwXTextViewCursorUnoTunnelId;
1676  return theSwXTextViewCursorUnoTunnelId.getSeq();
1677 }
1678 
1679 //XUnoTunnel
1681  const uno::Sequence< sal_Int8 >& rId )
1682 {
1683  return comphelper::getSomethingImpl(rId, this,
1685 }
1686 
1688 const SwDoc* SwXTextViewCursor::GetDoc() const
1689 {
1690  SwWrtShell& rSh = m_pView->GetWrtShell();
1691  return rSh.GetCursor() ? &rSh.GetCursor()->GetDoc() : nullptr;
1692 }
1693 
1695 {
1696  SwWrtShell& rSh = m_pView->GetWrtShell();
1697  return rSh.GetCursor() ? &rSh.GetCursor()->GetDoc() : nullptr;
1698 }
1699 
1701 {
1702  SwWrtShell& rSh = m_pView->GetWrtShell();
1703  return rSh.GetCursor();
1704 }
1705 
1707 {
1708  SwWrtShell& rSh = m_pView->GetWrtShell();
1709  return rSh.GetCursor();
1710 }
1711 
1712 uno::Reference<datatransfer::XTransferable> SAL_CALL
1713 SwXTextView::getTransferableForTextRange(uno::Reference<text::XTextRange> const& xTextRange)
1714 {
1715  SolarMutexGuard aGuard;
1716 
1717  // the point is we can copy PaM that wouldn't be legal as shell cursor
1719  if (!::sw::XTextRangeToSwPaM(aPam, xTextRange, ::sw::TextRangeMode::AllowNonTextNode))
1720  {
1721  throw uno::RuntimeException("invalid text range");
1722  }
1723 
1724  //force immediate shell update
1725  GetView()->StopShellTimer();
1726  SwWrtShell& rSh = GetView()->GetWrtShell();
1727  rtl::Reference<SwTransferable> pTransfer = new SwTransferable(rSh);
1728  const bool bLockedView = rSh.IsViewLocked();
1729  rSh.LockView( true );
1730  pTransfer->PrepareForCopyTextRange(aPam);
1731  rSh.LockView( bLockedView );
1732  return pTransfer;
1733 }
1734 
1735 uno::Reference< datatransfer::XTransferable > SAL_CALL SwXTextView::getTransferable()
1736 {
1737  SolarMutexGuard aGuard;
1738 
1739  //force immediat shell update
1740  GetView()->StopShellTimer();
1741  SwWrtShell& rSh = GetView()->GetWrtShell();
1742  if ( GetView()->GetShellMode() == ShellMode::DrawText )
1743  {
1744  SdrView *pSdrView = rSh.GetDrawView();
1745  OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
1746  return pOLV->GetEditView().GetTransferable();
1747  }
1748  else
1749  {
1750  rtl::Reference<SwTransferable> pTransfer = new SwTransferable( rSh );
1751  const bool bLockedView = rSh.IsViewLocked();
1752  rSh.LockView( true ); //lock visible section
1753  pTransfer->PrepareForCopy();
1754  rSh.LockView( bLockedView );
1755  return pTransfer;
1756  }
1757 }
1758 
1759 void SAL_CALL SwXTextView::insertTransferable( const uno::Reference< datatransfer::XTransferable >& xTrans )
1760 {
1761  SolarMutexGuard aGuard;
1762 
1763  //force immediat shell update
1764  GetView()->StopShellTimer();
1765  SwWrtShell& rSh = GetView()->GetWrtShell();
1766  if ( GetView()->GetShellMode() == ShellMode::DrawText )
1767  {
1768  SdrView *pSdrView = rSh.GetDrawView();
1769  OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
1770  pOLV->GetEditView().InsertText( xTrans, GetView()->GetDocShell()->GetMedium()->GetBaseURL(), false );
1771  }
1772  else
1773  {
1774  TransferableDataHelper aDataHelper( xTrans );
1775  if ( SwTransferable::IsPaste( rSh, aDataHelper ) )
1776  {
1777  SwTransferable::Paste( rSh, aDataHelper );
1778  if( rSh.IsFrameSelected() || rSh.IsObjSelected() )
1779  rSh.EnterSelFrameMode();
1780  GetView()->AttrChangedNotify(nullptr);
1781  }
1782  }
1783 }
1784 
1785 /* 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:766
#define UNO_NAME_RUBY_POSITION
Definition: unoprnms.hxx:566
void StopShellTimer()
Definition: view.cxx:1814
Starts a section of nodes in the document model.
Definition: node.hxx:313
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:178
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:1314
URL aURL
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:224
sal_uInt16 GetLineCount()
Definition: editsh.cxx:845
bool EndPg(bool bSelect=false)
Definition: move.cxx:350
size_t GetMarkCount() const
Marks a position in the document model.
Definition: pam.hxx:36
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:648
virtual void SAL_CALL collapseToEnd() override
Definition: unotxvw.cxx:957
SdrView * GetDrawView()
Definition: vnew.cxx:373
#define PROPERTY_MAP_TEXT_CURSOR
Definition: unomap.hxx:27
bool IsTextSelection(bool bAllowTables=true) const
Definition: unotxvw.cxx:884
#define UNO_NAME_RUBY_BASE_TEXT
Definition: unoprnms.hxx:561
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unotxvw.cxx:844
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unotxvw.cxx:1455
virtual void SAL_CALL gotoEnd(sal_Bool bExpand) override
Definition: unotxvw.cxx:1172
bool SttEndDoc(bool bStt)
Definition: crsrsh.cxx:575
virtual OUString SAL_CALL getImplementationName() override
Definition: unotxvw.cxx:851
virtual void SAL_CALL setVisible(sal_Bool bVisible) override
Definition: unotxvw.cxx:907
std::string GetValue
virtual SdrObjList * getChildrenOfSdrObject() const
#define UNO_NAME_RUBY_TEXT
Definition: unoprnms.hxx:562
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:1735
css::uno::Reference< css::beans::XPropertySet > mxViewSettings
Definition: unotxvw.hxx:70
ULONG m_refCount
sal_Int32 addInterface(const css::uno::Reference< ListenerT > &rxIFace)
virtual const SwPaM * GetPaM() const override
Definition: unotxvw.cxx:1700
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unotxvw.cxx:1473
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:1373
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:210
sal_Int64 n
bool EndPrvPg(bool bSelect=false)
Definition: move.cxx:338
Definition: doc.hxx:188
const SwShellTableCursor * GetTableCursor() const
Definition: crsrsh.hxx:646
size_t GetObjCount() const
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unotxvw.cxx:837
#define UNO_NAME_RUBY_CHAR_STYLE_NAME
Definition: unoprnms.hxx:564
virtual OUString SAL_CALL getString() override
Definition: unotxvw.cxx:1383
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:1626
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: unotxvw.cxx:1680
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
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:92
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:735
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:1299
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
Definition: unotxvw.cxx:1347
virtual sal_Bool SAL_CALL goUp(sal_Int16 nCount, sal_Bool bExpand) override
Definition: unotxvw.cxx:1580
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:1508
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:1662
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:996
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:979
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:1449
void GetTextFromPam(SwPaM &rPam, OUString &rBuffer, SwRootFrame const *pLayout=nullptr)
Definition: unoobj.cxx:127
SwDoc * GetDoc() const
Definition: viewsh.hxx:282
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unotxvw.cxx:823
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:1449
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:265
virtual sal_Bool SAL_CALL jumpToLastPage() override
Definition: unotxvw.cxx:1205
virtual sal_Bool SAL_CALL jumpToPreviousPage() override
Definition: unotxvw.cxx:1249
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:872
virtual sal_Bool SAL_CALL jumpToFirstPage() override
Definition: unotxvw.cxx:1186
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unotxvw.cxx:776
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:204
virtual void SAL_CALL gotoStart(sal_Bool bExpand) override
Definition: unotxvw.cxx:1158
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
const IDocumentDeviceAccess & getIDocumentDeviceAccess() const
Provides access to the document device interface.
Definition: viewsh.cxx:2781
virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString &aPropertyName) override
Definition: unotxvw.cxx:1550
sal_uInt16 GetPosition() const
Definition: fmtruby.hxx:70
virtual void SAL_CALL collapseToStart() override
Definition: unotxvw.cxx:935
#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:1538
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unotxvw.cxx:1657
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:2674
int i
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:133
const SwPosition * GetPoint() const
Definition: pam.hxx:208
void SetOnlineSpell(bool b)
Definition: viewopt.cxx:339
static const char * GetDBChangeURL()
SelectionType
virtual sal_Bool SAL_CALL isAtStartOfLine() override
Definition: unotxvw.cxx:1596
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unotxvw.cxx:1673
void Exchange()
Definition: pam.cxx:492
#define UNO_NAME_RUBY_IS_ABOVE
Definition: unoprnms.hxx:565
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:206
FrameTypeFlags
values can be combined via logical or
Definition: fesh.hxx:63
sal_Int32 removeInterface(const css::uno::Reference< ListenerT > &rxIFace)
tools::Long GetLeft() const
virtual SwCursor & GetCurrentShellCursor() override
Return the current shell cursor.
Definition: crsrsh.cxx:187
void SetSelection(const SwPaM &rCursor)
Definition: crsrsh.cxx:3546
SwXTextViewCursor(SwView *pVw)
Definition: unotxvw.cxx:866
unsigned char sal_Bool
virtual sal_Bool SAL_CALL isVisible() override
Definition: unotxvw.cxx:901
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:1503
bool IsGroupObject() const
const OutlinerView * GetTextEditOutlinerView() const
virtual sal_Bool SAL_CALL jumpToStartOfPage() override
Definition: unotxvw.cxx:1273
virtual void setJobsetup(const JobSetup &rJobSetup)=0
Sets the Jobsetup.
virtual OUString SAL_CALL getImplementationName() override
Definition: unotxvw.cxx:1652
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:912
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unotxvw.cxx:1498
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:1011
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
void notifyEach(void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event)
const SwPosition * Start() const
Definition: pam.hxx:213
SwDocShell * GetDocShell()
Definition: view.cxx:1135
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unotxvw.cxx:1493
SwFrameFormat * GetTableFormat()
Definition: edws.cxx:183
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:1285
void InsertText(const OUString &rNew, bool bSelect=false, bool bLOKShowSelect=true)
bool SttPg(bool bSelect=false)
Definition: move.cxx:344
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:1713
#define PROPERTY_MAP_TEXT_VIEW
Definition: unomap.hxx:117
virtual void SAL_CALL gotoStartOfLine(sal_Bool bExpand) override
Definition: unotxvw.cxx:1639
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:1225
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:1699
virtual void SAL_CALL setString(const OUString &aString) override
Definition: unotxvw.cxx:1419
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:1261
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unotxvw.cxx:856
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:414
Reference< XDispatch > xDispatch
bool IsAtRightMargin() const
Definition: crsrsh.hxx:747
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:196
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unotxvw.cxx:830
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:1688
static SfxViewFrame * LoadHiddenDocument(SfxObjectShell const &i_rDoc, SfxInterfaceId i_nViewId)
::comphelper::OInterfaceContainerHelper3< css::view::XSelectionChangeListener > m_SelChangedListeners
Definition: unotxvw.hxx:64
SdrPage * GetPage() const
void LockView(bool b)
Definition: viewsh.hxx:467
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:428
vcl::Window * GetWin() const
Definition: viewsh.hxx:338
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:1488
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:721
::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:1759
virtual bool IsDesignMode() const override
#define WID_PAGE_COUNT
Definition: unomap.hxx:285
const SwPosition * End() const
Definition: pam.hxx:218
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:3196
const SwRect & GetCharRect() const
Definition: crsrsh.hxx:517
void Execute(SfxRequest &)
Definition: view2.cxx:537
size_t IsObjSelected() const
Definition: feshview.cxx:1246
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:1564
#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:1365
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:1027
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:861
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
void disposeAndClear(const css::lang::EventObject &rEvt)
#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:244
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:3484
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:3437
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:1611
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:1329
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:1550
virtual void ApplyViewOptions(const SwViewOption &rOpt) override
Apply ViewOptions with Start-/EndAction.
Definition: wrtsh1.cxx:1946
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2174
ShellMode GetShellMode() const
Definition: view0.cxx:107
size_t GetCurPageDesc(const bool bCalcFrame=true) const
Definition: fedesc.cxx:167
bool IsTextNode() const
Definition: node.hxx:640
bool IsAtLeftMargin() const
Definition: crsrsh.hxx:746
FrameTypeFlags GetFrameType(const Point *pPt, bool bStopAtFly) const
For return values see above FrameType.
Definition: fews.cxx:237
bool IsFrameSelected() const
Definition: feshview.cxx:1254
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:1523
#define UNO_NAME_RUBY_ADJUST
Definition: unoprnms.hxx:563
ViewOptFlags1 GetCoreOptions() const
Definition: viewopt.hxx:205
virtual ~SwXTextView() override
Definition: unotxvw.cxx:96
AnyEventRef aEvent
bool IsViewLocked() const
Definition: viewsh.hxx:466
void HideCursor()
Definition: crsrsh.cxx:2417
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:1237
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:742
Base class of the Writer document model elements.
Definition: node.hxx:81