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 SfxUInt16Item *>(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 aBrushItem.setComplexColor(rNewColorItem.getComplexColor());
1229
1230 pTabViewShell->ApplyAttr( aBrushItem, false );
1231 }
1232 break;
1233
1234 case SID_ATTR_BRUSH:
1235 {
1236 SvxBrushItem aBrushItem( pTabViewShell->GetSelectionPattern()->
1238 const SvxBrushItem& rNewBrushItem = static_cast<const SvxBrushItem&>(
1239 pNewAttrs->Get( GetPool().GetWhich(nSlot) ) );
1240 aBrushItem.SetColor(rNewBrushItem.GetColor());
1241 aBrushItem.setComplexColor(rNewBrushItem.getComplexColor());
1242 pTabViewShell->ApplyAttr( aBrushItem );
1243 }
1244 break;
1245
1246 case SID_ATTR_BORDER_SHADOW:
1247 {
1248 const SvxShadowItem& rNewShadowItem =
1249 pNewAttrs->Get( ATTR_SHADOW );
1250 pTabViewShell->ApplyAttr( rNewShadowItem );
1251 }
1252 break;
1253
1254 default:
1255 break;
1256 }
1257
1258 if( ! rReq.IsAPI() && ! rReq.IsDone() )
1259 rReq.Done();
1260 }
1261}
1262
1264{
1265 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
1266 const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
1267 const SvxBrushItem& rBrushItem = rAttrSet.Get( ATTR_BACKGROUND );
1268 SfxWhichIter aIter( rSet );
1269 sal_uInt16 nWhich = aIter.FirstWhich();
1270
1271 rSet.Put( rAttrSet, false );
1272
1273 // choose font info according to selection script type
1274 SvtScriptType nScript = SvtScriptType::NONE; // GetSelectionScriptType never returns 0
1275 if ( rSet.GetItemState( ATTR_FONT ) != SfxItemState::UNKNOWN )
1276 {
1277 nScript = pTabViewShell->GetSelectionScriptType();
1278 ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT, nScript );
1279 }
1280 if ( rSet.GetItemState( ATTR_FONT_HEIGHT ) != SfxItemState::UNKNOWN )
1281 {
1282 if (nScript == SvtScriptType::NONE) nScript = pTabViewShell->GetSelectionScriptType();
1283 ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT_HEIGHT, nScript );
1284 }
1285
1286 while ( nWhich )
1287 {
1288 switch(nWhich)
1289 {
1290 case SID_BACKGROUND_COLOR:
1291 {
1292 rSet.Put( SvxColorItem( rBrushItem.GetColor(), SID_BACKGROUND_COLOR ) );
1293 if(SfxItemState::DONTCARE == rAttrSet.GetItemState(ATTR_BACKGROUND))
1294 {
1295 rSet.InvalidateItem(SID_BACKGROUND_COLOR);
1296 }
1297 }
1298 break;
1299 case SID_FRAME_LINESTYLE:
1300 case SID_FRAME_LINECOLOR:
1301 {
1302 // handled together because both need the cell border information for decisions
1303 Color aCol;
1304 editeng::SvxBorderLine aLine(nullptr,0,SvxBorderLineStyle::SOLID);
1305 bool bCol = false;
1306 bool bColDisable = false, bStyleDisable = false;
1307 std::shared_ptr<SvxBoxItem> aBoxItem(std::make_shared<SvxBoxItem>(ATTR_BORDER));
1308 std::shared_ptr<SvxBoxInfoItem> aInfoItem(std::make_shared<SvxBoxInfoItem>(ATTR_BORDER_INNER));
1309
1310 pTabViewShell->GetSelectionFrame(aBoxItem, aInfoItem);
1311
1312 if( aBoxItem->GetTop() )
1313 {
1314 bCol = true;
1315 aCol = aBoxItem->GetTop()->GetColor() ;
1316 aLine.SetColor(aCol);
1317 aLine.SetWidth( aBoxItem->GetTop()->GetWidth());
1318 aLine.SetBorderLineStyle( aBoxItem->GetTop()->GetBorderLineStyle());
1319 }
1320
1321 if( aBoxItem->GetBottom() )
1322 {
1323 if(!bCol)
1324 {
1325 bCol = true;
1326 aCol = aBoxItem->GetBottom()->GetColor() ;
1327 aLine.SetColor(aCol);
1328 aLine.SetWidth( aBoxItem->GetBottom()->GetWidth());
1329 aLine.SetBorderLineStyle( aBoxItem->GetBottom()->GetBorderLineStyle());
1330 }
1331 else
1332 {
1333 if(aCol != aBoxItem->GetBottom()->GetColor() )
1334 bColDisable = true;
1335 if( aLine != *aBoxItem->GetBottom() )
1336 bStyleDisable = true;
1337 }
1338 }
1339
1340 if( aBoxItem->GetLeft() )
1341 {
1342 if(!bCol)
1343 {
1344 bCol = true;
1345 aCol = aBoxItem->GetLeft()->GetColor() ;
1346 aLine.SetColor(aCol);
1347 aLine.SetWidth( aBoxItem->GetLeft()->GetWidth());
1348 aLine.SetBorderLineStyle( aBoxItem->GetLeft()->GetBorderLineStyle());
1349 }
1350 else
1351 {
1352 if(aCol != aBoxItem->GetLeft()->GetColor() )
1353 bColDisable = true;
1354 if( aLine != *aBoxItem->GetLeft() )
1355 bStyleDisable = true;
1356 }
1357 }
1358
1359 if( aBoxItem->GetRight() )
1360 {
1361 if(!bCol)
1362 {
1363 bCol = true;
1364 aCol = aBoxItem->GetRight()->GetColor() ;
1365 aLine.SetColor(aCol);
1366 aLine.SetWidth( aBoxItem->GetRight()->GetWidth());
1367 aLine.SetBorderLineStyle( aBoxItem->GetRight()->GetBorderLineStyle());
1368 }
1369 else
1370 {
1371 if(aCol != aBoxItem->GetRight()->GetColor() )
1372 bColDisable = true;
1373 if( aLine != *aBoxItem->GetRight() )
1374 bStyleDisable = true;
1375 }
1376 }
1377
1378 if( aInfoItem->GetVert())
1379 {
1380 if(!bCol)
1381 {
1382 bCol = true;
1383 aCol = aInfoItem->GetVert()->GetColor() ;
1384 aLine.SetColor(aCol);
1385 aLine.SetWidth( aInfoItem->GetVert()->GetWidth());
1386 aLine.SetBorderLineStyle( aInfoItem->GetVert()->GetBorderLineStyle());
1387 }
1388 else
1389 {
1390 if(aCol != aInfoItem->GetVert()->GetColor() )
1391 bColDisable = true;
1392 if( aLine != *aInfoItem->GetVert() )
1393 bStyleDisable = true;
1394 }
1395 }
1396
1397 if( aInfoItem->GetHori())
1398 {
1399 if(!bCol)
1400 {
1401 bCol = true;
1402 aCol = aInfoItem->GetHori()->GetColor() ;
1403 aLine.SetColor(aCol);
1404 aLine.SetWidth( aInfoItem->GetHori()->GetWidth());
1405 aLine.SetBorderLineStyle( aInfoItem->GetHori()->GetBorderLineStyle());
1406 }
1407 else
1408 {
1409 if(aCol != aInfoItem->GetHori()->GetColor() )
1410 bColDisable = true;
1411 if( aLine != *aInfoItem->GetHori() )
1412 bStyleDisable = true;
1413 }
1414 }
1415
1416 if( !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::VERT )
1417 || !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::HORI )
1418 || !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::LEFT )
1419 || !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::RIGHT )
1420 || !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::TOP )
1421 || !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::BOTTOM ) )
1422 {
1423 bColDisable = true;
1424 bStyleDisable = true;
1425 }
1426
1427 if(SID_FRAME_LINECOLOR == nWhich)
1428 {
1429 if(bColDisable) // if different lines have different colors
1430 {
1431 aCol = COL_TRANSPARENT;
1432 rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) );
1433 rSet.InvalidateItem(SID_FRAME_LINECOLOR);
1434 }
1435 else if (!bCol) // if no line available
1436 {
1437 aCol = COL_AUTO;
1438 rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) );
1439 }
1440 else
1441 rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) );
1442 }
1443 else // if( nWhich == SID_FRAME_LINESTYLE)
1444 {
1445 if(bStyleDisable) // if have several lines but don't have same style
1446 {
1447 aLine.SetWidth( 1 );
1448 SvxLineItem aItem(SID_FRAME_LINESTYLE);
1449 aItem.SetLine(&aLine);
1450 rSet.Put( aItem );
1451 rSet.InvalidateItem(SID_FRAME_LINESTYLE);
1452 }
1453 else // all the lines have same style or no line available, use initial value (0,0,0,0)
1454 {
1455 SvxLineItem aItem(SID_FRAME_LINESTYLE);
1456 aItem.SetLine(&aLine);
1457 rSet.Put( aItem );
1458 }
1459 }
1460 }
1461 break;
1462 case SID_ATTR_BRUSH:
1463 {
1464 rSet.Put( rBrushItem.CloneSetWhich(GetPool().GetWhich(nWhich)) );
1465 }
1466 break;
1467 case SID_SCATTR_CELLPROTECTION:
1468 {
1469 bool bProtect = rAttrSet.Get( ATTR_PROTECTION ).GetProtection();
1470 rSet.Put( SfxBoolItem(SID_SCATTR_CELLPROTECTION, bProtect) );
1471 }
1472 break;
1473 }
1474 nWhich = aIter.NextWhich();
1475 }
1476
1477 // stuff for sidebar panels
1478 Invalidate(SID_ATTR_ALIGN_DEGREES);
1479 Invalidate(SID_ATTR_ALIGN_LOCKPOS);
1480 Invalidate(SID_ATTR_ALIGN_STACKED);
1481}
1482
1484{
1485 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
1486 const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
1487 rSet.Put( rAttrSet, false ); // Include ItemStates in copy
1488
1489 // choose font info according to selection script type
1490 SvtScriptType nScript = SvtScriptType::NONE; // GetSelectionScriptType never returns 0
1491 if ( rSet.GetItemState( ATTR_FONT_WEIGHT ) != SfxItemState::UNKNOWN )
1492 {
1493 nScript = pTabViewShell->GetSelectionScriptType();
1494 ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT_WEIGHT, nScript );
1495 }
1496 if ( rSet.GetItemState( ATTR_FONT_POSTURE ) != SfxItemState::UNKNOWN )
1497 {
1498 if (nScript == SvtScriptType::NONE) nScript = pTabViewShell->GetSelectionScriptType();
1499 ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT_POSTURE, nScript );
1500 }
1501
1502 SfxItemState eState;
1503
1504 // own control on radio button functionality:
1505
1506 // underline
1507
1508 eState = rAttrSet.GetItemState( ATTR_FONT_UNDERLINE );
1509 if ( eState == SfxItemState::DONTCARE )
1510 {
1511 rSet.InvalidateItem( SID_ULINE_VAL_NONE );
1512 rSet.InvalidateItem( SID_ULINE_VAL_SINGLE );
1513 rSet.InvalidateItem( SID_ULINE_VAL_DOUBLE );
1514 rSet.InvalidateItem( SID_ULINE_VAL_DOTTED );
1515 }
1516 else
1517 {
1518 FontLineStyle eUnderline =
1519 rAttrSet.Get(ATTR_FONT_UNDERLINE).GetLineStyle();
1520 rSet.Put(SfxBoolItem(SID_ULINE_VAL_SINGLE, eUnderline == LINESTYLE_SINGLE));
1521 rSet.Put(SfxBoolItem(SID_ULINE_VAL_DOUBLE, eUnderline == LINESTYLE_DOUBLE));
1522 rSet.Put(SfxBoolItem(SID_ULINE_VAL_DOTTED, eUnderline == LINESTYLE_DOTTED));
1523 rSet.Put(SfxBoolItem(SID_ULINE_VAL_NONE, eUnderline == LINESTYLE_NONE));
1524 }
1525
1526 // horizontal alignment
1527
1528 const SvxHorJustifyItem* pHorJustify = nullptr;
1529 const SvxVerJustifyItem* pVerJustify = nullptr;
1530 SvxCellVerJustify eVerJustify = SvxCellVerJustify::Standard;
1531 sal_uInt16 nWhich = 0;
1532 bool bJustifyStd = false;
1533 SfxBoolItem aBoolItem ( 0, true );
1534
1535 eState = rAttrSet.GetItemState( ATTR_HOR_JUSTIFY, true,
1536 reinterpret_cast<const SfxPoolItem**>(&pHorJustify) );
1537 switch ( eState )
1538 {
1539 case SfxItemState::SET:
1540 {
1541 switch ( pHorJustify->GetValue() )
1542 {
1543 case SvxCellHorJustify::Standard:
1544 break;
1545
1546 case SvxCellHorJustify::Left:
1547 nWhich = SID_ALIGNLEFT;
1548 break;
1549
1550 case SvxCellHorJustify::Right:
1551 nWhich = SID_ALIGNRIGHT;
1552 break;
1553
1554 case SvxCellHorJustify::Center:
1555 nWhich = SID_ALIGNCENTERHOR;
1556 break;
1557
1558 case SvxCellHorJustify::Block:
1559 nWhich = SID_ALIGNBLOCK;
1560 break;
1561
1562 case SvxCellHorJustify::Repeat:
1563 default:
1564 bJustifyStd = true;
1565 break;
1566 }
1567 }
1568 break;
1569
1570 case SfxItemState::DONTCARE:
1571 rSet.InvalidateItem( SID_ALIGNLEFT );
1572 rSet.InvalidateItem( SID_ALIGNRIGHT );
1573 rSet.InvalidateItem( SID_ALIGNCENTERHOR );
1574 rSet.InvalidateItem( SID_ALIGNBLOCK );
1575 break;
1576
1577 default:
1578 bJustifyStd = true;
1579 break;
1580 }
1581
1582 if ( nWhich )
1583 {
1584 aBoolItem.SetWhich( nWhich );
1585 rSet.Put( aBoolItem );
1586 }
1587 else if ( bJustifyStd )
1588 {
1589 aBoolItem.SetValue( false );
1590 aBoolItem.SetWhich( SID_ALIGNLEFT ); rSet.Put( aBoolItem );
1591 aBoolItem.SetWhich( SID_ALIGNRIGHT ); rSet.Put( aBoolItem );
1592 aBoolItem.SetWhich( SID_ALIGNCENTERHOR ); rSet.Put( aBoolItem );
1593 aBoolItem.SetWhich( SID_ALIGNBLOCK ); rSet.Put( aBoolItem );
1594 bJustifyStd = false;
1595 }
1596
1597 // vertical alignment
1598
1599 nWhich = 0;
1600 aBoolItem.SetValue( true );
1601
1602 eState = rAttrSet.GetItemState( ATTR_VER_JUSTIFY, true,
1603 reinterpret_cast<const SfxPoolItem**>(&pVerJustify) );
1604
1605 switch ( eState )
1606 {
1607 case SfxItemState::SET:
1608 {
1609 eVerJustify = pVerJustify->GetValue();
1610
1611 switch ( eVerJustify )
1612 {
1613 case SvxCellVerJustify::Top:
1614 nWhich = SID_ALIGNTOP;
1615 break;
1616
1617 case SvxCellVerJustify::Bottom:
1618 nWhich = SID_ALIGNBOTTOM;
1619 break;
1620
1621 case SvxCellVerJustify::Center:
1622 nWhich = SID_ALIGNCENTERVER;
1623 break;
1624
1625 case SvxCellVerJustify::Standard:
1626 default:
1627 bJustifyStd = true;
1628 break;
1629 }
1630 }
1631 break;
1632
1633 case SfxItemState::DONTCARE:
1634 rSet.InvalidateItem( SID_ALIGNTOP );
1635 rSet.InvalidateItem( SID_ALIGNBOTTOM );
1636 rSet.InvalidateItem( SID_ALIGNCENTERVER );
1637 break;
1638
1639 default:
1640 bJustifyStd = true;
1641 break;
1642 }
1643
1644 if ( nWhich )
1645 {
1646 aBoolItem.SetWhich( nWhich );
1647 rSet.Put( aBoolItem );
1648 }
1649 else if ( bJustifyStd )
1650 {
1651 aBoolItem.SetValue( false );
1652 aBoolItem.SetWhich( SID_ALIGNTOP ); rSet.Put( aBoolItem );
1653 aBoolItem.SetWhich( SID_ALIGNBOTTOM ); rSet.Put( aBoolItem );
1654 aBoolItem.SetWhich( SID_ALIGNCENTERVER ); rSet.Put( aBoolItem );
1655 }
1656}
1657
1659{
1660 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
1661 std::shared_ptr<SvxBoxItem> aBoxItem(std::make_shared<SvxBoxItem>(ATTR_BORDER));
1662 std::shared_ptr<SvxBoxInfoItem> aInfoItem(std::make_shared<SvxBoxInfoItem>(ATTR_BORDER_INNER));
1663
1664 pTabViewShell->GetSelectionFrame( aBoxItem, aInfoItem );
1665
1666 if ( rSet.GetItemState( ATTR_BORDER ) != SfxItemState::UNKNOWN )
1667 rSet.Put( *aBoxItem );
1668 if ( rSet.GetItemState( ATTR_BORDER_INNER ) != SfxItemState::UNKNOWN )
1669 rSet.Put( *aInfoItem );
1670}
1671
1673{
1674 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
1675 const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
1676 SfxWhichIter aIter(rSet);
1677 sal_uInt16 nWhich = aIter.FirstWhich();
1678
1679 SvxCellHorJustify eHAlign = SvxCellHorJustify::Standard;
1680 bool bHasHAlign = rAttrSet.GetItemState( ATTR_HOR_JUSTIFY ) != SfxItemState::DONTCARE;
1681 if( bHasHAlign )
1682 eHAlign = rAttrSet.Get( ATTR_HOR_JUSTIFY ).GetValue();
1683
1684 SvxCellVerJustify eVAlign = SvxCellVerJustify::Standard;
1685 bool bHasVAlign = rAttrSet.GetItemState( ATTR_VER_JUSTIFY ) != SfxItemState::DONTCARE;
1686 if( bHasVAlign )
1687 eVAlign = rAttrSet.Get( ATTR_VER_JUSTIFY ).GetValue();
1688
1689 while ( nWhich )
1690 {
1691 switch ( nWhich )
1692 {
1693 case SID_H_ALIGNCELL:
1694 if ( bHasHAlign )
1695 rSet.Put( SvxHorJustifyItem( eHAlign, nWhich ));
1696 break;
1697 case SID_V_ALIGNCELL:
1698 if ( bHasVAlign )
1699 rSet.Put( SvxVerJustifyItem( eVAlign, nWhich ));
1700 break;
1701
1702 // pseudo slots for Format menu
1703 case SID_ALIGN_ANY_HDEFAULT:
1704 case SID_ALIGN_ANY_LEFT:
1705 case SID_ALIGN_ANY_HCENTER:
1706 case SID_ALIGN_ANY_RIGHT:
1707 case SID_ALIGN_ANY_JUSTIFIED:
1708 rSet.Put( SfxBoolItem( nWhich, bHasHAlign && (eHAlign == lclConvertSlotToHAlign( nWhich )) ) );
1709 break;
1710 case SID_ALIGN_ANY_VDEFAULT:
1711 case SID_ALIGN_ANY_TOP:
1712 case SID_ALIGN_ANY_VCENTER:
1713 case SID_ALIGN_ANY_BOTTOM:
1714 rSet.Put( SfxBoolItem( nWhich, bHasVAlign && (eVAlign == lclConvertSlotToVAlign( nWhich )) ) );
1715 break;
1716 }
1717 nWhich = aIter.NextWhich();
1718 }
1719}
1720
1722{
1723 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
1725 const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
1726 const SfxItemState eItemState = rAttrSet.GetItemState( ATTR_VALUE_FORMAT );
1727 sal_uInt32 nNumberFormat = rAttrSet.Get(ATTR_VALUE_FORMAT).GetValue();
1728 SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
1729 // If item state is default or set it
1730 // indicates one number format so we
1731 // don't have to iterate over all
1732 // selected cells' attribute ranges to
1733 // determine selected types.
1734 // Does *NOT* include the
1735 // SvNumFormatType::DEFINED bit.
1736 const SvNumFormatType nType = (eItemState >= SfxItemState::DEFAULT ? pFormatter->GetType( nNumberFormat) :
1738 NfIndexTableOffset nOffset = pFormatter->GetIndexTableOffset(nNumberFormat);
1739
1740 SfxWhichIter aIter(rSet);
1741 sal_uInt16 nWhich = aIter.FirstWhich();
1742
1743 while ( nWhich )
1744 {
1745 switch ( nWhich )
1746 {
1747 case SID_NUMBER_THOUSANDS:
1748 {
1749 bool bEnable = (SfxItemState::DONTCARE != eItemState);
1750 if (bEnable)
1751 {
1752 bEnable = ((nType != SvNumFormatType::ALL) && (nType &
1753 (SvNumFormatType::NUMBER |
1754 SvNumFormatType::PERCENT |
1755 SvNumFormatType::CURRENCY |
1756 SvNumFormatType::FRACTION)));
1757 if (bEnable)
1758 {
1759 bool bThousand( false );
1760 bool bNegRed( false );
1761 sal_uInt16 nPrecision( 0 );
1762 sal_uInt16 nLeadZeroes( 0 );
1763 pFormatter->GetFormatSpecialInfo( nNumberFormat, bThousand, bNegRed, nPrecision, nLeadZeroes);
1764 rSet.Put( SfxBoolItem( nWhich, bThousand));
1765 }
1766 }
1767 if (!bEnable)
1768 {
1769 rSet.DisableItem( nWhich );
1770 }
1771 }
1772 break;
1773 case SID_NUMBER_FORMAT:
1774 // symphony version with format interpretation
1775 {
1776 if(SfxItemState::DONTCARE != eItemState)
1777 {
1778 bool bThousand(false);
1779 bool bNegRed(false);
1780 sal_uInt16 nPrecision(0);
1781 sal_uInt16 nLeadZeroes(0);
1782
1783 pFormatter->GetFormatSpecialInfo(nNumberFormat,bThousand, bNegRed, nPrecision, nLeadZeroes);
1784
1785 const SvNumberformat* pFormatEntry = pFormatter->GetEntry( nNumberFormat );
1786 if (pFormatEntry && (pFormatEntry->GetType() & SvNumFormatType::SCIENTIFIC))
1787 {
1788 // if scientific, bThousand is used for engineering notation
1789 const sal_uInt16 nIntegerDigits = pFormatEntry->GetFormatIntegerDigits();
1790 bThousand = nIntegerDigits > 0 && ((nIntegerDigits % 3) == 0);
1791 }
1792 OUString aFormat;
1793 static constexpr OUStringLiteral sBreak = u",";
1794 const OUString sThousand = OUString::number(static_cast<sal_Int32>(bThousand));
1795 const OUString sNegRed = OUString::number(static_cast<sal_Int32>(bNegRed));
1796 const OUString sPrecision = OUString::number(nPrecision);
1797 const OUString sLeadZeroes = OUString::number(nLeadZeroes);
1798 const OUString sNatNum12 = OUString::number( static_cast< sal_Int32 >( pFormatter->IsNatNum12( nNumberFormat ) ) );
1799
1800 aFormat += sThousand +
1801 sBreak +
1802 sNegRed +
1803 sBreak +
1804 sPrecision +
1805 sBreak +
1806 sLeadZeroes +
1807 sBreak +
1808 sNatNum12 +
1809 sBreak;
1810
1811 rSet.Put(SfxStringItem(nWhich, aFormat));
1812
1814 {
1815 OUString sPayload = ".uno:NumberFormat=" + aFormat;
1816 GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
1817 OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US));
1818 }
1819 }
1820 else
1821 {
1822 rSet.InvalidateItem( nWhich );
1823 }
1824 }
1825 break;
1826
1827 case SID_NUMBER_TYPE_FORMAT:
1828 {
1829 sal_Int16 nFormatCategory = -1;
1830 if ( eItemState >= SfxItemState::DEFAULT ) //Modify for more robust
1831 {
1832 switch(nType)
1833 {
1834 case SvNumFormatType::NUMBER:
1835 // Determine if General format.
1836 if ((nNumberFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0)
1837 nFormatCategory = 0;
1838 else
1839 nFormatCategory = 1;
1840 break;
1841 case SvNumFormatType::PERCENT:
1842 nFormatCategory = 2;
1843 break;
1844 case SvNumFormatType::CURRENCY:
1845 nFormatCategory = 3;
1846 break;
1847 case SvNumFormatType::DATE:
1848 //Add
1849 case SvNumFormatType::DATETIME:
1850 nFormatCategory = 4;
1851 break;
1852 case SvNumFormatType::TIME:
1853 nFormatCategory = 5;
1854 break;
1855 case SvNumFormatType::SCIENTIFIC:
1856 nFormatCategory = 6;
1857 break;
1858 case SvNumFormatType::FRACTION:
1859 nFormatCategory = 7;
1860 break;
1861 case SvNumFormatType::LOGICAL:
1862 nFormatCategory = 8;
1863 break;
1864 case SvNumFormatType::TEXT:
1865 nFormatCategory = 9;
1866 break;
1867 default:
1868 nFormatCategory = -1; //for more robust
1869 }
1870 if( nFormatCategory == -1 )
1871 rSet.InvalidateItem( nWhich );
1872 else
1873 rSet.Put( SfxUInt16Item( nWhich, nFormatCategory ) );
1874 }
1875 else
1876 {
1877 rSet.InvalidateItem( nWhich );
1878 }
1879
1880 }
1881 break;
1882 case SID_NUMBER_CURRENCY:
1883 rSet.Put( SfxBoolItem(nWhich, bool(nType & SvNumFormatType::CURRENCY)) );
1884 break;
1885 case SID_NUMBER_SCIENTIFIC:
1886 rSet.Put( SfxBoolItem(nWhich, bool(nType & SvNumFormatType::SCIENTIFIC)) );
1887 break;
1888 case SID_NUMBER_DATE:
1889 rSet.Put( SfxBoolItem(nWhich, bool(nType & SvNumFormatType::DATE)) );
1890 break;
1891 case SID_NUMBER_PERCENT:
1892 rSet.Put( SfxBoolItem(nWhich, bool(nType & SvNumFormatType::PERCENT)) );
1893 break;
1894 case SID_NUMBER_TIME:
1895 rSet.Put( SfxBoolItem(nWhich, bool(nType & SvNumFormatType::TIME)) );
1896 break;
1897 case SID_NUMBER_TWODEC:
1898 rSet.Put( SfxBoolItem(nWhich, (nType & SvNumFormatType::NUMBER) && nOffset == NF_NUMBER_1000DEC2 ) );
1899 break;
1900 case SID_NUMBER_STANDARD:
1901 rSet.Put( SfxBoolItem(nWhich, (nType & SvNumFormatType::NUMBER) && (nNumberFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0) );
1902 break;
1903 }
1904 nWhich = aIter.NextWhich();
1905 }
1906}
1907
1909{
1910 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
1911 pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox
1912 bool bEditMode = false;
1913 if ( GetViewData().HasEditView( GetViewData().GetActivePart() ) )
1914 {
1915 bEditMode=true;
1916 SC_MOD()->InputEnterHandler();
1917 pTabViewShell->UpdateInputHandler();
1918 }
1919 sal_uInt16 nSlot = rReq.GetSlot();
1920 switch( nSlot )
1921 {
1922 case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
1923 case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
1924 {
1925 bool bVert = (nSlot == SID_TEXTDIRECTION_TOP_TO_BOTTOM);
1926 ScPatternAttr aAttr( GetViewData().GetDocument().GetPool() );
1927 SfxItemSet& rItemSet = aAttr.GetItemSet();
1928 rItemSet.Put( ScVerticalStackCell( bVert ) );
1929 rItemSet.Put( SfxBoolItem( ATTR_VERTICAL_ASIAN, bVert ) );
1930 pTabViewShell->ApplySelectionPattern( aAttr );
1931 pTabViewShell->AdjustBlockHeight();
1932 }
1933 break;
1934
1935 case SID_ATTR_PARA_LEFT_TO_RIGHT:
1936 case SID_ATTR_PARA_RIGHT_TO_LEFT:
1937 {
1938 SvxFrameDirection eDirection = ( nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT ) ?
1939 SvxFrameDirection::Horizontal_LR_TB : SvxFrameDirection::Horizontal_RL_TB;
1940 pTabViewShell->ApplyAttr( SvxFrameDirectionItem( eDirection, ATTR_WRITINGDIR ) );
1941 }
1942 break;
1943 }
1944 if (bEditMode)
1945 SC_MOD()->SetInputMode( SC_INPUT_TABLE );
1946}
1947
1949{
1950 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
1951 const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
1952
1953 bool bVertDontCare =
1954 (rAttrSet.GetItemState( ATTR_VERTICAL_ASIAN ) == SfxItemState::DONTCARE) ||
1955 (rAttrSet.GetItemState( ATTR_STACKED ) == SfxItemState::DONTCARE);
1956 bool bLeftRight = !bVertDontCare &&
1957 !rAttrSet.Get( ATTR_STACKED ).GetValue();
1958 bool bTopBottom = !bVertDontCare && !bLeftRight &&
1959 rAttrSet.Get( ATTR_VERTICAL_ASIAN ).GetValue();
1960
1961 bool bBidiDontCare = (rAttrSet.GetItemState( ATTR_WRITINGDIR ) == SfxItemState::DONTCARE);
1962 EEHorizontalTextDirection eBidiDir = EEHorizontalTextDirection::Default;
1963 if ( !bBidiDontCare )
1964 {
1965 SvxFrameDirection eCellDir = rAttrSet.Get( ATTR_WRITINGDIR ).GetValue();
1966 if ( eCellDir == SvxFrameDirection::Environment )
1967 eBidiDir = GetViewData().GetDocument().
1968 GetEditTextDirection( GetViewData().GetTabNo() );
1969 else if ( eCellDir == SvxFrameDirection::Horizontal_RL_TB )
1970 eBidiDir = EEHorizontalTextDirection::R2L;
1971 else
1972 eBidiDir = EEHorizontalTextDirection::L2R;
1973 }
1974
1975 bool bDisableCTLFont = !SvtCTLOptions::IsCTLFontEnabled();
1976 bool bDisableVerticalText = !SvtCJKOptions::IsVerticalTextEnabled();
1977
1978 SfxWhichIter aIter( rSet );
1979 sal_uInt16 nWhich = aIter.FirstWhich();
1980 while( nWhich )
1981 {
1982 switch( nWhich )
1983 {
1984 case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
1985 case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
1986 if ( bDisableVerticalText )
1987 rSet.DisableItem( nWhich );
1988 else
1989 {
1990 if( bVertDontCare )
1991 rSet.InvalidateItem( nWhich );
1992 else if ( nWhich == SID_TEXTDIRECTION_LEFT_TO_RIGHT )
1993 rSet.Put( SfxBoolItem( nWhich, bLeftRight ) );
1994 else
1995 rSet.Put( SfxBoolItem( nWhich, bTopBottom ) );
1996 }
1997 break;
1998
1999 case SID_ATTR_PARA_LEFT_TO_RIGHT:
2000 case SID_ATTR_PARA_RIGHT_TO_LEFT:
2001 if ( bDisableCTLFont )
2002 rSet.DisableItem( nWhich );
2003 else
2004 {
2005 if ( bTopBottom )
2006 rSet.DisableItem( nWhich );
2007 else if ( bBidiDontCare )
2008 rSet.InvalidateItem( nWhich );
2009 else if ( nWhich == SID_ATTR_PARA_LEFT_TO_RIGHT )
2010 rSet.Put( SfxBoolItem( nWhich, eBidiDir == EEHorizontalTextDirection::L2R ) );
2011 else
2012 rSet.Put( SfxBoolItem( nWhich, eBidiDir == EEHorizontalTextDirection::R2L ) );
2013 }
2014 }
2015 nWhich = aIter.NextWhich();
2016 }
2017}
2018
2020{
2021 ScViewFunc* pView = rViewData.GetView();
2022 if ( pView->HasPaintBrush() )
2023 {
2024 // cancel paintbrush mode
2025 pView->ResetBrushDocument();
2026 }
2027 else
2028 {
2029 bool bLock = false;
2030 const SfxItemSet *pArgs = rReq.GetArgs();
2031 if( pArgs && pArgs->Count() >= 1 )
2032 bLock = pArgs->Get(SID_FORMATPAINTBRUSH).GetValue();
2033
2034 // in case of multi selection, deselect all and use the cursor position
2035 ScRange aDummy;
2036 if ( rViewData.GetSimpleArea(aDummy) != SC_MARK_SIMPLE )
2037 pView->Unmark();
2038
2040 pView->CopyToClip( pBrushDoc.get(), false, true );
2041 pView->SetBrushDocument( std::move(pBrushDoc), bLock );
2042 }
2043}
2044
2046{
2048 rSet.DisableItem( SID_FORMATPAINTBRUSH );
2049 else
2050 rSet.Put( SfxBoolItem( SID_FORMATPAINTBRUSH, rViewData.GetView()->HasPaintBrush() ) );
2051}
2052
2054{
2055 SvNumFormatType nType = SvNumFormatType::ALL;
2057 ScMarkData aMark(GetViewData().GetMarkData());
2058 const SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
2059 if (!pFormatter)
2060 return nType;
2061
2062 // TODO: Find out how to get a selected table range in case multiple tables
2063 // are selected. Currently we only check for the current active table.
2064
2065 if ( aMark.IsMarked() || aMark.IsMultiMarked() )
2066 {
2067 aMark.MarkToMulti();
2068 const ScRange& aRange = aMark.GetMultiMarkArea();
2069 const ScMultiSel& rMultiSel = aMark.GetMultiSelData();
2070
2071 SvNumFormatType nComboType = SvNumFormatType::ALL;
2072 bool bFirstItem = true;
2073 for (SCCOL nCol = aRange.aStart.Col(); nCol <= aRange.aEnd.Col(); ++nCol)
2074 {
2075 if (!rMultiSel.HasMarks(nCol))
2076 continue;
2077
2078 SCROW nRow1, nRow2;
2079 ScMultiSelIter aMultiIter(rMultiSel, nCol);
2080 while (aMultiIter.Next(nRow1, nRow2))
2081 {
2082 ScRange aColRange(nCol, nRow1, aRange.aStart.Tab());
2083 aColRange.aEnd.SetRow(nRow2);
2084 sal_uInt32 nNumFmt = rDoc.GetNumberFormat(aColRange);
2085 SvNumFormatType nThisType = pFormatter->GetType(nNumFmt);
2086 if (bFirstItem)
2087 {
2088 bFirstItem = false;
2089 nComboType = nThisType;
2090 }
2091 else if (nComboType != nThisType)
2092 // mixed number format type.
2093 return SvNumFormatType::ALL;
2094 }
2095 }
2096 nType = nComboType;
2097 }
2098 else
2099 {
2100 sal_uInt32 nNumFmt = rDoc.GetNumberFormat( rViewData.GetCurX(), rViewData.GetCurY(),
2102 nType = pFormatter->GetType( nNumFmt );
2103 }
2104 return nType;
2105}
2106
2107/* 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:219
SC_DLLPUBLIC sal_uInt32 GetNumberFormat(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:3640
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6050
SC_DLLPUBLIC void ApplySelectionPattern(const ScPatternAttr &rAttr, const ScMarkData &rMark, ScEditDataArray *pDataArray=nullptr, bool *pIsChanged=nullptr)
Definition: document.cxx:5864
void SetPreviewSelection(const ScMarkData &rSel)
Definition: documen2.cxx:1473
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
Definition: document.cxx:6055
void SetPreviewCellStyle(ScStyleSheet *pStyle)
Definition: document.hxx:1396
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:467
void SetPreviewFont(std::unique_ptr< SfxItemSet > pFontSet)
Definition: documen2.cxx:1468
const ScMarkData & GetPreviewSelection() const
Definition: document.hxx:1392
ScStyleSheet * GetPreviewCellStyle()
Definition: document.hxx:1394
bool IsUndoEnabled() const
Definition: document.hxx:1595
const ScPatternAttr * GetSelectionPattern(const ScMarkData &rMark)
Definition: document.cxx:5058
void GetTextAttrState(SfxItemSet &rSet)
Definition: formatsh.cxx:1483
virtual ~ScFormatShell() override
Definition: formatsh.cxx:144
void GetAttrState(SfxItemSet &rSet)
Definition: formatsh.cxx:1263
void ExecFormatPaintbrush(const SfxRequest &rReq)
Definition: formatsh.cxx:2019
void ExecuteAlignment(SfxRequest &rReq)
Definition: formatsh.cxx:567
void ExecuteTextDirection(const SfxRequest &rReq)
Definition: formatsh.cxx:1908
ScViewData & GetViewData()
Definition: formatsh.hxx:34
void ExecuteNumFormat(SfxRequest &rReq)
Definition: formatsh.cxx:248
void GetNumFormatState(SfxItemSet &rSet)
Definition: formatsh.cxx:1721
void GetTextDirectionState(SfxItemSet &rSet)
Definition: formatsh.cxx:1948
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:1658
void GetAlignState(SfxItemSet &rSet)
Definition: formatsh.cxx:1672
SvNumFormatType GetCurrentNumberFormatType()
Definition: formatsh.cxx:2053
void StateFormatPaintbrush(SfxItemSet &rSet)
Definition: formatsh.cxx:2045
void ExecuteAttr(SfxRequest &rReq)
Definition: formatsh.cxx:901
ScViewData & rViewData
Definition: formatsh.hxx:31
static SC_DLLPUBLIC LanguageType eLnge
Definition: global.hxx:560
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:1411
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:1306
SfxItemSet & GetItemSet()
Definition: patattr.hxx:192
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
Definition: patattr.hxx:73
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
void UpdateInputHandler(bool bForce=false, bool bStopEditing=true)
Definition: tabvwsha.cxx:690
void ExecuteCellFormatDlg(SfxRequest &rReq, const OUString &rTabPage)
Definition: tabvwsha.cxx:538
void UpdateInputHandlerCellAdjust(SvxCellHorJustify eJust)
Definition: tabvwsha.cxx:787
::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:2996
bool HasPaintBrush() const
Definition: tabview.hxx:598
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3146
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:1182
ScDBFunc * GetView() const
Definition: viewdata.cxx:864
ScSplitPos GetActivePart() const
Definition: viewdata.hxx:398
SfxObjectShell * GetSfxDocShell() const
Definition: viewdata.hxx:358
SfxBindings & GetBindings()
Definition: viewdata.cxx:3134
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:2776
void ApplyUserItemSet(const SfxItemSet &rItemSet)
Definition: viewfunc.cxx:1396
void SetSelectionFrameLines(const ::editeng::SvxBorderLine *pLine, bool bColorOnly)
Definition: viewfun2.cxx:3356
void SetNumberFormat(SvNumFormatType nFormatType, sal_uLong nAdd=0)
Definition: viewfunc.cxx:2742
SvtScriptType GetSelectionScriptType()
Definition: viewfunc.cxx:883
void ApplySelectionPattern(const ScPatternAttr &rAttr, bool bCursorOnly=false)
Definition: viewfunc.cxx:1227
SC_DLLPUBLIC const ScPatternAttr * GetSelectionPattern()
Definition: viewfunc.cxx:911
void UpdateSelectionArea(const ScMarkData &rSel, ScPatternAttr *pAttr=nullptr)
Definition: viewfunc.cxx:3119
bool AdjustBlockHeight(bool bPaint=true, ScMarkData *pMarkData=nullptr)
Definition: viewfun2.cxx:115
void ChangeNumFmtDecimals(bool bIncrement)
Definition: viewfunc.cxx:2823
void GetSelectionFrame(std::shared_ptr< SvxBoxItem > &rLineOuter, std::shared_ptr< SvxBoxInfoItem > &rLineInner)
Definition: viewfunc.cxx:943
void ApplyAttr(const SfxPoolItem &rAttrItem, bool bAdjustBlockHeight=true)
Definition: viewfunc.cxx:1086
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:974
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)
void SetMaxUndoActionCount(size_t nMaxUndoActionCount)
SfxBindings & GetBindings()
virtual void libreOfficeKitViewCallback(int nType, const OString &pPayload) const override
SfxViewFrame & GetViewFrame() const
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
static bool IsCTLFontEnabled()
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
void setComplexColor(model::ComplexColor const &rComplexColor)
const Color & GetColor() const
void SetColor(const Color &rCol)
const model::ComplexColor & getComplexColor() const
const Color & GetValue() const
model::ComplexColor const & getComplexColor() 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 &rColor)
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:2720
@ 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:363
#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:247
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