LCOV - code coverage report
Current view: top level - sw/source/core/uibase/shells - textglos.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 63 0.0 %
Date: 2014-04-14 Functions: 0 3 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/request.hxx>
      21             : #include <svl/eitem.hxx>
      22             : #include <svl/stritem.hxx>
      23             : 
      24             : #include "view.hxx"
      25             : #include "cmdid.h"
      26             : #include "textsh.hxx"
      27             : #include "initui.hxx"
      28             : #include "gloshdl.hxx"
      29             : #include "glosdoc.hxx"
      30             : #include "gloslst.hxx"
      31             : #include "swabstdlg.hxx"
      32             : #include <misc.hrc>
      33             : 
      34           0 : void SwTextShell::ExecGlossary(SfxRequest &rReq)
      35             : {
      36           0 :     sal_uInt16 nSlot = rReq.GetSlot();
      37           0 :     ::GetGlossaries()->UpdateGlosPath(!rReq.IsAPI() ||
      38           0 :                                         FN_GLOSSARY_DLG == nSlot );
      39           0 :     SwGlossaryHdl* pGlosHdl = GetView().GetGlosHdl();
      40             :     // Update SwGlossaryList?
      41           0 :     bool bUpdateList = false;
      42             : 
      43           0 :     const SfxItemSet *pArgs = rReq.GetArgs();
      44           0 :     const SfxPoolItem* pItem = 0;
      45           0 :     if(pArgs)
      46           0 :        pArgs->GetItemState(nSlot, false, &pItem );
      47             : 
      48           0 :     switch( nSlot )
      49             :     {
      50             :         case FN_GLOSSARY_DLG:
      51           0 :             pGlosHdl->GlossaryDlg();
      52           0 :             bUpdateList = true;
      53           0 :             rReq.Ignore();
      54           0 :             break;
      55             :         case FN_EXPAND_GLOSSARY:
      56             :         {
      57             :             sal_Bool bReturn;
      58           0 :             bReturn = pGlosHdl->ExpandGlossary();
      59           0 :             rReq.SetReturnValue( SfxBoolItem( nSlot, bReturn ) );
      60           0 :             rReq.Done();
      61             :         }
      62           0 :         break;
      63             :         case FN_NEW_GLOSSARY:
      64           0 :             if(pItem && pArgs->Count() == 3 )
      65             :             {
      66           0 :                 OUString aGroup = (( const SfxStringItem *)pItem)->GetValue();
      67           0 :                 OUString aName;
      68           0 :                 if(SFX_ITEM_SET ==  pArgs->GetItemState(FN_PARAM_1, false, &pItem ))
      69           0 :                     aName = (( const SfxStringItem *)pItem)->GetValue();
      70           0 :                 OUString aShortName;
      71           0 :                 if(SFX_ITEM_SET ==  pArgs->GetItemState(FN_PARAM_2, false, &pItem ))
      72           0 :                     aShortName = (( const SfxStringItem *)pItem)->GetValue();
      73             : 
      74           0 :                 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
      75             :                 OSL_ENSURE(pFact, "Dialogdiet fail!");
      76           0 :                 ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc();
      77           0 :                 if ( fnSetActGroup )
      78           0 :                     (*fnSetActGroup)( aGroup );
      79           0 :                 pGlosHdl->SetCurGroup(aGroup, sal_True);
      80             :                 // Chosen group must be created in NewGlossary if necessary!
      81           0 :                 pGlosHdl->NewGlossary( aName, aShortName, sal_True );
      82           0 :                 rReq.Done();
      83             :             }
      84           0 :             bUpdateList = true;
      85           0 :         break;
      86             :         case FN_SET_ACT_GLOSSARY:
      87           0 :             if(pItem)
      88             :             {
      89           0 :                 OUString aGroup = (( const SfxStringItem *)pItem)->GetValue();
      90           0 :                 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
      91             :                 OSL_ENSURE(pFact, "Dialogdiet fail!");
      92           0 :                 ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc();
      93           0 :                 if ( fnSetActGroup )
      94           0 :                     (*fnSetActGroup)( aGroup );
      95           0 :                 rReq.Done();
      96             :             }
      97           0 :         break;
      98             :         case FN_INSERT_GLOSSARY:
      99             :         {
     100           0 :             if(pItem && pArgs->Count() > 1)
     101             :             {
     102           0 :                 OUString aGroup = (( const SfxStringItem *)pItem)->GetValue();
     103           0 :                 OUString aName;
     104           0 :                 if(SFX_ITEM_SET ==  pArgs->GetItemState(FN_PARAM_1, false, &pItem ))
     105           0 :                     aName = (( const SfxStringItem *)pItem)->GetValue();
     106           0 :                 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     107             :                 OSL_ENSURE(pFact, "Dialogdiet fail!");
     108           0 :                 ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc();
     109           0 :                 if ( fnSetActGroup )
     110           0 :                     (*fnSetActGroup)( aGroup );
     111           0 :                 pGlosHdl->SetCurGroup(aGroup, sal_True);
     112           0 :                 rReq.SetReturnValue(SfxBoolItem(nSlot, pGlosHdl->InsertGlossary( aName ) ? sal_True : sal_False));
     113           0 :                 rReq.Done();
     114             :             }
     115             :         }
     116           0 :         break;
     117             :         default:
     118             :             OSL_FAIL("wrong dispatcher");
     119           0 :             return;
     120             :     }
     121           0 :     if(bUpdateList)
     122             :     {
     123           0 :         SwGlossaryList* pList = ::GetGlossaryList();
     124           0 :         if(pList->IsActive())
     125           0 :             pList->Update();
     126             :     }
     127           0 : }
     128             : 
     129             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10