diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2019-09-06 19:36:48 +0200 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2019-09-17 10:45:40 +0200 |
commit | 5ba30f588d6e41a13d68b1461345fca7a7ca61ac (patch) | |
tree | 6f098ffd0fb2c75a2c1cbda4e7b82bd65fb8e7dd | |
parent | 6e1cb2e9dd406fb2883460cefaa4660622996005 (diff) |
tdf#64222 sw: better DOCX import/export of paragraph marker formatting
The problem here is that Word allows formatting the paragraph end
marker, and applies the same formatting to the generated numbering
string; Writer has no such marker thing.
This is currently represented by an empty AUTOFMT hint at the end of the
paragraph, which is created almost by accident in
SwXText::finishParagraph(), because the paragraph properties are set on
a SwPaM that doesn't select the whole paragraph but sits at the end.
This is a bit fragile and the hint may have unfortunate accidents such
as being merged into a preceding AUTOFMT hint if it happens to have the
same items in it.
It ought to work better to have an item in SwTextNode's SwAttrSet to
store these special items; has the advantage that the items will also be
copied when you split the paragraph, like in Word.
Add a RES_PARATR_LIST_AUTOFMT and UNO property "ListAutoFormat" (which
should be considered a first draft...) and use it in preference (where
possible) or in addition to (where necessary due to other missing
pieces) the empty hint.
Also revert the change in checkApplyParagraphMarkFormatToNumbering() to
consider hints that start before the end of the paragraph, as it has
unintended side effects as pointed out by Mike Kaganski.
Change-Id: Ic1d5dd9db2bab0c5e4594712bb45973aa1442da3
Reviewed-on: https://gerrit.libreoffice.org/78729
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
-rw-r--r-- | sw/inc/cmdid.h | 1 | ||||
-rw-r--r-- | sw/inc/hintids.hxx | 198 | ||||
-rw-r--r-- | sw/inc/unoprnms.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/bastyp/init.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/txtfld.cxx | 53 | ||||
-rw-r--r-- | sw/source/core/unocore/unomap1.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/unocore/unomapproperties.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/unocore/unoobj.cxx | 35 | ||||
-rw-r--r-- | sw/source/filter/html/css1atr.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8nds.cxx | 16 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 30 |
11 files changed, 218 insertions, 123 deletions
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 0916d97c90cd..491b18228167 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -498,6 +498,7 @@ #define FN_UNO_PARA_STYLE (FN_EXTRA2 + 9) // starting here are UNI-Ids for the PropertyMap listed #define FN_UNO_PAGE_STYLE (FN_EXTRA2 + 10) +#define FN_UNO_PARA_NUM_AUTO_FORMAT (FN_EXTRA2 + 11) #define FN_UNO_FRAME_STYLE_NAME (FN_EXTRA2 + 12) #define FN_UNO_NUM_START_VALUE (FN_EXTRA2 + 13) #define FN_UNO_NUM_LEVEL (FN_EXTRA2 + 14) diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 72c20b21cc8a..6e818b03349b 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -187,120 +187,120 @@ class SvxLRSpaceItem; #define RES_PARATR_LIST_ISRESTART TypedWhichId<SfxBoolItem>(84) #define RES_PARATR_LIST_RESTARTVALUE TypedWhichId<SfxInt16Item>(85) #define RES_PARATR_LIST_ISCOUNTED TypedWhichId<SfxBoolItem>(86) -#define RES_PARATR_LIST_END (87) +#define RES_PARATR_LIST_AUTOFMT TypedWhichId<SwFormatAutoFormat>(87)//TypedWhichId<SfxSetItem>(87) +#define RES_PARATR_LIST_END (88) #define RES_FRMATR_BEGIN RES_PARATR_LIST_END #define RES_FILL_ORDER TypedWhichId<SwFormatFillOrder>(RES_FRMATR_BEGIN) -#define RES_FRM_SIZE TypedWhichId<SwFormatFrameSize>(88) -#define RES_PAPER_BIN TypedWhichId<SvxPaperBinItem>(89) -#define RES_LR_SPACE TypedWhichId<SvxLRSpaceItem>(90) -#define RES_UL_SPACE TypedWhichId<SvxULSpaceItem>(91) -#define RES_PAGEDESC TypedWhichId<SwFormatPageDesc>(92) -#define RES_BREAK TypedWhichId<SvxFormatBreakItem>(93) -#define RES_CNTNT TypedWhichId<SwFormatContent>(94) -#define RES_HEADER TypedWhichId<SwFormatHeader>(95) -#define RES_FOOTER TypedWhichId<SwFormatFooter>(96) -#define RES_PRINT TypedWhichId<SvxPrintItem>(97) -#define RES_OPAQUE TypedWhichId<SvxOpaqueItem>(98) -#define RES_PROTECT TypedWhichId<SvxProtectItem>(99) -#define RES_SURROUND TypedWhichId<SwFormatSurround>(100) -#define RES_VERT_ORIENT TypedWhichId<SwFormatVertOrient>(101) -#define RES_HORI_ORIENT TypedWhichId<SwFormatHoriOrient>(102) -#define RES_ANCHOR TypedWhichId<SwFormatAnchor>(103) -#define RES_BACKGROUND TypedWhichId<SvxBrushItem>(104) -#define RES_BOX TypedWhichId<SvxBoxItem>(105) -#define RES_SHADOW TypedWhichId<SvxShadowItem>(106) -#define RES_FRMMACRO TypedWhichId<SvxMacroItem>(107) -#define RES_COL TypedWhichId<SwFormatCol>(108) -#define RES_KEEP TypedWhichId<SvxFormatKeepItem>(109) -#define RES_URL TypedWhichId<SwFormatURL>(110) -#define RES_EDIT_IN_READONLY TypedWhichId<SwFormatEditInReadonly>(111) -#define RES_LAYOUT_SPLIT TypedWhichId<SwFormatLayoutSplit>(112) -#define RES_CHAIN TypedWhichId<SwFormatChain>(113) -#define RES_TEXTGRID TypedWhichId<SwTextGridItem>(114) -#define RES_LINENUMBER TypedWhichId<SwFormatLineNumber>(115) -#define RES_FTN_AT_TXTEND TypedWhichId<SwFormatFootnoteAtTextEnd>(116) -#define RES_END_AT_TXTEND TypedWhichId<SwFormatEndAtTextEnd>(117) -#define RES_COLUMNBALANCE TypedWhichId<SwFormatNoBalancedColumns>(118) -#define RES_FRAMEDIR TypedWhichId<SvxFrameDirectionItem>(119) -#define RES_HEADER_FOOTER_EAT_SPACING TypedWhichId<SwHeaderAndFooterEatSpacingItem>(120) -#define RES_ROW_SPLIT TypedWhichId<SwFormatRowSplit>(121) -#define RES_FOLLOW_TEXT_FLOW TypedWhichId<SwFormatFollowTextFlow>(122) -#define RES_COLLAPSING_BORDERS TypedWhichId<SfxBoolItem>(123) -#define RES_WRAP_INFLUENCE_ON_OBJPOS TypedWhichId<SwFormatWrapInfluenceOnObjPos>(124) -#define RES_AUTO_STYLE TypedWhichId<SwFormatAutoFormat>(125) -#define RES_FRMATR_STYLE_NAME TypedWhichId<SfxStringItem>(126) -#define RES_FRMATR_CONDITIONAL_STYLE_NAME TypedWhichId<SfxStringItem>(127) -#define RES_FRMATR_GRABBAG TypedWhichId<SfxGrabBagItem>(128) -#define RES_TEXT_VERT_ADJUST TypedWhichId<SdrTextVertAdjustItem>(129) -#define RES_FRMATR_END 130 +#define RES_FRM_SIZE TypedWhichId<SwFormatFrameSize>(89) +#define RES_PAPER_BIN TypedWhichId<SvxPaperBinItem>(90) +#define RES_LR_SPACE TypedWhichId<SvxLRSpaceItem>(91) +#define RES_UL_SPACE TypedWhichId<SvxULSpaceItem>(92) +#define RES_PAGEDESC TypedWhichId<SwFormatPageDesc>(93) +#define RES_BREAK TypedWhichId<SvxFormatBreakItem>(94) +#define RES_CNTNT TypedWhichId<SwFormatContent>(95) +#define RES_HEADER TypedWhichId<SwFormatHeader>(96) +#define RES_FOOTER TypedWhichId<SwFormatFooter>(97) +#define RES_PRINT TypedWhichId<SvxPrintItem>(98) +#define RES_OPAQUE TypedWhichId<SvxOpaqueItem>(99) +#define RES_PROTECT TypedWhichId<SvxProtectItem>(100) +#define RES_SURROUND TypedWhichId<SwFormatSurround>(101) +#define RES_VERT_ORIENT TypedWhichId<SwFormatVertOrient>(102) +#define RES_HORI_ORIENT TypedWhichId<SwFormatHoriOrient>(103) +#define RES_ANCHOR TypedWhichId<SwFormatAnchor>(104) +#define RES_BACKGROUND TypedWhichId<SvxBrushItem>(105) +#define RES_BOX TypedWhichId<SvxBoxItem>(106) +#define RES_SHADOW TypedWhichId<SvxShadowItem>(107) +#define RES_FRMMACRO TypedWhichId<SvxMacroItem>(108) +#define RES_COL TypedWhichId<SwFormatCol>(109) +#define RES_KEEP TypedWhichId<SvxFormatKeepItem>(110) +#define RES_URL TypedWhichId<SwFormatURL>(111) +#define RES_EDIT_IN_READONLY TypedWhichId<SwFormatEditInReadonly>(112) +#define RES_LAYOUT_SPLIT TypedWhichId<SwFormatLayoutSplit>(113) +#define RES_CHAIN TypedWhichId<SwFormatChain>(114) +#define RES_TEXTGRID TypedWhichId<SwTextGridItem>(115) +#define RES_LINENUMBER TypedWhichId<SwFormatLineNumber>(116) +#define RES_FTN_AT_TXTEND TypedWhichId<SwFormatFootnoteAtTextEnd>(117) +#define RES_END_AT_TXTEND TypedWhichId<SwFormatEndAtTextEnd>(118) +#define RES_COLUMNBALANCE TypedWhichId<SwFormatNoBalancedColumns>(119) +#define RES_FRAMEDIR TypedWhichId<SvxFrameDirectionItem>(120) +#define RES_HEADER_FOOTER_EAT_SPACING TypedWhichId<SwHeaderAndFooterEatSpacingItem>(121) +#define RES_ROW_SPLIT TypedWhichId<SwFormatRowSplit>(122) +#define RES_FOLLOW_TEXT_FLOW TypedWhichId<SwFormatFollowTextFlow>(123) +#define RES_COLLAPSING_BORDERS TypedWhichId<SfxBoolItem>(124) +#define RES_WRAP_INFLUENCE_ON_OBJPOS TypedWhichId<SwFormatWrapInfluenceOnObjPos>(125) +#define RES_AUTO_STYLE TypedWhichId<SwFormatAutoFormat>(126) +#define RES_FRMATR_STYLE_NAME TypedWhichId<SfxStringItem>(127) +#define RES_FRMATR_CONDITIONAL_STYLE_NAME TypedWhichId<SfxStringItem>(128) +#define RES_FRMATR_GRABBAG TypedWhichId<SfxGrabBagItem>(129) +#define RES_TEXT_VERT_ADJUST TypedWhichId<SdrTextVertAdjustItem>(130) +#define RES_FRMATR_END 131 #define RES_GRFATR_BEGIN RES_FRMATR_END -#define RES_GRFATR_MIRRORGRF TypedWhichId<SwMirrorGrf>(RES_GRFATR_BEGIN) // 130 -#define RES_GRFATR_CROPGRF TypedWhichId<SwCropGrf>(131) - -#define RES_GRFATR_ROTATION TypedWhichId<SwRotationGrf>(132) -#define RES_GRFATR_LUMINANCE TypedWhichId<SwLuminanceGrf>(133) -#define RES_GRFATR_CONTRAST TypedWhichId<SwContrastGrf>(134) -#define RES_GRFATR_CHANNELR TypedWhichId<SwChannelRGrf>(135) -#define RES_GRFATR_CHANNELG TypedWhichId<SwChannelGGrf>(136) -#define RES_GRFATR_CHANNELB TypedWhichId<SwChannelBGrf>(137) -#define RES_GRFATR_GAMMA TypedWhichId<SwGammaGrf>(138) -#define RES_GRFATR_INVERT TypedWhichId<SwInvertGrf>(139) -#define RES_GRFATR_TRANSPARENCY TypedWhichId<SwTransparencyGrf>(140) -#define RES_GRFATR_DRAWMODE TypedWhichId<SwDrawModeGrf>(141) - -#define RES_GRFATR_DUMMY1 TypedWhichId<SfxBoolItem>(142) -#define RES_GRFATR_DUMMY2 TypedWhichId<SfxBoolItem>(143) -#define RES_GRFATR_DUMMY3 TypedWhichId<SfxBoolItem>(144) -#define RES_GRFATR_DUMMY4 TypedWhichId<SfxBoolItem>(145) -#define RES_GRFATR_DUMMY5 TypedWhichId<SfxBoolItem>(146) -#define RES_GRFATR_END (147) +#define RES_GRFATR_MIRRORGRF TypedWhichId<SwMirrorGrf>(RES_GRFATR_BEGIN) // 131 +#define RES_GRFATR_CROPGRF TypedWhichId<SwCropGrf>(132) + +#define RES_GRFATR_ROTATION TypedWhichId<SwRotationGrf>(133) +#define RES_GRFATR_LUMINANCE TypedWhichId<SwLuminanceGrf>(134) +#define RES_GRFATR_CONTRAST TypedWhichId<SwContrastGrf>(135) +#define RES_GRFATR_CHANNELR TypedWhichId<SwChannelRGrf>(136) +#define RES_GRFATR_CHANNELG TypedWhichId<SwChannelGGrf>(137) +#define RES_GRFATR_CHANNELB TypedWhichId<SwChannelBGrf>(138) +#define RES_GRFATR_GAMMA TypedWhichId<SwGammaGrf>(139) +#define RES_GRFATR_INVERT TypedWhichId<SwInvertGrf>(140) +#define RES_GRFATR_TRANSPARENCY TypedWhichId<SwTransparencyGrf>(141) +#define RES_GRFATR_DRAWMODE TypedWhichId<SwDrawModeGrf>(142) + +#define RES_GRFATR_DUMMY1 TypedWhichId<SfxBoolItem>(143) +#define RES_GRFATR_DUMMY2 TypedWhichId<SfxBoolItem>(144) +#define RES_GRFATR_DUMMY3 TypedWhichId<SfxBoolItem>(145) +#define RES_GRFATR_DUMMY4 TypedWhichId<SfxBoolItem>(146) +#define RES_GRFATR_DUMMY5 TypedWhichId<SfxBoolItem>(147) +#define RES_GRFATR_END (148) #define RES_BOXATR_BEGIN RES_GRFATR_END -#define RES_BOXATR_FORMAT TypedWhichId<SwTableBoxNumFormat>(RES_BOXATR_BEGIN) // 147 -#define RES_BOXATR_FORMULA TypedWhichId<SwTableBoxFormula>(148) -#define RES_BOXATR_VALUE TypedWhichId<SwTableBoxValue>(149) -#define RES_BOXATR_END (150) +#define RES_BOXATR_FORMAT TypedWhichId<SwTableBoxNumFormat>(RES_BOXATR_BEGIN) // 148 +#define RES_BOXATR_FORMULA TypedWhichId<SwTableBoxFormula>(149) +#define RES_BOXATR_VALUE TypedWhichId<SwTableBoxValue>(150) +#define RES_BOXATR_END (151) #define RES_UNKNOWNATR_BEGIN RES_BOXATR_END -#define RES_UNKNOWNATR_CONTAINER TypedWhichId<SvXMLAttrContainerItem>(RES_UNKNOWNATR_BEGIN)// 150 -#define RES_UNKNOWNATR_END (151) +#define RES_UNKNOWNATR_CONTAINER TypedWhichId<SvXMLAttrContainerItem>(RES_UNKNOWNATR_BEGIN)// 151 +#define RES_UNKNOWNATR_END (152) // Format IDs #define RES_FMT_BEGIN RES_UNKNOWNATR_END -#define RES_CHRFMT TypedWhichId<SwCharFormat>(RES_FMT_BEGIN) // 151 -#define RES_FRMFMT TypedWhichId<SwFrameFormat>(152) -#define RES_FLYFRMFMT TypedWhichId<SwFlyFrameFormat>(153) -#define RES_TXTFMTCOLL TypedWhichId<SwTextFormatColl>(154) -#define RES_GRFFMTCOLL TypedWhichId<SwGrfFormatColl>(155) -#define RES_DRAWFRMFMT TypedWhichId<SwDrawFrameFormat>(156) -#define RES_CONDTXTFMTCOLL TypedWhichId<SwConditionTextFormatColl>(157) -#define RES_FMT_END 158 +#define RES_CHRFMT TypedWhichId<SwCharFormat>(RES_FMT_BEGIN) // 152 +#define RES_FRMFMT TypedWhichId<SwFrameFormat>(153) +#define RES_FLYFRMFMT TypedWhichId<SwFlyFrameFormat>(154) +#define RES_TXTFMTCOLL TypedWhichId<SwTextFormatColl>(155) +#define RES_GRFFMTCOLL TypedWhichId<SwGrfFormatColl>(156) +#define RES_DRAWFRMFMT TypedWhichId<SwDrawFrameFormat>(157) +#define RES_CONDTXTFMTCOLL TypedWhichId<SwConditionTextFormatColl>(158) +#define RES_FMT_END 159 // ID's for Messages in the Formats #define RES_MSG_BEGIN RES_FMT_END -#define RES_OBJECTDYING TypedWhichId<SwPtrMsgPoolItem>(RES_MSG_BEGIN) // 158 -#define RES_FMT_CHG TypedWhichId<SwFormatChg>(159) -#define RES_ATTRSET_CHG TypedWhichId<SwAttrSetChg>(160) -#define RES_INS_TXT TypedWhichId<SwInsText>(161) -#define RES_DEL_CHR TypedWhichId<SwDelChr>(162) -#define RES_DEL_TXT TypedWhichId<SwDelText>(163) -#define RES_UPDATE_ATTR TypedWhichId<SwUpdateAttr>(164) -#define RES_REFMARKFLD_UPDATE TypedWhichId<SwRefMarkFieldUpdate>(165) -#define RES_DOCPOS_UPDATE TypedWhichId<SwDocPosUpdate>(166) -#define RES_TABLEFML_UPDATE TypedWhichId<SwTableFormulaUpdate>(167) -#define RES_UPDATEDDETBL TypedWhichId<SwMsgPoolItem>(168) -#define RES_TBLHEADLINECHG TypedWhichId<SwMsgPoolItem>(169) -#define RES_AUTOFMT_DOCNODE TypedWhichId<SwAutoFormatGetDocNode>(170) -#define RES_SECTION_HIDDEN TypedWhichId<SwMsgPoolItem>(171) -#define RES_SECTION_NOT_HIDDEN TypedWhichId<SwMsgPoolItem>(172) -#define RES_GRAPHIC_ARRIVED TypedWhichId<SwMsgPoolItem>(173) -#define RES_GRAPHIC_PIECE_ARRIVED TypedWhichId<SwMsgPoolItem>(174) -#define RES_HIDDENPARA_PRINT TypedWhichId<SwMsgPoolItem>(175) -#define RES_CONDCOLL_CONDCHG TypedWhichId<SwCondCollCondChg>(176) -#define RES_VIRTPAGENUM_INFO TypedWhichId<SwVirtPageNumInfo>(177) -// empty +#define RES_OBJECTDYING TypedWhichId<SwPtrMsgPoolItem>(RES_MSG_BEGIN) // 159 +#define RES_FMT_CHG TypedWhichId<SwFormatChg>(160) +#define RES_ATTRSET_CHG TypedWhichId<SwAttrSetChg>(161) +#define RES_INS_TXT TypedWhichId<SwInsText>(162) +#define RES_DEL_CHR TypedWhichId<SwDelChr>(163) +#define RES_DEL_TXT TypedWhichId<SwDelText>(164) +#define RES_UPDATE_ATTR TypedWhichId<SwUpdateAttr>(165) +#define RES_REFMARKFLD_UPDATE TypedWhichId<SwRefMarkFieldUpdate>(166) +#define RES_DOCPOS_UPDATE TypedWhichId<SwDocPosUpdate>(167) +#define RES_TABLEFML_UPDATE TypedWhichId<SwTableFormulaUpdate>(168) +#define RES_UPDATEDDETBL TypedWhichId<SwMsgPoolItem>(169) +#define RES_TBLHEADLINECHG TypedWhichId<SwMsgPoolItem>(170) +#define RES_AUTOFMT_DOCNODE TypedWhichId<SwAutoFormatGetDocNode>(171) +#define RES_SECTION_HIDDEN TypedWhichId<SwMsgPoolItem>(172) +#define RES_SECTION_NOT_HIDDEN TypedWhichId<SwMsgPoolItem>(173) +#define RES_GRAPHIC_ARRIVED TypedWhichId<SwMsgPoolItem>(174) +#define RES_GRAPHIC_PIECE_ARRIVED TypedWhichId<SwMsgPoolItem>(175) +#define RES_HIDDENPARA_PRINT TypedWhichId<SwMsgPoolItem>(176) +#define RES_CONDCOLL_CONDCHG TypedWhichId<SwCondCollCondChg>(177) +#define RES_VIRTPAGENUM_INFO TypedWhichId<SwVirtPageNumInfo>(178) #define RES_REMOVE_UNO_OBJECT TypedWhichId<SwPtrMsgPoolItem>(179) #define RES_GRF_REREAD_AND_INCACHE TypedWhichId<SwMsgPoolItem>(180) // empty diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index 1ae3a69fc618..69fadbe60c5f 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -808,6 +808,7 @@ #define UNO_NAME_STREAM_NAME "StreamName" #define UNO_NAME_PARA_CONTINUEING_PREVIOUS_SUB_TREE "ContinueingPreviousSubTree" #define UNO_NAME_PARA_LIST_LABEL_STRING "ListLabelString" +#define UNO_NAME_PARA_LIST_AUTO_FORMAT "ListAutoFormat" #define UNO_NAME_CHAR_OVERLINE "CharOverline" #define UNO_NAME_CHAR_OVERLINE_COLOR "CharOverlineColor" #define UNO_NAME_CHAR_OVERLINE_HAS_COLOR "CharOverlineHasColor" diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 6c6d462ab331..b27dfdabb2d7 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -359,6 +359,7 @@ SfxItemInfo aSlotTab[] = { 0, true }, // RES_PARATR_LIST_ISRESTART { 0, true }, // RES_PARATR_LIST_RESTARTVALUE { 0, true }, // RES_PARATR_LIST_ISCOUNTED + { 0, true }, // RES_PARATR_LIST_AUTOFMT { 0, true }, // RES_FILL_ORDER { 0, true }, // RES_FRM_SIZE @@ -561,6 +562,7 @@ void InitCore() aAttrTab[ RES_PARATR_LIST_ISRESTART - POOLATTR_BEGIN ] = new SfxBoolItem( RES_PARATR_LIST_ISRESTART, false ); aAttrTab[ RES_PARATR_LIST_RESTARTVALUE - POOLATTR_BEGIN ] = new SfxInt16Item( RES_PARATR_LIST_RESTARTVALUE, 1 ); aAttrTab[ RES_PARATR_LIST_ISCOUNTED - POOLATTR_BEGIN ] = new SfxBoolItem( RES_PARATR_LIST_ISCOUNTED, true ); + aAttrTab[ RES_PARATR_LIST_AUTOFMT - POOLATTR_BEGIN ] = new SwFormatAutoFormat(RES_PARATR_LIST_AUTOFMT);//new SfxSetItem(RES_PARATR_LIST_AUTOFMT, std::make_unique<SfxItemSet>(aCharAutoFormatSetRange)); aAttrTab[ RES_FILL_ORDER- POOLATTR_BEGIN ] = new SwFormatFillOrder; aAttrTab[ RES_FRM_SIZE- POOLATTR_BEGIN ] = new SwFormatFrameSize; diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index 90edb00b7e0b..e0005a569994 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -21,6 +21,7 @@ #include <fmtfld.hxx> #include <txtfld.hxx> #include <charfmt.hxx> +#include <fmtautofmt.hxx> #include <viewsh.hxx> #include <doc.hxx> @@ -419,37 +420,45 @@ static void checkApplyParagraphMarkFormatToNumbering(SwFont* pNumFnt, SwTextForm { if( !pIDSA->get(DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING )) return; - TextFrameIndex const nTextLen(rInf.GetTextFrame()->GetText().getLength()); - SwTextNode const* pNode(nullptr); - sw::MergedAttrIterReverse iter(*rInf.GetTextFrame()); - std::shared_ptr<SfxItemSet> pSet; - for (SwTextAttr const* pHint = iter.PrevAttr(&pNode); pHint; - pHint = iter.PrevAttr(&pNode)) + + SwFormatAutoFormat const& rListAutoFormat(static_cast<SwFormatAutoFormat const&>(rInf.GetTextFrame()->GetTextNodeForParaProps()->GetAttr(RES_PARATR_LIST_AUTOFMT))); + std::shared_ptr<SfxItemSet> pSet(rListAutoFormat.GetStyleHandle()); + + // TODO remove this fallback (for WW8/RTF) + if (!pSet) { - TextFrameIndex const nHintEnd( - rInf.GetTextFrame()->MapModelToView(pNode, pHint->GetAnyEnd())); - if (nHintEnd < nTextLen) - { - break; // only those at para end are interesting - } - // Formatting for the paragraph mark is usually set to apply only to the - // (non-existent) extra character at end of the text node, but there can be - // other hints too (ending at nTextLen), so look for all matching hints. - // Still the (non-existent) extra character at the end is preferred if it exists. - if (pHint->Which() == RES_TXTATR_AUTOFMT) + TextFrameIndex const nTextLen(rInf.GetTextFrame()->GetText().getLength()); + SwTextNode const* pNode(nullptr); + sw::MergedAttrIterReverse iter(*rInf.GetTextFrame()); + for (SwTextAttr const* pHint = iter.PrevAttr(&pNode); pHint; + pHint = iter.PrevAttr(&pNode)) { - pSet = pHint->GetAutoFormat().GetStyleHandle(); - // When we find an empty hint (start == end) we got what we are looking for. - if (pHint->GetStart() == *pHint->End()) + TextFrameIndex const nHintEnd( + rInf.GetTextFrame()->MapModelToView(pNode, pHint->GetAnyEnd())); + if (nHintEnd < nTextLen) + { + break; // only those at para end are interesting + } + // Formatting for the paragraph mark is usually set to apply only to the + // (non-existent) extra character at end of the text node, but there can be + // other hints too (ending at nTextLen), so look for all matching hints. + // Still the (non-existent) extra character at the end is preferred if it exists. + if (pHint->Which() == RES_TXTATR_AUTOFMT + && pHint->GetStart() == *pHint->End()) + { + pSet = pHint->GetAutoFormat().GetStyleHandle(); + // When we find an empty hint (start == end) we got what we are looking for. break; + } } } + // TODO: apparently Word can apply Character Style too, see testParagraphMark + // Check each item and in case it should be ignored, then clear it. - std::unique_ptr<SfxItemSet> pCleanedSet; if (pSet.get()) { - pCleanedSet = pSet->Clone(); + std::unique_ptr<SfxItemSet> const pCleanedSet = pSet->Clone(); SfxItemIter aIter(*pSet); const SfxPoolItem* pItem = aIter.GetCurItem(); diff --git a/sw/source/core/unocore/unomap1.cxx b/sw/source/core/unocore/unomap1.cxx index 25138d0c4b8e..08d9d1e49943 100644 --- a/sw/source/core/unocore/unomap1.cxx +++ b/sw/source/core/unocore/unomap1.cxx @@ -203,6 +203,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetAutoParaStyleProper { OUString(UNO_NAME_PARA_CHAPTER_NUMBERING_LEVEL), FN_UNO_PARA_CHAPTER_NUMBERING_LEVEL,cppu::UnoType<sal_Int8>::get(), PROPERTY_NONE, 0}, { OUString(UNO_NAME_PARA_CONDITIONAL_STYLE_NAME), RES_FRMATR_CONDITIONAL_STYLE_NAME, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0}, { OUString(UNO_NAME_PARA_IS_NUMBERING_RESTART), FN_NUMBER_NEWSTART, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID, 0 }, + // TODO add RES_PARATR_LIST_AUTOFMT? { OUString(UNO_NAME_OUTLINE_LEVEL), RES_PARATR_OUTLINELEVEL, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, 0}, COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN TABSTOPS_MAP_ENTRY diff --git a/sw/source/core/unocore/unomapproperties.hxx b/sw/source/core/unocore/unomapproperties.hxx index 251c9ab6ed8d..aafe8263afbf 100644 --- a/sw/source/core/unocore/unomapproperties.hxx +++ b/sw/source/core/unocore/unomapproperties.hxx @@ -95,6 +95,7 @@ { OUString(UNO_NAME_PARA_IS_NUMBERING_RESTART), FN_NUMBER_NEWSTART, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID, 0 }, \ { OUString(UNO_NAME_PARA_CONTINUEING_PREVIOUS_SUB_TREE), FN_UNO_PARA_CONT_PREV_SUBTREE, cppu::UnoType<bool>::get(), PropertyAttribute::READONLY, 0 }, \ { OUString(UNO_NAME_PARA_LIST_LABEL_STRING), FN_UNO_PARA_NUM_STRING, cppu::UnoType<OUString>::get(), PropertyAttribute::READONLY, 0 }, \ + { OUString(UNO_NAME_PARA_LIST_AUTO_FORMAT), FN_UNO_PARA_NUM_AUTO_FORMAT, cppu::UnoType<cppu::UnoSequenceType<css::beans::NamedValue>>::get(), PropertyAttribute::MAYBEVOID, 0 }, \ { OUString(UNO_NAME_OUTLINE_LEVEL), RES_PARATR_OUTLINELEVEL, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, 0}, #define COMMON_HYPERLINK_PROPERTIES \ diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index e47a0b11a904..2c5766ecebf9 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -102,6 +102,7 @@ #include <SwStyleNameMapper.hxx> #include <sortopt.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/i18n/WordType.hpp> #include <memory> #include <unoparaframeenum.hxx> @@ -512,6 +513,7 @@ SwUnoCursorHelper::SetCursorPropertyValue( // #i91601# case FN_UNO_LIST_ID: case FN_UNO_IS_NUMBER: + case FN_UNO_PARA_NUM_AUTO_FORMAT: { // multi selection is not considered SwTextNode *const pTextNd = rPam.GetNode().GetTextNode(); @@ -549,6 +551,39 @@ SwUnoCursorHelper::SetCursorPropertyValue( pTextNd->SetCountedInList( false ); } } + else if (FN_UNO_PARA_NUM_AUTO_FORMAT == rEntry.nWID) + { + uno::Sequence<beans::NamedValue> props; + if (rValue >>= props) + { + // TODO create own map for this, it contains UNO_NAME_DISPLAY_NAME? or make property readable so ODF export can map it to a automatic style? + SfxItemPropertySet const& rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_CHAR_AUTO_STYLE)); + SfxItemPropertyMap const& rMap(rPropSet.getPropertyMap()); + SfxItemSet items{rPam.GetDoc()->GetAttrPool(), aCharAutoFormatSetRange}; + + for (sal_Int32 i = 0; i < props.getLength(); ++i) + { + SfxItemPropertySimpleEntry const*const pEntry = + rMap.getByName(props[i].Name); + if (!pEntry) + { + throw beans::UnknownPropertyException( + "Unknown property: " + props[i].Name); + } + if (pEntry->nFlags & beans::PropertyAttribute::READONLY) + { + throw beans::PropertyVetoException( + "Property is read-only: " + props[i].Name); + } + rPropSet.setPropertyValue(*pEntry, props[i].Value, items); + } + + SwFormatAutoFormat item(RES_PARATR_LIST_AUTOFMT); + // TODO: for ODF export we'd need to add it to the autostyle pool + item.SetStyleHandle(std::make_shared<SfxItemSet>(items)); + pTextNd->SetAttr(item); + } + } //PROPERTY_MAYBEVOID! } break; diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 6aea83c11b60..55cb6346b1e1 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -3587,6 +3587,7 @@ static SwAttrFnTab const aCSS1AttrFnTab = { /* RES_PARATR_LIST_ISRESTART */ nullptr, // new /* RES_PARATR_LIST_RESTARTVALUE */ nullptr, // new /* RES_PARATR_LIST_ISCOUNTED */ nullptr, // new +/* RES_PARATR_LIST_AUTOFMT */ nullptr, // new /* RES_FILL_ORDER */ nullptr, /* RES_FRM_SIZE */ nullptr, @@ -3655,6 +3656,8 @@ static SwAttrFnTab const aCSS1AttrFnTab = { /* RES_BOXATR_VALUE */ nullptr }; +static_assert(SAL_N_ELEMENTS(aCSS1AttrFnTab) == RES_BOXATR_END); + void SwHTMLWriter::OutCSS1_SfxItemSet( const SfxItemSet& rItemSet, bool bDeep ) { diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index c67c9e05b9d5..da3726c980e3 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -2968,6 +2968,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) } // The formatting of the paragraph marker has two sources: + // 0) If there is a RES_PARATR_LIST_AUTOFMT, then use that. // 1) If there are hints at the end of the paragraph, then use that. // 2) Else use the RES_CHRATR_BEGIN..RES_TXTATR_END range of the paragraph // properties. @@ -2977,7 +2978,15 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) // set as a hint. SfxItemSet aParagraphMarkerProperties(m_pDoc->GetAttrPool(), svl::Items<RES_CHRATR_BEGIN, RES_TXTATR_END>{}); bool bCharFormatOnly = true; - if(const SwpHints* pTextAttrs = rNode.GetpSwpHints()) + + SwFormatAutoFormat const& rListAutoFormat(static_cast<SwFormatAutoFormat const&>(rNode.GetAttr(RES_PARATR_LIST_AUTOFMT))); + if (std::shared_ptr<SfxItemSet> const& pSet = rListAutoFormat.GetStyleHandle()) + { + aParagraphMarkerProperties.Put(*pSet); + bCharFormatOnly = false; + // TODO: still need to check for a RES_TXTATR_CHARFMT hint... + } + if (const SwpHints* pTextAttrs = rNode.GetpSwpHints()) { for( size_t i = 0; i < pTextAttrs->Count(); ++i ) { @@ -2992,8 +3001,11 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) SAL_INFO( "sw.ww8", startPos << "startPos == endPos" << *endPos); sal_uInt16 nWhich = pHt->GetAttr().Which(); SAL_INFO( "sw.ww8", "nWhich" << nWhich); - if (nWhich == RES_TXTATR_AUTOFMT || nWhich == RES_TXTATR_CHARFMT) + if ((nWhich == RES_TXTATR_AUTOFMT && bCharFormatOnly) + || nWhich == RES_TXTATR_CHARFMT) + { aParagraphMarkerProperties.Put(pHt->GetAttr()); + } if (nWhich != RES_TXTATR_CHARFMT) bCharFormatOnly = false; } diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 42521e06e228..192b5ab70130 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1408,7 +1408,37 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con } std::vector<beans::PropertyValue> aProperties; if (pPropertyMap.get()) + { aProperties = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(pPropertyMap->GetPropertyValues()); + } + // TODO: this *should* work for RTF but there are test failures, maybe rtftok doesn't distinguish between formatting for the paragraph marker and for the paragraph as a whole; needs investigation + if (pPropertyMap.get() && IsOOXMLImport()) + { + // tdf#64222 filter out the "paragraph marker" formatting and + // set it as a separate paragraph property, not a empty hint at + // end of paragraph + std::vector<beans::NamedValue> charProperties; + for (auto it = aProperties.begin(); it != aProperties.end(); ) + { + // this condition isn't ideal but as it happens all + // RES_CHRATR_* have names that start with "Char" + if (it->Name.startsWith("Char") +// TODO testParagraphMark *wants* this but it's some effort to create a real SwFormatCharFormat... + && !it->Name.startsWith("CharStyleName")) + { + charProperties.emplace_back(it->Name, it->Value); + // as testN793262 demonstrates, font size in rPr must + // affect the paragraph size => also insert empty hint! +// it = aProperties.erase(it); + } + ++it; + } + if (!charProperties.empty()) + { + aProperties.push_back(beans::PropertyValue("ListAutoFormat", + 0, uno::makeAny(comphelper::containerToSequence(charProperties)), beans::PropertyState_DIRECT_VALUE)); + } + } if( !bIsDropCap ) { if( aDrop.Lines > 1 ) |