LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/fldui - fldwrap.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 57 5.3 %
Date: 2012-12-27 Functions: 5 18 27.8 %
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 <cmdid.h>
      21             : #include <swtypes.hxx>
      22             : #include <sfx2/basedlgs.hxx>
      23             : #include <sfx2/dispatch.hxx>
      24             : #include <vcl/msgbox.hxx>
      25             : #include <svx/htmlmode.hxx>
      26             : #include <viewopt.hxx>
      27             : #include <docsh.hxx>
      28             : #include <fldwrap.hxx>
      29             : #include <wrtsh.hxx>
      30             : #include <view.hxx>
      31             : #include <swmodule.hxx>
      32             : 
      33             : #include <helpid.h>
      34             : #include <fldui.hrc>
      35             : #include <globals.hrc>
      36             : #include <fldtdlg.hrc>
      37             : #include "swabstdlg.hxx"
      38             : 
      39         260 : SFX_IMPL_CHILDWINDOW_WITHID(SwFldDlgWrapper, FN_INSERT_FIELD)
      40             : 
      41           0 : SwChildWinWrapper::SwChildWinWrapper(Window *pParentWindow, sal_uInt16 nId) :
      42             :         SfxChildWindow(pParentWindow, nId),
      43           0 :         m_pDocSh(0)
      44             : {
      45             :     // avoid flickering of buttons:
      46           0 :     m_aUpdateTimer.SetTimeout(200);
      47           0 :     m_aUpdateTimer.SetTimeoutHdl(LINK(this, SwChildWinWrapper, UpdateHdl));
      48           0 : }
      49             : 
      50           0 : IMPL_LINK_NOARG(SwChildWinWrapper, UpdateHdl)
      51             : {
      52           0 :     GetWindow()->Activate();    // update dialog
      53             : 
      54           0 :     return 0;
      55             : }
      56             : 
      57             : /*--------------------------------------------------------------------
      58             :     Description: newly initialise dialog after Doc switch
      59             :  --------------------------------------------------------------------*/
      60           0 : sal_Bool SwChildWinWrapper::ReInitDlg(SwDocShell *)
      61             : {
      62           0 :     sal_Bool bRet = sal_False;
      63             : 
      64           0 :     if (m_pDocSh != GetOldDocShell())
      65             :     {
      66           0 :         m_aUpdateTimer.Stop();
      67           0 :         bRet = sal_True;            // immediate Update
      68             :     }
      69             :     else
      70           0 :         m_aUpdateTimer.Start();
      71             : 
      72           0 :     return bRet;
      73             : }
      74             : 
      75           0 : SfxChildWinInfo SwFldDlgWrapper::GetInfo() const
      76             : {
      77           0 :     SfxChildWinInfo aInfo = SfxChildWindow::GetInfo();
      78           0 :     aInfo.aPos = GetWindow()->OutputToAbsoluteScreenPixel(aInfo.aPos);
      79           0 :     return aInfo;
      80             : }
      81             : 
      82           0 : SwFldDlgWrapper::SwFldDlgWrapper( Window* _pParent, sal_uInt16 nId,
      83             :                                     SfxBindings* pB,
      84             :                                     SfxChildWinInfo*  )
      85           0 :     : SwChildWinWrapper( _pParent, nId )
      86             : {
      87           0 :     SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
      88             :     OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
      89             : 
      90           0 :     AbstractSwFldDlg* pDlg = pFact->CreateSwFldDlg(pB, this, _pParent, DLG_FLD_INSERT );
      91             :     OSL_ENSURE(pDlg, "Dialogdiet fail!");
      92           0 :     pDlgInterface = pDlg;
      93           0 :     pWindow = pDlg->GetWindow();
      94           0 :     pDlg->Start();
      95           0 :     eChildAlignment = SFX_ALIGN_NOALIGNMENT;
      96           0 : }
      97             : 
      98             : /*--------------------------------------------------------------------
      99             :     Description: newly initialise dialog after Doc switch
     100             :  --------------------------------------------------------------------*/
     101           0 : sal_Bool SwFldDlgWrapper::ReInitDlg(SwDocShell *pDocSh)
     102             : {
     103             :     sal_Bool bRet;
     104             : 
     105           0 :     if ((bRet = SwChildWinWrapper::ReInitDlg(pDocSh)) == sal_True)  // update immediately, Doc switch
     106             :     {
     107           0 :         pDlgInterface->ReInitDlg();
     108             :     }
     109             : 
     110           0 :     return bRet;
     111             : }
     112             : 
     113           0 : void SwFldDlgWrapper::ShowPage(sal_uInt16 nPage)
     114             : {
     115           0 :     pDlgInterface->ShowPage(nPage ? nPage : TP_FLD_REF);
     116           0 : }
     117             : 
     118          10 : SFX_IMPL_CHILDWINDOW(SwFldDataOnlyDlgWrapper, FN_INSERT_FIELD_DATA_ONLY)
     119             : 
     120           0 : SfxChildWinInfo SwFldDataOnlyDlgWrapper::GetInfo() const
     121             : {
     122           0 :     SfxChildWinInfo aInfo = SfxChildWindow::GetInfo();
     123             : // prevent instatiation of dialog other than by calling
     124             : // the mail merge dialog
     125           0 :     aInfo.bVisible = sal_False;
     126           0 :     return aInfo;
     127             : }
     128             : 
     129           0 : SwFldDataOnlyDlgWrapper::SwFldDataOnlyDlgWrapper( Window* _pParent, sal_uInt16 nId,
     130             :                                     SfxBindings* pB,
     131             :                                     SfxChildWinInfo* pInfo )
     132           0 :     : SwChildWinWrapper( _pParent, nId )
     133             : {
     134           0 :     SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     135             :     OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
     136             : 
     137           0 :     AbstractSwFldDlg* pDlg = pFact->CreateSwFldDlg(pB, this, _pParent, DLG_FLD_INSERT );
     138             :     OSL_ENSURE(pDlg, "Dialogdiet fail!");
     139           0 :     pDlgInterface = pDlg;
     140             : 
     141           0 :     pWindow = pDlg->GetWindow();
     142           0 :     pDlg->ActivateDatabasePage();
     143           0 :     pDlg->Start();
     144           0 :     pDlg->Initialize( pInfo );
     145           0 :     eChildAlignment = SFX_ALIGN_NOALIGNMENT;
     146           0 : }
     147             : 
     148             : /* --------------------------------------------------
     149             :  * re-init after doc activation
     150             :  * --------------------------------------------------*/
     151           0 : sal_Bool SwFldDataOnlyDlgWrapper::ReInitDlg(SwDocShell *pDocSh)
     152             : {
     153             :     sal_Bool bRet;
     154           0 :     if ((bRet = SwChildWinWrapper::ReInitDlg(pDocSh)) == sal_True)  // update immediately, Doc switch
     155             :     {
     156           0 :         pDlgInterface->ReInitDlg();
     157             :     }
     158             : 
     159           0 :     return bRet;
     160          30 : }
     161             : 
     162             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10