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< uno::XInterface > xInt = SwFmDrawPage::GetInterface( pObj );
420  uno::Reference< drawing::XShape > xShape(xInt, uno::UNO_QUERY);
421  xShCol->add(xShape);
422  }
423  aRef.set(xShCol, uno::UNO_QUERY);
424  }
425  break;
426  default:;//prevent warning
427  }
428  }
430  return aRet;
431 }
432 
434  const uno::Reference< view::XSelectionChangeListener > & rxListener)
435 {
436  SolarMutexGuard aGuard;
438 }
439 
441  const uno::Reference< view::XSelectionChangeListener > & rxListener)
442 {
443  SolarMutexGuard aGuard;
445 }
446 
448  const uno::Reference< awt::XControlModel > & xModel,
449  uno::Reference< awt::XControl >& xToFill )
450 {
451  SwView* pView2 = GetView();
452  FmFormShell* pFormShell = pView2 ? pView2->GetFormShell() : nullptr;
453  SdrView* pDrawView = pView2 ? pView2->GetDrawView() : nullptr;
454  vcl::Window* pWindow = pView2 ? pView2->GetWrtShell().GetWin() : nullptr;
455 
456  OSL_ENSURE( pFormShell && pDrawView && pWindow, "SwXTextView::GetControl: how could I?" );
457 
458  SdrObject* pControl = nullptr;
459  if ( pFormShell && pDrawView && pWindow )
460  pControl = pFormShell->GetFormControl( xModel, *pDrawView, *pWindow, xToFill );
461  return pControl;
462 }
463 
464 uno::Reference< awt::XControl > SwXTextView::getControl(const uno::Reference< awt::XControlModel > & xModel)
465 {
466  SolarMutexGuard aGuard;
467  uno::Reference< awt::XControl > xRet;
468  GetControl(xModel, xRet);
469  return xRet;
470 }
471 
472 uno::Reference< form::runtime::XFormController > SAL_CALL SwXTextView::getFormController( const uno::Reference< form::XForm >& Form )
473 {
474  SolarMutexGuard aGuard;
475 
476  SwView* pView2 = GetView();
477  FmFormShell* pFormShell = pView2 ? pView2->GetFormShell() : nullptr;
478  SdrView* pDrawView = pView2 ? pView2->GetDrawView() : nullptr;
479  vcl::Window* pWindow = pView2 ? pView2->GetWrtShell().GetWin() : nullptr;
480  OSL_ENSURE( pFormShell && pDrawView && pWindow, "SwXTextView::getFormController: how could I?" );
481 
482  uno::Reference< form::runtime::XFormController > xController;
483  if ( pFormShell && pDrawView && pWindow )
484  xController = FmFormShell::GetFormController( Form, *pDrawView, *pWindow );
485  return xController;
486 }
487 
489 {
490  SolarMutexGuard aGuard;
491  SwView* pView2 = GetView();
492  FmFormShell* pFormShell = pView2 ? pView2->GetFormShell() : nullptr;
493  return !pFormShell || pFormShell->IsDesignMode();
494 }
495 
496 void SAL_CALL SwXTextView::setFormDesignMode( sal_Bool DesignMode )
497 {
498  SolarMutexGuard aGuard;
499  SwView* pView2 = GetView();
500  FmFormShell* pFormShell = pView2 ? pView2->GetFormShell() : nullptr;
501  if ( pFormShell )
502  pFormShell->SetDesignMode( DesignMode );
503 }
504 
505 uno::Reference< text::XTextViewCursor > SwXTextView::getViewCursor()
506 {
507  SolarMutexGuard aGuard;
508  comphelper::ProfileZone aZone("getViewCursor");
509  if(!GetView())
510  throw uno::RuntimeException();
511 
512  if(!mxTextViewCursor.is())
513  {
515  }
516  return mxTextViewCursor;
517 }
518 
519 uno::Reference< beans::XPropertySet > SwXTextView::getViewSettings()
520 {
521  SolarMutexGuard aGuard;
522  if(!m_pView)
523  throw uno::RuntimeException();
524 
525  if(!mxViewSettings.is())
526  {
528  }
529 
530  return mxViewSettings;
531 }
532 
533 Sequence< Sequence< PropertyValue > > SwXTextView::getRubyList( sal_Bool /*bAutomatic*/ )
534 {
535  SolarMutexGuard aGuard;
536 
537  if(!GetView())
538  throw RuntimeException();
539  SwWrtShell& rSh = m_pView->GetWrtShell();
540  ShellMode eSelMode = m_pView->GetShellMode();
541  if (eSelMode != ShellMode::ListText &&
542  eSelMode != ShellMode::TableListText &&
543  eSelMode != ShellMode::TableText &&
544  eSelMode != ShellMode::Text )
545  return Sequence< Sequence< PropertyValue > > ();
546 
547  SwRubyList aList;
548 
549  const sal_uInt16 nCount = SwDoc::FillRubyList( *rSh.GetCursor(), aList );
550  Sequence< Sequence< PropertyValue > > aRet(nCount);
551  Sequence< PropertyValue >* pRet = aRet.getArray();
552  OUString aString;
553  for(sal_uInt16 n = 0; n < nCount; n++)
554  {
555  const SwRubyListEntry* pEntry = aList[n].get();
556 
557  const OUString& rEntryText = pEntry->GetText();
558  const SwFormatRuby& rAttr = pEntry->GetRubyAttr();
559 
560  pRet[n].realloc(6);
561  PropertyValue* pValues = pRet[n].getArray();
562  pValues[0].Name = UNO_NAME_RUBY_BASE_TEXT;
563  pValues[0].Value <<= rEntryText;
564  pValues[1].Name = UNO_NAME_RUBY_TEXT;
565  pValues[1].Value <<= rAttr.GetText();
566  pValues[2].Name = UNO_NAME_RUBY_CHAR_STYLE_NAME;
568  pValues[2].Value <<= aString;
569  pValues[3].Name = UNO_NAME_RUBY_ADJUST;
570  pValues[3].Value <<= static_cast<sal_Int16>(rAttr.GetAdjustment());
571  pValues[4].Name = UNO_NAME_RUBY_IS_ABOVE;
572  pValues[4].Value <<= !rAttr.GetPosition();
573  pValues[5].Name = UNO_NAME_RUBY_POSITION;
574  pValues[5].Value <<= rAttr.GetPosition();
575  }
576  return aRet;
577 }
578 
580  const Sequence< Sequence< PropertyValue > >& rRubyList, sal_Bool /*bAutomatic*/ )
581 {
582  SolarMutexGuard aGuard;
583 
584  if(!GetView() || !rRubyList.hasElements())
585  throw RuntimeException();
586  SwWrtShell& rSh = m_pView->GetWrtShell();
587  ShellMode eSelMode = m_pView->GetShellMode();
588  if (eSelMode != ShellMode::ListText &&
589  eSelMode != ShellMode::TableListText &&
590  eSelMode != ShellMode::TableText &&
591  eSelMode != ShellMode::Text )
592  throw RuntimeException();
593 
594  SwRubyList aList;
595 
596  const Sequence<PropertyValue>* pRubyList = rRubyList.getConstArray();
597  for(sal_Int32 nPos = 0; nPos < rRubyList.getLength(); nPos++)
598  {
599  std::unique_ptr<SwRubyListEntry> pEntry(new SwRubyListEntry);
600  const PropertyValue* pProperties = pRubyList[nPos].getConstArray();
601  OUString sTmp;
602  for(sal_Int32 nProp = 0; nProp < pRubyList[nPos].getLength(); nProp++)
603  {
604  if(pProperties[nProp].Name == UNO_NAME_RUBY_BASE_TEXT)
605  {
606  pProperties[nProp].Value >>= sTmp;
607  pEntry->SetText(sTmp);
608  }
609  else if(pProperties[nProp].Name == UNO_NAME_RUBY_TEXT)
610  {
611  pProperties[nProp].Value >>= sTmp;
612  pEntry->GetRubyAttr().SetText(sTmp);
613  }
614  else if(pProperties[nProp].Name == UNO_NAME_RUBY_CHAR_STYLE_NAME)
615  {
616  if(pProperties[nProp].Value >>= sTmp)
617  {
618  OUString sName;
620  const sal_uInt16 nPoolId = sName.isEmpty() ? 0
623 
624  pEntry->GetRubyAttr().SetCharFormatName( sName );
625  pEntry->GetRubyAttr().SetCharFormatId( nPoolId );
626  }
627  }
628  else if(pProperties[nProp].Name == UNO_NAME_RUBY_ADJUST)
629  {
630  sal_Int16 nTmp = 0;
631  if(pProperties[nProp].Value >>= nTmp)
632  pEntry->GetRubyAttr().SetAdjustment(static_cast<css::text::RubyAdjust>(nTmp));
633  }
634  else if(pProperties[nProp].Name == UNO_NAME_RUBY_IS_ABOVE)
635  {
636  bool bValue = !pProperties[nProp].Value.hasValue() ||
637  *o3tl::doAccess<bool>(pProperties[nProp].Value);
638  pEntry->GetRubyAttr().SetPosition(bValue ? 0 : 1);
639  }
640  else if(pProperties[nProp].Name == UNO_NAME_RUBY_POSITION)
641  {
642  sal_Int16 nTmp = 0;
643  if(pProperties[nProp].Value >>= nTmp)
644  pEntry->GetRubyAttr().SetPosition( nTmp );
645  }
646  }
647  aList.insert(aList.begin() + nPos, std::move(pEntry));
648  }
649  SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
650  pDoc->SetRubyList( *rSh.GetCursor(), aList );
651 }
652 
654 {
655  SwWrtShell& rOldSh = m_pView->GetWrtShell();
656  SfxPrinter *pPrt = rOldSh.getIDocumentDeviceAccess().getPrinter( false );
657  SwDocShell* pDocSh;
658  SfxObjectShellLock xDocSh( pDocSh = new SwDocShell( /*pPrtDoc, */SfxObjectCreateMode::STANDARD ) );
659  xDocSh->DoInitNew();
660  SwDoc *const pTempDoc( pDocSh->GetDoc() );
661  // #i103634#, #i112425#: do not expand numbering and fields on PDF export
662  pTempDoc->SetClipBoard(true);
663  rOldSh.FillPrtDoc(pTempDoc, pPrt);
665  SwView* pDocView = static_cast<SwView*>( pDocFrame->GetViewShell() );
666  pDocView->AttrChangedNotify( &pDocView->GetWrtShell() );//So that SelectShell is called.
667  SwWrtShell* pSh = pDocView->GetWrtShellPtr();
668 
670  SfxPrinter* pTempPrinter = rIDDA.getPrinter( true );
671 
672  const SwPageDesc& rCurPageDesc = rOldSh.GetPageDesc(rOldSh.GetCurPageDesc());
673 
674  IDocumentDeviceAccess& rIDDA_old = rOldSh.getIDocumentDeviceAccess();
675 
676  if( rIDDA_old.getPrinter( false ) )
677  {
678  rIDDA.setJobsetup( *rIDDA_old.getJobsetup() );
679  //#69563# if it isn't the same printer then the pointer has been invalidated!
680  pTempPrinter = rIDDA.getPrinter( true );
681  }
682 
683  pTempPrinter->SetPaperBin(rCurPageDesc.GetMaster().GetPaperBin().GetValue());
684 
685  return xDocSh;
686 }
687 
689 {
690  OSL_ENSURE( m_pView, "view is missing" );
691 
692  uno::Reference<uno::XInterface> const xInt(
693  static_cast<cppu::OWeakObject*>(static_cast<SfxBaseController*>(this)));
694 
695  lang::EventObject const aEvent(xInt);
697  &view::XSelectionChangeListener::selectionChanged, aEvent);
698 }
699 
700 namespace {
701  struct DispatchListener
702  {
703  URL const & m_rURL;
704  Sequence<PropertyValue> const& m_rSeq;
705  explicit DispatchListener(URL const& rURL,
706  Sequence<PropertyValue> const& rSeq)
707  : m_rURL(rURL), m_rSeq(rSeq) { }
708  void operator()(uno::Reference<XDispatch> const & xListener) const
709  {
710  xListener->dispatch(m_rURL, m_rSeq);
711  }
712  };
713 }
714 
716 {
717  URL aURL;
718  aURL.Complete = OUString::createFromAscii(SwXDispatch::GetDBChangeURL());
719 
720  m_SelChangedListeners.forEach<XDispatch>(
721  DispatchListener(aURL, Sequence<PropertyValue>(0)));
722 }
723 
724 uno::Reference< beans::XPropertySetInfo > SAL_CALL SwXTextView::getPropertySetInfo( )
725 {
726  SolarMutexGuard aGuard;
727  static uno::Reference< XPropertySetInfo > aRef = m_pPropSet->getPropertySetInfo();
728  return aRef;
729 }
730 
732  const OUString& rPropertyName, const uno::Any& rValue )
733 {
734  SolarMutexGuard aGuard;
735  const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
736  if (!pEntry)
737  throw UnknownPropertyException();
738  else if (pEntry->nFlags & PropertyAttribute::READONLY)
739  throw PropertyVetoException();
740  else
741  {
742  switch (pEntry->nWID)
743  {
745  // deprecated #i91949
746  break;
748  {
749  bool bVal = false;
750  const SwViewOption *pOpt = m_pView->GetWrtShell().GetViewOptions();
751  if (!pOpt || !(rValue >>= bVal))
752  throw RuntimeException();
753  SwViewOption aNewOpt( *pOpt );
754  if (pEntry->nWID == WID_IS_CONSTANT_SPELLCHECK)
755  aNewOpt.SetOnlineSpell(bVal);
756  m_pView->GetWrtShell().ApplyViewOptions( aNewOpt );
757  }
758  break;
759  default :
760  OSL_FAIL("unknown WID");
761  }
762  }
763 }
764 
766  const OUString& rPropertyName )
767 {
768  SolarMutexGuard aGuard;
769 
770  Any aRet;
771 
772  const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
773  if (!pEntry)
774  throw UnknownPropertyException();
775 
776  sal_Int16 nWID = pEntry->nWID;
777  switch (nWID)
778  {
779  case WID_PAGE_COUNT :
780  case WID_LINE_COUNT :
781  {
782  // format document completely in order to get meaningful
783  // values for page count and line count
785 
786  sal_Int32 nCount = -1;
787  if (nWID == WID_PAGE_COUNT)
788  nCount = m_pView->GetWrtShell().GetPageCount();
789  else // WID_LINE_COUNT
790  nCount = m_pView->GetWrtShell().GetLineCount();
791  aRet <<= nCount;
792  }
793  break;
795  // deprecated #i91949
796  break;
798  {
799  const SwViewOption *pOpt = m_pView->GetWrtShell().GetViewOptions();
800  if (!pOpt)
801  throw RuntimeException();
802  aRet <<= bool(pOpt->GetCoreOptions() & ViewOptFlags1::OnlineSpell);
803  }
804  break;
805  default :
806  OSL_FAIL("unknown WID");
807  }
808 
809  return aRet;
810 }
811 
813  const OUString& /*rPropertyName*/,
814  const uno::Reference< beans::XPropertyChangeListener >& /*rxListener*/ )
815 {
816  OSL_FAIL("not implemented");
817 }
818 
820  const OUString& /*rPropertyName*/,
821  const uno::Reference< beans::XPropertyChangeListener >& /*rxListener*/ )
822 {
823  OSL_FAIL("not implemented");
824 }
825 
827  const OUString& /*rPropertyName*/,
828  const uno::Reference< beans::XVetoableChangeListener >& /*rxListener*/ )
829 {
830  OSL_FAIL("not implemented");
831 }
832 
834  const OUString& /*rPropertyName*/,
835  const uno::Reference< beans::XVetoableChangeListener >& /*rxListener*/ )
836 {
837  OSL_FAIL("not implemented");
838 }
839 
841 {
842  return OUString("SwXTextView");
843 }
844 
845 sal_Bool SwXTextView::supportsService(const OUString& rServiceName)
846 {
847  return cppu::supportsService(this, rServiceName);
848 }
849 
851 {
852  Sequence< OUString > aRet(2);
853  OUString* pArray = aRet.getArray();
854  pArray[0] = "com.sun.star.text.TextDocumentView";
855  pArray[1] = "com.sun.star.view.OfficeDocumentView";
856  return aRet;
857 }
858 
860  m_pView(pVw),
861  m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR))
862 {
863 }
864 
866 {
867 }
868 
869 // used to determine if there is a text selection or not.
870 // If there is no text selection the functions that need a working
871 // cursor will be disabled (throw RuntimeException). This will be the case
872 // for the following interfaces:
873 // - XViewCursor
874 // - XTextCursor
875 // - XTextRange
876 // - XLineCursor
877 bool SwXTextViewCursor::IsTextSelection( bool bAllowTables ) const
878 {
879 
880  bool bRes = false;
881  OSL_ENSURE(m_pView, "m_pView is NULL ???");
882  if(m_pView)
883  {
887  bRes = ( (SelectionType::Text & eSelType) ||
888  (SelectionType::NumberList & eSelType) ) &&
889  (!(SelectionType::TableCell & eSelType) || bAllowTables);
890  }
891  return bRes;
892 }
893 
895 {
896  OSL_FAIL("not implemented");
897  return true;
898 }
899 
901 {
902  OSL_FAIL("not implemented");
903 }
904 
906 {
907  SolarMutexGuard aGuard;
908  awt::Point aRet;
909  if(!m_pView)
910  throw uno::RuntimeException();
911 
912  const SwWrtShell& rSh = m_pView->GetWrtShell();
913  const SwRect& aCharRect(rSh.GetCharRect());
914 
915  const SwFrameFormat& rMaster = rSh.GetPageDesc( rSh.GetCurPageDesc() ).GetMaster();
916 
917  const SvxULSpaceItem& rUL = rMaster.GetULSpace();
918  const long nY = aCharRect.Top() - (rUL.GetUpper() + DOCUMENTBORDER);
919  aRet.Y = convertTwipToMm100(nY);
920 
921  const SvxLRSpaceItem& rLR = rMaster.GetLRSpace();
922  const long nX = aCharRect.Left() - (rLR.GetLeft() + DOCUMENTBORDER);
923  aRet.X = convertTwipToMm100(nX);
924 
925  return aRet;
926 }
927 
929 {
930  SolarMutexGuard aGuard;
931  if(!m_pView)
932  throw uno::RuntimeException();
933 
934  if (!IsTextSelection())
935  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
936 
937  SwWrtShell& rSh = m_pView->GetWrtShell();
938  if(rSh.HasSelection())
939  {
940  SwPaM* pShellCursor = rSh.GetCursor();
941  if(*pShellCursor->GetPoint() > *pShellCursor->GetMark())
942  pShellCursor->Exchange();
943  pShellCursor->DeleteMark();
944  rSh.EnterStdMode();
945  rSh.SetSelection(*pShellCursor);
946  }
947 
948 }
949 
951 {
952  SolarMutexGuard aGuard;
953  if(!m_pView)
954  throw uno::RuntimeException();
955 
956  if (!IsTextSelection())
957  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
958 
959  SwWrtShell& rSh = m_pView->GetWrtShell();
960  if(rSh.HasSelection())
961  {
962  SwPaM* pShellCursor = rSh.GetCursor();
963  if(*pShellCursor->GetPoint() < *pShellCursor->GetMark())
964  pShellCursor->Exchange();
965  pShellCursor->DeleteMark();
966  rSh.EnterStdMode();
967  rSh.SetSelection(*pShellCursor);
968  }
969 
970 }
971 
973 {
974  SolarMutexGuard aGuard;
975  bool bRet = false;
976  if(!m_pView)
977  throw uno::RuntimeException();
978 
979  if (!IsTextSelection())
980  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
981 
982  const SwWrtShell& rSh = m_pView->GetWrtShell();
983  bRet = !rSh.HasSelection();
984 
985  return bRet;
986 
987 }
988 
989 sal_Bool SwXTextViewCursor::goLeft(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().Left( CRSR_SKIP_CHARS, bExpand, nCount, true );
1000 
1001  return bRet;
1002 }
1003 
1005 {
1006  SolarMutexGuard aGuard;
1007  bool bRet = false;
1008  if(!m_pView)
1009  throw uno::RuntimeException();
1010 
1011  if (!IsTextSelection())
1012  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1013 
1014  bRet = m_pView->GetWrtShell().Right( CRSR_SKIP_CHARS, bExpand, nCount, true );
1015 
1016  return bRet;
1017 
1018 }
1019 
1021  const uno::Reference< text::XTextRange > & xRange,
1022  sal_Bool bExpand)
1023 {
1024  SolarMutexGuard aGuard;
1025  if(!(m_pView && xRange.is()))
1026  throw uno::RuntimeException();
1027 
1028  if (!IsTextSelection())
1029  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1030 
1031  SwUnoInternalPaM rDestPam(*m_pView->GetDocShell()->GetDoc());
1032  if (!::sw::XTextRangeToSwPaM(rDestPam, xRange))
1033  {
1034  throw uno::RuntimeException();
1035  }
1036 
1037  ShellMode eSelMode = m_pView->GetShellMode();
1038  SwWrtShell& rSh = m_pView->GetWrtShell();
1039  // call EnterStdMode in non-text selections only
1040  if(!bExpand ||
1041  (eSelMode != ShellMode::TableText &&
1042  eSelMode != ShellMode::ListText &&
1043  eSelMode != ShellMode::TableListText &&
1044  eSelMode != ShellMode::Text ))
1045  rSh.EnterStdMode();
1046  SwPaM* pShellCursor = rSh.GetCursor();
1047  SwPaM aOwnPaM(*pShellCursor->GetPoint());
1048  if(pShellCursor->HasMark())
1049  {
1050  aOwnPaM.SetMark();
1051  *aOwnPaM.GetMark() = *pShellCursor->GetMark();
1052  }
1053 
1054  uno::Reference<lang::XUnoTunnel> xRangeTunnel( xRange, uno::UNO_QUERY);
1055  SwXTextRange* pRange = nullptr;
1056  SwXParagraph* pPara = nullptr;
1057  OTextCursorHelper* pCursor = nullptr;
1058  if(xRangeTunnel.is())
1059  {
1060  pRange = reinterpret_cast<SwXTextRange*>(xRangeTunnel->getSomething(
1062  pCursor = reinterpret_cast<OTextCursorHelper*>(xRangeTunnel->getSomething(
1064  pPara = reinterpret_cast<SwXParagraph*>(xRangeTunnel->getSomething(
1066  }
1067 
1068  const FrameTypeFlags nFrameType = rSh.GetFrameType(nullptr,true);
1069 
1070  SwStartNodeType eSearchNodeType = SwNormalStartNode;
1071  if(nFrameType & FrameTypeFlags::FLY_ANY)
1072  eSearchNodeType = SwFlyStartNode;
1073  else if(nFrameType &FrameTypeFlags::HEADER)
1074  eSearchNodeType = SwHeaderStartNode;
1075  else if(nFrameType & FrameTypeFlags::FOOTER)
1076  eSearchNodeType = SwFooterStartNode;
1077  else if(nFrameType & FrameTypeFlags::TABLE)
1078  eSearchNodeType = SwTableBoxStartNode;
1079  else if(nFrameType & FrameTypeFlags::FOOTNOTE)
1080  eSearchNodeType = SwFootnoteStartNode;
1081 
1082  const SwStartNode* pOwnStartNode = aOwnPaM.GetNode().
1083  FindSttNodeByType(eSearchNodeType);
1084 
1085  const SwNode* pSrcNode = nullptr;
1086  if(pCursor && pCursor->GetPaM())
1087  {
1088  pSrcNode = &pCursor->GetPaM()->GetNode();
1089  }
1090  else if (pRange)
1091  {
1092  SwPaM aPam(pRange->GetDoc().GetNodes());
1093  if (pRange->GetPositions(aPam))
1094  {
1095  pSrcNode = &aPam.GetNode();
1096  }
1097  }
1098  else if (pPara && pPara->GetTextNode())
1099  {
1100  pSrcNode = pPara->GetTextNode();
1101  }
1102  const SwStartNode* pTmp = pSrcNode ? pSrcNode->FindSttNodeByType(eSearchNodeType) : nullptr;
1103 
1104  //Skip SectionNodes
1105  while(pTmp && pTmp->IsSectionNode())
1106  {
1107  pTmp = pTmp->StartOfSectionNode();
1108  }
1109  while(pOwnStartNode && pOwnStartNode->IsSectionNode())
1110  {
1111  pOwnStartNode = pOwnStartNode->StartOfSectionNode();
1112  }
1113  //Without Expand it is allowed to jump out with the ViewCursor everywhere,
1114  //with Expand only in the same environment
1115  if(bExpand &&
1116  (pOwnStartNode != pTmp ||
1117  (eSelMode != ShellMode::TableText &&
1118  eSelMode != ShellMode::ListText &&
1119  eSelMode != ShellMode::TableListText &&
1120  eSelMode != ShellMode::Text)))
1121  throw uno::RuntimeException();
1122 
1123  //Now, the selection must be expanded.
1124  if(bExpand)
1125  {
1126  // The cursor should include everything that has been included
1127  // by him and the transferred Range.
1128  SwPosition aOwnLeft(*aOwnPaM.Start());
1129  SwPosition aOwnRight(*aOwnPaM.End());
1130  SwPosition* pParamLeft = rDestPam.Start();
1131  SwPosition* pParamRight = rDestPam.End();
1132  // Now four SwPositions are there, two of them are needed, but which?
1133  if(aOwnRight > *pParamRight)
1134  *aOwnPaM.GetPoint() = aOwnRight;
1135  else
1136  *aOwnPaM.GetPoint() = *pParamRight;
1137  aOwnPaM.SetMark();
1138  if(aOwnLeft < *pParamLeft)
1139  *aOwnPaM.GetMark() = aOwnLeft;
1140  else
1141  *aOwnPaM.GetMark() = *pParamLeft;
1142  }
1143  else
1144  {
1145  //The cursor shall match the passed range.
1146  *aOwnPaM.GetPoint() = *rDestPam.GetPoint();
1147  if(rDestPam.HasMark())
1148  {
1149  aOwnPaM.SetMark();
1150  *aOwnPaM.GetMark() = *rDestPam.GetMark();
1151  }
1152  else
1153  aOwnPaM.DeleteMark();
1154  }
1155  rSh.SetSelection(aOwnPaM);
1156 
1157 
1158 }
1159 
1161 {
1162  SolarMutexGuard aGuard;
1163  comphelper::ProfileZone aZone("SwXTextViewCursor::gotoStart");
1164  if(!m_pView)
1165  throw uno::RuntimeException();
1166 
1167  if (!IsTextSelection())
1168  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1169 
1170  m_pView->GetWrtShell().StartOfSection( bExpand );
1171 
1172 }
1173 
1175 {
1176  SolarMutexGuard aGuard;
1177  comphelper::ProfileZone aZone("SwXTextViewCursor::gotoEnd");
1178  if(!m_pView)
1179  throw uno::RuntimeException();
1180 
1181  if (!IsTextSelection())
1182  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1183 
1184  m_pView->GetWrtShell().EndOfSection( bExpand );
1185 
1186 }
1187 
1189 {
1190  SolarMutexGuard aGuard;
1191  bool bRet = false;
1192  if(!m_pView)
1193  throw uno::RuntimeException();
1194 
1195  SwWrtShell& rSh = m_pView->GetWrtShell();
1196  if (rSh.IsSelFrameMode())
1197  {
1198  rSh.UnSelectFrame();
1199  rSh.LeaveSelFrameMode();
1200  }
1201  rSh.EnterStdMode();
1202  bRet = rSh.SttEndDoc(true);
1203 
1204  return bRet;
1205 }
1206 
1208 {
1209  SolarMutexGuard aGuard;
1210  bool bRet = false;
1211  if(!m_pView)
1212  throw uno::RuntimeException();
1213 
1214  SwWrtShell& rSh = m_pView->GetWrtShell();
1215  if (rSh.IsSelFrameMode())
1216  {
1217  rSh.UnSelectFrame();
1218  rSh.LeaveSelFrameMode();
1219  }
1220  rSh.EnterStdMode();
1221  bRet = rSh.SttEndDoc(false);
1222  rSh.SttPg();
1223 
1224  return bRet;
1225 }
1226 
1228 {
1229  SolarMutexGuard aGuard;
1230  bool bRet = false;
1231  if(!m_pView)
1232  throw uno::RuntimeException();
1233 
1234  bRet = m_pView->GetWrtShell().GotoPage(nPage, true);
1235 
1236  return bRet;
1237 }
1238 
1240 {
1241  SolarMutexGuard aGuard;
1242  bool bRet = false;
1243  if(!m_pView)
1244  throw uno::RuntimeException();
1245 
1246  bRet = m_pView->GetWrtShell().SttNxtPg();
1247 
1248  return bRet;
1249 }
1250 
1252 {
1253  SolarMutexGuard aGuard;
1254  bool bRet = false;
1255  if(!m_pView)
1256  throw uno::RuntimeException();
1257 
1258  bRet = m_pView->GetWrtShell().EndPrvPg();
1259 
1260  return bRet;
1261 }
1262 
1264 {
1265  SolarMutexGuard aGuard;
1266  bool bRet = false;
1267  if(!m_pView)
1268  throw uno::RuntimeException();
1269 
1270  bRet = m_pView->GetWrtShell().EndPg();
1271 
1272  return bRet;
1273 }
1274 
1276 {
1277  SolarMutexGuard aGuard;
1278  bool bRet = false;
1279  if(!m_pView)
1280  throw uno::RuntimeException();
1281 
1282  bRet = m_pView->GetWrtShell().SttPg();
1283 
1284  return bRet;
1285 }
1286 
1288 {
1289  SolarMutexGuard aGuard;
1290  sal_Int16 nRet = 0;
1291  if(!m_pView)
1292  throw uno::RuntimeException();
1293 
1294  SwWrtShell& rSh = m_pView->GetWrtShell();
1295  SwPaM* pShellCursor = rSh.GetCursor();
1296  nRet = static_cast<sal_Int16>(pShellCursor->GetPageNum());
1297 
1298  return nRet;
1299 }
1300 
1302 {
1303  SolarMutexGuard aGuard;
1304  bool bRet = false;
1305  if(!m_pView)
1306  throw uno::RuntimeException();
1307 
1308  SfxRequest aReq(FN_PAGEDOWN, 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 
1317 {
1318  SolarMutexGuard aGuard;
1319  bool bRet = false;
1320  if(!m_pView)
1321  throw uno::RuntimeException();
1322 
1323  SfxRequest aReq(FN_PAGEUP, SfxCallMode::SLOT, m_pView->GetPool());
1324  m_pView->Execute(aReq);
1325  const SfxPoolItem* pRet = aReq.GetReturnValue();
1326  bRet = pRet && static_cast<const SfxBoolItem*>(pRet)->GetValue();
1327 
1328  return bRet;
1329 }
1330 
1331 uno::Reference< text::XText > SwXTextViewCursor::getText()
1332 {
1333  SolarMutexGuard aGuard;
1334  uno::Reference< text::XText > xRet;
1335  if(!m_pView)
1336  throw uno::RuntimeException();
1337 
1338  if (!IsTextSelection( false ))
1339  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1340 
1341  SwWrtShell& rSh = m_pView->GetWrtShell();
1342  SwPaM* pShellCursor = rSh.GetCursor();
1343  SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
1344  xRet = ::sw::CreateParentXText(*pDoc, *pShellCursor->Start());
1345 
1346  return xRet;
1347 }
1348 
1349 uno::Reference< text::XTextRange > SwXTextViewCursor::getStart()
1350 {
1351  SolarMutexGuard aGuard;
1352  uno::Reference< text::XTextRange > xRet;
1353  if(!m_pView)
1354  throw uno::RuntimeException();
1355 
1356  if (!IsTextSelection())
1357  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1358 
1359  SwWrtShell& rSh = m_pView->GetWrtShell();
1360  SwPaM* pShellCursor = rSh.GetCursor();
1361  SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
1362  xRet = SwXTextRange::CreateXTextRange(*pDoc, *pShellCursor->Start(), nullptr);
1363 
1364  return xRet;
1365 }
1366 
1367 uno::Reference< text::XTextRange > SwXTextViewCursor::getEnd()
1368 {
1369  SolarMutexGuard aGuard;
1370  uno::Reference< text::XTextRange > xRet;
1371  if(!m_pView)
1372  throw uno::RuntimeException();
1373 
1374  if (!IsTextSelection())
1375  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1376 
1377  SwWrtShell& rSh = m_pView->GetWrtShell();
1378  SwPaM* pShellCursor = rSh.GetCursor();
1379  SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
1380  xRet = SwXTextRange::CreateXTextRange(*pDoc, *pShellCursor->End(), nullptr);
1381 
1382  return xRet;
1383 }
1384 
1386 {
1387  SolarMutexGuard aGuard;
1388  OUString uRet;
1389  if(m_pView)
1390  {
1391  if (!IsTextSelection( false ))
1392  {
1393  SAL_WARN("sw.uno", "no text selection in getString() " << static_cast<cppu::OWeakObject*>(this));
1394  return uRet;
1395  }
1396 
1397  ShellMode eSelMode = m_pView->GetShellMode();
1398  switch(eSelMode)
1399  {
1404 
1405  case ShellMode::ListText :
1407  case ShellMode::Text :
1408  {
1409  SwWrtShell& rSh = m_pView->GetWrtShell();
1410  SwPaM* pShellCursor = rSh.GetCursor();
1411  SwUnoCursorHelper::GetTextFromPam(*pShellCursor, uRet,
1412  rSh.GetLayout());
1413  break;
1414  }
1415  default:;//prevent warning
1416  }
1417  }
1418  return uRet;
1419 }
1420 
1421 void SwXTextViewCursor::setString(const OUString& aString)
1422 {
1423  SolarMutexGuard aGuard;
1424  if(m_pView)
1425  {
1426  if (!IsTextSelection( false ))
1427  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1428 
1429  ShellMode eSelMode = m_pView->GetShellMode();
1430  switch(eSelMode)
1431  {
1436 
1437  case ShellMode::ListText :
1439  case ShellMode::Text :
1440  {
1441  SwWrtShell& rSh = m_pView->GetWrtShell();
1442  SwCursor* pShellCursor = rSh.GetSwCursor();
1443  SwUnoCursorHelper::SetString(*pShellCursor, aString);
1444  break;
1445  }
1446  default:;//prevent warning
1447  }
1448  }
1449 }
1450 
1451 uno::Reference< XPropertySetInfo > SwXTextViewCursor::getPropertySetInfo( )
1452 {
1453  static uno::Reference< XPropertySetInfo > xRef = m_pPropSet->getPropertySetInfo();
1454  return xRef;
1455 }
1456 
1457 void SwXTextViewCursor::setPropertyValue( const OUString& rPropertyName, const Any& aValue )
1458 {
1459  SolarMutexGuard aGuard;
1460  if(!m_pView)
1461  throw RuntimeException();
1462 
1463  SwWrtShell& rSh = m_pView->GetWrtShell();
1464  SwPaM* pShellCursor = rSh.GetCursor();
1465  SwNode& rNode = pShellCursor->GetNode();
1466  if (!rNode.IsTextNode())
1467  throw RuntimeException();
1468 
1470  *pShellCursor, *m_pPropSet, rPropertyName, aValue );
1471 
1472 
1473 }
1474 
1475 Any SwXTextViewCursor::getPropertyValue( const OUString& rPropertyName )
1476 {
1477  SolarMutexGuard aGuard;
1478  Any aRet;
1479  if(!m_pView)
1480  throw RuntimeException();
1481 
1482  SwWrtShell& rSh = m_pView->GetWrtShell();
1483  SwPaM* pShellCursor = rSh.GetCursor();
1485  *pShellCursor, *m_pPropSet, rPropertyName);
1486 
1487  return aRet;
1488 }
1489 
1491  const OUString& /*aPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
1492 {
1493 }
1494 
1496  const OUString& /*aPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*aListener*/ )
1497 {
1498 }
1499 
1501  const OUString& /*PropertyName*/, const uno::Reference< XVetoableChangeListener >& /*aListener*/ )
1502 {
1503 }
1504 
1506  const OUString& /*PropertyName*/, const uno::Reference< XVetoableChangeListener >& /*aListener*/ )
1507 {
1508 }
1509 
1510 PropertyState SwXTextViewCursor::getPropertyState( const OUString& rPropertyName )
1511 {
1512  SolarMutexGuard aGuard;
1513  PropertyState eState;
1514  if(!m_pView)
1515  throw RuntimeException();
1516 
1517  SwWrtShell& rSh = m_pView->GetWrtShell();
1518  SwPaM* pShellCursor = rSh.GetCursor();
1520  *pShellCursor, *m_pPropSet, rPropertyName);
1521 
1522  return eState;
1523 }
1524 
1525 Sequence< PropertyState > SwXTextViewCursor::getPropertyStates(
1526  const Sequence< OUString >& rPropertyNames )
1527 {
1528  SolarMutexGuard aGuard;
1529  Sequence< PropertyState > aRet;
1530  if(m_pView)
1531  {
1532  SwWrtShell& rSh = m_pView->GetWrtShell();
1533  SwPaM* pShellCursor = rSh.GetCursor();
1535  *pShellCursor, *m_pPropSet, rPropertyNames);
1536  }
1537  return aRet;
1538 }
1539 
1540 void SwXTextViewCursor::setPropertyToDefault( const OUString& rPropertyName )
1541 {
1542  SolarMutexGuard aGuard;
1543  if(m_pView)
1544  {
1545  SwWrtShell& rSh = m_pView->GetWrtShell();
1546  SwPaM* pShellCursor = rSh.GetCursor();
1548  *pShellCursor, *m_pPropSet, rPropertyName);
1549  }
1550 }
1551 
1552 Any SwXTextViewCursor::getPropertyDefault( const OUString& rPropertyName )
1553 {
1554  Any aRet;
1555  SolarMutexGuard aGuard;
1556  if(m_pView)
1557  {
1558  SwWrtShell& rSh = m_pView->GetWrtShell();
1559  SwPaM* pShellCursor = rSh.GetCursor();
1561  *pShellCursor, *m_pPropSet, rPropertyName);
1562  }
1563  return aRet;
1564 }
1565 
1566 sal_Bool SwXTextViewCursor::goDown(sal_Int16 nCount, sal_Bool bExpand)
1567 {
1568  SolarMutexGuard aGuard;
1569  comphelper::ProfileZone aZone("SwXTextViewCursor::goDown");
1570  bool bRet = false;
1571  if(!m_pView)
1572  throw uno::RuntimeException();
1573 
1574  if (!IsTextSelection())
1575  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1576 
1577  bRet = m_pView->GetWrtShell().Down( bExpand, nCount, true );
1578 
1579  return bRet;
1580 }
1581 
1582 sal_Bool SwXTextViewCursor::goUp(sal_Int16 nCount, sal_Bool bExpand)
1583 {
1584  SolarMutexGuard aGuard;
1585  comphelper::ProfileZone aZone("SwXTextViewCursor::goUp");
1586  bool bRet = false;
1587  if(!m_pView)
1588  throw uno::RuntimeException();
1589 
1590  if (!IsTextSelection())
1591  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1592 
1593  bRet = m_pView->GetWrtShell().Up( bExpand, nCount, true );
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().IsAtLeftMargin();
1609 
1610  return bRet;
1611 }
1612 
1614 {
1615  SolarMutexGuard aGuard;
1616  bool bRet = false;
1617  if(!m_pView)
1618  throw uno::RuntimeException();
1619 
1620  if (!IsTextSelection( false ))
1621  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1622 
1623  bRet = m_pView->GetWrtShell().IsAtRightMargin();
1624 
1625  return bRet;
1626 }
1627 
1629 {
1630  SolarMutexGuard aGuard;
1631  if(!m_pView)
1632  throw uno::RuntimeException();
1633 
1634  if (!IsTextSelection( false ))
1635  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1636 
1637  m_pView->GetWrtShell().RightMargin(bExpand, true);
1638 
1639 }
1640 
1642 {
1643  SolarMutexGuard aGuard;
1644  if(!m_pView)
1645  throw uno::RuntimeException();
1646 
1647  if (!IsTextSelection( false ))
1648  throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
1649 
1650  m_pView->GetWrtShell().LeftMargin(bExpand, true);
1651 
1652 }
1653 
1655 {
1656  return OUString("SwXTextViewCursor");
1657 }
1658 
1659 sal_Bool SwXTextViewCursor::supportsService(const OUString& rServiceName)
1660 {
1661  return cppu::supportsService(this, rServiceName);
1662 }
1663 
1665 {
1666  Sequence< OUString > aRet(7);
1667  OUString* pArray = aRet.getArray();
1668  pArray[0] = "com.sun.star.text.TextViewCursor";
1669  pArray[1] = "com.sun.star.style.CharacterProperties";
1670  pArray[2] = "com.sun.star.style.CharacterPropertiesAsian";
1671  pArray[3] = "com.sun.star.style.CharacterPropertiesComplex";
1672  pArray[4] = "com.sun.star.style.ParagraphProperties";
1673  pArray[5] = "com.sun.star.style.ParagraphPropertiesAsian";
1674  pArray[6] = "com.sun.star.style.ParagraphPropertiesComplex";
1675  return aRet;
1676 }
1677 
1678 namespace
1679 {
1680  class theSwXTextViewCursorUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXTextViewCursorUnoTunnelId > {};
1681 }
1682 
1683 const uno::Sequence< sal_Int8 > & SwXTextViewCursor::getUnoTunnelId()
1684 {
1685  return theSwXTextViewCursorUnoTunnelId::get().getSeq();
1686 }
1687 
1688 //XUnoTunnel
1690  const uno::Sequence< sal_Int8 >& rId )
1691 {
1692  if( rId.getLength() == 16
1693  && 0 == memcmp( getUnoTunnelId().getConstArray(),
1694  rId.getConstArray(), 16 ) )
1695  {
1696  return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ));
1697  }
1698  return OTextCursorHelper::getSomething(rId);
1699 }
1700 
1702 const SwDoc* SwXTextViewCursor::GetDoc() const
1703 {
1704  SwWrtShell& rSh = m_pView->GetWrtShell();
1705  return rSh.GetCursor() ? rSh.GetCursor()->GetDoc() : nullptr;
1706 }
1707 
1709 {
1710  SwWrtShell& rSh = m_pView->GetWrtShell();
1711  return rSh.GetCursor() ? rSh.GetCursor()->GetDoc() : nullptr;
1712 }
1713 
1715 {
1716  SwWrtShell& rSh = m_pView->GetWrtShell();
1717  return rSh.GetCursor();
1718 }
1719 
1721 {
1722  SwWrtShell& rSh = m_pView->GetWrtShell();
1723  return rSh.GetCursor();
1724 }
1725 
1726 uno::Reference< datatransfer::XTransferable > SAL_CALL SwXTextView::getTransferable()
1727 {
1728  SolarMutexGuard aGuard;
1729 
1730  //force immediat shell update
1731  GetView()->StopShellTimer();
1732  SwWrtShell& rSh = GetView()->GetWrtShell();
1733  if ( GetView()->GetShellMode() == ShellMode::DrawText )
1734  {
1735  SdrView *pSdrView = rSh.GetDrawView();
1736  OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
1737  return pOLV->GetEditView().GetTransferable();
1738  }
1739  else
1740  {
1741  SwTransferable* pTransfer = new SwTransferable( rSh );
1742  const bool bLockedView = rSh.IsViewLocked();
1743  rSh.LockView( true ); //lock visible section
1744  pTransfer->PrepareForCopy();
1745  rSh.LockView( bLockedView );
1746  return uno::Reference< datatransfer::XTransferable >( pTransfer );
1747  }
1748 }
1749 
1750 void SAL_CALL SwXTextView::insertTransferable( const uno::Reference< datatransfer::XTransferable >& xTrans )
1751 {
1752  SolarMutexGuard aGuard;
1753 
1754  //force immediat shell update
1755  GetView()->StopShellTimer();
1756  SwWrtShell& rSh = GetView()->GetWrtShell();
1757  if ( GetView()->GetShellMode() == ShellMode::DrawText )
1758  {
1759  SdrView *pSdrView = rSh.GetDrawView();
1760  OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
1761  pOLV->GetEditView().InsertText( xTrans, GetView()->GetDocShell()->GetMedium()->GetBaseURL(), false );
1762  }
1763  else
1764  {
1765  TransferableDataHelper aDataHelper( xTrans );
1766  if ( SwTransferable::IsPaste( rSh, aDataHelper ) )
1767  {
1768  SwTransferable::Paste( rSh, aDataHelper );
1769  if( rSh.IsFrameSelected() || rSh.IsObjSelected() )
1770  rSh.EnterSelFrameMode();
1771  GetView()->AttrChangedNotify( &rSh );
1772  }
1773  }
1774 }
1775 
1776 /* 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:571
void StopShellTimer()
Definition: view.cxx:1759
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:1316
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:950
SdrView * GetDrawView()
Definition: vnew.cxx:376
SwPaM * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:185
#define PROPERTY_MAP_TEXT_CURSOR
Definition: unomap.hxx:29
bool IsTextSelection(bool bAllowTables=true) const
Definition: unotxvw.cxx:877
#define UNO_NAME_RUBY_BASE_TEXT
Definition: unoprnms.hxx:566
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unotxvw.cxx:833
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unotxvw.cxx:1457
virtual void SAL_CALL gotoEnd(sal_Bool bExpand) override
Definition: unotxvw.cxx:1174
bool SttEndDoc(bool bStt)
Definition: crsrsh.cxx:563
virtual OUString SAL_CALL getImplementationName() override
Definition: unotxvw.cxx:840
void notifyEach(void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event)
static SwXTextRanges * Create(SwPaM *const pCursor)
Definition: unoobj2.cxx:1527
virtual void SAL_CALL setVisible(sal_Bool bVisible) override
Definition: unotxvw.cxx:900
std::string GetValue
virtual SdrObjList * getChildrenOfSdrObject() const
#define UNO_NAME_RUBY_TEXT
Definition: unoprnms.hxx:567
static void FillUIName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
virtual css::uno::Reference< css::datatransfer::XTransferable > SAL_CALL getTransferable() override
Definition: unotxvw.cxx:1726
css::uno::Reference< css::beans::XPropertySet > mxViewSettings
Definition: unotxvw.hxx:67
virtual const SwPaM * GetPaM() const override
Definition: unotxvw.cxx:1714
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unotxvw.cxx:1475
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getViewSettings() override
Definition: unotxvw.cxx:519
int PrepareForCopy(bool bIsCut=false)
Definition: swdtflvr.cxx:808
bool SttNxtPg(bool bSelect=false)
Definition: move.cxx:312
static bool IsPaste(const SwWrtShell &, const TransferableDataHelper &)
Definition: swdtflvr.cxx:1211
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:864
bool EndPrvPg(bool bSelect=false)
Definition: move.cxx:330
Definition: doc.hxx:185
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:826
#define UNO_NAME_RUBY_CHAR_STYLE_NAME
Definition: unoprnms.hxx:569
virtual OUString SAL_CALL getString() override
Definition: unotxvw.cxx:1385
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:1628
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: unotxvw.cxx:1689
OUString Name
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:956
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:579
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:488
void SetString(SwCursor &rCursor, const OUString &rString)
Definition: unoobj2.cxx:1566
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unotxvw.cxx:724
Used by the UI to modify the document model.
Definition: wrtsh.hxx:86
Value
virtual sal_Bool SAL_CALL screenDown() override
Definition: unotxvw.cxx:1301
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
Definition: unotxvw.cxx:1349
virtual sal_Bool SAL_CALL goUp(sal_Int16 nCount, sal_Bool bExpand) override
Definition: unotxvw.cxx:1582
virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString &PropertyName) override
Definition: unotxvw.cxx:1510
const SwDoc & GetDoc() const
Definition: unoobj2.cxx:806
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:1664
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:989
virtual sal_Bool SAL_CALL isCollapsed() override
Definition: unotxvw.cxx:972
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:812
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:1451
css::uno::Any GetPropertyDefault(SwPaM const &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName)
Definition: unoobj.cxx:2048
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:1031
SwPaM * GetNext()
Definition: pam.hxx:264
virtual sal_Bool SAL_CALL jumpToLastPage() override
Definition: unotxvw.cxx:1207
virtual sal_Bool SAL_CALL jumpToPreviousPage() override
Definition: unotxvw.cxx:1251
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:865
virtual sal_Bool SAL_CALL jumpToFirstPage() override
Definition: unotxvw.cxx:1188
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unotxvw.cxx:765
SdrObject * GetMarkedSdrObj() const
virtual void SAL_CALL addSelectionChangeListener(const css::uno::Reference< css::view::XSelectionChangeListener > &xListener) override
Definition: unotxvw.cxx:433
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:202
virtual void SAL_CALL gotoStart(sal_Bool bExpand) override
Definition: unotxvw.cxx:1160
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:2590
virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString &aPropertyName) override
Definition: unotxvw.cxx:1552
sal_uInt16 GetPosition() const
Definition: fmtruby.hxx:70
virtual void SAL_CALL collapseToStart() override
Definition: unotxvw.cxx:928
#define FN_PAGEUP
Definition: cmdid.h:647
SwXTextView(SwView *pSwView)
Definition: unotxvw.cxx:92
virtual FmFormShell * GetFormShell() override
Definition: view.hxx:564
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:1540
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unotxvw.cxx:1659
Style of a layout element.
Definition: frmfmt.hxx:57
bool HasSelection() const
Definition: wrtsh.hxx:137
#define WID_IS_HIDE_SPELL_MARKS
Definition: unomap.hxx:290
sal_uInt16 GetPageCount() const
Definition: viewsh.cxx:2500
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:131
css::uno::Reference< css::datatransfer::XTransferable > GetTransferable()
const SwPosition * GetPoint() const
Definition: pam.hxx:207
void SetOnlineSpell(bool b)
Definition: viewopt.cxx:324
virtual sal_Bool SAL_CALL isAtStartOfLine() override
Definition: unotxvw.cxx:1598
OUString sName
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unotxvw.cxx:1683
void Exchange()
Definition: pam.cxx:471
#define UNO_NAME_RUBY_IS_ABOVE
Definition: unoprnms.hxx:570
int i
SwView * m_pView
Definition: unotxvw.hxx:158
static css::uno::Reference< css::uno::XInterface > GetInterface(SdrObject *pObj)
Definition: unodraw.cxx:288
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:440
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:3393
SwXTextViewCursor(SwView *pVw)
Definition: unotxvw.cxx:859
unsigned char sal_Bool
virtual sal_Bool SAL_CALL isVisible() override
Definition: unotxvw.cxx:894
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:1505
bool IsGroupObject() const
const OutlinerView * GetTextEditOutlinerView() const
virtual sal_Bool SAL_CALL jumpToStartOfPage() override
Definition: unotxvw.cxx:1275
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:1654
void NotifySelChanged()
Definition: unotxvw.cxx:688
const SfxItemPropertySet * m_pPropSet
Definition: unotxvw.hxx:159
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:905
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unotxvw.cxx:1500
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:464
virtual sal_Bool SAL_CALL goRight(sal_Int16 nCount, sal_Bool bExpand) override
Definition: unotxvw.cxx:1004
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:1115
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unotxvw.cxx:1495
SwFrameFormat * GetTableFormat()
Definition: edws.cxx:182
::comphelper::OInterfaceContainerHelper2 m_SelChangedListeners
Definition: unotxvw.hxx:61
virtual sal_Int16 SAL_CALL getPage() override
Definition: unotxvw.cxx:1287
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:56
virtual void SAL_CALL gotoStartOfLine(sal_Bool bExpand) override
Definition: unotxvw.cxx:1641
virtual css::uno::Reference< css::form::runtime::XFormController > SAL_CALL getFormController(const css::uno::Reference< css::form::XForm > &Form) override
Definition: unotxvw.cxx:472
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:1227
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:867
virtual void SAL_CALL setString(const OUString &aString) override
Definition: unotxvw.cxx:1421
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:1263
virtual void SAL_CALL release() override
Definition: unotxvw.cxx:161
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unotxvw.cxx:845
void FillPrtDoc(SwDoc *pPrtDoc, const SfxPrinter *pPrt)
Definition: vprint.cxx:325
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:401
bool IsAtRightMargin() const
Definition: crsrsh.hxx:745
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unotxvw.cxx:819
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:1702
static bool Paste(SwWrtShell &, TransferableDataHelper &, RndStdIds nAnchorType=RndStdIds::FLY_AT_PARA, bool bIgnoreComments=false)
Definition: swdtflvr.cxx:1252
void SetPropertyToDefault(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName)
Definition: unoobj.cxx:2008
css::uno::Any GetPropertyValue(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName)
Definition: unoobj.cxx:1722
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:1009
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:496
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unotxvw.cxx:1490
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:715
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:1750
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:533
static SW_DLLPUBLIC css::uno::Reference< css::text::XTextFrame > CreateXTextFrame(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3141
const SwRect & GetCharRect() const
Definition: crsrsh.hxx:518
void Execute(SfxRequest &)
Definition: view2.cxx:526
size_t IsObjSelected() const
Definition: feshview.cxx:1167
const SwTextNode * GetTextNode() const
Reference< XComponentContext > getProcessComponentContext()
SwUnoPropertyMapProvider aSwMapProvider
Definition: unomap1.cxx:130
void UnSelectFrame()
Definition: select.cxx:327
virtual sal_Bool SAL_CALL goDown(sal_Int16 nCount, sal_Bool bExpand) override
Definition: unotxvw.cxx:1566
#define FN_PAGEDOWN
Definition: cmdid.h:648
SfxObjectShellLock BuildTmpSelectionDoc()
Definition: unotxvw.cxx:653
css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
Definition: unotxvw.cxx:1367
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:1020
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:850
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:447
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:3433
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:3386
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:457
css::beans::PropertyState GetPropertyState(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName)
Definition: unoobj.cxx:1975
virtual sal_Bool SAL_CALL isAtEndOfLine() override
Definition: unotxvw.cxx:1613
virtual SdrView * GetDrawView() const override
Definition: viewdraw.cxx:622
virtual css::uno::Reference< css::text::XTextViewCursor > SAL_CALL getViewCursor() override
Definition: unotxvw.cxx:505
virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override
Definition: unotxvw.cxx:1331
static css::uno::Reference< css::text::XTextRange > CreateXTextRange(SwDoc &rDoc, const SwPosition &rPos, const SwPosition *const pMark)
Definition: unoobj2.cxx:1135
css::uno::Reference< css::text::XTextViewCursor > mxTextViewCursor
Definition: unotxvw.hxx:68
#define DOCUMENTBORDER
Definition: swtypes.hxx:82
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1373
virtual void ApplyViewOptions(const SwViewOption &rOpt) override
Apply ViewOptions with Start-/EndAction.
Definition: wrtsh1.cxx:1765
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2072
sal_Int32 nPos
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:744
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:1156
virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates(const css::uno::Sequence< OUString > &aPropertyName) override
Definition: unotxvw.cxx:1525
#define UNO_NAME_RUBY_ADJUST
Definition: unoprnms.hxx:568
ViewOptFlags1 GetCoreOptions() const
Definition: viewopt.hxx:197
virtual ~SwXTextView() override
Definition: unotxvw.cxx:103
bool IsViewLocked() const
Definition: viewsh.hxx:464
void HideCursor()
Definition: crsrsh.cxx:2311
sal_uInt16 GetPageNum(bool bAtPoint=true, const Point *pLayPos=nullptr)
Get number of page which contains cursor.
Definition: pam.cxx:531
virtual sal_Bool SAL_CALL jumpToNextPage() override
Definition: unotxvw.cxx:1239
Definition: view.hxx:146
bool IsSelFrameMode() const
Definition: wrtsh.hxx:166
sal_uInt16 GetUpper() const
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unotxvw.cxx:731
Base class of the Writer document model elements.
Definition: node.hxx:79