LibreOffice Module sc (master)  1
formatsh.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 <com/sun/star/style/XStyleFamiliesSupplier.hpp>
21 #include <com/sun/star/beans/XPropertySet.hpp>
22 #include <com/sun/star/container/XNameAccess.hpp>
23 
24 #include <scitems.hxx>
25 #include <editeng/borderline.hxx>
26 
27 #include <sfx2/viewfrm.hxx>
28 #include <sfx2/bindings.hxx>
29 #include <sfx2/newstyle.hxx>
30 #include <sfx2/objface.hxx>
31 #include <sfx2/request.hxx>
32 #include <sfx2/sfxdlg.hxx>
33 #include <svl/whiter.hxx>
34 
35 #include <svl/stritem.hxx>
36 #include <svl/zformat.hxx>
37 #include <svl/languageoptions.hxx>
38 #include <editeng/boxitem.hxx>
39 #include <editeng/langitem.hxx>
40 #include <svx/numinf.hxx>
41 #include <sfx2/dispatch.hxx>
42 #include <sfx2/tplpitem.hxx>
43 #include <editeng/svxenum.hxx>
44 #include <editeng/wghtitem.hxx>
45 #include <editeng/postitem.hxx>
46 #include <editeng/udlnitem.hxx>
47 #include <editeng/lineitem.hxx>
48 #include <editeng/colritem.hxx>
49 #include <editeng/brushitem.hxx>
50 #include <editeng/frmdiritem.hxx>
52 #include <editeng/shaditem.hxx>
53 #include <editeng/justifyitem.hxx>
54 #include <editeng/fhgtitem.hxx>
55 #include <sal/log.hxx>
56 #include <comphelper/lok.hxx>
57 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
58 
59 #include <formatsh.hxx>
60 #include <sc.hrc>
61 #include <globstr.hrc>
62 #include <scresid.hxx>
63 #include <docsh.hxx>
64 #include <patattr.hxx>
65 #include <scmod.hxx>
66 #include <stlpool.hxx>
67 #include <stlsheet.hxx>
68 #include <printfun.hxx>
69 #include <docpool.hxx>
70 #include <tabvwsh.hxx>
71 #include <undostyl.hxx>
72 #include <markdata.hxx>
73 #include <attrib.hxx>
74 
75 #define ShellClass_ScFormatShell
76 #define ShellClass_TableFont
77 #define ShellClass_FormatForSelection
78 #include <scslots.hxx>
79 
80 #include <scabstdlg.hxx>
81 #include <editeng/fontitem.hxx>
83 
84 #include <memory>
85 
86 using namespace ::com::sun::star;
87 
88 namespace {
89 
90 SvxCellHorJustify lclConvertSlotToHAlign( sal_uInt16 nSlot )
91 {
92  SvxCellHorJustify eHJustify = SvxCellHorJustify::Standard;
93  switch( nSlot )
94  {
95  case SID_ALIGN_ANY_HDEFAULT: eHJustify = SvxCellHorJustify::Standard; break;
96  case SID_ALIGN_ANY_LEFT: eHJustify = SvxCellHorJustify::Left; break;
97  case SID_ALIGN_ANY_HCENTER: eHJustify = SvxCellHorJustify::Center; break;
98  case SID_ALIGN_ANY_RIGHT: eHJustify = SvxCellHorJustify::Right; break;
99  case SID_ALIGN_ANY_JUSTIFIED: eHJustify = SvxCellHorJustify::Block; break;
100  default: OSL_FAIL( "lclConvertSlotToHAlign - invalid slot" );
101  }
102  return eHJustify;
103 }
104 
105 SvxCellVerJustify lclConvertSlotToVAlign( sal_uInt16 nSlot )
106 {
107  SvxCellVerJustify eVJustify = SvxCellVerJustify::Standard;
108  switch( nSlot )
109  {
110  case SID_ALIGN_ANY_VDEFAULT: eVJustify = SvxCellVerJustify::Standard; break;
111  case SID_ALIGN_ANY_TOP: eVJustify = SvxCellVerJustify::Top; break;
112  case SID_ALIGN_ANY_VCENTER: eVJustify = SvxCellVerJustify::Center; break;
113  case SID_ALIGN_ANY_BOTTOM: eVJustify = SvxCellVerJustify::Bottom; break;
114  default: OSL_FAIL( "lclConvertSlotToVAlign - invalid slot" );
115  }
116  return eVJustify;
117 }
118 
119 } // namespace
120 
121 
123 
124 void ScFormatShell::InitInterface_Impl()
125 {
126  GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT,
127  SfxVisibilityFlags::Standard | SfxVisibilityFlags::Server,
128  ToolbarId::Objectbar_Format);
129 }
130 
132  SfxShell(rData.GetViewShell()),
133  rViewData(rData)
134 {
135  ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
136 
137  SetPool( &pTabViewShell->GetPool() );
139  SetUndoManager( pMgr );
141  {
142  pMgr->SetMaxUndoActionCount( 0 );
143  }
144  SetName("Format");
145 }
146 
148 {
149 }
150 
152 {
153  ScDocument& rDoc = GetViewData().GetDocument();
154  ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
155  SfxStyleSheetBasePool* pStylePool = rDoc.GetStyleSheetPool();
156 
157  bool bProtected = false;
158  SCTAB nTabCount = rDoc.GetTableCount();
159  for (SCTAB i=0; i<nTabCount && !bProtected; i++)
160  if (rDoc.IsTabProtected(i)) // look after protected table
161  bProtected = true;
162 
163  SfxWhichIter aIter(rSet);
164  sal_uInt16 nWhich = aIter.FirstWhich();
165  sal_uInt16 nSlotId = 0;
166 
167  while ( nWhich )
168  {
169  nSlotId = SfxItemPool::IsWhich( nWhich )
170  ? GetPool().GetSlotId( nWhich )
171  : nWhich;
172 
173  switch ( nSlotId )
174  {
175  case SID_STYLE_APPLY:
176  if ( !pStylePool )
177  rSet.DisableItem( nSlotId );
178  break;
179 
180  case SID_STYLE_FAMILY2: // cell style sheets
181  {
182  SfxStyleSheet* pStyleSheet = const_cast<SfxStyleSheet*>(
183  pTabViewShell->GetStyleSheetFromMarked());
184 
185  if ( pStyleSheet )
186  rSet.Put( SfxTemplateItem( nSlotId, pStyleSheet->GetName() ) );
187  else
188  rSet.Put( SfxTemplateItem( nSlotId, OUString() ) );
189  }
190  break;
191 
192  case SID_STYLE_FAMILY4: // page style sheets
193  {
194  SCTAB nCurTab = GetViewData().GetTabNo();
195  OUString aPageStyle = rDoc.GetPageStyle( nCurTab );
196  SfxStyleSheet* pStyleSheet = pStylePool ? static_cast<SfxStyleSheet*>(pStylePool->
197  Find( aPageStyle, SfxStyleFamily::Page )) : nullptr;
198 
199  if ( pStyleSheet )
200  rSet.Put( SfxTemplateItem( nSlotId, aPageStyle ) );
201  else
202  rSet.Put( SfxTemplateItem( nSlotId, OUString() ) );
203  }
204  break;
205 
206  case SID_STYLE_WATERCAN:
207  {
208  rSet.Put( SfxBoolItem( nSlotId, SC_MOD()->GetIsWaterCan() ) );
209  }
210  break;
211 
212  case SID_STYLE_UPDATE_BY_EXAMPLE:
213  {
214  std::unique_ptr<SfxPoolItem> pItem;
215  pTabViewShell->GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pItem);
216  SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem.get());
217 
218  bool bPage = pFamilyItem && SfxStyleFamily::Page == static_cast<SfxStyleFamily>(pFamilyItem->GetValue());
219 
220  if ( bProtected || bPage )
221  rSet.DisableItem( nSlotId );
222  }
223  break;
224 
225  case SID_STYLE_EDIT:
226  case SID_STYLE_DELETE:
227  case SID_STYLE_HIDE:
228  case SID_STYLE_SHOW:
229  {
230  std::unique_ptr<SfxPoolItem> pItem;
231  pTabViewShell->GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pItem);
232  SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem.get());
233  bool bPage = pFamilyItem && SfxStyleFamily::Page == static_cast<SfxStyleFamily>(pFamilyItem->GetValue());
234 
235  if ( bProtected && !bPage )
236  rSet.DisableItem( nSlotId );
237  }
238  break;
239 
240  default:
241  break;
242  }
243 
244  nWhich = aIter.NextWhich();
245  }
246 }
247 
249 {
250  const SfxItemSet* pArgs = rReq.GetArgs();
251  const sal_uInt16 nSlotId = rReq.GetSlot();
252  if ( !pArgs && nSlotId != SID_STYLE_NEW_BY_EXAMPLE && nSlotId != SID_STYLE_UPDATE_BY_EXAMPLE )
253  {
254  // in case of vertical toolbar
255  rViewData.GetDispatcher().Execute( SID_STYLE_DESIGNER, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
256  return;
257  }
258 
259  SfxBindings& rBindings = rViewData.GetBindings();
260  const SCTAB nCurTab = GetViewData().GetTabNo();
261  ScDocShell* pDocSh = GetViewData().GetDocShell();
262  ScTabViewShell* pTabViewShell= GetViewData().GetViewShell();
263  ScDocument& rDoc = pDocSh->GetDocument();
264  ScMarkData& rMark = GetViewData().GetMarkData();
265  ScModule* pScMod = SC_MOD();
266  OUString aRefName;
267  bool bUndo = rDoc.IsUndoEnabled();
268  SfxStyleSheetBasePool* pStylePool = rDoc.GetStyleSheetPool();
269 
270  if ( (nSlotId == SID_STYLE_PREVIEW)
271  || (nSlotId == SID_STYLE_END_PREVIEW) )
272  {
273  if (nSlotId == SID_STYLE_PREVIEW)
274  {
275  SfxStyleFamily eFamily = SfxStyleFamily::Para;
276  const SfxPoolItem* pFamItem;
277  if ( pArgs && SfxItemState::SET == pArgs->GetItemState( SID_STYLE_FAMILY, true, &pFamItem ) )
278  eFamily = static_cast<SfxStyleFamily>(static_cast<const SfxUInt16Item*>(pFamItem)->GetValue());
279  const SfxPoolItem* pNameItem;
280  OUString aStyleName;
281  if (pArgs && SfxItemState::SET == pArgs->GetItemState( nSlotId, true, &pNameItem ))
282  aStyleName = static_cast<const SfxStringItem*>(pNameItem)->GetValue();
283  if ( eFamily == SfxStyleFamily::Para ) // CellStyles
284  {
285  ScMarkData aFuncMark( rViewData.GetMarkData() );
286  ScViewUtil::UnmarkFiltered( aFuncMark, rDoc );
287  aFuncMark.MarkToMulti();
288 
289  if ( !aFuncMark.IsMarked() && !aFuncMark.IsMultiMarked() )
290  {
291  SCCOL nCol = rViewData.GetCurX();
292  SCROW nRow = rViewData.GetCurY();
293  SCTAB nTab = rViewData.GetTabNo();
294  ScRange aRange( nCol, nRow, nTab );
295  aFuncMark.SetMarkArea( aRange );
296  }
297  rDoc.SetPreviewSelection( aFuncMark );
298  ScStyleSheet* pPreviewStyle = static_cast<ScStyleSheet*>( pStylePool->Find( aStyleName, eFamily ) );
299  rDoc.SetPreviewCellStyle( pPreviewStyle );
300  ScPatternAttr aAttr( *rDoc.GetSelectionPattern( aFuncMark ) );
301  aAttr.SetStyleSheet( pPreviewStyle );
302 
303  SfxItemSet aItemSet( GetPool() );
304 
305  ScPatternAttr aNewAttrs( GetViewData().GetDocument().GetPool() );
306  SfxItemSet& rNewSet = aNewAttrs.GetItemSet();
307  rNewSet.Put( aItemSet, false );
308 
309  rDoc.ApplySelectionPattern( aNewAttrs, rDoc.GetPreviewSelection() );
310  pTabViewShell->UpdateSelectionArea( aFuncMark, &aAttr );
311  }
312  }
313  else
314  {
315  // No mark at all happens when creating a new document, in which
316  // case the selection pattern obtained would be empty (created of
317  // GetPool()) anyway and nothing needs to be applied.
318  ScMarkData aPreviewMark( rDoc.GetPreviewSelection());
319  if (aPreviewMark.IsMarked() || aPreviewMark.IsMultiMarked())
320  {
321  ScPatternAttr aAttr( *rDoc.GetSelectionPattern( aPreviewMark ) );
322  if ( ScStyleSheet* pPreviewStyle = rDoc.GetPreviewCellStyle() )
323  aAttr.SetStyleSheet( pPreviewStyle );
324  rDoc.SetPreviewCellStyle(nullptr);
325 
326  SfxItemSet aItemSet( GetPool() );
327 
328  ScPatternAttr aNewAttrs( GetViewData().GetDocument().GetPool() );
329  SfxItemSet& rNewSet = aNewAttrs.GetItemSet();
330  rNewSet.Put( aItemSet, false );
331  rDoc.ApplySelectionPattern( aNewAttrs, aPreviewMark );
332  pTabViewShell->UpdateSelectionArea( aPreviewMark, &aAttr );
333  }
334  }
335  }
336  else if ( (nSlotId == SID_STYLE_NEW)
337  || (nSlotId == SID_STYLE_EDIT)
338  || (nSlotId == SID_STYLE_DELETE)
339  || (nSlotId == SID_STYLE_HIDE)
340  || (nSlotId == SID_STYLE_SHOW)
341  || (nSlotId == SID_STYLE_APPLY)
342  || (nSlotId == SID_STYLE_WATERCAN)
343  || (nSlotId == SID_STYLE_FAMILY)
344  || (nSlotId == SID_STYLE_NEW_BY_EXAMPLE)
345  || (nSlotId == SID_STYLE_UPDATE_BY_EXAMPLE) )
346  {
347  SfxStyleSheetBase* pStyleSheet = nullptr;
348 
349  bool bStyleToMarked = false;
350  bool bListAction = false;
351  bool bAddUndo = false; // add ScUndoModifyStyle (style modified)
352  ScStyleSaveData aOldData; // for undo/redo
353  ScStyleSaveData aNewData;
354 
355  SfxStyleFamily eFamily = SfxStyleFamily::Para;
356  const SfxPoolItem* pFamItem;
357  if ( pArgs && SfxItemState::SET == pArgs->GetItemState( SID_STYLE_FAMILY, true, &pFamItem ) )
358  eFamily = static_cast<SfxStyleFamily>(static_cast<const SfxUInt16Item*>(pFamItem)->GetValue());
359  else if ( pArgs && SfxItemState::SET == pArgs->GetItemState( SID_STYLE_FAMILYNAME, true, &pFamItem ) )
360  {
361  OUString sFamily = static_cast<const SfxStringItem*>(pFamItem)->GetValue();
362  if (sFamily == "CellStyles")
363  eFamily = SfxStyleFamily::Para;
364  else if (sFamily == "PageStyles")
365  eFamily = SfxStyleFamily::Page;
366  }
367 
368  OUString aStyleName;
369  sal_uInt16 nRetMask = 0xffff;
370 
371  switch ( nSlotId )
372  {
373  case SID_STYLE_NEW:
374  {
375  const SfxPoolItem* pNameItem;
376  if (pArgs && SfxItemState::SET == pArgs->GetItemState( nSlotId, true, &pNameItem ))
377  aStyleName = static_cast<const SfxStringItem*>(pNameItem)->GetValue();
378 
379  const SfxPoolItem* pRefItem=nullptr;
380  if (pArgs && SfxItemState::SET == pArgs->GetItemState( SID_STYLE_REFERENCE, true, &pRefItem ))
381  {
382  if(pRefItem!=nullptr)
383  aRefName = static_cast<const SfxStringItem*>(pRefItem)->GetValue();
384  }
385 
386  pStyleSheet = &(pStylePool->Make( aStyleName, eFamily,
387  SfxStyleSearchBits::UserDefined ) );
388 
389  if (pStyleSheet->HasParentSupport())
390  pStyleSheet->SetParent(aRefName);
391  }
392  break;
393 
394  case SID_STYLE_APPLY:
395  {
396  const SfxStringItem* pNameItem = rReq.GetArg<SfxStringItem>(SID_APPLY_STYLE);
397  const SfxStringItem* pFamilyItem = rReq.GetArg<SfxStringItem>(SID_STYLE_FAMILYNAME);
398  if ( pFamilyItem && pNameItem )
399  {
400  css::uno::Reference< css::style::XStyleFamiliesSupplier > xModel(pDocSh->GetModel(), css::uno::UNO_QUERY);
401  try
402  {
403  css::uno::Reference< css::container::XNameAccess > xStyles;
404  css::uno::Reference< css::container::XNameAccess > xCont = xModel->getStyleFamilies();
405  xCont->getByName(pFamilyItem->GetValue()) >>= xStyles;
406  css::uno::Reference< css::beans::XPropertySet > xInfo;
407  xStyles->getByName( pNameItem->GetValue() ) >>= xInfo;
408  OUString aUIName;
409  xInfo->getPropertyValue("DisplayName") >>= aUIName;
410  if ( !aUIName.isEmpty() )
411  rReq.AppendItem( SfxStringItem( SID_STYLE_APPLY, aUIName ) );
412  }
413  catch( css::uno::Exception& )
414  {
415  }
416  }
417  [[fallthrough]];
418  }
419  case SID_STYLE_EDIT:
420  case SID_STYLE_DELETE:
421  case SID_STYLE_HIDE:
422  case SID_STYLE_SHOW:
423  case SID_STYLE_NEW_BY_EXAMPLE:
424  {
425  const SfxPoolItem* pNameItem;
426  if (pArgs && SfxItemState::SET == pArgs->GetItemState( nSlotId, true, &pNameItem ))
427  aStyleName = static_cast<const SfxStringItem*>(pNameItem)->GetValue();
428  else if ( nSlotId == SID_STYLE_NEW_BY_EXAMPLE )
429  {
430  weld::Window* pDialogParent = rReq.GetFrameWeld();
431  if (!pDialogParent)
432  pDialogParent = pTabViewShell->GetFrameWeld();
433  SfxNewStyleDlg aDlg(pDialogParent, *pStylePool, eFamily);
434  if (aDlg.run() != RET_OK)
435  return;
436  aStyleName = aDlg.GetName();
437  }
438 
439  pStyleSheet = pStylePool->Find( aStyleName, eFamily );
440 
441  aOldData.InitFromStyle( pStyleSheet );
442  }
443  break;
444 
445  case SID_STYLE_WATERCAN:
446  {
447  bool bWaterCan = pScMod->GetIsWaterCan();
448 
449  if( !bWaterCan )
450  {
451  const SfxPoolItem* pItem;
452 
453  if ( SfxItemState::SET ==
454  pArgs->GetItemState( nSlotId, true, &pItem ) )
455  {
456  const SfxStringItem* pStrItem = dynamic_cast< const SfxStringItem *>( pItem );
457  if ( pStrItem )
458  {
459  aStyleName = pStrItem->GetValue();
460  pStyleSheet = pStylePool->Find( aStyleName, eFamily );
461 
462  if ( pStyleSheet )
463  {
464  static_cast<ScStyleSheetPool*>(pStylePool)->
465  SetActualStyleSheet( pStyleSheet );
466  rReq.Done();
467  }
468  }
469  }
470  }
471 
472  if ( !bWaterCan && pStyleSheet )
473  {
474  pScMod->SetWaterCan( true );
475  pTabViewShell->SetActivePointer( PointerStyle::Fill );
476  rReq.Done();
477  }
478  else
479  {
480  pScMod->SetWaterCan( false );
481  pTabViewShell->SetActivePointer( PointerStyle::Arrow );
482  rReq.Done();
483  }
484  }
485  break;
486 
487  default:
488  break;
489  }
490 
491  // set new style for paintbrush format mode
492  if ( nSlotId == SID_STYLE_APPLY && pScMod->GetIsWaterCan() && pStyleSheet )
493  static_cast<ScStyleSheetPool*>(pStylePool)->SetActualStyleSheet( pStyleSheet );
494 
495  switch ( eFamily )
496  {
497  case SfxStyleFamily::Para:
498  {
499  switch ( nSlotId )
500  {
501  case SID_STYLE_DELETE:
502  {
503  if ( pStyleSheet )
504  {
505  pTabViewShell->RemoveStyleSheetInUse( pStyleSheet );
506  pStylePool->Remove( pStyleSheet );
507  pTabViewShell->InvalidateAttribs();
508  nRetMask = sal_uInt16(true);
509  bAddUndo = true;
510  rReq.Done();
511  }
512  else
513  nRetMask = sal_uInt16(false);
514  }
515  break;
516 
517  case SID_STYLE_HIDE:
518  case SID_STYLE_SHOW:
519  {
520  if ( pStyleSheet )
521  {
522  pStyleSheet->SetHidden( nSlotId == SID_STYLE_HIDE );
523  pTabViewShell->InvalidateAttribs();
524  rReq.Done();
525  }
526  else
527  nRetMask = sal_uInt16(false);
528  }
529  break;
530 
531  case SID_STYLE_APPLY:
532  {
533  if ( pStyleSheet && !pScMod->GetIsWaterCan() )
534  {
535  // apply style sheet to document
536  pTabViewShell->SetStyleSheetToMarked( static_cast<SfxStyleSheet*>(pStyleSheet) );
537  pTabViewShell->InvalidateAttribs();
538  rReq.Done();
539  }
540  }
541  break;
542 
543  case SID_STYLE_NEW_BY_EXAMPLE:
544  case SID_STYLE_UPDATE_BY_EXAMPLE:
545  {
546  // create/replace style sheet by attributes
547  // at cursor position:
548 
549  const ScPatternAttr* pAttrItem = nullptr;
550 
551  // The query if marked, was always wrong here,
552  // so now no more, and just from the cursor.
553  // If attributes are to be removed from the selection, still need to be
554  // cautious not to adopt items from templates
555  // (GetSelectionPattern also collects items from originals) (# 44748 #)
556  SCCOL nCol = rViewData.GetCurX();
557  SCROW nRow = rViewData.GetCurY();
558  pAttrItem = rDoc.GetPattern( nCol, nRow, nCurTab );
559 
560  SfxItemSet aAttrSet = pAttrItem->GetItemSet();
561  aAttrSet.ClearItem( ATTR_MERGE );
562  aAttrSet.ClearItem( ATTR_MERGE_FLAG );
563 
564  // Do not adopt conditional formatting and validity,
565  // because they can not be edited in the template
566  aAttrSet.ClearItem( ATTR_VALIDDATA );
567  aAttrSet.ClearItem( ATTR_CONDITIONAL );
568 
569  if ( SID_STYLE_NEW_BY_EXAMPLE == nSlotId )
570  {
571  if ( bUndo )
572  {
573  OUString aUndo = ScResId( STR_UNDO_EDITCELLSTYLE );
574  pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, pTabViewShell->GetViewShellId() );
575  bListAction = true;
576  }
577 
578  bool bConvertBack = false;
579  SfxStyleSheet* pSheetInUse = const_cast<SfxStyleSheet*>(
580  pTabViewShell->GetStyleSheetFromMarked());
581 
582  // when a new style is present and is used in the selection,
583  // then the parent can not be adopted:
584  if ( pStyleSheet && pSheetInUse && pStyleSheet == pSheetInUse )
585  pSheetInUse = nullptr;
586 
587  // if already present, first remove ...
588  if ( pStyleSheet )
589  {
590  // style pointer to names before erase,
591  // otherwise cells will get invalid pointer
593  rDoc.StylesToNames();
594  bConvertBack = true;
595  pStylePool->Remove(pStyleSheet);
596  }
597 
598  // ...and create new
599  pStyleSheet = &pStylePool->Make( aStyleName, eFamily,
600  SfxStyleSearchBits::UserDefined );
601 
602  // when a style is present, then this will become
603  // the parent of the new style:
604  if ( pSheetInUse && pStyleSheet->HasParentSupport() )
605  pStyleSheet->SetParent( pSheetInUse->GetName() );
606 
607  if ( bConvertBack )
608  // Name to style pointer
609  rDoc.UpdStlShtPtrsFrmNms();
610  else
611  rDoc.GetPool()->CellStyleCreated( aStyleName, rDoc );
612 
613  // Adopt attribute and use style
614  pStyleSheet->GetItemSet().Put( aAttrSet );
615  pTabViewShell->UpdateStyleSheetInUse( pStyleSheet );
616 
617  // call SetStyleSheetToMarked after adding the ScUndoModifyStyle
618  // (pStyleSheet pointer is used!)
619  bStyleToMarked = true;
620  }
621  else // ( nSlotId == SID_STYLE_UPDATE_BY_EXAMPLE )
622  {
623  pStyleSheet = const_cast<SfxStyleSheet*>(pTabViewShell->GetStyleSheetFromMarked());
624 
625  if ( pStyleSheet )
626  {
627  aOldData.InitFromStyle( pStyleSheet );
628 
629  if ( bUndo )
630  {
631  OUString aUndo = ScResId( STR_UNDO_EDITCELLSTYLE );
632  pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, pTabViewShell->GetViewShellId() );
633  bListAction = true;
634  }
635 
636  pStyleSheet->GetItemSet().Put( aAttrSet );
637  pTabViewShell->UpdateStyleSheetInUse( pStyleSheet );
638 
639  // call SetStyleSheetToMarked after adding the ScUndoModifyStyle
640  // (pStyleSheet pointer is used!)
641  bStyleToMarked = true;
642  }
643  }
644 
645  aNewData.InitFromStyle( pStyleSheet );
646  bAddUndo = true;
647  rReq.Done();
648  }
649  break;
650 
651  default:
652  break;
653  }
654  } // case SfxStyleFamily::Para:
655  break;
656 
657  case SfxStyleFamily::Page:
658  {
659  switch ( nSlotId )
660  {
661  case SID_STYLE_DELETE:
662  {
663  nRetMask = sal_uInt16( nullptr != pStyleSheet );
664  if ( pStyleSheet )
665  {
666  if ( rDoc.RemovePageStyleInUse( pStyleSheet->GetName() ) )
667  {
668  ScPrintFunc( pDocSh, pTabViewShell->GetPrinter(true), nCurTab ).UpdatePages();
669  rBindings.Invalidate( SID_STATUS_PAGESTYLE );
670  rBindings.Invalidate( FID_RESET_PRINTZOOM );
671  }
672  pStylePool->Remove( pStyleSheet );
673  rBindings.Invalidate( SID_STYLE_FAMILY4 );
674  pDocSh->SetDocumentModified();
675  bAddUndo = true;
676  rReq.Done();
677  }
678  }
679  break;
680 
681  case SID_STYLE_HIDE:
682  case SID_STYLE_SHOW:
683  {
684  nRetMask = sal_uInt16( nullptr != pStyleSheet );
685  if ( pStyleSheet )
686  {
687  pStyleSheet->SetHidden( nSlotId == SID_STYLE_HIDE );
688  rBindings.Invalidate( SID_STYLE_FAMILY4 );
689  pDocSh->SetDocumentModified();
690  rReq.Done();
691  }
692  }
693  break;
694 
695  case SID_STYLE_APPLY:
696  {
697  nRetMask = sal_uInt16( nullptr != pStyleSheet );
698  if ( pStyleSheet && !pScMod->GetIsWaterCan() )
699  {
700  std::unique_ptr<ScUndoApplyPageStyle> pUndoAction;
701  SCTAB nTabCount = rDoc.GetTableCount();
702  for (const auto& rTab : rMark)
703  {
704  if (rTab >= nTabCount)
705  break;
706  OUString aOldName = rDoc.GetPageStyle( rTab );
707  if ( aOldName != aStyleName )
708  {
709  rDoc.SetPageStyle( rTab, aStyleName );
710  ScPrintFunc( pDocSh, pTabViewShell->GetPrinter(true), rTab ).UpdatePages();
711  if( !pUndoAction )
712  pUndoAction.reset(new ScUndoApplyPageStyle( pDocSh, aStyleName ));
713  pUndoAction->AddSheetAction( rTab, aOldName );
714  }
715  }
716  if( pUndoAction )
717  {
718  pDocSh->GetUndoManager()->AddUndoAction( std::move(pUndoAction) );
719  pDocSh->SetDocumentModified();
720  rBindings.Invalidate( SID_STYLE_FAMILY4 );
721  rBindings.Invalidate( SID_STATUS_PAGESTYLE );
722  rBindings.Invalidate( FID_RESET_PRINTZOOM );
723  }
724  rReq.Done();
725  }
726  }
727  break;
728 
729  case SID_STYLE_NEW_BY_EXAMPLE:
730  {
731  const OUString& rStrCurStyle = rDoc.GetPageStyle( nCurTab );
732 
733  if ( rStrCurStyle != aStyleName )
734  {
735  SfxStyleSheetBase* pCurStyle = pStylePool->Find( rStrCurStyle, eFamily );
736  SfxItemSet aAttrSet = pCurStyle->GetItemSet();
737  SCTAB nInTab;
738  bool bUsed = rDoc.IsPageStyleInUse( aStyleName, &nInTab );
739 
740  // if already present, first remove...
741  if ( pStyleSheet )
742  pStylePool->Remove( pStyleSheet );
743 
744  // ...and create new
745  pStyleSheet = &pStylePool->Make( aStyleName, eFamily,
746  SfxStyleSearchBits::UserDefined );
747 
748  // Adopt attribute
749  pStyleSheet->GetItemSet().Put( aAttrSet );
750  pDocSh->SetDocumentModified();
751 
752  // If being used -> Update
753  if ( bUsed )
754  ScPrintFunc( pDocSh, pTabViewShell->GetPrinter(true), nInTab ).UpdatePages();
755 
756  aNewData.InitFromStyle( pStyleSheet );
757  bAddUndo = true;
758  rReq.Done();
759  nRetMask = sal_uInt16(true);
760  }
761  }
762  break;
763 
764  default:
765  break;
766  } // switch ( nSlotId )
767  } // case SfxStyleFamily::Page:
768  break;
769 
770  default:
771  break;
772  } // switch ( eFamily )
773 
774  // create new or process through Dialog:
775  if ( nSlotId == SID_STYLE_NEW || nSlotId == SID_STYLE_EDIT )
776  {
777  if ( pStyleSheet )
778  {
779  SfxStyleFamily eFam = pStyleSheet->GetFamily();
781  bool bPage = false;
782 
783  // Store old Items from the style
784  SfxItemSet aOldSet = pStyleSheet->GetItemSet();
785  OUString aOldName = pStyleSheet->GetName();
786 
787  switch ( eFam )
788  {
789  case SfxStyleFamily::Page:
790  bPage = true;
791  break;
792 
793  case SfxStyleFamily::Para:
794  default:
795  {
796  SfxItemSet& rSet = pStyleSheet->GetItemSet();
797 
798  const SfxPoolItem* pItem;
799  if ( rSet.GetItemState( ATTR_VALUE_FORMAT,
800  false, &pItem ) == SfxItemState::SET )
801  {
802  // Produce and format NumberFormat Value from Value and Language
803  sal_uLong nFormat =
804  static_cast<const SfxUInt32Item*>(pItem)->GetValue();
805  LanguageType eLang =
806  rSet.Get(ATTR_LANGUAGE_FORMAT ).GetLanguage();
807  sal_uLong nLangFormat = rDoc.GetFormatTable()->
808  GetFormatForLanguageIfBuiltIn( nFormat, eLang );
809  if ( nLangFormat != nFormat )
810  {
811  SfxUInt32Item aNewItem( ATTR_VALUE_FORMAT, nLangFormat );
812  rSet.Put( aNewItem );
813  aOldSet.Put( aNewItem );
814  // Also in aOldSet for comparison after the dialog,
815  // Otherwise might miss a language change
816  }
817  }
818 
819  std::unique_ptr<SvxNumberInfoItem> pNumberInfoItem(
821 
822  pDocSh->PutItem( *pNumberInfoItem );
823  bPage = false;
824 
825  // Definitely a SvxBoxInfoItem with Table = sal_False in set:
826  // (If there is no item, the dialogue will also delete the
827  // BORDER_OUTER SvxBoxItem from the Template Set)
828  if ( rSet.GetItemState( ATTR_BORDER_INNER, false ) != SfxItemState::SET )
829  {
830  SvxBoxInfoItem aBoxInfoItem( ATTR_BORDER_INNER );
831  aBoxInfoItem.SetTable(false); // no inner lines
832  aBoxInfoItem.SetDist(true);
833  aBoxInfoItem.SetMinDist(false);
834  rSet.Put( aBoxInfoItem );
835  }
836  }
837  break;
838  }
839 
840  pTabViewShell->SetInFormatDialog(true);
841 
842  SfxItemSet& rStyleSet = pStyleSheet->GetItemSet();
844 
846 
847  weld::Window* pDialogParent = rReq.GetFrameWeld();
848  if (!pDialogParent)
849  pDialogParent = pTabViewShell->GetFrameWeld();
850  pDlg.disposeAndReset(pFact->CreateScStyleDlg(pDialogParent, *pStyleSheet, bPage));
851  short nResult = pDlg->Execute();
852  pTabViewShell->SetInFormatDialog(false);
853 
854  if ( nResult == RET_OK )
855  {
856  const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
857 
858  if ( pOutSet )
859  {
860  nRetMask = sal_uInt16(pStyleSheet->GetMask());
861 
862  // Attribute comparisons (earlier in ModifyStyleSheet) now here
863  // with the old values (the style is already changed)
864  if ( SfxStyleFamily::Para == eFam )
865  {
866  SfxItemSet& rNewSet = pStyleSheet->GetItemSet();
867  bool bNumFormatChanged;
869  bNumFormatChanged, rNewSet, aOldSet ) )
870  rDoc.InvalidateTextWidth( nullptr, nullptr, bNumFormatChanged );
871 
872  SCTAB nTabCount = rDoc.GetTableCount();
873  for (SCTAB nTab=0; nTab<nTabCount; nTab++)
874  rDoc.SetStreamValid(nTab, false);
875 
876  sal_uLong nOldFormat = aOldSet.Get( ATTR_VALUE_FORMAT ).GetValue();
877  sal_uLong nNewFormat = rNewSet.Get( ATTR_VALUE_FORMAT ).GetValue();
878  if ( nNewFormat != nOldFormat )
879  {
880  SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
881  const SvNumberformat* pOld = pFormatter->GetEntry( nOldFormat );
882  const SvNumberformat* pNew = pFormatter->GetEntry( nNewFormat );
883  if ( pOld && pNew && pOld->GetLanguage() != pNew->GetLanguage() )
884  rNewSet.Put( SvxLanguageItem(
885  pNew->GetLanguage(), ATTR_LANGUAGE_FORMAT ) );
886  }
887 
888  rDoc.GetPool()->CellStyleCreated( pStyleSheet->GetName(), rDoc );
889  }
890  else
891  {
893 
894  OUString aNewName = pStyleSheet->GetName();
895  if ( aNewName != aOldName &&
896  rDoc.RenamePageStyleInUse( aOldName, aNewName ) )
897  {
898  rBindings.Invalidate( SID_STATUS_PAGESTYLE );
899  rBindings.Invalidate( FID_RESET_PRINTZOOM );
900  }
901 
902  rDoc.ModifyStyleSheet( *pStyleSheet, *pOutSet );
903  rBindings.Invalidate( FID_RESET_PRINTZOOM );
904  }
905 
906  pDocSh->SetDocumentModified();
907 
908  if ( SfxStyleFamily::Para == eFam )
909  {
911  *( pDocSh->GetItem(SID_ATTR_NUMBERFORMAT_INFO) ));
912 
913  pTabViewShell->UpdateStyleSheetInUse( pStyleSheet );
914  pTabViewShell->InvalidateAttribs();
915  }
916 
917  aNewData.InitFromStyle( pStyleSheet );
918  bAddUndo = true;
919  }
920  }
921  else
922  {
923  if ( nSlotId == SID_STYLE_NEW )
924  pStylePool->Remove( pStyleSheet );
925  else
926  {
927  // If in the meantime something was painted with the
928  // temporary changed item set
929  pDocSh->PostPaintGridAll();
930  }
931  }
932  }
933  }
934 
935  rReq.SetReturnValue( SfxUInt16Item( nSlotId, nRetMask ) );
936 
937  if ( bAddUndo && bUndo)
938  pDocSh->GetUndoManager()->AddUndoAction(
939  std::make_unique<ScUndoModifyStyle>( pDocSh, eFamily, aOldData, aNewData ) );
940 
941  if ( bStyleToMarked )
942  {
943  // call SetStyleSheetToMarked after adding the ScUndoModifyStyle,
944  // so redo will find the modified style
945  pTabViewShell->SetStyleSheetToMarked( static_cast<SfxStyleSheet*>(pStyleSheet) );
946  pTabViewShell->InvalidateAttribs();
947  }
948 
949  if ( bListAction )
950  pDocSh->GetUndoManager()->LeaveListAction();
951  }
952  else if (nSlotId == SID_CLASSIFICATION_APPLY)
953  {
954  const SfxPoolItem* pItem = nullptr;
955  if (pArgs && pArgs->GetItemState(nSlotId, false, &pItem) == SfxItemState::SET)
956  {
957  const OUString& rName = static_cast<const SfxStringItem*>(pItem)->GetValue();
959  auto eType = SfxClassificationPolicyType::IntellectualProperty;
960  if (pArgs->GetItemState(SID_TYPE_NAME, false, &pItem) == SfxItemState::SET)
961  {
962  const OUString& rType = static_cast<const SfxStringItem*>(pItem)->GetValue();
964  }
965  aHelper.SetBACName(rName, eType);
966  }
967  else
968  SAL_WARN("sc.ui", "missing parameter for SID_CLASSIFICATION_APPLY");
969  }
970  else
971  {
972  OSL_FAIL( "Unknown slot (ScViewShell::ExecuteStyle)" );
973  }
974 }
975 
977 {
978  ScModule* pScMod = SC_MOD();
979  ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
980  const SfxItemSet* pReqArgs = rReq.GetArgs();
981  sal_uInt16 nSlot = rReq.GetSlot();
982  SfxBindings& rBindings = pTabViewShell->GetViewFrame()->GetBindings();
983 
984  pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox
985 
986  // End input
987  if ( GetViewData().HasEditView( GetViewData().GetActivePart() ) )
988  {
989  switch ( nSlot )
990  {
991  case SID_NUMBER_TYPE_FORMAT:
992  case SID_NUMBER_TWODEC:
993  case SID_NUMBER_SCIENTIFIC:
994  case SID_NUMBER_DATE:
995  case SID_NUMBER_CURRENCY:
996  case SID_NUMBER_PERCENT:
997  case SID_NUMBER_STANDARD:
998  case SID_NUMBER_FORMAT:
999  case SID_NUMBER_INCDEC:
1000  case SID_NUMBER_DECDEC:
1001  case SID_NUMBER_THOUSANDS:
1002  case FID_DEFINE_NAME:
1003  case FID_ADD_NAME:
1004  case FID_USE_NAME:
1005  case FID_INSERT_NAME:
1006  case SID_SPELL_DIALOG:
1007  case SID_HANGUL_HANJA_CONVERSION:
1008 
1009  pScMod->InputEnterHandler();
1010  pTabViewShell->UpdateInputHandler();
1011  break;
1012 
1013  default:
1014  break;
1015  }
1016  }
1017 
1019  switch ( nSlot )
1020  {
1021  case SID_NUMBER_TWODEC:
1022  {
1023  const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
1024  sal_uInt32 nNumberFormat = rAttrSet.Get(ATTR_VALUE_FORMAT).GetValue();
1025 
1026  if ((nType & SvNumFormatType::NUMBER) && nNumberFormat == 4)
1027  pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
1028  else
1029  pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER, 4 );
1030  rBindings.Invalidate( nSlot );
1031  rReq.Done();
1032  }
1033  break;
1034  case SID_NUMBER_SCIENTIFIC:
1035  if (nType & SvNumFormatType::SCIENTIFIC)
1036  pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
1037  else
1038  pTabViewShell->SetNumberFormat( SvNumFormatType::SCIENTIFIC );
1039  rBindings.Invalidate( nSlot );
1040  rReq.Done();
1041  break;
1042  case SID_NUMBER_DATE:
1043  if (nType & SvNumFormatType::DATE)
1044  pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
1045  else
1046  pTabViewShell->SetNumberFormat( SvNumFormatType::DATE );
1047  rBindings.Invalidate( nSlot );
1048  rReq.Done();
1049  break;
1050  case SID_NUMBER_TIME:
1051  if (nType & SvNumFormatType::TIME)
1052  pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
1053  else
1054  pTabViewShell->SetNumberFormat( SvNumFormatType::TIME );
1055  rBindings.Invalidate( nSlot );
1056  rReq.Done();
1057  break;
1058  case SID_NUMBER_CURRENCY:
1059  if(pReqArgs)
1060  {
1061  const SfxPoolItem* pItem;
1062  if ( pReqArgs->HasItem( SID_NUMBER_CURRENCY, &pItem ) )
1063  {
1064  sal_uInt32 nNewFormat = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
1065  ScDocument& rDoc = rViewData.GetDocument();
1066  SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
1067  const SfxItemSet& rOldSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
1068 
1069  LanguageType eOldLang = rOldSet.Get( ATTR_LANGUAGE_FORMAT ).GetLanguage();
1070  sal_uInt32 nOldFormat = rOldSet.Get( ATTR_VALUE_FORMAT ).GetValue();
1071 
1072  if ( nOldFormat != nNewFormat )
1073  {
1074  const SvNumberformat* pNewEntry = pFormatter->GetEntry( nNewFormat );
1075  ScPatternAttr aNewAttrs( rDoc.GetPool() );
1076  SfxItemSet& rSet = aNewAttrs.GetItemSet();
1077  LanguageType eNewLang = pNewEntry ? pNewEntry->GetLanguage() : LANGUAGE_DONTKNOW;
1078  if ( eNewLang != eOldLang && eNewLang != LANGUAGE_DONTKNOW )
1079  rSet.Put( SvxLanguageItem( eNewLang, ATTR_LANGUAGE_FORMAT ) );
1080  rSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
1081  pTabViewShell->ApplySelectionPattern( aNewAttrs );
1082  }
1083  else
1084  pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
1085  }
1086  }
1087  else
1088  {
1089  if ( nType & SvNumFormatType::CURRENCY )
1090  pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
1091  else
1092  pTabViewShell->SetNumberFormat( SvNumFormatType::CURRENCY );
1093  }
1094  rBindings.Invalidate( nSlot );
1095  rReq.Done();
1096  break;
1097  case SID_NUMBER_PERCENT:
1098  if (nType & SvNumFormatType::PERCENT)
1099  pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
1100  else
1101  pTabViewShell->SetNumberFormat( SvNumFormatType::PERCENT );
1102  rBindings.Invalidate( nSlot );
1103  rReq.Done();
1104  break;
1105  case SID_NUMBER_STANDARD:
1106  pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
1107  rReq.Done();
1108  break;
1109  case SID_NUMBER_INCDEC:
1110  pTabViewShell->ChangeNumFmtDecimals( true );
1111  rReq.Done();
1112  break;
1113  case SID_NUMBER_DECDEC:
1114  pTabViewShell->ChangeNumFmtDecimals( false );
1115  rReq.Done();
1116  break;
1117  case SID_NUMBER_THOUSANDS:
1118  {
1119  ScDocument& rDoc = rViewData.GetDocument();
1120  SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
1121  sal_uInt32 nCurrentNumberFormat;
1122  bool bThousand(false);
1123  bool bNegRed(false);
1124  sal_uInt16 nPrecision(0);
1125  sal_uInt16 nLeadZeroes(0);
1126  LanguageType eLanguage = ScGlobal::eLnge;
1127 
1128  rDoc.GetNumberFormat(rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo(), nCurrentNumberFormat);
1129  const SvNumberformat* pEntry = pFormatter->GetEntry(nCurrentNumberFormat);
1130 
1131  if (pEntry)
1132  eLanguage = pEntry->GetLanguage();
1133 
1134  pFormatter->GetFormatSpecialInfo(nCurrentNumberFormat, bThousand, bNegRed, nPrecision, nLeadZeroes);
1135  bThousand = !bThousand;
1136  OUString aCode = pFormatter->GenerateFormat(
1137  nCurrentNumberFormat,
1138  eLanguage,
1139  bThousand,
1140  bNegRed,
1141  nPrecision,
1142  nLeadZeroes);
1143  pTabViewShell->SetNumFmtByStr(aCode);
1144 
1145  rBindings.Invalidate(nSlot);
1146  rReq.Done();
1147  }
1148  break;
1149  case SID_NUMBER_FORMAT:
1150  // symphony version with format interpretation
1151  if(pReqArgs)
1152  {
1153  const SfxPoolItem* pItem;
1154  ScDocument& rDoc = rViewData.GetDocument();
1155  SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
1156  sal_uInt32 nCurrentNumberFormat;
1157 
1158  rDoc.GetNumberFormat(rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo(), nCurrentNumberFormat);
1159  const SvNumberformat* pEntry = pFormatter->GetEntry(nCurrentNumberFormat);
1160 
1161  if(!pEntry)
1162  break;
1163 
1164  LanguageType eLanguage = pEntry->GetLanguage();
1165  SvNumFormatType eType = pEntry->GetMaskedType();
1166 
1167  //Just use eType to judge whether the command is fired for NUMBER/PERCENT/CURRENCY/SCIENTIFIC/FRACTION/TIME
1168  //In sidebar, users can fire SID_NUMBER_FORMAT command by operating the related UI controls before they are disable
1169  if(!(eType == SvNumFormatType::ALL
1170  || eType == SvNumFormatType::NUMBER
1171  || eType == SvNumFormatType::PERCENT
1172  || eType == SvNumFormatType::CURRENCY
1173  || eType == SvNumFormatType::SCIENTIFIC
1174  || eType == SvNumFormatType::TIME
1175  || eType == SvNumFormatType::FRACTION))
1176  pEntry = nullptr;
1177 
1178  if(SfxItemState::SET == pReqArgs->GetItemState(nSlot, true, &pItem) && pEntry)
1179  {
1180  OUString aCode = static_cast<const SfxStringItem*>(pItem)->GetValue();
1181  sal_uInt16 aLen = aCode.getLength();
1182  std::unique_ptr<OUString[]> sFormat( new OUString[4] );
1183  OUStringBuffer sTmpStr;
1184  sal_uInt16 nCount(0);
1185  sal_uInt16 nStrCount(0);
1186 
1187  while(nCount < aLen)
1188  {
1189  sal_Unicode cChar = aCode[nCount];
1190 
1191  if(cChar == ',')
1192  {
1193  sFormat[nStrCount] = sTmpStr.makeStringAndClear();
1194  nStrCount++;
1195  }
1196  else
1197  {
1198  sTmpStr.append(cChar);
1199  }
1200 
1201  nCount++;
1202 
1203  if(nStrCount > 3)
1204  break;
1205  }
1206 
1207  const bool bThousand = static_cast<bool>(sFormat[0].toInt32());
1208  const bool bNegRed = static_cast<bool>(sFormat[1].toInt32());
1209  const sal_uInt16 nPrecision = static_cast<sal_uInt16>(sFormat[2].toInt32());
1210  const sal_uInt16 nLeadZeroes = static_cast<sal_uInt16>(sFormat[3].toInt32());
1211 
1212  aCode = pFormatter->GenerateFormat(
1213  nCurrentNumberFormat,//modify
1214  eLanguage,
1215  bThousand,
1216  bNegRed,
1217  nPrecision,
1218  nLeadZeroes);
1219  pTabViewShell->SetNumFmtByStr(aCode);
1220  }
1221  }
1222  break;
1223 
1224  case SID_ATTR_NUMBERFORMAT_VALUE:
1225  if ( pReqArgs )
1226  {
1227  const SfxPoolItem* pItem;
1228  if ( pReqArgs->GetItemState( ATTR_VALUE_FORMAT, true, &pItem ) == SfxItemState::SET )
1229  {
1230  // We have to accomplish this using ApplyAttributes()
1231  // because we also need the language information to be
1232  // considered.
1233  const SfxItemSet& rOldSet =
1234  pTabViewShell->GetSelectionPattern()->GetItemSet();
1235  SfxItemPool* pDocPool = GetViewData().GetDocument().GetPool();
1237  aNewSet.Put( *pItem );
1238  pTabViewShell->ApplyAttributes( &aNewSet, &rOldSet );
1239  }
1240  }
1241  break;
1242 
1243  case SID_NUMBER_TYPE_FORMAT:
1244  if ( pReqArgs )
1245  {
1246  const SfxPoolItem* pItem;
1247  if ( pReqArgs->GetItemState( nSlot, true, &pItem ) == SfxItemState::SET )
1248  {
1249  sal_uInt16 nFormat = static_cast<const SfxInt16Item *>(pItem)->GetValue();
1250  switch(nFormat)
1251  {
1252  case 0:
1253  pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER); //Modify
1254  break;
1255  case 1:
1256  pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER, 2 ); //Modify
1257  break;
1258  case 2:
1259  pTabViewShell->SetNumberFormat( SvNumFormatType::PERCENT );
1260  break;
1261  case 3:
1262  pTabViewShell->SetNumberFormat( SvNumFormatType::CURRENCY );
1263  break;
1264  case 4:
1265  pTabViewShell->SetNumberFormat( SvNumFormatType::DATE );
1266  break;
1267  case 5:
1268  pTabViewShell->SetNumberFormat( SvNumFormatType::TIME );
1269  break;
1270  case 6:
1271  pTabViewShell->SetNumberFormat( SvNumFormatType::SCIENTIFIC );
1272  break;
1273  case 7:
1274  pTabViewShell->SetNumberFormat( SvNumFormatType::FRACTION );
1275  break;
1276  case 8:
1277  pTabViewShell->SetNumberFormat( SvNumFormatType::LOGICAL );
1278  break;
1279  case 9:
1280  pTabViewShell->SetNumberFormat( SvNumFormatType::TEXT );
1281  break;
1282  default:
1283  ;
1284  }
1285  rReq.Done();
1286  }
1287  }
1288  break;
1289 
1290  default:
1291  OSL_FAIL("ExecuteEdit: invalid slot");
1292  break;
1293  }
1294 }
1295 
1297 {
1298  ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
1299  SfxBindings& rBindings = rViewData.GetBindings();
1300  const SfxItemSet* pSet = rReq.GetArgs();
1301  sal_uInt16 nSlot = rReq.GetSlot();
1302 
1303  pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox
1304 
1305  switch( nSlot )
1306  {
1307  // pseudo slots for Format menu
1308  case SID_ALIGN_ANY_HDEFAULT:
1309  case SID_ALIGN_ANY_LEFT:
1310  case SID_ALIGN_ANY_HCENTER:
1311  case SID_ALIGN_ANY_RIGHT:
1312  case SID_ALIGN_ANY_JUSTIFIED:
1313  pTabViewShell->ApplyAttr( SvxHorJustifyItem( lclConvertSlotToHAlign( nSlot ), ATTR_HOR_JUSTIFY ) );
1314  break;
1315  case SID_ALIGN_ANY_VDEFAULT:
1316  case SID_ALIGN_ANY_TOP:
1317  case SID_ALIGN_ANY_VCENTER:
1318  case SID_ALIGN_ANY_BOTTOM:
1319  pTabViewShell->ApplyAttr( SvxVerJustifyItem( lclConvertSlotToVAlign( nSlot ), ATTR_VER_JUSTIFY ) );
1320  break;
1321 
1322  default:
1323  if( pSet )
1324  {
1325  const SfxPoolItem* pItem = nullptr;
1326  if( pSet->GetItemState(GetPool().GetWhich(nSlot), true, &pItem ) == SfxItemState::SET )
1327  {
1328 
1329  switch ( nSlot )
1330  {
1331  case SID_ATTR_ALIGN_HOR_JUSTIFY:
1332  case SID_ATTR_ALIGN_VER_JUSTIFY:
1333  case SID_ATTR_ALIGN_INDENT:
1334  case SID_ATTR_ALIGN_HYPHENATION:
1335  case SID_ATTR_ALIGN_DEGREES:
1336  case SID_ATTR_ALIGN_LOCKPOS:
1337  case SID_ATTR_ALIGN_MARGIN:
1338  case SID_ATTR_ALIGN_STACKED:
1339  pTabViewShell->ApplyAttr( *pItem );
1340  break;
1341 
1342  case SID_H_ALIGNCELL:
1343  {
1344  SvxCellHorJustify eJust = static_cast<const SvxHorJustifyItem*>(pItem)->GetValue();
1345  // #i78476# update alignment of text in cell edit mode
1346  pTabViewShell->UpdateInputHandlerCellAdjust( eJust );
1347  pTabViewShell->ApplyAttr( SvxHorJustifyItem( eJust, ATTR_HOR_JUSTIFY ) );
1348  }
1349  break;
1350  case SID_V_ALIGNCELL:
1351  pTabViewShell->ApplyAttr( SvxVerJustifyItem( static_cast<const SvxVerJustifyItem*>(pItem)->GetValue(), ATTR_VER_JUSTIFY ) );
1352  break;
1353  default:
1354  OSL_FAIL( "ExecuteAlignment: invalid slot" );
1355  return;
1356  }
1357  }
1358  }
1359  }
1360  rBindings.Invalidate( SID_ATTR_PARA_ADJUST_LEFT );
1361  rBindings.Invalidate( SID_ATTR_PARA_ADJUST_RIGHT );
1362  rBindings.Invalidate( SID_ATTR_PARA_ADJUST_BLOCK );
1363  rBindings.Invalidate( SID_ATTR_PARA_ADJUST_CENTER);
1364  rBindings.Invalidate( SID_ALIGNLEFT );
1365  rBindings.Invalidate( SID_ALIGNRIGHT );
1366  rBindings.Invalidate( SID_ALIGNCENTERHOR );
1367  rBindings.Invalidate( SID_ALIGNBLOCK );
1368  rBindings.Invalidate( SID_ALIGNTOP );
1369  rBindings.Invalidate( SID_ALIGNBOTTOM );
1370  rBindings.Invalidate( SID_ALIGNCENTERVER );
1371  rBindings.Invalidate( SID_V_ALIGNCELL );
1372  rBindings.Invalidate( SID_H_ALIGNCELL );
1373  // pseudo slots for Format menu
1374  rBindings.Invalidate( SID_ALIGN_ANY_HDEFAULT );
1375  rBindings.Invalidate( SID_ALIGN_ANY_LEFT );
1376  rBindings.Invalidate( SID_ALIGN_ANY_HCENTER );
1377  rBindings.Invalidate( SID_ALIGN_ANY_RIGHT );
1378  rBindings.Invalidate( SID_ALIGN_ANY_JUSTIFIED );
1379  rBindings.Invalidate( SID_ALIGN_ANY_VDEFAULT );
1380  rBindings.Invalidate( SID_ALIGN_ANY_TOP );
1381  rBindings.Invalidate( SID_ALIGN_ANY_VCENTER );
1382  rBindings.Invalidate( SID_ALIGN_ANY_BOTTOM );
1383  rBindings.Update();
1384 
1385  if( ! rReq.IsAPI() )
1386  rReq.Done();
1387 }
1388 
1390 {
1391  ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
1392  SfxBindings& rBindings = rViewData.GetBindings();
1393  const ScPatternAttr* pAttrs = pTabViewShell->GetSelectionPattern();
1394  const SfxItemSet* pSet = rReq.GetArgs();
1395  sal_uInt16 nSlot = rReq.GetSlot();
1396  std::unique_ptr<SfxAllItemSet> pNewSet;
1397 
1398  pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox
1399 
1400  if ( (nSlot == SID_ATTR_CHAR_WEIGHT)
1401  ||(nSlot == SID_ATTR_CHAR_POSTURE)
1402  ||(nSlot == SID_ATTR_CHAR_UNDERLINE)
1403  ||(nSlot == SID_ULINE_VAL_NONE)
1404  ||(nSlot == SID_ULINE_VAL_SINGLE)
1405  ||(nSlot == SID_ULINE_VAL_DOUBLE)
1406  ||(nSlot == SID_ULINE_VAL_DOTTED) )
1407  {
1408  pNewSet.reset(new SfxAllItemSet( GetPool() ));
1409 
1410  switch ( nSlot )
1411  {
1412  case SID_ATTR_CHAR_WEIGHT:
1413  {
1414  // #i78017 establish the same behaviour as in Writer
1415  SvtScriptType nScript = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
1416 
1417  SfxItemPool& rPool = GetPool();
1418  SvxScriptSetItem aSetItem( nSlot, rPool );
1419  if ( pSet )
1420  aSetItem.PutItemForScriptType( nScript, pSet->Get( ATTR_FONT_WEIGHT ) );
1421  else
1422  {
1423  // toggle manually
1424 
1425  FontWeight eWeight = WEIGHT_BOLD;
1426  SvxScriptSetItem aOldSetItem( nSlot, rPool );
1427  aOldSetItem.GetItemSet().Put( pAttrs->GetItemSet(), false );
1428  const SfxPoolItem* pCore = aOldSetItem.GetItemOfScript( nScript );
1429  if ( pCore && static_cast<const SvxWeightItem*>(pCore)->GetWeight() == WEIGHT_BOLD )
1430  eWeight = WEIGHT_NORMAL;
1431 
1432  aSetItem.PutItemForScriptType( nScript, SvxWeightItem( eWeight, ATTR_FONT_WEIGHT ) );
1433  }
1434  pTabViewShell->ApplyUserItemSet( aSetItem.GetItemSet() );
1435  pNewSet->Put( aSetItem.GetItemSet(), false );
1436  }
1437  break;
1438 
1439  case SID_ATTR_CHAR_POSTURE:
1440  {
1441  // #i78017 establish the same behaviour as in Writer
1442  SvtScriptType nScript = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
1443 
1444  SfxItemPool& rPool = GetPool();
1445  SvxScriptSetItem aSetItem( nSlot, rPool );
1446  if ( pSet )
1447  aSetItem.PutItemForScriptType( nScript, pSet->Get( ATTR_FONT_POSTURE ) );
1448  else
1449  {
1450  // toggle manually
1451 
1452  FontItalic eItalic = ITALIC_NORMAL;
1453  SvxScriptSetItem aOldSetItem( nSlot, rPool );
1454  aOldSetItem.GetItemSet().Put( pAttrs->GetItemSet(), false );
1455  const SfxPoolItem* pCore = aOldSetItem.GetItemOfScript( nScript );
1456  if ( pCore && static_cast<const SvxPostureItem*>(pCore)->GetPosture() == ITALIC_NORMAL )
1457  eItalic = ITALIC_NONE;
1458 
1459  aSetItem.PutItemForScriptType( nScript, SvxPostureItem( eItalic, ATTR_FONT_POSTURE ) );
1460  }
1461  pTabViewShell->ApplyUserItemSet( aSetItem.GetItemSet() );
1462  pNewSet->Put( aSetItem.GetItemSet(), false );
1463  }
1464  break;
1465 
1466  case SID_ATTR_CHAR_UNDERLINE:
1467  {
1468  if( pSet )
1469  {
1470  const SfxPoolItem& rUnderline = pSet->Get( ATTR_FONT_UNDERLINE );
1471 
1472  if( dynamic_cast<const SvxUnderlineItem*>( &rUnderline) != nullptr )
1473  {
1474  pTabViewShell->ApplyAttr( rUnderline );
1475  pNewSet->Put( rUnderline,rUnderline.Which() );
1476  }
1477  else if ( auto pTextLineItem = dynamic_cast<const SvxTextLineItem*>( &rUnderline) )
1478  {
1479  // #i106580# also allow SvxTextLineItem (base class of SvxUnderlineItem)
1480  SvxUnderlineItem aNewItem( pTextLineItem->GetLineStyle(), pTextLineItem->Which() );
1481  aNewItem.SetColor( pTextLineItem->GetColor() );
1482  pTabViewShell->ApplyAttr( aNewItem );
1483  pNewSet->Put( aNewItem, aNewItem.Which() );
1484  }
1485  }
1486  else
1487  {
1488  SvxUnderlineItem aUnderline( pAttrs->GetItem( ATTR_FONT_UNDERLINE ) );
1489  FontLineStyle eUnderline = (LINESTYLE_NONE != aUnderline.GetLineStyle())
1490  ? LINESTYLE_NONE
1491  : LINESTYLE_SINGLE;
1492  aUnderline.SetLineStyle( eUnderline );
1493  pTabViewShell->ApplyAttr( aUnderline );
1494  pNewSet->Put( aUnderline,aUnderline.Which() );
1495  }
1496  }
1497  break;
1498 
1499  case SID_ULINE_VAL_NONE:
1501  break;
1502  case SID_ULINE_VAL_SINGLE: // Toggles
1503  case SID_ULINE_VAL_DOUBLE:
1504  case SID_ULINE_VAL_DOTTED:
1505  {
1506  FontLineStyle eOld = pAttrs->GetItem(ATTR_FONT_UNDERLINE).GetLineStyle();
1507  FontLineStyle eNew = eOld;
1508  switch (nSlot)
1509  {
1510  case SID_ULINE_VAL_SINGLE:
1511  eNew = ( eOld == LINESTYLE_SINGLE ) ? LINESTYLE_NONE : LINESTYLE_SINGLE;
1512  break;
1513  case SID_ULINE_VAL_DOUBLE:
1514  eNew = ( eOld == LINESTYLE_DOUBLE ) ? LINESTYLE_NONE : LINESTYLE_DOUBLE;
1515  break;
1516  case SID_ULINE_VAL_DOTTED:
1517  eNew = ( eOld == LINESTYLE_DOTTED ) ? LINESTYLE_NONE : LINESTYLE_DOTTED;
1518  break;
1519  }
1520  pTabViewShell->ApplyAttr( SvxUnderlineItem( eNew, ATTR_FONT_UNDERLINE ) );
1521  }
1522  break;
1523 
1524  default:
1525  break;
1526  }
1527  rBindings.Invalidate( nSlot );
1528  }
1529  else
1530  {
1531  /*
1532  * "Self-made" functionality of radio buttons
1533  * At the toggle the default state is used, this means
1534  * no button was clicked.
1535  */
1536 
1537  const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
1538  const SfxPoolItem* pItem = nullptr;
1539  const SvxHorJustifyItem* pHorJustify = nullptr;
1540  const SvxVerJustifyItem* pVerJustify = nullptr;
1541  SvxCellHorJustify eHorJustify = SvxCellHorJustify::Standard;
1542  SvxCellVerJustify eVerJustify = SvxCellVerJustify::Standard;
1543 
1544  if (rAttrSet.GetItemState(ATTR_HOR_JUSTIFY, true,&pItem ) == SfxItemState::SET)
1545  {
1546  pHorJustify = static_cast<const SvxHorJustifyItem*>(pItem);
1547  eHorJustify = pHorJustify->GetValue();
1548  }
1549  if (rAttrSet.GetItemState(ATTR_VER_JUSTIFY, true,&pItem ) == SfxItemState::SET)
1550  {
1551  pVerJustify = static_cast<const SvxVerJustifyItem*>(pItem);
1552  eVerJustify = pVerJustify->GetValue();
1553  }
1554 
1555  switch ( nSlot )
1556  {
1557  case SID_ALIGNLEFT:
1558  rReq.SetSlot( SID_H_ALIGNCELL );
1560  !pHorJustify || (eHorJustify != SvxCellHorJustify::Left) ?
1561  SvxCellHorJustify::Left : SvxCellHorJustify::Standard, SID_H_ALIGNCELL ) );
1562  ExecuteSlot( rReq, GetInterface() );
1563  return;
1564 
1565  case SID_ALIGNRIGHT:
1566  rReq.SetSlot( SID_H_ALIGNCELL );
1568  !pHorJustify || (eHorJustify != SvxCellHorJustify::Right) ?
1569  SvxCellHorJustify::Right : SvxCellHorJustify::Standard, SID_H_ALIGNCELL ) );
1570  ExecuteSlot( rReq, GetInterface() );
1571  return;
1572 
1573  case SID_ALIGNCENTERHOR:
1574  rReq.SetSlot( SID_H_ALIGNCELL );
1576  !pHorJustify || (eHorJustify != SvxCellHorJustify::Center) ?
1577  SvxCellHorJustify::Center : SvxCellHorJustify::Standard, SID_H_ALIGNCELL ) );
1578  ExecuteSlot( rReq, GetInterface() );
1579  return;
1580 
1581  case SID_ALIGNBLOCK:
1582  rReq.SetSlot( SID_H_ALIGNCELL );
1584  !pHorJustify || (eHorJustify != SvxCellHorJustify::Block) ?
1585  SvxCellHorJustify::Block : SvxCellHorJustify::Standard, SID_H_ALIGNCELL ) );
1586  ExecuteSlot( rReq, GetInterface() );
1587  return;
1588 
1589  case SID_ALIGNTOP:
1590  rReq.SetSlot( SID_V_ALIGNCELL );
1592  !pVerJustify || (eVerJustify != SvxCellVerJustify::Top) ?
1593  SvxCellVerJustify::Top : SvxCellVerJustify::Standard, SID_V_ALIGNCELL ) );
1594  ExecuteSlot( rReq, GetInterface() );
1595  return;
1596 
1597  case SID_ALIGNBOTTOM:
1598  rReq.SetSlot( SID_V_ALIGNCELL );
1600  !pVerJustify || (eVerJustify != SvxCellVerJustify::Bottom) ?
1601  SvxCellVerJustify::Bottom : SvxCellVerJustify::Standard, SID_V_ALIGNCELL ) );
1602  ExecuteSlot( rReq, GetInterface() );
1603  return;
1604 
1605  case SID_ALIGNCENTERVER:
1606  rReq.SetSlot( SID_V_ALIGNCELL );
1608  !pVerJustify || (eVerJustify != SvxCellVerJustify::Center) ?
1609  SvxCellVerJustify::Center : SvxCellVerJustify::Standard, SID_V_ALIGNCELL ) );
1610  ExecuteSlot( rReq, GetInterface() );
1611  return;
1612 
1613  default:
1614  break;
1615  }
1616 
1617  }
1618 
1619  rBindings.Update();
1620 
1621  if( pNewSet )
1622  {
1623  rReq.Done( *pNewSet );
1624  pNewSet.reset();
1625  }
1626  else
1627  {
1628  rReq.Done();
1629  }
1630 
1631 }
1632 
1633 namespace
1634 {
1635  bool lcl_getColorFromStr(const SfxItemSet *pArgs, Color &rColor)
1636  {
1637  const SfxPoolItem* pColorStringItem = nullptr;
1638 
1639  if (pArgs && SfxItemState::SET == pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pColorStringItem) && pColorStringItem)
1640  {
1641  OUString sColor;
1642  sColor = static_cast<const SfxStringItem*>(pColorStringItem)->GetValue();
1643 
1644  if (sColor == "transparent")
1645  rColor = COL_TRANSPARENT;
1646  else
1647  rColor = Color(ColorTransparency, sColor.toInt32(16));
1648  return true;
1649  }
1650  return false;
1651  }
1652 }
1653 
1655 {
1656  ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
1657  SfxBindings& rBindings = rViewData.GetBindings();
1658  const SfxItemSet* pNewAttrs = rReq.GetArgs();
1659  sal_uInt16 nSlot = rReq.GetSlot();
1660 
1661  pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox
1662  ScDocument& rDoc = GetViewData().GetDocument();
1663  if ( !pNewAttrs )
1664  {
1665  switch ( nSlot )
1666  {
1667  case SID_GROW_FONT_SIZE:
1668  case SID_SHRINK_FONT_SIZE:
1669  {
1670  SfxItemPool& rPool = GetPool();
1671  SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT, rPool );
1672  aSetItem.GetItemSet().Put( pTabViewShell->GetSelectionPattern()->GetItemSet(), false );
1673 
1674  SvtScriptType nScriptTypes = pTabViewShell->GetSelectionScriptType();
1675  const SvxFontHeightItem* pSize( static_cast<const SvxFontHeightItem*>( aSetItem.GetItemOfScript( nScriptTypes ) ) );
1676 
1677  if ( pSize )
1678  {
1679  SvxFontHeightItem aSize( *pSize );
1680  sal_uInt32 nSize = aSize.GetHeight();
1681 
1682  const sal_uInt32 nFontInc = 40; // 2pt
1683  const sal_uInt32 nFontMaxSz = 19998; // 999.9pt
1684  if ( nSlot == SID_GROW_FONT_SIZE )
1685  nSize = std::min< sal_uInt32 >( nSize + nFontInc, nFontMaxSz );
1686  else
1687  nSize = std::max< sal_Int32 >( nSize - nFontInc, nFontInc );
1688 
1689  aSize.SetHeight( nSize );
1690  aSetItem.PutItemForScriptType( nScriptTypes, aSize );
1691  pTabViewShell->ApplyUserItemSet( aSetItem.GetItemSet() );
1692  }
1693  rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
1694  }
1695  break;
1696 
1697  case SID_ATTR_CHAR_ENDPREVIEW_FONT:
1698  {
1699  rDoc.SetPreviewFont(nullptr);
1700  pTabViewShell->UpdateSelectionArea( rDoc.GetPreviewSelection() );
1701  break;
1702  }
1703  case SID_ATTR_CHAR_COLOR:
1704  case SID_ATTR_CHAR_FONT:
1705  case SID_ATTR_CHAR_FONTHEIGHT:
1706  pTabViewShell->ExecuteCellFormatDlg(rReq, "font"); // when ToolBar is vertical
1707  break;
1708 
1709  case SID_BACKGROUND_COLOR:
1710  {
1711  SvxBrushItem aBrushItem(
1712  pTabViewShell->GetSelectionPattern()->GetItem( ATTR_BACKGROUND ) );
1713  aBrushItem.SetColor( COL_TRANSPARENT );
1714  pTabViewShell->ApplyAttr( aBrushItem, false );
1715  }
1716  break;
1717 
1718  case SID_ATTR_ALIGN_LINEBREAK: // without parameter as toggle
1719  {
1720  const ScPatternAttr* pAttrs = pTabViewShell->GetSelectionPattern();
1721  bool bOld = pAttrs->GetItem(ATTR_LINEBREAK).GetValue();
1722  ScLineBreakCell aBreakItem(!bOld);
1723  pTabViewShell->ApplyAttr( aBreakItem );
1724 
1725  SfxAllItemSet aNewSet( GetPool() );
1726  aNewSet.Put( aBreakItem,aBreakItem.Which() );
1727  rReq.Done( aNewSet );
1728 
1729  rBindings.Invalidate( nSlot );
1730  }
1731  break;
1732 
1733  case SID_SCATTR_CELLPROTECTION: // without parameter as toggle
1734  {
1735  const ScPatternAttr* pAttrs = pTabViewShell->GetSelectionPattern();
1736  bool bProtect = pAttrs->GetItem(ATTR_PROTECTION).GetProtection();
1737  bool bHideFormula = pAttrs->GetItem(ATTR_PROTECTION).GetHideFormula();
1738  bool bHideCell = pAttrs->GetItem(ATTR_PROTECTION).GetHideCell();
1739  bool bHidePrint = pAttrs->GetItem(ATTR_PROTECTION).GetHidePrint();
1740 
1741  ScProtectionAttr aProtectionItem( !bProtect, bHideFormula, bHideCell, bHidePrint );
1742  pTabViewShell->ApplyAttr( aProtectionItem );
1743 
1744  SfxAllItemSet aNewSet( GetPool() );
1745  aNewSet.Put( aProtectionItem, aProtectionItem.Which());
1746  aNewSet.Put( SfxBoolItem( SID_SCATTR_CELLPROTECTION, !bProtect ) );
1747  rReq.Done( aNewSet );
1748 
1749  rBindings.Invalidate( nSlot );
1750  }
1751  break;
1752  }
1753  }
1754  else
1755  {
1756  switch ( nSlot )
1757  {
1758  case SID_ATTR_CHAR_PREVIEW_FONT:
1759  {
1760  SfxItemPool& rPool = GetPool();
1761  sal_uInt16 nWhich = rPool.GetWhich( nSlot );
1762  const SvxFontItem& rFont = static_cast<const SvxFontItem&>(pNewAttrs->Get( nWhich ));
1763  SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, rPool );
1764  SvtScriptType nScript = pTabViewShell->GetSelectionScriptType();
1765  aSetItem.PutItemForScriptType( nScript, rFont );
1766 
1767  ScMarkData aFuncMark( rViewData.GetMarkData() );
1768  ScViewUtil::UnmarkFiltered( aFuncMark, rDoc );
1769  rDoc.SetPreviewFont( aSetItem.GetItemSet().Clone() );
1770  aFuncMark.MarkToMulti();
1771 
1772  if ( !aFuncMark.IsMarked() && !aFuncMark.IsMultiMarked() )
1773  {
1774  SCCOL nCol = rViewData.GetCurX();
1775  SCROW nRow = rViewData.GetCurY();
1776  SCTAB nTab = rViewData.GetTabNo();
1777  ScRange aRange( nCol, nRow, nTab );
1778  aFuncMark.SetMarkArea( aRange );
1779  }
1780  rDoc.SetPreviewSelection( aFuncMark );
1781  pTabViewShell->UpdateSelectionArea( aFuncMark );
1782  break;
1783  }
1784  case SID_ATTR_CHAR_OVERLINE:
1785  case SID_ATTR_CHAR_STRIKEOUT:
1786  case SID_ATTR_ALIGN_LINEBREAK:
1787  case SID_ATTR_CHAR_CONTOUR:
1788  case SID_ATTR_CHAR_SHADOWED:
1789  case SID_ATTR_CHAR_RELIEF:
1790  pTabViewShell->ApplyAttr( pNewAttrs->Get( pNewAttrs->GetPool()->GetWhich( nSlot ) ) );
1791  rBindings.Invalidate( nSlot );
1792  rBindings.Update( nSlot );
1793  break;
1794  case SID_ATTR_CHAR_COLOR:
1795  case SID_SCATTR_PROTECTION :
1796  {
1797  Color aColor;
1798  if (lcl_getColorFromStr(pNewAttrs, aColor))
1799  {
1800  SvxColorItem aColorItem(pTabViewShell->GetSelectionPattern()->
1801  GetItem( ATTR_FONT_COLOR ) );
1802  aColorItem.SetValue(aColor);
1803  pTabViewShell->ApplyAttr(aColorItem, false);
1804  }
1805  else
1806  {
1807  pTabViewShell->ApplyAttr( pNewAttrs->Get( pNewAttrs->GetPool()->GetWhich( nSlot) ), false);
1808  }
1809 
1810  rBindings.Invalidate( nSlot );
1811  rBindings.Update( nSlot );
1812  }
1813 
1814  break;
1815 
1816  case SID_ATTR_CHAR_FONT:
1817  case SID_ATTR_CHAR_FONTHEIGHT:
1818  {
1819  // #i78017 establish the same behaviour as in Writer
1820  SvtScriptType nScript = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
1821  if (nSlot == SID_ATTR_CHAR_FONT)
1822  nScript = pTabViewShell->GetSelectionScriptType();
1823 
1824  SfxItemPool& rPool = GetPool();
1825  SvxScriptSetItem aSetItem( nSlot, rPool );
1826  sal_uInt16 nWhich = rPool.GetWhich( nSlot );
1827  aSetItem.PutItemForScriptType( nScript, pNewAttrs->Get( nWhich ) );
1828 
1829  pTabViewShell->ApplyUserItemSet( aSetItem.GetItemSet() );
1830 
1831  rBindings.Invalidate( nSlot );
1832  rBindings.Update( nSlot );
1833  }
1834  break;
1835 
1836  case SID_FRAME_LINESTYLE:
1837  {
1838  // Update default line
1839  const ::editeng::SvxBorderLine* pLine =
1840  pNewAttrs->Get( SID_FRAME_LINESTYLE ).
1841  GetLine();
1842 
1843  if ( pLine )
1844  {
1845  ::editeng::SvxBorderLine* pDefLine = pTabViewShell->GetDefaultFrameLine();
1846 
1847  if ( pDefLine )
1848  {
1849  pDefLine->SetBorderLineStyle(
1850  pLine->GetBorderLineStyle());
1851  pDefLine->SetWidth( pLine->GetWidth( ) );
1852  pTabViewShell->SetSelectionFrameLines( pDefLine, false );
1853  }
1854  else
1855  {
1856  pTabViewShell->SetDefaultFrameLine( pLine );
1857  pTabViewShell->GetDefaultFrameLine()->SetColor( COL_BLACK );
1858  pTabViewShell->SetSelectionFrameLines( pLine, false );
1859  }
1860  }
1861  else
1862  {
1863  Color aColorBlack( COL_BLACK );
1864  ::editeng::SvxBorderLine aDefLine( &aColorBlack, 20,
1865  SvxBorderLineStyle::SOLID );
1866  pTabViewShell->SetDefaultFrameLine( &aDefLine );
1867  pTabViewShell->SetSelectionFrameLines( nullptr, false );
1868  }
1869  }
1870  break;
1871 
1872  case SID_FRAME_LINECOLOR:
1873  {
1874  ::editeng::SvxBorderLine* pDefLine = pTabViewShell->GetDefaultFrameLine();
1875 
1876  Color aColor;
1877  if (!lcl_getColorFromStr(pNewAttrs, aColor))
1878  aColor = pNewAttrs->Get( SID_FRAME_LINECOLOR ).GetValue();
1879 
1880  // Update default line
1881  if ( pDefLine )
1882  {
1883  pDefLine->SetColor( aColor );
1884  pTabViewShell->SetSelectionFrameLines( pDefLine, true );
1885  }
1886  else
1887  {
1888  ::editeng::SvxBorderLine aDefLine( &aColor, 20, SvxBorderLineStyle::SOLID );
1889  pTabViewShell->SetDefaultFrameLine( &aDefLine );
1890  pTabViewShell->SetSelectionFrameLines( &aDefLine, false );
1891  }
1892  }
1893  break;
1894 
1895  case SID_ATTR_BORDER_OUTER:
1896  case SID_ATTR_BORDER:
1897  {
1898  ::editeng::SvxBorderLine* pDefLine = pTabViewShell->GetDefaultFrameLine();
1899  const ScPatternAttr* pOldAttrs = pTabViewShell->GetSelectionPattern();
1900  std::unique_ptr<SfxItemSet> pOldSet(
1901  new SfxItemSet(
1902  *rDoc.GetPool(),
1904  ATTR_PATTERN_END>{} ));
1905  std::unique_ptr<SfxItemSet> pNewSet(
1906  new SfxItemSet(
1907  *rDoc.GetPool(),
1909  ATTR_PATTERN_END>{} ));
1910  const SfxPoolItem& rBorderAttr =
1911  pOldAttrs->GetItemSet().
1912  Get( ATTR_BORDER );
1913 
1914  // Evaluate border items from controller:
1915  const SfxPoolItem* pItem = nullptr;
1916 
1917  if ( pNewAttrs->GetItemState( ATTR_BORDER, true, &pItem )
1918  == SfxItemState::SET )
1919  {
1920  // The SvxFrameToolBoxControl toolbox controller uses a default
1921  // SvxBorderLine (all widths 0) to mark the lines that should be set.
1922  // Macro recording uses a SvxBoxItem with the real values (OutWidth > 0)
1923  // or NULL pointers for no lines.
1924  // -> Substitute existing lines with pDefLine only if widths are 0.
1925  SvxBoxItem aBoxItem ( *static_cast<const SvxBoxItem*>(pItem ));
1926  if ( aBoxItem.GetTop() && aBoxItem.GetTop()->GetOutWidth() == 0 )
1927  aBoxItem.SetLine( pDefLine, SvxBoxItemLine::TOP );
1928  if ( aBoxItem.GetBottom() && aBoxItem.GetBottom()->GetOutWidth() == 0 )
1929  aBoxItem.SetLine( pDefLine, SvxBoxItemLine::BOTTOM );
1930  if ( aBoxItem.GetLeft() && aBoxItem.GetLeft()->GetOutWidth() == 0 )
1931  aBoxItem.SetLine( pDefLine, SvxBoxItemLine::LEFT );
1932  if ( aBoxItem.GetRight() && aBoxItem.GetRight()->GetOutWidth() == 0 )
1933  aBoxItem.SetLine( pDefLine, SvxBoxItemLine::RIGHT );
1934  pNewSet->Put( aBoxItem );
1935  rReq.AppendItem( aBoxItem );
1936  }
1937 
1938  if ( pNewAttrs->GetItemState( ATTR_BORDER_INNER, true, &pItem )
1939  == SfxItemState::SET )
1940  {
1941  SvxBoxInfoItem aBoxInfoItem( *static_cast<const SvxBoxInfoItem*>(pItem) );
1942  if ( aBoxInfoItem.GetHori() && aBoxInfoItem.GetHori()->GetOutWidth() == 0 )
1943  aBoxInfoItem.SetLine( pDefLine, SvxBoxInfoItemLine::HORI );
1944  if ( aBoxInfoItem.GetVert() && aBoxInfoItem.GetVert()->GetOutWidth() == 0 )
1945  aBoxInfoItem.SetLine( pDefLine, SvxBoxInfoItemLine::VERT );
1946  pNewSet->Put( aBoxInfoItem );
1947  rReq.AppendItem( aBoxInfoItem );
1948  }
1949  else
1950  {
1951  SvxBoxInfoItem aBoxInfoItem( ATTR_BORDER_INNER );
1952  aBoxInfoItem.SetLine( nullptr, SvxBoxInfoItemLine::HORI );
1953  aBoxInfoItem.SetLine( nullptr, SvxBoxInfoItemLine::VERT );
1954  pNewSet->Put( aBoxInfoItem );
1955  }
1956 
1957  pOldSet->Put( rBorderAttr );
1958  pTabViewShell->ApplyAttributes( pNewSet.get(), pOldSet.get() );
1959  }
1960  break;
1961 
1962  case SID_ATTR_BORDER_DIAG_TLBR:
1963  case SID_ATTR_BORDER_DIAG_BLTR:
1964  {
1965  const ScPatternAttr* pOldAttrs = pTabViewShell->GetSelectionPattern();
1966  std::unique_ptr<SfxItemSet> pOldSet(new SfxItemSet(pOldAttrs->GetItemSet()));
1967  std::unique_ptr<SfxItemSet> pNewSet(new SfxItemSet(pOldAttrs->GetItemSet()));
1968  const SfxPoolItem* pItem = nullptr;
1969 
1970  if(SID_ATTR_BORDER_DIAG_TLBR == nSlot)
1971  {
1972  if(SfxItemState::SET == pNewAttrs->GetItemState(ATTR_BORDER_TLBR, true, &pItem))
1973  {
1975  aItem.SetLine(pNewAttrs->Get(ATTR_BORDER_TLBR).GetLine());
1976  pNewSet->Put(aItem);
1977  rReq.AppendItem(aItem);
1978  pTabViewShell->ApplyAttributes(pNewSet.get(), pOldSet.get());
1979  }
1980  }
1981  else // if( nSlot == SID_ATTR_BORDER_DIAG_BLTR )
1982  {
1983  if(SfxItemState::SET == pNewAttrs->GetItemState(ATTR_BORDER_BLTR, true, &pItem ))
1984  {
1986  aItem.SetLine(pNewAttrs->Get(ATTR_BORDER_BLTR).GetLine());
1987  pNewSet->Put(aItem);
1988  rReq.AppendItem(aItem);
1989  pTabViewShell->ApplyAttributes(pNewSet.get(), pOldSet.get());
1990  }
1991  }
1992 
1993  rBindings.Invalidate(nSlot);
1994  }
1995  break;
1996 
1997  // ATTR_BACKGROUND (=SID_ATTR_BRUSH) has to be set to two IDs:
1998  case SID_BACKGROUND_COLOR:
1999  {
2000  Color aColor;
2001 
2002  if (!lcl_getColorFromStr(pNewAttrs, aColor))
2003  {
2004  const SvxColorItem& rNewColorItem = pNewAttrs->Get( SID_BACKGROUND_COLOR );
2005  aColor = rNewColorItem.GetValue();
2006  }
2007 
2008  SvxBrushItem aBrushItem(
2009  pTabViewShell->GetSelectionPattern()->GetItem( ATTR_BACKGROUND ) );
2010  aBrushItem.SetColor( aColor );
2011 
2012  pTabViewShell->ApplyAttr( aBrushItem, false );
2013  }
2014  break;
2015 
2016  case SID_ATTR_BRUSH:
2017  {
2018  SvxBrushItem aBrushItem( pTabViewShell->GetSelectionPattern()->
2019  GetItem( ATTR_BACKGROUND ) );
2020  const SvxBrushItem& rNewBrushItem = static_cast<const SvxBrushItem&>(
2021  pNewAttrs->Get( GetPool().GetWhich(nSlot) ) );
2022  aBrushItem.SetColor(rNewBrushItem.GetColor());
2023  pTabViewShell->ApplyAttr( aBrushItem );
2024  }
2025  break;
2026 
2027  case SID_ATTR_BORDER_SHADOW:
2028  {
2029  const SvxShadowItem& rNewShadowItem =
2030  pNewAttrs->Get( ATTR_SHADOW );
2031  pTabViewShell->ApplyAttr( rNewShadowItem );
2032  }
2033  break;
2034 
2035  default:
2036  break;
2037  }
2038 
2039  if( ! rReq.IsAPI() && ! rReq.IsDone() )
2040  rReq.Done();
2041  }
2042 }
2043 
2045 {
2046  ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
2047  const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
2048  const SvxBrushItem& rBrushItem = rAttrSet.Get( ATTR_BACKGROUND );
2049  SfxWhichIter aIter( rSet );
2050  sal_uInt16 nWhich = aIter.FirstWhich();
2051 
2052  rSet.Put( rAttrSet, false );
2053 
2054  // choose font info according to selection script type
2055  SvtScriptType nScript = SvtScriptType::NONE; // GetSelectionScriptType never returns 0
2056  if ( rSet.GetItemState( ATTR_FONT ) != SfxItemState::UNKNOWN )
2057  {
2058  nScript = pTabViewShell->GetSelectionScriptType();
2059  ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT, nScript );
2060  }
2061  if ( rSet.GetItemState( ATTR_FONT_HEIGHT ) != SfxItemState::UNKNOWN )
2062  {
2063  if (nScript == SvtScriptType::NONE) nScript = pTabViewShell->GetSelectionScriptType();
2064  ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT_HEIGHT, nScript );
2065  }
2066 
2067  while ( nWhich )
2068  {
2069  switch(nWhich)
2070  {
2071  case SID_BACKGROUND_COLOR:
2072  {
2073  rSet.Put( SvxColorItem( rBrushItem.GetColor(), SID_BACKGROUND_COLOR ) );
2074  if(SfxItemState::DONTCARE == rAttrSet.GetItemState(ATTR_BACKGROUND))
2075  {
2076  rSet.InvalidateItem(SID_BACKGROUND_COLOR);
2077  }
2078  }
2079  break;
2080  case SID_FRAME_LINESTYLE:
2081  case SID_FRAME_LINECOLOR:
2082  {
2083  // handled together because both need the cell border information for decisions
2084  Color aCol;
2085  editeng::SvxBorderLine aLine(nullptr,0,SvxBorderLineStyle::SOLID);
2086  bool bCol = false;
2087  bool bColDisable = false, bStyleDisable = false;
2088  std::shared_ptr<SvxBoxItem> aBoxItem(std::make_shared<SvxBoxItem>(ATTR_BORDER));
2089  std::shared_ptr<SvxBoxInfoItem> aInfoItem(std::make_shared<SvxBoxInfoItem>(ATTR_BORDER_INNER));
2090 
2091  pTabViewShell->GetSelectionFrame(aBoxItem, aInfoItem);
2092 
2093  if( aBoxItem->GetTop() )
2094  {
2095  bCol = true;
2096  aCol = aBoxItem->GetTop()->GetColor() ;
2097  aLine.SetColor(aCol);
2098  aLine.SetWidth( aBoxItem->GetTop()->GetWidth());
2099  aLine.SetBorderLineStyle( aBoxItem->GetTop()->GetBorderLineStyle());
2100  }
2101 
2102  if( aBoxItem->GetBottom() )
2103  {
2104  if(!bCol)
2105  {
2106  bCol = true;
2107  aCol = aBoxItem->GetBottom()->GetColor() ;
2108  aLine.SetColor(aCol);
2109  aLine.SetWidth( aBoxItem->GetBottom()->GetWidth());
2110  aLine.SetBorderLineStyle( aBoxItem->GetBottom()->GetBorderLineStyle());
2111  }
2112  else
2113  {
2114  if(aCol != aBoxItem->GetBottom()->GetColor() )
2115  bColDisable = true;
2116  if( aLine != *aBoxItem->GetBottom() )
2117  bStyleDisable = true;
2118  }
2119  }
2120 
2121  if( aBoxItem->GetLeft() )
2122  {
2123  if(!bCol)
2124  {
2125  bCol = true;
2126  aCol = aBoxItem->GetLeft()->GetColor() ;
2127  aLine.SetColor(aCol);
2128  aLine.SetWidth( aBoxItem->GetLeft()->GetWidth());
2129  aLine.SetBorderLineStyle( aBoxItem->GetLeft()->GetBorderLineStyle());
2130  }
2131  else
2132  {
2133  if(aCol != aBoxItem->GetLeft()->GetColor() )
2134  bColDisable = true;
2135  if( aLine != *aBoxItem->GetLeft() )
2136  bStyleDisable = true;
2137  }
2138  }
2139 
2140  if( aBoxItem->GetRight() )
2141  {
2142  if(!bCol)
2143  {
2144  bCol = true;
2145  aCol = aBoxItem->GetRight()->GetColor() ;
2146  aLine.SetColor(aCol);
2147  aLine.SetWidth( aBoxItem->GetRight()->GetWidth());
2148  aLine.SetBorderLineStyle( aBoxItem->GetRight()->GetBorderLineStyle());
2149  }
2150  else
2151  {
2152  if(aCol != aBoxItem->GetRight()->GetColor() )
2153  bColDisable = true;
2154  if( aLine != *aBoxItem->GetRight() )
2155  bStyleDisable = true;
2156  }
2157  }
2158 
2159  if( aInfoItem->GetVert())
2160  {
2161  if(!bCol)
2162  {
2163  bCol = true;
2164  aCol = aInfoItem->GetVert()->GetColor() ;
2165  aLine.SetColor(aCol);
2166  aLine.SetWidth( aInfoItem->GetVert()->GetWidth());
2167  aLine.SetBorderLineStyle( aInfoItem->GetVert()->GetBorderLineStyle());
2168  }
2169  else
2170  {
2171  if(aCol != aInfoItem->GetVert()->GetColor() )
2172  bColDisable = true;
2173  if( aLine != *aInfoItem->GetVert() )
2174  bStyleDisable = true;
2175  }
2176  }
2177 
2178  if( aInfoItem->GetHori())
2179  {
2180  if(!bCol)
2181  {
2182  bCol = true;
2183  aCol = aInfoItem->GetHori()->GetColor() ;
2184  aLine.SetColor(aCol);
2185  aLine.SetWidth( aInfoItem->GetHori()->GetWidth());
2186  aLine.SetBorderLineStyle( aInfoItem->GetHori()->GetBorderLineStyle());
2187  }
2188  else
2189  {
2190  if(aCol != aInfoItem->GetHori()->GetColor() )
2191  bColDisable = true;
2192  if( aLine != *aInfoItem->GetHori() )
2193  bStyleDisable = true;
2194  }
2195  }
2196 
2197  if( !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::VERT )
2198  || !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::HORI )
2199  || !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::LEFT )
2200  || !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::RIGHT )
2201  || !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::TOP )
2202  || !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::BOTTOM ) )
2203  {
2204  bColDisable = true;
2205  bStyleDisable = true;
2206  }
2207 
2208  if(SID_FRAME_LINECOLOR == nWhich)
2209  {
2210  if(bColDisable) // if different lines have different colors
2211  {
2212  aCol = COL_TRANSPARENT;
2213  rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) );
2214  rSet.InvalidateItem(SID_FRAME_LINECOLOR);
2215  }
2216  else if (!bCol) // if no line available
2217  {
2218  aCol = COL_AUTO;
2219  rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) );
2220  }
2221  else
2222  rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) );
2223  }
2224  else // if( nWhich == SID_FRAME_LINESTYLE)
2225  {
2226  if(bStyleDisable) // if have several lines but don't have same style
2227  {
2228  aLine.SetWidth( 1 );
2229  SvxLineItem aItem(SID_FRAME_LINESTYLE);
2230  aItem.SetLine(&aLine);
2231  rSet.Put( aItem );
2232  rSet.InvalidateItem(SID_FRAME_LINESTYLE);
2233  }
2234  else // all the lines have same style or no line available, use initial value (0,0,0,0)
2235  {
2236  SvxLineItem aItem(SID_FRAME_LINESTYLE);
2237  aItem.SetLine(&aLine);
2238  rSet.Put( aItem );
2239  }
2240  }
2241  }
2242  break;
2243  case SID_ATTR_BRUSH:
2244  {
2245  rSet.Put( rBrushItem.CloneSetWhich(GetPool().GetWhich(nWhich)) );
2246  }
2247  break;
2248  case SID_SCATTR_CELLPROTECTION:
2249  {
2250  bool bProtect = rAttrSet.Get( ATTR_PROTECTION ).GetProtection();
2251  rSet.Put( SfxBoolItem(SID_SCATTR_CELLPROTECTION, bProtect) );
2252  }
2253  break;
2254  }
2255  nWhich = aIter.NextWhich();
2256  }
2257 
2258  // stuff for sidebar panels
2259  Invalidate(SID_ATTR_ALIGN_DEGREES);
2260  Invalidate(SID_ATTR_ALIGN_LOCKPOS);
2261  Invalidate(SID_ATTR_ALIGN_STACKED);
2262 }
2263 
2265 {
2266  ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
2267  const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
2268  rSet.Put( rAttrSet, false ); // Include ItemStates in copy
2269 
2270  // choose font info according to selection script type
2271  SvtScriptType nScript = SvtScriptType::NONE; // GetSelectionScriptType never returns 0
2272  if ( rSet.GetItemState( ATTR_FONT_WEIGHT ) != SfxItemState::UNKNOWN )
2273  {
2274  nScript = pTabViewShell->GetSelectionScriptType();
2275  ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT_WEIGHT, nScript );
2276  }
2277  if ( rSet.GetItemState( ATTR_FONT_POSTURE ) != SfxItemState::UNKNOWN )
2278  {
2279  if (nScript == SvtScriptType::NONE) nScript = pTabViewShell->GetSelectionScriptType();
2280  ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT_POSTURE, nScript );
2281  }
2282 
2283  SfxItemState eState;
2284 
2285  // own control on radio button functionality:
2286 
2287  // underline
2288 
2289  eState = rAttrSet.GetItemState( ATTR_FONT_UNDERLINE );
2290  if ( eState == SfxItemState::DONTCARE )
2291  {
2292  rSet.InvalidateItem( SID_ULINE_VAL_NONE );
2293  rSet.InvalidateItem( SID_ULINE_VAL_SINGLE );
2294  rSet.InvalidateItem( SID_ULINE_VAL_DOUBLE );
2295  rSet.InvalidateItem( SID_ULINE_VAL_DOTTED );
2296  }
2297  else
2298  {
2299  FontLineStyle eUnderline =
2300  rAttrSet.Get(ATTR_FONT_UNDERLINE).GetLineStyle();
2301  rSet.Put(SfxBoolItem(SID_ULINE_VAL_SINGLE, eUnderline == LINESTYLE_SINGLE));
2302  rSet.Put(SfxBoolItem(SID_ULINE_VAL_DOUBLE, eUnderline == LINESTYLE_DOUBLE));
2303  rSet.Put(SfxBoolItem(SID_ULINE_VAL_DOTTED, eUnderline == LINESTYLE_DOTTED));
2304  rSet.Put(SfxBoolItem(SID_ULINE_VAL_NONE, eUnderline == LINESTYLE_NONE));
2305  }
2306 
2307  // horizontal alignment
2308 
2309  const SvxHorJustifyItem* pHorJustify = nullptr;
2310  const SvxVerJustifyItem* pVerJustify = nullptr;
2311  SvxCellVerJustify eVerJustify = SvxCellVerJustify::Standard;
2312  sal_uInt16 nWhich = 0;
2313  bool bJustifyStd = false;
2314  SfxBoolItem aBoolItem ( 0, true );
2315 
2316  eState = rAttrSet.GetItemState( ATTR_HOR_JUSTIFY, true,
2317  reinterpret_cast<const SfxPoolItem**>(&pHorJustify) );
2318  switch ( eState )
2319  {
2320  case SfxItemState::SET:
2321  {
2322  switch ( pHorJustify->GetValue() )
2323  {
2324  case SvxCellHorJustify::Standard:
2325  break;
2326 
2327  case SvxCellHorJustify::Left:
2328  nWhich = SID_ALIGNLEFT;
2329  break;
2330 
2331  case SvxCellHorJustify::Right:
2332  nWhich = SID_ALIGNRIGHT;
2333  break;
2334 
2335  case SvxCellHorJustify::Center:
2336  nWhich = SID_ALIGNCENTERHOR;
2337  break;
2338 
2339  case SvxCellHorJustify::Block:
2340  nWhich = SID_ALIGNBLOCK;
2341  break;
2342 
2343  case SvxCellHorJustify::Repeat:
2344  default:
2345  bJustifyStd = true;
2346  break;
2347  }
2348  }
2349  break;
2350 
2351  case SfxItemState::DONTCARE:
2352  rSet.InvalidateItem( SID_ALIGNLEFT );
2353  rSet.InvalidateItem( SID_ALIGNRIGHT );
2354  rSet.InvalidateItem( SID_ALIGNCENTERHOR );
2355  rSet.InvalidateItem( SID_ALIGNBLOCK );
2356  break;
2357 
2358  default:
2359  bJustifyStd = true;
2360  break;
2361  }
2362 
2363  if ( nWhich )
2364  {
2365  aBoolItem.SetWhich( nWhich );
2366  rSet.Put( aBoolItem );
2367  }
2368  else if ( bJustifyStd )
2369  {
2370  aBoolItem.SetValue( false );
2371  aBoolItem.SetWhich( SID_ALIGNLEFT ); rSet.Put( aBoolItem );
2372  aBoolItem.SetWhich( SID_ALIGNRIGHT ); rSet.Put( aBoolItem );
2373  aBoolItem.SetWhich( SID_ALIGNCENTERHOR ); rSet.Put( aBoolItem );
2374  aBoolItem.SetWhich( SID_ALIGNBLOCK ); rSet.Put( aBoolItem );
2375  bJustifyStd = false;
2376  }
2377 
2378  // vertical alignment
2379 
2380  nWhich = 0;
2381  aBoolItem.SetValue( true );
2382 
2383  eState = rAttrSet.GetItemState( ATTR_VER_JUSTIFY, true,
2384  reinterpret_cast<const SfxPoolItem**>(&pVerJustify) );
2385 
2386  switch ( eState )
2387  {
2388  case SfxItemState::SET:
2389  {
2390  eVerJustify = pVerJustify->GetValue();
2391 
2392  switch ( eVerJustify )
2393  {
2394  case SvxCellVerJustify::Top:
2395  nWhich = SID_ALIGNTOP;
2396  break;
2397 
2398  case SvxCellVerJustify::Bottom:
2399  nWhich = SID_ALIGNBOTTOM;
2400  break;
2401 
2402  case SvxCellVerJustify::Center:
2403  nWhich = SID_ALIGNCENTERVER;
2404  break;
2405 
2406  case SvxCellVerJustify::Standard:
2407  default:
2408  bJustifyStd = true;
2409  break;
2410  }
2411  }
2412  break;
2413 
2414  case SfxItemState::DONTCARE:
2415  rSet.InvalidateItem( SID_ALIGNTOP );
2416  rSet.InvalidateItem( SID_ALIGNBOTTOM );
2417  rSet.InvalidateItem( SID_ALIGNCENTERVER );
2418  break;
2419 
2420  default:
2421  bJustifyStd = true;
2422  break;
2423  }
2424 
2425  if ( nWhich )
2426  {
2427  aBoolItem.SetWhich( nWhich );
2428  rSet.Put( aBoolItem );
2429  }
2430  else if ( bJustifyStd )
2431  {
2432  aBoolItem.SetValue( false );
2433  aBoolItem.SetWhich( SID_ALIGNTOP ); rSet.Put( aBoolItem );
2434  aBoolItem.SetWhich( SID_ALIGNBOTTOM ); rSet.Put( aBoolItem );
2435  aBoolItem.SetWhich( SID_ALIGNCENTERVER ); rSet.Put( aBoolItem );
2436  }
2437 }
2438 
2440 {
2441  ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
2442  std::shared_ptr<SvxBoxItem> aBoxItem(std::make_shared<SvxBoxItem>(ATTR_BORDER));
2443  std::shared_ptr<SvxBoxInfoItem> aInfoItem(std::make_shared<SvxBoxInfoItem>(ATTR_BORDER_INNER));
2444 
2445  pTabViewShell->GetSelectionFrame( aBoxItem, aInfoItem );
2446 
2447  if ( rSet.GetItemState( ATTR_BORDER ) != SfxItemState::UNKNOWN )
2448  rSet.Put( *aBoxItem );
2449  if ( rSet.GetItemState( ATTR_BORDER_INNER ) != SfxItemState::UNKNOWN )
2450  rSet.Put( *aInfoItem );
2451 }
2452 
2454 {
2455  ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
2456  const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
2457  SfxWhichIter aIter(rSet);
2458  sal_uInt16 nWhich = aIter.FirstWhich();
2459 
2460  SvxCellHorJustify eHAlign = SvxCellHorJustify::Standard;
2461  bool bHasHAlign = rAttrSet.GetItemState( ATTR_HOR_JUSTIFY ) != SfxItemState::DONTCARE;
2462  if( bHasHAlign )
2463  eHAlign = rAttrSet.Get( ATTR_HOR_JUSTIFY ).GetValue();
2464 
2465  SvxCellVerJustify eVAlign = SvxCellVerJustify::Standard;
2466  bool bHasVAlign = rAttrSet.GetItemState( ATTR_VER_JUSTIFY ) != SfxItemState::DONTCARE;
2467  if( bHasVAlign )
2468  eVAlign = rAttrSet.Get( ATTR_VER_JUSTIFY ).GetValue();
2469 
2470  while ( nWhich )
2471  {
2472  switch ( nWhich )
2473  {
2474  case SID_H_ALIGNCELL:
2475  if ( bHasHAlign )
2476  rSet.Put( SvxHorJustifyItem( eHAlign, nWhich ));
2477  break;
2478  case SID_V_ALIGNCELL:
2479  if ( bHasVAlign )
2480  rSet.Put( SvxVerJustifyItem( eVAlign, nWhich ));
2481  break;
2482 
2483  // pseudo slots for Format menu
2484  case SID_ALIGN_ANY_HDEFAULT:
2485  case SID_ALIGN_ANY_LEFT:
2486  case SID_ALIGN_ANY_HCENTER:
2487  case SID_ALIGN_ANY_RIGHT:
2488  case SID_ALIGN_ANY_JUSTIFIED:
2489  rSet.Put( SfxBoolItem( nWhich, bHasHAlign && (eHAlign == lclConvertSlotToHAlign( nWhich )) ) );
2490  break;
2491  case SID_ALIGN_ANY_VDEFAULT:
2492  case SID_ALIGN_ANY_TOP:
2493  case SID_ALIGN_ANY_VCENTER:
2494  case SID_ALIGN_ANY_BOTTOM:
2495  rSet.Put( SfxBoolItem( nWhich, bHasVAlign && (eVAlign == lclConvertSlotToVAlign( nWhich )) ) );
2496  break;
2497  }
2498  nWhich = aIter.NextWhich();
2499  }
2500 }
2501 
2503 {
2504  ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
2505  ScDocument& rDoc = rViewData.GetDocument();
2506  const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
2507  const SfxItemState eItemState = rAttrSet.GetItemState( ATTR_VALUE_FORMAT );
2508  sal_uInt32 nNumberFormat = rAttrSet.Get(ATTR_VALUE_FORMAT).GetValue();
2509  SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
2510  // If item state is default or set it
2511  // indicates one number format so we
2512  // don't have to iterate over all
2513  // selected cells' attribute ranges to
2514  // determine selected types.
2515  // Does *NOT* include the
2516  // SvNumFormatType::DEFINED bit.
2517  const SvNumFormatType nType = (eItemState >= SfxItemState::DEFAULT ? pFormatter->GetType( nNumberFormat) :
2519  NfIndexTableOffset nOffset = pFormatter->GetIndexTableOffset(nNumberFormat);
2520 
2521  SfxWhichIter aIter(rSet);
2522  sal_uInt16 nWhich = aIter.FirstWhich();
2523 
2524  while ( nWhich )
2525  {
2526  switch ( nWhich )
2527  {
2528  case SID_NUMBER_THOUSANDS:
2529  {
2530  bool bEnable = (SfxItemState::DONTCARE != eItemState);
2531  if (bEnable)
2532  {
2533  bEnable = ((nType != SvNumFormatType::ALL) && (nType &
2534  (SvNumFormatType::NUMBER |
2535  SvNumFormatType::PERCENT |
2536  SvNumFormatType::CURRENCY |
2537  SvNumFormatType::FRACTION)));
2538  if (bEnable)
2539  {
2540  bool bThousand( false );
2541  bool bNegRed( false );
2542  sal_uInt16 nPrecision( 0 );
2543  sal_uInt16 nLeadZeroes( 0 );
2544  pFormatter->GetFormatSpecialInfo( nNumberFormat, bThousand, bNegRed, nPrecision, nLeadZeroes);
2545  rSet.Put( SfxBoolItem( nWhich, bThousand));
2546  }
2547  }
2548  if (!bEnable)
2549  {
2550  rSet.DisableItem( nWhich );
2551  }
2552  }
2553  break;
2554  case SID_NUMBER_FORMAT:
2555  // symphony version with format interpretation
2556  {
2557  if(SfxItemState::DONTCARE != eItemState)
2558  {
2559  bool bThousand(false);
2560  bool bNegRed(false);
2561  sal_uInt16 nPrecision(0);
2562  sal_uInt16 nLeadZeroes(0);
2563 
2564  pFormatter->GetFormatSpecialInfo(nNumberFormat,bThousand, bNegRed, nPrecision, nLeadZeroes);
2565 
2566  const SvNumberformat* pFormatEntry = pFormatter->GetEntry( nNumberFormat );
2567  if (pFormatEntry && (pFormatEntry->GetType() & SvNumFormatType::SCIENTIFIC))
2568  {
2569  // if scientific, bThousand is used for engineering notation
2570  const sal_uInt16 nIntegerDigits = pFormatEntry->GetFormatIntegerDigits();
2571  bThousand = nIntegerDigits > 0 && ((nIntegerDigits % 3) == 0);
2572  }
2573  OUString aFormat;
2574  static constexpr OUStringLiteral sBreak = u",";
2575  const OUString sThousand = OUString::number(static_cast<sal_Int32>(bThousand));
2576  const OUString sNegRed = OUString::number(static_cast<sal_Int32>(bNegRed));
2577  const OUString sPrecision = OUString::number(nPrecision);
2578  const OUString sLeadZeroes = OUString::number(nLeadZeroes);
2579 
2580  aFormat += sThousand +
2581  sBreak +
2582  sNegRed +
2583  sBreak +
2584  sPrecision +
2585  sBreak +
2586  sLeadZeroes +
2587  sBreak;
2588 
2589  rSet.Put(SfxStringItem(nWhich, aFormat));
2590 
2592  {
2593  OUString sPayload = ".uno:NumberFormat=" + aFormat;
2594  GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
2595  OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr());
2596  }
2597  }
2598  else
2599  {
2600  rSet.InvalidateItem( nWhich );
2601  }
2602  }
2603  break;
2604 
2605  case SID_NUMBER_TYPE_FORMAT:
2606  {
2607  sal_Int16 nFormatCategory = -1;
2608  if ( eItemState >= SfxItemState::DEFAULT ) //Modify for more robust
2609  {
2610  switch(nType)
2611  {
2612  case SvNumFormatType::NUMBER:
2613  // Determine if General format.
2614  if ((nNumberFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0)
2615  nFormatCategory = 0;
2616  else
2617  nFormatCategory = 1;
2618  break;
2619  case SvNumFormatType::PERCENT:
2620  nFormatCategory = 2;
2621  break;
2622  case SvNumFormatType::CURRENCY:
2623  nFormatCategory = 3;
2624  break;
2625  case SvNumFormatType::DATE:
2626  //Add
2627  case SvNumFormatType::DATETIME:
2628  nFormatCategory = 4;
2629  break;
2630  case SvNumFormatType::TIME:
2631  nFormatCategory = 5;
2632  break;
2633  case SvNumFormatType::SCIENTIFIC:
2634  nFormatCategory = 6;
2635  break;
2636  case SvNumFormatType::FRACTION:
2637  nFormatCategory = 7;
2638  break;
2639  case SvNumFormatType::LOGICAL:
2640  nFormatCategory = 8;
2641  break;
2642  case SvNumFormatType::TEXT:
2643  nFormatCategory = 9;
2644  break;
2645  default:
2646  nFormatCategory = -1; //for more robust
2647  }
2648  if( nFormatCategory == -1 )
2649  rSet.InvalidateItem( nWhich );
2650  else
2651  rSet.Put( SfxInt16Item( nWhich, nFormatCategory ) );
2652  }
2653  else
2654  {
2655  rSet.InvalidateItem( nWhich );
2656  }
2657 
2658  }
2659  break;
2660  case SID_NUMBER_CURRENCY:
2661  rSet.Put( SfxBoolItem(nWhich, bool(nType & SvNumFormatType::CURRENCY)) );
2662  break;
2663  case SID_NUMBER_SCIENTIFIC:
2664  rSet.Put( SfxBoolItem(nWhich, bool(nType & SvNumFormatType::SCIENTIFIC)) );
2665  break;
2666  case SID_NUMBER_DATE:
2667  rSet.Put( SfxBoolItem(nWhich, bool(nType & SvNumFormatType::DATE)) );
2668  break;
2669  case SID_NUMBER_PERCENT:
2670  rSet.Put( SfxBoolItem(nWhich, bool(nType & SvNumFormatType::PERCENT)) );
2671  break;
2672  case SID_NUMBER_TIME:
2673  rSet.Put( SfxBoolItem(nWhich, bool(nType & SvNumFormatType::TIME)) );
2674  break;
2675  case SID_NUMBER_TWODEC:
2676  rSet.Put( SfxBoolItem(nWhich, (nType & SvNumFormatType::NUMBER) && nOffset == NF_NUMBER_1000DEC2 ) );
2677  break;
2678  case SID_NUMBER_STANDARD:
2679  rSet.Put( SfxBoolItem(nWhich, (nType & SvNumFormatType::NUMBER) && (nNumberFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0) );
2680  break;
2681  }
2682  nWhich = aIter.NextWhich();
2683  }
2684 }
2685 
2687 {
2688  ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
2689  pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox
2690  bool bEditMode = false;
2691  if ( GetViewData().HasEditView( GetViewData().GetActivePart() ) )
2692  {
2693  bEditMode=true;
2694  SC_MOD()->InputEnterHandler();
2695  pTabViewShell->UpdateInputHandler();
2696  }
2697  sal_uInt16 nSlot = rReq.GetSlot();
2698  switch( nSlot )
2699  {
2700  case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
2701  case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
2702  {
2703  bool bVert = (nSlot == SID_TEXTDIRECTION_TOP_TO_BOTTOM);
2704  ScPatternAttr aAttr( GetViewData().GetDocument().GetPool() );
2705  SfxItemSet& rItemSet = aAttr.GetItemSet();
2706  rItemSet.Put( ScVerticalStackCell( bVert ) );
2707  rItemSet.Put( SfxBoolItem( ATTR_VERTICAL_ASIAN, bVert ) );
2708  pTabViewShell->ApplySelectionPattern( aAttr );
2709  pTabViewShell->AdjustBlockHeight();
2710  }
2711  break;
2712 
2713  case SID_ATTR_PARA_LEFT_TO_RIGHT:
2714  case SID_ATTR_PARA_RIGHT_TO_LEFT:
2715  {
2716  SvxFrameDirection eDirection = ( nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT ) ?
2717  SvxFrameDirection::Horizontal_LR_TB : SvxFrameDirection::Horizontal_RL_TB;
2718  pTabViewShell->ApplyAttr( SvxFrameDirectionItem( eDirection, ATTR_WRITINGDIR ) );
2719  }
2720  break;
2721  }
2722  if (bEditMode)
2723  SC_MOD()->SetInputMode( SC_INPUT_TABLE );
2724 }
2725 
2727 {
2728  ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
2729  const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
2730 
2731  bool bVertDontCare =
2732  (rAttrSet.GetItemState( ATTR_VERTICAL_ASIAN ) == SfxItemState::DONTCARE) ||
2733  (rAttrSet.GetItemState( ATTR_STACKED ) == SfxItemState::DONTCARE);
2734  bool bLeftRight = !bVertDontCare &&
2735  !rAttrSet.Get( ATTR_STACKED ).GetValue();
2736  bool bTopBottom = !bVertDontCare && !bLeftRight &&
2737  rAttrSet.Get( ATTR_VERTICAL_ASIAN ).GetValue();
2738 
2739  bool bBidiDontCare = (rAttrSet.GetItemState( ATTR_WRITINGDIR ) == SfxItemState::DONTCARE);
2740  EEHorizontalTextDirection eBidiDir = EEHorizontalTextDirection::Default;
2741  if ( !bBidiDontCare )
2742  {
2743  SvxFrameDirection eCellDir = rAttrSet.Get( ATTR_WRITINGDIR ).GetValue();
2744  if ( eCellDir == SvxFrameDirection::Environment )
2745  eBidiDir = GetViewData().GetDocument().
2746  GetEditTextDirection( GetViewData().GetTabNo() );
2747  else if ( eCellDir == SvxFrameDirection::Horizontal_RL_TB )
2748  eBidiDir = EEHorizontalTextDirection::R2L;
2749  else
2750  eBidiDir = EEHorizontalTextDirection::L2R;
2751  }
2752 
2753  SvtLanguageOptions aLangOpt;
2754  bool bDisableCTLFont = !aLangOpt.IsCTLFontEnabled();
2755  bool bDisableVerticalText = !aLangOpt.IsVerticalTextEnabled();
2756 
2757  SfxWhichIter aIter( rSet );
2758  sal_uInt16 nWhich = aIter.FirstWhich();
2759  while( nWhich )
2760  {
2761  switch( nWhich )
2762  {
2763  case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
2764  case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
2765  if ( bDisableVerticalText )
2766  rSet.DisableItem( nWhich );
2767  else
2768  {
2769  if( bVertDontCare )
2770  rSet.InvalidateItem( nWhich );
2771  else if ( nWhich == SID_TEXTDIRECTION_LEFT_TO_RIGHT )
2772  rSet.Put( SfxBoolItem( nWhich, bLeftRight ) );
2773  else
2774  rSet.Put( SfxBoolItem( nWhich, bTopBottom ) );
2775  }
2776  break;
2777 
2778  case SID_ATTR_PARA_LEFT_TO_RIGHT:
2779  case SID_ATTR_PARA_RIGHT_TO_LEFT:
2780  if ( bDisableCTLFont )
2781  rSet.DisableItem( nWhich );
2782  else
2783  {
2784  if ( bTopBottom )
2785  rSet.DisableItem( nWhich );
2786  else if ( bBidiDontCare )
2787  rSet.InvalidateItem( nWhich );
2788  else if ( nWhich == SID_ATTR_PARA_LEFT_TO_RIGHT )
2789  rSet.Put( SfxBoolItem( nWhich, eBidiDir == EEHorizontalTextDirection::L2R ) );
2790  else
2791  rSet.Put( SfxBoolItem( nWhich, eBidiDir == EEHorizontalTextDirection::R2L ) );
2792  }
2793  }
2794  nWhich = aIter.NextWhich();
2795  }
2796 }
2797 
2799 {
2800  ScViewFunc* pView = rViewData.GetView();
2801  if ( pView->HasPaintBrush() )
2802  {
2803  // cancel paintbrush mode
2804  pView->ResetBrushDocument();
2805  }
2806  else
2807  {
2808  bool bLock = false;
2809  const SfxItemSet *pArgs = rReq.GetArgs();
2810  if( pArgs && pArgs->Count() >= 1 )
2811  bLock = pArgs->Get(SID_FORMATPAINTBRUSH).GetValue();
2812 
2813  // in case of multi selection, deselect all and use the cursor position
2814  ScRange aDummy;
2815  if ( rViewData.GetSimpleArea(aDummy) != SC_MARK_SIMPLE )
2816  pView->Unmark();
2817 
2818  ScDocumentUniquePtr pBrushDoc(new ScDocument( SCDOCMODE_CLIP ));
2819  pView->CopyToClip( pBrushDoc.get(), false, true );
2820  pView->SetBrushDocument( std::move(pBrushDoc), bLock );
2821  }
2822 }
2823 
2825 {
2827  rSet.DisableItem( SID_FORMATPAINTBRUSH );
2828  else
2829  rSet.Put( SfxBoolItem( SID_FORMATPAINTBRUSH, rViewData.GetView()->HasPaintBrush() ) );
2830 }
2831 
2833 {
2834  SvNumFormatType nType = SvNumFormatType::ALL;
2835  ScDocument& rDoc = GetViewData().GetDocument();
2836  ScMarkData aMark(GetViewData().GetMarkData());
2837  const SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
2838  if (!pFormatter)
2839  return nType;
2840 
2841  // TODO: Find out how to get a selected table range in case multiple tables
2842  // are selected. Currently we only check for the current active table.
2843 
2844  if ( aMark.IsMarked() || aMark.IsMultiMarked() )
2845  {
2846  aMark.MarkToMulti();
2847  ScRange aRange;
2848  aMark.GetMultiMarkArea(aRange);
2849 
2850  const ScMultiSel& rMultiSel = aMark.GetMultiSelData();
2851 
2852  SvNumFormatType nComboType = SvNumFormatType::ALL;
2853  bool bFirstItem = true;
2854  for (SCCOL nCol = aRange.aStart.Col(); nCol <= aRange.aEnd.Col(); ++nCol)
2855  {
2856  if (!rMultiSel.HasMarks(nCol))
2857  continue;
2858 
2859  SCROW nRow1, nRow2;
2860  ScMultiSelIter aMultiIter(rMultiSel, nCol);
2861  while (aMultiIter.Next(nRow1, nRow2))
2862  {
2863  ScRange aColRange(nCol, nRow1, aRange.aStart.Tab());
2864  aColRange.aEnd.SetRow(nRow2);
2865  sal_uInt32 nNumFmt = rDoc.GetNumberFormat(aColRange);
2866  SvNumFormatType nThisType = pFormatter->GetType(nNumFmt);
2867  if (bFirstItem)
2868  {
2869  bFirstItem = false;
2870  nComboType = nThisType;
2871  }
2872  else if (nComboType != nThisType)
2873  // mixed number format type.
2874  return SvNumFormatType::ALL;
2875  }
2876  }
2877  nType = nComboType;
2878  }
2879  else
2880  {
2881  sal_uInt32 nNumFmt;
2883  rViewData.GetTabNo(), nNumFmt );
2884  nType = pFormatter->GetType( nNumFmt );
2885  }
2886  return nType;
2887 }
2888 
2889 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3047
void ExecuteTextAttr(SfxRequest &rReq)
Definition: formatsh.cxx:1389
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
bool GetIsWaterCan() const
Definition: scmod.hxx:155
SfxViewFrame * GetViewFrame() const
virtual ~ScFormatShell() override
Definition: formatsh.cxx:147
SvxCellHorJustify
void SetBorderLineStyle(SvxBorderLineStyle nNew)
void ResetBrushDocument()
Definition: tabview5.cxx:646
static void UpdateNumberFormatter(const SvxNumberInfoItem &rInfoItem)
Definition: tabvwsh5.cxx:384
ScAddress aStart
Definition: address.hxx:499
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:353
bool AdjustBlockHeight(bool bPaint=true, ScMarkData *pMarkData=nullptr)
Definition: viewfun2.cxx:113
void SetWidth(tools::Long nWidth)
void SetSelectionFrameLines(const ::editeng::SvxBorderLine *pLine, bool bColorOnly)
Definition: viewfun2.cxx:3295
SC_DLLPUBLIC bool IsTabProtected(SCTAB nTab) const
Definition: documen3.cxx:1906
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:42
constexpr TypedWhichId< SvxLanguageItem > ATTR_LANGUAGE_FORMAT(147)
void PutItemForScriptType(SvtScriptType nScriptType, const SfxPoolItem &rItem)
#define SFX_IMPL_INTERFACE(Class, SuperClass)
SC_DLLPUBLIC bool CopyToClip(ScDocument *pClipDoc, bool bCut, bool bApi=false, bool bIncludeObjects=false, bool bStopEdit=true)
Definition: viewfun3.cxx:167
void CellStyleCreated(std::u16string_view rName, const ScDocument &rDoc)
Definition: docpool.cxx:360
constexpr TypedWhichId< SvxBoxItem > ATTR_BORDER(150)
void PostPaintGridAll()
Definition: docsh3.cxx:182
static void PutItemScript(SfxItemSet &rShellSet, const SfxItemSet &rCoreSet, sal_uInt16 nWhichId, SvtScriptType nScript)
Definition: viewutil.cxx:49
void MarkToMulti()
Definition: markdata.cxx:224
void SetPreviewSelection(const ScMarkData &rSel)
Definition: documen2.cxx:1359
void GetAttrState(SfxItemSet &rSet)
Definition: formatsh.cxx:2044
constexpr sal_uInt16 ATTR_PATTERN_START(100)
virtual const SfxItemSet * GetOutputItemSet() const =0
std::string GetValue
void SetBrushDocument(ScDocumentUniquePtr pNew, bool bLock)
Definition: tabview5.cxx:626
constexpr TypedWhichId< SfxBoolItem > ATTR_VERTICAL_ASIAN(137)
void SetColor(const Color &rCol)
virtual bool SetParent(const OUString &)
void ApplyAttr(const SfxPoolItem &rAttrItem, bool bAdjustBlockHeight=true)
Definition: viewfunc.cxx:998
void StateFormatPaintbrush(SfxItemSet &rSet)
Definition: formatsh.cxx:2824
void GetNumFormatState(SfxItemSet &rSet)
Definition: formatsh.cxx:2502
void SetMinDist(bool bNew)
void UpdateInputHandlerCellAdjust(SvxCellHorJustify eJust)
Definition: tabvwsha.cxx:741
bool IsPageStyleInUse(std::u16string_view rStrPageStyle, SCTAB *pInTab)
Definition: documen8.cxx:310
virtual void Remove(SfxStyleSheetBase *)
sal_uIntPtr sal_uLong
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
void SetTable(bool bNew)
const editeng::SvxBorderLine * GetVert() const
SCROW GetCurY() const
Definition: viewdata.hxx:401
constexpr::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
bool IsDone() const
void ModifyStyleSheet(SfxStyleSheetBase &rPageStyle, const SfxItemSet &rChanges)
Definition: documen8.cxx:209
const ScMarkData & GetPreviewSelection() const
Definition: document.hxx:1340
sal_uInt16 GetValue() const
SvNumFormatType GetType(sal_uInt32 nFIndex) const
void SetHeight(sal_uInt32 nNewHeight, const sal_uInt16 nNewProp=100, MapUnit eUnit=MapUnit::MapRelative)
void InvalidateItem(sal_uInt16 nWhich)
void SetDocumentModified()
Definition: docsh.cxx:2820
ScViewData & GetViewData()
Definition: formatsh.hxx:34
const SfxItemSet & GetItemSet() const
sal_uInt16 FirstWhich()
bool HasEditView(ScSplitPos eWhich) const
Definition: viewdata.hxx:563
SCTAB GetTabNo() const
Definition: viewdata.hxx:394
SC_DLLPUBLIC void GetNumberFormat(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt32 &rFormat) const
Definition: document.cxx:3633
NfIndexTableOffset GetIndexTableOffset(sal_uInt32 nFormat) const
constexpr TypedWhichId< SvxBoxInfoItem > ATTR_BORDER_INNER(151)
void Unmark()
Definition: tabview3.cxx:1721
ScAddress aEnd
Definition: address.hxx:500
ScSplitPos GetActivePart() const
Definition: viewdata.hxx:397
SvxFrameDirection
void Done(bool bRemove=false)
ScDocument & GetDocument() const
Definition: viewdata.hxx:379
NF_NUMBER_1000DEC2
constexpr TypedWhichId< SvxFontItem > ATTR_FONT(100)
virtual SfxUndoManager * GetUndoManager()
virtual SfxItemSet & GetItemSet()
constexpr TypedWhichId< ScLineBreakCell > ATTR_LINEBREAK(139)
void SetLine(const editeng::SvxBorderLine *pNew)
constexpr TypedWhichId< ScProtectionAttr > ATTR_PROTECTION(149)
css::uno::Reference< css::frame::XModel > GetModel() const
const SfxItemSet * GetArgs() const
void Invalidate(sal_uInt16 nId)
void SetPreviewFont(std::unique_ptr< SfxItemSet > pFontSet)
Definition: documen2.cxx:1354
const editeng::SvxBorderLine * GetRight() const
SfxStyleFamily GetFamily() const
void PutItem(const SfxPoolItem &rItem)
bool IsVerticalTextEnabled() const
SfxStyleSearchBits GetMask() const
static std::unique_ptr< SvxNumberInfoItem > MakeNumberInfoItem(ScDocument &rDoc, const ScViewData &rViewData)
Definition: tabvwsh5.cxx:314
constexpr TypedWhichId< ScMergeAttr > ATTR_MERGE(144)
css::uno::Reference< css::document::XDocumentProperties > getDocProperties() const
SC_DLLPUBLIC void InputEnterHandler(ScEnterMode nBlockMode=ScEnterMode::NORMAL)
Definition: scmod.cxx:1360
sal_uInt16 NextWhich()
void GetStyleState(SfxItemSet &rSet)
Definition: formatsh.cxx:151
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6048
WEIGHT_BOLD
virtual SfxUndoManager * GetUndoManager() override
Definition: docsh.cxx:2806
bool Next(SCROW &rTop, SCROW &rBottom)
Definition: markmulti.cxx:452
const SfxStyleSheet * GetStyleSheetFromMarked()
Definition: viewfunc.cxx:1294
bool HasMarks(SCCOL nCol) const
Definition: markmulti.cxx:67
sal_uInt16 sal_Unicode
void disposeAndReset(reference_type *pBody)
void SetSlot(sal_uInt16 nNewSlot)
void MergeRange(sal_uInt16 nFrom, sal_uInt16 nTo)
virtual void SetHidden(bool bValue)
SvxCellVerJustify
const OUString & GetName() const
void RemoveStyleSheetInUse(const SfxStyleSheetBase *pStyleSheet)
Definition: viewfunc.cxx:1410
LINESTYLE_NONE
sal_uInt16 GetOutWidth() const
void SetColor(const Color &rColor)
constexpr TypedWhichId< SvxShadowItem > ATTR_SHADOW(152)
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:313
const ScPatternAttr * GetSelectionPattern(const ScMarkData &rMark)
Definition: document.cxx:5087
bool IsMultiMarked() const
Definition: markdata.hxx:82
ScViewData & rViewData
Definition: formatsh.hxx:31
int nCount
void libreOfficeKitViewCallback(int nType, const char *pPayload) const override
OUString GetName() const
NfIndexTableOffset
bool RemovePageStyleInUse(std::u16string_view rStrPageStyle)
Definition: documen8.cxx:325
void UpdateInputHandler(bool bForce=false, bool bStopEditing=true)
Definition: tabvwsha.cxx:653
SCTAB Tab() const
Definition: address.hxx:270
void SetRow(SCROW nRowP)
Definition: address.hxx:274
void SetUndoManager(SfxUndoManager *pNewUndoMgr)
SfxStyleFamily
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
void GetFormatSpecialInfo(sal_uInt32 nFormat, bool &bThousand, bool &IsRed, sal_uInt16 &nPrecision, sal_uInt16 &nLeadingCnt)
SC_DLLPUBLIC const ScPatternAttr * GetPattern(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4727
SvtScriptType GetSelectionScriptType()
Definition: viewfunc.cxx:803
void SetColor(const Color &rCol)
void StylesToNames()
Definition: document.cxx:6109
SfxItemPool & GetPool() const
constexpr TypedWhichId< SvxUnderlineItem > ATTR_FONT_UNDERLINE(104)
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
Definition: patattr.hxx:70
ScStyleSheet * GetPreviewCellStyle()
Definition: document.hxx:1342
DocumentType eType
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:356
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_TLBR(141)
const Color & GetColor() const
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALIDDATA(153)
void GetAlignState(SfxItemSet &rSet)
Definition: formatsh.cxx:2453
void InitFromStyle(const SfxStyleSheetBase *pSource)
Definition: undostyl.cxx:59
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
const editeng::SvxBorderLine * GetHori() const
SvNumFormatType GetCurrentNumberFormatType()
Definition: formatsh.cxx:2832
const editeng::SvxBorderLine * GetTop() const
constexpr TypedWhichId< SvxPostureItem > ATTR_FONT_POSTURE(103)
const sal_uInt32 nFontInc
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:440
virtual void AddUndoAction(std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false)
SvNumFormatType GetType() const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SvtScriptType
const sal_uInt32 nFontMaxSz
::editeng::SvxBorderLine * GetDefaultFrameLine() const
Definition: tabvwsh.hxx:240
bool IsMarked() const
Definition: markdata.hxx:81
const editeng::SvxBorderLine * GetLeft() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
int i
SfxBindings & GetBindings()
Definition: viewdata.cxx:3035
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
Definition: document.hxx:2616
virtual SfxStyleSheetBase & Make(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits nMask=SfxStyleSearchBits::All)
sal_Int16 SCCOL
Definition: types.hxx:21
void SetActivePointer(PointerStyle nPointer)
Definition: tabview.cxx:894
constexpr TypedWhichId< SvxVerJustifyItem > ATTR_VER_JUSTIFY(132)
#define SC_MOD()
Definition: scmod.hxx:249
void UpdateStyleSheetInUse(const SfxStyleSheetBase *pStyleSheet)
Definition: viewfunc.cxx:1436
SfxBindings & GetBindings()
Any aHelper
void ExecuteCellFormatDlg(SfxRequest &rReq, const OString &rTabPage)
Definition: tabvwsha.cxx:502
const OUString & GetValue() const
sal_uInt16 Count() const
static SfxClassificationPolicyType stringToPolicyType(const OUString &rType)
const T * GetArg(sal_uInt16 nSlotId) const
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxInfoItemLine nLine)
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
void SetPool(SfxItemPool *pNewPool)
EEHorizontalTextDirection
WEIGHT_NORMAL
LINESTYLE_SINGLE
bool RenamePageStyleInUse(std::u16string_view rOld, const OUString &rNew)
Definition: documen8.cxx:340
float u
OUString ScResId(const char *pId)
Definition: scdll.cxx:89
ScMarkType GetSimpleArea(SCCOL &rStartCol, SCROW &rStartRow, SCTAB &rStartTab, SCCOL &rEndCol, SCROW &rEndRow, SCTAB &rEndTab) const
Definition: viewdata.cxx:1171
void SetNumFmtByStr(const OUString &rCode)
Definition: viewfunc.cxx:2645
#define LANGUAGE_DONTKNOW
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
SvNumFormatType
SC_DLLPUBLIC OUString GetPageStyle(SCTAB nTab) const
Definition: document.cxx:6173
SfxItemState QueryState(sal_uInt16 nSID, std::unique_ptr< SfxPoolItem > &rpState)
void ApplySelectionPattern(const ScPatternAttr &rAttr, bool bCursorOnly=false)
Definition: viewfunc.cxx:1108
constexpr TypedWhichId< ScVerticalStackCell > ATTR_STACKED(134)
sal_uInt16 GetSlotId(sal_uInt16 nWhich) const
void SetName(const OUString &rName)
#define SV_COUNTRY_LANGUAGE_OFFSET
void SetNumberFormat(SvNumFormatType nFormatType, sal_uLong nAdd=0)
Definition: viewfunc.cxx:2609
ITALIC_NONE
static void UnmarkFiltered(ScMarkData &rMark, const ScDocument &rDoc)
Definition: viewutil.cxx:223
static SC_DLLPUBLIC LanguageType eLnge
Definition: global.hxx:547
void UpdStlShtPtrsFrmNms()
Definition: document.cxx:6096
virtual SvxScriptSetItem * Clone(SfxItemPool *pPool=nullptr) const override
SfxItemPool * GetPool() const
SfxViewShell * GetViewShell() const
void InvalidateAttribs()
Definition: tabview3.cxx:250
void SetStyleSheet(ScStyleSheet *pNewStyle, bool bClearDirectFormat=true)
Definition: patattr.cxx:1168
void SetValue(bool const bTheValue)
SCCOL Col() const
Definition: address.hxx:266
SC_DLLPUBLIC const ScPatternAttr * GetSelectionPattern()
Definition: viewfunc.cxx:829
#define SFX_OBJECTBAR_OBJECT
size_t LeaveListAction()
ScDBFunc * GetView() const
Definition: viewdata.cxx:853
constexpr TypedWhichId< SvxBrushItem > ATTR_BACKGROUND(148)
void SetReturnValue(const SfxPoolItem &)
void InvalidateTextWidth(std::u16string_view rStyleName)
Definition: documen8.cxx:295
weld::Window * GetFrameWeld() const
void Update(sal_uInt16 nId)
bool HasPaintBrush() const
Definition: tabview.hxx:585
ScFormatShell(ScViewData &rData)
Definition: formatsh.cxx:131
void GetTextDirectionState(SfxItemSet &rSet)
Definition: formatsh.cxx:2726
OUString GenerateFormat(sal_uInt32 nIndex, LanguageType eLnge=LANGUAGE_DONTKNOW, bool bThousand=false, bool IsRed=false, sal_uInt16 nPrecision=0, sal_uInt16 nLeadingCnt=1)
constexpr TypedWhichId< SvxFrameDirectionItem > ATTR_WRITINGDIR(138)
SC_DLLPUBLIC void SetPageStyle(SCTAB nTab, const OUString &rName)
Definition: document.cxx:6167
constexpr TypedWhichId< ScMergeFlagAttr > ATTR_MERGE_FLAG(145)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_Int32 SCROW
Definition: types.hxx:17
sal_uInt16 GetSlot() const
FontWeight
virtual VclPtr< SfxAbstractTabDialog > CreateScStyleDlg(weld::Window *pParent, SfxStyleSheetBase &rStyleBase, bool bPage)=0
void GetBorderState(SfxItemSet &rSet)
Definition: formatsh.cxx:2439
sal_uInt32 GetHeight() const
void SetStreamValid(SCTAB nTab, bool bSet, bool bIgnoreLock=false)
Definition: document.cxx:924
SfxItemState
void DisableItem(sal_uInt16 nWhich)
weld::Window * GetFrameWeld() const
sal_uInt16 GetFormatIntegerDigits(sal_uInt16 nIx=0) const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
ITALIC_NORMAL
const SvNumberformat * GetEntry(sal_uInt32 nKey) const
#define GetWhich(nSlot)
OUString aUIName
LINESTYLE_DOTTED
virtual void Invalidate(sal_uInt16 nId=0)
void ChangeNumFmtDecimals(bool bIncrement)
Definition: viewfunc.cxx:2693
void SetWhich(sal_uInt16 nId)
static SC_DLLPUBLIC ScAbstractDialogFactory * Create()
Definition: scabstdlg.cxx:37
SfxDispatcher & GetDispatcher()
Definition: viewdata.cxx:3041
RET_OK
bool IsCTLFontEnabled() const
SC_DLLPUBLIC void ApplySelectionPattern(const ScPatternAttr &rAttr, const ScMarkData &rMark, ScEditDataArray *pDataArray=nullptr, bool *pIsChanged=nullptr)
Definition: document.cxx:5861
static bool CheckWidthInvalidate(bool &bNumFormatChanged, const SfxItemSet &rNewAttrs, const SfxItemSet &rOldAttrs)
Definition: global.cxx:178
constexpr TypedWhichId< SvxWeightItem > ATTR_FONT_WEIGHT(102)
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
constexpr TypedWhichId< SvxHorJustifyItem > ATTR_HOR_JUSTIFY(129)
void SetStyleSheetToMarked(const SfxStyleSheet *pStyleSheet)
Definition: viewfunc.cxx:1314
virtual void EnterListAction(const OUString &rComment, const OUString &rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId)
SvNumFormatType GetMaskedType() const
constexpr TypedWhichId< ScCondFormatItem > ATTR_CONDITIONAL(154)
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:400
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
constexpr sal_uInt16 ATTR_PATTERN_END(155)
const ScDocument & GetDocument() const
Definition: docsh.hxx:216
void SetWaterCan(bool bNew)
Definition: scmod.hxx:154
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
Definition: document.cxx:6053
void SetPreviewCellStyle(ScStyleSheet *pStyle)
Definition: document.hxx:1344
void HideListBox()
Definition: tabview3.cxx:2962
void UpdateSelectionArea(const ScMarkData &rSel, ScPatternAttr *pAttr=nullptr)
Definition: viewfunc.cxx:2990
void ExecuteAlignment(SfxRequest &rReq)
Definition: formatsh.cxx:1296
virtual SfxInterface * GetInterface() const
void ApplyUserItemSet(const SfxItemSet &rItemSet)
Definition: viewfunc.cxx:1275
void ExecuteTextDirection(const SfxRequest &rReq)
Definition: formatsh.cxx:2686
void AppendItem(const SfxPoolItem &)
#define SAL_WARN(area, stream)
SfxObjectShell * GetSfxDocShell() const
Definition: viewdata.hxx:357
const ScMultiSel & GetMultiSelData() const
Definition: markdata.hxx:106
bool IsUndoEnabled() const
Definition: document.hxx:1533
Reference< XModel > xModel
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
void ApplyAttributes(const SfxItemSet *pDialogSet, const SfxItemSet *pOldSet, bool bAdjustBlockHeight=true)
Definition: viewfunc.cxx:886
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLBACKGROUND)
void GetMultiMarkArea(ScRange &rRange) const
Definition: markdata.cxx:117
bool IsAPI() const
virtual SfxPrinter * GetPrinter(bool bCreate=false) override
Definition: tabvwsh4.cxx:1043
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
LINESTYLE_DOUBLE
virtual bool HasParentSupport() const
void GetTextAttrState(SfxItemSet &rSet)
Definition: formatsh.cxx:2264
void ExecuteAttr(SfxRequest &rReq)
Definition: formatsh.cxx:1654
void ExecuteNumFormat(SfxRequest &rReq)
Definition: formatsh.cxx:976
void SetDefaultFrameLine(const ::editeng::SvxBorderLine *pLine)
Definition: tabvwsh8.cxx:25
FontLineStyle
void ExecFormatPaintbrush(const SfxRequest &rReq)
Definition: formatsh.cxx:2798
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
constexpr TypedWhichId< SvxColorItem > ATTR_FONT_COLOR(109)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_FONT_HEIGHT(101)
void ExecuteStyle(SfxRequest &rReq)
Definition: formatsh.cxx:248
const editeng::SvxBorderLine * GetBottom() const
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_BLTR(142)
const SfxPoolItem * GetItemOfScript(SvtScriptType nScript) const
void GetSelectionFrame(std::shared_ptr< SvxBoxItem > &rLineOuter, std::shared_ptr< SvxBoxInfoItem > &rLineInner)
Definition: viewfunc.cxx:855
sal_uInt16 Which() const
static bool IsWhich(sal_uInt16 nId)
LanguageType GetLanguage() const
const Color & GetValue() const
sal_Int16 SCTAB
Definition: types.hxx:22
FontItalic
void SetDist(bool bNew)
void SetValue(const Color &rNewColor)
SCCOL GetCurX() const
Definition: viewdata.hxx:400
ViewShellId GetViewShellId() const override
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo
void SetInFormatDialog(bool bFlag)
Definition: tabvwsh.hxx:345