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
73using namespace ::com::sun::star;
74using namespace ::com::sun::star::uno;
75using namespace ::com::sun::star::beans;
76using namespace ::com::sun::star::i18n;
77
79
80void 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 m_pSdrView = rSh.GetDrawView();
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 m_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 m_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 {
165 }
166}
167
169{
170 return m_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& rVFrame = GetView().GetViewFrame();
179 if ( rReq.GetArgs() )
180 {
181 rVFrame.SetChildWindow(SvxFontWorkChildWindow::GetChildWindowId(),
182 static_cast<const SfxBoolItem&>( (rReq.GetArgs()->
183 Get(SID_FONTWORK))).GetValue());
184 }
185 else
186 rVFrame.ToggleChildWindow(SvxFontWorkChildWindow::GetChildWindowId());
187
188 rVFrame.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 = DynCastSdrTextObj(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();
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
286 Reference<XComponentContext> xContext = comphelper::getProcessComponentContext();
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 m_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 {
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 (m_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 {
439 m_pSdrView->GetAttributes( aNewAttr );
443 &aNewAttr, m_pSdrView ));
444 sal_uInt16 nResult = pDlg->Execute();
445
446 if (nResult == RET_OK)
447 {
449 {
450 m_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();
462 {
464 if (nSId == SID_TABLE_VERT_CENTER)
466 else if (nSId == SID_TABLE_VERT_BOTTOM)
468
470 m_pSdrView->GetAttributes( aNewAttr );
471 aNewAttr.Put(SdrTextVertAdjustItem(eTVA));
472 m_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& rSfxViewFrame = GetView().GetViewFrame();
530 rSfxViewFrame.ExecuteSlot(rReq, rSfxViewFrame.GetInterface());
531 }
532}
533
534// State of undo
535
537{
538 if ( !IsTextEdit() )
539 return;
540
541 SfxViewFrame& rSfxViewFrame = 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();
561 }
562 else
563 {
564 nCount = pUndoManager->GetRedoActionCount();
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 rSfxViewFrame.GetSlotState(nWhich, rSfxViewFrame.GetInterface(), &rSet);
589 if (pUndoManager)
590 pUndoManager->SetView(nullptr);
591 }
592 }
593
594 nWhich = aIter.NextWhich();
595 }
596}
597
599{
600 if (!m_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 (!m_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 SfxStringItem* pItem = nullptr;
679 if( pArgs )
680 pItem = pArgs->GetItemIfSet(SID_CHARMAP, false);
681
682 OUString sSym;
683 OUString sFontName;
684 if ( pItem )
685 {
686 sSym = pItem->GetValue();
687 const SfxStringItem* pFontItem = pArgs->GetItemIfSet( SID_ATTR_SPECIALCHAR, false);
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 {
703 TypedWhichId<SvxFontItem> nFontWhich =
705 SID_ATTR_CHAR_FONT,
707 aSetDlgFont.reset(aSet.Get( nFontWhich ).Clone());
708 }
709 if (sFontName.isEmpty())
710 sFontName = aSetDlgFont->GetFamilyName();
711 }
712
713 vcl::Font aFont(sFontName, Size(1,1));
714 if(sSym.isEmpty())
715 {
716 SfxAllItemSet aAllSet( GetPool() );
717 aAllSet.Put( SfxBoolItem( FN_PARAM_1, false ) );
718
720 const OUString& sSymbolFont = aOpt.GetSymbolFont();
721 if( !sSymbolFont.isEmpty() )
722 aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) );
723 else
724 aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont->GetFamilyName() ) );
725
726 // If character is selected, it can be shown
730 pDlg->Execute();
731 return;
732 }
733
734 // do not flicker
735 pOLV->HideCursor();
737 pOutliner->SetUpdateLayout(false);
738
739 SfxItemSet aOldSet( pOLV->GetAttribs() );
742 EE_CHAR_FONTINFO_CJK, EE_CHAR_FONTINFO_CTL> aFontSet( *aOldSet.GetPool() );
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(),
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->SetUpdateLayout(true);
780 pOLV->ShowCursor();
781
782 rReq.AppendItem( SfxStringItem( 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 m_pSdrView = rSh.GetDrawView();
794 return &pOutliner->GetUndoManager();
795}
796
798{
799 SfxWhichIter aIter( rSet );
800 sal_uInt16 nWhich = aIter.FirstWhich();
801
802 SwWrtShell &rSh = GetShell();
803 m_pSdrView = rSh.GetDrawView();
804
806 m_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;
820 if( eConState != SfxItemState::DONTCARE )
821 {
822 bContour = aAttrs.Get( SDRATTR_TEXT_CONTOURFRAME ).GetValue();
823 }
824 if (bContour) break;
825
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: */
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:34
sal_uInt16 GetValue() const
const OUString & GetValue() const
void RemoveFields(const std::function< bool(const SvxFieldData *)> &isFieldData=[](const SvxFieldData *){return true;})
EditEngine * GetEditEngine() const
void SetSelection(const ESelection &)
SvtScriptType GetSelectedScriptType() const
void StartTextConversion(weld::Widget *pDialogParent, LanguageType nSrcLang, LanguageType nDestLang, const vcl::Font *pDestFont, sal_Int32 nOptions, bool bIsInteractive, bool bMultipleDoc)
void InsertText(const OUString &rNew, bool bSelect=false)
void TransliterateText(TransliterationFlags nTransliterationMode)
tools::Rectangle const & GetOutputArea() const
EESpellState StartThesaurus(weld::Widget *pDialogParent)
void HideCursor(bool bDeactivate=false)
ESelection GetSelection() const
SfxItemSet GetAttribs()
Outliner * GetOutliner() const
void SetAttribs(const SfxItemSet &)
void RemoveAttribsKeepLanguages(bool bRemoveParaAttribs)
void SelectRange(sal_Int32 nFirst, sal_Int32 nCount)
EditView & GetEditView() const
void ShowCursor(bool bGotoCursor=true, bool bActivate=false)
bool IsModified() const
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
TransliterationFlags getNextMode()
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
const SdrMarkList & GetMarkedObjectList() const
bool AreObjectsMarked() const
SdrObject * GetMarkedSdrObj() const
const SfxItemPool & GetItemPool() const
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false)
const OutlinerView * GetTextEditOutlinerView() const
virtual bool IsTextEdit() const final override
const SdrOutliner * GetTextEditOutliner() const
SdrModel & GetModel() const
virtual bool HasText() const override
bool SetAttributes(const SfxItemSet &rSet, bool bReplaceAll=false)
void GetAttributes(SfxItemSet &rTargetSet, bool bOnlyHardAttr=false) const
void Invalidate(sal_uInt16 nId)
void InvalidateAll(bool bWithMsg)
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
SfxItemPool * GetSecondaryPool() const
sal_uInt16 GetSlotId(sal_uInt16 nWhich) const
static bool IsWhich(sal_uInt16 nId)
SfxItemPool * GetPool() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void DisableItem(sal_uInt16 nWhich)
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
sal_uInt16 GetSlot() const
const SfxItemSet * GetArgs() const
void AppendItem(const SfxPoolItem &)
weld::Window * GetFrameWeld() const
void Done(bool bRemove=false)
const SfxPoolItem * GetSlotState(sal_uInt16 nSlotId, const SfxInterface *pIF=nullptr, SfxItemSet *pStateSet=nullptr)
void SetUndoManager(SfxUndoManager *pNewUndoMgr)
SfxItemPool & GetPool() const
void SetContextName(const OUString &rsContextName)
virtual SfxInterface * GetInterface() const
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
void SetPool(SfxItemPool *pNewPool)
void SetName(const OUString &rName)
void SetString(const OUString &)
virtual bool Undo()
OUString GetRedoActionComment(size_t nNo=0, bool const i_currentLevel=CurrentLevel) const
OUString GetUndoActionComment(size_t nNo=0, bool const i_currentLevel=CurrentLevel) const
static bool const TopLevel
virtual bool Redo()
virtual size_t GetRedoActionCount(bool const i_currentLevel=CurrentLevel) const
virtual size_t GetUndoActionCount(bool const i_currentLevel=CurrentLevel) const
void ToggleChildWindow(sal_uInt16)
SfxBindings & GetBindings()
void SetChildWindow(sal_uInt16 nId, bool bVisible, bool bSetFocus=true)
SfxFrame & GetFrame() const
weld::Window * GetFrameWeld() const
SfxViewFrame & GetViewFrame() const
sal_uInt16 FirstWhich()
sal_uInt16 NextWhich()
virtual VclPtr< SfxAbstractDialog > CreateCharMapDialog(weld::Window *pParent, const SfxItemSet &rAttr, const css::uno::Reference< css::frame::XFrame > &rFrame)=0
virtual VclPtr< SfxAbstractTabDialog > CreateTextTabDialog(weld::Window *pParent, const SfxItemSet *pAttrSet, SdrView *pView)=0
static SvxAbstractDialogFactory * Create()
const SfxPoolItem * GetItemOfScript(SvtScriptType nScript) const
SvtScriptType GetAllScriptsOfText(const OUString &rText) const
Definition: breakit.cxx:128
SfxShell subclass that is used while interacting with the editeng-based text of a shape.
Definition: drwtxtsh.hxx:32
void ExecDrawLingu(SfxRequest const &rReq)
Definition: drwtxtsh.cxx:264
void ExecTransliteration(SfxRequest const &)
Definition: drwtxtsh.cxx:598
SwView & m_rView
Definition: drwtxtsh.hxx:33
void ExecUndo(SfxRequest &rReq)
Definition: drwtxtsh.cxx:492
SwDrawTextShell(SwView &rView)
Definition: drwtxtsh.cxx:118
void GetFormTextState(SfxItemSet &rSet)
Definition: drwtxtsh.cxx:227
void ExecRotateTransliteration(SfxRequest const &)
Definition: drwtxtsh.cxx:654
virtual SfxUndoManager * GetUndoManager() override
Definition: drwtxtsh.cxx:789
void GetStatePropPanelAttr(SfxItemSet &)
Definition: drwtxtsh.cxx:797
void ExecDraw(SfxRequest &)
Definition: drwtxtsh.cxx:354
virtual ~SwDrawTextShell() override
Definition: drwtxtsh.cxx:132
void ExecFormText(SfxRequest const &rReq)
Definition: drwtxtsh.cxx:199
SdrView * m_pSdrView
Definition: drwtxtsh.hxx:36
void SetAttrToMarked(const SfxItemSet &rAttr)
Definition: drwtxtsh.cxx:157
void StateUndo(SfxItemSet &rSet)
Definition: drwtxtsh.cxx:536
void StateFontWork(SfxItemSet &rSet)
Definition: drwtxtsh.cxx:191
SwWrtShell & GetShell()
Definition: drwtxtsh.cxx:138
bool IsTextEdit() const
Definition: drwtxtsh.cxx:168
static void StateDisableItems(SfxItemSet &)
Definition: drwtxtsh.cxx:145
void InsertSymbol(SfxRequest &rReq)
Definition: drwtxtsh.cxx:672
void ExecFontWork(SfxRequest const &rReq)
Definition: drwtxtsh.cxx:173
SwView & GetView()
Definition: drwtxtsh.hxx:50
RotateTransliteration m_aRotateCase
Definition: drwtxtsh.hxx:34
void SetModified()
Definition: edws.cxx:70
void EndTextEdit()
Deletes object if required.
Definition: feshview.cxx:1193
const OUString & GetSymbolFont() const
Definition: viewopt.hxx:739
bool IsOnlineSpell() const
Definition: viewopt.hxx:537
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:452
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:648
SdrView * GetDrawView()
Definition: vnew.cxx:386
Definition: view.hxx:146
SwWrtShell & GetWrtShell() const
Definition: view.hxx:423
void ResetSubShell()
Definition: view.hxx:593
void ExitDraw()
Definition: viewdraw.cxx:389
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void Edit()
Definition: wrtsh1.cxx:188
const SwView & GetView() const
Definition: wrtsh.hxx:443
static const OUString & GetContextName(const Context eContext)
FontFamily GetFamilyType()
const OUString & GetStyleName() const
const OUString & GetFamilyName() const
FontPitch GetPitch()
rtl_TextEncoding GetCharSet() const
#define FN_ESCAPE
Definition: cmdid.h:712
#define FN_DRAWTEXT_ATTR_DLG
Definition: cmdid.h:260
#define FN_INSERT_STRING
Definition: cmdid.h:235
int nCount
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:19
EEControlBits
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CJK(EE_CHAR_START+17)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CTL(EE_CHAR_START+18)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
FieldUnit
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
sal_uInt16 GetWhichOfScript(sal_uInt16 nWhich, sal_uInt16 nScript)
Definition: hints.cxx:184
LanguageType GetAppLanguage()
Definition: init.cxx:741
sal_Int64 n
#define LANGUAGE_CHINESE_TRADITIONAL
#define LANGUAGE_CHINESE_SIMPLIFIED
#define LANGUAGE_KOREAN
SvtScriptType
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
sal_Int16 GetI18NScriptTypeOfLanguage(LanguageType nLang)
@ Exception
css::uno::Sequence< css::uno::Any > InitAnyPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
Reference< XComponentContext > getProcessComponentContext()
#define SFX_OBJECTBAR_OBJECT
sal_Int16 nId
const char GetValue[]
SfxItemState
SdrTextVertAdjust
SDRTEXTVERTADJUST_BOTTOM
SDRTEXTVERTADJUST_CENTER
SDRTEXTVERTADJUST_TOP
static SfxItemSet & rSet
#define SFX_IMPL_INTERFACE(Class, SuperClass)
sal_Int32 nStartPara
sal_Int32 nEndPos
sal_Int32 nStartPos
sal_Int32 nEndPara
Reference< XFrame > xFrame
constexpr TypedWhichId< SdrTextVertAdjustItem > SDRATTR_TEXT_VERTADJUST(SDRATTR_MISC_FIRST+8)
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_TEXT_CONTOURFRAME(SDRATTR_MISC_FIRST+21)
SVXCORE_DLLPUBLIC SdrTextObj * DynCastSdrTextObj(SdrObject *)
#define SW_MOD()
Definition: swmodule.hxx:254
#define CHAR_HARDBLANK
Definition: swtypes.hxx:173
#define CHAR_LRM
Definition: swtypes.hxx:177
#define CHAR_SOFTHYPHEN
Definition: swtypes.hxx:175
#define CHAR_WJ
Definition: swtypes.hxx:179
#define CHAR_HARDHYPHEN
Definition: swtypes.hxx:174
#define CHAR_RLM
Definition: swtypes.hxx:176
#define CHAR_ZWSP
Definition: swtypes.hxx:178
#define CHAR_NNBSP
Definition: swtypes.hxx:180
TransliterationFlags
sal_uInt16 sal_Unicode
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:756
RET_OK
constexpr TypedWhichId< XFormTextMirrorItem > XATTR_FORMTXTMIRROR(XATTR_TEXT_FIRST+4)
constexpr TypedWhichId< XFormTextStyleItem > XATTR_FORMTXTSTYLE(XATTR_TEXT_FIRST)
constexpr TypedWhichId< XFormTextStartItem > XATTR_FORMTXTSTART(XATTR_TEXT_FIRST+3)
constexpr TypedWhichId< XFormTextShadowYValItem > XATTR_FORMTXTSHDWYVAL(XATTR_TEXT_FIRST+9)
constexpr TypedWhichId< XFormTextHideFormItem > XATTR_FORMTXTHIDEFORM(XATTR_TEXT_FIRST+10)
constexpr TypedWhichId< XFormTextDistanceItem > XATTR_FORMTXTDISTANCE(XATTR_TEXT_FIRST+2)
constexpr TypedWhichId< XFormTextShadowItem > XATTR_FORMTXTSHADOW(XATTR_TEXT_FIRST+6)
constexpr TypedWhichId< XFormTextOutlineItem > XATTR_FORMTXTOUTLINE(XATTR_TEXT_FIRST+5)
constexpr TypedWhichId< XFormTextShadowXValItem > XATTR_FORMTXTSHDWXVAL(XATTR_TEXT_FIRST+8)
constexpr TypedWhichId< XFormTextShadowColorItem > XATTR_FORMTXTSHDWCOLOR(XATTR_TEXT_FIRST+7)
constexpr TypedWhichId< XFormTextAdjustItem > XATTR_FORMTXTADJUST(XATTR_TEXT_FIRST+1)