Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / uibase / utlui / attrdesc.cxx
blob71fdd4ab5436d9b540dca0919711f705cad03f60
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <i18nutil/unicode.hxx>
21 #include <svl/itemiter.hxx>
22 #include <vcl/svapp.hxx>
23 #include <vcl/settings.hxx>
24 #include <vcl/GraphicAttributes.hxx>
26 #include <editeng/itemtype.hxx>
27 #include <editeng/eerdll.hxx>
28 #include <unotools/intlwrapper.hxx>
29 #include <unotools/syslocale.hxx>
30 #include <rtl/ustrbuf.hxx>
31 #include <fmtanchr.hxx>
32 #include <fmtfsize.hxx>
33 #include <fmtinfmt.hxx>
34 #include <fchrfmt.hxx>
35 #include <fmtautofmt.hxx>
36 #include <fmtsrnd.hxx>
37 #include <fmtornt.hxx>
38 #include <fmtlsplt.hxx>
39 #include <fmtrowsplt.hxx>
40 #include <fmtpdsc.hxx>
41 #include <fmtclds.hxx>
42 #include <fmteiro.hxx>
43 #include <fmturl.hxx>
44 #include <fmthdft.hxx>
45 #include <fmtcnct.hxx>
46 #include <fmtline.hxx>
47 #include <tgrditem.hxx>
48 #include <hfspacingitem.hxx>
49 #include <fmtruby.hxx>
50 #include <paratr.hxx>
51 #include <grfatr.hxx>
52 #include <pagedesc.hxx>
53 #include <charfmt.hxx>
54 #include <strings.hrc>
55 #include <fmtftntx.hxx>
56 #include <fmtfollowtextflow.hxx>
57 #include <libxml/xmlwriter.h>
59 using namespace com::sun::star;
62 // query the attribute descriptions
63 void SwAttrSet::GetPresentation(
64 SfxItemPresentation ePres,
65 MapUnit eCoreMetric,
66 MapUnit ePresMetric,
67 OUString &rText ) const
69 rText.clear();
70 OUString aStr;
71 if( !Count() )
72 return;
74 SfxItemIter aIter( *this );
75 const SfxPoolItem* pItem = aIter.GetCurItem();
76 const IntlWrapper aInt(SvtSysLocale().GetUILanguageTag());
79 pItem->GetPresentation(ePres, eCoreMetric, ePresMetric, aStr, aInt);
80 if( rText.getLength() && aStr.getLength() )
81 rText += ", ";
82 rText += aStr;
83 pItem = aIter.NextItem();
84 } while (pItem);
87 bool SwFormatCharFormat::GetPresentation
89 SfxItemPresentation ePres,
90 MapUnit eCoreUnit,
91 MapUnit ePresUnit,
92 OUString& rText,
93 const IntlWrapper& /*rIntl*/
94 ) const
96 const SwCharFormat *pCharFormat = GetCharFormat();
97 if ( pCharFormat )
99 OUString aStr;
100 pCharFormat->GetPresentation( ePres, eCoreUnit, ePresUnit, aStr );
101 rText = SwResId( STR_CHARFMT ) + "(" + aStr + ")";
103 else
104 rText = SwResId( STR_NO_CHARFMT );
105 return true;
108 bool SwFormatAutoFormat::GetPresentation
110 SfxItemPresentation /*ePres*/,
111 MapUnit /*eCoreUnit*/,
112 MapUnit /*ePresUnit*/,
113 OUString& rText,
114 const IntlWrapper& /*rIntl*/
115 ) const
117 rText.clear(); //TODO
118 return true;
121 bool SwFormatINetFormat::GetPresentation
123 SfxItemPresentation /*ePres*/,
124 MapUnit /*eCoreUnit*/,
125 MapUnit /*ePresUnit*/,
126 OUString& rText,
127 const IntlWrapper& /*rIntl*/
128 ) const
130 rText = GetValue();
131 return true;
134 bool SwFormatRuby::GetPresentation( SfxItemPresentation /*ePres*/,
135 MapUnit /*eCoreMetric*/, MapUnit /*ePresMetric*/,
136 OUString &rText, const IntlWrapper& /*rIntl*/ ) const
138 rText.clear();
139 return true;
142 bool SwFormatDrop::GetPresentation
144 SfxItemPresentation /*ePres*/,
145 MapUnit /*eCoreUnit*/,
146 MapUnit /*ePresUnit*/,
147 OUString& rText,
148 const IntlWrapper& /*rIntl*/
149 ) const
151 rText.clear();
152 if ( GetLines() > 1 )
154 if ( GetChars() > 1 )
156 rText = OUString::number( GetChars() ) + " ";
158 rText += SwResId( STR_DROP_OVER ) +
159 " " +
160 OUString::number( GetLines() ) +
161 " " +
162 SwResId( STR_DROP_LINES );
164 else
165 rText = SwResId( STR_NO_DROP_LINES );
166 return true;
169 bool SwRegisterItem::GetPresentation
171 SfxItemPresentation /*ePres*/,
172 MapUnit /*eCoreUnit*/,
173 MapUnit /*ePresUnit*/,
174 OUString& rText,
175 const IntlWrapper& /*rIntl*/
176 ) const
178 TranslateId pId = GetValue() ? STR_REGISTER_ON : STR_REGISTER_OFF;
179 rText = SwResId(pId);
180 return true;
183 bool SwNumRuleItem::GetPresentation
185 SfxItemPresentation /*ePres*/,
186 MapUnit /*eCoreUnit*/,
187 MapUnit /*ePresUnit*/,
188 OUString& rText,
189 const IntlWrapper& /*rIntl*/
190 ) const
192 if( !GetValue().isEmpty() )
193 rText = SwResId( STR_NUMRULE_ON ).replaceFirst("%LISTSTYLENAME", GetValue());
194 else
195 rText = SwResId( STR_NUMRULE_OFF );
196 return true;
199 bool SwParaConnectBorderItem::GetPresentation
201 SfxItemPresentation /*ePres*/,
202 MapUnit /*eCoreUnit*/,
203 MapUnit /*ePresUnit*/,
204 OUString& rText,
205 const IntlWrapper& /*rIntl*/
206 ) const
208 TranslateId pId = GetValue() ? STR_CONNECT_BORDER_ON : STR_CONNECT_BORDER_OFF;
209 rText = SwResId(pId);
210 return true;
213 // Frame attribute
215 bool SwFormatFrameSize::GetPresentation
217 SfxItemPresentation /*ePres*/,
218 MapUnit eCoreUnit,
219 MapUnit ePresUnit,
220 OUString& rText,
221 const IntlWrapper& rIntl
222 ) const
224 rText = SwResId( STR_FRM_WIDTH ) + " ";
225 if ( GetWidthPercent() )
227 rText += unicode::formatPercent(GetWidthPercent(),
228 Application::GetSettings().GetUILanguageTag());
230 else
232 rText += ::GetMetricText( GetWidth(), eCoreUnit, ePresUnit, &rIntl ) +
233 " " + ::EditResId( ::GetMetricId( ePresUnit ) );
235 if ( SwFrameSize::Variable != GetHeightSizeType() )
237 TranslateId pId = SwFrameSize::Fixed == m_eFrameHeightType ?
238 STR_FRM_FIXEDHEIGHT : STR_FRM_MINHEIGHT;
239 rText += ", " + SwResId(pId) + " ";
240 if ( GetHeightPercent() )
242 rText += unicode::formatPercent(GetHeightPercent(),
243 Application::GetSettings().GetUILanguageTag());
245 else
247 rText = ::GetMetricText( GetHeight(), eCoreUnit, ePresUnit, &rIntl ) +
248 " " + EditResId( ::GetMetricId( ePresUnit ) );
251 return true;
254 //Header for page formats.
255 //Client of FrameFormat which describes the header.
257 bool SwFormatHeader::GetPresentation
259 SfxItemPresentation /*ePres*/,
260 MapUnit /*eCoreUnit*/,
261 MapUnit /*ePresUnit*/,
262 OUString& rText,
263 const IntlWrapper& /*rIntl*/
264 ) const
266 TranslateId pId = GetHeaderFormat() ? STR_HEADER : STR_NO_HEADER;
267 rText = SwResId(pId);
268 return true;
271 //Footer for page formats.
272 //Client of FrameFormat which describes the footer.
274 bool SwFormatFooter::GetPresentation
276 SfxItemPresentation /*ePres*/,
277 MapUnit /*eCoreUnit*/,
278 MapUnit /*ePresUnit*/,
279 OUString& rText,
280 const IntlWrapper& /*rIntl*/
281 ) const
283 TranslateId pId = GetFooterFormat() ? STR_FOOTER : STR_NO_FOOTER;
284 rText = SwResId(pId);
285 return true;
288 bool SwFormatSurround::GetPresentation
290 SfxItemPresentation /*ePres*/,
291 MapUnit /*eCoreUnit*/,
292 MapUnit /*ePresUnit*/,
293 OUString& rText,
294 const IntlWrapper& /*rIntl*/
295 ) const
297 TranslateId pId;
298 switch ( GetValue() )
300 case css::text::WrapTextMode_NONE:
301 pId = STR_SURROUND_NONE;
302 break;
303 case css::text::WrapTextMode_THROUGH:
304 pId = STR_SURROUND_THROUGH;
305 break;
306 case css::text::WrapTextMode_PARALLEL:
307 pId = STR_SURROUND_PARALLEL;
308 break;
309 case css::text::WrapTextMode_DYNAMIC:
310 pId = STR_SURROUND_IDEAL;
311 break;
312 case css::text::WrapTextMode_LEFT:
313 pId = STR_SURROUND_LEFT;
314 break;
315 case css::text::WrapTextMode_RIGHT:
316 pId = STR_SURROUND_RIGHT;
317 break;
318 default:;//prevent warning
320 if (pId)
321 rText = SwResId(pId);
323 if ( IsAnchorOnly() )
325 rText += " " + SwResId( STR_SURROUND_ANCHORONLY );
327 return true;
330 //VertOrientation, how and by what orientate the FlyFrame in the vertical?
332 bool SwFormatVertOrient::GetPresentation
334 SfxItemPresentation /*ePres*/,
335 MapUnit eCoreUnit,
336 MapUnit ePresUnit,
337 OUString& rText,
338 const IntlWrapper& rIntl
339 ) const
341 TranslateId pId;
342 switch ( GetVertOrient() )
344 case text::VertOrientation::NONE:
346 rText += SwResId( STR_POS_Y ) + " " +
347 ::GetMetricText( GetPos(), eCoreUnit, ePresUnit, &rIntl ) +
348 " " + EditResId( ::GetMetricId( ePresUnit ) );
350 break;
351 case text::VertOrientation::TOP:
352 pId = STR_VERT_TOP;
353 break;
354 case text::VertOrientation::CENTER:
355 pId = STR_VERT_CENTER;
356 break;
357 case text::VertOrientation::BOTTOM:
358 pId = STR_VERT_BOTTOM;
359 break;
360 case text::VertOrientation::LINE_TOP:
361 pId = STR_LINE_TOP;
362 break;
363 case text::VertOrientation::LINE_CENTER:
364 pId = STR_LINE_CENTER;
365 break;
366 case text::VertOrientation::LINE_BOTTOM:
367 pId = STR_LINE_BOTTOM;
368 break;
369 default:;//prevent warning
371 if (pId)
372 rText += SwResId(pId);
373 return true;
376 //HoriOrientation, how and by what orientate the FlyFrame in the horizontal?
378 bool SwFormatHoriOrient::GetPresentation
380 SfxItemPresentation /*ePres*/,
381 MapUnit eCoreUnit,
382 MapUnit ePresUnit,
383 OUString& rText,
384 const IntlWrapper& rIntl
385 ) const
387 TranslateId pId;
388 switch ( GetHoriOrient() )
390 case text::HoriOrientation::NONE:
392 rText += SwResId( STR_POS_X ) + " " +
393 ::GetMetricText( GetPos(), eCoreUnit, ePresUnit, &rIntl ) +
394 " " + EditResId( ::GetMetricId( ePresUnit ) );
396 break;
397 case text::HoriOrientation::RIGHT:
398 pId = STR_HORI_RIGHT;
399 break;
400 case text::HoriOrientation::CENTER:
401 pId = STR_HORI_CENTER;
402 break;
403 case text::HoriOrientation::LEFT:
404 pId = STR_HORI_LEFT;
405 break;
406 case text::HoriOrientation::INSIDE:
407 pId = STR_HORI_INSIDE;
408 break;
409 case text::HoriOrientation::OUTSIDE:
410 pId = STR_HORI_OUTSIDE;
411 break;
412 case text::HoriOrientation::FULL:
413 pId = STR_HORI_FULL;
414 break;
415 default:;//prevent warning
417 if (pId)
418 rText += SwResId(pId);
419 return true;
422 // FlyAnchor, Anchor of the free-flying frame
424 bool SwFormatAnchor::GetPresentation
426 SfxItemPresentation /*ePres*/,
427 MapUnit /*eCoreUnit*/,
428 MapUnit /*ePresUnit*/,
429 OUString& rText,
430 const IntlWrapper& /*rIntl*/
431 ) const
433 TranslateId pId;
434 switch ( GetAnchorId() )
436 case RndStdIds::FLY_AT_PARA:
437 pId = STR_FLY_AT_PARA;
438 break;
439 case RndStdIds::FLY_AS_CHAR:
440 pId = STR_FLY_AS_CHAR;
441 break;
442 case RndStdIds::FLY_AT_CHAR:
443 pId = STR_FLY_AT_CHAR;
444 break;
445 case RndStdIds::FLY_AT_PAGE:
446 pId = STR_FLY_AT_PAGE;
447 break;
448 default:;//prevent warning
450 if (pId)
451 rText += SwResId(pId);
452 return true;
455 bool SwFormatPageDesc::GetPresentation
457 SfxItemPresentation /*ePres*/,
458 MapUnit /*eCoreUnit*/,
459 MapUnit /*ePresUnit*/,
460 OUString& rText,
461 const IntlWrapper& /*rIntl*/
462 ) const
464 const SwPageDesc *pPageDesc = GetPageDesc();
465 if ( pPageDesc )
466 rText = pPageDesc->GetName();
467 else
468 rText = SwResId( STR_NO_PAGEDESC );
469 return true;
472 //The ColumnDescriptor
474 bool SwFormatCol::GetPresentation
476 SfxItemPresentation /*ePres*/,
477 MapUnit eCoreUnit,
478 MapUnit /*ePresUnit*/,
479 OUString& rText,
480 const IntlWrapper& rIntl
481 ) const
483 sal_uInt16 nCnt = GetNumCols();
484 if ( nCnt > 1 )
486 rText = OUString::number(nCnt) + " " + SwResId( STR_COLUMNS );
487 if ( COLADJ_NONE != GetLineAdj() )
489 const tools::Long nWdth = static_cast<tools::Long>(GetLineWidth());
490 rText += " " + SwResId( STR_LINE_WIDTH ) + " " +
491 ::GetMetricText( nWdth, eCoreUnit,
492 MapUnit::MapPoint, &rIntl );
495 else
496 rText.clear();
497 return true;
500 //URL's and maps
502 bool SwFormatURL::GetPresentation
504 SfxItemPresentation /*ePres*/,
505 MapUnit /*eCoreUnit*/,
506 MapUnit /*ePresUnit*/,
507 OUString& rText,
508 const IntlWrapper& /*rIntl*/
509 ) const
511 rText.clear();
512 if ( m_pMap )
513 rText += "Client-Map";
514 if ( !m_sURL.isEmpty() )
516 if ( m_pMap )
517 rText += " - ";
518 rText += "URL: " + m_sURL;
519 if ( m_bIsServerMap )
520 rText += " (Server-Map)";
522 if ( !m_sTargetFrameName.isEmpty() )
524 rText += ", Target: " + m_sTargetFrameName;
526 return true;
529 bool SwFormatEditInReadonly::GetPresentation
531 SfxItemPresentation /*ePres*/,
532 MapUnit /*eCoreUnit*/,
533 MapUnit /*ePresUnit*/,
534 OUString& rText,
535 const IntlWrapper& /*rIntl*/
536 ) const
538 rText.clear();
539 if ( GetValue() )
540 rText = SwResId(STR_EDIT_IN_READONLY);
541 return true;
544 void SwFormatEditInReadonly::dumpAsXml(xmlTextWriterPtr pWriter) const
546 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatEditInReadonly"));
547 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
548 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::boolean(GetValue()).getStr()));
549 (void)xmlTextWriterEndElement(pWriter);
552 bool SwFormatLayoutSplit::GetPresentation
554 SfxItemPresentation /*ePres*/,
555 MapUnit /*eCoreUnit*/,
556 MapUnit /*ePresUnit*/,
557 OUString& rText,
558 const IntlWrapper& /*rIntl*/
559 ) const
561 if ( GetValue() )
562 rText = SwResId(STR_LAYOUT_SPLIT);
563 return true;
566 bool SwFormatRowSplit::GetPresentation
568 SfxItemPresentation /*ePres*/,
569 MapUnit /*eCoreUnit*/,
570 MapUnit /*ePresUnit*/,
571 OUString& /*rText*/,
572 const IntlWrapper& /*rIntl*/
573 ) const
575 return false;
578 bool SwFormatFootnoteEndAtTextEnd::GetPresentation
580 SfxItemPresentation /*ePres*/,
581 MapUnit /*eCoreUnit*/,
582 MapUnit /*ePresUnit*/,
583 OUString& /*rText*/,
584 const IntlWrapper& /*rIntl*/
585 ) const
587 return true;
590 bool SwFormatChain::GetPresentation
592 SfxItemPresentation /*ePres*/,
593 MapUnit /*eCoreUnit*/,
594 MapUnit /*ePresUnit*/,
595 OUString& rText,
596 const IntlWrapper& /*rIntl*/
597 ) const
599 if ( GetPrev() || GetNext() )
601 rText = SwResId(STR_CONNECT1);
602 if ( GetPrev() )
604 rText += GetPrev()->GetName();
605 if ( GetNext() )
606 rText += SwResId(STR_CONNECT2);
608 if ( GetNext() )
609 rText += GetNext()->GetName();
611 return true;
614 bool SwFormatLineNumber::GetPresentation
616 SfxItemPresentation /*ePres*/,
617 MapUnit /*eCoreUnit*/,
618 MapUnit /*ePresUnit*/,
619 OUString& rText,
620 const IntlWrapper& /*rIntl*/
621 ) const
623 if ( IsCount() )
624 rText += SwResId(STR_LINECOUNT);
625 else
626 rText += SwResId(STR_DONTLINECOUNT);
627 if ( GetStartValue() )
629 rText += " " + SwResId(STR_LINCOUNT_START) +
630 OUString::number( GetStartValue() );
632 return true;
635 bool SwTextGridItem::GetPresentation
637 SfxItemPresentation /*ePres*/,
638 MapUnit /*eCoreUnit*/,
639 MapUnit /*ePresUnit*/,
640 OUString& rText,
641 const IntlWrapper& /*rIntl*/
642 ) const
644 TranslateId pId;
646 switch ( GetGridType() )
648 case GRID_NONE :
649 pId = STR_GRID_NONE;
650 break;
651 case GRID_LINES_ONLY :
652 pId = STR_GRID_LINES_ONLY;
653 break;
654 case GRID_LINES_CHARS :
655 pId = STR_GRID_LINES_CHARS;
656 break;
658 if (pId)
659 rText += SwResId(pId);
660 return true;
663 bool SwHeaderAndFooterEatSpacingItem::GetPresentation
665 SfxItemPresentation /*ePres*/,
666 MapUnit /*eCoreUnit*/,
667 MapUnit /*ePresUnit*/,
668 OUString& /*rText*/,
669 const IntlWrapper& /*rIntl*/
670 ) const
672 return false;
675 // Graphic attributes
677 bool SwMirrorGrf::GetPresentation(
678 SfxItemPresentation /*ePres*/, MapUnit /*eCoreUnit*/, MapUnit /*ePresUnit*/,
679 OUString& rText, const IntlWrapper& /*rIntl*/ ) const
681 TranslateId pId;
682 switch( GetValue() )
684 case MirrorGraph::Dont: pId = STR_NO_MIRROR; break;
685 case MirrorGraph::Vertical: pId = STR_VERT_MIRROR; break;
686 case MirrorGraph::Horizontal: pId = STR_HORI_MIRROR; break;
687 case MirrorGraph::Both: pId = STR_BOTH_MIRROR; break;
688 default: break;
690 if (pId)
692 rText = SwResId(pId);
693 if (m_bGrfToggle)
694 rText += SwResId( STR_MIRROR_TOGGLE );
696 return true;
699 bool SwRotationGrf::GetPresentation(
700 SfxItemPresentation ePres, MapUnit /*eCoreUnit*/, MapUnit /*ePresUnit*/,
701 OUString &rText, const IntlWrapper& /*rIntl*/) const
703 if( SfxItemPresentation::Complete == ePres )
704 rText = SwResId( STR_ROTATION );
705 else if( rText.getLength() )
706 rText.clear();
707 rText += OUString::number( toDegrees(GetValue()) ) + "\xB0";
708 return true;
711 bool SwLuminanceGrf::GetPresentation(
712 SfxItemPresentation ePres, MapUnit /*eCoreUnit*/, MapUnit /*ePresUnit*/,
713 OUString &rText, const IntlWrapper& /*rIntl*/) const
715 if( SfxItemPresentation::Complete == ePres )
716 rText = SwResId( STR_LUMINANCE );
717 else if( rText.getLength() )
718 rText.clear();
719 rText += unicode::formatPercent(GetValue(),
720 Application::GetSettings().GetUILanguageTag());
721 return true;
724 bool SwContrastGrf::GetPresentation(
725 SfxItemPresentation ePres, MapUnit /*eCoreUnit*/, MapUnit /*ePresUnit*/,
726 OUString &rText, const IntlWrapper& /*rIntl*/) const
728 if( SfxItemPresentation::Complete == ePres )
729 rText = SwResId( STR_CONTRAST );
730 else if( rText.getLength() )
731 rText.clear();
732 rText += unicode::formatPercent(GetValue(),
733 Application::GetSettings().GetUILanguageTag());
734 return true;
737 bool SwChannelGrf::GetPresentation(
738 SfxItemPresentation ePres, MapUnit /*eCoreUnit*/, MapUnit /*ePresUnit*/,
739 OUString &rText, const IntlWrapper& /*rIntl*/) const
741 if( SfxItemPresentation::Complete == ePres )
743 TranslateId pId;
744 switch ( Which() )
746 case RES_GRFATR_CHANNELR: pId = STR_CHANNELR; break;
747 case RES_GRFATR_CHANNELG: pId = STR_CHANNELG; break;
748 case RES_GRFATR_CHANNELB: pId = STR_CHANNELB; break;
749 default: break;
751 if (pId)
752 rText = SwResId(pId);
753 else if( rText.getLength() )
754 rText.clear();
756 else if( rText.getLength() )
757 rText.clear();
758 rText += unicode::formatPercent(GetValue(),
759 Application::GetSettings().GetUILanguageTag());
760 return true;
763 bool SwGammaGrf::GetPresentation(
764 SfxItemPresentation ePres, MapUnit /*eCoreUnit*/, MapUnit /*ePresUnit*/,
765 OUString &rText, const IntlWrapper& /*rIntl*/) const
767 OUStringBuffer aText;
768 if( SfxItemPresentation::Complete == ePres )
769 aText.append(SwResId(STR_GAMMA));
770 aText.append(unicode::formatPercent(GetValue(),
771 Application::GetSettings().GetUILanguageTag()));
772 rText = aText.makeStringAndClear();
773 return true;
776 bool SwInvertGrf::GetPresentation(
777 SfxItemPresentation ePres, MapUnit /*eCoreUnit*/, MapUnit /*ePresUnit*/,
778 OUString &rText, const IntlWrapper& /*rIntl*/) const
780 rText.clear();
781 if( SfxItemPresentation::Complete == ePres )
783 TranslateId pId = GetValue() ? STR_INVERT : STR_INVERT_NOT;
784 rText = SwResId(pId);
786 return true;
789 bool SwTransparencyGrf::GetPresentation(
790 SfxItemPresentation ePres, MapUnit /*eCoreUnit*/, MapUnit /*ePresUnit*/,
791 OUString &rText, const IntlWrapper& /*rIntl*/) const
793 if( SfxItemPresentation::Complete == ePres )
794 rText = SwResId( STR_TRANSPARENCY );
795 else if( rText.getLength() )
796 rText.clear();
797 rText += unicode::formatPercent(GetValue(),
798 Application::GetSettings().GetUILanguageTag());
799 return true;
802 bool SwDrawModeGrf::GetPresentation(
803 SfxItemPresentation ePres, MapUnit /*eCoreUnit*/, MapUnit /*ePresUnit*/,
804 OUString &rText, const IntlWrapper& /*rIntl*/) const
806 rText.clear();
807 if( SfxItemPresentation::Complete == ePres )
809 TranslateId pId;
810 switch ( GetValue() )
813 case GraphicDrawMode::Greys: pId = STR_DRAWMODE_GREY; break;
814 case GraphicDrawMode::Mono: pId = STR_DRAWMODE_BLACKWHITE; break;
815 case GraphicDrawMode::Watermark: pId = STR_DRAWMODE_WATERMARK; break;
816 default: pId = STR_DRAWMODE_STD; break;
818 rText = SwResId( STR_DRAWMODE ) + SwResId(pId);
820 return true;
823 bool SwFormatFollowTextFlow::GetPresentation( SfxItemPresentation ePres,
824 MapUnit /*eCoreMetric*/,
825 MapUnit /*ePresMetric*/,
826 OUString &rText,
827 const IntlWrapper& /*rIntl*/ ) const
829 rText.clear();
830 if( SfxItemPresentation::Complete == ePres )
832 TranslateId pId = GetValue() ? STR_FOLLOW_TEXT_FLOW : STR_DONT_FOLLOW_TEXT_FLOW;
833 rText = SwResId(pId);
835 return true;
838 void SwFormatFollowTextFlow::dumpAsXml(xmlTextWriterPtr pWriter) const
840 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatFollowTextFlow"));
841 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
842 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::boolean(GetValue()).getStr()));
843 (void)xmlTextWriterEndElement(pWriter);
846 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */