bump product version to 7.6.3.2-android
[LibreOffice.git] / svx / source / dialog / hyperdlg.cxx
blob6d94d8add6c88e71f535d17e03745c418c69f558
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 <svx/hyperdlg.hxx>
21 #include <svx/svxdlg.hxx>
22 #include <sfx2/app.hxx>
23 #include <sfx2/sfxsids.hrc>
25 //# #
26 //# Childwindow-Wrapper-Class #
27 //# #
28 SFX_IMPL_CHILDWINDOW_WITHID(SvxHlinkDlgWrapper, SID_HYPERLINK_DIALOG)
30 SvxHlinkDlgWrapper::SvxHlinkDlgWrapper( vcl::Window* _pParent, sal_uInt16 nId,
31 SfxBindings* pBindings,
32 SfxChildWinInfo* pInfo ) :
33 SfxChildWindow( _pParent, nId ),
35 mpDlg( nullptr )
38 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
39 mpDlg = pFact->CreateSvxHpLinkDlg(this, pBindings, _pParent->GetFrameWeld());
40 SetController( mpDlg->GetController() );
41 SetVisible_Impl(false);
43 if ( !pInfo->aSize.IsEmpty() )
45 weld::Window* pTopWindow = SfxGetpApp()->GetTopWindow();
46 if (pTopWindow)
48 weld::Dialog* pDialog = GetController()->getDialog();
50 Size aParentSize(pTopWindow->get_size());
51 Size aDlgSize(pDialog->get_size());
53 if( aParentSize.Width() < pInfo->aPos.X() )
54 pInfo->aPos.setX( aParentSize.Width()-aDlgSize.Width() < tools::Long(0.1*aParentSize.Width()) ?
55 tools::Long(0.1*aParentSize.Width()) : aParentSize.Width()-aDlgSize.Width() );
56 if( aParentSize.Height() < pInfo->aPos. Y() )
57 pInfo->aPos.setY( aParentSize.Height()-aDlgSize.Height() < tools::Long(0.1*aParentSize.Height()) ?
58 tools::Long(0.1*aParentSize.Height()) : aParentSize.Height()-aDlgSize.Height() );
60 pDialog->window_move(pInfo->aPos.X(), pInfo->aPos.Y());
63 SetHideNotDelete( true );
66 SfxChildWinInfo SvxHlinkDlgWrapper::GetInfo() const
68 return SfxChildWindow::GetInfo();
71 bool SvxHlinkDlgWrapper::QueryClose()
73 return !mpDlg || mpDlg->QueryClose();
76 SvxHlinkDlgWrapper::~SvxHlinkDlgWrapper()
78 mpDlg.disposeAndClear();
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */