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