LCOV - code coverage report
Current view: top level - dbaccess/source/ui/querydesign - QueryTabWinUndoAct.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 49 0.0 %
Date: 2012-08-25 Functions: 0 9 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 42 0.0 %

           Branch data     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 "QueryTabWinUndoAct.hxx"
      21                 :            : #include <osl/diagnose.h>
      22                 :            : #include "QTableWindow.hxx"
      23                 :            : #include "QTableWindowData.hxx"
      24                 :            : #include "TableConnection.hxx"
      25                 :            : #include "TableConnectionData.hxx"
      26                 :            : #include "QueryDesignFieldUndoAct.hxx"
      27                 :            : #include "QueryTableView.hxx"
      28                 :            : 
      29                 :            : 
      30                 :            : using namespace dbaui;
      31                 :            : DBG_NAME(OQueryDesignFieldUndoAct)
      32                 :          0 : OQueryDesignFieldUndoAct::OQueryDesignFieldUndoAct(OSelectionBrowseBox* pSelBrwBox, sal_uInt16 nCommentID)
      33                 :            :     : OCommentUndoAction(nCommentID)
      34                 :            :     , pOwner(pSelBrwBox)
      35                 :          0 :     , m_nColumnPostion(BROWSER_INVALIDID)
      36                 :            : {
      37                 :            :     DBG_CTOR(OQueryDesignFieldUndoAct,NULL);
      38                 :          0 : }
      39                 :            : // -----------------------------------------------------------------------------
      40                 :          0 : OQueryDesignFieldUndoAct::~OQueryDesignFieldUndoAct()
      41                 :            : {
      42                 :            :     DBG_DTOR(OQueryDesignFieldUndoAct,NULL);
      43                 :          0 :     pOwner = NULL;
      44         [ #  # ]:          0 : }
      45                 :            : // -----------------------------------------------------------------------------
      46                 :            : 
      47                 :            : DBG_NAME(OQueryTabWinUndoAct )
      48                 :            : // ------------------------------------------------------------------------------------------------
      49                 :          0 : OQueryTabWinUndoAct::OQueryTabWinUndoAct(OQueryTableView* pOwner, sal_uInt16 nCommentID)
      50                 :            :     :OQueryDesignUndoAction(pOwner, nCommentID)
      51         [ #  # ]:          0 :     ,m_pTabWin(NULL)
      52                 :            : {
      53                 :            :     DBG_CTOR(OQueryTabWinUndoAct ,NULL);
      54                 :          0 : }
      55                 :            : //==============================================================================
      56                 :          0 : OQueryTabWinUndoAct::~OQueryTabWinUndoAct()
      57                 :            : {
      58                 :            :     DBG_DTOR(OQueryTabWinUndoAct ,NULL);
      59         [ #  # ]:          0 :     if (m_bOwnerOfObjects)
      60                 :            :     {   // wenn ich der alleinige Owner des Fenster bin, muss ich dafuer sorgen, dass es geloescht wird
      61                 :            :         OSL_ENSURE(m_pTabWin != NULL, "OQueryTabWinUndoAct::~OQueryTabWinUndoAct() : m_pTabWin sollte nicht NULL sein");
      62                 :            :         OSL_ENSURE(!m_pTabWin->IsVisible(), "OQueryTabWinUndoAct::~OQueryTabWinUndoAct() : *m_pTabWin sollte nicht sichtbar sein");
      63                 :            : 
      64         [ #  # ]:          0 :         if ( m_pTabWin )
      65         [ #  # ]:          0 :             m_pTabWin->clearListBox();
      66 [ #  # ][ #  # ]:          0 :         delete m_pTabWin;
      67                 :            : 
      68                 :            :         // und natuerlich auch die entsprechenden Connections
      69                 :          0 :         ::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin();
      70                 :          0 :         ::std::vector<OTableConnection*>::iterator aEnd = m_vTableConnection.end();
      71 [ #  # ][ #  # ]:          0 :         for(;aIter != aEnd;++aIter)
      72                 :            :         {
      73         [ #  # ]:          0 :             m_pOwner->DeselectConn(*aIter);
      74 [ #  # ][ #  # ]:          0 :             delete (*aIter);
      75                 :            :         }
      76                 :          0 :         m_vTableConnection.clear();
      77                 :            :     }
      78         [ #  # ]:          0 : }
      79                 :            : //------------------------------------------------------------------------------
      80                 :          0 : void OTabFieldCellModifiedUndoAct::Undo()
      81                 :            : {
      82                 :          0 :     pOwner->EnterUndoMode();
      83                 :            :     OSL_ENSURE(m_nColumnPostion != BROWSER_INVALIDID,"Column position was not set add the undo action!");
      84                 :            :     OSL_ENSURE(m_nColumnPostion < pOwner->GetColumnCount(),"Position outside the column count!");
      85         [ #  # ]:          0 :     if ( m_nColumnPostion != BROWSER_INVALIDID )
      86                 :            :     {
      87         [ #  # ]:          0 :         sal_uInt16 nColumnId = pOwner->GetColumnId(m_nColumnPostion);
      88         [ #  # ]:          0 :         String strNext = pOwner->GetCellContents(m_nCellIndex, nColumnId);
      89         [ #  # ]:          0 :         pOwner->SetCellContents(m_nCellIndex, nColumnId, m_strNextCellContents);
      90 [ #  # ][ #  # ]:          0 :         m_strNextCellContents = strNext;
      91                 :            :     }
      92                 :          0 :     pOwner->LeaveUndoMode();
      93                 :          0 : }
      94                 :            : 
      95                 :            : //------------------------------------------------------------------------------
      96                 :          0 : void OTabFieldSizedUndoAct::Undo()
      97                 :            : {
      98                 :          0 :     pOwner->EnterUndoMode();
      99                 :            :     OSL_ENSURE(m_nColumnPostion != BROWSER_INVALIDID,"Column position was not set add the undo action!");
     100         [ #  # ]:          0 :     if ( m_nColumnPostion != BROWSER_INVALIDID )
     101                 :            :     {
     102                 :          0 :         sal_uInt16 nColumnId = pOwner->GetColumnId(m_nColumnPostion);
     103                 :          0 :         long nNextWidth = pOwner->GetColumnWidth(nColumnId);
     104                 :          0 :         pOwner->SetColWidth(nColumnId, m_nNextWidth);
     105                 :          0 :         m_nNextWidth = nNextWidth;
     106                 :            :     }
     107                 :          0 :     pOwner->LeaveUndoMode();
     108                 :          0 : }
     109                 :            : // -----------------------------------------------------------------------------
     110                 :          0 : void OTabFieldMovedUndoAct::Undo()
     111                 :            : {
     112                 :          0 :     pOwner->EnterUndoMode();
     113                 :            :     OSL_ENSURE(m_nColumnPostion != BROWSER_INVALIDID,"Column position was not set add the undo action!");
     114         [ #  # ]:          0 :     if ( m_nColumnPostion != BROWSER_INVALIDID )
     115                 :            :     {
     116                 :          0 :         sal_uInt16 nId = pDescr->GetColumnId();
     117                 :          0 :         sal_uInt16 nOldPos = pOwner->GetColumnPos(nId);
     118                 :          0 :         pOwner->SetColumnPos(nId,m_nColumnPostion);
     119                 :          0 :         pOwner->ColumnMoved(nId,sal_False);
     120                 :          0 :         m_nColumnPostion = nOldPos;
     121                 :            :     }
     122                 :          0 :     pOwner->LeaveUndoMode();
     123                 :          0 : }
     124                 :            : // -----------------------------------------------------------------------------
     125                 :            : 
     126                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10