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