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 //# #
27 //# Childwindow-Wrapper-Class #
28 //# #
29 
30 
32 
33 SvxHlinkDlgWrapper::SvxHlinkDlgWrapper( vcl::Window* _pParent, sal_uInt16 nId,
34  SfxBindings* pBindings,
35  SfxChildWinInfo* pInfo ) :
36  SfxChildWindow( _pParent, nId ),
37 
38  mpDlg( nullptr )
39 
40 {
42  mpDlg = pFact->CreateSvxHpLinkDlg(this, pBindings, _pParent->GetFrameWeld());
43  SetController( mpDlg->GetController() );
44  SetVisible_Impl(false);
45 
46  if ( !pInfo->aSize.IsEmpty() )
47  {
48  vcl::Window* pTopWindow = SfxGetpApp()->GetTopWindow();
49  if (pTopWindow)
50  {
51  weld::Dialog* pDialog = GetController()->getDialog();
52 
53  Size aParentSize( pTopWindow->GetSizePixel() );
54  Size aDlgSize(pDialog->get_size());
55 
56  if( aParentSize.Width() < pInfo->aPos.X() )
57  pInfo->aPos.setX( aParentSize.Width()-aDlgSize.Width() < long(0.1*aParentSize.Width()) ?
58  long(0.1*aParentSize.Width()) : aParentSize.Width()-aDlgSize.Width() );
59  if( aParentSize.Height() < pInfo->aPos. Y() )
60  pInfo->aPos.setY( aParentSize.Height()-aDlgSize.Height() < long(0.1*aParentSize.Height()) ?
61  long(0.1*aParentSize.Height()) : aParentSize.Height()-aDlgSize.Height() );
62 
63  pDialog->window_move(pInfo->aPos.X(), pInfo->aPos.Y());
64  }
65  }
66  SetHideNotDelete( true );
67 }
68 
70 {
71  return SfxChildWindow::GetInfo();
72 }
73 
75 {
76  return !mpDlg || mpDlg->QueryClose();
77 }
78 
80 {
82 }
83 
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool QueryClose()=0
static SvxAbstractDialogFactory * Create()
Definition: svxdlg.cxx:23
void disposeAndClear()
virtual Size GetSizePixel() const
virtual VclPtr< AbstractSvxHpLinkDlg > CreateSvxHpLinkDlg(SfxChildWindow *pChild, SfxBindings *pBindings, weld::Window *pParent)=0
SfxApplication * SfxGetpApp()
vcl::Window * GetTopWindow() const
virtual bool QueryClose() override
Definition: hyperdlg.cxx:74
virtual void window_move(int x, int y)=0
virtual ~SvxHlinkDlgWrapper() override
Definition: hyperdlg.cxx:79
SFX_IMPL_CHILDWINDOW_WITHID(SvxSearchDialogWrapper, SID_SEARCH_DLG)
#define Y
VclPtr< AbstractSvxHpLinkDlg > mpDlg
Definition: hyperdlg.hxx:37
virtual Size get_size() const =0
virtual SfxChildWinInfo GetInfo() const