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