1*efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*efeef26fSAndrew Rist * distributed with this work for additional information
6*efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*efeef26fSAndrew Rist * "License"); you may not use this file except in compliance
9*efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11*efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13*efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*efeef26fSAndrew Rist * software distributed under the License is distributed on an
15*efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*efeef26fSAndrew Rist * KIND, either express or implied. See the License for the
17*efeef26fSAndrew Rist * specific language governing permissions and limitations
18*efeef26fSAndrew Rist * under the License.
19cdf0e10cSrcweir *
20*efeef26fSAndrew Rist *************************************************************/
21*efeef26fSAndrew Rist
22*efeef26fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir
28cdf0e10cSrcweir
29cdf0e10cSrcweir #ifndef _CMDID_H
30cdf0e10cSrcweir #include <cmdid.h>
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #include <swtypes.hxx>
33cdf0e10cSrcweir #include <sfx2/basedlgs.hxx>
34cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
35cdf0e10cSrcweir #include <vcl/msgbox.hxx>
36cdf0e10cSrcweir #include <svx/htmlmode.hxx>
37cdf0e10cSrcweir #include <viewopt.hxx>
38cdf0e10cSrcweir #ifndef _DOCSH_HXX
39cdf0e10cSrcweir #include <docsh.hxx>
40cdf0e10cSrcweir #endif
41cdf0e10cSrcweir #include <fldwrap.hxx>
42cdf0e10cSrcweir #include <wrtsh.hxx>
43cdf0e10cSrcweir #include <view.hxx>
44cdf0e10cSrcweir #include <swmodule.hxx>
45cdf0e10cSrcweir
46cdf0e10cSrcweir #ifndef _HELPID_H
47cdf0e10cSrcweir #include <helpid.h>
48cdf0e10cSrcweir #endif
49cdf0e10cSrcweir #ifndef _FLDUI_HRC
50cdf0e10cSrcweir #include <fldui.hrc>
51cdf0e10cSrcweir #endif
52cdf0e10cSrcweir #ifndef _GLOBALS_HRC
53cdf0e10cSrcweir #include <globals.hrc>
54cdf0e10cSrcweir #endif
55cdf0e10cSrcweir #ifndef _FLDTDLG_HRC
56cdf0e10cSrcweir #include <fldtdlg.hrc>
57cdf0e10cSrcweir #endif
58cdf0e10cSrcweir #include "swabstdlg.hxx"
59cdf0e10cSrcweir
SFX_IMPL_CHILDWINDOW(SwFldDlgWrapper,FN_INSERT_FIELD)60cdf0e10cSrcweir SFX_IMPL_CHILDWINDOW(SwFldDlgWrapper, FN_INSERT_FIELD)
61cdf0e10cSrcweir
62cdf0e10cSrcweir /*--------------------------------------------------------------------
63cdf0e10cSrcweir Beschreibung:
64cdf0e10cSrcweir --------------------------------------------------------------------*/
65cdf0e10cSrcweir
66cdf0e10cSrcweir SwChildWinWrapper::SwChildWinWrapper(Window *pParentWindow, sal_uInt16 nId) :
67cdf0e10cSrcweir SfxChildWindow(pParentWindow, nId),
68cdf0e10cSrcweir m_pDocSh(0)
69cdf0e10cSrcweir {
70cdf0e10cSrcweir // Flackern der Buttons vermeiden:
71cdf0e10cSrcweir m_aUpdateTimer.SetTimeout(200);
72cdf0e10cSrcweir m_aUpdateTimer.SetTimeoutHdl(LINK(this, SwChildWinWrapper, UpdateHdl));
73cdf0e10cSrcweir }
74cdf0e10cSrcweir
75cdf0e10cSrcweir /*--------------------------------------------------------------------
76cdf0e10cSrcweir Beschreibung:
77cdf0e10cSrcweir --------------------------------------------------------------------*/
78cdf0e10cSrcweir
IMPL_LINK(SwChildWinWrapper,UpdateHdl,void *,EMPTYARG)79cdf0e10cSrcweir IMPL_LINK( SwChildWinWrapper, UpdateHdl, void*, EMPTYARG )
80cdf0e10cSrcweir {
81cdf0e10cSrcweir GetWindow()->Activate(); // Dialog aktualisieren
82cdf0e10cSrcweir
83cdf0e10cSrcweir return 0;
84cdf0e10cSrcweir }
85cdf0e10cSrcweir
86cdf0e10cSrcweir /*--------------------------------------------------------------------
87cdf0e10cSrcweir Beschreibung: Nach Dok-Wechsel Dialog neu initialisieren
88cdf0e10cSrcweir --------------------------------------------------------------------*/
89cdf0e10cSrcweir
ReInitDlg(SwDocShell *)90cdf0e10cSrcweir sal_Bool SwChildWinWrapper::ReInitDlg(SwDocShell *)
91cdf0e10cSrcweir {
92cdf0e10cSrcweir sal_Bool bRet = sal_False;
93cdf0e10cSrcweir
94cdf0e10cSrcweir if (m_pDocSh != GetOldDocShell())
95cdf0e10cSrcweir {
96cdf0e10cSrcweir m_aUpdateTimer.Stop();
97cdf0e10cSrcweir bRet = sal_True; // Sofortiges Update
98cdf0e10cSrcweir }
99cdf0e10cSrcweir else
100cdf0e10cSrcweir m_aUpdateTimer.Start();
101cdf0e10cSrcweir
102cdf0e10cSrcweir return bRet;
103cdf0e10cSrcweir }
104cdf0e10cSrcweir
105cdf0e10cSrcweir /*--------------------------------------------------------------------
106cdf0e10cSrcweir Beschreibung:
107cdf0e10cSrcweir --------------------------------------------------------------------*/
108cdf0e10cSrcweir
GetInfo() const109cdf0e10cSrcweir SfxChildWinInfo SwFldDlgWrapper::GetInfo() const
110cdf0e10cSrcweir {
111cdf0e10cSrcweir SfxChildWinInfo aInfo = SfxChildWindow::GetInfo();
112cdf0e10cSrcweir aInfo.aPos = GetWindow()->OutputToAbsoluteScreenPixel(aInfo.aPos);
113cdf0e10cSrcweir return aInfo;
114cdf0e10cSrcweir }
115cdf0e10cSrcweir
116cdf0e10cSrcweir
117cdf0e10cSrcweir /*--------------------------------------------------------------------
118cdf0e10cSrcweir Beschreibung:
119cdf0e10cSrcweir --------------------------------------------------------------------*/
120cdf0e10cSrcweir
SwFldDlgWrapper(Window * _pParent,sal_uInt16 nId,SfxBindings * pB,SfxChildWinInfo *)121cdf0e10cSrcweir SwFldDlgWrapper::SwFldDlgWrapper( Window* _pParent, sal_uInt16 nId,
122cdf0e10cSrcweir SfxBindings* pB,
123cdf0e10cSrcweir SfxChildWinInfo* )
124cdf0e10cSrcweir : SwChildWinWrapper( _pParent, nId )
125cdf0e10cSrcweir {
126cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
127cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
128cdf0e10cSrcweir
129cdf0e10cSrcweir AbstractSwFldDlg* pDlg = pFact->CreateSwFldDlg(pB, this, _pParent, DLG_FLD_INSERT );
130cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");
131cdf0e10cSrcweir pDlgInterface = pDlg;
132cdf0e10cSrcweir pWindow = pDlg->GetWindow();
133cdf0e10cSrcweir pDlg->Start();
134cdf0e10cSrcweir eChildAlignment = SFX_ALIGN_NOALIGNMENT;
135cdf0e10cSrcweir }
136cdf0e10cSrcweir
137cdf0e10cSrcweir /*--------------------------------------------------------------------
138cdf0e10cSrcweir Beschreibung: Nach Dok-Wechsel Dialog neu initialisieren
139cdf0e10cSrcweir --------------------------------------------------------------------*/
140cdf0e10cSrcweir
ReInitDlg(SwDocShell * pDocSh)141cdf0e10cSrcweir sal_Bool SwFldDlgWrapper::ReInitDlg(SwDocShell *pDocSh)
142cdf0e10cSrcweir {
143cdf0e10cSrcweir sal_Bool bRet;
144cdf0e10cSrcweir
145cdf0e10cSrcweir if ((bRet = SwChildWinWrapper::ReInitDlg(pDocSh)) == sal_True) // Sofort aktualisieren, Dok-Wechsel
146cdf0e10cSrcweir {
147cdf0e10cSrcweir pDlgInterface->ReInitDlg();
148cdf0e10cSrcweir }
149cdf0e10cSrcweir
150cdf0e10cSrcweir return bRet;
151cdf0e10cSrcweir }
152cdf0e10cSrcweir
153cdf0e10cSrcweir /*--------------------------------------------------------------------
154cdf0e10cSrcweir Beschreibung:
155cdf0e10cSrcweir --------------------------------------------------------------------*/
156cdf0e10cSrcweir
ShowPage(sal_uInt16 nPage)157cdf0e10cSrcweir void SwFldDlgWrapper::ShowPage(sal_uInt16 nPage)
158cdf0e10cSrcweir {
159cdf0e10cSrcweir pDlgInterface->ShowPage(nPage ? nPage : TP_FLD_REF);
160cdf0e10cSrcweir }
161cdf0e10cSrcweir
SFX_IMPL_CHILDWINDOW(SwFldDataOnlyDlgWrapper,FN_INSERT_FIELD_DATA_ONLY)162cdf0e10cSrcweir SFX_IMPL_CHILDWINDOW(SwFldDataOnlyDlgWrapper, FN_INSERT_FIELD_DATA_ONLY)
163cdf0e10cSrcweir
164cdf0e10cSrcweir /* -----------------04.02.2003 14:17-----------------
165cdf0e10cSrcweir *
166cdf0e10cSrcweir * --------------------------------------------------*/
167cdf0e10cSrcweir SfxChildWinInfo SwFldDataOnlyDlgWrapper::GetInfo() const
168cdf0e10cSrcweir {
169cdf0e10cSrcweir SfxChildWinInfo aInfo = SfxChildWindow::GetInfo();
170cdf0e10cSrcweir // prevent instatiation of dialog other than by calling
171cdf0e10cSrcweir // the mail merge dialog
172cdf0e10cSrcweir aInfo.bVisible = sal_False;
173cdf0e10cSrcweir return aInfo;
174cdf0e10cSrcweir }
175cdf0e10cSrcweir /* -----------------04.02.2003 14:17-----------------
176cdf0e10cSrcweir *
177cdf0e10cSrcweir * --------------------------------------------------*/
SwFldDataOnlyDlgWrapper(Window * _pParent,sal_uInt16 nId,SfxBindings * pB,SfxChildWinInfo * pInfo)178cdf0e10cSrcweir SwFldDataOnlyDlgWrapper::SwFldDataOnlyDlgWrapper( Window* _pParent, sal_uInt16 nId,
179cdf0e10cSrcweir SfxBindings* pB,
180cdf0e10cSrcweir SfxChildWinInfo* pInfo )
181cdf0e10cSrcweir : SwChildWinWrapper( _pParent, nId )
182cdf0e10cSrcweir {
183cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
184cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
185cdf0e10cSrcweir
186cdf0e10cSrcweir AbstractSwFldDlg* pDlg = pFact->CreateSwFldDlg(pB, this, _pParent, DLG_FLD_INSERT );
187cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");
188cdf0e10cSrcweir pDlgInterface = pDlg;
189cdf0e10cSrcweir
190cdf0e10cSrcweir pWindow = pDlg->GetWindow();
191cdf0e10cSrcweir pDlg->ActivateDatabasePage();
192cdf0e10cSrcweir pDlg->Start();
193cdf0e10cSrcweir pDlg->Initialize( pInfo );
194cdf0e10cSrcweir eChildAlignment = SFX_ALIGN_NOALIGNMENT;
195cdf0e10cSrcweir }
196cdf0e10cSrcweir /* -----------------04.02.2003 14:17-----------------
197cdf0e10cSrcweir * re-init after doc activation
198cdf0e10cSrcweir * --------------------------------------------------*/
ReInitDlg(SwDocShell * pDocSh)199cdf0e10cSrcweir sal_Bool SwFldDataOnlyDlgWrapper::ReInitDlg(SwDocShell *pDocSh)
200cdf0e10cSrcweir {
201cdf0e10cSrcweir sal_Bool bRet;
202cdf0e10cSrcweir if ((bRet = SwChildWinWrapper::ReInitDlg(pDocSh)) == sal_True) // Sofort aktualisieren, Dok-Wechsel
203cdf0e10cSrcweir {
204cdf0e10cSrcweir pDlgInterface->ReInitDlg();
205cdf0e10cSrcweir }
206cdf0e10cSrcweir
207cdf0e10cSrcweir return bRet;
208cdf0e10cSrcweir }
209