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>
This commit is contained in:
committed by
Caolán McNamara
parent
186398e266
commit
e195c22533
@@ -62,6 +62,10 @@ published service GetReference
|
||||
</p>
|
||||
*/
|
||||
[optional, property] string ReferenceFieldLanguage;
|
||||
/** contains extra flags which can modify the behaviour of the field
|
||||
@since LibreOffice 24.2
|
||||
*/
|
||||
[optional, property] short ReferenceFieldFlags;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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: */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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},
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -126,6 +126,9 @@
|
||||
#include <unicode/errorcode.h>
|
||||
#include <unicode/regex.h>
|
||||
|
||||
#define REFFLDFLAG_STYLE_FROM_BOTTOM 0xc100
|
||||
#define REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL 0xc200
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
using namespace oox;
|
||||
namespace writerfilter::dmapper{
|
||||
@@ -7600,6 +7603,21 @@ void DomainMapper_Impl::CloseFieldCommand()
|
||||
|
||||
xFieldProperties->setPropertyValue(
|
||||
getPropertyName(PROP_SOURCE_NAME), aStyleDisplayName);
|
||||
|
||||
sal_uInt16 nFlags = 0;
|
||||
OUString sValue;
|
||||
if( lcl_FindInCommand( pContext->GetCommand(), 'l', sValue ))
|
||||
{
|
||||
//search-below-first
|
||||
nFlags |= REFFLDFLAG_STYLE_FROM_BOTTOM;
|
||||
}
|
||||
if( lcl_FindInCommand( pContext->GetCommand(), 't', sValue ))
|
||||
{
|
||||
//suppress-nondelimiter
|
||||
nFlags |= REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL;
|
||||
}
|
||||
xFieldProperties->setPropertyValue(
|
||||
getPropertyName( PROP_REFERENCE_FIELD_FLAGS ), uno::Any(nFlags) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -259,6 +259,7 @@ namespace
|
||||
{ PROP_TABS_RELATIVE_TO_INDENT, u"TabsRelativeToIndent"},
|
||||
{ PROP_CREATE_FROM_LEVEL_PARAGRAPH_STYLES, u"CreateFromLevelParagraphStyles"},
|
||||
{ PROP_DROP_CAP_FORMAT, u"DropCapFormat"},
|
||||
{ PROP_REFERENCE_FIELD_FLAGS, u"ReferenceFieldFlags"},
|
||||
{ PROP_REFERENCE_FIELD_PART, u"ReferenceFieldPart"},
|
||||
{ PROP_SOURCE_NAME, u"SourceName"},
|
||||
{ PROP_REFERENCE_FIELD_SOURCE, u"ReferenceFieldSource"},
|
||||
|
||||
@@ -267,6 +267,7 @@ enum PropertyIds
|
||||
,PROP_REDLINE_DATE_TIME
|
||||
,PROP_REDLINE_TYPE
|
||||
,PROP_REDLINE_REVERT_PROPERTIES
|
||||
,PROP_REFERENCE_FIELD_FLAGS
|
||||
,PROP_REFERENCE_FIELD_PART
|
||||
,PROP_REFERENCE_FIELD_SOURCE
|
||||
,PROP_RESTART_AT_EACH_PAGE
|
||||
|
||||
Reference in New Issue
Block a user