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