xref: /aoo41x/main/sw/source/ui/fldui/fldtdlg.cxx (revision efeef26f)
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
10*efeef26fSAndrew Rist  *
11*efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*efeef26fSAndrew Rist  *
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.
19*efeef26fSAndrew Rist  *
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 #ifdef SW_DLLIMPLEMENTATION
28cdf0e10cSrcweir #undef SW_DLLIMPLEMENTATION
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir 
31cdf0e10cSrcweir 
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #ifndef _CMDID_H
34cdf0e10cSrcweir #include <cmdid.h>
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #include <swtypes.hxx>
37cdf0e10cSrcweir #include <unotools/confignode.hxx>
38cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
39cdf0e10cSrcweir #include <sfx2/basedlgs.hxx>
40cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
41cdf0e10cSrcweir #include <vcl/msgbox.hxx>
42cdf0e10cSrcweir #include <svx/htmlmode.hxx>
43cdf0e10cSrcweir #include <viewopt.hxx>
44cdf0e10cSrcweir #include <docsh.hxx>
45cdf0e10cSrcweir #include <fldwrap.hxx>
46cdf0e10cSrcweir #include <flddb.hxx>
47cdf0e10cSrcweir #include <flddinf.hxx>
48cdf0e10cSrcweir #include <fldvar.hxx>
49cdf0e10cSrcweir #include <flddok.hxx>
50cdf0e10cSrcweir #include <fldfunc.hxx>
51cdf0e10cSrcweir #include <fldref.hxx>
52cdf0e10cSrcweir #include <wrtsh.hxx>
53cdf0e10cSrcweir #include <view.hxx>
54cdf0e10cSrcweir #include <fldtdlg.hxx>
55cdf0e10cSrcweir #include <swmodule.hxx>
56cdf0e10cSrcweir 
57cdf0e10cSrcweir #include <helpid.h>
58cdf0e10cSrcweir #include <fldui.hrc>
59cdf0e10cSrcweir #include <globals.hrc>
60cdf0e10cSrcweir #include <fldtdlg.hrc>
61cdf0e10cSrcweir 
62cdf0e10cSrcweir #include <com/sun/star/document/XDocumentProperties.hpp>
63cdf0e10cSrcweir #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 
66cdf0e10cSrcweir /*--------------------------------------------------------------------
67cdf0e10cSrcweir 	Beschreibung:	Der Traeger des Dialoges
68cdf0e10cSrcweir  --------------------------------------------------------------------*/
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 
SwFldDlg(SfxBindings * pB,SwChildWinWrapper * pCW,Window * pParent)71cdf0e10cSrcweir SwFldDlg::SwFldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, Window *pParent)
72cdf0e10cSrcweir 	: SfxTabDialog( pParent, SW_RES( DLG_FLD_INSERT )),
73cdf0e10cSrcweir     m_pChildWin(pCW),
74cdf0e10cSrcweir     m_pBindings(pB),
75cdf0e10cSrcweir     m_bDataBaseMode(sal_False)
76cdf0e10cSrcweir {
77cdf0e10cSrcweir 	SetStyle(GetStyle()|WB_STDMODELESS);
78cdf0e10cSrcweir     m_bHtmlMode = (::GetHtmlMode((SwDocShell*)SfxObjectShell::Current()) & HTMLMODE_ON) != 0;
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	RemoveResetButton();
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 	GetOKButton().SetText(String(SW_RES(STR_FLD_INSERT)));
83cdf0e10cSrcweir 	GetOKButton().SetHelpId(HID_FIELD_INSERT);
84cdf0e10cSrcweir 	GetOKButton().SetHelpText(aEmptyStr);	// Damit generierter Hilfetext verwendet wird
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	GetCancelButton().SetText(String(SW_RES(STR_FLD_CLOSE)));
87cdf0e10cSrcweir 	GetCancelButton().SetHelpId(HID_FIELD_CLOSE);
88cdf0e10cSrcweir 	GetCancelButton().SetHelpText(aEmptyStr);	// Damit generierter Hilfetext verwendet wird
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 	FreeResource();
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 	GetOKButton().SetClickHdl(LINK(this, SwFldDlg, OKHdl));
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 	AddTabPage(TP_FLD_DOK, SwFldDokPage::Create, 0);
95cdf0e10cSrcweir 	AddTabPage(TP_FLD_VAR, SwFldVarPage::Create, 0);
96cdf0e10cSrcweir 	AddTabPage(TP_FLD_DOKINF, SwFldDokInfPage::Create, 0);
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     if (!m_bHtmlMode)
99cdf0e10cSrcweir 	{
100cdf0e10cSrcweir 		AddTabPage(TP_FLD_REF, SwFldRefPage::Create, 0);
101cdf0e10cSrcweir 		AddTabPage(TP_FLD_FUNC, SwFldFuncPage::Create, 0);
102cdf0e10cSrcweir 
103cdf0e10cSrcweir         utl::OConfigurationTreeRoot aCfgRoot
104cdf0e10cSrcweir             = utl::OConfigurationTreeRoot::createWithServiceFactory(
105cdf0e10cSrcweir                 ::comphelper::getProcessServiceFactory(),
106cdf0e10cSrcweir                 rtl::OUString(
107cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
108cdf0e10cSrcweir                         "/org.openoffice.Office.DataAccess/Policies/Features/Writer" ) ),
109cdf0e10cSrcweir                 -1,
110cdf0e10cSrcweir                 utl::OConfigurationTreeRoot::CM_READONLY);
111cdf0e10cSrcweir 
112cdf0e10cSrcweir         sal_Bool bDatabaseFields = sal_True;
113cdf0e10cSrcweir         aCfgRoot.getNodeValue(
114cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DatabaseFields"))) >>= bDatabaseFields;
115cdf0e10cSrcweir 
116cdf0e10cSrcweir         if (bDatabaseFields)
117cdf0e10cSrcweir             AddTabPage(TP_FLD_DB, SwFldDBPage::Create, 0);
118cdf0e10cSrcweir         else
119cdf0e10cSrcweir             RemoveTabPage(TP_FLD_DB);
120cdf0e10cSrcweir 	}
121cdf0e10cSrcweir 	else
122cdf0e10cSrcweir 	{
123cdf0e10cSrcweir 		RemoveTabPage(TP_FLD_REF);
124cdf0e10cSrcweir 		RemoveTabPage(TP_FLD_FUNC);
125cdf0e10cSrcweir 		RemoveTabPage(TP_FLD_DB);
126cdf0e10cSrcweir 	}
127cdf0e10cSrcweir }
128cdf0e10cSrcweir 
129cdf0e10cSrcweir /*--------------------------------------------------------------------
130cdf0e10cSrcweir 	Beschreibung:
131cdf0e10cSrcweir  --------------------------------------------------------------------*/
132cdf0e10cSrcweir 
~SwFldDlg()133cdf0e10cSrcweir SwFldDlg::~SwFldDlg()
134cdf0e10cSrcweir {
135cdf0e10cSrcweir }
136cdf0e10cSrcweir 
137cdf0e10cSrcweir /*--------------------------------------------------------------------
138cdf0e10cSrcweir 	Beschreibung:
139cdf0e10cSrcweir  --------------------------------------------------------------------*/
140cdf0e10cSrcweir 
Close()141cdf0e10cSrcweir sal_Bool SwFldDlg::Close()
142cdf0e10cSrcweir {
143cdf0e10cSrcweir     m_pBindings->GetDispatcher()->
144cdf0e10cSrcweir         Execute(m_bDataBaseMode ? FN_INSERT_FIELD_DATA_ONLY : FN_INSERT_FIELD,
145cdf0e10cSrcweir         SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD);
146cdf0e10cSrcweir 	return sal_True;
147cdf0e10cSrcweir }
148cdf0e10cSrcweir 
149cdf0e10cSrcweir /*--------------------------------------------------------------------
150cdf0e10cSrcweir 	Beschreibung:
151cdf0e10cSrcweir  --------------------------------------------------------------------*/
152cdf0e10cSrcweir 
Initialize(SfxChildWinInfo * pInfo)153cdf0e10cSrcweir void SwFldDlg::Initialize(SfxChildWinInfo *pInfo)
154cdf0e10cSrcweir {
155cdf0e10cSrcweir 	Point aPos;
156cdf0e10cSrcweir 	Size aSize;
157cdf0e10cSrcweir 
158cdf0e10cSrcweir 	if ( pInfo->aSize.Width() != 0 && pInfo->aSize.Height() != 0 )
159cdf0e10cSrcweir 	{
160cdf0e10cSrcweir 		aPos = pInfo->aPos;
161cdf0e10cSrcweir 		if ( GetStyle() & WB_SIZEABLE )
162cdf0e10cSrcweir 			SetSizePixel( pInfo->aSize );
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 		// Initiale Gr"o\se aus pInfo merken
165cdf0e10cSrcweir 		aSize = GetSizePixel();
166cdf0e10cSrcweir 
167cdf0e10cSrcweir 		// Soll das FloatingWindow eingezoomt werden ?
168cdf0e10cSrcweir 		if ( pInfo->nFlags & SFX_CHILDWIN_ZOOMIN )
169cdf0e10cSrcweir 			RollUp();
170cdf0e10cSrcweir 	}
171cdf0e10cSrcweir 	else
172cdf0e10cSrcweir 	{
173cdf0e10cSrcweir 		// Initiale Gr"o\se aus Resource oder ctor merken
174cdf0e10cSrcweir 		aSize = GetSizePixel();
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 		Size aParentSize = GetParent()->GetOutputSizePixel();
177cdf0e10cSrcweir 		aPos.X() += ( aParentSize.Width() - aSize.Width() ) / 2;
178cdf0e10cSrcweir 		aPos.Y() += ( aParentSize.Height() - aSize.Height() ) / 2;
179cdf0e10cSrcweir 	}
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 	Point aPoint;
182cdf0e10cSrcweir 	Rectangle aRect = GetDesktopRectPixel();
183cdf0e10cSrcweir 	aPoint.X() = aRect.Right() - aSize.Width();
184cdf0e10cSrcweir 	aPoint.Y() = aRect.Bottom() - aSize.Height();
185cdf0e10cSrcweir 
186cdf0e10cSrcweir 	aPoint = OutputToScreenPixel( aPoint );
187cdf0e10cSrcweir 
188cdf0e10cSrcweir 	if ( aPos.X() > aPoint.X() )
189cdf0e10cSrcweir 		aPos.X() = aPoint.X() ;
190cdf0e10cSrcweir 	if ( aPos.Y() > aPoint.Y() )
191cdf0e10cSrcweir 		aPos.Y() = aPoint.Y();
192cdf0e10cSrcweir 
193cdf0e10cSrcweir 	if ( aPos.X() < 0 ) aPos.X() = 0;
194cdf0e10cSrcweir 	if ( aPos.Y() < 0 ) aPos.Y() = 0;
195cdf0e10cSrcweir 
196cdf0e10cSrcweir 	SetPosPixel( aPos );
197cdf0e10cSrcweir }
198cdf0e10cSrcweir 
199cdf0e10cSrcweir /*--------------------------------------------------------------------
200cdf0e10cSrcweir 	Beschreibung:
201cdf0e10cSrcweir  --------------------------------------------------------------------*/
202cdf0e10cSrcweir 
CreateInputItemSet(sal_uInt16 nID)203cdf0e10cSrcweir SfxItemSet* SwFldDlg::CreateInputItemSet( sal_uInt16 nID  )
204cdf0e10cSrcweir {
205cdf0e10cSrcweir 	if ( nID == TP_FLD_DOKINF )
206cdf0e10cSrcweir 	{
207cdf0e10cSrcweir 		SwDocShell* pDocSh = (SwDocShell*)SfxObjectShell::Current();
208cdf0e10cSrcweir 		SfxItemSet* pISet = new SfxItemSet( pDocSh->GetPool(), SID_DOCINFO, SID_DOCINFO );
209cdf0e10cSrcweir         using namespace ::com::sun::star;
210cdf0e10cSrcweir         uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
211cdf0e10cSrcweir             pDocSh->GetModel(), uno::UNO_QUERY_THROW);
212cdf0e10cSrcweir         uno::Reference<document::XDocumentProperties> xDocProps
213cdf0e10cSrcweir             = xDPS->getDocumentProperties();
214cdf0e10cSrcweir         uno::Reference< beans::XPropertySet > xUDProps(
215cdf0e10cSrcweir             xDocProps->getUserDefinedProperties(),
216cdf0e10cSrcweir             uno::UNO_QUERY_THROW);
217cdf0e10cSrcweir         pISet->Put( SfxUnoAnyItem( SID_DOCINFO, uno::makeAny(xUDProps) ) );
218cdf0e10cSrcweir 		return pISet;
219cdf0e10cSrcweir 	}
220cdf0e10cSrcweir 	else
221cdf0e10cSrcweir 		return 0;
222cdf0e10cSrcweir }
223cdf0e10cSrcweir 
224cdf0e10cSrcweir /*--------------------------------------------------------------------
225cdf0e10cSrcweir 	 Beschreibung: Einfuegen von neuen Feldern anstossen
226cdf0e10cSrcweir  --------------------------------------------------------------------*/
227cdf0e10cSrcweir 
IMPL_LINK(SwFldDlg,OKHdl,Button *,EMPTYARG)228cdf0e10cSrcweir IMPL_LINK( SwFldDlg, OKHdl, Button *, EMPTYARG )
229cdf0e10cSrcweir {
230cdf0e10cSrcweir 	if (GetOKButton().IsEnabled())
231cdf0e10cSrcweir 	{
232cdf0e10cSrcweir 		SfxTabPage*	pPage = GetTabPage(GetCurPageId());
233cdf0e10cSrcweir 		pPage->FillItemSet(*(SfxItemSet*)0);
234cdf0e10cSrcweir 
235cdf0e10cSrcweir 		GetOKButton().GrabFocus();	// Wegen InputField-Dlg
236cdf0e10cSrcweir 	}
237cdf0e10cSrcweir 
238cdf0e10cSrcweir 	return 0;
239cdf0e10cSrcweir }
240cdf0e10cSrcweir 
241cdf0e10cSrcweir /*--------------------------------------------------------------------
242cdf0e10cSrcweir 	Beschreibung: Nach Dok-Wechsel Dialog neu initialisieren
243cdf0e10cSrcweir  --------------------------------------------------------------------*/
244cdf0e10cSrcweir 
ReInitDlg()245cdf0e10cSrcweir void SwFldDlg::ReInitDlg()
246cdf0e10cSrcweir {
247cdf0e10cSrcweir 	SwDocShell* pDocSh = (SwDocShell*)SfxObjectShell::Current();
248cdf0e10cSrcweir 	sal_Bool bNewMode = (::GetHtmlMode(pDocSh) & HTMLMODE_ON) != 0;
249cdf0e10cSrcweir 
250cdf0e10cSrcweir     if (bNewMode != m_bHtmlMode)
251cdf0e10cSrcweir 	{
252cdf0e10cSrcweir 		SfxViewFrame::Current()->GetDispatcher()->
253cdf0e10cSrcweir 			Execute(FN_INSERT_FIELD, SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD);
254cdf0e10cSrcweir 		Close();
255cdf0e10cSrcweir 	}
256cdf0e10cSrcweir 
257cdf0e10cSrcweir 	SwView* pActiveView = ::GetActiveView();
258cdf0e10cSrcweir 	if(!pActiveView)
259cdf0e10cSrcweir 		return;
260cdf0e10cSrcweir 	const SwWrtShell& rSh = pActiveView->GetWrtShell();
261cdf0e10cSrcweir 	GetOKButton().Enable( !rSh.IsReadOnlyAvailable() ||
262cdf0e10cSrcweir 						  !rSh.HasReadonlySel() );
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 	ReInitTabPage(TP_FLD_DOK);
265cdf0e10cSrcweir 	ReInitTabPage(TP_FLD_VAR);
266cdf0e10cSrcweir 	ReInitTabPage(TP_FLD_DOKINF);
267cdf0e10cSrcweir 
268cdf0e10cSrcweir     if (!m_bHtmlMode)
269cdf0e10cSrcweir 	{
270cdf0e10cSrcweir 		ReInitTabPage(TP_FLD_REF);
271cdf0e10cSrcweir 		ReInitTabPage(TP_FLD_FUNC);
272cdf0e10cSrcweir 		ReInitTabPage(TP_FLD_DB);
273cdf0e10cSrcweir 	}
274cdf0e10cSrcweir 
275cdf0e10cSrcweir     m_pChildWin->SetOldDocShell(pDocSh);
276cdf0e10cSrcweir }
277cdf0e10cSrcweir 
278cdf0e10cSrcweir /*--------------------------------------------------------------------
279cdf0e10cSrcweir 	Beschreibung: Nach Dok-Wechsel TabPage neu initialisieren
280cdf0e10cSrcweir  --------------------------------------------------------------------*/
281cdf0e10cSrcweir 
ReInitTabPage(sal_uInt16 nPageId,sal_Bool bOnlyActivate)282cdf0e10cSrcweir void SwFldDlg::ReInitTabPage( sal_uInt16 nPageId, sal_Bool bOnlyActivate )
283cdf0e10cSrcweir {
284cdf0e10cSrcweir 	SwFldPage* pPage = (SwFldPage* )GetTabPage(nPageId);
285cdf0e10cSrcweir 
286cdf0e10cSrcweir 	if ( pPage )
287cdf0e10cSrcweir 		pPage->EditNewField( bOnlyActivate );	// TabPage neu initialisieren
288cdf0e10cSrcweir }
289cdf0e10cSrcweir 
290cdf0e10cSrcweir /*--------------------------------------------------------------------
291cdf0e10cSrcweir 	Beschreibung: Nach Aktivierung einige TabPages neu initialisieren
292cdf0e10cSrcweir  --------------------------------------------------------------------*/
293cdf0e10cSrcweir 
Activate()294cdf0e10cSrcweir void SwFldDlg::Activate()
295cdf0e10cSrcweir {
296cdf0e10cSrcweir 	SwView* pView = ::GetActiveView();
297cdf0e10cSrcweir 	if( pView )
298cdf0e10cSrcweir 	{
299cdf0e10cSrcweir 		sal_Bool bHtmlMode = (::GetHtmlMode((SwDocShell*)SfxObjectShell::Current()) & HTMLMODE_ON) != 0;
300cdf0e10cSrcweir 		const SwWrtShell& rSh = pView->GetWrtShell();
301cdf0e10cSrcweir 		GetOKButton().Enable( !rSh.IsReadOnlyAvailable() ||
302cdf0e10cSrcweir 						  	!rSh.HasReadonlySel() );
303cdf0e10cSrcweir 
304cdf0e10cSrcweir 		ReInitTabPage( TP_FLD_VAR, sal_True );
305cdf0e10cSrcweir 
306cdf0e10cSrcweir 		if( !bHtmlMode )
307cdf0e10cSrcweir 		{
308cdf0e10cSrcweir 			ReInitTabPage( TP_FLD_REF, sal_True );
309cdf0e10cSrcweir 			ReInitTabPage( TP_FLD_FUNC, sal_True );
310cdf0e10cSrcweir 		}
311cdf0e10cSrcweir 	}
312cdf0e10cSrcweir }
313cdf0e10cSrcweir 
314cdf0e10cSrcweir /*--------------------------------------------------------------------
315cdf0e10cSrcweir 	Beschreibung:
316cdf0e10cSrcweir  --------------------------------------------------------------------*/
317cdf0e10cSrcweir 
EnableInsert(sal_Bool bEnable)318cdf0e10cSrcweir void SwFldDlg::EnableInsert(sal_Bool bEnable)
319cdf0e10cSrcweir {
320cdf0e10cSrcweir 	if( bEnable )
321cdf0e10cSrcweir 	{
322cdf0e10cSrcweir 		SwView* pView = ::GetActiveView();
323cdf0e10cSrcweir 		DBG_ASSERT(pView, "no view found");
324cdf0e10cSrcweir 		if( !pView ||
325cdf0e10cSrcweir 				(pView->GetWrtShell().IsReadOnlyAvailable() &&
326cdf0e10cSrcweir 					pView->GetWrtShell().HasReadonlySel()) )
327cdf0e10cSrcweir 			bEnable = sal_False;
328cdf0e10cSrcweir 	}
329cdf0e10cSrcweir 	GetOKButton().Enable(bEnable);
330cdf0e10cSrcweir }
331cdf0e10cSrcweir 
332cdf0e10cSrcweir /*--------------------------------------------------------------------
333cdf0e10cSrcweir 	Beschreibung:
334cdf0e10cSrcweir  --------------------------------------------------------------------*/
335cdf0e10cSrcweir 
InsertHdl()336cdf0e10cSrcweir void SwFldDlg::InsertHdl()
337cdf0e10cSrcweir {
338cdf0e10cSrcweir 	GetOKButton().Click();
339cdf0e10cSrcweir }
340cdf0e10cSrcweir /* -----------------27.11.2002 15:24-----------------
341cdf0e10cSrcweir  *
342cdf0e10cSrcweir  * --------------------------------------------------*/
ActivateDatabasePage()343cdf0e10cSrcweir void SwFldDlg::ActivateDatabasePage()
344cdf0e10cSrcweir {
345cdf0e10cSrcweir     m_bDataBaseMode = sal_True;
346cdf0e10cSrcweir     ShowPage( TP_FLD_DB );
347cdf0e10cSrcweir     SfxTabPage* pDBPage =  GetTabPage( TP_FLD_DB );
348cdf0e10cSrcweir     if( pDBPage )
349cdf0e10cSrcweir     {
350cdf0e10cSrcweir         ((SwFldDBPage*)pDBPage)->ActivateMailMergeAddress();
351cdf0e10cSrcweir     }
352cdf0e10cSrcweir     //remove all other pages
353cdf0e10cSrcweir     RemoveTabPage(TP_FLD_DOK);
354cdf0e10cSrcweir     RemoveTabPage(TP_FLD_VAR);
355cdf0e10cSrcweir     RemoveTabPage(TP_FLD_DOKINF);
356cdf0e10cSrcweir     RemoveTabPage(TP_FLD_REF);
357cdf0e10cSrcweir     RemoveTabPage(TP_FLD_FUNC);
358cdf0e10cSrcweir }
359cdf0e10cSrcweir /*-- 07.10.2003 14:01:44---------------------------------------------------
360cdf0e10cSrcweir 
361cdf0e10cSrcweir   -----------------------------------------------------------------------*/
PageCreated(sal_uInt16 nId,SfxTabPage & rPage)362cdf0e10cSrcweir void SwFldDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage)
363cdf0e10cSrcweir {
364cdf0e10cSrcweir     if( TP_FLD_DB == nId)
365cdf0e10cSrcweir     {
366cdf0e10cSrcweir         SfxDispatcher* pDispatch = m_pBindings->GetDispatcher();
367cdf0e10cSrcweir         SfxViewFrame* pViewFrame = pDispatch ? pDispatch->GetFrame() : 0;
368cdf0e10cSrcweir         if(pViewFrame)
369cdf0e10cSrcweir         {
370cdf0e10cSrcweir             const TypeId aSwViewTypeId = TYPE(SwView);
371cdf0e10cSrcweir             SfxViewShell* pViewShell = SfxViewShell::GetFirst( &aSwViewTypeId );
372cdf0e10cSrcweir             while(pViewShell && pViewShell->GetViewFrame() != pViewFrame)
373cdf0e10cSrcweir             {
374cdf0e10cSrcweir                 pViewShell = SfxViewShell::GetNext( *pViewShell, &aSwViewTypeId );
375cdf0e10cSrcweir             }
376cdf0e10cSrcweir             if(pViewShell)
377cdf0e10cSrcweir                 static_cast<SwFldDBPage&>(rPage).SetWrtShell(static_cast<SwView*>(pViewShell)->GetWrtShell());
378cdf0e10cSrcweir         }
379cdf0e10cSrcweir     }
380cdf0e10cSrcweir }
381cdf0e10cSrcweir 
382cdf0e10cSrcweir 
383