LibreOffice Module sd (master) 1
drtxtob1.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 <TextObjectBar.hxx>
21
22#include <svx/svxids.hrc>
23
24#include <editeng/eeitem.hxx>
25#include <editeng/editview.hxx>
26#include <editeng/outliner.hxx>
27#include <editeng/ulspitem.hxx>
28#include <editeng/lspcitem.hxx>
30#include <editeng/numitem.hxx>
31#include <svl/itempool.hxx>
32#include <svl/stritem.hxx>
33#include <svl/style.hxx>
34#include <sfx2/request.hxx>
35#include <sfx2/viewfrm.hxx>
36#include <sfx2/dispatch.hxx>
38#include <editeng/wghtitem.hxx>
39#include <editeng/postitem.hxx>
40#include <editeng/udlnitem.hxx>
43#include <editeng/shdditem.hxx>
44#include <svx/svdpagv.hxx>
45#include <editeng/flstitem.hxx>
49#include <editeng/cmapitem.hxx>
50
51#include <app.hrc>
52#include <strings.hrc>
53#include <sdresid.hxx>
54#include <prlayout.hxx>
55#include <ViewShell.hxx>
56#include <drawdoc.hxx>
57#include <sdpage.hxx>
58#include <stlpool.hxx>
59#include <stlsheet.hxx>
60#include <OutlineView.hxx>
61#include <Window.hxx>
62#include <futempl.hxx>
63#include <DrawDocShell.hxx>
64#include <futext.hxx>
65#include <editeng/colritem.hxx>
66
67#include <memory>
68
69namespace sd {
70
76{
77 const SfxItemSet* pArgs = rReq.GetArgs();
78 sal_uInt16 nSlot = rReq.GetSlot();
80
81 std::unique_ptr<OutlineViewModelChangeGuard, o3tl::default_delete<OutlineViewModelChangeGuard>> aGuard;
82
83 assert(mpViewShell);
84
85 if (OutlineView* pOView = dynamic_cast<OutlineView*>(mpView))
86 {
87 pOLV = pOView->GetViewByWindow(mpViewShell->GetActiveWindow());
88 aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) );
89 }
90
91 switch (nSlot)
92 {
93 case SID_STYLE_APPLY:
94 {
95 if( pArgs )
96 {
97 SdDrawDocument& rDoc = mpView->GetDoc();
98 assert(mpViewShell->GetViewShell());
100
101 if(xFunc.is())
102 {
103 xFunc->Activate();
104 xFunc->Deactivate();
105
106 if( rReq.GetSlot() == SID_STYLE_APPLY )
107 {
109 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_APPLY );
110 }
111 }
112 }
113 else
114 {
116 mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_STYLE_DESIGNER, SfxCallMode::ASYNCHRON );
117 }
118
119 rReq.Done();
120 }
121 break;
122
123 case SID_INC_INDENT:
124 case SID_DEC_INDENT:
125 {
126 if( pOLV )
127 {
128 ESelection aSel = pOLV->GetSelection();
129 aSel.Adjust();
130 sal_Int32 nStartPara = aSel.nStartPara;
131 sal_Int32 nEndPara = aSel.nEndPara;
132 if( !aSel.HasRange() )
133 {
134 nStartPara = 0;
135 nEndPara = pOLV->GetOutliner()->GetParagraphCount() - 1;
136 }
137
139 for( sal_Int32 nPara = nStartPara; nPara <= nEndPara; nPara++ )
140 {
141 SfxStyleSheet* pStyleSheet = nullptr;
142 if (pOLV->GetOutliner() != nullptr)
143 pStyleSheet = pOLV->GetOutliner()->GetStyleSheet(nPara);
144 if (pStyleSheet != nullptr)
145 {
146 SfxItemSet aAttr( pStyleSheet->GetItemSet() );
147 SfxItemSet aTmpSet( pOLV->GetOutliner()->GetParaAttribs( nPara ) );
148 aAttr.Put( aTmpSet, false );
149 const SvxLRSpaceItem& rItem = aAttr.Get( EE_PARA_LRSPACE );
150 std::unique_ptr<SvxLRSpaceItem> pNewItem(rItem.Clone());
151
152 ::tools::Long nLeft = pNewItem->GetLeft();
153 if( nSlot == SID_INC_INDENT )
154 nLeft += 1000;
155 else
156 {
157 nLeft -= 1000;
158 nLeft = std::max<::tools::Long>( nLeft, 0 );
159 }
160 pNewItem->SetLeftValue( static_cast<sal_uInt16>(nLeft) );
161
162 SfxItemSet aNewAttrs( aAttr );
163 aNewAttrs.Put( std::move(pNewItem) );
164 pOLV->GetOutliner()->SetParaAttribs( nPara, aNewAttrs );
165 }
166 }
167 pOLV->GetOutliner()->UndoActionEnd();
168 mpViewShell->Invalidate( SID_UNDO );
169 }
170 rReq.Done();
171
172 Invalidate();
173 // to refresh preview (in outline mode), slot has to be invalidated:
174 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true );
175
176 }
177 break;
178
179 case SID_PARASPACE_INCREASE:
180 case SID_PARASPACE_DECREASE:
181 {
182 if( pOLV )
183 {
184 ESelection aSel = pOLV->GetSelection();
185 aSel.Adjust();
186 sal_Int32 nStartPara = aSel.nStartPara;
187 sal_Int32 nEndPara = aSel.nEndPara;
188 if( !aSel.HasRange() )
189 {
190 nStartPara = 0;
191 nEndPara = pOLV->GetOutliner()->GetParagraphCount() - 1;
192 }
193
195 for( sal_Int32 nPara = nStartPara; nPara <= nEndPara; nPara++ )
196 {
197 SfxStyleSheet* pStyleSheet = nullptr;
198 if (pOLV->GetOutliner() != nullptr)
199 pStyleSheet = pOLV->GetOutliner()->GetStyleSheet(nPara);
200 if (pStyleSheet != nullptr)
201 {
202 SfxItemSet aAttr( pStyleSheet->GetItemSet() );
203 SfxItemSet aTmpSet( pOLV->GetOutliner()->GetParaAttribs( nPara ) );
204 aAttr.Put( aTmpSet, false ); // sal_False= InvalidItems is not default, handle it as "holes"
205 const SvxULSpaceItem& rItem = aAttr.Get( EE_PARA_ULSPACE );
206 std::unique_ptr<SvxULSpaceItem> pNewItem(rItem.Clone());
207
208 ::tools::Long nUpper = pNewItem->GetUpper();
209 if( nSlot == SID_PARASPACE_INCREASE )
210 nUpper += 100;
211 else
212 {
213 nUpper -= 100;
214 nUpper = std::max<::tools::Long>( nUpper, 0 );
215 }
216 pNewItem->SetUpper( static_cast<sal_uInt16>(nUpper) );
217
218 ::tools::Long nLower = pNewItem->GetLower();
219 if( nSlot == SID_PARASPACE_INCREASE )
220 nLower += 100;
221 else
222 {
223 nLower -= 100;
224 nLower = std::max<::tools::Long>( nLower, 0 );
225 }
226 pNewItem->SetLower( static_cast<sal_uInt16>(nLower) );
227
228 SfxItemSet aNewAttrs( aAttr );
229 aNewAttrs.Put( std::move(pNewItem) );
230 pOLV->GetOutliner()->SetParaAttribs( nPara, aNewAttrs );
231 }
232 }
233 pOLV->GetOutliner()->UndoActionEnd();
234 mpViewShell->Invalidate( SID_UNDO );
235 }
236 else
237 {
238 // the following code could be enabled, if I get a correct
239 // DontCare status from JOE.
240
241 // gets enabled, through it doesn't really work (see above)
242 SfxItemSet aEditAttr( mpView->GetDoc().GetPool() );
243 mpView->GetAttributes( aEditAttr );
244 if( aEditAttr.GetItemState( EE_PARA_ULSPACE ) >= SfxItemState::DEFAULT )
245 {
246 SfxItemSet aNewAttrs(*(aEditAttr.GetPool()), aEditAttr.GetRanges());
247 const SvxULSpaceItem& rItem = aEditAttr.Get( EE_PARA_ULSPACE );
248 std::unique_ptr<SvxULSpaceItem> pNewItem(rItem.Clone());
249 ::tools::Long nUpper = pNewItem->GetUpper();
250
251 if( nSlot == SID_PARASPACE_INCREASE )
252 nUpper += 100;
253 else
254 {
255 nUpper -= 100;
256 nUpper = std::max<::tools::Long>( nUpper, 0 );
257 }
258 pNewItem->SetUpper( static_cast<sal_uInt16>(nUpper) );
259
260 ::tools::Long nLower = pNewItem->GetLower();
261 if( nSlot == SID_PARASPACE_INCREASE )
262 nLower += 100;
263 else
264 {
265 nLower -= 100;
266 nLower = std::max<::tools::Long>( nLower, 0 );
267 }
268 pNewItem->SetLower( static_cast<sal_uInt16>(nLower) );
269
270 aNewAttrs.Put( std::move(pNewItem) );
271
272 mpView->SetAttributes( aNewAttrs );
273 }
274 }
275 rReq.Done();
276
277 Invalidate();
278 // to refresh preview (in outline mode), slot has to be invalidated:
279 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true );
280 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_PARA_ULSPACE, true );
281 }
282 break;
283
284 case SID_OUTLINE_LEFT:
285 {
286 if (pOLV)
287 {
288 pOLV->AdjustDepth( -1 );
289
290 // Ensure bold/italic etc. icon state updates
291 Invalidate();
292 // trigger preview refresh
293 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true );
294 }
295 rReq.Done();
296 }
297 break;
298
299 case SID_OUTLINE_RIGHT:
300 {
301 if (pOLV)
302 {
303 pOLV->AdjustDepth( 1 );
304
305 // Ensure bold/italic etc. icon state updates
306 Invalidate();
307 // trigger preview refresh
308 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true );
309 }
310 rReq.Done();
311 }
312 break;
313
314 case SID_ATTR_PARA_LRSPACE:
315 {
316 SvxLRSpaceItem aLRSpace = static_cast<const SvxLRSpaceItem&>(pArgs->Get(
317 SID_ATTR_PARA_LRSPACE));
318
320 aLRSpace.SetWhich( EE_PARA_LRSPACE );
321
322 aEditAttr.Put( aLRSpace );
323 mpView->SetAttributes( aEditAttr );
324
325 Invalidate(SID_ATTR_PARA_LRSPACE);
326 }
327 break;
328
329 case SID_HANGING_INDENT:
330 {
332 mpView->GetAttributes( aLRSpaceSet );
333 SvxLRSpaceItem aParaMargin( aLRSpaceSet.Get( EE_PARA_LRSPACE ) );
334
335 SvxLRSpaceItem aNewMargin( EE_PARA_LRSPACE );
336 aNewMargin.SetTextLeft( aParaMargin.GetTextLeft() + aParaMargin.GetTextFirstLineOffset() );
337 aNewMargin.SetRight( aParaMargin.GetRight() );
338 aNewMargin.SetTextFirstLineOffset( ( aParaMargin.GetTextFirstLineOffset() ) * -1 );
339 aLRSpaceSet.Put( aNewMargin );
340 mpView->SetAttributes( aLRSpaceSet );
341
342 Invalidate(SID_ATTR_PARA_LRSPACE);
343 }
344 break;
345
346 case SID_OUTLINE_UP:
347 {
348 if (pOLV)
349 {
350 pOLV->AdjustHeight( -1 );
351
352 // trigger preview refresh
353 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true );
354 }
355 rReq.Done();
356 }
357 break;
358
359 case SID_OUTLINE_DOWN:
360 {
361 if (pOLV)
362 {
363 pOLV->AdjustHeight( 1 );
364
365 // trigger preview refresh
366 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true );
367 }
368 rReq.Done();
369 }
370 break;
371
372 case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
373 case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
374 {
376 // tdf#131571: SdrEndTextEdit invalidates pTextEditOutlinerView, the pointer retrieved for pOLV
377 // so reinitialize pOLV
380 aAttr.Put( SvxWritingModeItem(
381 nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ?
382 css::text::WritingMode_LR_TB : css::text::WritingMode_TB_RL,
384 rReq.Done( aAttr );
385 mpView->SetAttributes( aAttr );
386 Invalidate();
387 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true );
388 }
389 break;
390
391 case FN_NUM_BULLET_ON:
392 {
393 if (pOLV)
394 {
395 bool bMasterPage = false;
396 SdrPageView* pPageView = mpView->GetSdrPageView();
397 if (pPageView)
398 {
399 SdPage* pPage = static_cast<SdPage*>(pPageView->GetPage());
400 bMasterPage = pPage && (pPage->GetPageKind() == PageKind::Standard) && pPage->IsMasterPage();
401 }
402
403 if (!bMasterPage)
404 pOLV->ToggleBullets();
405 else
406 {
407 //Resolves: fdo#78151 in master pages if we toggle bullets on
408 //and off then just disable/enable the bulleting, but do not
409 //change the *level* of the paragraph, because the paragraph is
410 //effectively a preview of the equivalent style level, and
411 //changing the level disconnects it from the style
412
413 ::Outliner* pOL = pOLV->GetOutliner();
414 if (pOL)
415 {
416 const SvxNumBulletItem *pItem = nullptr;
418 OUString sStyleName(SdResId(STR_PSEUDOSHEET_OUTLINE) + " 1");
419 SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find(sStyleName, SfxStyleFamily::Pseudo);
420 if( pFirstStyleSheet )
421 pItem = pFirstStyleSheet->GetItemSet().GetItemIfSet(EE_PARA_NUMBULLET, false);
422
423 if (pItem )
424 {
425 SvxNumRule aNewRule(pItem->GetNumRule());
426 ESelection aSel = pOLV->GetSelection();
427 aSel.Adjust();
428 sal_Int32 nStartPara = aSel.nStartPara;
429 sal_Int32 nEndPara = aSel.nEndPara;
430 for (sal_Int32 nPara = nStartPara; nPara <= nEndPara; ++nPara)
431 {
432 sal_uInt16 nLevel = pOL->GetDepth(nPara);
433 SvxNumberFormat aFmt(aNewRule.GetLevel(nLevel));
434
436 {
439 }
440 else
441 {
443 aFmt.SetAbsLSpace(0);
444 aFmt.SetFirstLineOffset(0);
445 }
446
447 aNewRule.SetLevel(nLevel, aFmt);
448 }
449
450 pFirstStyleSheet->GetItemSet().Put(SvxNumBulletItem(std::move(aNewRule), EE_PARA_NUMBULLET));
451
453 }
454 }
455 }
456 }
457 break;
458 }
459 case SID_GROW_FONT_SIZE:
460 case SID_SHRINK_FONT_SIZE:
461 {
462 const SvxFontListItem* pFonts = static_cast<const SvxFontListItem*>(mpViewShell->GetDocSh()->GetItem( SID_ATTR_CHAR_FONTLIST ));
463 const FontList* pFontList = pFonts ? pFonts->GetFontList(): nullptr;
464 if( pFontList )
465 {
466 FuText::ChangeFontSize( nSlot == SID_GROW_FONT_SIZE, pOLV, pFontList, mpView );
467 if( pOLV )
468 pOLV->SetAttribs( pOLV->GetEditView().GetEmptyItemSet() );
469 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
470 }
471 rReq.Done();
472 }
473 break;
474
475 case SID_THES:
476 {
477 OUString aReplaceText;
478 const SfxStringItem* pItem2 = rReq.GetArg(FN_PARAM_THES_WORD_REPLACE);
479 if (pItem2)
480 aReplaceText = pItem2->GetValue();
481 if (!aReplaceText.isEmpty())
482 ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText );
483 }
484 break;
485
486 default:
487 {
488 SfxItemSet aEditAttr( mpView->GetDoc().GetPool() );
489 mpView->GetAttributes( aEditAttr );
490 SfxItemSet aNewAttr(*(aEditAttr.GetPool()), aEditAttr.GetRanges());
491
492 if( !pArgs )
493 {
494 //aNewAttr.InvalidateAllItems(); <- produces problems (#35465#)
495
496 switch ( nSlot )
497 {
498 case SID_ATTR_CHAR_WEIGHT:
499 {
500 FontWeight eFW = aEditAttr.Get( EE_CHAR_WEIGHT ).GetWeight();
501 aNewAttr.Put( SvxWeightItem( eFW == WEIGHT_NORMAL ?
503 EE_CHAR_WEIGHT ) );
504 }
505 break;
506 case SID_ATTR_CHAR_POSTURE:
507 {
508 FontItalic eFI = aEditAttr.Get( EE_CHAR_ITALIC ).GetPosture();
509 aNewAttr.Put( SvxPostureItem( eFI == ITALIC_NORMAL ?
511 EE_CHAR_ITALIC ) );
512 }
513 break;
514 case SID_ATTR_CHAR_UNDERLINE:
515 {
516 FontLineStyle eFU = aEditAttr.Get( EE_CHAR_UNDERLINE ).GetLineStyle();
517 aNewAttr.Put( SvxUnderlineItem( eFU == LINESTYLE_SINGLE ?
520 }
521 break;
522
523 case SID_ULINE_VAL_NONE:
524 {
526 break;
527 }
528
529 case SID_ULINE_VAL_SINGLE:
530 case SID_ULINE_VAL_DOUBLE:
531 case SID_ULINE_VAL_DOTTED:
532 {
533 FontLineStyle eOld = aEditAttr.Get(EE_CHAR_UNDERLINE).GetLineStyle();
534 FontLineStyle eNew = eOld;
535
536 switch (nSlot)
537 {
538 case SID_ULINE_VAL_SINGLE:
539 eNew = ( eOld == LINESTYLE_SINGLE ) ? LINESTYLE_NONE : LINESTYLE_SINGLE;
540 break;
541 case SID_ULINE_VAL_DOUBLE:
542 eNew = ( eOld == LINESTYLE_DOUBLE ) ? LINESTYLE_NONE : LINESTYLE_DOUBLE;
543 break;
544 case SID_ULINE_VAL_DOTTED:
545 eNew = ( eOld == LINESTYLE_DOTTED ) ? LINESTYLE_NONE : LINESTYLE_DOTTED;
546 break;
547 }
548
549 SvxUnderlineItem aUnderline(eNew, EE_CHAR_UNDERLINE);
550 aNewAttr.Put(aUnderline);
551 }
552 break;
553
554 case SID_ATTR_CHAR_OVERLINE:
555 {
556 FontLineStyle eFO = aEditAttr.Get( EE_CHAR_OVERLINE ).GetLineStyle();
557 aNewAttr.Put( SvxOverlineItem( eFO == LINESTYLE_SINGLE ?
560 }
561 break;
562 case SID_ATTR_CHAR_CONTOUR:
563 {
564 aNewAttr.Put( SvxContourItem( !aEditAttr.Get( EE_CHAR_OUTLINE ).GetValue(), EE_CHAR_OUTLINE ) );
565 }
566 break;
567 case SID_ATTR_CHAR_SHADOWED:
568 {
569 aNewAttr.Put( SvxShadowedItem( !aEditAttr.Get( EE_CHAR_SHADOW ).GetValue(), EE_CHAR_SHADOW ) );
570 }
571 break;
572 case SID_ATTR_CHAR_CASEMAP:
573 {
574 aNewAttr.Put( aEditAttr.Get( EE_CHAR_CASEMAP ) );
575 }
576 break;
577 case SID_ATTR_CHAR_STRIKEOUT:
578 {
579 FontStrikeout eFSO = aEditAttr.Get( EE_CHAR_STRIKEOUT ).GetStrikeout();
580 aNewAttr.Put( SvxCrossedOutItem( eFSO == STRIKEOUT_SINGLE ?
582 }
583 break;
584
585 case SID_ATTR_PARA_ADJUST_LEFT:
586 {
587 aNewAttr.Put( SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ) );
588 }
589 break;
590 case SID_ATTR_PARA_ADJUST_CENTER:
591 {
592 aNewAttr.Put( SvxAdjustItem( SvxAdjust::Center, EE_PARA_JUST ) );
593 }
594 break;
595 case SID_ATTR_PARA_ADJUST_RIGHT:
596 {
597 aNewAttr.Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) );
598 }
599 break;
600 case SID_ATTR_PARA_ADJUST_BLOCK:
601 {
602 aNewAttr.Put( SvxAdjustItem( SvxAdjust::Block, EE_PARA_JUST ) );
603 }
604 break;
605 case SID_ATTR_PARA_LINESPACE_10:
606 {
608 aItem.SetPropLineSpace( 100 );
609 aNewAttr.Put( aItem );
610 }
611 break;
612 case SID_ATTR_PARA_LINESPACE_15:
613 {
615 aItem.SetPropLineSpace( 150 );
616 aNewAttr.Put( aItem );
617 }
618 break;
619 case SID_ATTR_PARA_LINESPACE_20:
620 {
622 aItem.SetPropLineSpace( 200 );
623 aNewAttr.Put( aItem );
624 }
625 break;
626 case SID_SET_SUPER_SCRIPT:
627 {
629 SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
630
631 if( eEsc == SvxEscapement::Superscript )
632 aItem.SetEscapement( SvxEscapement::Off );
633 else
634 aItem.SetEscapement( SvxEscapement::Superscript );
635 aNewAttr.Put( aItem );
636 }
637 break;
638 case SID_SET_SUB_SCRIPT:
639 {
641 SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
642
643 if( eEsc == SvxEscapement::Subscript )
644 aItem.SetEscapement( SvxEscapement::Off );
645 else
646 aItem.SetEscapement( SvxEscapement::Subscript );
647 aNewAttr.Put( aItem );
648 }
649 break;
650
651 // attributes for TextObjectBar
652 case SID_ATTR_CHAR_FONT:
654 Execute( SID_CHAR_DLG, SfxCallMode::ASYNCHRON );
655 break;
656 case SID_ATTR_CHAR_FONTHEIGHT:
658 Execute( SID_CHAR_DLG, SfxCallMode::ASYNCHRON );
659 break;
660 case SID_ATTR_CHAR_COLOR:
661 break;
662// #i35937# removed need for FN_NUM_BULLET_ON handling
663 }
664
665 rReq.Done( aNewAttr );
666 pArgs = rReq.GetArgs();
667 }
668 else if ( nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT ||
669 nSlot == SID_ATTR_PARA_RIGHT_TO_LEFT )
670 {
671 bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT;
672
673 SvxAdjust nAdjust = SvxAdjust::Left;
674 if( const SvxAdjustItem* pAdjustItem = aEditAttr.GetItemIfSet(EE_PARA_JUST) )
675 nAdjust = pAdjustItem->GetAdjust();
676
677 if( bLeftToRight )
678 {
679 aNewAttr.Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_LR_TB, EE_PARA_WRITINGDIR ) );
680 if( nAdjust == SvxAdjust::Right )
681 aNewAttr.Put( SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ) );
682 }
683 else
684 {
685 aNewAttr.Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_RL_TB, EE_PARA_WRITINGDIR ) );
686 if( nAdjust == SvxAdjust::Left )
687 aNewAttr.Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) );
688 }
689
690 rReq.Done( aNewAttr );
691 pArgs = rReq.GetArgs();
692
693 Invalidate( SID_RULER_TEXT_RIGHT_TO_LEFT );
694 }
695 else if ( nSlot == SID_ATTR_CHAR_FONT ||
696 nSlot == SID_ATTR_CHAR_FONTHEIGHT ||
697 nSlot == SID_ATTR_CHAR_POSTURE ||
698 nSlot == SID_ATTR_CHAR_WEIGHT )
699 {
700 // #i78017 establish the same behaviour as in Writer
701 SvtScriptType nScriptType = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
702 if (nSlot == SID_ATTR_CHAR_FONT)
703 nScriptType = mpView->GetScriptType();
704
705 SfxItemPool& rPool = mpView->GetDoc().GetPool();
706 SvxScriptSetItem aSvxScriptSetItem( nSlot, rPool );
707 aSvxScriptSetItem.PutItemForScriptType( nScriptType, pArgs->Get( rPool.GetWhich( nSlot ) ) );
708 aNewAttr.Put( aSvxScriptSetItem.GetItemSet() );
709 rReq.Done( aNewAttr );
710 pArgs = rReq.GetArgs();
711 }
712 else if (nSlot == SID_ATTR_PARA_ADJUST_LEFT ||
713 nSlot == SID_ATTR_PARA_ADJUST_CENTER ||
714 nSlot == SID_ATTR_PARA_ADJUST_RIGHT ||
715 nSlot == SID_ATTR_PARA_ADJUST_BLOCK)
716 {
717 switch( nSlot )
718 {
719 case SID_ATTR_PARA_ADJUST_LEFT:
720 {
721 aNewAttr.Put( SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ) );
722 }
723 break;
724 case SID_ATTR_PARA_ADJUST_CENTER:
725 {
726 aNewAttr.Put( SvxAdjustItem( SvxAdjust::Center, EE_PARA_JUST ) );
727 }
728 break;
729 case SID_ATTR_PARA_ADJUST_RIGHT:
730 {
731 aNewAttr.Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) );
732 }
733 break;
734 case SID_ATTR_PARA_ADJUST_BLOCK:
735 {
736 aNewAttr.Put( SvxAdjustItem( SvxAdjust::Block, EE_PARA_JUST ) );
737 }
738 break;
739 }
740 rReq.Done( aNewAttr );
741 pArgs = rReq.GetArgs();
742 }
743 else if(nSlot == SID_ATTR_CHAR_KERNING)
744 {
745 aNewAttr.Put(pArgs->Get(pArgs->GetPool()->GetWhich(nSlot)));
746 rReq.Done( aNewAttr );
747 pArgs = rReq.GetArgs();
748 }
749 else if(nSlot == SID_SET_SUPER_SCRIPT )
750 {
752 SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
753
754 if( eEsc == SvxEscapement::Superscript )
755 aItem.SetEscapement( SvxEscapement::Off );
756 else
757 aItem.SetEscapement( SvxEscapement::Superscript );
758 aNewAttr.Put( aItem );
759 rReq.Done( aNewAttr );
760 pArgs = rReq.GetArgs();
761 }
762 else if( nSlot == SID_SET_SUB_SCRIPT )
763 {
765 SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
766
767 if( eEsc == SvxEscapement::Subscript )
768 aItem.SetEscapement( SvxEscapement::Off );
769 else
770 aItem.SetEscapement( SvxEscapement::Subscript );
771 aNewAttr.Put( aItem );
772 rReq.Done( aNewAttr );
773 pArgs = rReq.GetArgs();
774 }
775
776 std::unique_ptr<SfxItemSet> pNewArgs = pArgs->Clone();
777
778 // Merge the color parameters to the color itself.
779 std::unique_ptr<SvxColorItem> pColorItem;
780 if (nSlot == SID_ATTR_CHAR_COLOR)
781 {
782 pColorItem = std::make_unique<SvxColorItem>(pNewArgs->Get(EE_CHAR_COLOR));
783 model::ComplexColor aComplexColor;
784
785 if (const SfxInt16Item* pIntItem = pArgs->GetItemIfSet(SID_ATTR_COLOR_THEME_INDEX, false))
786 {
787 aComplexColor.setSchemeColor(model::convertToThemeColorType(pIntItem->GetValue()));
788 }
789 if (const SfxInt16Item* pIntItem = pArgs->GetItemIfSet(SID_ATTR_COLOR_LUM_MOD, false))
790 {
791 aComplexColor.addTransformation({model::TransformationType::LumMod, pIntItem->GetValue()});
792 }
793 if (const SfxInt16Item* pIntItem = pArgs->GetItemIfSet(SID_ATTR_COLOR_LUM_OFF, false))
794 {
795 aComplexColor.addTransformation({model::TransformationType::LumOff, pIntItem->GetValue()});
796 }
797 pColorItem->setComplexColor(aComplexColor);
798 pNewArgs->Put(std::move(pColorItem));
799 }
800
801 mpView->SetAttributes(*pNewArgs);
802
803 // invalidate entire shell because of performance and
804 // extension reasons
805 Invalidate();
806
807 // to refresh preview (in outline mode), slot has to be invalidated:
808 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true );
809 }
810 break;
811 }
812
813 if ( nSlot != SID_STYLE_APPLY && pOLV )
814 {
815 pOLV->ShowCursor();
816 pOLV->GetWindow()->GrabFocus();
817 }
818
819 Invalidate( SID_OUTLINE_LEFT );
820 Invalidate( SID_OUTLINE_RIGHT );
821 Invalidate( SID_OUTLINE_UP );
822 Invalidate( SID_OUTLINE_DOWN );
823}
824
825} // end of namespace sd
826
827/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const OUString & GetValue() const
const SfxItemSet & GetEmptyItemSet() const
void ToggleBullets()
void AdjustDepth(short nDX)
vcl::Window * GetWindow() const
ESelection GetSelection() const
void AdjustHeight(tools::Long nDY)
Outliner * GetOutliner() const
void SetAttribs(const SfxItemSet &)
EditView & GetEditView() const
void ShowCursor(bool bGotoCursor=true, bool bActivate=false)
sal_Int16 GetDepth(sal_Int32 nPara) const
void SetParaAttribs(sal_Int32 nPara, const SfxItemSet &)
void UndoActionStart(sal_uInt16 nId)
SfxItemSet const & GetParaAttribs(sal_Int32 nPara) const
SfxStyleSheet * GetStyleSheet(sal_Int32 nPara)
void UndoActionEnd()
sal_Int32 GetParagraphCount() const
SAL_DLLPRIVATE SfxItemPool & GetPool()
Definition: drawdoc.hxx:237
PageKind GetPageKind() const
Definition: sdpage.hxx:205
static void setDefaultOutlineNumberFormatBulletAndIndent(sal_uInt16 i, SvxNumberFormat &rNumberFormat)
Definition: stlpool.cxx:1017
static void BroadcastSdStyleSheetChange(SfxStyleSheetBase const *pStyleSheet, PresentationObjects ePO, SfxStyleSheetBasePool *pSSPool)
Definition: stlsheet.cxx:1512
const OutlinerView * GetTextEditOutlinerView() const
virtual SvtScriptType GetScriptType() const
SdrPage * GetPage() const
bool IsMasterPage() const
SdrPageView * GetSdrPageView() 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
const WhichRangesContainer & GetRanges() const
SfxItemPool * GetPool() const
virtual std::unique_ptr< SfxItemSet > Clone(bool bItems=true, SfxItemPool *pToPool=nullptr) 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
sal_uInt16 GetSlot() const
const SfxItemSet * GetArgs() const
const T * GetArg(sal_uInt16 nSlotId) const
void Done(bool bRemove=false)
SfxItemPool & GetPool() const
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
virtual void Invalidate(sal_uInt16 nId=0)
SfxViewShell * GetViewShell() const
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
virtual SfxItemSet & GetItemSet()
SfxBindings & GetBindings()
SfxDispatcher * GetDispatcher()
vcl::Window * GetWindow() const
void SetEscapement(const SvxEscapement eNew)
const FontList * GetFontList() const
short GetTextFirstLineOffset() const
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
tools::Long GetRight() const
virtual SvxLRSpaceItem * Clone(SfxItemPool *pPool=nullptr) const override
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp=100)
tools::Long GetTextLeft() const
void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp=100)
void SetPropLineSpace(const sal_uInt16 nProp)
const SvxNumRule & GetNumRule() const
const SvxNumberFormat & GetLevel(sal_uInt16 nLevel) const
void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat &rFmt, bool bIsValid=true)
void SetAbsLSpace(sal_Int32 nSet)
void SetFirstLineOffset(sal_Int32 nSet)
void SetNumberingType(SvxNumType nSet)
SvxNumType GetNumberingType() const
void PutItemForScriptType(SvtScriptType nScriptType, const SfxPoolItem &rItem)
virtual SvxULSpaceItem * Clone(SfxItemPool *pPool=nullptr) const override
void setSchemeColor(ThemeColorType eType)
void addTransformation(Transformation const &rTransform)
virtual SfxStyleSheetBasePool * GetStyleSheetPool() override
Definition: docshel4.cxx:690
static rtl::Reference< FuPoor > Create(ViewShell *pViewSh, ::sd::Window *pWin, ::sd::View *pView, SdDrawDocument *pDoc, SfxRequest &rReq)
Definition: futempl.cxx:87
static void ChangeFontSize(bool, OutlinerView *, const FontList *, ::sd::View *)
Definition: futext.cxx:1345
Derivative of sd::View for the outline mode |* .
Definition: OutlineView.hxx:55
ViewShell * mpViewShell
::sd::View * mpView
void Execute(SfxRequest &rReq)
Process SfxRequests.
Definition: drtxtob1.cxx:75
SD_DLLPUBLIC DrawDocShell * GetDocSh() const
Definition: viewshel.cxx:1407
::sd::Window * GetActiveWindow() const
The active window is usually the mpContentWindow.
Definition: ViewShell.hxx:155
SD_DLLPUBLIC SfxViewFrame * GetViewFrame() const
Definition: viewshel.cxx:118
DrawDocShell * GetDocSh() const
Definition: View.hxx:142
virtual bool SetAttributes(const SfxItemSet &rSet, bool bReplaceAll=false, bool bSlide=false, bool bMaster=false)
Definition: sdview.cxx:509
virtual void GetAttributes(SfxItemSet &rTargetSet, bool bOnlyHardAttr=false) const
Definition: sdview.cxx:515
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false) override
ends current text editing
Definition: sdview.cxx:772
SdDrawDocument & GetDoc() const
Definition: View.hxx:293
An SdWindow contains the actual working area of ViewShell.
Definition: Window.hxx:45
void GrabFocus()
constexpr TypedWhichId< SvxContourItem > EE_CHAR_OUTLINE(EE_CHAR_START+8)
constexpr TypedWhichId< SvxUnderlineItem > EE_CHAR_UNDERLINE(EE_CHAR_START+5)
constexpr TypedWhichId< SvxAdjustItem > EE_PARA_JUST(EE_PARA_START+16)
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< SvxColorItem > EE_CHAR_COLOR(EE_CHAR_START+0)
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< SvxCaseMapItem > EE_CHAR_CASEMAP(EE_CHAR_START+30)
constexpr TypedWhichId< SvxNumBulletItem > EE_PARA_NUMBULLET(EE_PARA_START+5)
FontLineStyle
LINESTYLE_SINGLE
LINESTYLE_DOUBLE
LINESTYLE_NONE
LINESTYLE_DOTTED
FontStrikeout
STRIKEOUT_SINGLE
STRIKEOUT_NONE
FontItalic
ITALIC_NORMAL
ITALIC_NONE
WEIGHT_BOLD
WEIGHT_NORMAL
SvtScriptType
sal_Int16 nAdjust
#define LINE_SPACE_DEFAULT_HEIGHT
constexpr ThemeColorType convertToThemeColorType(sal_Int32 nIndex)
FontWeight
long Long
#define OLUNDO_ATTR
void ReplaceTextWithSynonym(EditView &rEditView, const OUString &rSynonmText)
OUString SdResId(TranslateId aId)
Definition: sdmod.cxx:83
bool HasRange() const
sal_Int32 nStartPara
void Adjust()
sal_Int32 nEndPara
constexpr TypedWhichId< SvxWritingModeItem > SDRATTR_TEXTDIRECTION(SDRATTR_NOTPERSIST_FIRST+34)
SvxEscapement
SVX_NUM_NUMBER_NONE
SVX_NUM_CHAR_SPECIAL
SvxAdjust