LCOV - code coverage report
Current view: top level - libreoffice/svx/source/dialog - hyperdlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 27 7.4 %
Date: 2012-12-27 Functions: 4 8 50.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 <vcl/settings.hxx>
      21             : #include <unotools/viewoptions.hxx>
      22             : #include "svx/hyperdlg.hxx"
      23             : #include <svx/svxdlg.hxx>
      24             : #include <sfx2/app.hxx>
      25             : #include <sfx2/sfxsids.hrc>
      26             : 
      27             : //########################################################################
      28             : //#                                                                      #
      29             : //# Childwindow-Wrapper-Class                                            #
      30             : //#                                                                      #
      31             : //########################################################################
      32             : 
      33          27 : SFX_IMPL_CHILDWINDOW_WITHID(SvxHlinkDlgWrapper, SID_HYPERLINK_DIALOG)
      34             : 
      35             : // -----------------------------------------------------------------------
      36             : 
      37             : struct MyStruct
      38             : {
      39             :     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame;
      40             :     SfxChildWinFactory* pFact;
      41             :     sal_Bool                bHideNotDelete;
      42             :     sal_Bool                bVisible;
      43             :     sal_Bool                bHideAtToggle;
      44             :     SfxModule*          pContextModule;
      45             :     SfxWorkWindow*      pWorkWin;
      46             : };
      47             : 
      48           0 : SvxHlinkDlgWrapper::SvxHlinkDlgWrapper( Window* _pParent, sal_uInt16 nId,
      49             :                                                 SfxBindings* pBindings,
      50             :                                                 SfxChildWinInfo* pInfo ) :
      51             :     SfxChildWindow( _pParent, nId ),
      52             : 
      53           0 :     mpDlg( NULL )
      54             : 
      55             : {
      56           0 :     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
      57             :     DBG_ASSERT(pFact, "Dialogdiet fail!");
      58           0 :     mpDlg = pFact->CreateSvxHpLinkDlg( _pParent, pBindings, SID_HYPERLINK_DIALOG );
      59             :     DBG_ASSERT(mpDlg, "Dialogdiet fail!");
      60           0 :     pWindow = mpDlg->GetWindow();
      61           0 :     ((MyStruct*)pImp)->bVisible = sal_False;
      62             : 
      63           0 :     Window* pTopWindow = 0;
      64           0 :     if ( pInfo->aSize.Width() != 0 && pInfo->aSize.Height() != 0 &&
      65           0 :             (0 != (pTopWindow = SFX_APP()->GetTopWindow())))
      66             :     {
      67           0 :         Size aParentSize( pTopWindow->GetSizePixel() );
      68           0 :         Size aDlgSize ( GetSizePixel () );
      69             : 
      70           0 :         if( aParentSize.Width() < pInfo->aPos.X() )
      71           0 :             pInfo->aPos.setX( aParentSize.Width()-aDlgSize.Width() < long(0.1*aParentSize.Width()) ?
      72           0 :                               long(0.1*aParentSize.Width()) : aParentSize.Width()-aDlgSize.Width() );
      73           0 :         if( aParentSize.Height() < pInfo->aPos. Y() )
      74           0 :             pInfo->aPos.setY( aParentSize.Height()-aDlgSize.Height() < long(0.1*aParentSize.Height()) ?
      75           0 :                               long(0.1*aParentSize.Height()) : aParentSize.Height()-aDlgSize.Height() );
      76             : 
      77           0 :         pWindow->SetPosPixel( pInfo->aPos );
      78             :     }
      79             : 
      80           0 :     eChildAlignment = SFX_ALIGN_NOALIGNMENT;
      81             : 
      82           0 :     SetHideNotDelete( sal_True );
      83           0 : }
      84             : 
      85           0 : SfxChildWinInfo SvxHlinkDlgWrapper::GetInfo() const
      86             : {
      87           0 :     return SfxChildWindow::GetInfo();
      88             : }
      89             : 
      90           0 : sal_Bool SvxHlinkDlgWrapper::QueryClose()
      91             : {
      92           0 :     return mpDlg ? mpDlg->QueryClose() : sal_True;
      93          57 : }
      94             : 
      95             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10