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