1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sd.hxx"
#include "DrawViewShell.hxx"
#include "ViewShellImplementation.hxx"
#include <vcl/waitobj.hxx>
#include <svx/svdograf.hxx>
#include <svx/svxids.hrc>
#include <svx/svdpagv.hxx>
#include <svx/svdundo.hxx>
#include <svx/zoomitem.hxx>
#include <editeng/editdata.hxx>
#include <basic/sberrors.hxx>
#include <vcl/msgbox.hxx>
#include <sfx2/request.hxx>
#include <sfx2/dispatch.hxx>
#include <svx/xfillit0.hxx>
#include <svx/xflclit.hxx>
#include <svl/aeitem.hxx>
#include <editeng/eeitem.hxx>
#include <basic/sbstar.hxx>
#include <editeng/flditem.hxx>
#include <svx/xlineit0.hxx>
#include <svx/xfillit0.hxx>
#include <svx/svdoutl.hxx>
#include <svx/xlnwtit.hxx>
#include <svx/svdoattr.hxx>
#include <svx/xlnstwit.hxx>
#include <svx/sdtmfitm.hxx>
#include <svx/sdtagitm.hxx>
#include <svx/xlnedwit.hxx>
#include <svx/fontworkbar.hxx>
#include <svx/svxdlg.hxx>
#include <svx/dialogs.hrc>
#include <sfx2/viewfrm.hxx>
#include "sdgrffilter.hxx"
#include "app.hrc"
#include "glob.hrc"
#include "helpids.h"
#include "sdattr.hxx"
#include "drawview.hxx"
#include "Window.hxx"
#include "drawdoc.hxx"
#include "DrawDocShell.hxx"
#include "sdpage.hxx"
#include "fuscale.hxx"
#include "sdresid.hxx"
#include "GraphicViewShell.hxx"
#include "unmodpg.hxx"
#include "slideshow.hxx"
#include "fuvect.hxx"
#include "stlpool.hxx"
#include "optsitem.hxx"
#include "sdabstdlg.hxx"
#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
#include <com/sun/star/drawing/XDrawPages.hpp>
#include <strings.hrc>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
namespace sd {
/*************************************************************************
|*
|* SfxRequests fuer temporaere Funktionen
|*
\************************************************************************/
void DrawViewShell::FuTemporary(SfxRequest& rReq)
{
// Waehrend einer Native-Diashow wird nichts ausgefuehrt!
if(SlideShow::IsRunning( GetViewShellBase() ) && (rReq.GetSlot() != SID_NAVIGATOR))
return;
DBG_ASSERT( mpDrawView, "sd::DrawViewShell::FuTemporary(), no draw view!" );
if( !mpDrawView )
return;
CheckLineTo (rReq);
DeactivateCurrentFunction();
sal_uInt16 nSId = rReq.GetSlot();
// Slot wird gemapped (ToolboxImages/-Slots)
MapSlot( nSId );
switch ( nSId )
{
case SID_OUTLINE_TEXT_AUTOFIT:
{
::svl::IUndoManager* pUndoManager = GetDocSh()->GetUndoManager();
SdrObject* pObj = NULL;
const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
if( rMarkList.GetMarkCount() == 1 )
{
pUndoManager->EnterListAction( String(), String() );
mpDrawView->BegUndo();
pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
bool bSet = ((const SdrTextFitToSizeTypeItem*)pObj->GetMergedItemSet().GetItem(SDRATTR_TEXT_FITTOSIZE))->GetValue() != SDRTEXTFIT_NONE;
mpDrawView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
pObj->SetMergedItem(SdrTextFitToSizeTypeItem(bSet ? SDRTEXTFIT_NONE : SDRTEXTFIT_AUTOFIT));
mpDrawView->EndUndo();
pUndoManager->LeaveListAction();
}
Cancel();
rReq.Done();
}
break;
// Flaechen und Linien-Attribute:
// Sollten (wie StateMethode) eine eigene
// Execute-Methode besitzen
case SID_ATTR_FILL_STYLE:
case SID_ATTR_FILL_COLOR:
case SID_ATTR_FILL_GRADIENT:
case SID_ATTR_FILL_HATCH:
case SID_ATTR_FILL_BITMAP:
case SID_ATTR_FILL_SHADOW:
case SID_ATTR_LINE_STYLE:
case SID_ATTR_LINE_DASH:
case SID_ATTR_LINE_WIDTH:
case SID_ATTR_LINE_COLOR:
case SID_ATTR_LINEEND_STYLE:
case SID_ATTR_TEXT_FITTOSIZE:
{
if( rReq.GetArgs() )
{
sal_Bool bMergeUndo = sal_False;
::svl::IUndoManager* pUndoManager = GetDocSh()->GetUndoManager();
// Anpassungen Start/EndWidth
if(nSId == SID_ATTR_LINE_WIDTH)
{
SdrObject* pObj = NULL;
const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
sal_uLong nCount = rMarkList.GetMarkCount();
sal_Int32 nNewLineWidth = ((const XLineWidthItem&)rReq.GetArgs()->Get(XATTR_LINEWIDTH)).GetValue();
for (sal_uLong i=0; i<nCount; i++)
{
SfxItemSet aAttr(GetDoc()->GetPool());
pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
aAttr.Put(pObj->GetMergedItemSet());
sal_Int32 nActLineWidth = ((const XLineWidthItem&)aAttr.Get(XATTR_LINEWIDTH)).GetValue();
if(nActLineWidth != nNewLineWidth)
{
sal_Bool bSetItemSet(sal_False);
// do this for SFX_ITEM_DEFAULT and for SFX_ITEM_SET
if(SFX_ITEM_DONTCARE != aAttr.GetItemState(XATTR_LINESTARTWIDTH))
{
sal_Int32 nValAct = ((const XLineStartWidthItem&)aAttr.Get(XATTR_LINESTARTWIDTH)).GetValue();
sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
if(nValNew < 0)
nValNew = 0;
bSetItemSet = sal_True;
aAttr.Put(XLineStartWidthItem(nValNew));
}
// do this for SFX_ITEM_DEFAULT and for SFX_ITEM_SET
if(SFX_ITEM_DONTCARE != aAttr.GetItemState(XATTR_LINEENDWIDTH))
{
sal_Int32 nValAct = ((const XLineEndWidthItem&)aAttr.Get(XATTR_LINEENDWIDTH)).GetValue();
sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
if(nValNew < 0)
nValNew = 0;
bSetItemSet = sal_True;
aAttr.Put(XLineEndWidthItem(nValNew));
}
if(bSetItemSet)
pObj->SetMergedItemSet(aAttr);
}
}
}
if (nSId == SID_ATTR_FILL_SHADOW)
{
// Ggf. werden transparente Objekte wei?gefuellt
SdrObject* pObj = NULL;
const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
sal_uLong nCount = rMarkList.GetMarkCount();
const bool bUndo = mpDrawView->IsUndoEnabled();
for (sal_uLong i=0; i<nCount; i++)
{
SfxItemSet aAttr(GetDoc()->GetPool());
pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
// #i25616#
if(!pObj->ISA(SdrGrafObj))
{
aAttr.Put(pObj->GetMergedItemSet());
const XFillStyleItem& rFillStyle =
(const XFillStyleItem&) aAttr.Get(XATTR_FILLSTYLE);
if (rFillStyle.GetValue() == XFILL_NONE)
{
if( bUndo )
{
// Vorlage hat keine Fuellung,
// daher hart attributieren: Fuellung setzen
if (!bMergeUndo)
{
bMergeUndo = sal_True;
pUndoManager->EnterListAction( String(), String() );
mpDrawView->BegUndo();
}
mpDrawView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
}
aAttr.Put(XFillStyleItem(XFILL_SOLID));
aAttr.Put(XFillColorItem(String(), COL_WHITE));
pObj->SetMergedItemSet(aAttr);
}
}
}
if (bMergeUndo)
{
mpDrawView->EndUndo();
}
}
mpDrawView->SetAttributes(*rReq.GetArgs());
if (bMergeUndo)
{
pUndoManager->LeaveListAction();
}
rReq.Done();
}
else
{
switch( rReq.GetSlot() )
{
case SID_ATTR_FILL_SHADOW:
case SID_ATTR_FILL_STYLE:
case SID_ATTR_FILL_COLOR:
case SID_ATTR_FILL_GRADIENT:
case SID_ATTR_FILL_HATCH:
case SID_ATTR_FILL_BITMAP:
GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_AREA, SFX_CALLMODE_ASYNCHRON );
break;
case SID_ATTR_LINE_STYLE:
case SID_ATTR_LINE_DASH:
case SID_ATTR_LINE_WIDTH:
case SID_ATTR_LINE_COLOR:
GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_LINE, SFX_CALLMODE_ASYNCHRON );
break;
case SID_ATTR_TEXT_FITTOSIZE:
GetViewFrame()->GetDispatcher()->Execute( SID_TEXTATTR_DLG, SFX_CALLMODE_ASYNCHRON );
break;
}
}
Cancel();
}
break;
case SID_HYPHENATION:
{
// const SfxPoolItem* pItem = rReq.GetArg( SID_HYPHENATION );
// ^-- Soll so nicht benutzt werden (Defaults sind falsch) !
SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, SID_HYPHENATION, sal_False);
if( pItem )
{
SfxItemSet aSet( GetPool(), EE_PARA_HYPHENATE, EE_PARA_HYPHENATE );
sal_Bool bValue = ( (const SfxBoolItem*) pItem)->GetValue();
aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) );
mpDrawView->SetAttributes( aSet );
}
else // nur zum Test
{
OSL_FAIL(" Kein Wert fuer Silbentrennung!");
SfxItemSet aSet( GetPool(), EE_PARA_HYPHENATE, EE_PARA_HYPHENATE );
sal_Bool bValue = sal_True;
aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) );
mpDrawView->SetAttributes( aSet );
}
rReq.Done();
Cancel();
}
break;
case SID_INSERTPAGE:
case SID_INSERTPAGE_QUICK:
case SID_DUPLICATE_PAGE:
{
SdPage* pNewPage = CreateOrDuplicatePage (rReq, mePageKind, GetActualPage());
Cancel();
if(HasCurrentFunction(SID_BEZIER_EDIT) )
GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
if (pNewPage != NULL)
SwitchPage((pNewPage->GetPageNum()-1)/2);
rReq.Done ();
}
break;
case SID_INSERT_MASTER_PAGE:
{
// Use the API to create a new page.
Reference<drawing::XMasterPagesSupplier> xMasterPagesSupplier (
GetDoc()->getUnoModel(), UNO_QUERY);
if (xMasterPagesSupplier.is())
{
Reference<drawing::XDrawPages> xMasterPages (
xMasterPagesSupplier->getMasterPages());
if (xMasterPages.is())
{
sal_uInt16 nIndex = GetCurPageId();
xMasterPages->insertNewByIndex (nIndex);
// Create shapes for the default layout.
SdPage* pMasterPage = GetDoc()->GetMasterSdPage(
nIndex, PK_STANDARD);
pMasterPage->CreateTitleAndLayout (sal_True,sal_True);
}
}
Cancel();
if(HasCurrentFunction(SID_BEZIER_EDIT))
GetViewFrame()->GetDispatcher()->Execute(
SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
rReq.Done ();
}
break;
case SID_MODIFYPAGE:
{
if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES ||
(mePageKind==PK_HANDOUT && meEditMode==EM_MASTERPAGE) )
{
if ( mpDrawView->IsTextEdit() )
{
mpDrawView->SdrEndTextEdit();
}
sal_uInt16 nPage = maTabControl.GetCurPageId() - 1;
mpActualPage = GetDoc()->GetSdPage(nPage, mePageKind);
::sd::ViewShell::mpImpl->ProcessModifyPageSlot (
rReq,
mpActualPage,
mePageKind);
}
Cancel();
rReq.Done ();
}
break;
case SID_ASSIGN_LAYOUT:
{
if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES || (mePageKind==PK_HANDOUT && meEditMode==EM_MASTERPAGE))
{
if ( mpDrawView->IsTextEdit() )
mpDrawView->SdrEndTextEdit();
::sd::ViewShell::mpImpl->AssignLayout(rReq, mePageKind);
}
Cancel();
rReq.Done ();
}
break;
case SID_RENAMEPAGE:
case SID_RENAME_MASTER_PAGE:
{
if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES )
{
if ( mpDrawView->IsTextEdit() )
{
mpDrawView->SdrEndTextEdit();
}
sal_uInt16 nPageId = maTabControl.GetCurPageId();
SdPage* pCurrentPage = ( GetEditMode() == EM_PAGE )
? GetDoc()->GetSdPage( nPageId - 1, GetPageKind() )
: GetDoc()->GetMasterSdPage( nPageId - 1, GetPageKind() );
String aTitle( SdResId( STR_TITLE_RENAMESLIDE ) );
String aDescr( SdResId( STR_DESC_RENAMESLIDE ) );
String aPageName = pCurrentPage->GetName();
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
DBG_ASSERT(pFact, "Dialogdiet fail!");
AbstractSvxNameDialog* aNameDlg = pFact->CreateSvxNameDialog( GetActiveWindow(), aPageName, aDescr );
DBG_ASSERT(aNameDlg, "Dialogdiet fail!");
aNameDlg->SetText( aTitle );
aNameDlg->SetCheckNameHdl( LINK( this, DrawViewShell, RenameSlideHdl ), true );
aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE );
if( aNameDlg->Execute() == RET_OK )
{
String aNewName;
aNameDlg->GetName( aNewName );
if( ! aNewName.Equals( aPageName ) )
{
#ifdef DBG_UTIL
bool bResult =
#endif
RenameSlide( nPageId, aNewName );
DBG_ASSERT( bResult, "Couldn't rename slide" );
}
}
delete aNameDlg;
}
Cancel();
rReq.Ignore ();
}
break;
case SID_RENAMEPAGE_QUICK:
{
if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES )
{
if ( mpDrawView->IsTextEdit() )
{
mpDrawView->SdrEndTextEdit();
}
maTabControl.StartEditMode( maTabControl.GetCurPageId() );
}
Cancel();
rReq.Ignore ();
}
break;
case SID_PAGESIZE : // entweder dieses (kein menueeintrag o. ae. !!)
{
const SfxItemSet *pArgs = rReq.GetArgs ();
if (pArgs)
if (pArgs->Count () == 3)
{
SFX_REQUEST_ARG (rReq, pWidth, SfxUInt32Item, ID_VAL_PAGEWIDTH, sal_False);
SFX_REQUEST_ARG (rReq, pHeight, SfxUInt32Item, ID_VAL_PAGEHEIGHT, sal_False);
SFX_REQUEST_ARG (rReq, pScaleAll, SfxBoolItem, ID_VAL_SCALEOBJECTS, sal_False);
Size aSize (pWidth->GetValue (), pHeight->GetValue ());
SetupPage (aSize, 0, 0, 0, 0, sal_True, sal_False, pScaleAll->GetValue ());
rReq.Ignore ();
break;
}
StarBASIC::FatalError (SbERR_WRONG_ARGS);
rReq.Ignore ();
break;
}
case SID_PAGEMARGIN : // oder dieses (kein menueeintrag o. ae. !!)
{
const SfxItemSet *pArgs = rReq.GetArgs ();
if (pArgs)
if (pArgs->Count () == 5)
{
SFX_REQUEST_ARG (rReq, pLeft, SfxUInt32Item, ID_VAL_PAGELEFT, sal_False);
SFX_REQUEST_ARG (rReq, pRight, SfxUInt32Item, ID_VAL_PAGERIGHT, sal_False);
SFX_REQUEST_ARG (rReq, pUpper, SfxUInt32Item, ID_VAL_PAGETOP, sal_False);
SFX_REQUEST_ARG (rReq, pLower, SfxUInt32Item, ID_VAL_PAGEBOTTOM, sal_False);
SFX_REQUEST_ARG (rReq, pScaleAll, SfxBoolItem, ID_VAL_SCALEOBJECTS, sal_False);
Size aEmptySize (0, 0);
SetupPage (aEmptySize, pLeft->GetValue (), pRight->GetValue (),
pUpper->GetValue (), pLower->GetValue (),
sal_False, sal_True, pScaleAll->GetValue ());
rReq.Ignore ();
break;
}
StarBASIC::FatalError (SbERR_WRONG_ARGS);
rReq.Ignore ();
break;
}
case SID_ATTR_ZOOMSLIDER:
{
const SfxItemSet* pArgs = rReq.GetArgs();
if (pArgs && pArgs->Count () == 1 )
{
SFX_REQUEST_ARG (rReq, pScale, SfxUInt16Item, SID_ATTR_ZOOMSLIDER, sal_False);
if (CHECK_RANGE (5, pScale->GetValue (), 3000))
{
SetZoom (pScale->GetValue ());
SfxBindings& rBindings = GetViewFrame()->GetBindings();
rBindings.Invalidate( SID_ATTR_ZOOM );
rBindings.Invalidate( SID_ZOOM_IN );
rBindings.Invalidate( SID_ZOOM_OUT );
rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
}
}
Cancel();
rReq.Done ();
break;
}
case SID_ZOOMING : // kein Menueintrag, sondern aus dem Zoomdialog generiert
{
const SfxItemSet* pArgs = rReq.GetArgs();
if (pArgs)
if (pArgs->Count () == 1)
{
SFX_REQUEST_ARG (rReq, pScale, SfxUInt32Item, ID_VAL_ZOOM, sal_False);
if (CHECK_RANGE (10, pScale->GetValue (), 1000))
{
SetZoom (pScale->GetValue ());
SfxBindings& rBindings = GetViewFrame()->GetBindings();
rBindings.Invalidate( SID_ATTR_ZOOM );
rBindings.Invalidate( SID_ZOOM_IN );
rBindings.Invalidate( SID_ZOOM_OUT );
rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
}
else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
rReq.Ignore ();
break;
}
StarBASIC::FatalError (SbERR_WRONG_ARGS);
rReq.Ignore ();
break;
}
case SID_ATTR_ZOOM:
{
const SfxItemSet* pArgs = rReq.GetArgs();
mbZoomOnPage = sal_False;
if ( pArgs )
{
SvxZoomType eZT = ( ( const SvxZoomItem& ) pArgs->
Get( SID_ATTR_ZOOM ) ).GetType();
switch( eZT )
{
case SVX_ZOOM_PERCENT:
SetZoom( (long) ( ( const SvxZoomItem& ) pArgs->
Get( SID_ATTR_ZOOM ) ).GetValue() );
break;
case SVX_ZOOM_OPTIMAL:
GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_ALL,
SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
break;
case SVX_ZOOM_PAGEWIDTH:
GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE_WIDTH,
SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
break;
case SVX_ZOOM_WHOLEPAGE:
GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE,
SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
break;
case SVX_ZOOM_PAGEWIDTH_NOBORDER:
OSL_FAIL("sd::DrawViewShell::FuTemporary(), SVX_ZOOM_PAGEWIDTH_NOBORDER not handled!" );
break;
}
rReq.Ignore ();
}
else
{
// hier den Zoom-Dialog oeffnen
SetCurrentFunction( FuScale::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
}
Cancel();
}
break;
case SID_CHANGEBEZIER:
case SID_CHANGEPOLYGON:
if ( mpDrawView->IsTextEdit() )
{
mpDrawView->SdrEndTextEdit();
GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
}
if ( mpDrawView->IsPresObjSelected() )
{
::sd::Window* pWindow = GetActiveWindow();
InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
}
else
{
if( rReq.GetSlot() == SID_CHANGEBEZIER )
{
WaitObject aWait( (Window*)GetActiveWindow() );
mpDrawView->ConvertMarkedToPathObj(sal_False);
}
else
{
if( mpDrawView->IsVectorizeAllowed() )
SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
else
{
WaitObject aWait( (Window*)GetActiveWindow() );
mpDrawView->ConvertMarkedToPolyObj(sal_False);
}
}
Invalidate(SID_CHANGEBEZIER);
Invalidate(SID_CHANGEPOLYGON);
}
Cancel();
if( HasCurrentFunction(SID_BEZIER_EDIT) )
{ // ggf. die richtige Editfunktion aktivieren
GetViewFrame()->GetDispatcher()->Execute(SID_SWITCH_POINTEDIT,
SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
}
rReq.Ignore ();
break;
case SID_CONVERT_TO_CONTOUR:
if ( mpDrawView->IsTextEdit() )
{
mpDrawView->SdrEndTextEdit();
GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
}
if ( mpDrawView->IsPresObjSelected() )
{
::sd::Window* pWindow = GetActiveWindow();
InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
}
else
{
WaitObject aWait( (Window*)GetActiveWindow() );
mpDrawView->ConvertMarkedToPathObj(sal_True);
Invalidate(SID_CONVERT_TO_CONTOUR);
}
Cancel();
rReq.Ignore ();
break;
case SID_CONVERT_TO_METAFILE:
case SID_CONVERT_TO_BITMAP:
{
// End text edit mode when it is active because the metafile or
// bitmap that will be created does not support it.
if ( mpDrawView->IsTextEdit() )
{
mpDrawView->SdrEndTextEdit();
GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
}
if ( mpDrawView->IsPresObjSelected(true,true,true) )
{
::sd::Window* pWindow = GetActiveWindow();
InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
}
else
{
WaitObject aWait( (Window*)GetActiveWindow() );
// switch on undo for the next operations
mpDrawView->BegUndo(
String(
SdResId (nSId==SID_CONVERT_TO_METAFILE ? STR_UNDO_CONVERT_TO_METAFILE : STR_UNDO_CONVERT_TO_BITMAP)));
// create SdrGrafObj from metafile/bitmap
Graphic aGraphic;
switch (nSId)
{
case SID_CONVERT_TO_METAFILE:
{
GDIMetaFile aMetaFile(mpDrawView->GetAllMarkedMetaFile ());
aGraphic = Graphic(aMetaFile);
}
break;
case SID_CONVERT_TO_BITMAP:
{
Bitmap aBitmap (mpDrawView->GetAllMarkedBitmap ());
aGraphic = Graphic(aBitmap);
}
break;
}
// create new object
SdrGrafObj* pGraphicObj = new SdrGrafObj (aGraphic);
// get some necessary info and ensure it
const SdrMarkList& rMarkList(mpDrawView->GetMarkedObjectList());
const sal_uInt32 nMarkCount(rMarkList.GetMarkCount());
SdrPageView* pPageView = mpDrawView->GetSdrPageView();
OSL_ENSURE(nMarkCount, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP with empty selection (!)");
OSL_ENSURE(pPageView, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP without SdrPageView (!)");
// fit rectangle of new graphic object to selection's mark rect
Rectangle aAllMarkedRect;
rMarkList.TakeBoundRect(pPageView, aAllMarkedRect);
pGraphicObj->SetLogicRect(aAllMarkedRect);
// #i71540# to keep the order, it is necessary to replace the lowest object
// of the selection with the new object. This also means that with multi
// selection, all other objects need to be deleted first
SdrMark* pFirstMark = rMarkList.GetMark(0L);
SdrObject* pReplacementCandidate = pFirstMark->GetMarkedSdrObj();
if(nMarkCount > 1L)
{
// take first object out of selection
mpDrawView->MarkObj(pReplacementCandidate, pPageView, true, true);
// clear remaining selection
mpDrawView->DeleteMarkedObj();
}
// now replace lowest object with new one
mpDrawView->ReplaceObjectAtView(pReplacementCandidate, *pPageView, pGraphicObj);
// switch off undo
mpDrawView->EndUndo();
}
}
Cancel();
rReq.Done ();
break;
case SID_SET_DEFAULT:
{
SfxItemSet* pSet = NULL;
if (mpDrawView->IsTextEdit())
{
::Outliner* pOutl = mpDrawView->GetTextEditOutliner();
if (pOutl)
{
pOutl->RemoveFields(sal_True, (TypeId) SvxURLField::StaticType());
}
pSet = new SfxItemSet( GetPool(), EE_ITEMS_START, EE_ITEMS_END );
mpDrawView->SetAttributes( *pSet, sal_True );
}
else
{
const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
sal_uLong nCount = rMarkList.GetMarkCount();
// In diese Liste werden fuer jedes Praesentationsobjekt ein SfxItemSet
// der harten Attribute sowie der UserCall eingetragen, da diese beim nachfolgenden
// mpDrawView->SetAttributes( *pSet, sal_True ) verloren gehen und spaeter restauriert
// werden muessen
List* pAttrList = new List();
SdPage* pPresPage = (SdPage*) mpDrawView->GetSdrPageView()->GetPage();
sal_uLong i;
for ( i = 0; i < nCount; i++ )
{
SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
if( pPresPage->IsPresObj( pObj ) )
{
SfxItemSet* pNewSet = new SfxItemSet( GetDoc()->GetPool(), SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT, 0 );
pNewSet->Put(pObj->GetMergedItemSet());
pAttrList->Insert( pNewSet, LIST_APPEND );
pAttrList->Insert( pObj->GetUserCall(), LIST_APPEND );
}
}
pSet = new SfxItemSet( GetPool() );
mpDrawView->SetAttributes( *pSet, sal_True );
sal_uLong j = 0;
for ( i = 0; i < nCount; i++ )
{
SfxStyleSheet* pSheet = NULL;
SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
if (pObj->GetObjIdentifier() == OBJ_TITLETEXT)
{
pSheet = mpActualPage->GetStyleSheetForPresObj(PRESOBJ_TITLE);
if (pSheet)
pObj->SetStyleSheet(pSheet, sal_False);
}
else if(pObj->GetObjIdentifier() == OBJ_OUTLINETEXT)
{
for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++)
{
pSheet = mpActualPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE );
DBG_ASSERT(pSheet, "Vorlage fuer Gliederungsobjekt nicht gefunden");
if (pSheet)
{
pObj->StartListening(*pSheet);
if( nLevel == 1 )
// Textrahmen hoert auf StyleSheet der Ebene1
pObj->NbcSetStyleSheet(pSheet, sal_False);
}
}
}
if( pPresPage->IsPresObj( pObj ) )
{
SfxItemSet* pNewSet = (SfxItemSet*) pAttrList->GetObject(j++);
SdrObjUserCall* pUserCall = (SdrObjUserCall*) pAttrList->GetObject(j++);
if ( pNewSet && pNewSet->GetItemState( SDRATTR_TEXT_MINFRAMEHEIGHT ) == SFX_ITEM_ON )
{
pObj->SetMergedItem(pNewSet->Get(SDRATTR_TEXT_MINFRAMEHEIGHT));
}
if ( pNewSet && pNewSet->GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) == SFX_ITEM_ON )
{
pObj->SetMergedItem(pNewSet->Get(SDRATTR_TEXT_AUTOGROWHEIGHT));
}
if( pUserCall )
pObj->SetUserCall( pUserCall );
delete pNewSet;
}
}
delete pAttrList;
}
delete pSet;
Cancel();
}
break;
case SID_DELETE_SNAPITEM:
{
SdrPageView* pPV;
Point aMPos = GetActiveWindow()->PixelToLogic( maMousePos );
sal_uInt16 nHitLog = (sal_uInt16) GetActiveWindow()->PixelToLogic( Size(
FuPoor::HITPIX, 0 ) ).Width();
sal_uInt16 nHelpLine;
mbMousePosFreezed = sal_False;
if( mpDrawView->PickHelpLine( aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) )
{
pPV->DeleteHelpLine( nHelpLine );
}
Cancel();
rReq.Ignore ();
}
break;
case SID_DELETE_PAGE:
case SID_DELETE_MASTER_PAGE:
DeleteActualPage();
Cancel();
rReq.Ignore ();
break;
case SID_DELETE_LAYER:
DeleteActualLayer();
Cancel();
rReq.Ignore ();
break;
case SID_ORIGINAL_SIZE:
mpDrawView->SetMarkedOriginalSize();
Cancel();
rReq.Done();
break;
case SID_DRAW_FONTWORK:
case SID_DRAW_FONTWORK_VERTICAL:
{
svx::FontworkBar::execute( mpView, rReq, GetViewFrame()->GetBindings() ); // SJ: can be removed (I think)
Cancel();
rReq.Done();
}
break;
case SID_SAVEGRAPHIC:
{
const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
if( rMarkList.GetMarkCount() == 1 )
{
SdrGrafObj *pGrafObj = dynamic_cast< SdrGrafObj* >( rMarkList.GetMark( 0 )->GetMarkedSdrObj() );
if(pGrafObj )
{
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape( pGrafObj->getUnoShape(), com::sun::star::uno::UNO_QUERY );
SdGRFFilter::SaveGraphic( xShape );
}
}
Cancel();
rReq.Ignore();
}
break;
default:
{
// switch Anweisung wegen CLOOKS aufgeteilt. Alle case-Anweisungen die
// eine Fu???? -Funktion aufrufen, sind in die Methode FuTemp01 (drviews8)
// gewandert.
FuTemp01(rReq);
}
break;
}
if(HasCurrentFunction())
{
GetCurrentFunction()->Activate();
}
}
/** This method consists basically of three parts:
1. Process the arguments of the SFX request.
2. Use the model to create a new page or duplicate an existing one.
3. Update the tab control and switch to the new page.
*/
SdPage* DrawViewShell::CreateOrDuplicatePage (
SfxRequest& rRequest,
PageKind ePageKind,
SdPage* pPage,
const sal_Int32 nInsertPosition)
{
SdPage* pNewPage = NULL;
if (ePageKind == PK_STANDARD && meEditMode != EM_MASTERPAGE)
{
if ( mpDrawView->IsTextEdit() )
{
mpDrawView->SdrEndTextEdit();
}
pNewPage = ViewShell::CreateOrDuplicatePage (rRequest, ePageKind, pPage, nInsertPosition);
}
return pNewPage;
}
} // end of namespace sd
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|