LCOV - code coverage report
Current view: top level - sw/source/uibase/fldui - fldwrap.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 3 57 5.3 %
Date: 2014-11-03 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 <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       73350 : SFX_IMPL_CHILDWINDOW_WITHID(SwFldDlgWrapper, FN_INSERT_FIELD)
      39             : 
      40           0 : SwChildWinWrapper::SwChildWinWrapper(vcl::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             : // newly initialise dialog after Doc switch
      57           0 : bool SwChildWinWrapper::ReInitDlg(SwDocShell *)
      58             : {
      59           0 :     bool bRet = false;
      60             : 
      61           0 :     if (m_pDocSh != GetOldDocShell())
      62             :     {
      63           0 :         m_aUpdateTimer.Stop();
      64           0 :         bRet = true;            // immediate Update
      65             :     }
      66             :     else
      67           0 :         m_aUpdateTimer.Start();
      68             : 
      69           0 :     return bRet;
      70             : }
      71             : 
      72           0 : SfxChildWinInfo SwFldDlgWrapper::GetInfo() const
      73             : {
      74           0 :     SfxChildWinInfo aInfo = SfxChildWindow::GetInfo();
      75           0 :     aInfo.aPos = GetWindow()->OutputToAbsoluteScreenPixel(aInfo.aPos);
      76           0 :     return aInfo;
      77             : }
      78             : 
      79           0 : SwFldDlgWrapper::SwFldDlgWrapper( vcl::Window* _pParent, sal_uInt16 nId,
      80             :                                     SfxBindings* pB,
      81             :                                     SfxChildWinInfo*  )
      82           0 :     : SwChildWinWrapper( _pParent, nId )
      83             : {
      84           0 :     SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
      85             :     assert(pFact && "SwAbstractDialogFactory fail!");
      86           0 :     AbstractSwFldDlg* pDlg = pFact->CreateSwFldDlg(pB, this, _pParent);
      87             :     assert(pDlg && "Dialog creation failed!");
      88           0 :     pDlgInterface = pDlg;
      89           0 :     pWindow = pDlg->GetWindow();
      90           0 :     pDlg->Start();
      91           0 :     eChildAlignment = SFX_ALIGN_NOALIGNMENT;
      92           0 : }
      93             : 
      94             : // newly initialise dialog after Doc switch
      95           0 : bool SwFldDlgWrapper::ReInitDlg(SwDocShell *pDocSh)
      96             : {
      97             :     bool bRet;
      98             : 
      99           0 :     if ((bRet = SwChildWinWrapper::ReInitDlg(pDocSh)))  // update immediately, Doc switch
     100             :     {
     101           0 :         pDlgInterface->ReInitDlg();
     102             :     }
     103             : 
     104           0 :     return bRet;
     105             : }
     106             : 
     107           0 : void SwFldDlgWrapper::ShowReferencePage()
     108             : {
     109           0 :     pDlgInterface->ShowReferencePage();
     110           0 : }
     111             : 
     112          90 : SFX_IMPL_CHILDWINDOW(SwFldDataOnlyDlgWrapper, FN_INSERT_FIELD_DATA_ONLY)
     113             : 
     114           0 : SfxChildWinInfo SwFldDataOnlyDlgWrapper::GetInfo() const
     115             : {
     116           0 :     SfxChildWinInfo aInfo = SfxChildWindow::GetInfo();
     117             : // prevent instatiation of dialog other than by calling
     118             : // the mail merge dialog
     119           0 :     aInfo.bVisible = false;
     120           0 :     return aInfo;
     121             : }
     122             : 
     123           0 : SwFldDataOnlyDlgWrapper::SwFldDataOnlyDlgWrapper( vcl::Window* _pParent, sal_uInt16 nId,
     124             :                                     SfxBindings* pB,
     125             :                                     SfxChildWinInfo* pInfo )
     126           0 :     : SwChildWinWrapper( _pParent, nId )
     127             : {
     128           0 :     SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     129             :     OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
     130             : 
     131           0 :     AbstractSwFldDlg* pDlg = pFact->CreateSwFldDlg(pB, this, _pParent);
     132             :     OSL_ENSURE(pDlg, "Dialog creation failed!");
     133           0 :     pDlgInterface = pDlg;
     134             : 
     135           0 :     pWindow = pDlg->GetWindow();
     136           0 :     pDlg->ActivateDatabasePage();
     137           0 :     pDlg->Start();
     138           0 :     pDlg->Initialize( pInfo );
     139           0 :     eChildAlignment = SFX_ALIGN_NOALIGNMENT;
     140           0 : }
     141             : 
     142             : // re-init after doc activation
     143           0 : bool SwFldDataOnlyDlgWrapper::ReInitDlg(SwDocShell *pDocSh)
     144             : {
     145             :     bool bRet;
     146           0 :     if ((bRet = SwChildWinWrapper::ReInitDlg(pDocSh)))  // update immediately, Doc switch
     147             :     {
     148           0 :         pDlgInterface->ReInitDlg();
     149             :     }
     150             : 
     151           0 :     return bRet;
     152         270 : }
     153             : 
     154             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10