Bump version to 4.3-4
[LibreOffice.git] / sc / source / ui / view / cellsh2.cxx
blob7b7189c9549ba171701dc4b4bb19018aa54ba736
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 "scitems.hxx"
21 #include <sfx2/viewfrm.hxx>
22 #include <sfx2/app.hxx>
23 #include <sfx2/request.hxx>
24 #include <svl/aeitem.hxx>
25 #include <basic/sbxcore.hxx>
26 #include <svl/whiter.hxx>
27 #include <svl/zforlist.hxx>
28 #include <vcl/msgbox.hxx>
29 #include <svl/stritem.hxx>
30 #include <svl/visitem.hxx>
31 #include <svtools/miscopt.hxx>
32 #include <unotools/moduleoptions.hxx>
34 #include <com/sun/star/frame/FrameSearchFlag.hpp>
35 #include <com/sun/star/sdbc/XResultSet.hpp>
37 #include "cellsh.hxx"
38 #include "tabvwsh.hxx"
39 #include "sc.hrc"
40 #include "globstr.hrc"
41 #include "global.hxx"
42 #include "globalnames.hxx"
43 #include "scmod.hxx"
44 #include "docsh.hxx"
45 #include "document.hxx"
46 #include "uiitems.hxx"
47 #include "dbfunc.hxx"
48 #include "dbdocfun.hxx"
49 #include "filtdlg.hxx"
50 #include "dbnamdlg.hxx"
51 #include "reffact.hxx"
52 #include "validat.hxx"
53 #include "scresid.hxx"
55 #include "scui_def.hxx"
56 #include "scabstdlg.hxx"
57 #include "impex.hxx"
58 #include "asciiopt.hxx"
59 #include "datastream.hxx"
60 #include "datastreamdlg.hxx"
61 #include "queryentry.hxx"
62 #include "markdata.hxx"
63 #include <documentlinkmgr.hxx>
65 #include <config_orcus.h>
67 #include <boost/scoped_ptr.hpp>
69 using namespace com::sun::star;
71 static bool lcl_GetTextToColumnsRange( const ScViewData* pData, ScRange& rRange )
73 OSL_ENSURE( pData, "lcl_GetTextToColumnsRange: pData is null!" );
75 bool bRet = false;
76 const ScMarkData& rMark = pData->GetMarkData();
78 if ( rMark.IsMarked() )
80 if ( !rMark.IsMultiMarked() )
82 rMark.GetMarkArea( rRange );
83 if ( rRange.aStart.Col() == rRange.aEnd.Col() )
85 bRet = true;
89 else
91 const SCCOL nCol = pData->GetCurX();
92 const SCROW nRow = pData->GetCurY();
93 const SCTAB nTab = pData->GetTabNo();
94 rRange = ScRange( nCol, nRow, nTab, nCol, nRow, nTab );
95 bRet = true;
98 const ScDocument* pDoc = pData->GetDocument();
99 OSL_ENSURE( pDoc, "lcl_GetTextToColumnsRange: pDoc is null!" );
101 if ( bRet && pDoc->IsBlockEmpty( rRange.aStart.Tab(), rRange.aStart.Col(),
102 rRange.aStart.Row(), rRange.aEnd.Col(),
103 rRange.aEnd.Row() ) )
105 bRet = false;
108 return bRet;
111 static bool lcl_GetSortParam( const ScViewData* pData, ScSortParam& rSortParam )
113 ScTabViewShell* pTabViewShell = pData->GetViewShell();
114 ScDBData* pDBData = pTabViewShell->GetDBData();
115 ScDocument* pDoc = pData->GetDocument();
116 SCTAB nTab = pData->GetTabNo();
117 ScDirection eFillDir = DIR_TOP;
118 bool bSort = true;
119 ScRange aExternalRange;
121 if( rSortParam.nCol1 != rSortParam.nCol2 )
122 eFillDir = DIR_LEFT;
123 if( rSortParam.nRow1 != rSortParam.nRow2 )
124 eFillDir = DIR_TOP;
126 if( rSortParam.nRow2 == MAXROW )
128 // Assume that user selected entire column(s), but cater for the
129 // possibility that the start row is not the first row.
130 SCSIZE nCount = pDoc->GetEmptyLinesInBlock( rSortParam.nCol1, rSortParam.nRow1, nTab,
131 rSortParam.nCol2, rSortParam.nRow2, nTab, eFillDir );
132 aExternalRange = ScRange( rSortParam.nCol1,
133 ::std::min( rSortParam.nRow1 + sal::static_int_cast<SCROW>( nCount ), MAXROW), nTab );
135 else
136 aExternalRange = ScRange( pData->GetCurX(), pData->GetCurY(), nTab );
138 SCROW nStartRow = aExternalRange.aStart.Row();
139 SCCOL nStartCol = aExternalRange.aStart.Col();
140 SCROW nEndRow = aExternalRange.aEnd.Row();
141 SCCOL nEndCol = aExternalRange.aEnd.Col();
142 pDoc->GetDataArea( aExternalRange.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow, false, false );
143 aExternalRange.aStart.SetRow( nStartRow );
144 aExternalRange.aStart.SetCol( nStartCol );
145 aExternalRange.aEnd.SetRow( nEndRow );
146 aExternalRange.aEnd.SetCol( nEndCol );
148 if(( rSortParam.nCol1 == rSortParam.nCol2 && aExternalRange.aStart.Col() != aExternalRange.aEnd.Col() ) ||
149 ( rSortParam.nRow1 == rSortParam.nRow2 && aExternalRange.aStart.Row() != aExternalRange.aEnd.Row() ) )
151 sal_uInt16 nFmt = SCA_VALID;
153 pTabViewShell->AddHighlightRange( aExternalRange,Color( COL_LIGHTBLUE ) );
154 ScRange rExtendRange( aExternalRange.aStart.Col(), aExternalRange.aStart.Row(), nTab, aExternalRange.aEnd.Col(), aExternalRange.aEnd.Row(), nTab );
155 OUString aExtendStr(rExtendRange.Format(nFmt, pDoc));
157 ScRange rCurrentRange( rSortParam.nCol1, rSortParam.nRow1, nTab, rSortParam.nCol2, rSortParam.nRow2, nTab );
158 OUString aCurrentStr(rCurrentRange.Format(nFmt, pDoc));
160 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
161 OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
163 boost::scoped_ptr<AbstractScSortWarningDlg> pWarningDlg(pFact->CreateScSortWarningDlg( pTabViewShell->GetDialogParent(), aExtendStr, aCurrentStr ));
164 OSL_ENSURE(pWarningDlg, "Dialog create fail!");
165 short bResult = pWarningDlg->Execute();
166 if( bResult == BTN_EXTEND_RANGE || bResult == BTN_CURRENT_SELECTION )
168 if( bResult == BTN_EXTEND_RANGE )
170 pTabViewShell->MarkRange( aExternalRange, false );
171 pDBData->SetArea( nTab, aExternalRange.aStart.Col(), aExternalRange.aStart.Row(), aExternalRange.aEnd.Col(), aExternalRange.aEnd.Row() );
174 else
176 bSort = false;
177 pData->GetDocShell()->CancelAutoDBRange();
180 pTabViewShell->ClearHighlightRanges();
182 return bSort;
185 //after end execute from !IsModalInputMode, it is safer to delay deleting
186 namespace
188 long DelayDeleteAbstractDialog( void *pAbstractDialog, void * /*pArg*/ )
190 delete reinterpret_cast<SfxAbstractTabDialog*>( pAbstractDialog );
191 return 0;
195 void ScCellShell::ExecuteDB( SfxRequest& rReq )
197 ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell();
198 sal_uInt16 nSlotId = rReq.GetSlot();
199 const SfxItemSet* pReqArgs = rReq.GetArgs();
200 ScModule* pScMod = SC_MOD();
202 pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox
204 if ( GetViewData()->HasEditView( GetViewData()->GetActivePart() ) )
206 pScMod->InputEnterHandler();
207 pTabViewShell->UpdateInputHandler();
210 switch ( nSlotId )
212 case SID_VIEW_DATA_SOURCE_BROWSER:
214 // check if database beamer is open
216 SfxViewFrame* pViewFrame = pTabViewShell->GetViewFrame();
217 bool bWasOpen = false;
219 uno::Reference<frame::XFrame> xFrame = pViewFrame->GetFrame().GetFrameInterface();
220 uno::Reference<frame::XFrame> xBeamerFrame = xFrame->findFrame(
221 OUString("_beamer"),
222 frame::FrameSearchFlag::CHILDREN);
223 if ( xBeamerFrame.is() )
224 bWasOpen = true;
227 if ( bWasOpen )
229 // close database beamer: just forward to SfxViewFrame
231 pViewFrame->ExecuteSlot( rReq );
233 else
235 // show database beamer: SfxViewFrame call must be synchronous
237 pViewFrame->ExecuteSlot( rReq, false ); // false = synchronous
239 // select current database in database beamer
241 ScImportParam aImportParam;
242 ScDBData* pDBData = pTabViewShell->GetDBData(true,SC_DB_OLD); // don't create if none found
243 if (pDBData)
244 pDBData->GetImportParam( aImportParam );
246 ScDBDocFunc::ShowInBeamer( aImportParam, pTabViewShell->GetViewFrame() );
248 rReq.Done(); // needed because it's a toggle slot
250 break;
252 case SID_REIMPORT_DATA:
254 bool bOk = false;
255 ScDBData* pDBData = pTabViewShell->GetDBData(true,SC_DB_OLD);
256 if (pDBData)
258 ScImportParam aImportParam;
259 pDBData->GetImportParam( aImportParam );
260 if (aImportParam.bImport && !pDBData->HasImportSelection())
262 pTabViewShell->ImportData( aImportParam );
263 pDBData->SetImportParam( aImportParam ); //! Undo ??
264 bOk = true;
268 if (!bOk && ! rReq.IsAPI() )
269 pTabViewShell->ErrorMessage(STR_REIMPORT_EMPTY);
271 if( bOk )
272 rReq.Done();
274 break;
276 case SID_REFRESH_DBAREA:
278 ScDBData* pDBData = pTabViewShell->GetDBData(true,SC_DB_OLD);
279 if (pDBData)
281 // repeat import like SID_REIMPORT_DATA
283 bool bContinue = true;
284 ScImportParam aImportParam;
285 pDBData->GetImportParam( aImportParam );
286 if (aImportParam.bImport && !pDBData->HasImportSelection())
288 bContinue = pTabViewShell->ImportData( aImportParam );
289 pDBData->SetImportParam( aImportParam ); //! Undo ??
291 // mark (size may have been changed)
292 ScRange aNewRange;
293 pDBData->GetArea(aNewRange);
294 pTabViewShell->MarkRange(aNewRange);
297 if ( bContinue ) // fail at import -> break
299 // internal operations, when any stored
301 if ( pDBData->HasQueryParam() || pDBData->HasSortParam() ||
302 pDBData->HasSubTotalParam() )
303 pTabViewShell->RepeatDB();
305 // pivot tables that have the range as data source
307 ScRange aRange;
308 pDBData->GetArea(aRange);
309 GetViewData()->GetDocShell()->RefreshPivotTables(aRange);
312 rReq.Done();
314 break;
316 case SID_SBA_BRW_INSERT:
318 OSL_FAIL( "Deprecated Slot" );
320 break;
322 case SID_DATA_FORM:
324 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
325 OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
327 AbstractScDataFormDlg* pDlg = pFact->CreateScDataFormDlg(
328 pTabViewShell->GetDialogParent(), pTabViewShell);
329 OSL_ENSURE(pDlg, "Dialog create fail!");
331 pDlg->Execute();
333 rReq.Done();
335 break;
337 case SID_SUBTOTALS:
338 ExecuteSubtotals(rReq);
339 break;
341 case SID_SORT_DESCENDING:
342 case SID_SORT_ASCENDING:
344 //#i60401 ux-ctest: Calc does not support all users' strategies regarding sorting data
345 //the patch comes from maoyg
346 ScSortParam aSortParam;
347 ScDBData* pDBData = pTabViewShell->GetDBData();
348 ScViewData* pData = GetViewData();
350 pDBData->GetSortParam( aSortParam );
352 if( lcl_GetSortParam( pData, aSortParam ) )
354 SfxItemSet aArgSet( GetPool(), SCITEM_SORTDATA, SCITEM_SORTDATA );
355 SCCOL nCol = GetViewData()->GetCurX();
356 SCCOL nTab = GetViewData()->GetTabNo();
357 ScDocument* pDoc = GetViewData()->GetDocument();
359 pDBData->GetSortParam( aSortParam );
360 bool bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, nTab );
362 if( nCol < aSortParam.nCol1 )
363 nCol = aSortParam.nCol1;
364 else if( nCol > aSortParam.nCol2 )
365 nCol = aSortParam.nCol2;
367 aSortParam.bHasHeader = bHasHeader;
368 aSortParam.bByRow = true;
369 aSortParam.bCaseSens = false;
370 aSortParam.bNaturalSort = false;
371 aSortParam.bIncludePattern = true;
372 aSortParam.bInplace = true;
373 aSortParam.maKeyState[0].bDoSort = true;
374 aSortParam.maKeyState[0].nField = nCol;
375 aSortParam.maKeyState[0].bAscending = ( nSlotId == SID_SORT_ASCENDING );
377 for ( sal_uInt16 i=1; i<aSortParam.GetSortKeyCount(); i++ )
378 aSortParam.maKeyState[i].bDoSort = false;
380 aArgSet.Put( ScSortItem( SCITEM_SORTDATA, GetViewData(), &aSortParam ) );
382 pTabViewShell->UISort( aSortParam ); // subtotal when needed new
384 rReq.Done();
387 break;
389 case SID_SORT:
391 const SfxItemSet* pArgs = rReq.GetArgs();
393 //#i60401 ux-ctest: Calc does not support all users' strategies regarding sorting data
394 //the patch comes from maoyg
396 if ( pArgs ) // Basic
398 ScSortParam aSortParam;
399 ScDBData* pDBData = pTabViewShell->GetDBData();
400 ScViewData* pData = GetViewData();
402 pDBData->GetSortParam( aSortParam );
404 if( lcl_GetSortParam( pData, aSortParam ) )
406 ScDocument* pDoc = GetViewData()->GetDocument();
408 pDBData->GetSortParam( aSortParam );
409 bool bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, pData->GetTabNo() );
410 if( bHasHeader )
411 aSortParam.bHasHeader = bHasHeader;
413 aSortParam.bInplace = true; // from Basic always
415 const SfxPoolItem* pItem;
416 if ( pArgs->GetItemState( SID_SORT_BYROW, true, &pItem ) == SFX_ITEM_SET )
417 aSortParam.bByRow = static_cast<const SfxBoolItem*>(pItem)->GetValue();
418 if ( pArgs->GetItemState( SID_SORT_HASHEADER, true, &pItem ) == SFX_ITEM_SET )
419 aSortParam.bHasHeader = static_cast<const SfxBoolItem*>(pItem)->GetValue();
420 if ( pArgs->GetItemState( SID_SORT_CASESENS, true, &pItem ) == SFX_ITEM_SET )
421 aSortParam.bCaseSens = static_cast<const SfxBoolItem*>(pItem)->GetValue();
422 if ( pArgs->GetItemState( SID_SORT_NATURALSORT, true, &pItem ) == SFX_ITEM_SET )
423 aSortParam.bNaturalSort = static_cast<const SfxBoolItem*>(pItem)->GetValue();
424 if ( pArgs->GetItemState( SID_SORT_ATTRIBS, true, &pItem ) == SFX_ITEM_SET )
425 aSortParam.bIncludePattern = static_cast<const SfxBoolItem*>(pItem)->GetValue();
426 if ( pArgs->GetItemState( SID_SORT_USERDEF, true, &pItem ) == SFX_ITEM_SET )
428 sal_uInt16 nUserIndex = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
429 aSortParam.bUserDef = ( nUserIndex != 0 );
430 if ( nUserIndex )
431 aSortParam.nUserIndex = nUserIndex - 1; // Basic: 1-based
434 SCCOLROW nField0 = 0;
435 if ( pArgs->GetItemState( FN_PARAM_1, true, &pItem ) == SFX_ITEM_SET )
436 nField0 = static_cast<const SfxInt32Item*>(pItem)->GetValue();
437 aSortParam.maKeyState[0].bDoSort = ( nField0 != 0 );
438 aSortParam.maKeyState[0].nField = nField0 > 0 ? (nField0-1) : 0;
439 if ( pArgs->GetItemState( FN_PARAM_2, true, &pItem ) == SFX_ITEM_SET )
440 aSortParam.maKeyState[0].bAscending = static_cast<const SfxBoolItem*>(pItem)->GetValue();
441 SCCOLROW nField1 = 0;
442 if ( pArgs->GetItemState( FN_PARAM_3, true, &pItem ) == SFX_ITEM_SET )
443 nField1 = static_cast<const SfxInt32Item*>(pItem)->GetValue();
444 aSortParam.maKeyState[1].bDoSort = ( nField1 != 0 );
445 aSortParam.maKeyState[1].nField = nField1 > 0 ? (nField1-1) : 0;
446 if ( pArgs->GetItemState( FN_PARAM_4, true, &pItem ) == SFX_ITEM_SET )
447 aSortParam.maKeyState[1].bAscending = static_cast<const SfxBoolItem*>(pItem)->GetValue();
448 SCCOLROW nField2 = 0;
449 if ( pArgs->GetItemState( FN_PARAM_5, true, &pItem ) == SFX_ITEM_SET )
450 nField2 = static_cast<const SfxInt32Item*>(pItem)->GetValue();
451 aSortParam.maKeyState[2].bDoSort = ( nField2 != 0 );
452 aSortParam.maKeyState[2].nField = nField2 > 0 ? (nField2-1) : 0;
453 if ( pArgs->GetItemState( FN_PARAM_6, true, &pItem ) == SFX_ITEM_SET )
454 aSortParam.maKeyState[2].bAscending = static_cast<const SfxBoolItem*>(pItem)->GetValue();
456 // subtotal when needed new
457 pTabViewShell->UISort( aSortParam );
458 rReq.Done();
461 else
463 ScSortParam aSortParam;
464 ScDBData* pDBData = pTabViewShell->GetDBData();
465 ScViewData* pData = GetViewData();
467 pDBData->GetSortParam( aSortParam );
469 if( lcl_GetSortParam( pData, aSortParam ) )
471 ScDocument* pDoc = GetViewData()->GetDocument();
472 SfxItemSet aArgSet( GetPool(), SCITEM_SORTDATA, SCITEM_SORTDATA );
474 pDBData->GetSortParam( aSortParam );
475 bool bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, pData->GetTabNo() );
476 if( bHasHeader )
477 aSortParam.bHasHeader = bHasHeader;
479 aArgSet.Put( ScSortItem( SCITEM_SORTDATA, GetViewData(), &aSortParam ) );
481 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
482 assert(pFact); //ScAbstractFactory create fail!
484 boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateScSortDlg(pTabViewShell->GetDialogParent(), &aArgSet));
485 assert(pDlg); //Dialog create fail!
486 pDlg->SetCurPageId("criteria"); // 1=sort field tab 2=sort options tab
488 if ( pDlg->Execute() == RET_OK )
490 const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
491 const ScSortParam& rOutParam = ((const ScSortItem&)
492 pOutSet->Get( SCITEM_SORTDATA )).GetSortData();
494 // subtotal when needed new
496 pTabViewShell->UISort( rOutParam );
498 if ( rOutParam.bInplace )
500 rReq.AppendItem( SfxBoolItem( SID_SORT_BYROW,
501 rOutParam.bByRow ) );
502 rReq.AppendItem( SfxBoolItem( SID_SORT_HASHEADER,
503 rOutParam.bHasHeader ) );
504 rReq.AppendItem( SfxBoolItem( SID_SORT_CASESENS,
505 rOutParam.bCaseSens ) );
506 rReq.AppendItem( SfxBoolItem( SID_SORT_NATURALSORT,
507 rOutParam.bNaturalSort ) );
508 rReq.AppendItem( SfxBoolItem( SID_SORT_ATTRIBS,
509 rOutParam.bIncludePattern ) );
510 sal_uInt16 nUser = rOutParam.bUserDef ? ( rOutParam.nUserIndex + 1 ) : 0;
511 rReq.AppendItem( SfxUInt16Item( SID_SORT_USERDEF, nUser ) );
512 if ( rOutParam.maKeyState[0].bDoSort )
514 rReq.AppendItem( SfxInt32Item( FN_PARAM_1,
515 rOutParam.maKeyState[0].nField + 1 ) );
516 rReq.AppendItem( SfxBoolItem( FN_PARAM_2,
517 rOutParam.maKeyState[0].bAscending ) );
519 if ( rOutParam.maKeyState[1].bDoSort )
521 rReq.AppendItem( SfxInt32Item( FN_PARAM_3,
522 rOutParam.maKeyState[1].nField + 1 ) );
523 rReq.AppendItem( SfxBoolItem( FN_PARAM_4,
524 rOutParam.maKeyState[1].bAscending ) );
526 if ( rOutParam.maKeyState[2].bDoSort )
528 rReq.AppendItem( SfxInt32Item( FN_PARAM_5,
529 rOutParam.maKeyState[2].nField + 1 ) );
530 rReq.AppendItem( SfxBoolItem( FN_PARAM_6,
531 rOutParam.maKeyState[2].bAscending ) );
535 rReq.Done();
537 else
538 GetViewData()->GetDocShell()->CancelAutoDBRange();
542 break;
544 case SID_FILTER:
546 const SfxItemSet* pArgs = rReq.GetArgs();
547 if ( pArgs )
549 OSL_FAIL("SID_FILTER with arguments?");
550 pTabViewShell->Query( ((const ScQueryItem&)
551 pArgs->Get( SCITEM_QUERYDATA )).GetQueryData(), NULL, true );
552 rReq.Done();
554 else
556 sal_uInt16 nId = ScFilterDlgWrapper::GetChildWindowId();
557 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
558 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
560 pScMod->SetRefDialog( nId, pWnd ? false : sal_True );
563 break;
565 case SID_SPECIAL_FILTER:
567 const SfxItemSet* pArgs = rReq.GetArgs();
568 if ( pArgs )
570 OSL_FAIL("SID_SPECIAL_FILTER with arguments?");
571 pTabViewShell->Query( ((const ScQueryItem&)
572 pArgs->Get( SCITEM_QUERYDATA )).GetQueryData(), NULL, true );
573 rReq.Done();
575 else
577 sal_uInt16 nId = ScSpecialFilterDlgWrapper::GetChildWindowId();
578 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
579 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
581 pScMod->SetRefDialog( nId, pWnd ? false : sal_True );
584 break;
586 case FID_FILTER_OK:
588 const SfxPoolItem* pItem;
589 if ( pReqArgs && SFX_ITEM_SET ==
590 pReqArgs->GetItemState( SCITEM_QUERYDATA, true, &pItem ) )
592 const ScQueryItem& rQueryItem = static_cast<const ScQueryItem&>(*pItem);
594 SCTAB nCurTab = GetViewData()->GetTabNo();
595 SCTAB nRefTab = GetViewData()->GetRefTabNo();
597 // If RefInput switched to a different sheet from the data sheet,
598 // switch back:
600 if ( nCurTab != nRefTab )
602 pTabViewShell->SetTabNo( nRefTab );
603 pTabViewShell->PaintExtras();
606 ScRange aAdvSource;
607 if (rQueryItem.GetAdvancedQuerySource(aAdvSource))
608 pTabViewShell->Query( rQueryItem.GetQueryData(), &aAdvSource, true );
609 else
610 pTabViewShell->Query( rQueryItem.GetQueryData(), NULL, true );
611 rReq.Done( *pReqArgs );
614 break;
616 case SID_UNFILTER:
618 ScQueryParam aParam;
619 ScDBData* pDBData = pTabViewShell->GetDBData();
621 pDBData->GetQueryParam( aParam );
622 SCSIZE nEC = aParam.GetEntryCount();
623 for (SCSIZE i=0; i<nEC; i++)
624 aParam.GetEntry(i).bDoQuery = false;
625 aParam.bDuplicate = true;
626 pTabViewShell->Query( aParam, NULL, true );
627 rReq.Done();
629 break;
631 case SID_AUTO_FILTER:
632 pTabViewShell->ToggleAutoFilter();
633 rReq.Done();
634 break;
636 case SID_AUTOFILTER_HIDE:
637 pTabViewShell->HideAutoFilter();
638 rReq.Done();
639 break;
641 case SID_PIVOT_TABLE:
643 const SfxPoolItem* pItem;
644 if ( pReqArgs && SFX_ITEM_SET ==
645 pReqArgs->GetItemState( SCITEM_PIVOTDATA, true, &pItem ) )
647 SCTAB nCurTab = GetViewData()->GetTabNo();
648 SCTAB nRefTab = GetViewData()->GetRefTabNo();
650 // If RefInput switched to a different sheet from the data sheet,
651 // switch back:
653 if ( nCurTab != nRefTab )
655 pTabViewShell->SetTabNo( nRefTab );
656 pTabViewShell->PaintExtras();
659 const ScDPObject* pDPObject = pTabViewShell->GetDialogDPObject();
660 if ( pDPObject )
662 const ScPivotItem* pPItem = (const ScPivotItem*)pItem;
663 bool bSuccess = pTabViewShell->MakePivotTable(
664 pPItem->GetData(), pPItem->GetDestRange(), pPItem->IsNewSheet(), *pDPObject );
665 SfxBoolItem aRet(0, bSuccess);
666 rReq.SetReturnValue(aRet);
668 rReq.Done();
670 #ifndef DISABLE_SCRIPTING
671 else if (rReq.IsAPI())
672 SbxBase::SetError(SbxERR_BAD_PARAMETER);
673 #endif
675 break;
677 case SID_OPENDLG_PIVOTTABLE:
678 ExecuteDataPilotDialog();
679 break;
680 case SID_DEFINE_DBNAME:
683 sal_uInt16 nId = ScDbNameDlgWrapper::GetChildWindowId();
684 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
685 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
687 pScMod->SetRefDialog( nId, pWnd ? false : sal_True );
690 break;
692 case SID_SELECT_DB:
694 if ( pReqArgs )
696 const SfxStringItem* pItem =
697 (const SfxStringItem*)&pReqArgs->Get( SID_SELECT_DB );
699 if( pItem )
701 pTabViewShell->GotoDBArea( pItem->GetValue() );
702 rReq.Done();
704 else
706 OSL_FAIL("NULL");
709 else
711 ScDocument* pDoc = GetViewData()->GetDocument();
712 ScDBCollection* pDBCol = pDoc->GetDBCollection();
714 if ( pDBCol )
716 std::vector<OUString> aList;
717 const ScDBCollection::NamedDBs& rDBs = pDBCol->getNamedDBs();
718 ScDBCollection::NamedDBs::const_iterator itr = rDBs.begin(), itrEnd = rDBs.end();
719 for (; itr != itrEnd; ++itr)
720 aList.push_back(itr->GetName());
722 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
723 OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
725 boost::scoped_ptr<AbstractScSelEntryDlg> pDlg(pFact->CreateScSelEntryDlg( pTabViewShell->GetDialogParent(),
726 aList ));
727 OSL_ENSURE(pDlg, "Dialog create fail!");
728 if ( pDlg->Execute() == RET_OK )
730 OUString aName = pDlg->GetSelectEntry();
731 pTabViewShell->GotoDBArea( aName );
732 rReq.AppendItem( SfxStringItem( SID_SELECT_DB, aName ) );
733 rReq.Done();
738 break;
739 case SID_DATA_STREAMS:
741 sc::DataStreamDlg aDialog( GetViewData()->GetDocShell(), pTabViewShell->GetDialogParent() );
742 ScDocument *pDoc = GetViewData()->GetDocument();
743 sc::DocumentLinkManager& rMgr = pDoc->GetDocLinkManager();
744 sc::DataStream* pStrm = rMgr.getDataStream();
745 if (pStrm)
746 aDialog.Init(*pStrm);
748 if (aDialog.Execute() == RET_OK)
749 aDialog.StartStream();
751 break;
752 case SID_DATA_STREAMS_PLAY:
754 ScDocument *pDoc = GetViewData()->GetDocument();
755 sc::DocumentLinkManager& rMgr = pDoc->GetDocLinkManager();
756 sc::DataStream* pStrm = rMgr.getDataStream();
757 if (pStrm)
758 pStrm->StartImport();
760 break;
761 case SID_DATA_STREAMS_STOP:
763 ScDocument *pDoc = GetViewData()->GetDocument();
764 sc::DocumentLinkManager& rMgr = pDoc->GetDocLinkManager();
765 sc::DataStream* pStrm = rMgr.getDataStream();
766 if (pStrm)
767 pStrm->StopImport();
769 break;
770 case SID_MANAGE_XML_SOURCE:
771 ExecuteXMLSourceDialog();
772 break;
773 case FID_VALIDATION:
775 const SfxPoolItem* pItem;
776 const SfxItemSet* pArgs = rReq.GetArgs();
777 if ( pArgs )
779 OSL_FAIL("later...");
781 else
783 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
784 OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
785 ::GetTabPageRanges ScTPValidationValueGetRanges = pFact->GetTabPageRangesFunc();
786 OSL_ENSURE(ScTPValidationValueGetRanges, "TabPage create fail!");
787 SfxItemSet aArgSet( GetPool(), (*ScTPValidationValueGetRanges)() );
788 ScValidationMode eMode = SC_VALID_ANY;
789 ScConditionMode eOper = SC_COND_EQUAL;
790 OUString aExpr1, aExpr2;
791 bool bBlank = true;
792 sal_Int16 nListType = ValidListType::UNSORTED;
793 bool bShowHelp = false;
794 OUString aHelpTitle, aHelpText;
795 bool bShowError = false;
796 ScValidErrorStyle eErrStyle = SC_VALERR_STOP;
797 OUString aErrTitle, aErrText;
799 ScDocument* pDoc = GetViewData()->GetDocument();
800 SCCOL nCurX = GetViewData()->GetCurX();
801 SCROW nCurY = GetViewData()->GetCurY();
802 SCTAB nTab = GetViewData()->GetTabNo();
803 ScAddress aCursorPos( nCurX, nCurY, nTab );
804 sal_uLong nIndex = ((SfxUInt32Item*)pDoc->GetAttr(
805 nCurX, nCurY, nTab, ATTR_VALIDDATA ))->GetValue();
806 if ( nIndex )
808 const ScValidationData* pOldData = pDoc->GetValidationEntry( nIndex );
809 if ( pOldData )
811 eMode = pOldData->GetDataMode();
812 eOper = pOldData->GetOperation();
813 sal_uLong nNumFmt = 0;
814 if ( eMode == SC_VALID_DATE || eMode == SC_VALID_TIME )
816 short nType = ( eMode == SC_VALID_DATE ) ? NUMBERFORMAT_DATE
817 : NUMBERFORMAT_TIME;
818 nNumFmt = pDoc->GetFormatTable()->GetStandardFormat(
819 nType, ScGlobal::eLnge );
821 aExpr1 = pOldData->GetExpression( aCursorPos, 0, nNumFmt );
822 aExpr2 = pOldData->GetExpression( aCursorPos, 1, nNumFmt );
823 bBlank = pOldData->IsIgnoreBlank();
824 nListType = pOldData->GetListType();
826 bShowHelp = pOldData->GetInput( aHelpTitle, aHelpText );
827 bShowError = pOldData->GetErrMsg( aErrTitle, aErrText, eErrStyle );
829 aArgSet.Put( SfxAllEnumItem( FID_VALID_MODE, sal::static_int_cast<sal_uInt16>(eMode) ) );
830 aArgSet.Put( SfxAllEnumItem( FID_VALID_CONDMODE, sal::static_int_cast<sal_uInt16>(eOper) ) );
831 aArgSet.Put( SfxStringItem( FID_VALID_VALUE1, aExpr1 ) );
832 aArgSet.Put( SfxStringItem( FID_VALID_VALUE2, aExpr2 ) );
833 aArgSet.Put( SfxBoolItem( FID_VALID_BLANK, bBlank ) );
834 aArgSet.Put( SfxInt16Item( FID_VALID_LISTTYPE, nListType ) );
835 aArgSet.Put( SfxBoolItem( FID_VALID_SHOWHELP, bShowHelp ) );
836 aArgSet.Put( SfxStringItem( FID_VALID_HELPTITLE, aHelpTitle ) );
837 aArgSet.Put( SfxStringItem( FID_VALID_HELPTEXT, aHelpText ) );
838 aArgSet.Put( SfxBoolItem( FID_VALID_SHOWERR, bShowError ) );
839 aArgSet.Put( SfxAllEnumItem( FID_VALID_ERRSTYLE, sal::static_int_cast<sal_uInt16>(eErrStyle) ) );
840 aArgSet.Put( SfxStringItem( FID_VALID_ERRTITLE, aErrTitle ) );
841 aArgSet.Put( SfxStringItem( FID_VALID_ERRTEXT, aErrText ) );
845 // cell range picker
846 SfxAbstractTabDialog* pDlg = pFact->CreateScValidationDlg(NULL, &aArgSet, pTabViewShell);
847 assert(pDlg); //Dialog create fail!
849 short nResult = pDlg->Execute();
850 if ( nResult == RET_OK )
852 const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
854 if ( pOutSet->GetItemState( FID_VALID_MODE, true, &pItem ) == SFX_ITEM_SET )
855 eMode = (ScValidationMode) ((const SfxAllEnumItem*)pItem)->GetValue();
856 if ( pOutSet->GetItemState( FID_VALID_CONDMODE, true, &pItem ) == SFX_ITEM_SET )
857 eOper = (ScConditionMode) ((const SfxAllEnumItem*)pItem)->GetValue();
858 if ( pOutSet->GetItemState( FID_VALID_VALUE1, true, &pItem ) == SFX_ITEM_SET )
860 OUString aTemp1 = ((const SfxStringItem*)pItem)->GetValue();
861 if (eMode == SC_VALID_DATE || eMode == SC_VALID_TIME)
863 sal_uInt32 nNumIndex = 0;
864 double nVal;
865 if (pDoc->GetFormatTable()->IsNumberFormat(aTemp1, nNumIndex, nVal))
866 aExpr1 = OUString( ::rtl::math::doubleToUString( nVal,
867 rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
868 ScGlobal::pLocaleData->getNumDecimalSep()[0], true));
869 else
870 aExpr1 = aTemp1;
872 else
873 aExpr1 = aTemp1;
875 if ( pOutSet->GetItemState( FID_VALID_VALUE2, true, &pItem ) == SFX_ITEM_SET )
877 OUString aTemp2 = ((const SfxStringItem*)pItem)->GetValue();
878 if (eMode == SC_VALID_DATE || eMode == SC_VALID_TIME)
880 sal_uInt32 nNumIndex = 0;
881 double nVal;
882 if (pDoc->GetFormatTable()->IsNumberFormat(aTemp2, nNumIndex, nVal))
883 aExpr2 = OUString( ::rtl::math::doubleToUString( nVal,
884 rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
885 ScGlobal::pLocaleData->getNumDecimalSep()[0], true));
886 else
887 aExpr2 = aTemp2;
889 else
890 aExpr2 = aTemp2;
893 if ( pOutSet->GetItemState( FID_VALID_BLANK, true, &pItem ) == SFX_ITEM_SET )
894 bBlank = ((const SfxBoolItem*)pItem)->GetValue();
895 if ( pOutSet->GetItemState( FID_VALID_LISTTYPE, true, &pItem ) == SFX_ITEM_SET )
896 nListType = ((const SfxInt16Item*)pItem)->GetValue();
898 if ( pOutSet->GetItemState( FID_VALID_SHOWHELP, true, &pItem ) == SFX_ITEM_SET )
899 bShowHelp = ((const SfxBoolItem*)pItem)->GetValue();
900 if ( pOutSet->GetItemState( FID_VALID_HELPTITLE, true, &pItem ) == SFX_ITEM_SET )
901 aHelpTitle = ((const SfxStringItem*)pItem)->GetValue();
902 if ( pOutSet->GetItemState( FID_VALID_HELPTEXT, true, &pItem ) == SFX_ITEM_SET )
903 aHelpText = ((const SfxStringItem*)pItem)->GetValue();
905 if ( pOutSet->GetItemState( FID_VALID_SHOWERR, true, &pItem ) == SFX_ITEM_SET )
906 bShowError = ((const SfxBoolItem*)pItem)->GetValue();
907 if ( pOutSet->GetItemState( FID_VALID_ERRSTYLE, true, &pItem ) == SFX_ITEM_SET )
908 eErrStyle = (ScValidErrorStyle) ((const SfxAllEnumItem*)pItem)->GetValue();
909 if ( pOutSet->GetItemState( FID_VALID_ERRTITLE, true, &pItem ) == SFX_ITEM_SET )
910 aErrTitle = ((const SfxStringItem*)pItem)->GetValue();
911 if ( pOutSet->GetItemState( FID_VALID_ERRTEXT, true, &pItem ) == SFX_ITEM_SET )
912 aErrText = ((const SfxStringItem*)pItem)->GetValue();
914 ScValidationData aData( eMode, eOper, aExpr1, aExpr2, pDoc, aCursorPos );
915 aData.SetIgnoreBlank( bBlank );
916 aData.SetListType( nListType );
918 aData.SetInput(aHelpTitle, aHelpText); // sets bShowInput to TRUE
919 if (!bShowHelp)
920 aData.ResetInput(); // reset only bShowInput
922 aData.SetError(aErrTitle, aErrText, eErrStyle); // sets bShowError to TRUE
923 if (!bShowError)
924 aData.ResetError(); // reset only bShowError
926 pTabViewShell->SetValidation( aData );
927 pTabViewShell->TestHintWindow();
928 rReq.Done( *pOutSet );
930 //after end execute from !IsModalInputMode, it is safer to delay deleting
931 //delete pDlg;
932 Application::PostUserEvent( Link( pDlg, &DelayDeleteAbstractDialog ) );
935 break;
937 case SID_TEXT_TO_COLUMNS:
939 ScViewData* pData = GetViewData();
940 OSL_ENSURE( pData, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pData is null!" );
941 ScRange aRange;
943 if ( lcl_GetTextToColumnsRange( pData, aRange ) )
945 ScDocument* pDoc = pData->GetDocument();
946 OSL_ENSURE( pDoc, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pDoc is null!" );
948 ScImportExport aExport( pDoc, aRange );
949 aExport.SetExportTextOptions( ScExportTextOptions( ScExportTextOptions::None, 0, false ) );
951 // #i87703# text to columns fails with tab separator
952 aExport.SetDelimiter( static_cast< sal_Unicode >( 0 ) );
954 SvMemoryStream aStream;
955 aStream.SetStreamCharSet( RTL_TEXTENCODING_UNICODE );
956 ScImportExport::SetNoEndianSwap( aStream );
957 aExport.ExportStream( aStream, OUString(), FORMAT_STRING );
959 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
960 OSL_ENSURE( pFact, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pFact is null!" );
961 boost::scoped_ptr<AbstractScImportAsciiDlg> pDlg(pFact->CreateScImportAsciiDlg(
962 NULL, OUString(), &aStream, SC_TEXTTOCOLUMNS));
963 OSL_ENSURE( pDlg, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pDlg is null!" );
965 if ( pDlg->Execute() == RET_OK )
967 ScDocShell* pDocSh = pData->GetDocShell();
968 OSL_ENSURE( pDocSh, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pDocSh is null!" );
970 OUString aUndo = ScGlobal::GetRscString( STR_UNDO_TEXTTOCOLUMNS );
971 pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo );
973 ScImportExport aImport( pDoc, aRange.aStart );
974 ScAsciiOptions aOptions;
975 pDlg->GetOptions( aOptions );
976 pDlg->SaveParameters();
977 aImport.SetExtOptions( aOptions );
978 aImport.SetApi( false );
979 aImport.SetImportBroadcast( true );
980 aStream.Seek( 0 );
981 aImport.ImportStream( aStream, OUString(), FORMAT_STRING );
983 pDocSh->GetUndoManager()->LeaveListAction();
987 break;
991 void ScCellShell::GetDBState( SfxItemSet& rSet )
993 ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell();
994 ScViewData* pData = GetViewData();
995 ScDocShell* pDocSh = pData->GetDocShell();
996 ScDocument* pDoc = pDocSh->GetDocument();
997 SCCOL nPosX = pData->GetCurX();
998 SCROW nPosY = pData->GetCurY();
999 SCTAB nTab = pData->GetTabNo();
1001 bool bAutoFilter = false;
1002 bool bAutoFilterTested = false;
1004 SfxWhichIter aIter(rSet);
1005 sal_uInt16 nWhich = aIter.FirstWhich();
1006 while (nWhich)
1008 switch (nWhich)
1010 case SID_REFRESH_DBAREA:
1012 // imported data without selection
1013 // or filter,sort,subtotal (also without import)
1014 bool bOk = false;
1015 ScDBData* pDBData = pTabViewShell->GetDBData(false,SC_DB_OLD);
1016 if (pDBData && pDoc->GetChangeTrack() == NULL)
1018 if ( pDBData->HasImportParam() )
1019 bOk = !pDBData->HasImportSelection();
1020 else
1022 bOk = pDBData->HasQueryParam() ||
1023 pDBData->HasSortParam() ||
1024 pDBData->HasSubTotalParam();
1027 if (!bOk)
1028 rSet.DisableItem( nWhich );
1030 break;
1032 case SID_FILTER:
1033 case SID_SPECIAL_FILTER:
1035 ScRange aDummy;
1036 ScMarkType eMarkType = GetViewData()->GetSimpleArea( aDummy);
1037 if (eMarkType != SC_MARK_SIMPLE && eMarkType != SC_MARK_SIMPLE_FILTERED)
1039 rSet.DisableItem( nWhich );
1042 break;
1045 //in case of Redlining and multiselection disable
1046 case SID_SORT_ASCENDING:
1047 case SID_SORT_DESCENDING:
1048 case SCITEM_SORTDATA:
1049 case SCITEM_SUBTDATA:
1050 case SID_OPENDLG_PIVOTTABLE:
1052 //! move ReadOnly check to idl flags
1054 if ( pDocSh->IsReadOnly() || pDoc->GetChangeTrack()!=NULL ||
1055 GetViewData()->IsMultiMarked() )
1057 rSet.DisableItem( nWhich );
1060 break;
1062 case SID_REIMPORT_DATA:
1064 // only imported data without selection
1065 ScDBData* pDBData = pTabViewShell->GetDBData(false,SC_DB_OLD);
1066 if (!pDBData || !pDBData->HasImportParam() || pDBData->HasImportSelection() ||
1067 pDoc->GetChangeTrack()!=NULL)
1069 rSet.DisableItem( nWhich );
1072 break;
1074 case SID_VIEW_DATA_SOURCE_BROWSER:
1076 if (!SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SDATABASE))
1077 rSet.Put(SfxVisibilityItem(nWhich, false));
1078 else
1079 // get state (BoolItem) from SfxViewFrame
1080 pTabViewShell->GetViewFrame()->GetSlotState( nWhich, NULL, &rSet );
1082 break;
1083 case SID_SBA_BRW_INSERT:
1085 // SBA wants a sal_Bool-item, enabled
1087 bool bEnable = true;
1088 rSet.Put(SfxBoolItem(nWhich, bEnable));
1090 break;
1092 case SID_AUTO_FILTER:
1093 case SID_AUTOFILTER_HIDE:
1095 if (!bAutoFilterTested)
1097 bAutoFilter = pDoc->HasAutoFilter( nPosX, nPosY, nTab );
1098 bAutoFilterTested = true;
1100 if ( nWhich == SID_AUTO_FILTER )
1102 ScRange aDummy;
1103 ScMarkType eMarkType = GetViewData()->GetSimpleArea( aDummy);
1104 if (eMarkType != SC_MARK_SIMPLE && eMarkType != SC_MARK_SIMPLE_FILTERED)
1106 rSet.DisableItem( nWhich );
1108 else if (pDoc->GetDPAtBlock(aDummy))
1110 rSet.DisableItem( nWhich );
1112 else
1113 rSet.Put( SfxBoolItem( nWhich, bAutoFilter ) );
1115 else
1116 if (!bAutoFilter)
1117 rSet.DisableItem( nWhich );
1119 break;
1121 case SID_UNFILTER:
1123 SCCOL nStartCol, nEndCol;
1124 SCROW nStartRow, nEndRow;
1125 SCTAB nStartTab, nEndTab;
1126 bool bAnyQuery = false;
1128 bool bSelected = (GetViewData()->GetSimpleArea(
1129 nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab )
1130 == SC_MARK_SIMPLE);
1132 if ( bSelected )
1134 if (nStartCol==nEndCol && nStartRow==nEndRow)
1135 bSelected = false;
1137 else
1139 nStartCol = GetViewData()->GetCurX();
1140 nStartRow = GetViewData()->GetCurY();
1141 nStartTab = GetViewData()->GetTabNo();
1144 ScDBData* pDBData = bSelected
1145 ? pDoc->GetDBAtArea( nStartTab, nStartCol, nStartRow, nEndCol, nEndRow )
1146 : pDoc->GetDBAtCursor( nStartCol, nStartRow, nStartTab );
1148 if ( pDBData )
1150 ScQueryParam aParam;
1151 pDBData->GetQueryParam( aParam );
1152 if ( aParam.GetEntry(0).bDoQuery )
1153 bAnyQuery = true;
1156 if ( !bAnyQuery )
1157 rSet.DisableItem( nWhich );
1159 break;
1161 case SID_DEFINE_DBNAME:
1163 if ( pDocSh->IsDocShared() )
1165 rSet.DisableItem( nWhich );
1168 break;
1169 case SID_DATA_STREAMS:
1170 case SID_DATA_STREAMS_PLAY:
1171 case SID_DATA_STREAMS_STOP:
1173 SvtMiscOptions aMiscOptions;
1174 if ( !aMiscOptions.IsExperimentalMode() )
1175 rSet.DisableItem( nWhich );
1177 break;
1178 case SID_TEXT_TO_COLUMNS:
1180 ScRange aRange;
1181 if ( !lcl_GetTextToColumnsRange( pData, aRange ) )
1183 rSet.DisableItem( nWhich );
1186 break;
1187 #if !ENABLE_ORCUS
1188 case SID_MANAGE_XML_SOURCE:
1189 rSet.DisableItem(nWhich);
1190 break;
1191 #endif
1193 nWhich = aIter.NextWhich();
1197 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */