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 : :
30 : : #include <sot/factory.hxx>
31 : : #include <hintids.hxx>
32 : : #include <svl/urihelper.hxx>
33 : : #include <svl/languageoptions.hxx>
34 : :
35 : : #include <svx/svxids.hrc>
36 : : #include <sfx2/linkmgr.hxx>
37 : : #include <svx/htmlmode.hxx>
38 : : #include <svx/imapdlg.hxx>
39 : : #include <sfx2/dispatch.hxx>
40 : : #include <sfx2/docfile.hxx>
41 : : #include <sfx2/viewfrm.hxx>
42 : : #include <sfx2/request.hxx>
43 : : #include <svl/whiter.hxx>
44 : : #include <svl/visitem.hxx>
45 : : #include <sfx2/objitem.hxx>
46 : : #include <svtools/filter.hxx>
47 : : #include <svx/gallery.hxx>
48 : : #include <editeng/langitem.hxx>
49 : : #include <svx/clipfmtitem.hxx>
50 : : #include <svx/contdlg.hxx>
51 : : #include <vcl/graph.hxx>
52 : : #include <svl/slstitm.hxx>
53 : : #include <vcl/msgbox.hxx>
54 : : #include <svl/ptitem.hxx>
55 : : #include <svl/itemiter.hxx>
56 : : #include <svl/stritem.hxx>
57 : : #include <editeng/colritem.hxx>
58 : : #include <editeng/shaditem.hxx>
59 : : #include <editeng/boxitem.hxx>
60 : : #include <svl/srchitem.hxx>
61 : : #include <editeng/ulspitem.hxx>
62 : : #include <editeng/lrspitem.hxx>
63 : : #include <editeng/brshitem.hxx>
64 : : #include <editeng/opaqitem.hxx>
65 : : #include <editeng/sizeitem.hxx>
66 : : #include <svx/flagsdef.hxx>
67 : : #include <editeng/scripttypeitem.hxx>
68 : : #include <sfx2/objface.hxx>
69 : : #include <fmturl.hxx>
70 : : #include <fmthdft.hxx>
71 : : #include <fmtclds.hxx>
72 : : #include <docsh.hxx>
73 : : #include <wrtsh.hxx>
74 : : #include <view.hxx>
75 : : #include <swmodule.hxx>
76 : : #include <swundo.hxx>
77 : : #include <fldbas.hxx>
78 : : #include <uitool.hxx>
79 : : #include <basesh.hxx>
80 : : #include <viewopt.hxx>
81 : : #include <fontcfg.hxx>
82 : : #include <docstat.hxx>
83 : : #include <usrfld.hxx>
84 : : #include <expfld.hxx>
85 : : #include <fldmgr.hxx>
86 : : #include <frmmgr.hxx>
87 : : #include <tablemgr.hxx>
88 : : #include <mdiexp.hxx>
89 : : #include <swdtflvr.hxx>
90 : : #include <pagedesc.hxx>
91 : : #include <convert.hxx>
92 : : #include <fmtcol.hxx>
93 : : #include <edtwin.hxx>
94 : : #include <tblafmt.hxx>
95 : : #include <caption.hxx>
96 : : #include <swwait.hxx>
97 : : #include <cmdid.h>
98 : : #include <globals.hrc>
99 : : #include <shells.hrc>
100 : : #include <statstr.hrc>
101 : : #include <globals.h>
102 : : #include <unotxdoc.hxx>
103 : : #include <crsskip.hxx>
104 : : #include <fmtinfmt.hxx>
105 : : #include <doc.hxx>
106 : :
107 : : #include "swabstdlg.hxx"
108 : : #include "dialog.hrc"
109 : : #include "fldui.hrc"
110 : : #include "table.hrc"
111 : : #include <modcfg.hxx>
112 : : #include <instable.hxx>
113 : : #include <svx/fmshell.hxx> // for FN_XFORMS_DESIGN_MODE
114 : : #include <SwRewriter.hxx>
115 : : #include <comcore.hrc>
116 : :
117 : : #include <unomid.h>
118 : :
119 : : FlyMode SwBaseShell::eFrameMode = FLY_DRAG_END;
120 : :
121 : : //Fuer die Erkennung der Id, die variable von Gallery mit SID_GALLERY_BG_BRUSH
122 : : //ankommt.
123 : : static sal_uInt8 nParagraphPos;
124 : : static sal_uInt8 nGraphicPos;
125 : : static sal_uInt8 nOlePos;
126 : : static sal_uInt8 nFramePos;
127 : : static sal_uInt8 nTablePos;
128 : : static sal_uInt8 nTableRowPos;
129 : : static sal_uInt8 nTableCellPos;
130 : : static sal_uInt8 nPagePos;
131 : : static sal_uInt8 nHeaderPos;
132 : : static sal_uInt8 nFooterPos;
133 : :
134 : : #define SwBaseShell
135 : : #define Shadow
136 : : #include <sfx2/msg.hxx>
137 : : #include "swslots.hxx"
138 : :
139 : : #define SWCONTOURDLG(rView) ( (SvxContourDlg*) ( rView.GetViewFrame()->GetChildWindow( \
140 : : SvxContourDlgChildWindow::GetChildWindowId() )-> \
141 : : GetWindow() ) )
142 : :
143 : : #define SWIMAPDLG(rView) ( (SvxIMapDlg*) ( rView.GetViewFrame()->GetChildWindow( \
144 : : SvxIMapDlgChildWindow::GetChildWindowId() )-> \
145 : : GetWindow() ) )
146 : :
147 : :
148 : : using namespace ::com::sun::star;
149 : : using namespace ::com::sun::star::uno;
150 : : using namespace ::com::sun::star::frame;
151 : : using namespace ::com::sun::star::lang;
152 : :
153 [ + + ][ + - ]: 1022 : SFX_IMPL_INTERFACE(SwBaseShell, SfxShell, SW_RES(0))
[ + - ]
154 : : {
155 : 73 : SFX_CHILDWINDOW_REGISTRATION(SvxIMapDlgChildWindow::GetChildWindowId());
156 : 73 : SFX_CHILDWINDOW_REGISTRATION(SvxContourDlgChildWindow::GetChildWindowId());
157 : 73 : }
158 : :
159 [ + + ][ - + ]: 40775 : TYPEINIT1(SwBaseShell,SfxShell)
160 : :
161 : : /*--------------------------------------------------------------------
162 : : Beschreibung: statics
163 : : --------------------------------------------------------------------*/
164 : 0 : void lcl_UpdateIMapDlg( SwWrtShell& rSh )
165 : : {
166 [ # # ]: 0 : Graphic aGrf( rSh.GetIMapGraphic() );
167 [ # # ]: 0 : GraphicType nGrfType = aGrf.GetType();
168 : : void* pEditObj = GRAPHIC_NONE != nGrfType && GRAPHIC_DEFAULT != nGrfType
169 [ # # ][ # # ]: 0 : ? rSh.GetIMapInventor() : 0;
[ # # ]
170 [ # # ][ # # ]: 0 : TargetList* pList = new TargetList;
171 [ # # ][ # # ]: 0 : rSh.GetView().GetViewFrame()->GetTopFrame().GetTargetList(*pList);
172 : :
173 [ # # ][ # # ]: 0 : SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
174 [ # # ]: 0 : rSh.GetFlyFrmAttr( aSet );
175 [ # # ]: 0 : const SwFmtURL &rURL = (SwFmtURL&)aSet.Get( RES_URL );
176 : : SvxIMapDlgChildWindow::UpdateIMapDlg(
177 [ # # ]: 0 : aGrf, rURL.GetMap(), pList, pEditObj );
178 : :
179 [ # # ]: 0 : for ( size_t i = 0, n = pList->size(); i < n; ++i )
180 [ # # ][ # # ]: 0 : delete pList->at( i );
[ # # ]
181 [ # # ][ # # ]: 0 : delete pList;
[ # # ]
182 : 0 : }
183 : :
184 : 0 : sal_Bool lcl_UpdateContourDlg( SwWrtShell &rSh, int nSel )
185 : : {
186 [ # # ]: 0 : Graphic aGraf( rSh.GetIMapGraphic() );
187 [ # # ]: 0 : GraphicType nGrfType = aGraf.GetType();
188 [ # # ][ # # ]: 0 : sal_Bool bRet = GRAPHIC_NONE != nGrfType && GRAPHIC_DEFAULT != nGrfType;
189 [ # # ]: 0 : if( bRet )
190 : : {
191 [ # # ]: 0 : String aGrfName;
192 [ # # ]: 0 : if ( nSel & nsSelectionType::SEL_GRF )
193 [ # # ]: 0 : rSh.GetGrfNms( &aGrfName, 0 );
194 : :
195 [ # # ][ # # ]: 0 : SvxContourDlg *pDlg = SWCONTOURDLG(rSh.GetView());
196 : 0 : pDlg->Update( aGraf, aGrfName.Len() > 0,
197 [ # # # # ]: 0 : rSh.GetGraphicPolygon(), rSh.GetIMapInventor() );
[ # # ][ # # ]
198 : : }
199 [ # # ]: 0 : return bRet;
200 : : }
201 : :
202 : : /*--------------------------------------------------------------------
203 : : Beschreibung: loeschen
204 : : --------------------------------------------------------------------*/
205 : 0 : void SwBaseShell::ExecDelete(SfxRequest &rReq)
206 : : {
207 : 0 : SwWrtShell &rSh = GetShell();
208 : 0 : SwEditWin& rTmpEditWin = GetView().GetEditWin();
209 [ # # # # ]: 0 : switch(rReq.GetSlot())
210 : : {
211 : : case SID_DELETE:
212 : 0 : rSh.DelRight();
213 : 0 : break;
214 : :
215 : : case FN_BACKSPACE:
216 : :
217 [ # # ]: 0 : if( rSh.IsNoNum() )
218 : : {
219 : 0 : rSh.SttCrsrMove();
220 : 0 : sal_Bool bLeft = rSh.Left( CRSR_SKIP_CHARS, sal_True, 1, sal_False );
221 [ # # ]: 0 : if( bLeft )
222 : : {
223 : 0 : rSh.DelLeft();
224 : : }
225 : : else
226 : : // JP 15.07.96: wenns nicht mehr nach vorne geht, die
227 : : // Numerierung aufheben. Z.B. am Doc-/
228 : : // Rahmen-/Tabellen-/Bereichs-Anfang
229 : 0 : rSh.DelNumRules();
230 : :
231 : 0 : rSh.EndCrsrMove();
232 : 0 : break;
233 : : }
234 : :
235 : : // ansonsten DelLeft rufen
236 : : case FN_SHIFT_BACKSPACE:
237 : 0 : rSh.DelLeft();
238 : 0 : break;
239 : : default:
240 : : OSL_FAIL("wrong Dispatcher");
241 : 0 : return;
242 : : }
243 : 0 : rReq.Done();
244 : :
245 : : //#i42732# - notify the edit window that from now on we do not use the input language
246 : 0 : rTmpEditWin.SetUseInputLanguage( sal_False );
247 : : }
248 : :
249 : 0 : void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
250 : : {
251 : : //Achtung: Suizid gefaehrdet! Nach Paste, Paste special kann der die
252 : : //Shell zerstoert sein.
253 : :
254 : :
255 : 0 : SwWrtShell &rSh = GetShell();
256 : 0 : sal_uInt16 nId = rReq.GetSlot();
257 : 0 : sal_Bool bIgnore = sal_False;
258 [ # # # # : 0 : switch( nId )
# # ]
259 : : {
260 : : case SID_CUT:
261 : : case SID_COPY:
262 : 0 : rView.GetEditWin().FlushInBuffer();
263 [ # # ]: 0 : if ( rSh.HasSelection() )
264 : : {
265 [ # # ]: 0 : SwTransferable* pTransfer = new SwTransferable( rSh );
266 [ # # ][ # # ]: 0 : /*??*/ uno::Reference< datatransfer::XTransferable > xRef( pTransfer );
267 : :
268 [ # # ][ # # ]: 0 : if ( nId == SID_CUT && !rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT) )
[ # # ][ # # ]
269 [ # # ]: 0 : pTransfer->Cut();
270 : : else
271 : : {
272 : 0 : const sal_Bool bLockedView = rSh.IsViewLocked();
273 : 0 : rSh.LockView( sal_True ); //lock visible section
274 [ # # ]: 0 : pTransfer->Copy();
275 : 0 : rSh.LockView( bLockedView );
276 : : }
277 : 0 : break;
278 : : }
279 : 0 : return;
280 : :
281 : : case SID_PASTE:
282 : : {
283 : : TransferableDataHelper aDataHelper(
284 : : TransferableDataHelper::CreateFromSystemClipboard(
285 [ # # ]: 0 : &rSh.GetView().GetEditWin() ) );
286 : :
287 [ # # ][ # # ]: 0 : if( aDataHelper.GetXTransferable().is() &&
[ # # ][ # # ]
[ # # # # ]
288 [ # # ]: 0 : SwTransferable::IsPaste( rSh, aDataHelper ))
289 : : {
290 : : // temp. Variablen, da die Shell nach dem Paste schon
291 : : // zerstoert sein kann
292 : 0 : SwView* pView = &rView;
293 [ # # ]: 0 : SwTransferable::Paste( rSh, aDataHelper );
294 [ # # ][ # # ]: 0 : if( rSh.IsFrmSelected() || rSh.IsObjSelected() )
[ # # ][ # # ]
[ # # ]
295 [ # # ]: 0 : rSh.EnterSelFrmMode();
296 [ # # ]: 0 : pView->AttrChangedNotify( &rSh );
297 : : }
298 : : else
299 [ # # ][ # # ]: 0 : return;
300 : : }
301 : 0 : break;
302 : :
303 : : case SID_CLIPBOARD_FORMAT_ITEMS:
304 : : {
305 : 0 : const SfxItemSet* pArgs = rReq.GetArgs();
306 : : const SfxPoolItem* pFmt;
307 [ # # ][ # # ]: 0 : if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nId, sal_False, &pFmt ) )
[ # # ][ # # ]
308 : : {
309 : : TransferableDataHelper aDataHelper(
310 : : TransferableDataHelper::CreateFromSystemClipboard(
311 [ # # ]: 0 : &rSh.GetView().GetEditWin()) );
312 [ # # ][ # # ]: 0 : if( aDataHelper.GetXTransferable().is()
313 : : /*&& SwTransferable::IsPaste( rSh, aDataHelper )*/ )
314 : : {
315 : : // temp. Variablen, da die Shell nach dem Paste schon
316 : : // zerstoert sein kann
317 : 0 : SwView* pView = &rView;
318 : :
319 : : SwTransferable::PasteFormat( rSh, aDataHelper,
320 [ # # ]: 0 : ((SfxUInt32Item*)pFmt)->GetValue() );
321 : :
322 : : //Done() has to be called before the shell has been removed
323 [ # # ]: 0 : rReq.Done();
324 : 0 : bIgnore = sal_True;
325 [ # # ][ # # ]: 0 : if( rSh.IsFrmSelected() || rSh.IsObjSelected())
[ # # ][ # # ]
[ # # ]
326 [ # # ]: 0 : rSh.EnterSelFrmMode();
327 [ # # ]: 0 : pView->AttrChangedNotify( &rSh );
328 [ # # ]: 0 : }
329 : : }
330 : : }
331 : 0 : break;
332 : :
333 : : case SID_PASTE_UNFORMATTED:
334 : : {
335 : : TransferableDataHelper aDataHelper(
336 : : TransferableDataHelper::CreateFromSystemClipboard(
337 [ # # ]: 0 : &rSh.GetView().GetEditWin()) );
338 [ # # ][ # # ]: 0 : if( aDataHelper.GetXTransferable().is() &&
[ # # ][ # # ]
[ # # # # ]
339 [ # # ]: 0 : SwTransferable::IsPaste( rSh, aDataHelper ))
340 : : {
341 : : // temp. Variablen, da die Shell nach dem Paste schon
342 : : // zerstoert sein kann
343 : 0 : SwView* pView = &rView;
344 [ # # ]: 0 : rReq.Ignore();
345 : 0 : bIgnore = sal_True;
346 [ # # ]: 0 : int nRet = SwTransferable::PasteUnformatted( rSh, aDataHelper );
347 [ # # ]: 0 : if(nRet)
348 : : {
349 : 0 : SfxViewFrame* pViewFrame = pView->GetViewFrame();
350 : : uno::Reference< frame::XDispatchRecorder > xRecorder =
351 [ # # ]: 0 : pViewFrame->GetBindings().GetRecorder();
352 [ # # ]: 0 : if(xRecorder.is()) {
353 [ # # ]: 0 : SfxRequest aReq( pViewFrame, SID_CLIPBOARD_FORMAT_ITEMS );
354 [ # # ][ # # ]: 0 : aReq.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS, SOT_FORMAT_STRING ) );
[ # # ]
355 [ # # ][ # # ]: 0 : aReq.Done();
356 : 0 : }
357 : : }
358 : :
359 [ # # ][ # # ]: 0 : if (rSh.IsFrmSelected() || rSh.IsObjSelected())
[ # # ][ # # ]
[ # # ]
360 [ # # ]: 0 : rSh.EnterSelFrmMode();
361 [ # # ]: 0 : pView->AttrChangedNotify( &rSh );
362 : : }
363 : : else
364 [ # # ][ # # ]: 0 : return;
365 : : }
366 : 0 : break;
367 : :
368 : : case SID_PASTE_SPECIAL:
369 : : {
370 : : TransferableDataHelper aDataHelper(
371 : : TransferableDataHelper::CreateFromSystemClipboard(
372 [ # # ]: 0 : &rSh.GetView().GetEditWin()) );
373 [ # # ][ # # ]: 0 : if( aDataHelper.GetXTransferable().is() &&
[ # # ][ # # ]
[ # # # # ]
374 [ # # ]: 0 : SwTransferable::IsPaste( rSh, aDataHelper ))
375 : : {
376 : : // temp. Variablen, da die Shell nach dem Paste schon
377 : : // zerstoert sein kann
378 : 0 : SwView* pView = &rView;
379 : 0 : sal_uLong nFormatId = 0;
380 [ # # ]: 0 : rReq.Ignore();
381 : 0 : bIgnore = sal_True;
382 [ # # ]: 0 : int nRet = SwTransferable::PasteSpecial( rSh, aDataHelper, nFormatId );
383 [ # # ]: 0 : if(nRet)
384 : : {
385 : 0 : SfxViewFrame* pViewFrame = pView->GetViewFrame();
386 : : uno::Reference< frame::XDispatchRecorder > xRecorder =
387 [ # # ]: 0 : pViewFrame->GetBindings().GetRecorder();
388 [ # # ]: 0 : if(xRecorder.is()) {
389 [ # # ]: 0 : SfxRequest aReq( pViewFrame, SID_CLIPBOARD_FORMAT_ITEMS );
390 [ # # ][ # # ]: 0 : aReq.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS, nFormatId ) );
[ # # ]
391 [ # # ][ # # ]: 0 : aReq.Done();
392 : 0 : }
393 : : }
394 : :
395 [ # # ][ # # ]: 0 : if (rSh.IsFrmSelected() || rSh.IsObjSelected())
[ # # ][ # # ]
[ # # ]
396 [ # # ]: 0 : rSh.EnterSelFrmMode();
397 [ # # ]: 0 : pView->AttrChangedNotify( &rSh );
398 : : }
399 : : else
400 [ # # ][ # # ]: 0 : return;
401 : : }
402 : 0 : break;
403 : : default:
404 : : OSL_FAIL("wrong Dispatcher");
405 : 0 : return;
406 : : }
407 [ # # ]: 0 : if(!bIgnore)
408 : 0 : rReq.Done();
409 : : }
410 : :
411 : : /*--------------------------------------------------------------------
412 : : Beschreibung: ClipBoard-Status
413 : : --------------------------------------------------------------------*/
414 : 5096 : void SwBaseShell::StateClpbrd(SfxItemSet &rSet)
415 : : {
416 : 5096 : SwWrtShell &rSh = GetShell();
417 [ + - ]: 5096 : SfxWhichIter aIter(rSet);
418 : :
419 [ + - ]: 5096 : const sal_Bool bCopy = rSh.HasSelection();
420 : :
421 [ + - ]: 5096 : sal_uInt16 nWhich = aIter.FirstWhich();
422 : :
423 [ + + ]: 16324 : while(nWhich)
424 : : {
425 [ + + + + : 11228 : switch(nWhich)
+ - ]
426 : : {
427 : : case SID_CUT:
428 [ + - ][ - + ]: 2799 : if( 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) )
429 : : {
430 [ # # ]: 0 : rSet.DisableItem( nWhich );
431 : 0 : break;
432 : : }
433 : : case SID_COPY:
434 [ + + ]: 5606 : if( !bCopy )
435 [ + - ]: 5540 : rSet.DisableItem( nWhich );
436 : 5606 : break;
437 : :
438 : : case SID_PASTE:
439 [ + - ][ + - ]: 2817 : if( !GetView().IsPasteAllowed() )
440 [ + - ]: 2817 : rSet.DisableItem( SID_PASTE );
441 : 2817 : break;
442 : :
443 : : case SID_PASTE_SPECIAL:
444 [ + - ][ + - ]: 20 : if( !GetView().IsPasteSpecialAllowed() )
445 : : {
446 [ + - ]: 20 : rSet.DisableItem( SID_PASTE_SPECIAL );
447 [ + - ]: 20 : rSet.DisableItem( SID_PASTE_UNFORMATTED );
448 : : }
449 : 20 : break;
450 : :
451 : : case SID_CLIPBOARD_FORMAT_ITEMS:
452 : : {
453 : : TransferableDataHelper aDataHelper(
454 : : TransferableDataHelper::CreateFromSystemClipboard(
455 [ + - ]: 2785 : &rSh.GetView().GetEditWin()) );
456 : :
457 [ + - ]: 2785 : SvxClipboardFmtItem aFmtItem( nWhich );
458 [ + - ]: 2785 : SwTransferable::FillClipFmtItem( rSh, aDataHelper, aFmtItem );
459 [ + - ][ + - ]: 2785 : rSet.Put( aFmtItem );
[ + - ]
460 : : }
461 : 2785 : break;
462 : : }
463 [ + - ]: 11228 : nWhich = aIter.NextWhich();
464 [ + - ]: 5096 : }
465 : 5096 : }
466 : :
467 : : /*--------------------------------------------------------------------
468 : : Beschreibung: Undo ausfuehren
469 : : --------------------------------------------------------------------*/
470 : 8 : void SwBaseShell::ExecUndo(SfxRequest &rReq)
471 : : {
472 : 8 : SwWrtShell &rSh = GetShell();
473 : :
474 : 8 : sal_uInt16 nId = rReq.GetSlot(), nCnt = 1;
475 : 8 : const SfxItemSet* pArgs = rReq.GetArgs();
476 : : const SfxPoolItem* pItem;
477 [ # # ][ # # ]: 8 : if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nId, sal_False, &pItem ))
[ - + ][ - + ]
478 : 0 : nCnt = ((SfxUInt16Item*)pItem)->GetValue();
479 : :
480 : : // #i106349#: save pointer: undo/redo may delete the shell, i.e., this!
481 : 8 : SfxViewFrame *const pViewFrame( GetView().GetViewFrame() );
482 : :
483 [ + + - - ]: 8 : switch( nId )
484 : : {
485 : : case SID_UNDO:
486 [ + - ]: 6 : rSh.LockPaint();
487 [ + - ]: 6 : rSh.Do( SwWrtShell::UNDO, nCnt );
488 [ + - ]: 6 : rSh.UnlockPaint();
489 : 6 : break;
490 : :
491 : : case SID_REDO:
492 [ + - ]: 2 : rSh.LockPaint();
493 [ + - ]: 2 : rSh.Do( SwWrtShell::REDO, nCnt );
494 [ + - ]: 2 : rSh.UnlockPaint();
495 : 2 : break;
496 : :
497 : : case SID_REPEAT:
498 [ # # ]: 0 : rSh.Do( SwWrtShell::REPEAT );
499 : 0 : break;
500 : : default:
501 : : OSL_FAIL("wrong Dispatcher");
502 : : }
503 : :
504 [ + - ][ + - ]: 8 : if (pViewFrame) { pViewFrame->GetBindings().InvalidateAll(sal_False); }
505 : 8 : }
506 : :
507 : : /*--------------------------------------------------------------------
508 : : Beschreibung: Zustand Undo
509 : : --------------------------------------------------------------------*/
510 : 2131 : void SwBaseShell::StateUndo(SfxItemSet &rSet)
511 : : {
512 : 2131 : SwWrtShell &rSh = GetShell();
513 [ + - ]: 2131 : SfxWhichIter aIter(rSet);
514 [ + - ]: 2131 : sal_uInt16 nWhich = aIter.FirstWhich();
515 [ + + ]: 4859 : while(nWhich)
516 : : {
517 [ + + + - : 2728 : switch(nWhich)
- - ]
518 : : {
519 : : case SID_UNDO:
520 : : {
521 [ + - ][ + + ]: 1359 : if (rSh.GetLastUndoInfo(0, 0))
522 : : {
523 : : rSet.Put( SfxStringItem(nWhich,
524 [ + - ][ + - ]: 740 : rSh.GetDoString(SwWrtShell::UNDO)));
[ + - ][ + - ]
[ + - ]
525 : : }
526 : : else
527 [ + - ]: 619 : rSet.DisableItem(nWhich);
528 : 1359 : break;
529 : : }
530 : : case SID_REDO:
531 : : {
532 [ + - ][ + + ]: 1355 : if (rSh.GetFirstRedoInfo(0))
533 : : {
534 : : rSet.Put(SfxStringItem(nWhich,
535 [ + - ][ + - ]: 2 : rSh.GetDoString(SwWrtShell::REDO)));
[ + - ][ + - ]
[ + - ]
536 : : }
537 : : else
538 [ + - ]: 1353 : rSet.DisableItem(nWhich);
539 : 1355 : break;
540 : : }
541 : : case SID_REPEAT:
542 : : { // Repeat nur moeglich wenn kein REDO moeglich - UI-Restriktion
543 [ + - ]: 42 : if ((!rSh.GetFirstRedoInfo(0)) &&
[ + - + - ]
[ - + ][ - + ]
544 : 14 : !rSh.IsSelFrmMode() &&
545 [ + - ]: 14 : (UNDO_EMPTY != rSh.GetRepeatInfo(0)))
546 : : {
547 [ # # ][ # # ]: 0 : rSet.Put(SfxStringItem(nWhich, rSh.GetRepeatString()));
[ # # ][ # # ]
[ # # ]
548 : : }
549 : : else
550 [ + - ]: 14 : rSet.DisableItem(nWhich);
551 : 14 : break;
552 : : }
553 : :
554 : : case SID_GETUNDOSTRINGS:
555 [ # # ][ # # ]: 0 : if (rSh.GetLastUndoInfo(0, 0))
556 : : {
557 [ # # ]: 0 : SfxStringListItem aStrLst( nWhich );
558 [ # # ]: 0 : rSh.GetDoStrings( SwWrtShell::UNDO, aStrLst );
559 [ # # ][ # # ]: 0 : rSet.Put( aStrLst );
560 : : }
561 : : else
562 [ # # ]: 0 : rSet.DisableItem( nWhich );
563 : 0 : break;
564 : :
565 : : case SID_GETREDOSTRINGS:
566 [ # # ][ # # ]: 0 : if (rSh.GetFirstRedoInfo(0))
567 : : {
568 [ # # ]: 0 : SfxStringListItem aStrLst( nWhich );
569 [ # # ]: 0 : rSh.GetDoStrings( SwWrtShell::REDO, aStrLst );
570 [ # # ][ # # ]: 0 : rSet.Put( aStrLst );
571 : : }
572 : : else
573 [ # # ]: 0 : rSet.DisableItem( nWhich );
574 : 0 : break;
575 : : }
576 [ + - ]: 2728 : nWhich = aIter.NextWhich();
577 [ + - ]: 2131 : }
578 : 2131 : }
579 : :
580 : : /*--------------------------------------------------------------------
581 : : Beschreibung: Slot-Id auswerten bzw. Dispatchen
582 : : --------------------------------------------------------------------*/
583 : 0 : void SwBaseShell::Execute(SfxRequest &rReq)
584 : : {
585 : : const SfxPoolItem *pItem;
586 : 0 : SwWrtShell &rSh = GetShell();
587 : 0 : const SfxItemSet* pArgs = rReq.GetArgs();
588 : 0 : sal_Bool bMore = sal_False;
589 : :
590 : 0 : sal_uInt16 nSlot = rReq.GetSlot();
591 [ # # # # : 0 : switch(nSlot)
# # # # #
# # # # #
# # # # #
# # # # #
# # ]
592 : : {
593 : : case FN_REPAGINATE:
594 : : {
595 [ # # ][ # # ]: 0 : Reference < XModel > xModel = GetView().GetDocShell()->GetModel();
596 [ # # ]: 0 : Reference < XUnoTunnel > xDocTunnel ( xModel, UNO_QUERY );
597 [ # # ][ # # ]: 0 : SwXTextDocument *pDoc = reinterpret_cast < SwXTextDocument * > ( xDocTunnel->getSomething ( SwXTextDocument::getUnoTunnelId() ) );
[ # # ]
598 [ # # ]: 0 : pDoc->notifyRefreshListeners();
599 [ # # ]: 0 : rSh.CalcLayout();
600 : : }
601 : 0 : break;
602 : : case FN_UPDATE_FIELDS:
603 : : {
604 [ # # ]: 0 : rSh.UpdateDocStat();
605 [ # # ]: 0 : rSh.EndAllTblBoxEdit();
606 [ # # ]: 0 : rSh.ViewShell::UpdateFlds(sal_True);
607 : :
608 [ # # ][ # # ]: 0 : if( rSh.IsCrsrInTbl() )
609 : : {
610 [ # # ][ # # ]: 0 : if( !rSh.IsTblComplexForChart() )
611 [ # # ][ # # ]: 0 : SwTableFUNC( &rSh, sal_False).UpdateChart();
[ # # ]
612 [ # # ]: 0 : rSh.ClearTblBoxCntnt();
613 [ # # ]: 0 : rSh.SaveTblBoxCntnt();
614 : : }
615 : : }
616 : 0 : break;
617 : : case FN_UPDATE_CHARTS:
618 : : {
619 [ # # ][ # # ]: 0 : SwWait aWait( *rView.GetDocShell(), sal_True );
620 [ # # ][ # # ]: 0 : rSh.UpdateAllCharts();
621 : : }
622 : 0 : break;
623 : :
624 : : case FN_UPDATE_ALL:
625 : : {
626 : 0 : SwView& rTempView = GetView();
627 [ # # ]: 0 : rSh.EnterStdMode();
628 [ # # ][ # # ]: 0 : if( !rSh.GetLinkManager().GetLinks().empty() )
629 : : {
630 [ # # ]: 0 : rSh.StartAllAction();
631 [ # # ][ # # ]: 0 : rSh.GetLinkManager().UpdateAllLinks( sal_False, sal_True, sal_True );
632 [ # # ]: 0 : rSh.EndAllAction();
633 : : }
634 : 0 : SfxDispatcher &rDis = *rTempView.GetViewFrame()->GetDispatcher();
635 [ # # ]: 0 : rDis.Execute( FN_UPDATE_FIELDS );
636 [ # # ]: 0 : rDis.Execute( FN_UPDATE_TOX );
637 [ # # ]: 0 : rDis.Execute( FN_UPDATE_CHARTS );
638 [ # # ]: 0 : rSh.CalcLayout();
639 : : }
640 : 0 : break;
641 : :
642 : : case FN_UPDATE_INPUTFIELDS:
643 [ # # ]: 0 : rSh.UpdateInputFlds(NULL, sal_False);
644 : 0 : break;
645 : : case FN_PREV_BOOKMARK:
646 [ # # ][ # # ]: 0 : rReq.SetReturnValue(SfxBoolItem( nSlot, rSh.GoPrevBookmark()));
[ # # ][ # # ]
647 : 0 : break;
648 : : case FN_NEXT_BOOKMARK:
649 [ # # ][ # # ]: 0 : rReq.SetReturnValue(SfxBoolItem( nSlot, rSh.GoNextBookmark()));
[ # # ][ # # ]
650 : 0 : break;
651 : :
652 : : case FN_GOTO_NEXT_MARK:
653 : : case FN_GOTO_PREV_MARK:
654 : : {
655 [ # # ]: 0 : SwFldMgr aFldMgr;
656 [ # # ]: 0 : SwFieldType* pFldType = aFldMgr.GetFldType(RES_JUMPEDITFLD);
657 : :
658 [ # # ]: 0 : if (pFldType)
659 : : {
660 [ # # ]: 0 : if (rSh.IsSelFrmMode())
661 : : {
662 [ # # ]: 0 : rSh.UnSelectFrm();
663 [ # # ]: 0 : rSh.LeaveSelFrmMode();
664 : : }
665 : :
666 [ # # ]: 0 : if (rSh.HasMark())
667 : : {
668 [ # # ]: 0 : MV_KONTEXT(&rSh);
669 [ # # ][ # # ]: 0 : if (rSh.IsCrsrPtAtEnd())
670 [ # # ]: 0 : rSh.SwapPam();
671 [ # # ]: 0 : rSh.ClearMark();
672 [ # # ][ # # ]: 0 : rSh.EndSelect();
673 : : }
674 [ # # ]: 0 : sal_Bool bRet = rSh.MoveFldType(pFldType, nSlot == FN_GOTO_NEXT_MARK);
675 [ # # ][ # # ]: 0 : SwField* pCurField = bRet ? rSh.GetCurFld() : 0;
676 [ # # ]: 0 : if (pCurField)
677 [ # # ]: 0 : rSh.ClickToField(*pCurField);
678 [ # # ][ # # ]: 0 : rReq.SetReturnValue(SfxBoolItem( nSlot, bRet));
[ # # ]
679 [ # # ]: 0 : }
680 : : }
681 : 0 : break;
682 : :
683 : : case FN_START_DOC_DIRECT:
684 : : case FN_END_DOC_DIRECT:
685 : : {
686 [ # # ]: 0 : if (rSh.IsSelFrmMode())
687 : : {
688 [ # # ]: 0 : rSh.UnSelectFrm();
689 [ # # ]: 0 : rSh.LeaveSelFrmMode();
690 : : }
691 [ # # ]: 0 : rSh.EnterStdMode();
692 : : nSlot == FN_START_DOC_DIRECT ?
693 : 0 : rSh.SttEndDoc(sal_True) :
694 [ # # ][ # # ]: 0 : rSh.SttEndDoc(sal_False);
[ # # ]
695 : : }
696 : 0 : break;
697 : : case FN_GOTO_PREV_OBJ:
698 : : case FN_GOTO_NEXT_OBJ:
699 : : {
700 : : sal_Bool bSuccess = rSh.GotoObj(
701 [ # # ][ # # ]: 0 : nSlot == FN_GOTO_NEXT_OBJ ? sal_True : sal_False);
702 [ # # ][ # # ]: 0 : rReq.SetReturnValue(SfxBoolItem(nSlot, bSuccess));
[ # # ]
703 [ # # ][ # # ]: 0 : if (bSuccess && !rSh.IsSelFrmMode())
[ # # ]
704 : : {
705 [ # # ]: 0 : rSh.HideCrsr();
706 [ # # ]: 0 : rSh.EnterSelFrmMode();
707 [ # # ]: 0 : GetView().AttrChangedNotify( &rSh );
708 : : }
709 : : }
710 : 0 : break;
711 : : case SID_GALLERY_FORMATS:
712 : : {
713 [ # # ]: 0 : const int nSelType = rSh.GetSelectionType();
714 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == pArgs->GetItemState( nSlot, sal_True, &pItem))
715 : : {
716 : 0 : GalleryExplorer* pGal = 0;
717 [ # # ][ # # ]: 0 : if ( (!rSh.IsSelFrmMode() || nSelType & nsSelectionType::SEL_GRF) &&
[ # # ]
[ # # # # ]
[ # # ]
718 : : 0!= (pGal = SVX_GALLERY())&&
719 : 0 : 0 != (SGA_FORMAT_GRAPHIC & ((SfxUInt32Item*)pItem)->GetValue()))
720 : : {
721 [ # # ][ # # ]: 0 : SwWait aWait( *rView.GetDocShell(), sal_True );
722 : :
723 [ # # ][ # # ]: 0 : String aGrfName, aFltName;
724 [ # # ]: 0 : const Graphic aGrf( pGal->GetGraphic() );
725 : :
726 [ # # ][ # # ]: 0 : if( pGal->IsLinkage() )
727 : : {
728 : : // Verknuepft
729 [ # # ][ # # ]: 0 : aGrfName = pGal->GetURL().GetMainURL(INetURLObject::NO_DECODE);
[ # # ][ # # ]
730 [ # # ][ # # ]: 0 : aFltName = pGal->GetFilterName();
[ # # ]
731 : : }
732 : :
733 [ # # ]: 0 : if ( nSelType & nsSelectionType::SEL_GRF )
734 [ # # ]: 0 : rSh.ReRead( aGrfName, aFltName, &aGrf );
735 : : else
736 [ # # ]: 0 : rSh.Insert( aGrfName, aFltName, aGrf );
737 : :
738 [ # # ][ # # ]: 0 : GetView().GetEditWin().GrabFocus();
[ # # ][ # # ]
[ # # ]
739 : : }
740 [ # # ][ # # ]: 0 : else if(!rSh.IsSelFrmMode() && SGA_FORMAT_SOUND & ((SfxUInt32Item*)pItem)->GetValue())
[ # # ]
741 : : {
742 [ # # ][ # # ]: 0 : const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, pGal->GetURL().GetMainURL( INetURLObject::NO_DECODE ) );
[ # # ][ # # ]
[ # # ][ # # ]
743 [ # # ][ # # ]: 0 : GetView().GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_AVMEDIA, SFX_CALLMODE_SYNCHRON, &aMediaURLItem, 0L );
744 : : }
745 : : }
746 : : }
747 : 0 : break;
748 : : case FN_PAGE_STYLE_SET_COLS:
749 : : {
750 [ # # ]: 0 : if (pArgs)
751 : : {
752 : : // aktuellen PageDescriptor ermitteln und damit den Set fuellen
753 [ # # ]: 0 : const sal_uInt16 nCurIdx = rSh.GetCurPageDesc();
754 [ # # ][ # # ]: 0 : SwPageDesc aPageDesc(rSh.GetPageDesc(nCurIdx));
755 : :
756 : 0 : SwFrmFmt &rFmt = aPageDesc.GetMaster();
757 : :
758 [ # # ][ # # ]: 0 : SwFmtCol aFmtCol = rFmt.GetCol();
759 : :
760 : : sal_uInt16 nCount;
761 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == pArgs->GetItemState(nSlot))
762 [ # # ]: 0 : nCount = ((SfxUInt16Item &)pArgs->Get(nSlot)).GetValue();
763 : : else
764 [ # # ]: 0 : nCount = ((SfxUInt16Item &)pArgs->Get(SID_ATTR_COLUMNS)).GetValue();
765 : 0 : sal_uInt16 nGutterWidth = DEF_GUTTER_WIDTH;
766 : :
767 [ # # ][ # # ]: 0 : aFmtCol.Init(nCount ? nCount : 1, nGutterWidth, USHRT_MAX);
768 : 0 : aFmtCol.SetWishWidth(USHRT_MAX);
769 [ # # ]: 0 : aFmtCol.SetGutterWidth(nGutterWidth, USHRT_MAX);
770 : :
771 [ # # ]: 0 : rFmt.SetFmtAttr(aFmtCol);
772 : :
773 [ # # ][ # # ]: 0 : rSh.ChgPageDesc(nCurIdx, aPageDesc);
[ # # ]
774 : : }
775 : : else
776 [ # # ]: 0 : GetView().GetViewFrame()->GetDispatcher()->Execute(FN_FORMAT_PAGE_COLUMN_DLG, sal_False);
777 : : }
778 : 0 : break;
779 : : case FN_CONVERT_TABLE_TO_TEXT:
780 : : case FN_CONVERT_TEXT_TO_TABLE:
781 : : case FN_CONVERT_TEXT_TABLE:
782 : : {
783 : 0 : sal_Unicode cDelim = 0;
784 : 0 : bool bToTable = false;
785 [ # # ][ # # ]: 0 : if( nSlot == FN_CONVERT_TEXT_TO_TABLE ||
[ # # ][ # # ]
786 [ # # ]: 0 : ( nSlot == FN_CONVERT_TEXT_TABLE && 0 == rSh.GetTableFmt() ))
787 : 0 : bToTable = true;
788 : 0 : SwInsertTableOptions aInsTblOpts( tabopts::ALL_TBL_INS_ATTR, 1 );
789 : 0 : SwTableAutoFmt const* pTAFmt = 0;
790 : 0 : SwTableAutoFmtTbl* pAutoFmtTbl = 0;
791 : 0 : bool bDeleteFormat = true;
792 [ # # ][ # # ]: 0 : if(pArgs && SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_1, sal_True, &pItem))
[ # # ][ # # ]
793 : : {
794 : 0 : aInsTblOpts.mnInsMode = 0;
795 : : //Delimiter
796 [ # # ]: 0 : String sDelim = static_cast< const SfxStringItem* >(pItem)->GetValue();
797 [ # # ]: 0 : if(sDelim.Len())
798 : 0 : cDelim = sDelim.GetChar(0);
799 : : //AutoFormat
800 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_2, sal_True, &pItem))
801 : : {
802 [ # # ]: 0 : String sAutoFmt = static_cast< const SfxStringItem* >(pItem)->GetValue();
803 : :
804 [ # # ][ # # ]: 0 : pAutoFmtTbl = new SwTableAutoFmtTbl;
805 [ # # ]: 0 : pAutoFmtTbl->Load();
806 : :
807 [ # # ][ # # ]: 0 : for( sal_uInt16 i = 0, nCount = pAutoFmtTbl->size(); i < nCount; i++ )
808 : : {
809 [ # # ]: 0 : SwTableAutoFmt const*const pFmt = &(*pAutoFmtTbl)[ i ];
810 [ # # ][ # # ]: 0 : if( pFmt->GetName() == sAutoFmt )
811 : : {
812 : 0 : pTAFmt = pFmt;
813 : 0 : bDeleteFormat = false;
814 : 0 : break;
815 : : }
816 [ # # ]: 0 : }
817 : : }
818 : : //WithHeader
819 [ # # ]: 0 : if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_3, sal_True, &pItem) &&
[ # # # # ]
[ # # ]
820 : 0 : static_cast< const SfxBoolItem* >(pItem)->GetValue())
821 : 0 : aInsTblOpts.mnInsMode |= tabopts::HEADLINE;
822 : : // RepeatHeaderLines
823 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_4, sal_True, &pItem))
824 : : aInsTblOpts.mnRowsToRepeat =
825 : 0 : (sal_uInt16)static_cast< const SfxInt16Item* >(pItem)->GetValue();
826 : : //WithBorder
827 [ # # ]: 0 : if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_5, sal_True, &pItem) &&
[ # # # # ]
[ # # ]
828 : 0 : static_cast< const SfxBoolItem* >(pItem)->GetValue())
829 : 0 : aInsTblOpts.mnInsMode |= tabopts::DEFAULT_BORDER;
830 : : //DontSplitTable
831 [ # # ]: 0 : if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_6, sal_True, &pItem) &&
[ # # # # ]
[ # # ]
832 : 0 : !static_cast< const SfxBoolItem* >(pItem)->GetValue() )
833 [ # # ]: 0 : aInsTblOpts.mnInsMode |= tabopts::SPLIT_LAYOUT;
834 : : }
835 : : else
836 : : {
837 [ # # ]: 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
838 : : OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
839 : :
840 : : AbstractSwConvertTableDlg* pDlg = pFact->CreateSwConvertTableDlg(
841 [ # # ]: 0 : GetView(),DLG_CONV_TEXT_TABLE , bToTable);
842 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
843 [ # # ][ # # ]: 0 : if( RET_OK == pDlg->Execute() )
844 : : {
845 [ # # ]: 0 : pDlg->GetValues( cDelim, aInsTblOpts, pTAFmt );
846 : :
847 : : }
848 [ # # ][ # # ]: 0 : delete pDlg;
849 : : }
850 : :
851 [ # # ]: 0 : if( cDelim )
852 : : {
853 : : //Shellwechsel!
854 : 0 : SwView& rSaveView = rView;
855 : 0 : sal_Bool bInserted = sal_False;
856 : : //recording:
857 : :
858 : 0 : SfxViewFrame* pViewFrame = GetView().GetViewFrame();
859 [ # # ][ # # ]: 0 : if( SfxRequest::HasMacroRecorder(pViewFrame) )
860 : : {
861 [ # # ]: 0 : SfxRequest aReq( pViewFrame, nSlot);
862 [ # # ][ # # ]: 0 : aReq.AppendItem( SfxStringItem( FN_PARAM_1, rtl::OUString(cDelim) ));
[ # # ][ # # ]
[ # # ]
863 [ # # ]: 0 : if(bToTable)
864 : : {
865 [ # # ]: 0 : if(pTAFmt)
866 [ # # ][ # # ]: 0 : aReq.AppendItem( SfxStringItem( FN_PARAM_2, pTAFmt->GetName()));
[ # # ]
867 [ # # ][ # # ]: 0 : aReq.AppendItem( SfxBoolItem ( FN_PARAM_3, 0 != (aInsTblOpts.mnInsMode & tabopts::HEADLINE)));
[ # # ]
868 [ # # ][ # # ]: 0 : aReq.AppendItem( SfxInt16Item( FN_PARAM_4, (short)aInsTblOpts.mnRowsToRepeat ));
[ # # ]
869 [ # # ][ # # ]: 0 : aReq.AppendItem( SfxBoolItem ( FN_PARAM_5, 0 != (aInsTblOpts.mnInsMode & tabopts::DEFAULT_BORDER) ));
[ # # ]
870 [ # # ][ # # ]: 0 : aReq.AppendItem( SfxBoolItem ( FN_PARAM_6, !(aInsTblOpts.mnInsMode & tabopts::SPLIT_LAYOUT)));
[ # # ]
871 : : }
872 [ # # ][ # # ]: 0 : aReq.Done();
873 : : }
874 : :
875 [ # # ]: 0 : if( !bToTable )
876 [ # # ]: 0 : rSh.TableToText( cDelim );
877 : : else
878 : : {
879 [ # # ]: 0 : bInserted = rSh.TextToTable( aInsTblOpts, cDelim, text::HoriOrientation::FULL, pTAFmt );
880 : : }
881 [ # # ]: 0 : rSh.EnterStdMode();
882 : :
883 [ # # ]: 0 : if( bInserted )
884 [ # # ]: 0 : rSaveView.AutoCaption( TABLE_CAP );
885 : : }
886 [ # # ]: 0 : if(bDeleteFormat)
887 [ # # ][ # # ]: 0 : delete pTAFmt;
888 [ # # ][ # # ]: 0 : delete pAutoFmtTbl;
889 : : }
890 : 0 : break;
891 : : case SID_STYLE_WATERCAN:
892 : : case SID_STYLE_UPDATE_BY_EXAMPLE:
893 : : case SID_STYLE_NEW_BY_EXAMPLE:
894 : : case SID_STYLE_APPLY:
895 : : {
896 [ # # ]: 0 : ShellModes eMode = GetView().GetShellMode();
897 [ # # ][ # # ]: 0 : if ( SHELL_MODE_DRAW != eMode &&
[ # # ][ # # ]
[ # # ]
898 : : SHELL_MODE_DRAW_CTRL != eMode &&
899 : : SHELL_MODE_DRAW_FORM != eMode &&
900 : : SHELL_MODE_DRAWTEXT != eMode &&
901 : : SHELL_MODE_BEZIER != eMode )
902 : : {
903 : : // oj #107754#
904 [ # # ]: 0 : if ( SID_STYLE_WATERCAN == nSlot )
905 : : {
906 : 0 : const sal_Bool bLockedView = rSh.IsViewLocked();
907 : 0 : rSh.LockView( sal_True ); //lock visible section
908 : :
909 [ # # ][ # # ]: 0 : GetView().GetDocShell()->ExecStyleSheet(rReq);
910 : :
911 : 0 : rSh.LockView( bLockedView );
912 : : }
913 : : else
914 : : // wird von der DocShell aufgezeichnet
915 [ # # ][ # # ]: 0 : GetView().GetDocShell()->ExecStyleSheet(rReq);
916 : : }
917 : : }
918 : 0 : break;
919 : : case FN_ESCAPE:
920 [ # # ]: 0 : GetView().ExecuteSlot(rReq);
921 : 0 : break;
922 : : case SID_IMAP:
923 : : {
924 [ # # ]: 0 : sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
925 : :
926 : 0 : SfxViewFrame* pVFrame = GetView().GetViewFrame();
927 [ # # ]: 0 : pVFrame->ToggleChildWindow( nId );
928 [ # # ]: 0 : pVFrame->GetBindings().Invalidate( SID_IMAP );
929 : :
930 [ # # ][ # # ]: 0 : if ( pVFrame->HasChildWindow( nId ) && rSh.IsFrmSelected() )
[ # # ][ # # ]
[ # # ]
931 [ # # ]: 0 : lcl_UpdateIMapDlg( rSh );
932 : : }
933 : 0 : break;
934 : : case SID_IMAP_EXEC:
935 : : {
936 [ # # ][ # # ]: 0 : SvxIMapDlg* pDlg = SWIMAPDLG(GetView());
937 : :
938 : : // Kontrolle, ob Zuweisung ueberhaupt sinnvoll/erlaubt
939 [ # # ][ # # ]: 0 : if ( rSh.IsFrmSelected() &&
[ # # ][ # # ]
940 [ # # ]: 0 : pDlg->GetEditingObject() == rSh.GetIMapInventor() )
941 : : {
942 [ # # ][ # # ]: 0 : SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
943 [ # # ]: 0 : rSh.GetFlyFrmAttr( aSet );
944 [ # # ][ # # ]: 0 : SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) );
945 [ # # ][ # # ]: 0 : aURL.SetMap( &pDlg->GetImageMap() );
946 [ # # ]: 0 : aSet.Put( aURL );
947 [ # # ][ # # ]: 0 : rSh.SetFlyFrmAttr( aSet );
[ # # ]
948 : : }
949 : : }
950 : 0 : break;
951 : : case SID_CONTOUR_DLG:
952 : : {
953 [ # # ]: 0 : sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
954 : :
955 : 0 : SfxViewFrame* pVFrame = GetView().GetViewFrame();
956 [ # # ]: 0 : pVFrame->ToggleChildWindow( nId );
957 [ # # ]: 0 : pVFrame->GetBindings().Invalidate( SID_CONTOUR_DLG );
958 : :
959 [ # # ]: 0 : int nSel = rSh.GetSelectionType();
960 [ # # ][ # # ]: 0 : if ( pVFrame->HasChildWindow( nId ) &&
[ # # ][ # # ]
961 : : (nSel & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_OLE)) )
962 : : {
963 [ # # ]: 0 : lcl_UpdateContourDlg( rSh, nSel );
964 : : }
965 : : }
966 : 0 : break;
967 : : case SID_CONTOUR_EXEC:
968 : : {
969 [ # # ][ # # ]: 0 : SvxContourDlg *pDlg = SWCONTOURDLG(GetView());
970 : :
971 : : // Kontrolle, ob Zuweisung ueberhaupt sinnvoll/erlaubt
972 [ # # ]: 0 : int nSel = rSh.GetSelectionType();
973 [ # # ]: 0 : if ( nSel & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_OLE) )
974 : : {
975 [ # # ][ # # ]: 0 : if ( pDlg->GetEditingObject() == rSh.GetIMapInventor() )
[ # # ]
976 : : {
977 [ # # ]: 0 : rSh.StartAction();
978 [ # # ][ # # ]: 0 : SfxItemSet aSet( rSh.GetAttrPool(), RES_SURROUND, RES_SURROUND);
979 [ # # ]: 0 : rSh.GetFlyFrmAttr( aSet );
980 [ # # ][ # # ]: 0 : SwFmtSurround aSur( (SwFmtSurround&)aSet.Get( RES_SURROUND ) );
981 [ # # ]: 0 : if ( !aSur.IsContour() )
982 : : {
983 : 0 : aSur.SetContour( sal_True );
984 [ # # ]: 0 : if ( aSur.GetSurround() == SURROUND_NONE )
985 : 0 : aSur.SetSurround( SURROUND_PARALLEL );
986 [ # # ]: 0 : aSet.Put( aSur );
987 [ # # ]: 0 : rSh.SetFlyFrmAttr( aSet );
988 : : }
989 [ # # ]: 0 : const PolyPolygon aPoly( pDlg->GetPolyPolygon() );
990 [ # # ]: 0 : rSh.SetGraphicPolygon( &aPoly );
991 [ # # ][ # # ]: 0 : if ( pDlg->IsGraphicChanged() )
992 [ # # ][ # # ]: 0 : rSh.ReRead( aEmptyStr, aEmptyStr, &pDlg->GetGraphic());
993 [ # # ][ # # ]: 0 : rSh.EndAction();
[ # # ][ # # ]
994 : : }
995 : : }
996 : : }
997 : 0 : break;
998 : : case FN_FRAME_TO_ANCHOR:
999 : : {
1000 [ # # ]: 0 : rSh.GotoFlyAnchor();
1001 [ # # ]: 0 : rSh.EnterStdMode();
1002 [ # # ]: 0 : rSh.CallChgLnk();
1003 : : }
1004 : 0 : break;
1005 : : case FN_TOOL_ANCHOR:
1006 : 0 : break;
1007 : : case FN_TOOL_ANCHOR_PAGE:
1008 : : case FN_TOOL_ANCHOR_PARAGRAPH:
1009 : : case FN_TOOL_ANCHOR_CHAR:
1010 : : case FN_TOOL_ANCHOR_AT_CHAR:
1011 : : case FN_TOOL_ANCHOR_FRAME:
1012 : : {
1013 : : RndStdIds eSet = nSlot == FN_TOOL_ANCHOR_PAGE
1014 : : ? FLY_AT_PAGE
1015 : : : nSlot == FN_TOOL_ANCHOR_PARAGRAPH
1016 : : ? FLY_AT_PARA
1017 : : : nSlot == FN_TOOL_ANCHOR_FRAME
1018 : : ? FLY_AT_FLY
1019 : : : nSlot == FN_TOOL_ANCHOR_CHAR
1020 : : ? FLY_AS_CHAR
1021 [ # # ][ # # ]: 0 : : FLY_AT_CHAR;
[ # # ][ # # ]
1022 [ # # ]: 0 : rSh.StartUndo();
1023 [ # # ][ # # ]: 0 : if( rSh.IsObjSelected() )
1024 [ # # ]: 0 : rSh.ChgAnchor( eSet );
1025 [ # # ][ # # ]: 0 : else if( rSh.IsFrmSelected() )
1026 : : {
1027 : : // Der Set beinhaltet auch VERT/HORI_ORIENT, da in FEShell::
1028 : : // SetFlyFrmAttr/SetFlyFrmAnchor ggf. als Folge des Umankerns
1029 : : // die Ausrichtungen veraendert werden sollen.
1030 [ # # ]: 0 : SfxItemSet aSet( GetPool(), RES_VERT_ORIENT, RES_ANCHOR );
1031 [ # # ][ # # ]: 0 : SwFmtAnchor aAnc( eSet, rSh.GetPhyPageNum() );
1032 [ # # ]: 0 : aSet.Put( aAnc );
1033 [ # # ][ # # ]: 0 : rSh.SetFlyFrmAttr(aSet);
[ # # ]
1034 : : }
1035 : :
1036 : : // if new anchor is 'as char' and it is a Math object and the usual
1037 : : // pre-conditions are met then align the formula to the baseline of the text
1038 [ # # ]: 0 : const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() );
1039 [ # # ][ # # ]: 0 : const bool bDoMathBaselineAlignment = xObj.is() && SotExchange::IsMath( xObj->getClassID() )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # # ]
1040 [ # # ][ # # ]: 0 : && FLY_AS_CHAR == eSet && rSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT );
[ # # ][ # # ]
[ # # ]
1041 [ # # ]: 0 : if (bDoMathBaselineAlignment)
1042 [ # # ]: 0 : rSh.AlignFormulaToBaseline( xObj );
1043 : :
1044 [ # # ][ # # ]: 0 : sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
1045 [ # # ]: 0 : if( nHtmlMode )
1046 : : {
1047 [ # # ]: 0 : SfxItemSet aSet(GetPool(), RES_SURROUND, RES_HORI_ORIENT);
1048 [ # # ]: 0 : rSh.GetFlyFrmAttr(aSet);
1049 : :
1050 [ # # ]: 0 : const SwFmtSurround& rSurround = (const SwFmtSurround&)aSet.Get(RES_SURROUND);
1051 [ # # ]: 0 : const SwFmtVertOrient& rVert = (const SwFmtVertOrient&)aSet.Get(RES_VERT_ORIENT);
1052 [ # # ]: 0 : const SwFmtHoriOrient& rHori = (const SwFmtHoriOrient&)aSet.Get(RES_HORI_ORIENT);
1053 : 0 : sal_Int16 eVOrient = rVert.GetVertOrient();
1054 : 0 : sal_Int16 eHOrient = rHori.GetHoriOrient();
1055 : 0 : SwSurround eSurround = rSurround.GetSurround();
1056 : :
1057 [ # # # # ]: 0 : switch( eSet )
1058 : : {
1059 : : case FLY_AT_FLY:
1060 : : case FLY_AT_PAGE:
1061 : :
1062 : : //Durchlauf, links oder von links, oben, von oben
1063 [ # # ]: 0 : if(eSurround != SURROUND_THROUGHT)
1064 [ # # ][ # # ]: 0 : aSet.Put(SwFmtSurround(SURROUND_THROUGHT));
[ # # ]
1065 : :
1066 [ # # ][ # # ]: 0 : if( eVOrient != text::VertOrientation::TOP && eVOrient != text::VertOrientation::NONE)
1067 [ # # ][ # # ]: 0 : aSet.Put(SwFmtVertOrient(0, text::VertOrientation::TOP));
[ # # ]
1068 : :
1069 [ # # ][ # # ]: 0 : if(eHOrient != text::HoriOrientation::NONE || eHOrient != text::HoriOrientation::LEFT)
1070 [ # # ][ # # ]: 0 : aSet.Put(SwFmtHoriOrient(0, text::HoriOrientation::LEFT));
[ # # ]
1071 : 0 : break;
1072 : :
1073 : : case FLY_AT_PARA:
1074 : : //links, von links, rechts, oben, kein Uml, li+re Umlauf,
1075 [ # # ][ # # ]: 0 : if(eSurround != SURROUND_LEFT || eSurround != SURROUND_RIGHT)
1076 [ # # ][ # # ]: 0 : aSet.Put(SwFmtSurround(SURROUND_LEFT));
[ # # ]
1077 : :
1078 [ # # ]: 0 : if( eVOrient != text::VertOrientation::TOP)
1079 [ # # ][ # # ]: 0 : aSet.Put(SwFmtVertOrient(0, text::VertOrientation::TOP));
[ # # ]
1080 : :
1081 [ # # ][ # # ]: 0 : if(eHOrient != text::HoriOrientation::NONE || eHOrient != text::HoriOrientation::LEFT || eHOrient != text::HoriOrientation::RIGHT)
[ # # ]
1082 [ # # ][ # # ]: 0 : aSet.Put(SwFmtHoriOrient(0, text::HoriOrientation::LEFT));
[ # # ]
1083 : 0 : break;
1084 : :
1085 : : case FLY_AT_CHAR:
1086 : : //links, von links, rechts, oben, Durchlauf
1087 [ # # ]: 0 : if(eSurround != SURROUND_THROUGHT)
1088 [ # # ][ # # ]: 0 : aSet.Put(SwFmtSurround(SURROUND_THROUGHT));
[ # # ]
1089 : :
1090 [ # # ]: 0 : if( eVOrient != text::VertOrientation::TOP)
1091 [ # # ][ # # ]: 0 : aSet.Put(SwFmtVertOrient(0, text::VertOrientation::TOP));
[ # # ]
1092 : :
1093 [ # # ][ # # ]: 0 : if(eHOrient != text::HoriOrientation::NONE || eHOrient != text::HoriOrientation::LEFT || eHOrient != text::HoriOrientation::RIGHT)
[ # # ]
1094 [ # # ][ # # ]: 0 : aSet.Put(SwFmtHoriOrient(0, text::HoriOrientation::LEFT));
[ # # ]
1095 : 0 : break;
1096 : :
1097 : : default:
1098 : : ;
1099 : : }
1100 : :
1101 [ # # ]: 0 : if( aSet.Count() )
1102 [ # # ][ # # ]: 0 : rSh.SetFlyFrmAttr( aSet );
1103 : : }
1104 [ # # ]: 0 : rSh.EndUndo();
1105 : :
1106 [ # # ]: 0 : GetView().GetViewFrame()->GetBindings().Invalidate( FN_TOOL_ANCHOR );
1107 : : }
1108 : 0 : break;
1109 : :
1110 : : case FN_FRAME_NOWRAP:
1111 : : case FN_FRAME_WRAP:
1112 : : case FN_FRAME_WRAP_IDEAL:
1113 : : case FN_FRAME_WRAPTHRU:
1114 : : case FN_FRAME_WRAPTHRU_TRANSP:
1115 : : case FN_FRAME_WRAP_CONTOUR:
1116 : : case FN_WRAP_ANCHOR_ONLY:
1117 : : case FN_FRAME_WRAP_LEFT:
1118 : : case FN_FRAME_WRAP_RIGHT:
1119 [ # # ]: 0 : SetWrapMode( nSlot );
1120 : 0 : break;
1121 : :
1122 : : case FN_UPDATE_ALL_LINKS:
1123 : : {
1124 [ # # ][ # # ]: 0 : if( !rSh.GetLinkManager().GetLinks().empty() )
1125 : : {
1126 : 0 : sal_Bool bUpdateGrf = sal_False, bCallErrHdl = sal_False;
1127 [ # # ]: 0 : rSh.EnterStdMode();
1128 [ # # ]: 0 : rSh.StartAllAction();
1129 [ # # ][ # # ]: 0 : rSh.GetLinkManager().UpdateAllLinks( sal_False, bCallErrHdl, bUpdateGrf );
1130 [ # # ]: 0 : rSh.EndAllAction();
1131 : : }
1132 : : }
1133 : 0 : break;
1134 : :
1135 : : case FN_XFORMS_DESIGN_MODE:
1136 [ # # ][ # # ]: 0 : if( pArgs != NULL
[ # # ][ # # ]
[ # # ]
1137 [ # # ]: 0 : && pArgs->GetItemState( nSlot, sal_True, &pItem ) == SFX_ITEM_SET
1138 : : && pItem != NULL
1139 [ # # ][ # # ]: 0 : && pItem->ISA( SfxBoolItem ) )
1140 : : {
1141 : : sal_Bool bDesignMode =
1142 : 0 : static_cast<const SfxBoolItem*>( pItem )->GetValue();
1143 : :
1144 : : // set form design mode
1145 : : OSL_ENSURE( GetView().GetFormShell() != NULL, "form shell?" );
1146 [ # # ]: 0 : SfxRequest aReq( GetView().GetViewFrame(), SID_FM_DESIGN_MODE );
1147 [ # # ][ # # ]: 0 : aReq.AppendItem( SfxBoolItem( SID_FM_DESIGN_MODE, bDesignMode ) );
[ # # ]
1148 [ # # ]: 0 : GetView().GetFormShell()->Execute( aReq );
1149 [ # # ]: 0 : aReq.Done();
1150 : :
1151 : : // also set suitable view options
1152 [ # # ]: 0 : SwViewOption aViewOption = *rSh.GetViewOptions();
1153 : 0 : aViewOption.SetFormView( ! bDesignMode );
1154 [ # # ][ # # ]: 0 : rSh.ApplyViewOptions( aViewOption );
[ # # ]
1155 : : }
1156 : 0 : break;
1157 : :
1158 : : default:
1159 : 0 : bMore = sal_True;
1160 : : }
1161 [ # # ][ # # ]: 0 : if(bMore && pArgs)
1162 : : {
1163 : 0 : pItem = 0;
1164 [ # # ][ # # ]: 0 : pArgs->GetItemState(GetPool().GetWhich(nSlot), sal_False, &pItem);
1165 [ # # ]: 0 : if(pItem)
1166 [ # # # # ]: 0 : switch(nSlot)
1167 : : {
1168 : : case SID_ATTR_BRUSH:
1169 : : case SID_ATTR_BORDER_SHADOW:
1170 : : case RES_SHADOW:
1171 : : {
1172 [ # # ]: 0 : rSh.StartAllAction();
1173 [ # # ]: 0 : SfxItemSet aSet( rSh.GetAttrPool(),
1174 : : RES_SHADOW, RES_SHADOW,
1175 [ # # ]: 0 : RES_BACKGROUND, RES_BACKGROUND, 0 );
1176 : :
1177 [ # # ]: 0 : aSet.Put(*pItem);
1178 : : // Tabellenzelle(n) selektiert?
1179 [ # # ]: 0 : if ( rSh.IsTableMode() )
1180 : : {
1181 [ # # ]: 0 : SwFrmFmt *pFmt = rSh.GetTableFmt();
1182 [ # # ]: 0 : pFmt->SetFmtAttr( *pItem );
1183 : : }
1184 [ # # ][ # # ]: 0 : else if ( rSh.IsFrmSelected() )
1185 : : {
1186 : : // Umrandungsattribute ueber Frame-Manager setzen
1187 [ # # ]: 0 : SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE );
1188 [ # # ]: 0 : aMgr.SetAttrSet( *pArgs );
1189 [ # # ][ # # ]: 0 : aMgr.UpdateFlyFrm();
1190 : : }
1191 : : else
1192 : : {
1193 [ # # ]: 0 : rSh.SetAttr( *pArgs );
1194 : : }
1195 [ # # ][ # # ]: 0 : rSh.EndAllAction();
1196 : : }
1197 : 0 : break;
1198 : : case FN_PAGE_STYLE_SET_LR_MARGIN:
1199 : : case FN_PAGE_STYLE_SET_UL_MARGIN:
1200 : : case FN_PAGE_STYLE_SET_NUMBER_FORMAT:
1201 : : case FN_PAGE_STYLE_SET_PAPER_SIZE:
1202 : : case FN_PAGE_STYLE_SET_PAPER_BIN:
1203 : : {
1204 : : OSL_FAIL("not implemented");
1205 : : }
1206 : 0 : break;
1207 : :
1208 : : case SID_ATTR_BORDER_OUTER:
1209 : : {
1210 : : // Tabellenzelle(n) selektiert?
1211 [ # # ]: 0 : if ( rSh.IsTableMode() )
1212 : : {
1213 : : // Umrandungattribute Get/SetTabBorders() setzen
1214 [ # # ]: 0 : rSh.SetTabBorders(*pArgs);
1215 : : }
1216 [ # # ][ # # ]: 0 : else if ( rSh.IsFrmSelected() )
1217 : : {
1218 : : // Umrandungsattribute ueber Frame-Manager setzen
1219 [ # # ]: 0 : SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE );
1220 [ # # ]: 0 : aMgr.SetAttrSet(*pArgs);
1221 [ # # ][ # # ]: 0 : aMgr.UpdateFlyFrm();
1222 : : }
1223 : : else
1224 : : {
1225 : : // Umrandungsattribute ganz normal ueber Shell setzen
1226 [ # # ]: 0 : rSh.SetAttr( *pItem );
1227 : : }
1228 : : }
1229 : 0 : break;
1230 : : default:
1231 : : OSL_FAIL("wrong Dispatcher");
1232 : : }
1233 : :
1234 : : }
1235 : 0 : }
1236 : :
1237 : : /* --------------------------------------------------
1238 : : * Hier wird der State fuer SID_IMAP / SID_CONTOUR behandelt,
1239 : : * wenn die Grafik ausgeswappt ist
1240 : : * --------------------------------------------------*/
1241 : 0 : IMPL_LINK_NOARG(SwBaseShell, GraphicArrivedHdl)
1242 : : {
1243 : : sal_uInt16 nGrfType;
1244 : 0 : SwWrtShell &rSh = GetShell();
1245 [ # # # # ]: 0 : if( CNT_GRF == rSh.SwEditShell::GetCntType() &&
[ # # ][ # # ]
1246 : 0 : GRAPHIC_NONE != ( nGrfType = rSh.GetGraphicType() ) &&
1247 : 0 : !aGrfUpdateSlots.empty() )
1248 : : {
1249 [ # # ]: 0 : sal_Bool bProtect = 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT);
1250 : 0 : SfxViewFrame* pVFrame = GetView().GetViewFrame();
1251 : : sal_uInt16 nSlot;
1252 [ # # ]: 0 : std::set<sal_uInt16>::iterator it;
1253 [ # # ][ # # ]: 0 : for( it = aGrfUpdateSlots.begin(); it != aGrfUpdateSlots.end(); ++it )
[ # # ]
1254 : : {
1255 : 0 : sal_Bool bSetState = sal_False;
1256 : 0 : sal_Bool bState = sal_False;
1257 [ # # ][ # # : 0 : switch( nSlot = *it )
# # # ]
1258 : : {
1259 : : case SID_IMAP:
1260 : : case SID_IMAP_EXEC:
1261 : : {
1262 [ # # ]: 0 : sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
1263 [ # # ]: 0 : SvxIMapDlg *pDlg = pVFrame->HasChildWindow( nId ) ?
1264 : : (SvxIMapDlg*) ( pVFrame->GetChildWindow( nId )
1265 [ # # ][ # # ]: 0 : ->GetWindow()) : 0;
1266 : :
1267 [ # # ][ # # ]: 0 : if( pDlg && ( SID_IMAP_EXEC == nSlot ||
[ # # ][ # # ]
[ # # ][ # # ]
1268 : : ( SID_IMAP == nSlot && !bProtect)) &&
1269 [ # # ]: 0 : pDlg->GetEditingObject() != rSh.GetIMapInventor())
1270 [ # # ]: 0 : lcl_UpdateIMapDlg( rSh );
1271 : :
1272 [ # # ][ # # ]: 0 : if( !bProtect && SID_IMAP == nSlot )
1273 : 0 : bSetState = sal_True, bState = 0 != pDlg;
1274 : : }
1275 : 0 : break;
1276 : :
1277 : : case SID_CONTOUR_DLG:
1278 [ # # ]: 0 : if( !bProtect )
1279 : : {
1280 [ # # ]: 0 : sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
1281 [ # # ]: 0 : SvxIMapDlg *pDlg = pVFrame->HasChildWindow( nId ) ?
1282 : : (SvxIMapDlg*) ( pVFrame->GetChildWindow( nId )
1283 [ # # ][ # # ]: 0 : ->GetWindow()) : 0;
1284 [ # # ][ # # ]: 0 : if( pDlg && pDlg->GetEditingObject() !=
[ # # ]
1285 [ # # ]: 0 : rSh.GetIMapInventor() )
1286 [ # # ]: 0 : lcl_UpdateContourDlg( rSh, nsSelectionType::SEL_GRF );
1287 : :
1288 : 0 : bSetState = sal_True;
1289 : 0 : bState = 0 != pDlg;
1290 : : }
1291 : 0 : break;
1292 : :
1293 : : case FN_FRAME_WRAP_CONTOUR:
1294 [ # # ]: 0 : if( !bProtect )
1295 : : {
1296 [ # # ]: 0 : SfxItemSet aSet(GetPool(), RES_SURROUND, RES_SURROUND);
1297 [ # # ]: 0 : rSh.GetFlyFrmAttr(aSet);
1298 [ # # ]: 0 : const SwFmtSurround& rWrap = (const SwFmtSurround&)aSet.Get(RES_SURROUND);
1299 : 0 : bSetState = sal_True;
1300 [ # # ]: 0 : bState = rWrap.IsContour();
1301 : : }
1302 : 0 : break;
1303 : :
1304 : : case SID_GRFFILTER:
1305 : : case SID_GRFFILTER_INVERT:
1306 : : case SID_GRFFILTER_SMOOTH:
1307 : : case SID_GRFFILTER_SHARPEN:
1308 : : case SID_GRFFILTER_REMOVENOISE:
1309 : : case SID_GRFFILTER_SOBEL:
1310 : : case SID_GRFFILTER_MOSAIC:
1311 : : case SID_GRFFILTER_EMBOSS:
1312 : : case SID_GRFFILTER_POSTER:
1313 : : case SID_GRFFILTER_POPART:
1314 : : case SID_GRFFILTER_SEPIA:
1315 : : case SID_GRFFILTER_SOLARIZE:
1316 : 0 : bSetState = bState = GRAPHIC_BITMAP == nGrfType;
1317 : 0 : break;
1318 : : }
1319 : :
1320 [ # # ]: 0 : if( bSetState )
1321 : : {
1322 [ # # ]: 0 : SfxBoolItem aBool( nSlot, bState );
1323 [ # # ]: 0 : if( pGetStateSet )
1324 [ # # ]: 0 : pGetStateSet->Put( aBool );
1325 : : else
1326 [ # # ][ # # ]: 0 : pVFrame->GetBindings().SetState( aBool );
1327 : : }
1328 : : }
1329 : 0 : aGrfUpdateSlots.clear();
1330 : : }
1331 : 0 : return 0;
1332 : : }
1333 : :
1334 : 18 : void SwBaseShell::GetState( SfxItemSet &rSet )
1335 : : {
1336 : 18 : SwWrtShell &rSh = GetShell();
1337 : 18 : SfxViewFrame* pVFrame = GetView().GetViewFrame();
1338 [ + - ]: 18 : SfxWhichIter aIter( rSet );
1339 [ + - ]: 18 : sal_uInt16 nWhich = aIter.FirstWhich();
1340 : 18 : pGetStateSet = &rSet;
1341 [ + + ]: 36 : while ( nWhich )
1342 : : {
1343 [ - - + - : 18 : switch ( nWhich )
- - - - +
- - - - -
- - - -
- ]
1344 : : {
1345 : : case SID_GALLERY_FORMATS:
1346 [ # # ]: 0 : if ( rSh.IsObjSelected() ||
[ # # # # ]
[ # # ][ # # ]
1347 : 0 : (rSh.IsSelFrmMode() &&
1348 [ # # ]: 0 : !(rSh.GetSelectionType() & nsSelectionType::SEL_GRF)) )
1349 [ # # ]: 0 : rSet.DisableItem( nWhich );
1350 : 0 : break;
1351 : : case SID_GALLERY_ENABLE_ADDCOPY:
1352 : : // #108230# allow copy from gallery in Writer AND Writer/Web!
1353 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( SID_GALLERY_ENABLE_ADDCOPY, sal_True ) );
[ # # ]
1354 : 0 : break;
1355 : : case FN_EDIT_REGION:
1356 [ + - ][ + - ]: 4 : if( !rSh.IsAnySectionInDoc() )
1357 [ + - ]: 4 : rSet.DisableItem(nWhich);
1358 : 4 : break;
1359 : :
1360 : : case FN_INSERT_REGION:
1361 [ # # ][ # # ]: 0 : if( rSh.IsSelFrmMode() ||
[ # # ]
1362 [ # # ]: 0 : !rSh.IsInsRegionAvailable() )
1363 [ # # ]: 0 : rSet.DisableItem( nWhich );
1364 : 0 : break;
1365 : : case FN_CONVERT_TABLE_TO_TEXT:
1366 : : {
1367 [ # # ]: 0 : sal_uInt16 eFrmType = rSh.GetFrmType(0,sal_True);
1368 [ # # ][ # # ]: 0 : if( (eFrmType & FRMTYPE_FOOTNOTE) ||
[ # # ]
1369 [ # # ]: 0 : !rSh.GetTableFmt() )
1370 [ # # ]: 0 : rSet.DisableItem( nWhich );
1371 : : }
1372 : 0 : break;
1373 : : case FN_CONVERT_TEXT_TO_TABLE:
1374 : : {
1375 [ # # ]: 0 : sal_uInt16 eFrmType = rSh.GetFrmType(0,sal_True);
1376 [ # # ][ # # ]: 0 : if( (eFrmType & FRMTYPE_FOOTNOTE) ||
[ # # ]
1377 [ # # ]: 0 : !rSh.IsTextToTableAvailable() )
1378 [ # # ]: 0 : rSet.DisableItem( nWhich );
1379 : : }
1380 : 0 : break;
1381 : : case FN_CONVERT_TEXT_TABLE:
1382 : : {
1383 [ # # ]: 0 : sal_uInt16 eFrmType = rSh.GetFrmType(0,sal_True);
1384 [ # # ][ # # ]: 0 : if( (eFrmType & FRMTYPE_FOOTNOTE) ||
[ # # ][ # # ]
1385 [ # # ][ # # ]: 0 : (!rSh.GetTableFmt() && !rSh.IsTextToTableAvailable() ) )
1386 [ # # ]: 0 : rSet.DisableItem( nWhich );
1387 : : }
1388 : 0 : break;
1389 : : case RES_SHADOW:
1390 : : {
1391 [ # # ]: 0 : SfxItemSet aSet( rSh.GetAttrPool(),
1392 [ # # ]: 0 : RES_SHADOW, RES_SHADOW );
1393 : :
1394 : : // Tabellenzelle(n) selektiert?
1395 [ # # ]: 0 : if ( rSh.IsTableMode() )
1396 : : {
1397 [ # # ]: 0 : SwFrmFmt *pFmt = rSh.GetTableFmt();
1398 [ # # ][ # # ]: 0 : aSet.Put(pFmt->GetFmtAttr( nWhich, sal_True ));
1399 : : }
1400 [ # # ][ # # ]: 0 : else if( rSh.IsFrmSelected() )
1401 : : {
1402 [ # # ]: 0 : SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE );
1403 [ # # ][ # # ]: 0 : aSet.Put( aMgr.GetAttrSet() );
1404 : : }
1405 : : else
1406 [ # # ]: 0 : rSh.GetCurAttr( aSet );
1407 : :
1408 [ # # ]: 0 : const SvxShadowItem& rShItem = (const SvxShadowItem&)aSet.Get(nWhich);
1409 [ # # ][ # # ]: 0 : rSet.Put(rShItem);
1410 : : }
1411 : 0 : break;
1412 : : case SID_IMAP:
1413 : : {
1414 : : // #i59688#
1415 : : // improve efficiency:
1416 : : // If selected object is protected, item has to disabled.
1417 [ + - ]: 14 : const sal_Bool bProtect = 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT);
1418 [ - + ]: 14 : if ( bProtect )
1419 : : {
1420 [ # # ]: 0 : rSet.DisableItem( nWhich );
1421 : : }
1422 : : else
1423 : : {
1424 [ + - ]: 14 : const sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
1425 [ + - ]: 14 : const sal_Bool bHas = pVFrame->HasChildWindow( nId );
1426 [ + - ]: 14 : const sal_Bool bFrmSel = rSh.IsFrmSelected();
1427 : : const sal_Bool bIsGraphicSelection =
1428 [ + - ]: 14 : rSh.GetSelectionType() == nsSelectionType::SEL_GRF;
1429 : :
1430 : : // #i59688#
1431 : : // avoid unnecessary loading of selected graphic.
1432 : : // The graphic is only needed, if the dialog is open.
1433 : : //wenn die Grafik ausgeswappt ist, dann muss der
1434 : : //Status asynchron ermittelt werden
1435 : : //bis dahin wird der Slot disabled
1436 [ - + ][ # # ]: 14 : if ( bHas && bIsGraphicSelection && rSh.IsGrfSwapOut( sal_True ) )
[ # # ][ # # ]
[ - + ]
1437 : : {
1438 [ # # ][ # # ]: 0 : if( AddGrfUpdateSlot( nWhich ))
1439 [ # # ]: 0 : rSh.GetGraphic(sal_False); // start the loading
1440 : : }
1441 : : else
1442 : : {
1443 [ + - ][ - + ]: 14 : if ( !bHas &&
[ # # ][ # # ]
[ + - ]
1444 : : ( !bFrmSel ||
1445 : : ( bIsGraphicSelection &&
1446 [ # # ]: 0 : rSh.GetGraphicType() == GRAPHIC_NONE ) ) )
1447 : : {
1448 [ + - ]: 14 : rSet.DisableItem( nWhich );
1449 : : }
1450 : : else
1451 : : {
1452 [ # # ]: 0 : SfxBoolItem aBool(nWhich, bHas);
1453 [ # # ][ # # ]: 0 : if ( bHas && bFrmSel )
1454 [ # # ]: 0 : lcl_UpdateIMapDlg( rSh );
1455 [ # # ][ # # ]: 0 : rSet.Put(aBool);
1456 : : }
1457 : : }
1458 : : }
1459 : : }
1460 : 14 : break;
1461 : : case SID_IMAP_EXEC:
1462 : : {
1463 : 0 : sal_Bool bDisable = sal_False;
1464 [ # # ][ # # ]: 0 : if( !rSh.IsFrmSelected())
1465 : 0 : bDisable = sal_True;
1466 [ # # ]: 0 : sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
1467 [ # # ][ # # ]: 0 : if(!bDisable && pVFrame->HasChildWindow( nId ))
[ # # ][ # # ]
1468 : : {
1469 [ # # ][ # # ]: 0 : if(rSh.GetSelectionType() == nsSelectionType::SEL_GRF
[ # # ][ # # ]
1470 [ # # ]: 0 : && rSh.IsGrfSwapOut(sal_True))
1471 : : {
1472 [ # # ][ # # ]: 0 : if( AddGrfUpdateSlot( nWhich ))
1473 [ # # ]: 0 : rSh.GetGraphic(sal_False); // start the loading
1474 : : }
1475 : : else
1476 : : {
1477 [ # # ][ # # ]: 0 : SvxIMapDlg *pDlg = SWIMAPDLG(GetView());
1478 [ # # ][ # # ]: 0 : if( pDlg->GetEditingObject() != rSh.GetIMapInventor() )
1479 [ # # ]: 0 : lcl_UpdateIMapDlg( rSh );
1480 : : }
1481 : : }
1482 [ # # ][ # # ]: 0 : rSet.Put(SfxBoolItem(nWhich, bDisable));
[ # # ]
1483 : : }
1484 : 0 : break;
1485 : : case FN_BACKSPACE:
1486 : : case SID_DELETE:
1487 [ # # ][ # # ]: 0 : if (rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0)
1488 [ # # ]: 0 : rSet.DisableItem( nWhich );
1489 : 0 : break;
1490 : : case SID_CONTOUR_DLG:
1491 : : {
1492 [ # # ]: 0 : sal_Bool bParentCntProt = 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT );
1493 : :
1494 [ # # ][ # # ]: 0 : if( bParentCntProt || 0 != (HTMLMODE_ON & ::GetHtmlMode(
[ # # ]
1495 [ # # ][ # # ]: 0 : GetView().GetDocShell() )) )
1496 [ # # ]: 0 : rSet.DisableItem( nWhich );
1497 : : else
1498 : : {
1499 [ # # ]: 0 : sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
1500 [ # # ]: 0 : sal_Bool bHas = GetView().GetViewFrame()->HasChildWindow( nId );
1501 [ # # ]: 0 : int nSel = rSh.GetSelectionType();
1502 : 0 : sal_Bool bOk = 0 != (nSel & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_OLE));
1503 : :
1504 : 0 : sal_Bool bDisable = sal_False;
1505 [ # # ][ # # ]: 0 : if( !bHas && !bOk )
1506 : 0 : bDisable = sal_True;
1507 : : // #i59688#
1508 : : // avoid unnecessary loading of selected graphic.
1509 : : // The graphic is only needed, if the dialog is open.
1510 : : // wenn die Grafik ausgeswappt ist, dann muss der Status
1511 : : // asynchron ermittelt werden bis dahin wird der Slot
1512 : : // disabled
1513 [ # # ][ # # ]: 0 : else if ( bHas && (nSel & nsSelectionType::SEL_GRF) &&
[ # # ][ # # ]
1514 [ # # ]: 0 : rSh.IsGrfSwapOut(sal_True) )
1515 : : {
1516 [ # # ][ # # ]: 0 : if( AddGrfUpdateSlot( nWhich ))
1517 [ # # ]: 0 : rSh.GetGraphic(sal_False); // start the loading
1518 : : // #i75481#
1519 : 0 : bDisable = sal_True;
1520 : : }
1521 [ # # ][ # # ]: 0 : else if( bHas && bOk )
1522 [ # # ]: 0 : bDisable = !lcl_UpdateContourDlg( rSh, nSel );
1523 [ # # ]: 0 : else if( bOk )
1524 : : {
1525 : : // #i75481#
1526 : : // apply fix #i59688# only for selected graphics
1527 [ # # ]: 0 : if ( nSel & nsSelectionType::SEL_GRF )
1528 [ # # ]: 0 : bDisable = GRAPHIC_NONE == rSh.GetGraphicType();
1529 : : else
1530 [ # # ][ # # ]: 0 : bDisable = GRAPHIC_NONE == rSh.GetIMapGraphic().GetType();
[ # # ]
1531 : : }
1532 : :
1533 [ # # ]: 0 : if( bDisable )
1534 [ # # ]: 0 : rSet.DisableItem( nWhich );
1535 : : else
1536 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem(nWhich, bHas) );
[ # # ]
1537 : : }
1538 : : }
1539 : 0 : break;
1540 : : case SID_CONTOUR_EXEC:
1541 : : {
1542 : 0 : sal_Bool bDisable = sal_False;
1543 [ # # ]: 0 : int nSel = rSh.GetSelectionType();
1544 [ # # ]: 0 : if( !(nSel & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_OLE)) )
1545 : 0 : bDisable = sal_True;
1546 [ # # ]: 0 : sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
1547 [ # # ][ # # ]: 0 : if( !bDisable && GetView().GetViewFrame()->HasChildWindow( nId ))
[ # # ][ # # ]
1548 : : {
1549 [ # # ][ # # ]: 0 : SvxContourDlg *pDlg = SWCONTOURDLG(GetView());
1550 [ # # ][ # # ]: 0 : if( pDlg->GetEditingObject() != rSh.GetIMapInventor() )
[ # # ]
1551 : 0 : bDisable = sal_True;
1552 : : }
1553 [ # # ][ # # ]: 0 : rSet.Put(SfxBoolItem(nWhich, bDisable));
[ # # ]
1554 : : }
1555 : 0 : break;
1556 : :
1557 : : case FN_TOOL_ANCHOR:
1558 : : case FN_TOOL_ANCHOR_PAGE:
1559 : : case FN_TOOL_ANCHOR_PARAGRAPH:
1560 : : case FN_TOOL_ANCHOR_CHAR:
1561 : : case FN_TOOL_ANCHOR_AT_CHAR:
1562 : : case FN_TOOL_ANCHOR_FRAME:
1563 : : {
1564 [ # # ]: 0 : sal_Bool bObj = 0 != rSh.IsObjSelected();
1565 [ # # ]: 0 : sal_Bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
1566 : :
1567 [ # # ][ # # ]: 0 : if( !bParentCntProt && (bObj || rSh.IsFrmSelected()))
[ # # ][ # # ]
[ # # ]
1568 : : {
1569 [ # # ]: 0 : SfxItemSet aSet(GetPool(), RES_ANCHOR, RES_ANCHOR);
1570 [ # # ]: 0 : if(bObj)
1571 [ # # ]: 0 : rSh.GetObjAttr(aSet);
1572 : : else
1573 [ # # ]: 0 : rSh.GetFlyFrmAttr(aSet);
1574 [ # # ]: 0 : RndStdIds eSet = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId();
1575 : : const sal_Bool bSet =
1576 : : ((nWhich == FN_TOOL_ANCHOR_PAGE) &&
1577 : : (eSet == FLY_AT_PAGE))
1578 : : || ((nWhich == FN_TOOL_ANCHOR_PARAGRAPH) &&
1579 : : (eSet == FLY_AT_PARA))
1580 : : || ((nWhich == FN_TOOL_ANCHOR_FRAME) &&
1581 : : (eSet == FLY_AT_FLY))
1582 : : || ((nWhich == FN_TOOL_ANCHOR_AT_CHAR) &&
1583 : : (eSet == FLY_AT_CHAR))
1584 : : || ((nWhich == FN_TOOL_ANCHOR_CHAR) &&
1585 [ # # ][ # # ]: 0 : (eSet == FLY_AS_CHAR));
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
1586 [ # # ]: 0 : if(nWhich != FN_TOOL_ANCHOR)
1587 : : {
1588 [ # # ][ # # ]: 0 : sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
1589 [ # # ][ # # ]: 0 : if( ( nWhich == FN_TOOL_ANCHOR_PAGE &&
[ # # ][ # # ]
[ # # ][ # # ]
1590 : : ((HTMLMODE_ON & nHtmlMode) && (0 == (nHtmlMode & HTMLMODE_SOME_ABS_POS)))) ||
1591 [ # # ]: 0 : ( nWhich == FN_TOOL_ANCHOR_FRAME && !rSh.IsFlyInFly() ) )
1592 [ # # ]: 0 : rSet.DisableItem(nWhich);
1593 : : else
1594 [ # # ][ # # ]: 0 : rSet.Put(SfxBoolItem(nWhich, bSet));
[ # # ]
1595 : : }
1596 : : else
1597 : : {
1598 : 0 : sal_uInt16 nSlotId = 0;
1599 : :
1600 [ # # # # : 0 : switch (eSet)
# # ]
1601 : : {
1602 : : case FLY_AT_PAGE:
1603 : 0 : nSlotId = FN_TOOL_ANCHOR_PAGE;
1604 : 0 : break;
1605 : : case FLY_AT_PARA:
1606 : 0 : nSlotId = FN_TOOL_ANCHOR_PARAGRAPH;
1607 : 0 : break;
1608 : : case FLY_AS_CHAR:
1609 : 0 : nSlotId = FN_TOOL_ANCHOR_CHAR;
1610 : 0 : break;
1611 : : case FLY_AT_CHAR:
1612 : 0 : nSlotId = FN_TOOL_ANCHOR_AT_CHAR;
1613 : 0 : break;
1614 : : case FLY_AT_FLY:
1615 : 0 : nSlotId = FN_TOOL_ANCHOR_FRAME;
1616 : 0 : break;
1617 : : default:
1618 : : ;
1619 : : }
1620 [ # # ][ # # ]: 0 : rSet.Put(SfxUInt16Item(nWhich, nSlotId));
[ # # ]
1621 [ # # ]: 0 : }
1622 : : }
1623 : : else
1624 [ # # ]: 0 : rSet.DisableItem( nWhich );
1625 : : }
1626 : 0 : break;
1627 : : case FN_FRAME_NOWRAP:
1628 : : case FN_FRAME_WRAP:
1629 : : case FN_FRAME_WRAP_IDEAL:
1630 : : case FN_FRAME_WRAPTHRU:
1631 : : case FN_FRAME_WRAPTHRU_TRANSP:
1632 : : case FN_FRAME_WRAP_CONTOUR:
1633 : : case FN_WRAP_ANCHOR_ONLY:
1634 : : case FN_FRAME_WRAP_LEFT:
1635 : : case FN_FRAME_WRAP_RIGHT:
1636 : : {
1637 [ # # ]: 0 : sal_Bool bObj = 0 != rSh.IsObjSelected();
1638 [ # # ]: 0 : sal_Bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
1639 : :
1640 [ # # ][ # # ]: 0 : if( !bParentCntProt && (bObj || rSh.IsFrmSelected()))
[ # # ][ # # ]
[ # # ]
1641 : : {
1642 [ # # ]: 0 : SfxItemSet aSet(GetPool(), RES_OPAQUE, RES_ANCHOR);
1643 : : int nAnchorType;
1644 [ # # ]: 0 : if(bObj)
1645 : : {
1646 [ # # ]: 0 : rSh.GetObjAttr(aSet);
1647 [ # # ]: 0 : nAnchorType = rSh.GetAnchorId();
1648 : : }
1649 : : else
1650 : : {
1651 [ # # ]: 0 : rSh.GetFlyFrmAttr(aSet);
1652 [ # # ]: 0 : nAnchorType = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId();
1653 : : }
1654 [ # # ]: 0 : const SwFmtSurround& rWrap = (const SwFmtSurround&)aSet.Get(RES_SURROUND);
1655 : :
1656 [ # # ]: 0 : const SvxOpaqueItem& rOpaque = (const SvxOpaqueItem&)aSet.Get(RES_OPAQUE);
1657 : 0 : sal_Bool bOpaque = rOpaque.GetValue();
1658 : 0 : SwSurround nSurround = rWrap.GetSurround();
1659 : 0 : sal_Bool bSet = sal_False;
1660 : :
1661 : : bool bDisable =
1662 [ # # ][ # # ]: 0 : (nAnchorType == - 1) || (nAnchorType == FLY_AS_CHAR);
1663 : : const bool bHtmlMode =
1664 [ # # ][ # # ]: 0 : 0 != ::GetHtmlMode(GetView().GetDocShell());
1665 : :
1666 [ # # # # : 0 : switch( nWhich )
# # # # #
# ]
1667 : : {
1668 : : case FN_FRAME_NOWRAP:
1669 : : bDisable |=
1670 : : ( (nAnchorType != FLY_AT_PARA)
1671 : : && (nAnchorType != FLY_AT_CHAR)
1672 [ # # ][ # # ]: 0 : && (nAnchorType != FLY_AT_PAGE));
[ # # ]
1673 : 0 : bSet = nSurround == SURROUND_NONE;
1674 : 0 : break;
1675 : : case FN_FRAME_WRAP:
1676 : 0 : bDisable |= bHtmlMode;
1677 : 0 : bSet = nSurround == SURROUND_PARALLEL;
1678 : 0 : break;
1679 : : case FN_FRAME_WRAP_IDEAL:
1680 : 0 : bDisable |= bHtmlMode;
1681 : 0 : bSet = nSurround == SURROUND_IDEAL;
1682 : 0 : break;
1683 : : case FN_FRAME_WRAPTHRU:
1684 : : bDisable |= (bHtmlMode ||
1685 : : ( (nAnchorType != FLY_AT_PARA)
1686 : : && (nAnchorType != FLY_AT_CHAR)
1687 [ # # ][ # # ]: 0 : && (nAnchorType != FLY_AT_PAGE)));
[ # # ][ # # ]
1688 [ # # ]: 0 : if(bObj)
1689 [ # # ][ # # ]: 0 : bSet = nSurround == SURROUND_THROUGHT && rSh.GetLayerId();
[ # # ]
1690 : : else
1691 [ # # ][ # # ]: 0 : bSet = nSurround == SURROUND_THROUGHT && bOpaque;
1692 : 0 : break;
1693 : : case FN_FRAME_WRAPTHRU_TRANSP:
1694 : 0 : bDisable |= bHtmlMode;
1695 [ # # ]: 0 : if(bObj)
1696 [ # # ][ # # ]: 0 : bSet = nSurround == SURROUND_THROUGHT && !rSh.GetLayerId();
[ # # ]
1697 : : else
1698 [ # # ][ # # ]: 0 : bSet = nSurround == SURROUND_THROUGHT && !bOpaque;
1699 : 0 : break;
1700 : : case FN_FRAME_WRAP_CONTOUR:
1701 : 0 : bDisable |= bHtmlMode;
1702 : : //no contour available whenn no wrap or wrap through is set
1703 [ # # ][ # # ]: 0 : bDisable |= (nSurround == SURROUND_NONE || nSurround == SURROUND_THROUGHT);
1704 : 0 : bSet = rWrap.IsContour();
1705 [ # # ]: 0 : if( !bDisable )
1706 : : {
1707 [ # # ]: 0 : int nSel = rSh.GetSelectionType();
1708 [ # # ][ # # ]: 0 : if( (nSel & nsSelectionType::SEL_GRF) &&
[ # # ]
1709 [ # # ]: 0 : rSh.IsGrfSwapOut(sal_True))
1710 : : {
1711 [ # # ][ # # ]: 0 : if( AddGrfUpdateSlot( nWhich ))
1712 [ # # ]: 0 : rSh.GetGraphic(sal_False); // start the loading
1713 : : }
1714 [ # # ][ # # ]: 0 : else if( rSh.IsFrmSelected() )
1715 : : {
1716 : : // #i102253# applied patch from OD (see task)
1717 : : bDisable =
1718 : : nSel & nsSelectionType::SEL_FRM ||
1719 [ # # ][ # # ]: 0 : GRAPHIC_NONE == rSh.GetIMapGraphic().GetType();
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1720 : : }
1721 : : }
1722 [ # # ]: 0 : bSet = bDisable ? sal_False : rWrap.IsContour();
1723 : :
1724 : 0 : break;
1725 : : case FN_WRAP_ANCHOR_ONLY:
1726 : : bDisable |= (bHtmlMode ||
1727 [ # # ][ # # ]: 0 : (nAnchorType != FLY_AT_PARA));
1728 : 0 : bSet = rWrap.IsAnchorOnly();
1729 : 0 : break;
1730 : : case FN_FRAME_WRAP_LEFT:
1731 : 0 : bSet = nSurround == SURROUND_LEFT;
1732 : 0 : break;
1733 : : case FN_FRAME_WRAP_RIGHT:
1734 : 0 : bSet = nSurround == SURROUND_RIGHT;
1735 : 0 : break;
1736 : : }
1737 : :
1738 [ # # ]: 0 : if(bDisable)
1739 [ # # ]: 0 : rSet.DisableItem(nWhich);
1740 : : else
1741 [ # # ][ # # ]: 0 : rSet.Put(SfxBoolItem(nWhich, bSet));
[ # # ][ # # ]
1742 : : }
1743 : : else
1744 [ # # ]: 0 : rSet.DisableItem(nWhich);
1745 : : }
1746 : 0 : break;
1747 : : case FN_UPDATE_CHARTS:
1748 [ # # ][ # # ]: 0 : if( !rSh.HasCharts() )
1749 [ # # ]: 0 : rSet.DisableItem( nWhich );
1750 : 0 : break;
1751 : : case FN_UPDATE_ALL_LINKS:
1752 [ # # ][ # # ]: 0 : if ( rSh.GetLinkManager().GetLinks().empty() )
1753 [ # # ]: 0 : rSet.DisableItem(nWhich);
1754 : 0 : break;
1755 : : case FN_XFORMS_DESIGN_MODE:
1756 : : // enable if in XForms document
1757 [ # # ][ # # ]: 0 : if( rSh.GetDoc()->isXForms() )
1758 : : {
1759 : : // determine current state from view options
1760 : 0 : sal_Bool bValue = ! rSh.GetViewOptions()->IsFormView();
1761 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( nWhich, bValue ) );
[ # # ]
1762 : : }
1763 : : else
1764 [ # # ][ # # ]: 0 : rSet.Put( SfxVisibilityItem( nWhich, sal_False ) );
[ # # ]
1765 : 0 : break;
1766 : : }
1767 [ + - ]: 18 : nWhich = aIter.NextWhich();
1768 : : }
1769 [ + - ]: 18 : pGetStateSet = 0;
1770 : 18 : }
1771 : :
1772 : : /*--------------------------------------------------------------------
1773 : : Beschreibung: Slots mit dieser Statusmethode disablen
1774 : : --------------------------------------------------------------------*/
1775 : 0 : void SwBaseShell::StateDisableItems( SfxItemSet &rSet )
1776 : : {
1777 [ # # ]: 0 : SfxWhichIter aIter(rSet);
1778 [ # # ]: 0 : sal_uInt16 nWhich = aIter.FirstWhich();
1779 : :
1780 [ # # ]: 0 : while (nWhich)
1781 : : {
1782 [ # # ]: 0 : rSet.DisableItem( nWhich );
1783 [ # # ]: 0 : nWhich = aIter.NextWhich();
1784 [ # # ]: 0 : }
1785 : 0 : }
1786 : :
1787 : : /*--------------------------------------------------------------------
1788 : : Beschreibung: Slots mit dieser Statusmethode disablen
1789 : : --------------------------------------------------------------------*/
1790 : 9589 : void SwBaseShell::StateStyle( SfxItemSet &rSet )
1791 : : {
1792 : 9589 : sal_Bool bParentCntProt = GetShell().IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
1793 : 9589 : ShellModes eMode = GetView().GetShellMode();
1794 : :
1795 [ + - ][ + - ]: 9589 : if ( bParentCntProt ||
[ + - ][ + - ]
[ - + ][ + - ]
1796 : : SHELL_MODE_DRAW == eMode ||
1797 : : SHELL_MODE_DRAW_CTRL == eMode ||
1798 : : SHELL_MODE_DRAW_FORM == eMode ||
1799 : : SHELL_MODE_DRAWTEXT == eMode ||
1800 : : SHELL_MODE_BEZIER == eMode )
1801 : : {
1802 [ # # ]: 0 : SfxWhichIter aIter( rSet );
1803 [ # # ]: 0 : sal_uInt16 nWhich = aIter.FirstWhich();
1804 [ # # ]: 0 : while ( nWhich )
1805 : : {
1806 [ # # ]: 0 : rSet.DisableItem( nWhich );
1807 [ # # ]: 0 : nWhich = aIter.NextWhich();
1808 [ # # ]: 0 : }
1809 : : }
1810 : : else
1811 : 9589 : GetView().GetDocShell()->StateStyleSheet(rSet, &GetShell());
1812 : 9589 : }
1813 : :
1814 : 0 : void SwBaseShell::SetWrapMode( sal_uInt16 nSlot )
1815 : : {
1816 : 0 : SwWrtShell &rSh = GetShell();
1817 : 0 : sal_Bool bObj = 0 != rSh.IsObjSelected();
1818 [ # # ][ # # ]: 0 : if( bObj || rSh.IsFrmSelected())
[ # # ]
1819 : : {
1820 [ # # ]: 0 : SfxItemSet aSet(GetPool(), RES_OPAQUE, RES_SURROUND);
1821 [ # # ]: 0 : if(bObj)
1822 [ # # ]: 0 : rSh.GetObjAttr(aSet);
1823 : : else
1824 [ # # ]: 0 : rSh.GetFlyFrmAttr(aSet);
1825 [ # # ][ # # ]: 0 : SwFmtSurround aWrap( (SwFmtSurround&)aSet.Get(RES_SURROUND) );
1826 : 0 : SwSurround nOldSurround(aWrap.GetSurround());
1827 : 0 : SwSurround nSurround = SURROUND_PARALLEL;
1828 : :
1829 [ # # # # : 0 : switch (nSlot)
# # # #
# ]
1830 : : {
1831 : : case FN_FRAME_NOWRAP:
1832 : 0 : nSurround = SURROUND_NONE;
1833 [ # # ]: 0 : if (aWrap.IsContour())
1834 : 0 : aWrap.SetContour(sal_False);
1835 : 0 : break;
1836 : : case FN_FRAME_WRAP_IDEAL:
1837 : 0 : nSurround = SURROUND_IDEAL;
1838 : 0 : break;
1839 : : case FN_WRAP_ANCHOR_ONLY:
1840 : 0 : aWrap.SetAnchorOnly(!aWrap.IsAnchorOnly());
1841 : : //
1842 : : // keep previous wrapping
1843 : : //
1844 : : // switch to wrap SURROUND_PARALLEL, if previous wrap is SURROUND_NONE
1845 [ # # ]: 0 : if ( nOldSurround != SURROUND_NONE )
1846 : : {
1847 : 0 : nSurround = nOldSurround;
1848 : : }
1849 : 0 : break;
1850 : : case FN_FRAME_WRAP_CONTOUR:
1851 : 0 : aWrap.SetContour(!aWrap.IsContour());
1852 [ # # ]: 0 : if (nSurround == SURROUND_THROUGHT)
1853 : 0 : nSurround = SURROUND_PARALLEL;
1854 : 0 : break;
1855 : : case FN_FRAME_WRAPTHRU_TRANSP:
1856 [ # # ]: 0 : if (aWrap.IsContour())
1857 : 0 : aWrap.SetContour(sal_False);
1858 : : // kein break!!!
1859 : : case FN_FRAME_WRAPTHRU:
1860 : 0 : nSurround = SURROUND_THROUGHT;
1861 : 0 : break;
1862 : :
1863 : : case FN_FRAME_WRAP_LEFT:
1864 : 0 : nSurround = SURROUND_LEFT;
1865 : 0 : break;
1866 : :
1867 : : case FN_FRAME_WRAP_RIGHT:
1868 : 0 : nSurround = SURROUND_RIGHT;
1869 : 0 : break;
1870 : :
1871 : : default:
1872 : 0 : break;
1873 : : }
1874 : 0 : aWrap.SetSurround(nSurround);
1875 : :
1876 [ # # ]: 0 : if (nSlot != FN_FRAME_WRAP_CONTOUR)
1877 : : {
1878 : : // Konturumfluss bei Draw-Objekten defaulten
1879 [ # # ][ # # ]: 0 : if (bObj && nOldSurround != nSurround &&
[ # # ][ # # ]
1880 : : (nOldSurround == SURROUND_NONE || nOldSurround == SURROUND_THROUGHT))
1881 : : {
1882 : 0 : aWrap.SetContour(sal_True);
1883 : : }
1884 : : }
1885 : :
1886 [ # # ]: 0 : aSet.Put( aWrap );
1887 [ # # ][ # # ]: 0 : aSet.Put(SvxOpaqueItem(RES_OPAQUE, nSlot != FN_FRAME_WRAPTHRU_TRANSP));
[ # # ]
1888 [ # # ]: 0 : if(bObj)
1889 : : {
1890 [ # # ]: 0 : rSh.SetObjAttr(aSet);
1891 [ # # ]: 0 : if (nSlot != FN_FRAME_WRAPTHRU_TRANSP)
1892 [ # # ]: 0 : rSh.SelectionToHeaven();
1893 : : else
1894 [ # # ]: 0 : rSh.SelectionToHell();
1895 : : }
1896 : : else
1897 [ # # ][ # # ]: 0 : rSh.SetFlyFrmAttr(aSet);
[ # # ]
1898 : : }
1899 : 0 : }
1900 : :
1901 : : /*--------------------------------------------------------------------
1902 : : Beschreibung: Update der Statuszeile erzwingen
1903 : : --------------------------------------------------------------------*/
1904 : 0 : void SwBaseShell::SetFrmMode(FlyMode eMode, SwWrtShell *pSh )
1905 : : {
1906 : 0 : eFrameMode = eMode;
1907 : 0 : SfxBindings &rBnd = pSh->GetView().GetViewFrame()->GetBindings();
1908 : :
1909 [ # # # # : 0 : if( eMode == FLY_DRAG ||
# # ][ # # ]
[ # # ]
1910 : 0 : (pSh && (pSh->IsFrmSelected() || pSh->IsObjSelected())) )
1911 : : {
1912 [ # # ][ # # ]: 0 : const SfxPointItem aTmp1( SID_ATTR_POSITION, pSh->GetAnchorObjDiff());
1913 [ # # ][ # # ]: 0 : const SvxSizeItem aTmp2( SID_ATTR_SIZE, pSh->GetObjSize());
1914 [ # # ]: 0 : rBnd.SetState( aTmp1 );
1915 [ # # ][ # # ]: 0 : rBnd.SetState( aTmp2 );
[ # # ]
1916 : : }
1917 [ # # ]: 0 : else if( eMode == FLY_DRAG_END )
1918 : : {
1919 : : static sal_uInt16 aInval[] =
1920 : : {
1921 : : SID_ATTR_POSITION, SID_ATTR_SIZE, 0
1922 : : };
1923 : 0 : rBnd.Invalidate(aInval);
1924 : : }
1925 : 0 : }
1926 : :
1927 : : /*--------------------------------------------------------------------
1928 : : Beschreibung: Ctor
1929 : : --------------------------------------------------------------------*/
1930 : :
1931 : 2663 : SwBaseShell::SwBaseShell(SwView& rVw) :
1932 : : SfxShell( &rVw ),
1933 : : rView(rVw),
1934 [ + - ]: 2663 : pGetStateSet(0)
1935 : : {
1936 : 2663 : SwWrtShell& rWrtSh = rView.GetWrtShell();
1937 : :
1938 [ + - ]: 2663 : SetPool(&rWrtSh.GetAttrPool());
1939 [ + - ][ + - ]: 2663 : SetName(rtl::OUString("Base"));
[ + - ]
1940 [ + - ]: 2663 : rWrtSh.SetGrfArrivedLnk( LINK( this, SwBaseShell, GraphicArrivedHdl));
1941 : 2663 : }
1942 : :
1943 : 2489 : SwBaseShell::~SwBaseShell()
1944 : : {
1945 [ - + ]: 2489 : if( rView.GetCurShell() == this )
1946 : 0 : rView.ResetSubShell();
1947 : :
1948 [ + - ]: 2489 : Link aTmp( LINK( this, SwBaseShell, GraphicArrivedHdl));
1949 [ + - ][ + + ]: 2489 : if( aTmp == rView.GetWrtShell().GetGrfArrivedLnk() )
1950 [ + - ]: 1223 : rView.GetWrtShell().SetGrfArrivedLnk( Link() );
1951 [ - + ]: 2489 : }
1952 : :
1953 : 0 : void SwBaseShell::ExecTxtCtrl( SfxRequest& rReq )
1954 : : {
1955 : 0 : const SfxItemSet *pArgs = rReq.GetArgs();
1956 : :
1957 [ # # ]: 0 : if( pArgs)
1958 : : {
1959 : 0 : SwWrtShell &rSh = GetShell();
1960 : 0 : SvxScriptSetItem* pSSetItem = 0;
1961 : 0 : sal_uInt16 nSlot = rReq.GetSlot();
1962 [ # # ]: 0 : SfxItemPool& rPool = rSh.GetAttrPool();
1963 [ # # ]: 0 : sal_uInt16 nWhich = rPool.GetWhich( nSlot );
1964 : 0 : sal_uInt16 nScripts = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
1965 : 0 : SfxItemSet aHeightSet( GetPool(), RES_CHRATR_FONTSIZE, RES_CHRATR_FONTSIZE,
1966 : : RES_CHRATR_CJK_FONTSIZE, RES_CHRATR_CJK_FONTSIZE,
1967 : : RES_CHRATR_CTL_FONTSIZE, RES_CHRATR_CTL_FONTSIZE,
1968 [ # # ]: 0 : 0L);
1969 : :
1970 [ # # # # ]: 0 : switch( nSlot )
1971 : : {
1972 : : case SID_ATTR_CHAR_FONT:
1973 : : {
1974 [ # # ]: 0 : nScripts = rSh.GetScriptType();
1975 : : // #i42732# input language should be preferred over
1976 : : // current cursor position to detect script type
1977 [ # # ][ # # ]: 0 : if(!rSh.HasSelection())
1978 : : {
1979 [ # # ]: 0 : LanguageType nInputLang = GetView().GetEditWin().GetInputLanguage();
1980 [ # # ][ # # ]: 0 : if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
1981 [ # # ]: 0 : nScripts = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
1982 : : }
1983 : : }
1984 : : case SID_ATTR_CHAR_POSTURE:
1985 : : case SID_ATTR_CHAR_WEIGHT:
1986 : : {
1987 [ # # ][ # # ]: 0 : pSSetItem = new SvxScriptSetItem( nSlot, rPool );
1988 [ # # ][ # # ]: 0 : pSSetItem->PutItemForScriptType( nScripts, pArgs->Get( nWhich ));
1989 : 0 : pArgs = &pSSetItem->GetItemSet();
1990 : : }
1991 : 0 : break;
1992 : : case SID_ATTR_CHAR_FONTHEIGHT:
1993 : : {
1994 [ # # ][ # # ]: 0 : if(rSh.HasSelection())
1995 : : {
1996 [ # # ][ # # ]: 0 : pSSetItem = new SvxScriptSetItem( nSlot, rPool );
1997 [ # # ][ # # ]: 0 : pSSetItem->PutItemForScriptType( nScripts, pArgs->Get( nWhich ));
1998 : 0 : pArgs = &pSSetItem->GetItemSet();
1999 : : }
2000 : : else
2001 : : {
2002 [ # # ]: 0 : nScripts = rSh.GetScriptType();
2003 [ # # ]: 0 : LanguageType nInputLang = GetView().GetEditWin().GetInputLanguage();
2004 [ # # ][ # # ]: 0 : if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
2005 [ # # ]: 0 : nScripts = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
2006 [ # # ]: 0 : sal_uInt32 nHeight = static_cast< const SvxFontHeightItem& >(pArgs->Get( nWhich )).GetHeight();
2007 [ # # ]: 0 : SwStdFontConfig* pStdFont = SW_MOD()->GetStdFontConfig();
2008 : :
2009 : 0 : SfxItemSet aLangSet( GetPool(), RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE,
2010 : : RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
2011 : : RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
2012 [ # # ]: 0 : 0L);
2013 [ # # ]: 0 : rSh.GetCurAttr( aLangSet );
2014 : :
2015 : : sal_Int32 nWesternSize =
2016 : : pStdFont->GetFontHeight(FONT_STANDARD, FONT_GROUP_DEFAULT,
2017 [ # # ][ # # ]: 0 : static_cast<const SvxLanguageItem&>(aLangSet.Get( RES_CHRATR_LANGUAGE)).GetLanguage());
2018 : : sal_Int32 nCJKSize =
2019 : : pStdFont->GetFontHeight(FONT_STANDARD, FONT_GROUP_CJK,
2020 [ # # ][ # # ]: 0 : static_cast<const SvxLanguageItem&>(aLangSet.Get( RES_CHRATR_CJK_LANGUAGE)).GetLanguage());
2021 : : sal_Int32 nCTLSize =
2022 : : pStdFont->GetFontHeight(FONT_STANDARD, FONT_GROUP_CTL,
2023 [ # # ][ # # ]: 0 : static_cast<const SvxLanguageItem&>(aLangSet.Get( RES_CHRATR_CTL_LANGUAGE)).GetLanguage());
2024 : :
2025 [ # # # # ]: 0 : switch(nScripts)
2026 : : {
2027 : : case SCRIPTTYPE_LATIN:
2028 : 0 : nCJKSize = nHeight * nCJKSize / nWesternSize;
2029 : 0 : nCTLSize = nHeight * nCTLSize / nWesternSize;
2030 : 0 : nWesternSize = (sal_Int32) nHeight;
2031 : 0 : break;
2032 : : case SCRIPTTYPE_ASIAN:
2033 : 0 : nCTLSize = nHeight* nCTLSize / nCJKSize;
2034 : 0 : nWesternSize = nHeight * nWesternSize / nCJKSize;
2035 : 0 : nCJKSize = (sal_Int32) nHeight;
2036 : 0 : break;
2037 : : case SCRIPTTYPE_COMPLEX:
2038 : 0 : nCJKSize = nHeight * nCJKSize / nCTLSize;
2039 : 0 : nWesternSize = nHeight * nWesternSize / nCTLSize;
2040 : 0 : nCTLSize = (sal_Int32) nHeight;
2041 : 0 : break;
2042 : : }
2043 [ # # ][ # # ]: 0 : aHeightSet.Put( SvxFontHeightItem( (sal_uInt32)nWesternSize, 100, RES_CHRATR_FONTSIZE ));
[ # # ]
2044 [ # # ][ # # ]: 0 : aHeightSet.Put( SvxFontHeightItem( (sal_uInt32)nCJKSize, 100, RES_CHRATR_CJK_FONTSIZE ));
[ # # ]
2045 [ # # ][ # # ]: 0 : aHeightSet.Put( SvxFontHeightItem( (sal_uInt32)nCTLSize, 100, RES_CHRATR_CTL_FONTSIZE ));
[ # # ]
2046 [ # # ]: 0 : pArgs = &aHeightSet;
2047 : : }
2048 : : }
2049 : 0 : break;
2050 : : }
2051 : :
2052 [ # # ]: 0 : if( pArgs )
2053 : : {
2054 : 0 : bool bAuto = false;
2055 [ # # ][ # # ]: 0 : if ( !isCHRATR(nWhich) ||
[ # # ][ # # ]
2056 [ # # ][ # # ]: 0 : ( rSh.HasSelection() && rSh.IsSelFullPara() ) )
2057 : : {
2058 [ # # ]: 0 : SwTxtFmtColl * pColl = rSh.GetCurTxtFmtColl();
2059 [ # # ][ # # ]: 0 : if ( pColl && pColl->IsAutoUpdateFmt() )
[ # # ]
2060 : : {
2061 [ # # ]: 0 : rSh.AutoUpdatePara( pColl, *pArgs );
2062 : 0 : bAuto = true;
2063 : : }
2064 : : }
2065 : :
2066 [ # # ]: 0 : if (!bAuto)
2067 : : {
2068 [ # # ]: 0 : rSh.SetAttr( *pArgs );
2069 : : }
2070 : : }
2071 [ # # ][ # # ]: 0 : delete pSSetItem;
[ # # ]
2072 : : }
2073 : : else
2074 : 0 : GetView().GetViewFrame()->GetDispatcher()->Execute( SID_CHAR_DLG, sal_False);
2075 : 0 : rReq.Done();
2076 : 0 : }
2077 : :
2078 : 1327 : void SwBaseShell::GetTxtCtrlState( SfxItemSet& rSet )
2079 : : {
2080 : 1327 : SwWrtShell &rSh = GetShell();
2081 : 1327 : rSh.GetCurAttr( rSet );
2082 : 1327 : }
2083 : :
2084 : 4327 : void SwBaseShell::GetTxtFontCtrlState( SfxItemSet& rSet )
2085 : : {
2086 : 4327 : SwWrtShell &rSh = GetShell();
2087 : 4327 : sal_Bool bFirst = sal_True;
2088 : 4327 : SfxItemSet* pFntCoreSet = 0;
2089 : 4327 : sal_uInt16 nScriptType = SCRIPTTYPE_LATIN;
2090 [ + - ]: 4327 : SfxWhichIter aIter( rSet );
2091 [ + - ]: 4327 : sal_uInt16 nWhich = aIter.FirstWhich();
2092 [ + + ]: 10430 : while( nWhich )
2093 : : {
2094 [ + - ]: 6103 : switch( nWhich )
2095 : : {
2096 : : case RES_CHRATR_FONT:
2097 : : case RES_CHRATR_FONTSIZE:
2098 : : case RES_CHRATR_WEIGHT:
2099 : : case RES_CHRATR_POSTURE:
2100 : : {
2101 [ + + ]: 6103 : if( !pFntCoreSet )
2102 : : {
2103 : : pFntCoreSet = new SfxItemSet( *rSet.GetPool(),
2104 [ + - ][ + - ]: 4327 : RES_CHRATR_BEGIN, RES_CHRATR_END-1 );
2105 [ + - ]: 4327 : rSh.GetCurAttr( *pFntCoreSet );
2106 [ + - ]: 4327 : nScriptType = rSh.GetScriptType();
2107 : : // #i42732# input language should be preferred over
2108 : : // current cursor position to detect script type
2109 : 4327 : SwEditWin& rEditWin = GetView().GetEditWin();
2110 [ + - ]: 4327 : if( rEditWin.IsUseInputLanguage() )
2111 : : {
2112 [ + - ][ + + ]: 4327 : if(!rSh.HasSelection() && (
[ + + ][ + + ]
[ + + ]
2113 : : nWhich == RES_CHRATR_FONT ||
2114 : : nWhich == RES_CHRATR_FONTSIZE ))
2115 : : {
2116 [ + - ]: 2829 : LanguageType nInputLang = rEditWin.GetInputLanguage();
2117 [ - + ][ # # ]: 2829 : if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
2118 [ # # ]: 0 : nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
2119 : : }
2120 : : }
2121 : : }
2122 : 6103 : SfxItemPool& rPool = *rSet.GetPool();
2123 [ + - ][ + - ]: 6103 : SvxScriptSetItem aSetItem( rPool.GetSlotId( nWhich ), rPool );
2124 [ + - ]: 6103 : aSetItem.GetItemSet().Put( *pFntCoreSet, sal_False );
2125 [ + - ]: 6103 : const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
2126 [ + + ]: 6103 : if( pI )
2127 [ + - ]: 6099 : rSet.Put( *pI, nWhich );
2128 : : else
2129 [ + - ]: 4 : rSet.InvalidateItem( nWhich );
2130 : : //set input context of the SwEditWin according to the selected font and script type
2131 [ + + ]: 6103 : if(RES_CHRATR_FONT == nWhich)
2132 : : {
2133 [ + - ]: 2086 : Font aFont;
2134 [ + - ][ + - ]: 2086 : if(pI && pI->ISA(SvxFontItem))
[ + - ][ + - ]
[ + - ]
2135 : : {
2136 [ + - ][ + - ]: 2086 : aFont.SetName( ((const SvxFontItem*)pI)->GetFamilyName());
2137 [ + - ]: 2086 : aFont.SetStyleName(((const SvxFontItem*)pI)->GetStyleName());
2138 [ + - ]: 2086 : aFont.SetFamily(((const SvxFontItem*)pI)->GetFamily());
2139 [ + - ]: 2086 : aFont.SetPitch(((const SvxFontItem*)pI)->GetPitch());
2140 [ + - ]: 2086 : aFont.SetCharSet(((const SvxFontItem*)pI)->GetCharSet());
2141 : : }
2142 : :
2143 [ + - ]: 2086 : sal_Bool bVertical = rSh.IsInVerticalText();
2144 [ - + ][ + - ]: 2086 : aFont.SetOrientation(bVertical ? 2700 : 0);
2145 [ + - ]: 2086 : aFont.SetVertical(bVertical);
2146 : 2086 : GetView().GetEditWin().SetInputContext( InputContext( aFont, INPUTCONTEXT_TEXT |
2147 [ + - + - ]: 4172 : INPUTCONTEXT_EXTTEXTINPUT ) );
[ + - ][ + - ]
2148 [ + - ]: 6103 : }
2149 : : }
2150 : 6103 : break;
2151 : :
2152 : : default:
2153 [ # # ]: 0 : if( bFirst )
2154 : : {
2155 [ # # ]: 0 : rSh.GetCurAttr( rSet );
2156 : 0 : bFirst = sal_False;
2157 : : }
2158 : : }
2159 [ + - ]: 6103 : nWhich = aIter.NextWhich();
2160 : : }
2161 [ + - ][ + - ]: 4327 : delete pFntCoreSet;
[ + - ]
2162 : 4327 : }
2163 : :
2164 : 1245 : void SwBaseShell::GetBckColState(SfxItemSet &rSet)
2165 : : {
2166 : 1245 : SwWrtShell &rSh = GetShell();
2167 [ + - ]: 1245 : SfxWhichIter aIter( rSet );
2168 [ + - ]: 1245 : sal_uInt16 nWhich = aIter.FirstWhich();
2169 [ + - ]: 1245 : int nSelType = rSh.GetSelectionType();
2170 : :
2171 [ - + ]: 1245 : if( nSelType & nsSelectionType::SEL_OLE )
2172 : : {
2173 [ # # ]: 0 : rSet.DisableItem( SID_BACKGROUND_COLOR );
2174 : : return;
2175 : : }
2176 : :
2177 [ - + ]: 1245 : if ( nSelType & nsSelectionType::SEL_FRM )
2178 : : {
2179 [ # # ]: 0 : sal_Bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
2180 [ # # ]: 0 : if (bParentCntProt)
2181 : : {
2182 [ # # ]: 0 : rSet.DisableItem( SID_BACKGROUND_COLOR );
2183 : : return;
2184 : : }
2185 : : }
2186 : :
2187 [ + - ]: 1245 : SvxBrushItem aBrushItem( RES_BACKGROUND );
2188 : :
2189 [ + + ]: 1245 : if( nsSelectionType::SEL_TBL_CELLS & nSelType )
2190 [ + - ]: 6 : rSh.GetBoxBackground( aBrushItem );
2191 : : else
2192 : : {
2193 [ + - ]: 1239 : SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);
2194 [ + - ][ - + ]: 1239 : if( nSelType & nsSelectionType::SEL_GRF || nsSelectionType::SEL_FRM & nSelType )
2195 [ # # ]: 0 : rSh.GetFlyFrmAttr( aCoreSet );
2196 : : else
2197 [ + - ]: 1239 : rSh.GetCurAttr( aCoreSet );
2198 [ + - ][ + - ]: 1239 : aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND);
[ + - ]
2199 : : }
2200 : :
2201 [ + + ]: 2490 : while ( nWhich )
2202 : : {
2203 [ + - - ]: 1245 : switch(nWhich)
2204 : : {
2205 : : case SID_BACKGROUND_COLOR :
2206 : : {
2207 [ + - ]: 1245 : SvxColorItem aColorItem(aBrushItem.GetColor(), SID_BACKGROUND_COLOR);
2208 [ + - ][ + - ]: 1245 : rSet.Put( aColorItem, SID_BACKGROUND_COLOR );
2209 : : }
2210 : 1245 : break;
2211 : : case SID_ATTR_BRUSH:
2212 : : case RES_BACKGROUND:
2213 [ # # ][ # # ]: 0 : rSet.Put( aBrushItem, GetPool().GetWhich(nWhich) );
2214 : 0 : break;
2215 : : }
2216 [ + - ]: 1245 : nWhich = aIter.NextWhich();
2217 [ + - ][ + - ]: 1245 : }
[ + - ]
2218 : : }
2219 : :
2220 : 0 : void SwBaseShell::ExecBckCol(SfxRequest& rReq)
2221 : : {
2222 : 0 : SwWrtShell &rSh = GetShell();
2223 [ # # ]: 0 : int nSelType = rSh.GetSelectionType();
2224 [ # # ]: 0 : if ( nSelType & nsSelectionType::SEL_OLE )
2225 : : {
2226 : : return;
2227 : : }
2228 : :
2229 : 0 : const SfxItemSet* pArgs = rReq.GetArgs();
2230 : 0 : sal_uInt16 nSlot = rReq.GetSlot();
2231 [ # # ][ # # ]: 0 : if( !pArgs && nSlot != SID_BACKGROUND_COLOR)
2232 : : return ;
2233 : :
2234 [ # # ]: 0 : SvxBrushItem aBrushItem( RES_BACKGROUND );
2235 : :
2236 [ # # ]: 0 : if( nsSelectionType::SEL_TBL_CELLS & nSelType )
2237 : : {
2238 [ # # ]: 0 : rSh.GetBoxBackground( aBrushItem );
2239 : : }
2240 : : else
2241 : : {
2242 [ # # ]: 0 : SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);
2243 [ # # ][ # # ]: 0 : if( (nsSelectionType::SEL_FRM & nSelType) || (nsSelectionType::SEL_GRF & nSelType) )
2244 [ # # ]: 0 : rSh.GetFlyFrmAttr( aCoreSet );
2245 : : else
2246 [ # # ]: 0 : rSh.GetCurAttr( aCoreSet );
2247 [ # # ][ # # ]: 0 : aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND);
[ # # ]
2248 : : }
2249 : :
2250 [ # # # ]: 0 : switch (nSlot)
2251 : : {
2252 : : // RES_BACKGROUND (=SID_ATTR_BRUSH) muss ueber zwei IDs
2253 : : // gesetzt werden:
2254 : : case SID_BACKGROUND_COLOR:
2255 : : {
2256 [ # # ]: 0 : aBrushItem.SetGraphicPos(GPOS_NONE);
2257 : :
2258 [ # # ]: 0 : if(pArgs)
2259 : : {
2260 : : const SvxColorItem& rNewColorItem = (const SvxColorItem&)
2261 [ # # ]: 0 : pArgs->Get(SID_BACKGROUND_COLOR);
2262 : 0 : const Color& rNewColor = rNewColorItem.GetValue();
2263 : 0 : aBrushItem.SetColor( rNewColor );
2264 [ # # ]: 0 : GetView().GetViewFrame()->GetBindings().SetState(rNewColorItem);
2265 : : }
2266 : : else
2267 : : {
2268 : 0 : aBrushItem.SetColor( COL_TRANSPARENT );
2269 [ # # ][ # # ]: 0 : rReq.AppendItem( SvxColorItem( Color( COL_TRANSPARENT ), nSlot ) );
[ # # ]
2270 : : }
2271 : : }
2272 : 0 : break;
2273 : :
2274 : : case SID_ATTR_BRUSH:
2275 : : case RES_BACKGROUND:
2276 : : {
2277 : : const SvxBrushItem& rNewBrushItem = (const SvxBrushItem&)
2278 [ # # ][ # # ]: 0 : pArgs->Get( GetPool().GetWhich(nSlot) );
2279 [ # # ]: 0 : aBrushItem = rNewBrushItem;
2280 : : }
2281 : 0 : break;
2282 : : default:
2283 [ # # ]: 0 : rReq.Ignore();
2284 : : OSL_FAIL("unknown message in ExecuteAttr!" );
2285 : : return;
2286 : : }
2287 : :
2288 [ # # ]: 0 : if( nsSelectionType::SEL_TBL_CELLS & nSelType )
2289 : : {
2290 [ # # ]: 0 : rSh.SetBoxBackground( aBrushItem );
2291 : : }
2292 [ # # ][ # # ]: 0 : else if( (nsSelectionType::SEL_FRM & nSelType) ||
2293 : : (nsSelectionType::SEL_GRF & nSelType) )
2294 : : {
2295 [ # # ]: 0 : SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);
2296 [ # # ]: 0 : aCoreSet.Put( aBrushItem );
2297 : : // Vorlagen-AutoUpdate
2298 [ # # ]: 0 : SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
2299 [ # # ][ # # ]: 0 : if(pFmt && pFmt->IsAutoUpdateFmt())
[ # # ]
2300 [ # # ]: 0 : rSh.AutoUpdateFrame( pFmt, aCoreSet);
2301 : : else
2302 [ # # ][ # # ]: 0 : rSh.SetFlyFrmAttr( aCoreSet );
2303 : : }
2304 : : else
2305 : : {
2306 [ # # ]: 0 : SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl();
2307 [ # # ][ # # ]: 0 : if( pColl && pColl->IsAutoUpdateFmt())
[ # # ]
2308 : : {
2309 [ # # ]: 0 : SfxItemSet aSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND );
2310 [ # # ]: 0 : aSet.Put(aBrushItem);
2311 [ # # ][ # # ]: 0 : rSh.AutoUpdatePara( pColl, aSet);
2312 : : }
2313 : : else
2314 [ # # ]: 0 : rSh.SetAttr( aBrushItem );
2315 : : }
2316 : :
2317 [ # # ][ # # ]: 0 : rReq.Done();
[ # # ]
2318 : : }
2319 : :
2320 : 0 : void SwBaseShell::GetBorderState(SfxItemSet &rSet)
2321 : : {
2322 : 0 : SwWrtShell &rSh = GetShell();
2323 : : // Tabellenzelle(n) selektiert?
2324 : 0 : sal_Bool bPrepare = sal_True;
2325 : 0 : sal_Bool bTableMode = rSh.IsTableMode();
2326 [ # # ]: 0 : if ( bTableMode )
2327 : : {
2328 : 0 : SfxItemSet aCoreSet( GetPool(),
2329 : : RES_BOX, RES_BOX,
2330 [ # # ]: 0 : SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 );
2331 [ # # ]: 0 : SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
2332 [ # # ]: 0 : aCoreSet.Put( aBoxInfo );
2333 [ # # ]: 0 : rSh.GetTabBorders( aCoreSet );
2334 [ # # ][ # # ]: 0 : rSet.Put( aCoreSet );
[ # # ]
2335 : : }
2336 [ # # ]: 0 : else if ( rSh.IsFrmSelected() )
2337 : : {
2338 [ # # ]: 0 : SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE );
2339 [ # # ]: 0 : rSet.Put( aMgr.GetAttrSet() );
2340 [ # # ]: 0 : bPrepare = sal_False;
2341 : : }
2342 : : else
2343 : : // Umrandungsattribute ganz normal ueber Shell holen
2344 : 0 : rSh.GetCurAttr( rSet );
2345 [ # # ]: 0 : if ( bPrepare )
2346 : 0 : ::PrepareBoxInfo( rSet, rSh );
2347 : : // switch the border toolbox controller mode
2348 [ # # ]: 0 : rSet.Put( SfxBoolItem( SID_BORDER_REDUCED_MODE, !bTableMode ));
2349 : 0 : }
2350 : :
2351 : 0 : void SwBaseShell::ExecDlg(SfxRequest &rReq)
2352 : : {
2353 : 0 : SwWrtShell &rSh = GetShell();
2354 [ # # ]: 0 : Window *pMDI = &GetView().GetViewFrame()->GetWindow();
2355 : : //Damit aus dem Basic keine Dialoge fuer Hintergrund-Views aufgerufen werden:
2356 [ # # ]: 0 : sal_Bool bBackground = (&GetView() != GetActiveView());
2357 : 0 : const SfxPoolItem* pItem = 0;
2358 : 0 : const SfxItemSet* pArgs = rReq.GetArgs();
2359 : :
2360 : 0 : sal_uInt16 nSlot = rReq.GetSlot();
2361 : 0 : const SfxItemSet* pOutSet = 0;
2362 : 0 : bool bDone = false;
2363 [ # # ]: 0 : if(pArgs)
2364 [ # # ][ # # ]: 0 : pArgs->GetItemState( GetPool().GetWhich(nSlot), sal_False, &pItem );
2365 : :
2366 [ # # # # : 0 : switch ( nSlot )
# ]
2367 : : {
2368 : : case FN_FORMAT_TITLEPAGE_DLG:
2369 : : {
2370 [ # # ]: 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
2371 [ # # ]: 0 : VclAbstractDialog* pDlg = pFact->CreateTitlePageDlg( pMDI );
2372 [ # # ]: 0 : pDlg->Execute();
2373 [ # # ][ # # ]: 0 : delete pDlg;
2374 : : }
2375 : 0 : break;
2376 : : case FN_FORMAT_PAGE_COLUMN_DLG:
2377 : : case FN_FORMAT_PAGE_DLG:
2378 : : {
2379 [ # # ]: 0 : if( !bBackground )
2380 : : {
2381 [ # # ]: 0 : const sal_uInt16 nCurIdx = rSh.GetCurPageDesc();
2382 [ # # ]: 0 : const SwPageDesc& rPageDesc = rSh.GetPageDesc( nCurIdx );
2383 : : //temp. View, weil die Shell nach dem Dialog nicht mehr gueltig sein muss
2384 : : //z.B. Kopfzeile ausschalten
2385 : 0 : SwView& rTempView = GetView();
2386 : 0 : sal_uInt16 nPageId = 0;
2387 [ # # ]: 0 : if ( nSlot == FN_FORMAT_PAGE_COLUMN_DLG )
2388 : 0 : nPageId = TP_COLUMN ;
2389 : 0 : rTempView.GetDocShell()->FormatPage(rPageDesc.GetName(),
2390 [ # # ][ # # ]: 0 : nPageId, &rSh );
2391 [ # # ]: 0 : rTempView.InvalidateRulerPos();
2392 : : }
2393 : : }
2394 : 0 : break;
2395 : : case FN_FORMAT_BORDER_DLG:
2396 : : {
2397 [ # # ]: 0 : SfxItemSet aSet( rSh.GetAttrPool(),
2398 : : RES_BOX , RES_SHADOW,
2399 : : SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
2400 [ # # ]: 0 : 0 );
2401 : 0 : SfxAbstractDialog * pDlg = 0;
2402 : : // Tabellenzelle(n) selektiert?
2403 [ # # ]: 0 : if ( rSh.IsTableMode() )
2404 : : {
2405 : : // Umrandungattribute Get/SetTabBorders() setzen
2406 [ # # ]: 0 : ::PrepareBoxInfo( aSet, rSh );
2407 [ # # ]: 0 : rSh.GetTabBorders( aSet );
2408 [ # # ]: 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
2409 : : OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
2410 : :
2411 [ # # ]: 0 : pDlg = pFact->CreateSwBorderDlg( pMDI, aSet, SW_BORDER_MODE_TABLE, RC_DLG_SWBORDERDLG );
2412 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
2413 [ # # ][ # # ]: 0 : if ( pDlg->Execute() == RET_OK )
2414 : : {
2415 [ # # ][ # # ]: 0 : rSh.SetTabBorders( *pDlg->GetOutputItemSet() );
2416 [ # # ]: 0 : pOutSet = pDlg->GetOutputItemSet();
2417 : : }
2418 : : }
2419 [ # # ][ # # ]: 0 : else if ( rSh.IsFrmSelected() )
2420 : : {
2421 : : // Umrandungsattribute ueber Frame-Manager setzen
2422 [ # # ]: 0 : SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE );
2423 [ # # ]: 0 : aSet.Put( aMgr.GetAttrSet() );
2424 : :
2425 [ # # ]: 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
2426 : : OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
2427 : :
2428 [ # # ]: 0 : pDlg = pFact->CreateSwBorderDlg( pMDI, aSet, SW_BORDER_MODE_FRAME, RC_DLG_SWBORDERDLG );
2429 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
2430 [ # # ][ # # ]: 0 : if ( pDlg->Execute() == RET_OK )
2431 : : {
2432 [ # # ][ # # ]: 0 : aMgr.SetAttrSet( *pDlg->GetOutputItemSet() );
2433 [ # # ]: 0 : aMgr.UpdateFlyFrm();
2434 [ # # ]: 0 : pOutSet = pDlg->GetOutputItemSet();
2435 [ # # ]: 0 : }
2436 : : }
2437 : : else
2438 : : {
2439 : : // Umrandungsattribute ganz normal ueber Shell setzen
2440 [ # # ]: 0 : rSh.GetCurAttr( aSet );
2441 [ # # ]: 0 : ::PrepareBoxInfo( aSet, rSh );
2442 : :
2443 [ # # ]: 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
2444 : : OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
2445 : :
2446 [ # # ]: 0 : pDlg = pFact->CreateSwBorderDlg( pMDI, aSet, SW_BORDER_MODE_PARA, RC_DLG_SWBORDERDLG );
2447 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
2448 [ # # ][ # # ]: 0 : if ( pDlg->Execute() == RET_OK )
2449 : : {
2450 [ # # ][ # # ]: 0 : rSh.SetAttr( *pDlg->GetOutputItemSet() );
2451 [ # # ]: 0 : pOutSet = pDlg->GetOutputItemSet();
2452 : : }
2453 : : }
2454 [ # # ]: 0 : if(pOutSet)
2455 : : {
2456 [ # # ]: 0 : rReq.Done(*pOutSet);
2457 : 0 : bDone = true;
2458 : : }
2459 [ # # ][ # # ]: 0 : delete pDlg;
[ # # ]
2460 : : }
2461 : 0 : break;
2462 : : case FN_FORMAT_BACKGROUND_DLG:
2463 : : {
2464 [ # # ]: 0 : SfxItemSet aSet( rSh.GetAttrPool(),
2465 [ # # ]: 0 : RES_BACKGROUND, RES_BACKGROUND );
2466 : :
2467 : 0 : SfxAbstractDialog * pDlg = 0;
2468 [ # # ]: 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
2469 : : OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
2470 : :
2471 : :
2472 : : // Tabellenzelle(n) selektiert?
2473 [ # # ]: 0 : if ( rSh.IsTableMode() )
2474 : : {
2475 : : //Hintergrundattribute der Tabelle holen und in den Set packen
2476 [ # # ]: 0 : SvxBrushItem aBrush(RES_BACKGROUND);
2477 [ # # ]: 0 : rSh.GetBoxBackground( aBrush );
2478 : : pDlg = pFact->CreateSfxDialog( pMDI, aSet,
2479 [ # # ]: 0 : rView.GetViewFrame()->GetFrame().GetFrameInterface(),
2480 [ # # ][ # # ]: 0 : RC_SWDLG_BACKGROUND );
2481 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
2482 [ # # ]: 0 : aSet.Put( aBrush );
2483 [ # # ][ # # ]: 0 : if ( pDlg->Execute() == RET_OK )
2484 : : {
2485 : :
2486 : : rSh.SetBoxBackground( (SvxBrushItem&)
2487 [ # # ][ # # ]: 0 : pDlg->GetOutputItemSet()->Get( RES_BACKGROUND ));
[ # # ]
2488 [ # # ]: 0 : pOutSet = pDlg->GetOutputItemSet();
2489 [ # # ]: 0 : }
2490 : : }
2491 [ # # ][ # # ]: 0 : else if ( rSh.IsFrmSelected() )
2492 : : {
2493 : :
2494 [ # # ]: 0 : rSh.GetFlyFrmAttr( aSet );
2495 : :
2496 : : pDlg = pFact->CreateSfxDialog( pMDI, aSet,
2497 [ # # ]: 0 : rView.GetViewFrame()->GetFrame().GetFrameInterface(),
2498 [ # # ][ # # ]: 0 : RC_SWDLG_BACKGROUND );
2499 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
2500 [ # # ][ # # ]: 0 : if ( pDlg->Execute() == RET_OK )
2501 : : {
2502 [ # # ][ # # ]: 0 : rSh.SetFlyFrmAttr((SfxItemSet &) *pDlg->GetOutputItemSet() );
2503 [ # # ]: 0 : pOutSet = pDlg->GetOutputItemSet();
2504 : : }
2505 : : }
2506 : : else
2507 : : {
2508 : : // Umrandungsattribute ganz normal ueber Shell setzen
2509 [ # # ]: 0 : rSh.GetCurAttr( aSet );
2510 : :
2511 : : pDlg = pFact->CreateSfxDialog( pMDI, aSet,
2512 [ # # ]: 0 : rView.GetViewFrame()->GetFrame().GetFrameInterface(),
2513 [ # # ][ # # ]: 0 : RC_SWDLG_BACKGROUND );
2514 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
2515 [ # # ][ # # ]: 0 : if ( pDlg->Execute() == RET_OK )
2516 : : {
2517 [ # # ][ # # ]: 0 : rSh.SetAttr( *pDlg->GetOutputItemSet() );
2518 [ # # ]: 0 : pOutSet = pDlg->GetOutputItemSet();
2519 : : }
2520 : : }
2521 [ # # ]: 0 : if(pOutSet)
2522 : : {
2523 [ # # ]: 0 : rReq.Done(*pOutSet);
2524 : 0 : bDone = true;
2525 : : }
2526 [ # # ][ # # ]: 0 : delete pDlg;
[ # # ]
2527 : :
2528 : : }
2529 : 0 : break;
2530 : : default:OSL_FAIL("wrong Dispatcher (basesh.cxx)");
2531 : : }
2532 [ # # ]: 0 : if(!bDone)
2533 [ # # ]: 0 : rReq.Done();
2534 : 0 : }
2535 : :
2536 : 57142 : SwWrtShell& SwBaseShell::GetShell()
2537 : : {
2538 : 57142 : return rView.GetWrtShell();
2539 : : }
2540 : :
2541 : 0 : SwWrtShell* SwBaseShell::GetShellPtr()
2542 : : {
2543 : 0 : return rView.GetWrtShellPtr();
2544 : : }
2545 : :
2546 : 0 : void SwBaseShell::InsertTable( SfxRequest& _rRequest )
2547 : : {
2548 : 0 : const SfxItemSet* pArgs = _rRequest.GetArgs();
2549 : 0 : SwWrtShell& rSh = GetShell();
2550 : :
2551 [ # # ]: 0 : if ( !( rSh.GetFrmType( 0, sal_True ) & FRMTYPE_FOOTNOTE ) )
2552 : : {
2553 : 0 : SwView &rTempView = GetView(); // Da GetView() nach Shellwechsel nicht mehr geht
2554 : 0 : sal_Bool bHTMLMode = 0 != (::GetHtmlMode(rTempView.GetDocShell())&HTMLMODE_ON);
2555 : 0 : sal_Bool bCallEndUndo = sal_False;
2556 : :
2557 [ # # ]: 0 : if( !pArgs && rSh.IsSelection() && !rSh.IsInClickToEdit() &&
[ # # # # ]
[ # # ][ # # ]
2558 : 0 : !rSh.IsTableMode() )
2559 : : {
2560 [ # # ]: 0 : const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
2561 : 0 : SwInsertTableOptions aInsTblOpts = pModOpt->GetInsTblFlags(bHTMLMode);
2562 : :
2563 [ # # ]: 0 : rSh.StartUndo(UNDO_INSTABLE);
2564 : 0 : bCallEndUndo = sal_True;
2565 : :
2566 [ # # ]: 0 : sal_Bool bInserted = rSh.TextToTable( aInsTblOpts, '\t', text::HoriOrientation::FULL );
2567 [ # # ]: 0 : rSh.EnterStdMode();
2568 [ # # ]: 0 : if (bInserted)
2569 [ # # ]: 0 : rTempView.AutoCaption(TABLE_CAP);
2570 [ # # ]: 0 : _rRequest.Done();
2571 : : }
2572 : : else
2573 : : {
2574 : 0 : sal_uInt16 nCols = 0;
2575 : 0 : sal_uInt16 nRows = 0;
2576 : 0 : SwInsertTableOptions aInsTblOpts( tabopts::ALL_TBL_INS_ATTR, 1 );
2577 [ # # ][ # # ]: 0 : String aTableName, aAutoName;
2578 : 0 : SwTableAutoFmt* pTAFmt = 0;
2579 : :
2580 [ # # ][ # # ]: 0 : if( pArgs && pArgs->Count() >= 2 )
[ # # ]
2581 : : {
2582 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG( _rRequest, pName, SfxStringItem, FN_INSERT_TABLE, sal_False );
2583 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG( _rRequest, pCols, SfxUInt16Item, SID_ATTR_TABLE_COLUMN, sal_False );
2584 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG( _rRequest, pRows, SfxUInt16Item, SID_ATTR_TABLE_ROW, sal_False );
2585 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG( _rRequest, pFlags, SfxInt32Item, FN_PARAM_1, sal_False );
2586 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG( _rRequest, pAuto, SfxStringItem, FN_PARAM_2, sal_False );
2587 : :
2588 [ # # ]: 0 : if ( pName )
2589 [ # # ]: 0 : aTableName = pName->GetValue();
2590 [ # # ]: 0 : if ( pCols )
2591 : 0 : nCols = pCols->GetValue();
2592 [ # # ]: 0 : if ( pRows )
2593 : 0 : nRows = pRows->GetValue();
2594 [ # # ]: 0 : if ( pAuto )
2595 : : {
2596 [ # # ]: 0 : aAutoName = pAuto->GetValue();
2597 [ # # ]: 0 : if ( aAutoName.Len() )
2598 : : {
2599 [ # # ]: 0 : SwTableAutoFmtTbl aTableTbl;
2600 [ # # ]: 0 : aTableTbl.Load();
2601 [ # # ][ # # ]: 0 : for ( sal_uInt16 n=0; n<aTableTbl.size(); n++ )
2602 : : {
2603 [ # # ][ # # ]: 0 : if ( aTableTbl[n].GetName() == aAutoName )
[ # # ]
2604 : : {
2605 [ # # ][ # # ]: 0 : pTAFmt = new SwTableAutoFmt( aTableTbl[n] );
[ # # ]
2606 : 0 : break;
2607 : : }
2608 [ # # ]: 0 : }
2609 : : }
2610 : : }
2611 : :
2612 [ # # ]: 0 : if ( pFlags )
2613 : 0 : aInsTblOpts.mnInsMode = (sal_uInt16) pFlags->GetValue();
2614 : : else
2615 : : {
2616 [ # # ]: 0 : const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
2617 : 0 : aInsTblOpts = pModOpt->GetInsTblFlags(bHTMLMode);
2618 : : }
2619 : : }
2620 : :
2621 [ # # ][ # # ]: 0 : if( !nCols || !nRows )
2622 : : {
2623 [ # # ]: 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
2624 : : OSL_ENSURE(pFact, "Dialogdiet fail!");
2625 [ # # ]: 0 : AbstractInsTableDlg* pDlg = pFact->CreateInsTableDlg( DLG_INSERT_TABLE, rTempView );
2626 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
2627 [ # # ][ # # ]: 0 : if( RET_OK == pDlg->Execute() )
2628 : : {
2629 [ # # ]: 0 : pDlg->GetValues( aTableName, nRows, nCols, aInsTblOpts, aAutoName, pTAFmt );
2630 : : }
2631 : : else
2632 [ # # ]: 0 : _rRequest.Ignore();
2633 [ # # ][ # # ]: 0 : delete pDlg;
2634 : : }
2635 : :
2636 [ # # ][ # # ]: 0 : if( nCols && nRows )
2637 : : {
2638 : : // record before shell change
2639 [ # # ][ # # ]: 0 : _rRequest.AppendItem( SfxStringItem( FN_INSERT_TABLE, aTableName ) );
[ # # ]
2640 [ # # ]: 0 : if ( aAutoName.Len() )
2641 [ # # ][ # # ]: 0 : _rRequest.AppendItem( SfxStringItem( FN_PARAM_2, aAutoName ) );
[ # # ]
2642 [ # # ][ # # ]: 0 : _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_COLUMN, nCols ) );
[ # # ]
2643 [ # # ][ # # ]: 0 : _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_ROW, nRows ) );
[ # # ]
2644 [ # # ][ # # ]: 0 : _rRequest.AppendItem( SfxInt32Item( FN_PARAM_1, (sal_Int32) aInsTblOpts.mnInsMode ) );
[ # # ]
2645 [ # # ]: 0 : _rRequest.Done();
2646 : :
2647 [ # # ]: 0 : rSh.StartUndo(UNDO_INSTABLE);
2648 : 0 : bCallEndUndo = sal_True;
2649 : :
2650 [ # # ]: 0 : rSh.StartAllAction();
2651 [ # # ][ # # ]: 0 : if( rSh.HasSelection() )
2652 [ # # ]: 0 : rSh.DelRight();
2653 : :
2654 [ # # ]: 0 : rSh.InsertTable( aInsTblOpts, nRows, nCols, text::HoriOrientation::FULL, pTAFmt );
2655 [ # # ]: 0 : rSh.MoveTable( fnTablePrev, fnTableStart );
2656 : :
2657 [ # # ][ # # ]: 0 : if( aTableName.Len() && !rSh.GetTblStyle( aTableName ) )
[ # # ][ # # ]
2658 [ # # ][ # # ]: 0 : rSh.GetTableFmt()->SetName( aTableName );
2659 : :
2660 [ # # ]: 0 : rSh.EndAllAction();
2661 [ # # ]: 0 : rTempView.AutoCaption(TABLE_CAP);
2662 : : }
2663 [ # # ][ # # ]: 0 : delete pTAFmt;
[ # # ][ # # ]
2664 : : }
2665 : :
2666 [ # # ]: 0 : if( bCallEndUndo )
2667 : : {
2668 [ # # ]: 0 : SwRewriter aRewriter;
2669 : :
2670 [ # # ][ # # ]: 0 : if (rSh.GetTableFmt())
2671 : : {
2672 [ # # ][ # # ]: 0 : aRewriter.AddRule(UndoArg1, SW_RESSTR(STR_START_QUOTE));
[ # # ][ # # ]
2673 [ # # ][ # # ]: 0 : aRewriter.AddRule(UndoArg2, rSh.GetTableFmt()->GetName());
2674 [ # # ][ # # ]: 0 : aRewriter.AddRule(UndoArg3, SW_RESSTR(STR_END_QUOTE));
[ # # ][ # # ]
2675 : :
2676 : : }
2677 [ # # ][ # # ]: 0 : rSh.EndUndo(UNDO_INSTABLE, &aRewriter); // wegen moegl. Shellwechsel
2678 : : }
2679 : : }
2680 : 0 : }
2681 : :
2682 : 0 : void SwBaseShell::GetGalleryState( SfxItemSet &rSet )
2683 : : {
2684 : 0 : SwWrtShell &rSh = GetShell();
2685 [ # # ]: 0 : SfxWhichIter aIter( rSet );
2686 [ # # ]: 0 : sal_uInt16 nWhich = aIter.FirstWhich();
2687 [ # # ]: 0 : switch ( nWhich )
2688 : : {
2689 : : case SID_GALLERY_BG_BRUSH:
2690 : : {
2691 [ # # ]: 0 : int nSel = rSh.GetSelectionType();
2692 [ # # ]: 0 : SfxStringListItem aLst( nWhich );
2693 [ # # ]: 0 : std::vector<String> &rLst = aLst.GetList();
2694 : : nParagraphPos = nGraphicPos = nOlePos = nFramePos = nTablePos =
2695 : : nTableRowPos = nTableCellPos = nPagePos =
2696 : 0 : nHeaderPos = nFooterPos = 0;
2697 : 0 : sal_uInt8 nPos = 1;
2698 [ # # ][ # # ]: 0 : rLst.push_back( SW_RESSTR( STR_SWBG_PAGE ) );
[ # # ][ # # ]
2699 : 0 : nPagePos = nPos++;
2700 [ # # ][ # # ]: 0 : sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
2701 : 0 : sal_Bool bHtmlMode = 0 != (nHtmlMode & HTMLMODE_ON);
2702 : :
2703 [ # # ][ # # ]: 0 : if ( (!bHtmlMode || (nHtmlMode & HTMLMODE_FULL_STYLES)) &&
[ # # ]
2704 : : (nSel & nsSelectionType::SEL_TXT) )
2705 : : {
2706 [ # # ][ # # ]: 0 : rLst.push_back( SW_RESSTR( STR_SWBG_PARAGRAPH ) );
[ # # ][ # # ]
2707 : 0 : nParagraphPos = nPos++;
2708 : : }
2709 [ # # ][ # # ]: 0 : if ( (!bHtmlMode || (nHtmlMode & HTMLMODE_SOME_STYLES)) &&
[ # # ]
2710 : : nSel & (nsSelectionType::SEL_TBL|nsSelectionType::SEL_TBL_CELLS) )
2711 : : {
2712 [ # # ][ # # ]: 0 : rLst.push_back( SW_RESSTR( STR_SWBG_TABLE ) );
[ # # ][ # # ]
2713 : 0 : nTablePos = nPos++;
2714 : :
2715 [ # # ]: 0 : if(!bHtmlMode)
2716 : : {
2717 [ # # ][ # # ]: 0 : rLst.push_back( SW_RESSTR( STR_SWBG_TABLE_ROW ) );
[ # # ][ # # ]
2718 : 0 : nTableRowPos = nPos++;
2719 : : }
2720 : :
2721 [ # # ][ # # ]: 0 : rLst.push_back( SW_RESSTR( STR_SWBG_TABLE_CELL) );
[ # # ][ # # ]
2722 : 0 : nTableCellPos = nPos++;
2723 : : }
2724 [ # # ]: 0 : if(!bHtmlMode)
2725 : : {
2726 [ # # ]: 0 : if ( nSel & nsSelectionType::SEL_FRM )
2727 : : {
2728 [ # # ][ # # ]: 0 : rLst.push_back( SW_RESSTR( STR_SWBG_FRAME ) );
[ # # ][ # # ]
2729 : 0 : nFramePos = nPos++;
2730 : : }
2731 [ # # ]: 0 : if ( nSel & nsSelectionType::SEL_GRF )
2732 : : {
2733 [ # # ][ # # ]: 0 : rLst.push_back( SW_RESSTR( STR_SWBG_GRAPHIC ) );
[ # # ][ # # ]
2734 : 0 : nGraphicPos = nPos++;
2735 : : }
2736 [ # # ]: 0 : if ( nSel & nsSelectionType::SEL_OLE )
2737 : : {
2738 [ # # ][ # # ]: 0 : rLst.push_back( SW_RESSTR( STR_SWBG_OLE ) );
[ # # ][ # # ]
2739 : 0 : nOlePos = nPos++;
2740 : : }
2741 [ # # ]: 0 : const sal_uInt16 nType = rSh.GetFrmType(0,sal_True);
2742 [ # # ]: 0 : if ( nType & FRMTYPE_HEADER )
2743 : : {
2744 [ # # ][ # # ]: 0 : rLst.push_back( SW_RESSTR( STR_SWBG_HEADER ) );
[ # # ][ # # ]
2745 : 0 : nHeaderPos = nPos++;
2746 : : }
2747 [ # # ]: 0 : if ( nType & FRMTYPE_FOOTER )
2748 : : {
2749 [ # # ][ # # ]: 0 : rLst.push_back( SW_RESSTR( STR_SWBG_FOOTER ) );
[ # # ][ # # ]
2750 : 0 : nFooterPos = nPos;
2751 : : }
2752 : : }
2753 [ # # ]: 0 : if ( rLst.empty() )
2754 [ # # ]: 0 : rSet.DisableItem( nWhich );
2755 : : else
2756 [ # # ]: 0 : rSet.Put( aLst );
2757 [ # # ]: 0 : break;
2758 : : }
2759 [ # # ]: 0 : }
2760 : 0 : }
2761 : :
2762 : 0 : void SwBaseShell::ExecuteGallery(SfxRequest &rReq)
2763 : : {
2764 : 0 : SwWrtShell &rSh = GetShell();
2765 : 0 : rSh.StartAction();
2766 : 0 : const SfxItemSet* pArgs = rReq.GetArgs();
2767 : 0 : sal_uInt16 nSlot = rReq.GetSlot();
2768 [ # # ]: 0 : switch(nSlot)
2769 : : {
2770 : : case SID_GALLERY_BG_BRUSH:
2771 : : {
2772 [ # # ]: 0 : int nSel = rSh.GetSelectionType();
2773 [ # # ]: 0 : if ( nSel & nsSelectionType::SEL_DRW_TXT )
2774 : : break;
2775 : :
2776 [ # # ]: 0 : sal_uInt8 nPos = (sal_uInt8)((SfxUInt16Item &)pArgs->Get(SID_GALLERY_BG_POS)).GetValue();
2777 : 0 : ++nPos;
2778 : :
2779 [ # # ][ # # ]: 0 : SvxBrushItem aBrush( (SvxBrushItem&)pArgs->Get(SID_GALLERY_BG_BRUSH));
2780 : 0 : aBrush.SetWhich( RES_BACKGROUND );
2781 [ # # ]: 0 : if ( nPos == nParagraphPos )
2782 [ # # ]: 0 : rSh.SetAttr( aBrush );
2783 [ # # ]: 0 : else if ( nPos == nTablePos )
2784 [ # # ]: 0 : rSh.SetTabBackground( aBrush );
2785 [ # # ]: 0 : else if ( nPos == nTableRowPos )
2786 [ # # ]: 0 : rSh.SetRowBackground( aBrush );
2787 [ # # ]: 0 : else if ( nPos == nTableCellPos )
2788 [ # # ]: 0 : rSh.SetBoxBackground( aBrush );
2789 [ # # ][ # # ]: 0 : else if ( nPos == nFramePos || nPos == nGraphicPos || nPos == nOlePos )
[ # # ]
2790 : : {
2791 [ # # ]: 0 : SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);
2792 [ # # ]: 0 : aCoreSet.Put( aBrush );
2793 [ # # ][ # # ]: 0 : rSh.SetFlyFrmAttr( aCoreSet );
2794 : : }
2795 [ # # ][ # # ]: 0 : else if ( nPos == nPagePos || nPos == nHeaderPos || nPos == nFooterPos )
[ # # ]
2796 : : {
2797 [ # # ]: 0 : sal_uInt16 nDesc = rSh.GetCurPageDesc();
2798 [ # # ][ # # ]: 0 : SwPageDesc aDesc( rSh.GetPageDesc( nDesc ) );
2799 [ # # ]: 0 : if ( nPos == nPagePos )
2800 [ # # ]: 0 : aDesc.GetMaster().SetFmtAttr( aBrush );
2801 [ # # ]: 0 : else if ( nPos == nHeaderPos )
2802 : : {
2803 [ # # ][ # # ]: 0 : SwFmtHeader aHead( aDesc.GetMaster().GetHeader() );
2804 [ # # ]: 0 : aHead.GetHeaderFmt()->SetFmtAttr( aBrush );
2805 [ # # ][ # # ]: 0 : aDesc.GetMaster().SetFmtAttr( aHead );
2806 : : }
2807 [ # # ]: 0 : else if ( nPos == nFooterPos )
2808 : : {
2809 [ # # ][ # # ]: 0 : SwFmtFooter aFoot( aDesc.GetMaster().GetFooter() );
2810 [ # # ]: 0 : aFoot.GetFooterFmt()->SetFmtAttr( aBrush );
2811 [ # # ][ # # ]: 0 : aDesc.GetMaster().SetFmtAttr( aFoot );
2812 : : }
2813 [ # # ][ # # ]: 0 : rSh.ChgPageDesc( nDesc, aDesc );
2814 : : }
2815 [ # # ]: 0 : break;
2816 : : }
2817 : : }
2818 : 0 : rSh.EndAction();
2819 : 0 : rReq.Done();
2820 : 0 : }
2821 : :
2822 : 0 : void SwBaseShell::ExecField( SfxRequest& rReq )
2823 : : {
2824 : 0 : sal_uInt16 nSlot = rReq.GetSlot();
2825 [ # # ]: 0 : switch( nSlot )
2826 : : {
2827 : : case FN_CHANGE_DBFIELD:
2828 : : {
2829 : 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
2830 : : OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
2831 : :
2832 : 0 : VclAbstractDialog* pDlg = pFact->CreateSwChangeDBDlg(GetView(), DLG_CHANGE_DB );
2833 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
2834 : 0 : pDlg->Execute();
2835 [ # # ]: 0 : delete pDlg;
2836 : : }
2837 : 0 : break;
2838 : : default:
2839 : : OSL_FAIL("wrong dispatcher");
2840 : : }
2841 : 0 : }
2842 : :
2843 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|