1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <scitems.hxx>
22 #include <svl/slstitm.hxx>
23 #include <svl/stritem.hxx>
24 #include <svl/whiter.hxx>
25 #include <svtools/cliplistener.hxx>
26 #include <svtools/insdlg.hxx>
27 #include <sot/formats.hxx>
28 #include <svx/hlnkitem.hxx>
29 #include <sfx2/bindings.hxx>
30 #include <sfx2/childwin.hxx>
31 #include <sfx2/objface.hxx>
32 #include <sfx2/request.hxx>
33 #include <sfx2/viewfrm.hxx>
34 #include <vcl/EnumContext.hxx>
35 #include <vcl/svapp.hxx>
36 #include <svx/clipfmtitem.hxx>
37 #include <svx/statusitem.hxx>
43 #include <tabvwsh.hxx>
44 #include <formulacell.hxx>
46 #include <globstr.hrc>
47 #include <scresid.hxx>
48 #include <transobj.hxx>
49 #include <drwtrans.hxx>
50 #include <scabstdlg.hxx>
52 #include <cliputil.hxx>
53 #include <clipparam.hxx>
54 #include <markdata.hxx>
55 #include <gridwin.hxx>
57 #define ShellClass_ScCellShell
58 #define ShellClass_CellMovement
59 #include <scslots.hxx>
62 SFX_IMPL_INTERFACE(ScCellShell
, ScFormatShell
)
64 void ScCellShell::InitInterface_Impl()
66 GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT
,
67 SfxVisibilityFlags::Standard
| SfxVisibilityFlags::Server
,
68 ToolbarId::Objectbar_Format
);
70 GetStaticInterface()->RegisterPopupMenu(u
"cell"_ustr
);
73 ScCellShell::ScCellShell(ScViewData
& rData
, const VclPtr
<vcl::Window
>& frameWin
) :
75 pImpl( new CellShell_Impl() ),
76 bPastePossible(false),
79 SetName(u
"Cell"_ustr
);
80 SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Cell
));
83 ScCellShell::~ScCellShell()
85 if ( pImpl
->m_xClipEvtLstnr
.is() )
87 pImpl
->m_xClipEvtLstnr
->RemoveListener( GetViewData().GetActiveWin() );
89 // The listener may just now be waiting for the SolarMutex and call the link
90 // afterwards, in spite of RemoveListener. So the link has to be reset, too.
91 pImpl
->m_xClipEvtLstnr
->ClearCallbackLink();
93 pImpl
->m_xClipEvtLstnr
.clear();
96 pImpl
->m_pLinkedDlg
.disposeAndClear();
97 delete pImpl
->m_pRequest
;
100 void ScCellShell::GetBlockState( SfxItemSet
& rSet
)
102 ScTabViewShell
* pTabViewShell
= GetViewData().GetViewShell();
104 ScMarkType eMarkType
= GetViewData().GetSimpleArea( aMarkRange
);
105 bool bSimpleArea
= (eMarkType
== SC_MARK_SIMPLE
);
106 bool bOnlyNotBecauseOfMatrix
;
107 bool bEditable
= pTabViewShell
->SelectionEditable( &bOnlyNotBecauseOfMatrix
);
108 ScDocument
& rDoc
= GetViewData().GetDocument();
109 ScDocShell
* pDocShell
= GetViewData().GetDocShell();
110 ScMarkData
& rMark
= GetViewData().GetMarkData();
113 nCol1
= aMarkRange
.aStart
.Col();
114 nRow1
= aMarkRange
.aStart
.Row();
115 nCol2
= aMarkRange
.aEnd
.Col();
116 nRow2
= aMarkRange
.aEnd
.Row();
117 SCTAB nTab
= GetViewData().GetTabNo();
119 SfxWhichIter
aIter(rSet
);
120 sal_uInt16 nWhich
= aIter
.FirstWhich();
123 bool bDisable
= false;
124 bool bNeedEdit
= true; // need selection be editable?
127 case FID_FILL_TO_BOTTOM
: // fill to top / bottom
129 bDisable
= !bSimpleArea
|| (nRow1
== 0 && nRow2
== 0);
130 if (!bDisable
&& GetViewData().SelectionForbidsCellFill())
132 if ( !bDisable
&& bEditable
)
133 { // do not damage matrix
134 bDisable
= rDoc
.HasSelectedBlockMatrixFragment(
135 nCol1
, nRow1
, nCol2
, nRow1
, rMark
); // first row
139 case FID_FILL_TO_TOP
:
141 bDisable
= (!bSimpleArea
) || (nRow1
== rDoc
.MaxRow() && nRow2
== rDoc
.MaxRow());
142 if (!bDisable
&& GetViewData().SelectionForbidsCellFill())
144 if ( !bDisable
&& bEditable
)
145 { // do not damage matrix
146 bDisable
= rDoc
.HasSelectedBlockMatrixFragment(
147 nCol1
, nRow2
, nCol2
, nRow2
, rMark
); // last row
151 case FID_FILL_TO_RIGHT
: // fill to left / right
153 bDisable
= !bSimpleArea
|| (nCol1
== 0 && nCol2
== 0);
154 if (!bDisable
&& GetViewData().SelectionForbidsCellFill())
156 if ( !bDisable
&& bEditable
)
157 { // do not damage matrix
158 bDisable
= rDoc
.HasSelectedBlockMatrixFragment(
159 nCol1
, nRow1
, nCol1
, nRow2
, rMark
); // first column
163 case FID_FILL_TO_LEFT
:
165 bDisable
= (!bSimpleArea
) || (nCol1
== rDoc
.MaxCol() && nCol2
== rDoc
.MaxCol());
166 if (!bDisable
&& GetViewData().SelectionForbidsCellFill())
168 if ( !bDisable
&& bEditable
)
169 { // do not damage matrix
170 bDisable
= rDoc
.HasSelectedBlockMatrixFragment(
171 nCol2
, nRow1
, nCol2
, nRow2
, rMark
); // last column
176 case SID_RANDOM_NUMBER_GENERATOR_DIALOG
:
177 bDisable
= !bSimpleArea
|| GetViewData().SelectionForbidsCellFill();
179 case SID_SAMPLING_DIALOG
:
180 case SID_DESCRIPTIVE_STATISTICS_DIALOG
:
181 case SID_ANALYSIS_OF_VARIANCE_DIALOG
:
182 case SID_CORRELATION_DIALOG
:
183 case SID_COVARIANCE_DIALOG
:
184 case SID_INSERT_SPARKLINE
:
186 bDisable
= !bSimpleArea
;
189 case SID_GROUP_SPARKLINES
:
190 case SID_UNGROUP_SPARKLINES
:
192 bDisable
= !bSimpleArea
;
196 case SID_EDIT_SPARKLINE
:
198 bDisable
= !rDoc
.HasSparkline(GetViewData().GetCurPos());
202 case SID_DELETE_SPARKLINE
:
203 case SID_EDIT_SPARKLINE_GROUP
:
204 case SID_DELETE_SPARKLINE_GROUP
:
206 bDisable
= !rDoc
.HasOneSparklineGroup(ScRange(nCol1
, nRow1
, nTab
, nCol2
, nRow2
, nTab
));
210 case FID_FILL_SERIES
: // fill block
211 case SID_OPENDLG_TABOP
: // multiple-cell operations, are at least 2 cells marked?
212 if (rDoc
.GetChangeTrack()!=nullptr &&nWhich
==SID_OPENDLG_TABOP
)
215 bDisable
= (!bSimpleArea
) || (nCol1
== nCol2
&& nRow1
== nRow2
);
217 if (!bDisable
&& GetViewData().SelectionForbidsCellFill())
220 if ( !bDisable
&& bEditable
&& nWhich
== FID_FILL_SERIES
)
221 { // do not damage matrix
222 bDisable
= rDoc
.HasSelectedBlockMatrixFragment(
223 nCol1
, nRow1
, nCol2
, nRow1
, rMark
) // first row
224 || rDoc
.HasSelectedBlockMatrixFragment(
225 nCol1
, nRow2
, nCol2
, nRow2
, rMark
) // last row
226 || rDoc
.HasSelectedBlockMatrixFragment(
227 nCol1
, nRow1
, nCol1
, nRow2
, rMark
) // first column
228 || rDoc
.HasSelectedBlockMatrixFragment(
229 nCol2
, nRow1
, nCol2
, nRow2
, rMark
); // last column
232 case FID_FILL_SINGLE_EDIT
:
237 bDisable
= !bSimpleArea
|| GetObjectShell()->isContentExtractionLocked();
239 case FID_INS_CELL
: // insert cells, just simple selection
240 bDisable
= (!bSimpleArea
);
244 case SID_PASTE_SPECIAL
:
245 case SID_PASTE_UNFORMATTED
:
246 case SID_PASTE_ONLY_VALUE
:
247 case SID_PASTE_ONLY_TEXT
:
248 case SID_PASTE_ONLY_FORMULA
:
249 case SID_PASTE_TRANSPOSED
:
250 case SID_PASTE_AS_LINK
:
251 case SID_PASTE_TEXTIMPORT_DIALOG
:
252 bDisable
= GetViewData().SelectionForbidsPaste();
256 case FID_INS_ROWS_BEFORE
: // insert rows
257 case FID_INS_ROWS_AFTER
:
259 sc::EditAction eAction
= sc::EditAction::InsertRowsBefore
;
260 if (nWhich
== FID_INS_ROWS_AFTER
)
261 eAction
= sc::EditAction::InsertRowsAfter
;
263 bDisable
= (!bSimpleArea
) || GetViewData().SimpleColMarked();
264 if (!bEditable
&& nCol1
== 0 && nCol2
== rDoc
.MaxCol())
266 // See if row insertions are allowed.
267 bEditable
= rDoc
.IsEditActionAllowed(eAction
, rMark
, nCol1
, nRow1
, nCol2
, nRow2
);
271 case FID_INS_CELLSDOWN
:
272 bDisable
= (!bSimpleArea
) || GetViewData().SimpleColMarked();
276 case FID_INS_COLUMNS_BEFORE
: // insert columns
277 case FID_INS_COLUMNS_AFTER
:
279 sc::EditAction eAction
= sc::EditAction::InsertColumnsBefore
;
280 if (nWhich
== FID_INS_COLUMNS_AFTER
)
281 eAction
= sc::EditAction::InsertColumnsAfter
;
283 bDisable
= (!bSimpleArea
&& eMarkType
!= SC_MARK_SIMPLE_FILTERED
)
284 || GetViewData().SimpleRowMarked();
285 if (!bEditable
&& nRow1
== 0 && nRow2
== rDoc
.MaxRow())
287 // See if row insertions are allowed.
288 bEditable
= rDoc
.IsEditActionAllowed(eAction
, rMark
, nCol1
, nRow1
, nCol2
, nRow2
);
292 case FID_INS_CELLSRIGHT
:
293 bDisable
= (!bSimpleArea
) || GetViewData().SimpleRowMarked();
296 case SID_COPY
: // copy
297 case SID_COPY_HYPERLINK_LOCATION
:
298 // not editable because of matrix only? Do not damage matrix
299 //! is not called, when protected AND matrix, we will have
300 //! to live with this... is caught in Copy-Routine, otherwise
301 //! work is to be done once more
302 if ( bEditable
|| !bOnlyNotBecauseOfMatrix
)
303 bNeedEdit
= false; // allowed when protected/ReadOnly
304 bDisable
= GetObjectShell()->isContentExtractionLocked();
307 case SID_AUTOFORMAT
: // Autoformat, at least 3x3 selected
308 bDisable
= (!bSimpleArea
)
309 || ((nCol2
- nCol1
) < 2) || ((nRow2
- nRow1
) < 2);
312 case SID_CELL_FORMAT_RESET
:
313 case FID_CELL_FORMAT
:
314 case SID_ENABLE_HYPHENATION
:
315 // not editable because of matrix only? Attribute ok nonetheless
316 if ( !bEditable
&& bOnlyNotBecauseOfMatrix
)
320 case FID_CURRENTVALIDATION
:
323 if ( pDocShell
&& pDocShell
->IsDocShared() )
329 case SID_TRANSLITERATE_HALFWIDTH
:
330 case SID_TRANSLITERATE_FULLWIDTH
:
331 case SID_TRANSLITERATE_HIRAGANA
:
332 case SID_TRANSLITERATE_KATAKANA
:
333 ScViewUtil::HideDisabledSlot( rSet
, GetViewData().GetBindings(), nWhich
);
335 case SID_CONVERT_FORMULA_TO_VALUE
:
337 // Check and see if the marked range has at least one formula cell.
338 bDisable
= !rDoc
.HasFormulaCell(aMarkRange
);
342 if (!bDisable
&& bNeedEdit
&& !bEditable
)
346 rSet
.DisableItem(nWhich
);
347 else if (nWhich
== SID_ENABLE_HYPHENATION
)
349 // toggle slots need a bool item
350 rSet
.Put( SfxBoolItem( nWhich
, false ) );
352 nWhich
= aIter
.NextWhich();
356 // functions, disabled depending on cursor position
358 // SID_INSERT_POSTIT, SID_CHARMAP, SID_OPENDLG_FUNCTION
360 void ScCellShell::GetCellState( SfxItemSet
& rSet
)
362 ScDocShell
* pDocShell
= GetViewData().GetDocShell();
363 ScDocument
& rDoc
= GetViewData().GetDocShell()->GetDocument();
364 ScAddress
aCursor( GetViewData().GetCurX(), GetViewData().GetCurY(),
365 GetViewData().GetTabNo() );
366 SfxWhichIter
aIter(rSet
);
367 sal_uInt16 nWhich
= aIter
.FirstWhich();
370 bool bDisable
= false;
371 bool bNeedEdit
= true; // need cursor position be editable?
376 CellType eType
= rDoc
.GetCellType( aCursor
);
377 bDisable
= ( eType
!= CELLTYPE_STRING
&& eType
!= CELLTYPE_EDIT
);
380 // test for available languages
381 LanguageType nLang
= ScViewUtil::GetEffLanguage( rDoc
, aCursor
);
382 bDisable
= !ScModule::HasThesaurusLanguage( nLang
);
386 case SID_OPENDLG_FUNCTION
:
388 ScMarkData aMarkData
= GetViewData().GetMarkData();
389 aMarkData
.MarkToSimple();
390 const ScRange
& aRange
= aMarkData
.GetMarkArea();
391 if(aMarkData
.IsMarked())
393 if (!rDoc
.IsBlockEditable( aCursor
.Tab(), aRange
.aStart
.Col(),aRange
.aStart
.Row(),
394 aRange
.aEnd
.Col(),aRange
.aEnd
.Row() ))
403 case SID_INSERT_POSTIT
:
405 ScAddress
aPos( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() );
406 if( rDoc
.GetNote(aPos
) )
413 if ( pDocShell
&& pDocShell
->IsDocShared() )
420 case SID_EDIT_POSTIT
:
422 ScAddress
aPos( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() );
423 bDisable
= rDoc
.GetNote(aPos
) == nullptr;
427 if (!bDisable
&& bNeedEdit
)
428 if (!rDoc
.IsBlockEditable( aCursor
.Tab(), aCursor
.Col(),aCursor
.Row(),
429 aCursor
.Col(),aCursor
.Row() ))
432 rSet
.DisableItem(nWhich
);
433 nWhich
= aIter
.NextWhich();
437 static bool lcl_TestFormat( SvxClipboardFormatItem
& rFormats
, const TransferableDataHelper
& rDataHelper
,
438 SotClipboardFormatId nFormatId
)
440 if ( rDataHelper
.HasFormat( nFormatId
) )
442 // translated format name strings are no longer inserted here,
443 // handled by "paste special" dialog / toolbox controller instead.
444 // Only the object type name has to be set here:
446 if ( nFormatId
== SotClipboardFormatId::EMBED_SOURCE
)
448 TransferableObjectDescriptor aDesc
;
449 if ( rDataHelper
.GetTransferableObjectDescriptor(
450 SotClipboardFormatId::OBJECTDESCRIPTOR
, aDesc
) )
451 aStrVal
= aDesc
.maTypeName
;
453 else if ( nFormatId
== SotClipboardFormatId::EMBED_SOURCE_OLE
454 || nFormatId
== SotClipboardFormatId::EMBEDDED_OBJ_OLE
)
457 SvPasteObjectHelper::GetEmbeddedName( rDataHelper
, aStrVal
, aSource
, nFormatId
);
460 if ( !aStrVal
.isEmpty() )
461 rFormats
.AddClipbrdFormat( nFormatId
, aStrVal
);
463 rFormats
.AddClipbrdFormat( nFormatId
);
471 void ScCellShell::GetPossibleClipboardFormats( SvxClipboardFormatItem
& rFormats
)
473 vcl::Window
* pWin
= GetViewData().GetActiveWin();
474 bool bDraw
= ScDrawTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(pWin
)) != nullptr;
476 TransferableDataHelper
aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pWin
) );
478 lcl_TestFormat( rFormats
, aDataHelper
, SotClipboardFormatId::DRAWING
);
479 lcl_TestFormat( rFormats
, aDataHelper
, SotClipboardFormatId::SVXB
);
480 lcl_TestFormat( rFormats
, aDataHelper
, SotClipboardFormatId::GDIMETAFILE
);
481 lcl_TestFormat( rFormats
, aDataHelper
, SotClipboardFormatId::PNG
);
482 lcl_TestFormat( rFormats
, aDataHelper
, SotClipboardFormatId::BITMAP
);
483 lcl_TestFormat( rFormats
, aDataHelper
, SotClipboardFormatId::EMBED_SOURCE
);
487 lcl_TestFormat( rFormats
, aDataHelper
, SotClipboardFormatId::LINK
);
488 lcl_TestFormat( rFormats
, aDataHelper
, SotClipboardFormatId::STRING
);
489 lcl_TestFormat( rFormats
, aDataHelper
, SotClipboardFormatId::STRING_TSVC
);
490 lcl_TestFormat( rFormats
, aDataHelper
, SotClipboardFormatId::DIF
);
491 lcl_TestFormat( rFormats
, aDataHelper
, SotClipboardFormatId::RTF
);
492 lcl_TestFormat( rFormats
, aDataHelper
, SotClipboardFormatId::RICHTEXT
);
493 lcl_TestFormat( rFormats
, aDataHelper
, SotClipboardFormatId::HTML
);
494 lcl_TestFormat( rFormats
, aDataHelper
, SotClipboardFormatId::HTML_SIMPLE
);
495 lcl_TestFormat( rFormats
, aDataHelper
, SotClipboardFormatId::BIFF_8
);
496 lcl_TestFormat( rFormats
, aDataHelper
, SotClipboardFormatId::BIFF_5
);
499 if ( !lcl_TestFormat( rFormats
, aDataHelper
, SotClipboardFormatId::EMBED_SOURCE_OLE
) )
500 lcl_TestFormat( rFormats
, aDataHelper
, SotClipboardFormatId::EMBEDDED_OBJ_OLE
);
503 // insert, insert contents
505 static bool lcl_IsCellPastePossible( const TransferableDataHelper
& rData
)
507 bool bPossible
= false;
508 css::uno::Reference
< css::datatransfer::XTransferable2
> xTransferable(rData
.GetXTransferable(), css::uno::UNO_QUERY
);
509 if ( ScTransferObj::GetOwnClipboard(xTransferable
) || ScDrawTransferObj::GetOwnClipboard(xTransferable
) )
513 if ( rData
.HasFormat( SotClipboardFormatId::PNG
) ||
514 rData
.HasFormat( SotClipboardFormatId::BITMAP
) ||
515 rData
.HasFormat( SotClipboardFormatId::GDIMETAFILE
) ||
516 rData
.HasFormat( SotClipboardFormatId::SVXB
) ||
517 rData
.HasFormat( SotClipboardFormatId::PRIVATE
) ||
518 rData
.HasFormat( SotClipboardFormatId::RTF
) ||
519 rData
.HasFormat( SotClipboardFormatId::RICHTEXT
) ||
520 rData
.HasFormat( SotClipboardFormatId::EMBED_SOURCE
) ||
521 rData
.HasFormat( SotClipboardFormatId::LINK_SOURCE
) ||
522 rData
.HasFormat( SotClipboardFormatId::EMBED_SOURCE_OLE
) ||
523 rData
.HasFormat( SotClipboardFormatId::LINK_SOURCE_OLE
) ||
524 rData
.HasFormat( SotClipboardFormatId::EMBEDDED_OBJ_OLE
) ||
525 rData
.HasFormat( SotClipboardFormatId::STRING
) ||
526 rData
.HasFormat( SotClipboardFormatId::STRING_TSVC
) ||
527 rData
.HasFormat( SotClipboardFormatId::SYLK
) ||
528 rData
.HasFormat( SotClipboardFormatId::LINK
) ||
529 rData
.HasFormat( SotClipboardFormatId::HTML
) ||
530 rData
.HasFormat( SotClipboardFormatId::HTML_SIMPLE
) ||
531 rData
.HasFormat( SotClipboardFormatId::DIF
) )
539 bool ScCellShell::HasClipboardFormat( SotClipboardFormatId nFormatId
)
541 vcl::Window
* pWin
= GetViewData().GetActiveWin();
542 TransferableDataHelper
aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pWin
));
543 return aDataHelper
.HasFormat( nFormatId
);
546 IMPL_LINK( ScCellShell
, ClipboardChanged
, TransferableDataHelper
*, pDataHelper
, void )
548 bPastePossible
= lcl_IsCellPastePossible( *pDataHelper
);
550 SfxBindings
& rBindings
= GetViewData().GetBindings();
551 rBindings
.Invalidate( SID_PASTE
);
552 rBindings
.Invalidate( SID_PASTE_SPECIAL
);
553 rBindings
.Invalidate( SID_PASTE_UNFORMATTED
);
554 rBindings
.Invalidate( SID_PASTE_ONLY_VALUE
);
555 rBindings
.Invalidate( SID_PASTE_ONLY_TEXT
);
556 rBindings
.Invalidate( SID_PASTE_ONLY_FORMULA
);
557 rBindings
.Invalidate( SID_PASTE_TRANSPOSED
);
558 rBindings
.Invalidate( SID_PASTE_AS_LINK
);
559 rBindings
.Invalidate( SID_PASTE_TEXTIMPORT_DIALOG
);
560 rBindings
.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS
);
565 bool checkDestRanges(ScViewData
& rViewData
)
568 ScMarkType eMarkType
= rViewData
.GetSimpleArea( aDummy
);
569 if (eMarkType
!= SC_MARK_MULTI
)
571 // Single destination range.
572 if (eMarkType
!= SC_MARK_SIMPLE
&& eMarkType
!= SC_MARK_SIMPLE_FILTERED
)
576 // Multiple destination ranges.
578 // Same as ScViewData::SelectionForbidsPaste() in
579 // sc/source/ui/view/viewdata.cxx but different return details.
581 vcl::Window
* pWin
= rViewData
.GetActiveWin();
585 const ScTransferObj
* pOwnClip
= ScTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(pWin
));
587 // If it's not a Calc document, we won't be picky.
590 ScDocument
* pClipDoc
= pOwnClip
->GetDocument();
594 ScRange aSrcRange
= pClipDoc
->GetClipParam().getWholeRange();
595 SCROW nRowSize
= aSrcRange
.aEnd
.Row() - aSrcRange
.aStart
.Row() + 1;
596 SCCOL nColSize
= aSrcRange
.aEnd
.Col() - aSrcRange
.aStart
.Col() + 1;
598 if (rViewData
.SelectionForbidsPaste( nColSize
, nRowSize
))
601 ScMarkData aMark
= rViewData
.GetMarkData();
603 aMark
.MarkToSimple();
604 aMark
.FillRangeListWithMarks(&aRanges
, false);
606 return ScClipUtil::CheckDestRanges(rViewData
.GetDocument(), nColSize
, nRowSize
, aMark
, aRanges
);
611 void ScCellShell::GetClipState( SfxItemSet
& rSet
)
615 // SID_PASTE_UNFORMATTED
616 // SID_CLIPBOARD_FORMAT_ITEMS
618 if ( !pImpl
->m_xClipEvtLstnr
.is() )
621 pImpl
->m_xClipEvtLstnr
= new TransferableClipboardListener( LINK( this, ScCellShell
, ClipboardChanged
) );
622 vcl::Window
* pWin
= GetViewData().GetActiveWin();
623 pImpl
->m_xClipEvtLstnr
->AddListener( pWin
);
626 TransferableDataHelper
aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pWin
) );
627 bPastePossible
= lcl_IsCellPastePossible( aDataHelper
);
630 bool bDisable
= !bPastePossible
;
632 // cell protection / multiple selection
636 SCCOL nCol
= GetViewData().GetCurX();
637 SCROW nRow
= GetViewData().GetCurY();
638 SCTAB nTab
= GetViewData().GetTabNo();
639 ScDocument
& rDoc
= GetViewData().GetDocShell()->GetDocument();
640 if (!rDoc
.IsBlockEditable( nTab
, nCol
,nRow
, nCol
,nRow
))
643 if (!bDisable
&& !checkDestRanges(GetViewData()))
649 rSet
.DisableItem( SID_PASTE
);
650 rSet
.DisableItem( SID_PASTE_SPECIAL
);
651 rSet
.DisableItem( SID_PASTE_UNFORMATTED
);
652 rSet
.DisableItem( SID_PASTE_ONLY_VALUE
);
653 rSet
.DisableItem( SID_PASTE_ONLY_TEXT
);
654 rSet
.DisableItem( SID_PASTE_ONLY_FORMULA
);
655 rSet
.DisableItem( SID_PASTE_TRANSPOSED
);
656 rSet
.DisableItem( SID_PASTE_AS_LINK
);
657 rSet
.DisableItem( SID_PASTE_TEXTIMPORT_DIALOG
);
658 rSet
.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS
);
660 else if ( rSet
.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS
) != SfxItemState::UNKNOWN
)
662 SvxClipboardFormatItem
aFormats( SID_CLIPBOARD_FORMAT_ITEMS
);
663 GetPossibleClipboardFormats( aFormats
);
664 rSet
.Put( aFormats
);
668 // only SID_HYPERLINK_GETLINK:
670 void ScCellShell::GetHLinkState( SfxItemSet
& rSet
)
672 // always return an item (or inserting will be disabled)
673 // if the cell at the cursor contains only a link, return that link
675 SvxHyperlinkItem aHLinkItem
;
676 if ( !GetViewData().GetView()->HasBookmarkAtCursor( &aHLinkItem
) )
678 // tdf#80043 - put selected text into item
679 ScViewData
& rData
= GetViewData();
680 ScDocument
& rDoc
= rData
.GetDocument();
681 SCCOL nPosX
= rData
.GetCurX();
682 SCROW nPosY
= rData
.GetCurY();
683 SCTAB nTab
= rData
.GetTabNo();
684 aHLinkItem
.SetName(rDoc
.GetString(nPosX
, nPosY
, nTab
));
687 rSet
.Put(aHLinkItem
);
690 void ScCellShell::GetState(SfxItemSet
&rSet
)
692 ScTabViewShell
* pTabViewShell
= GetViewData().GetViewShell();
693 ScDocShell
* pDocSh
= GetViewData().GetDocShell();
694 ScViewData
& rData
= GetViewData();
695 ScDocument
& rDoc
= rData
.GetDocument();
696 ScMarkData
& rMark
= rData
.GetMarkData();
697 SCCOL nPosX
= rData
.GetCurX();
698 SCROW nPosY
= rData
.GetCurY();
699 SCTAB nTab
= rData
.GetTabNo();
701 SCTAB nTabCount
= rDoc
.GetTableCount();
702 SCTAB nTabSelCount
= rMark
.GetSelectCount();
704 SfxWhichIter
aIter(rSet
);
705 sal_uInt16 nWhich
= aIter
.FirstWhich();
710 case SID_DETECTIVE_REFRESH
:
711 if (!rDoc
.HasDetectiveOperations())
712 rSet
.DisableItem( nWhich
);
715 case SID_RANGE_ADDRESS
:
718 if ( rData
.GetSimpleArea( aRange
) == SC_MARK_SIMPLE
)
720 OUString
aStr(aRange
.Format(rDoc
, ScRefFlags::VALID
| ScRefFlags::TAB_3D
));
721 rSet
.Put( SfxStringItem( nWhich
, aStr
) );
726 case SID_RANGE_NOTETEXT
:
728 // always take cursor position, do not use top-left cell of selection
730 if ( const ScPostIt
* pNote
= rDoc
.GetNote(nPosX
, nPosY
, nTab
) )
731 aNoteText
= pNote
->GetText();
732 rSet
.Put( SfxStringItem( nWhich
, aNoteText
) );
737 rSet
.Put( SfxInt32Item( SID_RANGE_ROW
, nPosY
+1 ) );
741 rSet
.Put( SfxInt16Item( SID_RANGE_COL
, nPosX
+1 ) );
744 case SID_RANGE_TABLE
:
745 rSet
.Put( SfxInt16Item( SID_RANGE_TABLE
, nTab
+1 ) );
748 case SID_RANGE_FORMULA
:
750 OUString aString
= rDoc
.GetFormula( nPosX
, nPosY
, nTab
);
751 if( aString
.isEmpty() )
753 aString
= rDoc
.GetInputString( nPosX
, nPosY
, nTab
);
755 rSet
.Put( SfxStringItem( nWhich
, aString
) );
759 case SID_RANGE_TEXTVALUE
:
761 OUString aString
= rDoc
.GetString(nPosX
, nPosY
, nTab
);
762 rSet
.Put( SfxStringItem( nWhich
, aString
) );
766 case SID_STATUS_SELMODE
:
768 /* 0: STD Click cancels Sel
769 * 1: ER Click extends selection
770 * 2: ERG Click defines further selection
772 sal_uInt16 nMode
= pTabViewShell
->GetLockedModifiers();
776 case KEY_SHIFT
: nMode
= 1; break;
777 case KEY_MOD1
: nMode
= 2; break; // Control-key
783 rSet
.Put( SfxUInt16Item( nWhich
, nMode
) );
787 case SID_STATUS_DOCPOS
:
789 OUString aStr
= ScResId( STR_TABLE_COUNT
);
791 aStr
= aStr
.replaceFirst("%1", OUString::number( nTab
+ 1 ) );
792 aStr
= aStr
.replaceFirst("%2", OUString::number( nTabCount
) );
794 rSet
.Put( SfxStringItem( nWhich
, aStr
) ); }
797 case SID_ROWCOL_SELCOUNT
:
799 ScRangeListRef aMarkRanges
;
800 GetViewData().GetMultiArea(aMarkRanges
);
801 const SCCOL nCol1
= aMarkRanges
->front().aStart
.Col();
802 const SCROW nRow1
= aMarkRanges
->front().aStart
.Row();
803 const SCCOL nCol2
= aMarkRanges
->front().aEnd
.Col();
804 const SCROW nRow2
= aMarkRanges
->front().aEnd
.Row();
805 const size_t nRanges
= aMarkRanges
->size();
807 if ((nRanges
== 1 && (nCol2
!= nCol1
|| nRow1
!= nRow2
)) || nRanges
> 1)
809 bool bSameRows
= true;
810 bool bSameCols
= true;
813 for (size_t i
= 0; i
< nRanges
; ++i
)
815 const ScRange
& rRange
= (*aMarkRanges
)[i
];
816 const SCCOL nRangeCol1
= rRange
.aStart
.Col();
817 const SCROW nRangeRow1
= rRange
.aStart
.Row();
818 const SCCOL nRangeCol2
= rRange
.aEnd
.Col();
819 const SCROW nRangeRow2
= rRange
.aEnd
.Row();
820 bSameRows
&= (nRow1
== nRangeRow1
&& nRow2
== nRangeRow2
);
821 bSameCols
&= (nCol1
== nRangeCol1
&& nCol2
== nRangeCol2
);
822 // Sum rows if the number of cols is the same or
823 // sum columns if the number of rows is the same,
824 // otherwise do not show any count of selected cells.
825 if (bSameRows
|| bSameCols
)
827 const auto nCols
= nRangeCol2
- nRangeCol1
+ 1;
828 const auto nRows
= (bSameCols
|| nRowsSum
== 0) ?
829 rDoc
.CountNonFilteredRows( nRangeRow1
, nRangeRow2
, rRange
.aStart
.Tab()) :
845 // Either the rows or columns are the same among selections
846 if (bSameRows
|| bSameCols
)
848 const LocaleDataWrapper
& rLocaleData
849 = Application::GetSettings().GetUILocaleDataWrapper();
851 = ScResId(STR_SELCOUNT_ROWARG
, nRowsSum
)
852 .replaceAll("%d", rLocaleData
.getNum(nRowsSum
, 0));
854 = ScResId(STR_SELCOUNT_COLARG
, nColsSum
)
855 .replaceAll("%d", rLocaleData
.getNum(nColsSum
, 0));
856 OUString aStr
= ScResId(STR_SELCOUNT
);
857 aStr
= aStr
.replaceAll("%1", aRowArg
);
858 aStr
= aStr
.replaceAll("%2", aColArg
);
859 rSet
.Put(SfxStringItem(nWhich
, aStr
));
864 SCSIZE nSelected
, nTotal
;
865 rDoc
.GetFilterSelCount( nPosX
, nPosY
, nTab
, nSelected
, nTotal
);
866 if( nTotal
&& nSelected
!= SCSIZE_MAX
)
868 OUString aStr
= ScResId( STR_FILTER_SELCOUNT
);
869 aStr
= aStr
.replaceAll( "%1", OUString::number( nSelected
) );
870 aStr
= aStr
.replaceAll( "%2", OUString::number( nTotal
) );
871 rSet
.Put( SfxStringItem( nWhich
, aStr
) );
877 // calculations etc. with date/time/Fail/position&size together
879 // #i34458# The SvxStatusItem belongs only into SID_TABLE_CELL. It no longer has to be
880 // duplicated in SID_ATTR_POSITION or SID_ATTR_SIZE for SvxPosSizeStatusBarControl.
883 // Test, if error under cursor
884 // (not rDoc.GetErrCode, to avoid erasing circular references)
886 // In interpreter may happen via rescheduled Basic
887 if ( rDoc
.IsInInterpreter() )
888 rSet
.Put( SvxStatusItem( SID_TABLE_CELL
, u
"..."_ustr
, StatusCategory::Formula
) );
891 FormulaError nErrCode
= FormulaError::NONE
;
892 ScFormulaCell
* pCell
= rDoc
.GetFormulaCell(ScAddress(nPosX
, nPosY
, nTab
));
893 if (pCell
&& !pCell
->IsRunning())
894 nErrCode
= pCell
->GetErrCode();
897 if ( pTabViewShell
->GetFunction( aFuncStr
, nErrCode
) )
899 rSet
.Put( SvxStatusItem( SID_TABLE_CELL
, aFuncStr
, StatusCategory::Formula
) );
905 case SID_DATA_SELECT
:
906 // HasSelectionData includes column content and validity,
907 // page fields have to be checked separately.
908 if ( !rDoc
.HasSelectionData( nPosX
, nPosY
, nTab
) &&
909 !pTabViewShell
->HasPageFieldDataAtCursor() )
910 rSet
.DisableItem( nWhich
);
913 case FID_CURRENTVALIDATION
:
914 if ( !rDoc
.HasValidationData( nPosX
, nPosY
, nTab
))
915 rSet
.DisableItem( nWhich
);
921 if ( pTabViewShell
->GetFunction( aFuncStr
, FormulaError::NONE
) )
922 rSet
.Put( SfxStringItem( nWhich
, aFuncStr
) );
927 if ( rDoc
.GetChangeTrack() || !pTabViewShell
->TestMergeCells() )
928 rSet
.DisableItem( nWhich
);
932 if ( rDoc
.GetChangeTrack() || !pTabViewShell
->TestRemoveMerge() )
933 rSet
.DisableItem( nWhich
);
936 case FID_MERGE_TOGGLE
:
937 if ( rDoc
.GetChangeTrack() )
938 rSet
.DisableItem( nWhich
);
941 bool bCanMerge
= pTabViewShell
->TestMergeCells();
942 bool bCanSplit
= pTabViewShell
->TestRemoveMerge();
943 if( !bCanMerge
&& !bCanSplit
)
944 rSet
.DisableItem( nWhich
);
946 rSet
.Put( SfxBoolItem( nWhich
, bCanSplit
) );
951 if ( nPosY
==0 || (rDoc
.HasRowBreak(nPosY
, nTab
) & ScBreakType::Manual
) || rDoc
.IsTabProtected(nTab
) )
952 rSet
.DisableItem( nWhich
);
956 if ( nPosX
==0 || (rDoc
.HasColBreak(nPosX
, nTab
) & ScBreakType::Manual
) || rDoc
.IsTabProtected(nTab
) )
957 rSet
.DisableItem( nWhich
);
961 if ( nPosY
==0 || !(rDoc
.HasRowBreak(nPosY
, nTab
) & ScBreakType::Manual
) || rDoc
.IsTabProtected(nTab
) )
962 rSet
.DisableItem( nWhich
);
966 if ( nPosX
==0 || !(rDoc
.HasColBreak(nPosX
, nTab
) & ScBreakType::Manual
) || rDoc
.IsTabProtected(nTab
) )
967 rSet
.DisableItem( nWhich
);
971 if ( nTabSelCount
< 2 )
972 rSet
.DisableItem( nWhich
);
975 case SID_INSERT_CURRENT_DATE
:
976 case SID_INSERT_CURRENT_TIME
:
978 if ( rDoc
.IsTabProtected(nTab
) &&
979 rDoc
.HasAttrib(nPosX
, nPosY
, nTab
, nPosX
, nPosY
, nTab
, HasAttrFlags::Protected
))
980 rSet
.DisableItem( nWhich
);
984 case SID_SELECT_SCENARIO
:
986 std::vector
<OUString
> aList
;
989 if ( !rDoc
.IsScenario(nTab
) )
992 ScScenarioFlags nFlags
;
993 SCTAB nScTab
= nTab
+ 1;
994 bool bSheetProtected
= rDoc
.IsTabProtected(nTab
);
996 while ( rDoc
.IsScenario(nScTab
) )
998 rDoc
.GetName( nScTab
, aStr
);
999 aList
.push_back(aStr
);
1000 rDoc
.GetScenarioData( nScTab
, aStr
, aDummyCol
, nFlags
);
1001 aList
.push_back(aStr
);
1002 // Protection is sal_True if both Sheet and Scenario are protected
1003 aList
.push_back((bSheetProtected
&& (nFlags
& ScScenarioFlags::Protected
)) ? u
"1"_ustr
: u
"0"_ustr
);
1010 ScScenarioFlags nDummyFlags
;
1011 rDoc
.GetScenarioData( nTab
, aComment
, aDummyCol
, nDummyFlags
);
1012 OSL_ENSURE( aList
.empty(), "List not empty!" );
1013 aList
.push_back(aComment
);
1016 rSet
.Put( SfxStringListItem( nWhich
, &aList
) );
1024 case FID_COL_OPT_WIDTH
:
1025 case FID_ROW_OPT_HEIGHT
:
1026 case FID_DELETE_CELL
:
1027 if ( rDoc
.IsTabProtected(nTab
) || pDocSh
->IsReadOnly())
1028 rSet
.DisableItem( nWhich
);
1031 case SID_OUTLINE_MAKE
:
1033 if ( GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(),
1034 GetViewData().GetCurY(), GetViewData().GetTabNo() ) )
1036 //! test for data pilot operation
1038 else if (rDoc
.GetChangeTrack()!=nullptr || GetViewData().IsMultiMarked())
1040 rSet
.DisableItem( nWhich
);
1044 case SID_OUTLINE_SHOW
:
1045 if ( GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(),
1046 GetViewData().GetCurY(), GetViewData().GetTabNo() ) )
1048 //! test for data pilot operation
1050 else if (!pTabViewShell
->OutlinePossible(false))
1051 rSet
.DisableItem( nWhich
);
1054 case SID_OUTLINE_HIDE
:
1055 if ( GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(),
1056 GetViewData().GetCurY(), GetViewData().GetTabNo() ) )
1058 //! test for data pilot operation
1060 else if (!pTabViewShell
->OutlinePossible(true))
1061 rSet
.DisableItem( nWhich
);
1064 case SID_OUTLINE_REMOVE
:
1066 if ( GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(),
1067 GetViewData().GetCurY(), GetViewData().GetTabNo() ) )
1069 //! test for data pilot operation
1074 pTabViewShell
->TestRemoveOutline( bCol
, bRow
);
1075 if ( !bCol
&& !bRow
)
1076 rSet
.DisableItem( nWhich
);
1083 SfxUInt16Item
aWidthItem( FID_COL_WIDTH
, rDoc
.GetColWidth( nPosX
, nTab
) );
1084 rSet
.Put( aWidthItem
);
1085 if ( pDocSh
->IsReadOnly())
1086 rSet
.DisableItem( nWhich
);
1088 //XXX disable if not conclusive
1092 case FID_ROW_HEIGHT
:
1094 SfxUInt16Item
aHeightItem( FID_ROW_HEIGHT
, rDoc
.GetRowHeight( nPosY
, nTab
) );
1095 rSet
.Put( aHeightItem
);
1096 //XXX disable if not conclusive
1097 if ( pDocSh
->IsReadOnly())
1098 rSet
.DisableItem( nWhich
);
1102 case SID_DETECTIVE_FILLMODE
:
1103 rSet
.Put(SfxBoolItem( nWhich
, pTabViewShell
->IsAuditShell() ));
1106 case FID_INPUTLINE_STATUS
:
1107 OSL_FAIL( "Old update method. Use ScTabViewShell::UpdateInputHandler()." );
1110 case SID_SCENARIOS
: // scenarios:
1111 if (!(rMark
.IsMarked() || rMark
.IsMultiMarked())) // only, if something selected
1112 rSet
.DisableItem( nWhich
);
1115 case FID_NOTE_VISIBLE
:
1117 const ScPostIt
* pNote
= rDoc
.GetNote(nPosX
, nPosY
, nTab
);
1118 if ( pNote
&& rDoc
.IsBlockEditable( nTab
, nPosX
,nPosY
, nPosX
,nPosY
) )
1119 rSet
.Put( SfxBoolItem( nWhich
, pNote
->IsCaptionShown() ) );
1121 rSet
.DisableItem( nWhich
);
1128 bool bEnable
= false;
1129 bool bSearchForHidden
= nWhich
== FID_SHOW_NOTE
;
1130 if (!rMark
.IsMarked() && !rMark
.IsMultiMarked())
1132 // Check current cell
1133 const ScPostIt
* pNote
= rDoc
.GetNote(nPosX
, nPosY
, nTab
);
1134 if ( pNote
&& rDoc
.IsBlockEditable( nTab
, nPosX
,nPosY
, nPosX
,nPosY
) )
1135 if ( pNote
->IsCaptionShown() != bSearchForHidden
)
1140 // Check selection range
1141 ScRangeListRef aRangesRef
;
1142 rData
.GetMultiArea(aRangesRef
);
1143 ScRangeList aRanges
= *aRangesRef
;
1144 std::vector
<sc::NoteEntry
> aNotes
;
1145 rDoc
.GetNotesInRange(aRanges
, aNotes
);
1146 for(const auto& rNote
: aNotes
)
1148 const ScAddress
& rAdr
= rNote
.maPos
;
1149 if( rDoc
.IsBlockEditable( rAdr
.Tab(), rAdr
.Col(), rAdr
.Row(), rAdr
.Col(), rAdr
.Row() ))
1151 if (rNote
.mpNote
->IsCaptionShown() != bSearchForHidden
)
1161 rSet
.DisableItem( nWhich
);
1165 case FID_SHOW_ALL_NOTES
:
1166 case FID_HIDE_ALL_NOTES
:
1167 case FID_DELETE_ALL_NOTES
:
1169 bool bHasNotes
= false;
1171 for (auto const& rTab
: rMark
.GetSelectedTabs())
1173 if (rDoc
.HasTabNotes( rTab
))
1181 rSet
.DisableItem( nWhich
);
1185 case SID_TOGGLE_NOTES
:
1187 bool bHasNotes
= false;
1188 ScRangeList aRanges
;
1190 for (auto const& rTab
: rMark
.GetSelectedTabs())
1192 if (rDoc
.HasTabNotes( rTab
))
1195 aRanges
.push_back(ScRange(0,0,rTab
,rDoc
.MaxCol(),rDoc
.MaxRow(),rTab
));
1200 rSet
.DisableItem( nWhich
);
1203 CommentCaptionState eState
= rDoc
.GetAllNoteCaptionsState( aRanges
);
1204 bool bAllNotesInShown
= (eState
!= ALLHIDDEN
&& eState
!= MIXED
);
1205 rSet
.Put( SfxBoolItem( SID_TOGGLE_NOTES
, bAllNotesInShown
) );
1210 case SID_DELETE_NOTE
:
1212 bool bEnable
= false;
1213 if ( rMark
.IsMarked() || rMark
.IsMultiMarked() )
1215 if ( rDoc
.IsSelectionEditable( rMark
) )
1217 // look for at least one note in selection
1218 ScRangeList aRanges
;
1219 rMark
.FillRangeListWithMarks( &aRanges
, false );
1220 bEnable
= rDoc
.ContainsNotesInRange( aRanges
);
1225 bEnable
= rDoc
.IsBlockEditable( nTab
, nPosX
,nPosY
, nPosX
,nPosY
) &&
1226 rDoc
.GetNote(nPosX
, nPosY
, nTab
);
1229 rSet
.DisableItem( nWhich
);
1233 case SID_OPENDLG_CONSOLIDATE
:
1234 case SCITEM_CONSOLIDATEDATA
:
1236 if (rDoc
.GetChangeTrack()!=nullptr)
1237 rSet
.DisableItem( nWhich
);
1241 case SID_CHINESE_CONVERSION
:
1242 case SID_HANGUL_HANJA_CONVERSION
:
1243 ScViewUtil::HideDisabledSlot( rSet
, rData
.GetBindings(), nWhich
);
1248 if ( pDocSh
&& pDocSh
->IsDocShared() )
1249 rSet
.DisableItem( nWhich
);
1253 if ( rData
.GetSimpleArea( aRange
) != SC_MARK_SIMPLE
)
1254 rSet
.DisableItem( nWhich
);
1259 case FID_DEFINE_NAME
:
1260 case FID_INSERT_NAME
:
1262 case SID_DEFINE_COLROWNAMERANGES
:
1264 if ( pDocSh
&& pDocSh
->IsDocShared() )
1266 rSet
.DisableItem( nWhich
);
1271 case FID_DEFINE_CURRENT_NAME
:
1273 ScAddress
aCurrentAddress( nPosX
, nPosY
, nTab
);
1275 if ( !rDoc
.IsAddressInRangeName( RangeNameScope::GLOBAL
, aCurrentAddress
) &&
1276 !rDoc
.IsAddressInRangeName( RangeNameScope::SHEET
, aCurrentAddress
))
1278 rSet
.DisableItem( nWhich
);
1283 case SID_SPELL_DIALOG
:
1285 if (rDoc
.IsTabProtected(rData
.GetTabNo()))
1287 bool bVisible
= false;
1288 SfxViewFrame
* pViewFrame
= ( pTabViewShell
? &pTabViewShell
->GetViewFrame() : nullptr );
1289 if ( pViewFrame
&& pViewFrame
->HasChildWindow( nWhich
) )
1291 SfxChildWindow
* pChild
= pViewFrame
->GetChildWindow( nWhich
);
1292 std::shared_ptr
<SfxDialogController
> xController
= pChild
? pChild
->GetController() : nullptr;
1293 if (xController
&& xController
->getDialog()->get_visible())
1300 rSet
.DisableItem( nWhich
);
1306 case SID_OPENDLG_CURRENTCONDFRMT
:
1307 case SID_OPENDLG_CURRENTCONDFRMT_MANAGER
:
1309 const SfxPoolItem
* pItem
= rDoc
.GetAttr( nPosX
, nPosY
, nTab
, ATTR_CONDITIONAL
);
1310 const ScCondFormatItem
* pCondFormatItem
= static_cast<const ScCondFormatItem
*>(pItem
);
1312 if ( pCondFormatItem
->GetCondFormatData().empty() )
1313 rSet
.DisableItem( nWhich
);
1314 else if ( pCondFormatItem
->GetCondFormatData().size() == 1 )
1315 rSet
.DisableItem( SID_OPENDLG_CURRENTCONDFRMT_MANAGER
);
1316 else if ( pCondFormatItem
->GetCondFormatData().size() > 1 )
1317 rSet
.DisableItem( SID_OPENDLG_CURRENTCONDFRMT
);
1321 } // switch ( nWitch )
1322 nWhich
= aIter
.NextWhich();
1323 } // while ( nWitch )
1326 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */