LibreOffice Module sc (master)  1
drtxtob.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 <comphelper/string.hxx>
21 #include <scitems.hxx>
22 
23 #include <editeng/adjustitem.hxx>
24 #include <svx/clipfmtitem.hxx>
25 #include <editeng/contouritem.hxx>
27 #include <editeng/eeitem.hxx>
28 #include <editeng/editeng.hxx>
29 #include <editeng/editview.hxx>
31 #include <editeng/flditem.hxx>
32 #include <editeng/flstitem.hxx>
33 #include <editeng/fontitem.hxx>
34 #include <editeng/frmdiritem.hxx>
35 #include <editeng/lrspitem.hxx>
36 #include <editeng/lspcitem.hxx>
37 #include <editeng/ulspitem.hxx>
39 #include <svx/hlnkitem.hxx>
40 #include <svx/svdoutl.hxx>
41 #include <svx/sdooitm.hxx>
42 #include <editeng/postitem.hxx>
44 #include <editeng/shdditem.hxx>
45 #include <editeng/udlnitem.hxx>
46 #include <editeng/wghtitem.hxx>
48 #include <sfx2/dispatch.hxx>
49 #include <sfx2/objface.hxx>
50 #include <sfx2/objsh.hxx>
51 #include <sfx2/request.hxx>
52 #include <sfx2/viewfrm.hxx>
53 #include <svtools/cliplistener.hxx>
54 #include <vcl/transfer.hxx>
55 #include <svl/stritem.hxx>
56 #include <svl/whiter.hxx>
57 #include <svl/languageoptions.hxx>
58 
59 #include <svx/svxdlg.hxx>
60 #include <vcl/EnumContext.hxx>
61 #include <vcl/unohelp2.hxx>
62 
63 #include <sc.hrc>
64 #include <globstr.hrc>
65 #include <scresid.hxx>
66 #include <scmod.hxx>
67 #include <drtxtob.hxx>
68 #include <viewdata.hxx>
69 #include <document.hxx>
70 #include <drawview.hxx>
71 #include <viewutil.hxx>
72 #include <tabvwsh.hxx>
73 #include <gridwin.hxx>
74 
75 #define ShellClass_ScDrawTextObjectBar
76 #include <scslots.hxx>
77 
78 using namespace ::com::sun::star;
79 
81 
82 void ScDrawTextObjectBar::InitInterface_Impl()
83 {
84  GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT,
85  SfxVisibilityFlags::Standard | SfxVisibilityFlags::Server,
86  ToolbarId::Text_Toolbox_Sc);
87 
88  GetStaticInterface()->RegisterPopupMenu("drawtext");
89 
90  GetStaticInterface()->RegisterChildWindow(ScGetFontWorkId());
91 }
92 
93 
94 // disable not wanted accelerators
95 
97 {
98  SfxWhichIter aIter(rSet);
99  sal_uInt16 nWhich = aIter.FirstWhich();
100 
101  while (nWhich)
102  {
103  rSet.DisableItem( nWhich );
104  nWhich = aIter.NextWhich();
105  }
106 }
107 
109  SfxShell(rData.GetViewShell()),
110  mrViewData(rData),
111  bPastePossible(false)
112 {
114 
115  // At the switching-over the UndoManager is changed to edit mode
117  SetUndoManager( pMgr );
119  {
120  pMgr->SetMaxUndoActionCount( 0 );
121  }
122 
123  SetName("DrawText");
125 }
126 
128 {
129  if ( mxClipEvtLstnr.is() )
130  {
131  mxClipEvtLstnr->RemoveListener( mrViewData.GetActiveWin() );
132 
133  // The listener may just now be waiting for the SolarMutex and call the link
134  // afterwards, in spite of RemoveListener. So the link has to be reset, too.
135  mxClipEvtLstnr->ClearCallbackLink();
136  }
137 }
138 
139 // Functions
140 
142 {
144  OutlinerView* pOutView = pView->GetTextEditOutlinerView();
145  Outliner* pOutliner = pView->GetTextEditOutliner();
146 
147  if (!pOutView || !pOutliner)
148  {
149  ExecuteGlobal( rReq ); // on whole objects
150  return;
151  }
152 
153  const SfxItemSet* pReqArgs = rReq.GetArgs();
154  sal_uInt16 nSlot = rReq.GetSlot();
155  switch ( nSlot )
156  {
157  case SID_COPY:
158  pOutView->Copy();
159  break;
160 
161  case SID_CUT:
162  pOutView->Cut();
163  break;
164 
165  case SID_PASTE:
166  pOutView->PasteSpecial();
167  break;
168 
169  case SID_CLIPBOARD_FORMAT_ITEMS:
170  {
171  SotClipboardFormatId nFormat = SotClipboardFormatId::NONE;
172  const SfxPoolItem* pItem;
173  if ( pReqArgs &&
174  pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET &&
175  dynamic_cast<const SfxUInt32Item*>( pItem) != nullptr )
176  {
177  nFormat = static_cast<SotClipboardFormatId>(static_cast<const SfxUInt32Item*>(pItem)->GetValue());
178  }
179 
180  if ( nFormat != SotClipboardFormatId::NONE )
181  {
182  if (nFormat == SotClipboardFormatId::STRING)
183  pOutView->Paste();
184  else
185  pOutView->PasteSpecial();
186  }
187  }
188  break;
189 
190  case SID_PASTE_SPECIAL:
191  ExecutePasteContents( rReq );
192  break;
193 
194  case SID_PASTE_UNFORMATTED:
195  pOutView->Paste();
196  break;
197 
198  case SID_SELECTALL:
199  {
200  sal_Int32 nCount = pOutliner->GetParagraphCount();
201  ESelection aSel( 0,0,nCount,0 );
202  pOutView->SetSelection( aSel );
203  }
204  break;
205 
206  case SID_CHARMAP:
207  {
208  const SvxFontItem& rItem = pOutView->GetAttribs().Get(EE_CHAR_FONTINFO);
209 
210  OUString aString;
211  std::shared_ptr<SvxFontItem> aNewItem(std::make_shared<SvxFontItem>(EE_CHAR_FONTINFO));
212 
213  const SfxItemSet *pArgs = rReq.GetArgs();
214  const SfxPoolItem* pItem = nullptr;
215  if( pArgs )
216  pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), false, &pItem);
217 
218  if ( pItem )
219  {
220  aString = static_cast<const SfxStringItem*>(pItem)->GetValue();
221  const SfxPoolItem* pFtItem = nullptr;
222  pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), false, &pFtItem);
223  const SfxStringItem* pFontItem = dynamic_cast<const SfxStringItem*>( pFtItem );
224  if ( pFontItem )
225  {
226  const OUString& aFontName(pFontItem->GetValue());
227  vcl::Font aFont(aFontName, Size(1,1)); // Size only because of CTOR
228  aNewItem = std::make_shared<SvxFontItem>(
229  aFont.GetFamilyType(), aFont.GetFamilyName(),
230  aFont.GetStyleName(), aFont.GetPitch(),
231  aFont.GetCharSet(), ATTR_FONT);
232  }
233  else
234  {
235  aNewItem.reset(rItem.Clone());
236  }
237  }
238  else
240 
241  if ( !aString.isEmpty() )
242  {
243  SfxItemSet aSet( pOutliner->GetEmptyItemSet() );
244  // tdf#125054
245  // checked against original, indeed aNewItem looks as if it can have
246  // either WhichID EE_CHAR_FONTINFO or ATTR_FONT when it was reset
247  // above, original uses '= SvxFontItem(..., ATTR_FONT).
248  // BUT beware: the operator=() did not copy the WhichID when resetting,
249  // so it indeed has WhichID of EE_CHAR_FONTINFO despite copying an Item
250  // that was constructed using ATTR_FONT as WhichID (!)
251  aSet.Put( *aNewItem, EE_CHAR_FONTINFO );
252 
253  // If nothing is selected, then SetAttribs of the View selects a word
254  pOutView->GetOutliner()->QuickSetAttribs( aSet, pOutView->GetSelection() );
255  pOutView->InsertText(aString);
256  }
257 
258  Invalidate( SID_ATTR_CHAR_FONT );
259  }
260  break;
261 
262  case SID_HYPERLINK_SETLINK:
263  if( pReqArgs )
264  {
265  const SfxPoolItem* pItem;
266  if ( pReqArgs->GetItemState( SID_HYPERLINK_SETLINK, true, &pItem ) == SfxItemState::SET )
267  {
268  const SvxHyperlinkItem* pHyper = static_cast<const SvxHyperlinkItem*>(pItem);
269  const OUString& rName = pHyper->GetName();
270  const OUString& rURL = pHyper->GetURL();
271  const OUString& rTarget = pHyper->GetTargetFrame();
273 
274  bool bDone = false;
275  if (eMode == HLINK_DEFAULT || eMode == HLINK_FIELD)
276  {
277  pOutView->SelectFieldAtCursor();
278 
279  // insert new field
280  SvxURLField aURLField( rURL, rName, SvxURLFormat::Repr );
281  aURLField.SetTargetFrame( rTarget );
282  SvxFieldItem aURLItem( aURLField, EE_FEATURE_FIELD );
283  pOutView->InsertField( aURLItem );
284 
285  bDone = true;
286  }
287 
288  if (!bDone)
289  ExecuteGlobal( rReq ); // normal at View
290 
291  // If "text" is received by InsertURL of ViewShell, then the DrawShell is turned off !!!
292  }
293  }
294  break;
295 
296  case SID_OPEN_HYPERLINK:
297  if (const SvxFieldData* pField = pOutView->GetFieldAtCursor())
298  {
299  if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
300  {
301  ScGlobal::OpenURL(pURLField->GetURL(), pURLField->GetTargetFrame(), true);
302  }
303  }
304  break;
305 
306  case SID_EDIT_HYPERLINK:
307  {
308  // Ensure the field is selected first
309  pOutView->SelectFieldAtCursor();
310  mrViewData.GetViewShell()->GetViewFrame()->GetDispatcher()->Execute(SID_HYPERLINK_DIALOG);
311  }
312  break;
313 
314  case SID_COPY_HYPERLINK_LOCATION:
315  {
316  const SvxFieldData* pField = pOutView->GetFieldAtCursor();
317  if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
318  {
319  uno::Reference<datatransfer::clipboard::XClipboard> xClipboard
320  = pOutView->GetWindow()->GetClipboard();
321  vcl::unohelper::TextDataObject::CopyStringTo(pURLField->GetURL(), xClipboard);
322  }
323  }
324  break;
325 
326  case SID_REMOVE_HYPERLINK:
327  {
328  // Ensure the field is selected first
330  }
331  break;
332 
333  case SID_ENABLE_HYPHENATION:
334  case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
335  case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
336  pView->ScEndTextEdit(); // end text edit before switching direction
337  ExecuteGlobal( rReq );
338  // restore consistent state between shells and functions:
339  mrViewData.GetDispatcher().Execute(SID_OBJECT_SELECT, SfxCallMode::SLOT | SfxCallMode::RECORD);
340  break;
341 
342  case SID_THES:
343  {
344  OUString aReplaceText;
345  const SfxStringItem* pItem2 = rReq.GetArg<SfxStringItem>(SID_THES);
346  if (pItem2)
347  aReplaceText = pItem2->GetValue();
348  if (!aReplaceText.isEmpty())
349  ReplaceTextWithSynonym( pOutView->GetEditView(), aReplaceText );
350  }
351  break;
352 
353  case SID_THESAURUS:
354  {
355  pOutView->StartThesaurus();
356  }
357  break;
358 
359  }
360 }
361 
363 {
365  bool bHasFontWork = pViewFrm->HasChildWindow(SID_FONTWORK);
366  bool bDisableFontWork = false;
367 
368  if (IsNoteEdit())
369  {
370  // #i21255# notes now support rich text formatting (#i74140# but not fontwork)
371  bDisableFontWork = true;
372  }
373 
374  if ( bDisableFontWork )
375  rSet.DisableItem( SID_FONTWORK );
376  else
377  rSet.Put(SfxBoolItem(SID_FONTWORK, bHasFontWork));
378 
379  if ( rSet.GetItemState( SID_HYPERLINK_GETLINK ) != SfxItemState::UNKNOWN )
380  {
381  SvxHyperlinkItem aHLinkItem;
382  SdrView* pView = mrViewData.GetScDrawView();
383  OutlinerView* pOutView = pView->GetTextEditOutlinerView();
384  if ( pOutView )
385  {
386  bool bField = false;
387  const SvxFieldData* pField = pOutView->GetFieldAtCursor();
388  if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
389  {
390  aHLinkItem.SetName( pURLField->GetRepresentation() );
391  aHLinkItem.SetURL( pURLField->GetURL() );
392  aHLinkItem.SetTargetFrame( pURLField->GetTargetFrame() );
393  bField = true;
394  }
395 
396  if (!bField)
397  {
398  // use selected text as name for urls
399  OUString sReturn = pOutView->GetSelected();
400  sal_Int32 nLen = std::min<sal_Int32>(sReturn.getLength(), 255);
401  sReturn = sReturn.copy(0, nLen);
402  aHLinkItem.SetName(comphelper::string::stripEnd(sReturn, ' '));
403  }
404  }
405  rSet.Put(aHLinkItem);
406  }
407 
408  if (rSet.GetItemState(SID_OPEN_HYPERLINK) != SfxItemState::UNKNOWN
409  || rSet.GetItemState(SID_EDIT_HYPERLINK) != SfxItemState::UNKNOWN
410  || rSet.GetItemState(SID_COPY_HYPERLINK_LOCATION) != SfxItemState::UNKNOWN
411  || rSet.GetItemState(SID_REMOVE_HYPERLINK) != SfxItemState::UNKNOWN)
412  {
413  SdrView* pView = mrViewData.GetScDrawView();
415  {
416  rSet.DisableItem( SID_OPEN_HYPERLINK );
417  rSet.DisableItem( SID_EDIT_HYPERLINK );
418  rSet.DisableItem( SID_COPY_HYPERLINK_LOCATION );
419  rSet.DisableItem( SID_REMOVE_HYPERLINK );
420  }
421  }
422 
423  if( rSet.GetItemState( SID_TRANSLITERATE_HALFWIDTH ) != SfxItemState::UNKNOWN )
424  ScViewUtil::HideDisabledSlot( rSet, pViewFrm->GetBindings(), SID_TRANSLITERATE_HALFWIDTH );
425  if( rSet.GetItemState( SID_TRANSLITERATE_FULLWIDTH ) != SfxItemState::UNKNOWN )
426  ScViewUtil::HideDisabledSlot( rSet, pViewFrm->GetBindings(), SID_TRANSLITERATE_FULLWIDTH );
427  if( rSet.GetItemState( SID_TRANSLITERATE_HIRAGANA ) != SfxItemState::UNKNOWN )
428  ScViewUtil::HideDisabledSlot( rSet, pViewFrm->GetBindings(), SID_TRANSLITERATE_HIRAGANA );
429  if( rSet.GetItemState( SID_TRANSLITERATE_KATAKANA ) != SfxItemState::UNKNOWN )
430  ScViewUtil::HideDisabledSlot( rSet, pViewFrm->GetBindings(), SID_TRANSLITERATE_KATAKANA );
431 
432  if ( rSet.GetItemState( SID_ENABLE_HYPHENATION ) != SfxItemState::UNKNOWN )
433  {
434  SdrView* pView = mrViewData.GetScDrawView();
435  SfxItemSet aAttrs( pView->GetModel()->GetItemPool() );
436  pView->GetAttributes( aAttrs );
437  if( aAttrs.GetItemState( EE_PARA_HYPHENATE ) >= SfxItemState::DEFAULT )
438  {
439  bool bValue = aAttrs.Get( EE_PARA_HYPHENATE ).GetValue();
440  rSet.Put( SfxBoolItem( SID_ENABLE_HYPHENATION, bValue ) );
441  }
442  }
443 
444  if ( rSet.GetItemState( SID_THES ) != SfxItemState::UNKNOWN ||
445  rSet.GetItemState( SID_THESAURUS ) != SfxItemState::UNKNOWN )
446  {
447  SdrView * pView = mrViewData.GetScDrawView();
448  OutlinerView* pOutView = pView->GetTextEditOutlinerView();
449 
450  OUString aStatusVal;
451  LanguageType nLang = LANGUAGE_NONE;
452  bool bIsLookUpWord = false;
453  if ( pOutView )
454  {
455  EditView& rEditView = pOutView->GetEditView();
456  bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, rEditView );
457  }
458  rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
459 
460  // disable thesaurus main menu and context menu entry if there is nothing to look up
461  bool bCanDoThesaurus = ScModule::HasThesaurusLanguage( nLang );
462  if (!bIsLookUpWord || !bCanDoThesaurus)
463  rSet.DisableItem( SID_THES );
464  if (!bCanDoThesaurus)
465  rSet.DisableItem( SID_THESAURUS );
466  }
467 
468  if (GetObjectShell()->isContentExtractionLocked())
469  {
470  rSet.DisableItem(SID_COPY);
471  rSet.DisableItem(SID_CUT);
472  }
473 }
474 
475 IMPL_LINK( ScDrawTextObjectBar, ClipboardChanged, TransferableDataHelper*, pDataHelper, void )
476 {
477  bPastePossible = ( pDataHelper->HasFormat( SotClipboardFormatId::STRING ) || pDataHelper->HasFormat( SotClipboardFormatId::RTF )
478  || pDataHelper->HasFormat( SotClipboardFormatId::RICHTEXT ) );
479 
480  SfxBindings& rBindings = mrViewData.GetBindings();
481  rBindings.Invalidate( SID_PASTE );
482  rBindings.Invalidate( SID_PASTE_SPECIAL );
483  rBindings.Invalidate( SID_PASTE_UNFORMATTED );
484  rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
485 }
486 
488 {
489  SdrView* pView = mrViewData.GetScDrawView();
490  if ( !pView->GetTextEditOutlinerView() )
491  {
492  GetGlobalClipState( rSet );
493  return;
494  }
495 
496  if ( !mxClipEvtLstnr.is() )
497  {
498  // create listener
499  mxClipEvtLstnr = new TransferableClipboardListener( LINK( this, ScDrawTextObjectBar, ClipboardChanged ) );
501  mxClipEvtLstnr->AddListener( pWin );
502 
503  // get initial state
505  bPastePossible = ( aDataHelper.HasFormat( SotClipboardFormatId::STRING ) || aDataHelper.HasFormat( SotClipboardFormatId::RTF )
506  || aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) );
507  }
508 
509  SfxWhichIter aIter( rSet );
510  sal_uInt16 nWhich = aIter.FirstWhich();
511  while (nWhich)
512  {
513  switch (nWhich)
514  {
515  case SID_PASTE:
516  case SID_PASTE_SPECIAL:
517  case SID_PASTE_UNFORMATTED:
518  if( !bPastePossible )
519  rSet.DisableItem( nWhich );
520  break;
521  case SID_CLIPBOARD_FORMAT_ITEMS:
522  if ( bPastePossible )
523  {
524  SvxClipboardFormatItem aFormats( SID_CLIPBOARD_FORMAT_ITEMS );
525  TransferableDataHelper aDataHelper(
527 
528  if ( aDataHelper.HasFormat( SotClipboardFormatId::STRING ) )
529  aFormats.AddClipbrdFormat( SotClipboardFormatId::STRING );
530  if ( aDataHelper.HasFormat( SotClipboardFormatId::RTF ) )
531  aFormats.AddClipbrdFormat( SotClipboardFormatId::RTF );
532  if ( aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) )
533  aFormats.AddClipbrdFormat( SotClipboardFormatId::RICHTEXT );
534 
535  rSet.Put( aFormats );
536  }
537  else
538  rSet.DisableItem( nWhich );
539  break;
540  }
541  nWhich = aIter.NextWhich();
542  }
543 }
544 
545 // Attributes
546 
548 {
549  // Underline
550 
551  SdrView* pView = mrViewData.GetScDrawView();
552 
553  sal_uInt16 nSlot = rReq.GetSlot();
554 
555  SfxItemSet aSet( pView->GetDefaultAttr() );
556 
557  SfxItemSet aViewAttr(pView->GetModel()->GetItemPool());
558  pView->GetAttributes(aViewAttr);
559 
560  // Underline
561  FontLineStyle eOld = aViewAttr.Get(EE_CHAR_UNDERLINE).GetLineStyle();
562  FontLineStyle eNew = eOld;
563  switch (nSlot)
564  {
565  case SID_ULINE_VAL_NONE:
566  eNew = LINESTYLE_NONE;
567  break;
568  case SID_ULINE_VAL_SINGLE:
569  eNew = ( eOld == LINESTYLE_SINGLE ) ? LINESTYLE_NONE : LINESTYLE_SINGLE;
570  break;
571  case SID_ULINE_VAL_DOUBLE:
572  eNew = ( eOld == LINESTYLE_DOUBLE ) ? LINESTYLE_NONE : LINESTYLE_DOUBLE;
573  break;
574  case SID_ULINE_VAL_DOTTED:
575  eNew = ( eOld == LINESTYLE_DOTTED ) ? LINESTYLE_NONE : LINESTYLE_DOTTED;
576  break;
577  default:
578  break;
579  }
580  aSet.Put( SvxUnderlineItem( eNew, EE_CHAR_UNDERLINE ) );
581 
582  pView->SetAttributes( aSet );
583  rReq.Done();
585 }
586 
587 static void lcl_RemoveFields( OutlinerView& rOutView )
588 {
590 
591  Outliner* pOutliner = rOutView.GetOutliner();
592  if (!pOutliner) return;
593 
594  ESelection aOldSel = rOutView.GetSelection();
595  ESelection aSel = aOldSel;
596  aSel.Adjust();
597  sal_Int32 nNewEnd = aSel.nEndPos;
598 
599  bool bUpdate = pOutliner->GetUpdateMode();
600  bool bChanged = false;
601 
603  EditEngine& rEditEng = const_cast<EditEngine&>(pOutliner->GetEditEngine());
604 
605  sal_Int32 nParCount = pOutliner->GetParagraphCount();
606  for (sal_Int32 nPar=0; nPar<nParCount; nPar++)
607  if ( nPar >= aSel.nStartPara && nPar <= aSel.nEndPara )
608  {
609  std::vector<sal_Int32> aPortions;
610  rEditEng.GetPortions( nPar, aPortions );
611 
612  for ( size_t nPos = aPortions.size(); nPos; )
613  {
614  --nPos;
615  sal_Int32 nEnd = aPortions[ nPos ];
616  sal_Int32 nStart = nPos ? aPortions[ nPos - 1 ] : 0;
617  // fields are single characters
618  if ( nEnd == nStart+1 &&
619  ( nPar > aSel.nStartPara || nStart >= aSel.nStartPos ) &&
620  ( nPar < aSel.nEndPara || nEnd <= aSel.nEndPos ) )
621  {
622  ESelection aFieldSel( nPar, nStart, nPar, nEnd );
623  SfxItemSet aSet = rEditEng.GetAttribs( aFieldSel );
624  if ( aSet.GetItemState( EE_FEATURE_FIELD ) == SfxItemState::SET )
625  {
626  if (!bChanged)
627  {
628  if (bUpdate)
629  pOutliner->SetUpdateMode( false );
630  OUString aName = ScResId( STR_UNDO_DELETECONTENTS );
631  ViewShellId nViewShellId(-1);
633  nViewShellId = pViewSh->GetViewShellId();
634  pOutliner->GetUndoManager().EnterListAction( aName, aName, 0, nViewShellId );
635  bChanged = true;
636  }
637 
638  OUString aFieldText = rEditEng.GetText( aFieldSel );
639  pOutliner->QuickInsertText( aFieldText, aFieldSel );
640  if ( nPar == aSel.nEndPara )
641  {
642  nNewEnd = nNewEnd + aFieldText.getLength();
643  --nNewEnd;
644  }
645  }
646  }
647  }
648  }
649 
650  if (bUpdate && bChanged)
651  {
652  pOutliner->GetUndoManager().LeaveListAction();
653  pOutliner->SetUpdateMode( true );
654  }
655 
656  if ( aOldSel == aSel ) // aSel is adjusted
657  aOldSel.nEndPos = nNewEnd;
658  else
659  aOldSel.nStartPos = nNewEnd; // if aOldSel is backwards
660  rOutView.SetSelection( aOldSel );
661 }
662 
664 {
665  SdrView* pView = mrViewData.GetScDrawView();
666  const SfxItemSet* pArgs = rReq.GetArgs();
667  sal_uInt16 nSlot = rReq.GetSlot();
668 
669  SfxItemSet aEditAttr( pView->GetModel()->GetItemPool() );
670  pView->GetAttributes( aEditAttr );
671  SfxItemSet aNewAttr( *aEditAttr.GetPool(), aEditAttr.GetRanges() );
672 
673  bool bSet = true;
674  switch ( nSlot )
675  {
676  case SID_ALIGNLEFT:
677  case SID_ALIGN_ANY_LEFT:
678  case SID_ATTR_PARA_ADJUST_LEFT:
679  aNewAttr.Put( SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ) );
680  break;
681 
682  case SID_ALIGNCENTERHOR:
683  case SID_ALIGN_ANY_HCENTER:
684  case SID_ATTR_PARA_ADJUST_CENTER:
685  aNewAttr.Put( SvxAdjustItem( SvxAdjust::Center, EE_PARA_JUST ) );
686  break;
687 
688  case SID_ALIGNRIGHT:
689  case SID_ALIGN_ANY_RIGHT:
690  case SID_ATTR_PARA_ADJUST_RIGHT:
691  aNewAttr.Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) );
692  break;
693 
694  case SID_ALIGNBLOCK:
695  case SID_ALIGN_ANY_JUSTIFIED:
696  case SID_ATTR_PARA_ADJUST_BLOCK:
697  aNewAttr.Put( SvxAdjustItem( SvxAdjust::Block, EE_PARA_JUST ) );
698  break;
699 
700  case SID_ATTR_PARA_LINESPACE_10:
701  {
703  aItem.SetPropLineSpace( 100 );
704  aNewAttr.Put( aItem );
705  }
706  break;
707 
708  case SID_ATTR_PARA_LINESPACE_15:
709  {
711  aItem.SetPropLineSpace( 150 );
712  aNewAttr.Put( aItem );
713  }
714  break;
715 
716  case SID_ATTR_PARA_LINESPACE_20:
717  {
719  aItem.SetPropLineSpace( 200 );
720  aNewAttr.Put( aItem );
721  }
722  break;
723 
724  case SID_SET_SUPER_SCRIPT:
725  {
727  SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
728 
729  if( eEsc == SvxEscapement::Superscript )
730  aItem.SetEscapement( SvxEscapement::Off );
731  else
732  aItem.SetEscapement( SvxEscapement::Superscript );
733  aNewAttr.Put( aItem );
734  }
735  break;
736 
737  case SID_SET_SUB_SCRIPT:
738  {
740  SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
741 
742  if( eEsc == SvxEscapement::Subscript )
743  aItem.SetEscapement( SvxEscapement::Off );
744  else
745  aItem.SetEscapement( SvxEscapement::Subscript );
746  aNewAttr.Put( aItem );
747  }
748  break;
749 
750  case SID_TABLE_VERT_NONE:
751  case SID_TABLE_VERT_CENTER:
752  case SID_TABLE_VERT_BOTTOM:
753  {
755  if (nSlot == SID_TABLE_VERT_CENTER)
757  else if (nSlot == SID_TABLE_VERT_BOTTOM)
759  aNewAttr.Put(SdrTextVertAdjustItem(eTVA));
760  }
761  break;
762 
763  case SID_PARASPACE_INCREASE:
764  case SID_PARASPACE_DECREASE:
765  {
766  SvxULSpaceItem aULSpace( aEditAttr.Get( EE_PARA_ULSPACE ) );
767  sal_uInt16 nUpper = aULSpace.GetUpper();
768  sal_uInt16 nLower = aULSpace.GetLower();
769 
770  if ( nSlot == SID_PARASPACE_INCREASE )
771  {
772  nUpper += 100;
773  nLower += 100;
774  }
775  else
776  {
777  nUpper = std::max< sal_Int16 >( nUpper - 100, 0 );
778  nLower = std::max< sal_Int16 >( nLower - 100, 0 );
779  }
780 
781  aULSpace.SetUpper( nUpper );
782  aULSpace.SetLower( nLower );
783  aNewAttr.Put( aULSpace );
784  }
785  break;
786 
787  default:
788  bSet = false;
789  }
790 
791  bool bDone = true;
792  bool bArgsInReq = ( pArgs != nullptr );
793 
794  if ( !bArgsInReq )
795  {
796  switch ( nSlot )
797  {
798  case SID_TEXT_STANDARD: // delete hard text attributes
799  {
800  OutlinerView* pOutView = pView->IsTextEdit() ?
801  pView->GetTextEditOutlinerView() : nullptr;
802  if ( pOutView )
803  pOutView->Paint( tools::Rectangle() );
804 
805  SfxItemSet aEmptyAttr( *aEditAttr.GetPool(), svl::Items<EE_ITEMS_START, EE_ITEMS_END>{} );
806  pView->SetAttributes( aEmptyAttr, true );
807 
808  if ( pOutView )
809  {
810  lcl_RemoveFields( *pOutView );
811  pOutView->ShowCursor();
812  }
813 
814  rReq.Done( aEmptyAttr );
816  bDone = false; // already happened here
817  }
818  break;
819 
820  case SID_GROW_FONT_SIZE:
821  case SID_SHRINK_FONT_SIZE:
822  {
823  OutlinerView* pOutView = pView->IsTextEdit() ?
824  pView->GetTextEditOutlinerView() : nullptr;
825  if ( pOutView )
826  {
827  const SvxFontListItem* pFontListItem = static_cast< const SvxFontListItem* >
828  ( SfxObjectShell::Current()->GetItem( SID_ATTR_CHAR_FONTLIST ) );
829  const FontList* pFontList = pFontListItem ? pFontListItem->GetFontList() : nullptr;
830  pOutView->GetEditView().ChangeFontSize( nSlot == SID_GROW_FONT_SIZE, pFontList );
831  mrViewData.GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
832  bDone = false;
833  }
834  }
835  break;
836 
837  case SID_CHAR_DLG_EFFECT:
838  case SID_CHAR_DLG: // dialog button
839  case SID_ATTR_CHAR_FONT: // Controller not shown
840  case SID_ATTR_CHAR_FONTHEIGHT:
841  bDone = ExecuteCharDlg( aEditAttr, aNewAttr , nSlot);
842  break;
843 
844  case SID_PARA_DLG:
845  bDone = ExecuteParaDlg( aEditAttr, aNewAttr );
846  break;
847 
848  case SID_ATTR_CHAR_WEIGHT:
849  aNewAttr.Put( aEditAttr.Get( EE_CHAR_WEIGHT ) );
850  break;
851 
852  case SID_ATTR_CHAR_POSTURE:
853  aNewAttr.Put( aEditAttr.Get( EE_CHAR_ITALIC ) );
854  break;
855 
856  case SID_ATTR_CHAR_UNDERLINE:
857  aNewAttr.Put( aEditAttr.Get( EE_CHAR_UNDERLINE ) );
858  break;
859 
860  case SID_ATTR_CHAR_OVERLINE:
861  aNewAttr.Put( aEditAttr.Get( EE_CHAR_OVERLINE ) );
862  break;
863 
864  case SID_ATTR_CHAR_CONTOUR:
865  aNewAttr.Put( aEditAttr.Get( EE_CHAR_OUTLINE ) );
866  break;
867 
868  case SID_ATTR_CHAR_SHADOWED:
869  aNewAttr.Put( aEditAttr.Get( EE_CHAR_SHADOW ) );
870  break;
871 
872  case SID_ATTR_CHAR_STRIKEOUT:
873  aNewAttr.Put( aEditAttr.Get( EE_CHAR_STRIKEOUT ) );
874  break;
875 
876  case SID_DRAWTEXT_ATTR_DLG:
877  {
880 
881  bDone = ( RET_OK == pDlg->Execute() );
882 
883  if ( bDone )
884  aNewAttr.Put( *pDlg->GetOutputItemSet() );
885 
886  pDlg.disposeAndClear();
887 
888  SfxBindings& rBindings = mrViewData.GetBindings();
889  rBindings.Invalidate( SID_TABLE_VERT_NONE );
890  rBindings.Invalidate( SID_TABLE_VERT_CENTER );
891  rBindings.Invalidate( SID_TABLE_VERT_BOTTOM );
892  }
893  break;
894  }
895  }
896 
897  if ( bSet || bDone )
898  {
899  rReq.Done( aNewAttr );
900  pArgs = rReq.GetArgs();
901  }
902 
903  if ( !pArgs )
904  return;
905 
906  if ( bArgsInReq &&
907  ( nSlot == SID_ATTR_CHAR_FONT || nSlot == SID_ATTR_CHAR_FONTHEIGHT ||
908  nSlot == SID_ATTR_CHAR_WEIGHT || nSlot == SID_ATTR_CHAR_POSTURE ) )
909  {
910  // font items from toolbox controller have to be applied for the right script type
911 
912  // #i78017 establish the same behaviour as in Writer
913  SvtScriptType nScript = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
914  if (nSlot == SID_ATTR_CHAR_FONT)
915  nScript = pView->GetScriptType();
916 
917  SfxItemPool& rPool = GetPool();
918  SvxScriptSetItem aSetItem( nSlot, rPool );
919  sal_uInt16 nWhich = rPool.GetWhich( nSlot );
920  aSetItem.PutItemForScriptType( nScript, pArgs->Get( nWhich ) );
921 
922  pView->SetAttributes( aSetItem.GetItemSet() );
923  }
924  else if( nSlot == SID_ATTR_PARA_LRSPACE )
925  {
926  sal_uInt16 nId = SID_ATTR_PARA_LRSPACE;
927  const SvxLRSpaceItem& rItem = static_cast<const SvxLRSpaceItem&>(
928  pArgs->Get( nId ));
930  nId = EE_PARA_LRSPACE;
931  SvxLRSpaceItem aLRSpaceItem( rItem.GetLeft(),
932  rItem.GetRight(), rItem.GetTextLeft(),
933  rItem.GetTextFirstLineOffset(), nId );
934  aAttr.Put( aLRSpaceItem );
935  pView->SetAttributes( aAttr );
936  }
937  else if( nSlot == SID_ATTR_PARA_LINESPACE )
938  {
939  SvxLineSpacingItem aLineSpaceItem = static_cast<const SvxLineSpacingItem&>(pArgs->Get(
940  GetPool().GetWhich(nSlot)));
942  aAttr.Put( aLineSpaceItem );
943  pView->SetAttributes( aAttr );
944  }
945  else if( nSlot == SID_ATTR_PARA_ULSPACE )
946  {
947  SvxULSpaceItem aULSpaceItem = static_cast<const SvxULSpaceItem&>(pArgs->Get(
948  GetPool().GetWhich(nSlot)));
950  aULSpaceItem.SetWhich(EE_PARA_ULSPACE);
951  aAttr.Put( aULSpaceItem );
952  pView->SetAttributes( aAttr );
953  }
954  else
955  {
956  // use args directly
957  pView->SetAttributes( *pArgs );
958  }
960 }
961 
963 {
964  if ( IsNoteEdit() )
965  {
966  // issue 21255 - Notes now support rich text formatting.
967  }
968 
969  SvtLanguageOptions aLangOpt;
970  bool bDisableCTLFont = !aLangOpt.IsCTLFontEnabled();
971  bool bDisableVerticalText = !aLangOpt.IsVerticalTextEnabled();
972 
973  SdrView* pView = mrViewData.GetScDrawView();
974  SfxItemSet aAttrSet(pView->GetModel()->GetItemPool());
975  pView->GetAttributes(aAttrSet);
976 
977  // direct attributes
978 
979  rDestSet.Put( aAttrSet );
980 
981  // choose font info according to selection script type
982 
983  SvtScriptType nScript = pView->GetScriptType();
984 
985  // #i55929# input-language-dependent script type (depends on input language if nothing selected)
986  SvtScriptType nInputScript = nScript;
987  OutlinerView* pOutView = pView->GetTextEditOutlinerView();
988  if (pOutView && !pOutView->GetSelection().HasRange())
989  {
991  if (nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
992  nInputScript = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
993  }
994 
995  // #i55929# according to spec, nInputScript is used for font and font height only
996  if ( rDestSet.GetItemState( EE_CHAR_FONTINFO ) != SfxItemState::UNKNOWN )
997  ScViewUtil::PutItemScript( rDestSet, aAttrSet, EE_CHAR_FONTINFO, nInputScript );
998  if ( rDestSet.GetItemState( EE_CHAR_FONTHEIGHT ) != SfxItemState::UNKNOWN )
999  ScViewUtil::PutItemScript( rDestSet, aAttrSet, EE_CHAR_FONTHEIGHT, nInputScript );
1000  if ( rDestSet.GetItemState( EE_CHAR_WEIGHT ) != SfxItemState::UNKNOWN )
1001  ScViewUtil::PutItemScript( rDestSet, aAttrSet, EE_CHAR_WEIGHT, nScript );
1002  if ( rDestSet.GetItemState( EE_CHAR_ITALIC ) != SfxItemState::UNKNOWN )
1003  ScViewUtil::PutItemScript( rDestSet, aAttrSet, EE_CHAR_ITALIC, nScript );
1004  // Alignment
1005 
1006  SvxAdjust eAdj = aAttrSet.Get(EE_PARA_JUST).GetAdjust();
1007  switch( eAdj )
1008  {
1009  case SvxAdjust::Left:
1010  {
1011  rDestSet.Put( SfxBoolItem( SID_ALIGNLEFT, true ) );
1012  rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT, true ) );
1013  }
1014  break;
1015  case SvxAdjust::Center:
1016  {
1017  rDestSet.Put( SfxBoolItem( SID_ALIGNCENTERHOR, true ) );
1018  rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER, true ) );
1019  }
1020  break;
1021  case SvxAdjust::Right:
1022  {
1023  rDestSet.Put( SfxBoolItem( SID_ALIGNRIGHT, true ) );
1024  rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, true ) );
1025  }
1026  break;
1027  case SvxAdjust::Block:
1028  {
1029  rDestSet.Put( SfxBoolItem( SID_ALIGNBLOCK, true ) );
1030  rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, true ) );
1031  }
1032  break;
1033  default:
1034  {
1035  // added to avoid warnings
1036  }
1037  }
1038  // pseudo slots for Format menu
1039  rDestSet.Put( SfxBoolItem( SID_ALIGN_ANY_LEFT, eAdj == SvxAdjust::Left ) );
1040  rDestSet.Put( SfxBoolItem( SID_ALIGN_ANY_HCENTER, eAdj == SvxAdjust::Center ) );
1041  rDestSet.Put( SfxBoolItem( SID_ALIGN_ANY_RIGHT, eAdj == SvxAdjust::Right ) );
1042  rDestSet.Put( SfxBoolItem( SID_ALIGN_ANY_JUSTIFIED, eAdj == SvxAdjust::Block ) );
1043 
1044  SvxLRSpaceItem aLR = aAttrSet.Get( EE_PARA_LRSPACE );
1045  aLR.SetWhich(SID_ATTR_PARA_LRSPACE);
1046  rDestSet.Put(aLR);
1047  Invalidate( SID_ATTR_PARA_LRSPACE );
1048  SfxItemState eState = aAttrSet.GetItemState( EE_PARA_LRSPACE );
1049  if ( eState == SfxItemState::DONTCARE )
1050  rDestSet.InvalidateItem(SID_ATTR_PARA_LRSPACE);
1051  //xuxu for Line Space
1052  SvxLineSpacingItem aLineSP = aAttrSet.Get( EE_PARA_SBL );
1053  aLineSP.SetWhich(SID_ATTR_PARA_LINESPACE);
1054  rDestSet.Put(aLineSP);
1055  Invalidate(SID_ATTR_PARA_LINESPACE);
1056  eState = aAttrSet.GetItemState( EE_PARA_SBL );
1057  if ( eState == SfxItemState::DONTCARE )
1058  rDestSet.InvalidateItem(SID_ATTR_PARA_LINESPACE);
1059  //xuxu for UL Space
1060  SvxULSpaceItem aULSP = aAttrSet.Get( EE_PARA_ULSPACE );
1061  aULSP.SetWhich(SID_ATTR_PARA_ULSPACE);
1062  rDestSet.Put(aULSP);
1063  Invalidate(SID_ATTR_PARA_ULSPACE);
1064  Invalidate(SID_PARASPACE_INCREASE);
1065  Invalidate(SID_PARASPACE_DECREASE);
1066  eState = aAttrSet.GetItemState( EE_PARA_ULSPACE );
1067  if( eState >= SfxItemState::DEFAULT )
1068  {
1069  if ( !aULSP.GetUpper() && !aULSP.GetLower() )
1070  rDestSet.DisableItem( SID_PARASPACE_DECREASE );
1071  }
1072  else
1073  {
1074  rDestSet.DisableItem( SID_PARASPACE_INCREASE );
1075  rDestSet.DisableItem( SID_PARASPACE_DECREASE );
1076  rDestSet.InvalidateItem(SID_ATTR_PARA_ULSPACE);
1077  }
1078 
1079  // Line spacing
1080 
1081  sal_uInt16 nLineSpace = aAttrSet.Get( EE_PARA_SBL ).GetPropLineSpace();
1082  switch( nLineSpace )
1083  {
1084  case 100:
1085  rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_10, true ) );
1086  break;
1087  case 150:
1088  rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_15, true ) );
1089  break;
1090  case 200:
1091  rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_20, true ) );
1092  break;
1093  }
1094 
1095  // super-/subscript
1096  SvxEscapement eEsc = static_cast<SvxEscapement>(aAttrSet.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
1097  rDestSet.Put(SfxBoolItem(SID_SET_SUPER_SCRIPT, eEsc == SvxEscapement::Superscript));
1098  rDestSet.Put(SfxBoolItem(SID_SET_SUB_SCRIPT, eEsc == SvxEscapement::Subscript));
1099 
1100  // Underline
1101  eState = aAttrSet.GetItemState( EE_CHAR_UNDERLINE );
1102  if ( eState == SfxItemState::DONTCARE )
1103  {
1104  rDestSet.InvalidateItem( SID_ULINE_VAL_NONE );
1105  rDestSet.InvalidateItem( SID_ULINE_VAL_SINGLE );
1106  rDestSet.InvalidateItem( SID_ULINE_VAL_DOUBLE );
1107  rDestSet.InvalidateItem( SID_ULINE_VAL_DOTTED );
1108  }
1109  else
1110  {
1111  FontLineStyle eUnderline = aAttrSet.Get(EE_CHAR_UNDERLINE).GetLineStyle();
1112  rDestSet.Put(SfxBoolItem(SID_ULINE_VAL_SINGLE, eUnderline == LINESTYLE_SINGLE));
1113  rDestSet.Put(SfxBoolItem(SID_ULINE_VAL_DOUBLE, eUnderline == LINESTYLE_DOUBLE));
1114  rDestSet.Put(SfxBoolItem(SID_ULINE_VAL_DOTTED, eUnderline == LINESTYLE_DOTTED));
1115  rDestSet.Put(SfxBoolItem(SID_ULINE_VAL_NONE, eUnderline == LINESTYLE_NONE));
1116  }
1117 
1118  // horizontal / vertical
1119 
1120  bool bLeftToRight = true;
1121 
1122  SdrOutliner* pOutl = pView->GetTextEditOutliner();
1123  if( pOutl )
1124  {
1125  if( pOutl->IsVertical() )
1126  bLeftToRight = false;
1127  }
1128  else
1129  bLeftToRight = aAttrSet.Get( SDRATTR_TEXTDIRECTION ).GetValue() == css::text::WritingMode_LR_TB;
1130 
1131  if ( bDisableVerticalText )
1132  {
1133  rDestSet.DisableItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT );
1134  rDestSet.DisableItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM );
1135  }
1136  else
1137  {
1138  rDestSet.Put( SfxBoolItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT, bLeftToRight ) );
1139  rDestSet.Put( SfxBoolItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM, !bLeftToRight ) );
1140  }
1141 
1142  // left-to-right or right-to-left
1143 
1144  if ( !bLeftToRight || bDisableCTLFont )
1145  {
1146  // disabled if vertical
1147  rDestSet.DisableItem( SID_ATTR_PARA_LEFT_TO_RIGHT );
1148  rDestSet.DisableItem( SID_ATTR_PARA_RIGHT_TO_LEFT );
1149  }
1150  else if ( aAttrSet.GetItemState( EE_PARA_WRITINGDIR ) == SfxItemState::DONTCARE )
1151  {
1152  rDestSet.InvalidateItem( SID_ATTR_PARA_LEFT_TO_RIGHT );
1153  rDestSet.InvalidateItem( SID_ATTR_PARA_RIGHT_TO_LEFT );
1154  }
1155  else
1156  {
1157  SvxFrameDirection eAttrDir = aAttrSet.Get( EE_PARA_WRITINGDIR ).GetValue();
1158  if ( eAttrDir == SvxFrameDirection::Environment )
1159  {
1160  // get "environment" direction from page style
1161  if ( mrViewData.GetDocument().GetEditTextDirection( mrViewData.GetTabNo() ) == EEHorizontalTextDirection::R2L )
1162  eAttrDir = SvxFrameDirection::Horizontal_RL_TB;
1163  else
1164  eAttrDir = SvxFrameDirection::Horizontal_LR_TB;
1165  }
1166  rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_LEFT_TO_RIGHT, ( eAttrDir == SvxFrameDirection::Horizontal_LR_TB ) ) );
1167  rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_RIGHT_TO_LEFT, ( eAttrDir == SvxFrameDirection::Horizontal_RL_TB ) ) );
1168  }
1169 }
1170 
1172 {
1174  if ( nType == TransliterationFlags::NONE )
1175  return;
1176 
1177  ScDrawView* pView = mrViewData.GetScDrawView();
1178  OutlinerView* pOutView = pView->GetTextEditOutlinerView();
1179  if ( pOutView )
1180  {
1181  // change selected text in object
1182  pOutView->TransliterateText( nType );
1183  }
1184  else
1185  {
1187  }
1188 }
1189 
1191 {
1192  SfxWhichIter aIter( rSet );
1193  sal_uInt16 nWhich = aIter.FirstWhich();
1194 
1195  SdrView* pView = mrViewData.GetScDrawView();
1196 
1197  SfxItemSet aEditAttr(pView->GetModel()->GetItemPool());
1198  pView->GetAttributes(aEditAttr);
1199  //SfxItemSet aAttrs( *aEditAttr.GetPool(), aEditAttr.GetRanges() );
1200 
1201  while ( nWhich )
1202  {
1203  sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
1204  ? GetPool().GetSlotId(nWhich)
1205  : nWhich;
1206  switch ( nSlotId )
1207  {
1208  case SID_TABLE_VERT_NONE:
1209  case SID_TABLE_VERT_CENTER:
1210  case SID_TABLE_VERT_BOTTOM:
1211  bool bContour = false;
1212  SfxItemState eConState = aEditAttr.GetItemState( SDRATTR_TEXT_CONTOURFRAME );
1213  if( eConState != SfxItemState::DONTCARE )
1214  {
1215  bContour = aEditAttr.Get( SDRATTR_TEXT_CONTOURFRAME ).GetValue();
1216  }
1217  if (bContour) break;
1218 
1219  SfxItemState eVState = aEditAttr.GetItemState( SDRATTR_TEXT_VERTADJUST );
1220  //SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
1221 
1222  //if(SfxItemState::DONTCARE != eVState && SfxItemState::DONTCARE != eHState)
1223  if(SfxItemState::DONTCARE != eVState)
1224  {
1225  SdrTextVertAdjust eTVA = aEditAttr.Get(SDRATTR_TEXT_VERTADJUST).GetValue();
1226  bool bSet = (nSlotId == SID_TABLE_VERT_NONE && eTVA == SDRTEXTVERTADJUST_TOP) ||
1227  (nSlotId == SID_TABLE_VERT_CENTER && eTVA == SDRTEXTVERTADJUST_CENTER) ||
1228  (nSlotId == SID_TABLE_VERT_BOTTOM && eTVA == SDRTEXTVERTADJUST_BOTTOM);
1229  rSet.Put(SfxBoolItem(nSlotId, bSet));
1230  }
1231  else
1232  {
1233  rSet.Put(SfxBoolItem(nSlotId, false));
1234  }
1235  break;
1236  }
1237  nWhich = aIter.NextWhich();
1238  }
1239 }
1240 
1241 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OString stripEnd(const OString &rIn, char c)
void SetURL(const OUString &rURL)
SfxViewFrame * GetViewFrame() const
void Adjust()
#define LANGUAGE_NONE
OUString GetText(LineEnd eEnd=LINEEND_LF) const
void SetTargetFrame(const OUString &rFrm)
void ExecuteToggle(SfxRequest &rReq)
Definition: drtxtob.cxx:547
sal_Int32 nStartPara
static void HideDisabledSlot(SfxItemSet &rSet, SfxBindings &rBindings, sal_uInt16 nSlotId)
Definition: viewutil.cxx:285
SDRTEXTVERTADJUST_TOP
EESpellState StartThesaurus()
bool IsNoteEdit() const
Definition: drtxtob2.cxx:42
void PasteSpecial()
void PutItemForScriptType(SvtScriptType nScriptType, const SfxPoolItem &rItem)
#define SFX_IMPL_INTERFACE(Class, SuperClass)
void InsertText(const OUString &rNew, bool bSelect=false)
sal_uInt16 GetLower() const
#define LINE_SPACE_DEFAULT_HEIGHT
void SetEscapement(const SvxEscapement eNew)
static void PutItemScript(SfxItemSet &rShellSet, const SfxItemSet &rCoreSet, sal_uInt16 nWhichId, SvtScriptType nScript)
Definition: viewutil.cxx:49
void SelectFieldAtCursor()
virtual const SfxItemSet * GetOutputItemSet() const =0
std::string GetValue
css::uno::Reference< css::datatransfer::clipboard::XClipboard > GetClipboard()
static void StateDisableItems(SfxItemSet &rSet)
Definition: drtxtob.cxx:96
const OUString & GetTargetFrame() const
void ExecuteAttr(SfxRequest &rReq)
Definition: drtxtob.cxx:663
SfxDispatcher * GetDispatcher()
void ShowCursor(bool bGotoCursor=true, bool bActivate=false)
static SvxAbstractDialogFactory * Create()
tools::Long GetRight() const
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_TEXT_CONTOURFRAME(SDRATTR_MISC_FIRST+21)
void disposeAndClear()
FilterGroup & rTarget
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC(EE_CHAR_START+7)
static void OpenURL(const OUString &rURL, const OUString &rTarget, bool bIgnoreSettings=false)
Open the specified URL.
Definition: global.cxx:760
void InvalidateItem(sal_uInt16 nWhich)
sal_Int16 nId
sal_uInt16 FirstWhich()
void TransliterateText(TransliterationFlags nTransliterationMode)
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
SvxFrameDirection
void Done(bool bRemove=false)
sal_Int32 GetParagraphCount() const
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
void ChangeFontSize(bool bGrow, const FontList *pList)
constexpr TypedWhichId< SvxAdjustItem > EE_PARA_JUST(EE_PARA_START+15)
static bool HasThesaurusLanguage(LanguageType nLang)
Definition: scmod.cxx:2230
static SfxObjectShell * Current()
constexpr TypedWhichId< SvxFontItem > ATTR_FONT(100)
virtual SfxUndoManager * GetUndoManager()
const SfxItemSet * GetArgs() const
void Invalidate(sal_uInt16 nId)
void ExecutePasteContents(SfxRequest &rReq)
Definition: drtxtob1.cxx:100
bool HasFormat(SotClipboardFormatId nFormat) const
virtual SvxFontItem * Clone(SfxItemPool *pPool=nullptr) const override
bool IsVerticalTextEnabled() const
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
constexpr TypedWhichId< SvxLineSpacingItem > EE_PARA_SBL(EE_PARA_START+14)
SfxItemSet GetAttribs(sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags=GetAttribsFlags::ALL) const
constexpr TypedWhichId< SvxFrameDirectionItem > EE_PARA_WRITINGDIR(EE_PARA_START+0)
sal_uInt16 NextWhich()
void GetClipState(SfxItemSet &rSet)
Definition: drtxtob.cxx:487
void SetTargetFrame(const OUString &rTarget)
SfxUndoManager & GetUndoManager()
void SetPropLineSpace(const sal_uInt16 nProp)
LINESTYLE_NONE
constexpr TypedWhichId< SvxLRSpaceItem > EE_PARA_LRSPACE(EE_PARA_START+12)
constexpr TypedWhichId< SvxULSpaceItem > EE_PARA_ULSPACE(EE_PARA_START+13)
int nCount
static TransferableDataHelper CreateFromSystemClipboard(vcl::Window *pWindow)
ScViewData & mrViewData
Definition: drtxtob.hxx:38
Mode eMode
const SfxItemSet & GetDefaultAttr() const
void SetUndoManager(SfxUndoManager *pNewUndoMgr)
SotClipboardFormatId
static SvtScriptType GetScriptTypeOfLanguage(LanguageType nLang)
sal_Int32 nEndPos
virtual SvtScriptType GetScriptType() const
ScDrawView * GetScDrawView()
Definition: viewdata.cxx:3074
constexpr TypedWhichId< SvxContourItem > EE_CHAR_OUTLINE(EE_CHAR_START+8)
TransliterationFlags
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT(EE_CHAR_START+4)
EditView & GetEditView() const
SfxItemPool & GetPool() const
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:357
constexpr TypedWhichId< SvxShadowedItem > EE_CHAR_SHADOW(EE_CHAR_START+9)
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
SDRTEXTVERTADJUST_BOTTOM
constexpr TypedWhichId< SvxWritingModeItem > SDRATTR_TEXTDIRECTION(SDRATTR_NOTPERSIST_FIRST+34)
void Execute(SfxRequest &rReq)
Definition: drtxtob.cxx:141
void QuickSetAttribs(const SfxItemSet &rSet, const ESelection &rSel)
tools::Long GetTextLeft() const
sal_Int32 nEndPara
const SdrOutliner * GetTextEditOutliner() const
SvtScriptType
const OUString & GetURL() const
void ExecuteTrans(const SfxRequest &rReq)
Definition: drtxtob.cxx:1171
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
static void GetGlobalClipState(SfxItemSet &rSet)
Definition: drtxtob2.cxx:112
SvxAdjust
IMPL_LINK(ScDrawTextObjectBar, ClipboardChanged, TransferableDataHelper *, pDataHelper, void)
Definition: drtxtob.cxx:475
SfxBindings & GetBindings()
Definition: viewdata.cxx:3034
#define LANGUAGE_SYSTEM
void InvalidateDrawTextAttrs()
Definition: drawview.cxx:160
SfxBindings & GetBindings()
constexpr TypedWhichId< SdrTextVertAdjustItem > SDRATTR_TEXT_VERTADJUST(SDRATTR_MISC_FIRST+8)
const OUString & GetValue() const
ScDrawTextObjectBar(ScViewData &rData)
Definition: drtxtob.cxx:108
const T * GetArg(sal_uInt16 nSlotId) const
tools::Long GetLeft() const
bool SetAttributes(const SfxItemSet &rSet, bool bReplaceAll=false)
void SetPool(SfxItemPool *pNewPool)
OUString GetSelected() const
SvxLinkInsertMode
LINESTYLE_SINGLE
OUString ScResId(const char *pId)
Definition: scdll.cxx:95
ScGridWindow * GetActiveWin()
Definition: viewdata.cxx:3062
#define LANGUAGE_DONTKNOW
short GetTextFirstLineOffset() const
void Paste(bool bUseSpecial=false)
const OutlinerView * GetTextEditOutlinerView() const
HLINK_FIELD
Outliner * GetOutliner() const
static void CopyStringTo(const OUString &rContent, const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &rxClipboard, std::function< void(int, const char *)> *callback=nullptr)
sal_uInt16 GetSlotId(sal_uInt16 nWhich) const
void SetName(const OUString &rName)
void SetName(const OUString &rName)
weld::Window * GetDialogParent()
Definition: viewdata.cxx:3056
rtl::Reference< TransferableClipboardListener > mxClipEvtLstnr
Definition: drtxtob.hxx:39
void InsertField(const SvxFieldItem &rFld)
SfxItemPool * GetPool() const
void ExecuteGlobal(SfxRequest &rReq)
Definition: drtxtob2.cxx:49
static void RemoveURLField(EditView &pEditView)
const EditEngine & GetEditEngine() const
void QuickInsertText(const OUString &rText, const ESelection &rSel)
#define SFX_OBJECTBAR_OBJECT
size_t LeaveListAction()
ESelection GetSelection() const
virtual VclPtr< SfxAbstractTabDialog > CreateTextTabDialog(weld::Window *pParent, const SfxItemSet *pAttrSet, SdrView *pView)=0
virtual ~ScDrawTextObjectBar() override
Definition: drtxtob.cxx:127
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_uInt16 GetSlot() const
static const OUString & GetContextName(const Context eContext)
EEHorizontalTextDirection GetEditTextDirection(SCTAB nTab) const
Definition: documen8.cxx:355
constexpr TypedWhichId< SvxCrossedOutItem > EE_CHAR_STRIKEOUT(EE_CHAR_START+6)
void SetSelection(const ESelection &)
bool HasChildWindow(sal_uInt16)
HLINK_DEFAULT
bool HasRange() const
bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext(OUString &rStatusVal, LanguageType &rLang, const EditView &rEditView)
static ScTabViewShell * GetActiveViewShell()
Definition: tabvwsh4.cxx:1023
SfxItemState
virtual bool IsTextEdit() const final override
void DisableItem(sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
static TransliterationFlags GetTransliterationType(sal_uInt16 nSlotID)
Definition: viewutil.cxx:98
#define GetWhich(nSlot)
constexpr TypedWhichId< SvxEscapementItem > EE_CHAR_ESCAPEMENT(EE_CHAR_START+10)
LINESTYLE_DOTTED
virtual void Invalidate(sal_uInt16 nId=0)
bool ExecuteParaDlg(const SfxItemSet &rArgs, SfxItemSet &rOutSet)
Definition: drtxtob1.cxx:63
OUString aName
void GetAttributes(SfxItemSet &rTargetSet, bool bOnlyHardAttr=false) const
void GetPortions(sal_Int32 nPara, std::vector< sal_Int32 > &rList)
SfxDispatcher & GetDispatcher()
Definition: viewdata.cxx:3040
RET_OK
bool IsCTLFontEnabled() const
constexpr TypedWhichId< SfxBoolItem > EE_PARA_HYPHENATE(EE_PARA_START+6)
constexpr TypedWhichId< SvxOverlineItem > EE_CHAR_OVERLINE(EE_CHAR_START+29)
virtual void EnterListAction(const OUString &rComment, const OUString &rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId)
vcl::Window * GetWindow() const
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:401
void GetStatePropPanelAttr(SfxItemSet &)
Definition: drtxtob.cxx:1190
const SvxFieldData * GetFieldAtCursor() const
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
const SfxItemSet & GetEmptyItemSet() const
void SetUpdateMode(bool bUpdate)
SdrEndTextEditKind ScEndTextEdit()
Definition: drawview.cxx:892
static void ExecuteCharMap(const SvxFontItem &rOldFont, SfxViewFrame &rFrame)
Definition: viewutil.cxx:320
void GetState(SfxItemSet &rSet)
Definition: drtxtob.cxx:362
void AddClipbrdFormat(SotClipboardFormatId nId)
SvxEscapement
constexpr TypedWhichId< SvxUnderlineItem > EE_CHAR_UNDERLINE(EE_CHAR_START+5)
const OUString & GetName() const
SvxLinkInsertMode GetInsertMode() const
SfxObjectShell * GetSfxDocShell() const
Definition: viewdata.hxx:358
bool IsUndoEnabled() const
Definition: document.hxx:1531
SfxItemSet GetAttribs()
void GetAttrState(SfxItemSet &rSet)
Definition: drtxtob.cxx:962
const SfxItemPool & GetItemPool() const
constexpr sal_uInt16 EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
LINESTYLE_DOUBLE
const FontList * GetFontList() const
static void lcl_RemoveFields(OutlinerView &rOutView)
Definition: drtxtob.cxx:587
LanguageType GetInputLanguage() const
FontLineStyle
sal_uInt16 ScGetFontWorkId()
Definition: drtxtob2.cxx:37
bool ExecuteCharDlg(const SfxItemSet &rArgs, SfxItemSet &rOutSet, sal_uInt16 nSlot)
Definition: drtxtob1.cxx:40
SdrModel * GetModel() const
static bool IsCursorAtURLField(const EditView &pEditView)
void SetContextName(const OUString &rsContextName)
SdrTextVertAdjust
virtual SfxObjectShell * GetObjectShell()
void EDITENG_DLLPUBLIC ReplaceTextWithSynonym(EditView &rEditView, const OUString &rSynonmText)
static bool IsWhich(sal_uInt16 nId)
bool GetUpdateMode() const
sal_uInt16 nPos
sal_uInt16 GetUpper() const
SDRTEXTVERTADJUST_CENTER
sal_Int32 nStartPos
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo
void Paint(const tools::Rectangle &rRect, OutputDevice *pTargetDevice=nullptr)