LCOV - code coverage report
Current view: top level - cui/source/dialogs - splitcelldlg.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 45 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 15 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             : #include <sfx2/dispatch.hxx>
      21             : #include <svl/intitem.hxx>
      22             : #include <svl/eitem.hxx>
      23             : #include "dialmgr.hxx"
      24             : #include "splitcelldlg.hxx"
      25             : #include "cuires.hrc"
      26             : 
      27             : namespace {
      28           0 :     class NoApplyDialog : public SvxStandardDialog
      29             :     {
      30             :     public:
      31           0 :         NoApplyDialog(vcl::Window *pParent, const OUString &rId, const OUString &rXML) :
      32           0 :             SvxStandardDialog(pParent, rId, rXML) { }
      33             :     protected:
      34           0 :         virtual void Apply() SAL_OVERRIDE {}
      35             :     };
      36             : }
      37             : 
      38           0 : SvxSplitTableDlg::SvxSplitTableDlg( vcl::Window *pParent, bool bIsTableVertical,
      39             :     long nMaxVertical, long nMaxHorizontal )
      40             :     : m_pDialog(VclPtr<NoApplyDialog>::Create(pParent, "SplitCellsDialog", "cui/ui/splitcellsdialog.ui"))
      41             :     , mnMaxVertical(nMaxVertical)
      42           0 :     , mnMaxHorizontal(nMaxHorizontal)
      43             : {
      44           0 :     m_pDialog->get(m_pCountEdit, "countnf");
      45           0 :     m_pDialog->get(m_pHorzBox, "hori");
      46           0 :     m_pDialog->get(m_pVertBox, "vert");
      47           0 :     m_pDialog->get(m_pPropCB, "prop");
      48           0 :     m_pHorzBox->SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
      49           0 :     m_pPropCB->SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
      50           0 :     m_pVertBox->SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
      51             : 
      52           0 :     if( mnMaxVertical < 2 )
      53           0 :         m_pVertBox->Enable(false);
      54             : 
      55             :     //exchange the meaning of horizontal and vertical for vertical text
      56           0 :     if(bIsTableVertical)
      57             :     {
      58           0 :         Image aTmpImg(m_pHorzBox->GetModeRadioImage());
      59           0 :         OUString sTmp(m_pHorzBox->GetText());
      60           0 :         m_pHorzBox->SetText(m_pVertBox->GetText());
      61           0 :         m_pHorzBox->SetModeRadioImage(m_pVertBox->GetModeRadioImage());
      62           0 :         m_pVertBox->SetText(sTmp);
      63           0 :         m_pVertBox->SetModeRadioImage(aTmpImg);
      64             :     }
      65           0 : }
      66             : 
      67           0 : SvxSplitTableDlg::~SvxSplitTableDlg()
      68             : {
      69           0 :     m_pCountEdit.clear();
      70           0 :     m_pHorzBox.clear();
      71           0 :     m_pVertBox.clear();
      72           0 :     m_pPropCB.clear();
      73           0 :     m_pDialog.disposeAndClear();
      74           0 : }
      75             : 
      76           0 : IMPL_LINK( SvxSplitTableDlg, ClickHdl, Button *, pButton )
      77             : {
      78           0 :     const bool bIsVert =  pButton == m_pVertBox ;
      79           0 :     long nMax = bIsVert ? mnMaxVertical : mnMaxHorizontal;
      80           0 :     m_pPropCB->Enable(!bIsVert);
      81           0 :     m_pCountEdit->SetMax( nMax );
      82           0 :     return 0;
      83             : }
      84             : 
      85           0 : bool SvxSplitTableDlg::IsHorizontal() const
      86             : {
      87           0 :     return m_pHorzBox->IsChecked();
      88             : }
      89             : 
      90           0 : bool SvxSplitTableDlg::IsProportional() const
      91             : {
      92           0 :     return m_pPropCB->IsChecked() && m_pHorzBox->IsChecked();
      93             : }
      94             : 
      95           0 : long SvxSplitTableDlg::GetCount() const
      96             : {
      97           0 :     return sal::static_int_cast<long>( m_pCountEdit->GetValue() );
      98             : }
      99             : 
     100           0 : short SvxSplitTableDlg::Execute()
     101             : {
     102           0 :     return m_pDialog->Execute();
     103           0 : }
     104             : 
     105             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11