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>
26
27#include <sfx2/viewfrm.hxx>
28#include <sfx2/bindings.hxx>
29#include <sfx2/objface.hxx>
30#include <sfx2/request.hxx>
31#include <sfx2/sfxdlg.hxx>
32#include <svl/whiter.hxx>
33
34#include <svl/stritem.hxx>
35#include <svl/numformat.hxx>
36#include <svl/zformat.hxx>
38#include <svl/cjkoptions.hxx>
39#include <svl/ctloptions.hxx>
40#include <editeng/boxitem.hxx>
41#include <editeng/langitem.hxx>
42#include <svx/numinf.hxx>
43#include <editeng/svxenum.hxx>
44#include <editeng/wghtitem.hxx>
45#include <editeng/postitem.hxx>
46#include <editeng/udlnitem.hxx>
47#include <editeng/lineitem.hxx>
48#include <editeng/colritem.hxx>
49#include <editeng/brushitem.hxx>
52#include <editeng/shaditem.hxx>
54#include <editeng/fhgtitem.hxx>
55#include <sal/log.hxx>
56#include <comphelper/lok.hxx>
57#include <LibreOfficeKit/LibreOfficeKitEnums.h>
58
59#include <formatsh.hxx>
60#include <sc.hrc>
61#include <globstr.hrc>
62#include <scresid.hxx>
63#include <docsh.hxx>
64#include <patattr.hxx>
65#include <scmod.hxx>
66#include <stlpool.hxx>
67#include <stlsheet.hxx>
68#include <printfun.hxx>
69#include <docpool.hxx>
70#include <tabvwsh.hxx>
71#include <attrib.hxx>
72
73#define ShellClass_ScFormatShell
74#define ShellClass_TableFont
75#define ShellClass_FormatForSelection
76#include <scslots.hxx>
77
78#include <editeng/fontitem.hxx>
80
81#include <memory>
82
83using namespace ::com::sun::star;
84
85namespace {
86
87SvxCellHorJustify lclConvertSlotToHAlign( sal_uInt16 nSlot )
88{
89 SvxCellHorJustify eHJustify = SvxCellHorJustify::Standard;
90 switch( nSlot )
91 {
92 case SID_ALIGN_ANY_HDEFAULT: eHJustify = SvxCellHorJustify::Standard; break;
93 case SID_ALIGN_ANY_LEFT: eHJustify = SvxCellHorJustify::Left; break;
94 case SID_ALIGN_ANY_HCENTER: eHJustify = SvxCellHorJustify::Center; break;
95 case SID_ALIGN_ANY_RIGHT: eHJustify = SvxCellHorJustify::Right; break;
96 case SID_ALIGN_ANY_JUSTIFIED: eHJustify = SvxCellHorJustify::Block; break;
97 default: OSL_FAIL( "lclConvertSlotToHAlign - invalid slot" );
98 }
99 return eHJustify;
100}
101
102SvxCellVerJustify lclConvertSlotToVAlign( sal_uInt16 nSlot )
103{
104 SvxCellVerJustify eVJustify = SvxCellVerJustify::Standard;
105 switch( nSlot )
106 {
107 case SID_ALIGN_ANY_VDEFAULT: eVJustify = SvxCellVerJustify::Standard; break;
108 case SID_ALIGN_ANY_TOP: eVJustify = SvxCellVerJustify::Top; break;
109 case SID_ALIGN_ANY_VCENTER: eVJustify = SvxCellVerJustify::Center; break;
110 case SID_ALIGN_ANY_BOTTOM: eVJustify = SvxCellVerJustify::Bottom; break;
111 default: OSL_FAIL( "lclConvertSlotToVAlign - invalid slot" );
112 }
113 return eVJustify;
114}
115
116} // namespace
117
118
120
121void ScFormatShell::InitInterface_Impl()
122{
123 GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT,
124 SfxVisibilityFlags::Standard | SfxVisibilityFlags::Server,
125 ToolbarId::Objectbar_Format);
126}
127
129 SfxShell(rData.GetViewShell()),
130 rViewData(rData)
131{
132 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
133
134 SetPool( &pTabViewShell->GetPool() );
136 SetUndoManager( pMgr );
138 {
139 pMgr->SetMaxUndoActionCount( 0 );
140 }
141 SetName("Format");
142}
143
145{
146}
147
149{
150 const SfxItemSet* pArgs = rReq.GetArgs();
151 const sal_uInt16 nSlotId = rReq.GetSlot();
152
153 ScDocShell* pDocSh = GetViewData().GetDocShell();
154 ScTabViewShell* pTabViewShell= GetViewData().GetViewShell();
155 ScDocument& rDoc = pDocSh->GetDocument();
156 SfxStyleSheetBasePool* pStylePool = rDoc.GetStyleSheetPool();
157
158 if ( (nSlotId == SID_STYLE_PREVIEW)
159 || (nSlotId == SID_STYLE_END_PREVIEW) )
160 {
161 if (nSlotId == SID_STYLE_PREVIEW)
162 {
163 SfxStyleFamily eFamily = SfxStyleFamily::Para;
164 const SfxUInt16Item* pFamItem;
165 if ( pArgs && (pFamItem = pArgs->GetItemIfSet( SID_STYLE_FAMILY )) )
166 eFamily = static_cast<SfxStyleFamily>(pFamItem->GetValue());
167 const SfxPoolItem* pNameItem;
168 OUString aStyleName;
169 if (pArgs && SfxItemState::SET == pArgs->GetItemState( nSlotId, true, &pNameItem ))
170 aStyleName = static_cast<const SfxStringItem*>(pNameItem)->GetValue();
171 if ( eFamily == SfxStyleFamily::Para ) // CellStyles
172 {
173 ScMarkData aFuncMark( rViewData.GetMarkData() );
174 ScViewUtil::UnmarkFiltered( aFuncMark, rDoc );
175 aFuncMark.MarkToMulti();
176
177 if ( !aFuncMark.IsMarked() && !aFuncMark.IsMultiMarked() )
178 {
179 SCCOL nCol = rViewData.GetCurX();
180 SCROW nRow = rViewData.GetCurY();
181 SCTAB nTab = rViewData.GetTabNo();
182 ScRange aRange( nCol, nRow, nTab );
183 aFuncMark.SetMarkArea( aRange );
184 }
185 rDoc.SetPreviewSelection( aFuncMark );
186 ScStyleSheet* pPreviewStyle = static_cast<ScStyleSheet*>( pStylePool->Find( aStyleName, eFamily ) );
187 rDoc.SetPreviewCellStyle( pPreviewStyle );
188 ScPatternAttr aAttr( *rDoc.GetSelectionPattern( aFuncMark ) );
189 aAttr.SetStyleSheet( pPreviewStyle );
190
191 SfxItemSet aItemSet( GetPool() );
192
193 ScPatternAttr aNewAttrs( GetViewData().GetDocument().GetPool() );
194 SfxItemSet& rNewSet = aNewAttrs.GetItemSet();
195 rNewSet.Put( aItemSet, false );
196
197 rDoc.ApplySelectionPattern( aNewAttrs, rDoc.GetPreviewSelection() );
198 pTabViewShell->UpdateSelectionArea( aFuncMark, &aAttr );
199 }
200 }
201 else
202 {
203 // No mark at all happens when creating a new document, in which
204 // case the selection pattern obtained would be empty (created of
205 // GetPool()) anyway and nothing needs to be applied.
206 ScMarkData aPreviewMark( rDoc.GetPreviewSelection());
207 if (aPreviewMark.IsMarked() || aPreviewMark.IsMultiMarked())
208 {
209 ScPatternAttr aAttr( *rDoc.GetSelectionPattern( aPreviewMark ) );
210 if ( ScStyleSheet* pPreviewStyle = rDoc.GetPreviewCellStyle() )
211 aAttr.SetStyleSheet( pPreviewStyle );
212 rDoc.SetPreviewCellStyle(nullptr);
213
214 SfxItemSet aItemSet( GetPool() );
215
216 ScPatternAttr aNewAttrs( GetViewData().GetDocument().GetPool() );
217 SfxItemSet& rNewSet = aNewAttrs.GetItemSet();
218 rNewSet.Put( aItemSet, false );
219 rDoc.ApplySelectionPattern( aNewAttrs, aPreviewMark );
220 pTabViewShell->UpdateSelectionArea( aPreviewMark, &aAttr );
221 }
222 }
223 }
224 else if (nSlotId == SID_CLASSIFICATION_APPLY)
225 {
226 const SfxPoolItem* pItem = nullptr;
227 if (pArgs && pArgs->GetItemState(nSlotId, false, &pItem) == SfxItemState::SET)
228 {
229 const OUString& rName = static_cast<const SfxStringItem*>(pItem)->GetValue();
231 auto eType = SfxClassificationPolicyType::IntellectualProperty;
232 if (const SfxStringItem* pNameItem = pArgs->GetItemIfSet(SID_TYPE_NAME, false))
233 {
234 const OUString& rType = pNameItem->GetValue();
236 }
237 aHelper.SetBACName(rName, eType);
238 }
239 else
240 SAL_WARN("sc.ui", "missing parameter for SID_CLASSIFICATION_APPLY");
241 }
242 else
243 {
244 OSL_FAIL( "Unknown slot (ScViewShell::ExecuteStyle)" );
245 }
246}
247
249{
250 ScModule* pScMod = SC_MOD();
251 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
252 const SfxItemSet* pReqArgs = rReq.GetArgs();
253 sal_uInt16 nSlot = rReq.GetSlot();
254 SfxBindings& rBindings = pTabViewShell->GetViewFrame().GetBindings();
255
256 pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox
257
258 // End input
259 if ( GetViewData().HasEditView( GetViewData().GetActivePart() ) )
260 {
261 switch ( nSlot )
262 {
263 case SID_NUMBER_TYPE_FORMAT:
264 case SID_NUMBER_TWODEC:
265 case SID_NUMBER_SCIENTIFIC:
266 case SID_NUMBER_DATE:
267 case SID_NUMBER_CURRENCY:
268 case SID_NUMBER_PERCENT:
269 case SID_NUMBER_STANDARD:
270 case SID_NUMBER_FORMAT:
271 case SID_NUMBER_INCDEC:
272 case SID_NUMBER_DECDEC:
273 case SID_NUMBER_THOUSANDS:
274 case FID_DEFINE_NAME:
275 case FID_ADD_NAME:
276 case FID_USE_NAME:
277 case FID_INSERT_NAME:
278 case SID_SPELL_DIALOG:
279 case SID_HANGUL_HANJA_CONVERSION:
280
281 pScMod->InputEnterHandler();
282 pTabViewShell->UpdateInputHandler();
283 break;
284
285 default:
286 break;
287 }
288 }
289
291 switch ( nSlot )
292 {
293 case SID_NUMBER_TWODEC:
294 {
295 const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
296 sal_uInt32 nNumberFormat = rAttrSet.Get(ATTR_VALUE_FORMAT).GetValue();
297
298 if ((nType & SvNumFormatType::NUMBER) && nNumberFormat == 4)
299 pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
300 else
301 pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER, 4 );
302 rBindings.Invalidate( nSlot );
303 rReq.Done();
304 }
305 break;
306 case SID_NUMBER_SCIENTIFIC:
307 if (nType & SvNumFormatType::SCIENTIFIC)
308 pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
309 else
310 pTabViewShell->SetNumberFormat( SvNumFormatType::SCIENTIFIC );
311 rBindings.Invalidate( nSlot );
312 rReq.Done();
313 break;
314 case SID_NUMBER_DATE:
315 if (nType & SvNumFormatType::DATE)
316 pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
317 else
318 pTabViewShell->SetNumberFormat( SvNumFormatType::DATE );
319 rBindings.Invalidate( nSlot );
320 rReq.Done();
321 break;
322 case SID_NUMBER_TIME:
323 if (nType & SvNumFormatType::TIME)
324 pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
325 else
326 pTabViewShell->SetNumberFormat( SvNumFormatType::TIME );
327 rBindings.Invalidate( nSlot );
328 rReq.Done();
329 break;
330 case SID_NUMBER_CURRENCY:
331 if(pReqArgs)
332 {
333 const SfxPoolItem* pItem;
334 if ( pReqArgs->HasItem( SID_NUMBER_CURRENCY, &pItem ) )
335 {
336 sal_uInt32 nNewFormat = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
338 SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
339 const SfxItemSet& rOldSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
340
341 LanguageType eOldLang = rOldSet.Get( ATTR_LANGUAGE_FORMAT ).GetLanguage();
342 sal_uInt32 nOldFormat = rOldSet.Get( ATTR_VALUE_FORMAT ).GetValue();
343
344 if ( nOldFormat != nNewFormat )
345 {
346 const SvNumberformat* pNewEntry = pFormatter->GetEntry( nNewFormat );
347 ScPatternAttr aNewAttrs( rDoc.GetPool() );
348 SfxItemSet& rSet = aNewAttrs.GetItemSet();
349 LanguageType eNewLang = pNewEntry ? pNewEntry->GetLanguage() : LANGUAGE_DONTKNOW;
350 if ( eNewLang != eOldLang && eNewLang != LANGUAGE_DONTKNOW )
352 rSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
353 pTabViewShell->ApplySelectionPattern( aNewAttrs );
354 }
355 else
356 pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
357 }
358 }
359 else
360 {
361 if ( nType & SvNumFormatType::CURRENCY )
362 pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
363 else
364 pTabViewShell->SetNumberFormat( SvNumFormatType::CURRENCY );
365 }
366 rBindings.Invalidate( nSlot );
367 rReq.Done();
368 break;
369 case SID_NUMBER_PERCENT:
370 if (nType & SvNumFormatType::PERCENT)
371 pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
372 else
373 pTabViewShell->SetNumberFormat( SvNumFormatType::PERCENT );
374 rBindings.Invalidate( nSlot );
375 rReq.Done();
376 break;
377 case SID_NUMBER_STANDARD:
378 pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
379 rReq.Done();
380 break;
381 case SID_NUMBER_INCDEC:
382 pTabViewShell->ChangeNumFmtDecimals( true );
383 rReq.Done();
384 break;
385 case SID_NUMBER_DECDEC:
386 pTabViewShell->ChangeNumFmtDecimals( false );
387 rReq.Done();
388 break;
389 case SID_NUMBER_THOUSANDS:
390 {
392 SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
393 bool bThousand(false);
394 bool bNegRed(false);
395 sal_uInt16 nPrecision(0);
396 sal_uInt16 nLeadZeroes(0);
397 LanguageType eLanguage = ScGlobal::eLnge;
398
399 sal_uInt32 nCurrentNumberFormat = rDoc.GetNumberFormat(
401 const SvNumberformat* pEntry = pFormatter->GetEntry(nCurrentNumberFormat);
402
403 if (pEntry)
404 eLanguage = pEntry->GetLanguage();
405
406 pFormatter->GetFormatSpecialInfo(nCurrentNumberFormat, bThousand, bNegRed, nPrecision, nLeadZeroes);
407 bThousand = !bThousand;
408 OUString aCode = pFormatter->GenerateFormat(
409 nCurrentNumberFormat,
410 eLanguage,
411 bThousand,
412 bNegRed,
413 nPrecision,
414 nLeadZeroes);
415 pTabViewShell->SetNumFmtByStr(aCode);
416
417 rBindings.Invalidate(nSlot);
418 rReq.Done();
419 }
420 break;
421 case SID_NUMBER_FORMAT:
422 // symphony version with format interpretation
423 if(pReqArgs)
424 {
425 const SfxPoolItem* pItem;
427 SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
428
429 sal_uInt32 nCurrentNumberFormat = rDoc.GetNumberFormat(
431 const SvNumberformat* pEntry = pFormatter->GetEntry(nCurrentNumberFormat);
432
433 if(!pEntry)
434 break;
435
436 LanguageType eLanguage = pEntry->GetLanguage();
438
439 //Just use eType to judge whether the command is fired for NUMBER/PERCENT/CURRENCY/SCIENTIFIC/FRACTION/TIME
440 //In sidebar, users can fire SID_NUMBER_FORMAT command by operating the related UI controls before they are disable
441 if(!(eType == SvNumFormatType::ALL
442 || eType == SvNumFormatType::NUMBER
443 || eType == SvNumFormatType::PERCENT
444 || eType == SvNumFormatType::CURRENCY
445 || eType == SvNumFormatType::SCIENTIFIC
446 || eType == SvNumFormatType::TIME
447 || eType == SvNumFormatType::FRACTION))
448 pEntry = nullptr;
449
450 if(SfxItemState::SET == pReqArgs->GetItemState(nSlot, true, &pItem) && pEntry)
451 {
452 OUString aCode = static_cast<const SfxStringItem*>(pItem)->GetValue();
453 sal_uInt16 aLen = aCode.getLength();
454 std::unique_ptr<OUString[]> sFormat( new OUString[4] );
455 OUStringBuffer sTmpStr;
456 sal_uInt16 nCount(0);
457 sal_uInt16 nStrCount(0);
458
459 while(nCount < aLen)
460 {
461 sal_Unicode cChar = aCode[nCount];
462
463 if(cChar == ',')
464 {
465 sFormat[nStrCount] = sTmpStr.makeStringAndClear();
466 nStrCount++;
467 }
468 else
469 {
470 sTmpStr.append(cChar);
471 }
472
473 nCount++;
474
475 if(nStrCount > 3)
476 break;
477 }
478
479 const bool bThousand = static_cast<bool>(sFormat[0].toInt32());
480 const bool bNegRed = static_cast<bool>(sFormat[1].toInt32());
481 const sal_uInt16 nPrecision = static_cast<sal_uInt16>(sFormat[2].toInt32());
482 const sal_uInt16 nLeadZeroes = static_cast<sal_uInt16>(sFormat[3].toInt32());
483
484 aCode = pFormatter->GenerateFormat(
485 nCurrentNumberFormat,//modify
486 eLanguage,
487 bThousand,
488 bNegRed,
489 nPrecision,
490 nLeadZeroes);
491 pTabViewShell->SetNumFmtByStr(aCode);
492 }
493 }
494 break;
495
496 case SID_ATTR_NUMBERFORMAT_VALUE:
497 if ( pReqArgs )
498 {
499 if ( const SfxUInt32Item* pItem = pReqArgs->GetItemIfSet( ATTR_VALUE_FORMAT ) )
500 {
501 // We have to accomplish this using ApplyAttributes()
502 // because we also need the language information to be
503 // considered.
504 const SfxItemSet& rOldSet =
505 pTabViewShell->GetSelectionPattern()->GetItemSet();
506 SfxItemPool* pDocPool = GetViewData().GetDocument().GetPool();
508 aNewSet.Put( *pItem );
509 pTabViewShell->ApplyAttributes( &aNewSet, &rOldSet );
510 }
511 }
512 break;
513
514 case SID_NUMBER_TYPE_FORMAT:
515 if ( pReqArgs )
516 {
517 const SfxPoolItem* pItem;
518 if ( pReqArgs->GetItemState( nSlot, true, &pItem ) == SfxItemState::SET )
519 {
520 sal_uInt16 nFormat = static_cast<const SfxInt16Item *>(pItem)->GetValue();
521 switch(nFormat)
522 {
523 case 0:
524 pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER); //Modify
525 break;
526 case 1:
527 pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER, 2 ); //Modify
528 break;
529 case 2:
530 pTabViewShell->SetNumberFormat( SvNumFormatType::PERCENT );
531 break;
532 case 3:
533 pTabViewShell->SetNumberFormat( SvNumFormatType::CURRENCY );
534 break;
535 case 4:
536 pTabViewShell->SetNumberFormat( SvNumFormatType::DATE );
537 break;
538 case 5:
539 pTabViewShell->SetNumberFormat( SvNumFormatType::TIME );
540 break;
541 case 6:
542 pTabViewShell->SetNumberFormat( SvNumFormatType::SCIENTIFIC );
543 break;
544 case 7:
545 pTabViewShell->SetNumberFormat( SvNumFormatType::FRACTION );
546 break;
547 case 8:
548 pTabViewShell->SetNumberFormat( SvNumFormatType::LOGICAL );
549 break;
550 case 9:
551 pTabViewShell->SetNumberFormat( SvNumFormatType::TEXT );
552 break;
553 default:
554 ;
555 }
556 rReq.Done();
557 }
558 }
559 break;
560
561 default:
562 OSL_FAIL("ExecuteEdit: invalid slot");
563 break;
564 }
565}
566
568{
569 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
570 SfxBindings& rBindings = rViewData.GetBindings();
571 const SfxItemSet* pSet = rReq.GetArgs();
572 sal_uInt16 nSlot = rReq.GetSlot();
573
574 pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox
575
576 switch( nSlot )
577 {
578 // pseudo slots for Format menu
579 case SID_ALIGN_ANY_HDEFAULT:
580 case SID_ALIGN_ANY_LEFT:
581 case SID_ALIGN_ANY_HCENTER:
582 case SID_ALIGN_ANY_RIGHT:
583 case SID_ALIGN_ANY_JUSTIFIED:
584 pTabViewShell->ApplyAttr( SvxHorJustifyItem( lclConvertSlotToHAlign( nSlot ), ATTR_HOR_JUSTIFY ) );
585 break;
586 case SID_ALIGN_ANY_VDEFAULT:
587 case SID_ALIGN_ANY_TOP:
588 case SID_ALIGN_ANY_VCENTER:
589 case SID_ALIGN_ANY_BOTTOM:
590 pTabViewShell->ApplyAttr( SvxVerJustifyItem( lclConvertSlotToVAlign( nSlot ), ATTR_VER_JUSTIFY ) );
591 break;
592
593 default:
594 if( pSet )
595 {
596 const SfxPoolItem* pItem = nullptr;
597 if( pSet->GetItemState(GetPool().GetWhich(nSlot), true, &pItem ) == SfxItemState::SET )
598 {
599
600 switch ( nSlot )
601 {
602 case SID_ATTR_ALIGN_HOR_JUSTIFY:
603 case SID_ATTR_ALIGN_VER_JUSTIFY:
604 case SID_ATTR_ALIGN_INDENT:
605 case SID_ATTR_ALIGN_HYPHENATION:
606 case SID_ATTR_ALIGN_DEGREES:
607 case SID_ATTR_ALIGN_LOCKPOS:
608 case SID_ATTR_ALIGN_MARGIN:
609 case SID_ATTR_ALIGN_STACKED:
610 pTabViewShell->ApplyAttr( *pItem );
611 break;
612
613 case SID_H_ALIGNCELL:
614 {
615 SvxCellHorJustify eJust = static_cast<const SvxHorJustifyItem*>(pItem)->GetValue();
616 // #i78476# update alignment of text in cell edit mode
617 pTabViewShell->UpdateInputHandlerCellAdjust( eJust );
618 pTabViewShell->ApplyAttr( SvxHorJustifyItem( eJust, ATTR_HOR_JUSTIFY ) );
619 }
620 break;
621 case SID_V_ALIGNCELL:
622 pTabViewShell->ApplyAttr( SvxVerJustifyItem( static_cast<const SvxVerJustifyItem*>(pItem)->GetValue(), ATTR_VER_JUSTIFY ) );
623 break;
624 default:
625 OSL_FAIL( "ExecuteAlignment: invalid slot" );
626 return;
627 }
628 }
629 }
630 }
631 rBindings.Invalidate( SID_ATTR_PARA_ADJUST_LEFT );
632 rBindings.Invalidate( SID_ATTR_PARA_ADJUST_RIGHT );
633 rBindings.Invalidate( SID_ATTR_PARA_ADJUST_BLOCK );
634 rBindings.Invalidate( SID_ATTR_PARA_ADJUST_CENTER);
635 rBindings.Invalidate( SID_ALIGNLEFT );
636 rBindings.Invalidate( SID_ALIGNRIGHT );
637 rBindings.Invalidate( SID_ALIGNCENTERHOR );
638 rBindings.Invalidate( SID_ALIGNBLOCK );
639 rBindings.Invalidate( SID_ALIGNTOP );
640 rBindings.Invalidate( SID_ALIGNBOTTOM );
641 rBindings.Invalidate( SID_ALIGNCENTERVER );
642 rBindings.Invalidate( SID_V_ALIGNCELL );
643 rBindings.Invalidate( SID_H_ALIGNCELL );
644 // pseudo slots for Format menu
645 rBindings.Invalidate( SID_ALIGN_ANY_HDEFAULT );
646 rBindings.Invalidate( SID_ALIGN_ANY_LEFT );
647 rBindings.Invalidate( SID_ALIGN_ANY_HCENTER );
648 rBindings.Invalidate( SID_ALIGN_ANY_RIGHT );
649 rBindings.Invalidate( SID_ALIGN_ANY_JUSTIFIED );
650 rBindings.Invalidate( SID_ALIGN_ANY_VDEFAULT );
651 rBindings.Invalidate( SID_ALIGN_ANY_TOP );
652 rBindings.Invalidate( SID_ALIGN_ANY_VCENTER );
653 rBindings.Invalidate( SID_ALIGN_ANY_BOTTOM );
654 rBindings.Update();
655
656 if( ! rReq.IsAPI() )
657 rReq.Done();
658}
659
661{
662 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
663 SfxBindings& rBindings = rViewData.GetBindings();
664 const ScPatternAttr* pAttrs = pTabViewShell->GetSelectionPattern();
665 const SfxItemSet* pSet = rReq.GetArgs();
666 sal_uInt16 nSlot = rReq.GetSlot();
667 std::optional<SfxAllItemSet> pNewSet;
668
669 pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox
670
671 if ( (nSlot == SID_ATTR_CHAR_WEIGHT)
672 ||(nSlot == SID_ATTR_CHAR_POSTURE)
673 ||(nSlot == SID_ATTR_CHAR_UNDERLINE)
674 ||(nSlot == SID_ULINE_VAL_NONE)
675 ||(nSlot == SID_ULINE_VAL_SINGLE)
676 ||(nSlot == SID_ULINE_VAL_DOUBLE)
677 ||(nSlot == SID_ULINE_VAL_DOTTED) )
678 {
679 pNewSet.emplace( GetPool() );
680
681 switch ( nSlot )
682 {
683 case SID_ATTR_CHAR_WEIGHT:
684 {
685 // #i78017 establish the same behaviour as in Writer
686 SvtScriptType nScript = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
687
688 SfxItemPool& rPool = GetPool();
689 SvxScriptSetItem aSetItem( nSlot, rPool );
690 if ( pSet )
691 aSetItem.PutItemForScriptType( nScript, pSet->Get( ATTR_FONT_WEIGHT ) );
692 else
693 {
694 // toggle manually
695
696 FontWeight eWeight = WEIGHT_BOLD;
697 SvxScriptSetItem aOldSetItem( nSlot, rPool );
698 aOldSetItem.GetItemSet().Put( pAttrs->GetItemSet(), false );
699 const SfxPoolItem* pCore = aOldSetItem.GetItemOfScript( nScript );
700 if ( pCore && static_cast<const SvxWeightItem*>(pCore)->GetWeight() == WEIGHT_BOLD )
701 eWeight = WEIGHT_NORMAL;
702
703 aSetItem.PutItemForScriptType( nScript, SvxWeightItem( eWeight, ATTR_FONT_WEIGHT ) );
704 }
705 pTabViewShell->ApplyUserItemSet( aSetItem.GetItemSet() );
706 pNewSet->Put( aSetItem.GetItemSet(), false );
707 }
708 break;
709
710 case SID_ATTR_CHAR_POSTURE:
711 {
712 // #i78017 establish the same behaviour as in Writer
713 SvtScriptType nScript = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
714
715 SfxItemPool& rPool = GetPool();
716 SvxScriptSetItem aSetItem( nSlot, rPool );
717 if ( pSet )
718 aSetItem.PutItemForScriptType( nScript, pSet->Get( ATTR_FONT_POSTURE ) );
719 else
720 {
721 // toggle manually
722
723 FontItalic eItalic = ITALIC_NORMAL;
724 SvxScriptSetItem aOldSetItem( nSlot, rPool );
725 aOldSetItem.GetItemSet().Put( pAttrs->GetItemSet(), false );
726 const SfxPoolItem* pCore = aOldSetItem.GetItemOfScript( nScript );
727 if ( pCore && static_cast<const SvxPostureItem*>(pCore)->GetPosture() == ITALIC_NORMAL )
728 eItalic = ITALIC_NONE;
729
730 aSetItem.PutItemForScriptType( nScript, SvxPostureItem( eItalic, ATTR_FONT_POSTURE ) );
731 }
732 pTabViewShell->ApplyUserItemSet( aSetItem.GetItemSet() );
733 pNewSet->Put( aSetItem.GetItemSet(), false );
734 }
735 break;
736
737 case SID_ATTR_CHAR_UNDERLINE:
738 {
739 if( pSet )
740 {
741 const SfxPoolItem& rUnderline = pSet->Get( ATTR_FONT_UNDERLINE );
742
743 if( dynamic_cast<const SvxUnderlineItem*>( &rUnderline) != nullptr )
744 {
745 pTabViewShell->ApplyAttr( rUnderline );
746 pNewSet->Put( rUnderline,rUnderline.Which() );
747 }
748 else if ( auto pTextLineItem = dynamic_cast<const SvxTextLineItem*>( &rUnderline) )
749 {
750 // #i106580# also allow SvxTextLineItem (base class of SvxUnderlineItem)
751 SvxUnderlineItem aNewItem( pTextLineItem->GetLineStyle(), pTextLineItem->Which() );
752 aNewItem.SetColor( pTextLineItem->GetColor() );
753 pTabViewShell->ApplyAttr( aNewItem );
754 pNewSet->Put( aNewItem, aNewItem.Which() );
755 }
756 }
757 else
758 {
759 SvxUnderlineItem aUnderline( pAttrs->GetItem( ATTR_FONT_UNDERLINE ) );
760 FontLineStyle eUnderline = (LINESTYLE_NONE != aUnderline.GetLineStyle())
763 aUnderline.SetLineStyle( eUnderline );
764 pTabViewShell->ApplyAttr( aUnderline );
765 pNewSet->Put( aUnderline,aUnderline.Which() );
766 }
767 }
768 break;
769
770 case SID_ULINE_VAL_NONE:
772 break;
773 case SID_ULINE_VAL_SINGLE: // Toggles
774 case SID_ULINE_VAL_DOUBLE:
775 case SID_ULINE_VAL_DOTTED:
776 {
777 FontLineStyle eOld = pAttrs->GetItem(ATTR_FONT_UNDERLINE).GetLineStyle();
778 FontLineStyle eNew = eOld;
779 switch (nSlot)
780 {
781 case SID_ULINE_VAL_SINGLE:
782 eNew = ( eOld == LINESTYLE_SINGLE ) ? LINESTYLE_NONE : LINESTYLE_SINGLE;
783 break;
784 case SID_ULINE_VAL_DOUBLE:
785 eNew = ( eOld == LINESTYLE_DOUBLE ) ? LINESTYLE_NONE : LINESTYLE_DOUBLE;
786 break;
787 case SID_ULINE_VAL_DOTTED:
788 eNew = ( eOld == LINESTYLE_DOTTED ) ? LINESTYLE_NONE : LINESTYLE_DOTTED;
789 break;
790 }
791 pTabViewShell->ApplyAttr( SvxUnderlineItem( eNew, ATTR_FONT_UNDERLINE ) );
792 }
793 break;
794
795 default:
796 break;
797 }
798 rBindings.Invalidate( nSlot );
799 }
800 else
801 {
802 /*
803 * "Self-made" functionality of radio buttons
804 * At the toggle the default state is used, this means
805 * no button was clicked.
806 */
807
808 const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
809 const SvxHorJustifyItem* pHorJustify = rAttrSet.GetItemIfSet(ATTR_HOR_JUSTIFY);
810 const SvxVerJustifyItem* pVerJustify = rAttrSet.GetItemIfSet(ATTR_VER_JUSTIFY );
811 SvxCellHorJustify eHorJustify = SvxCellHorJustify::Standard;
812 SvxCellVerJustify eVerJustify = SvxCellVerJustify::Standard;
813
814 if (pHorJustify)
815 {
816 eHorJustify = pHorJustify->GetValue();
817 }
818 if (pVerJustify)
819 {
820 eVerJustify = pVerJustify->GetValue();
821 }
822
823 switch ( nSlot )
824 {
825 case SID_ALIGNLEFT:
826 rReq.SetSlot( SID_H_ALIGNCELL );
828 !pHorJustify || (eHorJustify != SvxCellHorJustify::Left) ?
829 SvxCellHorJustify::Left : SvxCellHorJustify::Standard, SID_H_ALIGNCELL ) );
830 ExecuteSlot( rReq, GetInterface() );
831 return;
832
833 case SID_ALIGNRIGHT:
834 rReq.SetSlot( SID_H_ALIGNCELL );
836 !pHorJustify || (eHorJustify != SvxCellHorJustify::Right) ?
837 SvxCellHorJustify::Right : SvxCellHorJustify::Standard, SID_H_ALIGNCELL ) );
838 ExecuteSlot( rReq, GetInterface() );
839 return;
840
841 case SID_ALIGNCENTERHOR:
842 rReq.SetSlot( SID_H_ALIGNCELL );
844 !pHorJustify || (eHorJustify != SvxCellHorJustify::Center) ?
845 SvxCellHorJustify::Center : SvxCellHorJustify::Standard, SID_H_ALIGNCELL ) );
846 ExecuteSlot( rReq, GetInterface() );
847 return;
848
849 case SID_ALIGNBLOCK:
850 rReq.SetSlot( SID_H_ALIGNCELL );
852 !pHorJustify || (eHorJustify != SvxCellHorJustify::Block) ?
853 SvxCellHorJustify::Block : SvxCellHorJustify::Standard, SID_H_ALIGNCELL ) );
854 ExecuteSlot( rReq, GetInterface() );
855 return;
856
857 case SID_ALIGNTOP:
858 rReq.SetSlot( SID_V_ALIGNCELL );
860 !pVerJustify || (eVerJustify != SvxCellVerJustify::Top) ?
861 SvxCellVerJustify::Top : SvxCellVerJustify::Standard, SID_V_ALIGNCELL ) );
862 ExecuteSlot( rReq, GetInterface() );
863 return;
864
865 case SID_ALIGNBOTTOM:
866 rReq.SetSlot( SID_V_ALIGNCELL );
868 !pVerJustify || (eVerJustify != SvxCellVerJustify::Bottom) ?
869 SvxCellVerJustify::Bottom : SvxCellVerJustify::Standard, SID_V_ALIGNCELL ) );
870 ExecuteSlot( rReq, GetInterface() );
871 return;
872
873 case SID_ALIGNCENTERVER:
874 rReq.SetSlot( SID_V_ALIGNCELL );
876 !pVerJustify || (eVerJustify != SvxCellVerJustify::Center) ?
877 SvxCellVerJustify::Center : SvxCellVerJustify::Standard, SID_V_ALIGNCELL ) );
878 ExecuteSlot( rReq, GetInterface() );
879 return;
880
881 default:
882 break;
883 }
884
885 }
886
887 rBindings.Update();
888
889 if( pNewSet )
890 {
891 rReq.Done( *pNewSet );
892 pNewSet.reset();
893 }
894 else
895 {
896 rReq.Done();
897 }
898
899}
900
902{
903 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
904 SfxBindings& rBindings = rViewData.GetBindings();
905 const SfxItemSet* pNewAttrs = rReq.GetArgs();
906 sal_uInt16 nSlot = rReq.GetSlot();
907
908 pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox
910 if ( !pNewAttrs )
911 {
912 switch ( nSlot )
913 {
914 case SID_GROW_FONT_SIZE:
915 case SID_SHRINK_FONT_SIZE:
916 {
917 SfxItemPool& rPool = GetPool();
918 SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT, rPool );
919 aSetItem.GetItemSet().Put( pTabViewShell->GetSelectionPattern()->GetItemSet(), false );
920
921 SvtScriptType nScriptTypes = pTabViewShell->GetSelectionScriptType();
922 const SvxFontHeightItem* pSize( static_cast<const SvxFontHeightItem*>( aSetItem.GetItemOfScript( nScriptTypes ) ) );
923
924 if ( pSize )
925 {
926 SvxFontHeightItem aSize( *pSize );
927 sal_uInt32 nSize = aSize.GetHeight();
928
929 const sal_uInt32 nFontInc = 40; // 2pt
930 const sal_uInt32 nFontMaxSz = 19998; // 999.9pt
931 if ( nSlot == SID_GROW_FONT_SIZE )
932 nSize = std::min< sal_uInt32 >( nSize + nFontInc, nFontMaxSz );
933 else
934 nSize = std::max< sal_Int32 >( nSize - nFontInc, nFontInc );
935
936 aSize.SetHeight( nSize );
937 aSetItem.PutItemForScriptType( nScriptTypes, aSize );
938 pTabViewShell->ApplyUserItemSet( aSetItem.GetItemSet() );
939 }
940 rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
941 }
942 break;
943
944 case SID_ATTR_CHAR_ENDPREVIEW_FONT:
945 {
946 rDoc.SetPreviewFont(nullptr);
947 pTabViewShell->UpdateSelectionArea( rDoc.GetPreviewSelection() );
948 break;
949 }
950 case SID_ATTR_CHAR_COLOR:
951 case SID_ATTR_CHAR_FONT:
952 case SID_ATTR_CHAR_FONTHEIGHT:
953 pTabViewShell->ExecuteCellFormatDlg(rReq, "font"); // when ToolBar is vertical
954 break;
955
956 case SID_BACKGROUND_COLOR:
957 {
958 SvxBrushItem aBrushItem(
959 pTabViewShell->GetSelectionPattern()->GetItem( ATTR_BACKGROUND ) );
960 aBrushItem.SetColor( COL_TRANSPARENT );
961 pTabViewShell->ApplyAttr( aBrushItem, false );
962 }
963 break;
964
965 case SID_ATTR_ALIGN_LINEBREAK: // without parameter as toggle
966 {
967 const ScPatternAttr* pAttrs = pTabViewShell->GetSelectionPattern();
968 bool bOld = pAttrs->GetItem(ATTR_LINEBREAK).GetValue();
969 ScLineBreakCell aBreakItem(!bOld);
970 pTabViewShell->ApplyAttr( aBreakItem );
971
972 SfxAllItemSet aNewSet( GetPool() );
973 aNewSet.Put( aBreakItem,aBreakItem.Which() );
974 rReq.Done( aNewSet );
975
976 rBindings.Invalidate( nSlot );
977 }
978 break;
979
980 case SID_SCATTR_CELLPROTECTION: // without parameter as toggle
981 {
982 const ScPatternAttr* pAttrs = pTabViewShell->GetSelectionPattern();
983 bool bProtect = pAttrs->GetItem(ATTR_PROTECTION).GetProtection();
984 bool bHideFormula = pAttrs->GetItem(ATTR_PROTECTION).GetHideFormula();
985 bool bHideCell = pAttrs->GetItem(ATTR_PROTECTION).GetHideCell();
986 bool bHidePrint = pAttrs->GetItem(ATTR_PROTECTION).GetHidePrint();
987
988 ScProtectionAttr aProtectionItem( !bProtect, bHideFormula, bHideCell, bHidePrint );
989 pTabViewShell->ApplyAttr( aProtectionItem );
990
991 SfxAllItemSet aNewSet( GetPool() );
992 aNewSet.Put( aProtectionItem, aProtectionItem.Which());
993 aNewSet.Put( SfxBoolItem( SID_SCATTR_CELLPROTECTION, !bProtect ) );
994 rReq.Done( aNewSet );
995
996 rBindings.Invalidate( nSlot );
997 }
998 break;
999 }
1000 }
1001 else
1002 {
1003 switch ( nSlot )
1004 {
1005 case SID_ATTR_CHAR_PREVIEW_FONT:
1006 {
1007 SfxItemPool& rPool = GetPool();
1008 sal_uInt16 nWhich = rPool.GetWhich( nSlot );
1009 const SvxFontItem& rFont = static_cast<const SvxFontItem&>(pNewAttrs->Get( nWhich ));
1010 SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, rPool );
1011 SvtScriptType nScript = pTabViewShell->GetSelectionScriptType();
1012 aSetItem.PutItemForScriptType( nScript, rFont );
1013
1014 ScMarkData aFuncMark( rViewData.GetMarkData() );
1015 ScViewUtil::UnmarkFiltered( aFuncMark, rDoc );
1016 rDoc.SetPreviewFont( aSetItem.GetItemSet().Clone() );
1017 aFuncMark.MarkToMulti();
1018
1019 if ( !aFuncMark.IsMarked() && !aFuncMark.IsMultiMarked() )
1020 {
1021 SCCOL nCol = rViewData.GetCurX();
1022 SCROW nRow = rViewData.GetCurY();
1023 SCTAB nTab = rViewData.GetTabNo();
1024 ScRange aRange( nCol, nRow, nTab );
1025 aFuncMark.SetMarkArea( aRange );
1026 }
1027 rDoc.SetPreviewSelection( aFuncMark );
1028 pTabViewShell->UpdateSelectionArea( aFuncMark );
1029 break;
1030 }
1031 case SID_ATTR_CHAR_OVERLINE:
1032 case SID_ATTR_CHAR_STRIKEOUT:
1033 case SID_ATTR_ALIGN_LINEBREAK:
1034 case SID_ATTR_CHAR_CONTOUR:
1035 case SID_ATTR_CHAR_SHADOWED:
1036 case SID_ATTR_CHAR_RELIEF:
1037 pTabViewShell->ApplyAttr( pNewAttrs->Get( pNewAttrs->GetPool()->GetWhich( nSlot ) ) );
1038 rBindings.Invalidate( nSlot );
1039 rBindings.Update( nSlot );
1040 break;
1041 case SID_ATTR_CHAR_COLOR:
1042 case SID_SCATTR_PROTECTION :
1043 {
1044 pTabViewShell->ApplyAttr( pNewAttrs->Get( pNewAttrs->GetPool()->GetWhich( nSlot) ), false);
1045
1046 rBindings.Invalidate( nSlot );
1047 rBindings.Update( nSlot );
1048 }
1049
1050 break;
1051
1052 case SID_ATTR_CHAR_FONT:
1053 case SID_ATTR_CHAR_FONTHEIGHT:
1054 {
1055 // #i78017 establish the same behaviour as in Writer
1056 SvtScriptType nScript = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
1057 if (nSlot == SID_ATTR_CHAR_FONT)
1058 nScript = pTabViewShell->GetSelectionScriptType();
1059
1060 SfxItemPool& rPool = GetPool();
1061 SvxScriptSetItem aSetItem( nSlot, rPool );
1062 sal_uInt16 nWhich = rPool.GetWhich( nSlot );
1063 aSetItem.PutItemForScriptType( nScript, pNewAttrs->Get( nWhich ) );
1064
1065 pTabViewShell->ApplyUserItemSet( aSetItem.GetItemSet() );
1066
1067 rBindings.Invalidate( nSlot );
1068 rBindings.Update( nSlot );
1069 }
1070 break;
1071
1072 case SID_FRAME_LINESTYLE:
1073 {
1074 // Update default line
1075 const ::editeng::SvxBorderLine* pLine =
1076 pNewAttrs->Get( SID_FRAME_LINESTYLE ).
1077 GetLine();
1078
1079 if ( pLine )
1080 {
1081 ::editeng::SvxBorderLine* pDefLine = pTabViewShell->GetDefaultFrameLine();
1082
1083 if ( pDefLine )
1084 {
1085 pDefLine->SetBorderLineStyle(
1086 pLine->GetBorderLineStyle());
1087 pDefLine->SetWidth( pLine->GetWidth( ) );
1088 pTabViewShell->SetSelectionFrameLines( pDefLine, false );
1089 }
1090 else
1091 {
1092 pTabViewShell->SetDefaultFrameLine( pLine );
1093 pTabViewShell->GetDefaultFrameLine()->SetColor( COL_BLACK );
1094 pTabViewShell->SetSelectionFrameLines( pLine, false );
1095 }
1096 }
1097 else
1098 {
1099 Color aColorBlack( COL_BLACK );
1100 ::editeng::SvxBorderLine aDefLine( &aColorBlack, 20,
1101 SvxBorderLineStyle::SOLID );
1102 pTabViewShell->SetDefaultFrameLine( &aDefLine );
1103 pTabViewShell->SetSelectionFrameLines( nullptr, false );
1104 }
1105 }
1106 break;
1107
1108 case SID_FRAME_LINECOLOR:
1109 {
1110 ::editeng::SvxBorderLine* pDefLine = pTabViewShell->GetDefaultFrameLine();
1111
1112 Color aColor = pNewAttrs->Get( SID_FRAME_LINECOLOR ).GetValue();
1113
1114 // Update default line
1115 if ( pDefLine )
1116 {
1117 pDefLine->SetColor( aColor );
1118 pTabViewShell->SetSelectionFrameLines( pDefLine, true );
1119 }
1120 else
1121 {
1122 ::editeng::SvxBorderLine aDefLine( &aColor, 20, SvxBorderLineStyle::SOLID );
1123 pTabViewShell->SetDefaultFrameLine( &aDefLine );
1124 pTabViewShell->SetSelectionFrameLines( &aDefLine, false );
1125 }
1126 }
1127 break;
1128
1129 case SID_ATTR_BORDER_OUTER:
1130 case SID_ATTR_BORDER:
1131 {
1132 ::editeng::SvxBorderLine* pDefLine = pTabViewShell->GetDefaultFrameLine();
1133 const ScPatternAttr* pOldAttrs = pTabViewShell->GetSelectionPattern();
1136 const SfxPoolItem& rBorderAttr =
1137 pOldAttrs->GetItemSet().
1138 Get( ATTR_BORDER );
1139
1140 // Evaluate border items from controller:
1141
1142 if ( const SvxBoxItem* pBoxItem = pNewAttrs->GetItemIfSet( ATTR_BORDER ) )
1143 {
1144 // The SvxFrameToolBoxControl toolbox controller uses a default
1145 // SvxBorderLine (all widths 0) to mark the lines that should be set.
1146 // Macro recording uses a SvxBoxItem with the real values (OutWidth > 0)
1147 // or NULL pointers for no lines.
1148 // -> Substitute existing lines with pDefLine only if widths are 0.
1149 SvxBoxItem aBoxItem ( *pBoxItem );
1150 if ( aBoxItem.GetTop() && aBoxItem.GetTop()->GetOutWidth() == 0 )
1151 aBoxItem.SetLine( pDefLine, SvxBoxItemLine::TOP );
1152 if ( aBoxItem.GetBottom() && aBoxItem.GetBottom()->GetOutWidth() == 0 )
1153 aBoxItem.SetLine( pDefLine, SvxBoxItemLine::BOTTOM );
1154 if ( aBoxItem.GetLeft() && aBoxItem.GetLeft()->GetOutWidth() == 0 )
1155 aBoxItem.SetLine( pDefLine, SvxBoxItemLine::LEFT );
1156 if ( aBoxItem.GetRight() && aBoxItem.GetRight()->GetOutWidth() == 0 )
1157 aBoxItem.SetLine( pDefLine, SvxBoxItemLine::RIGHT );
1158 aNewSet.Put( aBoxItem );
1159 rReq.AppendItem( aBoxItem );
1160 }
1161
1162 if ( const SvxBoxInfoItem* pBoxInfoItem = pNewAttrs->GetItemIfSet( ATTR_BORDER_INNER ) )
1163 {
1164 SvxBoxInfoItem aBoxInfoItem( *pBoxInfoItem );
1165 if ( aBoxInfoItem.GetHori() && aBoxInfoItem.GetHori()->GetOutWidth() == 0 )
1166 aBoxInfoItem.SetLine( pDefLine, SvxBoxInfoItemLine::HORI );
1167 if ( aBoxInfoItem.GetVert() && aBoxInfoItem.GetVert()->GetOutWidth() == 0 )
1168 aBoxInfoItem.SetLine( pDefLine, SvxBoxInfoItemLine::VERT );
1169 aNewSet.Put( aBoxInfoItem );
1170 rReq.AppendItem( aBoxInfoItem );
1171 }
1172 else
1173 {
1174 SvxBoxInfoItem aBoxInfoItem( ATTR_BORDER_INNER );
1175 aBoxInfoItem.SetLine( nullptr, SvxBoxInfoItemLine::HORI );
1176 aBoxInfoItem.SetLine( nullptr, SvxBoxInfoItemLine::VERT );
1177 aNewSet.Put( aBoxInfoItem );
1178 }
1179
1180 aOldSet.Put( rBorderAttr );
1181 pTabViewShell->ApplyAttributes( &aNewSet, &aOldSet );
1182 }
1183 break;
1184
1185 case SID_ATTR_BORDER_DIAG_TLBR:
1186 case SID_ATTR_BORDER_DIAG_BLTR:
1187 {
1188 const ScPatternAttr* pOldAttrs = pTabViewShell->GetSelectionPattern();
1189 SfxItemSet aOldSet(pOldAttrs->GetItemSet());
1190 SfxItemSet aNewSet(pOldAttrs->GetItemSet());
1191
1192 if(SID_ATTR_BORDER_DIAG_TLBR == nSlot)
1193 {
1194 if(SfxItemState::SET == pNewAttrs->GetItemState(ATTR_BORDER_TLBR))
1195 {
1197 aItem.SetLine(pNewAttrs->Get(ATTR_BORDER_TLBR).GetLine());
1198 aNewSet.Put(aItem);
1199 rReq.AppendItem(aItem);
1200 pTabViewShell->ApplyAttributes(&aNewSet, &aOldSet);
1201 }
1202 }
1203 else // if( nSlot == SID_ATTR_BORDER_DIAG_BLTR )
1204 {
1205 if(SfxItemState::SET == pNewAttrs->GetItemState(ATTR_BORDER_BLTR ))
1206 {
1208 aItem.SetLine(pNewAttrs->Get(ATTR_BORDER_BLTR).GetLine());
1209 aNewSet.Put(aItem);
1210 rReq.AppendItem(aItem);
1211 pTabViewShell->ApplyAttributes(&aNewSet, &aOldSet);
1212 }
1213 }
1214
1215 rBindings.Invalidate(nSlot);
1216 }
1217 break;
1218
1219 // ATTR_BACKGROUND (=SID_ATTR_BRUSH) has to be set to two IDs:
1220 case SID_BACKGROUND_COLOR:
1221 {
1222 const SvxColorItem& rNewColorItem = pNewAttrs->Get( SID_BACKGROUND_COLOR );
1223 Color aColor = rNewColorItem.GetValue();
1224
1225 SvxBrushItem aBrushItem(
1226 pTabViewShell->GetSelectionPattern()->GetItem( ATTR_BACKGROUND ) );
1227 aBrushItem.SetColor( aColor );
1228
1229 pTabViewShell->ApplyAttr( aBrushItem, false );
1230 }
1231 break;
1232
1233 case SID_ATTR_BRUSH:
1234 {
1235 SvxBrushItem aBrushItem( pTabViewShell->GetSelectionPattern()->
1237 const SvxBrushItem& rNewBrushItem = static_cast<const SvxBrushItem&>(
1238 pNewAttrs->Get( GetPool().GetWhich(nSlot) ) );
1239 aBrushItem.SetColor(rNewBrushItem.GetColor());
1240 pTabViewShell->ApplyAttr( aBrushItem );
1241 }
1242 break;
1243
1244 case SID_ATTR_BORDER_SHADOW:
1245 {
1246 const SvxShadowItem& rNewShadowItem =
1247 pNewAttrs->Get( ATTR_SHADOW );
1248 pTabViewShell->ApplyAttr( rNewShadowItem );
1249 }
1250 break;
1251
1252 default:
1253 break;
1254 }
1255
1256 if( ! rReq.IsAPI() && ! rReq.IsDone() )
1257 rReq.Done();
1258 }
1259}
1260
1262{
1263 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
1264 const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
1265 const SvxBrushItem& rBrushItem = rAttrSet.Get( ATTR_BACKGROUND );
1266 SfxWhichIter aIter( rSet );
1267 sal_uInt16 nWhich = aIter.FirstWhich();
1268
1269 rSet.Put( rAttrSet, false );
1270
1271 // choose font info according to selection script type
1272 SvtScriptType nScript = SvtScriptType::NONE; // GetSelectionScriptType never returns 0
1273 if ( rSet.GetItemState( ATTR_FONT ) != SfxItemState::UNKNOWN )
1274 {
1275 nScript = pTabViewShell->GetSelectionScriptType();
1276 ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT, nScript );
1277 }
1278 if ( rSet.GetItemState( ATTR_FONT_HEIGHT ) != SfxItemState::UNKNOWN )
1279 {
1280 if (nScript == SvtScriptType::NONE) nScript = pTabViewShell->GetSelectionScriptType();
1281 ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT_HEIGHT, nScript );
1282 }
1283
1284 while ( nWhich )
1285 {
1286 switch(nWhich)
1287 {
1288 case SID_BACKGROUND_COLOR:
1289 {
1290 rSet.Put( SvxColorItem( rBrushItem.GetColor(), SID_BACKGROUND_COLOR ) );
1291 if(SfxItemState::DONTCARE == rAttrSet.GetItemState(ATTR_BACKGROUND))
1292 {
1293 rSet.InvalidateItem(SID_BACKGROUND_COLOR);
1294 }
1295 }
1296 break;
1297 case SID_FRAME_LINESTYLE:
1298 case SID_FRAME_LINECOLOR:
1299 {
1300 // handled together because both need the cell border information for decisions
1301 Color aCol;
1302 editeng::SvxBorderLine aLine(nullptr,0,SvxBorderLineStyle::SOLID);
1303 bool bCol = false;
1304 bool bColDisable = false, bStyleDisable = false;
1305 std::shared_ptr<SvxBoxItem> aBoxItem(std::make_shared<SvxBoxItem>(ATTR_BORDER));
1306 std::shared_ptr<SvxBoxInfoItem> aInfoItem(std::make_shared<SvxBoxInfoItem>(ATTR_BORDER_INNER));
1307
1308 pTabViewShell->GetSelectionFrame(aBoxItem, aInfoItem);
1309
1310 if( aBoxItem->GetTop() )
1311 {
1312 bCol = true;
1313 aCol = aBoxItem->GetTop()->GetColor() ;
1314 aLine.SetColor(aCol);
1315 aLine.SetWidth( aBoxItem->GetTop()->GetWidth());
1316 aLine.SetBorderLineStyle( aBoxItem->GetTop()->GetBorderLineStyle());
1317 }
1318
1319 if( aBoxItem->GetBottom() )
1320 {
1321 if(!bCol)
1322 {
1323 bCol = true;
1324 aCol = aBoxItem->GetBottom()->GetColor() ;
1325 aLine.SetColor(aCol);
1326 aLine.SetWidth( aBoxItem->GetBottom()->GetWidth());
1327 aLine.SetBorderLineStyle( aBoxItem->GetBottom()->GetBorderLineStyle());
1328 }
1329 else
1330 {
1331 if(aCol != aBoxItem->GetBottom()->GetColor() )
1332 bColDisable = true;
1333 if( aLine != *aBoxItem->GetBottom() )
1334 bStyleDisable = true;
1335 }
1336 }
1337
1338 if( aBoxItem->GetLeft() )
1339 {
1340 if(!bCol)
1341 {
1342 bCol = true;
1343 aCol = aBoxItem->GetLeft()->GetColor() ;
1344 aLine.SetColor(aCol);
1345 aLine.SetWidth( aBoxItem->GetLeft()->GetWidth());
1346 aLine.SetBorderLineStyle( aBoxItem->GetLeft()->GetBorderLineStyle());
1347 }
1348 else
1349 {
1350 if(aCol != aBoxItem->GetLeft()->GetColor() )
1351 bColDisable = true;
1352 if( aLine != *aBoxItem->GetLeft() )
1353 bStyleDisable = true;
1354 }
1355 }
1356
1357 if( aBoxItem->GetRight() )
1358 {
1359 if(!bCol)
1360 {
1361 bCol = true;
1362 aCol = aBoxItem->GetRight()->GetColor() ;
1363 aLine.SetColor(aCol);
1364 aLine.SetWidth( aBoxItem->GetRight()->GetWidth());
1365 aLine.SetBorderLineStyle( aBoxItem->GetRight()->GetBorderLineStyle());
1366 }
1367 else
1368 {
1369 if(aCol != aBoxItem->GetRight()->GetColor() )
1370 bColDisable = true;
1371 if( aLine != *aBoxItem->GetRight() )
1372 bStyleDisable = true;
1373 }
1374 }
1375
1376 if( aInfoItem->GetVert())
1377 {
1378 if(!bCol)
1379 {
1380 bCol = true;
1381 aCol = aInfoItem->GetVert()->GetColor() ;
1382 aLine.SetColor(aCol);
1383 aLine.SetWidth( aInfoItem->GetVert()->GetWidth());
1384 aLine.SetBorderLineStyle( aInfoItem->GetVert()->GetBorderLineStyle());
1385 }
1386 else
1387 {
1388 if(aCol != aInfoItem->GetVert()->GetColor() )
1389 bColDisable = true;
1390 if( aLine != *aInfoItem->GetVert() )
1391 bStyleDisable = true;
1392 }
1393 }
1394
1395 if( aInfoItem->GetHori())
1396 {
1397 if(!bCol)
1398 {
1399 bCol = true;
1400 aCol = aInfoItem->GetHori()->GetColor() ;
1401 aLine.SetColor(aCol);
1402 aLine.SetWidth( aInfoItem->GetHori()->GetWidth());
1403 aLine.SetBorderLineStyle( aInfoItem->GetHori()->GetBorderLineStyle());
1404 }
1405 else
1406 {
1407 if(aCol != aInfoItem->GetHori()->GetColor() )
1408 bColDisable = true;
1409 if( aLine != *aInfoItem->GetHori() )
1410 bStyleDisable = true;
1411 }
1412 }
1413
1414 if( !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::VERT )
1415 || !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::HORI )
1416 || !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::LEFT )
1417 || !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::RIGHT )
1418 || !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::TOP )
1419 || !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::BOTTOM ) )
1420 {
1421 bColDisable = true;
1422 bStyleDisable = true;
1423 }
1424
1425 if(SID_FRAME_LINECOLOR == nWhich)
1426 {
1427 if(bColDisable) // if different lines have different colors
1428 {
1429 aCol = COL_TRANSPARENT;
1430 rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) );
1431 rSet.InvalidateItem(SID_FRAME_LINECOLOR);
1432 }
1433 else if (!bCol) // if no line available
1434 {
1435 aCol = COL_AUTO;
1436 rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) );
1437 }
1438 else
1439 rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) );
1440 }
1441 else // if( nWhich == SID_FRAME_LINESTYLE)
1442 {
1443 if(bStyleDisable) // if have several lines but don't have same style
1444 {
1445 aLine.SetWidth( 1 );
1446 SvxLineItem aItem(SID_FRAME_LINESTYLE);
1447 aItem.SetLine(&aLine);
1448 rSet.Put( aItem );
1449 rSet.InvalidateItem(SID_FRAME_LINESTYLE);
1450 }
1451 else // all the lines have same style or no line available, use initial value (0,0,0,0)
1452 {
1453 SvxLineItem aItem(SID_FRAME_LINESTYLE);
1454 aItem.SetLine(&aLine);
1455 rSet.Put( aItem );
1456 }
1457 }
1458 }
1459 break;
1460 case SID_ATTR_BRUSH:
1461 {
1462 rSet.Put( rBrushItem.CloneSetWhich(GetPool().GetWhich(nWhich)) );
1463 }
1464 break;
1465 case SID_SCATTR_CELLPROTECTION:
1466 {
1467 bool bProtect = rAttrSet.Get( ATTR_PROTECTION ).GetProtection();
1468 rSet.Put( SfxBoolItem(SID_SCATTR_CELLPROTECTION, bProtect) );
1469 }
1470 break;
1471 }
1472 nWhich = aIter.NextWhich();
1473 }
1474
1475 // stuff for sidebar panels
1476 Invalidate(SID_ATTR_ALIGN_DEGREES);
1477 Invalidate(SID_ATTR_ALIGN_LOCKPOS);
1478 Invalidate(SID_ATTR_ALIGN_STACKED);
1479}
1480
1482{
1483 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
1484 const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
1485 rSet.Put( rAttrSet, false ); // Include ItemStates in copy
1486
1487 // choose font info according to selection script type
1488 SvtScriptType nScript = SvtScriptType::NONE; // GetSelectionScriptType never returns 0
1489 if ( rSet.GetItemState( ATTR_FONT_WEIGHT ) != SfxItemState::UNKNOWN )
1490 {
1491 nScript = pTabViewShell->GetSelectionScriptType();
1492 ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT_WEIGHT, nScript );
1493 }
1494 if ( rSet.GetItemState( ATTR_FONT_POSTURE ) != SfxItemState::UNKNOWN )
1495 {
1496 if (nScript == SvtScriptType::NONE) nScript = pTabViewShell->GetSelectionScriptType();
1497 ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT_POSTURE, nScript );
1498 }
1499
1500 SfxItemState eState;
1501
1502 // own control on radio button functionality:
1503
1504 // underline
1505
1506 eState = rAttrSet.GetItemState( ATTR_FONT_UNDERLINE );
1507 if ( eState == SfxItemState::DONTCARE )
1508 {
1509 rSet.InvalidateItem( SID_ULINE_VAL_NONE );
1510 rSet.InvalidateItem( SID_ULINE_VAL_SINGLE );
1511 rSet.InvalidateItem( SID_ULINE_VAL_DOUBLE );
1512 rSet.InvalidateItem( SID_ULINE_VAL_DOTTED );
1513 }
1514 else
1515 {
1516 FontLineStyle eUnderline =
1517 rAttrSet.Get(ATTR_FONT_UNDERLINE).GetLineStyle();
1518 rSet.Put(SfxBoolItem(SID_ULINE_VAL_SINGLE, eUnderline == LINESTYLE_SINGLE));
1519 rSet.Put(SfxBoolItem(SID_ULINE_VAL_DOUBLE, eUnderline == LINESTYLE_DOUBLE));
1520 rSet.Put(SfxBoolItem(SID_ULINE_VAL_DOTTED, eUnderline == LINESTYLE_DOTTED));
1521 rSet.Put(SfxBoolItem(SID_ULINE_VAL_NONE, eUnderline == LINESTYLE_NONE));
1522 }
1523
1524 // horizontal alignment
1525
1526 const SvxHorJustifyItem* pHorJustify = nullptr;
1527 const SvxVerJustifyItem* pVerJustify = nullptr;
1528 SvxCellVerJustify eVerJustify = SvxCellVerJustify::Standard;
1529 sal_uInt16 nWhich = 0;
1530 bool bJustifyStd = false;
1531 SfxBoolItem aBoolItem ( 0, true );
1532
1533 eState = rAttrSet.GetItemState( ATTR_HOR_JUSTIFY, true,
1534 reinterpret_cast<const SfxPoolItem**>(&pHorJustify) );
1535 switch ( eState )
1536 {
1537 case SfxItemState::SET:
1538 {
1539 switch ( pHorJustify->GetValue() )
1540 {
1541 case SvxCellHorJustify::Standard:
1542 break;
1543
1544 case SvxCellHorJustify::Left:
1545 nWhich = SID_ALIGNLEFT;
1546 break;
1547
1548 case SvxCellHorJustify::Right:
1549 nWhich = SID_ALIGNRIGHT;
1550 break;
1551
1552 case SvxCellHorJustify::Center:
1553 nWhich = SID_ALIGNCENTERHOR;
1554 break;
1555
1556 case SvxCellHorJustify::Block:
1557 nWhich = SID_ALIGNBLOCK;
1558 break;
1559
1560 case SvxCellHorJustify::Repeat:
1561 default:
1562 bJustifyStd = true;
1563 break;
1564 }
1565 }
1566 break;
1567
1568 case SfxItemState::DONTCARE:
1569 rSet.InvalidateItem( SID_ALIGNLEFT );
1570 rSet.InvalidateItem( SID_ALIGNRIGHT );
1571 rSet.InvalidateItem( SID_ALIGNCENTERHOR );
1572 rSet.InvalidateItem( SID_ALIGNBLOCK );
1573 break;
1574
1575 default:
1576 bJustifyStd = true;
1577 break;
1578 }
1579
1580 if ( nWhich )
1581 {
1582 aBoolItem.SetWhich( nWhich );
1583 rSet.Put( aBoolItem );
1584 }
1585 else if ( bJustifyStd )
1586 {
1587 aBoolItem.SetValue( false );
1588 aBoolItem.SetWhich( SID_ALIGNLEFT ); rSet.Put( aBoolItem );
1589 aBoolItem.SetWhich( SID_ALIGNRIGHT ); rSet.Put( aBoolItem );
1590 aBoolItem.SetWhich( SID_ALIGNCENTERHOR ); rSet.Put( aBoolItem );
1591 aBoolItem.SetWhich( SID_ALIGNBLOCK ); rSet.Put( aBoolItem );
1592 bJustifyStd = false;
1593 }
1594
1595 // vertical alignment
1596
1597 nWhich = 0;
1598 aBoolItem.SetValue( true );
1599
1600 eState = rAttrSet.GetItemState( ATTR_VER_JUSTIFY, true,
1601 reinterpret_cast<const SfxPoolItem**>(&pVerJustify) );
1602
1603 switch ( eState )
1604 {
1605 case SfxItemState::SET:
1606 {
1607 eVerJustify = pVerJustify->GetValue();
1608
1609 switch ( eVerJustify )
1610 {
1611 case SvxCellVerJustify::Top:
1612 nWhich = SID_ALIGNTOP;
1613 break;
1614
1615 case SvxCellVerJustify::Bottom:
1616 nWhich = SID_ALIGNBOTTOM;
1617 break;
1618
1619 case SvxCellVerJustify::Center:
1620 nWhich = SID_ALIGNCENTERVER;
1621 break;
1622
1623 case SvxCellVerJustify::Standard:
1624 default:
1625 bJustifyStd = true;
1626 break;
1627 }
1628 }
1629 break;
1630
1631 case SfxItemState::DONTCARE:
1632 rSet.InvalidateItem( SID_ALIGNTOP );
1633 rSet.InvalidateItem( SID_ALIGNBOTTOM );
1634 rSet.InvalidateItem( SID_ALIGNCENTERVER );
1635 break;
1636
1637 default:
1638 bJustifyStd = true;
1639 break;
1640 }
1641
1642 if ( nWhich )
1643 {
1644 aBoolItem.SetWhich( nWhich );
1645 rSet.Put( aBoolItem );
1646 }
1647 else if ( bJustifyStd )
1648 {
1649 aBoolItem.SetValue( false );
1650 aBoolItem.SetWhich( SID_ALIGNTOP ); rSet.Put( aBoolItem );
1651 aBoolItem.SetWhich( SID_ALIGNBOTTOM ); rSet.Put( aBoolItem );
1652 aBoolItem.SetWhich( SID_ALIGNCENTERVER ); rSet.Put( aBoolItem );
1653 }
1654}
1655
1657{
1658 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
1659 std::shared_ptr<SvxBoxItem> aBoxItem(std::make_shared<SvxBoxItem>(ATTR_BORDER));
1660 std::shared_ptr<SvxBoxInfoItem> aInfoItem(std::make_shared<SvxBoxInfoItem>(ATTR_BORDER_INNER));
1661
1662 pTabViewShell->GetSelectionFrame( aBoxItem, aInfoItem );
1663
1664 if ( rSet.GetItemState( ATTR_BORDER ) != SfxItemState::UNKNOWN )
1665 rSet.Put( *aBoxItem );
1666 if ( rSet.GetItemState( ATTR_BORDER_INNER ) != SfxItemState::UNKNOWN )
1667 rSet.Put( *aInfoItem );
1668}
1669
1671{
1672 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
1673 const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
1674 SfxWhichIter aIter(rSet);
1675 sal_uInt16 nWhich = aIter.FirstWhich();
1676
1677 SvxCellHorJustify eHAlign = SvxCellHorJustify::Standard;
1678 bool bHasHAlign = rAttrSet.GetItemState( ATTR_HOR_JUSTIFY ) != SfxItemState::DONTCARE;
1679 if( bHasHAlign )
1680 eHAlign = rAttrSet.Get( ATTR_HOR_JUSTIFY ).GetValue();
1681
1682 SvxCellVerJustify eVAlign = SvxCellVerJustify::Standard;
1683 bool bHasVAlign = rAttrSet.GetItemState( ATTR_VER_JUSTIFY ) != SfxItemState::DONTCARE;
1684 if( bHasVAlign )
1685 eVAlign = rAttrSet.Get( ATTR_VER_JUSTIFY ).GetValue();
1686
1687 while ( nWhich )
1688 {
1689 switch ( nWhich )
1690 {
1691 case SID_H_ALIGNCELL:
1692 if ( bHasHAlign )
1693 rSet.Put( SvxHorJustifyItem( eHAlign, nWhich ));
1694 break;
1695 case SID_V_ALIGNCELL:
1696 if ( bHasVAlign )
1697 rSet.Put( SvxVerJustifyItem( eVAlign, nWhich ));
1698 break;
1699
1700 // pseudo slots for Format menu
1701 case SID_ALIGN_ANY_HDEFAULT:
1702 case SID_ALIGN_ANY_LEFT:
1703 case SID_ALIGN_ANY_HCENTER:
1704 case SID_ALIGN_ANY_RIGHT:
1705 case SID_ALIGN_ANY_JUSTIFIED:
1706 rSet.Put( SfxBoolItem( nWhich, bHasHAlign && (eHAlign == lclConvertSlotToHAlign( nWhich )) ) );
1707 break;
1708 case SID_ALIGN_ANY_VDEFAULT:
1709 case SID_ALIGN_ANY_TOP:
1710 case SID_ALIGN_ANY_VCENTER:
1711 case SID_ALIGN_ANY_BOTTOM:
1712 rSet.Put( SfxBoolItem( nWhich, bHasVAlign && (eVAlign == lclConvertSlotToVAlign( nWhich )) ) );
1713 break;
1714 }
1715 nWhich = aIter.NextWhich();
1716 }
1717}
1718
1720{
1721 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
1723 const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
1724 const SfxItemState eItemState = rAttrSet.GetItemState( ATTR_VALUE_FORMAT );
1725 sal_uInt32 nNumberFormat = rAttrSet.Get(ATTR_VALUE_FORMAT).GetValue();
1726 SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
1727 // If item state is default or set it
1728 // indicates one number format so we
1729 // don't have to iterate over all
1730 // selected cells' attribute ranges to
1731 // determine selected types.
1732 // Does *NOT* include the
1733 // SvNumFormatType::DEFINED bit.
1734 const SvNumFormatType nType = (eItemState >= SfxItemState::DEFAULT ? pFormatter->GetType( nNumberFormat) :
1736 NfIndexTableOffset nOffset = pFormatter->GetIndexTableOffset(nNumberFormat);
1737
1738 SfxWhichIter aIter(rSet);
1739 sal_uInt16 nWhich = aIter.FirstWhich();
1740
1741 while ( nWhich )
1742 {
1743 switch ( nWhich )
1744 {
1745 case SID_NUMBER_THOUSANDS:
1746 {
1747 bool bEnable = (SfxItemState::DONTCARE != eItemState);
1748 if (bEnable)
1749 {
1750 bEnable = ((nType != SvNumFormatType::ALL) && (nType &
1751 (SvNumFormatType::NUMBER |
1752 SvNumFormatType::PERCENT |
1753 SvNumFormatType::CURRENCY |
1754 SvNumFormatType::FRACTION)));
1755 if (bEnable)
1756 {
1757 bool bThousand( false );
1758 bool bNegRed( false );
1759 sal_uInt16 nPrecision( 0 );
1760 sal_uInt16 nLeadZeroes( 0 );
1761 pFormatter->GetFormatSpecialInfo( nNumberFormat, bThousand, bNegRed, nPrecision, nLeadZeroes);
1762 rSet.Put( SfxBoolItem( nWhich, bThousand));
1763 }
1764 }
1765 if (!bEnable)
1766 {
1767 rSet.DisableItem( nWhich );
1768 }
1769 }
1770 break;
1771 case SID_NUMBER_FORMAT:
1772 // symphony version with format interpretation
1773 {
1774 if(SfxItemState::DONTCARE != eItemState)
1775 {
1776 bool bThousand(false);
1777 bool bNegRed(false);
1778 sal_uInt16 nPrecision(0);
1779 sal_uInt16 nLeadZeroes(0);
1780
1781 pFormatter->GetFormatSpecialInfo(nNumberFormat,bThousand, bNegRed, nPrecision, nLeadZeroes);
1782
1783 const SvNumberformat* pFormatEntry = pFormatter->GetEntry( nNumberFormat );
1784 if (pFormatEntry && (pFormatEntry->GetType() & SvNumFormatType::SCIENTIFIC))
1785 {
1786 // if scientific, bThousand is used for engineering notation
1787 const sal_uInt16 nIntegerDigits = pFormatEntry->GetFormatIntegerDigits();
1788 bThousand = nIntegerDigits > 0 && ((nIntegerDigits % 3) == 0);
1789 }
1790 OUString aFormat;
1791 static constexpr OUStringLiteral sBreak = u",";
1792 const OUString sThousand = OUString::number(static_cast<sal_Int32>(bThousand));
1793 const OUString sNegRed = OUString::number(static_cast<sal_Int32>(bNegRed));
1794 const OUString sPrecision = OUString::number(nPrecision);
1795 const OUString sLeadZeroes = OUString::number(nLeadZeroes);
1796 const OUString sNatNum12 = OUString::number( static_cast< sal_Int32 >( pFormatter->IsNatNum12( nNumberFormat ) ) );
1797
1798 aFormat += sThousand +
1799 sBreak +
1800 sNegRed +
1801 sBreak +
1802 sPrecision +
1803 sBreak +
1804 sLeadZeroes +
1805 sBreak +
1806 sNatNum12 +
1807 sBreak;
1808
1809 rSet.Put(SfxStringItem(nWhich, aFormat));
1810
1812 {
1813 OUString sPayload = ".uno:NumberFormat=" + aFormat;
1814 GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
1815 OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr());
1816 }
1817 }
1818 else
1819 {
1820 rSet.InvalidateItem( nWhich );
1821 }
1822 }
1823 break;
1824
1825 case SID_NUMBER_TYPE_FORMAT:
1826 {
1827 sal_Int16 nFormatCategory = -1;
1828 if ( eItemState >= SfxItemState::DEFAULT ) //Modify for more robust
1829 {
1830 switch(nType)
1831 {
1832 case SvNumFormatType::NUMBER:
1833 // Determine if General format.
1834 if ((nNumberFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0)
1835 nFormatCategory = 0;
1836 else
1837 nFormatCategory = 1;
1838 break;
1839 case SvNumFormatType::PERCENT:
1840 nFormatCategory = 2;
1841 break;
1842 case SvNumFormatType::CURRENCY:
1843 nFormatCategory = 3;
1844 break;
1845 case SvNumFormatType::DATE:
1846 //Add
1847 case SvNumFormatType::DATETIME:
1848 nFormatCategory = 4;
1849 break;
1850 case SvNumFormatType::TIME:
1851 nFormatCategory = 5;
1852 break;
1853 case SvNumFormatType::SCIENTIFIC:
1854 nFormatCategory = 6;
1855 break;
1856 case SvNumFormatType::FRACTION:
1857 nFormatCategory = 7;
1858 break;
1859 case SvNumFormatType::LOGICAL:
1860 nFormatCategory = 8;
1861 break;
1862 case SvNumFormatType::TEXT:
1863 nFormatCategory = 9;
1864 break;
1865 default:
1866 nFormatCategory = -1; //for more robust
1867 }
1868 if( nFormatCategory == -1 )
1869 rSet.InvalidateItem( nWhich );
1870 else
1871 rSet.Put( SfxInt16Item( nWhich, nFormatCategory ) );
1872 }
1873 else
1874 {
1875 rSet.InvalidateItem( nWhich );
1876 }
1877
1878 }
1879 break;
1880 case SID_NUMBER_CURRENCY:
1881 rSet.Put( SfxBoolItem(nWhich, bool(nType & SvNumFormatType::CURRENCY)) );
1882 break;
1883 case SID_NUMBER_SCIENTIFIC:
1884 rSet.Put( SfxBoolItem(nWhich, bool(nType & SvNumFormatType::SCIENTIFIC)) );
1885 break;
1886 case SID_NUMBER_DATE:
1887 rSet.Put( SfxBoolItem(nWhich, bool(nType & SvNumFormatType::DATE)) );
1888 break;
1889 case SID_NUMBER_PERCENT:
1890 rSet.Put( SfxBoolItem(nWhich, bool(nType & SvNumFormatType::PERCENT)) );
1891 break;
1892 case SID_NUMBER_TIME:
1893 rSet.Put( SfxBoolItem(nWhich, bool(nType & SvNumFormatType::TIME)) );
1894 break;
1895 case SID_NUMBER_TWODEC:
1896 rSet.Put( SfxBoolItem(nWhich, (nType & SvNumFormatType::NUMBER) && nOffset == NF_NUMBER_1000DEC2 ) );
1897 break;
1898 case SID_NUMBER_STANDARD:
1899 rSet.Put( SfxBoolItem(nWhich, (nType & SvNumFormatType::NUMBER) && (nNumberFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0) );
1900 break;
1901 }
1902 nWhich = aIter.NextWhich();
1903 }
1904}
1905
1907{
1908 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
1909 pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox
1910 bool bEditMode = false;
1911 if ( GetViewData().HasEditView( GetViewData().GetActivePart() ) )
1912 {
1913 bEditMode=true;
1914 SC_MOD()->InputEnterHandler();
1915 pTabViewShell->UpdateInputHandler();
1916 }
1917 sal_uInt16 nSlot = rReq.GetSlot();
1918 switch( nSlot )
1919 {
1920 case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
1921 case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
1922 {
1923 bool bVert = (nSlot == SID_TEXTDIRECTION_TOP_TO_BOTTOM);
1924 ScPatternAttr aAttr( GetViewData().GetDocument().GetPool() );
1925 SfxItemSet& rItemSet = aAttr.GetItemSet();
1926 rItemSet.Put( ScVerticalStackCell( bVert ) );
1927 rItemSet.Put( SfxBoolItem( ATTR_VERTICAL_ASIAN, bVert ) );
1928 pTabViewShell->ApplySelectionPattern( aAttr );
1929 pTabViewShell->AdjustBlockHeight();
1930 }
1931 break;
1932
1933 case SID_ATTR_PARA_LEFT_TO_RIGHT:
1934 case SID_ATTR_PARA_RIGHT_TO_LEFT:
1935 {
1936 SvxFrameDirection eDirection = ( nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT ) ?
1937 SvxFrameDirection::Horizontal_LR_TB : SvxFrameDirection::Horizontal_RL_TB;
1938 pTabViewShell->ApplyAttr( SvxFrameDirectionItem( eDirection, ATTR_WRITINGDIR ) );
1939 }
1940 break;
1941 }
1942 if (bEditMode)
1943 SC_MOD()->SetInputMode( SC_INPUT_TABLE );
1944}
1945
1947{
1948 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
1949 const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
1950
1951 bool bVertDontCare =
1952 (rAttrSet.GetItemState( ATTR_VERTICAL_ASIAN ) == SfxItemState::DONTCARE) ||
1953 (rAttrSet.GetItemState( ATTR_STACKED ) == SfxItemState::DONTCARE);
1954 bool bLeftRight = !bVertDontCare &&
1955 !rAttrSet.Get( ATTR_STACKED ).GetValue();
1956 bool bTopBottom = !bVertDontCare && !bLeftRight &&
1957 rAttrSet.Get( ATTR_VERTICAL_ASIAN ).GetValue();
1958
1959 bool bBidiDontCare = (rAttrSet.GetItemState( ATTR_WRITINGDIR ) == SfxItemState::DONTCARE);
1960 EEHorizontalTextDirection eBidiDir = EEHorizontalTextDirection::Default;
1961 if ( !bBidiDontCare )
1962 {
1963 SvxFrameDirection eCellDir = rAttrSet.Get( ATTR_WRITINGDIR ).GetValue();
1964 if ( eCellDir == SvxFrameDirection::Environment )
1965 eBidiDir = GetViewData().GetDocument().
1966 GetEditTextDirection( GetViewData().GetTabNo() );
1967 else if ( eCellDir == SvxFrameDirection::Horizontal_RL_TB )
1968 eBidiDir = EEHorizontalTextDirection::R2L;
1969 else
1970 eBidiDir = EEHorizontalTextDirection::L2R;
1971 }
1972
1973 bool bDisableCTLFont = !SvtCTLOptions().IsCTLFontEnabled();
1974 bool bDisableVerticalText = !SvtCJKOptions::IsVerticalTextEnabled();
1975
1976 SfxWhichIter aIter( rSet );
1977 sal_uInt16 nWhich = aIter.FirstWhich();
1978 while( nWhich )
1979 {
1980 switch( nWhich )
1981 {
1982 case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
1983 case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
1984 if ( bDisableVerticalText )
1985 rSet.DisableItem( nWhich );
1986 else
1987 {
1988 if( bVertDontCare )
1989 rSet.InvalidateItem( nWhich );
1990 else if ( nWhich == SID_TEXTDIRECTION_LEFT_TO_RIGHT )
1991 rSet.Put( SfxBoolItem( nWhich, bLeftRight ) );
1992 else
1993 rSet.Put( SfxBoolItem( nWhich, bTopBottom ) );
1994 }
1995 break;
1996
1997 case SID_ATTR_PARA_LEFT_TO_RIGHT:
1998 case SID_ATTR_PARA_RIGHT_TO_LEFT:
1999 if ( bDisableCTLFont )
2000 rSet.DisableItem( nWhich );
2001 else
2002 {
2003 if ( bTopBottom )
2004 rSet.DisableItem( nWhich );
2005 else if ( bBidiDontCare )
2006 rSet.InvalidateItem( nWhich );
2007 else if ( nWhich == SID_ATTR_PARA_LEFT_TO_RIGHT )
2008 rSet.Put( SfxBoolItem( nWhich, eBidiDir == EEHorizontalTextDirection::L2R ) );
2009 else
2010 rSet.Put( SfxBoolItem( nWhich, eBidiDir == EEHorizontalTextDirection::R2L ) );
2011 }
2012 }
2013 nWhich = aIter.NextWhich();
2014 }
2015}
2016
2018{
2019 ScViewFunc* pView = rViewData.GetView();
2020 if ( pView->HasPaintBrush() )
2021 {
2022 // cancel paintbrush mode
2023 pView->ResetBrushDocument();
2024 }
2025 else
2026 {
2027 bool bLock = false;
2028 const SfxItemSet *pArgs = rReq.GetArgs();
2029 if( pArgs && pArgs->Count() >= 1 )
2030 bLock = pArgs->Get(SID_FORMATPAINTBRUSH).GetValue();
2031
2032 // in case of multi selection, deselect all and use the cursor position
2033 ScRange aDummy;
2034 if ( rViewData.GetSimpleArea(aDummy) != SC_MARK_SIMPLE )
2035 pView->Unmark();
2036
2038 pView->CopyToClip( pBrushDoc.get(), false, true );
2039 pView->SetBrushDocument( std::move(pBrushDoc), bLock );
2040 }
2041}
2042
2044{
2046 rSet.DisableItem( SID_FORMATPAINTBRUSH );
2047 else
2048 rSet.Put( SfxBoolItem( SID_FORMATPAINTBRUSH, rViewData.GetView()->HasPaintBrush() ) );
2049}
2050
2052{
2053 SvNumFormatType nType = SvNumFormatType::ALL;
2055 ScMarkData aMark(GetViewData().GetMarkData());
2056 const SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
2057 if (!pFormatter)
2058 return nType;
2059
2060 // TODO: Find out how to get a selected table range in case multiple tables
2061 // are selected. Currently we only check for the current active table.
2062
2063 if ( aMark.IsMarked() || aMark.IsMultiMarked() )
2064 {
2065 aMark.MarkToMulti();
2066 const ScRange& aRange = aMark.GetMultiMarkArea();
2067 const ScMultiSel& rMultiSel = aMark.GetMultiSelData();
2068
2069 SvNumFormatType nComboType = SvNumFormatType::ALL;
2070 bool bFirstItem = true;
2071 for (SCCOL nCol = aRange.aStart.Col(); nCol <= aRange.aEnd.Col(); ++nCol)
2072 {
2073 if (!rMultiSel.HasMarks(nCol))
2074 continue;
2075
2076 SCROW nRow1, nRow2;
2077 ScMultiSelIter aMultiIter(rMultiSel, nCol);
2078 while (aMultiIter.Next(nRow1, nRow2))
2079 {
2080 ScRange aColRange(nCol, nRow1, aRange.aStart.Tab());
2081 aColRange.aEnd.SetRow(nRow2);
2082 sal_uInt32 nNumFmt = rDoc.GetNumberFormat(aColRange);
2083 SvNumFormatType nThisType = pFormatter->GetType(nNumFmt);
2084 if (bFirstItem)
2085 {
2086 bFirstItem = false;
2087 nComboType = nThisType;
2088 }
2089 else if (nComboType != nThisType)
2090 // mixed number format type.
2091 return SvNumFormatType::ALL;
2092 }
2093 }
2094 nType = nComboType;
2095 }
2096 else
2097 {
2098 sal_uInt32 nNumFmt = rDoc.GetNumberFormat( rViewData.GetCurX(), rViewData.GetCurY(),
2100 nType = pFormatter->GetType( nNumFmt );
2101 }
2102 return nType;
2103}
2104
2105/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define GetWhich(nSlot)
sal_uInt16 GetValue() const
const OUString & GetValue() const
SCTAB Tab() const
Definition: address.hxx:283
void SetRow(SCROW nRowP)
Definition: address.hxx:287
SCCOL Col() const
Definition: address.hxx:279
const ScDocument & GetDocument() const
Definition: docsh.hxx:220
SC_DLLPUBLIC sal_uInt32 GetNumberFormat(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:3689
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6181
SC_DLLPUBLIC void ApplySelectionPattern(const ScPatternAttr &rAttr, const ScMarkData &rMark, ScEditDataArray *pDataArray=nullptr, bool *pIsChanged=nullptr)
Definition: document.cxx:5995
void SetPreviewSelection(const ScMarkData &rSel)
Definition: documen2.cxx:1483
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
Definition: document.cxx:6186
void SetPreviewCellStyle(ScStyleSheet *pStyle)
Definition: document.hxx:1395
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:467
void SetPreviewFont(std::unique_ptr< SfxItemSet > pFontSet)
Definition: documen2.cxx:1478
const ScMarkData & GetPreviewSelection() const
Definition: document.hxx:1391
ScStyleSheet * GetPreviewCellStyle()
Definition: document.hxx:1393
bool IsUndoEnabled() const
Definition: document.hxx:1594
const ScPatternAttr * GetSelectionPattern(const ScMarkData &rMark)
Definition: document.cxx:5186
void GetTextAttrState(SfxItemSet &rSet)
Definition: formatsh.cxx:1481
virtual ~ScFormatShell() override
Definition: formatsh.cxx:144
void GetAttrState(SfxItemSet &rSet)
Definition: formatsh.cxx:1261
void ExecFormatPaintbrush(const SfxRequest &rReq)
Definition: formatsh.cxx:2017
void ExecuteAlignment(SfxRequest &rReq)
Definition: formatsh.cxx:567
void ExecuteTextDirection(const SfxRequest &rReq)
Definition: formatsh.cxx:1906
ScViewData & GetViewData()
Definition: formatsh.hxx:34
void ExecuteNumFormat(SfxRequest &rReq)
Definition: formatsh.cxx:248
void GetNumFormatState(SfxItemSet &rSet)
Definition: formatsh.cxx:1719
void GetTextDirectionState(SfxItemSet &rSet)
Definition: formatsh.cxx:1946
void ExecuteStyle(SfxRequest &rReq)
Definition: formatsh.cxx:148
void ExecuteTextAttr(SfxRequest &rReq)
Definition: formatsh.cxx:660
ScFormatShell(ScViewData &rData)
Definition: formatsh.cxx:128
void GetBorderState(SfxItemSet &rSet)
Definition: formatsh.cxx:1656
void GetAlignState(SfxItemSet &rSet)
Definition: formatsh.cxx:1670
SvNumFormatType GetCurrentNumberFormatType()
Definition: formatsh.cxx:2051
void StateFormatPaintbrush(SfxItemSet &rSet)
Definition: formatsh.cxx:2043
void ExecuteAttr(SfxRequest &rReq)
Definition: formatsh.cxx:901
ScViewData & rViewData
Definition: formatsh.hxx:31
static SC_DLLPUBLIC LanguageType eLnge
Definition: global.hxx:559
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
const ScRange & GetMultiMarkArea() const
Definition: markdata.hxx:84
bool IsMultiMarked() const
Definition: markdata.hxx:81
const ScMultiSel & GetMultiSelData() const
Definition: markdata.hxx:106
void MarkToMulti()
Definition: markdata.cxx:209
bool IsMarked() const
Definition: markdata.hxx:80
void SetMarkArea(const ScRange &rRange)
Definition: markdata.cxx:92
SC_DLLPUBLIC void InputEnterHandler(ScEnterMode nBlockMode=ScEnterMode::NORMAL, bool bBeforeSavingInLOK=false)
Definition: scmod.cxx:1408
bool Next(SCROW &rTop, SCROW &rBottom)
Definition: markmulti.cxx:455
bool HasMarks(SCCOL nCol) const
Definition: markmulti.cxx:65
void SetStyleSheet(ScStyleSheet *pNewStyle, bool bClearDirectFormat=true)
Definition: patattr.cxx:1212
SfxItemSet & GetItemSet()
Definition: patattr.hxx:155
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
Definition: patattr.hxx:72
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
void UpdateInputHandler(bool bForce=false, bool bStopEditing=true)
Definition: tabvwsha.cxx:674
void UpdateInputHandlerCellAdjust(SvxCellHorJustify eJust)
Definition: tabvwsha.cxx:771
void ExecuteCellFormatDlg(SfxRequest &rReq, const OString &rTabPage)
Definition: tabvwsha.cxx:528
::editeng::SvxBorderLine * GetDefaultFrameLine() const
Definition: tabvwsh.hxx:246
void SetDefaultFrameLine(const ::editeng::SvxBorderLine *pLine)
Definition: tabvwsh8.cxx:25
void ResetBrushDocument()
Definition: tabview5.cxx:651
void SetBrushDocument(ScDocumentUniquePtr pNew, bool bLock)
Definition: tabview5.cxx:631
void Unmark()
Definition: tabview3.cxx:1744
void HideListBox()
Definition: tabview3.cxx:2993
bool HasPaintBrush() const
Definition: tabview.hxx:594
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3141
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:354
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:357
ScMarkType GetSimpleArea(SCCOL &rStartCol, SCROW &rStartRow, SCTAB &rStartTab, SCCOL &rEndCol, SCROW &rEndRow, SCTAB &rEndTab) const
Definition: viewdata.cxx:1181
ScDBFunc * GetView() const
Definition: viewdata.cxx:863
ScSplitPos GetActivePart() const
Definition: viewdata.hxx:398
SfxObjectShell * GetSfxDocShell() const
Definition: viewdata.hxx:358
SfxBindings & GetBindings()
Definition: viewdata.cxx:3129
bool HasEditView(ScSplitPos eWhich) const
Definition: viewdata.hxx:582
SCROW GetCurY() const
Definition: viewdata.hxx:402
SCCOL GetCurX() const
Definition: viewdata.hxx:401
void SetNumFmtByStr(const OUString &rCode)
Definition: viewfunc.cxx:2763
void ApplyUserItemSet(const SfxItemSet &rItemSet)
Definition: viewfunc.cxx:1383
void SetSelectionFrameLines(const ::editeng::SvxBorderLine *pLine, bool bColorOnly)
Definition: viewfun2.cxx:3358
void SetNumberFormat(SvNumFormatType nFormatType, sal_uLong nAdd=0)
Definition: viewfunc.cxx:2729
SvtScriptType GetSelectionScriptType()
Definition: viewfunc.cxx:881
void ApplySelectionPattern(const ScPatternAttr &rAttr, bool bCursorOnly=false)
Definition: viewfunc.cxx:1214
SC_DLLPUBLIC const ScPatternAttr * GetSelectionPattern()
Definition: viewfunc.cxx:907
void UpdateSelectionArea(const ScMarkData &rSel, ScPatternAttr *pAttr=nullptr)
Definition: viewfunc.cxx:3106
bool AdjustBlockHeight(bool bPaint=true, ScMarkData *pMarkData=nullptr)
Definition: viewfun2.cxx:115
void ChangeNumFmtDecimals(bool bIncrement)
Definition: viewfunc.cxx:2810
void GetSelectionFrame(std::shared_ptr< SvxBoxItem > &rLineOuter, std::shared_ptr< SvxBoxInfoItem > &rLineInner)
Definition: viewfunc.cxx:933
void ApplyAttr(const SfxPoolItem &rAttrItem, bool bAdjustBlockHeight=true)
Definition: viewfunc.cxx:1076
SC_DLLPUBLIC bool CopyToClip(ScDocument *pClipDoc, bool bCut, bool bApi=false, bool bIncludeObjects=false, bool bStopEdit=true)
Definition: viewfun3.cxx:168
void ApplyAttributes(const SfxItemSet *pDialogSet, const SfxItemSet *pOldSet, bool bAdjustBlockHeight=true)
Definition: viewfunc.cxx:964
static void UnmarkFiltered(ScMarkData &rMark, const ScDocument &rDoc)
Definition: viewutil.cxx:223
static void PutItemScript(SfxItemSet &rShellSet, const SfxItemSet &rCoreSet, sal_uInt16 nWhichId, SvtScriptType nScript)
Definition: viewutil.cxx:50
void Update(sal_uInt16 nId)
void Invalidate(sal_uInt16 nId)
void SetValue(bool const bTheValue)
static SfxClassificationPolicyType stringToPolicyType(std::u16string_view rType)
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
SfxItemPool * GetPool() const
sal_uInt16 Count() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void DisableItem(sal_uInt16 nWhich)
void InvalidateItem(sal_uInt16 nWhich)
css::uno::Reference< css::document::XDocumentProperties > getDocProperties() const
sal_uInt16 Which() const
void SetWhich(sal_uInt16 nId)
sal_uInt16 GetSlot() const
const SfxItemSet * GetArgs() const
void SetSlot(sal_uInt16 nNewSlot)
void AppendItem(const SfxPoolItem &)
bool IsDone() const
bool IsAPI() const
void Done(bool bRemove=false)
void SetUndoManager(SfxUndoManager *pNewUndoMgr)
SfxItemPool & GetPool() const
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
virtual SfxInterface * GetInterface() const
virtual void Invalidate(sal_uInt16 nId=0)
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
virtual SfxUndoManager * GetUndoManager()
SfxViewShell * GetViewShell() const
void SetPool(SfxItemPool *pNewPool)
void SetName(const OUString &rName)
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All) const
void SetMaxUndoActionCount(size_t nMaxUndoActionCount)
SfxBindings & GetBindings()
SfxViewFrame & GetViewFrame() const
virtual void libreOfficeKitViewCallback(int nType, const char *pPayload) const override
sal_uInt16 FirstWhich()
sal_uInt16 NextWhich()
OUString GenerateFormat(sal_uInt32 nIndex, LanguageType eLnge=LANGUAGE_DONTKNOW, bool bThousand=false, bool IsRed=false, sal_uInt16 nPrecision=0, sal_uInt16 nLeadingCnt=1)
NfIndexTableOffset GetIndexTableOffset(sal_uInt32 nFormat) const
SvNumFormatType GetType(sal_uInt32 nFIndex) const
const SvNumberformat * GetEntry(sal_uInt32 nKey) const
bool IsNatNum12(sal_uInt32 nFIndex) const
void GetFormatSpecialInfo(sal_uInt32 nFormat, bool &bThousand, bool &IsRed, sal_uInt16 &nPrecision, sal_uInt16 &nLeadingCnt)
SvNumFormatType GetMaskedType() const
sal_uInt16 GetFormatIntegerDigits(sal_uInt16 nIx=0) const
LanguageType GetLanguage() const
SvNumFormatType GetType() const
bool IsCTLFontEnabled() const
const editeng::SvxBorderLine * GetHori() const
const editeng::SvxBorderLine * GetVert() const
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxInfoItemLine nLine)
const editeng::SvxBorderLine * GetTop() const
const editeng::SvxBorderLine * GetRight() const
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
const editeng::SvxBorderLine * GetLeft() const
const editeng::SvxBorderLine * GetBottom() const
const Color & GetColor() const
void SetColor(const Color &rCol)
const Color & GetValue() const
sal_uInt32 GetHeight() const
void SetHeight(sal_uInt32 nNewHeight, const sal_uInt16 nNewProp=100, MapUnit eUnit=MapUnit::MapRelative)
void SetLine(const editeng::SvxBorderLine *pNew)
void PutItemForScriptType(SvtScriptType nScriptType, const SfxPoolItem &rItem)
const SfxPoolItem * GetItemOfScript(SvtScriptType nScript) const
virtual SvxScriptSetItem * Clone(SfxItemPool *pPool=nullptr) const override
FontLineStyle GetLineStyle() const
void SetColor(const Color &rCol)
void SetLineStyle(FontLineStyle eNew)
void SetWidth(tools::Long nWidth)
void SetColor(const Color &rColor)
sal_uInt16 GetOutWidth() const
void SetBorderLineStyle(SvxBorderLineStyle nNew)
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
int nCount
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
Definition: document.hxx:2721
@ SCDOCMODE_CLIP
Definition: document.hxx:257
float u
EEHorizontalTextDirection
Any aHelper
DocumentType eType
FontLineStyle
LINESTYLE_SINGLE
LINESTYLE_DOUBLE
LINESTYLE_NONE
LINESTYLE_DOTTED
FontItalic
ITALIC_NORMAL
ITALIC_NONE
WEIGHT_BOLD
WEIGHT_NORMAL
SvxFrameDirection
@ SC_INPUT_TABLE
Definition: global.hxx:362
#define LANGUAGE_DONTKNOW
SvtScriptType
#define SAL_WARN(area, stream)
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
bool IsVerticalTextEnabled()
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
FontWeight
#define SFX_OBJECTBAR_OBJECT
const char GetValue[]
SfxItemState
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:398
constexpr TypedWhichId< SvxFontHeightItem > ATTR_FONT_HEIGHT(101)
constexpr TypedWhichId< SfxBoolItem > ATTR_VERTICAL_ASIAN(137)
constexpr TypedWhichId< SvxPostureItem > ATTR_FONT_POSTURE(103)
constexpr TypedWhichId< SvxWeightItem > ATTR_FONT_WEIGHT(102)
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_TLBR(141)
constexpr TypedWhichId< SvxBrushItem > ATTR_BACKGROUND(148)
constexpr TypedWhichId< SvxShadowItem > ATTR_SHADOW(152)
constexpr TypedWhichId< SvxLanguageItem > ATTR_LANGUAGE_FORMAT(147)
constexpr TypedWhichId< SvxHorJustifyItem > ATTR_HOR_JUSTIFY(129)
constexpr TypedWhichId< SvxBoxInfoItem > ATTR_BORDER_INNER(151)
constexpr TypedWhichId< SvxBoxItem > ATTR_BORDER(150)
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
constexpr TypedWhichId< SvxFrameDirectionItem > ATTR_WRITINGDIR(138)
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_BLTR(142)
constexpr TypedWhichId< ScVerticalStackCell > ATTR_STACKED(134)
constexpr TypedWhichId< SvxVerJustifyItem > ATTR_VER_JUSTIFY(132)
constexpr TypedWhichId< SvxFontItem > ATTR_FONT(100)
constexpr TypedWhichId< ScProtectionAttr > ATTR_PROTECTION(149)
constexpr TypedWhichId< ScLineBreakCell > ATTR_LINEBREAK(139)
constexpr TypedWhichId< SvxUnderlineItem > ATTR_FONT_UNDERLINE(104)
#define SC_MOD()
Definition: scmod.hxx:249
static SfxItemSet & rSet
#define SFX_IMPL_INTERFACE(Class, SuperClass)
SfxStyleFamily
SvxCellHorJustify
SvxCellVerJustify
const sal_uInt32 nFontInc
const sal_uInt32 nFontMaxSz
sal_uInt16 sal_Unicode
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
@ SC_MARK_SIMPLE
Definition: viewdata.hxx:65
SvNumFormatType
#define SV_COUNTRY_LANGUAGE_OFFSET
NfIndexTableOffset
NF_NUMBER_1000DEC2