LCOV - code coverage report
Current view: top level - sc/source/ui/namedlg - namepast.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 40 0.0 %
Date: 2012-08-25 Functions: 0 7 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 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                 :            : 
      30                 :            : #undef SC_DLLIMPLEMENTATION
      31                 :            : 
      32                 :            : 
      33                 :            : 
      34                 :            : //------------------------------------------------------------------
      35                 :            : 
      36                 :            : #include "namepast.hxx"
      37                 :            : #include "scresid.hxx"
      38                 :            : #include "docsh.hxx"
      39                 :            : #include "miscdlgs.hrc"
      40                 :            : #include "rangenam.hxx"
      41                 :            : #include "viewdata.hxx"
      42                 :            : 
      43                 :            : 
      44                 :            : //==================================================================
      45                 :            : 
      46                 :          0 : ScNamePasteDlg::ScNamePasteDlg( Window * pParent, ScDocShell* pShell, bool )
      47                 :            :     : ModalDialog( pParent, ScResId( RID_SCDLG_NAMES_PASTE ) ),
      48                 :            :     maBtnPasteAll    ( this, ScResId( BTN_PASTE_ALL ) ),
      49                 :            :     maBtnPaste       ( this, ScResId( BTN_PASTE ) ),
      50                 :            :     maHelpButton     ( this, ScResId( BTN_HELP ) ),
      51                 :            :     maBtnClose       ( this, ScResId( BTN_CLOSE ) ),
      52                 :            :     maFlDiv          ( this, ScResId( FL_DIV ) ),
      53                 :          0 :     maCtrl           ( this, ScResId( CTRL_TABLE ) )
      54                 :            : {
      55                 :          0 :     ScDocument* pDoc = pShell->GetDocument();
      56                 :          0 :     std::map<rtl::OUString, ScRangeName*> aCopyMap;
      57                 :          0 :     pDoc->GetRangeNameMap(aCopyMap);
      58                 :          0 :     std::map<rtl::OUString, ScRangeName*>::iterator itr = aCopyMap.begin(), itrEnd = aCopyMap.end();
      59                 :          0 :     for (; itr != itrEnd; ++itr)
      60                 :            :     {
      61                 :          0 :         rtl::OUString aTemp(itr->first);
      62                 :          0 :         maRangeMap.insert(aTemp, new ScRangeName(*itr->second));
      63                 :          0 :     }
      64                 :            : 
      65                 :          0 :     ScViewData* pViewData = pShell->GetViewData();
      66                 :          0 :     ScAddress aPos(pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo());
      67                 :          0 :     mpTable = new ScRangeManagerTable(&maCtrl, maRangeMap, aPos);
      68                 :            : 
      69                 :          0 :     maBtnPaste.SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl) );
      70                 :          0 :     maBtnPasteAll.SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl));
      71                 :          0 :     maBtnClose.SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl));
      72                 :            : 
      73                 :          0 :     if (!mpTable->GetEntryCount())
      74                 :            :     {
      75                 :          0 :         maBtnPaste.Disable();
      76                 :          0 :         maBtnPasteAll.Disable();
      77                 :            :     }
      78                 :            : 
      79                 :          0 :     FreeResource();
      80                 :          0 : }
      81                 :            : 
      82                 :          0 : ScNamePasteDlg::~ScNamePasteDlg()
      83                 :            : {
      84                 :          0 :     delete mpTable;
      85                 :          0 : }
      86                 :            : 
      87                 :            : //------------------------------------------------------------------
      88                 :            : 
      89                 :          0 : IMPL_LINK( ScNamePasteDlg, ButtonHdl, Button *, pButton )
      90                 :            : {
      91                 :          0 :     if( pButton == &maBtnPasteAll )
      92                 :            :     {
      93                 :          0 :         EndDialog( BTN_PASTE_LIST );
      94                 :            :     }
      95                 :          0 :     else if( pButton == &maBtnPaste )
      96                 :            :     {
      97                 :          0 :         std::vector<ScRangeNameLine> aSelectedLines = mpTable->GetSelectedEntries();
      98                 :          0 :         for (std::vector<ScRangeNameLine>::const_iterator itr = aSelectedLines.begin();
      99                 :          0 :                 itr != aSelectedLines.end(); ++itr)
     100                 :            :         {
     101                 :          0 :             maSelectedNames.push_back(itr->aName);
     102                 :            :         }
     103                 :          0 :         EndDialog( BTN_PASTE_NAME );
     104                 :            :     }
     105                 :          0 :     else if( pButton == &maBtnClose )
     106                 :            :     {
     107                 :          0 :         EndDialog( BTN_PASTE_CLOSE );
     108                 :            :     }
     109                 :          0 :     return 0;
     110                 :            : }
     111                 :            : 
     112                 :            : //------------------------------------------------------------------
     113                 :            : 
     114                 :          0 : std::vector<rtl::OUString> ScNamePasteDlg::GetSelectedNames() const
     115                 :            : {
     116                 :          0 :     return maSelectedNames;
     117                 :            : }
     118                 :            : 
     119                 :          0 : bool ScNamePasteDlg::IsAllSelected() const
     120                 :            : {
     121                 :          0 :     return false;
     122                 :            : }
     123                 :            : 
     124                 :            : 
     125                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10