1*f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*f6e50924SAndrew Rist * distributed with this work for additional information
6*f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*f6e50924SAndrew Rist * "License"); you may not use this file except in compliance
9*f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11*f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13*f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*f6e50924SAndrew Rist * software distributed under the License is distributed on an
15*f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f6e50924SAndrew Rist * KIND, either express or implied. See the License for the
17*f6e50924SAndrew Rist * specific language governing permissions and limitations
18*f6e50924SAndrew Rist * under the License.
19cdf0e10cSrcweir *
20*f6e50924SAndrew Rist *************************************************************/
21*f6e50924SAndrew Rist
22*f6e50924SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir // include ---------------------------------------------------------------
28cdf0e10cSrcweir #include <vcl/settings.hxx>
29cdf0e10cSrcweir #include <unotools/viewoptions.hxx>
30cdf0e10cSrcweir #include "svx/hyperdlg.hxx"
31cdf0e10cSrcweir #include <svx/svxdlg.hxx> //CHINA001
32cdf0e10cSrcweir #include <sfx2/app.hxx>
33cdf0e10cSrcweir #include <sfx2/sfxsids.hrc>
34cdf0e10cSrcweir
35cdf0e10cSrcweir //########################################################################
36cdf0e10cSrcweir //# #
37cdf0e10cSrcweir //# Childwindow-Wrapper-Class #
38cdf0e10cSrcweir //# #
39cdf0e10cSrcweir //########################################################################
40cdf0e10cSrcweir
41cdf0e10cSrcweir SFX_IMPL_CHILDWINDOW(SvxHlinkDlgWrapper, SID_HYPERLINK_DIALOG)
42cdf0e10cSrcweir
43cdf0e10cSrcweir // -----------------------------------------------------------------------
44cdf0e10cSrcweir
45cdf0e10cSrcweir struct MyStruct
46cdf0e10cSrcweir {
47cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame;
48cdf0e10cSrcweir SfxChildWinFactory* pFact;
49cdf0e10cSrcweir sal_Bool bHideNotDelete;
50cdf0e10cSrcweir sal_Bool bVisible;
51cdf0e10cSrcweir sal_Bool bHideAtToggle;
52cdf0e10cSrcweir SfxModule* pContextModule;
53cdf0e10cSrcweir SfxWorkWindow* pWorkWin;
54cdf0e10cSrcweir };
55cdf0e10cSrcweir
SvxHlinkDlgWrapper(Window * _pParent,sal_uInt16 nId,SfxBindings * pBindings,SfxChildWinInfo * pInfo)56cdf0e10cSrcweir SvxHlinkDlgWrapper::SvxHlinkDlgWrapper( Window* _pParent, sal_uInt16 nId,
57cdf0e10cSrcweir SfxBindings* pBindings,
58cdf0e10cSrcweir SfxChildWinInfo* pInfo ) :
59cdf0e10cSrcweir SfxChildWindow( _pParent, nId ),
60cdf0e10cSrcweir
61cdf0e10cSrcweir mpDlg( NULL )
62cdf0e10cSrcweir
63cdf0e10cSrcweir {
64cdf0e10cSrcweir //CHINA001 pWindow = new SvxHpLinkDlg( _pParent, pBindings );
65cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
66cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
67cdf0e10cSrcweir mpDlg = pFact->CreateSvxHpLinkDlg( _pParent, pBindings, SID_HYPERLINK_DIALOG );
68cdf0e10cSrcweir DBG_ASSERT(mpDlg, "Dialogdiet fail!");//CHINA001
69cdf0e10cSrcweir pWindow = mpDlg->GetWindow();
70cdf0e10cSrcweir ((MyStruct*)pImp)->bVisible = sal_False;
71cdf0e10cSrcweir
72cdf0e10cSrcweir Window* pTopWindow = 0;
73cdf0e10cSrcweir if ( pInfo->aSize.Width() != 0 && pInfo->aSize.Height() != 0 &&
74cdf0e10cSrcweir (0 != (pTopWindow = SFX_APP()->GetTopWindow())))
75cdf0e10cSrcweir {
76cdf0e10cSrcweir Size aParentSize( pTopWindow->GetSizePixel() );
77cdf0e10cSrcweir Size aDlgSize ( GetSizePixel () );
78cdf0e10cSrcweir
79cdf0e10cSrcweir if( aParentSize.Width() < pInfo->aPos.X() )
80cdf0e10cSrcweir pInfo->aPos.setX( aParentSize.Width()-aDlgSize.Width() < long(0.1*aParentSize.Width()) ?
81cdf0e10cSrcweir long(0.1*aParentSize.Width()) : aParentSize.Width()-aDlgSize.Width() );
82cdf0e10cSrcweir if( aParentSize.Height() < pInfo->aPos. Y() )
83cdf0e10cSrcweir pInfo->aPos.setY( aParentSize.Height()-aDlgSize.Height() < long(0.1*aParentSize.Height()) ?
84cdf0e10cSrcweir long(0.1*aParentSize.Height()) : aParentSize.Height()-aDlgSize.Height() );
85cdf0e10cSrcweir
86cdf0e10cSrcweir pWindow->SetPosPixel( pInfo->aPos );
87cdf0e10cSrcweir }
88cdf0e10cSrcweir
89cdf0e10cSrcweir eChildAlignment = SFX_ALIGN_NOALIGNMENT;
90cdf0e10cSrcweir
91cdf0e10cSrcweir SetHideNotDelete( sal_True );
92cdf0e10cSrcweir }
93cdf0e10cSrcweir
GetInfo() const94cdf0e10cSrcweir SfxChildWinInfo SvxHlinkDlgWrapper::GetInfo() const
95cdf0e10cSrcweir {
96cdf0e10cSrcweir return SfxChildWindow::GetInfo();
97cdf0e10cSrcweir }
98cdf0e10cSrcweir
QueryClose()99cdf0e10cSrcweir sal_Bool SvxHlinkDlgWrapper::QueryClose()
100cdf0e10cSrcweir {
101cdf0e10cSrcweir return mpDlg ? mpDlg->QueryClose() : sal_True;
102cdf0e10cSrcweir }
103cdf0e10cSrcweir
104