LCOV - code coverage report
Current view: top level - sw/source/ui/shells - textglos.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 62 0.0 %
Date: 2012-08-25 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 144 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                 :            : #include <sfx2/request.hxx>
      30                 :            : #include <svl/eitem.hxx>
      31                 :            : #include <svl/stritem.hxx>
      32                 :            : 
      33                 :            : #include "view.hxx"
      34                 :            : #include "cmdid.h"
      35                 :            : #include "textsh.hxx"
      36                 :            : #include "initui.hxx"
      37                 :            : #include "gloshdl.hxx"
      38                 :            : #include "glosdoc.hxx"
      39                 :            : #include "gloslst.hxx"
      40                 :            : #include "swabstdlg.hxx"
      41                 :            : #include <misc.hrc>
      42                 :            : 
      43                 :            : // STATIC DATA -----------------------------------------------------------
      44                 :          0 : void SwTextShell::ExecGlossary(SfxRequest &rReq)
      45                 :            : {
      46                 :          0 :     sal_uInt16 nSlot = rReq.GetSlot();
      47         [ #  # ]:          0 :     ::GetGlossaries()->UpdateGlosPath(!rReq.IsAPI() ||
      48 [ #  # ][ #  # ]:          0 :                                         FN_GLOSSARY_DLG == nSlot );
         [ #  # ][ #  # ]
      49         [ #  # ]:          0 :     SwGlossaryHdl* pGlosHdl = GetView().GetGlosHdl();
      50                 :            :     // SwGlossaryList updaten?
      51                 :          0 :     sal_Bool bUpdateList = sal_False;
      52                 :            : 
      53                 :          0 :     const SfxItemSet *pArgs = rReq.GetArgs();
      54                 :          0 :     const SfxPoolItem* pItem = 0;
      55         [ #  # ]:          0 :     if(pArgs)
      56         [ #  # ]:          0 :        pArgs->GetItemState(nSlot, sal_False, &pItem );
      57                 :            : 
      58   [ #  #  #  #  :          0 :     switch( nSlot )
                   #  # ]
      59                 :            :     {
      60                 :            :         case FN_GLOSSARY_DLG:
      61         [ #  # ]:          0 :             pGlosHdl->GlossaryDlg();
      62                 :          0 :             bUpdateList = sal_True;
      63         [ #  # ]:          0 :             rReq.Ignore();
      64                 :          0 :             break;
      65                 :            :         case FN_EXPAND_GLOSSARY:
      66                 :            :         {
      67                 :            :             sal_Bool bReturn;
      68         [ #  # ]:          0 :             bReturn = pGlosHdl->ExpandGlossary();
      69 [ #  # ][ #  # ]:          0 :             rReq.SetReturnValue( SfxBoolItem( nSlot, bReturn ) );
                 [ #  # ]
      70         [ #  # ]:          0 :             rReq.Done();
      71                 :            :         }
      72                 :          0 :         break;
      73                 :            :         case FN_NEW_GLOSSARY:
      74 [ #  # ][ #  # ]:          0 :             if(pItem && pArgs->Count() == 3 )
                 [ #  # ]
      75                 :            :             {
      76         [ #  # ]:          0 :                 String aGroup = (( const SfxStringItem *)pItem)->GetValue();
      77         [ #  # ]:          0 :                 String aName;
      78 [ #  # ][ #  # ]:          0 :                 if(SFX_ITEM_SET ==  pArgs->GetItemState(FN_PARAM_1, sal_False, &pItem ))
      79         [ #  # ]:          0 :                     aName = (( const SfxStringItem *)pItem)->GetValue();
      80         [ #  # ]:          0 :                 String aShortName;
      81 [ #  # ][ #  # ]:          0 :                 if(SFX_ITEM_SET ==  pArgs->GetItemState(FN_PARAM_2, sal_False, &pItem ))
      82         [ #  # ]:          0 :                     aShortName = (( const SfxStringItem *)pItem)->GetValue();
      83                 :            : 
      84         [ #  # ]:          0 :                 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
      85                 :            :                 OSL_ENSURE(pFact, "Dialogdiet fail!");
      86         [ #  # ]:          0 :                 ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc( DLG_RENAME_GLOS );
      87         [ #  # ]:          0 :                 if ( fnSetActGroup )
      88         [ #  # ]:          0 :                     (*fnSetActGroup)( aGroup );
      89         [ #  # ]:          0 :                 pGlosHdl->SetCurGroup(aGroup, sal_True);
      90                 :            :                 //eingestellte Gruppe muss in NewGlossary ggf. erzeugt werden!
      91         [ #  # ]:          0 :                 pGlosHdl->NewGlossary( aName, aShortName, sal_True );
      92 [ #  # ][ #  # ]:          0 :                 rReq.Done();
         [ #  # ][ #  # ]
      93                 :            :             }
      94                 :          0 :             bUpdateList = sal_True;
      95                 :          0 :         break;
      96                 :            :         case FN_SET_ACT_GLOSSARY:
      97         [ #  # ]:          0 :             if(pItem)
      98                 :            :             {
      99         [ #  # ]:          0 :                 String aGroup = (( const SfxStringItem *)pItem)->GetValue();
     100         [ #  # ]:          0 :                 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     101                 :            :                 OSL_ENSURE(pFact, "Dialogdiet fail!");
     102         [ #  # ]:          0 :                 ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc( DLG_RENAME_GLOS );
     103         [ #  # ]:          0 :                 if ( fnSetActGroup )
     104         [ #  # ]:          0 :                     (*fnSetActGroup)( aGroup );
     105 [ #  # ][ #  # ]:          0 :                 rReq.Done();
     106                 :            :             }
     107                 :          0 :         break;
     108                 :            :         case FN_INSERT_GLOSSARY:
     109                 :            :         {
     110 [ #  # ][ #  # ]:          0 :             if(pItem && pArgs->Count() > 1)
                 [ #  # ]
     111                 :            :             {
     112         [ #  # ]:          0 :                 String aGroup = (( const SfxStringItem *)pItem)->GetValue();
     113         [ #  # ]:          0 :                 String aName;
     114 [ #  # ][ #  # ]:          0 :                 if(SFX_ITEM_SET ==  pArgs->GetItemState(FN_PARAM_1, sal_False, &pItem ))
     115         [ #  # ]:          0 :                     aName = (( const SfxStringItem *)pItem)->GetValue();
     116         [ #  # ]:          0 :                 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     117                 :            :                 OSL_ENSURE(pFact, "Dialogdiet fail!");
     118         [ #  # ]:          0 :                 ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc( DLG_RENAME_GLOS );
     119         [ #  # ]:          0 :                 if ( fnSetActGroup )
     120         [ #  # ]:          0 :                     (*fnSetActGroup)( aGroup );
     121         [ #  # ]:          0 :                 pGlosHdl->SetCurGroup(aGroup, sal_True);
     122 [ #  # ][ #  # ]:          0 :                 rReq.SetReturnValue(SfxBoolItem(nSlot, pGlosHdl->InsertGlossary( aName )));
         [ #  # ][ #  # ]
     123 [ #  # ][ #  # ]:          0 :                 rReq.Done();
                 [ #  # ]
     124                 :            :             }
     125                 :            :         }
     126                 :          0 :         break;
     127                 :            :         default:
     128                 :            :             OSL_FAIL("wrong dispatcher");
     129                 :          0 :             return;
     130                 :            :     }
     131         [ #  # ]:          0 :     if(bUpdateList)
     132                 :            :     {
     133         [ #  # ]:          0 :         SwGlossaryList* pList = ::GetGlossaryList();
     134         [ #  # ]:          0 :         if(pList->IsActive())
     135         [ #  # ]:          0 :             pList->Update();
     136                 :            :     }
     137                 :            : }
     138                 :            : 
     139                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10