diff options
author | Skyler Grey <skyler.grey@collabora.com> | 2023-10-20 13:07:12 +0000 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-10-30 20:04:01 +0100 |
commit | e195c22533de44cd4f6afab7836c7eb6a613d202 (patch) | |
tree | e59ed742c91328d3b7f6abc18667646d9c5b6dd3 /sw | |
parent | 186398e2661c8be9c4d8447d2c8fada443b26ad4 (diff) |
Enable STYLEREF flag export/import with OOXML
This commit enables exporting the following STYLEREF flags with OOXML
- Search from bottom to top
- Hide non numerical
After this commit, the following steps have been implemented
- The document model (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- The layout (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- The UI (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- UNO
- DOCX filter
Change-Id: Ib664fec059aa1f7f130acc76c253d5d298fa59f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158350
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/unoprnms.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/fields/reffld.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/inc/unofldmid.h | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/unofield.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/unocore/unomap.cxx | 1 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 11 |
6 files changed, 36 insertions, 1 deletions
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index 1ab2395fa67d..e83b1b601ef4 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -307,6 +307,7 @@ inline constexpr OUString UNO_NAME_PAGE_NUMBER_OFFSET = u"PageNumberOffset"_ustr inline constexpr OUString UNO_NAME_PLACEHOLDER = u"PlaceHolder"_ustr; inline constexpr OUString UNO_NAME_PLACEHOLDER_TYPE = u"PlaceHolderType"_ustr; inline constexpr OUString UNO_NAME_PRINT = u"Print"_ustr; +inline constexpr OUString UNO_NAME_REFERENCE_FIELD_FLAGS = u"ReferenceFieldFlags"_ustr; inline constexpr OUString UNO_NAME_REFERENCE_FIELD_PART = u"ReferenceFieldPart"_ustr; inline constexpr OUString UNO_NAME_REFERENCE_FIELD_SOURCE = u"ReferenceFieldSource"_ustr; inline constexpr OUString UNO_NAME_REFERENCE_FIELD_LANGUAGE = u"ReferenceFieldLanguage"_ustr; diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 96b9716f7eac..638baf0a5474 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -974,6 +974,9 @@ bool SwGetRefField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const rAny <<= nSource; } break; + case FIELD_PROP_USHORT3: + rAny <<= m_nFlags; + break; case FIELD_PROP_PAR1: { OUString sTmp(GetPar1()); @@ -1076,6 +1079,13 @@ bool SwGetRefField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) case FIELD_PROP_PAR4: rAny >>= m_sSetReferenceLanguage; break; + case FIELD_PROP_USHORT3: + { + sal_uInt16 nSetFlags = 0; + rAny >>= nSetFlags; + m_nFlags = nSetFlags; + } + break; case FIELD_PROP_SHORT1: { sal_Int16 nSetSeq = 0; diff --git a/sw/source/core/inc/unofldmid.h b/sw/source/core/inc/unofldmid.h index 59f4583f3d6f..8c1838f45636 100644 --- a/sw/source/core/inc/unofldmid.h +++ b/sw/source/core/inc/unofldmid.h @@ -51,6 +51,8 @@ #define FIELD_PROP_PAR6 36 #define FIELD_PROP_PAR7 37 +#define FIELD_PROP_USHORT3 38 + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index b5d423e8fd42..74b530ed5a28 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -1043,6 +1043,7 @@ struct SwFieldProperties_Impl sal_Int32 nFormat; sal_uInt16 nUSHORT1; sal_uInt16 nUSHORT2; + sal_uInt16 nUSHORT3; sal_Int16 nSHORT1; sal_Int8 nByte1; bool bFormatIsDefault; @@ -1058,6 +1059,7 @@ struct SwFieldProperties_Impl nFormat(0), nUSHORT1(0), nUSHORT2(0), + nUSHORT3(0), nSHORT1(0), nByte1(0), bFormatIsDefault(true), @@ -1507,6 +1509,8 @@ void SAL_CALL SwXTextField::attach( xField->PutValue(aVal, FIELD_PROP_USHORT1 ); aVal <<= static_cast<sal_Int16>(m_pImpl->m_pProps->nUSHORT2); xField->PutValue(aVal, FIELD_PROP_USHORT2 ); + aVal <<= static_cast<sal_Int16>(m_pImpl->m_pProps->nUSHORT3); + xField->PutValue(aVal, FIELD_PROP_USHORT3 ); aVal <<= m_pImpl->m_pProps->nSHORT1; xField->PutValue(aVal, FIELD_PROP_SHORT1 ); } @@ -2250,13 +2254,16 @@ SwXTextField::setPropertyValue( break; case FIELD_PROP_USHORT1: case FIELD_PROP_USHORT2: + case FIELD_PROP_USHORT3: { sal_Int16 nVal = 0; rValue >>= nVal; if( FIELD_PROP_USHORT1 == pEntry->nWID) m_pImpl->m_pProps->nUSHORT1 = nVal; - else + else if( FIELD_PROP_USHORT2 == pEntry->nWID) m_pImpl->m_pProps->nUSHORT2 = nVal; + else + m_pImpl->m_pProps->nUSHORT3 = nVal; } break; case FIELD_PROP_SHORT1: @@ -2456,6 +2463,9 @@ uno::Any SAL_CALL SwXTextField::getPropertyValue(const OUString& rPropertyName) case FIELD_PROP_USHORT2: aRet <<= static_cast<sal_Int16>(m_pImpl->m_pProps->nUSHORT2); break; + case FIELD_PROP_USHORT3: + aRet <<= static_cast<sal_Int16>(m_pImpl->m_pProps->nUSHORT3); + break; case FIELD_PROP_SHORT1: aRet <<= m_pImpl->m_pProps->nSHORT1; break; diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 5fd4dec86013..3004fb684e9c 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -853,6 +853,7 @@ std::span<const SfxItemPropertyMapEntry> SwUnoPropertyMapProvider::GetPropertyMa {UNO_NAME_CURRENT_PRESENTATION, FIELD_PROP_PAR3, cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0}, {UNO_NAME_REFERENCE_FIELD_PART,FIELD_PROP_USHORT1, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, 0}, {UNO_NAME_REFERENCE_FIELD_SOURCE,FIELD_PROP_USHORT2, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, 0}, + {UNO_NAME_REFERENCE_FIELD_FLAGS, FIELD_PROP_USHORT3, cppu::UnoType<sal_uInt16>::get(), PROPERTY_NONE, 0}, {UNO_NAME_SEQUENCE_NUMBER, FIELD_PROP_SHORT1, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, 0}, {UNO_NAME_SOURCE_NAME, FIELD_PROP_PAR1, cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0}, {UNO_NAME_REFERENCE_FIELD_LANGUAGE, FIELD_PROP_PAR4, cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0}, diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index eda8e17caa53..79446939957e 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -3348,6 +3348,17 @@ void AttributeOutputBase::TextField( const SwFormatField& rField ) break; case ww::eSTYLEREF: sExtraFlags = ""; // styleref fields do not work if they have a hyperlink + + { + sal_uInt16 stylerefFlags = static_cast<const SwGetRefField*>(pField)->GetFlags(); + if ((stylerefFlags & REFFLDFLAG_STYLE_FROM_BOTTOM) == REFFLDFLAG_STYLE_FROM_BOTTOM) { + sExtraFlags += "\\l "; + } + if ((stylerefFlags & REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL) == REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL) { + sExtraFlags += "\\t "; + } + } + [[fallthrough]]; default: switch (pField->GetFormat()) |