LibreOffice Module sw (master)  1
drwtxtsh.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 <hintids.hxx>
21 #include <i18nlangtag/lang.h>
23 #include <svl/slstitm.hxx>
24 #include <svl/stritem.hxx>
25 #include <svl/cjkoptions.hxx>
26 #include <editeng/fontitem.hxx>
27 #include <editeng/langitem.hxx>
28 #include <svx/svdview.hxx>
29 #include <sfx2/viewfrm.hxx>
30 #include <sfx2/objface.hxx>
31 #include <svx/svdotext.hxx>
32 #include <svx/sdooitm.hxx>
33 #include <svx/svxids.hrc>
34 #include <editeng/editeng.hxx>
35 #include <editeng/editview.hxx>
36 #include <editeng/eeitem.hxx>
38 #include <sfx2/bindings.hxx>
39 #include <svx/fontwork.hxx>
40 #include <sfx2/request.hxx>
41 #include <vcl/EnumContext.hxx>
42 #include <svl/whiter.hxx>
43 #include <editeng/outliner.hxx>
44 #include <editeng/editstat.hxx>
45 #include <svx/svdoutl.hxx>
46 #include <com/sun/star/i18n/TextConversionOption.hpp>
47 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
48 #include <com/sun/star/lang/XInitialization.hpp>
49 #include <com/sun/star/beans/XPropertySet.hpp>
50 #include <com/sun/star/awt/XWindow.hpp>
51 #include <com/sun/star/uno/XComponentContext.hpp>
53 #include <swtypes.hxx>
54 #include <view.hxx>
55 #include <wrtsh.hxx>
56 #include <viewopt.hxx>
57 #include <initui.hxx>
58 #include <drwtxtsh.hxx>
59 #include <swundo.hxx>
60 #include <breakit.hxx>
61 
62 #include <cmdid.h>
63 #include <globals.hrc>
64 
65 #define ShellClass_SwDrawTextShell
66 #include <sfx2/msg.hxx>
67 #include <swslots.hxx>
68 #include <uitool.hxx>
69 #include <wview.hxx>
70 #include <swmodule.hxx>
71 #include <svx/dialogs.hrc>
72 #include <svx/svdoashp.hxx>
73 #include <svx/svxdlg.hxx>
74 #include <svx/xtable.hxx>
75 #include <cppuhelper/bootstrap.hxx>
77 #include <swabstdlg.hxx>
78 #include <IDocumentUndoRedo.hxx>
79 #include <memory>
80 
81 using namespace ::com::sun::star;
82 using namespace ::com::sun::star::uno;
83 using namespace ::com::sun::star::beans;
84 using namespace ::com::sun::star::i18n;
85 
87 
88 void SwDrawTextShell::InitInterface_Impl()
89 {
90  GetStaticInterface()->RegisterPopupMenu("drawtext");
91 
92  GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT, SfxVisibilityFlags::Invisible, ToolbarId::Draw_Text_Toolbox_Sw);
93 
94  GetStaticInterface()->RegisterChildWindow(SvxFontWorkChildWindow::GetChildWindowId());
95 }
96 
97 
99 {
100  SwWrtShell &rSh = GetShell();
101  pSdrView = rSh.GetDrawView();
102  SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
103  //#97471# mouse click _and_ key input at the same time
104  if( !pOutliner )
105  return ;
107  EEControlBits nCtrl = pOutliner->GetControlWord();
108  nCtrl |= EEControlBits::AUTOCORRECT;
109 
110  SetUndoManager(&pOutliner->GetUndoManager());
111 
112  // Now let's try an AutoSpell.
113 
114  const SwViewOption* pVOpt = rSh.GetViewOptions();
115  if(pVOpt->IsOnlineSpell())
116  {
117  nCtrl |= EEControlBits::ONLINESPELLING|EEControlBits::ALLOWBIGOBJS;
118  }
119  else
120  nCtrl &= ~EEControlBits::ONLINESPELLING;
121 
122  pOutliner->SetControlWord(nCtrl);
123  pOLV->ShowCursor();
124 }
125 
127  SfxShell(&rV),
128  rView(rV)
129 {
130  SwWrtShell &rSh = GetShell();
132 
133  Init();
134 
135  rSh.NoEdit();
136  SetName("ObjectText");
138 }
139 
141 {
142  if ( GetView().GetCurShell() == this )
144 }
145 
147 {
148  return rView.GetWrtShell();
149 }
150 
151 // Disable slots with this status method
152 
154 {
155  SfxWhichIter aIter(rSet);
156  sal_uInt16 nWhich = aIter.FirstWhich();
157 
158  while (nWhich)
159  {
160  rSet.DisableItem( nWhich );
161  nWhich = aIter.NextWhich();
162  }
163 }
164 
166 {
168  tools::Rectangle aOutRect = pOLV->GetOutputArea();
169 
170  if (tools::Rectangle() != aOutRect)
171  {
172  GetShell().GetDrawView()->SetAttributes(rAttr);
173  }
174 }
175 
177 {
178  return pSdrView->IsTextEdit();
179 }
180 
182 {
183  SwWrtShell &rSh = GetShell();
184  FieldUnit eMetric = ::GetDfltMetric( dynamic_cast<SwWebView*>( &rSh.GetView()) != nullptr );
185  SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
186  SfxViewFrame* pVFrame = GetView().GetViewFrame();
187  if ( rReq.GetArgs() )
188  {
189  pVFrame->SetChildWindow(SvxFontWorkChildWindow::GetChildWindowId(),
190  static_cast<const SfxBoolItem&>( (rReq.GetArgs()->
191  Get(SID_FONTWORK))).GetValue());
192  }
193  else
194  pVFrame->ToggleChildWindow(SvxFontWorkChildWindow::GetChildWindowId());
195 
196  pVFrame->GetBindings().Invalidate(SID_FONTWORK);
197 }
198 
200 {
201  const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
202  rSet.Put(SfxBoolItem(SID_FONTWORK, GetView().GetViewFrame()->HasChildWindow(nId)));
203 }
204 
205 // Edit SfxRequests for FontWork
206 
208 {
209  SwWrtShell &rSh = GetShell();
210  SdrView* pDrView = rSh.GetDrawView();
211 
212  const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
213 
214  if ( rMarkList.GetMarkCount() == 1 && rReq.GetArgs() )
215  {
216  const SfxItemSet& rSet = *rReq.GetArgs();
217 
218  if ( pDrView->IsTextEdit() )
219  {
220  //#111733# Sometimes SdrEndTextEdit() initiates the change in selection and
221  // 'this' is not valid anymore
222  SwView& rTempView = GetView();
223  pDrView->SdrEndTextEdit(true);
224  //this removes the current shell from the dispatcher stack!!
225  rTempView.AttrChangedNotify(&rSh);
226  }
227 
228  pDrView->SetAttributes(rSet);
229  }
230 
231 }
232 
233 // Return Status values back to FontWork
234 
236 {
237  SwWrtShell &rSh = GetShell();
238  SdrView* pDrView = rSh.GetDrawView();
239  const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
240  const SdrObject* pObj = nullptr;
241 
242  if ( rMarkList.GetMarkCount() == 1 )
243  pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
244 
245  const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >(pObj);
246  const bool bDeactivate(
247  !pObj ||
248  !pTextObj ||
249  !pTextObj->HasText() ||
250  dynamic_cast< const SdrObjCustomShape* >(pObj)); // #121538# no FontWork for CustomShapes
251 
252  if (bDeactivate)
253  {
265  }
266  else
267  {
268  pDrView->GetAttributes( rSet );
269  }
270 }
271 
273 {
274  SwWrtShell &rSh = GetShell();
275  OutlinerView* pOutlinerView = pSdrView->GetTextEditOutlinerView();
277  {
278  switch(rReq.GetSlot())
279  {
280  case SID_THESAURUS:
281  pOutlinerView->StartThesaurus();
282  break;
283 
284  case SID_HANGUL_HANJA_CONVERSION:
285  pOutlinerView->StartTextConversion(LANGUAGE_KOREAN, LANGUAGE_KOREAN, nullptr,
286  i18n::TextConversionOption::CHARACTER_BY_CHARACTER, true, false);
287  break;
288 
289  case SID_CHINESE_CONVERSION:
290  {
291  //open ChineseTranslationDialog
293  if (!xContext.is())
294  return;
295 
296  Reference<lang::XMultiComponentFactory> xMCF(xContext->getServiceManager());
297  if (!xMCF.is())
298  return;
299 
300  Reference<ui::dialogs::XExecutableDialog> xDialog(
301  xMCF->createInstanceWithContext("com.sun.star.linguistic2.ChineseTranslationDialog", xContext), UNO_QUERY);
302 
303  Reference<lang::XInitialization> xInit(xDialog, UNO_QUERY);
304 
305  if (!xInit.is())
306  return;
307 
308  // initialize dialog
309  uno::Sequence<uno::Any> aSequence(comphelper::InitAnyPropertySequence(
310  {
311  {"ParentWindow", uno::Any(Reference<awt::XWindow>())}
312  }));
313  xInit->initialize( aSequence );
314 
315  //execute dialog
316  sal_Int16 nDialogRet = xDialog->execute();
317  if(RET_OK == nDialogRet)
318  {
319  //get some parameters from the dialog
320  bool bToSimplified = true;
321  bool bUseVariants = true;
322  bool bCommonTerms = true;
323  Reference<beans::XPropertySet> xPropertySet(xDialog, UNO_QUERY);
324  if (xPropertySet.is())
325  {
326  try
327  {
328  xPropertySet->getPropertyValue("IsDirectionToSimplified") >>= bToSimplified;
329  xPropertySet->getPropertyValue("IsUseCharacterVariants") >>= bUseVariants;
330  xPropertySet->getPropertyValue("IsTranslateCommonTerms") >>= bCommonTerms;
331  }
332  catch (const Exception&)
333  {
334  }
335  }
336 
337  //execute translation
340  sal_Int32 nOptions = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0;
341  if(!bCommonTerms)
342  nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
343 
344  vcl::Font aTargetFont = OutputDevice::GetDefaultFont(DefaultFontType::CJK_TEXT, nTargetLang, GetDefaultFontFlags::OnlyOne);
345 
346  pOutlinerView->StartTextConversion(nSourceLang, nTargetLang, &aTargetFont, nOptions, false, false);
347  }
348 
349  Reference<lang::XComponent> xComponent(xDialog, UNO_QUERY);
350  if (xComponent.is())
351  xComponent->dispose();
352  }
353  break;
354 
355  default:
356  OSL_ENSURE(false, "unexpected slot-id");
357  }
358  }
359 }
360 
362 {
363  SwWrtShell &rSh = GetShell();
364  pSdrView = rSh.GetDrawView();
366 
367  switch (rReq.GetSlot())
368  {
369  case FN_INSERT_SOFT_HYPHEN:
370  case FN_INSERT_HARDHYPHEN:
371  case FN_INSERT_HARD_SPACE:
372  case FN_INSERT_NNBSP:
373  case SID_INSERT_RLM :
374  case SID_INSERT_LRM :
375  case SID_INSERT_ZWNBSP :
376  case SID_INSERT_ZWSP:
377  {
378  sal_Unicode cIns = 0;
379  switch(rReq.GetSlot())
380  {
381  case FN_INSERT_SOFT_HYPHEN: cIns = CHAR_SOFTHYPHEN; break;
382  case FN_INSERT_HARDHYPHEN: cIns = CHAR_HARDHYPHEN; break;
383  case FN_INSERT_HARD_SPACE: cIns = CHAR_HARDBLANK; break;
384  case FN_INSERT_NNBSP: cIns = CHAR_NNBSP; break;
385  case SID_INSERT_RLM : cIns = CHAR_RLM ; break;
386  case SID_INSERT_LRM : cIns = CHAR_LRM ; break;
387  case SID_INSERT_ZWSP : cIns = CHAR_ZWSP ; break;
388  case SID_INSERT_ZWNBSP: cIns = CHAR_ZWNBSP; break;
389  }
390  pOLV->InsertText( OUString(cIns));
391  rReq.Done();
392  }
393  break;
394  case SID_CHARMAP:
395  { // Insert special character
396  InsertSymbol(rReq);
397  break;
398  }
399  case FN_INSERT_STRING:
400  {
401  const SfxItemSet *pNewAttrs = rReq.GetArgs();
402  sal_uInt16 nSlot = rReq.GetSlot();
403  const SfxPoolItem* pItem = nullptr;
404  if(pNewAttrs)
405  {
406  pNewAttrs->GetItemState(nSlot, false, &pItem );
407  pOLV->InsertText(static_cast<const SfxStringItem *>(pItem)->GetValue());
408  }
409  break;
410  }
411 
412  case SID_SELECTALL:
413  {
414  SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
415  if(pOutliner)
416  {
417  sal_Int32 nParaCount = pOutliner->GetParagraphCount();
418  if (nParaCount > 0)
419  pOLV->SelectRange(0, nParaCount );
420  }
421  }
422  break;
423 
424  case FN_FORMAT_RESET: // delete hard text attributes
425  {
426  pOLV->RemoveAttribsKeepLanguages( true );
428  rReq.Done();
429  }
430  break;
431 
432  case FN_ESCAPE:
433  if (pSdrView->IsTextEdit())
434  {
435  // Shell switch!
436  rSh.EndTextEdit();
437  SwView& rTempView = rSh.GetView();
438  rTempView.ExitDraw();
439  rSh.Edit();
440  return;
441  }
442  break;
444  {
445  SfxItemSet aNewAttr( pSdrView->GetModel()->GetItemPool() );
446  pSdrView->GetAttributes( aNewAttr );
449  GetView().GetFrameWeld(),
450  &aNewAttr, pSdrView ));
451  sal_uInt16 nResult = pDlg->Execute();
452 
453  if (nResult == RET_OK)
454  {
455  if (pSdrView->AreObjectsMarked())
456  {
457  pSdrView->SetAttributes(*pDlg->GetOutputItemSet());
458  rReq.Done(*(pDlg->GetOutputItemSet()));
459  }
460  }
461  }
462  break;
463  case SID_TABLE_VERT_NONE:
464  case SID_TABLE_VERT_CENTER:
465  case SID_TABLE_VERT_BOTTOM:
466  {
467  sal_uInt16 nSId = rReq.GetSlot();
468  if (pSdrView->AreObjectsMarked())
469  {
471  if (nSId == SID_TABLE_VERT_CENTER)
473  else if (nSId == SID_TABLE_VERT_BOTTOM)
475 
476  SfxItemSet aNewAttr( pSdrView->GetModel()->GetItemPool() );
477  pSdrView->GetAttributes( aNewAttr );
478  aNewAttr.Put(SdrTextVertAdjustItem(eTVA));
479  pSdrView->SetAttributes(aNewAttr);
480  rReq.Done();
481  }
482 
483  }
484  break;
485 
486  default:
487  OSL_ENSURE(false, "unexpected slot-id");
488  return;
489  }
490 
492 
493  if (IsTextEdit() && pOLV->GetOutliner()->IsModified())
494  rSh.SetModified();
495 }
496 
497 // Execute undo
498 
500 {
501  if( IsTextEdit() )
502  {
503  bool bCallBase = true;
504  const SfxItemSet* pArgs = rReq.GetArgs();
505  if( pArgs )
506  {
507  sal_uInt16 nId = rReq.GetSlot(), nCnt = 1;
508  const SfxPoolItem* pItem;
509  switch( nId )
510  {
511  case SID_UNDO:
512  case SID_REDO:
513  if( SfxItemState::SET == pArgs->GetItemState( nId, false, &pItem ) &&
514  1 < (nCnt = static_cast<const SfxUInt16Item*>(pItem)->GetValue()) )
515  {
516  // then we make by ourself.
517  SfxUndoManager* pUndoManager = GetUndoManager();
518  if( pUndoManager )
519  {
520  if( SID_UNDO == nId )
521  while( nCnt-- )
522  pUndoManager->Undo();
523  else
524  while( nCnt-- )
525  pUndoManager->Redo();
526  }
527  bCallBase = false;
529  }
530  break;
531  }
532  }
533  if( bCallBase )
534  {
535  SfxViewFrame *pSfxViewFrame = GetView().GetViewFrame();
536  pSfxViewFrame->ExecuteSlot(rReq, pSfxViewFrame->GetInterface());
537  }
538  }
539 }
540 
541 // State of undo
542 
544 {
545  if ( !IsTextEdit() )
546  return;
547 
548  SfxViewFrame *pSfxViewFrame = GetView().GetViewFrame();
549  SfxWhichIter aIter(rSet);
550  sal_uInt16 nWhich = aIter.FirstWhich();
551  while( nWhich )
552  {
553  switch ( nWhich )
554  {
555  case SID_GETUNDOSTRINGS:
556  case SID_GETREDOSTRINGS:
557  {
558  SfxUndoManager* pUndoManager = GetUndoManager();
559  if( pUndoManager )
560  {
561  OUString (SfxUndoManager:: *fnGetComment)( size_t, bool const ) const;
562 
563  sal_uInt16 nCount;
564  if( SID_GETUNDOSTRINGS == nWhich )
565  {
566  nCount = pUndoManager->GetUndoActionCount();
567  fnGetComment = &SfxUndoManager::GetUndoActionComment;
568  }
569  else
570  {
571  nCount = pUndoManager->GetRedoActionCount();
572  fnGetComment = &SfxUndoManager::GetRedoActionComment;
573  }
574  if( nCount )
575  {
576  OUStringBuffer sList;
577  for( sal_uInt16 n = 0; n < nCount; ++n )
578  sList.append( (pUndoManager->*fnGetComment)( n, SfxUndoManager::TopLevel ) ).append("\n");
579 
580  SfxStringListItem aItem( nWhich );
581  aItem.SetString( sList.makeStringAndClear() );
582  rSet.Put( aItem );
583  }
584  }
585  else
586  rSet.DisableItem( nWhich );
587  }
588  break;
589 
590  default:
591  {
592  auto* pUndoManager = dynamic_cast<IDocumentUndoRedo*>(GetUndoManager());
593  if (pUndoManager)
594  pUndoManager->SetView(&GetView());
595  pSfxViewFrame->GetSlotState(nWhich, pSfxViewFrame->GetInterface(), &rSet);
596  if (pUndoManager)
597  pUndoManager->SetView(nullptr);
598  }
599  }
600 
601  nWhich = aIter.NextWhich();
602  }
603 }
604 
606 {
607  if (!pSdrView)
608  return;
609 
610  using namespace i18n;
611 
612  TransliterationFlags nMode = TransliterationFlags::NONE;
613 
614  switch( rReq.GetSlot() )
615  {
616  case SID_TRANSLITERATE_SENTENCE_CASE:
617  nMode = TransliterationFlags::SENTENCE_CASE;
618  break;
619  case SID_TRANSLITERATE_TITLE_CASE:
620  nMode = TransliterationFlags::TITLE_CASE;
621  break;
622  case SID_TRANSLITERATE_TOGGLE_CASE:
623  nMode = TransliterationFlags::TOGGLE_CASE;
624  break;
625  case SID_TRANSLITERATE_UPPER:
626  nMode = TransliterationFlags::LOWERCASE_UPPERCASE;
627  break;
628  case SID_TRANSLITERATE_LOWER:
629  nMode = TransliterationFlags::UPPERCASE_LOWERCASE;
630  break;
631 
632  case SID_TRANSLITERATE_HALFWIDTH:
633  nMode = TransliterationFlags::FULLWIDTH_HALFWIDTH;
634  break;
635  case SID_TRANSLITERATE_FULLWIDTH:
636  nMode = TransliterationFlags::HALFWIDTH_FULLWIDTH;
637  break;
638 
639  case SID_TRANSLITERATE_HIRAGANA:
640  nMode = TransliterationFlags::KATAKANA_HIRAGANA;
641  break;
642  case SID_TRANSLITERATE_KATAKANA:
643  nMode = TransliterationFlags::HIRAGANA_KATAKANA;
644  break;
645 
646  default:
647  OSL_ENSURE(false, "wrong dispatcher");
648  }
649 
650  if( nMode != TransliterationFlags::NONE )
651  {
653 
654  if (!pOLV)
655  return;
656 
657  pOLV->TransliterateText( nMode );
658  }
659 }
660 
662 {
663  if( rReq.GetSlot() == SID_TRANSLITERATE_ROTATE_CASE )
664  {
665  if (!pSdrView)
666  return;
667 
669 
670  if (!pOLV)
671  return;
672 
674  }
675 }
676 
677 // Insert special character (see SDraw: FUBULLET.CXX)
678 
680 {
682  if(!pOLV)
683  return;
684  const SfxItemSet *pArgs = rReq.GetArgs();
685  const SfxPoolItem* pItem = nullptr;
686  if( pArgs )
687  pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), false, &pItem);
688 
689  OUString sSym;
690  OUString sFontName;
691  if ( pItem )
692  {
693  sSym = static_cast<const SfxStringItem*>(pItem)->GetValue();
694  const SfxPoolItem* pFtItem = nullptr;
695  pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), false, &pFtItem);
696  const SfxStringItem* pFontItem = dynamic_cast<const SfxStringItem*>( pFtItem );
697  if ( pFontItem )
698  sFontName = pFontItem->GetValue();
699  }
700 
701  SfxItemSet aSet(pOLV->GetAttribs());
702  SvtScriptType nScript = pOLV->GetSelectedScriptType();
703  std::shared_ptr<SvxFontItem> aSetDlgFont(std::make_shared<SvxFontItem>(RES_CHRATR_FONT));
704  {
705  SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() );
706  aSetItem.GetItemSet().Put( aSet, false );
707  const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript );
708  if( pI )
709  aSetDlgFont.reset(static_cast<SvxFontItem*>(pI->Clone()));
710  else
711  aSetDlgFont.reset(static_cast<SvxFontItem*>(aSet.Get( GetWhichOfScript(
712  SID_ATTR_CHAR_FONT,
714  if (sFontName.isEmpty())
715  sFontName = aSetDlgFont->GetFamilyName();
716  }
717 
718  vcl::Font aFont(sFontName, Size(1,1));
719  if(sSym.isEmpty())
720  {
721  SfxAllItemSet aAllSet( GetPool() );
722  aAllSet.Put( SfxBoolItem( FN_PARAM_1, false ) );
723 
725  const OUString& sSymbolFont = aOpt.GetSymbolFont();
726  if( !sSymbolFont.isEmpty() )
727  aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) );
728  else
729  aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont->GetFamilyName() ) );
730 
731  // If character is selected, it can be shown
735  pDlg->Execute();
736  return;
737  }
738 
739  // do not flicker
740  pOLV->HideCursor();
741  SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
742  pOutliner->SetUpdateMode(false);
743 
744  SfxItemSet aOldSet( pOLV->GetAttribs() );
745  SfxItemSet aFontSet(
746  *aOldSet.GetPool(),
747  svl::Items<
748  EE_CHAR_FONTINFO, EE_CHAR_FONTINFO,
750  aFontSet.Set( aOldSet );
751 
752  // Insert string
753  pOLV->InsertText( sSym );
754 
755  // assign attributes (Set font)
756  SfxItemSet aFontAttribSet( *aFontSet.GetPool(), aFontSet.GetRanges() );
757  SvxFontItem aFontItem (aFont.GetFamilyType(), aFont.GetFamilyName(),
758  aFont.GetStyleName(), aFont.GetPitch(),
759  aFont.GetCharSet(),
760  EE_CHAR_FONTINFO );
761  nScript = g_pBreakIt->GetAllScriptsOfText( sSym );
762  if( SvtScriptType::LATIN & nScript )
763  aFontAttribSet.Put( aFontItem );
764  if( SvtScriptType::ASIAN & nScript )
765  {
766  aFontItem.SetWhich(EE_CHAR_FONTINFO_CJK);
767  aFontAttribSet.Put( aFontItem );
768  }
769  if( SvtScriptType::COMPLEX & nScript )
770  {
771  aFontItem.SetWhich(EE_CHAR_FONTINFO_CTL);
772  aFontAttribSet.Put( aFontItem );
773  }
774  pOLV->SetAttribs(aFontAttribSet);
775 
776  // Remove selection
777  ESelection aSel(pOLV->GetSelection());
778  aSel.nStartPara = aSel.nEndPara;
779  aSel.nStartPos = aSel.nEndPos;
780  pOLV->SetSelection(aSel);
781 
782  // Restore old font
783  pOLV->SetAttribs( aFontSet );
784 
785  // From now on show again
786  pOutliner->SetUpdateMode(true);
787  pOLV->ShowCursor();
788 
789  rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), sSym ) );
790  if(!aFont.GetFamilyName().isEmpty())
791  rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aFont.GetFamilyName() ) );
792  rReq.Done();
793 
794 }
795 
797 {
798  SwWrtShell &rSh = GetShell();
799  pSdrView = rSh.GetDrawView();
800  SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
801  return &pOutliner->GetUndoManager();
802 }
803 
805 {
806  SfxWhichIter aIter( rSet );
807  sal_uInt16 nWhich = aIter.FirstWhich();
808 
809  SwWrtShell &rSh = GetShell();
810  pSdrView = rSh.GetDrawView();
811 
812  SfxItemSet aAttrs( pSdrView->GetModel()->GetItemPool() );
813  pSdrView->GetAttributes( aAttrs );
814 
815  while ( nWhich )
816  {
817  sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
818  ? GetPool().GetSlotId(nWhich)
819  : nWhich;
820  switch ( nSlotId )
821  {
822  case SID_TABLE_VERT_NONE:
823  case SID_TABLE_VERT_CENTER:
824  case SID_TABLE_VERT_BOTTOM:
825  bool bContour = false;
826  SfxItemState eConState = aAttrs.GetItemState( SDRATTR_TEXT_CONTOURFRAME );
827  if( eConState != SfxItemState::DONTCARE )
828  {
829  bContour = aAttrs.Get( SDRATTR_TEXT_CONTOURFRAME ).GetValue();
830  }
831  if (bContour) break;
832 
833  SfxItemState eVState = aAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST );
834  //SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
835 
836  //if(SfxItemState::DONTCARE != eVState && SfxItemState::DONTCARE != eHState)
837  if(SfxItemState::DONTCARE != eVState)
838  {
839  SdrTextVertAdjust eTVA = aAttrs.Get(SDRATTR_TEXT_VERTADJUST).GetValue();
840  bool bSet = (nSlotId == SID_TABLE_VERT_NONE && eTVA == SDRTEXTVERTADJUST_TOP) ||
841  (nSlotId == SID_TABLE_VERT_CENTER && eTVA == SDRTEXTVERTADJUST_CENTER) ||
842  (nSlotId == SID_TABLE_VERT_BOTTOM && eTVA == SDRTEXTVERTADJUST_BOTTOM);
843  rSet.Put(SfxBoolItem(nSlotId, bSet));
844  }
845  else
846  {
847  rSet.Put(SfxBoolItem(nSlotId, false));
848  }
849  break;
850  }
851  nWhich = aIter.NextWhich();
852  }
853 }
854 
855 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
SfxViewFrame * GetViewFrame() const
void ExitDraw()
Definition: viewdraw.cxx:390
void GetFormTextState(SfxItemSet &rSet)
Definition: drwtxtsh.cxx:235
#define EE_CHAR_FONTINFO
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
FieldUnit
sal_Int32 nStartPara
SDRTEXTVERTADJUST_TOP
void ExecTransliteration(SfxRequest const &)
Definition: drwtxtsh.cxx:605
EESpellState StartThesaurus()
void ExecUndo(SfxRequest &rReq)
Definition: drwtxtsh.cxx:499
size_t GetMarkCount() const
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false)
const OUString & GetFamilyName() const
#define SFX_IMPL_INTERFACE(Class, SuperClass)
SdrView * GetDrawView()
Definition: vnew.cxx:376
void InsertText(const OUString &rNew, bool bSelect=false)
#define CHAR_NNBSP
Definition: swtypes.hxx:179
SdrView * pSdrView
Definition: drwtxtsh.hxx:35
void RemoveAttribsKeepLanguages(bool bRemoveParaAttribs)
std::string GetValue
const OUString & GetStyleName() const
void ExecRotateTransliteration(SfxRequest const &)
Definition: drwtxtsh.cxx:661
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
tools::Rectangle const & GetOutputArea() const
bool AreObjectsMarked() const
void ShowCursor(bool bGotoCursor=true, bool bActivate=false)
static SvxAbstractDialogFactory * Create()
void ExecFontWork(SfxRequest const &rReq)
Definition: drwtxtsh.cxx:181
Reference< XFrame > xFrame
#define LANGUAGE_KOREAN
bool IsTextEdit()
Definition: drwtxtsh.cxx:176
void StateFontWork(SfxItemSet &rSet)
Definition: drwtxtsh.cxx:199
SvtScriptType GetAllScriptsOfText(const OUString &rText) const
Definition: breakit.cxx:127
sal_Int16 nId
sal_uInt16 FirstWhich()
#define CHAR_HARDBLANK
Definition: swtypes.hxx:172
#define RES_CHRATR_FONT
Definition: hintids.hxx:75
void TransliterateText(TransliterationFlags nTransliterationMode)
void Done(bool bRemove=false)
SdrMark * GetMark(size_t nNum) const
void RemoveFields(const std::function< bool(const SvxFieldData *)> &isFieldData=[](const SvxFieldData *){return true;})
void SetModified()
Definition: edws.cxx:69
const SfxItemSet * GetArgs() const
void Invalidate(sal_uInt16 nId)
void ResetSubShell()
Definition: view.hxx:569
EEControlBits
virtual bool Undo()
#define CHAR_RLM
Definition: swtypes.hxx:175
virtual bool HasText() const override
void NoEdit(bool bHideCursor=true)
Definition: wrtsh1.cxx:160
FontFamily GetFamilyType()
sal_uInt16 NextWhich()
SwWrtShell & GetWrtShell() const
Definition: view.hxx:400
#define CHAR_SOFTHYPHEN
Definition: swtypes.hxx:174
virtual bool Redo()
Used by the UI to modify the document model.
Definition: wrtsh.hxx:88
void ToggleChildWindow(sal_uInt16)
sal_uInt16 sal_Unicode
const SwView & GetView() const
Definition: wrtsh.hxx:426
void ExecDraw(SfxRequest &)
Definition: drwtxtsh.cxx:361
void Edit()
Definition: wrtsh1.cxx:166
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:33
SfxFrame & GetFrame() const
void SelectRange(sal_Int32 nFirst, sal_Int32 nCount)
#define XATTR_FORMTXTSHADOW
void GetStatePropPanelAttr(SfxItemSet &)
Definition: drwtxtsh.cxx:804
void SetUndoManager(SfxUndoManager *pNewUndoMgr)
#define XATTR_FORMTXTSHDWXVAL
virtual size_t GetRedoActionCount(bool const i_currentLevel=CurrentLevel) const
SwView & rView
Definition: drwtxtsh.hxx:32
TransliterationFlags
EditView & GetEditView() const
void StateUndo(SfxItemSet &rSet)
Definition: drwtxtsh.cxx:543
css::uno::Reference< css::lang::XComponent > xComponent
SfxItemPool & GetPool() const
static void StateDisableItems(SfxItemSet &)
Definition: drwtxtsh.cxx:153
#define XATTR_FORMTXTADJUST
SdrObject * GetMarkedSdrObj() const
SDRTEXTVERTADJUST_BOTTOM
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:614
const SdrOutliner * GetTextEditOutliner() const
SvtScriptType
RotateTransliteration m_aRotateCase
Definition: drwtxtsh.hxx:33
#define SW_MOD()
Definition: swmodule.hxx:256
#define XATTR_FORMTXTSTART
FontPitch GetPitch()
void SetAttribs(const SfxItemSet &)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:710
const SfxPoolItem * GetSlotState(sal_uInt16 nSlotId, const SfxInterface *pIF=nullptr, SfxItemSet *pStateSet=nullptr)
css::uno::Sequence< css::uno::Any > InitAnyPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
#define SDRATTR_TEXT_VERTADJUST
EditEngine * GetEditEngine() const
void ExecFormText(SfxRequest const &rReq)
Definition: drwtxtsh.cxx:207
SfxBindings & GetBindings()
const OUString & GetValue() const
const SdrMarkList & GetMarkedObjectList() const
bool SetAttributes(const SfxItemSet &rSet, bool bReplaceAll=false)
void SetPool(SfxItemPool *pNewPool)
#define XATTR_FORMTXTOUTLINE
static sal_Int16 GetI18NScriptTypeOfLanguage(LanguageType nLang)
SvtScriptType GetSelectedScriptType() const
weld::Window * GetFrameWeld(SfxFrame *pFrame)
Definition: dialoghelp.cxx:20
sal_uInt16 GetWhichOfScript(sal_uInt16 nWhich, sal_uInt16 nScript)
Definition: hints.cxx:195
#define XATTR_FORMTXTHIDEFORM
bool IsModified() const
TransliterationFlags getNextMode()
const OutlinerView * GetTextEditOutlinerView() const
#define LANGUAGE_CHINESE_SIMPLIFIED
void SetString(const OUString &)
#define CHAR_ZWSP
Definition: swtypes.hxx:177
Outliner * GetOutliner() const
virtual VclPtr< SfxAbstractDialog > CreateCharMapDialog(weld::Window *pParent, const SfxItemSet &rAttr, const css::uno::Reference< css::frame::XFrame > &rFrame)=0
#define FN_DRAWTEXT_ATTR_DLG
Definition: cmdid.h:232
sal_uInt16 GetSlotId(sal_uInt16 nWhich) const
#define XATTR_FORMTXTSHDWYVAL
#define SDRATTR_TEXT_CONTOURFRAME
void SetName(const OUString &rName)
#define XATTR_FORMTXTSHDWCOLOR
void HideCursor(bool bDeactivate=false)
virtual size_t GetUndoActionCount(bool const i_currentLevel=CurrentLevel) const
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
const OUString & GetSymbolFont() const
Definition: viewopt.hxx:536
#define SFX_OBJECTBAR_OBJECT
#define FN_INSERT_STRING
Definition: cmdid.h:209
ESelection GetSelection() const
virtual VclPtr< SfxAbstractTabDialog > CreateTextTabDialog(weld::Window *pParent, const SfxItemSet *pAttrSet, SdrView *pView)=0
SfxItemPool * GetSecondaryPool() const
#define XATTR_FORMTXTDISTANCE
#define CHAR_LRM
Definition: swtypes.hxx:176
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
OUString GetUndoActionComment(size_t nNo=0, bool const i_currentLevel=CurrentLevel) const
SwView & GetView()
Definition: drwtxtsh.hxx:49
sal_uInt16 GetSlot() const
static const OUString & GetContextName(const Context eContext)
#define CHAR_HARDHYPHEN
Definition: swtypes.hxx:173
void SetSelection(const ESelection &)
SfxItemState
#define EE_CHAR_FONTINFO_CJK
virtual bool IsTextEdit() const final override
void DisableItem(sal_uInt16 nWhich)
weld::Window * GetFrameWeld() const
OUString GetRedoActionComment(size_t nNo=0, bool const i_currentLevel=CurrentLevel) const
#define GetWhich(nSlot)
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:426
void GetAttributes(SfxItemSet &rTargetSet, bool bOnlyHardAttr=false) const
LanguageType GetAppLanguage()
Definition: init.cxx:765
RET_OK
void SetChildWindow(sal_uInt16 nId, bool bVisible, bool bSetFocus=true)
SwDrawTextShell(SwView &rView)
Definition: drwtxtsh.cxx:126
void ExecDrawLingu(SfxRequest const &rReq)
Definition: drwtxtsh.cxx:272
void EndTextEdit()
Deletes object if required.
Definition: feshview.cxx:1235
Reference< XComponentContext > getProcessComponentContext()
SwWrtShell & GetShell()
Definition: drwtxtsh.cxx:146
void SetAttrToMarked(const SfxItemSet &rAttr)
Definition: drwtxtsh.cxx:165
virtual void SetView(SwView *pView)=0
Return undo/redo info for this view.
#define CHAR_ZWNBSP
Definition: swtypes.hxx:178
virtual SfxInterface * GetInterface() const
#define XATTR_FORMTXTSTYLE
void StartTextConversion(LanguageType nSrcLang, LanguageType nDestLang, const vcl::Font *pDestFont, sal_Int32 nOptions, bool bIsInteractive, bool bMultipleDoc)
void InvalidateAll(bool bWithMsg)
void AppendItem(const SfxPoolItem &)
#define LANGUAGE_CHINESE_TRADITIONAL
#define XATTR_FORMTXTMIRROR
SfxItemSet GetAttribs()
SVX_DLLPUBLIC MSO_SPT Get(const OUString &)
const SfxItemPool & GetItemPool() const
void InsertSymbol(SfxRequest &rReq)
Definition: drwtxtsh.cxx:679
#define EE_CHAR_FONTINFO_CTL
#define FN_ESCAPE
Definition: cmdid.h:655
SdrModel * GetModel() const
void SetContextName(const OUString &rsContextName)
SdrTextVertAdjust
static bool IsWhich(sal_uInt16 nId)
rtl_TextEncoding GetCharSet() const
Definition: view.hxx:146
virtual ~SwDrawTextShell() override
Definition: drwtxtsh.cxx:140
SDRTEXTVERTADJUST_CENTER
virtual SfxUndoManager * GetUndoManager() override
Definition: drwtxtsh.cxx:796
static bool const TopLevel