xref: /aoo41x/main/sw/source/ui/uiview/view2.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sw.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <com/sun/star/util/SearchOptions.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/util/SearchFlags.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/i18n/TransliterationModules.hpp>
34*cdf0e10cSrcweir #include <svtools/filter.hxx>
35*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/ListboxControlActions.hpp>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #define _SVSTDARR_STRINGSSORTDTOR
40*cdf0e10cSrcweir #include <svl/svstdarr.hxx>
41*cdf0e10cSrcweir #include <svl/aeitem.hxx>
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir #include <SwStyleNameMapper.hxx>
44*cdf0e10cSrcweir #include <docary.hxx>
45*cdf0e10cSrcweir #include <hintids.hxx>
46*cdf0e10cSrcweir #include <SwRewriter.hxx>
47*cdf0e10cSrcweir #include <numrule.hxx>
48*cdf0e10cSrcweir #include <swundo.hxx>
49*cdf0e10cSrcweir #include <caption.hxx>
50*cdf0e10cSrcweir #include <svl/PasswordHelper.hxx>
51*cdf0e10cSrcweir #include <svl/urihelper.hxx>
52*cdf0e10cSrcweir #include <sfx2/passwd.hxx>
53*cdf0e10cSrcweir #include <sfx2/sfxdlg.hxx>
54*cdf0e10cSrcweir #include <sfx2/filedlghelper.hxx>
55*cdf0e10cSrcweir #include <sfx2/sfxhelp.hxx>
56*cdf0e10cSrcweir #include <editeng/langitem.hxx>
57*cdf0e10cSrcweir #include <svx/viewlayoutitem.hxx>
58*cdf0e10cSrcweir #include <svx/zoomslideritem.hxx>
59*cdf0e10cSrcweir #include <svtools/xwindowitem.hxx>
60*cdf0e10cSrcweir #include <svx/htmlmode.hxx>
61*cdf0e10cSrcweir #include <vcl/svapp.hxx>
62*cdf0e10cSrcweir #include <vcl/wrkwin.hxx>
63*cdf0e10cSrcweir #include <sfx2/app.hxx>
64*cdf0e10cSrcweir #include <sfx2/request.hxx>
65*cdf0e10cSrcweir #include <sfx2/bindings.hxx>
66*cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
67*cdf0e10cSrcweir #include <svtools/txtcmp.hxx>
68*cdf0e10cSrcweir #include "editeng/unolingu.hxx"
69*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
70*cdf0e10cSrcweir #include <editeng/tstpitem.hxx>
71*cdf0e10cSrcweir #include <sfx2/event.hxx>
72*cdf0e10cSrcweir #include <sfx2/docfile.hxx>
73*cdf0e10cSrcweir #include <sfx2/docfilt.hxx>
74*cdf0e10cSrcweir #include <sfx2/fcontnr.hxx>
75*cdf0e10cSrcweir #include <editeng/sizeitem.hxx>
76*cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
77*cdf0e10cSrcweir #include <svl/whiter.hxx>
78*cdf0e10cSrcweir #include <svl/ptitem.hxx>
79*cdf0e10cSrcweir #include <sfx2/linkmgr.hxx>
80*cdf0e10cSrcweir #include <tools/errinf.hxx>
81*cdf0e10cSrcweir #include <tools/urlobj.hxx>
82*cdf0e10cSrcweir #include <svx/svdview.hxx>
83*cdf0e10cSrcweir #include <swtypes.hxx>
84*cdf0e10cSrcweir #include <swwait.hxx>
85*cdf0e10cSrcweir #include <redlndlg.hxx>
86*cdf0e10cSrcweir #include <view.hxx>
87*cdf0e10cSrcweir #include <uivwimp.hxx>
88*cdf0e10cSrcweir #include <docsh.hxx>
89*cdf0e10cSrcweir #include <doc.hxx>
90*cdf0e10cSrcweir #include <IDocumentUndoRedo.hxx>
91*cdf0e10cSrcweir #include <wrtsh.hxx>
92*cdf0e10cSrcweir #include <viewopt.hxx>
93*cdf0e10cSrcweir #include <basesh.hxx>
94*cdf0e10cSrcweir #include <swmodule.hxx>
95*cdf0e10cSrcweir #include <uitool.hxx>
96*cdf0e10cSrcweir #include <shellio.hxx>
97*cdf0e10cSrcweir #include <fmtinfmt.hxx>
98*cdf0e10cSrcweir #include <mdiexp.hxx>
99*cdf0e10cSrcweir #include <drawbase.hxx>
100*cdf0e10cSrcweir #include <frmmgr.hxx>
101*cdf0e10cSrcweir #include <pagedesc.hxx>
102*cdf0e10cSrcweir #include <section.hxx>
103*cdf0e10cSrcweir #include <usrpref.hxx>
104*cdf0e10cSrcweir #include <IMark.hxx>
105*cdf0e10cSrcweir #include <navipi.hxx>
106*cdf0e10cSrcweir #include <tox.hxx>
107*cdf0e10cSrcweir #include <workctrl.hxx>
108*cdf0e10cSrcweir #include <scroll.hxx>
109*cdf0e10cSrcweir #include <edtwin.hxx>
110*cdf0e10cSrcweir #include <wview.hxx>
111*cdf0e10cSrcweir #include <textsh.hxx>
112*cdf0e10cSrcweir #include <tabsh.hxx>
113*cdf0e10cSrcweir #include <listsh.hxx>
114*cdf0e10cSrcweir #include <cmdid.h>
115*cdf0e10cSrcweir #include <comcore.hrc>
116*cdf0e10cSrcweir #include <poolfmt.hrc>
117*cdf0e10cSrcweir #include <statstr.hrc>
118*cdf0e10cSrcweir #include <swerror.h>
119*cdf0e10cSrcweir #include <globals.hrc>
120*cdf0e10cSrcweir #include <shells.hrc>
121*cdf0e10cSrcweir #include <web.hrc>
122*cdf0e10cSrcweir #include <view.hrc>
123*cdf0e10cSrcweir #include <app.hrc>
124*cdf0e10cSrcweir #include <fmtclds.hxx>
125*cdf0e10cSrcweir #include <helpid.h>
126*cdf0e10cSrcweir #include <svtools/templdlg.hxx>
127*cdf0e10cSrcweir #include <dbconfig.hxx>
128*cdf0e10cSrcweir #include <dbmgr.hxx>
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir #include <PostItMgr.hxx>
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir #include <ndtxt.hxx> //#outline level,added by zhaojianwei
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir #include <svx/svxdlg.hxx>
137*cdf0e10cSrcweir #include <svx/dialogs.hrc>
138*cdf0e10cSrcweir #include "swabstdlg.hxx"
139*cdf0e10cSrcweir #include "globals.hrc"
140*cdf0e10cSrcweir #include <envelp.hrc>
141*cdf0e10cSrcweir #include <fmthdft.hxx>
142*cdf0e10cSrcweir #include <svx/ofaitem.hxx>
143*cdf0e10cSrcweir #include <unomid.h>
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir const char __FAR_DATA sStatusDelim[] = " : ";
146*cdf0e10cSrcweir const char __FAR_DATA sStatusComma[] = " , ";//#outlinelevel, define a Variable for "," add by zhaojianwei
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir using ::rtl::OUString;
149*cdf0e10cSrcweir using namespace sfx2;
150*cdf0e10cSrcweir using namespace ::com::sun::star;
151*cdf0e10cSrcweir using namespace ::com::sun::star::i18n;
152*cdf0e10cSrcweir using namespace ::com::sun::star::util;
153*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
154*cdf0e10cSrcweir using namespace ::com::sun::star::lang;
155*cdf0e10cSrcweir using namespace ::com::sun::star::scanner;
156*cdf0e10cSrcweir using namespace ::com::sun::star::i18n;
157*cdf0e10cSrcweir using namespace ::com::sun::star::beans;
158*cdf0e10cSrcweir using namespace ::com::sun::star::container;
159*cdf0e10cSrcweir using namespace ::com::sun::star::ui::dialogs;
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir static void lcl_SetAllTextToDefaultLanguage( SwWrtShell &rWrtSh, sal_uInt16 nWhichId )
163*cdf0e10cSrcweir {
164*cdf0e10cSrcweir 	if (nWhichId == RES_CHRATR_LANGUAGE ||
165*cdf0e10cSrcweir 		nWhichId == RES_CHRATR_CJK_LANGUAGE ||
166*cdf0e10cSrcweir 		nWhichId == RES_CHRATR_CTL_LANGUAGE)
167*cdf0e10cSrcweir 	{
168*cdf0e10cSrcweir 		rWrtSh.StartAction();
169*cdf0e10cSrcweir 		rWrtSh.LockView( sal_True );
170*cdf0e10cSrcweir 		rWrtSh.Push();
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir 		// prepare to apply new language to all text in document
173*cdf0e10cSrcweir 		rWrtSh.SelAll();
174*cdf0e10cSrcweir 		rWrtSh.ExtendedSelectAll();
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir 		// set language attribute to default for all text
177*cdf0e10cSrcweir 		SvUShortsSort aAttribs;
178*cdf0e10cSrcweir 		aAttribs.Insert( nWhichId );
179*cdf0e10cSrcweir 		rWrtSh.ResetAttr( &aAttribs );
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir 		rWrtSh.Pop( sal_False );
182*cdf0e10cSrcweir 		rWrtSh.LockView( sal_False );
183*cdf0e10cSrcweir 		rWrtSh.EndAction();
184*cdf0e10cSrcweir 	}
185*cdf0e10cSrcweir }
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir /*---------------------------------------------------------------------------
188*cdf0e10cSrcweir 	Beschreibung:	String fuer die Seitenanzeige in der Statusbar basteln.
189*cdf0e10cSrcweir  ----------------------------------------------------------------------------*/
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir String SwView::GetPageStr( sal_uInt16 nPg, sal_uInt16 nLogPg,
192*cdf0e10cSrcweir 							const String& rDisplay )
193*cdf0e10cSrcweir {
194*cdf0e10cSrcweir 	String aStr( aPageStr );
195*cdf0e10cSrcweir 	if( rDisplay.Len() )
196*cdf0e10cSrcweir 		aStr += rDisplay;
197*cdf0e10cSrcweir 	else
198*cdf0e10cSrcweir 		aStr += String::CreateFromInt32(nLogPg);
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir 	if( nLogPg && nLogPg != nPg )
201*cdf0e10cSrcweir 	{
202*cdf0e10cSrcweir 		aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM("   "));
203*cdf0e10cSrcweir 		aStr += String::CreateFromInt32(nPg);
204*cdf0e10cSrcweir 	}
205*cdf0e10cSrcweir 	aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" / "));
206*cdf0e10cSrcweir 	aStr += String::CreateFromInt32( GetWrtShell().GetPageCnt() );
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir 	return aStr;
209*cdf0e10cSrcweir }
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir int SwView::InsertGraphic( const String &rPath, const String &rFilter,
213*cdf0e10cSrcweir                                 sal_Bool bLink, GraphicFilter *pFlt,
214*cdf0e10cSrcweir                                 Graphic* pPreviewGrf, sal_Bool bRule )
215*cdf0e10cSrcweir {
216*cdf0e10cSrcweir     SwWait aWait( *GetDocShell(), sal_True );
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir     Graphic aGrf;
219*cdf0e10cSrcweir     int nRes = GRFILTER_OK;
220*cdf0e10cSrcweir     if ( pPreviewGrf )
221*cdf0e10cSrcweir         aGrf = *pPreviewGrf;
222*cdf0e10cSrcweir     else
223*cdf0e10cSrcweir     {
224*cdf0e10cSrcweir         if( !pFlt )
225*cdf0e10cSrcweir             pFlt = GraphicFilter::GetGraphicFilter();
226*cdf0e10cSrcweir         nRes = GraphicFilter::LoadGraphic( rPath, rFilter, aGrf, pFlt /*, nFilter*/ );
227*cdf0e10cSrcweir     }
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir     if( GRFILTER_OK == nRes )
230*cdf0e10cSrcweir     {
231*cdf0e10cSrcweir         SwFlyFrmAttrMgr aFrmMgr( sal_True, GetWrtShellPtr(), FRMMGR_TYPE_GRF );
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir         SwWrtShell &rSh = GetWrtShell();
234*cdf0e10cSrcweir         rSh.StartAction();
235*cdf0e10cSrcweir         if( bLink )
236*cdf0e10cSrcweir         {
237*cdf0e10cSrcweir             SwDocShell* pDocSh = GetDocShell();
238*cdf0e10cSrcweir             INetURLObject aTemp(
239*cdf0e10cSrcweir                 pDocSh->HasName() ?
240*cdf0e10cSrcweir                     pDocSh->GetMedium()->GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) :
241*cdf0e10cSrcweir                     rtl::OUString());
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir             String sURL = URIHelper::SmartRel2Abs(
244*cdf0e10cSrcweir                 aTemp, rPath, URIHelper::GetMaybeFileHdl() );
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir             rSh.Insert( sURL,
247*cdf0e10cSrcweir                         rFilter, aGrf, &aFrmMgr, bRule );
248*cdf0e10cSrcweir         }
249*cdf0e10cSrcweir         else
250*cdf0e10cSrcweir             rSh.Insert( aEmptyStr, aEmptyStr, aGrf, &aFrmMgr );
251*cdf0e10cSrcweir         // nach dem EndAction ist es zu spaet, weil die Shell dann schon zerstoert sein kann
252*cdf0e10cSrcweir         rSh.EndAction();
253*cdf0e10cSrcweir     }
254*cdf0e10cSrcweir     return nRes;
255*cdf0e10cSrcweir }
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir sal_Bool SwView::InsertGraphicDlg( SfxRequest& rReq )
259*cdf0e10cSrcweir {
260*cdf0e10cSrcweir #ifndef ENABLE_PROP_WITHOUTLINK
261*cdf0e10cSrcweir #define ENABLE_PROP_WITHOUTLINK 0x08
262*cdf0e10cSrcweir #endif
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir     sal_Bool bReturn = sal_False;
265*cdf0e10cSrcweir     SwDocShell* pDocShell = GetDocShell();
266*cdf0e10cSrcweir     sal_uInt16 nHtmlMode = ::GetHtmlMode(pDocShell);
267*cdf0e10cSrcweir     // im HTML-Mode nur verknuepft einfuegen
268*cdf0e10cSrcweir     FileDialogHelper* pFileDlg = new FileDialogHelper( SFXWB_GRAPHIC | SFXWB_SHOWSTYLES );
269*cdf0e10cSrcweir     pFileDlg->SetTitle(SW_RESSTR(STR_INSERT_GRAPHIC ));
270*cdf0e10cSrcweir     pFileDlg->SetContext( FileDialogHelper::SW_INSERT_GRAPHIC );
271*cdf0e10cSrcweir     uno::Reference < XFilePicker > xFP = pFileDlg->GetFilePicker();
272*cdf0e10cSrcweir     uno::Reference < XFilePickerControlAccess > xCtrlAcc(xFP, UNO_QUERY);
273*cdf0e10cSrcweir     if(nHtmlMode & HTMLMODE_ON)
274*cdf0e10cSrcweir     {
275*cdf0e10cSrcweir         sal_Bool bTrue = sal_True;
276*cdf0e10cSrcweir         Any aVal(&bTrue, ::getBooleanCppuType());
277*cdf0e10cSrcweir         xCtrlAcc->setValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, aVal);
278*cdf0e10cSrcweir         xCtrlAcc->enableControl( ExtendedFilePickerElementIds::CHECKBOX_LINK, sal_False);
279*cdf0e10cSrcweir     }
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir     SvStringsSortDtor aFormats;
282*cdf0e10cSrcweir     SwDoc* pDoc = pDocShell->GetDoc();
283*cdf0e10cSrcweir     const sal_uInt16 nArrLen = pDoc->GetFrmFmts()->Count();
284*cdf0e10cSrcweir     sal_uInt16 i;
285*cdf0e10cSrcweir     for( i = 0; i < nArrLen; i++ )
286*cdf0e10cSrcweir     {
287*cdf0e10cSrcweir         SwFrmFmt* pFmt = (*pDoc->GetFrmFmts())[ i ];
288*cdf0e10cSrcweir         if(pFmt->IsDefault() || pFmt->IsAuto())
289*cdf0e10cSrcweir             continue;
290*cdf0e10cSrcweir         String *pFormat = new String(pFmt->GetName());
291*cdf0e10cSrcweir         aFormats.Insert(pFormat);
292*cdf0e10cSrcweir     }
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir     // pool formats
295*cdf0e10cSrcweir     //
296*cdf0e10cSrcweir     const SvStringsDtor& rFrmPoolArr = SwStyleNameMapper::GetFrmFmtUINameArray();
297*cdf0e10cSrcweir     for( i = 0; i < rFrmPoolArr.Count(); i++ )
298*cdf0e10cSrcweir     {
299*cdf0e10cSrcweir         String *pFormat = new String(*rFrmPoolArr[i]);
300*cdf0e10cSrcweir         if (!aFormats.Insert(pFormat))
301*cdf0e10cSrcweir             delete pFormat;
302*cdf0e10cSrcweir     }
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir     Sequence<OUString> aListBoxEntries(aFormats.Count());
305*cdf0e10cSrcweir     OUString* pEntries = aListBoxEntries.getArray();
306*cdf0e10cSrcweir     sal_Int16 nSelect = 0;
307*cdf0e10cSrcweir     String sGraphicFormat = SW_RESSTR(STR_POOLFRM_GRAPHIC);
308*cdf0e10cSrcweir     for(i = 0; i < aFormats.Count(); ++i)
309*cdf0e10cSrcweir     {
310*cdf0e10cSrcweir         pEntries[i] = *aFormats[i];
311*cdf0e10cSrcweir         if(pEntries[i].equals(sGraphicFormat))
312*cdf0e10cSrcweir             nSelect = i;
313*cdf0e10cSrcweir     }
314*cdf0e10cSrcweir     try
315*cdf0e10cSrcweir     {
316*cdf0e10cSrcweir         Any aTemplates(&aListBoxEntries, ::getCppuType(&aListBoxEntries));
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir         xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
319*cdf0e10cSrcweir             ListboxControlActions::ADD_ITEMS , aTemplates );
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir         Any aSelectPos(&nSelect, ::getCppuType(&nSelect));
322*cdf0e10cSrcweir         xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
323*cdf0e10cSrcweir             ListboxControlActions::SET_SELECT_ITEM, aSelectPos );
324*cdf0e10cSrcweir     }
325*cdf0e10cSrcweir     catch(Exception& )
326*cdf0e10cSrcweir     {
327*cdf0e10cSrcweir         DBG_ERROR("control acces failed");
328*cdf0e10cSrcweir     }
329*cdf0e10cSrcweir 
330*cdf0e10cSrcweir     SFX_REQUEST_ARG( rReq, pName, SfxStringItem, SID_INSERT_GRAPHIC , sal_False );
331*cdf0e10cSrcweir     sal_Bool bShowError = !pName;
332*cdf0e10cSrcweir     if( pName || ERRCODE_NONE == pFileDlg->Execute() )
333*cdf0e10cSrcweir     {
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir         String aFileName, aFilterName;
336*cdf0e10cSrcweir         if ( pName )
337*cdf0e10cSrcweir         {
338*cdf0e10cSrcweir             aFileName = pName->GetValue();
339*cdf0e10cSrcweir             SFX_REQUEST_ARG( rReq, pFilter, SfxStringItem, FN_PARAM_FILTER , sal_False );
340*cdf0e10cSrcweir             if ( pFilter )
341*cdf0e10cSrcweir                 aFilterName = pFilter->GetValue();
342*cdf0e10cSrcweir         }
343*cdf0e10cSrcweir         else
344*cdf0e10cSrcweir         {
345*cdf0e10cSrcweir             aFileName = pFileDlg->GetPath();
346*cdf0e10cSrcweir             aFilterName = pFileDlg->GetCurrentFilter();
347*cdf0e10cSrcweir             rReq.AppendItem( SfxStringItem( SID_INSERT_GRAPHIC, aFileName ) );
348*cdf0e10cSrcweir             rReq.AppendItem( SfxStringItem( FN_PARAM_FILTER, aFilterName ) );
349*cdf0e10cSrcweir 
350*cdf0e10cSrcweir             sal_Bool bAsLink = sal_False;
351*cdf0e10cSrcweir             if(nHtmlMode & HTMLMODE_ON)
352*cdf0e10cSrcweir                 bAsLink = sal_True;
353*cdf0e10cSrcweir             else
354*cdf0e10cSrcweir             {
355*cdf0e10cSrcweir                 try
356*cdf0e10cSrcweir                 {
357*cdf0e10cSrcweir                     Any aVal = xCtrlAcc->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0);
358*cdf0e10cSrcweir                     DBG_ASSERT(aVal.hasValue(), "Value CBX_INSERT_AS_LINK not found");
359*cdf0e10cSrcweir                     bAsLink = aVal.hasValue() ? *(sal_Bool*) aVal.getValue() : sal_True;
360*cdf0e10cSrcweir                     Any aTemplateValue = xCtrlAcc->getValue(
361*cdf0e10cSrcweir                         ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
362*cdf0e10cSrcweir                         ListboxControlActions::GET_SELECTED_ITEM );
363*cdf0e10cSrcweir                     OUString sTmpl;
364*cdf0e10cSrcweir                     aTemplateValue >>= sTmpl;
365*cdf0e10cSrcweir                     rReq.AppendItem( SfxStringItem( FN_PARAM_2, sTmpl) );
366*cdf0e10cSrcweir                 }
367*cdf0e10cSrcweir                 catch(Exception& )
368*cdf0e10cSrcweir                 {
369*cdf0e10cSrcweir                     DBG_ERROR("control acces failed");
370*cdf0e10cSrcweir                 }
371*cdf0e10cSrcweir             }
372*cdf0e10cSrcweir             rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bAsLink ) );
373*cdf0e10cSrcweir         }
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir         SFX_REQUEST_ARG( rReq, pAsLink, SfxBoolItem, FN_PARAM_1 , sal_False );
376*cdf0e10cSrcweir         SFX_REQUEST_ARG( rReq, pStyle, SfxStringItem, FN_PARAM_2 , sal_False );
377*cdf0e10cSrcweir 
378*cdf0e10cSrcweir         sal_Bool bAsLink = sal_False;
379*cdf0e10cSrcweir         if( nHtmlMode & HTMLMODE_ON )
380*cdf0e10cSrcweir             bAsLink = sal_True;
381*cdf0e10cSrcweir         else
382*cdf0e10cSrcweir         {
383*cdf0e10cSrcweir             if ( rReq.GetArgs() )
384*cdf0e10cSrcweir             {
385*cdf0e10cSrcweir                 if ( pAsLink )
386*cdf0e10cSrcweir                     bAsLink = pAsLink->GetValue();
387*cdf0e10cSrcweir                 if ( pStyle && pStyle->GetValue().Len() )
388*cdf0e10cSrcweir                     sGraphicFormat = pStyle->GetValue();
389*cdf0e10cSrcweir             }
390*cdf0e10cSrcweir             else
391*cdf0e10cSrcweir             {
392*cdf0e10cSrcweir                 Any aVal = xCtrlAcc->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0);
393*cdf0e10cSrcweir                 DBG_ASSERT(aVal.hasValue(), "Value CBX_INSERT_AS_LINK not found");
394*cdf0e10cSrcweir                 bAsLink = aVal.hasValue() ? *(sal_Bool*) aVal.getValue() : sal_True;
395*cdf0e10cSrcweir                 Any aTemplateValue = xCtrlAcc->getValue(
396*cdf0e10cSrcweir                     ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
397*cdf0e10cSrcweir                     ListboxControlActions::GET_SELECTED_ITEM );
398*cdf0e10cSrcweir                 OUString sTmpl;
399*cdf0e10cSrcweir                 aTemplateValue >>= sTmpl;
400*cdf0e10cSrcweir                 if( sTmpl.getLength() )
401*cdf0e10cSrcweir                     sGraphicFormat = sTmpl;
402*cdf0e10cSrcweir                 rReq.AppendItem( SfxStringItem( FN_PARAM_2, sGraphicFormat ) );
403*cdf0e10cSrcweir                 rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bAsLink ) );
404*cdf0e10cSrcweir             }
405*cdf0e10cSrcweir         }
406*cdf0e10cSrcweir 
407*cdf0e10cSrcweir         SwWrtShell& rSh = GetWrtShell();
408*cdf0e10cSrcweir         rSh.LockPaint();
409*cdf0e10cSrcweir         rSh.StartAction();
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir         /// #111827#
412*cdf0e10cSrcweir         SwRewriter aRewriter;
413*cdf0e10cSrcweir         aRewriter.AddRule(UNDO_ARG1, String(SW_RES(STR_GRAPHIC_DEFNAME)));
414*cdf0e10cSrcweir 
415*cdf0e10cSrcweir         rSh.StartUndo(UNDO_INSERT, &aRewriter);
416*cdf0e10cSrcweir 
417*cdf0e10cSrcweir         int nError = InsertGraphic( aFileName, aFilterName, bAsLink, GraphicFilter::GetGraphicFilter() );
418*cdf0e10cSrcweir 
419*cdf0e10cSrcweir         // Format ist ungleich Current Filter, jetzt mit auto. detection
420*cdf0e10cSrcweir         if( nError == GRFILTER_FORMATERROR )
421*cdf0e10cSrcweir             nError = InsertGraphic( aFileName, aEmptyStr, bAsLink, GraphicFilter::GetGraphicFilter() );
422*cdf0e10cSrcweir         if ( rSh.IsFrmSelected() )
423*cdf0e10cSrcweir         {
424*cdf0e10cSrcweir             SwFrmFmt* pFmt = pDoc->FindFrmFmtByName( sGraphicFormat );
425*cdf0e10cSrcweir             if(!pFmt)
426*cdf0e10cSrcweir                 pFmt = pDoc->MakeFrmFmt(sGraphicFormat,
427*cdf0e10cSrcweir                                         pDocShell->GetDoc()->GetDfltFrmFmt(),
428*cdf0e10cSrcweir                                         sal_True, sal_False);
429*cdf0e10cSrcweir             rSh.SetFrmFmt( pFmt );
430*cdf0e10cSrcweir         }
431*cdf0e10cSrcweir 
432*cdf0e10cSrcweir         RESOURCE_TYPE nResId = 0;
433*cdf0e10cSrcweir         switch( nError )
434*cdf0e10cSrcweir         {
435*cdf0e10cSrcweir             case GRFILTER_OPENERROR:
436*cdf0e10cSrcweir                 nResId = STR_GRFILTER_OPENERROR;
437*cdf0e10cSrcweir                 break;
438*cdf0e10cSrcweir             case GRFILTER_IOERROR:
439*cdf0e10cSrcweir                 nResId = STR_GRFILTER_IOERROR;
440*cdf0e10cSrcweir                 break;
441*cdf0e10cSrcweir             case GRFILTER_FORMATERROR:
442*cdf0e10cSrcweir                 nResId = STR_GRFILTER_FORMATERROR;
443*cdf0e10cSrcweir                 break;
444*cdf0e10cSrcweir             case GRFILTER_VERSIONERROR:
445*cdf0e10cSrcweir                 nResId = STR_GRFILTER_VERSIONERROR;
446*cdf0e10cSrcweir                 break;
447*cdf0e10cSrcweir             case GRFILTER_FILTERERROR:
448*cdf0e10cSrcweir                 nResId = STR_GRFILTER_FILTERERROR;
449*cdf0e10cSrcweir                 break;
450*cdf0e10cSrcweir             case GRFILTER_TOOBIG:
451*cdf0e10cSrcweir                 nResId = STR_GRFILTER_TOOBIG;
452*cdf0e10cSrcweir                 break;
453*cdf0e10cSrcweir         }
454*cdf0e10cSrcweir 
455*cdf0e10cSrcweir         rSh.EndAction();
456*cdf0e10cSrcweir         rSh.UnlockPaint();
457*cdf0e10cSrcweir         if( nResId )
458*cdf0e10cSrcweir         {
459*cdf0e10cSrcweir             if( bShowError )
460*cdf0e10cSrcweir             {
461*cdf0e10cSrcweir                 InfoBox aInfoBox( GetWindow(), SW_RESSTR( nResId ));
462*cdf0e10cSrcweir                 aInfoBox.Execute();
463*cdf0e10cSrcweir             }
464*cdf0e10cSrcweir             rReq.Ignore();
465*cdf0e10cSrcweir         }
466*cdf0e10cSrcweir         else
467*cdf0e10cSrcweir         {
468*cdf0e10cSrcweir             // set the specific graphic attrbutes to the graphic
469*cdf0e10cSrcweir             bReturn = sal_True;
470*cdf0e10cSrcweir             AutoCaption( GRAPHIC_CAP );
471*cdf0e10cSrcweir             rReq.Done();
472*cdf0e10cSrcweir         }
473*cdf0e10cSrcweir 
474*cdf0e10cSrcweir         rSh.EndUndo(); // due to possible change of Shell
475*cdf0e10cSrcweir     }
476*cdf0e10cSrcweir 
477*cdf0e10cSrcweir     delete pFileDlg;
478*cdf0e10cSrcweir 
479*cdf0e10cSrcweir     return bReturn;
480*cdf0e10cSrcweir }
481*cdf0e10cSrcweir 
482*cdf0e10cSrcweir 
483*cdf0e10cSrcweir void __EXPORT SwView::Execute(SfxRequest &rReq)
484*cdf0e10cSrcweir {
485*cdf0e10cSrcweir 	sal_uInt16 nSlot = rReq.GetSlot();
486*cdf0e10cSrcweir 	const SfxItemSet* pArgs = rReq.GetArgs();
487*cdf0e10cSrcweir 	const SfxPoolItem* pItem;
488*cdf0e10cSrcweir     sal_Bool bIgnore = sal_False;
489*cdf0e10cSrcweir 	switch( nSlot )
490*cdf0e10cSrcweir 	{
491*cdf0e10cSrcweir 		case SID_CREATE_SW_DRAWVIEW:
492*cdf0e10cSrcweir             // --> OD 2005-08-08 #i52858# - method name changed
493*cdf0e10cSrcweir             pWrtShell->getIDocumentDrawModelAccess()->GetOrCreateDrawModel();
494*cdf0e10cSrcweir             // <--
495*cdf0e10cSrcweir 			break;
496*cdf0e10cSrcweir 
497*cdf0e10cSrcweir 		case FN_LINE_NUMBERING_DLG:
498*cdf0e10cSrcweir 		{
499*cdf0e10cSrcweir 			SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
500*cdf0e10cSrcweir             DBG_ASSERT(pFact, "Dialogdiet fail!");
501*cdf0e10cSrcweir             VclAbstractDialog* pDlg = pFact->CreateVclSwViewDialog( DLG_LINE_NUMBERING,    *this);
502*cdf0e10cSrcweir             DBG_ASSERT(pDlg, "Dialogdiet fail!");
503*cdf0e10cSrcweir 			pDlg->Execute();
504*cdf0e10cSrcweir 			delete pDlg;
505*cdf0e10cSrcweir 			break;
506*cdf0e10cSrcweir 		}
507*cdf0e10cSrcweir 		case FN_EDIT_LINK_DLG:
508*cdf0e10cSrcweir 			EditLinkDlg();
509*cdf0e10cSrcweir 			break;
510*cdf0e10cSrcweir 		case FN_REFRESH_VIEW:
511*cdf0e10cSrcweir 			GetEditWin().Invalidate();
512*cdf0e10cSrcweir 			break;
513*cdf0e10cSrcweir 		case FN_PAGEUP:
514*cdf0e10cSrcweir 		case FN_PAGEUP_SEL:
515*cdf0e10cSrcweir 		case FN_PAGEDOWN:
516*cdf0e10cSrcweir 		case FN_PAGEDOWN_SEL:
517*cdf0e10cSrcweir 		{
518*cdf0e10cSrcweir 			Rectangle aVis( GetVisArea() );
519*cdf0e10cSrcweir             SwEditWin& rTmpWin = GetEditWin();
520*cdf0e10cSrcweir             if ( FN_PAGEUP == nSlot || FN_PAGEUP_SEL == nSlot )
521*cdf0e10cSrcweir 			    PageUpCrsr(FN_PAGEUP_SEL == nSlot);
522*cdf0e10cSrcweir             else
523*cdf0e10cSrcweir     			PageDownCrsr(FN_PAGEDOWN_SEL == nSlot);
524*cdf0e10cSrcweir 
525*cdf0e10cSrcweir 			rReq.SetReturnValue(SfxBoolItem(nSlot,
526*cdf0e10cSrcweir 												aVis != GetVisArea()));
527*cdf0e10cSrcweir             //#i42732# - notify the edit window that from now on we do not use the input language
528*cdf0e10cSrcweir             rTmpWin.SetUseInputLanguage( sal_False );
529*cdf0e10cSrcweir         }
530*cdf0e10cSrcweir 		break;
531*cdf0e10cSrcweir 		case FN_REDLINE_ON:
532*cdf0e10cSrcweir 		{
533*cdf0e10cSrcweir 			if( pArgs &&
534*cdf0e10cSrcweir 				SFX_ITEM_SET == pArgs->GetItemState(nSlot, sal_False, &pItem ))
535*cdf0e10cSrcweir 			{
536*cdf0e10cSrcweir                 IDocumentRedlineAccess* pIDRA = pWrtShell->getIDocumentRedlineAccess();
537*cdf0e10cSrcweir                 Sequence <sal_Int8> aPasswd = pIDRA->GetRedlinePassword();
538*cdf0e10cSrcweir 				if( aPasswd.getLength() )
539*cdf0e10cSrcweir 				{
540*cdf0e10cSrcweir 					DBG_ASSERT( !((const SfxBoolItem*)pItem)->GetValue(), "SwView::Execute(): password set an redlining off doesn't match!" );
541*cdf0e10cSrcweir 					// xmlsec05:	new password dialog
542*cdf0e10cSrcweir 					Window* pParent;
543*cdf0e10cSrcweir 					const SfxPoolItem* pParentItem;
544*cdf0e10cSrcweir                     if( SFX_ITEM_SET == pArgs->GetItemState( SID_ATTR_XWINDOW, sal_False, &pParentItem ) )
545*cdf0e10cSrcweir                         pParent = ( ( const XWindowItem* ) pParentItem )->GetWindowPtr();
546*cdf0e10cSrcweir 					else
547*cdf0e10cSrcweir 						pParent = &GetViewFrame()->GetWindow();
548*cdf0e10cSrcweir 					SfxPasswordDialog aPasswdDlg( pParent );
549*cdf0e10cSrcweir                     aPasswdDlg.SetMinLen( 1 );
550*cdf0e10cSrcweir 					//#i69751# the result of Execute() can be ignored
551*cdf0e10cSrcweir                     aPasswdDlg.Execute();
552*cdf0e10cSrcweir 					String sNewPasswd( aPasswdDlg.GetPassword() );
553*cdf0e10cSrcweir                     Sequence <sal_Int8> aNewPasswd = pIDRA->GetRedlinePassword();
554*cdf0e10cSrcweir 					SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd );
555*cdf0e10cSrcweir 					if(SvPasswordHelper::CompareHashPassword(aPasswd, sNewPasswd))
556*cdf0e10cSrcweir                         pIDRA->SetRedlinePassword(Sequence <sal_Int8> ());
557*cdf0e10cSrcweir 					else
558*cdf0e10cSrcweir 					{	// xmlsec05: message box for wrong password
559*cdf0e10cSrcweir 						break;
560*cdf0e10cSrcweir 					}
561*cdf0e10cSrcweir 				}
562*cdf0e10cSrcweir 
563*cdf0e10cSrcweir 				sal_uInt16 nOn = ((const SfxBoolItem*)pItem)->GetValue() ? nsRedlineMode_t::REDLINE_ON : 0;
564*cdf0e10cSrcweir 				sal_uInt16 nMode = pWrtShell->GetRedlineMode();
565*cdf0e10cSrcweir                 pWrtShell->SetRedlineModeAndCheckInsMode( (nMode & ~nsRedlineMode_t::REDLINE_ON) | nOn);
566*cdf0e10cSrcweir 			}
567*cdf0e10cSrcweir 		}
568*cdf0e10cSrcweir 		break;
569*cdf0e10cSrcweir         case FN_REDLINE_PROTECT :
570*cdf0e10cSrcweir         {
571*cdf0e10cSrcweir             IDocumentRedlineAccess* pIDRA = pWrtShell->getIDocumentRedlineAccess();
572*cdf0e10cSrcweir             Sequence <sal_Int8> aPasswd = pIDRA->GetRedlinePassword();
573*cdf0e10cSrcweir             if( pArgs && SFX_ITEM_SET == pArgs->GetItemState(nSlot, sal_False, &pItem )
574*cdf0e10cSrcweir 				&& ((SfxBoolItem*)pItem)->GetValue() == ( aPasswd.getLength() != 0 ) )
575*cdf0e10cSrcweir                 break;
576*cdf0e10cSrcweir 
577*cdf0e10cSrcweir 			// xmlsec05:	new password dialog
578*cdf0e10cSrcweir 			//				message box for wrong password
579*cdf0e10cSrcweir 			Window* pParent;
580*cdf0e10cSrcweir 			const SfxPoolItem* pParentItem;
581*cdf0e10cSrcweir             if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_ATTR_XWINDOW, sal_False, &pParentItem ) )
582*cdf0e10cSrcweir                 pParent = ( ( const XWindowItem* ) pParentItem )->GetWindowPtr();
583*cdf0e10cSrcweir 			else
584*cdf0e10cSrcweir 				pParent = &GetViewFrame()->GetWindow();
585*cdf0e10cSrcweir             SfxPasswordDialog aPasswdDlg( pParent );
586*cdf0e10cSrcweir             aPasswdDlg.SetMinLen( 1 );
587*cdf0e10cSrcweir             if(!aPasswd.getLength())
588*cdf0e10cSrcweir                 aPasswdDlg.ShowExtras(SHOWEXTRAS_CONFIRM);
589*cdf0e10cSrcweir             if (aPasswdDlg.Execute())
590*cdf0e10cSrcweir             {
591*cdf0e10cSrcweir                 sal_uInt16 nOn = nsRedlineMode_t::REDLINE_ON;
592*cdf0e10cSrcweir                 String sNewPasswd( aPasswdDlg.GetPassword() );
593*cdf0e10cSrcweir                 Sequence <sal_Int8> aNewPasswd =
594*cdf0e10cSrcweir                         pIDRA->GetRedlinePassword();
595*cdf0e10cSrcweir                 SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd );
596*cdf0e10cSrcweir                 if(!aPasswd.getLength())
597*cdf0e10cSrcweir                 {
598*cdf0e10cSrcweir                     pIDRA->SetRedlinePassword(aNewPasswd);
599*cdf0e10cSrcweir                 }
600*cdf0e10cSrcweir                 else if(SvPasswordHelper::CompareHashPassword(aPasswd, sNewPasswd))
601*cdf0e10cSrcweir                 {
602*cdf0e10cSrcweir                     pIDRA->SetRedlinePassword(Sequence <sal_Int8> ());
603*cdf0e10cSrcweir                     nOn = 0;
604*cdf0e10cSrcweir                 }
605*cdf0e10cSrcweir                 sal_uInt16 nMode = pIDRA->GetRedlineMode();
606*cdf0e10cSrcweir                 pWrtShell->SetRedlineModeAndCheckInsMode( (nMode & ~nsRedlineMode_t::REDLINE_ON) | nOn);
607*cdf0e10cSrcweir                 rReq.AppendItem( SfxBoolItem( FN_REDLINE_PROTECT, ((nMode&nsRedlineMode_t::REDLINE_ON)==0) ) );
608*cdf0e10cSrcweir             }
609*cdf0e10cSrcweir             else
610*cdf0e10cSrcweir                 bIgnore = sal_True;
611*cdf0e10cSrcweir         }
612*cdf0e10cSrcweir         break;
613*cdf0e10cSrcweir 		case FN_REDLINE_SHOW:
614*cdf0e10cSrcweir 
615*cdf0e10cSrcweir 			if( pArgs &&
616*cdf0e10cSrcweir 				SFX_ITEM_SET == pArgs->GetItemState(nSlot, sal_False, &pItem))
617*cdf0e10cSrcweir 			{
618*cdf0e10cSrcweir 				sal_uInt16 nMode = ( ~(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE)
619*cdf0e10cSrcweir 						& pWrtShell->GetRedlineMode() ) | nsRedlineMode_t::REDLINE_SHOW_INSERT;
620*cdf0e10cSrcweir 				if( ((const SfxBoolItem*)pItem)->GetValue() )
621*cdf0e10cSrcweir 					nMode |= nsRedlineMode_t::REDLINE_SHOW_DELETE;
622*cdf0e10cSrcweir 
623*cdf0e10cSrcweir                 pWrtShell->SetRedlineModeAndCheckInsMode( nMode );
624*cdf0e10cSrcweir 			}
625*cdf0e10cSrcweir 			break;
626*cdf0e10cSrcweir         case FN_MAILMERGE_SENDMAIL_CHILDWINDOW:
627*cdf0e10cSrcweir         case FN_REDLINE_ACCEPT:
628*cdf0e10cSrcweir             GetViewFrame()->ToggleChildWindow(nSlot);
629*cdf0e10cSrcweir         break;
630*cdf0e10cSrcweir         case FN_REDLINE_ACCEPT_DIRECT:
631*cdf0e10cSrcweir         case FN_REDLINE_REJECT_DIRECT:
632*cdf0e10cSrcweir         {
633*cdf0e10cSrcweir             SwContentAtPos aCntntAtPos( SwContentAtPos::SW_REDLINE );
634*cdf0e10cSrcweir             Point aCrsrPos = pWrtShell->GetCrsrDocPos( sal_True );
635*cdf0e10cSrcweir             if( pWrtShell->GetContentAtPos( aCrsrPos, aCntntAtPos ) )
636*cdf0e10cSrcweir             {
637*cdf0e10cSrcweir                 sal_uInt16 nCount = pWrtShell->GetRedlineCount();
638*cdf0e10cSrcweir                 for( sal_uInt16 nRedline = 0; nRedline < nCount; ++nRedline )
639*cdf0e10cSrcweir                 {
640*cdf0e10cSrcweir                     const SwRedline& rRedline = pWrtShell->GetRedline( nRedline );
641*cdf0e10cSrcweir                     if( *aCntntAtPos.aFnd.pRedl == rRedline )
642*cdf0e10cSrcweir                     {
643*cdf0e10cSrcweir                         if( FN_REDLINE_ACCEPT_DIRECT == nSlot )
644*cdf0e10cSrcweir                             pWrtShell->AcceptRedline( nRedline );
645*cdf0e10cSrcweir                         else
646*cdf0e10cSrcweir                             pWrtShell->RejectRedline( nRedline );
647*cdf0e10cSrcweir                         break;
648*cdf0e10cSrcweir                     }
649*cdf0e10cSrcweir                 }
650*cdf0e10cSrcweir             }
651*cdf0e10cSrcweir         }
652*cdf0e10cSrcweir         break;
653*cdf0e10cSrcweir 		case SID_DOCUMENT_COMPARE:
654*cdf0e10cSrcweir 		case SID_DOCUMENT_MERGE:
655*cdf0e10cSrcweir 			{
656*cdf0e10cSrcweir 				String sFileName, sFilterName;
657*cdf0e10cSrcweir 				sal_Int16 nVersion = 0;
658*cdf0e10cSrcweir                 bool bHasFileName = false;
659*cdf0e10cSrcweir                 pViewImpl->SetParam( 0 );
660*cdf0e10cSrcweir 
661*cdf0e10cSrcweir 				if( pArgs )
662*cdf0e10cSrcweir 				{
663*cdf0e10cSrcweir 					if( SFX_ITEM_SET == pArgs->GetItemState( SID_FILE_NAME, sal_False, &pItem ))
664*cdf0e10cSrcweir 						sFileName = ((const SfxStringItem*)pItem)->GetValue();
665*cdf0e10cSrcweir                     bHasFileName = ( sFileName.Len() > 0 );
666*cdf0e10cSrcweir 
667*cdf0e10cSrcweir 					if( SFX_ITEM_SET == pArgs->GetItemState( SID_FILTER_NAME, sal_False, &pItem ))
668*cdf0e10cSrcweir 						sFilterName = ((const SfxStringItem*)pItem)->GetValue();
669*cdf0e10cSrcweir 
670*cdf0e10cSrcweir 					if( SFX_ITEM_SET == pArgs->GetItemState( SID_VERSION, sal_False, &pItem ))
671*cdf0e10cSrcweir                     {
672*cdf0e10cSrcweir 						nVersion = ((const SfxInt16Item *)pItem)->GetValue();
673*cdf0e10cSrcweir                         pViewImpl->SetParam( nVersion );
674*cdf0e10cSrcweir                     }
675*cdf0e10cSrcweir 				}
676*cdf0e10cSrcweir 
677*cdf0e10cSrcweir                 pViewImpl->InitRequest( rReq );
678*cdf0e10cSrcweir                 long nFound = InsertDoc( nSlot, sFileName, sFilterName, nVersion );
679*cdf0e10cSrcweir 
680*cdf0e10cSrcweir                 if ( bHasFileName )
681*cdf0e10cSrcweir                 {
682*cdf0e10cSrcweir                     rReq.SetReturnValue( SfxInt32Item( nSlot, nFound ));
683*cdf0e10cSrcweir 
684*cdf0e10cSrcweir                     if (nFound > 0) // Redline-Browser anzeigen
685*cdf0e10cSrcweir                     {
686*cdf0e10cSrcweir                         SfxViewFrame* pVFrame = GetViewFrame();
687*cdf0e10cSrcweir                         pVFrame->ShowChildWindow(FN_REDLINE_ACCEPT);
688*cdf0e10cSrcweir 
689*cdf0e10cSrcweir                         // RedlineDlg neu initialisieren
690*cdf0e10cSrcweir                         sal_uInt16 nId = SwRedlineAcceptChild::GetChildWindowId();
691*cdf0e10cSrcweir                         SwRedlineAcceptChild *pRed = (SwRedlineAcceptChild*)
692*cdf0e10cSrcweir                                                 pVFrame->GetChildWindow(nId);
693*cdf0e10cSrcweir                         if (pRed)
694*cdf0e10cSrcweir                             pRed->ReInitDlg(GetDocShell());
695*cdf0e10cSrcweir                     }
696*cdf0e10cSrcweir                 }
697*cdf0e10cSrcweir                 else
698*cdf0e10cSrcweir                     bIgnore = sal_True;
699*cdf0e10cSrcweir             }
700*cdf0e10cSrcweir 		break;
701*cdf0e10cSrcweir 		case FN_SYNC_LABELS:
702*cdf0e10cSrcweir         case FN_MAILMERGE_CHILDWINDOW:
703*cdf0e10cSrcweir             GetViewFrame()->ShowChildWindow(nSlot, sal_True);
704*cdf0e10cSrcweir         break;
705*cdf0e10cSrcweir         case FN_ESCAPE:
706*cdf0e10cSrcweir 		{
707*cdf0e10cSrcweir 			if ( pWrtShell->HasDrawView() && pWrtShell->GetDrawView()->IsDragObj() )
708*cdf0e10cSrcweir 			{
709*cdf0e10cSrcweir 				pWrtShell->BreakDrag();
710*cdf0e10cSrcweir 				pWrtShell->EnterSelFrmMode();
711*cdf0e10cSrcweir 			}
712*cdf0e10cSrcweir 			else if ( pWrtShell->IsDrawCreate() )
713*cdf0e10cSrcweir 			{
714*cdf0e10cSrcweir 				GetDrawFuncPtr()->BreakCreate();
715*cdf0e10cSrcweir 				AttrChangedNotify(pWrtShell); // ggf Shellwechsel...
716*cdf0e10cSrcweir 			}
717*cdf0e10cSrcweir 			else if ( pWrtShell->HasSelection() || IsDrawMode() )
718*cdf0e10cSrcweir 			{
719*cdf0e10cSrcweir                 SdrView *pSdrView = pWrtShell->HasDrawView() ? pWrtShell->GetDrawView() : 0;
720*cdf0e10cSrcweir                 if(pSdrView && pSdrView->AreObjectsMarked() &&
721*cdf0e10cSrcweir                     pSdrView->GetHdlList().GetFocusHdl())
722*cdf0e10cSrcweir                 {
723*cdf0e10cSrcweir                     ((SdrHdlList&)pSdrView->GetHdlList()).ResetFocusHdl();
724*cdf0e10cSrcweir                 }
725*cdf0e10cSrcweir                 else
726*cdf0e10cSrcweir                 {
727*cdf0e10cSrcweir                     if(pSdrView)
728*cdf0e10cSrcweir                     {
729*cdf0e10cSrcweir                         LeaveDrawCreate();
730*cdf0e10cSrcweir                         Point aPt(LONG_MIN, LONG_MIN);
731*cdf0e10cSrcweir                         //go out of the frame
732*cdf0e10cSrcweir                         pWrtShell->SelectObj(aPt, SW_LEAVE_FRAME);
733*cdf0e10cSrcweir                         SfxBindings& rBind = GetViewFrame()->GetBindings();
734*cdf0e10cSrcweir                         rBind.Invalidate( SID_ATTR_SIZE );
735*cdf0e10cSrcweir                     }
736*cdf0e10cSrcweir                     pWrtShell->EnterStdMode();
737*cdf0e10cSrcweir                     AttrChangedNotify(pWrtShell); // ggf Shellwechsel...
738*cdf0e10cSrcweir                 }
739*cdf0e10cSrcweir 			}
740*cdf0e10cSrcweir 			else if ( GetEditWin().GetApplyTemplate() )
741*cdf0e10cSrcweir 			{
742*cdf0e10cSrcweir 				GetEditWin().SetApplyTemplate(SwApplyTemplate());
743*cdf0e10cSrcweir 			}
744*cdf0e10cSrcweir             else if( ((SfxObjectShell*)GetDocShell())->IsInPlaceActive() )
745*cdf0e10cSrcweir 			{
746*cdf0e10cSrcweir                 Escape();
747*cdf0e10cSrcweir             }
748*cdf0e10cSrcweir 			else if ( GetEditWin().IsChainMode() )
749*cdf0e10cSrcweir 			{
750*cdf0e10cSrcweir 				GetEditWin().SetChainMode( sal_False );
751*cdf0e10cSrcweir 			}
752*cdf0e10cSrcweir             else if( pWrtShell->GetFlyFrmFmt() )
753*cdf0e10cSrcweir             {
754*cdf0e10cSrcweir                 const SwFrmFmt* pFmt = pWrtShell->GetFlyFrmFmt();
755*cdf0e10cSrcweir                 if(pWrtShell->GotoFly( pFmt->GetName(), FLYCNTTYPE_FRM ))
756*cdf0e10cSrcweir                 {
757*cdf0e10cSrcweir                     pWrtShell->HideCrsr();
758*cdf0e10cSrcweir                     pWrtShell->EnterSelFrmMode();
759*cdf0e10cSrcweir                 }
760*cdf0e10cSrcweir             }
761*cdf0e10cSrcweir 			else
762*cdf0e10cSrcweir 			{
763*cdf0e10cSrcweir 				SfxBoolItem aItem( SID_WIN_FULLSCREEN, sal_False );
764*cdf0e10cSrcweir 				GetViewFrame()->GetDispatcher()->Execute( SID_WIN_FULLSCREEN, SFX_CALLMODE_RECORD, &aItem, 0L );
765*cdf0e10cSrcweir                 bIgnore = sal_True;
766*cdf0e10cSrcweir 			}
767*cdf0e10cSrcweir 		}
768*cdf0e10cSrcweir         break;
769*cdf0e10cSrcweir 		case SID_ATTR_BORDER_INNER:
770*cdf0e10cSrcweir 		case SID_ATTR_BORDER_OUTER:
771*cdf0e10cSrcweir 		case SID_ATTR_BORDER_SHADOW:
772*cdf0e10cSrcweir 			if(pArgs)
773*cdf0e10cSrcweir 				pWrtShell->SetAttr(*pArgs);
774*cdf0e10cSrcweir 			break;
775*cdf0e10cSrcweir 
776*cdf0e10cSrcweir 		case SID_ATTR_PAGE:
777*cdf0e10cSrcweir 		case SID_ATTR_PAGE_SIZE:
778*cdf0e10cSrcweir 		case SID_ATTR_PAGE_MAXSIZE:
779*cdf0e10cSrcweir 		case SID_ATTR_PAGE_PAPERBIN:
780*cdf0e10cSrcweir 		case SID_ATTR_PAGE_EXT1:
781*cdf0e10cSrcweir 		case FN_PARAM_FTN_INFO:
782*cdf0e10cSrcweir 		{
783*cdf0e10cSrcweir 			if(pArgs)
784*cdf0e10cSrcweir 			{
785*cdf0e10cSrcweir 				const sal_uInt16 nCurIdx = pWrtShell->GetCurPageDesc();
786*cdf0e10cSrcweir 				SwPageDesc aPageDesc( pWrtShell->GetPageDesc( nCurIdx ) );
787*cdf0e10cSrcweir 				::ItemSetToPageDesc( *pArgs, aPageDesc );
788*cdf0e10cSrcweir 				// Den Descriptor der Core veraendern.
789*cdf0e10cSrcweir 				pWrtShell->ChgPageDesc( nCurIdx, aPageDesc );
790*cdf0e10cSrcweir 			}
791*cdf0e10cSrcweir 		}
792*cdf0e10cSrcweir 		break;
793*cdf0e10cSrcweir 		case FN_NAVIGATION_PI_GOTO_PAGE:
794*cdf0e10cSrcweir 		{
795*cdf0e10cSrcweir 			SfxViewFrame* pVFrame = GetViewFrame();
796*cdf0e10cSrcweir 			SfxChildWindow* pCh = pVFrame->GetChildWindow( SID_NAVIGATOR );
797*cdf0e10cSrcweir 			if(!pCh)
798*cdf0e10cSrcweir 			{
799*cdf0e10cSrcweir 				pVFrame->ToggleChildWindow( SID_NAVIGATOR );
800*cdf0e10cSrcweir 				pCh = pVFrame->GetChildWindow( SID_NAVIGATOR );
801*cdf0e10cSrcweir 
802*cdf0e10cSrcweir 			}
803*cdf0e10cSrcweir 				((SwNavigationPI*) pCh->GetContextWindow(SW_MOD()))->GotoPage();
804*cdf0e10cSrcweir 		}
805*cdf0e10cSrcweir 		break;
806*cdf0e10cSrcweir 		case  FN_EDIT_CURRENT_TOX:
807*cdf0e10cSrcweir 		{
808*cdf0e10cSrcweir 			GetViewFrame()->GetDispatcher()->Execute(
809*cdf0e10cSrcweir 								FN_INSERT_MULTI_TOX, SFX_CALLMODE_ASYNCHRON);
810*cdf0e10cSrcweir 		}
811*cdf0e10cSrcweir 		break;
812*cdf0e10cSrcweir 		case FN_UPDATE_CUR_TOX:
813*cdf0e10cSrcweir 		{
814*cdf0e10cSrcweir 			const SwTOXBase* pBase = pWrtShell->GetCurTOX();
815*cdf0e10cSrcweir 			if(pBase)
816*cdf0e10cSrcweir 			{
817*cdf0e10cSrcweir 				pWrtShell->StartAction();
818*cdf0e10cSrcweir 				if(TOX_INDEX == pBase->GetType())
819*cdf0e10cSrcweir 					pWrtShell->ApplyAutoMark();
820*cdf0e10cSrcweir 				pWrtShell->UpdateTableOf( *pBase );
821*cdf0e10cSrcweir 				pWrtShell->EndAction();
822*cdf0e10cSrcweir 			}
823*cdf0e10cSrcweir 		}
824*cdf0e10cSrcweir 		break;
825*cdf0e10cSrcweir 		case FN_UPDATE_TOX:
826*cdf0e10cSrcweir 		{
827*cdf0e10cSrcweir 			pWrtShell->StartAction();
828*cdf0e10cSrcweir 			pWrtShell->EnterStdMode();
829*cdf0e10cSrcweir 			sal_Bool bOldCrsrInReadOnly = pWrtShell->IsReadOnlyAvailable();
830*cdf0e10cSrcweir 			pWrtShell->SetReadOnlyAvailable( sal_True );
831*cdf0e10cSrcweir 
832*cdf0e10cSrcweir 			for( sal_uInt16 i = 0; i < 2; ++i )
833*cdf0e10cSrcweir 			{
834*cdf0e10cSrcweir 				sal_uInt16 nCount = pWrtShell->GetTOXCount();
835*cdf0e10cSrcweir 				if( 1 == nCount )
836*cdf0e10cSrcweir 					++i;
837*cdf0e10cSrcweir 
838*cdf0e10cSrcweir 				while( pWrtShell->GotoPrevTOXBase() )
839*cdf0e10cSrcweir 					;   // aufs erste Verzeichnis springen
840*cdf0e10cSrcweir 
841*cdf0e10cSrcweir 				// falls wir nicht mehr in einem stehen, dann zum naechsten
842*cdf0e10cSrcweir 				// springen.
843*cdf0e10cSrcweir 				const SwTOXBase* pBase = pWrtShell->GetCurTOX();
844*cdf0e10cSrcweir 				if( !pBase )
845*cdf0e10cSrcweir 				{
846*cdf0e10cSrcweir 					pWrtShell->GotoNextTOXBase();
847*cdf0e10cSrcweir 					pBase = pWrtShell->GetCurTOX();
848*cdf0e10cSrcweir 				}
849*cdf0e10cSrcweir 
850*cdf0e10cSrcweir 				sal_Bool bAutoMarkApplied = sal_False;
851*cdf0e10cSrcweir 				while( pBase )
852*cdf0e10cSrcweir 				{
853*cdf0e10cSrcweir 					if(TOX_INDEX == pBase->GetType() && !bAutoMarkApplied)
854*cdf0e10cSrcweir 					{
855*cdf0e10cSrcweir 						pWrtShell->ApplyAutoMark();
856*cdf0e10cSrcweir 						bAutoMarkApplied = sal_True;
857*cdf0e10cSrcweir 					}
858*cdf0e10cSrcweir 					// JP 15.07.96: das pBase wird nur fuer die Schnittstelle
859*cdf0e10cSrcweir 					//              benoetigt. Muss mal umgetstellt werden!!!
860*cdf0e10cSrcweir 					pWrtShell->UpdateTableOf( *pBase );
861*cdf0e10cSrcweir 
862*cdf0e10cSrcweir 					if( pWrtShell->GotoNextTOXBase() )
863*cdf0e10cSrcweir 						pBase = pWrtShell->GetCurTOX();
864*cdf0e10cSrcweir 					else
865*cdf0e10cSrcweir 						pBase = 0;
866*cdf0e10cSrcweir 				}
867*cdf0e10cSrcweir 			}
868*cdf0e10cSrcweir 			pWrtShell->SetReadOnlyAvailable( bOldCrsrInReadOnly );
869*cdf0e10cSrcweir 			pWrtShell->EndAction();
870*cdf0e10cSrcweir 		}
871*cdf0e10cSrcweir 		break;
872*cdf0e10cSrcweir 		case SID_ATTR_BRUSH:
873*cdf0e10cSrcweir 		{
874*cdf0e10cSrcweir 			if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(RES_BACKGROUND, sal_False, &pItem))
875*cdf0e10cSrcweir 			{
876*cdf0e10cSrcweir 				const sal_uInt16 nCurIdx = pWrtShell->GetCurPageDesc();
877*cdf0e10cSrcweir 				SwPageDesc aDesc( pWrtShell->GetPageDesc( nCurIdx ));
878*cdf0e10cSrcweir 				SwFrmFmt& rMaster = aDesc.GetMaster();
879*cdf0e10cSrcweir                 rMaster.SetFmtAttr(*pItem);
880*cdf0e10cSrcweir 				pWrtShell->ChgPageDesc( nCurIdx, aDesc);
881*cdf0e10cSrcweir 			}
882*cdf0e10cSrcweir 		}
883*cdf0e10cSrcweir 		break;
884*cdf0e10cSrcweir 		case SID_CLEARHISTORY:
885*cdf0e10cSrcweir 		{
886*cdf0e10cSrcweir 			pWrtShell->DelAllUndoObj();
887*cdf0e10cSrcweir 		}
888*cdf0e10cSrcweir 		break;
889*cdf0e10cSrcweir 		case SID_UNDO:
890*cdf0e10cSrcweir 		{
891*cdf0e10cSrcweir 			pShell->ExecuteSlot(rReq);
892*cdf0e10cSrcweir 		}
893*cdf0e10cSrcweir 		break;
894*cdf0e10cSrcweir 		case FN_INSERT_CTRL:
895*cdf0e10cSrcweir 		case FN_INSERT_OBJ_CTRL:
896*cdf0e10cSrcweir 		{
897*cdf0e10cSrcweir 			if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(nSlot, sal_False, &pItem))
898*cdf0e10cSrcweir 			{
899*cdf0e10cSrcweir 				sal_uInt16 nValue = ((SfxUInt16Item*)pItem)->GetValue();
900*cdf0e10cSrcweir 				switch ( nSlot )
901*cdf0e10cSrcweir 				{
902*cdf0e10cSrcweir 					case FN_INSERT_CTRL:
903*cdf0e10cSrcweir 					{
904*cdf0e10cSrcweir 						sal_Bool bWeb = 0 != PTR_CAST(SwWebView, this);
905*cdf0e10cSrcweir 						if(bWeb)
906*cdf0e10cSrcweir 							SwView::nWebInsertCtrlState = nValue;
907*cdf0e10cSrcweir 						else
908*cdf0e10cSrcweir 							SwView::nInsertCtrlState = nValue;
909*cdf0e10cSrcweir 					}
910*cdf0e10cSrcweir 					break;
911*cdf0e10cSrcweir 					case FN_INSERT_OBJ_CTRL:    SwView::nInsertObjectCtrlState = nValue  ;break;
912*cdf0e10cSrcweir 				}
913*cdf0e10cSrcweir 
914*cdf0e10cSrcweir 			}
915*cdf0e10cSrcweir 			GetViewFrame()->GetBindings().Invalidate( nSlot );
916*cdf0e10cSrcweir 		}
917*cdf0e10cSrcweir 		break;
918*cdf0e10cSrcweir #if defined WNT || defined UNX
919*cdf0e10cSrcweir         case SID_TWAIN_SELECT:
920*cdf0e10cSrcweir         case SID_TWAIN_TRANSFER:
921*cdf0e10cSrcweir             GetViewImpl()->ExecuteScan( rReq );
922*cdf0e10cSrcweir 		break;
923*cdf0e10cSrcweir #endif
924*cdf0e10cSrcweir 
925*cdf0e10cSrcweir 		case SID_ATTR_DEFTABSTOP:
926*cdf0e10cSrcweir 		{
927*cdf0e10cSrcweir 			if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_DEFTABSTOP, sal_False, &pItem))
928*cdf0e10cSrcweir 			{
929*cdf0e10cSrcweir                 SvxTabStopItem aDefTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
930*cdf0e10cSrcweir 				sal_uInt16 nTab = ((const SfxUInt16Item*)pItem)->GetValue();
931*cdf0e10cSrcweir 				MakeDefTabs( nTab, aDefTabs );
932*cdf0e10cSrcweir 				pWrtShell->SetDefault( aDefTabs );
933*cdf0e10cSrcweir 			}
934*cdf0e10cSrcweir 		}
935*cdf0e10cSrcweir 		break;
936*cdf0e10cSrcweir 		case SID_ATTR_LANGUAGE	:
937*cdf0e10cSrcweir 		if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_LANGUAGE, sal_False, &pItem))
938*cdf0e10cSrcweir 		{
939*cdf0e10cSrcweir 			SvxLanguageItem aLang(((SvxLanguageItem*)pItem)->GetLanguage(), RES_CHRATR_LANGUAGE);
940*cdf0e10cSrcweir 			pWrtShell->SetDefault( aLang );
941*cdf0e10cSrcweir 			lcl_SetAllTextToDefaultLanguage( *pWrtShell, RES_CHRATR_LANGUAGE );
942*cdf0e10cSrcweir 		}
943*cdf0e10cSrcweir 		break;
944*cdf0e10cSrcweir 		case  SID_ATTR_CHAR_CTL_LANGUAGE:
945*cdf0e10cSrcweir 		if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(RES_CHRATR_CTL_LANGUAGE, sal_False, &pItem))
946*cdf0e10cSrcweir 		{
947*cdf0e10cSrcweir 			pWrtShell->SetDefault( *pItem );
948*cdf0e10cSrcweir 			lcl_SetAllTextToDefaultLanguage( *pWrtShell, RES_CHRATR_CTL_LANGUAGE );
949*cdf0e10cSrcweir 		}
950*cdf0e10cSrcweir 		break;
951*cdf0e10cSrcweir 		case  SID_ATTR_CHAR_CJK_LANGUAGE:
952*cdf0e10cSrcweir 		if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(RES_CHRATR_CJK_LANGUAGE, sal_False, &pItem))
953*cdf0e10cSrcweir 		{
954*cdf0e10cSrcweir 			pWrtShell->SetDefault( *pItem );
955*cdf0e10cSrcweir 			lcl_SetAllTextToDefaultLanguage( *pWrtShell, RES_CHRATR_CJK_LANGUAGE );
956*cdf0e10cSrcweir 		}
957*cdf0e10cSrcweir 		break;
958*cdf0e10cSrcweir         case FN_SCROLL_NEXT_PREV:
959*cdf0e10cSrcweir 			if(pArgs && pArgs->GetItemState(FN_SCROLL_NEXT_PREV, sal_False, &pItem))
960*cdf0e10cSrcweir 			{
961*cdf0e10cSrcweir                 // call the handlers of PageUp/DownButtons, only
962*cdf0e10cSrcweir                 bool* pbNext = new bool ( ((const SfxBoolItem*)pItem)->GetValue() );
963*cdf0e10cSrcweir                 // #i75416# move the execution of the search to an asynchronously called static link
964*cdf0e10cSrcweir                 Application::PostUserEvent( STATIC_LINK(this, SwView, MoveNavigationHdl), pbNext );
965*cdf0e10cSrcweir 			}
966*cdf0e10cSrcweir 			break;
967*cdf0e10cSrcweir 		case SID_JUMPTOMARK:
968*cdf0e10cSrcweir 			if( pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_JUMPTOMARK, sal_False, &pItem))
969*cdf0e10cSrcweir 				JumpToSwMark( (( const SfxStringItem*)pItem)->GetValue() );
970*cdf0e10cSrcweir 			break;
971*cdf0e10cSrcweir 		case SID_GALLERY :
972*cdf0e10cSrcweir             GetViewFrame()->ChildWindowExecute(rReq);//ToggleChildWindow(SID_GALLERY);
973*cdf0e10cSrcweir 		break;
974*cdf0e10cSrcweir 		case SID_AVMEDIA_PLAYER :
975*cdf0e10cSrcweir             GetViewFrame()->ChildWindowExecute(rReq);//ToggleChildWindow(SID_AVMEDIA_PLAYER);
976*cdf0e10cSrcweir 		break;
977*cdf0e10cSrcweir         case SID_VIEW_DATA_SOURCE_BROWSER:
978*cdf0e10cSrcweir 		{
979*cdf0e10cSrcweir             SfxViewFrame* pVFrame = GetViewFrame();
980*cdf0e10cSrcweir             pVFrame->ChildWindowExecute(rReq);
981*cdf0e10cSrcweir             if(pVFrame->HasChildWindow(SID_BROWSER))
982*cdf0e10cSrcweir             {
983*cdf0e10cSrcweir                 const SwDBData& rData = GetWrtShell().GetDBDesc();
984*cdf0e10cSrcweir                 SW_MOD()->ShowDBObj(*this, rData, sal_False);
985*cdf0e10cSrcweir             }
986*cdf0e10cSrcweir         }
987*cdf0e10cSrcweir 		break;
988*cdf0e10cSrcweir         case FN_INSERT_FIELD_DATA_ONLY :
989*cdf0e10cSrcweir 		{
990*cdf0e10cSrcweir 			sal_Bool bShow = sal_False;
991*cdf0e10cSrcweir 			if( pArgs &&
992*cdf0e10cSrcweir 				SFX_ITEM_SET == pArgs->GetItemState(nSlot, sal_False, &pItem ))
993*cdf0e10cSrcweir 				bShow = ((const SfxBoolItem*)pItem)->GetValue();
994*cdf0e10cSrcweir             //GetViewFrame()->ShowChildWindow(nSlot, bShow && bInMailMerge);
995*cdf0e10cSrcweir             if((bShow && bInMailMerge) != GetViewFrame()->HasChildWindow(nSlot))
996*cdf0e10cSrcweir                 GetViewFrame()->ToggleChildWindow(nSlot);
997*cdf0e10cSrcweir             //if fields have been succesfully inserted call the "real"
998*cdf0e10cSrcweir             //mail merge dialog
999*cdf0e10cSrcweir             SwWrtShell &rSh = GetWrtShell();
1000*cdf0e10cSrcweir             if(bInMailMerge && rSh.IsAnyDatabaseFieldInDoc())
1001*cdf0e10cSrcweir             {
1002*cdf0e10cSrcweir                 SwNewDBMgr* pNewDBMgr = rSh.GetNewDBMgr();
1003*cdf0e10cSrcweir                 if (pNewDBMgr)
1004*cdf0e10cSrcweir                 {
1005*cdf0e10cSrcweir                     SwDBData aData;
1006*cdf0e10cSrcweir                     aData = rSh.GetDBData();
1007*cdf0e10cSrcweir                     rSh.EnterStdMode(); // Wechsel in Textshell erzwingen; ist fuer
1008*cdf0e10cSrcweir                                         // das Mischen von DB-Feldern notwendig.
1009*cdf0e10cSrcweir                     AttrChangedNotify( &rSh );
1010*cdf0e10cSrcweir                     pNewDBMgr->SetMergeType( DBMGR_MERGE );
1011*cdf0e10cSrcweir 
1012*cdf0e10cSrcweir                     Sequence<PropertyValue> aProperties(3);
1013*cdf0e10cSrcweir                     PropertyValue* pValues = aProperties.getArray();
1014*cdf0e10cSrcweir                     pValues[0].Name = C2U("DataSourceName");
1015*cdf0e10cSrcweir                     pValues[1].Name = C2U("Command");
1016*cdf0e10cSrcweir                     pValues[2].Name = C2U("CommandType");
1017*cdf0e10cSrcweir                     pValues[0].Value <<= aData.sDataSource;
1018*cdf0e10cSrcweir                     pValues[1].Value <<= aData.sCommand;
1019*cdf0e10cSrcweir                     pValues[2].Value <<= aData.nCommandType;
1020*cdf0e10cSrcweir                     pNewDBMgr->ExecuteFormLetter(rSh, aProperties, sal_True);
1021*cdf0e10cSrcweir                 }
1022*cdf0e10cSrcweir             }
1023*cdf0e10cSrcweir             bInMailMerge &= bShow;
1024*cdf0e10cSrcweir             GetViewFrame()->GetBindings().Invalidate(FN_INSERT_FIELD);
1025*cdf0e10cSrcweir 		}
1026*cdf0e10cSrcweir         break;
1027*cdf0e10cSrcweir         case FN_QRY_MERGE:
1028*cdf0e10cSrcweir         {
1029*cdf0e10cSrcweir             sal_Bool bUseCurrentDocument = sal_True;
1030*cdf0e10cSrcweir             sal_Bool bQuery = !pArgs||SFX_ITEM_SET != pArgs->GetItemState(nSlot);
1031*cdf0e10cSrcweir             if(bQuery)
1032*cdf0e10cSrcweir             {
1033*cdf0e10cSrcweir                 SfxViewFrame* pTmpFrame = GetViewFrame();
1034*cdf0e10cSrcweir                 SfxHelp::OpenHelpAgent( &pTmpFrame->GetFrame(), HID_MAIL_MERGE_SELECT );
1035*cdf0e10cSrcweir 				SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
1036*cdf0e10cSrcweir                 DBG_ASSERT(pFact, "Dialogdiet fail!");
1037*cdf0e10cSrcweir                 AbstractMailMergeCreateFromDlg* pDlg = pFact->CreateMailMergeCreateFromDlg( DLG_MERGE_CREATE,
1038*cdf0e10cSrcweir 														&pTmpFrame->GetWindow());
1039*cdf0e10cSrcweir                 DBG_ASSERT(pDlg, "Dialogdiet fail!");
1040*cdf0e10cSrcweir 				if(RET_OK == pDlg->Execute())
1041*cdf0e10cSrcweir                     bUseCurrentDocument = pDlg->IsThisDocument();
1042*cdf0e10cSrcweir                 else
1043*cdf0e10cSrcweir                     break;
1044*cdf0e10cSrcweir             }
1045*cdf0e10cSrcweir             GenerateFormLetter(bUseCurrentDocument);
1046*cdf0e10cSrcweir         }
1047*cdf0e10cSrcweir         break;
1048*cdf0e10cSrcweir         case SID_RECHECK_DOCUMENT:
1049*cdf0e10cSrcweir         {
1050*cdf0e10cSrcweir             SwDocShell* pDocShell = GetDocShell();
1051*cdf0e10cSrcweir             SwDoc* pDoc = pDocShell->GetDoc();
1052*cdf0e10cSrcweir             uno::Reference< linguistic2::XProofreadingIterator >  xGCIterator( pDoc->GetGCIterator() );
1053*cdf0e10cSrcweir             if( xGCIterator.is() )
1054*cdf0e10cSrcweir             {
1055*cdf0e10cSrcweir                 xGCIterator->resetIgnoreRules();
1056*cdf0e10cSrcweir             }
1057*cdf0e10cSrcweir             // reset ignore lists
1058*cdf0e10cSrcweir             pDoc->SpellItAgainSam( sal_True, sal_False, sal_False );
1059*cdf0e10cSrcweir             // clear ignore dictionary
1060*cdf0e10cSrcweir             uno::Reference< linguistic2::XDictionary > xDictionary( SvxGetIgnoreAllList(), uno::UNO_QUERY );
1061*cdf0e10cSrcweir             if( xDictionary.is() )
1062*cdf0e10cSrcweir                 xDictionary->clear();
1063*cdf0e10cSrcweir             // put cursor to the start of the document
1064*cdf0e10cSrcweir             pWrtShell->SttDoc();
1065*cdf0e10cSrcweir         }
1066*cdf0e10cSrcweir         // no break; - but call spell/grammar dialog
1067*cdf0e10cSrcweir         case FN_SPELL_GRAMMAR_DIALOG:
1068*cdf0e10cSrcweir         {
1069*cdf0e10cSrcweir             SfxViewFrame* pViewFrame = GetViewFrame();
1070*cdf0e10cSrcweir             if (rReq.GetArgs() != NULL)
1071*cdf0e10cSrcweir                 pViewFrame->SetChildWindow (FN_SPELL_GRAMMAR_DIALOG,
1072*cdf0e10cSrcweir                     ((const SfxBoolItem&) (rReq.GetArgs()->
1073*cdf0e10cSrcweir                         Get(FN_SPELL_GRAMMAR_DIALOG))).GetValue());
1074*cdf0e10cSrcweir             else
1075*cdf0e10cSrcweir                 pViewFrame->ToggleChildWindow(FN_SPELL_GRAMMAR_DIALOG);
1076*cdf0e10cSrcweir 
1077*cdf0e10cSrcweir             pViewFrame->GetBindings().Invalidate(FN_SPELL_GRAMMAR_DIALOG);
1078*cdf0e10cSrcweir             rReq.Ignore ();
1079*cdf0e10cSrcweir         }
1080*cdf0e10cSrcweir         break;
1081*cdf0e10cSrcweir         case SID_ALIGN_ANY_LEFT :
1082*cdf0e10cSrcweir         case SID_ALIGN_ANY_HCENTER  :
1083*cdf0e10cSrcweir         case SID_ALIGN_ANY_RIGHT    :
1084*cdf0e10cSrcweir         case SID_ALIGN_ANY_JUSTIFIED:
1085*cdf0e10cSrcweir         case SID_ALIGN_ANY_TOP      :
1086*cdf0e10cSrcweir         case SID_ALIGN_ANY_VCENTER  :
1087*cdf0e10cSrcweir         case SID_ALIGN_ANY_BOTTOM   :
1088*cdf0e10cSrcweir         case SID_ALIGN_ANY_HDEFAULT :
1089*cdf0e10cSrcweir         case SID_ALIGN_ANY_VDEFAULT :
1090*cdf0e10cSrcweir         {
1091*cdf0e10cSrcweir             sal_uInt16 nAlias = 0;
1092*cdf0e10cSrcweir             if( nSelectionType & (nsSelectionType::SEL_DRW_TXT|nsSelectionType::SEL_TXT) )
1093*cdf0e10cSrcweir             {
1094*cdf0e10cSrcweir                 switch( nSlot )
1095*cdf0e10cSrcweir                 {
1096*cdf0e10cSrcweir                     case SID_ALIGN_ANY_LEFT :       nAlias = SID_ATTR_PARA_ADJUST_LEFT; break;
1097*cdf0e10cSrcweir                     case SID_ALIGN_ANY_HCENTER  :   nAlias = SID_ATTR_PARA_ADJUST_CENTER; break;
1098*cdf0e10cSrcweir                     case SID_ALIGN_ANY_RIGHT    :   nAlias = SID_ATTR_PARA_ADJUST_RIGHT; break;
1099*cdf0e10cSrcweir                     case SID_ALIGN_ANY_JUSTIFIED:   nAlias = SID_ATTR_PARA_ADJUST_BLOCK; break;
1100*cdf0e10cSrcweir                     case SID_ALIGN_ANY_TOP      :   nAlias = FN_TABLE_VERT_NONE; break;
1101*cdf0e10cSrcweir                     case SID_ALIGN_ANY_VCENTER  :   nAlias = FN_TABLE_VERT_CENTER; break;
1102*cdf0e10cSrcweir                     case SID_ALIGN_ANY_BOTTOM   :   nAlias = FN_TABLE_VERT_BOTTOM; break;
1103*cdf0e10cSrcweir                 }
1104*cdf0e10cSrcweir             }
1105*cdf0e10cSrcweir             else
1106*cdf0e10cSrcweir             {
1107*cdf0e10cSrcweir                 switch( nSlot )
1108*cdf0e10cSrcweir                 {
1109*cdf0e10cSrcweir                     case SID_ALIGN_ANY_LEFT :       nAlias = SID_OBJECT_ALIGN_LEFT    ; break;
1110*cdf0e10cSrcweir                     case SID_ALIGN_ANY_HCENTER  :   nAlias = SID_OBJECT_ALIGN_CENTER ; break;
1111*cdf0e10cSrcweir                     case SID_ALIGN_ANY_RIGHT    :   nAlias = SID_OBJECT_ALIGN_RIGHT  ; break;
1112*cdf0e10cSrcweir                     case SID_ALIGN_ANY_TOP      :   nAlias = SID_OBJECT_ALIGN_UP     ;  break;
1113*cdf0e10cSrcweir                     case SID_ALIGN_ANY_VCENTER  :   nAlias = SID_OBJECT_ALIGN_MIDDLE ;  break;
1114*cdf0e10cSrcweir                     case SID_ALIGN_ANY_BOTTOM   :   nAlias = SID_OBJECT_ALIGN_DOWN    ; break;
1115*cdf0e10cSrcweir                 }
1116*cdf0e10cSrcweir             }
1117*cdf0e10cSrcweir             //special handling for the draw shell
1118*cdf0e10cSrcweir             if(nAlias && (nSelectionType & (nsSelectionType::SEL_DRW)))
1119*cdf0e10cSrcweir             {
1120*cdf0e10cSrcweir                 SfxAllEnumItem aEnumItem(SID_OBJECT_ALIGN, nAlias - SID_OBJECT_ALIGN_LEFT);
1121*cdf0e10cSrcweir                 GetViewFrame()->GetDispatcher()->Execute(
1122*cdf0e10cSrcweir                                 SID_OBJECT_ALIGN, SFX_CALLMODE_ASYNCHRON, &aEnumItem, 0L);
1123*cdf0e10cSrcweir             }
1124*cdf0e10cSrcweir             else if(nAlias)
1125*cdf0e10cSrcweir             //these slots are either re-mapped to text or object alignment
1126*cdf0e10cSrcweir                 GetViewFrame()->GetDispatcher()->Execute(
1127*cdf0e10cSrcweir                                 nAlias, SFX_CALLMODE_ASYNCHRON);
1128*cdf0e10cSrcweir         }
1129*cdf0e10cSrcweir         break;
1130*cdf0e10cSrcweir         case SID_RESTORE_EDITING_VIEW:
1131*cdf0e10cSrcweir         {
1132*cdf0e10cSrcweir             //#i33307# restore editing position
1133*cdf0e10cSrcweir             Point aCrsrPos;
1134*cdf0e10cSrcweir             bool bSelectObj;
1135*cdf0e10cSrcweir             if(pViewImpl->GetRestorePosition(aCrsrPos, bSelectObj))
1136*cdf0e10cSrcweir             {
1137*cdf0e10cSrcweir                 pWrtShell->SwCrsrShell::SetCrsr( aCrsrPos, !bSelectObj );
1138*cdf0e10cSrcweir                 if( bSelectObj )
1139*cdf0e10cSrcweir                 {
1140*cdf0e10cSrcweir                     pWrtShell->SelectObj( aCrsrPos );
1141*cdf0e10cSrcweir                     pWrtShell->EnterSelFrmMode( &aCrsrPos );
1142*cdf0e10cSrcweir                 }
1143*cdf0e10cSrcweir             }
1144*cdf0e10cSrcweir         }
1145*cdf0e10cSrcweir         break;
1146*cdf0e10cSrcweir         case SID_INSERT_GRAPHIC:
1147*cdf0e10cSrcweir         {
1148*cdf0e10cSrcweir             rReq.SetReturnValue(SfxBoolItem(nSlot, InsertGraphicDlg( rReq )));
1149*cdf0e10cSrcweir         }
1150*cdf0e10cSrcweir         break;
1151*cdf0e10cSrcweir 
1152*cdf0e10cSrcweir 
1153*cdf0e10cSrcweir         default:
1154*cdf0e10cSrcweir 			ASSERT(!this, falscher Dispatcher);
1155*cdf0e10cSrcweir 			return;
1156*cdf0e10cSrcweir 	}
1157*cdf0e10cSrcweir     if(!bIgnore)
1158*cdf0e10cSrcweir         rReq.Done();
1159*cdf0e10cSrcweir }
1160*cdf0e10cSrcweir 
1161*cdf0e10cSrcweir /*--------------------------------------------------------------------
1162*cdf0e10cSrcweir 	Beschreibung:	SeitenNr-Feld invalidieren
1163*cdf0e10cSrcweir  --------------------------------------------------------------------*/
1164*cdf0e10cSrcweir 
1165*cdf0e10cSrcweir void SwView::UpdatePageNums(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const String& rPgStr)
1166*cdf0e10cSrcweir {
1167*cdf0e10cSrcweir 	String sTemp(GetPageStr( nPhyNum, nVirtNum, rPgStr ));
1168*cdf0e10cSrcweir 	const SfxStringItem aTmp( FN_STAT_PAGE, sTemp );
1169*cdf0e10cSrcweir 	SfxBindings &rBnd = GetViewFrame()->GetBindings();
1170*cdf0e10cSrcweir 	rBnd.SetState( aTmp );
1171*cdf0e10cSrcweir 	rBnd.Update( FN_STAT_PAGE );
1172*cdf0e10cSrcweir }
1173*cdf0e10cSrcweir 
1174*cdf0e10cSrcweir /*--------------------------------------------------------------------
1175*cdf0e10cSrcweir 	Beschreibung:	Status der Stauszeile
1176*cdf0e10cSrcweir  --------------------------------------------------------------------*/
1177*cdf0e10cSrcweir 
1178*cdf0e10cSrcweir 
1179*cdf0e10cSrcweir void SwView::StateStatusLine(SfxItemSet &rSet)
1180*cdf0e10cSrcweir {
1181*cdf0e10cSrcweir 	SwWrtShell& rShell = GetWrtShell();
1182*cdf0e10cSrcweir 
1183*cdf0e10cSrcweir 	SfxWhichIter aIter( rSet );
1184*cdf0e10cSrcweir 	sal_uInt16 nWhich = aIter.FirstWhich();
1185*cdf0e10cSrcweir 	ASSERT( nWhich, "leeres Set");
1186*cdf0e10cSrcweir 
1187*cdf0e10cSrcweir 	while( nWhich )
1188*cdf0e10cSrcweir 	{
1189*cdf0e10cSrcweir 		switch( nWhich )
1190*cdf0e10cSrcweir 		{
1191*cdf0e10cSrcweir 			case FN_STAT_PAGE:
1192*cdf0e10cSrcweir /*
1193*cdf0e10cSrcweir //JP 07.01.00: is a nice feature - show the selektion of DrawObjects
1194*cdf0e10cSrcweir 			if( rShell.IsObjSelected()
1195*cdf0e10cSrcweir //???				|| rShell.IsFrmSelected()
1196*cdf0e10cSrcweir 				)
1197*cdf0e10cSrcweir 			{
1198*cdf0e10cSrcweir 				String sDisplay( rShell.GetDrawView()->GetMarkedObjectList().
1199*cdf0e10cSrcweir 									GetDescriptionOfMarkedObjects() );
1200*cdf0e10cSrcweir 				rSet.Put( SfxStringItem( FN_STAT_PAGE, sDisplay ));
1201*cdf0e10cSrcweir 			}
1202*cdf0e10cSrcweir 			else
1203*cdf0e10cSrcweir */			{
1204*cdf0e10cSrcweir 				// Anzahl der Seiten, log. SeitenNr. SeitenNr ermitteln
1205*cdf0e10cSrcweir 				sal_uInt16 nPage, nLogPage;
1206*cdf0e10cSrcweir 				String sDisplay;
1207*cdf0e10cSrcweir 				rShell.GetPageNumber( -1, rShell.IsCrsrVisible(), nPage, nLogPage, sDisplay );
1208*cdf0e10cSrcweir 				rSet.Put( SfxStringItem( FN_STAT_PAGE,
1209*cdf0e10cSrcweir 							GetPageStr( nPage, nLogPage, sDisplay) ));
1210*cdf0e10cSrcweir 
1211*cdf0e10cSrcweir 				sal_uInt16 nCnt = GetWrtShell().GetPageCnt();
1212*cdf0e10cSrcweir 				if (nPageCnt != nCnt)	// Basic benachrichtigen
1213*cdf0e10cSrcweir 				{
1214*cdf0e10cSrcweir 					nPageCnt = nCnt;
1215*cdf0e10cSrcweir                     SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_PAGE_COUNT, SwDocShell::GetEventName(STR_SW_EVENT_PAGE_COUNT), GetViewFrame()->GetObjectShell()), sal_False);
1216*cdf0e10cSrcweir 				}
1217*cdf0e10cSrcweir 			}
1218*cdf0e10cSrcweir 			break;
1219*cdf0e10cSrcweir 			case FN_STAT_TEMPLATE:
1220*cdf0e10cSrcweir 			{
1221*cdf0e10cSrcweir 				rSet.Put(SfxStringItem( FN_STAT_TEMPLATE,
1222*cdf0e10cSrcweir 										rShell.GetCurPageStyle(sal_False)));
1223*cdf0e10cSrcweir 
1224*cdf0e10cSrcweir 			}
1225*cdf0e10cSrcweir 			break;
1226*cdf0e10cSrcweir 			case SID_ATTR_ZOOM:
1227*cdf0e10cSrcweir 			{
1228*cdf0e10cSrcweir 				if ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() )
1229*cdf0e10cSrcweir 				{
1230*cdf0e10cSrcweir 					const SwViewOption* pVOpt = rShell.GetViewOptions();
1231*cdf0e10cSrcweir 					SvxZoomType eZoom = (SvxZoomType) pVOpt->GetZoomType();
1232*cdf0e10cSrcweir 					SvxZoomItem aZoom(eZoom,
1233*cdf0e10cSrcweir 										pVOpt->GetZoom());
1234*cdf0e10cSrcweir 					if( pVOpt->getBrowseMode() )
1235*cdf0e10cSrcweir 					{
1236*cdf0e10cSrcweir 						aZoom.SetValueSet(
1237*cdf0e10cSrcweir 								SVX_ZOOM_ENABLE_50|
1238*cdf0e10cSrcweir 								SVX_ZOOM_ENABLE_75|
1239*cdf0e10cSrcweir 								SVX_ZOOM_ENABLE_100|
1240*cdf0e10cSrcweir 								SVX_ZOOM_ENABLE_150|
1241*cdf0e10cSrcweir 								SVX_ZOOM_ENABLE_200);
1242*cdf0e10cSrcweir 					}
1243*cdf0e10cSrcweir 					rSet.Put( aZoom );
1244*cdf0e10cSrcweir                 }
1245*cdf0e10cSrcweir 				else
1246*cdf0e10cSrcweir 					rSet.DisableItem( SID_ATTR_ZOOM );
1247*cdf0e10cSrcweir 			}
1248*cdf0e10cSrcweir 			break;
1249*cdf0e10cSrcweir             case SID_ATTR_VIEWLAYOUT:
1250*cdf0e10cSrcweir             {
1251*cdf0e10cSrcweir 				if ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() )
1252*cdf0e10cSrcweir                 {
1253*cdf0e10cSrcweir                     const SwViewOption* pVOpt = rShell.GetViewOptions();
1254*cdf0e10cSrcweir                     const sal_uInt16 nColumns  = pVOpt->GetViewLayoutColumns();
1255*cdf0e10cSrcweir                     const bool  bBookMode = pVOpt->IsViewLayoutBookMode();
1256*cdf0e10cSrcweir                     SvxViewLayoutItem aViewLayout(nColumns, bBookMode);
1257*cdf0e10cSrcweir                     rSet.Put( aViewLayout );
1258*cdf0e10cSrcweir                 }
1259*cdf0e10cSrcweir                 else
1260*cdf0e10cSrcweir                     rSet.DisableItem( SID_ATTR_VIEWLAYOUT );
1261*cdf0e10cSrcweir             }
1262*cdf0e10cSrcweir             break;
1263*cdf0e10cSrcweir             case SID_ATTR_ZOOMSLIDER:
1264*cdf0e10cSrcweir             {
1265*cdf0e10cSrcweir 				if ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() )
1266*cdf0e10cSrcweir                 {
1267*cdf0e10cSrcweir                     const SwViewOption* pVOpt = rShell.GetViewOptions();
1268*cdf0e10cSrcweir                     const sal_uInt16 nCurrentZoom = pVOpt->GetZoom();
1269*cdf0e10cSrcweir                     SvxZoomSliderItem aZoomSliderItem( nCurrentZoom, MINZOOM, MAXZOOM );
1270*cdf0e10cSrcweir                     aZoomSliderItem.AddSnappingPoint( 100 );
1271*cdf0e10cSrcweir 
1272*cdf0e10cSrcweir                     if ( !pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) )
1273*cdf0e10cSrcweir                     {
1274*cdf0e10cSrcweir                         const sal_uInt16 nColumns = pVOpt->GetViewLayoutColumns();
1275*cdf0e10cSrcweir                         const bool bAutomaticViewLayout = 0 == nColumns;
1276*cdf0e10cSrcweir                         const SwPostItMgr* pMgr = GetPostItMgr();
1277*cdf0e10cSrcweir 
1278*cdf0e10cSrcweir                         // snapping points:
1279*cdf0e10cSrcweir                         // automatic mode: 1 Page, 2 Pages, 100%
1280*cdf0e10cSrcweir                         // n Columns mode: n Pages, 100%
1281*cdf0e10cSrcweir                         // n Columns book mode: nPages without gaps, 100%
1282*cdf0e10cSrcweir                         const SwRect aPageRect( pWrtShell->GetAnyCurRect( RECT_PAGE_CALC ) );
1283*cdf0e10cSrcweir                         const SwRect aRootRect( pWrtShell->GetAnyCurRect( RECT_PAGES_AREA ) ); // width of columns
1284*cdf0e10cSrcweir                         Size aPageSize( aPageRect.SSize() );
1285*cdf0e10cSrcweir                         aPageSize.Width() += pMgr->HasNotes() && pMgr->ShowNotes() ?
1286*cdf0e10cSrcweir                                              pMgr->GetSidebarWidth() + pMgr->GetSidebarBorderWidth() :
1287*cdf0e10cSrcweir                                              0;
1288*cdf0e10cSrcweir 
1289*cdf0e10cSrcweir                         Size aRootSize( aRootRect.SSize() );
1290*cdf0e10cSrcweir 
1291*cdf0e10cSrcweir     		            const MapMode aTmpMap( MAP_TWIP );
1292*cdf0e10cSrcweir                         const Size& rEditSize = GetEditWin().GetOutputSizePixel();
1293*cdf0e10cSrcweir 		                const Size aWindowSize( GetEditWin().PixelToLogic( rEditSize, aTmpMap ) );
1294*cdf0e10cSrcweir 
1295*cdf0e10cSrcweir                         const long nOf = DOCUMENTBORDER * 2L;
1296*cdf0e10cSrcweir                         long nTmpWidth = bAutomaticViewLayout ? aPageSize.Width() : aRootSize.Width();
1297*cdf0e10cSrcweir                         nTmpWidth += nOf;
1298*cdf0e10cSrcweir                         aPageSize.Height() += nOf;
1299*cdf0e10cSrcweir                         long nFac = aWindowSize.Width() * 100 / nTmpWidth;
1300*cdf0e10cSrcweir 
1301*cdf0e10cSrcweir                         long nVisPercent = aWindowSize.Height() * 100 / aPageSize.Height();
1302*cdf0e10cSrcweir 			            nFac = Min( nFac, nVisPercent );
1303*cdf0e10cSrcweir 
1304*cdf0e10cSrcweir                         aZoomSliderItem.AddSnappingPoint( nFac );
1305*cdf0e10cSrcweir 
1306*cdf0e10cSrcweir                         if ( bAutomaticViewLayout )
1307*cdf0e10cSrcweir                         {
1308*cdf0e10cSrcweir                             nTmpWidth += aPageSize.Width() + GAPBETWEENPAGES;
1309*cdf0e10cSrcweir                             nFac = aWindowSize.Width() * 100 / nTmpWidth;
1310*cdf0e10cSrcweir                             nFac = Min( nFac, nVisPercent );
1311*cdf0e10cSrcweir                             aZoomSliderItem.AddSnappingPoint( nFac );
1312*cdf0e10cSrcweir                         }
1313*cdf0e10cSrcweir                     }
1314*cdf0e10cSrcweir 
1315*cdf0e10cSrcweir                     rSet.Put( aZoomSliderItem );
1316*cdf0e10cSrcweir                 }
1317*cdf0e10cSrcweir                 else
1318*cdf0e10cSrcweir                     rSet.DisableItem( SID_ATTR_ZOOMSLIDER );
1319*cdf0e10cSrcweir             }
1320*cdf0e10cSrcweir             break;
1321*cdf0e10cSrcweir             case SID_ATTR_POSITION:
1322*cdf0e10cSrcweir 			case SID_ATTR_SIZE:
1323*cdf0e10cSrcweir 			{
1324*cdf0e10cSrcweir 				if( !rShell.IsFrmSelected() && !rShell.IsObjSelected() )
1325*cdf0e10cSrcweir 					SwBaseShell::_SetFrmMode( FLY_DRAG_END );
1326*cdf0e10cSrcweir 				else
1327*cdf0e10cSrcweir 				{
1328*cdf0e10cSrcweir                     FlyMode eFrameMode = SwBaseShell::GetFrmMode();
1329*cdf0e10cSrcweir                     if ( eFrameMode == FLY_DRAG_START || eFrameMode == FLY_DRAG )
1330*cdf0e10cSrcweir 					{
1331*cdf0e10cSrcweir 						if ( nWhich == SID_ATTR_POSITION )
1332*cdf0e10cSrcweir 							rSet.Put( SfxPointItem( SID_ATTR_POSITION,
1333*cdf0e10cSrcweir 													rShell.GetAnchorObjDiff()));
1334*cdf0e10cSrcweir 						else
1335*cdf0e10cSrcweir 							rSet.Put( SvxSizeItem( SID_ATTR_SIZE,
1336*cdf0e10cSrcweir 												   rShell.GetObjSize()));
1337*cdf0e10cSrcweir 					}
1338*cdf0e10cSrcweir 				}
1339*cdf0e10cSrcweir 			}
1340*cdf0e10cSrcweir 			break;
1341*cdf0e10cSrcweir 			case SID_TABLE_CELL:
1342*cdf0e10cSrcweir 
1343*cdf0e10cSrcweir 			if( rShell.IsFrmSelected() || rShell.IsObjSelected() )
1344*cdf0e10cSrcweir 			{
1345*cdf0e10cSrcweir                 // #i39171# Don't put a SvxSizeItem into a slot which is defined as SfxStringItem.
1346*cdf0e10cSrcweir                 // SvxPosSizeStatusBarControl no longer resets to empty display if only one slot
1347*cdf0e10cSrcweir                 // has no item, so SID_TABLE_CELL can remain empty (the SvxSizeItem is supplied
1348*cdf0e10cSrcweir                 // in SID_ATTR_SIZE).
1349*cdf0e10cSrcweir 			}
1350*cdf0e10cSrcweir 			else
1351*cdf0e10cSrcweir 			{
1352*cdf0e10cSrcweir 				String sStr;
1353*cdf0e10cSrcweir 				if( rShell.IsCrsrInTbl() )
1354*cdf0e10cSrcweir 				{
1355*cdf0e10cSrcweir 					// table name + cell coordinate
1356*cdf0e10cSrcweir 					sStr = rShell.GetTableFmt()->GetName();
1357*cdf0e10cSrcweir 					sStr += ':';
1358*cdf0e10cSrcweir 					sStr += rShell.GetBoxNms();
1359*cdf0e10cSrcweir 				}
1360*cdf0e10cSrcweir 				else
1361*cdf0e10cSrcweir 				{
1362*cdf0e10cSrcweir 					const SwSection* pCurrSect = rShell.GetCurrSection();
1363*cdf0e10cSrcweir 					if( pCurrSect )
1364*cdf0e10cSrcweir 					{
1365*cdf0e10cSrcweir 						switch( pCurrSect->GetType() )
1366*cdf0e10cSrcweir 						{
1367*cdf0e10cSrcweir 						case TOX_HEADER_SECTION:
1368*cdf0e10cSrcweir 						case TOX_CONTENT_SECTION:
1369*cdf0e10cSrcweir 							{
1370*cdf0e10cSrcweir 								const SwTOXBase* pTOX = pWrtShell->GetCurTOX();
1371*cdf0e10cSrcweir 								if( pTOX )
1372*cdf0e10cSrcweir 									sStr = pTOX->GetTOXName();
1373*cdf0e10cSrcweir 								else
1374*cdf0e10cSrcweir 								{
1375*cdf0e10cSrcweir 									ASSERT( !this,
1376*cdf0e10cSrcweir 										"was ist das fuer ein Verzeichnis?" );
1377*cdf0e10cSrcweir                                     sStr = pCurrSect->GetSectionName();
1378*cdf0e10cSrcweir 								}
1379*cdf0e10cSrcweir 							}
1380*cdf0e10cSrcweir 							break;
1381*cdf0e10cSrcweir 						default:
1382*cdf0e10cSrcweir                             sStr = pCurrSect->GetSectionName();
1383*cdf0e10cSrcweir 							break;
1384*cdf0e10cSrcweir 						}
1385*cdf0e10cSrcweir 					}
1386*cdf0e10cSrcweir 				}
1387*cdf0e10cSrcweir 
1388*cdf0e10cSrcweir 				//#outline level, removed by zhaojianwei
1389*cdf0e10cSrcweir 				//const SwNumRule* pNumRule = rShell.GetCurNumRule();
1390*cdf0e10cSrcweir 				//if (pNumRule)	// Cursor in Numerierung
1391*cdf0e10cSrcweir 				//{
1392*cdf0e10cSrcweir 				//	sal_uInt8 nNumLevel = rShell.GetNumLevel();
1393*cdf0e10cSrcweir 				//	if( IsShowNum(nNumLevel) && MAXLEVEL >
1394*cdf0e10cSrcweir 				//		( nNumLevel = GetRealLevel( nNumLevel )) )
1395*cdf0e10cSrcweir 				//	{
1396*cdf0e10cSrcweir 				//		if( sStr.Len() )
1397*cdf0e10cSrcweir 				//			sStr.AppendAscii(sStatusDelim);
1398*cdf0e10cSrcweir 				//		sStr += SW_RESSTR(STR_NUM_LEVEL);
1399*cdf0e10cSrcweir 				//		sStr += String::CreateFromInt32( nNumLevel + 1 );
1400*cdf0e10cSrcweir 				//		if(!pNumRule->IsAutoRule())
1401*cdf0e10cSrcweir 				//		{
1402*cdf0e10cSrcweir 				//			SfxItemSet aSet(GetPool(),
1403*cdf0e10cSrcweir 				//				RES_PARATR_NUMRULE, RES_PARATR_NUMRULE);
1404*cdf0e10cSrcweir 				//			rShell.GetCurAttr(aSet);
1405*cdf0e10cSrcweir 				//			/* const SfxPoolItem* pItem; */
1406*cdf0e10cSrcweir 				//			if(SFX_ITEM_AVAILABLE <=
1407*cdf0e10cSrcweir 				//				aSet.GetItemState(RES_PARATR_NUMRULE, sal_True
1408*cdf0e10cSrcweir 				//				/*, &pItem */ ))
1409*cdf0e10cSrcweir 				//			{
1410*cdf0e10cSrcweir 				//				const String& rNumStyle =
1411*cdf0e10cSrcweir 				//					((const SfxStringItem &)
1412*cdf0e10cSrcweir 				//					aSet.Get(RES_PARATR_NUMRULE)).GetValue();
1413*cdf0e10cSrcweir 				//				/* #i5116# GetItemState does not necessarily
1414*cdf0e10cSrcweir 				//				change pItem */
1415*cdf0e10cSrcweir 				//				// ((const SfxStringItem*)pItem)->GetValue();
1416*cdf0e10cSrcweir 				//				if(rNumStyle.Len())
1417*cdf0e10cSrcweir 				//				{
1418*cdf0e10cSrcweir 				//					sStr.AppendAscii(sStatusDelim);
1419*cdf0e10cSrcweir 				//					sStr += rNumStyle;
1420*cdf0e10cSrcweir 				//				}
1421*cdf0e10cSrcweir 				//			}
1422*cdf0e10cSrcweir 				//		}
1423*cdf0e10cSrcweir 				//	}
1424*cdf0e10cSrcweir 				//}//<-removed end ,zhaojianwei
1425*cdf0e10cSrcweir 
1426*cdf0e10cSrcweir 				//-->#outline level,added by zhaojianwei
1427*cdf0e10cSrcweir 				const SwNumRule* pNumRule = rShell.GetCurNumRule();
1428*cdf0e10cSrcweir 				const bool bOutlineNum = pNumRule ? pNumRule->IsOutlineRule() : 0;
1429*cdf0e10cSrcweir 					   //((SwTxtFmtColl*)rShell.GetCrsr()->GetNode()->GetTxtNode()->GetFmtColl())->IsAssignedToListLevelOfOutlineStyle();
1430*cdf0e10cSrcweir 
1431*cdf0e10cSrcweir 				if (pNumRule && !bOutlineNum )	// Cursor in Numerierung
1432*cdf0e10cSrcweir 				{
1433*cdf0e10cSrcweir 					sal_uInt8 nNumLevel = rShell.GetNumLevel();
1434*cdf0e10cSrcweir                     // --> OD 2008-04-02 #refactorlists#
1435*cdf0e10cSrcweir //                    if( IsShowNum(nNumLevel) && MAXLEVEL >
1436*cdf0e10cSrcweir //                        ( nNumLevel = GetRealLevel( nNumLevel )) )
1437*cdf0e10cSrcweir                     if ( nNumLevel < MAXLEVEL )
1438*cdf0e10cSrcweir                     // <--
1439*cdf0e10cSrcweir 					{
1440*cdf0e10cSrcweir 						if(!pNumRule->IsAutoRule())
1441*cdf0e10cSrcweir 						{
1442*cdf0e10cSrcweir 							SfxItemSet aSet(GetPool(),
1443*cdf0e10cSrcweir 									RES_PARATR_NUMRULE, RES_PARATR_NUMRULE);
1444*cdf0e10cSrcweir                             rShell.GetCurAttr(aSet);
1445*cdf0e10cSrcweir 							/* const SfxPoolItem* pItem; */
1446*cdf0e10cSrcweir 							if(SFX_ITEM_AVAILABLE <=
1447*cdf0e10cSrcweir 							   aSet.GetItemState(RES_PARATR_NUMRULE, sal_True
1448*cdf0e10cSrcweir 												 /*, &pItem */ ))
1449*cdf0e10cSrcweir 							{
1450*cdf0e10cSrcweir 								const String& rNumStyle =
1451*cdf0e10cSrcweir 									((const SfxStringItem &)
1452*cdf0e10cSrcweir 									 aSet.Get(RES_PARATR_NUMRULE)).GetValue();
1453*cdf0e10cSrcweir 								/* #i5116# GetItemState does not necessarily
1454*cdf0e10cSrcweir                                    change pItem */
1455*cdf0e10cSrcweir 								// ((const SfxStringItem*)pItem)->GetValue();
1456*cdf0e10cSrcweir 								if(rNumStyle.Len())
1457*cdf0e10cSrcweir 								{
1458*cdf0e10cSrcweir 									if( sStr.Len() )
1459*cdf0e10cSrcweir 										sStr.AppendAscii(sStatusDelim);
1460*cdf0e10cSrcweir 									sStr += rNumStyle;
1461*cdf0e10cSrcweir 								}
1462*cdf0e10cSrcweir 							}
1463*cdf0e10cSrcweir 						}
1464*cdf0e10cSrcweir 						if( sStr.Len() )
1465*cdf0e10cSrcweir 							sStr.AppendAscii(sStatusDelim);
1466*cdf0e10cSrcweir 						sStr += SW_RESSTR(STR_NUM_LEVEL);
1467*cdf0e10cSrcweir 						sStr += String::CreateFromInt32( nNumLevel + 1 );
1468*cdf0e10cSrcweir 
1469*cdf0e10cSrcweir 					}
1470*cdf0e10cSrcweir 				}
1471*cdf0e10cSrcweir 				const int nOutlineLevel = rShell.GetCurrentParaOutlineLevel();
1472*cdf0e10cSrcweir 				if( nOutlineLevel != 0 )
1473*cdf0e10cSrcweir 				{
1474*cdf0e10cSrcweir 					if( sStr.Len() )
1475*cdf0e10cSrcweir 						sStr.AppendAscii(sStatusComma);
1476*cdf0e10cSrcweir 					if( bOutlineNum )
1477*cdf0e10cSrcweir 					{
1478*cdf0e10cSrcweir 						sStr += SW_RESSTR(STR_OUTLINE_NUMBERING);
1479*cdf0e10cSrcweir 						sStr.AppendAscii(sStatusDelim);
1480*cdf0e10cSrcweir 						sStr += SW_RESSTR(STR_NUM_LEVEL);
1481*cdf0e10cSrcweir 					}
1482*cdf0e10cSrcweir 					else
1483*cdf0e10cSrcweir 						sStr += SW_RESSTR(STR_NUM_OUTLINE);
1484*cdf0e10cSrcweir 					sStr += String::CreateFromInt32( nOutlineLevel);
1485*cdf0e10cSrcweir 				}
1486*cdf0e10cSrcweir 				//<-end ,zhaojianwei
1487*cdf0e10cSrcweir 
1488*cdf0e10cSrcweir 				if( rShell.HasReadonlySel() )
1489*cdf0e10cSrcweir 				{
1490*cdf0e10cSrcweir 					if( sStr.Len() )
1491*cdf0e10cSrcweir 						sStr.InsertAscii( sStatusDelim, 0 );
1492*cdf0e10cSrcweir 					sStr.Insert( SW_RESSTR( STR_READONLY_SEL ), 0 );
1493*cdf0e10cSrcweir 				}
1494*cdf0e10cSrcweir 				if( sStr.Len() )
1495*cdf0e10cSrcweir 					rSet.Put( SfxStringItem( SID_TABLE_CELL, sStr ));
1496*cdf0e10cSrcweir 			}
1497*cdf0e10cSrcweir 			break;
1498*cdf0e10cSrcweir 			case FN_STAT_SELMODE:
1499*cdf0e10cSrcweir 			{
1500*cdf0e10cSrcweir 				if(rShell.IsStdMode())
1501*cdf0e10cSrcweir 					rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 0));
1502*cdf0e10cSrcweir 				else if(rShell.IsAddMode())
1503*cdf0e10cSrcweir 					rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 2));
1504*cdf0e10cSrcweir 				else if(rShell.IsBlockMode())
1505*cdf0e10cSrcweir 					rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 3));
1506*cdf0e10cSrcweir 				else
1507*cdf0e10cSrcweir 					rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 1));
1508*cdf0e10cSrcweir 				break;
1509*cdf0e10cSrcweir 			}
1510*cdf0e10cSrcweir 			case SID_ATTR_INSERT:
1511*cdf0e10cSrcweir 				if( rShell.IsRedlineOn() )
1512*cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
1513*cdf0e10cSrcweir 				else
1514*cdf0e10cSrcweir 				{
1515*cdf0e10cSrcweir 					rSet.Put(SfxBoolItem(SID_ATTR_INSERT,rShell.IsInsMode()));
1516*cdf0e10cSrcweir 				}
1517*cdf0e10cSrcweir 				break;
1518*cdf0e10cSrcweir 		}
1519*cdf0e10cSrcweir 		nWhich = aIter.NextWhich();
1520*cdf0e10cSrcweir 	}
1521*cdf0e10cSrcweir }
1522*cdf0e10cSrcweir 
1523*cdf0e10cSrcweir /*--------------------------------------------------------------------
1524*cdf0e10cSrcweir 	Beschreibung:	Execute fuer die Stauszeile
1525*cdf0e10cSrcweir  --------------------------------------------------------------------*/
1526*cdf0e10cSrcweir 
1527*cdf0e10cSrcweir 
1528*cdf0e10cSrcweir void SwView::ExecuteStatusLine(SfxRequest &rReq)
1529*cdf0e10cSrcweir {
1530*cdf0e10cSrcweir 	SwWrtShell &rSh = GetWrtShell();
1531*cdf0e10cSrcweir 	const SfxItemSet* pArgs = rReq.GetArgs();
1532*cdf0e10cSrcweir     const SfxPoolItem* pItem=NULL;
1533*cdf0e10cSrcweir 	sal_Bool bUp = sal_False;
1534*cdf0e10cSrcweir 	sal_uInt16 nWhich = rReq.GetSlot();
1535*cdf0e10cSrcweir 	switch( nWhich )
1536*cdf0e10cSrcweir 	{
1537*cdf0e10cSrcweir 		case FN_STAT_PAGE:
1538*cdf0e10cSrcweir 		{
1539*cdf0e10cSrcweir 			GetViewFrame()->GetDispatcher()->Execute( SID_NAVIGATOR,
1540*cdf0e10cSrcweir 									  SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD );
1541*cdf0e10cSrcweir 		}
1542*cdf0e10cSrcweir 		break;
1543*cdf0e10cSrcweir 
1544*cdf0e10cSrcweir         case FN_STAT_BOOKMARK:
1545*cdf0e10cSrcweir         if ( pArgs )
1546*cdf0e10cSrcweir         {
1547*cdf0e10cSrcweir             if (SFX_ITEM_SET == pArgs->GetItemState( nWhich, sal_True, &pItem))
1548*cdf0e10cSrcweir             {
1549*cdf0e10cSrcweir                 const IDocumentMarkAccess* pMarkAccess = rSh.getIDocumentMarkAccess();
1550*cdf0e10cSrcweir                 const sal_Int32 nIdx = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
1551*cdf0e10cSrcweir                 if(nIdx < pMarkAccess->getBookmarksCount())
1552*cdf0e10cSrcweir                 {
1553*cdf0e10cSrcweir                     const IDocumentMarkAccess::const_iterator_t ppBookmark = rSh.getIDocumentMarkAccess()->getBookmarksBegin() + nIdx;
1554*cdf0e10cSrcweir                     rSh.EnterStdMode();
1555*cdf0e10cSrcweir                     rSh.GotoMark( ppBookmark->get() );
1556*cdf0e10cSrcweir                 }
1557*cdf0e10cSrcweir                 else
1558*cdf0e10cSrcweir                     OSL_ENSURE(false,
1559*cdf0e10cSrcweir                         "SwView::ExecuteStatusLine(..)"
1560*cdf0e10cSrcweir                         " - Ignoring out of range bookmark index");
1561*cdf0e10cSrcweir             }
1562*cdf0e10cSrcweir         }
1563*cdf0e10cSrcweir 		break;
1564*cdf0e10cSrcweir 
1565*cdf0e10cSrcweir 		case FN_STAT_TEMPLATE:
1566*cdf0e10cSrcweir 		{
1567*cdf0e10cSrcweir 			GetViewFrame()->GetDispatcher()->Execute(FN_FORMAT_PAGE_DLG,
1568*cdf0e10cSrcweir 										SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD );
1569*cdf0e10cSrcweir 		}
1570*cdf0e10cSrcweir 		break;
1571*cdf0e10cSrcweir 		case SID_ATTR_ZOOM:
1572*cdf0e10cSrcweir 		{
1573*cdf0e10cSrcweir 			if ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() )
1574*cdf0e10cSrcweir 			{
1575*cdf0e10cSrcweir 				const SfxItemSet *pSet = 0;
1576*cdf0e10cSrcweir 				AbstractSvxZoomDialog *pDlg = 0;
1577*cdf0e10cSrcweir 				if ( pArgs )
1578*cdf0e10cSrcweir 					pSet = pArgs;
1579*cdf0e10cSrcweir 				else
1580*cdf0e10cSrcweir 				{
1581*cdf0e10cSrcweir                     const SwViewOption& rViewOptions = *rSh.GetViewOptions();
1582*cdf0e10cSrcweir                     SfxItemSet aCoreSet(pShell->GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM, SID_ATTR_VIEWLAYOUT, SID_ATTR_VIEWLAYOUT, 0 );
1583*cdf0e10cSrcweir 					SvxZoomItem aZoom( (SvxZoomType)rViewOptions.GetZoomType(), rViewOptions.GetZoom() );
1584*cdf0e10cSrcweir 
1585*cdf0e10cSrcweir                     const bool bBrowseMode = rSh.GetViewOptions()->getBrowseMode();
1586*cdf0e10cSrcweir 					if( bBrowseMode )
1587*cdf0e10cSrcweir 					{
1588*cdf0e10cSrcweir 						aZoom.SetValueSet(
1589*cdf0e10cSrcweir 								SVX_ZOOM_ENABLE_50|
1590*cdf0e10cSrcweir 								SVX_ZOOM_ENABLE_75|
1591*cdf0e10cSrcweir 								SVX_ZOOM_ENABLE_100|
1592*cdf0e10cSrcweir 								SVX_ZOOM_ENABLE_150|
1593*cdf0e10cSrcweir 								SVX_ZOOM_ENABLE_200);
1594*cdf0e10cSrcweir 					}
1595*cdf0e10cSrcweir 					aCoreSet.Put( aZoom );
1596*cdf0e10cSrcweir 
1597*cdf0e10cSrcweir                     // PAGES01
1598*cdf0e10cSrcweir                     if ( !bBrowseMode )
1599*cdf0e10cSrcweir                     {
1600*cdf0e10cSrcweir                         const SvxViewLayoutItem aViewLayout( rViewOptions.GetViewLayoutColumns(), rViewOptions.IsViewLayoutBookMode() );
1601*cdf0e10cSrcweir                         aCoreSet.Put( aViewLayout );
1602*cdf0e10cSrcweir                     }
1603*cdf0e10cSrcweir 
1604*cdf0e10cSrcweir 					SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
1605*cdf0e10cSrcweir 					if(pFact)
1606*cdf0e10cSrcweir 					{
1607*cdf0e10cSrcweir                         pDlg = pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aCoreSet);
1608*cdf0e10cSrcweir                         DBG_ASSERT(pDlg, "Dialogdiet fail!");
1609*cdf0e10cSrcweir 					}
1610*cdf0e10cSrcweir 
1611*cdf0e10cSrcweir 					pDlg->SetLimits( MINZOOM, MAXZOOM );
1612*cdf0e10cSrcweir 
1613*cdf0e10cSrcweir 					if( pDlg->Execute() != RET_CANCEL )
1614*cdf0e10cSrcweir 						pSet = pDlg->GetOutputItemSet();
1615*cdf0e10cSrcweir 				}
1616*cdf0e10cSrcweir 
1617*cdf0e10cSrcweir                 // PAGES01
1618*cdf0e10cSrcweir                 const SfxPoolItem* pViewLayoutItem = 0;
1619*cdf0e10cSrcweir                 if ( pSet && SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_VIEWLAYOUT, sal_True, &pViewLayoutItem))
1620*cdf0e10cSrcweir                 {
1621*cdf0e10cSrcweir                     const sal_uInt16 nColumns = ((const SvxViewLayoutItem *)pViewLayoutItem)->GetValue();
1622*cdf0e10cSrcweir                     const bool bBookMode  = ((const SvxViewLayoutItem *)pViewLayoutItem)->IsBookMode();
1623*cdf0e10cSrcweir                     SetViewLayout( nColumns, bBookMode );
1624*cdf0e10cSrcweir                 }
1625*cdf0e10cSrcweir 
1626*cdf0e10cSrcweir 				if ( pSet && SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_ZOOM, sal_True, &pItem))
1627*cdf0e10cSrcweir 				{
1628*cdf0e10cSrcweir                     enum SvxZoomType eType = ((const SvxZoomItem *)pItem)->GetType();
1629*cdf0e10cSrcweir 					SetZoom( eType, ((const SvxZoomItem *)pItem)->GetValue() );
1630*cdf0e10cSrcweir 				}
1631*cdf0e10cSrcweir 				bUp = sal_True;
1632*cdf0e10cSrcweir 				if ( pItem )
1633*cdf0e10cSrcweir 					rReq.AppendItem( *pItem );
1634*cdf0e10cSrcweir 				rReq.Done();
1635*cdf0e10cSrcweir 
1636*cdf0e10cSrcweir 				delete pDlg;
1637*cdf0e10cSrcweir 			}
1638*cdf0e10cSrcweir 		}
1639*cdf0e10cSrcweir 		break;
1640*cdf0e10cSrcweir 
1641*cdf0e10cSrcweir         case SID_ATTR_VIEWLAYOUT:
1642*cdf0e10cSrcweir         {
1643*cdf0e10cSrcweir             if ( pArgs && !rSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) &&
1644*cdf0e10cSrcweir 				( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) )
1645*cdf0e10cSrcweir             {
1646*cdf0e10cSrcweir                 // PAGES01
1647*cdf0e10cSrcweir                 if ( SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_VIEWLAYOUT, sal_True, &pItem ))
1648*cdf0e10cSrcweir                 {
1649*cdf0e10cSrcweir                     const sal_uInt16 nColumns = ((const SvxViewLayoutItem *)pItem)->GetValue();
1650*cdf0e10cSrcweir                     const bool bBookMode  = (0 == nColumns || 0 != (nColumns % 2)) ?
1651*cdf0e10cSrcweir                                             false :
1652*cdf0e10cSrcweir                                             ((const SvxViewLayoutItem *)pItem)->IsBookMode();
1653*cdf0e10cSrcweir 
1654*cdf0e10cSrcweir                     SetViewLayout( nColumns, bBookMode );
1655*cdf0e10cSrcweir                 }
1656*cdf0e10cSrcweir 
1657*cdf0e10cSrcweir                 bUp = sal_True;
1658*cdf0e10cSrcweir                 rReq.Done();
1659*cdf0e10cSrcweir 
1660*cdf0e10cSrcweir                 InvalidateRulerPos();
1661*cdf0e10cSrcweir             }
1662*cdf0e10cSrcweir         }
1663*cdf0e10cSrcweir         break;
1664*cdf0e10cSrcweir 
1665*cdf0e10cSrcweir         case SID_ATTR_ZOOMSLIDER:
1666*cdf0e10cSrcweir         {
1667*cdf0e10cSrcweir 			if ( pArgs && ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) )
1668*cdf0e10cSrcweir             {
1669*cdf0e10cSrcweir                 // PAGES01
1670*cdf0e10cSrcweir                 if ( SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_ZOOMSLIDER, sal_True, &pItem ))
1671*cdf0e10cSrcweir                 {
1672*cdf0e10cSrcweir                     const sal_uInt16 nCurrentZoom = ((const SvxZoomSliderItem *)pItem)->GetValue();
1673*cdf0e10cSrcweir                     SetZoom( SVX_ZOOM_PERCENT, nCurrentZoom );
1674*cdf0e10cSrcweir                 }
1675*cdf0e10cSrcweir 
1676*cdf0e10cSrcweir                 bUp = sal_True;
1677*cdf0e10cSrcweir                 rReq.Done();
1678*cdf0e10cSrcweir             }
1679*cdf0e10cSrcweir         }
1680*cdf0e10cSrcweir         break;
1681*cdf0e10cSrcweir 
1682*cdf0e10cSrcweir 		case SID_ATTR_SIZE:
1683*cdf0e10cSrcweir 		{
1684*cdf0e10cSrcweir 			sal_uLong nId = FN_INSERT_FIELD;
1685*cdf0e10cSrcweir 			if( rSh.IsCrsrInTbl() )
1686*cdf0e10cSrcweir 				nId = FN_FORMAT_TABLE_DLG;
1687*cdf0e10cSrcweir 			else if( rSh.GetCurTOX() )
1688*cdf0e10cSrcweir 				nId = FN_INSERT_MULTI_TOX;
1689*cdf0e10cSrcweir 			else if( rSh.GetCurrSection() )
1690*cdf0e10cSrcweir 				nId = FN_EDIT_REGION;
1691*cdf0e10cSrcweir 			else
1692*cdf0e10cSrcweir 			{
1693*cdf0e10cSrcweir 				const SwNumRule* pNumRule = rSh.GetCurNumRule();
1694*cdf0e10cSrcweir 				if( pNumRule )	// Cursor in Numerierung
1695*cdf0e10cSrcweir 				{
1696*cdf0e10cSrcweir 					if( pNumRule->IsAutoRule() )
1697*cdf0e10cSrcweir 						nId = FN_NUMBER_BULLETS;
1698*cdf0e10cSrcweir 					else
1699*cdf0e10cSrcweir 					{
1700*cdf0e10cSrcweir 						// Dialog vom Gestalter starten ;-)
1701*cdf0e10cSrcweir 						nId = 0;
1702*cdf0e10cSrcweir 					}
1703*cdf0e10cSrcweir 				}
1704*cdf0e10cSrcweir 				else if( rSh.IsFrmSelected() )
1705*cdf0e10cSrcweir 					nId = FN_FORMAT_FRAME_DLG;
1706*cdf0e10cSrcweir 				else if( rSh.IsObjSelected() )
1707*cdf0e10cSrcweir 					nId = SID_ATTR_TRANSFORM;
1708*cdf0e10cSrcweir 			}
1709*cdf0e10cSrcweir 			if( nId )
1710*cdf0e10cSrcweir 				GetViewFrame()->GetDispatcher()->Execute(
1711*cdf0e10cSrcweir 					static_cast< sal_uInt16 >( nId ), SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD );
1712*cdf0e10cSrcweir 		}
1713*cdf0e10cSrcweir 		break;
1714*cdf0e10cSrcweir 
1715*cdf0e10cSrcweir 		case FN_STAT_SELMODE:
1716*cdf0e10cSrcweir 		{
1717*cdf0e10cSrcweir 			if ( pArgs )
1718*cdf0e10cSrcweir 			{
1719*cdf0e10cSrcweir 				if (SFX_ITEM_SET == pArgs->GetItemState( nWhich, sal_True, &pItem))
1720*cdf0e10cSrcweir 				{
1721*cdf0e10cSrcweir 					switch ( ((const SfxUInt16Item *)pItem)->GetValue() )
1722*cdf0e10cSrcweir 					{
1723*cdf0e10cSrcweir 						case 0: rSh.EnterStdMode(); break;
1724*cdf0e10cSrcweir 						case 1: rSh.EnterExtMode(); break;
1725*cdf0e10cSrcweir 						case 2: rSh.EnterAddMode(); break;
1726*cdf0e10cSrcweir 						case 3: rSh.EnterBlockMode(); break;
1727*cdf0e10cSrcweir 					}
1728*cdf0e10cSrcweir 				}
1729*cdf0e10cSrcweir 			}
1730*cdf0e10cSrcweir 			else
1731*cdf0e10cSrcweir 			{
1732*cdf0e10cSrcweir 
1733*cdf0e10cSrcweir 				if( !rSh.IsAddMode() && !rSh.IsExtMode() && !rSh.IsBlockMode() )
1734*cdf0e10cSrcweir 					rSh.ToggleExtMode();
1735*cdf0e10cSrcweir 				else if ( rSh.IsExtMode() )
1736*cdf0e10cSrcweir 				{
1737*cdf0e10cSrcweir 					rSh.ToggleExtMode();
1738*cdf0e10cSrcweir 					rSh.ToggleAddMode();
1739*cdf0e10cSrcweir 				}
1740*cdf0e10cSrcweir 				else if ( rSh.IsAddMode() )
1741*cdf0e10cSrcweir                 {
1742*cdf0e10cSrcweir 					rSh.ToggleAddMode();
1743*cdf0e10cSrcweir 					rSh.ToggleBlockMode();
1744*cdf0e10cSrcweir                 }
1745*cdf0e10cSrcweir                 else
1746*cdf0e10cSrcweir 					rSh.ToggleBlockMode();
1747*cdf0e10cSrcweir 			}
1748*cdf0e10cSrcweir 			bUp = sal_True;
1749*cdf0e10cSrcweir 			break;
1750*cdf0e10cSrcweir 		}
1751*cdf0e10cSrcweir 		case FN_SET_ADD_MODE:
1752*cdf0e10cSrcweir 			rSh.ToggleAddMode();
1753*cdf0e10cSrcweir 			nWhich = FN_STAT_SELMODE;
1754*cdf0e10cSrcweir 			bUp = sal_True;
1755*cdf0e10cSrcweir 		break;
1756*cdf0e10cSrcweir 		case FN_SET_BLOCK_MODE:
1757*cdf0e10cSrcweir 			rSh.ToggleBlockMode();
1758*cdf0e10cSrcweir 			nWhich = FN_STAT_SELMODE;
1759*cdf0e10cSrcweir 			bUp = sal_True;
1760*cdf0e10cSrcweir 		break;
1761*cdf0e10cSrcweir 		case FN_SET_EXT_MODE:
1762*cdf0e10cSrcweir 			rSh.ToggleExtMode();
1763*cdf0e10cSrcweir 			nWhich = FN_STAT_SELMODE;
1764*cdf0e10cSrcweir 			bUp = sal_True;
1765*cdf0e10cSrcweir 		break;
1766*cdf0e10cSrcweir 		case SID_ATTR_INSERT:
1767*cdf0e10cSrcweir 			SwPostItMgr* pMgr = GetPostItMgr();
1768*cdf0e10cSrcweir             if ( pMgr && pMgr->HasActiveSidebarWin() )
1769*cdf0e10cSrcweir             {
1770*cdf0e10cSrcweir                 pMgr->ToggleInsModeOnActiveSidebarWin();
1771*cdf0e10cSrcweir             }
1772*cdf0e10cSrcweir 			else
1773*cdf0e10cSrcweir 				rSh.ToggleInsMode();
1774*cdf0e10cSrcweir 			bUp = sal_True;
1775*cdf0e10cSrcweir 		break;
1776*cdf0e10cSrcweir 
1777*cdf0e10cSrcweir 	}
1778*cdf0e10cSrcweir 	if ( bUp )
1779*cdf0e10cSrcweir 	{
1780*cdf0e10cSrcweir 		SfxBindings &rBnd = GetViewFrame()->GetBindings();
1781*cdf0e10cSrcweir 		rBnd.Invalidate(nWhich);
1782*cdf0e10cSrcweir 		rBnd.Update(nWhich);
1783*cdf0e10cSrcweir 	}
1784*cdf0e10cSrcweir }
1785*cdf0e10cSrcweir 
1786*cdf0e10cSrcweir void SwView::InsFrmMode(sal_uInt16 nCols)
1787*cdf0e10cSrcweir {
1788*cdf0e10cSrcweir 	if ( pWrtShell->HasWholeTabSelection() )
1789*cdf0e10cSrcweir 	{
1790*cdf0e10cSrcweir 		SwFlyFrmAttrMgr aMgr( sal_True, pWrtShell, FRMMGR_TYPE_TEXT );
1791*cdf0e10cSrcweir 
1792*cdf0e10cSrcweir 		const SwFrmFmt &rPageFmt =
1793*cdf0e10cSrcweir 				pWrtShell->GetPageDesc(pWrtShell->GetCurPageDesc()).GetMaster();
1794*cdf0e10cSrcweir 		SwTwips lWidth = rPageFmt.GetFrmSize().GetWidth();
1795*cdf0e10cSrcweir 		const SvxLRSpaceItem &rLR = rPageFmt.GetLRSpace();
1796*cdf0e10cSrcweir 		lWidth -= rLR.GetLeft() + rLR.GetRight();
1797*cdf0e10cSrcweir 		aMgr.SetSize(Size(lWidth, aMgr.GetSize().Height()));
1798*cdf0e10cSrcweir 		if(nCols > 1)
1799*cdf0e10cSrcweir 		{
1800*cdf0e10cSrcweir 			SwFmtCol aCol;
1801*cdf0e10cSrcweir 			aCol.Init( nCols, aCol.GetGutterWidth(), aCol.GetWishWidth() );
1802*cdf0e10cSrcweir 			aMgr.SetCol( aCol );
1803*cdf0e10cSrcweir 		}
1804*cdf0e10cSrcweir 		aMgr.InsertFlyFrm();
1805*cdf0e10cSrcweir 	}
1806*cdf0e10cSrcweir 	else
1807*cdf0e10cSrcweir 		GetEditWin().InsFrm(nCols);
1808*cdf0e10cSrcweir }
1809*cdf0e10cSrcweir 
1810*cdf0e10cSrcweir /*--------------------------------------------------------------------
1811*cdf0e10cSrcweir 	Beschreibung:	Links bearbeiten
1812*cdf0e10cSrcweir  --------------------------------------------------------------------*/
1813*cdf0e10cSrcweir 
1814*cdf0e10cSrcweir void SwView::EditLinkDlg()
1815*cdf0e10cSrcweir {
1816*cdf0e10cSrcweir 	sal_Bool bWeb = 0 != PTR_CAST(SwWebView, this);
1817*cdf0e10cSrcweir     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
1818*cdf0e10cSrcweir     SfxAbstractLinksDialog* pDlg = pFact->CreateLinksDialog( &GetViewFrame()->GetWindow(), &GetWrtShell().GetLinkManager(), bWeb );
1819*cdf0e10cSrcweir     if ( pDlg )
1820*cdf0e10cSrcweir     {
1821*cdf0e10cSrcweir         pDlg->Execute();
1822*cdf0e10cSrcweir         delete pDlg;
1823*cdf0e10cSrcweir     }
1824*cdf0e10cSrcweir /*
1825*cdf0e10cSrcweir 	SwLinkDlg* pDlg = new SwLinkDlg(GetFrameWindow());
1826*cdf0e10cSrcweir 	pDlg->SetShell(&GetWrtShell());
1827*cdf0e10cSrcweir 	pDlg->Execute();
1828*cdf0e10cSrcweir 
1829*cdf0e10cSrcweir 	DELETEZ(pDlg);
1830*cdf0e10cSrcweir */
1831*cdf0e10cSrcweir }
1832*cdf0e10cSrcweir 
1833*cdf0e10cSrcweir sal_Bool SwView::JumpToSwMark( const String& rMark )
1834*cdf0e10cSrcweir {
1835*cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1836*cdf0e10cSrcweir 	if( rMark.Len() )
1837*cdf0e10cSrcweir 	{
1838*cdf0e10cSrcweir 		// wir wollen den Bookmark aber am oberen Rand haben
1839*cdf0e10cSrcweir 		sal_Bool bSaveCC = IsCrsrAtCenter();
1840*cdf0e10cSrcweir 		sal_Bool bSaveCT = IsCrsrAtTop();
1841*cdf0e10cSrcweir 		SetCrsrAtTop( sal_True );
1842*cdf0e10cSrcweir 
1843*cdf0e10cSrcweir 		//JP 27.04.98: Bug 49786
1844*cdf0e10cSrcweir 		// Damit in FrameSet auch gescrollt werden kann, muss die
1845*cdf0e10cSrcweir 		// entsprechende Shell auch das Focus-Flag gesetzt haben!
1846*cdf0e10cSrcweir 		sal_Bool bHasShFocus = pWrtShell->HasShFcs();
1847*cdf0e10cSrcweir 		if( !bHasShFocus )
1848*cdf0e10cSrcweir 			pWrtShell->ShGetFcs( sal_False );
1849*cdf0e10cSrcweir 
1850*cdf0e10cSrcweir 		const SwFmtINetFmt* pINet;
1851*cdf0e10cSrcweir 		String sCmp, sMark( INetURLObject::decode( rMark, INET_HEX_ESCAPE,
1852*cdf0e10cSrcweir 						   				INetURLObject::DECODE_WITH_CHARSET,
1853*cdf0e10cSrcweir 										RTL_TEXTENCODING_UTF8 ));
1854*cdf0e10cSrcweir 
1855*cdf0e10cSrcweir 		xub_StrLen nLastPos, nPos = sMark.Search( cMarkSeperator );
1856*cdf0e10cSrcweir 		if( STRING_NOTFOUND != nPos )
1857*cdf0e10cSrcweir 			while( STRING_NOTFOUND != ( nLastPos =
1858*cdf0e10cSrcweir 				sMark.Search( cMarkSeperator, nPos + 1 )) )
1859*cdf0e10cSrcweir 				nPos = nLastPos;
1860*cdf0e10cSrcweir 
1861*cdf0e10cSrcweir         IDocumentMarkAccess::const_iterator_t ppMark;
1862*cdf0e10cSrcweir         IDocumentMarkAccess* const pMarkAccess = pWrtShell->getIDocumentMarkAccess();
1863*cdf0e10cSrcweir 		if( STRING_NOTFOUND != nPos &&
1864*cdf0e10cSrcweir 			( sCmp = sMark.Copy( nPos + 1 ) ).EraseAllChars().Len() )
1865*cdf0e10cSrcweir 		{
1866*cdf0e10cSrcweir 			String sName( sMark.Copy( 0, nPos ) );
1867*cdf0e10cSrcweir 			sCmp.ToLowerAscii();
1868*cdf0e10cSrcweir 			FlyCntType eFlyType = FLYCNTTYPE_ALL;
1869*cdf0e10cSrcweir 
1870*cdf0e10cSrcweir 			if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToRegion ) )
1871*cdf0e10cSrcweir 			{
1872*cdf0e10cSrcweir 				pWrtShell->EnterStdMode();
1873*cdf0e10cSrcweir 				bRet = pWrtShell->GotoRegion( sName );
1874*cdf0e10cSrcweir 			}
1875*cdf0e10cSrcweir 			else if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToOutline ) )
1876*cdf0e10cSrcweir 			{
1877*cdf0e10cSrcweir 				pWrtShell->EnterStdMode();
1878*cdf0e10cSrcweir 				bRet = pWrtShell->GotoOutline( sName );
1879*cdf0e10cSrcweir 			}
1880*cdf0e10cSrcweir 			else if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToFrame ) )
1881*cdf0e10cSrcweir 				eFlyType = FLYCNTTYPE_FRM;
1882*cdf0e10cSrcweir 			else if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToGraphic ) )
1883*cdf0e10cSrcweir 				eFlyType = FLYCNTTYPE_GRF;
1884*cdf0e10cSrcweir 			else if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToOLE ) )
1885*cdf0e10cSrcweir 				eFlyType = FLYCNTTYPE_OLE;
1886*cdf0e10cSrcweir 			else if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToTable ) )
1887*cdf0e10cSrcweir 			{
1888*cdf0e10cSrcweir 				pWrtShell->EnterStdMode();
1889*cdf0e10cSrcweir 				bRet = pWrtShell->GotoTable( sName );
1890*cdf0e10cSrcweir 			}
1891*cdf0e10cSrcweir 			else if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToText ) )
1892*cdf0e10cSrcweir 			{
1893*cdf0e10cSrcweir 				// Normale Textsuche
1894*cdf0e10cSrcweir 				pWrtShell->EnterStdMode();
1895*cdf0e10cSrcweir 
1896*cdf0e10cSrcweir 				SearchOptions aSearchOpt(
1897*cdf0e10cSrcweir 									SearchAlgorithms_ABSOLUTE, 0,
1898*cdf0e10cSrcweir 									sName, rtl::OUString(),
1899*cdf0e10cSrcweir 									SvxCreateLocale( LANGUAGE_SYSTEM ),
1900*cdf0e10cSrcweir 									0,0,0,
1901*cdf0e10cSrcweir 									TransliterationModules_IGNORE_CASE );
1902*cdf0e10cSrcweir 
1903*cdf0e10cSrcweir 				//todo/mba: assuming that notes shouldn't be searched
1904*cdf0e10cSrcweir 				sal_Bool bSearchInNotes = sal_False;
1905*cdf0e10cSrcweir 				if( pWrtShell->SearchPattern( aSearchOpt, bSearchInNotes, DOCPOS_START, DOCPOS_END ))
1906*cdf0e10cSrcweir 				{
1907*cdf0e10cSrcweir 					pWrtShell->EnterStdMode();		// Selektion wieder aufheben
1908*cdf0e10cSrcweir 					bRet = sal_True;
1909*cdf0e10cSrcweir 				}
1910*cdf0e10cSrcweir 			}
1911*cdf0e10cSrcweir 			else if( pMarkAccess->getMarksEnd() != (ppMark = pMarkAccess->findMark(sMark)) )
1912*cdf0e10cSrcweir 				pWrtShell->GotoMark( ppMark->get(), sal_False, sal_True ), bRet = sal_True;
1913*cdf0e10cSrcweir 			else if( 0 != ( pINet = pWrtShell->FindINetAttr( sMark ) ))
1914*cdf0e10cSrcweir 				bRet = pWrtShell->GotoINetAttr( *pINet->GetTxtINetFmt() );
1915*cdf0e10cSrcweir 
1916*cdf0e10cSrcweir 			// fuer alle Arten von Flys
1917*cdf0e10cSrcweir 			if( FLYCNTTYPE_ALL != eFlyType && pWrtShell->GotoFly( sName, eFlyType ))
1918*cdf0e10cSrcweir 			{
1919*cdf0e10cSrcweir 				bRet = sal_True;
1920*cdf0e10cSrcweir 				if( FLYCNTTYPE_FRM == eFlyType )
1921*cdf0e10cSrcweir 				{
1922*cdf0e10cSrcweir 					// TextFrames: Cursor in den Frame setzen
1923*cdf0e10cSrcweir 					pWrtShell->UnSelectFrm();
1924*cdf0e10cSrcweir 					pWrtShell->LeaveSelFrmMode();
1925*cdf0e10cSrcweir 				}
1926*cdf0e10cSrcweir 				else
1927*cdf0e10cSrcweir 				{
1928*cdf0e10cSrcweir 					pWrtShell->HideCrsr();
1929*cdf0e10cSrcweir 					pWrtShell->EnterSelFrmMode();
1930*cdf0e10cSrcweir 				}
1931*cdf0e10cSrcweir 			}
1932*cdf0e10cSrcweir 		}
1933*cdf0e10cSrcweir         else if( pMarkAccess->getMarksEnd() != (ppMark = pMarkAccess->findMark(sMark)))
1934*cdf0e10cSrcweir 			pWrtShell->GotoMark( ppMark->get(), sal_False, sal_True ), bRet = sal_True;
1935*cdf0e10cSrcweir 		else if( 0 != ( pINet = pWrtShell->FindINetAttr( sMark ) ))
1936*cdf0e10cSrcweir 			bRet = pWrtShell->GotoINetAttr( *pINet->GetTxtINetFmt() );
1937*cdf0e10cSrcweir 
1938*cdf0e10cSrcweir         // #b6330459# make selection visible later
1939*cdf0e10cSrcweir         if ( aVisArea.IsEmpty() )
1940*cdf0e10cSrcweir             bMakeSelectionVisible = sal_True;
1941*cdf0e10cSrcweir 
1942*cdf0e10cSrcweir         // ViewStatus wieder zurueck setzen
1943*cdf0e10cSrcweir 		SetCrsrAtTop( bSaveCT, bSaveCC );
1944*cdf0e10cSrcweir 
1945*cdf0e10cSrcweir 		if( !bHasShFocus )
1946*cdf0e10cSrcweir 			pWrtShell->ShLooseFcs();
1947*cdf0e10cSrcweir 	}
1948*cdf0e10cSrcweir 	return bRet;
1949*cdf0e10cSrcweir }
1950*cdf0e10cSrcweir 
1951*cdf0e10cSrcweir // #i67305, #1367991: Undo after insert from file:
1952*cdf0e10cSrcweir // Undo "Insert form file" crashes with documents imported from binary filter (.sdw) => disabled
1953*cdf0e10cSrcweir // Undo "Insert form file" crashes with (.odt) documents crashes if these documents contains
1954*cdf0e10cSrcweir // page styles with active header/footer => disabled for those documents
1955*cdf0e10cSrcweir 
1956*cdf0e10cSrcweir sal_uInt16 lcl_PageDescWithHeader( const SwDoc& rDoc )
1957*cdf0e10cSrcweir {
1958*cdf0e10cSrcweir     sal_uInt16 nRet = 0;
1959*cdf0e10cSrcweir     sal_uInt16 nCnt = rDoc.GetPageDescCnt();
1960*cdf0e10cSrcweir     for( sal_uInt16 i = 0; i < nCnt; ++i )
1961*cdf0e10cSrcweir     {
1962*cdf0e10cSrcweir         const SwPageDesc& rPageDesc = rDoc.GetPageDesc( i );
1963*cdf0e10cSrcweir         const SwFrmFmt& rMaster = rPageDesc.GetMaster();
1964*cdf0e10cSrcweir         const SfxPoolItem* pItem;
1965*cdf0e10cSrcweir         if( ( SFX_ITEM_SET == rMaster.GetAttrSet().GetItemState( RES_HEADER, sal_False, &pItem ) &&
1966*cdf0e10cSrcweir               ((SwFmtHeader*)pItem)->IsActive() ) ||
1967*cdf0e10cSrcweir             ( SFX_ITEM_SET == rMaster.GetAttrSet().GetItemState( RES_FOOTER, sal_False, &pItem )  &&
1968*cdf0e10cSrcweir               ((SwFmtFooter*)pItem)->IsActive()) )
1969*cdf0e10cSrcweir             ++nRet;
1970*cdf0e10cSrcweir     }
1971*cdf0e10cSrcweir     return nRet; // number of page styles with active header/footer
1972*cdf0e10cSrcweir }
1973*cdf0e10cSrcweir 
1974*cdf0e10cSrcweir /*--------------------------------------------------------------------
1975*cdf0e10cSrcweir 	Beschreibung:	Links bearbeiten
1976*cdf0e10cSrcweir  --------------------------------------------------------------------*/
1977*cdf0e10cSrcweir 
1978*cdf0e10cSrcweir void SwView::ExecuteInsertDoc( SfxRequest& rRequest, const SfxPoolItem* pItem )
1979*cdf0e10cSrcweir {
1980*cdf0e10cSrcweir     pViewImpl->InitRequest( rRequest );
1981*cdf0e10cSrcweir     pViewImpl->SetParam( pItem ? 1 : 0 );
1982*cdf0e10cSrcweir     sal_uInt16 nSlot = rRequest.GetSlot();
1983*cdf0e10cSrcweir 
1984*cdf0e10cSrcweir     if ( !pItem )
1985*cdf0e10cSrcweir     {
1986*cdf0e10cSrcweir         String sEmpty;
1987*cdf0e10cSrcweir         InsertDoc( nSlot, sEmpty, sEmpty );
1988*cdf0e10cSrcweir     }
1989*cdf0e10cSrcweir     else
1990*cdf0e10cSrcweir     {
1991*cdf0e10cSrcweir         String sFile, sFilter;
1992*cdf0e10cSrcweir         sFile = ( (const SfxStringItem *)pItem )->GetValue();
1993*cdf0e10cSrcweir         if ( SFX_ITEM_SET == rRequest.GetArgs()->GetItemState( FN_PARAM_1, sal_True, &pItem ) )
1994*cdf0e10cSrcweir             sFilter = ( (const SfxStringItem *)pItem )->GetValue();
1995*cdf0e10cSrcweir 
1996*cdf0e10cSrcweir         bool bHasFileName = ( sFile.Len() > 0 );
1997*cdf0e10cSrcweir         long nFound = InsertDoc( nSlot, sFile, sFilter );
1998*cdf0e10cSrcweir 
1999*cdf0e10cSrcweir         if ( bHasFileName )
2000*cdf0e10cSrcweir         {
2001*cdf0e10cSrcweir             rRequest.SetReturnValue( SfxBoolItem( nSlot, nFound != -1 ) );
2002*cdf0e10cSrcweir             rRequest.Done();
2003*cdf0e10cSrcweir         }
2004*cdf0e10cSrcweir     }
2005*cdf0e10cSrcweir }
2006*cdf0e10cSrcweir 
2007*cdf0e10cSrcweir long SwView::InsertDoc( sal_uInt16 nSlotId, const String& rFileName, const String& rFilterName, sal_Int16 nVersion )
2008*cdf0e10cSrcweir {
2009*cdf0e10cSrcweir 	SfxMedium* pMed = 0;
2010*cdf0e10cSrcweir 	SwDocShell* pDocSh = GetDocShell();
2011*cdf0e10cSrcweir 
2012*cdf0e10cSrcweir 	if( rFileName.Len() )
2013*cdf0e10cSrcweir 	{
2014*cdf0e10cSrcweir 		SfxObjectFactory& rFact = pDocSh->GetFactory();
2015*cdf0e10cSrcweir         const SfxFilter* pFilter = rFact.GetFilterContainer()->GetFilter4FilterName( rFilterName );
2016*cdf0e10cSrcweir 		if ( !pFilter )
2017*cdf0e10cSrcweir 		{
2018*cdf0e10cSrcweir 			pMed = new SfxMedium(rFileName, STREAM_READ, sal_True, 0, 0 );
2019*cdf0e10cSrcweir 			SfxFilterMatcher aMatcher( rFact.GetFilterContainer()->GetName() );
2020*cdf0e10cSrcweir             pMed->UseInteractionHandler( sal_True );
2021*cdf0e10cSrcweir 			ErrCode nErr = aMatcher.GuessFilter( *pMed, &pFilter, sal_False );
2022*cdf0e10cSrcweir 			if ( nErr )
2023*cdf0e10cSrcweir 				DELETEZ(pMed);
2024*cdf0e10cSrcweir 			else
2025*cdf0e10cSrcweir 				pMed->SetFilter( pFilter );
2026*cdf0e10cSrcweir 		}
2027*cdf0e10cSrcweir 		else
2028*cdf0e10cSrcweir 			pMed = new SfxMedium(rFileName, STREAM_READ, sal_True, pFilter, 0);
2029*cdf0e10cSrcweir 	}
2030*cdf0e10cSrcweir 	else
2031*cdf0e10cSrcweir 	{
2032*cdf0e10cSrcweir         String sFactory = String::CreateFromAscii( pDocSh->GetFactory().GetShortName() );
2033*cdf0e10cSrcweir         pViewImpl->StartDocumentInserter( sFactory, LINK( this, SwView, DialogClosedHdl ) );
2034*cdf0e10cSrcweir         return -1;
2035*cdf0e10cSrcweir 	}
2036*cdf0e10cSrcweir 
2037*cdf0e10cSrcweir     if( !pMed )
2038*cdf0e10cSrcweir 		return -1;
2039*cdf0e10cSrcweir 
2040*cdf0e10cSrcweir     return InsertMedium( nSlotId, pMed, nVersion );
2041*cdf0e10cSrcweir }
2042*cdf0e10cSrcweir 
2043*cdf0e10cSrcweir long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVersion )
2044*cdf0e10cSrcweir {
2045*cdf0e10cSrcweir     sal_Bool bInsert = sal_False, bCompare = sal_False, bMerge = sal_False;
2046*cdf0e10cSrcweir     long nFound = 0;
2047*cdf0e10cSrcweir     SwDocShell* pDocSh = GetDocShell();
2048*cdf0e10cSrcweir 
2049*cdf0e10cSrcweir     switch( nSlotId )
2050*cdf0e10cSrcweir     {
2051*cdf0e10cSrcweir         case SID_DOCUMENT_MERGE:        bMerge = sal_True;      break;
2052*cdf0e10cSrcweir         case SID_DOCUMENT_COMPARE:      bCompare = sal_True;    break;
2053*cdf0e10cSrcweir         case SID_INSERTDOC:             bInsert = sal_True;     break;
2054*cdf0e10cSrcweir 
2055*cdf0e10cSrcweir         default:
2056*cdf0e10cSrcweir             ASSERT( !this, "Unbekannte SlotId!" );
2057*cdf0e10cSrcweir             bInsert = sal_True;
2058*cdf0e10cSrcweir             nSlotId = SID_INSERTDOC;
2059*cdf0e10cSrcweir             break;
2060*cdf0e10cSrcweir     }
2061*cdf0e10cSrcweir 
2062*cdf0e10cSrcweir     if( bInsert )
2063*cdf0e10cSrcweir 	{
2064*cdf0e10cSrcweir         uno::Reference< frame::XDispatchRecorder > xRecorder =
2065*cdf0e10cSrcweir                 GetViewFrame()->GetBindings().GetRecorder();
2066*cdf0e10cSrcweir 		if ( xRecorder.is() )
2067*cdf0e10cSrcweir         {
2068*cdf0e10cSrcweir             SfxRequest aRequest(GetViewFrame(), SID_INSERTDOC);
2069*cdf0e10cSrcweir             aRequest.AppendItem(SfxStringItem(SID_INSERTDOC, pMedium->GetOrigURL()));
2070*cdf0e10cSrcweir             if(pMedium->GetFilter())
2071*cdf0e10cSrcweir             aRequest.AppendItem(SfxStringItem(FN_PARAM_1, pMedium->GetFilter()->GetName()));
2072*cdf0e10cSrcweir             aRequest.Done();
2073*cdf0e10cSrcweir         }
2074*cdf0e10cSrcweir 
2075*cdf0e10cSrcweir         SfxObjectShellRef aRef( pDocSh );
2076*cdf0e10cSrcweir 
2077*cdf0e10cSrcweir         sal_uInt32 nError = SfxObjectShell::HandleFilter( pMedium, pDocSh );
2078*cdf0e10cSrcweir         // #i16722# aborted?
2079*cdf0e10cSrcweir         if(nError != ERRCODE_NONE)
2080*cdf0e10cSrcweir         {
2081*cdf0e10cSrcweir             delete pMedium;
2082*cdf0e10cSrcweir             return -1;
2083*cdf0e10cSrcweir         }
2084*cdf0e10cSrcweir         pDocSh->RegisterTransfer( *pMedium );
2085*cdf0e10cSrcweir         pMedium->DownLoad();    // ggfs. den DownLoad anstossen
2086*cdf0e10cSrcweir 		if( aRef.Is() && 1 < aRef->GetRefCount() )	// noch gueltige Ref?
2087*cdf0e10cSrcweir 		{
2088*cdf0e10cSrcweir 			SwReader* pRdr;
2089*cdf0e10cSrcweir             Reader *pRead = pDocSh->StartConvertFrom( *pMedium, &pRdr, pWrtShell );
2090*cdf0e10cSrcweir 			if( pRead ||
2091*cdf0e10cSrcweir                 (pMedium->GetFilter()->GetFilterFlags() & SFX_FILTER_STARONEFILTER) != 0 )
2092*cdf0e10cSrcweir 			{
2093*cdf0e10cSrcweir                 sal_uInt16 nUndoCheck = 0;
2094*cdf0e10cSrcweir                 SwDoc *pDoc = pDocSh->GetDoc();
2095*cdf0e10cSrcweir                 if( pRead && pDocSh->GetDoc() )
2096*cdf0e10cSrcweir                     nUndoCheck = lcl_PageDescWithHeader( *pDoc );
2097*cdf0e10cSrcweir 				sal_uLong nErrno;
2098*cdf0e10cSrcweir 				{	//Scope for SwWait-Object, to be able to execute slots
2099*cdf0e10cSrcweir 					//outside this scope.
2100*cdf0e10cSrcweir 					SwWait aWait( *GetDocShell(), sal_True );
2101*cdf0e10cSrcweir 					pWrtShell->StartAllAction();
2102*cdf0e10cSrcweir 					if ( pWrtShell->HasSelection() )
2103*cdf0e10cSrcweir 						pWrtShell->DelRight();		// Selektionen loeschen
2104*cdf0e10cSrcweir 					if( pRead )
2105*cdf0e10cSrcweir 					{
2106*cdf0e10cSrcweir 						nErrno = pRdr->Read( *pRead );	// und Dokument einfuegen
2107*cdf0e10cSrcweir 						delete pRdr;
2108*cdf0e10cSrcweir 					}
2109*cdf0e10cSrcweir 					else
2110*cdf0e10cSrcweir 					{
2111*cdf0e10cSrcweir                         ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo());
2112*cdf0e10cSrcweir                         nErrno = pDocSh->InsertFrom( *pMedium ) ? 0 : ERR_SWG_READ_ERROR;
2113*cdf0e10cSrcweir 					}
2114*cdf0e10cSrcweir 
2115*cdf0e10cSrcweir 				}
2116*cdf0e10cSrcweir 
2117*cdf0e10cSrcweir 				// ggfs. alle Verzeichnisse updaten:
2118*cdf0e10cSrcweir 				if( pWrtShell->IsUpdateTOX() )
2119*cdf0e10cSrcweir 				{
2120*cdf0e10cSrcweir 					SfxRequest aReq( FN_UPDATE_TOX, SFX_CALLMODE_SLOT, GetPool() );
2121*cdf0e10cSrcweir 					Execute( aReq );
2122*cdf0e10cSrcweir 					pWrtShell->SetUpdateTOX( sal_False );		// wieder zurueck setzen
2123*cdf0e10cSrcweir 				}
2124*cdf0e10cSrcweir 
2125*cdf0e10cSrcweir                 if( pDoc )
2126*cdf0e10cSrcweir                 { // Disable Undo for .sdw (136991) or
2127*cdf0e10cSrcweir                   // if the number of page styles with header/footer has changed (#i67305)
2128*cdf0e10cSrcweir                     if( !pRead || nUndoCheck != lcl_PageDescWithHeader( *pDoc ) )
2129*cdf0e10cSrcweir                     {
2130*cdf0e10cSrcweir                         pDoc->GetIDocumentUndoRedo().DelAllUndoObj();
2131*cdf0e10cSrcweir                     }
2132*cdf0e10cSrcweir                 }
2133*cdf0e10cSrcweir 
2134*cdf0e10cSrcweir 				pWrtShell->EndAllAction();
2135*cdf0e10cSrcweir 				if( nErrno )
2136*cdf0e10cSrcweir 				{
2137*cdf0e10cSrcweir 					ErrorHandler::HandleError( nErrno );
2138*cdf0e10cSrcweir 					nFound = IsError( nErrno ) ? -1 : 0;
2139*cdf0e10cSrcweir 				}
2140*cdf0e10cSrcweir 				else
2141*cdf0e10cSrcweir 					nFound = 0;
2142*cdf0e10cSrcweir 			}
2143*cdf0e10cSrcweir 		}
2144*cdf0e10cSrcweir 	}
2145*cdf0e10cSrcweir 	else
2146*cdf0e10cSrcweir 	{
2147*cdf0e10cSrcweir 		SfxObjectShellRef xDocSh;
2148*cdf0e10cSrcweir 		SfxObjectShellLock xLockRef;
2149*cdf0e10cSrcweir 
2150*cdf0e10cSrcweir extern int lcl_FindDocShell( SfxObjectShellRef& xDocSh, SfxObjectShellLock& xLockRef,
2151*cdf0e10cSrcweir 							const String& rFileName, const String& rPasswd,
2152*cdf0e10cSrcweir 							String& rFilter, sal_Int16 nVersion,
2153*cdf0e10cSrcweir 							SwDocShell* pDestSh );
2154*cdf0e10cSrcweir 
2155*cdf0e10cSrcweir 		String sFltNm;
2156*cdf0e10cSrcweir         int nRet = lcl_FindDocShell( xDocSh, xLockRef, pMedium->GetName(), aEmptyStr,
2157*cdf0e10cSrcweir 									sFltNm, nVersion, pDocSh );
2158*cdf0e10cSrcweir 		if( nRet )
2159*cdf0e10cSrcweir 		{
2160*cdf0e10cSrcweir 			SwWait aWait( *GetDocShell(), sal_True );
2161*cdf0e10cSrcweir 			pWrtShell->StartAllAction();
2162*cdf0e10cSrcweir 
2163*cdf0e10cSrcweir 			pWrtShell->EnterStdMode();			// Selektionen loeschen
2164*cdf0e10cSrcweir 
2165*cdf0e10cSrcweir 			if( bCompare )
2166*cdf0e10cSrcweir 				nFound = pWrtShell->CompareDoc( *((SwDocShell*)&xDocSh)->GetDoc() );
2167*cdf0e10cSrcweir 			else
2168*cdf0e10cSrcweir 				nFound = pWrtShell->MergeDoc( *((SwDocShell*)&xDocSh)->GetDoc() );
2169*cdf0e10cSrcweir 
2170*cdf0e10cSrcweir 			pWrtShell->EndAllAction();
2171*cdf0e10cSrcweir 
2172*cdf0e10cSrcweir 			if (!bCompare && !nFound)
2173*cdf0e10cSrcweir 			{
2174*cdf0e10cSrcweir 				Window* pWin = &GetEditWin();
2175*cdf0e10cSrcweir 				InfoBox(pWin, SW_RES(MSG_NO_MERGE_ENTRY)).Execute();
2176*cdf0e10cSrcweir 			}
2177*cdf0e10cSrcweir 		}
2178*cdf0e10cSrcweir 		if( 2 == nRet && xDocSh.Is() )
2179*cdf0e10cSrcweir 			xDocSh->DoClose();
2180*cdf0e10cSrcweir 	}
2181*cdf0e10cSrcweir 
2182*cdf0e10cSrcweir     delete pMedium;
2183*cdf0e10cSrcweir 	return nFound;
2184*cdf0e10cSrcweir }
2185*cdf0e10cSrcweir /* -----------------05.02.2003 12:06-----------------
2186*cdf0e10cSrcweir  *
2187*cdf0e10cSrcweir  * --------------------------------------------------*/
2188*cdf0e10cSrcweir void SwView::EnableMailMerge(sal_Bool bEnable )
2189*cdf0e10cSrcweir {
2190*cdf0e10cSrcweir     bInMailMerge = bEnable;
2191*cdf0e10cSrcweir     SfxBindings& rBind = GetViewFrame()->GetBindings();
2192*cdf0e10cSrcweir     rBind.Invalidate(FN_INSERT_FIELD_DATA_ONLY);
2193*cdf0e10cSrcweir     rBind.Update(FN_INSERT_FIELD_DATA_ONLY);
2194*cdf0e10cSrcweir }
2195*cdf0e10cSrcweir /*
2196*cdf0e10cSrcweir */
2197*cdf0e10cSrcweir namespace
2198*cdf0e10cSrcweir {
2199*cdf0e10cSrcweir 	sal_Bool lcl_NeedAdditionalDataSource( const uno::Reference< XNameAccess >& _rDatasourceContext )
2200*cdf0e10cSrcweir 	{
2201*cdf0e10cSrcweir 		Sequence < OUString > aNames = _rDatasourceContext->getElementNames();
2202*cdf0e10cSrcweir 
2203*cdf0e10cSrcweir 		return	(	!aNames.getLength()
2204*cdf0e10cSrcweir 				||	(	( 1 == aNames.getLength() )
2205*cdf0e10cSrcweir 					&&	aNames.getConstArray()[0] == SW_MOD()->GetDBConfig()->GetBibliographySource().sDataSource
2206*cdf0e10cSrcweir 					)
2207*cdf0e10cSrcweir 				);
2208*cdf0e10cSrcweir 	}
2209*cdf0e10cSrcweir }
2210*cdf0e10cSrcweir 
2211*cdf0e10cSrcweir /* -----------------27.11.2002 12:12-----------------
2212*cdf0e10cSrcweir  *
2213*cdf0e10cSrcweir  * --------------------------------------------------*/
2214*cdf0e10cSrcweir 
2215*cdf0e10cSrcweir class SwMergeSourceWarningBox_Impl : public ModalDialog
2216*cdf0e10cSrcweir {
2217*cdf0e10cSrcweir         FixedInfo       aMessageFI;
2218*cdf0e10cSrcweir         OKButton        aOK;
2219*cdf0e10cSrcweir         CancelButton    aCancel;
2220*cdf0e10cSrcweir 
2221*cdf0e10cSrcweir         FixedImage      aWarnImage;
2222*cdf0e10cSrcweir     public:
2223*cdf0e10cSrcweir         SwMergeSourceWarningBox_Impl( Window* pParent ) :
2224*cdf0e10cSrcweir             ModalDialog( pParent, SW_RES( DLG_MERGE_SOURCE_UNAVAILABLE   ) ),
2225*cdf0e10cSrcweir                     aMessageFI( this, SW_RES( ST_MERGE_SOURCE_UNAVAILABLE ) ),
2226*cdf0e10cSrcweir                     aOK(        this, SW_RES( PB_MERGE_OK                 ) ),
2227*cdf0e10cSrcweir                     aCancel(    this, SW_RES( PB_MERGE_CANCEL             ) ),
2228*cdf0e10cSrcweir                     aWarnImage( this, SW_RES( IMG_MERGE                   ) )
2229*cdf0e10cSrcweir                     {
2230*cdf0e10cSrcweir                         FreeResource();
2231*cdf0e10cSrcweir                         SetText( Application::GetDisplayName() );
2232*cdf0e10cSrcweir                         const Image& rImg = WarningBox::GetStandardImage();
2233*cdf0e10cSrcweir                         aWarnImage.SetImage( rImg );
2234*cdf0e10cSrcweir                         Size aImageSize( rImg.GetSizePixel() );
2235*cdf0e10cSrcweir                         aImageSize.Width()  += 4;
2236*cdf0e10cSrcweir                         aImageSize.Height() += 4;
2237*cdf0e10cSrcweir                         aWarnImage.SetSizePixel( aImageSize );
2238*cdf0e10cSrcweir 
2239*cdf0e10cSrcweir                         aImageSize.Width() += aWarnImage.GetPosPixel().X();
2240*cdf0e10cSrcweir                         Size aSz(GetSizePixel());
2241*cdf0e10cSrcweir                         aSz.Width() += aImageSize.Width();
2242*cdf0e10cSrcweir                         SetSizePixel(aSz);
2243*cdf0e10cSrcweir 
2244*cdf0e10cSrcweir                         Point aPos(aMessageFI.GetPosPixel());
2245*cdf0e10cSrcweir                         aPos.X() += aImageSize.Width();
2246*cdf0e10cSrcweir                         aMessageFI.SetPosPixel( aPos );
2247*cdf0e10cSrcweir 
2248*cdf0e10cSrcweir                         aPos = aOK.GetPosPixel();
2249*cdf0e10cSrcweir                         aPos.X() += aImageSize.Width();
2250*cdf0e10cSrcweir                         aOK.SetPosPixel( aPos );
2251*cdf0e10cSrcweir                         aPos = aCancel.GetPosPixel();
2252*cdf0e10cSrcweir                         aPos.X() += aImageSize.Width();
2253*cdf0e10cSrcweir                         aCancel.SetPosPixel( aPos );
2254*cdf0e10cSrcweir 
2255*cdf0e10cSrcweir                     }
2256*cdf0e10cSrcweir 
2257*cdf0e10cSrcweir         String          GetMessText() const { return aMessageFI.GetText(); }
2258*cdf0e10cSrcweir         void            SetMessText( const String& rText ) { aMessageFI.SetText( rText ); }
2259*cdf0e10cSrcweir };
2260*cdf0e10cSrcweir 
2261*cdf0e10cSrcweir 
2262*cdf0e10cSrcweir 
2263*cdf0e10cSrcweir 
2264*cdf0e10cSrcweir void SwView::GenerateFormLetter(sal_Bool bUseCurrentDocument)
2265*cdf0e10cSrcweir {
2266*cdf0e10cSrcweir     if(bUseCurrentDocument)
2267*cdf0e10cSrcweir     {
2268*cdf0e10cSrcweir         if(!GetWrtShell().IsAnyDatabaseFieldInDoc())
2269*cdf0e10cSrcweir         {
2270*cdf0e10cSrcweir             //check availability of data sources (except biblio source)
2271*cdf0e10cSrcweir             uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
2272*cdf0e10cSrcweir             uno::Reference<XNameAccess>  xDBContext;
2273*cdf0e10cSrcweir             if( xMgr.is() )
2274*cdf0e10cSrcweir             {
2275*cdf0e10cSrcweir                 uno::Reference<XInterface> xInstance = xMgr->createInstance(
2276*cdf0e10cSrcweir                     OUString::createFromAscii( "com.sun.star.sdb.DatabaseContext" ));
2277*cdf0e10cSrcweir                 xDBContext = uno::Reference<XNameAccess>(xInstance, UNO_QUERY) ;
2278*cdf0e10cSrcweir             }
2279*cdf0e10cSrcweir             if(!xDBContext.is())
2280*cdf0e10cSrcweir                 return ;
2281*cdf0e10cSrcweir             sal_Bool bCallAddressPilot = sal_False;
2282*cdf0e10cSrcweir 			if ( lcl_NeedAdditionalDataSource( xDBContext ) )
2283*cdf0e10cSrcweir             {
2284*cdf0e10cSrcweir                 // no data sources are available - create a new one
2285*cdf0e10cSrcweir                 WarningBox aWarning(
2286*cdf0e10cSrcweir                             &GetViewFrame()->GetWindow(),
2287*cdf0e10cSrcweir                             SW_RES(MSG_DATA_SOURCES_UNAVAILABLE));
2288*cdf0e10cSrcweir                 // no cancel allowed
2289*cdf0e10cSrcweir                 if ( RET_OK != aWarning.Execute() )
2290*cdf0e10cSrcweir 					return;
2291*cdf0e10cSrcweir                 bCallAddressPilot = sal_True;
2292*cdf0e10cSrcweir             }
2293*cdf0e10cSrcweir             else
2294*cdf0e10cSrcweir             {
2295*cdf0e10cSrcweir                 //take an existing data source or create a new one?
2296*cdf0e10cSrcweir 					SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
2297*cdf0e10cSrcweir                     DBG_ASSERT(pFact, "Dialogdiet fail!");
2298*cdf0e10cSrcweir 					AbstractMailMergeFieldConnectionsDlg* pConnectionsDlg = pFact->CreateMailMergeFieldConnectionsDlg(
2299*cdf0e10cSrcweir 														DLG_MERGE_FIELD_CONNECTIONS,
2300*cdf0e10cSrcweir 														&GetViewFrame()->GetWindow());
2301*cdf0e10cSrcweir                     DBG_ASSERT(pConnectionsDlg, "Dialogdiet fail!");
2302*cdf0e10cSrcweir                     if(RET_OK == pConnectionsDlg->Execute())
2303*cdf0e10cSrcweir                         bCallAddressPilot = !pConnectionsDlg->IsUseExistingConnections();
2304*cdf0e10cSrcweir                     else
2305*cdf0e10cSrcweir                         return;
2306*cdf0e10cSrcweir 
2307*cdf0e10cSrcweir             }
2308*cdf0e10cSrcweir             if(bCallAddressPilot)
2309*cdf0e10cSrcweir             {
2310*cdf0e10cSrcweir                 GetViewFrame()->GetDispatcher()->Execute(
2311*cdf0e10cSrcweir                                 SID_ADDRESS_DATA_SOURCE, SFX_CALLMODE_SYNCHRON);
2312*cdf0e10cSrcweir 				if ( lcl_NeedAdditionalDataSource( xDBContext ) )
2313*cdf0e10cSrcweir 					// no additional data source has been created
2314*cdf0e10cSrcweir 					// -> assume that the user has cancelled the pilot
2315*cdf0e10cSrcweir 					return;
2316*cdf0e10cSrcweir             }
2317*cdf0e10cSrcweir 
2318*cdf0e10cSrcweir             //call insert fields with database field page available, only
2319*cdf0e10cSrcweir             SfxViewFrame* pVFrame = GetViewFrame();
2320*cdf0e10cSrcweir             //at first hide the default field dialog if currently visible
2321*cdf0e10cSrcweir             pVFrame->SetChildWindow(FN_INSERT_FIELD, sal_False);
2322*cdf0e10cSrcweir             //enable the status of the db field dialog - it is disabled in the status method
2323*cdf0e10cSrcweir             //to prevent creation of the dialog without mail merge active
2324*cdf0e10cSrcweir             EnableMailMerge();
2325*cdf0e10cSrcweir             //then show the "Data base only" field dialog
2326*cdf0e10cSrcweir             SfxBoolItem aOn(FN_INSERT_FIELD_DATA_ONLY, sal_True);
2327*cdf0e10cSrcweir             pVFrame->GetDispatcher()->Execute(FN_INSERT_FIELD_DATA_ONLY,
2328*cdf0e10cSrcweir                                                 SFX_CALLMODE_SYNCHRON, &aOn, 0L);
2329*cdf0e10cSrcweir             return;
2330*cdf0e10cSrcweir         }
2331*cdf0e10cSrcweir         else
2332*cdf0e10cSrcweir         {
2333*cdf0e10cSrcweir             // check whether the
2334*cdf0e10cSrcweir             String sSource;
2335*cdf0e10cSrcweir             if(!GetWrtShell().IsFieldDataSourceAvailable(sSource))
2336*cdf0e10cSrcweir             {
2337*cdf0e10cSrcweir                 SwMergeSourceWarningBox_Impl aWarning( &GetViewFrame()->GetWindow());
2338*cdf0e10cSrcweir                 String sTmp(aWarning.GetMessText());
2339*cdf0e10cSrcweir                 sTmp.SearchAndReplaceAscii("%1", sSource);
2340*cdf0e10cSrcweir                 aWarning.SetMessText(sTmp);
2341*cdf0e10cSrcweir                 if(RET_OK == aWarning.Execute())
2342*cdf0e10cSrcweir                 {
2343*cdf0e10cSrcweir                     SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
2344*cdf0e10cSrcweir                     if ( pFact )
2345*cdf0e10cSrcweir                     {
2346*cdf0e10cSrcweir                         VclAbstractDialog* pDlg = pFact->CreateVclDialog( NULL, SID_OPTIONS_DATABASES );
2347*cdf0e10cSrcweir                         pDlg->Execute();
2348*cdf0e10cSrcweir                         delete pDlg;
2349*cdf0e10cSrcweir                     }
2350*cdf0e10cSrcweir                 }
2351*cdf0e10cSrcweir                 return ;
2352*cdf0e10cSrcweir             }
2353*cdf0e10cSrcweir         }
2354*cdf0e10cSrcweir         SwNewDBMgr* pNewDBMgr = GetWrtShell().GetNewDBMgr();
2355*cdf0e10cSrcweir 
2356*cdf0e10cSrcweir         SwDBData aData;
2357*cdf0e10cSrcweir         SwWrtShell &rSh = GetWrtShell();
2358*cdf0e10cSrcweir         aData = rSh.GetDBData();
2359*cdf0e10cSrcweir         rSh.EnterStdMode(); // Wechsel in Textshell erzwingen; ist fuer
2360*cdf0e10cSrcweir                             // das Mischen von DB-Feldern notwendig.
2361*cdf0e10cSrcweir         AttrChangedNotify( &rSh );
2362*cdf0e10cSrcweir         pNewDBMgr->SetMergeType( DBMGR_MERGE );
2363*cdf0e10cSrcweir 
2364*cdf0e10cSrcweir         if (pNewDBMgr)
2365*cdf0e10cSrcweir         {
2366*cdf0e10cSrcweir             Sequence<PropertyValue> aProperties(3);
2367*cdf0e10cSrcweir             PropertyValue* pValues = aProperties.getArray();
2368*cdf0e10cSrcweir             pValues[0].Name = C2U("DataSourceName");
2369*cdf0e10cSrcweir             pValues[1].Name = C2U("Command");
2370*cdf0e10cSrcweir             pValues[2].Name = C2U("CommandType");
2371*cdf0e10cSrcweir             pValues[0].Value <<= aData.sDataSource;
2372*cdf0e10cSrcweir             pValues[1].Value <<= aData.sCommand;
2373*cdf0e10cSrcweir             pValues[2].Value <<= aData.nCommandType;
2374*cdf0e10cSrcweir             pNewDBMgr->ExecuteFormLetter(GetWrtShell(), aProperties, sal_True);
2375*cdf0e10cSrcweir         }
2376*cdf0e10cSrcweir     }
2377*cdf0e10cSrcweir     else
2378*cdf0e10cSrcweir     {
2379*cdf0e10cSrcweir         //call documents and template dialog
2380*cdf0e10cSrcweir         SfxApplication* pSfxApp = SFX_APP();
2381*cdf0e10cSrcweir         Window* pTopWin = pSfxApp->GetTopWindow();
2382*cdf0e10cSrcweir         SvtDocumentTemplateDialog* pDocTemplDlg = new SvtDocumentTemplateDialog( pTopWin );
2383*cdf0e10cSrcweir         pDocTemplDlg->SelectTemplateFolder();
2384*cdf0e10cSrcweir 
2385*cdf0e10cSrcweir         int nRet = pDocTemplDlg->Execute();
2386*cdf0e10cSrcweir         sal_Bool bNewWin = sal_False;
2387*cdf0e10cSrcweir         if ( nRet == RET_OK )
2388*cdf0e10cSrcweir         {
2389*cdf0e10cSrcweir             if ( pTopWin != pSfxApp->GetTopWindow() )
2390*cdf0e10cSrcweir             {
2391*cdf0e10cSrcweir                 // the dialogue opens a document -> a new TopWindow appears
2392*cdf0e10cSrcweir                 pTopWin = pSfxApp->GetTopWindow();
2393*cdf0e10cSrcweir                 bNewWin = sal_True;
2394*cdf0e10cSrcweir             }
2395*cdf0e10cSrcweir         }
2396*cdf0e10cSrcweir 
2397*cdf0e10cSrcweir         delete pDocTemplDlg;
2398*cdf0e10cSrcweir         if ( bNewWin )
2399*cdf0e10cSrcweir             // after the destruction of the dialogue its parent comes to top,
2400*cdf0e10cSrcweir             // but we want that the new document is on top
2401*cdf0e10cSrcweir             pTopWin->ToTop();
2402*cdf0e10cSrcweir 
2403*cdf0e10cSrcweir //        return;
2404*cdf0e10cSrcweir     }
2405*cdf0e10cSrcweir }
2406*cdf0e10cSrcweir 
2407*cdf0e10cSrcweir IMPL_LINK( SwView, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg )
2408*cdf0e10cSrcweir {
2409*cdf0e10cSrcweir     if ( ERRCODE_NONE == _pFileDlg->GetError() )
2410*cdf0e10cSrcweir     {
2411*cdf0e10cSrcweir         SfxMedium* pMed = pViewImpl->CreateMedium();
2412*cdf0e10cSrcweir         if ( pMed )
2413*cdf0e10cSrcweir         {
2414*cdf0e10cSrcweir             sal_uInt16 nSlot = pViewImpl->GetRequest()->GetSlot();
2415*cdf0e10cSrcweir             long nFound = InsertMedium( nSlot, pMed, pViewImpl->GetParam() );
2416*cdf0e10cSrcweir 
2417*cdf0e10cSrcweir             if ( SID_INSERTDOC == nSlot )
2418*cdf0e10cSrcweir             {
2419*cdf0e10cSrcweir                 if ( pViewImpl->GetParam() == 0 )
2420*cdf0e10cSrcweir                 {
2421*cdf0e10cSrcweir                     pViewImpl->GetRequest()->SetReturnValue( SfxBoolItem( nSlot, nFound != -1 ) );
2422*cdf0e10cSrcweir                     pViewImpl->GetRequest()->Ignore();
2423*cdf0e10cSrcweir                 }
2424*cdf0e10cSrcweir                 else
2425*cdf0e10cSrcweir                 {
2426*cdf0e10cSrcweir                     pViewImpl->GetRequest()->SetReturnValue( SfxBoolItem( nSlot, nFound != -1 ) );
2427*cdf0e10cSrcweir                     pViewImpl->GetRequest()->Done();
2428*cdf0e10cSrcweir                 }
2429*cdf0e10cSrcweir             }
2430*cdf0e10cSrcweir             else if ( SID_DOCUMENT_COMPARE == nSlot || SID_DOCUMENT_MERGE == nSlot )
2431*cdf0e10cSrcweir             {
2432*cdf0e10cSrcweir                 pViewImpl->GetRequest()->SetReturnValue( SfxInt32Item( nSlot, nFound ) );
2433*cdf0e10cSrcweir 
2434*cdf0e10cSrcweir                 if ( nFound > 0 ) // Redline-Browser anzeigen
2435*cdf0e10cSrcweir                 {
2436*cdf0e10cSrcweir                     SfxViewFrame* pVFrame = GetViewFrame();
2437*cdf0e10cSrcweir                     pVFrame->ShowChildWindow(FN_REDLINE_ACCEPT);
2438*cdf0e10cSrcweir 
2439*cdf0e10cSrcweir                     // RedlineDlg neu initialisieren
2440*cdf0e10cSrcweir                     sal_uInt16 nId = SwRedlineAcceptChild::GetChildWindowId();
2441*cdf0e10cSrcweir                     SwRedlineAcceptChild* pRed = (SwRedlineAcceptChild*)pVFrame->GetChildWindow( nId );
2442*cdf0e10cSrcweir                     if ( pRed )
2443*cdf0e10cSrcweir                         pRed->ReInitDlg( GetDocShell() );
2444*cdf0e10cSrcweir                 }
2445*cdf0e10cSrcweir             }
2446*cdf0e10cSrcweir         }
2447*cdf0e10cSrcweir     }
2448*cdf0e10cSrcweir     return 0;
2449*cdf0e10cSrcweir }
2450*cdf0e10cSrcweir 
2451*cdf0e10cSrcweir void SwView::ExecuteScan( SfxRequest& rReq )
2452*cdf0e10cSrcweir {
2453*cdf0e10cSrcweir 	if (pViewImpl)
2454*cdf0e10cSrcweir 		pViewImpl->ExecuteScan(rReq) ;
2455*cdf0e10cSrcweir }
2456*cdf0e10cSrcweir 
2457