diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-12-10 20:03:38 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-12-11 17:09:01 +0100 |
commit | cfbac86a0423c552a042ae7b9702c0904d4e232a (patch) | |
tree | c5d2ec17b913cdc840235dcbac206006fd37c972 /sc | |
parent | 331cafb1484597544bd94fa3f0e0a45b3328a4d8 (diff) |
Related: tdf#129300 add ScHyphenateCell to provide a description
Change-Id: If00a50a36cf2bb5c9b775a4ca1000af5c5be7bf4
Reviewed-on: https://gerrit.libreoffice.org/84892
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/attrib.hxx | 12 | ||||
-rw-r--r-- | sc/inc/globstr.hrc | 2 | ||||
-rw-r--r-- | sc/inc/scitems.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/attrib.cxx | 20 | ||||
-rw-r--r-- | sc/source/core/data/docpool.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/patattr.cxx | 2 |
6 files changed, 37 insertions, 3 deletions
diff --git a/sc/inc/attrib.hxx b/sc/inc/attrib.hxx index 100766e3afa9..59be64fb243d 100644 --- a/sc/inc/attrib.hxx +++ b/sc/inc/attrib.hxx @@ -333,6 +333,18 @@ public: const IntlWrapper& rIntl) const override; }; +class SC_DLLPUBLIC ScHyphenateCell final : public SfxBoolItem +{ +public: + ScHyphenateCell(bool bHyphenate= false); + virtual ScHyphenateCell* Clone(SfxItemPool *pPool = nullptr) const override; + virtual bool GetPresentation(SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl) const override; +}; + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc index 518d033814ee..4f13865ca778 100644 --- a/sc/inc/globstr.hrc +++ b/sc/inc/globstr.hrc @@ -521,6 +521,8 @@ #define STR_VERTICALSTACKCELL_OFF NC_("STR_VERTICALSTACKCELL_OFF", "Vertically stacked: Off") #define STR_LINEBREAKCELL_ON NC_("STR_LINEBREAKCELL_ON", "Wrap text automatically: On") #define STR_LINEBREAKCELL_OFF NC_("STR_LINEBREAKCELL_OFF", "Wrap text automatically: Off") +#define STR_HYPHENATECELL_ON NC_("STR_HYPHENATECELL_ON", "Hyphenate: On") +#define STR_HYPHENATECELL_OFF NC_("STR_HYPHENATECELL_OFF", "Hyphenate: Off") #endif diff --git a/sc/inc/scitems.hxx b/sc/inc/scitems.hxx index ce40a2c4a267..674bf07fa3e9 100644 --- a/sc/inc/scitems.hxx +++ b/sc/inc/scitems.hxx @@ -111,7 +111,7 @@ class SvxSizeItem; #define ATTR_USERDEF TypedWhichId<SvXMLAttrContainerItem>(122) // not saved in binary files #define ATTR_FONT_WORDLINE TypedWhichId<SvxWordLineModeItem>(123) #define ATTR_FONT_RELIEF TypedWhichId<SvxCharReliefItem>(124) -#define ATTR_HYPHENATE TypedWhichId<SfxBoolItem>(125) +#define ATTR_HYPHENATE TypedWhichId<ScHyphenateCell>(125) #define ATTR_SCRIPTSPACE TypedWhichId<SvxScriptSpaceItem>(126) #define ATTR_HANGPUNCTUATION TypedWhichId<SvxHangingPunctuationItem>(127) #define ATTR_FORBIDDEN_RULES TypedWhichId<SvxForbiddenRuleItem>(128) diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx index 75337c00f75d..4ed61887a67a 100644 --- a/sc/source/core/data/attrib.cxx +++ b/sc/source/core/data/attrib.cxx @@ -808,4 +808,24 @@ bool ScLineBreakCell::GetPresentation(SfxItemPresentation, return true; } +ScHyphenateCell::ScHyphenateCell(bool bHyphenate) + : SfxBoolItem(ATTR_HYPHENATE, bHyphenate) +{ +} + +ScHyphenateCell* ScHyphenateCell::Clone(SfxItemPool*) const +{ + return new ScHyphenateCell(GetValue()); +} + +bool ScHyphenateCell::GetPresentation(SfxItemPresentation, + MapUnit, MapUnit, + OUString& rText, + const IntlWrapper&) const +{ + const char* pId = GetValue() ? STR_HYPHENATECELL_ON : STR_HYPHENATECELL_OFF; + rText = ScResId(pId); + return true; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx index 2df0bfcb9878..148438da76a9 100644 --- a/sc/source/core/data/docpool.cxx +++ b/sc/source/core/data/docpool.cxx @@ -240,7 +240,7 @@ ScDocumentPool::ScDocumentPool() mvPoolDefaults[ ATTR_USERDEF - ATTR_STARTINDEX ] = new SvXMLAttrContainerItem( ATTR_USERDEF ); mvPoolDefaults[ ATTR_FONT_WORDLINE - ATTR_STARTINDEX ] = new SvxWordLineModeItem(false, ATTR_FONT_WORDLINE ); mvPoolDefaults[ ATTR_FONT_RELIEF - ATTR_STARTINDEX ] = new SvxCharReliefItem( FontRelief::NONE, ATTR_FONT_RELIEF ); - mvPoolDefaults[ ATTR_HYPHENATE - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_HYPHENATE ); + mvPoolDefaults[ ATTR_HYPHENATE - ATTR_STARTINDEX ] = new ScHyphenateCell(); mvPoolDefaults[ ATTR_SCRIPTSPACE - ATTR_STARTINDEX ] = new SvxScriptSpaceItem( false, ATTR_SCRIPTSPACE); mvPoolDefaults[ ATTR_HANGPUNCTUATION - ATTR_STARTINDEX ] = new SvxHangingPunctuationItem( false, ATTR_HANGPUNCTUATION); mvPoolDefaults[ ATTR_FORBIDDEN_RULES - ATTR_STARTINDEX ] = new SvxForbiddenRuleItem( false, ATTR_FORBIDDEN_RULES); diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index 996afb8e5f38..d7fc012873ae 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -663,7 +663,7 @@ void ScPatternAttr::FillToEditItemSet( SfxItemSet& rEditSet, const SfxItemSet& r if ( pCondSet->GetItemState( ATTR_HYPHENATE, true, &pItem ) != SfxItemState::SET ) pItem = &rSrcSet.Get( ATTR_HYPHENATE ); - bHyphenate = static_cast<const SfxBoolItem*>(pItem)->GetValue(); + bHyphenate = static_cast<const ScHyphenateCell*>(pItem)->GetValue(); if ( pCondSet->GetItemState( ATTR_WRITINGDIR, true, &pItem ) != SfxItemState::SET ) pItem = &rSrcSet.Get( ATTR_WRITINGDIR ); |