LibreOffice Module sc (master) 1
drtxtob.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 <comphelper/string.hxx>
21#include <scitems.hxx>
22
25#include <svx/clipfmtitem.hxx>
28#include <editeng/eeitem.hxx>
29#include <editeng/editeng.hxx>
30#include <editeng/editview.hxx>
32#include <editeng/flditem.hxx>
33#include <editeng/flstitem.hxx>
34#include <editeng/fontitem.hxx>
36#include <editeng/lrspitem.hxx>
37#include <editeng/lspcitem.hxx>
38#include <editeng/ulspitem.hxx>
40#include <svx/hlnkitem.hxx>
41#include <svx/svdoutl.hxx>
42#include <svx/sdooitm.hxx>
43#include <editeng/postitem.hxx>
45#include <editeng/shdditem.hxx>
46#include <editeng/udlnitem.hxx>
47#include <editeng/wghtitem.hxx>
49#include <sfx2/dispatch.hxx>
50#include <sfx2/objface.hxx>
51#include <sfx2/objsh.hxx>
52#include <sfx2/request.hxx>
53#include <sfx2/viewfrm.hxx>
55#include <vcl/transfer.hxx>
56#include <svl/stritem.hxx>
57#include <svl/whiter.hxx>
59#include <svl/cjkoptions.hxx>
60#include <svl/ctloptions.hxx>
61
62#include <svx/svxdlg.hxx>
63#include <vcl/EnumContext.hxx>
64#include <vcl/unohelp2.hxx>
65
66#include <sc.hrc>
67#include <globstr.hrc>
68#include <scresid.hxx>
69#include <scmod.hxx>
70#include <drtxtob.hxx>
71#include <viewdata.hxx>
72#include <document.hxx>
73#include <drawview.hxx>
74#include <viewutil.hxx>
75#include <tabvwsh.hxx>
76#include <gridwin.hxx>
77
78#define ShellClass_ScDrawTextObjectBar
79#include <scslots.hxx>
80
81using namespace ::com::sun::star;
82
84
85void ScDrawTextObjectBar::InitInterface_Impl()
86{
87 GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT,
88 SfxVisibilityFlags::Standard | SfxVisibilityFlags::Server,
89 ToolbarId::Text_Toolbox_Sc);
90
91 GetStaticInterface()->RegisterPopupMenu("drawtext");
92
93 GetStaticInterface()->RegisterChildWindow(ScGetFontWorkId());
94}
95
96
97// disable not wanted accelerators
98
100{
101 SfxWhichIter aIter(rSet);
102 sal_uInt16 nWhich = aIter.FirstWhich();
103
104 while (nWhich)
105 {
106 rSet.DisableItem( nWhich );
107 nWhich = aIter.NextWhich();
108 }
109}
110
112 SfxShell(rData.GetViewShell()),
113 mrViewData(rData),
114 bPastePossible(false)
115{
117
118 // At the switching-over the UndoManager is changed to edit mode
120 SetUndoManager( pMgr );
122 {
123 pMgr->SetMaxUndoActionCount( 0 );
124 }
125
126 SetName("DrawText");
128}
129
131{
132 if ( mxClipEvtLstnr.is() )
133 {
134 mxClipEvtLstnr->RemoveListener( mrViewData.GetActiveWin() );
135
136 // The listener may just now be waiting for the SolarMutex and call the link
137 // afterwards, in spite of RemoveListener. So the link has to be reset, too.
138 mxClipEvtLstnr->ClearCallbackLink();
139 }
140}
141
142// Functions
143
145{
147 OutlinerView* pOutView = pView->GetTextEditOutlinerView();
148 Outliner* pOutliner = pView->GetTextEditOutliner();
149
150 if (!pOutView || !pOutliner)
151 {
152 ExecuteGlobal( rReq ); // on whole objects
153 return;
154 }
155
156 const SfxItemSet* pReqArgs = rReq.GetArgs();
157 sal_uInt16 nSlot = rReq.GetSlot();
158 switch ( nSlot )
159 {
160 case SID_COPY:
161 pOutView->Copy();
162 break;
163
164 case SID_CUT:
165 pOutView->Cut();
166 break;
167
168 case SID_PASTE:
169 pOutView->PasteSpecial();
170 break;
171
172 case SID_CLIPBOARD_FORMAT_ITEMS:
173 {
174 SotClipboardFormatId nFormat = SotClipboardFormatId::NONE;
175 const SfxPoolItem* pItem;
176 if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET )
177 if (auto pIntItem = dynamic_cast<const SfxUInt32Item*>( pItem))
178 nFormat = static_cast<SotClipboardFormatId>(pIntItem->GetValue());
179
180 if ( nFormat != SotClipboardFormatId::NONE )
181 {
182 if (nFormat == SotClipboardFormatId::STRING)
183 pOutView->Paste();
184 else
185 pOutView->PasteSpecial();
186 }
187 }
188 break;
189
190 case SID_PASTE_SPECIAL:
191 ExecutePasteContents( rReq );
192 break;
193
194 case SID_PASTE_UNFORMATTED:
195 pOutView->Paste();
196 break;
197
198 case SID_SELECTALL:
199 {
200 sal_Int32 nCount = pOutliner->GetParagraphCount();
201 ESelection aSel( 0,0,nCount,0 );
202 pOutView->SetSelection( aSel );
203 }
204 break;
205
206 case SID_CHARMAP:
207 {
208 auto const attribs = pOutView->GetAttribs();
209 const SvxFontItem& rItem = attribs.Get(EE_CHAR_FONTINFO);
210
211 OUString aString;
212 std::shared_ptr<SvxFontItem> aNewItem(std::make_shared<SvxFontItem>(EE_CHAR_FONTINFO));
213
214 const SfxItemSet *pArgs = rReq.GetArgs();
215 const SfxPoolItem* pItem = nullptr;
216 if( pArgs )
217 pArgs->GetItemState(SID_CHARMAP, false, &pItem);
218
219 if ( pItem )
220 {
221 aString = static_cast<const SfxStringItem*>(pItem)->GetValue();
222 const SfxStringItem* pFontItem = pArgs->GetItemIfSet( SID_ATTR_SPECIALCHAR, false);
223 if ( pFontItem )
224 {
225 const OUString& aFontName(pFontItem->GetValue());
226 vcl::Font aFont(aFontName, Size(1,1)); // Size only because of CTOR
227 aNewItem = std::make_shared<SvxFontItem>(
228 aFont.GetFamilyType(), aFont.GetFamilyName(),
229 aFont.GetStyleName(), aFont.GetPitch(),
230 aFont.GetCharSet(), ATTR_FONT);
231 }
232 else
233 {
234 aNewItem.reset(rItem.Clone());
235 }
236 }
237 else
239
240 if ( !aString.isEmpty() )
241 {
242 SfxItemSet aSet( pOutliner->GetEmptyItemSet() );
243 // tdf#125054
244 // checked against original, indeed aNewItem looks as if it can have
245 // either WhichID EE_CHAR_FONTINFO or ATTR_FONT when it was reset
246 // above, original uses '= SvxFontItem(..., ATTR_FONT).
247 // BUT beware: the operator=() did not copy the WhichID when resetting,
248 // so it indeed has WhichID of EE_CHAR_FONTINFO despite copying an Item
249 // that was constructed using ATTR_FONT as WhichID (!)
250 aSet.Put( *aNewItem, EE_CHAR_FONTINFO );
251
252 // If nothing is selected, then SetAttribs of the View selects a word
253 pOutView->GetOutliner()->QuickSetAttribs( aSet, pOutView->GetSelection() );
254 pOutView->InsertText(aString);
255 }
256
257 Invalidate( SID_ATTR_CHAR_FONT );
258 }
259 break;
260
261 case SID_HYPERLINK_SETLINK:
262 if( pReqArgs )
263 {
264 if ( const SvxHyperlinkItem* pHyper = pReqArgs->GetItemIfSet( SID_HYPERLINK_SETLINK) )
265 {
266 const OUString& rName = pHyper->GetName();
267 const OUString& rURL = pHyper->GetURL();
268 const OUString& rTarget = pHyper->GetTargetFrame();
269 SvxLinkInsertMode eMode = pHyper->GetInsertMode();
270
271 bool bDone = false;
273 {
274 pOutView->SelectFieldAtCursor();
275
276 // insert new field
277 SvxURLField aURLField( rURL, rName, SvxURLFormat::Repr );
278 aURLField.SetTargetFrame( rTarget );
279 SvxFieldItem aURLItem( aURLField, EE_FEATURE_FIELD );
280 pOutView->InsertField( aURLItem );
281
282 bDone = true;
283 }
284
285 if (!bDone)
286 ExecuteGlobal( rReq ); // normal at View
287
288 // If "text" is received by InsertURL of ViewShell, then the DrawShell is turned off !!!
289 }
290 }
291 break;
292
293 case SID_OPEN_HYPERLINK:
294 if (const SvxFieldData* pField = pOutView->GetFieldAtCursor())
295 {
296 if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
297 {
298 ScGlobal::OpenURL(pURLField->GetURL(), pURLField->GetTargetFrame(), true);
299 }
300 }
301 break;
302
303 case SID_EDIT_HYPERLINK:
304 {
305 // Ensure the field is selected first
306 pOutView->SelectFieldAtCursor();
307 mrViewData.GetViewShell()->GetViewFrame().GetDispatcher()->Execute(SID_HYPERLINK_DIALOG);
308 }
309 break;
310
311 case SID_COPY_HYPERLINK_LOCATION:
312 {
313 const SvxFieldData* pField = pOutView->GetFieldAtCursor();
314 if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
315 {
316 uno::Reference<datatransfer::clipboard::XClipboard> xClipboard
317 = pOutView->GetWindow()->GetClipboard();
318 vcl::unohelper::TextDataObject::CopyStringTo(pURLField->GetURL(), xClipboard);
319 }
320 }
321 break;
322
323 case SID_REMOVE_HYPERLINK:
324 {
325 // Ensure the field is selected first
327 }
328 break;
329
330 case SID_ENABLE_HYPHENATION:
331 case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
332 case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
333 pView->ScEndTextEdit(); // end text edit before switching direction
334 ExecuteGlobal( rReq );
335 // restore consistent state between shells and functions:
336 mrViewData.GetDispatcher().Execute(SID_OBJECT_SELECT, SfxCallMode::SLOT | SfxCallMode::RECORD);
337 break;
338
339 case SID_THES:
340 {
341 OUString aReplaceText;
342 const SfxStringItem* pItem2 = rReq.GetArg(FN_PARAM_THES_WORD_REPLACE);
343 if (pItem2)
344 aReplaceText = pItem2->GetValue();
345 if (!aReplaceText.isEmpty())
346 ReplaceTextWithSynonym( pOutView->GetEditView(), aReplaceText );
347 }
348 break;
349
350 case SID_THESAURUS:
351 {
352 pOutView->StartThesaurus(rReq.GetFrameWeld());
353 }
354 break;
355 }
356}
357
359{
361 bool bHasFontWork = rViewFrm.HasChildWindow(SID_FONTWORK);
362 bool bDisableFontWork = false;
363
364 if (IsNoteEdit())
365 {
366 // #i21255# notes now support rich text formatting (#i74140# but not fontwork)
367 bDisableFontWork = true;
368 }
369
370 if ( bDisableFontWork )
371 rSet.DisableItem( SID_FONTWORK );
372 else
373 rSet.Put(SfxBoolItem(SID_FONTWORK, bHasFontWork));
374
375 if ( rSet.GetItemState( SID_HYPERLINK_GETLINK ) != SfxItemState::UNKNOWN )
376 {
377 SvxHyperlinkItem aHLinkItem;
379 OutlinerView* pOutView = pView->GetTextEditOutlinerView();
380 if ( pOutView )
381 {
382 bool bField = false;
383 const SvxFieldData* pField = pOutView->GetFieldAtCursor();
384 if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
385 {
386 aHLinkItem.SetName( pURLField->GetRepresentation() );
387 aHLinkItem.SetURL( pURLField->GetURL() );
388 aHLinkItem.SetTargetFrame( pURLField->GetTargetFrame() );
389 bField = true;
390 }
391
392 if (!bField)
393 {
394 // use selected text as name for urls
395 OUString sReturn = pOutView->GetSelected();
396 sal_Int32 nLen = std::min<sal_Int32>(sReturn.getLength(), 255);
397 sReturn = sReturn.copy(0, nLen);
398 aHLinkItem.SetName(comphelper::string::stripEnd(sReturn, ' '));
399 }
400 }
401 rSet.Put(aHLinkItem);
402 }
403
404 if (rSet.GetItemState(SID_OPEN_HYPERLINK) != SfxItemState::UNKNOWN
405 || rSet.GetItemState(SID_EDIT_HYPERLINK) != SfxItemState::UNKNOWN
406 || rSet.GetItemState(SID_COPY_HYPERLINK_LOCATION) != SfxItemState::UNKNOWN
407 || rSet.GetItemState(SID_REMOVE_HYPERLINK) != SfxItemState::UNKNOWN)
408 {
411 {
412 rSet.DisableItem( SID_OPEN_HYPERLINK );
413 rSet.DisableItem( SID_EDIT_HYPERLINK );
414 rSet.DisableItem( SID_COPY_HYPERLINK_LOCATION );
415 rSet.DisableItem( SID_REMOVE_HYPERLINK );
416 }
417 }
418
419 if( rSet.GetItemState( SID_TRANSLITERATE_HALFWIDTH ) != SfxItemState::UNKNOWN )
420 ScViewUtil::HideDisabledSlot( rSet, rViewFrm.GetBindings(), SID_TRANSLITERATE_HALFWIDTH );
421 if( rSet.GetItemState( SID_TRANSLITERATE_FULLWIDTH ) != SfxItemState::UNKNOWN )
422 ScViewUtil::HideDisabledSlot( rSet, rViewFrm.GetBindings(), SID_TRANSLITERATE_FULLWIDTH );
423 if( rSet.GetItemState( SID_TRANSLITERATE_HIRAGANA ) != SfxItemState::UNKNOWN )
424 ScViewUtil::HideDisabledSlot( rSet, rViewFrm.GetBindings(), SID_TRANSLITERATE_HIRAGANA );
425 if( rSet.GetItemState( SID_TRANSLITERATE_KATAKANA ) != SfxItemState::UNKNOWN )
426 ScViewUtil::HideDisabledSlot( rSet, rViewFrm.GetBindings(), SID_TRANSLITERATE_KATAKANA );
427
428 if ( rSet.GetItemState( SID_ENABLE_HYPHENATION ) != SfxItemState::UNKNOWN )
429 {
431 SfxItemSet aAttrs(pView->GetModel().GetItemPool());
432 pView->GetAttributes( aAttrs );
433 if( aAttrs.GetItemState( EE_PARA_HYPHENATE ) >= SfxItemState::DEFAULT )
434 {
435 bool bValue = aAttrs.Get( EE_PARA_HYPHENATE ).GetValue();
436 rSet.Put( SfxBoolItem( SID_ENABLE_HYPHENATION, bValue ) );
437 }
438 }
439
440 if ( rSet.GetItemState( SID_THES ) != SfxItemState::UNKNOWN ||
441 rSet.GetItemState( SID_THESAURUS ) != SfxItemState::UNKNOWN )
442 {
443 SdrView * pView = mrViewData.GetScDrawView();
444 OutlinerView* pOutView = pView->GetTextEditOutlinerView();
445
446 OUString aStatusVal;
448 bool bIsLookUpWord = false;
449 if ( pOutView )
450 {
451 EditView& rEditView = pOutView->GetEditView();
452 bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, rEditView );
453 }
454 rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
455
456 // disable thesaurus main menu and context menu entry if there is nothing to look up
457 bool bCanDoThesaurus = ScModule::HasThesaurusLanguage( nLang );
458 if (!bIsLookUpWord || !bCanDoThesaurus)
459 rSet.DisableItem( SID_THES );
460 if (!bCanDoThesaurus)
461 rSet.DisableItem( SID_THESAURUS );
462 }
463
464 if (GetObjectShell()->isContentExtractionLocked())
465 {
466 rSet.DisableItem(SID_COPY);
467 rSet.DisableItem(SID_CUT);
468 }
469}
470
471IMPL_LINK( ScDrawTextObjectBar, ClipboardChanged, TransferableDataHelper*, pDataHelper, void )
472{
473 bPastePossible = ( pDataHelper->HasFormat( SotClipboardFormatId::STRING ) || pDataHelper->HasFormat( SotClipboardFormatId::RTF )
474 || pDataHelper->HasFormat( SotClipboardFormatId::RICHTEXT ) );
475
476 SfxBindings& rBindings = mrViewData.GetBindings();
477 rBindings.Invalidate( SID_PASTE );
478 rBindings.Invalidate( SID_PASTE_SPECIAL );
479 rBindings.Invalidate( SID_PASTE_UNFORMATTED );
480 rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
481}
482
484{
486 if ( !pView->GetTextEditOutlinerView() )
487 {
489 return;
490 }
491
492 if ( !mxClipEvtLstnr.is() )
493 {
494 // create listener
495 mxClipEvtLstnr = new TransferableClipboardListener( LINK( this, ScDrawTextObjectBar, ClipboardChanged ) );
497 mxClipEvtLstnr->AddListener( pWin );
498
499 // get initial state
501 bPastePossible = ( aDataHelper.HasFormat( SotClipboardFormatId::STRING ) || aDataHelper.HasFormat( SotClipboardFormatId::RTF )
502 || aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) );
503 }
504
505 SfxWhichIter aIter( rSet );
506 sal_uInt16 nWhich = aIter.FirstWhich();
507 while (nWhich)
508 {
509 switch (nWhich)
510 {
511 case SID_PASTE:
512 case SID_PASTE_SPECIAL:
513 case SID_PASTE_UNFORMATTED:
514 if( !bPastePossible )
515 rSet.DisableItem( nWhich );
516 break;
517 case SID_CLIPBOARD_FORMAT_ITEMS:
518 if ( bPastePossible )
519 {
520 SvxClipboardFormatItem aFormats( SID_CLIPBOARD_FORMAT_ITEMS );
521 TransferableDataHelper aDataHelper(
523
524 if ( aDataHelper.HasFormat( SotClipboardFormatId::STRING ) )
525 aFormats.AddClipbrdFormat( SotClipboardFormatId::STRING );
526 if ( aDataHelper.HasFormat( SotClipboardFormatId::RTF ) )
527 aFormats.AddClipbrdFormat( SotClipboardFormatId::RTF );
528 if ( aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) )
529 aFormats.AddClipbrdFormat( SotClipboardFormatId::RICHTEXT );
530
531 rSet.Put( aFormats );
532 }
533 else
534 rSet.DisableItem( nWhich );
535 break;
536 }
537 nWhich = aIter.NextWhich();
538 }
539}
540
541// Attributes
542
544{
545 // Underline
546
548
549 sal_uInt16 nSlot = rReq.GetSlot();
550
551 SfxItemSet aSet( pView->GetDefaultAttr() );
552
553 SfxItemSet aViewAttr(pView->GetModel().GetItemPool());
554 pView->GetAttributes(aViewAttr);
555
556 // Underline
557 FontLineStyle eOld = aViewAttr.Get(EE_CHAR_UNDERLINE).GetLineStyle();
558 FontLineStyle eNew = eOld;
559 switch (nSlot)
560 {
561 case SID_ULINE_VAL_NONE:
562 eNew = LINESTYLE_NONE;
563 break;
564 case SID_ULINE_VAL_SINGLE:
565 eNew = ( eOld == LINESTYLE_SINGLE ) ? LINESTYLE_NONE : LINESTYLE_SINGLE;
566 break;
567 case SID_ULINE_VAL_DOUBLE:
568 eNew = ( eOld == LINESTYLE_DOUBLE ) ? LINESTYLE_NONE : LINESTYLE_DOUBLE;
569 break;
570 case SID_ULINE_VAL_DOTTED:
571 eNew = ( eOld == LINESTYLE_DOTTED ) ? LINESTYLE_NONE : LINESTYLE_DOTTED;
572 break;
573 default:
574 break;
575 }
576 aSet.Put( SvxUnderlineItem( eNew, EE_CHAR_UNDERLINE ) );
577
578 pView->SetAttributes( aSet );
579 rReq.Done();
581}
582
583static void lcl_RemoveFields( OutlinerView& rOutView )
584{
586
587 Outliner* pOutliner = rOutView.GetOutliner();
588 if (!pOutliner) return;
589
590 ESelection aOldSel = rOutView.GetSelection();
591 ESelection aSel = aOldSel;
592 aSel.Adjust();
593 sal_Int32 nNewEnd = aSel.nEndPos;
594
595 bool bUpdate = pOutliner->IsUpdateLayout();
596 bool bChanged = false;
597
599 EditEngine& rEditEng = const_cast<EditEngine&>(pOutliner->GetEditEngine());
600
601 sal_Int32 nParCount = pOutliner->GetParagraphCount();
602 for (sal_Int32 nPar=0; nPar<nParCount; nPar++)
603 if ( nPar >= aSel.nStartPara && nPar <= aSel.nEndPara )
604 {
605 std::vector<sal_Int32> aPortions;
606 rEditEng.GetPortions( nPar, aPortions );
607
608 for ( size_t nPos = aPortions.size(); nPos; )
609 {
610 --nPos;
611 sal_Int32 nEnd = aPortions[ nPos ];
612 sal_Int32 nStart = nPos ? aPortions[ nPos - 1 ] : 0;
613 // fields are single characters
614 if ( nEnd == nStart+1 &&
615 ( nPar > aSel.nStartPara || nStart >= aSel.nStartPos ) &&
616 ( nPar < aSel.nEndPara || nEnd <= aSel.nEndPos ) )
617 {
618 ESelection aFieldSel( nPar, nStart, nPar, nEnd );
619 SfxItemSet aSet = rEditEng.GetAttribs( aFieldSel );
620 if ( aSet.GetItemState( EE_FEATURE_FIELD ) == SfxItemState::SET )
621 {
622 if (!bChanged)
623 {
624 if (bUpdate)
625 pOutliner->SetUpdateLayout( false );
626 OUString aName = ScResId( STR_UNDO_DELETECONTENTS );
627 ViewShellId nViewShellId(-1);
629 nViewShellId = pViewSh->GetViewShellId();
630 pOutliner->GetUndoManager().EnterListAction( aName, aName, 0, nViewShellId );
631 bChanged = true;
632 }
633
634 OUString aFieldText = rEditEng.GetText( aFieldSel );
635 pOutliner->QuickInsertText( aFieldText, aFieldSel );
636 if ( nPar == aSel.nEndPara )
637 {
638 nNewEnd = nNewEnd + aFieldText.getLength();
639 --nNewEnd;
640 }
641 }
642 }
643 }
644 }
645
646 if (bUpdate && bChanged)
647 {
648 pOutliner->GetUndoManager().LeaveListAction();
649 pOutliner->SetUpdateLayout( true );
650 }
651
652 if ( aOldSel == aSel ) // aSel is adjusted
653 aOldSel.nEndPos = nNewEnd;
654 else
655 aOldSel.nStartPos = nNewEnd; // if aOldSel is backwards
656 rOutView.SetSelection( aOldSel );
657}
658
660{
662 const SfxItemSet* pArgs = rReq.GetArgs();
663 sal_uInt16 nSlot = rReq.GetSlot();
664
665 SfxItemSet aEditAttr( pView->GetModel().GetItemPool() );
666 pView->GetAttributes( aEditAttr );
667 SfxItemSet aNewAttr( *aEditAttr.GetPool(), aEditAttr.GetRanges() );
668
669 bool bSet = true;
670 switch ( nSlot )
671 {
672 case SID_ALIGNLEFT:
673 case SID_ALIGN_ANY_LEFT:
674 case SID_ATTR_PARA_ADJUST_LEFT:
675 aNewAttr.Put( SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ) );
676 break;
677
678 case SID_ALIGNCENTERHOR:
679 case SID_ALIGN_ANY_HCENTER:
680 case SID_ATTR_PARA_ADJUST_CENTER:
681 aNewAttr.Put( SvxAdjustItem( SvxAdjust::Center, EE_PARA_JUST ) );
682 break;
683
684 case SID_ALIGNRIGHT:
685 case SID_ALIGN_ANY_RIGHT:
686 case SID_ATTR_PARA_ADJUST_RIGHT:
687 aNewAttr.Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) );
688 break;
689
690 case SID_ALIGNBLOCK:
691 case SID_ALIGN_ANY_JUSTIFIED:
692 case SID_ATTR_PARA_ADJUST_BLOCK:
693 aNewAttr.Put( SvxAdjustItem( SvxAdjust::Block, EE_PARA_JUST ) );
694 break;
695
696 case SID_ATTR_PARA_LINESPACE_10:
697 {
699 aItem.SetPropLineSpace( 100 );
700 aNewAttr.Put( aItem );
701 }
702 break;
703
704 case SID_ATTR_PARA_LINESPACE_15:
705 {
707 aItem.SetPropLineSpace( 150 );
708 aNewAttr.Put( aItem );
709 }
710 break;
711
712 case SID_ATTR_PARA_LINESPACE_20:
713 {
715 aItem.SetPropLineSpace( 200 );
716 aNewAttr.Put( aItem );
717 }
718 break;
719
720 case SID_SET_SUPER_SCRIPT:
721 {
723 SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
724
725 if( eEsc == SvxEscapement::Superscript )
726 aItem.SetEscapement( SvxEscapement::Off );
727 else
728 aItem.SetEscapement( SvxEscapement::Superscript );
729 aNewAttr.Put( aItem );
730 }
731 break;
732
733 case SID_SET_SUB_SCRIPT:
734 {
736 SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
737
738 if( eEsc == SvxEscapement::Subscript )
739 aItem.SetEscapement( SvxEscapement::Off );
740 else
741 aItem.SetEscapement( SvxEscapement::Subscript );
742 aNewAttr.Put( aItem );
743 }
744 break;
745
746 case SID_TABLE_VERT_NONE:
747 case SID_TABLE_VERT_CENTER:
748 case SID_TABLE_VERT_BOTTOM:
749 {
751 if (nSlot == SID_TABLE_VERT_CENTER)
753 else if (nSlot == SID_TABLE_VERT_BOTTOM)
755 aNewAttr.Put(SdrTextVertAdjustItem(eTVA));
756 }
757 break;
758
759 case SID_PARASPACE_INCREASE:
760 case SID_PARASPACE_DECREASE:
761 {
762 SvxULSpaceItem aULSpace( aEditAttr.Get( EE_PARA_ULSPACE ) );
763 sal_uInt16 nUpper = aULSpace.GetUpper();
764 sal_uInt16 nLower = aULSpace.GetLower();
765
766 if ( nSlot == SID_PARASPACE_INCREASE )
767 {
768 nUpper += 100;
769 nLower += 100;
770 }
771 else
772 {
773 nUpper = std::max< sal_Int16 >( nUpper - 100, 0 );
774 nLower = std::max< sal_Int16 >( nLower - 100, 0 );
775 }
776
777 aULSpace.SetUpper( nUpper );
778 aULSpace.SetLower( nLower );
779 aNewAttr.Put( aULSpace );
780 }
781 break;
782
783 default:
784 bSet = false;
785 }
786
787 bool bDone = true;
788 bool bArgsInReq = ( pArgs != nullptr );
789
790 if ( !bArgsInReq )
791 {
792 switch ( nSlot )
793 {
794 case SID_CELL_FORMAT_RESET:
795 case SID_TEXT_STANDARD:
796 {
797 OutlinerView* pOutView = pView->IsTextEdit() ?
798 pView->GetTextEditOutlinerView() : nullptr;
799 if ( pOutView )
800 pOutView->Paint( tools::Rectangle() );
801
805
806 aSizeAttr.Put(pView->GetAttrFromMarked(true));
807 pView->SetAttributes( aEmptyAttr, true );
808
809 if (IsNoteEdit())
810 {
811 pView->SetAttributes(aSizeAttr, false);
813 }
814
815 if ( pOutView )
816 {
817 lcl_RemoveFields( *pOutView );
818 pOutView->ShowCursor();
819 }
820
821 rReq.Done( aEmptyAttr );
823 bDone = false; // already happened here
824 }
825 break;
826
827 case SID_GROW_FONT_SIZE:
828 case SID_SHRINK_FONT_SIZE:
829 {
830 OutlinerView* pOutView = pView->IsTextEdit() ?
831 pView->GetTextEditOutlinerView() : nullptr;
832 if ( pOutView )
833 {
835 {
836 const SvxFontListItem* pFontListItem = static_cast< const SvxFontListItem* >
837 ( pObjSh->GetItem( SID_ATTR_CHAR_FONTLIST ) );
838 const FontList* pFontList = pFontListItem ? pFontListItem->GetFontList() : nullptr;
839 pOutView->GetEditView().ChangeFontSize( nSlot == SID_GROW_FONT_SIZE, pFontList );
840 mrViewData.GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
841 }
842 bDone = false;
843 }
844 }
845 break;
846
847 case SID_CHAR_DLG_EFFECT:
848 case SID_CHAR_DLG: // dialog button
849 case SID_ATTR_CHAR_FONT: // Controller not shown
850 case SID_ATTR_CHAR_FONTHEIGHT:
851 bDone = ExecuteCharDlg( aEditAttr, aNewAttr , nSlot);
852 break;
853
854 case SID_PARA_DLG:
855 bDone = ExecuteParaDlg( aEditAttr, aNewAttr );
856 break;
857
858 case SID_ATTR_CHAR_WEIGHT:
859 aNewAttr.Put( aEditAttr.Get( EE_CHAR_WEIGHT ) );
860 break;
861
862 case SID_ATTR_CHAR_POSTURE:
863 aNewAttr.Put( aEditAttr.Get( EE_CHAR_ITALIC ) );
864 break;
865
866 case SID_ATTR_CHAR_UNDERLINE:
867 aNewAttr.Put( aEditAttr.Get( EE_CHAR_UNDERLINE ) );
868 break;
869
870 case SID_ATTR_CHAR_OVERLINE:
871 aNewAttr.Put( aEditAttr.Get( EE_CHAR_OVERLINE ) );
872 break;
873
874 case SID_ATTR_CHAR_CONTOUR:
875 aNewAttr.Put( aEditAttr.Get( EE_CHAR_OUTLINE ) );
876 break;
877
878 case SID_ATTR_CHAR_SHADOWED:
879 aNewAttr.Put( aEditAttr.Get( EE_CHAR_SHADOW ) );
880 break;
881
882 case SID_ATTR_CHAR_STRIKEOUT:
883 aNewAttr.Put( aEditAttr.Get( EE_CHAR_STRIKEOUT ) );
884 break;
885
886 case SID_DRAWTEXT_ATTR_DLG:
887 {
890
891 bDone = ( RET_OK == pDlg->Execute() );
892
893 if ( bDone )
894 aNewAttr.Put( *pDlg->GetOutputItemSet() );
895
896 pDlg.disposeAndClear();
897
898 SfxBindings& rBindings = mrViewData.GetBindings();
899 rBindings.Invalidate( SID_TABLE_VERT_NONE );
900 rBindings.Invalidate( SID_TABLE_VERT_CENTER );
901 rBindings.Invalidate( SID_TABLE_VERT_BOTTOM );
902 }
903 break;
904 }
905 }
906
907 if ( bSet || bDone )
908 {
909 rReq.Done( aNewAttr );
910 pArgs = rReq.GetArgs();
911 }
912
913 if ( !pArgs )
914 return;
915
916 if ( bArgsInReq &&
917 ( nSlot == SID_ATTR_CHAR_FONT || nSlot == SID_ATTR_CHAR_FONTHEIGHT ||
918 nSlot == SID_ATTR_CHAR_WEIGHT || nSlot == SID_ATTR_CHAR_POSTURE ) )
919 {
920 // font items from toolbox controller have to be applied for the right script type
921
922 // #i78017 establish the same behaviour as in Writer
923 SvtScriptType nScript = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
924 if (nSlot == SID_ATTR_CHAR_FONT)
925 nScript = pView->GetScriptType();
926
927 SfxItemPool& rPool = GetPool();
928 SvxScriptSetItem aSetItem( nSlot, rPool );
929 sal_uInt16 nWhich = rPool.GetWhich( nSlot );
930 aSetItem.PutItemForScriptType( nScript, pArgs->Get( nWhich ) );
931
932 pView->SetAttributes( aSetItem.GetItemSet() );
933 }
934 else if( nSlot == SID_ATTR_PARA_LRSPACE )
935 {
936 sal_uInt16 nId = SID_ATTR_PARA_LRSPACE;
937 const SvxLRSpaceItem& rItem = static_cast<const SvxLRSpaceItem&>(
938 pArgs->Get( nId ));
941 SvxLRSpaceItem aLRSpaceItem( rItem.GetLeft(),
942 rItem.GetRight(), rItem.GetTextFirstLineOffset(), nId );
943 aAttr.Put( aLRSpaceItem );
944 pView->SetAttributes( aAttr );
945 }
946 else if( nSlot == SID_ATTR_PARA_LINESPACE )
947 {
948 SvxLineSpacingItem aLineSpaceItem = static_cast<const SvxLineSpacingItem&>(pArgs->Get(
949 GetPool().GetWhich(nSlot)));
951 aAttr.Put( aLineSpaceItem );
952 pView->SetAttributes( aAttr );
953 }
954 else if( nSlot == SID_ATTR_PARA_ULSPACE )
955 {
956 SvxULSpaceItem aULSpaceItem = static_cast<const SvxULSpaceItem&>(pArgs->Get(
957 GetPool().GetWhich(nSlot)));
959 aULSpaceItem.SetWhich(EE_PARA_ULSPACE);
960 aAttr.Put( aULSpaceItem );
961 pView->SetAttributes( aAttr );
962 }
963 else
964 {
965 // use args directly
966 pView->SetAttributes( *pArgs );
967 }
969}
970
972{
973 if ( IsNoteEdit() )
974 {
975 // issue 21255 - Notes now support rich text formatting.
976 }
977
978 bool bDisableCTLFont = !::SvtCTLOptions::IsCTLFontEnabled();
979 bool bDisableVerticalText = !SvtCJKOptions::IsVerticalTextEnabled();
980
982 SfxItemSet aAttrSet(pView->GetModel().GetItemPool());
983 pView->GetAttributes(aAttrSet);
984
985 // direct attributes
986
987 rDestSet.Put( aAttrSet );
988
989 // choose font info according to selection script type
990
991 SvtScriptType nScript = pView->GetScriptType();
992
993 // #i55929# input-language-dependent script type (depends on input language if nothing selected)
994 SvtScriptType nInputScript = nScript;
995 OutlinerView* pOutView = pView->GetTextEditOutlinerView();
996 if (pOutView && !pOutView->GetSelection().HasRange())
997 {
999 if (nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
1000 nInputScript = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
1001 }
1002
1003 // #i55929# according to spec, nInputScript is used for font and font height only
1004 if ( rDestSet.GetItemState( EE_CHAR_FONTINFO ) != SfxItemState::UNKNOWN )
1005 ScViewUtil::PutItemScript( rDestSet, aAttrSet, EE_CHAR_FONTINFO, nInputScript );
1006 if ( rDestSet.GetItemState( EE_CHAR_FONTHEIGHT ) != SfxItemState::UNKNOWN )
1007 ScViewUtil::PutItemScript( rDestSet, aAttrSet, EE_CHAR_FONTHEIGHT, nInputScript );
1008 if ( rDestSet.GetItemState( EE_CHAR_WEIGHT ) != SfxItemState::UNKNOWN )
1009 ScViewUtil::PutItemScript( rDestSet, aAttrSet, EE_CHAR_WEIGHT, nScript );
1010 if ( rDestSet.GetItemState( EE_CHAR_ITALIC ) != SfxItemState::UNKNOWN )
1011 ScViewUtil::PutItemScript( rDestSet, aAttrSet, EE_CHAR_ITALIC, nScript );
1012 // Alignment
1013
1014 SvxAdjust eAdj = aAttrSet.Get(EE_PARA_JUST).GetAdjust();
1015 switch( eAdj )
1016 {
1017 case SvxAdjust::Left:
1018 {
1019 rDestSet.Put( SfxBoolItem( SID_ALIGNLEFT, true ) );
1020 rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT, true ) );
1021 }
1022 break;
1023 case SvxAdjust::Center:
1024 {
1025 rDestSet.Put( SfxBoolItem( SID_ALIGNCENTERHOR, true ) );
1026 rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER, true ) );
1027 }
1028 break;
1029 case SvxAdjust::Right:
1030 {
1031 rDestSet.Put( SfxBoolItem( SID_ALIGNRIGHT, true ) );
1032 rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, true ) );
1033 }
1034 break;
1035 case SvxAdjust::Block:
1036 {
1037 rDestSet.Put( SfxBoolItem( SID_ALIGNBLOCK, true ) );
1038 rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, true ) );
1039 }
1040 break;
1041 default:
1042 {
1043 // added to avoid warnings
1044 }
1045 }
1046 // pseudo slots for Format menu
1047 rDestSet.Put( SfxBoolItem( SID_ALIGN_ANY_LEFT, eAdj == SvxAdjust::Left ) );
1048 rDestSet.Put( SfxBoolItem( SID_ALIGN_ANY_HCENTER, eAdj == SvxAdjust::Center ) );
1049 rDestSet.Put( SfxBoolItem( SID_ALIGN_ANY_RIGHT, eAdj == SvxAdjust::Right ) );
1050 rDestSet.Put( SfxBoolItem( SID_ALIGN_ANY_JUSTIFIED, eAdj == SvxAdjust::Block ) );
1051
1052 SvxLRSpaceItem aLR = aAttrSet.Get( EE_PARA_LRSPACE );
1053 aLR.SetWhich(SID_ATTR_PARA_LRSPACE);
1054 rDestSet.Put(aLR);
1055 Invalidate( SID_ATTR_PARA_LRSPACE );
1056 SfxItemState eState = aAttrSet.GetItemState( EE_PARA_LRSPACE );
1057 if ( eState == SfxItemState::DONTCARE )
1058 rDestSet.InvalidateItem(SID_ATTR_PARA_LRSPACE);
1059 //xuxu for Line Space
1060 SvxLineSpacingItem aLineSP = aAttrSet.Get( EE_PARA_SBL );
1061 aLineSP.SetWhich(SID_ATTR_PARA_LINESPACE);
1062 rDestSet.Put(aLineSP);
1063 Invalidate(SID_ATTR_PARA_LINESPACE);
1064 eState = aAttrSet.GetItemState( EE_PARA_SBL );
1065 if ( eState == SfxItemState::DONTCARE )
1066 rDestSet.InvalidateItem(SID_ATTR_PARA_LINESPACE);
1067 //xuxu for UL Space
1068 SvxULSpaceItem aULSP = aAttrSet.Get( EE_PARA_ULSPACE );
1069 aULSP.SetWhich(SID_ATTR_PARA_ULSPACE);
1070 rDestSet.Put(aULSP);
1071 Invalidate(SID_ATTR_PARA_ULSPACE);
1072 Invalidate(SID_PARASPACE_INCREASE);
1073 Invalidate(SID_PARASPACE_DECREASE);
1074 eState = aAttrSet.GetItemState( EE_PARA_ULSPACE );
1075 if( eState >= SfxItemState::DEFAULT )
1076 {
1077 if ( !aULSP.GetUpper() && !aULSP.GetLower() )
1078 rDestSet.DisableItem( SID_PARASPACE_DECREASE );
1079 }
1080 else
1081 {
1082 rDestSet.DisableItem( SID_PARASPACE_INCREASE );
1083 rDestSet.DisableItem( SID_PARASPACE_DECREASE );
1084 rDestSet.InvalidateItem(SID_ATTR_PARA_ULSPACE);
1085 }
1086
1087 // Line spacing
1088
1089 sal_uInt16 nLineSpace = aAttrSet.Get( EE_PARA_SBL ).GetPropLineSpace();
1090 switch( nLineSpace )
1091 {
1092 case 100:
1093 rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_10, true ) );
1094 break;
1095 case 150:
1096 rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_15, true ) );
1097 break;
1098 case 200:
1099 rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_20, true ) );
1100 break;
1101 }
1102
1103 // super-/subscript
1104 SvxEscapement eEsc = static_cast<SvxEscapement>(aAttrSet.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
1105 rDestSet.Put(SfxBoolItem(SID_SET_SUPER_SCRIPT, eEsc == SvxEscapement::Superscript));
1106 rDestSet.Put(SfxBoolItem(SID_SET_SUB_SCRIPT, eEsc == SvxEscapement::Subscript));
1107
1108 // Underline
1109 eState = aAttrSet.GetItemState( EE_CHAR_UNDERLINE );
1110 if ( eState == SfxItemState::DONTCARE )
1111 {
1112 rDestSet.InvalidateItem( SID_ULINE_VAL_NONE );
1113 rDestSet.InvalidateItem( SID_ULINE_VAL_SINGLE );
1114 rDestSet.InvalidateItem( SID_ULINE_VAL_DOUBLE );
1115 rDestSet.InvalidateItem( SID_ULINE_VAL_DOTTED );
1116 }
1117 else
1118 {
1119 FontLineStyle eUnderline = aAttrSet.Get(EE_CHAR_UNDERLINE).GetLineStyle();
1120 rDestSet.Put(SfxBoolItem(SID_ULINE_VAL_SINGLE, eUnderline == LINESTYLE_SINGLE));
1121 rDestSet.Put(SfxBoolItem(SID_ULINE_VAL_DOUBLE, eUnderline == LINESTYLE_DOUBLE));
1122 rDestSet.Put(SfxBoolItem(SID_ULINE_VAL_DOTTED, eUnderline == LINESTYLE_DOTTED));
1123 rDestSet.Put(SfxBoolItem(SID_ULINE_VAL_NONE, eUnderline == LINESTYLE_NONE));
1124 }
1125
1126 // horizontal / vertical
1127
1128 bool bLeftToRight = true;
1129
1130 SdrOutliner* pOutl = pView->GetTextEditOutliner();
1131 if( pOutl )
1132 {
1133 if( pOutl->IsVertical() )
1134 bLeftToRight = false;
1135 }
1136 else
1137 bLeftToRight = aAttrSet.Get( SDRATTR_TEXTDIRECTION ).GetValue() == css::text::WritingMode_LR_TB;
1138
1139 if ( bDisableVerticalText )
1140 {
1141 rDestSet.DisableItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT );
1142 rDestSet.DisableItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM );
1143 }
1144 else
1145 {
1146 rDestSet.Put( SfxBoolItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT, bLeftToRight ) );
1147 rDestSet.Put( SfxBoolItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM, !bLeftToRight ) );
1148 }
1149
1150 // left-to-right or right-to-left
1151
1152 if ( !bLeftToRight || bDisableCTLFont )
1153 {
1154 // disabled if vertical
1155 rDestSet.DisableItem( SID_ATTR_PARA_LEFT_TO_RIGHT );
1156 rDestSet.DisableItem( SID_ATTR_PARA_RIGHT_TO_LEFT );
1157 }
1158 else if ( aAttrSet.GetItemState( EE_PARA_WRITINGDIR ) == SfxItemState::DONTCARE )
1159 {
1160 rDestSet.InvalidateItem( SID_ATTR_PARA_LEFT_TO_RIGHT );
1161 rDestSet.InvalidateItem( SID_ATTR_PARA_RIGHT_TO_LEFT );
1162 }
1163 else
1164 {
1165 SvxFrameDirection eAttrDir = aAttrSet.Get( EE_PARA_WRITINGDIR ).GetValue();
1166 if ( eAttrDir == SvxFrameDirection::Environment )
1167 {
1168 // get "environment" direction from page style
1169 if ( mrViewData.GetDocument().GetEditTextDirection( mrViewData.GetTabNo() ) == EEHorizontalTextDirection::R2L )
1170 eAttrDir = SvxFrameDirection::Horizontal_RL_TB;
1171 else
1172 eAttrDir = SvxFrameDirection::Horizontal_LR_TB;
1173 }
1174 rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_LEFT_TO_RIGHT, ( eAttrDir == SvxFrameDirection::Horizontal_LR_TB ) ) );
1175 rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_RIGHT_TO_LEFT, ( eAttrDir == SvxFrameDirection::Horizontal_RL_TB ) ) );
1176 }
1177}
1178
1180{
1182 if ( nType == TransliterationFlags::NONE )
1183 return;
1184
1186 OutlinerView* pOutView = pView->GetTextEditOutlinerView();
1187 if ( pOutView )
1188 {
1189 // change selected text in object
1190 pOutView->TransliterateText( nType );
1191 }
1192 else
1193 {
1195 }
1196}
1197
1199{
1200 SfxWhichIter aIter( rSet );
1201 sal_uInt16 nWhich = aIter.FirstWhich();
1202
1203 SdrView* pView = mrViewData.GetScDrawView();
1204
1205 SfxItemSet aEditAttr(pView->GetModel().GetItemPool());
1206 pView->GetAttributes(aEditAttr);
1207 //SfxItemSet aAttrs( *aEditAttr.GetPool(), aEditAttr.GetRanges() );
1208
1209 while ( nWhich )
1210 {
1211 sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
1212 ? GetPool().GetSlotId(nWhich)
1213 : nWhich;
1214 switch ( nSlotId )
1215 {
1216 case SID_TABLE_VERT_NONE:
1217 case SID_TABLE_VERT_CENTER:
1218 case SID_TABLE_VERT_BOTTOM:
1219 bool bContour = false;
1220 SfxItemState eConState = aEditAttr.GetItemState( SDRATTR_TEXT_CONTOURFRAME );
1221 if( eConState != SfxItemState::DONTCARE )
1222 {
1223 bContour = aEditAttr.Get( SDRATTR_TEXT_CONTOURFRAME ).GetValue();
1224 }
1225 if (bContour) break;
1226
1227 SfxItemState eVState = aEditAttr.GetItemState( SDRATTR_TEXT_VERTADJUST );
1228 //SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
1229
1230 //if(SfxItemState::DONTCARE != eVState && SfxItemState::DONTCARE != eHState)
1231 if(SfxItemState::DONTCARE != eVState)
1232 {
1233 SdrTextVertAdjust eTVA = aEditAttr.Get(SDRATTR_TEXT_VERTADJUST).GetValue();
1234 bool bSet = (nSlotId == SID_TABLE_VERT_NONE && eTVA == SDRTEXTVERTADJUST_TOP) ||
1235 (nSlotId == SID_TABLE_VERT_CENTER && eTVA == SDRTEXTVERTADJUST_CENTER) ||
1236 (nSlotId == SID_TABLE_VERT_BOTTOM && eTVA == SDRTEXTVERTADJUST_BOTTOM);
1237 rSet.Put(SfxBoolItem(nSlotId, bSet));
1238 }
1239 else
1240 {
1241 rSet.Put(SfxBoolItem(nSlotId, false));
1242 }
1243 break;
1244 }
1245 nWhich = aIter.NextWhich();
1246 }
1247}
1248
1249/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define GetWhich(nSlot)
const OUString & GetValue() const
void GetPortions(sal_Int32 nPara, std::vector< sal_Int32 > &rList)
OUString GetText(LineEnd eEnd=LINEEND_LF) const
SfxItemSet GetAttribs(sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags=GetAttribsFlags::ALL) const
void ChangeFontSize(bool bGrow, const FontList *pList)
void SetSelection(const ESelection &)
void SelectFieldAtCursor()
void PasteSpecial()
void Paint(const tools::Rectangle &rRect, OutputDevice *pTargetDevice=nullptr)
void InsertField(const SvxFieldItem &rFld)
void InsertText(const OUString &rNew, bool bSelect=false)
void TransliterateText(TransliterationFlags nTransliterationMode)
vcl::Window * GetWindow() const
EESpellState StartThesaurus(weld::Widget *pDialogParent)
ESelection GetSelection() const
const SvxFieldData * GetFieldAtCursor() const
void Paste(bool bUseSpecial=false)
SfxItemSet GetAttribs()
Outliner * GetOutliner() const
OUString GetSelected() const
EditView & GetEditView() const
void ShowCursor(bool bGotoCursor=true, bool bActivate=false)
void QuickSetAttribs(const SfxItemSet &rSet, const ESelection &rSel)
const EditEngine & GetEditEngine() const
bool IsUpdateLayout() const
void QuickInsertText(const OUString &rText, const ESelection &rSel)
const SfxItemSet & GetEmptyItemSet() const
bool SetUpdateLayout(bool bUpdate)
SfxUndoManager & GetUndoManager()
sal_Int32 GetParagraphCount() const
EEHorizontalTextDirection GetEditTextDirection(SCTAB nTab) const
Definition: documen8.cxx:355
bool IsUndoEnabled() const
Definition: document.hxx:1595
void ExecuteAttr(SfxRequest &rReq)
Definition: drtxtob.cxx:659
ScDrawTextObjectBar(ScViewData &rData)
Definition: drtxtob.cxx:111
rtl::Reference< TransferableClipboardListener > mxClipEvtLstnr
Definition: drtxtob.hxx:38
static void GetGlobalClipState(SfxItemSet &rSet)
Definition: drtxtob2.cxx:112
void ExecuteGlobal(SfxRequest &rReq)
Definition: drtxtob2.cxx:49
void GetStatePropPanelAttr(SfxItemSet &)
Definition: drtxtob.cxx:1198
bool IsNoteEdit() const
Definition: drtxtob2.cxx:42
void ExecuteTrans(const SfxRequest &rReq)
Definition: drtxtob.cxx:1179
void GetAttrState(SfxItemSet &rSet)
Definition: drtxtob.cxx:971
void Execute(SfxRequest &rReq)
Definition: drtxtob.cxx:144
void ExecutePasteContents(SfxRequest &rReq)
Definition: drtxtob1.cxx:98
ScViewData & mrViewData
Definition: drtxtob.hxx:37
void ExecuteToggle(SfxRequest &rReq)
Definition: drtxtob.cxx:543
void GetState(SfxItemSet &rSet)
Definition: drtxtob.cxx:358
bool ExecuteCharDlg(const SfxItemSet &rArgs, SfxItemSet &rOutSet, sal_uInt16 nSlot)
Definition: drtxtob1.cxx:40
bool ExecuteParaDlg(const SfxItemSet &rArgs, SfxItemSet &rOutSet)
Definition: drtxtob1.cxx:63
virtual ~ScDrawTextObjectBar() override
Definition: drtxtob.cxx:130
static void StateDisableItems(SfxItemSet &rSet)
Definition: drtxtob.cxx:99
void GetClipState(SfxItemSet &rSet)
Definition: drtxtob.cxx:483
SdrEndTextEditKind ScEndTextEdit()
Definition: drawview.cxx:887
void InvalidateDrawTextAttrs()
Definition: drawview.cxx:162
static void OpenURL(const OUString &rURL, const OUString &rTarget, bool bIgnoreSettings=false)
Open the specified URL.
Definition: global.cxx:810
static bool HasThesaurusLanguage(LanguageType nLang)
Definition: scmod.cxx:2280
static ScTabViewShell * GetActiveViewShell()
Definition: tabvwsh4.cxx:1076
SfxDispatcher & GetDispatcher()
Definition: viewdata.cxx:3140
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
ScGridWindow * GetActiveWin()
Definition: viewdata.cxx:3162
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:357
weld::Window * GetDialogParent()
Definition: viewdata.cxx:3156
SfxObjectShell * GetSfxDocShell() const
Definition: viewdata.hxx:358
SfxBindings & GetBindings()
Definition: viewdata.cxx:3134
ScDrawView * GetScDrawView()
Definition: viewdata.cxx:3174
static TransliterationFlags GetTransliterationType(sal_uInt16 nSlotID)
Definition: viewutil.cxx:99
static void ExecuteCharMap(const SvxFontItem &rOldFont, const ScTabViewShell &rShell)
Definition: viewutil.cxx:318
static void HideDisabledSlot(SfxItemSet &rSet, SfxBindings &rBindings, sal_uInt16 nSlotId)
Definition: viewutil.cxx:284
static void PutItemScript(SfxItemSet &rShellSet, const SfxItemSet &rCoreSet, sal_uInt16 nWhichId, SvtScriptType nScript)
Definition: viewutil.cxx:50
SfxItemSet GetAttrFromMarked(bool bOnlyHardAttr) const
const SfxItemPool & GetItemPool() const
SdrTextObj * GetTextEditObject() const
const OutlinerView * GetTextEditOutlinerView() const
virtual bool IsTextEdit() const final override
virtual SvtScriptType GetScriptType() const
const SdrOutliner * GetTextEditOutliner() const
const SfxItemSet & GetDefaultAttr() const
SdrModel & GetModel() const
virtual bool AdjustTextFrameWidthAndHeight(tools::Rectangle &rR, bool bHgt=true, bool bWdt=true) const
bool SetAttributes(const SfxItemSet &rSet, bool bReplaceAll=false)
void GetAttributes(SfxItemSet &rTargetSet, bool bOnlyHardAttr=false) const
void Invalidate(sal_uInt16 nId)
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
sal_uInt16 GetSlotId(sal_uInt16 nWhich) const
static bool IsWhich(sal_uInt16 nId)
const WhichRangesContainer & GetRanges() const
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)
void InvalidateItem(sal_uInt16 nWhich)
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
sal_uInt16 GetSlot() const
const SfxItemSet * GetArgs() const
const T * GetArg(sal_uInt16 nSlotId) const
weld::Window * GetFrameWeld() const
void Done(bool bRemove=false)
void SetUndoManager(SfxUndoManager *pNewUndoMgr)
SfxItemPool & GetPool() const
void SetContextName(const OUString &rsContextName)
virtual void Invalidate(sal_uInt16 nId=0)
virtual SfxObjectShell * GetObjectShell()
virtual SfxUndoManager * GetUndoManager()
void SetPool(SfxItemPool *pNewPool)
void SetName(const OUString &rName)
size_t LeaveListAction()
virtual void EnterListAction(const OUString &rComment, const OUString &rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId)
void SetMaxUndoActionCount(size_t nMaxUndoActionCount)
SfxBindings & GetBindings()
bool HasChildWindow(sal_uInt16)
SfxDispatcher * GetDispatcher()
SfxViewFrame & GetViewFrame() const
sal_uInt16 FirstWhich()
sal_uInt16 NextWhich()
static bool IsCTLFontEnabled()
virtual VclPtr< SfxAbstractTabDialog > CreateTextTabDialog(weld::Window *pParent, const SfxItemSet *pAttrSet, SdrView *pView)=0
static SvxAbstractDialogFactory * Create()
void AddClipbrdFormat(SotClipboardFormatId nId)
void SetEscapement(const SvxEscapement eNew)
virtual SvxFontItem * Clone(SfxItemPool *pPool=nullptr) const override
const FontList * GetFontList() const
void SetName(const OUString &rName)
void SetURL(const OUString &rURL)
void SetTargetFrame(const OUString &rTarget)
short GetTextFirstLineOffset() const
tools::Long GetRight() const
tools::Long GetLeft() const
void SetPropLineSpace(const sal_uInt16 nProp)
void PutItemForScriptType(SvtScriptType nScriptType, const SfxPoolItem &rItem)
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
sal_uInt16 GetUpper() const
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
sal_uInt16 GetLower() const
void SetTargetFrame(const OUString &rFrm)
static TransferableDataHelper CreateFromSystemClipboard(vcl::Window *pWindow)
bool HasFormat(SotClipboardFormatId nFormat) const
static void RemoveURLField(EditView &pEditView)
static bool IsCursorAtURLField(const EditView &pEditView)
void disposeAndClear()
static const OUString & GetContextName(const Context eContext)
FontFamily GetFamilyType()
const OUString & GetStyleName() const
const OUString & GetFamilyName() const
FontPitch GetPitch()
rtl_TextEncoding GetCharSet() const
LanguageType GetInputLanguage() const
css::uno::Reference< css::datatransfer::clipboard::XClipboard > GetClipboard()
static void CopyStringTo(const OUString &rContent, const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &rxClipboard, const vcl::ILibreOfficeKitNotifier *pNotifier=nullptr)
int nCount
sal_uInt16 ScGetFontWorkId()
Definition: drtxtob2.cxx:37
static void lcl_RemoveFields(OutlinerView &rOutView)
Definition: drtxtob.cxx:583
IMPL_LINK(ScDrawTextObjectBar, ClipboardChanged, TransferableDataHelper *, pDataHelper, void)
Definition: drtxtob.cxx:471
constexpr TypedWhichId< SvxContourItem > EE_CHAR_OUTLINE(EE_CHAR_START+8)
constexpr TypedWhichId< SfxBoolItem > EE_PARA_HYPHENATE(EE_PARA_START+6)
constexpr TypedWhichId< SvxFieldItem > EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
constexpr TypedWhichId< SvxUnderlineItem > EE_CHAR_UNDERLINE(EE_CHAR_START+5)
constexpr TypedWhichId< SvxAdjustItem > EE_PARA_JUST(EE_PARA_START+16)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
constexpr TypedWhichId< SvxShadowedItem > EE_CHAR_SHADOW(EE_CHAR_START+9)
constexpr TypedWhichId< SvxULSpaceItem > EE_PARA_ULSPACE(EE_PARA_START+14)
constexpr TypedWhichId< SvxOverlineItem > EE_CHAR_OVERLINE(EE_CHAR_START+29)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT(EE_CHAR_START+4)
constexpr TypedWhichId< SvxLRSpaceItem > EE_PARA_LRSPACE(EE_PARA_START+13)
constexpr TypedWhichId< SvxCrossedOutItem > EE_CHAR_STRIKEOUT(EE_CHAR_START+6)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC(EE_CHAR_START+7)
constexpr TypedWhichId< SvxLineSpacingItem > EE_PARA_SBL(EE_PARA_START+15)
constexpr TypedWhichId< SvxEscapementItem > EE_CHAR_ESCAPEMENT(EE_CHAR_START+10)
constexpr TypedWhichId< SvxFrameDirectionItem > EE_PARA_WRITINGDIR(EE_PARA_START+0)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
FilterGroup & rTarget
FontLineStyle
LINESTYLE_SINGLE
LINESTYLE_DOUBLE
LINESTYLE_NONE
LINESTYLE_DOTTED
SotClipboardFormatId
SvxFrameDirection
SvxLinkInsertMode
HLINK_FIELD
HLINK_DEFAULT
OUString aName
Mode eMode
#define LANGUAGE_SYSTEM
#define LANGUAGE_NONE
#define LANGUAGE_DONTKNOW
SvtScriptType
sal_uInt16 nPos
#define LINE_SPACE_DEFAULT_HEIGHT
bool IsVerticalTextEnabled()
SvtScriptType GetScriptTypeOfLanguage(LanguageType nLang)
OString stripEnd(const OString &rIn, char c)
#define SFX_OBJECTBAR_OBJECT
sal_Int16 nId
const char GetValue[]
void ReplaceTextWithSynonym(EditView &rEditView, const OUString &rSynonmText)
bool GetStatusValueForThesaurusFromContext(OUString &rStatusVal, LanguageType &rLang, const EditView &rEditView)
SfxItemState
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:398
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
constexpr TypedWhichId< SvxFontItem > ATTR_FONT(100)
SdrTextVertAdjust
SDRTEXTVERTADJUST_BOTTOM
SDRTEXTVERTADJUST_CENTER
SDRTEXTVERTADJUST_TOP
static SfxItemSet & rSet
#define SFX_IMPL_INTERFACE(Class, SuperClass)
bool HasRange() const
sal_Int32 nStartPara
sal_Int32 nEndPos
sal_Int32 nStartPos
void Adjust()
sal_Int32 nEndPara
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_MAXFRAMEHEIGHT(SDRATTR_MISC_FIRST+9)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_MINFRAMEHEIGHT(SDRATTR_MISC_FIRST+1)
constexpr TypedWhichId< SdrTextVertAdjustItem > SDRATTR_TEXT_VERTADJUST(SDRATTR_MISC_FIRST+8)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_MAXFRAMEWIDTH(SDRATTR_MISC_FIRST+11)
constexpr TypedWhichId< SvxWritingModeItem > SDRATTR_TEXTDIRECTION(SDRATTR_NOTPERSIST_FIRST+34)
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_TEXT_CONTOURFRAME(SDRATTR_MISC_FIRST+21)
SvxEscapement
SvxAdjust
TransliterationFlags
RET_OK