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