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

Generated by: LCOV version 1.10