xref: /trunk/main/sw/source/ui/utlui/attrdesc.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sw.hxx"
30 
31 
32 #include <svl/itemiter.hxx>
33 #include <vcl/svapp.hxx>
34 #include <editeng/itemtype.hxx>
35 #include <svtools/grfmgr.hxx>
36 #include <unotools/intlwrapper.hxx>
37 #include <comphelper/processfactory.hxx>
38 #include <fmtanchr.hxx>
39 #include <fmtfsize.hxx>
40 #include <fmtinfmt.hxx>
41 #include <fchrfmt.hxx>
42 #include <fmtautofmt.hxx>
43 #include <fmtsrnd.hxx>
44 #include <fmtornt.hxx>
45 #include <fmtlsplt.hxx>
46 #include <fmtrowsplt.hxx>
47 #include <fmtpdsc.hxx>
48 #include <fmtclds.hxx>
49 #include <fmteiro.hxx>
50 #include <fmturl.hxx>
51 #include <fmthdft.hxx>
52 #include <fmtcnct.hxx>
53 #include <fmtline.hxx>
54 #include <tgrditem.hxx>
55 #include <hfspacingitem.hxx>
56 #include <fmtruby.hxx>
57 #include <paratr.hxx>
58 #include <grfatr.hxx>
59 #include <pagedesc.hxx>
60 #include <charfmt.hxx>
61 #include <fmtcol.hxx>
62 #include <tox.hxx>
63 #ifndef _ATTRDESC_HRC
64 #include <attrdesc.hrc>
65 #endif
66 #include <fmtftntx.hxx>
67 #include <fmtfollowtextflow.hxx>
68 
69 
70 using namespace com::sun::star;
71 
72 
73 TYPEINIT2(SwFmtCharFmt,SfxPoolItem,SwClient);
74 
75 // erfrage die Attribut-Beschreibung
76 void SwAttrSet::GetPresentation(
77         SfxItemPresentation ePres,
78         SfxMapUnit eCoreMetric,
79         SfxMapUnit ePresMetric,
80         String &rText ) const
81 {
82 static sal_Char __READONLY_DATA sKomma[] = ", ";
83 
84     rText.Erase();
85     String aStr;
86     if( Count() )
87     {
88         SfxItemIter aIter( *this );
89         const IntlWrapper rInt( ::comphelper::getProcessServiceFactory(),
90                                     GetAppLanguage() );
91         while( sal_True )
92         {
93             aIter.GetCurItem()->GetPresentation( ePres, eCoreMetric,
94                                                  ePresMetric, aStr,
95                                                  &rInt );
96             if( rText.Len() && aStr.Len() )
97                 rText += String::CreateFromAscii(sKomma);
98             rText += aStr;
99             if( aIter.IsAtEnd() )
100                 break;
101             aIter.NextItem();
102         }
103     }
104 }
105 
106 // ATT_CHARFMT *********************************************
107 
108 
109 SfxItemPresentation SwFmtCharFmt::GetPresentation
110 (
111     SfxItemPresentation ePres,
112     SfxMapUnit          eCoreUnit,
113     SfxMapUnit          ePresUnit,
114     String&             rText,
115     const IntlWrapper*        /*pIntl*/
116 )   const
117 {
118     switch ( ePres )
119     {
120         case SFX_ITEM_PRESENTATION_NONE:
121             rText.Erase();
122             break;
123         case SFX_ITEM_PRESENTATION_NAMELESS:
124         case SFX_ITEM_PRESENTATION_COMPLETE:
125         {
126             const SwCharFmt *pCharFmt = GetCharFmt();
127             if ( pCharFmt )
128             {
129                 String aStr;
130                 rText = SW_RESSTR(STR_CHARFMT );
131                 pCharFmt->GetPresentation( ePres, eCoreUnit, ePresUnit, aStr );
132                 rText += '(';
133                 rText += aStr;
134                 rText += ')';
135             }
136             else
137                 rText = SW_RESSTR( STR_NO_CHARFMT );
138             return ePres;
139         }
140         default:;//prevent warning
141     }
142     return SFX_ITEM_PRESENTATION_NONE;
143 }
144 
145 // ATT_AUTOFMT *********************************************
146 
147 
148 SfxItemPresentation SwFmtAutoFmt::GetPresentation
149 (
150     SfxItemPresentation ePres,
151     SfxMapUnit          /*eCoreUnit*/,
152     SfxMapUnit          /*ePresUnit*/,
153     String&             rText,
154     const IntlWrapper*        /*pIntl*/
155 )   const
156 {
157     switch ( ePres )
158     {
159         case SFX_ITEM_PRESENTATION_NONE:
160             rText.Erase();
161             break;
162         case SFX_ITEM_PRESENTATION_NAMELESS:
163         case SFX_ITEM_PRESENTATION_COMPLETE:
164         {
165             rText.Erase(); //TODO
166             return ePres;
167         }
168         default:;//prevent warning
169     }
170     return SFX_ITEM_PRESENTATION_NONE;
171 }
172 
173 // ATT_INETFMT *********************************************
174 
175 
176 SfxItemPresentation SwFmtINetFmt::GetPresentation
177 (
178     SfxItemPresentation ePres,
179     SfxMapUnit          /*eCoreUnit*/,
180     SfxMapUnit          /*ePresUnit*/,
181     String&             rText,
182     const IntlWrapper*        /*pIntl*/
183 )   const
184 {
185     switch ( ePres )
186     {
187         case SFX_ITEM_PRESENTATION_NONE:
188             rText.Erase();
189             break;
190         case SFX_ITEM_PRESENTATION_NAMELESS:
191         case SFX_ITEM_PRESENTATION_COMPLETE:
192         {
193             rText = GetValue();
194             return ePres;
195         }
196         default:;//prevent warning
197     }
198     return SFX_ITEM_PRESENTATION_NONE;
199 }
200 
201 SfxItemPresentation SwFmtRuby::GetPresentation( SfxItemPresentation ePres,
202                             SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
203                             String &rText, const IntlWrapper* /*pIntl*/ ) const
204 {
205     switch ( ePres )
206     {
207         case SFX_ITEM_PRESENTATION_NONE:
208             rText.Erase();
209             break;
210         case SFX_ITEM_PRESENTATION_NAMELESS:
211         case SFX_ITEM_PRESENTATION_COMPLETE:
212             {
213                 rText = aEmptyStr;
214                 return ePres;
215             }
216         default:;//prevent warning
217     }
218     return SFX_ITEM_PRESENTATION_NONE;
219 }
220 
221 /*************************************************************************
222 |*    class     SwFmtDrop
223 *************************************************************************/
224 
225 
226 SfxItemPresentation SwFmtDrop::GetPresentation
227 (
228     SfxItemPresentation ePres,
229     SfxMapUnit          /*eCoreUnit*/,
230     SfxMapUnit          /*ePresUnit*/,
231     String&             rText,
232     const IntlWrapper*        /*pIntl*/
233 )   const
234 {
235     rText.Erase();
236     switch ( ePres )
237     {
238         case SFX_ITEM_PRESENTATION_NONE:
239             break;
240         case SFX_ITEM_PRESENTATION_NAMELESS:
241         case SFX_ITEM_PRESENTATION_COMPLETE:
242         {
243             if ( GetLines() > 1 )
244             {
245                 if ( GetChars() > 1 )
246                 {
247                     rText = String::CreateFromInt32( GetChars() );
248                     rText += ' ';
249                 }
250                 rText += SW_RESSTR( STR_DROP_OVER );
251                 rText += ' ';
252                 rText += String::CreateFromInt32( GetLines() );
253                 rText += ' ';
254                 rText += SW_RESSTR( STR_DROP_LINES );
255             }
256             else
257                 rText = SW_RESSTR( STR_NO_DROP_LINES );
258             return ePres;
259         }
260         default:;//prevent warning
261     }
262     return SFX_ITEM_PRESENTATION_NONE;
263 }
264 
265 /*************************************************************************
266 |*    class     SwRegisterItem
267 *************************************************************************/
268 
269 
270 SfxItemPresentation SwRegisterItem::GetPresentation
271 (
272     SfxItemPresentation ePres,
273     SfxMapUnit          /*eCoreUnit*/,
274     SfxMapUnit          /*ePresUnit*/,
275     XubString&          rText,
276     const IntlWrapper*        /*pIntl*/
277 )   const
278 {
279     switch ( ePres )
280     {
281         case SFX_ITEM_PRESENTATION_NONE:
282             rText.Erase();
283             return SFX_ITEM_PRESENTATION_NONE;
284         case SFX_ITEM_PRESENTATION_NAMELESS:
285         case SFX_ITEM_PRESENTATION_COMPLETE:
286         {
287             sal_uInt16 nId = GetValue() ? STR_REGISTER_ON : STR_REGISTER_OFF;
288             rText = SW_RESSTR( nId );
289             return ePres;
290         }
291         default:;//prevent warning
292     }
293     return SFX_ITEM_PRESENTATION_NONE;
294 }
295 
296 /*************************************************************************
297 |*    class     SwNumRuleItem
298 *************************************************************************/
299 
300 
301 SfxItemPresentation SwNumRuleItem::GetPresentation
302 (
303     SfxItemPresentation ePres,
304     SfxMapUnit          /*eCoreUnit*/,
305     SfxMapUnit          /*ePresUnit*/,
306     XubString&          rText,
307     const IntlWrapper*        /*pIntl*/
308 )   const
309 {
310     switch ( ePres )
311     {
312         case SFX_ITEM_PRESENTATION_NONE:
313             rText.Erase();
314             return SFX_ITEM_PRESENTATION_NONE;
315         case SFX_ITEM_PRESENTATION_NAMELESS:
316         case SFX_ITEM_PRESENTATION_COMPLETE:
317         {
318             if( GetValue().Len() )
319                 (((rText = SW_RESSTR( STR_NUMRULE_ON )) +=
320                     '(' ) += GetValue() ) += ')';
321             else
322                 rText = SW_RESSTR( STR_NUMRULE_OFF );
323             return ePres;
324         }
325         default:;//prevent warning
326     }
327     return SFX_ITEM_PRESENTATION_NONE;
328 }
329 /*************************************************************************
330 |*    class     SwParaConnectBorderItem
331 *************************************************************************/
332 
333 SfxItemPresentation SwParaConnectBorderItem::GetPresentation
334 (
335     SfxItemPresentation ePres,
336     SfxMapUnit          /*eCoreUnit*/,
337     SfxMapUnit          /*ePresUnit*/,
338     XubString&          rText,
339     const IntlWrapper*        /*pIntl*/
340 )   const
341 {
342     switch ( ePres )
343     {
344         case SFX_ITEM_PRESENTATION_NONE:
345             rText.Erase();
346             return SFX_ITEM_PRESENTATION_NONE;
347         case SFX_ITEM_PRESENTATION_NAMELESS:
348         case SFX_ITEM_PRESENTATION_COMPLETE:
349         {
350             sal_uInt16 nId = GetValue() ? STR_CONNECT_BORDER_ON : STR_CONNECT_BORDER_OFF;
351             rText = SW_RESSTR( nId );
352             return ePres;
353         }
354         default:;//prevent warning
355     }
356     return SFX_ITEM_PRESENTATION_NONE;
357 }
358 
359 
360 
361 /******************************************************************************
362  *  Frame-Attribute:
363  ******************************************************************************/
364 
365 
366 SfxItemPresentation SwFmtFrmSize::GetPresentation
367 (
368     SfxItemPresentation ePres,
369     SfxMapUnit          eCoreUnit,
370     SfxMapUnit          ePresUnit,
371     String&             rText,
372     const IntlWrapper*        pIntl
373 )   const
374 {
375     switch ( ePres )
376     {
377         case SFX_ITEM_PRESENTATION_NONE:
378         {
379             rText.Erase();
380             break;
381         }
382         case SFX_ITEM_PRESENTATION_NAMELESS:
383         case SFX_ITEM_PRESENTATION_COMPLETE:
384         {
385             rText = SW_RESSTR( STR_FRM_WIDTH );
386             rText += ' ';
387             if ( GetWidthPercent() )
388             {
389                 rText += String::CreateFromInt32(GetWidthPercent());
390                 rText += '%';
391             }
392             else
393             {
394                 rText += ::GetMetricText( GetWidth(), eCoreUnit, ePresUnit, pIntl );
395                 rText += ::GetSvxString( ::GetMetricId( ePresUnit ) );
396             }
397             if ( ATT_VAR_SIZE != GetHeightSizeType() )
398             {
399                 rText += ',';
400                 rText += ' ';
401                 const sal_uInt16 nId = ATT_FIX_SIZE == eFrmHeightType ?
402                                         STR_FRM_FIXEDHEIGHT : STR_FRM_MINHEIGHT;
403                 rText += SW_RESSTR( nId );
404                 rText += ' ';
405                 if ( GetHeightPercent() )
406                 {
407                     rText += String::CreateFromInt32(GetHeightPercent());
408                     rText += '%';
409                 }
410                 else
411                 {
412                     rText += ::GetMetricText( GetHeight(), eCoreUnit, ePresUnit, pIntl );
413                     rText += ::GetSvxString( ::GetMetricId( ePresUnit ) );
414                 }
415             }
416             return ePres;
417         }
418         default:;//prevent warning
419     }
420     return SFX_ITEM_PRESENTATION_NONE;
421 }
422 
423 //Kopfzeile, fuer Seitenformate
424 //Client von FrmFmt das den Header beschreibt.
425 
426 
427 SfxItemPresentation SwFmtHeader::GetPresentation
428 (
429     SfxItemPresentation ePres,
430     SfxMapUnit          /*eCoreUnit*/,
431     SfxMapUnit          /*ePresUnit*/,
432     String&             rText,
433     const IntlWrapper*        /*pIntl*/
434 )   const
435 {
436     switch ( ePres )
437     {
438         case SFX_ITEM_PRESENTATION_NONE:
439             rText.Erase();
440             break;
441         case SFX_ITEM_PRESENTATION_NAMELESS:
442         case SFX_ITEM_PRESENTATION_COMPLETE:
443         {
444             const sal_uInt16 nId = GetHeaderFmt() ? STR_HEADER : STR_NO_HEADER;
445             rText = SW_RESSTR( nId );
446             return ePres;
447         }
448         default:;//prevent warning
449     }
450     return SFX_ITEM_PRESENTATION_NONE;
451 }
452 
453 //Fusszeile, fuer Seitenformate
454 //Client von FrmFmt das den Footer beschreibt.
455 
456 
457 SfxItemPresentation SwFmtFooter::GetPresentation
458 (
459     SfxItemPresentation ePres,
460     SfxMapUnit          /*eCoreUnit*/,
461     SfxMapUnit          /*ePresUnit*/,
462     String&             rText,
463     const IntlWrapper*        /*pIntl*/
464 )   const
465 {
466     switch ( ePres )
467     {
468         case SFX_ITEM_PRESENTATION_NONE:
469             rText.Erase();
470             break;
471         case SFX_ITEM_PRESENTATION_NAMELESS:
472         case SFX_ITEM_PRESENTATION_COMPLETE:
473         {
474             const sal_uInt16 nId = GetFooterFmt() ? STR_FOOTER : STR_NO_FOOTER;
475             rText = SW_RESSTR( nId );
476             return ePres;
477         }
478         default:;//prevent warning
479     }
480     return SFX_ITEM_PRESENTATION_NONE;
481 }
482 
483 
484 SfxItemPresentation SwFmtSurround::GetPresentation
485 (
486     SfxItemPresentation ePres,
487     SfxMapUnit          /*eCoreUnit*/,
488     SfxMapUnit          /*ePresUnit*/,
489     String&             rText,
490     const IntlWrapper*        /*pIntl*/
491 )   const
492 {
493     switch ( ePres )
494     {
495         case SFX_ITEM_PRESENTATION_NONE:
496             rText.Erase();
497             break;
498         case SFX_ITEM_PRESENTATION_NAMELESS:
499         case SFX_ITEM_PRESENTATION_COMPLETE:
500         {
501             sal_uInt16 nId = 0;
502             switch ( (SwSurround)GetValue() )
503             {
504                 case SURROUND_NONE:
505                     nId = STR_SURROUND_NONE;
506                 break;
507                 case SURROUND_THROUGHT:
508                     nId = STR_SURROUND_THROUGHT;
509                 break;
510                 case SURROUND_PARALLEL:
511                     nId = STR_SURROUND_PARALLEL;
512                 break;
513                 case SURROUND_IDEAL:
514                     nId = STR_SURROUND_IDEAL;
515                 break;
516                 case SURROUND_LEFT:
517                     nId = STR_SURROUND_LEFT;
518                 break;
519                 case SURROUND_RIGHT:
520                     nId = STR_SURROUND_RIGHT;
521                 break;
522                 default:;//prevent warning
523             }
524             if ( nId )
525                 rText = SW_RESSTR( nId );
526 
527             if ( IsAnchorOnly() )
528             {
529                 rText += ' ';
530                 rText += SW_RESSTR( STR_SURROUND_ANCHORONLY );
531             }
532             return ePres;
533         }
534         default:;//prevent warning
535     }
536     return SFX_ITEM_PRESENTATION_NONE;
537 }
538 
539 
540 //VertOrientation, wie und woran orientiert --
541 //  sich der FlyFrm in der Vertikalen -----------
542 
543 
544 SfxItemPresentation SwFmtVertOrient::GetPresentation
545 (
546     SfxItemPresentation ePres,
547     SfxMapUnit          eCoreUnit,
548     SfxMapUnit          ePresUnit,
549     String&             rText,
550     const IntlWrapper*        pIntl
551 )   const
552 {
553     switch ( ePres )
554     {
555         case SFX_ITEM_PRESENTATION_NONE:
556             rText.Erase();
557             break;
558         case SFX_ITEM_PRESENTATION_NAMELESS:
559         case SFX_ITEM_PRESENTATION_COMPLETE:
560         {
561             sal_uInt16 nId = 0;
562             switch ( GetVertOrient() )
563             {
564                 case text::VertOrientation::NONE:
565                 {
566                     rText += SW_RESSTR( STR_POS_Y );
567                     rText += ' ';
568                     rText += ::GetMetricText( GetPos(), eCoreUnit, ePresUnit, pIntl );
569                     rText += ::GetSvxString( ::GetMetricId( ePresUnit ) );
570                 }
571                 break;
572                 case text::VertOrientation::TOP:
573                     nId = STR_VERT_TOP;
574                     break;
575                 case text::VertOrientation::CENTER:
576                     nId = STR_VERT_CENTER;
577                     break;
578                 case text::VertOrientation::BOTTOM:
579                     nId = STR_VERT_BOTTOM;
580                     break;
581                 case text::VertOrientation::LINE_TOP:
582                     nId = STR_LINE_TOP;
583                     break;
584                 case text::VertOrientation::LINE_CENTER:
585                     nId = STR_LINE_CENTER;
586                     break;
587                 case text::VertOrientation::LINE_BOTTOM:
588                     nId = STR_LINE_BOTTOM;
589                     break;
590                 default:;//prevent warning
591             }
592             if ( nId )
593                 rText += SW_RESSTR( nId );
594             return ePres;
595         }
596         default:;//prevent warning
597     }
598     return SFX_ITEM_PRESENTATION_NONE;
599 }
600 
601 //HoriOrientation, wie und woran orientiert --
602 //  sich der FlyFrm in der Hoizontalen ----------
603 
604 
605 SfxItemPresentation SwFmtHoriOrient::GetPresentation
606 (
607     SfxItemPresentation ePres,
608     SfxMapUnit          eCoreUnit,
609     SfxMapUnit          ePresUnit,
610     String&             rText,
611     const IntlWrapper*        pIntl
612 )   const
613 {
614     switch ( ePres )
615     {
616         case SFX_ITEM_PRESENTATION_NONE:
617             rText.Erase();
618             break;
619         case SFX_ITEM_PRESENTATION_NAMELESS:
620         case SFX_ITEM_PRESENTATION_COMPLETE:
621         {
622             sal_uInt16 nId = 0;
623             switch ( GetHoriOrient() )
624             {
625                 case text::HoriOrientation::NONE:
626                 {
627                     rText += SW_RESSTR( STR_POS_X );
628                     rText += ' ';
629                     rText += ::GetMetricText( GetPos(), eCoreUnit, ePresUnit, pIntl );
630                     rText += ::GetSvxString( ::GetMetricId( ePresUnit ) );
631                 }
632                 break;
633                 case text::HoriOrientation::RIGHT:
634                     nId = STR_HORI_RIGHT;
635                 break;
636                 case text::HoriOrientation::CENTER:
637                     nId = STR_HORI_CENTER;
638                 break;
639                 case text::HoriOrientation::LEFT:
640                     nId = STR_HORI_LEFT;
641                 break;
642                 case text::HoriOrientation::INSIDE:
643                     nId = STR_HORI_INSIDE;
644                 break;
645                 case text::HoriOrientation::OUTSIDE:
646                     nId = STR_HORI_OUTSIDE;
647                 break;
648                 case text::HoriOrientation::FULL:
649                     nId = STR_HORI_FULL;
650                 break;
651                 default:;//prevent warning
652             }
653             if ( nId )
654                 rText += SW_RESSTR( nId );
655             return ePres;
656         }
657         default:;//prevent warning
658     }
659     return SFX_ITEM_PRESENTATION_NONE;
660 }
661 
662 //FlyAnchor, Anker des Freifliegenden Rahmen ----
663 
664 
665 SfxItemPresentation SwFmtAnchor::GetPresentation
666 (
667     SfxItemPresentation ePres,
668     SfxMapUnit          /*eCoreUnit*/,
669     SfxMapUnit          /*ePresUnit*/,
670     String&             rText,
671     const IntlWrapper*        /*pIntl*/
672 )   const
673 {
674     switch ( ePres )
675     {
676         case SFX_ITEM_PRESENTATION_NONE:
677             rText.Erase();
678             break;
679         case SFX_ITEM_PRESENTATION_NAMELESS:
680         case SFX_ITEM_PRESENTATION_COMPLETE:
681         {
682             sal_uInt16 nId = 0;
683             switch ( GetAnchorId() )
684             {
685                 case FLY_AT_PARA:
686                     nId = STR_FLY_AT_PARA;
687                     break;
688                 case FLY_AS_CHAR:
689                     nId = STR_FLY_AS_CHAR;
690                     break;
691                 case FLY_AT_PAGE:
692                     nId = STR_FLY_AT_PAGE;
693                     break;
694                 default:;//prevent warning
695             }
696             if ( nId )
697                 rText += SW_RESSTR( nId );
698             return ePres;
699         }
700         default:;//prevent warning
701     }
702     return SFX_ITEM_PRESENTATION_NONE;
703 }
704 
705 
706 SfxItemPresentation SwFmtPageDesc::GetPresentation
707 (
708     SfxItemPresentation ePres,
709     SfxMapUnit          /*eCoreUnit*/,
710     SfxMapUnit          /*ePresUnit*/,
711     String&             rText,
712     const IntlWrapper*        /*pIntl*/
713 )   const
714 {
715     switch ( ePres )
716     {
717         case SFX_ITEM_PRESENTATION_NONE:
718             rText.Erase();
719             break;
720         case SFX_ITEM_PRESENTATION_NAMELESS:
721         case SFX_ITEM_PRESENTATION_COMPLETE:
722         {
723             const SwPageDesc *pPageDesc = GetPageDesc();
724             if ( pPageDesc )
725                 rText = pPageDesc->GetName();
726             else
727                 rText = SW_RESSTR( STR_NO_PAGEDESC );
728             return ePres;
729         }
730         default:;//prevent warning
731     }
732     return SFX_ITEM_PRESENTATION_NONE;
733 }
734 
735 //Der ColumnDescriptor --------------------------
736 
737 
738 SfxItemPresentation SwFmtCol::GetPresentation
739 (
740     SfxItemPresentation ePres,
741     SfxMapUnit          eCoreUnit,
742     SfxMapUnit          /*ePresUnit*/,
743     String&             rText,
744     const IntlWrapper*        pIntl
745 )   const
746 {
747     switch ( ePres )
748     {
749         case SFX_ITEM_PRESENTATION_NONE:
750             rText.Erase();
751             break;
752         case SFX_ITEM_PRESENTATION_NAMELESS:
753         case SFX_ITEM_PRESENTATION_COMPLETE:
754         {
755             sal_uInt16 nCnt = GetNumCols();
756             if ( nCnt > 1 )
757             {
758                 rText = String::CreateFromInt32(nCnt);
759                 rText += ' ';
760                 rText += SW_RESSTR( STR_COLUMNS );
761                 if ( COLADJ_NONE != GetLineAdj() )
762                 {
763                     sal_uInt16 nWdth = sal_uInt16(GetLineWidth());
764                     rText += ' ';
765                     rText += SW_RESSTR( STR_LINE_WIDTH );
766                     rText += ' ';
767                     rText += ::GetMetricText( nWdth, eCoreUnit,
768                                               SFX_MAPUNIT_POINT, pIntl );
769                 }
770             }
771             else
772                 rText.Erase();
773             return ePres;
774         }
775         default:;//prevent warning
776     }
777     return SFX_ITEM_PRESENTATION_NONE;
778 }
779 
780 //URL's und Maps
781 
782 
783 SfxItemPresentation SwFmtURL::GetPresentation
784 (
785     SfxItemPresentation ePres,
786     SfxMapUnit          /*eCoreUnit*/,
787     SfxMapUnit          /*ePresUnit*/,
788     String&             rText,
789     const IntlWrapper*        /*pIntl*/
790 )   const
791 {
792     rText.Erase();
793     switch ( ePres )
794     {
795         case SFX_ITEM_PRESENTATION_NONE:
796             break;
797         case SFX_ITEM_PRESENTATION_NAMELESS:
798         case SFX_ITEM_PRESENTATION_COMPLETE:
799         {
800             if ( pMap )
801                 rText.AppendAscii( RTL_CONSTASCII_STRINGPARAM("Client-Map"));
802             if ( sURL.Len() )
803             {
804                 if ( pMap )
805                     rText.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" - "));
806                 rText.AppendAscii( RTL_CONSTASCII_STRINGPARAM("URL: "));
807                 rText += sURL;
808                 if ( bIsServerMap )
809                     rText.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" (Server-Map)"));
810             }
811             if ( sTargetFrameName.Len() )
812             {
813                 rText.AppendAscii( RTL_CONSTASCII_STRINGPARAM(", Target: "));
814                 rText += sTargetFrameName;
815             }
816             return ePres;
817         }
818         default:;//prevent warning
819     }
820     return SFX_ITEM_PRESENTATION_NONE;
821 }
822 
823 
824 //SwFmtEditInReadonly
825 
826 
827 SfxItemPresentation SwFmtEditInReadonly::GetPresentation
828 (
829     SfxItemPresentation ePres,
830     SfxMapUnit          /*eCoreUnit*/,
831     SfxMapUnit          /*ePresUnit*/,
832     String&             rText,
833     const IntlWrapper*        /*pIntl*/
834 )   const
835 {
836     rText.Erase();
837     switch ( ePres )
838     {
839         case SFX_ITEM_PRESENTATION_NONE:
840             rText.Erase();
841             break;
842         case SFX_ITEM_PRESENTATION_NAMELESS:
843         case SFX_ITEM_PRESENTATION_COMPLETE:
844         {
845             if ( GetValue() )
846                 rText = SW_RESSTR(STR_EDIT_IN_READONLY);
847             return ePres;
848         }
849         default:;//prevent warning
850     }
851     return SFX_ITEM_PRESENTATION_NONE;
852 }
853 
854 
855 SfxItemPresentation SwFmtLayoutSplit::GetPresentation
856 (
857     SfxItemPresentation ePres,
858     SfxMapUnit          /*eCoreUnit*/,
859     SfxMapUnit          /*ePresUnit*/,
860     String&             rText,
861     const IntlWrapper*        /*pIntl*/
862 )   const
863 {
864     switch ( ePres )
865     {
866         case SFX_ITEM_PRESENTATION_NONE:
867             rText.Erase();
868             return SFX_ITEM_PRESENTATION_NONE;
869         case SFX_ITEM_PRESENTATION_NAMELESS:
870         case SFX_ITEM_PRESENTATION_COMPLETE:
871         {
872             if ( GetValue() )
873                 rText = SW_RESSTR(STR_LAYOUT_SPLIT);
874             return ePres;
875         }
876         default:;//prevent warning
877     }
878     return SFX_ITEM_PRESENTATION_NONE;
879 }
880 
881 SfxItemPresentation SwFmtRowSplit::GetPresentation
882 (
883     SfxItemPresentation /*ePres*/,
884     SfxMapUnit          /*eCoreUnit*/,
885     SfxMapUnit          /*ePresUnit*/,
886     String&             /*rText*/,
887     const IntlWrapper*        /*pIntl*/
888 )   const
889 {
890     return SFX_ITEM_PRESENTATION_NONE;
891 }
892 
893 
894 SfxItemPresentation SwFmtFtnEndAtTxtEnd::GetPresentation
895 (
896     SfxItemPresentation ePres,
897     SfxMapUnit          /*eCoreUnit*/,
898     SfxMapUnit          /*ePresUnit*/,
899     String&             rText,
900     const IntlWrapper*        /*pIntl*/
901 )   const
902 {
903     switch ( ePres )
904     {
905         case SFX_ITEM_PRESENTATION_NONE:
906             rText.Erase();
907             break;
908 
909         case SFX_ITEM_PRESENTATION_NAMELESS:
910         case SFX_ITEM_PRESENTATION_COMPLETE:
911             {
912                 switch( GetValue() )
913                 {
914                 case FTNEND_ATPGORDOCEND:
915 //                  rText = SW_RESSTR( STR_LAYOUT_FTN );
916                     break;
917 
918                 case FTNEND_ATTXTEND:
919                     break;
920 
921                 case FTNEND_ATTXTEND_OWNNUMSEQ:
922                     {
923 //  String      sPrefix;
924 //  String      sSuffix;
925 //  SvxNumberType   aFmt;
926 //  sal_uInt16      nOffset;
927 //                      rText +=
928                     }
929                     break;
930                 }
931             }
932             break;
933 
934         default:
935             ePres = SFX_ITEM_PRESENTATION_NONE;
936             break;
937     }
938     return ePres;
939 }
940 
941 SfxItemPresentation SwFmtChain::GetPresentation
942 (
943     SfxItemPresentation ePres,
944     SfxMapUnit          /*eCoreUnit*/,
945     SfxMapUnit          /*ePresUnit*/,
946     String&             rText,
947     const IntlWrapper*        /*pIntl*/
948 )   const
949 {
950     switch ( ePres )
951     {
952         case SFX_ITEM_PRESENTATION_NONE:
953             rText.Erase();
954             return SFX_ITEM_PRESENTATION_NONE;
955         case SFX_ITEM_PRESENTATION_NAMELESS:
956         case SFX_ITEM_PRESENTATION_COMPLETE:
957         {
958             if ( GetPrev() || GetNext() )
959             {
960                 rText = SW_RESSTR(STR_CONNECT1);
961                 if ( GetPrev() )
962                 {
963                     rText += GetPrev()->GetName();
964                     if ( GetNext() )
965                         rText += SW_RESSTR(STR_CONNECT2);
966                 }
967                 if ( GetNext() )
968                     rText += GetNext()->GetName();
969             }
970             return ePres;
971         }
972         default:;//prevent warning
973     }
974     return SFX_ITEM_PRESENTATION_NONE;
975 }
976 
977 
978 SfxItemPresentation SwFmtLineNumber::GetPresentation
979 (
980     SfxItemPresentation ePres,
981     SfxMapUnit          /*eCoreUnit*/,
982     SfxMapUnit          /*ePresUnit*/,
983     String&             rText,
984     const IntlWrapper*    /*pIntl*/
985 )   const
986 {
987     switch ( ePres )
988     {
989         case SFX_ITEM_PRESENTATION_NONE:
990             rText.Erase();
991             return SFX_ITEM_PRESENTATION_NONE;
992         case SFX_ITEM_PRESENTATION_NAMELESS:
993         case SFX_ITEM_PRESENTATION_COMPLETE:
994         {
995             if ( IsCount() )
996                 rText += SW_RESSTR(STR_LINECOUNT);
997             else
998                 rText += SW_RESSTR(STR_DONTLINECOUNT);
999             if ( GetStartValue() )
1000             {
1001                 rText += ' ';
1002                 rText += SW_RESSTR(STR_LINCOUNT_START);
1003                 rText += String::CreateFromInt32(GetStartValue());
1004             }
1005             return ePres;
1006         }
1007         default:;//prevent warning
1008     }
1009     return SFX_ITEM_PRESENTATION_NONE;
1010 }
1011 
1012 SfxItemPresentation SwTextGridItem::GetPresentation
1013 (
1014     SfxItemPresentation ePres,
1015     SfxMapUnit          /*eCoreUnit*/,
1016     SfxMapUnit          /*ePresUnit*/,
1017     String&             rText,
1018     const IntlWrapper*  /*pIntl*/
1019 )   const
1020 {
1021     switch ( ePres )
1022     {
1023         case SFX_ITEM_PRESENTATION_NONE:
1024             rText.Erase();
1025             return SFX_ITEM_PRESENTATION_NONE;
1026         case SFX_ITEM_PRESENTATION_NAMELESS:
1027         case SFX_ITEM_PRESENTATION_COMPLETE:
1028         {
1029             sal_uInt16 nId = 0;
1030 
1031             switch ( GetGridType() )
1032             {
1033             case GRID_NONE :
1034                 nId = STR_GRID_NONE;
1035                 break;
1036             case GRID_LINES_ONLY :
1037                 nId = STR_GRID_LINES_ONLY;
1038                 break;
1039             case GRID_LINES_CHARS :
1040                 nId = STR_GRID_LINES_CHARS;
1041                 break;
1042             }
1043             if ( nId )
1044                 rText += SW_RESSTR( nId );
1045             return ePres;
1046         }
1047         default:;//prevent warning
1048     }
1049 
1050     return SFX_ITEM_PRESENTATION_NONE;
1051 }
1052 
1053 
1054 //SwHeaderAndFooterEatSpacingItem
1055 
1056 
1057 SfxItemPresentation SwHeaderAndFooterEatSpacingItem::GetPresentation
1058 (
1059     SfxItemPresentation /*ePres*/,
1060     SfxMapUnit          /*eCoreUnit*/,
1061     SfxMapUnit          /*ePresUnit*/,
1062     String&             /*rText*/,
1063     const IntlWrapper*        /*pIntl*/
1064 )   const
1065 {
1066 //    rText.Erase();
1067 //    switch ( ePres )
1068 //    {
1069 //        case SFX_ITEM_PRESENTATION_NONE:
1070 //            rText.Erase();
1071 //            break;
1072 //        case SFX_ITEM_PRESENTATION_NAMELESS:
1073 //        case SFX_ITEM_PRESENTATION_COMPLETE:
1074 //        {
1075 //            if ( GetValue() )
1076 //                rText = SW_RESSTR(STR_EDIT_IN_READONLY);
1077 //            return ePres;
1078 //        }
1079 //    }
1080     return SFX_ITEM_PRESENTATION_NONE;
1081 }
1082 
1083 
1084 // ---------------------- Grafik-Attribute --------------------------
1085 
1086 SfxItemPresentation SwMirrorGrf::GetPresentation(
1087     SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
1088     String& rText, const IntlWrapper* /*pIntl*/ ) const
1089 {
1090     switch ( ePres )
1091     {
1092     case SFX_ITEM_PRESENTATION_NAMELESS:
1093     case SFX_ITEM_PRESENTATION_COMPLETE:
1094         {
1095             sal_uInt16 nId;
1096             switch( GetValue() )
1097             {
1098             case RES_MIRROR_GRAPH_DONT:     nId = STR_NO_MIRROR;    break;
1099             case RES_MIRROR_GRAPH_VERT: nId = STR_VERT_MIRROR;  break;
1100             case RES_MIRROR_GRAPH_HOR:  nId = STR_HORI_MIRROR;  break;
1101             case RES_MIRROR_GRAPH_BOTH: nId = STR_BOTH_MIRROR;  break;
1102             default:                    nId = 0;    break;
1103             }
1104             if ( nId )
1105             {
1106                 rText = SW_RESSTR( nId );
1107                 if (bGrfToggle)
1108                     rText += SW_RESSTR( STR_MIRROR_TOGGLE );
1109             }
1110         }
1111         break;
1112     default:
1113         ePres = SFX_ITEM_PRESENTATION_NONE;
1114         rText.Erase();
1115         break;
1116     }
1117     return ePres;
1118 }
1119 
1120 
1121 SfxItemPresentation SwRotationGrf::GetPresentation(
1122     SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
1123     String &rText, const IntlWrapper* /*pIntl*/) const
1124 {
1125     switch( ePres )
1126     {
1127     case SFX_ITEM_PRESENTATION_NAMELESS:
1128     case SFX_ITEM_PRESENTATION_COMPLETE:
1129         if( SFX_ITEM_PRESENTATION_COMPLETE == ePres )
1130             rText = SW_RESSTR( STR_ROTATION );
1131         else if( rText.Len() )
1132             rText.Erase();
1133         ( rText += UniString::CreateFromInt32( GetValue() )) += '\xB0';
1134         break;
1135 
1136     default:
1137         ePres = SFX_ITEM_PRESENTATION_NONE;
1138         rText.Erase();
1139         break;
1140     }
1141     return ePres;
1142 }
1143 
1144 SfxItemPresentation SwLuminanceGrf::GetPresentation(
1145     SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
1146     String &rText, const IntlWrapper* /*pIntl*/) const
1147 {
1148     switch( ePres )
1149     {
1150     case SFX_ITEM_PRESENTATION_NAMELESS:
1151     case SFX_ITEM_PRESENTATION_COMPLETE:
1152         if( SFX_ITEM_PRESENTATION_COMPLETE == ePres )
1153             rText = SW_RESSTR( STR_LUMINANCE );
1154         else if( rText.Len() )
1155             rText.Erase();
1156         ( rText += UniString::CreateFromInt32( GetValue() )) += '%';
1157         break;
1158 
1159     default:
1160         ePres = SFX_ITEM_PRESENTATION_NONE;
1161         rText.Erase();
1162         break;
1163     }
1164     return ePres;
1165 }
1166 
1167 SfxItemPresentation SwContrastGrf::GetPresentation(
1168     SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
1169     String &rText, const IntlWrapper* /*pIntl*/) const
1170 {
1171     switch( ePres )
1172     {
1173     case SFX_ITEM_PRESENTATION_NAMELESS:
1174     case SFX_ITEM_PRESENTATION_COMPLETE:
1175         if( SFX_ITEM_PRESENTATION_COMPLETE == ePres )
1176             rText = SW_RESSTR( STR_CONTRAST );
1177         else if( rText.Len() )
1178             rText.Erase();
1179         ( rText += UniString::CreateFromInt32( GetValue() )) += '%';
1180         break;
1181 
1182     default:
1183         ePres = SFX_ITEM_PRESENTATION_NONE;
1184         rText.Erase();
1185         break;
1186     }
1187     return ePres;
1188 }
1189 
1190 SfxItemPresentation SwChannelGrf::GetPresentation(
1191     SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
1192     String &rText, const IntlWrapper* /*pIntl*/) const
1193 {
1194     switch( ePres )
1195     {
1196     case SFX_ITEM_PRESENTATION_NAMELESS:
1197     case SFX_ITEM_PRESENTATION_COMPLETE:
1198         if( SFX_ITEM_PRESENTATION_COMPLETE == ePres )
1199         {
1200             sal_uInt16 nId;
1201             switch ( Which() )
1202             {
1203             case RES_GRFATR_CHANNELR:   nId = STR_CHANNELR; break;
1204             case RES_GRFATR_CHANNELG:   nId = STR_CHANNELG; break;
1205             case RES_GRFATR_CHANNELB:   nId = STR_CHANNELB; break;
1206             default:                    nId = 0; break;
1207             }
1208             if( nId )
1209                 rText = SW_RESSTR( nId );
1210             else if( rText.Len() )
1211                 rText.Erase();
1212         }
1213         else if( rText.Len() )
1214             rText.Erase();
1215         ( rText += UniString::CreateFromInt32( GetValue() )) += '%';
1216         break;
1217 
1218     default:
1219         ePres = SFX_ITEM_PRESENTATION_NONE;
1220         rText.Erase();
1221         break;
1222     }
1223     return ePres;
1224 }
1225 
1226 SfxItemPresentation SwGammaGrf::GetPresentation(
1227     SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
1228     String &rText, const IntlWrapper* /*pIntl*/) const
1229 {
1230     switch( ePres )
1231     {
1232     case SFX_ITEM_PRESENTATION_NAMELESS:
1233     case SFX_ITEM_PRESENTATION_COMPLETE:
1234         if( SFX_ITEM_PRESENTATION_COMPLETE == ePres )
1235             rText = SW_RESSTR( STR_GAMMA );
1236         else if( rText.Len() )
1237             rText.Erase();
1238         ( rText += UniString::CreateFromDouble( GetValue() )) += '%';
1239         break;
1240 
1241     default:
1242         ePres = SFX_ITEM_PRESENTATION_NONE;
1243         rText.Erase();
1244         break;
1245     }
1246     return ePres;
1247 }
1248 
1249 SfxItemPresentation SwInvertGrf::GetPresentation(
1250     SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
1251     String &rText, const IntlWrapper* /*pIntl*/) const
1252 {
1253     rText.Erase();
1254     switch( ePres )
1255     {
1256     case SFX_ITEM_PRESENTATION_NAMELESS:
1257     case SFX_ITEM_PRESENTATION_COMPLETE:
1258         if( SFX_ITEM_PRESENTATION_COMPLETE == ePres )
1259         {
1260             sal_uInt16 nId = 0 != GetValue() ? STR_INVERT : STR_INVERT_NOT;
1261             rText = SW_RESSTR( nId );
1262         }
1263         break;
1264 
1265     default:
1266         ePres = SFX_ITEM_PRESENTATION_NONE;
1267         break;
1268     }
1269     return ePres;
1270 }
1271 
1272 SfxItemPresentation SwTransparencyGrf::GetPresentation(
1273     SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
1274     String &rText, const IntlWrapper* /*pIntl*/) const
1275 {
1276     switch( ePres )
1277     {
1278     case SFX_ITEM_PRESENTATION_NAMELESS:
1279     case SFX_ITEM_PRESENTATION_COMPLETE:
1280         if( SFX_ITEM_PRESENTATION_COMPLETE == ePres )
1281             rText = SW_RESSTR( STR_TRANSPARENCY );
1282         else if( rText.Len() )
1283             rText.Erase();
1284         ( rText += UniString::CreateFromInt32( GetValue() )) += '%';
1285         break;
1286 
1287     default:
1288         ePres = SFX_ITEM_PRESENTATION_NONE;
1289         rText.Erase();
1290         break;
1291     }
1292     return ePres;
1293 }
1294 
1295 SfxItemPresentation SwDrawModeGrf::GetPresentation(
1296     SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
1297     String &rText, const IntlWrapper* /*pIntl*/) const
1298 {
1299     rText.Erase();
1300     switch( ePres )
1301     {
1302     case SFX_ITEM_PRESENTATION_NAMELESS:
1303     case SFX_ITEM_PRESENTATION_COMPLETE:
1304         if( SFX_ITEM_PRESENTATION_COMPLETE == ePres )
1305         {
1306             sal_uInt16 nId;
1307             switch ( GetValue() )
1308             {
1309 
1310             case GRAPHICDRAWMODE_GREYS:     nId = STR_DRAWMODE_GREY; break;
1311             case GRAPHICDRAWMODE_MONO:      nId = STR_DRAWMODE_BLACKWHITE; break;
1312             case GRAPHICDRAWMODE_WATERMARK: nId = STR_DRAWMODE_WATERMARK; break;
1313             default:                        nId = STR_DRAWMODE_STD; break;
1314             }
1315             (rText = SW_RESSTR( STR_DRAWMODE ) ) += SW_RESSTR( nId );
1316         }
1317         break;
1318 
1319     default:
1320         ePres = SFX_ITEM_PRESENTATION_NONE;
1321         break;
1322     }
1323     return ePres;
1324 }
1325 
1326 SfxItemPresentation SwFmtFollowTextFlow::GetPresentation( SfxItemPresentation ePres,
1327                                     SfxMapUnit /*eCoreMetric*/,
1328                                     SfxMapUnit /*ePresMetric*/,
1329                                     String &rText,
1330                                     const IntlWrapper*    /*pIntl*/ ) const
1331 {
1332     rText.Erase();
1333     switch( ePres )
1334     {
1335         case SFX_ITEM_PRESENTATION_NAMELESS:
1336         break;
1337         case SFX_ITEM_PRESENTATION_COMPLETE:
1338             {
1339                 sal_uInt16 nId = GetValue() ? STR_FOLLOW_TEXT_FLOW : STR_DONT_FOLLOW_TEXT_FLOW;
1340                 rText = SW_RESSTR( nId );
1341             }
1342         break;
1343 
1344         default:
1345             ePres = SFX_ITEM_PRESENTATION_NONE;
1346         break;
1347     }
1348     return ePres;
1349 }
1350 
1351