update credits
[LibreOffice.git] / svx / source / dialog / hyperdlg.cxx
blob6e095220e80ba6443922466104cb2c72da8bc22f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
27 //########################################################################
28 //# #
29 //# Childwindow-Wrapper-Class #
30 //# #
31 //########################################################################
33 SFX_IMPL_CHILDWINDOW_WITHID(SvxHlinkDlgWrapper, SID_HYPERLINK_DIALOG)
35 // -----------------------------------------------------------------------
37 struct MyStruct
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;
48 SvxHlinkDlgWrapper::SvxHlinkDlgWrapper( Window* _pParent, sal_uInt16 nId,
49 SfxBindings* pBindings,
50 SfxChildWinInfo* pInfo ) :
51 SfxChildWindow( _pParent, nId ),
53 mpDlg( NULL )
56 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
57 DBG_ASSERT(pFact, "Dialogdiet fail!");
58 mpDlg = pFact->CreateSvxHpLinkDlg( _pParent, pBindings, SID_HYPERLINK_DIALOG );
59 DBG_ASSERT(mpDlg, "Dialogdiet fail!");
60 pWindow = mpDlg->GetWindow();
61 ((MyStruct*)pImp)->bVisible = sal_False;
63 Window* pTopWindow = 0;
64 if ( pInfo->aSize.Width() != 0 && pInfo->aSize.Height() != 0 &&
65 (0 != (pTopWindow = SFX_APP()->GetTopWindow())))
67 Size aParentSize( pTopWindow->GetSizePixel() );
68 Size aDlgSize ( GetSizePixel () );
70 if( aParentSize.Width() < pInfo->aPos.X() )
71 pInfo->aPos.setX( aParentSize.Width()-aDlgSize.Width() < long(0.1*aParentSize.Width()) ?
72 long(0.1*aParentSize.Width()) : aParentSize.Width()-aDlgSize.Width() );
73 if( aParentSize.Height() < pInfo->aPos. Y() )
74 pInfo->aPos.setY( aParentSize.Height()-aDlgSize.Height() < long(0.1*aParentSize.Height()) ?
75 long(0.1*aParentSize.Height()) : aParentSize.Height()-aDlgSize.Height() );
77 pWindow->SetPosPixel( pInfo->aPos );
80 eChildAlignment = SFX_ALIGN_NOALIGNMENT;
82 SetHideNotDelete( sal_True );
85 SfxChildWinInfo SvxHlinkDlgWrapper::GetInfo() const
87 return SfxChildWindow::GetInfo();
90 sal_Bool SvxHlinkDlgWrapper::QueryClose()
92 return mpDlg ? mpDlg->QueryClose() : sal_True;
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */