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