Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <vcl/settings.hxx>
30 : : #include <unotools/viewoptions.hxx>
31 : : #include "svx/hyperdlg.hxx"
32 : : #include <svx/svxdlg.hxx>
33 : : #include <sfx2/app.hxx>
34 : : #include <sfx2/sfxsids.hrc>
35 : :
36 : : //########################################################################
37 : : //# #
38 : : //# Childwindow-Wrapper-Class #
39 : : //# #
40 : : //########################################################################
41 : :
42 [ + - ][ # # ]: 224 : SFX_IMPL_CHILDWINDOW_WITHID(SvxHlinkDlgWrapper, SID_HYPERLINK_DIALOG)
43 : :
44 : : // -----------------------------------------------------------------------
45 : :
46 : : struct MyStruct
47 : : {
48 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame;
49 : : SfxChildWinFactory* pFact;
50 : : sal_Bool bHideNotDelete;
51 : : sal_Bool bVisible;
52 : : sal_Bool bHideAtToggle;
53 : : SfxModule* pContextModule;
54 : : SfxWorkWindow* pWorkWin;
55 : : };
56 : :
57 : 0 : SvxHlinkDlgWrapper::SvxHlinkDlgWrapper( Window* _pParent, sal_uInt16 nId,
58 : : SfxBindings* pBindings,
59 : : SfxChildWinInfo* pInfo ) :
60 : : SfxChildWindow( _pParent, nId ),
61 : :
62 : 0 : mpDlg( NULL )
63 : :
64 : : {
65 [ # # ]: 0 : SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
66 : : DBG_ASSERT(pFact, "Dialogdiet fail!");
67 [ # # ]: 0 : mpDlg = pFact->CreateSvxHpLinkDlg( _pParent, pBindings, SID_HYPERLINK_DIALOG );
68 : : DBG_ASSERT(mpDlg, "Dialogdiet fail!");
69 [ # # ]: 0 : pWindow = mpDlg->GetWindow();
70 : 0 : ((MyStruct*)pImp)->bVisible = sal_False;
71 : :
72 : 0 : Window* pTopWindow = 0;
73 [ # # ][ # # ]: 0 : if ( pInfo->aSize.Width() != 0 && pInfo->aSize.Height() != 0 &&
[ # # ][ # # ]
[ # # ]
74 [ # # ]: 0 : (0 != (pTopWindow = SFX_APP()->GetTopWindow())))
75 : : {
76 [ # # ]: 0 : Size aParentSize( pTopWindow->GetSizePixel() );
77 [ # # ]: 0 : Size aDlgSize ( GetSizePixel () );
78 : :
79 [ # # ]: 0 : if( aParentSize.Width() < pInfo->aPos.X() )
80 : 0 : pInfo->aPos.setX( aParentSize.Width()-aDlgSize.Width() < long(0.1*aParentSize.Width()) ?
81 [ # # ]: 0 : long(0.1*aParentSize.Width()) : aParentSize.Width()-aDlgSize.Width() );
82 [ # # ]: 0 : if( aParentSize.Height() < pInfo->aPos. Y() )
83 : 0 : pInfo->aPos.setY( aParentSize.Height()-aDlgSize.Height() < long(0.1*aParentSize.Height()) ?
84 [ # # ]: 0 : long(0.1*aParentSize.Height()) : aParentSize.Height()-aDlgSize.Height() );
85 : :
86 [ # # ]: 0 : pWindow->SetPosPixel( pInfo->aPos );
87 : : }
88 : :
89 : 0 : eChildAlignment = SFX_ALIGN_NOALIGNMENT;
90 : :
91 [ # # ]: 0 : SetHideNotDelete( sal_True );
92 : 0 : }
93 : :
94 : 0 : SfxChildWinInfo SvxHlinkDlgWrapper::GetInfo() const
95 : : {
96 : 0 : return SfxChildWindow::GetInfo();
97 : : }
98 : :
99 : 0 : sal_Bool SvxHlinkDlgWrapper::QueryClose()
100 : : {
101 [ # # ]: 0 : return mpDlg ? mpDlg->QueryClose() : sal_True;
102 : : }
103 : :
104 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|