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 <com/sun/star/container/XChild.hpp>
31 : : #include <com/sun/star/embed/XVisualObject.hpp>
32 : : #include <com/sun/star/embed/EmbedMisc.hpp>
33 : : #include <com/sun/star/embed/EmbedStates.hpp>
34 : : #include <com/sun/star/beans/XPropertySet.hpp>
35 : : #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
36 : : #include <com/sun/star/chart2/XChartDocument.hpp>
37 : : #include <com/sun/star/util/XModifiable.hpp>
38 : :
39 : : #include <svx/dialogs.hrc>
40 : :
41 : : #include <math.h>
42 : : #include <hintids.hxx>
43 : : #include <svx/svdview.hxx>
44 : : #include <sot/factory.hxx>
45 : : #include <svl/itemiter.hxx>
46 : : #include <tools/bigint.hxx>
47 : : #include <sot/storage.hxx>
48 : : #include <svtools/insdlg.hxx>
49 : : #include <sfx2/frmdescr.hxx>
50 : : #include <sfx2/ipclient.hxx>
51 : : #include <svtools/ehdl.hxx>
52 : : #include <svtools/soerr.hxx>
53 : : #include <tools/cachestr.hxx>
54 : : #include <unotools/moduleoptions.hxx>
55 : : #include <editeng/sizeitem.hxx>
56 : : #include <editeng/brkitem.hxx>
57 : : #include <editeng/svxacorr.hxx>
58 : : #include <editeng/ulspitem.hxx>
59 : : #include <vcl/graph.hxx>
60 : : #include <vcl/msgbox.hxx>
61 : : #include <sfx2/printer.hxx>
62 : : #include <unotools/charclass.hxx>
63 : : #include <comphelper/storagehelper.hxx>
64 : : #include <svx/svxdlg.hxx>
65 : : #include <svx/extrusionbar.hxx>
66 : : #include <svx/fontworkbar.hxx>
67 : : #include <frmfmt.hxx>
68 : : #include <fmtftn.hxx>
69 : : #include <fmthdft.hxx>
70 : : #include <fmtpdsc.hxx>
71 : : #include <wdocsh.hxx>
72 : : #include <basesh.hxx>
73 : : #include <swmodule.hxx>
74 : : #include <wrtsh.hxx>
75 : : #include <view.hxx>
76 : : #include <uitool.hxx>
77 : : #include <cmdid.h>
78 : : #include <cfgitems.hxx>
79 : : #include <pagedesc.hxx>
80 : : #include <frmmgr.hxx>
81 : : #include <shellio.hxx>
82 : : #include <uinums.hxx> // fuer Anwenden einer
83 : : #include <swundo.hxx> // fuer Undo-Ids
84 : : #include <swcli.hxx>
85 : : #include <poolfmt.hxx>
86 : : #include <wview.hxx>
87 : : #include <edtwin.hxx>
88 : : #include <fmtcol.hxx>
89 : : #include <swtable.hxx>
90 : : #include <caption.hxx>
91 : : #include <viscrs.hxx>
92 : : #include <swdtflvr.hxx>
93 : : #include <crsskip.hxx>
94 : : #include <doc.hxx>
95 : : #include <wrtsh.hrc>
96 : : #include <SwStyleNameMapper.hxx>
97 : : #include <sfx2/request.hxx>
98 : : #include <paratr.hxx>
99 : : #include <ndtxt.hxx>
100 : : #include <editeng/acorrcfg.hxx>
101 : : #include <IMark.hxx>
102 : : #include <sfx2/bindings.hxx>
103 : : #include <svx/dialmgr.hxx>
104 : :
105 : : // -> #111827#
106 : : #include <SwRewriter.hxx>
107 : : #include <comcore.hrc>
108 : : // <- #111827#
109 : :
110 : : #include <toolkit/helper/vclunohelper.hxx>
111 : : #include <sfx2/viewfrm.hxx>
112 : :
113 : : #include "PostItMgr.hxx"
114 : : #include <sfx2/msgpool.hxx>
115 : :
116 : : using namespace sw::mark;
117 : : using namespace com::sun::star;
118 : :
119 : : #define COMMON_INI_LIST \
120 : : fnDrag(&SwWrtShell::BeginDrag),\
121 : : fnSetCrsr(&SwWrtShell::SetCrsr),\
122 : : fnEndDrag(&SwWrtShell::EndDrag),\
123 : : fnKillSel(&SwWrtShell::Ignore),\
124 : : pModeStack(0), \
125 : : ePageMove(MV_NO),\
126 : : pCrsrStack(0), \
127 : : rView(rShell),\
128 : : aNavigationMgr(*this), \
129 : : bDestOnStack(sal_False)
130 : :
131 : : #define BITFLD_INI_LIST \
132 : : bClearMark = \
133 : : bIns = sal_True;\
134 : : bAddMode = \
135 : : bBlockMode = \
136 : : bExtMode = \
137 : : bInSelect = \
138 : : bCopy = \
139 : : bLayoutMode = \
140 : : bNoEdit = \
141 : : bSelWrd = \
142 : : bSelLn = \
143 : : bIsInClickToEdit = \
144 : : mbRetainSelection = sal_False;
145 : :
146 : :
147 : 0 : SvxAutoCorrect* lcl_IsAutoCorr()
148 : : {
149 : 0 : SvxAutoCorrect* pACorr = SvxAutoCorrCfg::Get().GetAutoCorrect();
150 [ # # ]: 0 : if( pACorr && !pACorr->IsAutoCorrFlag( CptlSttSntnc | CptlSttWrd |
[ # # # # ]
151 : : AddNonBrkSpace | ChgOrdinalNumber |
152 : 0 : ChgToEnEmDash | SetINetAttr | Autocorrect ))
153 : 0 : pACorr = 0;
154 : 0 : return pACorr;
155 : : }
156 : :
157 : 0 : void SwWrtShell::NoEdit(sal_Bool bHideCrsr)
158 : : {
159 [ # # ]: 0 : if(bHideCrsr)
160 : 0 : HideCrsr();
161 : 0 : bNoEdit = sal_True;
162 : 0 : }
163 : :
164 : :
165 : :
166 : 0 : void SwWrtShell::Edit()
167 : : {
168 [ # # ]: 0 : if (CanInsert())
169 : : {
170 : 0 : ShowCrsr();
171 : 0 : bNoEdit = sal_False;
172 : : }
173 : 0 : }
174 : :
175 : :
176 : :
177 : 0 : sal_Bool SwWrtShell::IsEndWrd()
178 : : {
179 [ # # ]: 0 : MV_KONTEXT(this);
180 [ # # ][ # # ]: 0 : if(IsEndPara() && !IsSttPara())
[ # # ][ # # ]
[ # # ]
181 : 0 : return sal_True;
182 : :
183 [ # # ][ # # ]: 0 : return IsEndWord();
184 : : }
185 : :
186 : :
187 : : /*------------------------------------------------------------------------
188 : : Beschreibung: String einfuegen
189 : : ------------------------------------------------------------------------*/
190 : :
191 : 4 : void SwWrtShell::InsertByWord( const String & rStr)
192 : : {
193 [ + - ]: 4 : if( rStr.Len() )
194 : : {
195 : 4 : sal_Bool bDelim = GetAppCharClass().isLetterNumeric( rStr, 0 );
196 : 4 : xub_StrLen nPos = 0, nStt = 0;
197 [ + + ]: 118 : for( ; nPos < rStr.Len(); nPos++ )
198 : : {
199 : 114 : sal_Bool bTmpDelim = GetAppCharClass().isLetterNumeric( rStr, nPos );
200 [ + + ]: 114 : if( bTmpDelim != bDelim )
201 : : {
202 [ + - ]: 6 : Insert( rStr.Copy( nStt, nPos - nStt ));
203 : 6 : nStt = nPos;
204 : : }
205 : : }
206 [ + - ]: 4 : if( nStt != nPos )
207 [ + - ]: 4 : Insert( rStr.Copy( nStt, nPos - nStt ));
208 : : }
209 : 4 : }
210 : :
211 : :
212 : 10 : void SwWrtShell::Insert( const String &rStr )
213 : : {
214 : 10 : ResetCursorStack();
215 [ - + ]: 10 : if( !CanInsert() )
216 : 10 : return;
217 : :
218 : 10 : sal_Bool bStarted = sal_False, bHasSel = HasSelection(),
219 : 10 : bCallIns = bIns /*|| bHasSel*/;
220 : 10 : bool bDeleted = false;
221 : :
222 [ - + ][ # # ]: 10 : if( bHasSel || ( !bIns && SelectHiddenRange() ) )
[ - + ][ + - ]
223 : : {
224 : : // nur hier klammern, da das normale Insert schon an der
225 : : // Editshell geklammert ist
226 [ # # ]: 0 : StartAllAction();
227 : :
228 : : // #111827#
229 [ # # ]: 0 : SwRewriter aRewriter;
230 : :
231 [ # # ][ # # ]: 0 : aRewriter.AddRule(UndoArg1, GetCrsrDescr());
[ # # ]
232 [ # # ][ # # ]: 0 : aRewriter.AddRule(UndoArg2, String(SW_RES(STR_YIELDS)));
[ # # ]
233 : : {
234 [ # # ]: 0 : String aTmpStr;
235 [ # # ][ # # ]: 0 : aTmpStr += String(SW_RES(STR_START_QUOTE));
[ # # ]
236 [ # # ]: 0 : aTmpStr += rStr;
237 [ # # ][ # # ]: 0 : aTmpStr += String(SW_RES(STR_END_QUOTE));
[ # # ]
238 : :
239 [ # # ][ # # ]: 0 : aRewriter.AddRule(UndoArg3, rStr);
240 : : }
241 : :
242 [ # # ]: 0 : StartUndo(UNDO_REPLACE, &aRewriter);
243 : 0 : bStarted = sal_True;
244 [ # # ][ # # ]: 0 : bDeleted = DelRight() != 0;
245 : : }
246 : :
247 : : bCallIns ?
248 [ + - ]: 10 : SwEditShell::Insert2( rStr, bDeleted ) : SwEditShell::Overwrite( rStr );
249 : :
250 : :
251 [ - + ]: 10 : if( bStarted )
252 : : {
253 : 0 : EndAllAction();
254 : 0 : EndUndo();
255 : : }
256 : : }
257 : :
258 : : /* Begrenzung auf maximale Hoehe geht nicht, da die maximale Hoehe
259 : : * des aktuellen Frames nicht erfragt werden kann. */
260 : :
261 : :
262 : :
263 : 0 : void SwWrtShell::Insert( const String &rPath, const String &rFilter,
264 : : const Graphic &rGrf, SwFlyFrmAttrMgr *pFrmMgr,
265 : : sal_Bool bRule )
266 : : {
267 [ # # ]: 0 : ResetCursorStack();
268 [ # # ][ # # ]: 0 : if ( !CanInsert() )
269 : 0 : return;
270 : :
271 [ # # ]: 0 : StartAllAction();
272 : :
273 [ # # ]: 0 : SwRewriter aRewriter;
274 [ # # ][ # # ]: 0 : aRewriter.AddRule(UndoArg1, SW_RES(STR_GRAPHIC));
[ # # ]
275 : :
276 [ # # ]: 0 : StartUndo(UNDO_INSERT, &aRewriter);
277 : :
278 [ # # ][ # # ]: 0 : if ( HasSelection() )
279 [ # # ]: 0 : DelRight();
280 : : // eingefuegte Grafik in eigenen Absatz, falls am Ende
281 : : // eines nichtleeren Absatzes
282 [ # # ][ # # ]: 0 : if ( IsEndPara() && !IsSttPara() )
[ # # ][ # # ]
[ # # ]
283 [ # # ]: 0 : SwFEShell::SplitNode();
284 : :
285 [ # # ]: 0 : EnterSelFrmMode();
286 : :
287 : 0 : sal_Bool bSetGrfSize = sal_True;
288 : 0 : sal_Bool bOwnMgr = sal_False;
289 : :
290 [ # # ]: 0 : if ( !pFrmMgr )
291 : : {
292 : 0 : bOwnMgr = sal_True;
293 [ # # ][ # # ]: 0 : pFrmMgr = new SwFlyFrmAttrMgr( sal_True, this, FRMMGR_TYPE_GRF );
294 : :
295 : : // VORSICHT
296 : : // GetAttrSet nimmt einen Abgleich vor
297 : : // Beim Einfuegen ist eine SwFrmSize vorhanden wegen der
298 : : // DEF-Rahmengroesse
299 : : // Diese muss fuer die optimale Groesse explizit entfernt werden
300 [ # # ]: 0 : pFrmMgr->DelAttr(RES_FRM_SIZE);
301 : : }
302 : : else
303 : : {
304 [ # # ]: 0 : Size aSz( pFrmMgr->GetSize() );
305 [ # # ][ # # ]: 0 : if ( !aSz.Width() || !aSz.Height() )
[ # # ]
306 : : {
307 : 0 : aSz.Width() = aSz.Height() = 567;
308 [ # # ]: 0 : pFrmMgr->SetSize( aSz );
309 : : }
310 [ # # ][ # # ]: 0 : else if ( aSz.Width() != DFLT_WIDTH && aSz.Height() != DFLT_HEIGHT )
[ # # ]
311 : 0 : bSetGrfSize = sal_False;
312 : :
313 [ # # ]: 0 : pFrmMgr->SetHeightSizeType(ATT_FIX_SIZE);
314 : :
315 : : }
316 : :
317 : : // Einfuegen der Grafik
318 [ # # ]: 0 : SwFEShell::Insert(rPath, rFilter, &rGrf, &pFrmMgr->GetAttrSet());
319 [ # # ]: 0 : if ( bOwnMgr )
320 [ # # ]: 0 : pFrmMgr->UpdateAttrMgr();
321 : :
322 [ # # ][ # # ]: 0 : if( bSetGrfSize && !bRule )
323 : : {
324 [ # # ]: 0 : Size aGrfSize, aBound = GetGraphicDefaultSize();
325 [ # # ]: 0 : GetGrfSize( aGrfSize );
326 : :
327 : : //Die GrafikSize noch um die Randattribute vergroessern, denn die
328 : : //Zaehlen beim Rahmen mit.
329 [ # # ]: 0 : aGrfSize.Width() += pFrmMgr->CalcWidthBorder();
330 [ # # ]: 0 : aGrfSize.Height()+= pFrmMgr->CalcHeightBorder();
331 : :
332 [ # # ]: 0 : const BigInt aTempWidth( aGrfSize.Width() );
333 [ # # ]: 0 : const BigInt aTempHeight( aGrfSize.Height());
334 : :
335 : : // ggf. Breite anpassen, Hoehe dann proportional verkleinern
336 [ # # ]: 0 : if( aGrfSize.Width() > aBound.Width() )
337 : : {
338 : 0 : aGrfSize.Width() = aBound.Width();
339 [ # # ][ # # ]: 0 : aGrfSize.Height() = ((BigInt)aBound.Width()) * aTempHeight / aTempWidth;
[ # # ][ # # ]
340 : : }
341 : : // ggf. Hoehe anpassen, Breite dann proportional verkleinern
342 [ # # ]: 0 : if( aGrfSize.Height() > aBound.Height() )
343 : : {
344 : 0 : aGrfSize.Height() = aBound.Height();
345 [ # # ][ # # ]: 0 : aGrfSize.Width() = ((BigInt)aBound.Height()) * aTempWidth / aTempHeight;
[ # # ][ # # ]
346 : : }
347 [ # # ]: 0 : pFrmMgr->SetSize( aGrfSize );
348 [ # # ]: 0 : pFrmMgr->UpdateFlyFrm();
349 : : }
350 [ # # ]: 0 : if ( bOwnMgr )
351 [ # # ][ # # ]: 0 : delete pFrmMgr;
352 : :
353 [ # # ]: 0 : EndUndo();
354 [ # # ][ # # ]: 0 : EndAllAction();
355 : : }
356 : :
357 : :
358 : : /*------------------------------------------------------------------------
359 : : Beschreibung: Fuegt ein OLE-Objekt in die CORE ein.
360 : : Wenn kein Object uebergeben wird, so wird eins erzeugt.
361 : : ------------------------------------------------------------------------*/
362 : :
363 : :
364 : 0 : void SwWrtShell::InsertObject( const svt::EmbeddedObjectRef& xRef, SvGlobalName *pName,
365 : : sal_Bool bActivate, sal_uInt16 nSlotId )
366 : : {
367 : 0 : ResetCursorStack();
368 [ # # ]: 0 : if( !CanInsert() )
369 : 0 : return;
370 : :
371 [ # # ]: 0 : if( !xRef.is() )
372 : : {
373 : : // temporary storage
374 [ # # ]: 0 : svt::EmbeddedObjectRef xObj;
375 [ # # ]: 0 : uno::Reference < embed::XStorage > xStor = comphelper::OStorageHelper::GetTemporaryStorage();
376 : 0 : sal_Bool bDoVerb = sal_True;
377 [ # # ]: 0 : if ( pName )
378 : : {
379 [ # # ]: 0 : comphelper::EmbeddedObjectContainer aCnt( xStor );
380 : 0 : ::rtl::OUString aName;
381 : : // TODO/LATER: get aspect?
382 [ # # ][ # # ]: 0 : xObj.Assign( aCnt.CreateEmbeddedObject( pName->GetByteSequence(), aName ), embed::Aspects::MSOLE_CONTENT );
[ # # ][ # # ]
[ # # ]
383 : : }
384 : : else
385 : : {
386 [ # # ]: 0 : SvObjectServerList aServerList;
387 [ # # # ]: 0 : switch (nSlotId)
388 : : {
389 : : case SID_INSERT_OBJECT:
390 : : {
391 [ # # ]: 0 : aServerList.FillInsertObjects();
392 [ # # ][ # # ]: 0 : aServerList.Remove( SwDocShell::Factory().GetClassId() );
[ # # ]
393 : : // Intentionally no break!
394 : : }
395 : :
396 : : // TODO/LATER: recording! Convert properties to items
397 : : case SID_INSERT_PLUGIN:
398 : : case SID_INSERT_FLOATINGFRAME:
399 : : {
400 [ # # ][ # # ]: 0 : SfxSlotPool* pSlotPool = SW_MOD()->GetSlotPool();
401 [ # # ]: 0 : const SfxSlot* pSlot = pSlotPool->GetSlot(nSlotId);
402 : 0 : rtl::OString aCmd(".uno:");
403 : 0 : aCmd += pSlot->GetUnoName();
404 [ # # ]: 0 : SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
405 : : SfxAbstractInsertObjectDialog* pDlg =
406 [ # # ][ # # ]: 0 : pFact->CreateInsertObjectDialog( GetWin(), rtl::OStringToOUString( aCmd, RTL_TEXTENCODING_UTF8 ), xStor, &aServerList );
407 [ # # ]: 0 : if ( pDlg )
408 : : {
409 [ # # ]: 0 : pDlg->Execute();
410 [ # # ]: 0 : bDoVerb = pDlg->IsCreateNew();
411 : 0 : ::rtl::OUString aIconMediaType;
412 [ # # ]: 0 : uno::Reference< io::XInputStream > xIconMetaFile = pDlg->GetIconIfIconified( &aIconMediaType );
413 : 0 : xObj.Assign( pDlg->GetObject(),
414 [ # # ][ # # ]: 0 : xIconMetaFile.is() ? embed::Aspects::MSOLE_ICON : embed::Aspects::MSOLE_CONTENT );
[ # # ]
415 [ # # ]: 0 : if ( xIconMetaFile.is() )
416 [ # # ]: 0 : xObj.SetGraphicStream( xIconMetaFile, aIconMediaType );
417 : :
418 [ # # ][ # # ]: 0 : DELETEZ( pDlg );
419 : : }
420 : :
421 : 0 : break;
422 : : }
423 : :
424 : : default:
425 : 0 : break;
426 : 0 : }
427 : : }
428 : :
429 [ # # ]: 0 : if ( xObj.is() )
430 : : {
431 [ # # ][ # # ]: 0 : if( InsertOleObject( xObj ) && bActivate && bDoVerb )
[ # # ][ # # ]
[ # # ]
432 : : {
433 [ # # ]: 0 : SfxInPlaceClient* pClient = GetView().FindIPClient( xObj.GetObject(), &GetView().GetEditWin() );
434 [ # # ]: 0 : if ( !pClient )
435 : : {
436 [ # # ][ # # ]: 0 : pClient = new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj );
437 : 0 : SetCheckForOLEInCaption( sal_True );
438 : : }
439 : :
440 [ # # ][ # # ]: 0 : if ( xObj.GetViewAspect() == embed::Aspects::MSOLE_ICON )
441 : : {
442 [ # # ]: 0 : SwRect aArea = GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, xObj.GetObject() );
443 [ # # ]: 0 : aArea.Pos() += GetAnyCurRect( RECT_FLY_EMBEDDED, 0, xObj.GetObject() ).Pos();
444 [ # # ]: 0 : MapMode aMapMode( MAP_TWIP );
445 [ # # ]: 0 : Size aSize = xObj.GetSize( &aMapMode );
446 : 0 : aArea.Width( aSize.Width() );
447 : 0 : aArea.Height( aSize.Height() );
448 [ # # ][ # # ]: 0 : RequestObjectResize( aArea, xObj.GetObject() );
449 : : }
450 : : else
451 [ # # ]: 0 : CalcAndSetScale( xObj );
452 : :
453 : : //#50270# Error brauchen wir nicht handeln, das erledigt das
454 : : //DoVerb in der SfxViewShell
455 [ # # ]: 0 : pClient->DoVerb( SVVERB_SHOW );
456 : :
457 : : // TODO/LATER: set document name - should be done in Client
458 : : }
459 [ # # ]: 0 : }
460 : : }
461 : : else
462 : : {
463 [ # # ]: 0 : if( HasSelection() )
464 : 0 : DelRight();
465 : 0 : InsertOleObject( xRef );
466 : : }
467 : : }
468 : :
469 : : /*------------------------------------------------------------------------
470 : : Beschreibung: Object in die Core einfuegen.
471 : : Vom ClipBoard oder Insert
472 : : ------------------------------------------------------------------------*/
473 : :
474 : 0 : sal_Bool SwWrtShell::InsertOleObject( const svt::EmbeddedObjectRef& xRef, SwFlyFrmFmt **pFlyFrmFmt )
475 : : {
476 [ # # ]: 0 : ResetCursorStack();
477 [ # # ]: 0 : StartAllAction();
478 : :
479 [ # # ]: 0 : StartUndo(UNDO_INSERT);
480 : :
481 : : //Some differences between StarMath and any other objects:
482 : : //1. Selections should be deleted. For StarMath the Text should be
483 : : // passed to the Object
484 : : //2. If the cursor is at the end of an non empty paragraph a paragraph
485 : : // break should be insertet. StarMath objects are character bound and
486 : : // no break should be inserted.
487 : : //3. If an selektion is passed to a StarMath object, this object should
488 : : // not be activated. sal_False should be returned then.
489 : 0 : sal_Bool bStarMath = sal_True;
490 : 0 : sal_Bool bActivate = sal_True;
491 : :
492 : : // set parent to get correct VisArea(in case of object needing parent printer)
493 [ # # ]: 0 : uno::Reference < container::XChild > xChild( xRef.GetObject(), uno::UNO_QUERY );
494 [ # # ]: 0 : if ( xChild.is() )
495 [ # # ][ # # ]: 0 : xChild->setParent( pDoc->GetDocShell()->GetModel() );
[ # # ]
496 : :
497 [ # # ][ # # ]: 0 : SvGlobalName aCLSID( xRef->getClassID() );
[ # # ][ # # ]
498 [ # # ]: 0 : bStarMath = ( SotExchange::IsMath( aCLSID ) != 0 );
499 [ # # ]: 0 : if( IsSelection() )
500 : : {
501 [ # # ]: 0 : if( bStarMath )
502 : : {
503 [ # # ]: 0 : String aMathData;
504 [ # # ]: 0 : GetSelectedText( aMathData, GETSELTXT_PARABRK_TO_ONLYCR );
505 : :
506 [ # # ][ # # ]: 0 : if( aMathData.Len() && svt::EmbeddedObjectRef::TryRunningState( xRef.GetObject() ) )
[ # # ][ # # ]
507 : : {
508 [ # # ][ # # ]: 0 : uno::Reference < beans::XPropertySet > xSet( xRef->getComponent(), uno::UNO_QUERY );
[ # # ]
509 [ # # ]: 0 : if ( xSet.is() )
510 : : {
511 : : try
512 : : {
513 [ # # ][ # # ]: 0 : xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Formula")), uno::makeAny( ::rtl::OUString( aMathData ) ) );
[ # # ][ # # ]
[ # # ][ # # ]
514 : 0 : bActivate = sal_False;
515 : : }
516 [ # # ]: 0 : catch (const uno::Exception&)
517 : : {
518 : : }
519 : 0 : }
520 [ # # ]: 0 : }
521 : : }
522 [ # # ]: 0 : DelRight();
523 : : }
524 : :
525 [ # # ]: 0 : if ( !bStarMath )
526 [ # # ]: 0 : SwFEShell::SplitNode( sal_False, sal_False );
527 : :
528 [ # # ]: 0 : EnterSelFrmMode();
529 : :
530 [ # # ]: 0 : SwFlyFrmAttrMgr aFrmMgr( sal_True, this, FRMMGR_TYPE_OLE );
531 [ # # ]: 0 : aFrmMgr.SetHeightSizeType(ATT_FIX_SIZE);
532 : :
533 : 0 : SwRect aBound;
534 [ # # ][ # # ]: 0 : CalcBoundRect( aBound, aFrmMgr.GetAnchor() );
535 : :
536 : : //The Size should be suggested by the OLE server
537 [ # # ]: 0 : MapMode aMapMode( MAP_TWIP );
538 [ # # ]: 0 : Size aSz = xRef.GetSize( &aMapMode );
539 : :
540 : : //Object size can be limited
541 [ # # ]: 0 : if ( aSz.Width() > aBound.Width() )
542 : : {
543 : : //Immer proportional begrenzen.
544 : 0 : aSz.Height() = aSz.Height() * aBound.Width() / aSz.Width();
545 : 0 : aSz.Width() = aBound.Width();
546 : : }
547 [ # # ]: 0 : aFrmMgr.SetSize( aSz );
548 [ # # ]: 0 : SwFlyFrmFmt *pFmt = SwFEShell::InsertObject( xRef, &aFrmMgr.GetAttrSet() );
549 : :
550 : : // --> #i972#
551 [ # # ][ # # ]: 0 : if ( bStarMath && pDoc->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) )
[ # # ][ # # ]
552 [ # # ]: 0 : AlignFormulaToBaseline( xRef.GetObject() );
553 : :
554 [ # # ]: 0 : if (pFlyFrmFmt)
555 : 0 : *pFlyFrmFmt = pFmt;
556 : :
557 [ # # ][ # # ]: 0 : if ( SotExchange::IsChart( aCLSID ) )
558 : : {
559 [ # # ]: 0 : uno::Reference< embed::XEmbeddedObject > xEmbeddedObj( xRef.GetObject(), uno::UNO_QUERY );
560 [ # # ]: 0 : if ( xEmbeddedObj.is() )
561 : : {
562 : 0 : bool bDisableDataTableDialog = false;
563 [ # # ]: 0 : svt::EmbeddedObjectRef::TryRunningState( xEmbeddedObj );
564 [ # # ][ # # ]: 0 : uno::Reference< beans::XPropertySet > xProps( xEmbeddedObj->getComponent(), uno::UNO_QUERY );
[ # # ]
565 [ # # ][ # # ]: 0 : if ( xProps.is() &&
[ # # # # ]
566 [ # # ][ # # ]: 0 : ( xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableDataTableDialog" ) ) ) >>= bDisableDataTableDialog ) &&
[ # # ][ # # ]
[ # # ]
[ # # # # ]
567 : : bDisableDataTableDialog )
568 : : {
569 [ # # ]: 0 : xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableDataTableDialog" ) ),
570 [ # # ][ # # ]: 0 : uno::makeAny( sal_False ) );
[ # # ]
571 [ # # ]: 0 : xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableComplexChartTypes" ) ),
572 [ # # ][ # # ]: 0 : uno::makeAny( sal_False ) );
[ # # ]
573 [ # # ]: 0 : uno::Reference< util::XModifiable > xModifiable( xProps, uno::UNO_QUERY );
574 [ # # ]: 0 : if ( xModifiable.is() )
575 : : {
576 [ # # ][ # # ]: 0 : xModifiable->setModified( sal_True );
577 : 0 : }
578 : 0 : }
579 : 0 : }
580 : : }
581 : :
582 [ # # ]: 0 : EndAllAction();
583 [ # # ]: 0 : GetView().AutoCaption(OLE_CAP, &aCLSID);
584 : :
585 [ # # ]: 0 : SwRewriter aRewriter;
586 : :
587 [ # # ]: 0 : if ( bStarMath )
588 [ # # ][ # # ]: 0 : aRewriter.AddRule(UndoArg1, SW_RES(STR_MATH_FORMULA));
[ # # ]
589 [ # # ][ # # ]: 0 : else if ( SotExchange::IsChart( aCLSID ) )
590 [ # # ][ # # ]: 0 : aRewriter.AddRule(UndoArg1, SW_RES(STR_CHART));
[ # # ]
591 : : else
592 [ # # ][ # # ]: 0 : aRewriter.AddRule(UndoArg1, SW_RES(STR_OLE));
[ # # ]
593 : :
594 [ # # ]: 0 : EndUndo(UNDO_INSERT, &aRewriter);
595 : :
596 [ # # ][ # # ]: 0 : return bActivate;
[ # # ][ # # ]
597 : : }
598 : :
599 : : /*------------------------------------------------------------------------
600 : : Beschreibung: Das aktuelle selektierte OLE-Objekt wird mit dem
601 : : Verb in den Server geladen.
602 : : ------------------------------------------------------------------------*/
603 : :
604 : :
605 : :
606 : 0 : void SwWrtShell::LaunchOLEObj( long nVerb )
607 : : {
608 [ # # # # ]: 0 : if ( GetCntType() == CNT_OLE &&
[ # # ]
609 : 0 : !GetView().GetViewFrame()->GetFrame().IsInPlace() )
610 : : {
611 : 0 : svt::EmbeddedObjectRef& xRef = GetOLEObject();
612 : : OSL_ENSURE( xRef.is(), "OLE not found" );
613 : 0 : SfxInPlaceClient* pCli=0;
614 : :
615 : 0 : pCli = GetView().FindIPClient( xRef.GetObject(), &GetView().GetEditWin() );
616 [ # # ]: 0 : if ( !pCli )
617 [ # # ]: 0 : pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xRef );
618 : :
619 : 0 : ((SwOleClient*)pCli)->SetInDoVerb( sal_True );
620 : :
621 : 0 : CalcAndSetScale( xRef );
622 : 0 : pCli->DoVerb( nVerb );
623 : :
624 : 0 : ((SwOleClient*)pCli)->SetInDoVerb( sal_False );
625 : 0 : CalcAndSetScale( xRef );
626 : : }
627 : 0 : }
628 : :
629 : 0 : void SwWrtShell::MoveObjectIfActive( svt::EmbeddedObjectRef& xObj, const Point& rOffset )
630 : : {
631 : : try
632 : : {
633 [ # # ][ # # ]: 0 : sal_Int32 nState = xObj->getCurrentState();
634 [ # # ][ # # ]: 0 : if ( nState == ::com::sun::star::embed::EmbedStates::INPLACE_ACTIVE
635 : : || nState == ::com::sun::star::embed::EmbedStates::UI_ACTIVE )
636 : : {
637 : : SfxInPlaceClient* pCli =
638 [ # # ]: 0 : GetView().FindIPClient( xObj.GetObject(), &(GetView().GetEditWin()) );
639 [ # # ]: 0 : if ( pCli )
640 : : {
641 [ # # ]: 0 : Rectangle aArea = pCli->GetObjArea();
642 [ # # ]: 0 : aArea += rOffset;
643 [ # # ]: 0 : pCli->SetObjArea( aArea );
644 : : }
645 : : }
646 : : }
647 : 0 : catch (const uno::Exception&)
648 : : {
649 : : }
650 [ # # ]: 0 : }
651 : :
652 : :
653 : 865 : void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
654 : : const SwRect *pFlyPrtRect,
655 : : const SwRect *pFlyFrmRect,
656 : : const bool bNoTxtFrmPrtAreaChanged )
657 : : {
658 : : //Einstellen der Skalierung am Client. Diese ergibt sich aus der Differenz
659 : : //zwischen der VisArea des Objektes und der ObjArea.
660 : : OSL_ENSURE( xObj.is(), "ObjectRef not valid" );
661 : :
662 [ + - ]: 865 : sal_Int64 nAspect = xObj.GetViewAspect();
663 [ + - ]: 865 : if ( nAspect == embed::Aspects::MSOLE_ICON )
664 : : return; // the replacement image is completely controlled by container in this case
665 : :
666 : 865 : sal_Int64 nMisc = 0;
667 : 865 : sal_Bool bLinkingChart = sal_False;
668 : :
669 : : try
670 : : {
671 [ + - ][ + - ]: 865 : nMisc = xObj->getStatus( nAspect );
672 : :
673 : : //Das kann ja wohl nur ein nicht aktives Objekt sein. Diese bekommen
674 : : //auf Wunsch die neue Groesse als VisArea gesetzt (StarChart)
675 [ + + ]: 865 : if( embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE & nMisc )
676 : : {
677 : : // TODO/MBA: testing
678 : : SwRect aRect( pFlyPrtRect ? *pFlyPrtRect
679 [ - + ][ # # ]: 11 : : GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, xObj.GetObject() ));
680 [ + - ]: 11 : if( !aRect.IsEmpty() )
681 : : {
682 : : // TODO/LEAN: getMapUnit can switch object to running state
683 : : // xObj.TryRunningState();
684 : :
685 [ + - ][ + - ]: 11 : MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
[ + - ]
686 : :
687 : : // TODO/LATER: needs complete VisArea?!
688 [ + - ][ + - ]: 11 : Size aSize( OutputDevice::LogicToLogic( aRect.SVRect(), MAP_TWIP, aUnit ).GetSize() );
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ]
689 : 11 : awt::Size aSz;
690 : 11 : aSz.Width = aSize.Width();
691 : 11 : aSz.Height = aSize.Height();
692 [ + - ][ + - ]: 11 : xObj->setVisualAreaSize( nAspect, aSz );
693 : : // #i48419# - action 'UpdateReplacement' doesn't
694 : : // have to change the modified state of the document.
695 : : // This is only a workaround for the defect, that this action
696 : : // modifies a document after load, because unnecessarily the
697 : : // replacement graphic is updated, in spite of the fact that
698 : : // nothing has been changed.
699 : : // If the replacement graphic changes by this action, the document
700 : : // will be already modified via other mechanisms.
701 : : {
702 : 11 : bool bResetEnableSetModified(false);
703 [ + - ][ + + ]: 11 : if ( GetDoc()->GetDocShell()->IsEnableSetModified() )
704 : : {
705 [ + - ]: 10 : GetDoc()->GetDocShell()->EnableSetModified( sal_False );
706 : 10 : bResetEnableSetModified = true;
707 : : }
708 : :
709 : : //#i79576# don't destroy chart replacement images on load
710 : : //#i79578# don't request a new replacement image for charts to often
711 : : //a chart sends a modified call to the framework if it was changed
712 : : //thus the replacement update is already handled elsewhere
713 [ + - ][ + - ]: 11 : if ( !SotExchange::IsChart( xObj->getClassID() ) )
[ + - ][ + - ]
[ + - ][ + - ]
[ - + ]
714 [ # # ]: 0 : xObj.UpdateReplacement();
715 : :
716 [ + + ]: 11 : if ( bResetEnableSetModified )
717 : : {
718 [ + - ]: 11 : GetDoc()->GetDocShell()->EnableSetModified( sal_True );
719 : : }
720 : : }
721 : : }
722 : :
723 : : // TODO/LATER: this is only a workaround,
724 [ + - ][ + - ]: 11 : uno::Reference< chart2::XChartDocument > xChartDocument( xObj->getComponent(), uno::UNO_QUERY );
[ + - ]
725 [ + - ][ + - ]: 11 : bLinkingChart = ( xChartDocument.is() && !xChartDocument->hasInternalDataProvider() );
[ - + ][ # # ]
[ + - ]
726 : : }
727 : : }
728 [ # # ]: 0 : catch (const uno::Exception&)
729 : : {
730 : : // TODO/LATER: handle the error
731 : : return;
732 : : }
733 : :
734 [ + - ]: 865 : SfxInPlaceClient* pCli = GetView().FindIPClient( xObj.GetObject(), &GetView().GetEditWin() );
735 [ + + ]: 865 : if ( !pCli )
736 : : {
737 [ + - ][ + - ]: 863 : if ( (embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY & nMisc)
[ - + ][ # # ]
738 : : || bLinkingChart
739 : : // TODO/LATER: ResizeOnPrinterChange
740 : : //|| SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & xObj->GetMiscStatus()
741 : : // --> OD #i117189# - refine condition for non-resizable objects
742 : : // non-resizable objects need to be set the size back by this method
743 : : || ( bNoTxtFrmPrtAreaChanged && nMisc & embed::EmbedMisc::EMBED_NEVERRESIZE ) )
744 : : {
745 [ # # ][ # # ]: 0 : pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj );
[ # # # ]
746 : : }
747 : : else
748 : : return;
749 : : }
750 : :
751 : : // TODO/LEAN: getMapUnit can switch object to running state
752 : : // xObj.TryRunningState();
753 : :
754 : 2 : awt::Size aSize;
755 : : try
756 : : {
757 [ + - ][ + - ]: 2 : aSize = xObj->getVisualAreaSize( nAspect );
758 : : }
759 [ # # ]: 0 : catch (const embed::NoVisualAreaSizeException&)
760 : : {
761 : : OSL_FAIL("Can't get visual area size!\n" );
762 : : // the scaling will not be done
763 : : }
764 [ # # ]: 0 : catch (const uno::Exception&)
765 : : {
766 : : // TODO/LATER: handle the error
767 : : OSL_FAIL("Can't get visual area size!\n" );
768 : : return;
769 : : }
770 : :
771 : 2 : Size _aVisArea( aSize.Width, aSize.Height );
772 : :
773 [ + - ]: 2 : Fraction aScaleWidth( 1, 1 );
774 [ + - ]: 2 : Fraction aScaleHeight( 1, 1 );
775 : :
776 : 2 : sal_Bool bUseObjectSize = sal_False;
777 : :
778 : : // solange keine vernuenftige Size vom Object kommt, kann nichts
779 : : // skaliert werden
780 [ + - ][ + - ]: 2 : if( _aVisArea.Width() && _aVisArea.Height() )
[ + - ]
781 : : {
782 [ + - ]: 2 : const MapMode aTmp( MAP_TWIP );
783 [ + - ][ + - ]: 2 : MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
[ + - ]
784 [ + - ][ + - ]: 2 : _aVisArea = OutputDevice::LogicToLogic( _aVisArea, aUnit, aTmp);
[ + - ]
785 : 2 : Size aObjArea;
786 [ + - ]: 2 : if ( pFlyPrtRect )
787 : 2 : aObjArea = pFlyPrtRect->SSize();
788 : : else
789 [ # # ]: 0 : aObjArea = GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, xObj.GetObject() ).SSize();
790 : :
791 : : // differ the aObjArea and _aVisArea by 1 Pixel then set new VisArea
792 : : long nX, nY;
793 [ + - ]: 2 : SwSelPaintRects::Get1PixelInLogic( *this, &nX, &nY );
794 [ - + ]: 4 : if( !( _aVisArea.Width() - nX <= aObjArea.Width() &&
795 : 2 : _aVisArea.Width() + nX >= aObjArea.Width() &&
796 : 2 : _aVisArea.Height()- nY <= aObjArea.Height()&&
797 [ - + ][ + - : 6 : _aVisArea.Height()+ nY >= aObjArea.Height() ))
+ - + - ]
798 : : {
799 : : // TODO/LATER: MISCSTATUS_RESIZEONPRINTERCHANGE
800 : : /*
801 : : if( SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & nMisc )
802 : : {
803 : : //This type of objects should never be resized.
804 : : //If this request comes from the Writer core (inaktive Object
805 : : //ist resized), the Object should be resized too.
806 : : //If this request comes from the Object itself, the Frame
807 : : //in the Writer core should be resized.
808 : : if ( pFlyPrtRect ) //Request from core?
809 : : {
810 : : xObj->SetVisArea( OutputDevice::LogicToLogic(
811 : : pFlyPrtRect->SVRect(), MAP_TWIP, xObj->GetMapUnit() ));
812 : : }
813 : : else
814 : : {
815 : : SwRect aTmp( Point( LONG_MIN, LONG_MIN ), _aVisArea );
816 : : RequestObjectResize( aTmp, xObj );
817 : : }
818 : : //Der Rest erledigt sich, weil wir eh wiederkommen sollten, evtl.
819 : : //sogar rekursiv.
820 : : return;
821 : : }
822 : : else*/
823 : :
824 [ # # ]: 0 : if ( nMisc & embed::EmbedMisc::EMBED_NEVERRESIZE )
825 : : {
826 : : // the object must not be scaled, the size stored in object must be used for restoring
827 : 0 : bUseObjectSize = sal_True;
828 : : }
829 : : else
830 : : {
831 [ # # ][ # # ]: 0 : aScaleWidth = Fraction( aObjArea.Width(), _aVisArea.Width() );
832 [ # # ][ # # ]: 0 : aScaleHeight = Fraction( aObjArea.Height(), _aVisArea.Height());
833 : : }
834 [ + - ]: 2 : }
835 : : }
836 : :
837 : : //Jetzt ist auch der guenstige Zeitpunkt die ObjArea einzustellen.
838 : : //Die Scalierung muss beruecksichtigt werden.
839 : 2 : SwRect aArea;
840 [ + - ]: 2 : if ( pFlyPrtRect )
841 : : {
842 : 2 : aArea = *pFlyPrtRect;
843 : 2 : aArea += pFlyFrmRect->Pos();
844 : : }
845 : : else
846 : : {
847 [ # # ]: 0 : aArea = GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, xObj.GetObject() );
848 [ # # ]: 0 : aArea.Pos() += GetAnyCurRect( RECT_FLY_EMBEDDED, 0, xObj.GetObject() ).Pos();
849 : : }
850 : :
851 [ - + ]: 2 : if ( bUseObjectSize )
852 : : {
853 : : // --> this moves non-resizable object so that when adding borders the baseline remains the same
854 [ # # ][ # # ]: 0 : const SwFlyFrmFmt *pFlyFrmFmt = dynamic_cast< const SwFlyFrmFmt * >( GetFlyFrmFmt() );
855 : : OSL_ENSURE( pFlyFrmFmt, "Could not find fly frame." );
856 [ # # ]: 0 : if ( pFlyFrmFmt )
857 : : {
858 : 0 : const Point &rPoint = pFlyFrmFmt->GetLastFlyFrmPrtRectPos();
859 : : SwRect aRect( pFlyPrtRect ? *pFlyPrtRect
860 [ # # ][ # # ]: 0 : : GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, xObj.GetObject() ));
861 : 0 : aArea += rPoint - aRect.Pos(); // adjust area by diff of printing area position in order to keep baseline alignment correct.
862 : : }
863 : 0 : aArea.Width ( _aVisArea.Width() );
864 : 0 : aArea.Height( _aVisArea.Height() );
865 [ # # ]: 0 : RequestObjectResize( aArea, xObj.GetObject() );
866 : : }
867 : : else
868 : : {
869 [ + - ][ + - ]: 2 : aArea.Width ( Fraction( aArea.Width() ) / pCli->GetScaleWidth() );
[ + - ][ + - ]
870 [ + - ][ + - ]: 2 : aArea.Height( Fraction( aArea.Height() ) / pCli->GetScaleHeight());
[ + - ][ + - ]
871 : : }
872 : :
873 [ + - ][ + - ]: 865 : pCli->SetObjAreaAndScale( aArea.SVRect(), aScaleWidth, aScaleHeight );
874 : : }
875 : :
876 : :
877 : :
878 : 0 : void SwWrtShell::ConnectObj( svt::EmbeddedObjectRef& xObj, const SwRect &rPrt,
879 : : const SwRect &rFrm )
880 : : {
881 : 0 : SfxInPlaceClient* pCli = GetView().FindIPClient( xObj.GetObject(), &GetView().GetEditWin());
882 [ # # ]: 0 : if ( !pCli )
883 [ # # ]: 0 : pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj );
884 : 0 : CalcAndSetScale( xObj, &rPrt, &rFrm );
885 : 0 : }
886 : :
887 : : /*------------------------------------------------------------------------
888 : : Beschreibung: Einfuegen harter Seitenumbruch;
889 : : Selektionen werden ueberschrieben
890 : : ------------------------------------------------------------------------*/
891 : :
892 : :
893 : :
894 : 0 : void SwWrtShell::InsertPageBreak(const String *pPageDesc, sal_uInt16 nPgNum )
895 : : {
896 : 0 : ResetCursorStack();
897 [ # # ]: 0 : if( CanInsert() )
898 : : {
899 [ # # ]: 0 : ACT_KONTEXT(this);
900 [ # # ]: 0 : StartUndo(UNDO_UI_INSERT_PAGE_BREAK);
901 : :
902 [ # # ][ # # ]: 0 : if ( !IsCrsrInTbl() )
903 : : {
904 [ # # ][ # # ]: 0 : if(HasSelection())
905 [ # # ]: 0 : DelRight();
906 [ # # ]: 0 : SwFEShell::SplitNode();
907 : : // delete the numbered attribute of the last line if the last line is empty
908 [ # # ][ # # ]: 0 : GetDoc()->ClearLineNumAttrs( *GetCrsr()->GetPoint() );
909 : : }
910 : :
911 : : const SwPageDesc *pDesc = pPageDesc
912 [ # # ][ # # ]: 0 : ? FindPageDescByName( *pPageDesc, sal_True ) : 0;
913 [ # # ]: 0 : if( pDesc )
914 : : {
915 [ # # ]: 0 : SwFmtPageDesc aDesc( pDesc );
916 : 0 : aDesc.SetNumOffset( nPgNum );
917 [ # # ][ # # ]: 0 : SetAttr( aDesc );
918 : : }
919 : : else
920 [ # # ][ # # ]: 0 : SetAttr( SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK) );
[ # # ]
921 [ # # ][ # # ]: 0 : EndUndo(UNDO_UI_INSERT_PAGE_BREAK);
922 : : }
923 : 0 : }
924 : : /*------------------------------------------------------------------------
925 : : Beschreibung: Einfuegen harter Zeilenumbruch;
926 : : Selektionen werden ueberschrieben
927 : : ------------------------------------------------------------------------*/
928 : :
929 : :
930 : 0 : void SwWrtShell::InsertLineBreak()
931 : : {
932 : 0 : ResetCursorStack();
933 [ # # ]: 0 : if( CanInsert() )
934 : : {
935 [ # # ]: 0 : if(HasSelection())
936 : 0 : DelRight();
937 : :
938 : 0 : const sal_Unicode cIns = 0x0A;
939 : 0 : SvxAutoCorrect* pACorr = lcl_IsAutoCorr();
940 [ # # ]: 0 : if( pACorr )
941 : 0 : AutoCorrect( *pACorr, cIns );
942 : : else
943 [ # # ][ # # ]: 0 : SwWrtShell::Insert( rtl::OUString( cIns ) );
[ # # ]
944 : : }
945 : 0 : }
946 : : /*------------------------------------------------------------------------
947 : : Beschreibung: Einfuegen harter Spaltenumbruch;
948 : : Selektionen werden ueberschrieben
949 : : ------------------------------------------------------------------------*/
950 : :
951 : :
952 : 0 : void SwWrtShell::InsertColumnBreak()
953 : : {
954 [ # # ]: 0 : ACT_KONTEXT(this);
955 [ # # ]: 0 : ResetCursorStack();
956 [ # # ][ # # ]: 0 : if( CanInsert() )
957 : : {
958 [ # # ]: 0 : StartUndo(UNDO_UI_INSERT_COLUMN_BREAK);
959 : :
960 [ # # ][ # # ]: 0 : if ( !IsCrsrInTbl() )
961 : : {
962 [ # # ][ # # ]: 0 : if(HasSelection())
963 [ # # ]: 0 : DelRight();
964 [ # # ]: 0 : SwFEShell::SplitNode( sal_False, sal_False );
965 : : }
966 [ # # ][ # # ]: 0 : SetAttr(SvxFmtBreakItem(SVX_BREAK_COLUMN_BEFORE, RES_BREAK));
[ # # ]
967 : :
968 [ # # ]: 0 : EndUndo(UNDO_UI_INSERT_COLUMN_BREAK);
969 [ # # ]: 0 : }
970 : 0 : }
971 : :
972 : : /*------------------------------------------------------------------------
973 : : Beschreibung: Einfuegen Fussnote
974 : : Parameter: rStr -- optionales Fussnotenzeichen
975 : : ------------------------------------------------------------------------*/
976 : :
977 : :
978 : 0 : void SwWrtShell::InsertFootnote(const String &rStr, sal_Bool bEndNote, sal_Bool bEdit )
979 : : {
980 : 0 : ResetCursorStack();
981 [ # # ]: 0 : if( CanInsert() )
982 : : {
983 [ # # ][ # # ]: 0 : if(HasSelection())
984 : : {
985 : : //collapse cursor to the end
986 [ # # ][ # # ]: 0 : if(!IsCrsrPtAtEnd())
987 [ # # ]: 0 : SwapPam();
988 [ # # ]: 0 : ClearMark();
989 : : }
990 [ # # ][ # # ]: 0 : SwPosition aPos = *GetCrsr()->GetPoint();
991 [ # # ]: 0 : SwFmtFtn aFootNote( bEndNote );
992 [ # # ]: 0 : if(rStr.Len())
993 [ # # ]: 0 : aFootNote.SetNumStr( rStr );
994 : :
995 [ # # ]: 0 : SetAttr(aFootNote);
996 : :
997 [ # # ]: 0 : if( bEdit )
998 : : {
999 : : // zur Bearbeiung des Fussnotentextes
1000 [ # # ]: 0 : Left(CRSR_SKIP_CHARS, sal_False, 1, sal_False );
1001 [ # # ]: 0 : GotoFtnTxt();
1002 : : }
1003 [ # # ][ # # ]: 0 : aNavigationMgr.addEntry(aPos);
[ # # ]
1004 : : }
1005 : 0 : }
1006 : : /*------------------------------------------------------------------------
1007 : : Beschreibung: SplitNode; hier auch, da
1008 : : - selektierter Inhalt geloescht wird;
1009 : : - der Cursorstack gfs. zurueckgesetzt wird.
1010 : : ------------------------------------------------------------------------*/
1011 : :
1012 : :
1013 : 0 : void SwWrtShell::SplitNode( sal_Bool bAutoFmt, sal_Bool bCheckTableStart )
1014 : : {
1015 : 0 : ResetCursorStack();
1016 [ # # ]: 0 : if( CanInsert() )
1017 : : {
1018 [ # # ]: 0 : ACT_KONTEXT(this);
1019 : :
1020 [ # # ]: 0 : rView.GetEditWin().FlushInBuffer();
1021 [ # # ]: 0 : sal_Bool bHasSel = HasSelection();
1022 [ # # ]: 0 : if( bHasSel )
1023 : : {
1024 [ # # ]: 0 : StartUndo( UNDO_INSERT );
1025 [ # # ]: 0 : DelRight();
1026 : : }
1027 : :
1028 [ # # ]: 0 : SwFEShell::SplitNode( bAutoFmt, bCheckTableStart );
1029 [ # # ]: 0 : if( bHasSel )
1030 [ # # ][ # # ]: 0 : EndUndo( UNDO_INSERT );
1031 : : }
1032 : 0 : }
1033 : :
1034 : : /*------------------------------------------------------------------------
1035 : : Beschreibung: Numerierung anschalten
1036 : : Parameter: Optionale Angabe eines Namens fuer die benannte Liste;
1037 : : dieser bezeichnet eine Position, wenn er in eine
1038 : : Zahl konvertierbar ist und kleiner ist als nMaxRules.
1039 : : -------------------------------------------------------------------------*/
1040 : :
1041 : :
1042 : : // zum Testen der CharFormate an der Numerierung
1043 : : // extern void SetNumChrFmt( SwWrtShell*, SwNumRules& );
1044 : :
1045 : : // -> #i40041#
1046 : : // Preconditions (as far as OD has figured out):
1047 : : // - <SwEditShell::HasNumber()> is sal_False, if <bNum> is sal_True
1048 : : // - <SwEditShell::HasBullet()> is sal_False, if <bNum> is sal_False
1049 : : // Behavior of method is determined by the current situation at the current
1050 : : // cursor position in the document.
1051 : 0 : void SwWrtShell::NumOrBulletOn(sal_Bool bNum)
1052 : : {
1053 : : // determine numbering rule found at current cursor position in the document.
1054 [ # # ]: 0 : const SwNumRule* pCurRule = GetCurNumRule();
1055 : :
1056 [ # # ]: 0 : StartUndo(UNDO_NUMORNONUM);
1057 : :
1058 : 0 : const SwNumRule * pNumRule = pCurRule;
1059 : :
1060 : : // - activate outline rule respectively turning on outline rule for
1061 : : // current text node. But, only for turning on a numbering (<bNum> == sal_True).
1062 : : // - overwrite found numbering rule at current cursor position, if
1063 : : // no numbering rule can be retrieved from the paragraph style.
1064 : 0 : bool bContinueFoundNumRule( false );
1065 : 0 : bool bActivateOutlineRule( false );
1066 : 0 : int nActivateOutlineLvl( MAXLEVEL ); // only relevant, if <bActivateOutlineRule> == sal_True
1067 [ # # ]: 0 : SwTxtFmtColl * pColl = GetCurTxtFmtColl();
1068 [ # # ]: 0 : if ( pColl )
1069 : : {
1070 : : // retrieve numbering rule at paragraph
1071 : : // style, which is found at current cursor position in the document.
1072 [ # # ][ # # ]: 0 : SwNumRule* pCollRule = pDoc->FindNumRulePtr(pColl->GetNumRule().GetValue());
1073 : : // #125993# - The outline numbering rule isn't allowed
1074 : : // to be derived from a parent paragraph style to a derived one.
1075 : : // Thus check, if the found outline numbering rule is directly
1076 : : // set at the paragraph style <pColl>. If not, set <pCollRule> to NULL
1077 [ # # ][ # # ]: 0 : if ( pCollRule && pCollRule == GetDoc()->GetOutlineNumRule() )
[ # # ]
1078 : : {
1079 : : const SwNumRule* pDirectCollRule =
1080 [ # # ][ # # ]: 0 : pDoc->FindNumRulePtr(pColl->GetNumRule( sal_False ).GetValue());
1081 [ # # ]: 0 : if ( !pDirectCollRule )
1082 : : {
1083 : 0 : pCollRule = 0;
1084 : : }
1085 : : }
1086 : :
1087 [ # # ]: 0 : if ( !pCollRule )
1088 : : {
1089 : 0 : pNumRule = pCollRule;
1090 : : }
1091 : : // no activation or continuation of outline numbering in Writer/Web document
1092 [ # # # # : 0 : else if ( bNum &&
# # ][ # # ]
1093 [ # # ]: 0 : !dynamic_cast<SwWebDocShell*>(GetDoc()->GetDocShell()) &&
1094 : 0 : pCollRule == GetDoc()->GetOutlineNumRule() )
1095 : : {
1096 [ # # ]: 0 : if ( pNumRule == pCollRule )
1097 : : {
1098 : : // check, if text node at current cursor positioned is counted.
1099 : : // If not, let it been counted. Then it has to be checked,
1100 : : // of the outline numbering has to be activated or continued.
1101 : : SwTxtNode* pTxtNode =
1102 [ # # ]: 0 : GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
1103 [ # # ][ # # ]: 0 : if ( pTxtNode && !pTxtNode->IsCountedInList() )
[ # # ][ # # ]
1104 : : {
1105 : : // check, if numbering of the outline level of the paragraph
1106 : : // style is active. If not, activate this outline level.
1107 [ # # ]: 0 : nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();
1108 : : OSL_ENSURE( pColl->IsAssignedToListLevelOfOutlineStyle(),
1109 : : "<SwWrtShell::NumOrBulletOn(..)> - paragraph style with outline rule, but no outline level" );
1110 [ # # # # ]: 0 : if ( pColl->IsAssignedToListLevelOfOutlineStyle() &&
[ # # ]
1111 [ # # ]: 0 : pCollRule->Get( static_cast<sal_uInt16>(nActivateOutlineLvl) ).GetNumberingType()
1112 : : == SVX_NUM_NUMBER_NONE )
1113 : : {
1114 : : // activate outline numbering
1115 : 0 : bActivateOutlineRule = true;
1116 : : }
1117 : : else
1118 : : {
1119 : : // turning on outline numbering at current cursor position
1120 : 0 : bContinueFoundNumRule = true;
1121 : : }
1122 : : }
1123 : : else
1124 : : {
1125 : : // #i101234#
1126 : : // activate outline numbering, because from the precondition
1127 : : // it's known, that <SwEdit::HasNumber()> == sal_False
1128 : 0 : bActivateOutlineRule = true;
1129 [ # # ]: 0 : nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();//<-end,zhaojianwei
1130 : : }
1131 : : }
1132 [ # # ]: 0 : else if ( !pNumRule )
1133 : : {
1134 : : // #i101234#
1135 : : // Check, if corresponding list level of the outline numbering
1136 : : // has already a numbering format set.
1137 [ # # ]: 0 : nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();//<-end,zhaojianwei,need further consideration
1138 [ # # ][ # # ]: 0 : if ( pCollRule->Get( static_cast<sal_uInt16>(nActivateOutlineLvl) ).GetNumberingType()
1139 : : == SVX_NUM_NUMBER_NONE )
1140 : : {
1141 : : // activate outline numbering, because from the precondition
1142 : : // it's known, that <SwEdit::HasNumber()> == sal_False
1143 : 0 : bActivateOutlineRule = true;
1144 : : }
1145 : : else
1146 : : {
1147 : : // turning on outline numbering at current cursor position
1148 : 0 : bContinueFoundNumRule = true;
1149 : : }
1150 : : }
1151 : : else
1152 : : {
1153 : : // check, if numbering of the outline level of the paragraph
1154 : : // style is active. If not, activate this outline level.
1155 [ # # ]: 0 : nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();
1156 : : OSL_ENSURE( pColl->IsAssignedToListLevelOfOutlineStyle(),
1157 : : "<SwWrtShell::NumOrBulletOn(..)> - paragraph style with outline rule, but no outline level" );
1158 [ # # # # ]: 0 : if ( pColl->IsAssignedToListLevelOfOutlineStyle() &&
[ # # ]
1159 [ # # ]: 0 : pCollRule->Get( static_cast<sal_uInt16>(nActivateOutlineLvl) ).GetNumberingType()
1160 : : == SVX_NUM_NUMBER_NONE )
1161 : : {
1162 : : // activate outline numbering
1163 : 0 : bActivateOutlineRule = true;
1164 : : }
1165 : : else
1166 : : {
1167 : : // turning on outline numbering at current cursor position
1168 : 0 : bContinueFoundNumRule = true;
1169 : : }
1170 : : }
1171 : 0 : pNumRule = pCollRule;
1172 : : }
1173 : : }
1174 : :
1175 : : // Only automatic numbering/bullet rules should be changed.
1176 : : // Note: The outline numbering rule is also an automatic one. It's only
1177 : : // changed, if it has to be activated.
1178 [ # # ]: 0 : if ( pNumRule )
1179 : : {
1180 [ # # ]: 0 : if ( !pNumRule->IsAutoRule() )
1181 : : {
1182 : 0 : pNumRule = 0;
1183 : : }
1184 [ # # ][ # # ]: 0 : else if ( pNumRule == GetDoc()->GetOutlineNumRule() &&
[ # # ][ # # ]
1185 : 0 : !bActivateOutlineRule && !bContinueFoundNumRule )
1186 : : {
1187 : 0 : pNumRule = 0;
1188 : : }
1189 : : }
1190 : :
1191 : : // Search for a previous numbering/bullet rule to continue it.
1192 [ # # ]: 0 : String sContinuedListId;
1193 [ # # ]: 0 : if ( !pNumRule )
1194 : : {
1195 [ # # ]: 0 : pNumRule = GetDoc()->SearchNumRule( *GetCrsr()->GetPoint(),
1196 : : false, bNum, false, 0,
1197 [ # # ]: 0 : sContinuedListId );
1198 : 0 : bContinueFoundNumRule = pNumRule != 0;
1199 : : }
1200 : :
1201 [ # # ]: 0 : if (pNumRule)
1202 : : {
1203 [ # # ]: 0 : SwNumRule aNumRule(*pNumRule);
1204 : :
1205 : : // do not change found numbering/bullet rule, if it should only be continued.
1206 [ # # ]: 0 : if ( !bContinueFoundNumRule )
1207 : : {
1208 [ # # ]: 0 : SwTxtNode * pTxtNode = GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
1209 : :
1210 [ # # ]: 0 : if (pTxtNode)
1211 : : {
1212 : : // use above retrieve outline level, if outline numbering has to be activated.
1213 : : int nLevel = bActivateOutlineRule
1214 : : ? nActivateOutlineLvl
1215 [ # # ][ # # ]: 0 : : pTxtNode->GetActualListLevel();
1216 : :
1217 [ # # ]: 0 : if (nLevel < 0)
1218 : 0 : nLevel = 0;
1219 : :
1220 [ # # ]: 0 : if (nLevel >= MAXLEVEL)
1221 : 0 : nLevel = MAXLEVEL - 1;
1222 : :
1223 [ # # ][ # # ]: 0 : SwNumFmt aFmt(aNumRule.Get(static_cast<sal_uInt16>(nLevel)));
1224 : :
1225 [ # # ]: 0 : if (bNum)
1226 : 0 : aFmt.SetNumberingType(SVX_NUM_ARABIC);
1227 : : else
1228 : : {
1229 : : // #i63395# Only apply user defined default bullet font
1230 [ # # ][ # # ]: 0 : if ( numfunc::IsDefBulletFontUserDefined() )
1231 : : {
1232 [ # # ]: 0 : const Font* pFnt = &numfunc::GetDefBulletFont();
1233 [ # # ]: 0 : aFmt.SetBulletFont( pFnt );
1234 : : }
1235 [ # # ]: 0 : aFmt.SetBulletChar( numfunc::GetBulletChar(static_cast<sal_uInt8>(nLevel)));
1236 : 0 : aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
1237 : : // #i93908# clear suffix for bullet lists
1238 : 0 : aFmt.SetPrefix(::rtl::OUString());
1239 : 0 : aFmt.SetSuffix(::rtl::OUString());
1240 : : }
1241 [ # # ][ # # ]: 0 : aNumRule.Set(static_cast<sal_uInt16>(nLevel), aFmt);
1242 : : }
1243 : : }
1244 : :
1245 : : // reset indent attribute on applying list style
1246 [ # # ][ # # ]: 0 : SetCurNumRule( aNumRule, false, sContinuedListId, true );
[ # # ][ # # ]
1247 : : }
1248 : : else
1249 : : {
1250 : : // #i95907#
1251 : : const SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode(
1252 [ # # ]: 0 : numfunc::GetDefaultPositionAndSpaceMode() );
1253 [ # # ][ # # ]: 0 : SwNumRule aNumRule( GetUniqueNumRuleName(), ePosAndSpaceMode );
[ # # ]
1254 : : // Zeichenvorlage an die Numerierung haengen
1255 : : SwCharFmt* pChrFmt;
1256 [ # # ]: 0 : SwDocShell* pDocSh = GetView().GetDocShell();
1257 : : // #i63395#
1258 : : // Only apply user defined default bullet font
1259 [ # # ]: 0 : const Font* pFnt = numfunc::IsDefBulletFontUserDefined()
1260 : : ? &numfunc::GetDefBulletFont()
1261 [ # # ][ # # ]: 0 : : 0;
1262 : :
1263 [ # # ]: 0 : if (bNum)
1264 : : {
1265 [ # # ]: 0 : pChrFmt = GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL );
1266 : : }
1267 : : else
1268 : : {
1269 [ # # ]: 0 : pChrFmt = GetCharFmtFromPool( RES_POOLCHR_BUL_LEVEL );
1270 : : }
1271 : :
1272 [ # # ]: 0 : const SwTxtNode* pTxtNode = GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
1273 : : const SwTwips nWidthOfTabs = pTxtNode
1274 [ # # ]: 0 : ? pTxtNode->GetWidthOfLeadingTabs()
1275 [ # # ]: 0 : : 0;
1276 [ # # ][ # # ]: 0 : GetDoc()->RemoveLeadingWhiteSpace( *GetCrsr()->GetPoint() );
1277 : :
1278 [ # # ][ # # ]: 0 : const bool bHtml = 0 != PTR_CAST(SwWebDocShell, pDocSh);
[ # # ][ # # ]
[ # # ]
1279 [ # # ]: 0 : const bool bRightToLeft = IsInRightToLeftText();
1280 [ # # ]: 0 : for( sal_uInt8 nLvl = 0; nLvl < MAXLEVEL; ++nLvl )
1281 : : {
1282 [ # # ][ # # ]: 0 : SwNumFmt aFmt( aNumRule.Get( nLvl ) );
1283 [ # # ]: 0 : aFmt.SetCharFmt( pChrFmt );
1284 : :
1285 [ # # ]: 0 : if (! bNum)
1286 : : {
1287 : : // #i63395#
1288 : : // Only apply user defined default bullet font
1289 [ # # ]: 0 : if ( pFnt )
1290 : : {
1291 [ # # ]: 0 : aFmt.SetBulletFont( pFnt );
1292 : : }
1293 [ # # ]: 0 : aFmt.SetBulletChar( numfunc::GetBulletChar(nLvl) );
1294 : 0 : aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
1295 : : // #i93908# clear suffix for bullet lists
1296 : 0 : aFmt.SetPrefix(::rtl::OUString());
1297 : 0 : aFmt.SetSuffix(::rtl::OUString());
1298 : : }
1299 : :
1300 : : // #i95907#
1301 [ # # ]: 0 : if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1302 : : {
1303 [ # # ][ # # ]: 0 : if(bHtml && nLvl)
1304 : : {
1305 : : // 1/2" fuer HTML
1306 : 0 : aFmt.SetLSpace(720);
1307 : 0 : aFmt.SetAbsLSpace(nLvl * 720);
1308 : : }
1309 [ # # ]: 0 : else if ( nWidthOfTabs > 0 )
1310 : : {
1311 : 0 : aFmt.SetAbsLSpace(nWidthOfTabs + nLvl * 720);
1312 : : }
1313 : : }
1314 : :
1315 : : // #i38904# Default alignment for
1316 : : // numbering/bullet should be rtl in rtl paragraph:
1317 [ # # ]: 0 : if ( bRightToLeft )
1318 : : {
1319 : 0 : aFmt.SetNumAdjust( SVX_ADJUST_RIGHT );
1320 : : }
1321 : :
1322 [ # # ]: 0 : aNumRule.Set( nLvl, aFmt );
1323 [ # # ]: 0 : }
1324 : :
1325 : : // #i95907#
1326 [ # # ][ # # ]: 0 : if ( pTxtNode &&
1327 : : ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1328 : : {
1329 : :
1330 [ # # ]: 0 : const SwTwips nTxtNodeIndent = pTxtNode->GetAdditionalIndentForStartingNewList();
1331 [ # # ]: 0 : if ( ( nTxtNodeIndent + nWidthOfTabs ) != 0 )
1332 : : {
1333 : : // #i111172#
1334 : : // If text node is already inside a list, assure that the indents
1335 : : // are the same. Thus, adjust the indent change value by subtracting
1336 : : // indents of to be applied list style.
1337 : 0 : SwTwips nIndentChange = nTxtNodeIndent + nWidthOfTabs;
1338 [ # # ][ # # ]: 0 : if ( pTxtNode->GetNumRule() )
1339 : : {
1340 [ # # ][ # # ]: 0 : const SwNumFmt aFmt( aNumRule.Get( 0 ) );
1341 [ # # ][ # # ]: 0 : if ( aFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
1342 : : {
1343 [ # # ][ # # ]: 0 : nIndentChange -= aFmt.GetIndentAt() + aFmt.GetFirstLineIndent();
1344 [ # # ]: 0 : }
1345 : : }
1346 [ # # ]: 0 : aNumRule.ChangeIndent( nIndentChange );
1347 : : }
1348 : : }
1349 : : // reset indent attribute on applying list style
1350 : : // start new list
1351 [ # # ][ # # ]: 0 : SetCurNumRule( aNumRule, true, String(), true );
[ # # ][ # # ]
1352 : : }
1353 : :
1354 [ # # ][ # # ]: 0 : EndUndo(UNDO_NUMORNONUM);
1355 : 0 : }
1356 : : // <- #i40041#
1357 : :
1358 : 0 : void SwWrtShell::NumOn()
1359 : : {
1360 : 0 : NumOrBulletOn(sal_True);
1361 : 0 : }
1362 : :
1363 : 0 : void SwWrtShell::NumOrBulletOff()
1364 : : {
1365 : 0 : const SwNumRule * pCurNumRule = GetCurNumRule();
1366 : :
1367 [ # # ]: 0 : if (pCurNumRule)
1368 : : {
1369 [ # # ]: 0 : if (pCurNumRule->IsOutlineRule())
1370 : : {
1371 [ # # ]: 0 : SwNumRule aNumRule(*pCurNumRule);
1372 : :
1373 : : SwTxtNode * pTxtNode =
1374 [ # # ]: 0 : GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
1375 : :
1376 [ # # ]: 0 : if (pTxtNode)
1377 : : {
1378 [ # # ]: 0 : sal_uInt16 nLevel = sal::static_int_cast<sal_uInt16, sal_Int32>(pTxtNode->GetActualListLevel());
1379 [ # # ][ # # ]: 0 : SwNumFmt aFmt(aNumRule.Get(nLevel));
1380 : :
1381 : 0 : aFmt.SetNumberingType(SVX_NUM_NUMBER_NONE);
1382 [ # # ]: 0 : aNumRule.Set(nLevel, aFmt);
1383 : :
1384 : : // no start or continuation of a list - the outline style is only changed.
1385 [ # # ][ # # ]: 0 : SetCurNumRule( aNumRule, false );
[ # # ][ # # ]
1386 [ # # ]: 0 : }
1387 : : }
1388 : : else
1389 : : {
1390 : 0 : DelNumRules();
1391 : : }
1392 : :
1393 : : // #126346# - Cursor can not be anymore in front of
1394 : : // a label, because numbering/bullet is switched off.
1395 : 0 : SetInFrontOfLabel( sal_False );
1396 : : }
1397 : 0 : }
1398 : : // <- #i29560#
1399 : :
1400 : : /*------------------------------------------------------------------------
1401 : : Beschreibung: Default-Bulletliste erfragen
1402 : : ------------------------------------------------------------------------*/
1403 : :
1404 : 0 : void SwWrtShell::BulletOn()
1405 : : {
1406 : 0 : NumOrBulletOn(sal_False);
1407 : 0 : }
1408 : :
1409 : :
1410 : :
1411 : 24271 : SelectionType SwWrtShell::GetSelectionType() const
1412 : : {
1413 : : // ContentType kann nicht ermittelt werden innerhalb einer
1414 : : // Start-/Endactionklammerung.
1415 : : // Da es keinen ungueltigen Wert gibt, wird TEXT geliefert.
1416 : : // Der Wert ist egal, da in EndAction ohnehin aktualisiert wird.
1417 : :
1418 [ - + ]: 24271 : if ( BasicActionPend() )
1419 [ # # ]: 0 : return IsSelFrmMode() ? nsSelectionType::SEL_FRM : nsSelectionType::SEL_TXT;
1420 : :
1421 : 24271 : SwView &_rView = ((SwView&)GetView());
1422 [ - + ][ - + ]: 24271 : if (_rView.GetPostItMgr() && _rView.GetPostItMgr()->HasActiveSidebarWin() )
[ + - ]
1423 : 0 : return nsSelectionType::SEL_POSTIT;
1424 : : int nCnt;
1425 : :
1426 : : // Rahmen einfuegen ist kein DrawMode
1427 [ + - + - : 72813 : if ( !_rView.GetEditWin().IsFrmAction() &&
- + # # ]
[ - + ]
1428 : 48542 : (IsObjSelected() || (_rView.IsDrawMode() && !IsFrmSelected()) ))
1429 : : {
1430 [ # # ]: 0 : if (GetDrawView()->IsTextEdit())
1431 : 0 : nCnt = nsSelectionType::SEL_DRW_TXT;
1432 : : else
1433 : : {
1434 [ # # ][ # # ]: 0 : if (GetView().IsFormMode()) // Nur Forms selektiert
1435 : 0 : nCnt = nsSelectionType::SEL_DRW_FORM;
1436 : : else
1437 : 0 : nCnt = nsSelectionType::SEL_DRW; // Irgendein Draw-Objekt
1438 : :
1439 [ # # ][ # # ]: 0 : if (_rView.IsBezierEditMode())
1440 : 0 : nCnt |= nsSelectionType::SEL_BEZ;
1441 [ # # ][ # # ]: 0 : else if( GetDrawView()->GetContext() == SDRCONTEXT_MEDIA )
[ # # ]
1442 : 0 : nCnt |= nsSelectionType::SEL_MEDIA;
1443 : :
1444 [ # # ][ # # ]: 0 : if (svx::checkForSelectedCustomShapes(
1445 [ # # ]: 0 : const_cast<SdrView *>(GetDrawView()),
1446 : : true /* bOnlyExtruded */ ))
1447 : : {
1448 : 0 : nCnt |= nsSelectionType::SEL_EXTRUDED_CUSTOMSHAPE;
1449 : : }
1450 : 0 : sal_uInt32 nCheckStatus = 0;
1451 [ # # ][ # # ]: 0 : if (svx::checkForSelectedFontWork(
1452 [ # # ]: 0 : const_cast<SdrView *>(GetDrawView()), nCheckStatus ))
1453 : : {
1454 : 0 : nCnt |= nsSelectionType::SEL_FONTWORK;
1455 : : }
1456 : : }
1457 : :
1458 : 0 : return nCnt;
1459 : : }
1460 : :
1461 : 24271 : nCnt = GetCntType();
1462 : :
1463 [ - + ]: 24271 : if ( IsFrmSelected() )
1464 : : {
1465 [ # # ]: 0 : if (_rView.IsDrawMode())
1466 : 0 : _rView.LeaveDrawCreate(); // Aufraeumen (Bug #45639)
1467 [ # # ]: 0 : if ( !(nCnt & (CNT_GRF | CNT_OLE)) )
1468 : 0 : return nsSelectionType::SEL_FRM;
1469 : : }
1470 : :
1471 [ + + ]: 24271 : if ( IsCrsrInTbl() )
1472 : 84 : nCnt |= nsSelectionType::SEL_TBL;
1473 : :
1474 [ + + ]: 24271 : if ( IsTableMode() )
1475 : 34 : nCnt |= (nsSelectionType::SEL_TBL | nsSelectionType::SEL_TBL_CELLS);
1476 : :
1477 : : // #i39855#
1478 : : // Do not pop up numbering toolbar, if the text node has a numbering
1479 : : // of type SVX_NUM_NUMBER_NONE.
1480 : 24271 : const SwNumRule* pNumRule = GetCurNumRule();
1481 [ + + ]: 24271 : if ( pNumRule )
1482 : : {
1483 : : const SwTxtNode* pTxtNd =
1484 : 54 : GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
1485 : :
1486 [ + - ][ + - ]: 54 : if ( pTxtNd && pTxtNd->IsInList() )
[ + - ]
1487 : : {
1488 : 54 : const SwNumFmt& rFmt = pNumRule->Get(sal::static_int_cast< sal_uInt8, sal_Int32>(pTxtNd->GetActualListLevel()));
1489 [ + + ]: 54 : if ( SVX_NUM_NUMBER_NONE != rFmt.GetNumberingType() )
1490 : 45 : nCnt |= nsSelectionType::SEL_NUM;
1491 : : }
1492 : : }
1493 : :
1494 : 24271 : return nCnt;
1495 : : }
1496 : :
1497 : : /*------------------------------------------------------------------------
1498 : : Beschreibung: Finden der TextCollection mit dem Name rCollname
1499 : : Return: Pointer auf die Collection oder 0, wenn keine
1500 : : TextCollection mit diesem Namen existiert oder
1501 : : diese eine Defaultvorlage ist.
1502 : : ------------------------------------------------------------------------*/
1503 : :
1504 : :
1505 : 0 : SwTxtFmtColl *SwWrtShell::GetParaStyle(const String &rCollName, GetStyle eCreate )
1506 : : {
1507 : 0 : SwTxtFmtColl* pColl = FindTxtFmtCollByName( rCollName );
1508 [ # # ][ # # ]: 0 : if( !pColl && GETSTYLE_NOCREATE != eCreate )
1509 : : {
1510 : 0 : sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( rCollName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
1511 [ # # ][ # # ]: 0 : if( USHRT_MAX != nId || GETSTYLE_CREATEANY == eCreate )
1512 : 0 : pColl = GetTxtCollFromPool( nId );
1513 : : }
1514 : 0 : return pColl;
1515 : : }
1516 : : /*------------------------------------------------------------------------
1517 : : Beschreibung: Finden der Zeichenvorlage mit dem Name rCollname
1518 : : Return: Pointer auf die Collection oder 0, wenn keine
1519 : : Zeichenvorlage mit diesem Namen existiert oder
1520 : : diese eine Defaultvorlage oder automatische Vorlage ist.
1521 : : ------------------------------------------------------------------------*/
1522 : :
1523 : :
1524 : :
1525 : 0 : SwCharFmt *SwWrtShell::GetCharStyle(const String &rFmtName, GetStyle eCreate )
1526 : : {
1527 : 0 : SwCharFmt* pFmt = FindCharFmtByName( rFmtName );
1528 [ # # ][ # # ]: 0 : if( !pFmt && GETSTYLE_NOCREATE != eCreate )
1529 : : {
1530 : 0 : sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( rFmtName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
1531 [ # # ][ # # ]: 0 : if( USHRT_MAX != nId || GETSTYLE_CREATEANY == eCreate )
1532 : 0 : pFmt = (SwCharFmt*)GetFmtFromPool( nId );
1533 : : }
1534 : 0 : return pFmt;
1535 : : }
1536 : :
1537 : : /*------------------------------------------------------------------------
1538 : : Beschreibung: Finden des Tabellenformates mit dem Name rFmtname
1539 : : Return: Pointer auf das Format oder 0, wenn kein
1540 : : Rahmenformat mit diesem Namen existiert oder
1541 : : dieses eine Defaultformat oder automatisches Format ist.
1542 : : ------------------------------------------------------------------------*/
1543 : :
1544 : :
1545 : :
1546 : 0 : SwFrmFmt *SwWrtShell::GetTblStyle(const String &rFmtName)
1547 : : {
1548 : 0 : SwFrmFmt *pFmt = 0;
1549 [ # # ]: 0 : for( sal_uInt16 i = GetTblFrmFmtCount(); i; )
1550 [ # # # # : 0 : if( !( pFmt = &GetTblFrmFmt( --i ) )->IsDefault() &&
# # ][ # # ]
1551 : 0 : pFmt->GetName() == rFmtName && IsUsed( *pFmt ) )
1552 : 0 : return pFmt;
1553 : 0 : return 0;
1554 : : }
1555 : :
1556 : 2 : SwNavigationMgr& SwWrtShell::GetNavigationMgr() {
1557 : 2 : return aNavigationMgr;
1558 : : }
1559 : :
1560 : 0 : void SwWrtShell::addCurrentPosition() {
1561 : 0 : SwPaM* pPaM = GetCrsr();
1562 : 0 : aNavigationMgr.addEntry(*pPaM->GetPoint());
1563 : 0 : }
1564 : : /*------------------------------------------------------------------------
1565 : : Beschreibung: Anwenden der Vorlagen
1566 : : ------------------------------------------------------------------------*/
1567 : :
1568 : :
1569 : :
1570 : 0 : void SwWrtShell::SetPageStyle(const String &rCollName)
1571 : : {
1572 [ # # ][ # # ]: 0 : if( !SwCrsrShell::HasSelection() && !IsSelFrmMode() && !IsObjSelected() )
[ # # ][ # # ]
1573 : : {
1574 : 0 : SwPageDesc* pDesc = FindPageDescByName( rCollName, sal_True );
1575 [ # # ]: 0 : if( pDesc )
1576 : 0 : ChgCurPageDesc( *pDesc );
1577 : : }
1578 : 0 : }
1579 : :
1580 : : /*------------------------------------------------------------------------
1581 : : Beschreibung: Zugriff Vorlagen
1582 : : ------------------------------------------------------------------------*/
1583 : :
1584 : :
1585 : :
1586 : 1366 : String SwWrtShell::GetCurPageStyle( const sal_Bool bCalcFrm ) const
1587 : : {
1588 : 1366 : return GetPageDesc(GetCurPageDesc( bCalcFrm )).GetName();
1589 : : }
1590 : :
1591 : : /*------------------------------------------------------------------------
1592 : : Beschreibung: Aktuelle Vorlage anhand der geltenden Attribute aendern
1593 : : ------------------------------------------------------------------------*/
1594 : :
1595 : :
1596 : 0 : void SwWrtShell::QuickUpdateStyle()
1597 : : {
1598 : 0 : SwTxtFmtColl *pColl = GetCurTxtFmtColl();
1599 : :
1600 : : // Standard kann nicht geaendert werden
1601 [ # # ][ # # ]: 0 : if(pColl && !pColl->IsDefault())
[ # # ]
1602 : : {
1603 : 0 : FillByEx(pColl);
1604 : : // Vorlage auch anwenden, um harte Attributierung
1605 : : // zu entfernen
1606 : 0 : SetTxtFmtColl(pColl);
1607 : : }
1608 : 0 : }
1609 : :
1610 : :
1611 : 0 : void SwWrtShell::AutoUpdatePara(SwTxtFmtColl* pColl, const SfxItemSet& rStyleSet, SwPaM* pPaM )
1612 : : {
1613 [ # # ][ # # ]: 0 : SwPaM* pCrsr = pPaM ? pPaM : GetCrsr( );
1614 [ # # ]: 0 : SfxItemSet aCoreSet( GetAttrPool(),
1615 : : RES_CHRATR_BEGIN, RES_CHRATR_END - 1,
1616 : : RES_PARATR_BEGIN, RES_PARATR_END - 1,
1617 : : RES_FRMATR_BEGIN, RES_FRMATR_END - 1,
1618 : : SID_ATTR_TABSTOP_POS, SID_ATTR_TABSTOP_POS,
1619 : : SID_ATTR_TABSTOP_DEFAULTS, SID_ATTR_TABSTOP_DEFAULTS,
1620 : : SID_ATTR_TABSTOP_OFFSET, SID_ATTR_TABSTOP_OFFSET,
1621 : : SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
1622 : : SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP,
1623 : : SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM,
1624 [ # # ]: 0 : 0 );
1625 [ # # ]: 0 : GetPaMAttr( pCrsr, aCoreSet );
1626 : 0 : sal_Bool bReset = sal_False;
1627 [ # # ]: 0 : SfxItemIter aParaIter( aCoreSet );
1628 : 0 : const SfxPoolItem* pParaItem = aParaIter.FirstItem();
1629 [ # # ]: 0 : while( pParaItem )
1630 : : {
1631 [ # # ]: 0 : if(!IsInvalidItem(pParaItem))
1632 : : {
1633 : 0 : sal_uInt16 nWhich = pParaItem->Which();
1634 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == aCoreSet.GetItemState(nWhich) &&
[ # # ][ # # ]
1635 [ # # ]: 0 : SFX_ITEM_SET == rStyleSet.GetItemState(nWhich))
1636 : : {
1637 [ # # ]: 0 : aCoreSet.ClearItem(nWhich);
1638 : 0 : bReset = sal_True;
1639 : : }
1640 : : }
1641 [ # # ]: 0 : pParaItem = aParaIter.NextItem();
1642 : : }
1643 [ # # ]: 0 : StartAction();
1644 [ # # ]: 0 : if(bReset)
1645 : : {
1646 [ # # ][ # # ]: 0 : ResetAttr( std::set<sal_uInt16>(), pCrsr );
1647 [ # # ]: 0 : SetAttr(aCoreSet, 0, pCrsr);
1648 : : }
1649 [ # # ]: 0 : pDoc->ChgFmt(*pColl, rStyleSet );
1650 [ # # ][ # # ]: 0 : EndAction();
[ # # ]
1651 : 0 : }
1652 : :
1653 : 0 : void SwWrtShell::AutoUpdateFrame( SwFrmFmt* pFmt, const SfxItemSet& rStyleSet )
1654 : : {
1655 : 0 : StartAction();
1656 : :
1657 : 0 : ResetFlyFrmAttr( 0, &rStyleSet );
1658 : 0 : pFmt->SetFmtAttr( rStyleSet );
1659 : :
1660 : 0 : EndAction();
1661 : 0 : }
1662 : :
1663 : :
1664 : 0 : void SwWrtShell::AutoCorrect( SvxAutoCorrect& rACorr, sal_Unicode cChar )
1665 : : {
1666 : 0 : ResetCursorStack();
1667 [ # # ]: 0 : if(CanInsert())
1668 : : {
1669 : 0 : sal_Bool bStarted = sal_False;
1670 [ # # ]: 0 : if(HasSelection())
1671 : : {
1672 : : // nur hier klammern, da das normale Insert schon an der
1673 : : // Editshell geklammert ist
1674 : 0 : StartAllAction();
1675 : 0 : StartUndo(UNDO_INSERT);
1676 : 0 : bStarted = sal_True;
1677 : 0 : DelRight();
1678 : : }
1679 : 0 : SwEditShell::AutoCorrect( rACorr, IsInsMode(), cChar );
1680 : :
1681 [ # # ]: 0 : if(bStarted)
1682 : : {
1683 : 0 : EndAllAction();
1684 : 0 : EndUndo(UNDO_INSERT);
1685 : : }
1686 : : }
1687 : 0 : }
1688 : :
1689 : :
1690 : : /*
1691 : : * eine Art kontrollierter copy ctor
1692 : : */
1693 : :
1694 : 0 : SwWrtShell::SwWrtShell( SwWrtShell& rSh, Window *_pWin, SwView &rShell )
1695 : : : SwFEShell( rSh, _pWin ),
1696 [ # # ][ # # ]: 0 : COMMON_INI_LIST
1697 : : {
1698 : 0 : BITFLD_INI_LIST
1699 [ # # ]: 0 : SET_CURR_SHELL( this );
1700 : :
1701 : 0 : SetSfxViewShell( (SfxViewShell *)&rShell );
1702 [ # # ]: 0 : SetFlyMacroLnk( LINK(this, SwWrtShell, ExecFlyMac) );
1703 : :
1704 : : // place the cursor on the first field...
1705 : 0 : IFieldmark *pBM = NULL;
1706 [ # # ][ # # ]: 0 : if ( IsFormProtected() && ( pBM = GetFieldmarkAfter( ) ) !=NULL ) {
[ # # ][ # # ]
[ # # ]
1707 [ # # ]: 0 : GotoFieldmark(pBM);
1708 [ # # ]: 0 : }
1709 : 0 : }
1710 : :
1711 : :
1712 : 1318 : SwWrtShell::SwWrtShell( SwDoc& rDoc, Window *_pWin, SwView &rShell,
1713 : : const SwViewOption *pViewOpt )
1714 : : : SwFEShell( rDoc, _pWin, pViewOpt),
1715 [ + - ][ + - ]: 1318 : COMMON_INI_LIST
1716 : : {
1717 : 1318 : BITFLD_INI_LIST
1718 [ + - ]: 1318 : SET_CURR_SHELL( this );
1719 : 1318 : SetSfxViewShell( (SfxViewShell *)&rShell );
1720 [ + - ]: 1318 : SetFlyMacroLnk( LINK(this, SwWrtShell, ExecFlyMac) );
1721 : :
1722 : : // place the cursor on the first field...
1723 : 1318 : IFieldmark *pBM = NULL;
1724 [ - + ][ # # ]: 1318 : if ( IsFormProtected() && ( pBM = GetFieldmarkAfter( ) ) !=NULL ) {
[ # # ][ - + ]
[ + - ]
1725 [ # # ]: 0 : GotoFieldmark(pBM);
1726 [ + - ]: 1318 : }
1727 : 1318 : }
1728 : :
1729 : : /*
1730 : : * ctor
1731 : : */
1732 : :
1733 : :
1734 : :
1735 : 1231 : SwWrtShell::~SwWrtShell()
1736 : : {
1737 [ + - ]: 1231 : SET_CURR_SHELL( this );
1738 [ - + ]: 1231 : while(IsModePushed())
1739 [ # # ]: 0 : PopMode();
1740 [ + - ][ - + ]: 1231 : while(PopCrsr(sal_False))
1741 : : ;
1742 [ + - ][ + - ]: 1231 : SwTransferable::ClearSelection( *this );
1743 [ - + ]: 2462 : }
1744 : :
1745 : 11 : sal_Bool SwWrtShell::Pop( sal_Bool bOldCrsr )
1746 : : {
1747 : 11 : sal_Bool bRet = SwCrsrShell::Pop( bOldCrsr );
1748 [ - + ][ - + ]: 11 : if( bRet && IsSelection() )
[ + - ]
1749 : : {
1750 : 0 : fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
1751 : 0 : fnKillSel = &SwWrtShell::ResetSelect;
1752 : : }
1753 : 11 : return bRet;
1754 : : }
1755 : :
1756 : 10 : sal_Bool SwWrtShell::CanInsert()
1757 : : {
1758 : 10 : return (!(IsSelFrmMode() | IsObjSelected() | (GetView().GetDrawFuncPtr() != NULL) | (GetView().GetPostItMgr()->GetActiveSidebarWin()!= NULL)));
1759 : : }
1760 : :
1761 : : // --------------
1762 : 0 : void SwWrtShell::ChgDBData(const SwDBData& aDBData)
1763 : : {
1764 : 0 : SwEditShell::ChgDBData(aDBData);
1765 : : //notify the db-beamer if available
1766 : 0 : GetView().NotifyDBChanged();
1767 : 0 : }
1768 : :
1769 : 0 : String SwWrtShell::GetSelDescr() const
1770 : : {
1771 : 0 : String aResult;
1772 : :
1773 [ # # ]: 0 : int nSelType = GetSelectionType();
1774 [ # # # # ]: 0 : switch (nSelType)
1775 : : {
1776 : : case nsSelectionType::SEL_GRF:
1777 [ # # ][ # # ]: 0 : aResult = SW_RESSTR(STR_GRAPHIC);
1778 : :
1779 : 0 : break;
1780 : : case nsSelectionType::SEL_FRM:
1781 : : {
1782 [ # # ]: 0 : const SwFrmFmt * pFrmFmt = GetCurFrmFmt();
1783 : :
1784 [ # # ]: 0 : if (pFrmFmt)
1785 [ # # ][ # # ]: 0 : aResult = pFrmFmt->GetDescription();
[ # # ]
1786 : : }
1787 : 0 : break;
1788 : : case nsSelectionType::SEL_DRW:
1789 : : {
1790 [ # # ][ # # ]: 0 : aResult = SW_RESSTR(STR_DRAWING_OBJECTS);
1791 : : }
1792 : 0 : break;
1793 : : default:
1794 [ # # ]: 0 : if (0 != pDoc)
1795 [ # # ][ # # ]: 0 : aResult = GetCrsrDescr();
[ # # ]
1796 : : }
1797 : :
1798 : 0 : return aResult;
1799 : : }
1800 : :
1801 : 222 : void SwWrtShell::ApplyViewOptions( const SwViewOption &rOpt )
1802 : : {
1803 : 222 : SwFEShell::ApplyViewOptions( rOpt );
1804 : : //#i115062# invalidate meta character slot
1805 : 222 : GetView().GetViewFrame()->GetBindings().Invalidate( FN_VIEW_META_CHARS );
1806 : 222 : }
1807 : :
1808 : :
1809 : 0 : void SwWrtShell::SetReadonlyOption(sal_Bool bSet)
1810 : : {
1811 : 0 : GetView().GetEditWin().GetFrameControlsManager().SetReadonlyControls( bSet );
1812 : 0 : ViewShell::SetReadonlyOption( bSet );
1813 : 0 : }
1814 : :
1815 : : /*
1816 : : * Switch on/off header or footer of a page style - if an empty name is
1817 : : * given all styles are changed
1818 : : */
1819 : 0 : void SwWrtShell::ChangeHeaderOrFooter(
1820 : : const String& rStyleName, sal_Bool bHeader, sal_Bool bOn, sal_Bool bShowWarning)
1821 : : {
1822 : 0 : addCurrentPosition();
1823 : 0 : StartAllAction();
1824 : 0 : StartUndo( UNDO_HEADER_FOOTER ); // #i7983#
1825 : 0 : sal_Bool bExecute = sal_True;
1826 : 0 : sal_Bool bCrsrSet = sal_False;
1827 [ # # ]: 0 : for( sal_uInt16 nFrom = 0, nTo = GetPageDescCnt();
1828 : : nFrom < nTo; ++nFrom )
1829 : : {
1830 : 0 : int bChgd = sal_False;
1831 [ # # ][ # # ]: 0 : SwPageDesc aDesc( GetPageDesc( nFrom ));
1832 [ # # ]: 0 : String sTmp(aDesc.GetName());
1833 [ # # ][ # # ]: 0 : if( !rStyleName.Len() || rStyleName == sTmp )
[ # # ][ # # ]
1834 : : {
1835 [ # # ][ # # ]: 0 : if( bShowWarning && !bOn && GetActiveView() && GetActiveView() == &GetView() &&
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # # ]
[ # # # # ]
[ # # ]
1836 [ # # ]: 0 : ( (bHeader && aDesc.GetMaster().GetHeader().IsActive()) ||
1837 [ # # ]: 0 : (!bHeader && aDesc.GetMaster().GetFooter().IsActive()) ) )
1838 : : {
1839 : 0 : bShowWarning = sal_False;
1840 : : //Actions have to be closed while the dialog is showing
1841 [ # # ]: 0 : EndAllAction();
1842 : :
1843 [ # # ]: 0 : Window* pParent = &GetView().GetViewFrame()->GetWindow();
1844 : : sal_Bool bRet = RET_YES == QueryBox( pParent, ResId( RID_SVXQBX_DELETE_HEADFOOT,
1845 [ # # ][ # # ]: 0 : DIALOG_MGR() ) ).Execute();
[ # # ][ # # ]
1846 : 0 : bExecute = bRet;
1847 [ # # ]: 0 : StartAllAction();
1848 : : }
1849 [ # # ]: 0 : if( bExecute )
1850 : : {
1851 : 0 : bChgd = sal_True;
1852 : 0 : SwFrmFmt &rMaster = aDesc.GetMaster();
1853 [ # # ]: 0 : if(bHeader)
1854 [ # # ][ # # ]: 0 : rMaster.SetFmtAttr( SwFmtHeader( bOn ));
[ # # ]
1855 : : else
1856 [ # # ][ # # ]: 0 : rMaster.SetFmtAttr( SwFmtFooter( bOn ));
[ # # ]
1857 [ # # ]: 0 : if( bOn )
1858 : : {
1859 [ # # ][ # # ]: 0 : SvxULSpaceItem aUL(bHeader ? 0 : MM50, bHeader ? MM50 : 0, RES_UL_SPACE );
[ # # ]
1860 : : SwFrmFmt* pFmt = bHeader ?
1861 [ # # ]: 0 : (SwFrmFmt*)rMaster.GetHeader().GetHeaderFmt() :
1862 [ # # ][ # # ]: 0 : (SwFrmFmt*)rMaster.GetFooter().GetFooterFmt();
1863 [ # # ][ # # ]: 0 : pFmt->SetFmtAttr( aUL );
1864 : : }
1865 : : }
1866 [ # # ]: 0 : if( bChgd )
1867 : : {
1868 [ # # ]: 0 : ChgPageDesc( nFrom, aDesc );
1869 : :
1870 [ # # ][ # # ]: 0 : if( !bCrsrSet && bOn )
1871 : : {
1872 [ # # ]: 0 : if ( !IsHeaderFooterEdit() )
1873 [ # # ]: 0 : ToggleHeaderFooterEdit();
1874 : : bCrsrSet = SetCrsrInHdFt(
1875 : 0 : !rStyleName.Len() ? USHRT_MAX : nFrom,
1876 [ # # ][ # # ]: 0 : bHeader );
1877 : : }
1878 : : }
1879 : : }
1880 [ # # ][ # # ]: 0 : }
1881 : 0 : EndUndo( UNDO_HEADER_FOOTER ); // #i7983#
1882 : 0 : EndAllAction();
1883 : 0 : }
1884 : :
1885 : 0 : void SwWrtShell::SetShowHeaderFooterSeparator( FrameControlType eControl, bool bShow )
1886 : : {
1887 : 0 : ViewShell::SetShowHeaderFooterSeparator( eControl, bShow );
1888 [ # # ]: 0 : if ( !bShow )
1889 : 0 : GetView().GetEditWin().GetFrameControlsManager().HideControls( eControl );
1890 : 0 : }
1891 : :
1892 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|