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
|
/*************************************************************************
*
* $RCSfile: drwtxtex.cxx,v $
*
* $Revision: 1.6 $
*
* last change: $Author: jp $ $Date: 2001-02-02 17:43:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifdef PRECOMPILED
#include "ui_pch.hxx"
#endif
#pragma hdrstop
#ifndef _HINTIDS_HXX
#include <hintids.hxx>
#endif
#ifndef _SVDVIEW_HXX //autogen
#include <svx/svdview.hxx>
#endif
#ifndef _SVX_SPLTITEM_HXX //autogen
#include <svx/spltitem.hxx>
#endif
#ifndef _SVX_ORPHITEM_HXX //autogen
#include <svx/orphitem.hxx>
#endif
#ifndef _SVX_BRKITEM_HXX //autogen
#include <svx/brkitem.hxx>
#endif
#ifndef _SVX_WIDWITEM_HXX //autogen
#include <svx/widwitem.hxx>
#endif
#ifndef _SVX_BRKITEM_HXX //autogen
#include <svx/brkitem.hxx>
#endif
#ifndef _SVX_KERNITEM_HXX //autogen
#include <svx/kernitem.hxx>
#endif
#ifndef _SVX_ESCPITEM_HXX //autogen
#include <svx/escpitem.hxx>
#endif
#ifndef _SVX_PARAITEM_HXX //autogen
#include <svx/lspcitem.hxx>
#endif
#ifndef _SVX_ADJITEM_HXX //autogen
#include <svx/adjitem.hxx>
#endif
#ifndef _SVX_CRSDITEM_HXX //autogen
#include <svx/crsditem.hxx>
#endif
#ifndef _SVX_SHDDITEM_HXX //autogen
#include <svx/shdditem.hxx>
#endif
#ifndef _SVX_HYZNITEM_HXX //autogen
#include <svx/hyznitem.hxx>
#endif
#ifndef _SVX_UDLNITEM_HXX //autogen
#include <svx/udlnitem.hxx>
#endif
#ifndef _SVX_FONTITEM_HXX //autogen
#include <svx/fontitem.hxx>
#endif
#ifndef _SVX_FHGTITEM_HXX //autogen
#include <svx/fhgtitem.hxx>
#endif
#ifndef _SVX_COLRITEM_HXX //autogen
#include <svx/colritem.hxx>
#endif
#ifndef _SVX_WGHTITEM_HXX //autogen
#include <svx/wghtitem.hxx>
#endif
#ifndef _SVX_CNTRITEM_HXX //autogen
#include <svx/cntritem.hxx>
#endif
#ifndef _SVX_POSTITEM_HXX //autogen
#include <svx/postitem.hxx>
#endif
#ifndef _SVDOUTL_HXX
#include <svx/svdoutl.hxx>
#endif
#ifndef _SFXVIEWFRM_HXX
#include <sfx2/viewfrm.hxx>
#endif
#ifndef _SFX_WHITER_HXX //autogen
#include <svtools/whiter.hxx>
#endif
#ifndef _SFX_BINDINGS_HXX //autogen
#include <sfx2/bindings.hxx>
#endif
#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
#endif
#ifndef _SFXDISPATCH_HXX //autogen
#include <sfx2/dispatch.hxx>
#endif
#ifndef _SFXREQUEST_HXX //autogen
#include <sfx2/request.hxx>
#endif
#ifndef _SVX_FLDITEM_HXX
# ifndef ITEMID_FIELD
# ifndef _MyEDITDATA_HXX //autogen
# include <svx/editdata.hxx> // das include wird wg. EE_FEATURE_FIELD benoetigt
# endif
# define ITEMID_FIELD EE_FEATURE_FIELD /* wird fuer #include <flditem.hxx> benoetigt */
# endif
# ifndef _SVX_FLDITEM_HXX //autogen
# include <svx/flditem.hxx>
# endif
#endif
#ifndef _EDITSTAT_HXX //autogen
#include <svx/editstat.hxx>
#endif
#ifndef _OUTLINER_HXX //autogen
#include <svx/outliner.hxx>
#endif
#ifndef _SVX_HLNKITEM_HXX //autogen
#include <svx/hlnkitem.hxx>
#endif
#ifndef _SVX_HTMLMODE_HXX
#include <svx/htmlmode.hxx>
#endif
#ifndef _SVX_LANGITEM_HXX
#include <svx/langitem.hxx>
#endif
#ifndef _UNO_LINGU_HXX
#include <svx/unolingu.hxx>
#endif
#ifndef _SVX_SCRIPTTYPEITEM_HXX
#include <svx/scripttypeitem.hxx>
#endif
#ifndef _COM_SUN_STAR_LINGUISTIC2_XTHESAURUS_HPP_
#include <com/sun/star/linguistic2/XThesaurus.hpp>
#endif
#ifndef _DOC_HXX
#include <doc.hxx>
#endif
#ifndef _WVIEW_HXX
#include <wview.hxx>
#endif
#ifndef _VIEWOPT_HXX
#include <viewopt.hxx>
#endif
#ifndef _WRTSH_HXX
#include <wrtsh.hxx>
#endif
#ifndef _UIPARAM_HXX
#include <uiparam.hxx>
#endif
#ifndef _UITOOL_HXX
#include <uitool.hxx>
#endif
#ifndef _CHRDLG_HXX
#include <chrdlg.hxx>
#endif
#ifndef _PARDLG_HXX
#include <pardlg.hxx>
#endif
#ifndef _SWDTFLVR_HXX
#include <swdtflvr.hxx>
#endif
#ifndef _DRWTXTSH_HXX
#include <drwtxtsh.hxx>
#endif
#ifndef _SWMODULE_HXX
#include <swmodule.hxx>
#endif
#ifndef _INITUI_HXX
#include <initui.hxx> // fuer SpellPointer
#endif
#ifndef _CMDID_H
#include <cmdid.h>
#endif
#ifndef _GLOBALS_HRC
#include <globals.hrc>
#endif
#ifndef _SHELLS_HRC
#include <shells.hrc>
#endif
using namespace ::com::sun::star;
/*--------------------------------------------------------------------
Beschreibung:
--------------------------------------------------------------------*/
void SwDrawTextShell::Execute( SfxRequest &rReq )
{
SwWrtShell &rSh = GetShell();
SfxItemSet aEditAttr(pOLV->GetAttribs());
SfxItemSet aNewAttr(*(aEditAttr.GetPool()), aEditAttr.GetRanges());
sal_uInt16 nSlot = rReq.GetSlot();
sal_uInt16 nWhich = GetPool().GetWhich(nSlot);
const SfxItemSet *pNewAttrs = rReq.GetArgs();
switch (nSlot)
{
case SID_ATTR_CHAR_FONT:
case SID_ATTR_CHAR_FONTHEIGHT:
case SID_ATTR_CHAR_WEIGHT:
case SID_ATTR_CHAR_POSTURE:
{
SfxItemPool* pPool = aEditAttr.GetPool()->GetSecondaryPool();
if( !pPool )
pPool = aEditAttr.GetPool();
SvxScriptSetItem aSetItem( nSlot, *pPool );
aSetItem.PutItemForScriptType( pOLV->GetSelectedScriptType(),
pNewAttrs->Get( nWhich ));
aNewAttr.Put( aSetItem.GetItemSet() );
}
break;
case SID_ATTR_CHAR_COLOR:
aNewAttr.Put( pNewAttrs->Get(nWhich), EE_CHAR_COLOR );
break;
case SID_ATTR_CHAR_UNDERLINE:
{
FontUnderline eFU = ((const SvxUnderlineItem&)aEditAttr.Get(EE_CHAR_UNDERLINE)).GetUnderline();
aNewAttr.Put(SvxUnderlineItem(eFU == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE));
}
break;
case SID_ATTR_CHAR_CONTOUR:
aNewAttr.Put((const SvxContourItem&)pNewAttrs->Get(nWhich), EE_CHAR_OUTLINE);
break;
case SID_ATTR_CHAR_SHADOWED:
aNewAttr.Put((const SvxShadowedItem&)pNewAttrs->Get(nWhich), EE_CHAR_SHADOW);
break;
case SID_ATTR_CHAR_STRIKEOUT:
aNewAttr.Put((const SvxCrossedOutItem&)pNewAttrs->Get(nWhich), EE_CHAR_STRIKEOUT);
break;
case SID_ATTR_PARA_ADJUST_LEFT:
aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_LEFT, EE_PARA_JUST));
break;
case SID_ATTR_PARA_ADJUST_CENTER:
aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST));
break;
case SID_ATTR_PARA_ADJUST_RIGHT:
aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_RIGHT, EE_PARA_JUST));
break;
case SID_ATTR_PARA_ADJUST_BLOCK:
aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_BLOCK, EE_PARA_JUST));
break;
case SID_ATTR_PARA_LINESPACE_10:
{
SvxLineSpacingItem aItem(SVX_LINESPACE_ONE_LINE, EE_PARA_SBL);
aItem.SetPropLineSpace(100);
aNewAttr.Put(aItem);
}
break;
case SID_ATTR_PARA_LINESPACE_15:
{
SvxLineSpacingItem aItem(SVX_LINESPACE_ONE_POINT_FIVE_LINES, EE_PARA_SBL);
aItem.SetPropLineSpace(150);
aNewAttr.Put(aItem);
}
break;
case SID_ATTR_PARA_LINESPACE_20:
{
SvxLineSpacingItem aItem(SVX_LINESPACE_TWO_LINES, EE_PARA_SBL);
aItem.SetPropLineSpace(200);
aNewAttr.Put(aItem);
}
break;
case FN_SET_SUPER_SCRIPT:
{
SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
else
aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT );
}
break;
case FN_SET_SUB_SCRIPT:
{
SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
else
aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT );
}
break;
case SID_CHAR_DLG:
{
const SfxItemSet* pArgs = rReq.GetArgs();
if( !pArgs )
{
SwView* pView = &GetView();
FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView));
SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, eMetric));
SfxItemSet aDlgAttr(GetPool(), EE_ITEMS_START, EE_ITEMS_END);
// util::Language gibts an der EditEngine nicht! Daher nicht im Set.
aDlgAttr.Put( aEditAttr );
aDlgAttr.Put( SvxKerningItem() );
SwCharDlg* pDlg = new SwCharDlg(pView->GetWindow(), *pView, aDlgAttr, 0, sal_True);
USHORT nRet = pDlg->Execute();
if(RET_OK == nRet )
aNewAttr.Put(*pDlg->GetOutputItemSet());
delete( pDlg );
if(RET_OK != nRet)
return ;
}
else
aNewAttr.Put(*pArgs);
}
break;
case SID_PARA_DLG:
{
const SfxItemSet* pArgs = rReq.GetArgs();
if (!pArgs)
{
SwView* pView = &GetView();
FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView));
SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, eMetric));
SfxItemSet aDlgAttr(GetPool(),
EE_ITEMS_START, EE_ITEMS_END,
SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_HYPHENZONE,
SID_ATTR_PARA_SPLIT, SID_ATTR_PARA_SPLIT,
SID_ATTR_PARA_WIDOWS, SID_ATTR_PARA_WIDOWS,
SID_ATTR_PARA_ORPHANS, SID_ATTR_PARA_ORPHANS,
0);
aDlgAttr.Put(aEditAttr);
// Die Werte sind erst einmal uebernommen worden, um den Dialog anzuzeigen.
// Muss natuerlich noch geaendert werden
// aDlgAttr.Put( SvxParaDlgLimitsItem( 567 * 50, 5670) );
aDlgAttr.Put( SvxHyphenZoneItem() );
aDlgAttr.Put( SvxFmtBreakItem() );
aDlgAttr.Put( SvxFmtSplitItem() );
aDlgAttr.Put( SvxWidowsItem() );
aDlgAttr.Put( SvxOrphansItem() );
SwParaDlg* pDlg = new SwParaDlg(GetView().GetWindow(), GetView(), aDlgAttr, DLG_STD, 0, sal_True);
USHORT nRet = pDlg->Execute();
if(RET_OK == nRet)
aNewAttr.Put(*pDlg->GetOutputItemSet());
delete( pDlg );
if(RET_OK != nRet)
return;
}
else
aNewAttr.Put(*pArgs);
}
break;
case SID_AUTOSPELL_MARKOFF:
case SID_AUTOSPELL_CHECK:
{
pSdrView = rSh.GetDrawView();
pOutliner = pSdrView->GetTextEditOutliner();
sal_uInt32 nCtrl = pOutliner->GetControlWord();
sal_Bool bSet = ((const SfxBoolItem&)rReq.GetArgs()->Get(nSlot)).GetValue();
if(nSlot == SID_AUTOSPELL_MARKOFF)
{
if(bSet)
nCtrl |= EE_CNTRL_NOREDLINES;
else
nCtrl &= ~EE_CNTRL_NOREDLINES;
}
else
{
if(bSet)
nCtrl |= EE_CNTRL_ONLINESPELLING|EE_CNTRL_ALLOWBIGOBJS;
else
nCtrl &= ~EE_CNTRL_ONLINESPELLING;
}
pOutliner->SetControlWord(nCtrl);
SW_MOD()->ExecuteSlot(rReq);
}
break;
case SID_HYPERLINK_SETLINK:
{
const SfxPoolItem* pItem = 0;
if(pNewAttrs)
pNewAttrs->GetItemState(nSlot, sal_False, &pItem);
if(pItem)
{
const SvxHyperlinkItem& rHLinkItem = *(const SvxHyperlinkItem *)pItem;
SvxURLField aFld(rHLinkItem.GetURL(), rHLinkItem.GetName(), SVXURLFORMAT_APPDEFAULT);
aFld.SetTargetFrame(rHLinkItem.GetTargetFrame());
const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
if (pFieldItem && pFieldItem->GetField()->ISA(SvxURLField))
{
// Feld selektieren, so dass es beim Insert geloescht wird
ESelection aSel = pOLV->GetSelection();
aSel.nEndPos++;
pOLV->SetSelection(aSel);
}
pOLV->InsertField(aFld);
}
}
break;
default:
ASSERT(!this, falscher Dispatcher);
return;
}
SetAttrToMarked(aNewAttr);
GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False);
if (IsTextEdit() && pOLV->GetOutliner()->IsModified())
rSh.SetModified();
}
/*--------------------------------------------------------------------
Beschreibung:
--------------------------------------------------------------------*/
void SwDrawTextShell::GetState(SfxItemSet& rSet)
{
if (!IsTextEdit()) // Sonst manchmal Absturz!
return;
SfxItemSet aEditAttr(pOLV->GetAttribs());
sal_uInt16 nWhich = 0;
const SfxPoolItem* pItem = 0;
SfxItemState eState = aEditAttr.GetItemState(EE_PARA_JUST, sal_False, &pItem);
if (eState == SFX_ITEM_DONTCARE || !pItem)
{
rSet.InvalidateItem( SID_ATTR_PARA_ADJUST_LEFT );
rSet.InvalidateItem( SID_ATTR_PARA_ADJUST_CENTER );
rSet.InvalidateItem( SID_ATTR_PARA_ADJUST_RIGHT );
rSet.InvalidateItem( SID_ATTR_PARA_ADJUST_BLOCK );
}
else
{
SvxAdjust eAdjust = ((const SvxAdjustItem*)pItem)->GetAdjust();
switch( eAdjust )
{
case SVX_ADJUST_LEFT: nWhich = SID_ATTR_PARA_ADJUST_LEFT; break;
case SVX_ADJUST_CENTER: nWhich = SID_ATTR_PARA_ADJUST_CENTER; break;
case SVX_ADJUST_RIGHT: nWhich = SID_ATTR_PARA_ADJUST_RIGHT; break;
case SVX_ADJUST_BLOCK: nWhich = SID_ATTR_PARA_ADJUST_BLOCK; break;
}
if( nWhich )
rSet.Put( SfxBoolItem( nWhich, sal_True ) );
}
eState = aEditAttr.GetItemState(EE_PARA_SBL, sal_False, &pItem);
if (eState == SFX_ITEM_DONTCARE || !pItem)
{
rSet.InvalidateItem( SID_ATTR_PARA_LINESPACE_10 );
rSet.InvalidateItem( SID_ATTR_PARA_LINESPACE_15 );
rSet.InvalidateItem( SID_ATTR_PARA_LINESPACE_20 );
}
else
{
const sal_Int8 nSpace = ((const SvxLineSpacingItem*)pItem)->GetPropLineSpace();
nWhich = 0;
switch( nSpace )
{
case 100:
nWhich = SID_ATTR_PARA_LINESPACE_10;
break;
case 150:
nWhich = SID_ATTR_PARA_LINESPACE_15;
break;
case 200:
nWhich = SID_ATTR_PARA_LINESPACE_20;
break;
}
if( nWhich )
rSet.Put( SfxBoolItem( nWhich, sal_True ) );
}
SvxEscapement eEsc = (SvxEscapement)((const SvxEscapementItem&)
aEditAttr.Get(EE_CHAR_ESCAPEMENT)).GetEnumValue();
if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
rSet.Put( SfxBoolItem( FN_SET_SUPER_SCRIPT, sal_True ) );
else if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
rSet.Put( SfxBoolItem( FN_SET_SUB_SCRIPT, sal_True ) );
// disable "Thesaurus" if the language is not supported
const SfxPoolItem &rItem = GetShell().GetDoc()->GetDefault(RES_CHRATR_LANGUAGE);
LanguageType nLang = ((const SvxLanguageItem &) rItem).GetLanguage();
//
uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
if (!xThes.is() || nLang == LANGUAGE_NONE ||
!xThes->hasLocale( SvxCreateLocale( nLang ) ))
rSet.DisableItem( FN_THESAURUS_DLG );
}
/*--------------------------------------------------------------------
Beschreibung:
--------------------------------------------------------------------*/
void SwDrawTextShell::GetDrawTxtCtrlState(SfxItemSet& rSet)
{
if (!IsTextEdit()) // Sonst Absturz!
return;
SfxItemSet aEditAttr(pOLV->GetAttribs());
SfxWhichIter aIter(rSet);
sal_uInt16 nWhich = aIter.FirstWhich();
USHORT nScriptType = pOLV->GetSelectedScriptType();
while(nWhich)
{
USHORT nSlotId = GetPool().GetSlotId( nWhich );
switch( nSlotId )
{
case SID_ATTR_CHAR_FONT:
case SID_ATTR_CHAR_FONTHEIGHT:
case SID_ATTR_CHAR_WEIGHT:
case SID_ATTR_CHAR_POSTURE:
{
SfxItemPool* pPool = aEditAttr.GetPool()->GetSecondaryPool();
if( !pPool )
pPool = aEditAttr.GetPool();
SvxScriptSetItem aSetItem( nSlotId, *pPool );
aSetItem.GetItemSet().Put( aEditAttr, FALSE );
const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
if( pI )
rSet.Put( *pI, nWhich );
else
rSet.InvalidateItem( nWhich );
}
break;
case SID_ATTR_CHAR_COLOR:
rSet.Put(aEditAttr.Get(EE_CHAR_COLOR, sal_True), nWhich);
break;
case SID_ATTR_CHAR_UNDERLINE:
rSet.Put(aEditAttr.Get(EE_CHAR_UNDERLINE, sal_True), nWhich);
break;
case SID_ATTR_CHAR_CONTOUR:
rSet.Put(aEditAttr.Get(EE_CHAR_OUTLINE, sal_True), nWhich);
break;
case SID_ATTR_CHAR_SHADOWED:
rSet.Put(aEditAttr.Get(EE_CHAR_SHADOW, sal_True), nWhich);
break;
case SID_ATTR_CHAR_STRIKEOUT:
rSet.Put(aEditAttr.Get(EE_CHAR_STRIKEOUT, sal_True), nWhich);
break;
case SID_AUTOSPELL_MARKOFF:
case SID_AUTOSPELL_CHECK:
const SfxPoolItem* pState = SW_MOD()->GetSlotState(nWhich);
if (pState)
rSet.Put(SfxBoolItem(nWhich, ((const SfxBoolItem*)pState)->GetValue()));
else
rSet.DisableItem( nWhich );
break;
}
nWhich = aIter.NextWhich();
}
}
/*--------------------------------------------------------------------
Beschreibung:
--------------------------------------------------------------------*/
void SwDrawTextShell::ExecClpbrd(SfxRequest &rReq)
{
if (!IsTextEdit()) // Sonst Absturz!
return;
sal_uInt16 nId = rReq.GetSlot();
switch( nId )
{
case SID_CUT:
pOLV->Cut();
return;
case SID_COPY:
pOLV->Copy();
return;
case SID_PASTE:
pOLV->PasteSpecial();
break;
default:
DBG_ERROR("falscher Dispatcher");
return;
}
}
/*--------------------------------------------------------------------
Beschreibung: ClipBoard-Status
--------------------------------------------------------------------*/
void SwDrawTextShell::StateClpbrd(SfxItemSet &rSet)
{
if (!IsTextEdit()) // Sonst Absturz!
return;
ESelection aSel(pOLV->GetSelection());
const sal_Bool bCopy = (aSel.nStartPara != aSel.nEndPara) ||
(aSel.nStartPos != aSel.nEndPos);
SfxWhichIter aIter(rSet);
sal_uInt16 nWhich = aIter.FirstWhich();
while(nWhich)
{
switch(nWhich)
{
case SID_CUT:
case SID_COPY:
if( !bCopy )
rSet.DisableItem( nWhich );
break;
case SID_PASTE:
{
TransferableDataHelper aDataHelper(
TransferableDataHelper::CreateFromSystemClipboard() );
if( !aDataHelper.GetTransferable().is() ||
!SwTransferable::IsPaste( GetShell(), aDataHelper ))
rSet.DisableItem( SID_PASTE );
}
break;
case FN_PASTESPECIAL:
rSet.DisableItem( FN_PASTESPECIAL );
break;
}
nWhich = aIter.NextWhich();
}
}
/*--------------------------------------------------------------------
Beschreibung: Hyperlink-Status
--------------------------------------------------------------------*/
void SwDrawTextShell::StateInsert(SfxItemSet &rSet)
{
if (!IsTextEdit()) // Sonst Absturz!
return;
SfxWhichIter aIter(rSet);
sal_uInt16 nWhich = aIter.FirstWhich();
while(nWhich)
{
switch(nWhich)
{
case SID_HYPERLINK_GETLINK:
{
SvxHyperlinkItem aHLinkItem;
aHLinkItem.SetInsertMode(HLINK_FIELD);
const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
if (pFieldItem)
{
const SvxFieldData* pField = pFieldItem->GetField();
if (pField->ISA(SvxURLField))
{
aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation());
aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL());
aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame());
}
}
else
{
String sSel(pOLV->GetSelected());
sSel.Erase(255);
sSel.EraseTrailingChars();
aHLinkItem.SetName(sSel);
}
sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() |
((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0)));
rSet.Put(aHLinkItem);
}
break;
}
nWhich = aIter.NextWhich();
}
}
|