LCOV - code coverage report
Current view: top level - sc/source/ui/docshell - olinefun.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 428 0.0 %
Date: 2012-08-25 Functions: 0 11 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 620 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <sfx2/bindings.hxx>
      30                 :            : 
      31                 :            : #include "olinefun.hxx"
      32                 :            : 
      33                 :            : #include "docsh.hxx"
      34                 :            : #include "olinetab.hxx"
      35                 :            : #include "undodat.hxx"
      36                 :            : #include "globstr.hrc"
      37                 :            : #include "sc.hrc"
      38                 :            : 
      39                 :            : 
      40                 :            : //========================================================================
      41                 :            : 
      42                 :          0 : void lcl_InvalidateOutliner( SfxBindings* pBindings )
      43                 :            : {
      44         [ #  # ]:          0 :     if ( pBindings )
      45                 :            :     {
      46                 :          0 :         pBindings->Invalidate( SID_OUTLINE_SHOW );
      47                 :          0 :         pBindings->Invalidate( SID_OUTLINE_HIDE );
      48                 :          0 :         pBindings->Invalidate( SID_OUTLINE_REMOVE );
      49                 :            : 
      50                 :          0 :         pBindings->Invalidate( SID_STATUS_SUM );            // wegen ein-/ausblenden
      51                 :          0 :         pBindings->Invalidate( SID_ATTR_SIZE );
      52                 :            :     }
      53                 :          0 : }
      54                 :            : 
      55                 :            : //------------------------------------------------------------------------
      56                 :            : 
      57                 :            : //! PaintWidthHeight zur DocShell verschieben?
      58                 :            : 
      59                 :          0 : void lcl_PaintWidthHeight( ScDocShell& rDocShell, SCTAB nTab,
      60                 :            :                                     sal_Bool bColumns, SCCOLROW nStart, SCCOLROW nEnd )
      61                 :            : {
      62                 :          0 :     ScDocument* pDoc = rDocShell.GetDocument();
      63                 :            : 
      64                 :          0 :     sal_uInt16 nParts = PAINT_GRID;
      65                 :          0 :     SCCOL nStartCol = 0;
      66                 :          0 :     SCROW nStartRow = 0;
      67                 :          0 :     SCCOL nEndCol = MAXCOL;         // fuer Test auf Merge
      68                 :          0 :     SCROW nEndRow = MAXROW;
      69         [ #  # ]:          0 :     if ( bColumns )
      70                 :            :     {
      71                 :          0 :         nParts |= PAINT_TOP;
      72                 :          0 :         nStartCol = static_cast<SCCOL>(nStart);
      73                 :          0 :         nEndCol = static_cast<SCCOL>(nEnd);
      74                 :            :     }
      75                 :            :     else
      76                 :            :     {
      77                 :          0 :         nParts |= PAINT_LEFT;
      78                 :          0 :         nStartRow = nStart;
      79                 :          0 :         nEndRow = nEnd;
      80                 :            :     }
      81         [ #  # ]:          0 :     if (pDoc->HasAttrib( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab,
      82                 :          0 :                             HASATTR_MERGED | HASATTR_OVERLAPPED ))
      83                 :            :     {
      84                 :          0 :         nStartCol = 0;
      85                 :          0 :         nStartRow = 0;
      86                 :            :     }
      87                 :          0 :     rDocShell.PostPaint( nStartCol,nStartRow,nTab, MAXCOL,MAXROW,nTab, nParts );
      88                 :          0 : }
      89                 :            : 
      90                 :            : //------------------------------------------------------------------------
      91                 :            : 
      92                 :          0 : sal_Bool ScOutlineDocFunc::MakeOutline( const ScRange& rRange, sal_Bool bColumns, sal_Bool bRecord, sal_Bool bApi )
      93                 :            : {
      94                 :          0 :     sal_Bool bSuccess = false;
      95                 :          0 :     SCCOL nStartCol = rRange.aStart.Col();
      96                 :          0 :     SCROW nStartRow = rRange.aStart.Row();
      97                 :          0 :     SCCOL nEndCol = rRange.aEnd.Col();
      98                 :          0 :     SCROW nEndRow = rRange.aEnd.Row();
      99                 :          0 :     SCTAB nTab = rRange.aStart.Tab();
     100                 :            : 
     101                 :          0 :     ScDocument* pDoc = rDocShell.GetDocument();
     102         [ #  # ]:          0 :     ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab, sal_True );
     103                 :          0 :     ScOutlineTable* pUndoTab = NULL;
     104                 :            : 
     105 [ #  # ][ #  # ]:          0 :     if (bRecord && !pDoc->IsUndoEnabled())
                 [ #  # ]
     106                 :          0 :         bRecord = false;
     107                 :            : 
     108         [ #  # ]:          0 :     if (bRecord)
     109 [ #  # ][ #  # ]:          0 :         pUndoTab = new ScOutlineTable( *pTable );
     110                 :            : 
     111         [ #  # ]:          0 :     ScOutlineArray* pArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
     112                 :            : 
     113                 :            :     bool bRes;
     114                 :          0 :     bool bSize = false;
     115         [ #  # ]:          0 :     if ( bColumns )
     116         [ #  # ]:          0 :         bRes = pArray->Insert( nStartCol, nEndCol, bSize );
     117                 :            :     else
     118         [ #  # ]:          0 :         bRes = pArray->Insert( nStartRow, nEndRow, bSize );
     119                 :            : 
     120         [ #  # ]:          0 :     if ( bRes )
     121                 :            :     {
     122         [ #  # ]:          0 :         if (bRecord)
     123                 :            :         {
     124         [ #  # ]:          0 :             rDocShell.GetUndoManager()->AddUndoAction(
     125                 :            :                 new ScUndoMakeOutline( &rDocShell,
     126                 :            :                                         nStartCol,nStartRow,nTab,nEndCol,nEndRow,nTab,
     127 [ #  # ][ #  # ]:          0 :                                         pUndoTab, bColumns, sal_True ) );
                 [ #  # ]
     128                 :            :         }
     129                 :            : 
     130 [ #  # ][ #  # ]:          0 :         if (pDoc->IsStreamValid(nTab))
     131         [ #  # ]:          0 :             pDoc->SetStreamValid(nTab, false);
     132                 :            : 
     133                 :          0 :         sal_uInt16 nParts = 0;              // Datenbereich nicht geaendert
     134         [ #  # ]:          0 :         if ( bColumns )
     135                 :          0 :             nParts |= PAINT_TOP;
     136                 :            :         else
     137                 :          0 :             nParts |= PAINT_LEFT;
     138         [ #  # ]:          0 :         if ( bSize )
     139                 :          0 :             nParts |= PAINT_SIZE;
     140                 :            : 
     141         [ #  # ]:          0 :         rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, nParts );
     142         [ #  # ]:          0 :         rDocShell.SetDocumentModified();
     143 [ #  # ][ #  # ]:          0 :         lcl_InvalidateOutliner( rDocShell.GetViewBindings() );
     144                 :          0 :         bSuccess = sal_True;
     145                 :            :     }
     146                 :            :     else
     147                 :            :     {
     148         [ #  # ]:          0 :         if (!bApi)
     149         [ #  # ]:          0 :             rDocShell.ErrorMessage(STR_MSSG_MAKEOUTLINE_0); // "Gruppierung nicht moeglich"
     150 [ #  # ][ #  # ]:          0 :         delete pUndoTab;
     151                 :            :     }
     152                 :            : 
     153                 :          0 :     return bSuccess;
     154                 :            : }
     155                 :            : 
     156                 :          0 : sal_Bool ScOutlineDocFunc::RemoveOutline( const ScRange& rRange, sal_Bool bColumns, sal_Bool bRecord, sal_Bool bApi )
     157                 :            : {
     158                 :          0 :     sal_Bool bDone = false;
     159                 :            : 
     160                 :          0 :     SCCOL nStartCol = rRange.aStart.Col();
     161                 :          0 :     SCROW nStartRow = rRange.aStart.Row();
     162                 :          0 :     SCCOL nEndCol = rRange.aEnd.Col();
     163                 :          0 :     SCROW nEndRow = rRange.aEnd.Row();
     164                 :          0 :     SCTAB nTab = rRange.aStart.Tab();
     165                 :            : 
     166                 :          0 :     ScDocument* pDoc = rDocShell.GetDocument();
     167                 :            : 
     168 [ #  # ][ #  # ]:          0 :     if (bRecord && !pDoc->IsUndoEnabled())
                 [ #  # ]
     169                 :          0 :         bRecord = false;
     170                 :          0 :     ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
     171         [ #  # ]:          0 :     if (pTable)
     172                 :            :     {
     173                 :          0 :         ScOutlineTable* pUndoTab = NULL;
     174         [ #  # ]:          0 :         if (bRecord)
     175 [ #  # ][ #  # ]:          0 :             pUndoTab = new ScOutlineTable( *pTable );
     176                 :            : 
     177         [ #  # ]:          0 :         ScOutlineArray* pArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
     178                 :            : 
     179                 :            :         bool bRes;
     180                 :          0 :         bool bSize = false;
     181         [ #  # ]:          0 :         if ( bColumns )
     182         [ #  # ]:          0 :             bRes = pArray->Remove( nStartCol, nEndCol, bSize );
     183                 :            :         else
     184         [ #  # ]:          0 :             bRes = pArray->Remove( nStartRow, nEndRow, bSize );
     185                 :            : 
     186         [ #  # ]:          0 :         if ( bRes )
     187                 :            :         {
     188         [ #  # ]:          0 :             if (bRecord)
     189                 :            :             {
     190         [ #  # ]:          0 :                 rDocShell.GetUndoManager()->AddUndoAction(
     191                 :            :                     new ScUndoMakeOutline( &rDocShell,
     192                 :            :                                             nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab,
     193 [ #  # ][ #  # ]:          0 :                                             pUndoTab, bColumns, false ) );
                 [ #  # ]
     194                 :            :             }
     195                 :            : 
     196 [ #  # ][ #  # ]:          0 :             if (pDoc->IsStreamValid(nTab))
     197         [ #  # ]:          0 :                 pDoc->SetStreamValid(nTab, false);
     198                 :            : 
     199                 :          0 :             sal_uInt16 nParts = 0;              // Datenbereich nicht geaendert
     200         [ #  # ]:          0 :             if ( bColumns )
     201                 :          0 :                 nParts |= PAINT_TOP;
     202                 :            :             else
     203                 :          0 :                 nParts |= PAINT_LEFT;
     204         [ #  # ]:          0 :             if ( bSize )
     205                 :          0 :                 nParts |= PAINT_SIZE;
     206                 :            : 
     207         [ #  # ]:          0 :             rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, nParts );
     208         [ #  # ]:          0 :             rDocShell.SetDocumentModified();
     209                 :          0 :             bDone = sal_True;
     210 [ #  # ][ #  # ]:          0 :             lcl_InvalidateOutliner( rDocShell.GetViewBindings() );
     211                 :            : 
     212                 :            :             // es wird nicht wieder eingeblendet -> kein UpdatePageBreaks
     213                 :            :         }
     214                 :            :         else
     215 [ #  # ][ #  # ]:          0 :             delete pUndoTab;
     216                 :            :     }
     217                 :            : 
     218 [ #  # ][ #  # ]:          0 :     if (!bDone && !bApi)
     219                 :          0 :         rDocShell.ErrorMessage(STR_MSSG_REMOVEOUTLINE_0);   // "Aufheben nicht moeglich"
     220                 :            : 
     221                 :          0 :     return bDone;
     222                 :            : }
     223                 :            : 
     224                 :          0 : sal_Bool ScOutlineDocFunc::RemoveAllOutlines( SCTAB nTab, sal_Bool bRecord, sal_Bool bApi )
     225                 :            : {
     226                 :          0 :     sal_Bool bSuccess = false;
     227                 :          0 :     ScDocument* pDoc = rDocShell.GetDocument();
     228                 :            : 
     229 [ #  # ][ #  # ]:          0 :     if (bRecord && !pDoc->IsUndoEnabled())
                 [ #  # ]
     230                 :          0 :         bRecord = false;
     231                 :          0 :     ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
     232         [ #  # ]:          0 :     if (pTable)
     233                 :            :     {
     234         [ #  # ]:          0 :         if (bRecord)
     235                 :            :         {
     236                 :            :             SCCOLROW nCol1, nCol2, nRow1, nRow2;
     237         [ #  # ]:          0 :             pTable->GetColArray()->GetRange( nCol1, nCol2 );
     238         [ #  # ]:          0 :             pTable->GetRowArray()->GetRange( nRow1, nRow2 );
     239                 :          0 :             SCCOL nStartCol = static_cast<SCCOL>(nCol1);
     240                 :          0 :             SCROW nStartRow = nRow1;
     241                 :          0 :             SCCOL nEndCol = static_cast<SCCOL>(nCol2);
     242                 :          0 :             SCROW nEndRow = nRow2;
     243                 :            : 
     244 [ #  # ][ #  # ]:          0 :             ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
     245         [ #  # ]:          0 :             pUndoDoc->InitUndo( pDoc, nTab, nTab, sal_True, sal_True );
     246         [ #  # ]:          0 :             pDoc->CopyToDocument( nStartCol, 0, nTab, nEndCol, MAXROW, nTab, IDF_NONE, false, pUndoDoc );
     247         [ #  # ]:          0 :             pDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, pUndoDoc );
     248                 :            : 
     249 [ #  # ][ #  # ]:          0 :             ScOutlineTable* pUndoTab = new ScOutlineTable( *pTable );
     250                 :            : 
     251         [ #  # ]:          0 :             rDocShell.GetUndoManager()->AddUndoAction(
     252                 :            :                 new ScUndoRemoveAllOutlines( &rDocShell,
     253                 :            :                                                 nStartCol, nStartRow, nTab,
     254                 :            :                                                 nEndCol, nEndRow, nTab,
     255 [ #  # ][ #  # ]:          0 :                                                 pUndoDoc, pUndoTab ) );
                 [ #  # ]
     256                 :            :         }
     257                 :            : 
     258                 :          0 :         SelectLevel( nTab, sal_True,  pTable->GetColArray()->GetDepth(), false, false, bApi );
     259                 :          0 :         SelectLevel( nTab, false, pTable->GetRowArray()->GetDepth(), false, false, bApi );
     260                 :          0 :         pDoc->SetOutlineTable( nTab, NULL );
     261                 :            : 
     262                 :          0 :         pDoc->UpdatePageBreaks( nTab );
     263                 :            : 
     264         [ #  # ]:          0 :         if (pDoc->IsStreamValid(nTab))
     265                 :          0 :             pDoc->SetStreamValid(nTab, false);
     266                 :            : 
     267                 :            :         rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab,
     268                 :          0 :                                     PAINT_GRID | PAINT_LEFT | PAINT_TOP | PAINT_SIZE );
     269                 :          0 :         rDocShell.SetDocumentModified();
     270                 :          0 :         lcl_InvalidateOutliner( rDocShell.GetViewBindings() );
     271                 :          0 :         bSuccess = sal_True;
     272                 :            :     }
     273                 :            : 
     274                 :          0 :     return bSuccess;
     275                 :            : }
     276                 :            : 
     277                 :            : //------------------------------------------------------------------------
     278                 :            : 
     279                 :          0 : sal_Bool ScOutlineDocFunc::AutoOutline( const ScRange& rRange, sal_Bool bRecord, sal_Bool bApi )
     280                 :            : {
     281                 :          0 :     SCCOL nStartCol = rRange.aStart.Col();
     282                 :          0 :     SCROW nStartRow = rRange.aStart.Row();
     283                 :          0 :     SCCOL nEndCol = rRange.aEnd.Col();
     284                 :          0 :     SCROW nEndRow = rRange.aEnd.Row();
     285                 :          0 :     SCTAB nTab = rRange.aStart.Tab();
     286                 :            : 
     287                 :          0 :     ScDocument* pDoc = rDocShell.GetDocument();
     288                 :            : 
     289 [ #  # ][ #  # ]:          0 :     if (bRecord && !pDoc->IsUndoEnabled())
                 [ #  # ]
     290                 :          0 :         bRecord = false;
     291                 :          0 :     ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
     292                 :            : 
     293                 :          0 :     ScDocument* pUndoDoc = NULL;
     294                 :          0 :     ScOutlineTable* pUndoTab = NULL;
     295                 :            : 
     296         [ #  # ]:          0 :     if ( pTable )
     297                 :            :     {
     298         [ #  # ]:          0 :         if ( bRecord )
     299                 :            :         {
     300 [ #  # ][ #  # ]:          0 :             pUndoTab = new ScOutlineTable( *pTable );
     301                 :            : 
     302                 :            :             SCCOLROW nCol1, nCol2, nRow1, nRow2;
     303         [ #  # ]:          0 :             pTable->GetColArray()->GetRange( nCol1, nCol2 );
     304         [ #  # ]:          0 :             pTable->GetRowArray()->GetRange( nRow1, nRow2 );
     305                 :          0 :             SCCOL nOutStartCol = static_cast<SCCOL>(nCol1);
     306                 :          0 :             SCROW nOutStartRow = nRow1;
     307                 :          0 :             SCCOL nOutEndCol = static_cast<SCCOL>(nCol2);
     308                 :          0 :             SCROW nOutEndRow = nRow2;
     309                 :            : 
     310 [ #  # ][ #  # ]:          0 :             pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
     311         [ #  # ]:          0 :             pUndoDoc->InitUndo( pDoc, nTab, nTab, sal_True, sal_True );
     312         [ #  # ]:          0 :             pDoc->CopyToDocument( nOutStartCol, 0, nTab, nOutEndCol, MAXROW, nTab, IDF_NONE, false, pUndoDoc );
     313         [ #  # ]:          0 :             pDoc->CopyToDocument( 0, nOutStartRow, nTab, MAXCOL, nOutEndRow, nTab, IDF_NONE, false, pUndoDoc );
     314                 :            :         }
     315                 :            : 
     316                 :            :         // einblenden
     317                 :          0 :         SelectLevel( nTab, sal_True,  pTable->GetColArray()->GetDepth(), false, false, bApi );
     318                 :          0 :         SelectLevel( nTab, false, pTable->GetRowArray()->GetDepth(), false, false, bApi );
     319                 :          0 :         pDoc->SetOutlineTable( nTab, NULL );
     320                 :            :     }
     321                 :            : 
     322                 :          0 :     pDoc->DoAutoOutline( nStartCol,nStartRow, nEndCol,nEndRow, nTab );
     323                 :            : 
     324         [ #  # ]:          0 :     if (bRecord)
     325                 :            :     {
     326                 :          0 :         rDocShell.GetUndoManager()->AddUndoAction(
     327                 :            :             new ScUndoAutoOutline( &rDocShell,
     328                 :            :                                     nStartCol, nStartRow, nTab,
     329                 :            :                                     nEndCol, nEndRow, nTab,
     330         [ #  # ]:          0 :                                     pUndoDoc, pUndoTab ) );
     331                 :            :     }
     332                 :            : 
     333         [ #  # ]:          0 :     if (pDoc->IsStreamValid(nTab))
     334                 :          0 :         pDoc->SetStreamValid(nTab, false);
     335                 :            : 
     336                 :          0 :     rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_LEFT | PAINT_TOP | PAINT_SIZE );
     337                 :          0 :     rDocShell.SetDocumentModified();
     338                 :          0 :     lcl_InvalidateOutliner( rDocShell.GetViewBindings() );
     339                 :            : 
     340                 :          0 :     return sal_True;
     341                 :            : }
     342                 :            : 
     343                 :            : //------------------------------------------------------------------------
     344                 :            : 
     345                 :          0 : sal_Bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, sal_Bool bColumns, sal_uInt16 nLevel,
     346                 :            :                                     sal_Bool bRecord, sal_Bool bPaint, sal_Bool /* bApi */ )
     347                 :            : {
     348                 :          0 :     ScDocument* pDoc = rDocShell.GetDocument();
     349                 :            : 
     350 [ #  # ][ #  # ]:          0 :     if (bRecord && !pDoc->IsUndoEnabled())
                 [ #  # ]
     351                 :          0 :         bRecord = false;
     352         [ #  # ]:          0 :     ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );             // ist schon da
     353         [ #  # ]:          0 :     if (!pTable)
     354                 :          0 :         return false;
     355         [ #  # ]:          0 :     ScOutlineArray* pArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
     356         [ #  # ]:          0 :     if (!pArray)
     357                 :          0 :         return false;
     358                 :            : 
     359                 :            :     SCCOLROW nStart, nEnd;
     360         [ #  # ]:          0 :     pArray->GetRange( nStart, nEnd );
     361                 :            : 
     362         [ #  # ]:          0 :     if ( bRecord )
     363                 :            :     {
     364 [ #  # ][ #  # ]:          0 :         ScOutlineTable* pUndoTab = new ScOutlineTable( *pTable );
     365 [ #  # ][ #  # ]:          0 :         ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
     366         [ #  # ]:          0 :         if (bColumns)
     367                 :            :         {
     368         [ #  # ]:          0 :             pUndoDoc->InitUndo( pDoc, nTab, nTab, sal_True, false );
     369                 :            :             pDoc->CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
     370                 :            :                     static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE, false,
     371         [ #  # ]:          0 :                     pUndoDoc );
     372                 :            :         }
     373                 :            :         else
     374                 :            :         {
     375         [ #  # ]:          0 :             pUndoDoc->InitUndo( pDoc, nTab, nTab, false, sal_True );
     376         [ #  # ]:          0 :             pDoc->CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, pUndoDoc );
     377                 :            :         }
     378                 :            : 
     379         [ #  # ]:          0 :         rDocShell.GetUndoManager()->AddUndoAction(
     380                 :            :             new ScUndoOutlineLevel( &rDocShell,
     381                 :            :                                     nStart, nEnd, nTab,             //! start und end berechnen
     382                 :            :                                     pUndoDoc, pUndoTab,
     383 [ #  # ][ #  # ]:          0 :                                     bColumns, nLevel ) );
                 [ #  # ]
     384                 :            :     }
     385                 :            : 
     386         [ #  # ]:          0 :     pDoc->IncSizeRecalcLevel( nTab );
     387                 :            : 
     388         [ #  # ]:          0 :     pDoc->InitializeNoteCaptions(nTab);
     389         [ #  # ]:          0 :     ScSubOutlineIterator aIter( pArray );                   // alle Eintraege
     390                 :            :     ScOutlineEntry* pEntry;
     391 [ #  # ][ #  # ]:          0 :     while ((pEntry=aIter.GetNext()) != NULL)
     392                 :            :     {
     393         [ #  # ]:          0 :         sal_uInt16 nThisLevel = aIter.LastLevel();
     394                 :          0 :         sal_Bool bShow = (nThisLevel < nLevel);
     395         [ #  # ]:          0 :         if (bShow)                                          // einblenden
     396                 :            :         {
     397         [ #  # ]:          0 :             pEntry->SetHidden( false );
     398         [ #  # ]:          0 :             pEntry->SetVisible( sal_True );
     399                 :            :         }
     400         [ #  # ]:          0 :         else if ( nThisLevel == nLevel )                    // ausblenden
     401                 :            :         {
     402         [ #  # ]:          0 :             pEntry->SetHidden( sal_True );
     403         [ #  # ]:          0 :             pEntry->SetVisible( sal_True );
     404                 :            :         }
     405                 :            :         else                                                // verdeckt
     406                 :            :         {
     407         [ #  # ]:          0 :             pEntry->SetVisible( false );
     408                 :            :         }
     409                 :            : 
     410         [ #  # ]:          0 :         SCCOLROW nThisStart = pEntry->GetStart();
     411         [ #  # ]:          0 :         SCCOLROW nThisEnd   = pEntry->GetEnd();
     412         [ #  # ]:          0 :         for (SCCOLROW i=nThisStart; i<=nThisEnd; i++)
     413                 :            :         {
     414         [ #  # ]:          0 :             if ( bColumns )
     415         [ #  # ]:          0 :                 pDoc->ShowCol( static_cast<SCCOL>(i), nTab, bShow );
     416                 :            :             else
     417                 :            :             {
     418                 :            :                 // show several rows together, don't show filtered rows
     419                 :          0 :                 SCROW nFilterEnd = i;
     420         [ #  # ]:          0 :                 bool bFiltered = pDoc->RowFiltered( i, nTab, NULL, &nFilterEnd );
     421         [ #  # ]:          0 :                 nFilterEnd = std::min( nThisEnd, nFilterEnd );
     422 [ #  # ][ #  # ]:          0 :                 if ( !bShow || !bFiltered )
     423         [ #  # ]:          0 :                     pDoc->ShowRows( i, nFilterEnd, nTab, bShow );
     424                 :          0 :                 i = nFilterEnd;
     425                 :            :             }
     426                 :            :         }
     427                 :            :     }
     428                 :            : 
     429         [ #  # ]:          0 :     pDoc->DecSizeRecalcLevel( nTab );
     430         [ #  # ]:          0 :     pDoc->SetDrawPageSize(nTab);
     431         [ #  # ]:          0 :     pDoc->UpdatePageBreaks( nTab );
     432                 :            : 
     433         [ #  # ]:          0 :     if (bPaint)
     434         [ #  # ]:          0 :         lcl_PaintWidthHeight( rDocShell, nTab, bColumns, nStart, nEnd );
     435                 :            : 
     436         [ #  # ]:          0 :     rDocShell.SetDocumentModified();
     437 [ #  # ][ #  # ]:          0 :     lcl_InvalidateOutliner( rDocShell.GetViewBindings() );
     438                 :            : 
     439                 :          0 :     return sal_True;
     440                 :            : }
     441                 :            : 
     442                 :            : //------------------------------------------------------------------------
     443                 :            : 
     444                 :          0 : sal_Bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, sal_Bool bRecord )
     445                 :            : {
     446                 :          0 :     sal_Bool bDone = false;
     447                 :            : 
     448                 :          0 :     SCCOL nStartCol = rRange.aStart.Col();
     449                 :          0 :     SCROW nStartRow = rRange.aStart.Row();
     450                 :          0 :     SCCOL nEndCol = rRange.aEnd.Col();
     451                 :          0 :     SCROW nEndRow = rRange.aEnd.Row();
     452                 :          0 :     SCTAB nTab = rRange.aStart.Tab();
     453                 :            : 
     454                 :          0 :     ScDocument* pDoc = rDocShell.GetDocument();
     455                 :            : 
     456 [ #  # ][ #  # ]:          0 :     if (bRecord && !pDoc->IsUndoEnabled())
                 [ #  # ]
     457                 :          0 :         bRecord = false;
     458                 :          0 :     ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
     459                 :            : 
     460         [ #  # ]:          0 :     if (pTable)
     461                 :            :     {
     462                 :            :         ScOutlineArray* pArray;
     463                 :            :         ScOutlineEntry* pEntry;
     464                 :            :         SCCOLROW nStart;
     465                 :            :         SCCOLROW nEnd;
     466                 :            :         SCCOLROW nMin;
     467                 :            :         SCCOLROW nMax;
     468                 :            :         SCCOLROW i;
     469                 :            : 
     470         [ #  # ]:          0 :         if ( bRecord )
     471                 :            :         {
     472 [ #  # ][ #  # ]:          0 :             ScOutlineTable* pUndoTab = new ScOutlineTable( *pTable );
     473 [ #  # ][ #  # ]:          0 :             ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
     474         [ #  # ]:          0 :             pUndoDoc->InitUndo( pDoc, nTab, nTab, sal_True, sal_True );
     475         [ #  # ]:          0 :             pDoc->CopyToDocument( nStartCol, 0, nTab, nEndCol, MAXROW, nTab, IDF_NONE, false, pUndoDoc );
     476         [ #  # ]:          0 :             pDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, pUndoDoc );
     477                 :            : 
     478         [ #  # ]:          0 :             rDocShell.GetUndoManager()->AddUndoAction(
     479                 :            :                 new ScUndoOutlineBlock( &rDocShell,
     480                 :            :                                         nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab,
     481 [ #  # ][ #  # ]:          0 :                                         pUndoDoc, pUndoTab, sal_True ) );
                 [ #  # ]
     482                 :            :         }
     483                 :            : 
     484         [ #  # ]:          0 :         pDoc->IncSizeRecalcLevel( nTab );
     485                 :            : 
     486                 :            :         //  Spalten
     487                 :            : 
     488                 :          0 :         nMin=MAXCOL;
     489                 :          0 :         nMax=0;
     490                 :          0 :         pArray = pTable->GetColArray();
     491         [ #  # ]:          0 :         ScSubOutlineIterator aColIter( pArray );
     492 [ #  # ][ #  # ]:          0 :         while ((pEntry=aColIter.GetNext()) != NULL)
     493                 :            :         {
     494         [ #  # ]:          0 :             nStart = pEntry->GetStart();
     495         [ #  # ]:          0 :             nEnd   = pEntry->GetEnd();
     496 [ #  # ][ #  # ]:          0 :             if ( nStart>=nStartCol && nEnd<=nEndCol )
     497                 :            :             {
     498         [ #  # ]:          0 :                 pEntry->SetHidden( false );
     499         [ #  # ]:          0 :                 pEntry->SetVisible( sal_True );
     500         [ #  # ]:          0 :                 if (nStart<nMin) nMin=nStart;
     501         [ #  # ]:          0 :                 if (nEnd>nMax) nMax=nEnd;
     502                 :            :             }
     503                 :            :         }
     504         [ #  # ]:          0 :         for ( i=nMin; i<=nMax; i++ )
     505         [ #  # ]:          0 :             pDoc->ShowCol( static_cast<SCCOL>(i), nTab, sal_True );
     506                 :            : 
     507                 :            :         //  Zeilen
     508                 :            : 
     509                 :          0 :         nMin=MAXROW;
     510                 :          0 :         nMax=0;
     511                 :          0 :         pArray = pTable->GetRowArray();
     512         [ #  # ]:          0 :         ScSubOutlineIterator aRowIter( pArray );
     513         [ #  # ]:          0 :         pDoc->InitializeNoteCaptions(nTab);
     514 [ #  # ][ #  # ]:          0 :         while ((pEntry=aRowIter.GetNext()) != NULL)
     515                 :            :         {
     516         [ #  # ]:          0 :             nStart = pEntry->GetStart();
     517         [ #  # ]:          0 :             nEnd   = pEntry->GetEnd();
     518 [ #  # ][ #  # ]:          0 :             if ( nStart>=nStartRow && nEnd<=nEndRow )
     519                 :            :             {
     520         [ #  # ]:          0 :                 pEntry->SetHidden( false );
     521         [ #  # ]:          0 :                 pEntry->SetVisible( sal_True );
     522         [ #  # ]:          0 :                 if (nStart<nMin) nMin=nStart;
     523         [ #  # ]:          0 :                 if (nEnd>nMax) nMax=nEnd;
     524                 :            :             }
     525                 :            :         }
     526         [ #  # ]:          0 :         for ( i=nMin; i<=nMax; i++ )
     527                 :            :         {
     528                 :            :             // show several rows together, don't show filtered rows
     529                 :          0 :             SCROW nFilterEnd = i;
     530         [ #  # ]:          0 :             bool bFiltered = pDoc->RowFiltered( i, nTab, NULL, &nFilterEnd );
     531         [ #  # ]:          0 :             nFilterEnd = std::min( nMax, nFilterEnd );
     532         [ #  # ]:          0 :             if ( !bFiltered )
     533         [ #  # ]:          0 :                 pDoc->ShowRows( i, nFilterEnd, nTab, sal_True );
     534                 :          0 :             i = nFilterEnd;
     535                 :            :         }
     536                 :            : 
     537         [ #  # ]:          0 :         pDoc->DecSizeRecalcLevel( nTab );
     538         [ #  # ]:          0 :         pDoc->SetDrawPageSize(nTab);
     539         [ #  # ]:          0 :         pDoc->UpdatePageBreaks( nTab );
     540                 :            : 
     541         [ #  # ]:          0 :         rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID | PAINT_LEFT | PAINT_TOP );
     542         [ #  # ]:          0 :         rDocShell.SetDocumentModified();
     543                 :          0 :         bDone = sal_True;
     544                 :            : 
     545 [ #  # ][ #  # ]:          0 :         lcl_InvalidateOutliner( rDocShell.GetViewBindings() );
     546                 :            :     }
     547                 :            : 
     548                 :          0 :     return bDone;
     549                 :            : }
     550                 :            : 
     551                 :          0 : sal_Bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, sal_Bool bRecord, sal_Bool bApi )
     552                 :            : {
     553                 :          0 :     sal_Bool bDone = false;
     554                 :            : 
     555                 :          0 :     SCCOL nStartCol = rRange.aStart.Col();
     556                 :          0 :     SCROW nStartRow = rRange.aStart.Row();
     557                 :          0 :     SCCOL nEndCol = rRange.aEnd.Col();
     558                 :          0 :     SCROW nEndRow = rRange.aEnd.Row();
     559                 :          0 :     SCTAB nTab = rRange.aStart.Tab();
     560                 :            : 
     561                 :          0 :     ScDocument* pDoc = rDocShell.GetDocument();
     562                 :            : 
     563 [ #  # ][ #  # ]:          0 :     if (bRecord && !pDoc->IsUndoEnabled())
                 [ #  # ]
     564                 :          0 :         bRecord = false;
     565                 :          0 :     ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
     566                 :            : 
     567         [ #  # ]:          0 :     if (pTable)
     568                 :            :     {
     569                 :            :         const ScOutlineEntry* pEntry;
     570                 :            :         size_t nColLevel;
     571                 :            :         size_t nRowLevel;
     572                 :            :         sal_uInt16 nCount;
     573                 :            :         SCCOLROW nStart;
     574                 :            :         SCCOLROW nEnd;
     575                 :            :         sal_uInt16 i;
     576                 :            : 
     577                 :          0 :         SCCOLROW nEffStartCol = nStartCol;
     578                 :          0 :         SCCOLROW nEffEndCol   = nEndCol;
     579                 :          0 :         ScOutlineArray* pColArray = pTable->GetColArray();
     580         [ #  # ]:          0 :         pColArray->FindTouchedLevel( nStartCol, nEndCol, nColLevel );
     581         [ #  # ]:          0 :         pColArray->ExtendBlock( nColLevel, nEffStartCol, nEffEndCol );
     582                 :          0 :         SCCOLROW nEffStartRow = nStartRow;
     583                 :          0 :         SCCOLROW nEffEndRow   = nEndRow;
     584                 :          0 :         ScOutlineArray* pRowArray = pTable->GetRowArray();
     585         [ #  # ]:          0 :         pRowArray->FindTouchedLevel( nStartRow, nEndRow, nRowLevel );
     586         [ #  # ]:          0 :         pRowArray->ExtendBlock( nRowLevel, nEffStartRow, nEffEndRow );
     587                 :            : 
     588         [ #  # ]:          0 :         if ( bRecord )
     589                 :            :         {
     590 [ #  # ][ #  # ]:          0 :             ScOutlineTable* pUndoTab = new ScOutlineTable( *pTable );
     591 [ #  # ][ #  # ]:          0 :             ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
     592         [ #  # ]:          0 :             pUndoDoc->InitUndo( pDoc, nTab, nTab, sal_True, sal_True );
     593                 :            :             pDoc->CopyToDocument( static_cast<SCCOL>(nEffStartCol), 0, nTab,
     594                 :            :                     static_cast<SCCOL>(nEffEndCol), MAXROW, nTab, IDF_NONE,
     595         [ #  # ]:          0 :                     false, pUndoDoc );
     596         [ #  # ]:          0 :             pDoc->CopyToDocument( 0, nEffStartRow, nTab, MAXCOL, nEffEndRow, nTab, IDF_NONE, false, pUndoDoc );
     597                 :            : 
     598         [ #  # ]:          0 :             rDocShell.GetUndoManager()->AddUndoAction(
     599                 :            :                 new ScUndoOutlineBlock( &rDocShell,
     600                 :            :                                         nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab,
     601 [ #  # ][ #  # ]:          0 :                                         pUndoDoc, pUndoTab, false ) );
                 [ #  # ]
     602                 :            :         }
     603                 :            : 
     604         [ #  # ]:          0 :         pDoc->IncSizeRecalcLevel( nTab );
     605                 :            : 
     606                 :            :         //  Spalten
     607                 :            : 
     608         [ #  # ]:          0 :         nCount = pColArray->GetCount(nColLevel);
     609         [ #  # ]:          0 :         for ( i=0; i<nCount; i++ )
     610                 :            :         {
     611         [ #  # ]:          0 :             pEntry = pColArray->GetEntry(nColLevel,i);
     612         [ #  # ]:          0 :             nStart = pEntry->GetStart();
     613         [ #  # ]:          0 :             nEnd   = pEntry->GetEnd();
     614                 :            : 
     615 [ #  # ][ #  # ]:          0 :             if ( static_cast<SCCOLROW>(nStartCol)<=nEnd && static_cast<SCCOLROW>(nEndCol)>=nStart )
     616         [ #  # ]:          0 :                 HideOutline( nTab, sal_True, nColLevel, i, false, false, bApi );
     617                 :            :         }
     618                 :            : 
     619                 :            :         //  Zeilen
     620                 :            : 
     621         [ #  # ]:          0 :         nCount = pRowArray->GetCount(nRowLevel);
     622         [ #  # ]:          0 :         for ( i=0; i<nCount; i++ )
     623                 :            :         {
     624         [ #  # ]:          0 :             pEntry = pRowArray->GetEntry(nRowLevel,i);
     625         [ #  # ]:          0 :             nStart = pEntry->GetStart();
     626         [ #  # ]:          0 :             nEnd   = pEntry->GetEnd();
     627                 :            : 
     628 [ #  # ][ #  # ]:          0 :             if ( nStartRow<=nEnd && nEndRow>=nStart )
     629         [ #  # ]:          0 :                 HideOutline( nTab, false, nRowLevel, i, false, false, bApi );
     630                 :            :         }
     631                 :            : 
     632         [ #  # ]:          0 :         pDoc->DecSizeRecalcLevel( nTab );
     633         [ #  # ]:          0 :         pDoc->UpdatePageBreaks( nTab );
     634                 :            : 
     635         [ #  # ]:          0 :         rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID | PAINT_LEFT | PAINT_TOP );
     636                 :            : 
     637         [ #  # ]:          0 :         rDocShell.SetDocumentModified();
     638                 :          0 :         bDone = sal_True;
     639                 :            : 
     640 [ #  # ][ #  # ]:          0 :         lcl_InvalidateOutliner( rDocShell.GetViewBindings() );
     641                 :            :     }
     642                 :            : 
     643                 :          0 :     return bDone;
     644                 :            : }
     645                 :            : 
     646                 :            : //------------------------------------------------------------------------
     647                 :            : 
     648                 :          0 : sal_Bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, sal_Bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry,
     649                 :            :                                     sal_Bool bRecord, sal_Bool bPaint, sal_Bool /* bApi */ )
     650                 :            : {
     651                 :          0 :     ScDocument* pDoc = rDocShell.GetDocument();
     652 [ #  # ][ #  # ]:          0 :     if (bRecord && !pDoc->IsUndoEnabled())
                 [ #  # ]
     653                 :          0 :         bRecord = false;
     654                 :            : 
     655         [ #  # ]:          0 :     ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
     656         [ #  # ]:          0 :     ScOutlineArray* pArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
     657         [ #  # ]:          0 :     ScOutlineEntry* pEntry = pArray->GetEntry( nLevel, nEntry );
     658         [ #  # ]:          0 :     SCCOLROW nStart = pEntry->GetStart();
     659         [ #  # ]:          0 :     SCCOLROW nEnd   = pEntry->GetEnd();
     660                 :            : 
     661         [ #  # ]:          0 :     if ( bRecord )
     662                 :            :     {
     663 [ #  # ][ #  # ]:          0 :         ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
     664         [ #  # ]:          0 :         if (bColumns)
     665                 :            :         {
     666         [ #  # ]:          0 :             pUndoDoc->InitUndo( pDoc, nTab, nTab, sal_True, false );
     667                 :            :             pDoc->CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
     668                 :            :                     static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE, false,
     669         [ #  # ]:          0 :                     pUndoDoc );
     670                 :            :         }
     671                 :            :         else
     672                 :            :         {
     673         [ #  # ]:          0 :             pUndoDoc->InitUndo( pDoc, nTab, nTab, false, sal_True );
     674         [ #  # ]:          0 :             pDoc->CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, pUndoDoc );
     675                 :            :         }
     676                 :            : 
     677         [ #  # ]:          0 :         rDocShell.GetUndoManager()->AddUndoAction(
     678                 :            :             new ScUndoDoOutline( &rDocShell,
     679                 :            :                                     nStart, nEnd, nTab, pUndoDoc,       //! start und end berechnen
     680 [ #  # ][ #  # ]:          0 :                                     bColumns, nLevel, nEntry, sal_True ) );
                 [ #  # ]
     681                 :            :     }
     682                 :            : 
     683         [ #  # ]:          0 :     pDoc->IncSizeRecalcLevel( nTab );
     684                 :            : 
     685         [ #  # ]:          0 :     pDoc->InitializeNoteCaptions(nTab);
     686         [ #  # ]:          0 :     pEntry->SetHidden(false);
     687                 :            :     SCCOLROW i;
     688         [ #  # ]:          0 :     for ( i = nStart; i <= nEnd; i++ )
     689                 :            :     {
     690         [ #  # ]:          0 :         if ( bColumns )
     691         [ #  # ]:          0 :             pDoc->ShowCol( static_cast<SCCOL>(i), nTab, sal_True );
     692                 :            :         else
     693                 :            :         {
     694                 :            :             // show several rows together, don't show filtered rows
     695                 :          0 :             SCROW nFilterEnd = i;
     696         [ #  # ]:          0 :             bool bFiltered = pDoc->RowFiltered( i, nTab, NULL, &nFilterEnd );
     697         [ #  # ]:          0 :             nFilterEnd = std::min( nEnd, nFilterEnd );
     698         [ #  # ]:          0 :             if ( !bFiltered )
     699         [ #  # ]:          0 :                 pDoc->ShowRows( i, nFilterEnd, nTab, sal_True );
     700                 :          0 :             i = nFilterEnd;
     701                 :            :         }
     702                 :            :     }
     703                 :            : 
     704         [ #  # ]:          0 :     ScSubOutlineIterator aIter( pArray, nLevel, nEntry );
     705 [ #  # ][ #  # ]:          0 :     while ((pEntry=aIter.GetNext()) != NULL)
     706                 :            :     {
     707 [ #  # ][ #  # ]:          0 :         if ( pEntry->IsHidden() )
     708                 :            :         {
     709         [ #  # ]:          0 :             SCCOLROW nSubStart = pEntry->GetStart();
     710         [ #  # ]:          0 :             SCCOLROW nSubEnd   = pEntry->GetEnd();
     711         [ #  # ]:          0 :             if ( bColumns )
     712         [ #  # ]:          0 :                 for ( i = nSubStart; i <= nSubEnd; i++ )
     713         [ #  # ]:          0 :                     pDoc->ShowCol( static_cast<SCCOL>(i), nTab, false );
     714                 :            :             else
     715         [ #  # ]:          0 :                 pDoc->ShowRows( nSubStart, nSubEnd, nTab, sal_False );
     716                 :            :         }
     717                 :            :     }
     718                 :            : 
     719         [ #  # ]:          0 :     pArray->SetVisibleBelow( nLevel, nEntry, sal_True, sal_True );
     720                 :            : 
     721         [ #  # ]:          0 :     pDoc->SetDrawPageSize(nTab);
     722         [ #  # ]:          0 :     pDoc->InvalidatePageBreaks(nTab);
     723         [ #  # ]:          0 :     pDoc->UpdatePageBreaks( nTab );
     724                 :            : 
     725         [ #  # ]:          0 :     if (bPaint)
     726         [ #  # ]:          0 :         lcl_PaintWidthHeight( rDocShell, nTab, bColumns, nStart, nEnd );
     727                 :            : 
     728         [ #  # ]:          0 :     rDocShell.SetDocumentModified();
     729                 :            : 
     730 [ #  # ][ #  # ]:          0 :     lcl_InvalidateOutliner( rDocShell.GetViewBindings() );
     731                 :            : 
     732                 :          0 :     return sal_True;        //! immer ???
     733                 :            : }
     734                 :            : 
     735                 :          0 : sal_Bool ScOutlineDocFunc::HideOutline( SCTAB nTab, sal_Bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry,
     736                 :            :                                     sal_Bool bRecord, sal_Bool bPaint, sal_Bool /* bApi */ )
     737                 :            : {
     738                 :          0 :     ScDocument* pDoc = rDocShell.GetDocument();
     739 [ #  # ][ #  # ]:          0 :     if (bRecord && !pDoc->IsUndoEnabled())
                 [ #  # ]
     740                 :          0 :         bRecord = false;
     741                 :            : 
     742                 :          0 :     ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
     743         [ #  # ]:          0 :     ScOutlineArray* pArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
     744                 :          0 :     ScOutlineEntry* pEntry = pArray->GetEntry( nLevel, nEntry );
     745                 :          0 :     SCCOLROW nStart = pEntry->GetStart();
     746                 :          0 :     SCCOLROW nEnd   = pEntry->GetEnd();
     747                 :            : 
     748         [ #  # ]:          0 :     if ( bRecord )
     749                 :            :     {
     750         [ #  # ]:          0 :         ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
     751         [ #  # ]:          0 :         if (bColumns)
     752                 :            :         {
     753                 :          0 :             pUndoDoc->InitUndo( pDoc, nTab, nTab, sal_True, false );
     754                 :            :             pDoc->CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
     755                 :            :                     static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE, false,
     756                 :          0 :                     pUndoDoc );
     757                 :            :         }
     758                 :            :         else
     759                 :            :         {
     760                 :          0 :             pUndoDoc->InitUndo( pDoc, nTab, nTab, false, sal_True );
     761                 :          0 :             pDoc->CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, pUndoDoc );
     762                 :            :         }
     763                 :            : 
     764                 :          0 :         rDocShell.GetUndoManager()->AddUndoAction(
     765                 :            :             new ScUndoDoOutline( &rDocShell,
     766                 :            :                                     nStart, nEnd, nTab, pUndoDoc,
     767         [ #  # ]:          0 :                                     bColumns, nLevel, nEntry, false ) );
     768                 :            :     }
     769                 :            : 
     770                 :          0 :     pDoc->IncSizeRecalcLevel( nTab );
     771                 :            : 
     772                 :          0 :     pDoc->InitializeNoteCaptions(nTab);
     773                 :          0 :     pEntry->SetHidden(true);
     774                 :            :     SCCOLROW i;
     775         [ #  # ]:          0 :     if ( bColumns )
     776         [ #  # ]:          0 :         for ( i = nStart; i <= nEnd; i++ )
     777                 :          0 :             pDoc->ShowCol( static_cast<SCCOL>(i), nTab, sal_False );
     778                 :            :     else
     779                 :          0 :         pDoc->ShowRows( nStart, nEnd, nTab, sal_False );
     780                 :            : 
     781                 :          0 :     pArray->SetVisibleBelow( nLevel, nEntry, false );
     782                 :            : 
     783                 :          0 :     pDoc->DecSizeRecalcLevel( nTab );
     784                 :          0 :     pDoc->SetDrawPageSize(nTab);
     785                 :          0 :     pDoc->InvalidatePageBreaks(nTab);
     786                 :          0 :     pDoc->UpdatePageBreaks( nTab );
     787                 :            : 
     788         [ #  # ]:          0 :     if (bPaint)
     789                 :          0 :         lcl_PaintWidthHeight( rDocShell, nTab, bColumns, nStart, nEnd );
     790                 :            : 
     791                 :          0 :     rDocShell.SetDocumentModified();
     792                 :            : 
     793                 :          0 :     lcl_InvalidateOutliner( rDocShell.GetViewBindings() );
     794                 :            : 
     795                 :          0 :     return sal_True;        //! immer ???
     796                 :            : }
     797                 :            : 
     798                 :            : 
     799                 :            : 
     800                 :            : 
     801                 :            : 
     802                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10