diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2021-03-16 20:10:18 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2021-03-25 09:49:33 +0100 |
commit | 56d8007a197b095b09423c691a51515567648e80 (patch) | |
tree | 63ce068e98e368587e57e5e686dc09a27bd9ec74 /sw | |
parent | 473f2dec087288309cb169bf84c12124e1d7d7d1 (diff) |
* add BackgroundFullSize property to PageProperties
* add a checkbox on the SvxPageDescPage
* marshal the item via SfxGrabBagItem to avoid changing svxids.hrc
* add RES_BACKGROUND_FULL_SIZE item, pool default is "true" which is
appropriate for Word import filters
* ODF export: remove hard-coded export in
XMLPageMasterExportPropMapper::ContextFilter()
* use it in SwFrame::PaintSwFrameBackground()
* fix painting of bitmaps by also using the page frame area in
SwFrame::GetBackgroundBrush(), which was the reason why
f006b6339e20af6a3fbd60d97d21590d4ebf5021 painted things inconsistently
* force repaint in lcl_DescSetAttr()/SwFrame::UpdateAttrFrame()
Change-Id: I4cb64f87c01d17c051936e9b8128395fbb8b4fe5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112594
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/hintids.hxx | 139 | ||||
-rw-r--r-- | sw/qa/extras/odfexport/data/pagestyle_background_lo70.odt | bin | 0 -> 10125 bytes | |||
-rw-r--r-- | sw/qa/extras/odfexport/odfexport.cxx | 107 | ||||
-rw-r--r-- | sw/source/core/bastyp/init.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/docdesc.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/layout/paintfrm.cxx | 11 | ||||
-rw-r--r-- | sw/source/core/layout/wsfrm.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/unocore/unomap1.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/app/docst.cxx | 15 | ||||
-rw-r--r-- | sw/source/uibase/utlui/uitool.cxx | 27 |
10 files changed, 231 insertions, 76 deletions
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 3971619e27e1..cc6b1916a08b 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -361,84 +361,85 @@ constexpr TypedWhichId<SfxStringItem> RES_FRMATR_STYLE_NAME(127); constexpr TypedWhichId<SfxStringItem> RES_FRMATR_CONDITIONAL_STYLE_NAME(128); constexpr TypedWhichId<SfxGrabBagItem> RES_FRMATR_GRABBAG(129); constexpr TypedWhichId<SdrTextVertAdjustItem> RES_TEXT_VERT_ADJUST(130); -constexpr sal_uInt16 RES_FRMATR_END(131); +constexpr TypedWhichId<SfxBoolItem> RES_BACKGROUND_FULL_SIZE(131); +constexpr sal_uInt16 RES_FRMATR_END(132); constexpr sal_uInt16 RES_GRFATR_BEGIN(RES_FRMATR_END); -constexpr TypedWhichId<SwMirrorGrf> RES_GRFATR_MIRRORGRF(RES_GRFATR_BEGIN); // 131 -constexpr TypedWhichId<SwCropGrf> RES_GRFATR_CROPGRF(132); - -constexpr TypedWhichId<SwRotationGrf> RES_GRFATR_ROTATION(133); -constexpr TypedWhichId<SwLuminanceGrf> RES_GRFATR_LUMINANCE(134); -constexpr TypedWhichId<SwContrastGrf> RES_GRFATR_CONTRAST(135); -constexpr TypedWhichId<SwChannelRGrf> RES_GRFATR_CHANNELR(136); -constexpr TypedWhichId<SwChannelGGrf> RES_GRFATR_CHANNELG(137); -constexpr TypedWhichId<SwChannelBGrf> RES_GRFATR_CHANNELB(138); -constexpr TypedWhichId<SwGammaGrf> RES_GRFATR_GAMMA(139); -constexpr TypedWhichId<SwInvertGrf> RES_GRFATR_INVERT(140); -constexpr TypedWhichId<SwTransparencyGrf> RES_GRFATR_TRANSPARENCY(141); -constexpr TypedWhichId<SwDrawModeGrf> RES_GRFATR_DRAWMODE(142); - -constexpr TypedWhichId<SfxBoolItem> RES_GRFATR_DUMMY1(143); -constexpr TypedWhichId<SfxBoolItem> RES_GRFATR_DUMMY2(144); -constexpr TypedWhichId<SfxBoolItem> RES_GRFATR_DUMMY3(145); -constexpr TypedWhichId<SfxBoolItem> RES_GRFATR_DUMMY4(146); -constexpr TypedWhichId<SfxBoolItem> RES_GRFATR_DUMMY5(147); -constexpr sal_uInt16 RES_GRFATR_END(148); +constexpr TypedWhichId<SwMirrorGrf> RES_GRFATR_MIRRORGRF(RES_GRFATR_BEGIN); // 132 +constexpr TypedWhichId<SwCropGrf> RES_GRFATR_CROPGRF(133); + +constexpr TypedWhichId<SwRotationGrf> RES_GRFATR_ROTATION(134); +constexpr TypedWhichId<SwLuminanceGrf> RES_GRFATR_LUMINANCE(135); +constexpr TypedWhichId<SwContrastGrf> RES_GRFATR_CONTRAST(136); +constexpr TypedWhichId<SwChannelRGrf> RES_GRFATR_CHANNELR(137); +constexpr TypedWhichId<SwChannelGGrf> RES_GRFATR_CHANNELG(138); +constexpr TypedWhichId<SwChannelBGrf> RES_GRFATR_CHANNELB(139); +constexpr TypedWhichId<SwGammaGrf> RES_GRFATR_GAMMA(140); +constexpr TypedWhichId<SwInvertGrf> RES_GRFATR_INVERT(141); +constexpr TypedWhichId<SwTransparencyGrf> RES_GRFATR_TRANSPARENCY(142); +constexpr TypedWhichId<SwDrawModeGrf> RES_GRFATR_DRAWMODE(143); + +constexpr TypedWhichId<SfxBoolItem> RES_GRFATR_DUMMY1(144); +constexpr TypedWhichId<SfxBoolItem> RES_GRFATR_DUMMY2(145); +constexpr TypedWhichId<SfxBoolItem> RES_GRFATR_DUMMY3(146); +constexpr TypedWhichId<SfxBoolItem> RES_GRFATR_DUMMY4(147); +constexpr TypedWhichId<SfxBoolItem> RES_GRFATR_DUMMY5(148); +constexpr sal_uInt16 RES_GRFATR_END(149); constexpr sal_uInt16 RES_BOXATR_BEGIN(RES_GRFATR_END); -constexpr TypedWhichId<SwTableBoxNumFormat> RES_BOXATR_FORMAT(RES_BOXATR_BEGIN); // 148 -constexpr TypedWhichId<SwTableBoxFormula> RES_BOXATR_FORMULA(149); -constexpr TypedWhichId<SwTableBoxValue> RES_BOXATR_VALUE(150); -constexpr sal_uInt16 RES_BOXATR_END(151); +constexpr TypedWhichId<SwTableBoxNumFormat> RES_BOXATR_FORMAT(RES_BOXATR_BEGIN); // 149 +constexpr TypedWhichId<SwTableBoxFormula> RES_BOXATR_FORMULA(150); +constexpr TypedWhichId<SwTableBoxValue> RES_BOXATR_VALUE(151); +constexpr sal_uInt16 RES_BOXATR_END(152); constexpr sal_uInt16 RES_UNKNOWNATR_BEGIN(RES_BOXATR_END); constexpr TypedWhichId<SvXMLAttrContainerItem> - RES_UNKNOWNATR_CONTAINER(RES_UNKNOWNATR_BEGIN); // 151 -constexpr sal_uInt16 RES_UNKNOWNATR_END(152); + RES_UNKNOWNATR_CONTAINER(RES_UNKNOWNATR_BEGIN); // 152 +constexpr sal_uInt16 RES_UNKNOWNATR_END(153); constexpr sal_uInt16 POOLATTR_END(RES_UNKNOWNATR_END); // Format IDs constexpr sal_uInt16 RES_FMT_BEGIN(RES_UNKNOWNATR_END); -constexpr TypedWhichId<SwCharFormat> RES_CHRFMT(RES_FMT_BEGIN); // 152 -constexpr TypedWhichId<SwFrameFormat> RES_FRMFMT(153); -constexpr TypedWhichId<SwFlyFrameFormat> RES_FLYFRMFMT(154); -constexpr TypedWhichId<SwTextFormatColl> RES_TXTFMTCOLL(155); -constexpr TypedWhichId<SwGrfFormatColl> RES_GRFFMTCOLL(156); -constexpr TypedWhichId<SwDrawFrameFormat> RES_DRAWFRMFMT(157); -constexpr TypedWhichId<SwConditionTextFormatColl> RES_CONDTXTFMTCOLL(158); -constexpr sal_uInt16 RES_FMT_END(159); +constexpr TypedWhichId<SwCharFormat> RES_CHRFMT(RES_FMT_BEGIN); // 153 +constexpr TypedWhichId<SwFrameFormat> RES_FRMFMT(154); +constexpr TypedWhichId<SwFlyFrameFormat> RES_FLYFRMFMT(155); +constexpr TypedWhichId<SwTextFormatColl> RES_TXTFMTCOLL(156); +constexpr TypedWhichId<SwGrfFormatColl> RES_GRFFMTCOLL(157); +constexpr TypedWhichId<SwDrawFrameFormat> RES_DRAWFRMFMT(158); +constexpr TypedWhichId<SwConditionTextFormatColl> RES_CONDTXTFMTCOLL(159); +constexpr sal_uInt16 RES_FMT_END(160); // ID's for Messages in the Formats constexpr sal_uInt16 RES_MSG_BEGIN(RES_FMT_END); -constexpr TypedWhichId<SwPtrMsgPoolItem> RES_OBJECTDYING(RES_MSG_BEGIN); // 159 -constexpr TypedWhichId<SwFormatChg> RES_FMT_CHG(160); -constexpr TypedWhichId<SwAttrSetChg> RES_ATTRSET_CHG(161); -constexpr TypedWhichId<SwInsText> RES_INS_TXT(162); -constexpr TypedWhichId<SwDelChr> RES_DEL_CHR(163); -constexpr TypedWhichId<SwDelText> RES_DEL_TXT(164); -constexpr TypedWhichId<SwUpdateAttr> RES_UPDATE_ATTR(165); -constexpr TypedWhichId<SwRefMarkFieldUpdate> RES_REFMARKFLD_UPDATE(166); -constexpr TypedWhichId<SwDocPosUpdate> RES_DOCPOS_UPDATE(167); -constexpr TypedWhichId<SwTableFormulaUpdate> RES_TABLEFML_UPDATE(168); -constexpr TypedWhichId<SwMsgPoolItem> RES_UPDATEDDETBL(169); -constexpr TypedWhichId<SwMsgPoolItem> RES_TBLHEADLINECHG(170); -constexpr TypedWhichId<SwAutoFormatGetDocNode> RES_AUTOFMT_DOCNODE(171); -constexpr TypedWhichId<SwMsgPoolItem> RES_SECTION_HIDDEN(172); -constexpr TypedWhichId<SwMsgPoolItem> RES_SECTION_NOT_HIDDEN(173); -constexpr TypedWhichId<SwMsgPoolItem> RES_GRAPHIC_PIECE_ARRIVED(175); -constexpr TypedWhichId<SwMsgPoolItem> RES_HIDDENPARA_PRINT(176); -constexpr TypedWhichId<SwVirtPageNumInfo> RES_VIRTPAGENUM_INFO(178); -constexpr TypedWhichId<SwPtrMsgPoolItem> RES_REMOVE_UNO_OBJECT(179); +constexpr TypedWhichId<SwPtrMsgPoolItem> RES_OBJECTDYING(RES_MSG_BEGIN); // 160 +constexpr TypedWhichId<SwFormatChg> RES_FMT_CHG(161); +constexpr TypedWhichId<SwAttrSetChg> RES_ATTRSET_CHG(162); +constexpr TypedWhichId<SwInsText> RES_INS_TXT(163); +constexpr TypedWhichId<SwDelChr> RES_DEL_CHR(164); +constexpr TypedWhichId<SwDelText> RES_DEL_TXT(165); +constexpr TypedWhichId<SwUpdateAttr> RES_UPDATE_ATTR(166); +constexpr TypedWhichId<SwRefMarkFieldUpdate> RES_REFMARKFLD_UPDATE(167); +constexpr TypedWhichId<SwDocPosUpdate> RES_DOCPOS_UPDATE(168); +constexpr TypedWhichId<SwTableFormulaUpdate> RES_TABLEFML_UPDATE(169); +constexpr TypedWhichId<SwMsgPoolItem> RES_UPDATEDDETBL(170); +constexpr TypedWhichId<SwMsgPoolItem> RES_TBLHEADLINECHG(171); +constexpr TypedWhichId<SwAutoFormatGetDocNode> RES_AUTOFMT_DOCNODE(172); +constexpr TypedWhichId<SwMsgPoolItem> RES_SECTION_HIDDEN(173); +constexpr TypedWhichId<SwMsgPoolItem> RES_SECTION_NOT_HIDDEN(174); +constexpr TypedWhichId<SwMsgPoolItem> RES_GRAPHIC_PIECE_ARRIVED(176); +constexpr TypedWhichId<SwMsgPoolItem> RES_HIDDENPARA_PRINT(177); +constexpr TypedWhichId<SwVirtPageNumInfo> RES_VIRTPAGENUM_INFO(179); +constexpr TypedWhichId<SwPtrMsgPoolItem> RES_REMOVE_UNO_OBJECT(180); // empty -constexpr TypedWhichId<SwFindNearestNode> RES_FINDNEARESTNODE(182); -constexpr TypedWhichId<SwPtrMsgPoolItem> RES_CONTENT_VISIBLE(183); -constexpr TypedWhichId<SwMsgPoolItem> RES_GRAPHIC_SWAPIN(184); -constexpr TypedWhichId<SwStringMsgPoolItem> RES_NAME_CHANGED(185); -constexpr TypedWhichId<SwStringMsgPoolItem> RES_TITLE_CHANGED(186); -constexpr TypedWhichId<SwStringMsgPoolItem> RES_DESCRIPTION_CHANGED(187); -constexpr TypedWhichId<SwMsgPoolItem> RES_LINKED_GRAPHIC_STREAM_ARRIVED(187); -constexpr sal_uInt16 RES_MSG_END(188); +constexpr TypedWhichId<SwFindNearestNode> RES_FINDNEARESTNODE(183); +constexpr TypedWhichId<SwPtrMsgPoolItem> RES_CONTENT_VISIBLE(184); +constexpr TypedWhichId<SwMsgPoolItem> RES_GRAPHIC_SWAPIN(185); +constexpr TypedWhichId<SwStringMsgPoolItem> RES_NAME_CHANGED(186); +constexpr TypedWhichId<SwStringMsgPoolItem> RES_TITLE_CHANGED(187); +constexpr TypedWhichId<SwStringMsgPoolItem> RES_DESCRIPTION_CHANGED(188); +constexpr TypedWhichId<SwMsgPoolItem> RES_LINKED_GRAPHIC_STREAM_ARRIVED(188); +constexpr sal_uInt16 RES_MSG_END(189); // An ID for the RTF-reader. The stylesheets are treated like attributes, // i.e. there is a StyleSheet-attribute. To avoid collision with other @@ -446,13 +447,13 @@ constexpr sal_uInt16 RES_MSG_END(188); // new attributes!) constexpr sal_uInt16 RES_FLTRATTR_BEGIN(RES_MSG_END); constexpr TypedWhichId<SfxStringItem> RES_FLTR_BOOKMARK(RES_FLTRATTR_BEGIN); -constexpr TypedWhichId<SwFltAnchor> RES_FLTR_ANCHOR(189); -constexpr TypedWhichId<SfxStringItem> RES_FLTR_NUMRULE(190); -constexpr TypedWhichId<SwFltTOX> RES_FLTR_TOX(191); -constexpr TypedWhichId<SwFltRedline> RES_FLTR_REDLINE(192); -constexpr TypedWhichId<CntUInt16Item> RES_FLTR_ANNOTATIONMARK(193); -constexpr TypedWhichId<SwFltRDFMark> RES_FLTR_RDFMARK(194); -constexpr sal_uInt16 RES_FLTRATTR_END(195); +constexpr TypedWhichId<SwFltAnchor> RES_FLTR_ANCHOR(190); +constexpr TypedWhichId<SfxStringItem> RES_FLTR_NUMRULE(191); +constexpr TypedWhichId<SwFltTOX> RES_FLTR_TOX(192); +constexpr TypedWhichId<SwFltRedline> RES_FLTR_REDLINE(193); +constexpr TypedWhichId<CntUInt16Item> RES_FLTR_ANNOTATIONMARK(194); +constexpr TypedWhichId<SwFltRDFMark> RES_FLTR_RDFMARK(195); +constexpr sal_uInt16 RES_FLTRATTR_END(196); constexpr sal_uInt16 RES_TBX_DUMMY(RES_FLTRATTR_END + 1); diff --git a/sw/qa/extras/odfexport/data/pagestyle_background_lo70.odt b/sw/qa/extras/odfexport/data/pagestyle_background_lo70.odt Binary files differnew file mode 100644 index 000000000000..eb8b4a0e72aa --- /dev/null +++ b/sw/qa/extras/odfexport/data/pagestyle_background_lo70.odt diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 357557828091..e307ea6712d3 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -1887,6 +1887,113 @@ DECLARE_ODFEXPORT_TEST(testMasterPageWithDrawingPage, "sw_hatch.odt") CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xStyle, "FillTransparence")); } +DECLARE_ODFEXPORT_EXPORTONLY_TEST(testPageStyleBackgroundFullSizeLO70, "pagestyle_background_lo70.odt") +{ + xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); + // Standard + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name" + "]/style:drawing-page-properties", "background-size", "full"); + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name" + "]/style:drawing-page-properties", "fill", "solid"); + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name" + "]/style:drawing-page-properties", "fill-color", "#99ccff"); + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name" + "]/style:drawing-page-properties", "opacity", "100%"); + // Endnote + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name" + "]/style:drawing-page-properties", "background-size", "full"); + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name" + "]/style:drawing-page-properties", "fill", "bitmap"); + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name" + "]/style:drawing-page-properties", "repeat", "repeat"); + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name" + "]/style:drawing-page-properties", "fill-image-ref-point", "top-left"); + // Footnote + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name" + "]/style:drawing-page-properties", "background-size", "border"); + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name" + "]/style:drawing-page-properties", "fill", "bitmap"); + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name" + "]/style:drawing-page-properties", "repeat", "stretch"); + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name" + "]/style:drawing-page-properties", "fill-image-ref-point", "top-left"); + // Landscape + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='Landscape']/attribute::draw:style-name" + "]/style:drawing-page-properties", "background-size", "border"); + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='Landscape']/attribute::draw:style-name" + "]/style:drawing-page-properties", "fill", "bitmap"); + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='Landscape']/attribute::draw:style-name" + "]/style:drawing-page-properties", "repeat", "no-repeat"); + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='Landscape']/attribute::draw:style-name" + "]/style:drawing-page-properties", "fill-image-ref-point", "top-left"); + // Index + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='Index']/attribute::draw:style-name" + "]/style:drawing-page-properties", "background-size", "full"); + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='Index']/attribute::draw:style-name" + "]/style:drawing-page-properties", "fill", "gradient"); + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='Index']/attribute::draw:style-name" + "]/style:drawing-page-properties", "gradient-step-count", "0"); + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='Index']/attribute::draw:style-name" + "]/style:drawing-page-properties", "opacity", "100%"); + // First Page + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='First_20_Page']/attribute::draw:style-name" + "]/style:drawing-page-properties", "background-size", "full"); + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='First_20_Page']/attribute::draw:style-name" + "]/style:drawing-page-properties", "fill", "hatch"); + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='First_20_Page']/attribute::draw:style-name" + "]/style:drawing-page-properties", "fill-hatch-solid", "false"); + assertXPath(pXmlDoc, + "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = " + "/office:document-styles/office:master-styles/style:master-page[@style:name='First_20_Page']/attribute::draw:style-name" + "]/style:drawing-page-properties", "opacity", "100%"); +} + DECLARE_ODFEXPORT_TEST(testCellUserDefineAttr, "userdefattr-tablecell.odt") { CPPUNIT_ASSERT_EQUAL(1, getPages()); diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 61a6e982edb6..e3b40ced6452 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -409,6 +409,7 @@ SfxItemInfo aSlotTab[] = { 0, true }, // RES_FRMATR_CONDITIONAL_STYLE_NAME { 0, true }, // RES_FRMATR_GRABBAG { 0, true }, // RES_TEXT_VERT_ADJUST + { 0, true }, // RES_BACKGROUND_FULL_SIZE { 0, true }, // RES_GRFATR_MIRRORGRF { SID_ATTR_GRAF_CROP, true }, // RES_GRFATR_CROPGRF @@ -612,6 +613,7 @@ void InitCore() aAttrTab[ RES_FRMATR_CONDITIONAL_STYLE_NAME - POOLATTR_BEGIN ] = new SfxStringItem( RES_FRMATR_CONDITIONAL_STYLE_NAME, OUString() ); aAttrTab[ RES_FRMATR_GRABBAG - POOLATTR_BEGIN ] = new SfxGrabBagItem(RES_FRMATR_GRABBAG); aAttrTab[ RES_TEXT_VERT_ADJUST - POOLATTR_BEGIN ] = new SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP,RES_TEXT_VERT_ADJUST); + aAttrTab[ RES_BACKGROUND_FULL_SIZE - POOLATTR_BEGIN ] = new SfxBoolItem(RES_BACKGROUND_FULL_SIZE, true); aAttrTab[ RES_GRFATR_MIRRORGRF- POOLATTR_BEGIN ] = new SwMirrorGrf; aAttrTab[ RES_GRFATR_CROPGRF- POOLATTR_BEGIN ] = new SwCropGrf; diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 9d10e4b45214..a66feb74ee85 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -141,6 +141,7 @@ static void lcl_DescSetAttr( const SwFrameFormat &rSource, SwFrameFormat &rDest, RES_TEXTGRID, RES_TEXTGRID, // [109 RES_FRAMEDIR, RES_FRAMEDIR, // [114 RES_HEADER_FOOTER_EAT_SPACING, RES_HEADER_FOOTER_EAT_SPACING, // [115 + RES_BACKGROUND_FULL_SIZE, RES_BACKGROUND_FULL_SIZE, // [131 RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER, // [143 // take over DrawingLayer FillStyles @@ -181,9 +182,10 @@ static void lcl_DescSetAttr( const SwFrameFormat &rSource, SwFrameFormat &rDest, // When not Page switch(nId) { - // When not Page: All in aIdArr except from RES_COL and RES_PAPER_BIN: + // When not Page: All in aIdArr except these: case RES_COL: case RES_PAPER_BIN: + case RES_BACKGROUND_FULL_SIZE: bExecuteId = false; break; default: diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index d73a58ea38c7..edd2491ad138 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -6340,9 +6340,10 @@ void SwFrame::PaintSwFrameBackground( const SwRect &rRect, const SwPageFrame *pP } else { - if ( bPageFrame ) + if (bPageFrame && GetAttrSet()->GetItem<SfxBoolItem>(RES_BACKGROUND_FULL_SIZE)->GetValue()) { aRect = getFrameArea(); + ::SwAlignRect(aRect, gProp.pSGlobalShell, gProp.pSGlobalShell->GetOut()); } else { @@ -7372,10 +7373,16 @@ bool SwFrame::GetBackgroundBrush( if ( pFrame->IsPageFrame() && pSh->GetViewOptions()->getBrowseMode() ) { rOrigRect = pFrame->getFrameArea(); + ::SwAlignRect(rOrigRect, pSh, pSh->GetOut()); } else { - if ( pFrame->getFrameArea().SSize() != pFrame->getFramePrintArea().SSize() ) + if (pFrame->IsPageFrame() + && pFrame->GetAttrSet()->GetItem<SfxBoolItem>(RES_BACKGROUND_FULL_SIZE)->GetValue()) + { + rOrigRect = pFrame->getFrameArea(); + } + else if (pFrame->getFrameArea().SSize() != pFrame->getFramePrintArea().SSize()) { SwBorderAttrAccess aAccess( SwFrame::GetCache(), pFrame ); const SwBorderAttrs &rAttrs = *aAccess.Get(); diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 2937e5abaa78..10434529b67e 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -544,6 +544,7 @@ void SwFrame::UpdateAttrFrame( const SfxPoolItem *pOld, const SfxPoolItem *pNew, break; case RES_BACKGROUND: + case RES_BACKGROUND_FULL_SIZE: rInvFlags |= 0x28; break; diff --git a/sw/source/core/unocore/unomap1.cxx b/sw/source/core/unocore/unomap1.cxx index 8262630c08b0..572f1f752c61 100644 --- a/sw/source/core/unocore/unomap1.cxx +++ b/sw/source/core/unocore/unomap1.cxx @@ -569,6 +569,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPageStylePropertyMa // and uno types (see loop at end of this method and definition of SW_PROP_NMID) // This entry is for adding that properties to style import/export FILL_PROPERTIES_SW + { u"BackgroundFullSize", RES_BACKGROUND_FULL_SIZE, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0 }, // Added DrawingLayer FillStyle Properties for Header. These need an own unique name, // but reuse the same WhichIDs as the regular fill. The implementation will decide to which diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index f2a414a88955..99939d0b5155 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -902,11 +902,20 @@ void SwDocShell::Edit( rSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapList(), SID_BITMAP_LIST)); rSet.Put(SvxPatternListItem(pDrawModel->GetPatternList(), SID_PATTERN_LIST)); - SfxGrabBagItem aGrabBag(SID_ATTR_CHAR_GRABBAG); + std::optional<SfxGrabBagItem> oGrabBag; + SfxPoolItem const* pItem(nullptr); + if (SfxItemState::SET == rSet.GetItemState(SID_ATTR_CHAR_GRABBAG, true, &pItem)) + { + oGrabBag.emplace(*static_cast<SfxGrabBagItem const*>(pItem)); + } + else + { + oGrabBag.emplace(SID_ATTR_CHAR_GRABBAG); + } bool bGutterAtTop = GetDoc()->getIDocumentSettingAccess().get(DocumentSettingId::GUTTER_AT_TOP); - aGrabBag.GetGrabBag()["GutterAtTop"] <<= bGutterAtTop; - rSet.Put(aGrabBag); + oGrabBag->GetGrabBag()["GutterAtTop"] <<= bGutterAtTop; + rSet.Put(*oGrabBag); } if (!bBasic) diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx index d61e44e3408f..24dc581bac2f 100644 --- a/sw/source/uibase/utlui/uitool.cxx +++ b/sw/source/uibase/utlui/uitool.cxx @@ -271,6 +271,19 @@ void ItemSetToPageDesc( const SfxItemSet& rSet, SwPageDesc& rPageDesc ) SwFrameFormat& rMaster = rPageDesc.GetMaster(); bool bFirstShare = false; + // before SetFormatAttr() in case it contains RES_BACKGROUND_FULL_SIZE + // itself, as it does when called from SwXPageStyle + SfxPoolItem const* pItem(nullptr); + if (SfxItemState::SET == rSet.GetItemState(SID_ATTR_CHAR_GRABBAG, true, &pItem)) + { + SfxGrabBagItem const*const pGrabBag(static_cast<SfxGrabBagItem const*>(pItem)); + bool bValue; + if (pGrabBag->GetGrabBag().find("BackgroundFullSize")->second >>= bValue) + { + rMaster.SetFormatAttr(SfxBoolItem(RES_BACKGROUND_FULL_SIZE, bValue)); + } + } + // Transfer all general frame attributes rMaster.SetFormatAttr(rSet); @@ -296,7 +309,6 @@ void ItemSetToPageDesc( const SfxItemSet& rSet, SwPageDesc& rPageDesc ) rMaster.SetFormatAttr(aSize); } // Evaluate header attributes - const SfxPoolItem* pItem; if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_PAGE_HEADERSET, false, &pItem ) ) { @@ -569,6 +581,19 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet) if(pCol) rSet.Put(SfxStringItem(SID_SWREGISTER_COLLECTION, pCol->GetName())); + std::optional<SfxGrabBagItem> oGrabBag; + SfxPoolItem const* pItem(nullptr); + if (SfxItemState::SET == rSet.GetItemState(SID_ATTR_CHAR_GRABBAG, true, &pItem)) + { + oGrabBag.emplace(*static_cast<SfxGrabBagItem const*>(pItem)); + } + else + { + oGrabBag.emplace(SID_ATTR_CHAR_GRABBAG); + } + oGrabBag->GetGrabBag()["BackgroundFullSize"] <<= + rMaster.GetAttrSet().GetItem<SfxBoolItem>(RES_BACKGROUND_FULL_SIZE)->GetValue(); + rSet.Put(*oGrabBag); } // Set DefaultTabs |