LCOV - code coverage report
Current view: top level - sc/source/ui/namedlg - namepast.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 49 0.0 %
Date: 2014-11-03 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             : #undef SC_DLLIMPLEMENTATION
      21             : 
      22             : #include "namepast.hxx"
      23             : #include "scresid.hxx"
      24             : #include "docsh.hxx"
      25             : #include "miscdlgs.hrc"
      26             : #include "rangenam.hxx"
      27             : #include "viewdata.hxx"
      28             : 
      29           0 : ScNamePasteDlg::ScNamePasteDlg( vcl::Window * pParent, ScDocShell* pShell, bool )
      30           0 :     : ModalDialog( pParent, "InsertNameDialog", "modules/scalc/ui/insertname.ui" )
      31             : {
      32           0 :     get(m_pBtnPasteAll, "pasteall");
      33           0 :     get(m_pBtnPaste, "paste");
      34           0 :     get(m_pBtnClose, "close");
      35             : 
      36           0 :     ScDocument& rDoc = pShell->GetDocument();
      37           0 :     std::map<OUString, ScRangeName*> aCopyMap;
      38           0 :     rDoc.GetRangeNameMap(aCopyMap);
      39           0 :     std::map<OUString, ScRangeName*>::iterator itr = aCopyMap.begin(), itrEnd = aCopyMap.end();
      40           0 :     for (; itr != itrEnd; ++itr)
      41             :     {
      42           0 :         OUString aTemp(itr->first);
      43           0 :         maRangeMap.insert(aTemp, new ScRangeName(*itr->second));
      44           0 :     }
      45             : 
      46           0 :     ScViewData* pViewData = ScDocShell::GetViewData();
      47           0 :     ScAddress aPos(pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo());
      48           0 :     SvSimpleTableContainer *pContainer = get<SvSimpleTableContainer>("ctrl");
      49           0 :     Size aControlSize(210, 0);
      50           0 :     aControlSize = LogicToPixel(aControlSize, MAP_APPFONT);
      51           0 :     pContainer->set_width_request(aControlSize.Width());
      52           0 :     pContainer->set_height_request(10 * GetTextHeight());
      53           0 :     mpTable = new ScRangeManagerTable(*pContainer, maRangeMap, aPos);
      54             : 
      55           0 :     m_pBtnPaste->SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl) );
      56           0 :     m_pBtnPasteAll->SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl));
      57           0 :     m_pBtnClose->SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl));
      58             : 
      59           0 :     if (!mpTable->GetEntryCount())
      60             :     {
      61           0 :         m_pBtnPaste->Disable();
      62           0 :         m_pBtnPasteAll->Disable();
      63           0 :     }
      64           0 : }
      65             : 
      66           0 : ScNamePasteDlg::~ScNamePasteDlg()
      67             : {
      68           0 :     delete mpTable;
      69           0 : }
      70             : 
      71           0 : IMPL_LINK( ScNamePasteDlg, ButtonHdl, Button *, pButton )
      72             : {
      73           0 :     if( pButton == m_pBtnPasteAll )
      74             :     {
      75           0 :         EndDialog( BTN_PASTE_LIST );
      76             :     }
      77           0 :     else if( pButton == m_pBtnPaste )
      78             :     {
      79           0 :         std::vector<ScRangeNameLine> aSelectedLines = mpTable->GetSelectedEntries();
      80           0 :         for (std::vector<ScRangeNameLine>::const_iterator itr = aSelectedLines.begin();
      81           0 :                 itr != aSelectedLines.end(); ++itr)
      82             :         {
      83           0 :             maSelectedNames.push_back(itr->aName);
      84             :         }
      85           0 :         EndDialog( BTN_PASTE_NAME );
      86             :     }
      87           0 :     else if( pButton == m_pBtnClose )
      88             :     {
      89           0 :         EndDialog( BTN_PASTE_CLOSE );
      90             :     }
      91           0 :     return 0;
      92             : }
      93             : 
      94           0 : std::vector<OUString> ScNamePasteDlg::GetSelectedNames() const
      95             : {
      96           0 :     return maSelectedNames;
      97             : }
      98             : 
      99           0 : bool ScNamePasteDlg::IsAllSelected() const
     100             : {
     101           0 :     return false;
     102           0 : }
     103             : 
     104             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10