Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <sfx2/dispatch.hxx>
30 : : #include <vcl/msgbox.hxx>
31 : : #include <svx/svdpagv.hxx>
32 : : #include <sfx2/request.hxx>
33 : : #include <svl/style.hxx>
34 : : #include <editeng/outliner.hxx>
35 : : #include <svx/view3d.hxx>
36 : : #include <svx/svxids.hrc>
37 : : #include <svx/svdotext.hxx>
38 : : #include <svx/svdograf.hxx>
39 : : #include <svx/svdogrp.hxx>
40 : : #include <svx/svdorect.hxx>
41 : : #include <svl/poolitem.hxx>
42 : : #include <editeng/eeitem.hxx>
43 : : #include <editeng/bulitem.hxx>
44 : : #include <svl/itempool.hxx>
45 : : #include <editeng/numitem.hxx>
46 : : #include <svl/whiter.hxx>
47 : :
48 : : #include <sfx2/viewfrm.hxx>
49 : : #include <sfx2/objface.hxx>
50 : : #include "stlsheet.hxx"
51 : :
52 : : #include <svx/svdoutl.hxx>
53 : : #undef BMP_OLEOBJ
54 : : #include <svx/svdstr.hrc>
55 : : #include <svx/dialmgr.hxx>
56 : :
57 : : #include "glob.hrc"
58 : : #include "strings.hrc"
59 : : #include "View.hxx"
60 : : #include "sdattr.hxx"
61 : : #include "drawview.hxx"
62 : : #include "drawdoc.hxx"
63 : : #include "DrawDocShell.hxx"
64 : : #include "sdpage.hxx"
65 : : #include "DrawViewShell.hxx"
66 : : #include "pres.hxx"
67 : : #include "sdresid.hxx"
68 : : #include "Window.hxx"
69 : : #include "unchss.hxx"
70 : : #ifndef SD_FRAME_VIEW
71 : : #include "FrameView.hxx"
72 : : #endif
73 : : #include "anminfo.hxx"
74 : : #include "slideshow.hxx"
75 : : #include <vcl/virdev.hxx>
76 : : #include <svx/sdrpaintwindow.hxx>
77 : : #include <svx/sdr/contact/viewobjectcontact.hxx>
78 : : #include <svx/sdr/contact/viewcontact.hxx>
79 : : #include <svx/sdr/contact/displayinfo.hxx>
80 : :
81 : : #include "undo/undomanager.hxx"
82 : :
83 : : using namespace ::com::sun::star;
84 : :
85 : : namespace sd {
86 : :
87 [ - + ][ + - ]: 3645 : TYPEINIT1(DrawView, View);
88 : :
89 : : /*************************************************************************
90 : : |*
91 : : |* Konstruktor
92 : : |* zeigt die erste Seite des Dokuments auf Position 0,0 an;
93 : : |* falls noch keine Seite vorhanden ist, wird eine erzeugt
94 : : |*
95 : : \************************************************************************/
96 : :
97 : 260 : DrawView::DrawView( DrawDocShell* pDocSh, OutputDevice* pOutDev, DrawViewShell* pShell)
98 : 260 : : ::sd::View(*pDocSh->GetDoc(), pOutDev, pShell)
99 : : , mpDocShell(pDocSh)
100 : : , mpDrawViewShell(pShell)
101 : : , mpVDev(NULL)
102 : 260 : , mnPOCHSmph(0)
103 : : {
104 [ + - ]: 260 : SetCurrentObj(OBJ_RECT, SdrInventor);
105 : 260 : }
106 : :
107 : : /*************************************************************************
108 : : |*
109 : : |* Destruktor
110 : : |*
111 : : \************************************************************************/
112 : :
113 : 260 : DrawView::~DrawView()
114 : : {
115 [ - + ][ # # ]: 260 : delete mpVDev;
116 [ - + ]: 512 : }
117 : :
118 : : /*************************************************************************
119 : : |*
120 : : |* virtuelle Methode von SdrView, wird bei Selektionsaenderung gerufen
121 : : |*
122 : : \************************************************************************/
123 : :
124 : 132 : void DrawView::MarkListHasChanged()
125 : : {
126 : 132 : ::sd::View::MarkListHasChanged();
127 : :
128 [ + - ]: 132 : if (mpDrawViewShell)
129 : 132 : mpDrawViewShell->SelectionHasChanged();
130 : 132 : }
131 : :
132 : : /*************************************************************************
133 : : |*
134 : : |* virtuelle Methode von SdrView, wird bei Modelaenderung gerufen
135 : : |*
136 : : \************************************************************************/
137 : :
138 : 496 : void DrawView::ModelHasChanged()
139 : : {
140 : 496 : ::sd::View::ModelHasChanged();
141 : :
142 : : // den Gestalter zur Neudarstellung zwingen
143 : 496 : SfxStyleSheetBasePool* pSSPool = mrDoc.GetStyleSheetPool();
144 [ + - ]: 496 : pSSPool->Broadcast(SfxStyleSheetPoolHint(SFX_STYLESHEETPOOL_CHANGES));
145 : :
146 [ + + ]: 496 : if( mpDrawViewShell )
147 : 317 : mpDrawViewShell->ModelHasChanged();
148 : :
149 : 496 : }
150 : :
151 : : /*************************************************************************
152 : : |*
153 : : |* Attribute auf Titel- und Gliederungtext und Hintergrundrechteck einer
154 : : |* Masterpage in Vorlagen umlenken, sonst an Basisklasse weitergeben
155 : : |*
156 : : \************************************************************************/
157 : :
158 : 0 : sal_Bool DrawView::SetAttributes(const SfxItemSet& rSet,
159 : : sal_Bool bReplaceAll)
160 : : {
161 : 0 : sal_Bool bOk = sal_False;
162 : :
163 : : // wird eine Masterpage bearbeitet?
164 [ # # ][ # # ]: 0 : if ( mpDrawViewShell && mpDrawViewShell->GetEditMode() == EM_MASTERPAGE )
[ # # ]
165 : : {
166 [ # # ]: 0 : SfxStyleSheetBasePool* pStShPool = mrDoc.GetStyleSheetPool();
167 [ # # ]: 0 : SdPage& rPage = *mpDrawViewShell->getCurrentPage();
168 [ # # ][ # # ]: 0 : String aLayoutName = rPage.GetName();
169 [ # # ]: 0 : SdrTextObj* pEditObject = static_cast< SdrTextObj* >( GetTextEditObject() );
170 : :
171 [ # # ]: 0 : if (pEditObject)
172 : : {
173 : : // Textedit
174 [ # # ]: 0 : String aTemplateName(aLayoutName);
175 : :
176 [ # # ]: 0 : sal_uInt32 nInv = pEditObject->GetObjInventor();
177 : :
178 [ # # ]: 0 : if (nInv == SdrInventor)
179 : : {
180 [ # # ]: 0 : sal_uInt16 eObjKind = pEditObject->GetObjIdentifier();
181 [ # # ]: 0 : PresObjKind ePresObjKind = rPage.GetPresObjKind(pEditObject);
182 : :
183 [ # # ][ # # ]: 0 : if ( ePresObjKind == PRESOBJ_TITLE ||
184 : : ePresObjKind == PRESOBJ_NOTES )
185 : : {
186 : : // Presentation object (except outline)
187 [ # # ]: 0 : SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj( ePresObjKind );
188 : : DBG_ASSERT(pSheet, "StyleSheet nicht gefunden");
189 : :
190 [ # # ][ # # ]: 0 : SfxItemSet aTempSet( pSheet->GetItemSet() );
191 [ # # ]: 0 : aTempSet.Put( rSet );
192 [ # # ]: 0 : aTempSet.ClearInvalidItems();
193 : :
194 : : // Undo-Action
195 [ # # ][ # # ]: 0 : StyleSheetUndoAction* pAction = new StyleSheetUndoAction(&mrDoc, pSheet, &aTempSet);
196 [ # # ][ # # ]: 0 : mpDocSh->GetUndoManager()->AddUndoAction(pAction);
197 : :
198 [ # # ][ # # ]: 0 : pSheet->GetItemSet().Put(aTempSet);
199 [ # # ][ # # ]: 0 : pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
[ # # ]
200 [ # # ]: 0 : bOk = sal_True;
201 : : }
202 [ # # ]: 0 : else if (eObjKind == OBJ_OUTLINETEXT)
203 : : {
204 : : // Presentation object outline
205 : 0 : OutlinerView* pOV = GetTextEditOutlinerView();
206 : 0 : ::Outliner* pOutliner = pOV->GetOutliner();
207 : :
208 [ # # ][ # # ]: 0 : aTemplateName += String(SdResId(STR_LAYOUT_OUTLINE));
[ # # ][ # # ]
209 : :
210 [ # # ]: 0 : pOutliner->SetUpdateMode(sal_False);
211 [ # # ]: 0 : mpDocSh->SetWaitCursor( sal_True );
212 : :
213 : : // Platzhalter durch Vorlagennamen ersetzen
214 [ # # ][ # # ]: 0 : String aComment(SdResId(STR_UNDO_CHANGE_PRES_OBJECT));
215 [ # # ]: 0 : xub_StrLen nPos = aComment.Search( (sal_Unicode)'$' );
216 [ # # ]: 0 : aComment.Erase(nPos, 1);
217 [ # # ][ # # ]: 0 : aComment.Insert( String((SdResId(STR_PSEUDOSHEET_OUTLINE))), nPos);
[ # # ][ # # ]
218 [ # # ][ # # ]: 0 : mpDocSh->GetUndoManager()->EnterListAction( aComment, String() );
[ # # ][ # # ]
219 : :
220 [ # # ]: 0 : std::vector<Paragraph*> aSelList;
221 [ # # ]: 0 : pOV->CreateSelectionList(aSelList);
222 : :
223 : 0 : std::vector<Paragraph*>::reverse_iterator iter = aSelList.rbegin();
224 [ # # ][ # # ]: 0 : Paragraph* pPara = iter != aSelList.rend() ? *iter : NULL;
[ # # ]
225 : :
226 [ # # ]: 0 : while (pPara)
227 : : {
228 [ # # ]: 0 : sal_uLong nParaPos = pOutliner->GetAbsPos( pPara );
229 [ # # ]: 0 : sal_Int16 nDepth = pOutliner->GetDepth( (sal_uInt16) nParaPos );
230 [ # # ]: 0 : String aName(rPage.GetLayoutName());
231 [ # # ]: 0 : aName += (sal_Unicode)(' ');
232 [ # # ][ # # ]: 0 : aName += String::CreateFromInt32( (nDepth <= 0) ? 1 : nDepth + 1 );
[ # # ][ # # ]
233 [ # # ]: 0 : SfxStyleSheet* pSheet = (SfxStyleSheet*)pStShPool->Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
234 : : DBG_ASSERT(pSheet, "StyleSheet nicht gefunden");
235 : :
236 [ # # ][ # # ]: 0 : SfxItemSet aTempSet( pSheet->GetItemSet() );
237 [ # # ]: 0 : aTempSet.Put( rSet );
238 [ # # ]: 0 : aTempSet.ClearInvalidItems();
239 : :
240 [ # # ][ # # ]: 0 : if( nDepth > 0 && aTempSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON )
[ # # ][ # # ]
241 : : {
242 : : // no SvxNumBulletItem in outline level 1 to 8!
243 [ # # ]: 0 : aTempSet.ClearItem( EE_PARA_NUMBULLET );
244 : : }
245 : :
246 : : // Undo-Action
247 [ # # ][ # # ]: 0 : StyleSheetUndoAction* pAction = new StyleSheetUndoAction(&mrDoc, pSheet, &aTempSet);
248 [ # # ][ # # ]: 0 : mpDocSh->GetUndoManager()->AddUndoAction(pAction);
249 : :
250 [ # # ][ # # ]: 0 : pSheet->GetItemSet().Put(aTempSet);
251 [ # # ][ # # ]: 0 : pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
[ # # ]
252 : :
253 : : // now also broadcast any child sheets
254 : : sal_Int16 nChild;
255 [ # # ]: 0 : for( nChild = nDepth + 1; nChild < 9; nChild++ )
256 : : {
257 [ # # ]: 0 : String aSheetName(rPage.GetLayoutName());
258 [ # # ]: 0 : aSheetName += (sal_Unicode)(' ');
259 [ # # ][ # # ]: 0 : aSheetName += String::CreateFromInt32( nChild <= 0 ? 1 : nChild + 1 );
[ # # ][ # # ]
260 [ # # ]: 0 : SfxStyleSheet* pOutlSheet = static_cast< SfxStyleSheet* >(pStShPool->Find(aSheetName, SD_STYLE_FAMILY_MASTERPAGE));
261 : :
262 [ # # ]: 0 : if( pOutlSheet )
263 [ # # ][ # # ]: 0 : pOutlSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
[ # # ]
264 [ # # ]: 0 : }
265 : :
266 [ # # ]: 0 : ++iter;
267 [ # # ][ # # ]: 0 : pPara = iter != aSelList.rend() ? *iter : NULL;
[ # # ]
268 : :
269 [ # # ][ # # ]: 0 : if( !pPara && nDepth > 0 && rSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON &&
[ # # ][ # # ]
[ # # ][ # # ]
270 [ # # ][ # # ]: 0 : pOutliner->GetDepth( (sal_uInt16) pOutliner->GetAbsPos(*(aSelList.begin())) ) > 0 )
[ # # ][ # # ]
271 [ # # ]: 0 : pPara = pOutliner->GetParagraph( 0 ); // Put NumBulletItem in outline level 1
272 [ # # ][ # # ]: 0 : }
273 : :
274 [ # # ]: 0 : mpDocSh->SetWaitCursor( sal_False );
275 [ # # ]: 0 : pOV->GetOutliner()->SetUpdateMode(sal_True);
276 : :
277 [ # # ][ # # ]: 0 : mpDocSh->GetUndoManager()->LeaveListAction();
278 : :
279 [ # # ]: 0 : bOk = sal_True;
280 : : }
281 : : else
282 : : {
283 [ # # ]: 0 : bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
284 : : }
285 [ # # ]: 0 : }
286 : : }
287 : : else
288 : : {
289 : : // Selection
290 : 0 : const SdrMarkList& rList = GetMarkedObjectList();
291 : 0 : sal_uLong nMarkCount = rList.GetMarkCount();
292 [ # # ]: 0 : for (sal_uLong nMark = 0; nMark < nMarkCount; nMark++)
293 : : {
294 [ # # ][ # # ]: 0 : SdrObject* pObject = rList.GetMark(nMark)->GetMarkedSdrObj();
295 [ # # ]: 0 : sal_uInt32 nInv = pObject->GetObjInventor();
296 : :
297 [ # # ]: 0 : if (nInv == SdrInventor)
298 : : {
299 [ # # ]: 0 : sal_uInt16 eObjKind = pObject->GetObjIdentifier();
300 [ # # ]: 0 : PresObjKind ePresObjKind = rPage.GetPresObjKind(pObject);
301 [ # # ]: 0 : String aTemplateName(aLayoutName);
302 : :
303 [ # # ][ # # ]: 0 : if (ePresObjKind == PRESOBJ_TITLE ||
304 : : ePresObjKind == PRESOBJ_NOTES)
305 : : {
306 : : // Presentation object (except outline)
307 [ # # ]: 0 : SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj( ePresObjKind );
308 : : DBG_ASSERT(pSheet, "StyleSheet not found");
309 : :
310 [ # # ][ # # ]: 0 : SfxItemSet aTempSet( pSheet->GetItemSet() );
311 [ # # ]: 0 : aTempSet.Put( rSet );
312 [ # # ]: 0 : aTempSet.ClearInvalidItems();
313 : :
314 : : // Undo-Action
315 [ # # ][ # # ]: 0 : StyleSheetUndoAction* pAction = new StyleSheetUndoAction(&mrDoc, pSheet, &aTempSet);
316 [ # # ][ # # ]: 0 : mpDocSh->GetUndoManager()->AddUndoAction(pAction);
317 : :
318 [ # # ][ # # ]: 0 : pSheet->GetItemSet().Put(aTempSet,false);
319 [ # # ][ # # ]: 0 : pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
[ # # ]
320 [ # # ]: 0 : bOk = sal_True;
321 : : }
322 [ # # ]: 0 : else if (eObjKind == OBJ_OUTLINETEXT)
323 : : {
324 : : // Presentation object outline
325 [ # # ][ # # ]: 0 : aTemplateName += String(SdResId(STR_LAYOUT_OUTLINE));
[ # # ][ # # ]
326 [ # # ]: 0 : for (sal_uInt16 nLevel = 9; nLevel > 0; nLevel--)
327 : : {
328 [ # # ]: 0 : String aName(rPage.GetLayoutName());
329 [ # # ]: 0 : aName += (sal_Unicode)(' ');
330 [ # # ][ # # ]: 0 : aName += String::CreateFromInt32( (sal_Int32)nLevel );
[ # # ]
331 : : SfxStyleSheet* pSheet = (SfxStyleSheet*)pStShPool->
332 [ # # ]: 0 : Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
333 : : DBG_ASSERT(pSheet, "StyleSheet nicht gefunden");
334 : :
335 [ # # ][ # # ]: 0 : SfxItemSet aTempSet( pSheet->GetItemSet() );
336 : :
337 [ # # ]: 0 : if( nLevel > 1 )
338 : : {
339 : : // for all levels over 1, clear all items that will be
340 : : // hard set to level 1
341 [ # # ]: 0 : SfxWhichIter aWhichIter(rSet);
342 [ # # ]: 0 : sal_uInt16 nWhich(aWhichIter.FirstWhich());
343 [ # # ]: 0 : while( nWhich )
344 : : {
345 [ # # ][ # # ]: 0 : if( SFX_ITEM_ON == rSet.GetItemState( nWhich ) )
346 [ # # ]: 0 : aTempSet.ClearItem( nWhich );
347 [ # # ]: 0 : nWhich = aWhichIter.NextWhich();
348 [ # # ]: 0 : }
349 : :
350 : : }
351 : : else
352 : : {
353 : : // put the items hard into level one
354 [ # # ]: 0 : aTempSet.Put( rSet );
355 : : }
356 : :
357 [ # # ]: 0 : aTempSet.ClearInvalidItems();
358 : :
359 : : // Undo-Action
360 [ # # ][ # # ]: 0 : StyleSheetUndoAction* pAction = new StyleSheetUndoAction(&mrDoc, pSheet, &aTempSet);
361 [ # # ][ # # ]: 0 : mpDocSh->GetUndoManager()->AddUndoAction(pAction);
362 : :
363 [ # # ][ # # ]: 0 : pSheet->GetItemSet().Set(aTempSet,false);
364 [ # # ][ # # ]: 0 : pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
[ # # ]
365 [ # # ][ # # ]: 0 : }
366 : :
367 : : // remove all hard set items from shape that are now set in style
368 [ # # ]: 0 : SfxWhichIter aWhichIter(rSet);
369 [ # # ]: 0 : sal_uInt16 nWhich(aWhichIter.FirstWhich());
370 [ # # ]: 0 : while( nWhich )
371 : : {
372 [ # # ][ # # ]: 0 : if( SFX_ITEM_ON == rSet.GetItemState( nWhich ) )
373 [ # # ]: 0 : pObject->ClearMergedItem( nWhich );
374 [ # # ]: 0 : nWhich = aWhichIter.NextWhich();
375 : : }
376 : :
377 [ # # ]: 0 : bOk = sal_True;
378 [ # # ]: 0 : }
379 : : }
380 : : }
381 : :
382 [ # # ]: 0 : if(!bOk)
383 [ # # ]: 0 : bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
384 [ # # ]: 0 : }
385 : : }
386 : : else // nicht auf der Masterpage
387 : : {
388 : 0 : bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
389 : : }
390 : :
391 : 0 : return (bOk);
392 : : }
393 : :
394 : : /*************************************************************************
395 : : |*
396 : : |* Notify fuer Aenderung der Seitenanordnung
397 : : |*
398 : : \************************************************************************/
399 : :
400 : 4193 : void DrawView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
401 : : {
402 [ + + ][ + - ]: 4193 : if ( mpDrawViewShell && rHint.ISA(SdrHint) )
[ + + ]
403 : : {
404 : 3292 : SdrHintKind eHintKind = ( (SdrHint&) rHint).GetKind();
405 : :
406 [ + + ][ + - ]: 3292 : if ( mnPOCHSmph == 0 && eHintKind == HINT_PAGEORDERCHG )
407 : : {
408 : 320 : mpDrawViewShell->ResetActualPage();
409 : : }
410 [ + - ][ + + ]: 2972 : else if ( eHintKind == HINT_LAYERCHG || eHintKind == HINT_LAYERORDERCHG )
411 : : {
412 : 4 : mpDrawViewShell->ResetActualLayer();
413 : : }
414 : :
415 : : // switch to that page when it's not a master page
416 [ - + ]: 3292 : if(HINT_SWITCHTOPAGE == eHintKind)
417 : : {
418 : 0 : const SdrPage* pPage = ((const SdrHint&)rHint).GetPage();
419 : :
420 [ # # ][ # # ]: 0 : if(pPage && !pPage->IsMasterPage())
[ # # ]
421 : : {
422 [ # # ]: 0 : if(mpDrawViewShell->GetActualPage() != pPage)
423 : : {
424 : 0 : sal_uInt16 nPageNum = (pPage->GetPageNum() - 1) / 2; // Sdr --> Sd
425 : 0 : mpDrawViewShell->SwitchPage(nPageNum);
426 : : }
427 : : }
428 : : }
429 : : }
430 : :
431 : 4193 : ::sd::View::Notify(rBC, rHint);
432 : 4193 : }
433 : :
434 : : /*************************************************************************
435 : : |*
436 : : |* PageOrderChangedHint blockieren/freigeben
437 : : |*
438 : : \************************************************************************/
439 : :
440 : 0 : void DrawView::BlockPageOrderChangedHint(sal_Bool bBlock)
441 : : {
442 [ # # ]: 0 : if (bBlock)
443 : 0 : mnPOCHSmph++;
444 : : else
445 : : {
446 : : DBG_ASSERT(mnPOCHSmph, "Zaehlerunterlauf");
447 : 0 : mnPOCHSmph--;
448 : : }
449 : 0 : }
450 : :
451 : : /*************************************************************************
452 : : |*
453 : : |* StyleSheet-Setzen auf der Masterpage abfangen, wenn Praesentationsobjekte
454 : : |* selektiert sind
455 : : |*
456 : : \************************************************************************/
457 : :
458 : 0 : sal_Bool DrawView::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
459 : : {
460 : 0 : sal_Bool bResult = sal_True;
461 : :
462 : : // wird eine Masterpage bearbeitet?
463 [ # # ][ # # ]: 0 : if (mpDrawViewShell && mpDrawViewShell->GetEditMode() == EM_MASTERPAGE)
[ # # ]
464 : : {
465 [ # # ]: 0 : if (IsPresObjSelected(sal_False, sal_True))
466 : : {
467 : :
468 [ # # ]: 0 : InfoBox(mpDrawViewShell->GetActiveWindow(),
469 [ # # ][ # # ]: 0 : String(SdResId(STR_ACTION_NOTPOSSIBLE))).Execute();
[ # # ][ # # ]
[ # # ]
470 : 0 : bResult = sal_False;
471 : : }
472 : : else
473 : : {
474 : 0 : bResult = ::sd::View::SetStyleSheet(pStyleSheet, bDontRemoveHardAttr);
475 : : }
476 : : }
477 : : else
478 : : {
479 : 0 : bResult = ::sd::View::SetStyleSheet(pStyleSheet, bDontRemoveHardAttr);
480 : : }
481 : 0 : return bResult;
482 : : }
483 : :
484 : : /*************************************************************************
485 : : |*
486 : : |* Paint-Methode: das Ereignis wird an die View weitergeleitet
487 : : |*
488 : : \************************************************************************/
489 : :
490 : 1250 : void DrawView::CompleteRedraw(OutputDevice* pOutDev, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector /*=0L*/)
491 : : {
492 [ - + ]: 1250 : if( mpVDev )
493 : : {
494 [ # # ]: 0 : delete mpVDev;
495 : 0 : mpVDev = NULL;
496 : : }
497 : :
498 : 1250 : sal_Bool bStandardPaint = sal_True;
499 : :
500 : 1250 : SdDrawDocument* pDoc = mpDocShell->GetDoc();
501 [ + + ][ + + ]: 1250 : if( pDoc && pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS)
[ + - ]
502 : : {
503 [ + - ]: 144 : rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( pDoc ) );
504 [ + - ][ + - ]: 144 : if(xSlideshow.is() && xSlideshow->isRunning())
[ - + ][ - + ]
505 : : {
506 [ # # ]: 0 : OutputDevice* pShowWindow = ( OutputDevice* )xSlideshow->getShowWindow();
507 [ # # ][ # # ]: 0 : if( (pShowWindow == pOutDev) || (xSlideshow->getAnimationMode() == ANIMATIONMODE_PREVIEW) )
[ # # ][ # # ]
508 : : {
509 [ # # ]: 0 : if( pShowWindow == pOutDev )
510 [ # # ]: 0 : PresPaint(rReg);
511 : 0 : bStandardPaint = sal_False;
512 : : }
513 : 144 : }
514 : : }
515 : :
516 [ + - ]: 1250 : if(bStandardPaint)
517 : : {
518 : 1250 : ::sd::View::CompleteRedraw(pOutDev, rReg, pRedirector);
519 : : }
520 : 1250 : }
521 : :
522 : : /*************************************************************************
523 : : |*
524 : : |* Paint-Event during running slide show
525 : : |*
526 : : \************************************************************************/
527 : :
528 : 0 : void DrawView::PresPaint(const Region& rRegion)
529 : : {
530 [ # # ]: 0 : if(mpViewSh)
531 : : {
532 [ # # ]: 0 : rtl::Reference< SlideShow > xSlideshow( SlideShow::GetSlideShow( GetDoc() ) );
533 [ # # ][ # # ]: 0 : if( xSlideshow.is() && xSlideshow->isRunning() )
[ # # ][ # # ]
534 [ # # ][ # # ]: 0 : xSlideshow->paint( rRegion.GetBoundRect() );
535 : : }
536 : 0 : }
537 : :
538 : : /*************************************************************************
539 : : |* entscheidet, ob ein Objekt markiert werden kann (z. B. noch nicht
540 : : |* erschienene Animationsobjekte in der Diashow)
541 : : \************************************************************************/
542 : :
543 : 2 : sal_Bool DrawView::IsObjMarkable(SdrObject* pObj, SdrPageView* pPV) const
544 : : {
545 : 2 : return FmFormView::IsObjMarkable(pObj, pPV);
546 : : }
547 : :
548 : : /*************************************************************************
549 : : |*
550 : : |* Uebergebenen Bereich sichtbar machen (es wird ggf. gescrollt)
551 : : |*
552 : : \************************************************************************/
553 : :
554 : 0 : void DrawView::MakeVisible(const Rectangle& rRect, ::Window& rWin)
555 : : {
556 [ # # ][ # # ]: 0 : if (!rRect.IsEmpty() && mpDrawViewShell)
[ # # ]
557 : : {
558 : 0 : mpDrawViewShell->MakeVisible(rRect, rWin);
559 : : }
560 : 0 : }
561 : : /*************************************************************************
562 : : |*
563 : : |* Seite wird gehided
564 : : |*
565 : : \************************************************************************/
566 : :
567 : 413 : void DrawView::HideSdrPage()
568 : : {
569 [ + + ]: 413 : if (mpDrawViewShell)
570 : : {
571 : 143 : mpDrawViewShell->HidePage();
572 : : }
573 : :
574 : 413 : ::sd::View::HideSdrPage();
575 : 413 : }
576 : :
577 : 0 : void DrawView::DeleteMarked()
578 : : {
579 : : OSL_TRACE( "DrawView::DeleteMarked() - enter" );
580 : :
581 : 0 : sd::UndoManager* pUndoManager = mrDoc.GetUndoManager();
582 : : DBG_ASSERT( pUndoManager, "sd::DrawView::DeleteMarked(), ui action without undo manager!?" );
583 : :
584 [ # # ]: 0 : if( pUndoManager )
585 : : {
586 [ # # ][ # # ]: 0 : String aUndo( SVX_RES(STR_EditDelete) );
587 [ # # ]: 0 : String aSearchString(RTL_CONSTASCII_USTRINGPARAM("%1"));
588 [ # # ][ # # ]: 0 : aUndo.SearchAndReplace(aSearchString, GetDescriptionOfMarkedObjects());
[ # # ]
589 [ # # ][ # # ]: 0 : pUndoManager->EnterListAction(aUndo, aUndo);
[ # # ]
590 : : }
591 : :
592 : 0 : SdPage* pPage = 0;
593 : 0 : bool bResetLayout = false;
594 : :
595 : 0 : const sal_uLong nMarkCount = GetMarkedObjectList().GetMarkCount();
596 [ # # ]: 0 : if( nMarkCount )
597 : : {
598 [ # # ]: 0 : SdrMarkList aList( GetMarkedObjectList() );
599 [ # # ]: 0 : for (sal_uLong nMark = 0; nMark < nMarkCount; nMark++)
600 : : {
601 [ # # ][ # # ]: 0 : SdrObject* pObj = aList.GetMark(nMark)->GetMarkedSdrObj();
602 [ # # ][ # # ]: 0 : if( pObj && !pObj->IsEmptyPresObj() && pObj->GetUserCall() )
[ # # ][ # # ]
[ # # ][ # # ]
603 : : {
604 [ # # ]: 0 : pPage = static_cast< SdPage* >( pObj->GetPage() );
605 : : PresObjKind ePresObjKind;
606 [ # # ][ # # ]: 0 : if( pPage && ((ePresObjKind = pPage->GetPresObjKind(pObj)) != PRESOBJ_NONE))
[ # # ][ # # ]
607 : : {
608 [ # # ]: 0 : switch( ePresObjKind )
609 : : {
610 : : case PRESOBJ_GRAPHIC:
611 : : case PRESOBJ_OBJECT:
612 : : case PRESOBJ_CHART:
613 : : case PRESOBJ_ORGCHART:
614 : : case PRESOBJ_TABLE:
615 : : case PRESOBJ_CALC:
616 : : case PRESOBJ_IMAGE:
617 : : case PRESOBJ_MEDIA:
618 : 0 : ePresObjKind = PRESOBJ_OUTLINE;
619 : 0 : break;
620 : : default:
621 : 0 : break;
622 : : }
623 [ # # ]: 0 : SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
624 [ # # ][ # # ]: 0 : bool bVertical = pTextObj && pTextObj->IsVerticalWriting();
[ # # ]
625 [ # # ]: 0 : Rectangle aRect( pObj->GetLogicRect() );
626 [ # # ]: 0 : SdrObject* pNewObj = pPage->InsertAutoLayoutShape( 0, ePresObjKind, bVertical, aRect, true );
627 : :
628 [ # # ][ # # ]: 0 : pPage->SetObjectOrdNum( pNewObj->GetOrdNum(), pObj->GetOrdNum() );
[ # # ]
629 : :
630 : 0 : bResetLayout = true;
631 : :
632 : : OSL_TRACE( "DrawView::InsertAutoLayoutShape() - InsertAutoLayoutShape" );
633 : : }
634 : : }
635 [ # # ]: 0 : }
636 : : }
637 : :
638 : 0 : ::sd::View::DeleteMarked();
639 : :
640 [ # # ][ # # ]: 0 : if( pPage && bResetLayout )
641 : 0 : pPage->SetAutoLayout( pPage->GetAutoLayout() );
642 : :
643 [ # # ]: 0 : if( pUndoManager )
644 : 0 : pUndoManager->LeaveListAction();
645 : :
646 : : OSL_TRACE( "DrawView::InsertAutoLayoutShape() - leave" );
647 : 0 : }
648 : :
649 : : } // end of namespace sd
650 : :
651 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|