LCOV - code coverage report
Current view: top level - sd/source/ui/dlg - assclass.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 76 0.0 %
Date: 2012-08-25 Functions: 0 11 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 120 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <tools/debug.hxx>
      31                 :            : #include <vcl/ctrl.hxx>
      32                 :            : 
      33                 :            : #include "assclass.hxx"
      34                 :            : 
      35                 :          0 : Assistent::Assistent(int nNoOfPages)
      36 [ #  # ][ #  # ]:          0 :     : mnPages(nNoOfPages), mnCurrentPage(1)
           [ #  #  #  # ]
      37                 :            : {
      38         [ #  # ]:          0 :     if(mnPages > MAX_PAGES)
      39                 :          0 :         mnPages = MAX_PAGES;
      40                 :            : 
      41 [ #  # ][ #  # ]:          0 :     mpPageStatus.reset(new bool[mnPages]);
      42                 :            : 
      43         [ #  # ]:          0 :     for(int i=0; i < mnPages; ++i)
      44                 :          0 :         mpPageStatus[i] = true;
      45   [ #  #  #  # ]:          0 : }
      46                 :            : 
      47                 :          0 : bool Assistent::InsertControl(int nDestPage,Control* pUsedControl)
      48                 :            : {
      49                 :            :     DBG_ASSERT( (nDestPage > 0) && (nDestPage <= mnPages), "Seite nicht vorhanden!");
      50                 :            : 
      51 [ #  # ][ #  # ]:          0 :     if((nDestPage>0)&&(nDestPage<=mnPages))
      52                 :            :     {
      53                 :          0 :         maPages[nDestPage-1].push_back(pUsedControl);
      54                 :          0 :         pUsedControl->Hide();
      55                 :          0 :         pUsedControl->Disable();
      56                 :          0 :         return true;
      57                 :            :     }
      58                 :            : 
      59                 :          0 :     return false;
      60                 :            : }
      61                 :            : 
      62                 :          0 : bool Assistent::NextPage()
      63                 :            : {
      64         [ #  # ]:          0 :     if(mnCurrentPage<mnPages)
      65                 :            :     {
      66                 :          0 :         int nPage = mnCurrentPage+1;
      67 [ #  # ][ #  # ]:          0 :         while(nPage <= mnPages && !mpPageStatus[nPage-1])
                 [ #  # ]
      68                 :          0 :           nPage++;
      69                 :            : 
      70         [ #  # ]:          0 :         if(nPage <= mnPages)
      71                 :          0 :             return GotoPage(nPage);
      72                 :            :     }
      73                 :            : 
      74                 :          0 :     return false;
      75                 :            : }
      76                 :            : 
      77                 :            : 
      78                 :          0 : bool Assistent::PreviousPage()
      79                 :            : {
      80         [ #  # ]:          0 :     if(mnCurrentPage>1)
      81                 :            :     {
      82                 :          0 :         int nPage = mnCurrentPage-1;
      83 [ #  # ][ #  # ]:          0 :         while(nPage >= 0 && !mpPageStatus[nPage-1])
                 [ #  # ]
      84                 :          0 :             nPage--;
      85                 :            : 
      86         [ #  # ]:          0 :         if(nPage >= 0)
      87                 :          0 :             return GotoPage(nPage);
      88                 :            :     }
      89                 :          0 :     return false;
      90                 :            : }
      91                 :            : 
      92                 :            : 
      93                 :          0 : bool Assistent::GotoPage(const int nPageToGo)
      94                 :            : {
      95                 :            :     DBG_ASSERT( (nPageToGo > 0) && (nPageToGo <= mnPages), "Seite nicht vorhanden!");
      96                 :            : 
      97 [ #  # ][ #  # ]:          0 :     if((nPageToGo>0)&&(nPageToGo<=mnPages)&&mpPageStatus[nPageToGo-1])
         [ #  # ][ #  # ]
      98                 :            :     {
      99                 :          0 :         int nIndex=mnCurrentPage-1;
     100                 :            : 
     101                 :          0 :         std::vector<Control*>::iterator iter = maPages[nIndex].begin();
     102                 :          0 :         std::vector<Control*>::iterator iterEnd = maPages[nIndex].end();
     103                 :            : 
     104 [ #  # ][ #  # ]:          0 :         for(; iter != iterEnd; ++iter)
                 [ #  # ]
     105                 :            :         {
     106 [ #  # ][ #  # ]:          0 :             (*iter)->Disable();
     107 [ #  # ][ #  # ]:          0 :             (*iter)->Hide();
     108                 :            :         }
     109                 :            : 
     110                 :          0 :         mnCurrentPage=nPageToGo;
     111                 :          0 :         nIndex=mnCurrentPage-1;
     112                 :            : 
     113                 :          0 :         iter = maPages[nIndex].begin();
     114                 :          0 :         iterEnd = maPages[nIndex].end();
     115                 :            : 
     116 [ #  # ][ #  # ]:          0 :         for(; iter != iterEnd; ++iter)
                 [ #  # ]
     117                 :            :         {
     118 [ #  # ][ #  # ]:          0 :             (*iter)->Enable();
     119 [ #  # ][ #  # ]:          0 :             (*iter)->Show();
     120                 :            :         }
     121                 :            : 
     122                 :          0 :         return true;
     123                 :            :     }
     124                 :            : 
     125                 :          0 :     return false;
     126                 :            : }
     127                 :            : 
     128                 :            : 
     129                 :          0 : bool Assistent::IsLastPage() const
     130                 :            : {
     131         [ #  # ]:          0 :     if(mnCurrentPage == mnPages)
     132                 :          0 :         return true;
     133                 :            : 
     134                 :          0 :     int nPage = mnCurrentPage+1;
     135 [ #  # ][ #  # ]:          0 :     while(nPage <= mnPages && !mpPageStatus[nPage-1])
                 [ #  # ]
     136                 :          0 :         nPage++;
     137                 :            : 
     138                 :          0 :     return nPage > mnPages;
     139                 :            : }
     140                 :            : 
     141                 :            : 
     142                 :          0 : bool Assistent::IsFirstPage() const
     143                 :            : {
     144         [ #  # ]:          0 :     if(mnCurrentPage == 1)
     145                 :          0 :         return true;
     146                 :            : 
     147                 :          0 :     int nPage = mnCurrentPage-1;
     148 [ #  # ][ #  # ]:          0 :     while(nPage > 0 && !mpPageStatus[nPage-1])
                 [ #  # ]
     149                 :          0 :         nPage--;
     150                 :            : 
     151                 :          0 :     return nPage == 0;
     152                 :            : }
     153                 :            : 
     154                 :          0 : int Assistent::GetCurrentPage() const
     155                 :            : {
     156                 :          0 :     return mnCurrentPage;
     157                 :            : }
     158                 :            : 
     159                 :          0 : bool Assistent::IsEnabled( int nPage ) const
     160                 :            : {
     161                 :            :     DBG_ASSERT( (nPage>0) && (nPage <= mnPages), "Seite nicht vorhanden!" );
     162                 :            : 
     163 [ #  # ][ #  # ]:          0 :     return (nPage>0) && (nPage <= mnPages && mpPageStatus[nPage-1]);
                 [ #  # ]
     164                 :            : }
     165                 :            : 
     166                 :          0 : void Assistent::EnablePage( int nPage )
     167                 :            : {
     168                 :            :     DBG_ASSERT( (nPage>0) && (nPage <= mnPages), "Seite nicht vorhanden!" );
     169                 :            : 
     170 [ #  # ][ #  # ]:          0 :     if((nPage>0) && (nPage < mnPages && !mpPageStatus[nPage-1]))
         [ #  # ][ #  # ]
     171                 :            :     {
     172                 :          0 :         mpPageStatus[nPage-1] = true;
     173                 :            :     }
     174                 :          0 : }
     175                 :            : 
     176                 :          0 : void Assistent::DisablePage( int nPage )
     177                 :            : {
     178                 :            :     DBG_ASSERT( (nPage>0) && (nPage <= mnPages), "Seite nicht vorhanden!" );
     179                 :            : 
     180 [ #  # ][ #  # ]:          0 :     if((nPage>0) && (nPage <= mnPages && mpPageStatus[nPage-1]))
         [ #  # ][ #  # ]
     181                 :            :     {
     182                 :          0 :         mpPageStatus[nPage-1] = false;
     183         [ #  # ]:          0 :         if(mnCurrentPage == nPage)
     184                 :          0 :             GotoPage(1);
     185                 :            :     }
     186                 :          0 : }
     187                 :            : 
     188                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10