fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / ui / view / cellsh2.cxx
blobaeca622c5133a598a5babb67694aef4ae5dcb697
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <config_features.h>
22 #include "scitems.hxx"
23 #include <sfx2/viewfrm.hxx>
24 #include <sfx2/app.hxx>
25 #include <sfx2/request.hxx>
26 #include <svl/aeitem.hxx>
27 #include <basic/sbxcore.hxx>
28 #include <svl/whiter.hxx>
29 #include <svl/zforlist.hxx>
30 #include <vcl/msgbox.hxx>
31 #include <svl/stritem.hxx>
32 #include <svl/visitem.hxx>
33 #include <svtools/miscopt.hxx>
34 #include <unotools/moduleoptions.hxx>
36 #include <com/sun/star/frame/FrameSearchFlag.hpp>
37 #include <com/sun/star/sdbc/XResultSet.hpp>
39 #include "cellsh.hxx"
40 #include "tabvwsh.hxx"
41 #include "sc.hrc"
42 #include "globstr.hrc"
43 #include "global.hxx"
44 #include "globalnames.hxx"
45 #include "scmod.hxx"
46 #include "docsh.hxx"
47 #include "document.hxx"
48 #include "uiitems.hxx"
49 #include "dbfunc.hxx"
50 #include "dbdocfun.hxx"
51 #include "filtdlg.hxx"
52 #include "dbnamdlg.hxx"
53 #include "reffact.hxx"
54 #include "validat.hxx"
55 #include "scresid.hxx"
57 #include "scui_def.hxx"
58 #include "scabstdlg.hxx"
59 #include "impex.hxx"
60 #include "asciiopt.hxx"
61 #include "datastream.hxx"
62 #include "datastreamdlg.hxx"
63 #include "queryentry.hxx"
64 #include "markdata.hxx"
65 #include <documentlinkmgr.hxx>
67 #include <config_orcus.h>
69 #include <boost/scoped_ptr.hpp>
71 using namespace com::sun::star;
73 static bool lcl_GetTextToColumnsRange( const ScViewData* pData, ScRange& rRange )
75 OSL_ENSURE( pData, "lcl_GetTextToColumnsRange: pData is null!" );
77 bool bRet = false;
78 const ScMarkData& rMark = pData->GetMarkData();
80 if ( rMark.IsMarked() )
82 if ( !rMark.IsMultiMarked() )
84 rMark.GetMarkArea( rRange );
85 if ( rRange.aStart.Col() == rRange.aEnd.Col() )
87 bRet = true;
91 else
93 const SCCOL nCol = pData->GetCurX();
94 const SCROW nRow = pData->GetCurY();
95 const SCTAB nTab = pData->GetTabNo();
96 rRange = ScRange( nCol, nRow, nTab, nCol, nRow, nTab );
97 bRet = true;
100 const ScDocument* pDoc = pData->GetDocument();
101 OSL_ENSURE( pDoc, "lcl_GetTextToColumnsRange: pDoc is null!" );
103 if ( bRet && pDoc->IsBlockEmpty( rRange.aStart.Tab(), rRange.aStart.Col(),
104 rRange.aStart.Row(), rRange.aEnd.Col(),
105 rRange.aEnd.Row() ) )
107 bRet = false;
110 return bRet;
113 static bool lcl_GetSortParam( const ScViewData* pData, ScSortParam& rSortParam )
115 ScTabViewShell* pTabViewShell = pData->GetViewShell();
116 ScDBData* pDBData = pTabViewShell->GetDBData();
117 ScDocument* pDoc = pData->GetDocument();
118 SCTAB nTab = pData->GetTabNo();
119 ScDirection eFillDir = DIR_TOP;
120 bool bSort = true;
121 ScRange aExternalRange;
123 if( rSortParam.nCol1 != rSortParam.nCol2 )
124 eFillDir = DIR_LEFT;
125 if( rSortParam.nRow1 != rSortParam.nRow2 )
126 eFillDir = DIR_TOP;
128 if( rSortParam.nRow2 == MAXROW )
130 // Assume that user selected entire column(s), but cater for the
131 // possibility that the start row is not the first row.
132 SCSIZE nCount = pDoc->GetEmptyLinesInBlock( rSortParam.nCol1, rSortParam.nRow1, nTab,
133 rSortParam.nCol2, rSortParam.nRow2, nTab, eFillDir );
134 aExternalRange = ScRange( rSortParam.nCol1,
135 ::std::min( rSortParam.nRow1 + sal::static_int_cast<SCROW>( nCount ), MAXROW), nTab );
137 else
138 aExternalRange = ScRange( pData->GetCurX(), pData->GetCurY(), nTab );
140 SCROW nStartRow = aExternalRange.aStart.Row();
141 SCCOL nStartCol = aExternalRange.aStart.Col();
142 SCROW nEndRow = aExternalRange.aEnd.Row();
143 SCCOL nEndCol = aExternalRange.aEnd.Col();
144 pDoc->GetDataArea( aExternalRange.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow, false, false );
145 aExternalRange.aStart.SetRow( nStartRow );
146 aExternalRange.aStart.SetCol( nStartCol );
147 aExternalRange.aEnd.SetRow( nEndRow );
148 aExternalRange.aEnd.SetCol( nEndCol );
150 if(( rSortParam.nCol1 == rSortParam.nCol2 && aExternalRange.aStart.Col() != aExternalRange.aEnd.Col() ) ||
151 ( rSortParam.nRow1 == rSortParam.nRow2 && aExternalRange.aStart.Row() != aExternalRange.aEnd.Row() ) )
153 sal_uInt16 nFmt = SCA_VALID;
155 pTabViewShell->AddHighlightRange( aExternalRange,Color( COL_LIGHTBLUE ) );
156 ScRange rExtendRange( aExternalRange.aStart.Col(), aExternalRange.aStart.Row(), nTab, aExternalRange.aEnd.Col(), aExternalRange.aEnd.Row(), nTab );
157 OUString aExtendStr(rExtendRange.Format(nFmt, pDoc));
159 ScRange rCurrentRange( rSortParam.nCol1, rSortParam.nRow1, nTab, rSortParam.nCol2, rSortParam.nRow2, nTab );
160 OUString aCurrentStr(rCurrentRange.Format(nFmt, pDoc));
162 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
163 OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
165 boost::scoped_ptr<AbstractScSortWarningDlg> pWarningDlg(pFact->CreateScSortWarningDlg( pTabViewShell->GetDialogParent(), aExtendStr, aCurrentStr ));
166 OSL_ENSURE(pWarningDlg, "Dialog create fail!");
167 short bResult = pWarningDlg->Execute();
168 if( bResult == BTN_EXTEND_RANGE || bResult == BTN_CURRENT_SELECTION )
170 if( bResult == BTN_EXTEND_RANGE )
172 pTabViewShell->MarkRange( aExternalRange, false );
173 pDBData->SetArea( nTab, aExternalRange.aStart.Col(), aExternalRange.aStart.Row(), aExternalRange.aEnd.Col(), aExternalRange.aEnd.Row() );
176 else
178 bSort = false;
179 pData->GetDocShell()->CancelAutoDBRange();
182 pTabViewShell->ClearHighlightRanges();
184 return bSort;
187 //after end execute from !IsModalInputMode, it is safer to delay deleting
188 namespace
190 sal_IntPtr DelayDeleteAbstractDialog( void *pAbstractDialog, void * /*pArg*/ )
192 delete static_cast<SfxAbstractTabDialog*>( pAbstractDialog );
193 return 0;
197 void ScCellShell::ExecuteDB( SfxRequest& rReq )
199 ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell();
200 sal_uInt16 nSlotId = rReq.GetSlot();
201 const SfxItemSet* pReqArgs = rReq.GetArgs();
202 ScModule* pScMod = SC_MOD();
204 pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox
206 if ( GetViewData()->HasEditView( GetViewData()->GetActivePart() ) )
208 pScMod->InputEnterHandler();
209 pTabViewShell->UpdateInputHandler();
212 switch ( nSlotId )
214 case SID_VIEW_DATA_SOURCE_BROWSER:
216 // check if database beamer is open
218 SfxViewFrame* pViewFrame = pTabViewShell->GetViewFrame();
219 bool bWasOpen = false;
221 uno::Reference<frame::XFrame> xFrame = pViewFrame->GetFrame().GetFrameInterface();
222 uno::Reference<frame::XFrame> xBeamerFrame = xFrame->findFrame(
223 OUString("_beamer"),
224 frame::FrameSearchFlag::CHILDREN);
225 if ( xBeamerFrame.is() )
226 bWasOpen = true;
229 if ( bWasOpen )
231 // close database beamer: just forward to SfxViewFrame
233 pViewFrame->ExecuteSlot( rReq );
235 else
237 // show database beamer: SfxViewFrame call must be synchronous
239 pViewFrame->ExecuteSlot( rReq, false ); // false = synchronous
241 // select current database in database beamer
243 ScImportParam aImportParam;
244 ScDBData* pDBData = pTabViewShell->GetDBData(true,SC_DB_OLD); // don't create if none found
245 if (pDBData)
246 pDBData->GetImportParam( aImportParam );
248 ScDBDocFunc::ShowInBeamer( aImportParam, pTabViewShell->GetViewFrame() );
250 rReq.Done(); // needed because it's a toggle slot
252 break;
254 case SID_REIMPORT_DATA:
256 bool bOk = false;
257 ScDBData* pDBData = pTabViewShell->GetDBData(true,SC_DB_OLD);
258 if (pDBData)
260 ScImportParam aImportParam;
261 pDBData->GetImportParam( aImportParam );
262 if (aImportParam.bImport && !pDBData->HasImportSelection())
264 pTabViewShell->ImportData( aImportParam );
265 pDBData->SetImportParam( aImportParam ); //! Undo ??
266 bOk = true;
270 if (!bOk && ! rReq.IsAPI() )
271 pTabViewShell->ErrorMessage(STR_REIMPORT_EMPTY);
273 if( bOk )
274 rReq.Done();
276 break;
278 case SID_REFRESH_DBAREA:
280 ScDBData* pDBData = pTabViewShell->GetDBData(true,SC_DB_OLD);
281 if (pDBData)
283 // repeat import like SID_REIMPORT_DATA
285 bool bContinue = true;
286 ScImportParam aImportParam;
287 pDBData->GetImportParam( aImportParam );
288 if (aImportParam.bImport && !pDBData->HasImportSelection())
290 bContinue = pTabViewShell->ImportData( aImportParam );
291 pDBData->SetImportParam( aImportParam ); //! Undo ??
293 // mark (size may have been changed)
294 ScRange aNewRange;
295 pDBData->GetArea(aNewRange);
296 pTabViewShell->MarkRange(aNewRange);
299 if ( bContinue ) // fail at import -> break
301 // internal operations, when any stored
303 if ( pDBData->HasQueryParam() || pDBData->HasSortParam() ||
304 pDBData->HasSubTotalParam() )
305 pTabViewShell->RepeatDB();
307 // pivot tables that have the range as data source
309 ScRange aRange;
310 pDBData->GetArea(aRange);
311 GetViewData()->GetDocShell()->RefreshPivotTables(aRange);
314 rReq.Done();
316 break;
318 case SID_SBA_BRW_INSERT:
320 OSL_FAIL( "Deprecated Slot" );
322 break;
324 case SID_DATA_FORM:
326 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
327 OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
329 AbstractScDataFormDlg* pDlg = pFact->CreateScDataFormDlg(
330 pTabViewShell->GetDialogParent(), pTabViewShell);
331 OSL_ENSURE(pDlg, "Dialog create fail!");
333 pDlg->Execute();
335 rReq.Done();
337 break;
339 case SID_SUBTOTALS:
340 ExecuteSubtotals(rReq);
341 break;
343 case SID_SORT_DESCENDING:
344 case SID_SORT_ASCENDING:
346 //#i60401 ux-ctest: Calc does not support all users' strategies regarding sorting data
347 //the patch comes from maoyg
348 ScSortParam aSortParam;
349 ScDBData* pDBData = pTabViewShell->GetDBData();
350 ScViewData* pData = GetViewData();
352 pDBData->GetSortParam( aSortParam );
354 if( lcl_GetSortParam( pData, aSortParam ) )
356 SfxItemSet aArgSet( GetPool(), SCITEM_SORTDATA, SCITEM_SORTDATA );
357 SCCOL nCol = GetViewData()->GetCurX();
358 SCCOL nTab = GetViewData()->GetTabNo();
359 ScDocument* pDoc = GetViewData()->GetDocument();
361 pDBData->GetSortParam( aSortParam );
362 bool bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, nTab );
364 if( nCol < aSortParam.nCol1 )
365 nCol = aSortParam.nCol1;
366 else if( nCol > aSortParam.nCol2 )
367 nCol = aSortParam.nCol2;
369 aSortParam.bHasHeader = bHasHeader;
370 aSortParam.bByRow = true;
371 aSortParam.bCaseSens = false;
372 aSortParam.bNaturalSort = false;
373 aSortParam.bIncludePattern = true;
374 aSortParam.bInplace = true;
375 aSortParam.maKeyState[0].bDoSort = true;
376 aSortParam.maKeyState[0].nField = nCol;
377 aSortParam.maKeyState[0].bAscending = ( nSlotId == SID_SORT_ASCENDING );
379 for ( sal_uInt16 i=1; i<aSortParam.GetSortKeyCount(); i++ )
380 aSortParam.maKeyState[i].bDoSort = false;
382 aArgSet.Put( ScSortItem( SCITEM_SORTDATA, GetViewData(), &aSortParam ) );
384 pTabViewShell->UISort( aSortParam ); // subtotal when needed new
386 rReq.Done();
389 break;
391 case SID_SORT:
393 const SfxItemSet* pArgs = rReq.GetArgs();
395 //#i60401 ux-ctest: Calc does not support all users' strategies regarding sorting data
396 //the patch comes from maoyg
398 if ( pArgs ) // Basic
400 ScSortParam aSortParam;
401 ScDBData* pDBData = pTabViewShell->GetDBData();
402 ScViewData* pData = GetViewData();
404 pDBData->GetSortParam( aSortParam );
406 if( lcl_GetSortParam( pData, aSortParam ) )
408 ScDocument* pDoc = GetViewData()->GetDocument();
410 pDBData->GetSortParam( aSortParam );
411 bool bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, pData->GetTabNo() );
412 if( bHasHeader )
413 aSortParam.bHasHeader = bHasHeader;
415 aSortParam.bInplace = true; // from Basic always
417 const SfxPoolItem* pItem;
418 if ( pArgs->GetItemState( SID_SORT_BYROW, true, &pItem ) == SfxItemState::SET )
419 aSortParam.bByRow = static_cast<const SfxBoolItem*>(pItem)->GetValue();
420 if ( pArgs->GetItemState( SID_SORT_HASHEADER, true, &pItem ) == SfxItemState::SET )
421 aSortParam.bHasHeader = static_cast<const SfxBoolItem*>(pItem)->GetValue();
422 if ( pArgs->GetItemState( SID_SORT_CASESENS, true, &pItem ) == SfxItemState::SET )
423 aSortParam.bCaseSens = static_cast<const SfxBoolItem*>(pItem)->GetValue();
424 if ( pArgs->GetItemState( SID_SORT_NATURALSORT, true, &pItem ) == SfxItemState::SET )
425 aSortParam.bNaturalSort = static_cast<const SfxBoolItem*>(pItem)->GetValue();
426 if ( pArgs->GetItemState( SID_SORT_ATTRIBS, true, &pItem ) == SfxItemState::SET )
427 aSortParam.bIncludePattern = static_cast<const SfxBoolItem*>(pItem)->GetValue();
428 if ( pArgs->GetItemState( SID_SORT_USERDEF, true, &pItem ) == SfxItemState::SET )
430 sal_uInt16 nUserIndex = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
431 aSortParam.bUserDef = ( nUserIndex != 0 );
432 if ( nUserIndex )
433 aSortParam.nUserIndex = nUserIndex - 1; // Basic: 1-based
436 SCCOLROW nField0 = 0;
437 if ( pArgs->GetItemState( FN_PARAM_1, true, &pItem ) == SfxItemState::SET )
438 nField0 = static_cast<const SfxInt32Item*>(pItem)->GetValue();
439 aSortParam.maKeyState[0].bDoSort = ( nField0 != 0 );
440 aSortParam.maKeyState[0].nField = nField0 > 0 ? (nField0-1) : 0;
441 if ( pArgs->GetItemState( FN_PARAM_2, true, &pItem ) == SfxItemState::SET )
442 aSortParam.maKeyState[0].bAscending = static_cast<const SfxBoolItem*>(pItem)->GetValue();
443 SCCOLROW nField1 = 0;
444 if ( pArgs->GetItemState( FN_PARAM_3, true, &pItem ) == SfxItemState::SET )
445 nField1 = static_cast<const SfxInt32Item*>(pItem)->GetValue();
446 aSortParam.maKeyState[1].bDoSort = ( nField1 != 0 );
447 aSortParam.maKeyState[1].nField = nField1 > 0 ? (nField1-1) : 0;
448 if ( pArgs->GetItemState( FN_PARAM_4, true, &pItem ) == SfxItemState::SET )
449 aSortParam.maKeyState[1].bAscending = static_cast<const SfxBoolItem*>(pItem)->GetValue();
450 SCCOLROW nField2 = 0;
451 if ( pArgs->GetItemState( FN_PARAM_5, true, &pItem ) == SfxItemState::SET )
452 nField2 = static_cast<const SfxInt32Item*>(pItem)->GetValue();
453 aSortParam.maKeyState[2].bDoSort = ( nField2 != 0 );
454 aSortParam.maKeyState[2].nField = nField2 > 0 ? (nField2-1) : 0;
455 if ( pArgs->GetItemState( FN_PARAM_6, true, &pItem ) == SfxItemState::SET )
456 aSortParam.maKeyState[2].bAscending = static_cast<const SfxBoolItem*>(pItem)->GetValue();
458 // subtotal when needed new
459 pTabViewShell->UISort( aSortParam );
460 rReq.Done();
463 else
465 ScSortParam aSortParam;
466 ScDBData* pDBData = pTabViewShell->GetDBData();
467 ScViewData* pData = GetViewData();
469 pDBData->GetSortParam( aSortParam );
471 if( lcl_GetSortParam( pData, aSortParam ) )
473 ScDocument* pDoc = GetViewData()->GetDocument();
474 SfxItemSet aArgSet( GetPool(), SCITEM_SORTDATA, SCITEM_SORTDATA );
476 pDBData->GetSortParam( aSortParam );
477 bool bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, pData->GetTabNo() );
478 if( bHasHeader )
479 aSortParam.bHasHeader = bHasHeader;
481 aArgSet.Put( ScSortItem( SCITEM_SORTDATA, GetViewData(), &aSortParam ) );
483 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
484 assert(pFact); //ScAbstractFactory create fail!
486 boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateScSortDlg(pTabViewShell->GetDialogParent(), &aArgSet));
487 assert(pDlg); //Dialog create fail!
488 pDlg->SetCurPageId("criteria"); // 1=sort field tab 2=sort options tab
490 if ( pDlg->Execute() == RET_OK )
492 const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
493 const ScSortParam& rOutParam = static_cast<const ScSortItem&>(
494 pOutSet->Get( SCITEM_SORTDATA )).GetSortData();
496 // subtotal when needed new
498 pTabViewShell->UISort( rOutParam );
500 if ( rOutParam.bInplace )
502 rReq.AppendItem( SfxBoolItem( SID_SORT_BYROW,
503 rOutParam.bByRow ) );
504 rReq.AppendItem( SfxBoolItem( SID_SORT_HASHEADER,
505 rOutParam.bHasHeader ) );
506 rReq.AppendItem( SfxBoolItem( SID_SORT_CASESENS,
507 rOutParam.bCaseSens ) );
508 rReq.AppendItem( SfxBoolItem( SID_SORT_NATURALSORT,
509 rOutParam.bNaturalSort ) );
510 rReq.AppendItem( SfxBoolItem( SID_SORT_ATTRIBS,
511 rOutParam.bIncludePattern ) );
512 sal_uInt16 nUser = rOutParam.bUserDef ? ( rOutParam.nUserIndex + 1 ) : 0;
513 rReq.AppendItem( SfxUInt16Item( SID_SORT_USERDEF, nUser ) );
514 if ( rOutParam.maKeyState[0].bDoSort )
516 rReq.AppendItem( SfxInt32Item( FN_PARAM_1,
517 rOutParam.maKeyState[0].nField + 1 ) );
518 rReq.AppendItem( SfxBoolItem( FN_PARAM_2,
519 rOutParam.maKeyState[0].bAscending ) );
521 if ( rOutParam.maKeyState[1].bDoSort )
523 rReq.AppendItem( SfxInt32Item( FN_PARAM_3,
524 rOutParam.maKeyState[1].nField + 1 ) );
525 rReq.AppendItem( SfxBoolItem( FN_PARAM_4,
526 rOutParam.maKeyState[1].bAscending ) );
528 if ( rOutParam.maKeyState[2].bDoSort )
530 rReq.AppendItem( SfxInt32Item( FN_PARAM_5,
531 rOutParam.maKeyState[2].nField + 1 ) );
532 rReq.AppendItem( SfxBoolItem( FN_PARAM_6,
533 rOutParam.maKeyState[2].bAscending ) );
537 rReq.Done();
539 else
540 GetViewData()->GetDocShell()->CancelAutoDBRange();
544 break;
546 case SID_FILTER:
548 const SfxItemSet* pArgs = rReq.GetArgs();
549 if ( pArgs )
551 OSL_FAIL("SID_FILTER with arguments?");
552 pTabViewShell->Query( static_cast<const ScQueryItem&>(
553 pArgs->Get( SCITEM_QUERYDATA )).GetQueryData(), NULL, true );
554 rReq.Done();
556 else
558 sal_uInt16 nId = ScFilterDlgWrapper::GetChildWindowId();
559 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
560 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
562 pScMod->SetRefDialog( nId, pWnd == nullptr );
565 break;
567 case SID_SPECIAL_FILTER:
569 const SfxItemSet* pArgs = rReq.GetArgs();
570 if ( pArgs )
572 OSL_FAIL("SID_SPECIAL_FILTER with arguments?");
573 pTabViewShell->Query( static_cast<const ScQueryItem&>(
574 pArgs->Get( SCITEM_QUERYDATA )).GetQueryData(), NULL, true );
575 rReq.Done();
577 else
579 sal_uInt16 nId = ScSpecialFilterDlgWrapper::GetChildWindowId();
580 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
581 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
583 pScMod->SetRefDialog( nId, pWnd == nullptr );
586 break;
588 case FID_FILTER_OK:
590 const SfxPoolItem* pItem;
591 if ( pReqArgs && SfxItemState::SET ==
592 pReqArgs->GetItemState( SCITEM_QUERYDATA, true, &pItem ) )
594 const ScQueryItem& rQueryItem = static_cast<const ScQueryItem&>(*pItem);
596 SCTAB nCurTab = GetViewData()->GetTabNo();
597 SCTAB nRefTab = GetViewData()->GetRefTabNo();
599 // If RefInput switched to a different sheet from the data sheet,
600 // switch back:
602 if ( nCurTab != nRefTab )
604 pTabViewShell->SetTabNo( nRefTab );
605 pTabViewShell->PaintExtras();
608 ScRange aAdvSource;
609 if (rQueryItem.GetAdvancedQuerySource(aAdvSource))
610 pTabViewShell->Query( rQueryItem.GetQueryData(), &aAdvSource, true );
611 else
612 pTabViewShell->Query( rQueryItem.GetQueryData(), NULL, true );
613 rReq.Done( *pReqArgs );
616 break;
618 case SID_UNFILTER:
620 ScQueryParam aParam;
621 ScDBData* pDBData = pTabViewShell->GetDBData();
623 pDBData->GetQueryParam( aParam );
624 SCSIZE nEC = aParam.GetEntryCount();
625 for (SCSIZE i=0; i<nEC; i++)
626 aParam.GetEntry(i).bDoQuery = false;
627 aParam.bDuplicate = true;
628 pTabViewShell->Query( aParam, NULL, true );
629 rReq.Done();
631 break;
633 case SID_AUTO_FILTER:
634 pTabViewShell->ToggleAutoFilter();
635 rReq.Done();
636 break;
638 case SID_AUTOFILTER_HIDE:
639 pTabViewShell->HideAutoFilter();
640 rReq.Done();
641 break;
643 case SID_PIVOT_TABLE:
645 const SfxPoolItem* pItem;
646 if ( pReqArgs && SfxItemState::SET ==
647 pReqArgs->GetItemState( SCITEM_PIVOTDATA, true, &pItem ) )
649 SCTAB nCurTab = GetViewData()->GetTabNo();
650 SCTAB nRefTab = GetViewData()->GetRefTabNo();
652 // If RefInput switched to a different sheet from the data sheet,
653 // switch back:
655 if ( nCurTab != nRefTab )
657 pTabViewShell->SetTabNo( nRefTab );
658 pTabViewShell->PaintExtras();
661 const ScDPObject* pDPObject = pTabViewShell->GetDialogDPObject();
662 if ( pDPObject )
664 const ScPivotItem* pPItem = static_cast<const ScPivotItem*>(pItem);
665 bool bSuccess = pTabViewShell->MakePivotTable(
666 pPItem->GetData(), pPItem->GetDestRange(), pPItem->IsNewSheet(), *pDPObject );
667 SfxBoolItem aRet(0, bSuccess);
668 rReq.SetReturnValue(aRet);
670 rReq.Done();
672 #if HAVE_FEATURE_SCRIPTING
673 else if (rReq.IsAPI())
674 SbxBase::SetError(SbxERR_BAD_PARAMETER);
675 #endif
677 break;
679 case SID_OPENDLG_PIVOTTABLE:
680 ExecuteDataPilotDialog();
681 break;
682 case SID_DEFINE_DBNAME:
685 sal_uInt16 nId = ScDbNameDlgWrapper::GetChildWindowId();
686 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
687 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
689 pScMod->SetRefDialog( nId, pWnd == nullptr );
692 break;
694 case SID_SELECT_DB:
696 if ( pReqArgs )
698 const SfxStringItem* pItem =
699 static_cast<const SfxStringItem*>(&pReqArgs->Get( SID_SELECT_DB ));
701 if( pItem )
703 pTabViewShell->GotoDBArea( pItem->GetValue() );
704 rReq.Done();
706 else
708 OSL_FAIL("NULL");
711 else
713 ScDocument* pDoc = GetViewData()->GetDocument();
714 ScDBCollection* pDBCol = pDoc->GetDBCollection();
716 if ( pDBCol )
718 std::vector<OUString> aList;
719 const ScDBCollection::NamedDBs& rDBs = pDBCol->getNamedDBs();
720 ScDBCollection::NamedDBs::const_iterator itr = rDBs.begin(), itrEnd = rDBs.end();
721 for (; itr != itrEnd; ++itr)
722 aList.push_back(itr->GetName());
724 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
725 OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
727 boost::scoped_ptr<AbstractScSelEntryDlg> pDlg(pFact->CreateScSelEntryDlg( pTabViewShell->GetDialogParent(),
728 aList ));
729 OSL_ENSURE(pDlg, "Dialog create fail!");
730 if ( pDlg->Execute() == RET_OK )
732 OUString aName = pDlg->GetSelectEntry();
733 pTabViewShell->GotoDBArea( aName );
734 rReq.AppendItem( SfxStringItem( SID_SELECT_DB, aName ) );
735 rReq.Done();
740 break;
741 case SID_DATA_STREAMS:
743 ScopedVclPtrInstance< sc::DataStreamDlg > aDialog( GetViewData()->GetDocShell(), pTabViewShell->GetDialogParent() );
744 ScDocument *pDoc = GetViewData()->GetDocument();
745 sc::DocumentLinkManager& rMgr = pDoc->GetDocLinkManager();
746 sc::DataStream* pStrm = rMgr.getDataStream();
747 if (pStrm)
748 aDialog->Init(*pStrm);
750 if (aDialog->Execute() == RET_OK)
751 aDialog->StartStream();
753 break;
754 case SID_DATA_STREAMS_PLAY:
756 ScDocument *pDoc = GetViewData()->GetDocument();
757 sc::DocumentLinkManager& rMgr = pDoc->GetDocLinkManager();
758 sc::DataStream* pStrm = rMgr.getDataStream();
759 if (pStrm)
760 pStrm->StartImport();
762 break;
763 case SID_DATA_STREAMS_STOP:
765 ScDocument *pDoc = GetViewData()->GetDocument();
766 sc::DocumentLinkManager& rMgr = pDoc->GetDocLinkManager();
767 sc::DataStream* pStrm = rMgr.getDataStream();
768 if (pStrm)
769 pStrm->StopImport();
771 break;
772 case SID_MANAGE_XML_SOURCE:
773 ExecuteXMLSourceDialog();
774 break;
775 case FID_VALIDATION:
777 const SfxPoolItem* pItem;
778 const SfxItemSet* pArgs = rReq.GetArgs();
779 if ( pArgs )
781 OSL_FAIL("later...");
783 else
785 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
786 OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
787 ::GetTabPageRanges ScTPValidationValueGetRanges = pFact->GetTabPageRangesFunc();
788 OSL_ENSURE(ScTPValidationValueGetRanges, "TabPage create fail!");
789 SfxItemSet aArgSet( GetPool(), (*ScTPValidationValueGetRanges)() );
790 ScValidationMode eMode = SC_VALID_ANY;
791 ScConditionMode eOper = SC_COND_EQUAL;
792 OUString aExpr1, aExpr2;
793 bool bBlank = true;
794 sal_Int16 nListType = css::sheet::TableValidationVisibility::UNSORTED;
795 bool bShowHelp = false;
796 OUString aHelpTitle, aHelpText;
797 bool bShowError = false;
798 ScValidErrorStyle eErrStyle = SC_VALERR_STOP;
799 OUString aErrTitle, aErrText;
801 ScDocument* pDoc = GetViewData()->GetDocument();
802 SCCOL nCurX = GetViewData()->GetCurX();
803 SCROW nCurY = GetViewData()->GetCurY();
804 SCTAB nTab = GetViewData()->GetTabNo();
805 ScAddress aCursorPos( nCurX, nCurY, nTab );
806 sal_uLong nIndex = static_cast<const SfxUInt32Item*>(pDoc->GetAttr(
807 nCurX, nCurY, nTab, ATTR_VALIDDATA ))->GetValue();
808 if ( nIndex )
810 const ScValidationData* pOldData = pDoc->GetValidationEntry( nIndex );
811 if ( pOldData )
813 eMode = pOldData->GetDataMode();
814 eOper = pOldData->GetOperation();
815 sal_uLong nNumFmt = 0;
816 if ( eMode == SC_VALID_DATE || eMode == SC_VALID_TIME )
818 short nType = ( eMode == SC_VALID_DATE ) ? css::util::NumberFormat::DATE
819 : css::util::NumberFormat::TIME;
820 nNumFmt = pDoc->GetFormatTable()->GetStandardFormat(
821 nType, ScGlobal::eLnge );
823 aExpr1 = pOldData->GetExpression( aCursorPos, 0, nNumFmt );
824 aExpr2 = pOldData->GetExpression( aCursorPos, 1, nNumFmt );
825 bBlank = pOldData->IsIgnoreBlank();
826 nListType = pOldData->GetListType();
828 bShowHelp = pOldData->GetInput( aHelpTitle, aHelpText );
829 bShowError = pOldData->GetErrMsg( aErrTitle, aErrText, eErrStyle );
831 aArgSet.Put( SfxAllEnumItem( FID_VALID_MODE, sal::static_int_cast<sal_uInt16>(eMode) ) );
832 aArgSet.Put( SfxAllEnumItem( FID_VALID_CONDMODE, sal::static_int_cast<sal_uInt16>(eOper) ) );
833 aArgSet.Put( SfxStringItem( FID_VALID_VALUE1, aExpr1 ) );
834 aArgSet.Put( SfxStringItem( FID_VALID_VALUE2, aExpr2 ) );
835 aArgSet.Put( SfxBoolItem( FID_VALID_BLANK, bBlank ) );
836 aArgSet.Put( SfxInt16Item( FID_VALID_LISTTYPE, nListType ) );
837 aArgSet.Put( SfxBoolItem( FID_VALID_SHOWHELP, bShowHelp ) );
838 aArgSet.Put( SfxStringItem( FID_VALID_HELPTITLE, aHelpTitle ) );
839 aArgSet.Put( SfxStringItem( FID_VALID_HELPTEXT, aHelpText ) );
840 aArgSet.Put( SfxBoolItem( FID_VALID_SHOWERR, bShowError ) );
841 aArgSet.Put( SfxAllEnumItem( FID_VALID_ERRSTYLE, sal::static_int_cast<sal_uInt16>(eErrStyle) ) );
842 aArgSet.Put( SfxStringItem( FID_VALID_ERRTITLE, aErrTitle ) );
843 aArgSet.Put( SfxStringItem( FID_VALID_ERRTEXT, aErrText ) );
847 // cell range picker
848 SfxAbstractTabDialog* pDlg = pFact->CreateScValidationDlg(NULL, &aArgSet, pTabViewShell);
849 assert(pDlg); //Dialog create fail!
851 short nResult = pDlg->Execute();
852 if ( nResult == RET_OK )
854 const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
856 if ( pOutSet->GetItemState( FID_VALID_MODE, true, &pItem ) == SfxItemState::SET )
857 eMode = (ScValidationMode) static_cast<const SfxAllEnumItem*>(pItem)->GetValue();
858 if ( pOutSet->GetItemState( FID_VALID_CONDMODE, true, &pItem ) == SfxItemState::SET )
859 eOper = (ScConditionMode) static_cast<const SfxAllEnumItem*>(pItem)->GetValue();
860 if ( pOutSet->GetItemState( FID_VALID_VALUE1, true, &pItem ) == SfxItemState::SET )
862 OUString aTemp1 = static_cast<const SfxStringItem*>(pItem)->GetValue();
863 if (eMode == SC_VALID_DATE || eMode == SC_VALID_TIME)
865 sal_uInt32 nNumIndex = 0;
866 double nVal;
867 if (pDoc->GetFormatTable()->IsNumberFormat(aTemp1, nNumIndex, nVal))
868 aExpr1 = OUString( ::rtl::math::doubleToUString( nVal,
869 rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
870 ScGlobal::pLocaleData->getNumDecimalSep()[0], true));
871 else
872 aExpr1 = aTemp1;
874 else
875 aExpr1 = aTemp1;
877 if ( pOutSet->GetItemState( FID_VALID_VALUE2, true, &pItem ) == SfxItemState::SET )
879 OUString aTemp2 = static_cast<const SfxStringItem*>(pItem)->GetValue();
880 if (eMode == SC_VALID_DATE || eMode == SC_VALID_TIME)
882 sal_uInt32 nNumIndex = 0;
883 double nVal;
884 if (pDoc->GetFormatTable()->IsNumberFormat(aTemp2, nNumIndex, nVal))
885 aExpr2 = OUString( ::rtl::math::doubleToUString( nVal,
886 rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
887 ScGlobal::pLocaleData->getNumDecimalSep()[0], true));
888 else
889 aExpr2 = aTemp2;
891 else
892 aExpr2 = aTemp2;
895 if ( pOutSet->GetItemState( FID_VALID_BLANK, true, &pItem ) == SfxItemState::SET )
896 bBlank = static_cast<const SfxBoolItem*>(pItem)->GetValue();
897 if ( pOutSet->GetItemState( FID_VALID_LISTTYPE, true, &pItem ) == SfxItemState::SET )
898 nListType = static_cast<const SfxInt16Item*>(pItem)->GetValue();
900 if ( pOutSet->GetItemState( FID_VALID_SHOWHELP, true, &pItem ) == SfxItemState::SET )
901 bShowHelp = static_cast<const SfxBoolItem*>(pItem)->GetValue();
902 if ( pOutSet->GetItemState( FID_VALID_HELPTITLE, true, &pItem ) == SfxItemState::SET )
903 aHelpTitle = static_cast<const SfxStringItem*>(pItem)->GetValue();
904 if ( pOutSet->GetItemState( FID_VALID_HELPTEXT, true, &pItem ) == SfxItemState::SET )
905 aHelpText = static_cast<const SfxStringItem*>(pItem)->GetValue();
907 if ( pOutSet->GetItemState( FID_VALID_SHOWERR, true, &pItem ) == SfxItemState::SET )
908 bShowError = static_cast<const SfxBoolItem*>(pItem)->GetValue();
909 if ( pOutSet->GetItemState( FID_VALID_ERRSTYLE, true, &pItem ) == SfxItemState::SET )
910 eErrStyle = (ScValidErrorStyle) static_cast<const SfxAllEnumItem*>(pItem)->GetValue();
911 if ( pOutSet->GetItemState( FID_VALID_ERRTITLE, true, &pItem ) == SfxItemState::SET )
912 aErrTitle = static_cast<const SfxStringItem*>(pItem)->GetValue();
913 if ( pOutSet->GetItemState( FID_VALID_ERRTEXT, true, &pItem ) == SfxItemState::SET )
914 aErrText = static_cast<const SfxStringItem*>(pItem)->GetValue();
916 ScValidationData aData( eMode, eOper, aExpr1, aExpr2, pDoc, aCursorPos );
917 aData.SetIgnoreBlank( bBlank );
918 aData.SetListType( nListType );
920 aData.SetInput(aHelpTitle, aHelpText); // sets bShowInput to TRUE
921 if (!bShowHelp)
922 aData.ResetInput(); // reset only bShowInput
924 aData.SetError(aErrTitle, aErrText, eErrStyle); // sets bShowError to TRUE
925 if (!bShowError)
926 aData.ResetError(); // reset only bShowError
928 pTabViewShell->SetValidation( aData );
929 pTabViewShell->TestHintWindow();
930 rReq.Done( *pOutSet );
932 //after end execute from !IsModalInputMode, it is safer to delay deleting
933 //delete pDlg;
934 Application::PostUserEvent( Link<>( pDlg, &DelayDeleteAbstractDialog ) );
937 break;
939 case SID_TEXT_TO_COLUMNS:
941 ScViewData* pData = GetViewData();
942 OSL_ENSURE( pData, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pData is null!" );
943 ScRange aRange;
945 if ( lcl_GetTextToColumnsRange( pData, aRange ) )
947 ScDocument* pDoc = pData->GetDocument();
948 OSL_ENSURE( pDoc, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pDoc is null!" );
950 ScImportExport aExport( pDoc, aRange );
951 aExport.SetExportTextOptions( ScExportTextOptions( ScExportTextOptions::None, 0, false ) );
953 // #i87703# text to columns fails with tab separator
954 aExport.SetDelimiter( static_cast< sal_Unicode >( 0 ) );
956 SvMemoryStream aStream;
957 aStream.SetStreamCharSet( RTL_TEXTENCODING_UNICODE );
958 ScImportExport::SetNoEndianSwap( aStream );
959 aExport.ExportStream( aStream, OUString(), SotClipboardFormatId::STRING );
961 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
962 OSL_ENSURE( pFact, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pFact is null!" );
963 boost::scoped_ptr<AbstractScImportAsciiDlg> pDlg(pFact->CreateScImportAsciiDlg(
964 NULL, OUString(), &aStream, SC_TEXTTOCOLUMNS));
965 OSL_ENSURE( pDlg, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pDlg is null!" );
967 if ( pDlg->Execute() == RET_OK )
969 ScDocShell* pDocSh = pData->GetDocShell();
970 OSL_ENSURE( pDocSh, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pDocSh is null!" );
972 OUString aUndo = ScGlobal::GetRscString( STR_UNDO_TEXTTOCOLUMNS );
973 pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo );
975 ScImportExport aImport( pDoc, aRange.aStart );
976 ScAsciiOptions aOptions;
977 pDlg->GetOptions( aOptions );
978 pDlg->SaveParameters();
979 aImport.SetExtOptions( aOptions );
980 aImport.SetApi( false );
981 aImport.SetImportBroadcast( true );
982 aImport.SetOverwriting( true );
983 aStream.Seek( 0 );
984 aImport.ImportStream( aStream, OUString(), SotClipboardFormatId::STRING );
986 pDocSh->GetUndoManager()->LeaveListAction();
990 break;
994 void ScCellShell::GetDBState( SfxItemSet& rSet )
996 ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell();
997 ScViewData* pData = GetViewData();
998 ScDocShell* pDocSh = pData->GetDocShell();
999 ScDocument& rDoc = pDocSh->GetDocument();
1000 SCCOL nPosX = pData->GetCurX();
1001 SCROW nPosY = pData->GetCurY();
1002 SCTAB nTab = pData->GetTabNo();
1004 bool bAutoFilter = false;
1005 bool bAutoFilterTested = false;
1007 SfxWhichIter aIter(rSet);
1008 sal_uInt16 nWhich = aIter.FirstWhich();
1009 while (nWhich)
1011 switch (nWhich)
1013 case SID_REFRESH_DBAREA:
1015 // imported data without selection
1016 // or filter,sort,subtotal (also without import)
1017 bool bOk = false;
1018 ScDBData* pDBData = pTabViewShell->GetDBData(false,SC_DB_OLD);
1019 if (pDBData && rDoc.GetChangeTrack() == NULL)
1021 if ( pDBData->HasImportParam() )
1022 bOk = !pDBData->HasImportSelection();
1023 else
1025 bOk = pDBData->HasQueryParam() ||
1026 pDBData->HasSortParam() ||
1027 pDBData->HasSubTotalParam();
1030 if (!bOk)
1031 rSet.DisableItem( nWhich );
1033 break;
1035 case SID_FILTER:
1036 case SID_SPECIAL_FILTER:
1038 ScRange aDummy;
1039 ScMarkType eMarkType = GetViewData()->GetSimpleArea( aDummy);
1040 if (eMarkType != SC_MARK_SIMPLE && eMarkType != SC_MARK_SIMPLE_FILTERED)
1042 rSet.DisableItem( nWhich );
1045 break;
1047 //in case of Redlining and multiselection disable
1048 case SID_SORT_ASCENDING:
1049 case SID_SORT_DESCENDING:
1050 case SCITEM_SORTDATA:
1051 case SCITEM_SUBTDATA:
1052 case SID_OPENDLG_PIVOTTABLE:
1054 //! move ReadOnly check to idl flags
1056 if ( pDocSh->IsReadOnly() || rDoc.GetChangeTrack()!=NULL ||
1057 GetViewData()->IsMultiMarked() )
1059 rSet.DisableItem( nWhich );
1062 break;
1064 case SID_REIMPORT_DATA:
1066 // only imported data without selection
1067 ScDBData* pDBData = pTabViewShell->GetDBData(false,SC_DB_OLD);
1068 if (!pDBData || !pDBData->HasImportParam() || pDBData->HasImportSelection() ||
1069 rDoc.GetChangeTrack()!=NULL)
1071 rSet.DisableItem( nWhich );
1074 break;
1076 case SID_VIEW_DATA_SOURCE_BROWSER:
1078 if (!SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::DATABASE))
1079 rSet.Put(SfxVisibilityItem(nWhich, false));
1080 else
1081 // get state (BoolItem) from SfxViewFrame
1082 pTabViewShell->GetViewFrame()->GetSlotState( nWhich, NULL, &rSet );
1084 break;
1085 case SID_SBA_BRW_INSERT:
1087 // SBA wants a sal_Bool-item, enabled
1089 bool bEnable = true;
1090 rSet.Put(SfxBoolItem(nWhich, bEnable));
1092 break;
1094 case SID_AUTO_FILTER:
1095 case SID_AUTOFILTER_HIDE:
1097 if (!bAutoFilterTested)
1099 bAutoFilter = rDoc.HasAutoFilter( nPosX, nPosY, nTab );
1100 bAutoFilterTested = true;
1102 if ( nWhich == SID_AUTO_FILTER )
1104 ScRange aDummy;
1105 ScMarkType eMarkType = GetViewData()->GetSimpleArea( aDummy);
1106 if (eMarkType != SC_MARK_SIMPLE && eMarkType != SC_MARK_SIMPLE_FILTERED)
1108 rSet.DisableItem( nWhich );
1110 else if (rDoc.GetDPAtBlock(aDummy))
1112 rSet.DisableItem( nWhich );
1114 else
1115 rSet.Put( SfxBoolItem( nWhich, bAutoFilter ) );
1117 else
1118 if (!bAutoFilter)
1119 rSet.DisableItem( nWhich );
1121 break;
1123 case SID_UNFILTER:
1125 SCCOL nStartCol, nEndCol;
1126 SCROW nStartRow, nEndRow;
1127 SCTAB nStartTab, nEndTab;
1128 bool bAnyQuery = false;
1130 bool bSelected = (GetViewData()->GetSimpleArea(
1131 nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab )
1132 == SC_MARK_SIMPLE);
1134 if ( bSelected )
1136 if (nStartCol==nEndCol && nStartRow==nEndRow)
1137 bSelected = false;
1139 else
1141 nStartCol = GetViewData()->GetCurX();
1142 nStartRow = GetViewData()->GetCurY();
1143 nStartTab = GetViewData()->GetTabNo();
1146 ScDBData* pDBData = bSelected
1147 ? rDoc.GetDBAtArea( nStartTab, nStartCol, nStartRow, nEndCol, nEndRow )
1148 : rDoc.GetDBAtCursor( nStartCol, nStartRow, nStartTab );
1150 if ( pDBData )
1152 ScQueryParam aParam;
1153 pDBData->GetQueryParam( aParam );
1154 if ( aParam.GetEntry(0).bDoQuery )
1155 bAnyQuery = true;
1158 if ( !bAnyQuery )
1159 rSet.DisableItem( nWhich );
1161 break;
1163 case SID_DEFINE_DBNAME:
1165 if ( pDocSh->IsDocShared() )
1167 rSet.DisableItem( nWhich );
1170 break;
1171 case SID_DATA_STREAMS:
1172 case SID_DATA_STREAMS_PLAY:
1173 case SID_DATA_STREAMS_STOP:
1175 SvtMiscOptions aMiscOptions;
1176 if ( !aMiscOptions.IsExperimentalMode() )
1177 rSet.DisableItem( nWhich );
1179 break;
1180 case SID_TEXT_TO_COLUMNS:
1182 ScRange aRange;
1183 if ( !lcl_GetTextToColumnsRange( pData, aRange ) )
1185 rSet.DisableItem( nWhich );
1188 break;
1189 #if !ENABLE_ORCUS
1190 case SID_MANAGE_XML_SOURCE:
1191 rSet.DisableItem(nWhich);
1192 break;
1193 #endif
1195 nWhich = aIter.NextWhich();
1199 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */