xref: /aoo41x/main/sd/source/ui/view/drviews2.cxx (revision 1ff378ef)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sd.hxx"
26 
27 #include "DrawViewShell.hxx"
28 #include "ViewShellImplementation.hxx"
29 #include <vcl/waitobj.hxx>
30 #include <svx/svdograf.hxx>
31 #ifndef _SVXIDS_HRC
32 #include <svx/svxids.hrc>
33 #endif
34 #include <svx/svdpagv.hxx>
35 #include <svx/svdundo.hxx>
36 #ifndef _ZOOMITEM_HXX
37 #include <svx/zoomitem.hxx>
38 #endif
39 #ifndef _EDITDATA_HXX
40 #include <editeng/editdata.hxx>
41 #endif
42 #include <basic/sberrors.hxx>
43 #include <vcl/msgbox.hxx>
44 #include <sfx2/request.hxx>
45 #include <sfx2/dispatch.hxx>
46 #include <svx/xfillit0.hxx>
47 #include <svx/xflclit.hxx>
48 #include <svl/aeitem.hxx>
49 #include <editeng/eeitem.hxx>
50 #include <basic/sbstar.hxx>
51 #include <editeng/flditem.hxx>
52 #include <svx/xlineit0.hxx>
53 #include <svx/xfillit0.hxx>
54 
55 #ifndef _SDOUTL_HXX //autogen
56 #include <svx/svdoutl.hxx>
57 #endif
58 #include <svx/xlnwtit.hxx>
59 #include <svx/svdoattr.hxx>
60 #include <svx/xlnstwit.hxx>
61 #include <svx/sdtmfitm.hxx>
62 #include <svx/sdtagitm.hxx>
63 #include <svx/xlnedwit.hxx>
64 #include <svx/fontworkbar.hxx>
65 
66 #include <editeng/escpitem.hxx>
67 #include <editeng/kernitem.hxx>
68 #include <editeng/wghtitem.hxx>
69 #include <editeng/postitem.hxx>
70 #include <editeng/udlnitem.hxx>
71 #include <editeng/crsditem.hxx>
72 #include <editeng/cntritem.hxx>
73 #include <editeng/shdditem.hxx>
74 #include <svx/xtable.hxx>
75 #include <svx/svdobj.hxx>
76 #include <editeng/outlobj.hxx>
77 #include <editeng/flstitem.hxx>
78 #include <editeng/scripttypeitem.hxx>
79 #include <editeng/fontitem.hxx>
80 #include <editeng/fhgtitem.hxx>
81 #include <editeng/colritem.hxx>
82 #include <editeng/brshitem.hxx>
83 
84 #include <svl/whiter.hxx>
85 
86 #include <svx/svxdlg.hxx>
87 #include <svx/dialogs.hrc>
88 
89 #include <sfx2/viewfrm.hxx>
90 #include "sdgrffilter.hxx"
91 
92 #include "app.hrc"
93 #include "glob.hrc"
94 #include "helpids.h"
95 #include "sdattr.hxx"
96 #include "drawview.hxx"
97 #include "Window.hxx"
98 #include "drawdoc.hxx"
99 #include "DrawDocShell.hxx"
100 #include "sdpage.hxx"
101 #include "fuscale.hxx"
102 #include "sdresid.hxx"
103 #include "GraphicViewShell.hxx"
104 #include "unmodpg.hxx"
105 #include "slideshow.hxx"
106 #include "fuvect.hxx"
107 #include "stlpool.hxx"
108 
109 // #90356#
110 #include "optsitem.hxx"
111 #include "sdabstdlg.hxx"
112 #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
113 #include <com/sun/star/drawing/XDrawPages.hpp>
114 
115 #include <strings.hrc>
116 
117 using namespace ::com::sun::star;
118 using namespace ::com::sun::star::uno;
119 
120 namespace sd {
121 
122 /*************************************************************************
123 |*
124 |* SfxRequests fuer temporaere Funktionen
125 |*
126 \************************************************************************/
127 
128 void DrawViewShell::FuTemporary(SfxRequest& rReq)
129 {
130 	// Waehrend einer Native-Diashow wird nichts ausgefuehrt!
131 	if(SlideShow::IsRunning( GetViewShellBase() ) && (rReq.GetSlot() != SID_NAVIGATOR))
132 		return;
133 
134 	DBG_ASSERT( mpDrawView, "sd::DrawViewShell::FuTemporary(), no draw view!" );
135 	if( !mpDrawView )
136 		return;
137 
138 	CheckLineTo (rReq);
139 
140 	DeactivateCurrentFunction();
141 
142 	sal_uInt16 nSId = rReq.GetSlot();
143 
144 	// Slot wird gemapped (ToolboxImages/-Slots)
145 	MapSlot( nSId );
146 
147 	switch ( nSId )
148 	{
149 		// Flaechen und Linien-Attribute:
150 		// Sollten (wie StateMethode) eine eigene
151 		// Execute-Methode besitzen
152 		case SID_ATTR_FILL_STYLE:
153 		case SID_ATTR_FILL_COLOR:
154 		case SID_ATTR_FILL_GRADIENT:
155 		case SID_ATTR_FILL_HATCH:
156 		case SID_ATTR_FILL_BITMAP:
157 		case SID_ATTR_FILL_SHADOW:
158         case SID_ATTR_FILL_TRANSPARENCE:
159         case SID_ATTR_FILL_FLOATTRANSPARENCE:
160 
161 		case SID_ATTR_LINE_STYLE:
162 		case SID_ATTR_LINE_DASH:
163 		case SID_ATTR_LINE_WIDTH:
164 		case SID_ATTR_LINE_COLOR:
165 		case SID_ATTR_LINEEND_STYLE:
166         case SID_ATTR_LINE_START:
167         case SID_ATTR_LINE_END:
168         case SID_ATTR_LINE_TRANSPARENCE:
169         case SID_ATTR_LINE_JOINT:
170         case SID_ATTR_LINE_CAP:
171 
172 		case SID_ATTR_TEXT_FITTOSIZE:
173 		{
174 			if( rReq.GetArgs() )
175 			{
176 				sal_Bool bMergeUndo = sal_False;
177 				::svl::IUndoManager* pUndoManager = GetDocSh()->GetUndoManager();
178 
179 				// Anpassungen Start/EndWidth #63083#
180 				if(nSId == SID_ATTR_LINE_WIDTH)
181 				{
182 					SdrObject* pObj = NULL;
183 					const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
184 					sal_uLong nCount = rMarkList.GetMarkCount();
185 					const sal_Int32 nNewLineWidth(((const XLineWidthItem&)rReq.GetArgs()->Get(XATTR_LINEWIDTH)).GetValue());
186 					const bool bUndo(mpDrawView->IsUndoEnabled());
187 
188 					for (sal_uLong i=0; i<nCount; i++)
189 					{
190 						SfxItemSet aAttr(GetDoc()->GetPool());
191 						pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
192 						aAttr.Put(pObj->GetMergedItemSet());
193 
194 						sal_Int32 nActLineWidth = ((const XLineWidthItem&)aAttr.Get(XATTR_LINEWIDTH)).GetValue();
195 
196 						if(nActLineWidth != nNewLineWidth)
197 						{
198 							sal_Bool bSetItemSet(sal_False);
199 
200 							// #86265# do this for SFX_ITEM_DEFAULT and for SFX_ITEM_SET
201 							if(SFX_ITEM_DONTCARE != aAttr.GetItemState(XATTR_LINESTARTWIDTH))
202 							{
203 								sal_Int32 nValAct = ((const XLineStartWidthItem&)aAttr.Get(XATTR_LINESTARTWIDTH)).GetValue();
204 								sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
205 								if(nValNew < 0)
206 									nValNew = 0;
207 								bSetItemSet = sal_True;
208 								aAttr.Put(XLineStartWidthItem(nValNew));
209 							}
210 
211 							// #86265# do this for SFX_ITEM_DEFAULT and for SFX_ITEM_SET
212 							if(SFX_ITEM_DONTCARE != aAttr.GetItemState(XATTR_LINEENDWIDTH))
213 							{
214 								sal_Int32 nValAct = ((const XLineEndWidthItem&)aAttr.Get(XATTR_LINEENDWIDTH)).GetValue();
215 								sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
216 								if(nValNew < 0)
217 									nValNew = 0;
218 								bSetItemSet = sal_True;
219 								aAttr.Put(XLineEndWidthItem(nValNew));
220 							}
221 
222 							if(bSetItemSet)
223                             {
224                                 if(bUndo)
225                                 {
226                                     if(!bMergeUndo)
227                                     {
228 										pUndoManager->EnterListAction( String(), String() );
229             							mpDrawView->BegUndo();
230 										bMergeUndo = sal_True;
231                                     }
232 
233                                     mpDrawView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
234                                 }
235 
236                                 pObj->SetMergedItemSet(aAttr);
237                             }
238 						}
239 					}
240 
241                     if(bMergeUndo)
242                     {
243 						mpDrawView->EndUndo();
244                     }
245 				}
246 
247 				if (nSId == SID_ATTR_FILL_SHADOW)
248 				{
249 					// Ggf. werden transparente Objekte wei?gefuellt
250 					SdrObject* pObj = NULL;
251 					const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
252 					sal_uLong nCount = rMarkList.GetMarkCount();
253 					const bool bUndo = mpDrawView->IsUndoEnabled();
254 
255 					for (sal_uLong i=0; i<nCount; i++)
256 					{
257 						SfxItemSet aAttr(GetDoc()->GetPool());
258 						pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
259 
260 						// #i25616#
261 						if(!pObj->ISA(SdrGrafObj))
262 						{
263 							aAttr.Put(pObj->GetMergedItemSet());
264 
265 							const XFillStyleItem& rFillStyle = (const XFillStyleItem&) aAttr.Get(XATTR_FILLSTYLE);
266 							const XLineStyleItem& rLineStyle = (const XLineStyleItem&) aAttr.Get(XATTR_LINESTYLE);
267 
268 							if(XFILL_NONE == rFillStyle.GetValue() && XLINE_NONE == rLineStyle.GetValue())
269 							{
270 								if( bUndo )
271 								{
272 									// Vorlage hat keine Fuellung,
273 									// daher hart attributieren: Fuellung setzen
274 									if (!bMergeUndo)
275 									{
276 										bMergeUndo = sal_True;
277 										pUndoManager->EnterListAction( String(), String() );
278 										mpDrawView->BegUndo();
279 									}
280 
281 									mpDrawView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
282 								}
283 
284 								aAttr.Put(XFillStyleItem(XFILL_SOLID));
285 								aAttr.Put(XFillColorItem(String(), COL_WHITE));
286 
287 								pObj->SetMergedItemSet(aAttr);
288 							}
289 						}
290 					}
291 
292 					if (bMergeUndo)
293 					{
294 						mpDrawView->EndUndo();
295 					}
296 				}
297 
298 				mpDrawView->SetAttributes(*rReq.GetArgs());
299 
300 				if (bMergeUndo)
301 				{
302 					pUndoManager->LeaveListAction();
303 				}
304 
305 				rReq.Done();
306 			}
307 			else
308 			{
309 				switch( rReq.GetSlot() )
310 				{
311 					case SID_ATTR_FILL_SHADOW:
312 					case SID_ATTR_FILL_STYLE:
313 					case SID_ATTR_FILL_COLOR:
314 					case SID_ATTR_FILL_GRADIENT:
315 					case SID_ATTR_FILL_HATCH:
316 					case SID_ATTR_FILL_BITMAP:
317                     case SID_ATTR_FILL_TRANSPARENCE:
318                     case SID_ATTR_FILL_FLOATTRANSPARENCE:
319 						GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_AREA, SFX_CALLMODE_ASYNCHRON );
320 						break;
321 					case SID_ATTR_LINE_STYLE:
322 					case SID_ATTR_LINE_DASH:
323 					case SID_ATTR_LINE_WIDTH:
324 					case SID_ATTR_LINE_COLOR:
325                     case SID_ATTR_LINE_TRANSPARENCE:
326                     case SID_ATTR_LINE_JOINT:
327                     case SID_ATTR_LINE_CAP:
328 						GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_LINE, SFX_CALLMODE_ASYNCHRON );
329 						break;
330 					case SID_ATTR_TEXT_FITTOSIZE:
331 						GetViewFrame()->GetDispatcher()->Execute( SID_TEXTATTR_DLG, SFX_CALLMODE_ASYNCHRON );
332 						break;
333 				}
334 			}
335 			Cancel();
336 		}
337 		break;
338 
339 		case SID_HYPHENATION:
340 		{
341 			// const SfxPoolItem* pItem = rReq.GetArg( SID_HYPHENATION );
342 			//  ^-- Soll so nicht benutzt werden (Defaults sind falsch) !
343 			SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, SID_HYPHENATION, sal_False);
344 
345 			if( pItem )
346 			{
347 				SfxItemSet aSet( GetPool(), EE_PARA_HYPHENATE, EE_PARA_HYPHENATE );
348 				sal_Bool bValue = ( (const SfxBoolItem*) pItem)->GetValue();
349 				aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) );
350 				mpDrawView->SetAttributes( aSet );
351 			}
352 			else // nur zum Test
353 			{
354 				DBG_ERROR(" Kein Wert fuer Silbentrennung!");
355 				SfxItemSet aSet( GetPool(), EE_PARA_HYPHENATE, EE_PARA_HYPHENATE );
356 				sal_Bool bValue = sal_True;
357 				aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) );
358 				mpDrawView->SetAttributes( aSet );
359 			}
360 			rReq.Done();
361 			Cancel();
362 		}
363 		break;
364 
365 		case SID_INSERTPAGE:
366 		case SID_INSERTPAGE_QUICK:
367 		case SID_DUPLICATE_PAGE:
368         {
369             SdPage* pNewPage = CreateOrDuplicatePage (rReq, mePageKind, GetActualPage());
370             Cancel();
371             if(HasCurrentFunction(SID_BEZIER_EDIT) )
372                 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
373             if (pNewPage != NULL)
374                 SwitchPage((pNewPage->GetPageNum()-1)/2);
375             rReq.Done ();
376         }
377 		break;
378 
379 		case SID_INSERT_MASTER_PAGE:
380         {
381             // Use the API to create a new page.
382             Reference<drawing::XMasterPagesSupplier> xMasterPagesSupplier (
383                 GetDoc()->getUnoModel(), UNO_QUERY);
384             if (xMasterPagesSupplier.is())
385             {
386                 Reference<drawing::XDrawPages> xMasterPages (
387                     xMasterPagesSupplier->getMasterPages());
388                 if (xMasterPages.is())
389                 {
390                     sal_uInt16 nIndex = GetCurPageId();
391                     xMasterPages->insertNewByIndex (nIndex);
392 
393                     // Create shapes for the default layout.
394                     SdPage* pMasterPage = GetDoc()->GetMasterSdPage(
395                         nIndex, PK_STANDARD);
396                     pMasterPage->CreateTitleAndLayout (sal_True,sal_True);
397                 }
398             }
399 
400             Cancel();
401             if(HasCurrentFunction(SID_BEZIER_EDIT))
402                 GetViewFrame()->GetDispatcher()->Execute(
403                     SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
404             rReq.Done ();
405         }
406         break;
407 
408 		case SID_MODIFYPAGE:
409 		{
410 			if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES ||
411 				(mePageKind==PK_HANDOUT && meEditMode==EM_MASTERPAGE) )
412 			{
413 				if ( mpDrawView->IsTextEdit() )
414 				{
415 					mpDrawView->SdrEndTextEdit();
416 				}
417 				sal_uInt16 nPage = maTabControl.GetCurPageId() - 1;
418 				mpActualPage = GetDoc()->GetSdPage(nPage, mePageKind);
419                 ::sd::ViewShell::mpImpl->ProcessModifyPageSlot (
420                     rReq,
421                     mpActualPage,
422                     mePageKind);
423 			}
424 
425 			Cancel();
426 			rReq.Done ();
427 		}
428 		break;
429 
430         case SID_ASSIGN_LAYOUT:
431 		{
432 			if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES || (mePageKind==PK_HANDOUT && meEditMode==EM_MASTERPAGE))
433 			{
434 			    if ( mpDrawView->IsTextEdit() )
435 				    mpDrawView->SdrEndTextEdit();
436 
437 				::sd::ViewShell::mpImpl->AssignLayout(rReq, mePageKind);
438             }
439             Cancel();
440 			rReq.Done ();
441 		}
442         break;
443 
444 		case SID_RENAMEPAGE:
445 		case SID_RENAME_MASTER_PAGE:
446         {
447 			if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES )
448 			{
449 				if ( mpDrawView->IsTextEdit() )
450 				{
451 					mpDrawView->SdrEndTextEdit();
452 				}
453 
454                 sal_uInt16 nPageId = maTabControl.GetCurPageId();
455                 SdPage* pCurrentPage = ( GetEditMode() == EM_PAGE )
456                     ? GetDoc()->GetSdPage( nPageId - 1, GetPageKind() )
457                     : GetDoc()->GetMasterSdPage( nPageId - 1, GetPageKind() );
458 
459                 String aTitle( SdResId( STR_TITLE_RENAMESLIDE ) );
460                 String aDescr( SdResId( STR_DESC_RENAMESLIDE ) );
461                 String aPageName = pCurrentPage->GetName();
462 
463                 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
464 				DBG_ASSERT(pFact, "Dialogdiet fail!");
465 				AbstractSvxNameDialog* aNameDlg = pFact->CreateSvxNameDialog( GetActiveWindow(), aPageName, aDescr );
466 				DBG_ASSERT(aNameDlg, "Dialogdiet fail!");
467 				aNameDlg->SetText( aTitle );
468                 aNameDlg->SetCheckNameHdl( LINK( this, DrawViewShell, RenameSlideHdl ), true );
469                 aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE );
470 
471                 if( aNameDlg->Execute() == RET_OK )
472                 {
473                     String aNewName;
474                     aNameDlg->GetName( aNewName );
475                     if( ! aNewName.Equals( aPageName ) )
476                     {
477 #ifdef DBG_UTIL
478                         bool bResult =
479 #endif
480 							RenameSlide( nPageId, aNewName );
481                         DBG_ASSERT( bResult, "Couldn't rename slide" );
482                     }
483                 }
484 				delete aNameDlg;
485             }
486 
487 			Cancel();
488 			rReq.Ignore ();
489         }
490         break;
491 
492         case SID_RENAMEPAGE_QUICK:
493 		{
494 			if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES )
495 			{
496 				if ( mpDrawView->IsTextEdit() )
497 				{
498 					mpDrawView->SdrEndTextEdit();
499 				}
500 
501 				maTabControl.StartEditMode( maTabControl.GetCurPageId() );
502 			}
503 
504 			Cancel();
505 			rReq.Ignore ();
506 		}
507 		break;
508 
509 		case SID_PAGESIZE :  // entweder dieses (kein menueeintrag o. ae. !!)
510 		{
511 			const SfxItemSet *pArgs = rReq.GetArgs ();
512 
513 			if (pArgs)
514 				if (pArgs->Count () == 3)
515 				{
516 					SFX_REQUEST_ARG (rReq, pWidth, SfxUInt32Item, ID_VAL_PAGEWIDTH, sal_False);
517 					SFX_REQUEST_ARG (rReq, pHeight, SfxUInt32Item, ID_VAL_PAGEHEIGHT, sal_False);
518 					SFX_REQUEST_ARG (rReq, pScaleAll, SfxBoolItem, ID_VAL_SCALEOBJECTS, sal_False);
519 
520 					Size aSize (pWidth->GetValue (), pHeight->GetValue ());
521 
522 					SetupPage (aSize, 0, 0, 0, 0, sal_True, sal_False, pScaleAll->GetValue ());
523 					rReq.Ignore ();
524 					break;
525 				}
526 
527 			StarBASIC::FatalError (SbERR_WRONG_ARGS);
528 			rReq.Ignore ();
529 			break;
530 		}
531 
532 		case SID_PAGEMARGIN :  // oder dieses (kein menueeintrag o. ae. !!)
533 		{
534 			const SfxItemSet *pArgs = rReq.GetArgs ();
535 
536 			if (pArgs)
537 				if (pArgs->Count () == 5)
538 				{
539 					SFX_REQUEST_ARG (rReq, pLeft, SfxUInt32Item, ID_VAL_PAGELEFT, sal_False);
540 					SFX_REQUEST_ARG (rReq, pRight, SfxUInt32Item, ID_VAL_PAGERIGHT, sal_False);
541 					SFX_REQUEST_ARG (rReq, pUpper, SfxUInt32Item, ID_VAL_PAGETOP, sal_False);
542 					SFX_REQUEST_ARG (rReq, pLower, SfxUInt32Item, ID_VAL_PAGEBOTTOM, sal_False);
543 					SFX_REQUEST_ARG (rReq, pScaleAll, SfxBoolItem, ID_VAL_SCALEOBJECTS, sal_False);
544 
545 					Size aEmptySize (0, 0);
546 
547 					SetupPage (aEmptySize, pLeft->GetValue (), pRight->GetValue (),
548 							   pUpper->GetValue (), pLower->GetValue (),
549 							   sal_False, sal_True, pScaleAll->GetValue ());
550 					rReq.Ignore ();
551 					break;
552 				}
553 
554 			StarBASIC::FatalError (SbERR_WRONG_ARGS);
555 			rReq.Ignore ();
556 			break;
557 		}
558 
559 		case SID_ATTR_ZOOMSLIDER:
560 		{
561 			const SfxItemSet* pArgs = rReq.GetArgs();
562 
563 			if (pArgs && pArgs->Count () == 1 )
564 			{
565 				SFX_REQUEST_ARG (rReq, pScale, SfxUInt16Item, SID_ATTR_ZOOMSLIDER, sal_False);
566 				if (CHECK_RANGE (5, pScale->GetValue (), 3000))
567 				{
568 					SetZoom (pScale->GetValue ());
569 
570 					SfxBindings& rBindings = GetViewFrame()->GetBindings();
571 					rBindings.Invalidate( SID_ATTR_ZOOM );
572 					rBindings.Invalidate( SID_ZOOM_IN );
573 					rBindings.Invalidate( SID_ZOOM_OUT );
574 					rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
575 
576 				}
577 			}
578 
579 			Cancel();
580 			rReq.Done ();
581 			break;
582 		}
583 		case SID_ZOOMING :	// kein Menueintrag, sondern aus dem Zoomdialog generiert
584 		{
585 			const SfxItemSet* pArgs = rReq.GetArgs();
586 
587 			if (pArgs)
588 				if (pArgs->Count () == 1)
589 				{
590 					SFX_REQUEST_ARG (rReq, pScale, SfxUInt32Item, ID_VAL_ZOOM, sal_False);
591 					if (CHECK_RANGE (10, pScale->GetValue (), 1000))
592 					{
593 						SetZoom (pScale->GetValue ());
594 
595 						SfxBindings& rBindings = GetViewFrame()->GetBindings();
596 						rBindings.Invalidate( SID_ATTR_ZOOM );
597 						rBindings.Invalidate( SID_ZOOM_IN );
598 						rBindings.Invalidate( SID_ZOOM_OUT );
599 						rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
600 					}
601 					else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
602 
603 					rReq.Ignore ();
604 					break;
605 				}
606 
607 			StarBASIC::FatalError (SbERR_WRONG_ARGS);
608 			rReq.Ignore ();
609 			break;
610 		}
611 
612 		case SID_ATTR_ZOOM:
613 		{
614 			const SfxItemSet* pArgs = rReq.GetArgs();
615 			mbZoomOnPage = sal_False;
616 
617 			if ( pArgs )
618 			{
619 				SvxZoomType eZT = ( ( const SvxZoomItem& ) pArgs->
620 											Get( SID_ATTR_ZOOM ) ).GetType();
621 				switch( eZT )
622 				{
623 					case SVX_ZOOM_PERCENT:
624 						SetZoom( (long) ( ( const SvxZoomItem& ) pArgs->
625 											Get( SID_ATTR_ZOOM ) ).GetValue() );
626 						break;
627 
628 					case SVX_ZOOM_OPTIMAL:
629 						GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_ALL,
630 									SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
631 						break;
632 
633 					case SVX_ZOOM_PAGEWIDTH:
634 						GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE_WIDTH,
635 									SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
636 						break;
637 
638 					case SVX_ZOOM_WHOLEPAGE:
639 						GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE,
640 									SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
641 						break;
642 					case SVX_ZOOM_PAGEWIDTH_NOBORDER:
643 						DBG_ERROR("sd::DrawViewShell::FuTemporary(), SVX_ZOOM_PAGEWIDTH_NOBORDER not handled!" );
644 						break;
645 				}
646 				rReq.Ignore ();
647 			}
648 			else
649 			{
650 				// hier den Zoom-Dialog oeffnen
651 				SetCurrentFunction( FuScale::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
652 			}
653 			Cancel();
654 		}
655 		break;
656 
657 		case SID_CHANGEBEZIER:
658 		case SID_CHANGEPOLYGON:
659 			if ( mpDrawView->IsTextEdit() )
660 			{
661 				mpDrawView->SdrEndTextEdit();
662 				GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
663 			}
664 
665 			if ( mpDrawView->IsPresObjSelected() )
666 			{
667                 ::sd::Window* pWindow = GetActiveWindow();
668 				InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
669 			}
670 			else
671 			{
672 				if( rReq.GetSlot() == SID_CHANGEBEZIER )
673 				{
674 					WaitObject aWait( (Window*)GetActiveWindow() );
675 					mpDrawView->ConvertMarkedToPathObj(sal_False);
676 				}
677 				else
678 				{
679 					if( mpDrawView->IsVectorizeAllowed() )
680                     {
681 						SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
682                     }
683 					else
684 					{
685 						WaitObject aWait( (Window*)GetActiveWindow() );
686 						mpDrawView->ConvertMarkedToPolyObj(sal_False);
687 					}
688 				}
689 
690 				Invalidate(SID_CHANGEBEZIER);
691 				Invalidate(SID_CHANGEPOLYGON);
692 			}
693 			Cancel();
694 
695 			if( HasCurrentFunction(SID_BEZIER_EDIT) )
696 			{	// ggf. die richtige Editfunktion aktivieren
697 				GetViewFrame()->GetDispatcher()->Execute(SID_SWITCH_POINTEDIT,
698 										SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
699 			}
700 			rReq.Ignore ();
701 			break;
702 
703 		case SID_CONVERT_TO_CONTOUR:
704 			if ( mpDrawView->IsTextEdit() )
705 			{
706 				mpDrawView->SdrEndTextEdit();
707 				GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
708 			}
709 
710 			if ( mpDrawView->IsPresObjSelected() )
711 			{
712                 ::sd::Window* pWindow = GetActiveWindow();
713 				InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
714 			}
715 			else
716 			{
717 				WaitObject aWait( (Window*)GetActiveWindow() );
718 				mpDrawView->ConvertMarkedToPathObj(sal_True);
719 
720 				Invalidate(SID_CONVERT_TO_CONTOUR);
721 			}
722 			Cancel();
723 
724 			rReq.Ignore ();
725 			break;
726 
727 		case SID_CONVERT_TO_METAFILE:
728 		case SID_CONVERT_TO_BITMAP:
729 		{
730             // End text edit mode when it is active because the metafile or
731             // bitmap that will be created does not support it.
732             if ( mpDrawView->IsTextEdit() )
733 			{
734 				mpDrawView->SdrEndTextEdit();
735 				GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
736             }
737 
738 			if ( mpDrawView->IsPresObjSelected(true,true,true) )
739 			{
740                 ::sd::Window* pWindow = GetActiveWindow();
741 				InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
742 			}
743 			else
744 			{
745 				WaitObject aWait( (Window*)GetActiveWindow() );
746 
747 				// switch on undo for the next operations
748 				mpDrawView->BegUndo(
749 					String(
750 					SdResId (nSId==SID_CONVERT_TO_METAFILE ? STR_UNDO_CONVERT_TO_METAFILE : STR_UNDO_CONVERT_TO_BITMAP)));
751 
752 				// create SdrGrafObj from metafile/bitmap
753 				Graphic aGraphic;
754 				switch (nSId)
755 				{
756 					case SID_CONVERT_TO_METAFILE:
757 					{
758 						GDIMetaFile aMetaFile(mpDrawView->GetMarkedObjMetaFile());
759 						aGraphic = Graphic(aMetaFile);
760 					}
761 					break;
762 					case SID_CONVERT_TO_BITMAP:
763 					{
764                         bool bDone(false);
765 
766                         // I have to get the image here directly since GetMarkedObjBitmapEx works
767                         // based on Bitmaps, but not on BitmapEx, thus throwing away the alpha
768                         // channel. Argh! GetMarkedObjBitmapEx itself is too widely used to safely
769                         // change that, e.g. in the exchange formats. For now I can only add this
770                         // exception to get good results for Svgs. This is how the code gets more
771                         // and more crowded, at last I made a remark for myself to change this
772                         // as one of the next tasks.
773                         if(1 == mpDrawView->GetMarkedObjectCount())
774                         {
775                             const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(mpDrawView->GetMarkedObjectByIndex(0));
776 
777                             if(pSdrGrafObj && pSdrGrafObj->isEmbeddedSvg())
778                             {
779                                 aGraphic = Graphic(pSdrGrafObj->GetGraphic().getSvgData()->getReplacement());
780                                 bDone = true;
781                             }
782                         }
783 
784                         if(!bDone)
785                         {
786                             aGraphic = Graphic(mpDrawView->GetMarkedObjBitmapEx());
787                         }
788 					}
789 					break;
790 				}
791 
792 				// create new object
793 				SdrGrafObj* pGraphicObj = new SdrGrafObj (aGraphic);
794 
795 				// get some necessary info and ensure it
796 				const SdrMarkList& rMarkList(mpDrawView->GetMarkedObjectList());
797 				const sal_uInt32 nMarkCount(rMarkList.GetMarkCount());
798 				SdrPageView* pPageView = mpDrawView->GetSdrPageView();
799 				OSL_ENSURE(nMarkCount, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP with empty selection (!)");
800 				OSL_ENSURE(pPageView, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP without SdrPageView (!)");
801 
802 				// fit rectangle of new graphic object to selection's mark rect
803 				Rectangle aAllMarkedRect;
804 				rMarkList.TakeBoundRect(pPageView, aAllMarkedRect);
805 				pGraphicObj->SetLogicRect(aAllMarkedRect);
806 
807 				// #i71540# to keep the order, it is necessary to replace the lowest object
808 				// of the selection with the new object. This also means that with multi
809 				// selection, all other objects need to be deleted first
810 				SdrMark* pFirstMark = rMarkList.GetMark(0L);
811 				SdrObject* pReplacementCandidate = pFirstMark->GetMarkedSdrObj();
812 
813 				if(nMarkCount > 1L)
814 				{
815 					// take first object out of selection
816 					mpDrawView->MarkObj(pReplacementCandidate, pPageView, true, true);
817 
818 					// clear remaining selection
819 					mpDrawView->DeleteMarkedObj();
820 				}
821 
822 				// now replace lowest object with new one
823 				mpDrawView->ReplaceObjectAtView(pReplacementCandidate, *pPageView, pGraphicObj);
824 
825 				// switch off undo
826 				mpDrawView->EndUndo();
827 			}
828 		}
829 
830 		Cancel();
831 
832 		rReq.Done ();
833 		break;
834 
835 		case SID_SET_DEFAULT:
836 		{
837 			SfxItemSet* pSet = NULL;
838 
839 			if (mpDrawView->IsTextEdit())
840 			{
841 				::Outliner* pOutl = mpDrawView->GetTextEditOutliner();
842 				if (pOutl)
843 				{
844 					pOutl->RemoveFields(sal_True, (TypeId) SvxURLField::StaticType());
845 				}
846 
847 				pSet = new SfxItemSet( GetPool(), EE_ITEMS_START, EE_ITEMS_END );
848 				mpDrawView->SetAttributes( *pSet, sal_True );
849 			}
850 			else
851 			{
852 				const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
853 				sal_uLong nCount = rMarkList.GetMarkCount();
854 
855 				// In diese Liste werden fuer jedes Praesentationsobjekt ein SfxItemSet
856 				// der harten Attribute sowie der UserCall eingetragen, da diese beim nachfolgenden
857 				// mpDrawView->SetAttributes( *pSet, sal_True ) verloren gehen und spaeter restauriert
858 				// werden muessen
859 				List* pAttrList = new List();
860 				SdPage* pPresPage = (SdPage*) mpDrawView->GetSdrPageView()->GetPage();
861 				sal_uLong i;
862 
863 				for ( i = 0; i < nCount; i++ )
864 				{
865 					SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
866 
867 					if( pPresPage->IsPresObj( pObj ) )
868 					{
869 						SfxItemSet* pNewSet = new SfxItemSet( GetDoc()->GetPool(), SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT, 0 );
870 						pNewSet->Put(pObj->GetMergedItemSet());
871 						pAttrList->Insert( pNewSet, LIST_APPEND );
872 						pAttrList->Insert( pObj->GetUserCall(), LIST_APPEND );
873 					}
874 				}
875 
876 				pSet = new SfxItemSet( GetPool() );
877 				mpDrawView->SetAttributes( *pSet, sal_True );
878 
879 				sal_uLong j = 0;
880 
881 				for ( i = 0; i < nCount; i++ )
882 				{
883 					SfxStyleSheet* pSheet = NULL;
884 					SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
885 
886 					if (pObj->GetObjIdentifier() == OBJ_TITLETEXT)
887 					{
888 						pSheet = mpActualPage->GetStyleSheetForPresObj(PRESOBJ_TITLE);
889 						if (pSheet)
890 							pObj->SetStyleSheet(pSheet, sal_False);
891 					}
892 					else if(pObj->GetObjIdentifier() == OBJ_OUTLINETEXT)
893 					{
894 						for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++)
895 						{
896 							pSheet = mpActualPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE );
897 							DBG_ASSERT(pSheet, "Vorlage fuer Gliederungsobjekt nicht gefunden");
898 							if (pSheet)
899 							{
900 								pObj->StartListening(*pSheet);
901 
902 								if( nLevel == 1 )
903 									// Textrahmen hoert auf StyleSheet der Ebene1
904 									pObj->NbcSetStyleSheet(pSheet, sal_False);
905 
906 							}
907 						}
908 					}
909 
910 					if( pPresPage->IsPresObj( pObj ) )
911 					{
912 						SfxItemSet* pNewSet = (SfxItemSet*) pAttrList->GetObject(j++);
913 						SdrObjUserCall* pUserCall = (SdrObjUserCall*) pAttrList->GetObject(j++);
914 
915 						if ( pNewSet && pNewSet->GetItemState( SDRATTR_TEXT_MINFRAMEHEIGHT ) == SFX_ITEM_ON )
916 						{
917 							pObj->SetMergedItem(pNewSet->Get(SDRATTR_TEXT_MINFRAMEHEIGHT));
918 						}
919 
920 						if ( pNewSet && pNewSet->GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) == SFX_ITEM_ON )
921 						{
922 							pObj->SetMergedItem(pNewSet->Get(SDRATTR_TEXT_AUTOGROWHEIGHT));
923 						}
924 
925 						if( pUserCall )
926 							pObj->SetUserCall( pUserCall );
927 
928 						delete pNewSet;
929 					}
930 				}
931 
932 				delete pAttrList;
933 			}
934 
935 			delete pSet;
936 			Cancel();
937 		}
938 		break;
939 
940 		case SID_DELETE_SNAPITEM:
941 		{
942 			SdrPageView* pPV;
943 			Point	aMPos = GetActiveWindow()->PixelToLogic( maMousePos );
944 			sal_uInt16	nHitLog = (sal_uInt16) GetActiveWindow()->PixelToLogic( Size(
945                 FuPoor::HITPIX, 0 ) ).Width();
946 			sal_uInt16	nHelpLine;
947 
948 			mbMousePosFreezed = sal_False;
949 
950 			if( mpDrawView->PickHelpLine( aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) )
951 			{
952 				pPV->DeleteHelpLine( nHelpLine );
953 			}
954 			Cancel();
955 			rReq.Ignore ();
956 		}
957 		break;
958 
959 		case SID_DELETE_PAGE:
960 		case SID_DELETE_MASTER_PAGE:
961 			DeleteActualPage();
962 			Cancel();
963 			rReq.Ignore ();
964 		break;
965 
966 		case SID_DELETE_LAYER:
967 			DeleteActualLayer();
968 			Cancel();
969 			rReq.Ignore ();
970 		break;
971 
972 		case SID_ORIGINAL_SIZE:
973 			mpDrawView->SetMarkedOriginalSize();
974 			Cancel();
975 			rReq.Done();
976 		break;
977 
978 		case SID_DRAW_FONTWORK:
979 		case SID_DRAW_FONTWORK_VERTICAL:
980 		{
981 			svx::FontworkBar::execute( mpView, rReq, GetViewFrame()->GetBindings() );		// SJ: can be removed  (I think)
982 			Cancel();
983 			rReq.Done();
984 		}
985 		break;
986 
987 		case SID_SAVEGRAPHIC:
988 		{
989 			const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
990 			if( rMarkList.GetMarkCount() == 1 )
991 			{
992 				SdrGrafObj *pGrafObj = dynamic_cast< SdrGrafObj* >( rMarkList.GetMark( 0 )->GetMarkedSdrObj() );
993 				if(pGrafObj )
994 				{
995 					::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape( pGrafObj->getUnoShape(), com::sun::star::uno::UNO_QUERY );
996 					SdGRFFilter::SaveGraphic( xShape );
997 				}
998 			}
999 			Cancel();
1000 			rReq.Ignore();
1001 		}
1002 		break;
1003 
1004 		default:
1005 		{
1006 			// switch Anweisung wegen CLOOKS aufgeteilt. Alle case-Anweisungen die
1007 			// eine Fu???? -Funktion aufrufen, sind in die Methode FuTemp01 (drviews8)
1008 			// gewandert.
1009 			FuTemp01(rReq);
1010 		}
1011 		break;
1012 	}
1013 
1014 	if(HasCurrentFunction())
1015 	{
1016 		GetCurrentFunction()->Activate();
1017 	}
1018 }
1019 
1020 void DrawViewShell::ExecChar( SfxRequest &rReq )
1021 {
1022 	SdDrawDocument* pDoc = GetDoc();
1023 	if (!pDoc || !mpDrawView)
1024 	return;
1025 
1026 	SfxItemSet aEditAttr( pDoc->GetPool() );
1027 	mpDrawView->GetAttributes( aEditAttr );
1028 
1029 	//modified by wj for sym2_1580, if put old itemset into new set,
1030 	//when mpDrawView->SetAttributes(aNewAttr) it will invalidate all the item
1031 	// and use old attr to update all the attributes
1032 //	SfxItemSet aNewAttr( GetPool(),
1033 //	EE_ITEMS_START, EE_ITEMS_END );
1034 //	aNewAttr.Put( aEditAttr, sal_False );
1035 	SfxItemSet aNewAttr( pDoc->GetPool() );
1036 	//modified end
1037 
1038 	sal_uInt16 nSId = rReq.GetSlot();
1039 
1040 	MapSlot( nSId );
1041 
1042 	switch ( nSId )
1043 	{
1044 	case SID_ATTR_CHAR_FONT:
1045 		if( rReq.GetArgs() )
1046 		{
1047 			SFX_REQUEST_ARG( rReq, pItem, SvxFontItem, SID_ATTR_CHAR_FONT , sal_False );
1048 			if (pItem)
1049 			{
1050 				aNewAttr.Put(*pItem);
1051 			}
1052 		}
1053 		break;
1054 	case SID_ATTR_CHAR_FONTHEIGHT:
1055 		if( rReq.GetArgs() )
1056 		{
1057 			SFX_REQUEST_ARG( rReq, pItem, SvxFontHeightItem, SID_ATTR_CHAR_FONTHEIGHT , sal_False );
1058 			if (pItem)
1059 			{
1060 				aNewAttr.Put(*pItem);
1061 			}
1062 		}
1063 		break;
1064 	case SID_ATTR_CHAR_WEIGHT:
1065 		if( rReq.GetArgs() )
1066 		{
1067 			//const SvxWeightItem *pItem = (const SvxWeightItem*) rReq.GetArg( SID_ATTR_CHAR_WEIGHT, sal_False, TYPE(SvxWeightItem) );
1068 			SFX_REQUEST_ARG( rReq, pItem, SvxWeightItem, SID_ATTR_CHAR_WEIGHT , sal_False );
1069 			if (pItem)
1070 			{
1071 				aNewAttr.Put(*pItem);
1072 			}
1073 		}
1074 		break;
1075 	case SID_ATTR_CHAR_POSTURE:
1076 		if( rReq.GetArgs() )
1077 		{
1078 			//const SvxPostureItem *pItem = (const SvxPostureItem*) rReq.GetArg( SID_ATTR_CHAR_POSTURE, sal_False, TYPE(SvxPostureItem) );
1079 			SFX_REQUEST_ARG( rReq, pItem, SvxPostureItem, SID_ATTR_CHAR_POSTURE , sal_False );
1080 			if (pItem)
1081 			{
1082 				aNewAttr.Put(*pItem);
1083 			}
1084 		}
1085 		break;
1086 	case SID_ATTR_CHAR_UNDERLINE:
1087 		if( rReq.GetArgs() )
1088 		{
1089 			//<<modify by wj for sym2_1873
1090 			//SFX_REQUEST_ARG( rReq, pItem, SvxTextLineItem, SID_ATTR_CHAR_UNDERLINE , sal_False );
1091 			SFX_REQUEST_ARG( rReq, pItem, SvxUnderlineItem, SID_ATTR_CHAR_UNDERLINE , sal_False );
1092 			//end>>
1093 			if (pItem)
1094 			{
1095 				aNewAttr.Put(*pItem);
1096 			}
1097 			else
1098 			{
1099 				FontUnderline eFU = ( (const SvxUnderlineItem&) aEditAttr.Get( EE_CHAR_UNDERLINE ) ).GetLineStyle();
1100 				aNewAttr.Put( SvxUnderlineItem( eFU != UNDERLINE_NONE ?UNDERLINE_NONE : UNDERLINE_SINGLE,  EE_CHAR_UNDERLINE ) );
1101 			}//aNewAttr.Put( (const SvxUnderlineItem&)aEditAttr.Get( EE_CHAR_UNDERLINE ) );
1102 		}
1103 		break;
1104 	case SID_ATTR_CHAR_SHADOWED:
1105 		if( rReq.GetArgs() )
1106 		{
1107 			SFX_REQUEST_ARG( rReq, pItem, SvxShadowedItem, SID_ATTR_CHAR_SHADOWED , sal_False );
1108 			if (pItem)
1109 			{
1110 				aNewAttr.Put(*pItem);
1111 			}
1112 		}
1113 		break;
1114 	case SID_ATTR_CHAR_STRIKEOUT:
1115 		if( rReq.GetArgs() )
1116 		{
1117 			SFX_REQUEST_ARG( rReq, pItem, SvxCrossedOutItem, SID_ATTR_CHAR_STRIKEOUT , sal_False );
1118 			if (pItem)
1119 			{
1120 				aNewAttr.Put(*pItem);
1121 			}
1122 		}
1123 		break;
1124 	case SID_ATTR_CHAR_COLOR:
1125 		if( rReq.GetArgs() )
1126 		{
1127 			SFX_REQUEST_ARG( rReq, pItem, SvxColorItem, SID_ATTR_CHAR_COLOR , sal_False );
1128 			if (pItem)
1129 			{
1130 				aNewAttr.Put(*pItem);
1131 			}
1132 		}
1133 		break;
1134 	case SID_ATTR_CHAR_KERNING:
1135 		if( rReq.GetArgs() )
1136 		{
1137 			SFX_REQUEST_ARG( rReq, pItem, SvxKerningItem, SID_ATTR_CHAR_KERNING , sal_False );
1138 			if (pItem)
1139 			{
1140 				aNewAttr.Put(*pItem);
1141 			}
1142 		}
1143 		break;
1144 	case SID_SET_SUB_SCRIPT:
1145 		if( rReq.GetArgs() )
1146 		{
1147 			SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT );
1148 			SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
1149 							aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
1150 			if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
1151 				aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
1152 			else
1153 				aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
1154 			aNewAttr.Put( aItem );
1155 		}
1156 		break;
1157 	case SID_SET_SUPER_SCRIPT:
1158 		if( rReq.GetArgs() )
1159 		{
1160 			SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT );
1161 			SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
1162 							aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
1163 			if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
1164 				aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
1165 			else
1166 				aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
1167 			aNewAttr.Put( aItem );
1168 		}
1169 		break;
1170 	default:
1171 		;
1172 	}
1173 
1174 	mpDrawView->SetAttributes(aNewAttr);
1175 	rReq.Done();
1176 	Cancel();
1177 }
1178 
1179 
1180 /** This method consists basically of three parts:
1181     1. Process the arguments of the SFX request.
1182     2. Use the model to create a new page or duplicate an existing one.
1183     3. Update the tab control and switch to the new page.
1184 */
1185 SdPage* DrawViewShell::CreateOrDuplicatePage (
1186     SfxRequest& rRequest,
1187     PageKind ePageKind,
1188     SdPage* pPage,
1189     const sal_Int32 nInsertPosition)
1190 {
1191     SdPage* pNewPage = NULL;
1192     if (ePageKind == PK_STANDARD && meEditMode != EM_MASTERPAGE)
1193     {
1194         if ( mpDrawView->IsTextEdit() )
1195         {
1196             mpDrawView->SdrEndTextEdit();
1197         }
1198         pNewPage = ViewShell::CreateOrDuplicatePage (rRequest, ePageKind, pPage, nInsertPosition);
1199     }
1200     return pNewPage;
1201 }
1202 
1203 void DrawViewShell::ExecutePropPanelAttr (SfxRequest& rReq)
1204 {
1205 	if(SlideShow::IsRunning( GetViewShellBase() ))
1206 		return;
1207 
1208 	SdDrawDocument* pDoc = GetDoc();
1209 	if (!pDoc || !mpDrawView)
1210 		return;
1211 
1212 	sal_uInt16 nSId = rReq.GetSlot();
1213 	SfxItemSet aAttrs( pDoc->GetPool() );
1214 
1215 	switch ( nSId )
1216 	{
1217 	case SID_TABLE_VERT_NONE:
1218 	case SID_TABLE_VERT_CENTER:
1219 	case SID_TABLE_VERT_BOTTOM:
1220 		SdrTextVertAdjust eTVA = SDRTEXTVERTADJUST_TOP;
1221 		if (nSId == SID_TABLE_VERT_CENTER)
1222 			eTVA = SDRTEXTVERTADJUST_CENTER;
1223 		else if (nSId == SID_TABLE_VERT_BOTTOM)
1224 			eTVA = SDRTEXTVERTADJUST_BOTTOM;
1225 
1226 		aAttrs.Put( SdrTextVertAdjustItem(eTVA) );
1227 		mpDrawView->SetAttributes(aAttrs);
1228 
1229 		break;
1230 	}
1231 }
1232 
1233 void DrawViewShell::GetStatePropPanelAttr(SfxItemSet& rSet)
1234 {
1235 	SfxWhichIter	aIter( rSet );
1236 	sal_uInt16			nWhich = aIter.FirstWhich();
1237 
1238 	SdDrawDocument* pDoc = GetDoc();
1239 	if (!pDoc || !mpDrawView)
1240 		return;
1241 
1242 	SfxItemSet aAttrs( pDoc->GetPool() );
1243 	mpDrawView->GetAttributes( aAttrs );
1244 
1245 	while ( nWhich )
1246 	{
1247 		sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
1248 			? GetPool().GetSlotId(nWhich)
1249 			: nWhich;
1250 		switch ( nSlotId )
1251 		{
1252 			case SID_TABLE_VERT_NONE:
1253 			case SID_TABLE_VERT_CENTER:
1254 			case SID_TABLE_VERT_BOTTOM:
1255 				sal_Bool bContour = sal_False;
1256 				SfxItemState eConState = aAttrs.GetItemState( SDRATTR_TEXT_CONTOURFRAME );
1257 				if( eConState != SFX_ITEM_DONTCARE )
1258 				{
1259 					bContour = ( ( const SdrTextContourFrameItem& )aAttrs.Get( SDRATTR_TEXT_CONTOURFRAME ) ).GetValue();
1260 				}
1261 				if (bContour) break;
1262 
1263 				SfxItemState eVState = aAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST );
1264 				//SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
1265 
1266 				//if(SFX_ITEM_DONTCARE != eVState && SFX_ITEM_DONTCARE != eHState)
1267 				if(SFX_ITEM_DONTCARE != eVState)
1268 				{
1269 					SdrTextVertAdjust eTVA = (SdrTextVertAdjust)((const SdrTextVertAdjustItem&)aAttrs.Get(SDRATTR_TEXT_VERTADJUST)).GetValue();
1270 					sal_Bool bSet = nSlotId == SID_TABLE_VERT_NONE && eTVA == SDRTEXTVERTADJUST_TOP||
1271                             nSlotId == SID_TABLE_VERT_CENTER && eTVA == SDRTEXTVERTADJUST_CENTER ||
1272                             nSlotId == SID_TABLE_VERT_BOTTOM && eTVA == SDRTEXTVERTADJUST_BOTTOM;
1273 					rSet.Put(SfxBoolItem(nSlotId, bSet));
1274 				}
1275 				else
1276 				{
1277 					rSet.Put(SfxBoolItem(nSlotId, sal_False));
1278 				}
1279 				break;
1280 		}
1281 		nWhich = aIter.NextWhich();
1282 	}
1283 }
1284 
1285 } // end of namespace sd
1286