LCOV - code coverage report
Current view: top level - sc/source/ui/view - tabvwshc.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 147 0.0 %
Date: 2012-08-25 Functions: 0 3 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 208 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 "scitems.hxx"
      30                 :            : #include <vcl/msgbox.hxx>
      31                 :            : #include <sfx2/childwin.hxx>
      32                 :            : #include <sfx2/dispatch.hxx>
      33                 :            : 
      34                 :            : #include "tabvwsh.hxx"
      35                 :            : #include "sc.hrc"
      36                 :            : #include "globstr.hrc"
      37                 :            : #include "global.hxx"
      38                 :            : #include "scmod.hxx"
      39                 :            : #include "docsh.hxx"
      40                 :            : #include "document.hxx"
      41                 :            : #include "uiitems.hxx"
      42                 :            : #include "pivot.hxx"
      43                 :            : #include "namedlg.hxx"
      44                 :            : #include "namedefdlg.hxx"
      45                 :            : #include "solvrdlg.hxx"
      46                 :            : #include "optsolver.hxx"
      47                 :            : #include "tabopdlg.hxx"
      48                 :            : #include "autoform.hxx"         // Core
      49                 :            : #include "autofmt.hxx"          // Dialog
      50                 :            : #include "consdlg.hxx"
      51                 :            : #include "filtdlg.hxx"
      52                 :            : #include "dbnamdlg.hxx"
      53                 :            : #include "pvlaydlg.hxx"
      54                 :            : #include "areasdlg.hxx"
      55                 :            : #include "rangeutl.hxx"
      56                 :            : #include "crnrdlg.hxx"
      57                 :            : #include "formula.hxx"
      58                 :            : #include "cell.hxx"             // Input Status Edit-Zellen
      59                 :            : #include "acredlin.hxx"
      60                 :            : #include "highred.hxx"
      61                 :            : #include "simpref.hxx"
      62                 :            : #include "funcdesc.hxx"
      63                 :            : #include "dpobject.hxx"
      64                 :            : #include "markdata.hxx"
      65                 :            : #include "reffact.hxx"
      66                 :            : 
      67                 :            : //------------------------------------------------------------------
      68                 :            : 
      69                 :          0 : void ScTabViewShell::SetCurRefDlgId( sal_uInt16 nNew )
      70                 :            : {
      71                 :            :     //  CurRefDlgId is stored in ScModule to find if a ref dialog is open,
      72                 :            :     //  and in the view to identify the view that has opened the dialog
      73                 :          0 :     nCurRefDlgId = nNew;
      74                 :          0 : }
      75                 :            : 
      76                 :            : //ugly hack to call Define Name from Manage Names
      77                 :          0 : void ScTabViewShell::SwitchBetweenRefDialogs(SfxModelessDialog* pDialog)
      78                 :            : {
      79                 :          0 :    sal_uInt16 nSlotId = SC_MOD()->GetCurRefDlgId();
      80         [ #  # ]:          0 :    if (nSlotId == FID_DEFINE_NAME)
      81                 :            :    {
      82                 :          0 :         mbInSwitch = true;
      83                 :          0 :         static_cast<ScNameDlg*>(pDialog)->GetRangeNames(maRangeMap);
      84                 :          0 :         static_cast<ScNameDlg*>(pDialog)->Close();
      85                 :          0 :         sal_uInt16 nId  = ScNameDefDlgWrapper::GetChildWindowId();
      86                 :          0 :         SfxViewFrame* pViewFrm = GetViewFrame();
      87                 :          0 :         SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
      88                 :            : 
      89                 :          0 :         SC_MOD()->SetRefDialog( nId, pWnd ? false : sal_True );
      90                 :            :    }
      91         [ #  # ]:          0 :    else if( nSlotId == FID_ADD_NAME )
      92                 :            :    {
      93                 :          0 :         static_cast<ScNameDefDlg*>(pDialog)->GetNewData(maName, maScope);
      94                 :          0 :         static_cast<ScNameDlg*>(pDialog)->Close();
      95                 :          0 :         sal_uInt16 nId  = ScNameDlgWrapper::GetChildWindowId();
      96                 :          0 :         SfxViewFrame* pViewFrm = GetViewFrame();
      97                 :          0 :         SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
      98                 :            : 
      99                 :          0 :         SC_MOD()->SetRefDialog( nId, pWnd ? false : sal_True );
     100                 :            :    }
     101                 :            :    else
     102                 :            :    {
     103                 :            : 
     104                 :            :    }
     105                 :          0 : }
     106                 :            : 
     107                 :          0 : SfxModelessDialog* ScTabViewShell::CreateRefDialog(
     108                 :            :                         SfxBindings* pB, SfxChildWindow* pCW, SfxChildWinInfo* pInfo,
     109                 :            :                         Window* pParent, sal_uInt16 nSlotId )
     110                 :            : {
     111                 :            :     //  Dialog nur aufmachen, wenn ueber ScModule::SetRefDialog gerufen, damit
     112                 :            :     //  z.B. nach einem Absturz offene Ref-Dialoge nicht wiederkommen (#42341#).
     113                 :            : 
     114         [ #  # ]:          0 :     if ( SC_MOD()->GetCurRefDlgId() != nSlotId )
     115                 :          0 :         return NULL;
     116                 :            : 
     117         [ #  # ]:          0 :     if ( nCurRefDlgId != nSlotId )
     118                 :            :     {
     119                 :            :         //  the dialog has been opened in a different view
     120                 :            :         //  -> lock the dispatcher for this view (modal mode)
     121                 :            : 
     122                 :          0 :         GetViewData()->GetDispatcher().Lock( sal_True );    // lock is reset when closing dialog
     123                 :          0 :         return NULL;
     124                 :            :     }
     125                 :            : 
     126                 :          0 :     SfxModelessDialog* pResult = 0;
     127                 :            : 
     128         [ #  # ]:          0 :     if(pCW)
     129                 :          0 :         pCW->SetHideNotDelete(sal_True);
     130                 :            : 
     131                 :          0 :     ScDocument* pDoc = GetViewData()->GetDocument();
     132                 :            : 
     133   [ #  #  #  #  :          0 :     switch( nSlotId )
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     134                 :            :     {
     135                 :            :         case FID_DEFINE_NAME:
     136                 :            :         {
     137         [ #  # ]:          0 :             if (!mbInSwitch)
     138                 :            :             {
     139                 :          0 :                 pResult = new ScNameDlg( pB, pCW, pParent, GetViewData(),
     140                 :          0 :                                      ScAddress( GetViewData()->GetCurX(),
     141                 :            :                                                 GetViewData()->GetCurY(),
     142 [ #  # ][ #  # ]:          0 :                                                 GetViewData()->GetTabNo() ) );
     143                 :            :             }
     144                 :            :             else
     145                 :            :             {
     146                 :          0 :                 pResult = new ScNameDlg( pB, pCW, pParent, GetViewData(),
     147                 :          0 :                                      ScAddress( GetViewData()->GetCurX(),
     148                 :            :                                                 GetViewData()->GetCurY(),
     149 [ #  # ][ #  # ]:          0 :                                                 GetViewData()->GetTabNo() ), &maRangeMap);
     150                 :          0 :                 static_cast<ScNameDlg*>(pResult)->SetEntry( maName, maScope);
     151                 :          0 :                 mbInSwitch = false;
     152                 :            :             }
     153                 :            :         }
     154                 :          0 :         break;
     155                 :            : 
     156                 :            :         case FID_ADD_NAME:
     157                 :            :         {
     158         [ #  # ]:          0 :             if (!mbInSwitch)
     159                 :            :             {
     160         [ #  # ]:          0 :                 std::map<rtl::OUString, ScRangeName*> aRangeMap;
     161         [ #  # ]:          0 :                 pDoc->GetRangeNameMap(aRangeMap);
     162                 :          0 :                 pResult = new ScNameDefDlg( pB, pCW, pParent, GetViewData(), aRangeMap,
     163                 :          0 :                                 ScAddress( GetViewData()->GetCurX(),
     164                 :            :                                             GetViewData()->GetCurY(),
     165 [ #  # ][ #  # ]:          0 :                                             GetViewData()->GetTabNo() ), true );
                 [ #  # ]
     166                 :            :             }
     167                 :            :             else
     168                 :            :             {
     169         [ #  # ]:          0 :                 std::map<rtl::OUString, ScRangeName*> aRangeMap;
     170 [ #  # ][ #  # ]:          0 :                 for (boost::ptr_map<rtl::OUString, ScRangeName>::iterator itr = maRangeMap.begin();
         [ #  # ][ #  # ]
     171         [ #  # ]:          0 :                         itr != maRangeMap.end(); ++itr)
     172                 :            :                 {
     173 [ #  # ][ #  # ]:          0 :                     aRangeMap.insert(std::pair<rtl::OUString, ScRangeName*>(itr->first, itr->second));
                 [ #  # ]
     174                 :            :                 }
     175                 :          0 :                 pResult = new ScNameDefDlg( pB, pCW, pParent, GetViewData(), aRangeMap,
     176                 :          0 :                                 ScAddress( GetViewData()->GetCurX(),
     177                 :            :                                             GetViewData()->GetCurY(),
     178 [ #  # ][ #  # ]:          0 :                                             GetViewData()->GetTabNo() ), false );
                 [ #  # ]
     179                 :            :             }
     180                 :            :         }
     181                 :          0 :         break;
     182                 :            : 
     183                 :            :         case SID_DEFINE_COLROWNAMERANGES:
     184                 :            :         {
     185         [ #  # ]:          0 :             pResult = new ScColRowNameRangesDlg( pB, pCW, pParent, GetViewData() );
     186                 :            :         }
     187                 :          0 :         break;
     188                 :            : 
     189                 :            :         case SID_OPENDLG_CONSOLIDATE:
     190                 :            :         {
     191                 :          0 :             SfxItemSet aArgSet( GetPool(),
     192                 :            :                                 SCITEM_CONSOLIDATEDATA,
     193         [ #  # ]:          0 :                                 SCITEM_CONSOLIDATEDATA );
     194                 :            : 
     195                 :            :             const ScConsolidateParam* pDlgData =
     196                 :          0 :                             pDoc->GetConsolidateDlgData();
     197                 :            : 
     198         [ #  # ]:          0 :             if ( !pDlgData )
     199                 :            :             {
     200         [ #  # ]:          0 :                 ScConsolidateParam  aConsParam;
     201                 :            :                 SCCOL nStartCol, nEndCol;
     202                 :            :                 SCROW nStartRow, nEndRow;
     203                 :            :                 SCTAB nStartTab, nEndTab;
     204                 :            : 
     205                 :            :                 GetViewData()->GetSimpleArea( nStartCol, nStartRow, nStartTab,
     206         [ #  # ]:          0 :                                               nEndCol,   nEndRow,   nEndTab );
     207                 :            : 
     208                 :          0 :                 PutInOrder( nStartCol, nEndCol );
     209                 :          0 :                 PutInOrder( nStartRow, nEndRow );
     210                 :          0 :                 PutInOrder( nStartTab, nEndTab );
     211                 :            : 
     212                 :          0 :                 aConsParam.nCol = nStartCol;
     213                 :          0 :                 aConsParam.nRow = nStartRow;
     214                 :          0 :                 aConsParam.nTab = nStartTab;
     215                 :            : 
     216                 :            :                 aArgSet.Put( ScConsolidateItem( SCITEM_CONSOLIDATEDATA,
     217 [ #  # ][ #  # ]:          0 :                                                 &aConsParam ) );
         [ #  # ][ #  # ]
     218                 :            :             }
     219                 :            :             else
     220                 :            :             {
     221 [ #  # ][ #  # ]:          0 :                 aArgSet.Put( ScConsolidateItem( SCITEM_CONSOLIDATEDATA, pDlgData ) );
                 [ #  # ]
     222                 :            :             }
     223 [ #  # ][ #  # ]:          0 :             pResult = new ScConsolidateDlg( pB, pCW, pParent, aArgSet );
                 [ #  # ]
     224                 :            :         }
     225                 :          0 :         break;
     226                 :            : 
     227                 :            :         case SID_DEFINE_DBNAME:
     228                 :            :         {
     229                 :            :             //  wenn auf einem bestehenden Bereich aufgerufen, den markieren
     230                 :          0 :             GetDBData( sal_True, SC_DB_OLD );
     231                 :          0 :             const ScMarkData& rMark = GetViewData()->GetMarkData();
     232 [ #  # ][ #  # ]:          0 :             if ( !rMark.IsMarked() && !rMark.IsMultiMarked() )
                 [ #  # ]
     233                 :          0 :                 MarkDataArea( false );
     234                 :            : 
     235         [ #  # ]:          0 :             pResult = new ScDbNameDlg( pB, pCW, pParent, GetViewData() );
     236                 :            :         }
     237                 :          0 :         break;
     238                 :            : 
     239                 :            :         case SID_SPECIAL_FILTER:
     240                 :            :         {
     241         [ #  # ]:          0 :             ScQueryParam    aQueryParam;
     242                 :          0 :             SfxItemSet      aArgSet( GetPool(),
     243                 :            :                                      SCITEM_QUERYDATA,
     244         [ #  # ]:          0 :                                      SCITEM_QUERYDATA );
     245                 :            : 
     246         [ #  # ]:          0 :             ScDBData* pDBData = GetDBData(false, SC_DB_MAKE, SC_DBSEL_ROW_DOWN);
     247         [ #  # ]:          0 :             pDBData->ExtendDataArea(pDoc);
     248         [ #  # ]:          0 :             pDBData->GetQueryParam( aQueryParam );
     249                 :            : 
     250                 :          0 :             ScRange aArea;
     251         [ #  # ]:          0 :             pDBData->GetArea(aArea);
     252         [ #  # ]:          0 :             MarkRange(aArea, false);
     253                 :            : 
     254         [ #  # ]:          0 :             ScQueryItem aItem( SCITEM_QUERYDATA, GetViewData(), &aQueryParam );
     255                 :          0 :             ScRange aAdvSource;
     256 [ #  # ][ #  # ]:          0 :             if (pDBData->GetAdvancedQuerySource(aAdvSource))
     257         [ #  # ]:          0 :                 aItem.SetAdvancedQuerySource( &aAdvSource );
     258                 :            : 
     259         [ #  # ]:          0 :             aArgSet.Put( aItem );
     260                 :            : 
     261                 :            :             // aktuelle Tabelle merken (wg. RefInput im Dialog)
     262                 :          0 :             GetViewData()->SetRefTabNo( GetViewData()->GetTabNo() );
     263                 :            : 
     264 [ #  # ][ #  # ]:          0 :             pResult = new ScSpecialFilterDlg( pB, pCW, pParent, aArgSet );
         [ #  # ][ #  # ]
                 [ #  # ]
     265                 :            :         }
     266                 :          0 :         break;
     267                 :            : 
     268                 :            :         case SID_FILTER:
     269                 :            :         {
     270                 :            : 
     271         [ #  # ]:          0 :             ScQueryParam    aQueryParam;
     272                 :          0 :             SfxItemSet      aArgSet( GetPool(),
     273                 :            :                                      SCITEM_QUERYDATA,
     274         [ #  # ]:          0 :                                      SCITEM_QUERYDATA );
     275                 :            : 
     276         [ #  # ]:          0 :             ScDBData* pDBData = GetDBData(false, SC_DB_MAKE, SC_DBSEL_ROW_DOWN);
     277         [ #  # ]:          0 :             pDBData->ExtendDataArea(pDoc);
     278         [ #  # ]:          0 :             pDBData->GetQueryParam( aQueryParam );
     279                 :            : 
     280                 :          0 :             ScRange aArea;
     281         [ #  # ]:          0 :             pDBData->GetArea(aArea);
     282         [ #  # ]:          0 :             MarkRange(aArea, false);
     283                 :            : 
     284                 :            :             aArgSet.Put( ScQueryItem( SCITEM_QUERYDATA,
     285                 :            :                                       GetViewData(),
     286 [ #  # ][ #  # ]:          0 :                                       &aQueryParam ) );
                 [ #  # ]
     287                 :            : 
     288                 :            :             // aktuelle Tabelle merken (wg. RefInput im Dialog)
     289                 :          0 :             GetViewData()->SetRefTabNo( GetViewData()->GetTabNo() );
     290                 :            : 
     291 [ #  # ][ #  # ]:          0 :             pResult = new ScFilterDlg( pB, pCW, pParent, aArgSet );
         [ #  # ][ #  # ]
     292                 :            :         }
     293                 :          0 :         break;
     294                 :            : 
     295                 :            :         case SID_OPENDLG_TABOP:
     296                 :            :         {
     297                 :          0 :             ScViewData*  pViewData  = GetViewData();
     298                 :          0 :             ScRefAddress  aCurPos   ( pViewData->GetCurX(),
     299                 :            :                                       pViewData->GetCurY(),
     300                 :          0 :                                       pViewData->GetTabNo(),
     301                 :          0 :                                       false, false, false );
     302                 :            : 
     303 [ #  # ][ #  # ]:          0 :             pResult = new ScTabOpDlg( pB, pCW, pParent, pViewData->GetDocument(), aCurPos );
                 [ #  # ]
     304                 :            :         }
     305                 :          0 :         break;
     306                 :            : 
     307                 :            :         case SID_OPENDLG_SOLVE:
     308                 :            :         {
     309                 :          0 :             ScViewData*  pViewData  = GetViewData();
     310                 :          0 :             ScAddress aCurPos(  pViewData->GetCurX(),
     311                 :            :                                 pViewData->GetCurY(),
     312                 :          0 :                                 pViewData->GetTabNo());
     313 [ #  # ][ #  # ]:          0 :             pResult = new ScSolverDlg( pB, pCW, pParent, pViewData->GetDocument(), aCurPos );
                 [ #  # ]
     314                 :            :         }
     315                 :          0 :         break;
     316                 :            : 
     317                 :            :         case SID_OPENDLG_OPTSOLVER:
     318                 :            :         {
     319                 :          0 :             ScViewData* pViewData = GetViewData();
     320                 :          0 :             ScAddress aCurPos( pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo());
     321 [ #  # ][ #  # ]:          0 :             pResult = new ScOptSolverDlg( pB, pCW, pParent, pViewData->GetDocShell(), aCurPos );
     322                 :            :         }
     323                 :          0 :         break;
     324                 :            : 
     325                 :            :         case SID_OPENDLG_PIVOTTABLE:
     326                 :            :         {
     327                 :            :             //  all settings must be in pDialogDPObject
     328                 :            : 
     329         [ #  # ]:          0 :             if( pDialogDPObject )
     330                 :            :             {
     331                 :            :                 // Check for an existing datapilot output.
     332                 :          0 :                 ScViewData* pViewData = GetViewData();
     333                 :            :                 ScDPObject* pObj = pDoc->GetDPAtCursor(
     334                 :          0 :                     pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo());
     335                 :            : 
     336                 :          0 :                 GetViewData()->SetRefTabNo( GetViewData()->GetTabNo() );
     337         [ #  # ]:          0 :                 pResult = new ScDPLayoutDlg( pB, pCW, pParent, *pDialogDPObject, pObj == NULL);
     338                 :            :             }
     339                 :            :         }
     340                 :          0 :         break;
     341                 :            : 
     342                 :            :         case SID_OPENDLG_EDIT_PRINTAREA:
     343                 :            :         {
     344         [ #  # ]:          0 :             pResult = new ScPrintAreasDlg( pB, pCW, pParent );
     345                 :            :         }
     346                 :          0 :         break;
     347                 :            : 
     348                 :            :         case SID_OPENDLG_FUNCTION:
     349                 :            :         {
     350                 :            :             //  Dialog schaut selber, was in der Zelle steht
     351                 :            : 
     352         [ #  # ]:          0 :             pResult = new ScFormulaDlg( pB, pCW, pParent, GetViewData(),ScGlobal::GetStarCalcFunctionMgr() );
     353                 :            :         }
     354                 :          0 :         break;
     355                 :            : 
     356                 :            :         case FID_CHG_SHOW:
     357                 :            :         {
     358                 :            :             //  Dialog schaut selber, was in der Zelle steht
     359                 :            : 
     360         [ #  # ]:          0 :             pResult = new ScHighlightChgDlg( pB, pCW, pParent, GetViewData() );
     361                 :            :         }
     362                 :          0 :         break;
     363                 :            : 
     364                 :            :         case WID_SIMPLE_REF:
     365                 :            :         {
     366                 :            :             //  Dialog schaut selber, was in der Zelle steht
     367                 :            : 
     368                 :          0 :             ScViewData* pViewData = GetViewData();
     369                 :          0 :             pViewData->SetRefTabNo( pViewData->GetTabNo() );
     370         [ #  # ]:          0 :             pResult = new ScSimpleRefDlg( pB, pCW, pParent, pViewData );
     371                 :            :         }
     372                 :          0 :         break;
     373                 :            : 
     374                 :            : 
     375                 :            :         default:
     376                 :            :         OSL_FAIL( "ScTabViewShell::CreateRefDialog: unbekannte ID" );
     377                 :          0 :         break;
     378                 :            :     }
     379                 :            : 
     380         [ #  # ]:          0 :     if (pResult)
     381                 :            :     {
     382                 :            :         //  Die Dialoge gehen immer mit eingeklapptem Zusaetze-Button auf,
     383                 :            :         //  darum muss die Groesse ueber das Initialize gerettet werden
     384                 :            :         //  (oder den Zusaetze-Status mit speichern !!!)
     385                 :            : 
     386         [ #  # ]:          0 :         Size aSize = pResult->GetSizePixel();
     387         [ #  # ]:          0 :         pResult->Initialize( pInfo );
     388         [ #  # ]:          0 :         pResult->SetSizePixel(aSize);
     389                 :            :     }
     390                 :            : 
     391                 :          0 :     return pResult;
     392                 :            : }
     393                 :            : 
     394                 :            : 
     395                 :            : 
     396                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10