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