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