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