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