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 195 : SFX_IMPL_CHILDWINDOW_WITHID(SvxHlinkDlgWrapper, SID_HYPERLINK_DIALOG)
34 :
35 0 : SvxHlinkDlgWrapper::SvxHlinkDlgWrapper( vcl::Window* _pParent, sal_uInt16 nId,
36 : SfxBindings* pBindings,
37 : SfxChildWinInfo* pInfo ) :
38 : SfxChildWindow( _pParent, nId ),
39 :
40 0 : mpDlg( NULL )
41 :
42 : {
43 0 : SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
44 : DBG_ASSERT(pFact, "Dialog creation failed!");
45 0 : mpDlg = pFact->CreateSvxHpLinkDlg( _pParent, pBindings, SID_HYPERLINK_DIALOG );
46 : DBG_ASSERT(mpDlg, "Dialog creation failed!");
47 0 : pWindow = mpDlg->GetWindow();
48 0 : SetVisible_Impl(false);
49 :
50 0 : vcl::Window* pTopWindow = 0;
51 0 : if ( pInfo->aSize.Width() != 0 && pInfo->aSize.Height() != 0 &&
52 0 : (0 != (pTopWindow = SfxGetpApp()->GetTopWindow())))
53 : {
54 0 : Size aParentSize( pTopWindow->GetSizePixel() );
55 0 : Size aDlgSize ( GetSizePixel () );
56 :
57 0 : if( aParentSize.Width() < pInfo->aPos.X() )
58 0 : pInfo->aPos.setX( aParentSize.Width()-aDlgSize.Width() < long(0.1*aParentSize.Width()) ?
59 0 : long(0.1*aParentSize.Width()) : aParentSize.Width()-aDlgSize.Width() );
60 0 : if( aParentSize.Height() < pInfo->aPos. Y() )
61 0 : pInfo->aPos.setY( aParentSize.Height()-aDlgSize.Height() < long(0.1*aParentSize.Height()) ?
62 0 : long(0.1*aParentSize.Height()) : aParentSize.Height()-aDlgSize.Height() );
63 :
64 0 : pWindow->SetPosPixel( pInfo->aPos );
65 : }
66 :
67 0 : eChildAlignment = SfxChildAlignment::NOALIGNMENT;
68 :
69 0 : SetHideNotDelete( true );
70 0 : }
71 :
72 0 : SfxChildWinInfo SvxHlinkDlgWrapper::GetInfo() const
73 : {
74 0 : return SfxChildWindow::GetInfo();
75 : }
76 :
77 0 : bool SvxHlinkDlgWrapper::QueryClose()
78 : {
79 0 : return !mpDlg || mpDlg->QueryClose();
80 390 : }
81 :
82 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|