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