20#include <com/sun/star/style/TabStop.hpp>
21#include <com/sun/star/style/LineSpacing.hpp>
22#include <com/sun/star/style/LineSpacingMode.hpp>
23#include <com/sun/star/uno/Sequence.hxx>
24#include <libxml/xmlwriter.h>
26#include <osl/diagnose.h>
33#include <editeng/editrids.hrc>
47#include <rtl/ustring.hxx>
68enum class SvxSpecialLineSpace
92 assert(SfxPoolItem::operator==(rAttr));
119 nMemberId &= ~CONVERT_TWIPS;
121 style::LineSpacing aLSp;
127 aLSp.Mode = style::LineSpacingMode::LEADING;
132 aLSp.Mode = style::LineSpacingMode::PROP;
137 aLSp.Mode = style::LineSpacingMode::PROP;
152 case 0 : rVal <<= aLSp;
break;
154 case MID_HEIGHT : rVal <<= aLSp.Height;
break;
155 default: OSL_FAIL(
"Wrong MemberId!");
break;
164 nMemberId &= ~CONVERT_TWIPS;
167 style::LineSpacing aLSp;
174 case 0 : bRet = (rVal >>= aLSp);
break;
176 case MID_HEIGHT : bRet = (rVal >>= aLSp.Height);
break;
177 default: OSL_FAIL(
"Wrong MemberId!");
break;
185 case style::LineSpacingMode::LEADING:
195 case style::LineSpacingMode::PROP:
199 if(100 == aLSp.Height)
205 case style::LineSpacingMode::FIX:
206 case style::LineSpacingMode::MINIMUM:
236 case SfxItemPresentation::Nameless:
237 case SfxItemPresentation::Complete:
249 rText =
EditResId(RID_SVXITEMS_LINESPACING_SINGLE);
256 rText =
EditResId(RID_SVXITEMS_LINESPACING_SINGLE);
262 rText =
EditResId(RID_SVXITEMS_LINESPACING_115);
268 rText =
EditResId(RID_SVXITEMS_LINESPACING_15);
274 rText =
EditResId(RID_SVXITEMS_LINESPACING_DOUBLE);
282 rText =
EditResId(RID_SVXITEMS_LINESPACING_LEADING) +
291 rText =
EditResId(RID_SVXITEMS_LINESPACING_FIXED) +
297 rText =
EditResId(RID_SVXITEMS_LINESPACING_MIN) +
310 return sal_uInt16(SvxSpecialLineSpace::End);
316 SvxSpecialLineSpace nVal;
319 case 100: nVal = SvxSpecialLineSpace::OneLine;
break;
320 case 150: nVal = SvxSpecialLineSpace::OnePointFiveLines;
break;
321 case 200: nVal = SvxSpecialLineSpace::TwoLines;
break;
322 default: nVal = SvxSpecialLineSpace::User;
break;
324 return static_cast<sal_uInt16
>(nVal);
330 switch (
static_cast<SvxSpecialLineSpace
>(nVal) )
333 case SvxSpecialLineSpace::OnePointFiveLines:
nPropLineSpace = 150;
break;
343 bOneBlock( false ), bLastCenter( false ), bLastBlock( false )
351 assert(SfxPoolItem::operator==(rAttr));
362 nMemberId &= ~CONVERT_TWIPS;
379 nMemberId &= ~CONVERT_TWIPS;
385 sal_Int32 eVal = - 1;
386 ::cppu::enum2int(eVal,rVal);
387 if(eVal >= 0 && eVal <= 4)
421 case SfxItemPresentation::Nameless:
422 case SfxItemPresentation::Complete:
440 RID_SVXITEMS_ADJUST_LEFT,
441 RID_SVXITEMS_ADJUST_RIGHT,
442 RID_SVXITEMS_ADJUST_BLOCK,
443 RID_SVXITEMS_ADJUST_CENTER,
444 RID_SVXITEMS_ADJUST_BLOCKLINE
453 return static_cast<sal_uInt16
>(
GetAdjust());
485 case SfxItemPresentation::Nameless:
491 case SfxItemPresentation::Complete:
493 rText =
EditResId(RID_SVXITEMS_WIDOWS_COMPLETE) +
" " +
EditResId(RID_SVXITEMS_LINES);
499 SAL_WARN(
"editeng.items",
"SvxWidowsItem::GetPresentation(): unknown SfxItemPresentation" );
503 rText = rText.replaceFirst(
"%1", OUString::number(
GetValue() ) );
529 case SfxItemPresentation::Nameless:
535 case SfxItemPresentation::Complete:
537 rText =
EditResId(RID_SVXITEMS_ORPHANS_COMPLETE) +
" " +
EditResId(RID_SVXITEMS_LINES);
543 SAL_WARN(
"editeng.items",
"SvxOrphansItem::GetPresentation(): unknown SfxItemPresentation" );
547 rText = rText.replaceFirst(
"%1", OUString::number(
GetValue() ) );
557 bNoCapsHyphenation(false),
558 bNoLastWordHyphenation(false),
570 nMemberId &= ~CONVERT_TWIPS;
577 rVal <<= static_cast<sal_Int16>(
nMinLead);
580 rVal <<= static_cast<sal_Int16>(
nMinTrail);
603 nMemberId &= ~CONVERT_TWIPS;
604 sal_Int16 nNewVal = 0;
609 if(!(rVal >>= nNewVal))
646 assert(SfxPoolItem::operator==(rAttr));
676 case SfxItemPresentation::Nameless:
681 pId = RID_SVXITEMS_HYPHEN_TRUE;
683 pId = RID_SVXITEMS_PAGE_END_FALSE;
686 pId = RID_SVXITEMS_PAGE_END_TRUE;
688 OUString::number(
nMinLead ) + cpDelimTmp +
689 OUString::number(
nMinTrail ) + cpDelimTmp +
696 rText += cpDelimTmp +
EditResId(RID_SVXITEMS_HYPHEN_NO_CAPS_TRUE);
699 rText += cpDelimTmp +
EditResId(RID_SVXITEMS_HYPHEN_LAST_WORD_TRUE);
703 case SfxItemPresentation::Complete:
708 pId = RID_SVXITEMS_HYPHEN_TRUE;
710 pId = RID_SVXITEMS_PAGE_END_FALSE;
713 pId = RID_SVXITEMS_PAGE_END_TRUE;
716 EditResId(RID_SVXITEMS_HYPHEN_MINLEAD).replaceAll(
"%1", OUString::number(
nMinLead)) +
718 EditResId(RID_SVXITEMS_HYPHEN_MINTRAIL).replaceAll(
"%1", OUString::number(
nMinTrail)) +
726 rText += cpDelimTmp +
EditResId(RID_SVXITEMS_HYPHEN_ZONE) +
732 rText += cpDelimTmp +
EditResId(RID_SVXITEMS_HYPHEN_NO_CAPS_TRUE);
735 rText += cpDelimTmp +
EditResId(RID_SVXITEMS_HYPHEN_LAST_WORD_TRUE);
773 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SvxTabStop"));
774 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"nTabPos"),
775 BAD_CAST(OString::number(
nTabPos).getStr()));
776 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"eAdjustment"),
777 BAD_CAST(OString::number(
static_cast<int>(
eAdjustment)).getStr()));
778 (void)xmlTextWriterEndElement(pWriter);
789 for (sal_uInt16
i = 0;
i < nTabs; ++
i)
798 const sal_uInt16 nDist,
800 sal_uInt16 _nWhich ) :
803 for ( sal_uInt16
i = 0;
i < nTabs; ++
i )
837 nMemberId &= ~CONVERT_TWIPS;
844 style::TabStop* pArr =
aSeq.getArray();
856 pArr[
i].Alignment = style::TabAlign_DEFAULT;
883 nMemberId &= ~CONVERT_TWIPS;
888 uno::Sequence< style::TabStop>
aSeq;
891 uno::Sequence < uno::Sequence < uno::Any > > aAnySeq;
892 if (!(rVal >>= aAnySeq))
894 auto aAnySeqRange = asNonConstRange(aAnySeq);
895 sal_Int32
nLength = aAnySeq.getLength();
897 auto pSeq =
aSeq.getArray();
900 uno::Sequence < uno::Any >& rAnySeq = aAnySeqRange[
n];
901 if ( rAnySeq.getLength() == 4 )
903 if (!(rAnySeq[0] >>= pSeq[
n].
Position))
return false;
904 if (!(rAnySeq[1] >>= pSeq[
n].Alignment))
907 if (rAnySeq[1] >>= nVal)
908 pSeq[
n].Alignment =
static_cast<css::style::TabAlign
>(nVal);
912 if (!(rAnySeq[2] >>= pSeq[
n].DecimalChar))
915 if ( (rAnySeq[2] >>= aVal) && aVal.getLength() == 1 )
916 pSeq[
n].DecimalChar = aVal.toChar();
920 if (!(rAnySeq[3] >>= pSeq[
n].FillChar))
923 if ( (rAnySeq[3] >>= aVal) && aVal.getLength() == 1 )
924 pSeq[
n].FillChar = aVal.toChar();
935 const style::TabStop* pArr =
aSeq.getConstArray();
936 const sal_uInt16
nCount =
static_cast<sal_uInt16
>(
aSeq.getLength());
940 switch(pArr[
i].Alignment)
960 sal_Int32 nNewPos = 0;
961 if (!(rVal >>= nNewPos) )
975 sal_Int32 nNewDefaultDistance = 0;
976 if (!(rVal >>= nNewDefaultDistance))
980 if (nNewDefaultDistance < 0)
992 assert(SfxPoolItem::operator==(rAttr));
1002 for ( sal_uInt16
i = 0;
i <
Count(); ++
i )
1003 if( (*
this)[
i] != rTSI[
i] )
1024 bool bComma =
false;
1026 for ( sal_uInt16
i = 0;
i <
Count(); ++
i )
1033 ((*
this)[
i]).GetTabPos(), eCoreUnit, ePresUnit, &rIntl );
1034 if ( SfxItemPresentation::Complete == ePres )
1047 sal_uInt16 nTabPos =
GetPos(rTab);
1055 for( sal_uInt16
i = 0;
i < pTabs->
Count();
i++ )
1058 sal_uInt16 nTabPos =
GetPos(rTab);
1062 for( sal_uInt16
i = 0;
i < pTabs->
Count();
i++ )
1070 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SvxTabStopItem"));
1071 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"mnDefaultDistance"),
1074 rTabStop.dumpAsXml(pWriter);
1075 (void)xmlTextWriterEndElement(pWriter);
1099 pId = RID_SVXITEMS_FMTSPLIT_TRUE;
1111 nMemberId &= ~CONVERT_TWIPS;
1113 switch ( nMemberId )
1117 default: OSL_FAIL(
"Wrong MemberId!");
return false;
1125 nMemberId &= ~CONVERT_TWIPS;
1128 switch ( nMemberId )
1132 default: OSL_FAIL(
"Wrong MemberId!");
return false;
1157 case SfxItemPresentation::Nameless:
1162 case SfxItemPresentation::Complete:
1190 ? RID_SVXITEMS_SCRPTSPC_OFF
1191 : RID_SVXITEMS_SCRPTSPC_ON );
1197 bool bOn,
const sal_uInt16 nId )
1213 ? RID_SVXITEMS_HNGPNCT_OFF
1214 : RID_SVXITEMS_HNGPNCT_ON );
1220 bool bOn,
const sal_uInt16 nId )
1236 ? RID_SVXITEMS_FORBIDDEN_RULE_OFF
1237 : RID_SVXITEMS_FORBIDDEN_RULE_ON );
1265 case Align::Top: pTmp = RID_SVXITEMS_PARAVERTALIGN_TOP;
break;
1266 case Align::Center: pTmp = RID_SVXITEMS_PARAVERTALIGN_CENTER;
break;
1267 case Align::Bottom: pTmp = RID_SVXITEMS_PARAVERTALIGN_BOTTOM;
break;
1268 default: pTmp = RID_SVXITEMS_PARAVERTALIGN_BASELINE;
break;
1277 rVal <<= static_cast<sal_Int16>(
GetValue());
1284 sal_Int16 nVal = sal_Int16();
1285 if((rVal >>= nVal) && nVal >=0 && nVal <= sal_uInt16(
Align::Bottom) )
1310 EditResId( RID_SVXITEMS_PARASNAPTOGRID_ON ) :
1311 EditResId( RID_SVXITEMS_PARASNAPTOGRID_OFF );
constexpr auto convertTwipToMm100(N n)
sal_uInt8 GetValue() const
const OUString & GetValue() const
virtual bool operator==(const SfxPoolItem &rItem) const override
void SetValue(const OUString &rTheValue)
const OUString & getNumDecimalSep() const
const LocaleDataWrapper & GetLocaleData() const
virtual sal_uInt16 GetValueCount() const override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
SvxAdjust GetLastBlock() const
virtual bool operator==(const SfxPoolItem &) const override
SvxAdjust GetAdjust() const
SvxAdjustItem(const SvxAdjust eAdjst, const sal_uInt16 nId)
void SetAdjust(const SvxAdjust eType)
static SfxPoolItem * CreateDefault()
virtual SvxAdjustItem * Clone(SfxItemPool *pPool=nullptr) const override
void SetLastBlock(const SvxAdjust eType)
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
virtual void SetEnumValue(sal_uInt16 nNewVal) override
static OUString GetValueTextByPos(sal_uInt16 nPos)
virtual sal_uInt16 GetEnumValue() const override
SvxForbiddenRuleItem(bool bOn, const sal_uInt16 nId)
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
virtual SvxForbiddenRuleItem * Clone(SfxItemPool *pPool=nullptr) const override
SvxHangingPunctuationItem(bool bOn, const sal_uInt16 nId)
virtual SvxHangingPunctuationItem * Clone(SfxItemPool *pPool=nullptr) const override
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
virtual SvxHyphenZoneItem * Clone(SfxItemPool *pPool=nullptr) const override
static SfxPoolItem * CreateDefault()
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
SvxHyphenZoneItem(const bool bHyph, const sal_uInt16 nId)
bool bNoLastWordHyphenation
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool operator==(const SfxPoolItem &) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
sal_uInt16 nTextHyphenZone
SvxLineSpacingItem(sal_uInt16 nLineHeight, const sal_uInt16 nId)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
static SfxPoolItem * CreateDefault()
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
SvxInterLineSpaceRule eInterLineSpaceRule
sal_uInt16 nPropLineSpace
virtual void SetEnumValue(sal_uInt16 nNewVal) override
sal_uInt16 GetPropLineSpace() const
virtual SvxLineSpacingItem * Clone(SfxItemPool *pPool=nullptr) const override
SvxInterLineSpaceRule GetInterLineSpaceRule() const
SvxLineSpaceRule GetLineSpaceRule() const
SvxLineSpaceRule eLineSpaceRule
sal_uInt16 GetLineHeight() const
virtual sal_uInt16 GetValueCount() const override
virtual bool operator==(const SfxPoolItem &) const override
short GetInterLineSpace() const
virtual sal_uInt16 GetEnumValue() const override
An orphan line is a paragraph-starting line that is still on the previous page or column (has future,...
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
virtual SvxOrphansItem * Clone(SfxItemPool *pPool=nullptr) const override
static SfxPoolItem * CreateDefault()
SvxOrphansItem(const sal_uInt8 nL, const sal_uInt16 nId)
static SfxPoolItem * CreateDefault()
virtual bool operator==(const SfxPoolItem &) const override
SvxPageModelItem(TypedWhichId< SvxPageModelItem > nWh)
virtual SvxPageModelItem * Clone(SfxItemPool *pPool=nullptr) const override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
SvxParaGridItem(const bool bSnapToGrid, const sal_uInt16 nId)
virtual SvxParaGridItem * Clone(SfxItemPool *pPool=nullptr) const override
static SfxPoolItem * CreateDefault()
SvxParaVertAlignItem(Align nValue, TypedWhichId< SvxParaVertAlignItem > nId)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual SvxParaVertAlignItem * Clone(SfxItemPool *pPool=nullptr) const override
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
virtual SvxScriptSpaceItem * Clone(SfxItemPool *pPool=nullptr) const override
SvxScriptSpaceItem(bool bOn, const sal_uInt16 nId)
sal_Int32 mnDefaultDistance
Defines default tab width for tabs without dedicated tab stop in the paragraph.
static SfxPoolItem * CreateDefault()
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool operator==(const SfxPoolItem &) const override
void SetDefaultDistance(sal_Int32 nDefaultDistancenDefTabSize)
void Remove(const sal_uInt16 nPos, const sal_uInt16 nLen=1)
virtual SvxTabStopItem * Clone(SfxItemPool *pPool=nullptr) const override
bool Insert(const SvxTabStop &rTab)
void dumpAsXml(xmlTextWriterPtr pWriter) const override
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
sal_Int32 GetDefaultDistance() const
sal_uInt16 GetPos(const SvxTabStop &rTab) const
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
SvxTabStopItem(sal_uInt16 nWhich)
sal_Unicode & GetDecimal()
SvxTabAdjust & GetAdjustment()
void dumpAsXml(xmlTextWriterPtr pWriter) const
A widow line is a paragraph-ending line that goes to the following page or column (has past,...
SvxWidowsItem(const sal_uInt8 nL, const sal_uInt16 nId)
static SfxPoolItem * CreateDefault()
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
virtual SvxWidowsItem * Clone(SfxItemPool *pPool=nullptr) const override
const_iterator begin() const
std::vector< Value >::const_iterator const_iterator
const_iterator find(const Value &x) const
const_iterator end() const
const Value & front() const
std::pair< const_iterator, bool > insert(Value &&x)
OUString EditResId(TranslateId aId)
struct _xmlTextWriter * xmlTextWriterPtr
OUString GetMetricText(tools::Long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const IntlWrapper *pIntl)
TranslateId GetMetricId(MapUnit eUnit)
constexpr OUStringLiteral cpDelim
Sequence< sal_Int8 > aSeq
#define SAL_WARN(area, stream)
#define LINE_SPACE_DEFAULT_HEIGHT
#define SAL_N_ELEMENTS(arr)
#define MID_HYPHEN_MIN_WORD_LENGTH
#define MID_EXPAND_SINGLE
#define MID_LAST_LINE_ADJUST
#define MID_HYPHEN_MIN_LEAD
#define MID_HYPHEN_MAX_HYPHENS
#define MID_HYPHEN_NO_CAPS
#define MID_TABSTOP_DEFAULT_DISTANCE
#define MID_HYPHEN_MIN_TRAIL
#define MID_HYPHEN_NO_LAST_WORD
constexpr auto toTwips(N number, Length from)
bool Any2Bool(const css::uno::Any &rValue)