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

Generated by: LCOV version 1.10