LCOV - code coverage report
Current view: top level - libreoffice/sc/source/ui/view - dbfunc.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 255 0.4 %
Date: 2012-12-27 Functions: 2 15 13.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "scitems.hxx"
      21             : #include <sfx2/app.hxx>
      22             : #include <sfx2/bindings.hxx>
      23             : #include <vcl/msgbox.hxx>
      24             : 
      25             : #include <com/sun/star/sdbc/XResultSet.hpp>
      26             : 
      27             : #include "dbfunc.hxx"
      28             : #include "docsh.hxx"
      29             : #include "attrib.hxx"
      30             : #include "sc.hrc"
      31             : #include "undodat.hxx"
      32             : #include "dbdata.hxx"
      33             : #include "globstr.hrc"
      34             : #include "global.hxx"
      35             : #include "dbdocfun.hxx"
      36             : #include "editable.hxx"
      37             : #include "queryentry.hxx"
      38             : #include "markdata.hxx"
      39             : 
      40             : //==================================================================
      41             : 
      42           0 : ScDBFunc::ScDBFunc( Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell ) :
      43           0 :     ScViewFunc( pParent, rDocSh, pViewShell )
      44             : {
      45           0 : }
      46             : 
      47           0 : ScDBFunc::~ScDBFunc()
      48             : {
      49           0 : }
      50             : 
      51             : //
      52             : //      auxiliary functions
      53             : //
      54             : 
      55           0 : void ScDBFunc::GotoDBArea( const ::rtl::OUString& rDBName )
      56             : {
      57           0 :     ScDocument* pDoc = GetViewData()->GetDocument();
      58           0 :     ScDBCollection* pDBCol = pDoc->GetDBCollection();
      59           0 :     ScDBData* pData = pDBCol->getNamedDBs().findByUpperName(ScGlobal::pCharClass->uppercase(rDBName));
      60           0 :     if (pData)
      61             :     {
      62           0 :         SCTAB nTab = 0;
      63           0 :         SCCOL nStartCol = 0;
      64           0 :         SCROW nStartRow = 0;
      65           0 :         SCCOL nEndCol = 0;
      66           0 :         SCROW nEndRow = 0;
      67             : 
      68           0 :         pData->GetArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow );
      69           0 :         SetTabNo( nTab );
      70             : 
      71             :         MoveCursorAbs( nStartCol, nStartRow, ScFollowMode( SC_FOLLOW_JUMP ),
      72           0 :                        false, false );  // bShift,bControl
      73           0 :         DoneBlockMode();
      74           0 :         InitBlockMode( nStartCol, nStartRow, nTab );
      75           0 :         MarkCursor( nEndCol, nEndRow, nTab );
      76           0 :         SelectionChanged();
      77             :     }
      78           0 : }
      79             : 
      80             : //  search current datarange for sort / filter
      81             : 
      82           0 : ScDBData* ScDBFunc::GetDBData( bool bMark, ScGetDBMode eMode, ScGetDBSelection eSel )
      83             : {
      84           0 :     ScDocShell* pDocSh = GetViewData()->GetDocShell();
      85           0 :     ScDBData* pData = NULL;
      86           0 :     ScRange aRange;
      87           0 :     ScMarkType eMarkType = GetViewData()->GetSimpleArea(aRange);
      88           0 :     if ( eMarkType == SC_MARK_SIMPLE || eMarkType == SC_MARK_SIMPLE_FILTERED )
      89             :     {
      90           0 :         bool bShrinkColumnsOnly = false;
      91           0 :         if (eSel == SC_DBSEL_ROW_DOWN)
      92             :         {
      93             :             // Don't alter row range, additional rows may have been selected on
      94             :             // purpose to append data, or to have a fake header row.
      95           0 :             bShrinkColumnsOnly = true;
      96             :             // Select further rows only if only one row or a portion thereof is
      97             :             // selected.
      98           0 :             if (aRange.aStart.Row() != aRange.aEnd.Row())
      99             :             {
     100             :                 // If an area is selected shrink that to the actual used
     101             :                 // columns, don't draw filter buttons for empty columns.
     102           0 :                 eSel = SC_DBSEL_SHRINK_TO_USED_DATA;
     103             :             }
     104           0 :             else if (aRange.aStart.Col() == aRange.aEnd.Col())
     105             :             {
     106             :                 // One cell only, if it is not marked obtain entire used data
     107             :                 // area.
     108           0 :                 const ScMarkData& rMarkData = GetViewData()->GetMarkData();
     109           0 :                 if (!(rMarkData.IsMarked() || rMarkData.IsMultiMarked()))
     110           0 :                     eSel = SC_DBSEL_KEEP;
     111             :             }
     112             :         }
     113           0 :         switch (eSel)
     114             :         {
     115             :             case SC_DBSEL_SHRINK_TO_SHEET_DATA:
     116             :                 {
     117             :                     // Shrink the selection to sheet data area.
     118           0 :                     ScDocument* pDoc = pDocSh->GetDocument();
     119           0 :                     SCCOL nCol1 = aRange.aStart.Col(), nCol2 = aRange.aEnd.Col();
     120           0 :                     SCROW nRow1 = aRange.aStart.Row(), nRow2 = aRange.aEnd.Row();
     121           0 :                     if (pDoc->ShrinkToDataArea( aRange.aStart.Tab(), nCol1, nRow1, nCol2, nRow2))
     122             :                     {
     123           0 :                         aRange.aStart.SetCol(nCol1);
     124           0 :                         aRange.aEnd.SetCol(nCol2);
     125           0 :                         aRange.aStart.SetRow(nRow1);
     126           0 :                         aRange.aEnd.SetRow(nRow2);
     127             :                     }
     128             :                 }
     129           0 :                 break;
     130             :             case SC_DBSEL_SHRINK_TO_USED_DATA:
     131             :             case SC_DBSEL_ROW_DOWN:
     132             :                 {
     133             :                     // Shrink the selection to actual used area.
     134           0 :                     ScDocument* pDoc = pDocSh->GetDocument();
     135           0 :                     SCCOL nCol1 = aRange.aStart.Col(), nCol2 = aRange.aEnd.Col();
     136           0 :                     SCROW nRow1 = aRange.aStart.Row(), nRow2 = aRange.aEnd.Row();
     137             :                     bool bShrunk;
     138           0 :                     pDoc->ShrinkToUsedDataArea( bShrunk, aRange.aStart.Tab(),
     139           0 :                             nCol1, nRow1, nCol2, nRow2, bShrinkColumnsOnly);
     140           0 :                     if (bShrunk)
     141             :                     {
     142           0 :                         aRange.aStart.SetCol(nCol1);
     143           0 :                         aRange.aEnd.SetCol(nCol2);
     144           0 :                         aRange.aStart.SetRow(nRow1);
     145           0 :                         aRange.aEnd.SetRow(nRow2);
     146             :                     }
     147             :                 }
     148           0 :                 break;
     149             :             default:
     150             :                 ;   // nothing
     151             :         }
     152           0 :         pData = pDocSh->GetDBData( aRange, eMode, eSel );
     153             :     }
     154           0 :     else if ( eMode != SC_DB_OLD )
     155             :         pData = pDocSh->GetDBData(
     156           0 :                     ScRange( GetViewData()->GetCurX(), GetViewData()->GetCurY(),
     157           0 :                              GetViewData()->GetTabNo() ),
     158           0 :                     eMode, SC_DBSEL_KEEP );
     159             : 
     160           0 :     if (!pData)
     161           0 :         return NULL;
     162             : 
     163           0 :     if (bMark)
     164             :     {
     165           0 :         ScRange aFound;
     166           0 :         pData->GetArea(aFound);
     167           0 :         MarkRange( aFound, false );
     168             :     }
     169           0 :     return pData;
     170             : }
     171             : 
     172           0 : ScDBData* ScDBFunc::GetAnonymousDBData()
     173             : {
     174           0 :     ScDocShell* pDocSh = GetViewData()->GetDocShell();
     175           0 :     ScRange aRange;
     176           0 :     ScMarkType eMarkType = GetViewData()->GetSimpleArea(aRange);
     177           0 :     if (eMarkType != SC_MARK_SIMPLE && eMarkType != SC_MARK_SIMPLE_FILTERED)
     178           0 :         return NULL;
     179             : 
     180             :     // Expand to used data area if not explicitly marked.
     181           0 :     const ScMarkData& rMarkData = GetViewData()->GetMarkData();
     182           0 :     if (!rMarkData.IsMarked() && !rMarkData.IsMultiMarked())
     183             :     {
     184           0 :         SCCOL nCol1 = aRange.aStart.Col();
     185           0 :         SCCOL nCol2 = aRange.aEnd.Col();
     186           0 :         SCROW nRow1 = aRange.aStart.Row();
     187           0 :         SCROW nRow2 = aRange.aEnd.Row();
     188           0 :         pDocSh->GetDocument()->GetDataArea(aRange.aStart.Tab(), nCol1, nRow1, nCol2, nRow2, false, false);
     189           0 :         aRange.aStart.SetCol(nCol1);
     190           0 :         aRange.aStart.SetRow(nRow1);
     191           0 :         aRange.aEnd.SetCol(nCol2);
     192           0 :         aRange.aEnd.SetRow(nRow2);
     193             :     }
     194             : 
     195           0 :     return pDocSh->GetAnonymousDBData(aRange);
     196             : }
     197             : 
     198             : //  change database range (dialog)
     199             : 
     200           0 : void ScDBFunc::NotifyCloseDbNameDlg( const ScDBCollection& rNewColl, const std::vector<ScRange> &rDelAreaList )
     201             : {
     202             : 
     203           0 :     ScDocShell* pDocShell = GetViewData()->GetDocShell();
     204           0 :     ScDocShellModificator aModificator( *pDocShell );
     205           0 :     ScDocument* pDoc = pDocShell->GetDocument();
     206           0 :     ScDBCollection* pOldColl = pDoc->GetDBCollection();
     207           0 :     ScDBCollection* pUndoColl = NULL;
     208           0 :     ScDBCollection* pRedoColl = NULL;
     209           0 :     const sal_Bool bRecord (pDoc->IsUndoEnabled());
     210             : 
     211           0 :     std::vector<ScRange>::const_iterator iter;
     212           0 :     for (iter = rDelAreaList.begin(); iter != rDelAreaList.end(); ++iter)
     213             :     {
     214             :         // unregistering target in SBA no longer necessary
     215           0 :         const ScAddress& rStart = iter->aStart;
     216           0 :         const ScAddress& rEnd   = iter->aEnd;
     217           0 :         pDocShell->DBAreaDeleted( rStart.Tab(),
     218           0 :                                   rStart.Col(), rStart.Row(),
     219           0 :                                   rEnd.Col(),   rEnd.Row() );
     220             : 
     221             :     }
     222             : 
     223           0 :     if (bRecord)
     224           0 :         pUndoColl = new ScDBCollection( *pOldColl );
     225             : 
     226             :     //  register target in SBA no longer necessary
     227             : 
     228           0 :     pDoc->CompileDBFormula( sal_True );     // CreateFormulaString
     229           0 :     pDoc->SetDBCollection( new ScDBCollection( rNewColl ) );
     230           0 :     pDoc->CompileDBFormula( false );    // CompileFormulaString
     231           0 :     pOldColl = NULL;
     232           0 :     pDocShell->PostPaint(ScRange(0, 0, 0, MAXCOL, MAXROW, MAXTAB), PAINT_GRID);
     233           0 :     aModificator.SetDocumentModified();
     234           0 :     SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) );
     235             : 
     236           0 :     if (bRecord)
     237             :     {
     238           0 :         pRedoColl = new ScDBCollection( rNewColl );
     239           0 :         pDocShell->GetUndoManager()->AddUndoAction(
     240           0 :             new ScUndoDBData( pDocShell, pUndoColl, pRedoColl ) );
     241           0 :     }
     242           0 : }
     243             : 
     244             : //
     245             : //      main functions
     246             : //
     247             : 
     248             : // Sort
     249             : 
     250           0 : void ScDBFunc::UISort( const ScSortParam& rSortParam, sal_Bool bRecord )
     251             : {
     252           0 :     ScDocShell* pDocSh = GetViewData()->GetDocShell();
     253           0 :     ScDocument* pDoc = pDocSh->GetDocument();
     254           0 :     SCTAB nTab = GetViewData()->GetTabNo();
     255             :     ScDBData* pDBData = pDoc->GetDBAtArea( nTab, rSortParam.nCol1, rSortParam.nRow1,
     256           0 :                                                     rSortParam.nCol2, rSortParam.nRow2 );
     257           0 :     if (!pDBData)
     258             :     {
     259             :         OSL_FAIL( "Sort: no DBData" );
     260           0 :         return;
     261             :     }
     262             : 
     263           0 :     ScSubTotalParam aSubTotalParam;
     264           0 :     pDBData->GetSubTotalParam( aSubTotalParam );
     265           0 :     if (aSubTotalParam.bGroupActive[0] && !aSubTotalParam.bRemoveOnly)
     266             :     {
     267             :         //  repeat subtotals, with new sortorder
     268             : 
     269           0 :         DoSubTotals( aSubTotalParam, bRecord, &rSortParam );
     270             :     }
     271             :     else
     272             :     {
     273           0 :         Sort( rSortParam, bRecord );        // just sort
     274             :     }
     275             : }
     276             : 
     277           0 : void ScDBFunc::Sort( const ScSortParam& rSortParam, sal_Bool bRecord, sal_Bool bPaint )
     278             : {
     279           0 :     ScDocShell* pDocSh = GetViewData()->GetDocShell();
     280           0 :     SCTAB nTab = GetViewData()->GetTabNo();
     281           0 :     ScDBDocFunc aDBDocFunc( *pDocSh );
     282           0 :     sal_Bool bSuccess = aDBDocFunc.Sort( nTab, rSortParam, bRecord, bPaint, false );
     283           0 :     if ( bSuccess && !rSortParam.bInplace )
     284             :     {
     285             :         //  mark target
     286             :         ScRange aDestRange( rSortParam.nDestCol, rSortParam.nDestRow, rSortParam.nDestTab,
     287             :                             rSortParam.nDestCol + rSortParam.nCol2 - rSortParam.nCol1,
     288             :                             rSortParam.nDestRow + rSortParam.nRow2 - rSortParam.nRow1,
     289           0 :                             rSortParam.nDestTab );
     290           0 :         MarkRange( aDestRange );
     291           0 :     }
     292           0 : }
     293             : 
     294             : //  filters
     295             : 
     296           0 : void ScDBFunc::Query( const ScQueryParam& rQueryParam, const ScRange* pAdvSource, sal_Bool bRecord )
     297             : {
     298           0 :     ScDocShell* pDocSh = GetViewData()->GetDocShell();
     299           0 :     SCTAB nTab = GetViewData()->GetTabNo();
     300           0 :     ScDBDocFunc aDBDocFunc( *pDocSh );
     301           0 :     sal_Bool bSuccess = aDBDocFunc.Query( nTab, rQueryParam, pAdvSource, bRecord, false );
     302             : 
     303           0 :     if (bSuccess)
     304             :     {
     305           0 :         sal_Bool bCopy = !rQueryParam.bInplace;
     306           0 :         if (bCopy)
     307             :         {
     308             :             //  mark target range (data base range has been set up if applicable)
     309           0 :             ScDocument* pDoc = pDocSh->GetDocument();
     310             :             ScDBData* pDestData = pDoc->GetDBAtCursor(
     311             :                                             rQueryParam.nDestCol, rQueryParam.nDestRow,
     312           0 :                                             rQueryParam.nDestTab, sal_True );
     313           0 :             if (pDestData)
     314             :             {
     315           0 :                 ScRange aDestRange;
     316           0 :                 pDestData->GetArea(aDestRange);
     317           0 :                 MarkRange( aDestRange );
     318             :             }
     319             :         }
     320             : 
     321           0 :         if (!bCopy)
     322             :         {
     323           0 :             UpdateScrollBars();
     324           0 :             SelectionChanged();     // for attribute states (filtered rows are ignored)
     325             :         }
     326             : 
     327           0 :         GetViewData()->GetBindings().Invalidate( SID_UNFILTER );
     328           0 :     }
     329           0 : }
     330             : 
     331             : //  autofilter-buttons show / hide
     332             : 
     333           0 : void ScDBFunc::ToggleAutoFilter()
     334             : {
     335           0 :     ScDocShell* pDocSh = GetViewData()->GetDocShell();
     336           0 :     ScDocShellModificator aModificator( *pDocSh );
     337             : 
     338           0 :     ScQueryParam    aParam;
     339           0 :     ScDocument*     pDoc    = GetViewData()->GetDocument();
     340           0 :     ScDBData*       pDBData = GetDBData(false, SC_DB_MAKE, SC_DBSEL_ROW_DOWN);
     341             : 
     342           0 :     pDBData->SetByRow( sal_True );              //! undo, retrieve beforehand ??
     343           0 :     pDBData->GetQueryParam( aParam );
     344             : 
     345             : 
     346             :     SCCOL  nCol;
     347           0 :     SCROW  nRow = aParam.nRow1;
     348           0 :     SCTAB  nTab = GetViewData()->GetTabNo();
     349             :     sal_Int16   nFlag;
     350           0 :     sal_Bool    bHasAuto = sal_True;
     351           0 :     sal_Bool    bHeader  = pDBData->HasHeader();
     352           0 :     sal_Bool    bPaint   = false;
     353             : 
     354             :     //!     instead retrieve from DB-range?
     355             : 
     356           0 :     for (nCol=aParam.nCol1; nCol<=aParam.nCol2 && bHasAuto; nCol++)
     357             :     {
     358             :         nFlag = ((ScMergeFlagAttr*) pDoc->
     359           0 :                 GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue();
     360             : 
     361           0 :         if ( (nFlag & SC_MF_AUTO) == 0 )
     362           0 :             bHasAuto = false;
     363             :     }
     364             : 
     365           0 :     if (bHasAuto)                               // remove
     366             :     {
     367             :         //  hide filter buttons
     368             : 
     369           0 :         for (nCol=aParam.nCol1; nCol<=aParam.nCol2; nCol++)
     370             :         {
     371             :             nFlag = ((ScMergeFlagAttr*) pDoc->
     372           0 :                     GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue();
     373           0 :             pDoc->ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag & ~SC_MF_AUTO ) );
     374             :         }
     375             : 
     376             :         // use a list action for the AutoFilter buttons (ScUndoAutoFilter) and the filter operation
     377             : 
     378           0 :         String aUndo = ScGlobal::GetRscString( STR_UNDO_QUERY );
     379           0 :         pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo );
     380             : 
     381           0 :         ScRange aRange;
     382           0 :         pDBData->GetArea( aRange );
     383           0 :         pDocSh->GetUndoManager()->AddUndoAction(
     384           0 :             new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), false ) );
     385             : 
     386           0 :         pDBData->SetAutoFilter(false);
     387             : 
     388             :         //  remove filter (incl. Paint / Undo)
     389             : 
     390           0 :         SCSIZE nEC = aParam.GetEntryCount();
     391           0 :         for (SCSIZE i=0; i<nEC; i++)
     392           0 :             aParam.GetEntry(i).bDoQuery = false;
     393           0 :         aParam.bDuplicate = sal_True;
     394           0 :         Query( aParam, NULL, sal_True );
     395             : 
     396           0 :         pDocSh->GetUndoManager()->LeaveListAction();
     397             : 
     398           0 :         bPaint = sal_True;
     399             :     }
     400             :     else                                    // show filter buttons
     401             :     {
     402           0 :         if ( !pDoc->IsBlockEmpty( nTab,
     403             :                                   aParam.nCol1, aParam.nRow1,
     404           0 :                                   aParam.nCol2, aParam.nRow2 ) )
     405             :         {
     406           0 :             if (!bHeader)
     407             :             {
     408           0 :                 if ( MessBox( GetViewData()->GetDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
     409           0 :                         ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ),       // "StarCalc"
     410           0 :                         ScGlobal::GetRscString( STR_MSSG_MAKEAUTOFILTER_0 )     // header from first row?
     411           0 :                     ).Execute() == RET_YES )
     412             :                 {
     413           0 :                     pDBData->SetHeader( sal_True );     //! Undo ??
     414           0 :                     bHeader = sal_True;
     415             :                 }
     416             :             }
     417             : 
     418           0 :             ScRange aRange;
     419           0 :             pDBData->GetArea( aRange );
     420           0 :             pDocSh->GetUndoManager()->AddUndoAction(
     421           0 :                 new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), sal_True ) );
     422             : 
     423           0 :             pDBData->SetAutoFilter(sal_True);
     424             : 
     425           0 :             for (nCol=aParam.nCol1; nCol<=aParam.nCol2; nCol++)
     426             :             {
     427             :                 nFlag = ((ScMergeFlagAttr*) pDoc->
     428           0 :                         GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue();
     429           0 :                 pDoc->ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag | SC_MF_AUTO ) );
     430             :             }
     431             :             pDocSh->PostPaint(ScRange(aParam.nCol1, nRow, nTab, aParam.nCol2, nRow, nTab),
     432           0 :                               PAINT_GRID);
     433           0 :             bPaint = sal_True;
     434             :         }
     435             :         else
     436             :         {
     437             :             ErrorBox aErrorBox( GetViewData()->GetDialogParent(), WinBits( WB_OK | WB_DEF_OK ),
     438           0 :                                 ScGlobal::GetRscString( STR_ERR_AUTOFILTER ) );
     439           0 :             aErrorBox.Execute();
     440             :         }
     441             :     }
     442             : 
     443           0 :     if ( bPaint )
     444             :     {
     445           0 :         aModificator.SetDocumentModified();
     446             : 
     447           0 :         SfxBindings& rBindings = GetViewData()->GetBindings();
     448           0 :         rBindings.Invalidate( SID_AUTO_FILTER );
     449           0 :         rBindings.Invalidate( SID_AUTOFILTER_HIDE );
     450           0 :     }
     451           0 : }
     452             : 
     453             : //      just hide, no data change
     454             : 
     455           0 : void ScDBFunc::HideAutoFilter()
     456             : {
     457           0 :     ScDocShell* pDocSh = GetViewData()->GetDocShell();
     458           0 :     ScDocShellModificator aModificator( *pDocSh );
     459             : 
     460           0 :     ScDocument* pDoc = pDocSh->GetDocument();
     461             : 
     462           0 :     ScQueryParam aParam;
     463           0 :     ScDBData* pDBData = GetDBData( false );
     464             : 
     465             :     SCTAB nTab;
     466             :     SCCOL nCol1, nCol2;
     467             :     SCROW nRow1, nRow2;
     468           0 :     pDBData->GetArea(nTab, nCol1, nRow1, nCol2, nRow2);
     469             : 
     470           0 :     for (SCCOL nCol=nCol1; nCol<=nCol2; nCol++)
     471             :     {
     472             :         sal_Int16 nFlag = ((ScMergeFlagAttr*) pDoc->
     473           0 :                                 GetAttr( nCol, nRow1, nTab, ATTR_MERGE_FLAG ))->GetValue();
     474           0 :         pDoc->ApplyAttr( nCol, nRow1, nTab, ScMergeFlagAttr( nFlag & ~SC_MF_AUTO ) );
     475             :     }
     476             : 
     477           0 :     ScRange aRange;
     478           0 :     pDBData->GetArea( aRange );
     479           0 :     pDocSh->GetUndoManager()->AddUndoAction(
     480           0 :         new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), false ) );
     481             : 
     482           0 :     pDBData->SetAutoFilter(false);
     483             : 
     484           0 :     pDocSh->PostPaint(ScRange(nCol1, nRow1, nTab, nCol2, nRow1, nTab), PAINT_GRID );
     485           0 :     aModificator.SetDocumentModified();
     486             : 
     487           0 :     SfxBindings& rBindings = GetViewData()->GetBindings();
     488           0 :     rBindings.Invalidate( SID_AUTO_FILTER );
     489           0 :     rBindings.Invalidate( SID_AUTOFILTER_HIDE );
     490           0 : }
     491             : 
     492             : //      Re-Import
     493             : 
     494           0 : sal_Bool ScDBFunc::ImportData( const ScImportParam& rParam, sal_Bool bRecord )
     495             : {
     496           0 :     ScDocument* pDoc = GetViewData()->GetDocument();
     497           0 :     ScEditableTester aTester( pDoc, GetViewData()->GetTabNo(), rParam.nCol1,rParam.nRow1,
     498           0 :                                                             rParam.nCol2,rParam.nRow2 );
     499           0 :     if ( !aTester.IsEditable() )
     500             :     {
     501           0 :         ErrorMessage(aTester.GetMessageId());
     502           0 :         return false;
     503             :     }
     504             : 
     505           0 :     ScDBDocFunc aDBDocFunc( *GetViewData()->GetDocShell() );
     506           0 :     return aDBDocFunc.DoImport( GetViewData()->GetTabNo(), rParam, NULL, bRecord );
     507          15 : }
     508             : 
     509             : 
     510             : 
     511             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10