LCOV - code coverage report
Current view: top level - sc/source/ui/miscdlgs - inscodlg.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 195 0.0 %
Date: 2014-04-14 Functions: 0 16 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             : #include "inscodlg.hxx"
      26             : #include "scresid.hxx"
      27             : #include "miscdlgs.hrc"
      28             : 
      29             : 
      30             : bool       ScInsertContentsDlg::bPreviousAllCheck = false;
      31             : sal_uInt16 ScInsertContentsDlg::nPreviousChecks   = (IDF_VALUE | IDF_DATETIME | IDF_STRING);
      32             : sal_uInt16 ScInsertContentsDlg::nPreviousFormulaChecks = PASTE_NOFUNC;
      33             : sal_uInt16 ScInsertContentsDlg::nPreviousChecks2 = 0;
      34             : sal_uInt16 ScInsertContentsDlg::nPreviousMoveMode = INS_NONE;   // enum InsCellCmd
      35             : 
      36           0 : ScInsertContentsDlg::ScInsertContentsDlg( Window*       pParent,
      37             :                                           sal_uInt16        nCheckDefaults,
      38             :                                           const OUString* pStrTitle )
      39             : 
      40             :  :  ModalDialog     ( pParent, "PasteSpecial", "modules/scalc/ui/pastespecial.ui" ),
      41             :     bOtherDoc       ( false ),
      42             :     bFillMode       ( false ),
      43             :     bChangeTrack    ( false ),
      44             :     bMoveDownDisabled( false ),
      45           0 :     bMoveRightDisabled( false )
      46             : {
      47           0 :     get( mpBtnInsAll, "paste_all" );
      48           0 :     get( mpBtnInsStrings, "text" );
      49           0 :     get( mpBtnInsNumbers, "numbers" );
      50           0 :     get( mpBtnInsDateTime, "datetime" );
      51           0 :     get( mpBtnInsFormulas, "formulas" );
      52           0 :     get( mpBtnInsNotes, "comments" );
      53           0 :     get( mpBtnInsAttrs, "formats" );
      54           0 :     get( mpBtnInsObjects, "objects" );
      55           0 :     get( mpBtnSkipEmptyCells, "skip_empty" );
      56           0 :     get( mpBtnTranspose, "transpose" );
      57           0 :     get( mpBtnLink, "link" );
      58           0 :     get( mpRbNoOp, "none" );
      59           0 :     get( mpRbAdd, "add" );
      60           0 :     get( mpRbSub, "subtract" );
      61           0 :     get( mpRbMul, "multiply" );
      62           0 :     get( mpRbDiv, "divide" );
      63           0 :     get( mpRbMoveNone, "no_shift" );
      64           0 :     get( mpRbMoveDown, "move_down" );
      65           0 :     get( mpRbMoveRight, "move_right" );
      66             : 
      67           0 :     if ( pStrTitle )
      68           0 :         SetText( *pStrTitle );
      69             : 
      70           0 :     if ( nCheckDefaults != 0 )
      71             :     {
      72           0 :         ScInsertContentsDlg::nPreviousChecks = nCheckDefaults;
      73           0 :         ScInsertContentsDlg::bPreviousAllCheck = false;
      74           0 :         ScInsertContentsDlg::nPreviousChecks2 = 0;
      75             :     }
      76             : 
      77           0 :     mpBtnInsAll->Check     ( ScInsertContentsDlg::bPreviousAllCheck );
      78           0 :     mpBtnInsStrings->Check ( IS_SET( IDF_STRING,
      79           0 :                                    ScInsertContentsDlg::nPreviousChecks ) );
      80           0 :     mpBtnInsNumbers->Check ( IS_SET( IDF_VALUE,
      81           0 :                                    ScInsertContentsDlg::nPreviousChecks ) );
      82           0 :     mpBtnInsDateTime->Check( IS_SET( IDF_DATETIME,
      83           0 :                                    ScInsertContentsDlg::nPreviousChecks ) );
      84           0 :     mpBtnInsFormulas->Check( IS_SET( IDF_FORMULA,
      85           0 :                                    ScInsertContentsDlg::nPreviousChecks ) );
      86           0 :     mpBtnInsNotes->Check   ( IS_SET( IDF_NOTE,
      87           0 :                                    ScInsertContentsDlg::nPreviousChecks ) );
      88           0 :     mpBtnInsAttrs->Check   ( IS_SET( IDF_ATTRIB,
      89           0 :                                    ScInsertContentsDlg::nPreviousChecks ) );
      90           0 :     mpBtnInsObjects->Check ( IS_SET( IDF_OBJECTS,
      91           0 :                                    ScInsertContentsDlg::nPreviousChecks ) );
      92             : 
      93           0 :     switch( ScInsertContentsDlg::nPreviousFormulaChecks )
      94             :     {
      95           0 :         case PASTE_NOFUNC: mpRbNoOp->Check(true); break;
      96           0 :         case PASTE_ADD:    mpRbAdd->Check(true); break;
      97           0 :         case PASTE_SUB:    mpRbSub->Check(true); break;
      98           0 :         case PASTE_MUL:    mpRbMul->Check(true); break;
      99           0 :         case PASTE_DIV:    mpRbDiv->Check(true); break;
     100             :     }
     101             : 
     102           0 :     switch( ScInsertContentsDlg::nPreviousMoveMode )
     103             :     {
     104           0 :         case INS_NONE:       mpRbMoveNone->Check(true); break;
     105           0 :         case INS_CELLSDOWN:  mpRbMoveDown->Check(true); break;
     106           0 :         case INS_CELLSRIGHT: mpRbMoveRight->Check(true); break;
     107             :     }
     108             : 
     109           0 :     mpBtnSkipEmptyCells->Check( ( ScInsertContentsDlg::nPreviousChecks2 & INS_CONT_NOEMPTY ) != 0);
     110           0 :     mpBtnTranspose->Check( ( ScInsertContentsDlg::nPreviousChecks2    & INS_CONT_TRANS ) != 0);
     111           0 :     mpBtnLink->Check( ( ScInsertContentsDlg::nPreviousChecks2             & INS_CONT_LINK  ) != 0);
     112             : 
     113           0 :     DisableChecks( mpBtnInsAll->IsChecked() );
     114             : 
     115             : 
     116           0 :     mpBtnInsAll->SetClickHdl( LINK( this, ScInsertContentsDlg, InsAllHdl ) );
     117           0 :     mpBtnLink->SetClickHdl( LINK( this, ScInsertContentsDlg, LinkBtnHdl ) );
     118             : 
     119           0 : }
     120             : 
     121           0 : sal_uInt16 ScInsertContentsDlg::GetInsContentsCmdBits() const
     122             : {
     123           0 :     ScInsertContentsDlg::nPreviousChecks = 0;
     124             : 
     125           0 :     if ( mpBtnInsStrings->IsChecked() )
     126           0 :         ScInsertContentsDlg::nPreviousChecks = IDF_STRING;
     127           0 :     if ( mpBtnInsNumbers->IsChecked() )
     128           0 :         ScInsertContentsDlg::nPreviousChecks |= IDF_VALUE;
     129           0 :     if ( mpBtnInsDateTime->IsChecked())
     130           0 :         ScInsertContentsDlg::nPreviousChecks |= IDF_DATETIME;
     131           0 :     if ( mpBtnInsFormulas->IsChecked())
     132           0 :         ScInsertContentsDlg::nPreviousChecks |= IDF_FORMULA;
     133           0 :     if ( mpBtnInsNotes->IsChecked()   )
     134           0 :         ScInsertContentsDlg::nPreviousChecks |= IDF_NOTE;
     135           0 :     if ( mpBtnInsAttrs->IsChecked()   )
     136           0 :         ScInsertContentsDlg::nPreviousChecks |= IDF_ATTRIB;
     137           0 :     if ( mpBtnInsObjects->IsChecked() )
     138           0 :         ScInsertContentsDlg::nPreviousChecks |= IDF_OBJECTS;
     139             : 
     140           0 :     ScInsertContentsDlg::bPreviousAllCheck = mpBtnInsAll->IsChecked();
     141             : 
     142             :     return ( (ScInsertContentsDlg::bPreviousAllCheck)
     143             :                 ? IDF_ALL
     144           0 :                 : ScInsertContentsDlg::nPreviousChecks );
     145             : }
     146             : 
     147           0 : InsCellCmd ScInsertContentsDlg::GetMoveMode()
     148             : {
     149           0 :     if ( mpRbMoveDown->IsChecked() )
     150           0 :         return INS_CELLSDOWN;
     151           0 :     if ( mpRbMoveRight->IsChecked() )
     152           0 :         return INS_CELLSRIGHT;
     153             : 
     154           0 :     return INS_NONE;
     155             : }
     156             : 
     157           0 : void ScInsertContentsDlg::DisableChecks( bool bInsAllChecked )
     158             : {
     159           0 :     if ( bInsAllChecked )
     160             :     {
     161           0 :         mpBtnInsStrings->Disable();
     162           0 :         mpBtnInsNumbers->Disable();
     163           0 :         mpBtnInsDateTime->Disable();
     164           0 :         mpBtnInsFormulas->Disable();
     165           0 :         mpBtnInsNotes->Disable();
     166           0 :         mpBtnInsAttrs->Disable();
     167           0 :         mpBtnInsObjects->Disable();
     168             :     }
     169             :     else
     170             :     {
     171           0 :         mpBtnInsStrings->Enable();
     172           0 :         mpBtnInsNumbers->Enable();
     173           0 :         mpBtnInsDateTime->Enable();
     174           0 :         mpBtnInsFormulas->Enable();
     175           0 :         mpBtnInsNotes->Enable();
     176           0 :         mpBtnInsAttrs->Enable();
     177             : 
     178             :         //  "Objects" is disabled for "Fill Tables"
     179           0 :         if ( bFillMode )
     180           0 :             mpBtnInsObjects->Disable();
     181             :         else
     182           0 :             mpBtnInsObjects->Enable();
     183             :     }
     184           0 : }
     185             : 
     186             : // Link to other document -> everything else is disabled
     187             : 
     188           0 : void ScInsertContentsDlg::TestModes()
     189             : {
     190           0 :     if ( bOtherDoc && mpBtnLink->IsChecked() )
     191             :     {
     192           0 :         mpBtnSkipEmptyCells->Disable();
     193           0 :         mpBtnTranspose->Disable();
     194           0 :         mpRbNoOp->Disable();
     195           0 :         mpRbAdd->Disable();
     196           0 :         mpRbSub->Disable();
     197           0 :         mpRbMul->Disable();
     198           0 :         mpRbDiv->Disable();
     199             : 
     200           0 :         mpRbMoveNone->Disable();
     201           0 :         mpRbMoveDown->Disable();
     202           0 :         mpRbMoveRight->Disable();
     203             : 
     204           0 :         mpBtnInsAll->Disable();
     205           0 :         DisableChecks(true);
     206             :     }
     207             :     else
     208             :     {
     209           0 :         mpBtnSkipEmptyCells->Enable();
     210           0 :         mpBtnTranspose->Enable(!bFillMode);
     211           0 :         mpRbNoOp->Enable();
     212           0 :         mpRbAdd->Enable();
     213           0 :         mpRbSub->Enable();
     214           0 :         mpRbMul->Enable();
     215           0 :         mpRbDiv->Enable();
     216             : 
     217           0 :         mpRbMoveNone->Enable(!bFillMode && !bChangeTrack && !(bMoveDownDisabled && bMoveRightDisabled));
     218           0 :         mpRbMoveDown->Enable(!bFillMode && !bChangeTrack && !bMoveDownDisabled);
     219           0 :         mpRbMoveRight->Enable(!bFillMode && !bChangeTrack && !bMoveRightDisabled);
     220             : 
     221           0 :         mpBtnInsAll->Enable();
     222           0 :         DisableChecks( mpBtnInsAll->IsChecked() );
     223             :     }
     224           0 : }
     225             : 
     226           0 : void ScInsertContentsDlg::SetOtherDoc( bool bSet )
     227             : {
     228           0 :     if ( bSet != bOtherDoc )
     229             :     {
     230           0 :         bOtherDoc = bSet;
     231           0 :         TestModes();
     232           0 :         if ( bSet )
     233           0 :             mpRbMoveNone->Check(true);
     234             :     }
     235           0 : }
     236             : 
     237           0 : void ScInsertContentsDlg::SetFillMode( bool bSet )
     238             : {
     239           0 :     if ( bSet != bFillMode )
     240             :     {
     241           0 :         bFillMode = bSet;
     242           0 :         TestModes();
     243           0 :         if ( bSet )
     244           0 :             mpRbMoveNone->Check(true);
     245             :     }
     246           0 : }
     247             : 
     248           0 : void ScInsertContentsDlg::SetChangeTrack( bool bSet )
     249             : {
     250           0 :     if ( bSet != bChangeTrack )
     251             :     {
     252           0 :         bChangeTrack = bSet;
     253           0 :         TestModes();
     254           0 :         if ( bSet )
     255           0 :             mpRbMoveNone->Check(true);
     256             :     }
     257           0 : }
     258             : 
     259           0 : void ScInsertContentsDlg::SetCellShiftDisabled( int nDisable )
     260             : {
     261           0 :     bool bDown = ((nDisable & SC_CELL_SHIFT_DISABLE_DOWN) != 0);
     262           0 :     bool bRight = ((nDisable & SC_CELL_SHIFT_DISABLE_RIGHT) != 0);
     263           0 :     if ( bDown != bMoveDownDisabled || bRight != bMoveRightDisabled )
     264             :     {
     265           0 :         bMoveDownDisabled = bDown;
     266           0 :         bMoveRightDisabled = bRight;
     267           0 :         TestModes();
     268           0 :         if ( bMoveDownDisabled && mpRbMoveDown->IsChecked() )
     269           0 :             mpRbMoveNone->Check(true);
     270           0 :         if ( bMoveRightDisabled && mpRbMoveRight->IsChecked() )
     271           0 :             mpRbMoveNone->Check(true);
     272             :     }
     273           0 : }
     274             : 
     275             : 
     276           0 : IMPL_LINK_NOARG(ScInsertContentsDlg, InsAllHdl)
     277             : {
     278           0 :     DisableChecks( mpBtnInsAll->IsChecked() );
     279             : 
     280           0 :     return 0;
     281             : }
     282             : 
     283           0 : IMPL_LINK_NOARG(ScInsertContentsDlg, LinkBtnHdl)
     284             : {
     285           0 :     TestModes();
     286             : 
     287           0 :     return 0;
     288             : }
     289             : 
     290           0 : ScInsertContentsDlg::~ScInsertContentsDlg()
     291             : {
     292           0 :     ScInsertContentsDlg::nPreviousChecks2 = 0;
     293           0 :     if(mpBtnSkipEmptyCells->IsChecked())
     294           0 :         ScInsertContentsDlg::nPreviousChecks2 |= INS_CONT_NOEMPTY;
     295           0 :     if( mpBtnTranspose->IsChecked())
     296           0 :         ScInsertContentsDlg::nPreviousChecks2 |= INS_CONT_TRANS;
     297           0 :     if( mpBtnLink->IsChecked() )
     298           0 :         ScInsertContentsDlg::nPreviousChecks2 |= INS_CONT_LINK;
     299             : 
     300           0 :     if (!bFillMode)     // im FillMode ist None gecheckt und alle 3 disabled
     301             :     {
     302           0 :         if ( mpRbMoveNone->IsChecked() )
     303           0 :             ScInsertContentsDlg::nPreviousMoveMode = INS_NONE;
     304           0 :         else if ( mpRbMoveDown->IsChecked() )
     305           0 :             ScInsertContentsDlg::nPreviousMoveMode = INS_CELLSDOWN;
     306           0 :         else if ( mpRbMoveRight->IsChecked() )
     307           0 :             ScInsertContentsDlg::nPreviousMoveMode = INS_CELLSRIGHT;
     308             :     }
     309           0 : }
     310             : 
     311           0 : sal_uInt16  ScInsertContentsDlg::GetFormulaCmdBits() const
     312             : {
     313           0 :     ScInsertContentsDlg::nPreviousFormulaChecks = PASTE_NOFUNC;
     314           0 :     if(mpRbAdd->IsChecked())
     315           0 :         ScInsertContentsDlg::nPreviousFormulaChecks = PASTE_ADD;
     316           0 :     else if(mpRbSub->IsChecked())
     317           0 :         ScInsertContentsDlg::nPreviousFormulaChecks = PASTE_SUB;
     318           0 :     else if(mpRbMul->IsChecked())
     319           0 :         ScInsertContentsDlg::nPreviousFormulaChecks = PASTE_MUL;
     320           0 :     else if(mpRbDiv->IsChecked())
     321           0 :         ScInsertContentsDlg::nPreviousFormulaChecks = PASTE_DIV;
     322             :     // Bits fuer Checkboxen ausblenden
     323           0 :     return ScInsertContentsDlg::nPreviousFormulaChecks;
     324             : }
     325             : 
     326             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10