LibreOffice Module svx (master) 1
hyperdlg.cxx
Go to the documentation of this file.
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 <svx/hyperdlg.hxx>
21#include <svx/svxdlg.hxx>
22#include <sfx2/app.hxx>
23#include <sfx2/sfxsids.hrc>
24
25//# #
26//# Childwindow-Wrapper-Class #
27//# #
29
30SvxHlinkDlgWrapper::SvxHlinkDlgWrapper( vcl::Window* _pParent, sal_uInt16 nId,
31 SfxBindings* pBindings,
32 SfxChildWinInfo* pInfo ) :
33 SfxChildWindow( _pParent, nId ),
34
35 mpDlg( nullptr )
36
37{
39 mpDlg = pFact->CreateSvxHpLinkDlg(this, pBindings, _pParent->GetFrameWeld());
40 SetController( mpDlg->GetController() );
41 SetVisible_Impl(false);
42
43 if ( !pInfo->aSize.IsEmpty() )
44 {
45 weld::Window* pTopWindow = SfxGetpApp()->GetTopWindow();
46 if (pTopWindow)
47 {
48 weld::Dialog* pDialog = GetController()->getDialog();
49
50 Size aParentSize(pTopWindow->get_size());
51 Size aDlgSize(pDialog->get_size());
52
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() );
59
60 pDialog->window_move(pInfo->aPos.X(), pInfo->aPos.Y());
61 }
62 }
63 SetHideNotDelete( true );
64}
65
67{
69}
70
72{
73 return !mpDlg || mpDlg->QueryClose();
74}
75
77{
79}
80
81/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxApplication * SfxGetpApp()
weld::Window * GetTopWindow() const
virtual SfxChildWinInfo GetInfo() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
virtual VclPtr< AbstractSvxHpLinkDlg > CreateSvxHpLinkDlg(SfxChildWindow *pChild, SfxBindings *pBindings, weld::Window *pParent)=0
static SvxAbstractDialogFactory * Create()
Definition: svxdlg.cxx:22
virtual ~SvxHlinkDlgWrapper() override
Definition: hyperdlg.cxx:76
VclPtr< AbstractSvxHpLinkDlg > mpDlg
Definition: hyperdlg.hxx:37
virtual bool QueryClose() override
Definition: hyperdlg.cxx:71
void disposeAndClear()
virtual Size get_size() const=0
virtual void window_move(int x, int y)=0
virtual std::shared_ptr< SfxDialogController > GetController() override
long Long
#define Y
SFX_IMPL_CHILDWINDOW_WITHID(SvxSearchDialogWrapper, SID_SEARCH_DLG)