LCOV - code coverage report
Current view: top level - libreoffice/sc/source/ui/namedlg - namepast.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 41 0.0 %
Date: 2012-12-27 Functions: 0 9 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #undef SC_DLLIMPLEMENTATION
      22             : 
      23             : 
      24             : 
      25             : //------------------------------------------------------------------
      26             : 
      27             : #include "namepast.hxx"
      28             : #include "scresid.hxx"
      29             : #include "docsh.hxx"
      30             : #include "miscdlgs.hrc"
      31             : #include "rangenam.hxx"
      32             : #include "viewdata.hxx"
      33             : 
      34             : 
      35             : //==================================================================
      36             : 
      37           0 : ScNamePasteDlg::ScNamePasteDlg( Window * pParent, ScDocShell* pShell, bool )
      38             :     : ModalDialog( pParent, ScResId( RID_SCDLG_NAMES_PASTE ) ),
      39             :     maBtnPasteAll    ( this, ScResId( BTN_PASTE_ALL ) ),
      40             :     maBtnPaste       ( this, ScResId( BTN_PASTE ) ),
      41             :     maHelpButton     ( this, ScResId( BTN_HELP ) ),
      42             :     maBtnClose       ( this, ScResId( BTN_CLOSE ) ),
      43             :     maFlDiv          ( this, ScResId( FL_DIV ) ),
      44           0 :     maCtrl           ( this, ScResId( CTRL_TABLE ) )
      45             : {
      46           0 :     ScDocument* pDoc = pShell->GetDocument();
      47           0 :     std::map<rtl::OUString, ScRangeName*> aCopyMap;
      48           0 :     pDoc->GetRangeNameMap(aCopyMap);
      49           0 :     std::map<rtl::OUString, ScRangeName*>::iterator itr = aCopyMap.begin(), itrEnd = aCopyMap.end();
      50           0 :     for (; itr != itrEnd; ++itr)
      51             :     {
      52           0 :         rtl::OUString aTemp(itr->first);
      53           0 :         maRangeMap.insert(aTemp, new ScRangeName(*itr->second));
      54           0 :     }
      55             : 
      56           0 :     ScViewData* pViewData = pShell->GetViewData();
      57           0 :     ScAddress aPos(pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo());
      58           0 :     mpTable = new ScRangeManagerTable(&maCtrl, maRangeMap, aPos);
      59             : 
      60           0 :     maBtnPaste.SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl) );
      61           0 :     maBtnPasteAll.SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl));
      62           0 :     maBtnClose.SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl));
      63             : 
      64           0 :     if (!mpTable->GetEntryCount())
      65             :     {
      66           0 :         maBtnPaste.Disable();
      67           0 :         maBtnPasteAll.Disable();
      68             :     }
      69             : 
      70           0 :     FreeResource();
      71           0 : }
      72             : 
      73           0 : ScNamePasteDlg::~ScNamePasteDlg()
      74             : {
      75           0 :     delete mpTable;
      76           0 : }
      77             : 
      78             : //------------------------------------------------------------------
      79             : 
      80           0 : IMPL_LINK( ScNamePasteDlg, ButtonHdl, Button *, pButton )
      81             : {
      82           0 :     if( pButton == &maBtnPasteAll )
      83             :     {
      84           0 :         EndDialog( BTN_PASTE_LIST );
      85             :     }
      86           0 :     else if( pButton == &maBtnPaste )
      87             :     {
      88           0 :         std::vector<ScRangeNameLine> aSelectedLines = mpTable->GetSelectedEntries();
      89           0 :         for (std::vector<ScRangeNameLine>::const_iterator itr = aSelectedLines.begin();
      90           0 :                 itr != aSelectedLines.end(); ++itr)
      91             :         {
      92           0 :             maSelectedNames.push_back(itr->aName);
      93             :         }
      94           0 :         EndDialog( BTN_PASTE_NAME );
      95             :     }
      96           0 :     else if( pButton == &maBtnClose )
      97             :     {
      98           0 :         EndDialog( BTN_PASTE_CLOSE );
      99             :     }
     100           0 :     return 0;
     101             : }
     102             : 
     103             : //------------------------------------------------------------------
     104             : 
     105           0 : std::vector<rtl::OUString> ScNamePasteDlg::GetSelectedNames() const
     106             : {
     107           0 :     return maSelectedNames;
     108             : }
     109             : 
     110           0 : bool ScNamePasteDlg::IsAllSelected() const
     111             : {
     112           0 :     return false;
     113           0 : }
     114             : 
     115             : 
     116             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10