tdf#134734 tdf#141059 tdf#122508 cui,sw,xmloff: BackgroundFullSize
* 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>
diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx
index 1a2e8fb..1d92d27 100644
--- a/cui/source/inc/page.hxx
+++ b/cui/source/inc/page.hxx
@@ -125,6 +125,7 @@ private:
std::unique_ptr<weld::ComboBox> m_xRegisterLB;
std::unique_ptr<weld::Label> m_xGutterPositionFT;
std::unique_ptr<weld::ComboBox> m_xGutterPositionLB;
std::unique_ptr<weld::CheckButton> m_xBackgroundFullSizeCB;
std::unique_ptr<weld::Label> m_xInsideLbl;
std::unique_ptr<weld::Label> m_xOutsideLbl;
std::unique_ptr<weld::Label> m_xPrintRangeQueryText;
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index cc3cbcf..53dfe1e 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -179,6 +179,7 @@ SvxPageDescPage::SvxPageDescPage(weld::Container* pPage, weld::DialogController*
, m_xRegisterLB(m_xBuilder->weld_combo_box("comboRegisterStyle"))
, m_xGutterPositionFT(m_xBuilder->weld_label("labelGutterPosition"))
, m_xGutterPositionLB(m_xBuilder->weld_combo_box("comboGutterPosition"))
, m_xBackgroundFullSizeCB(m_xBuilder->weld_check_button("checkBackgroundFullSize"))
// Strings stored in UI
, m_xInsideLbl(m_xBuilder->weld_label("labelInner"))
, m_xOutsideLbl(m_xBuilder->weld_label("labelOuter"))
@@ -382,6 +383,14 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
// Left.
m_xGutterPositionLB->set_active(0);
}
it = rGrabBagItem.GetGrabBag().find("BackgroundFullSize");
bool isBackgroundFullSize{};
if (it != rGrabBagItem.GetGrabBag().end())
{
it->second >>= isBackgroundFullSize;
m_xBackgroundFullSizeCB->set_active(isBackgroundFullSize);
m_xBackgroundFullSizeCB->show();
}
}
// general page data
@@ -563,6 +572,7 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
m_xHorzBox->save_state();
m_xAdaptBox->save_state();
m_xGutterPositionLB->save_value();
m_xBackgroundFullSizeCB->save_state();
CheckMarginEdits( true );
@@ -659,6 +669,12 @@ bool SvxPageDescPage::FillItemSet( SfxItemSet* rSet )
aGrabBagItem.GetGrabBag()["GutterAtTop"] <<= bGutterAtTop;
bModified = true;
}
if (m_xBackgroundFullSizeCB->get_state_changed_from_saved())
{
bool const isBackgroundFullSize(m_xBackgroundFullSizeCB->get_active());
aGrabBagItem.GetGrabBag()["BackgroundFullSize"] <<= isBackgroundFullSize;
bModified = true;
}
if (bModified)
{
diff --git a/cui/uiconfig/ui/pageformatpage.ui b/cui/uiconfig/ui/pageformatpage.ui
index e7aa3f0..9332ebb 100644
--- a/cui/uiconfig/ui/pageformatpage.ui
+++ b/cui/uiconfig/ui/pageformatpage.ui
@@ -706,6 +706,26 @@
<child>
<placeholder/>
</child>
<child>
<object class="GtkCheckButton" id="checkBackgroundFullSize">
<property name="label" translatable="yes" context="pageformatpage|checkBackgroundFullSize">Background covers margins</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="no_show_all">True</property>
<property name="tooltip_text" translatable="yes" context="pageformatpage|checkBackgroundFullSize" comments="xdds">Any background will cover margins of the page as well</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="checkBackgroundFullSize-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="extended_tip|checkBackgroundFullSize">If enabled, then any background will cover the entire page, including margins. If disabled, any background will cover the page only inside the margins.</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">8</property>
</packing>
</child>
</object>
</child>
<child type="label">
diff --git a/offapi/com/sun/star/style/PageProperties.idl b/offapi/com/sun/star/style/PageProperties.idl
index dccd63f..29b561e 100644
--- a/offapi/com/sun/star/style/PageProperties.idl
+++ b/offapi/com/sun/star/style/PageProperties.idl
@@ -494,6 +494,13 @@ published service PageProperties
*/
[optional, property] long GutterMargin;
/** does the background cover the full page or only inside the
margins?
@since LibreOffice 7.2
*/
[optional, property] boolean BackgroundFullSize;
};
}; }; }; };
diff --git a/schema/odf1.3/OpenDocument-schema-v1.3.rng b/schema/odf1.3/OpenDocument-schema-v1.3.rng
index 4b49c3e..6c15e2f 100644
--- a/schema/odf1.3/OpenDocument-schema-v1.3.rng
+++ b/schema/odf1.3/OpenDocument-schema-v1.3.rng
@@ -9655,13 +9655,14 @@
<rng:value>right</rng:value>
<rng:value>top</rng:value>
<rng:value>bottom</rng:value>
<!-- FIXME msv ignores the 2nd list? -->
<rng:list>
<rng:ref name="horiBackPos"/>
<rng:ref name="vertBackPos"/>
<rng:ref name="horiBackPos"/>
</rng:list>
<rng:list>
<rng:ref name="vertBackPos"/>
<rng:ref name="horiBackPos"/>
<rng:ref name="vertBackPos"/>
</rng:list>
</rng:choice>
</rng:attribute>
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index 3971619..cc6b191 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<SwMirrorGrf> RES_GRFATR_MIRRORGRF(RES_GRFATR_BEGIN); // 132
constexpr TypedWhichId<SwCropGrf> RES_GRFATR_CROPGRF(133);
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<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(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<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
new file mode 100644
index 0000000..eb8b4a0
--- /dev/null
+++ b/sw/qa/extras/odfexport/data/pagestyle_background_lo70.odt
Binary files differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 3575578..e307ea6 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 61a6e98..e3b40ce 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 9d10e4b..a66feb7 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 d73a58e..edd2491 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 2937e5a..1043452 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 8262630..572f1f7 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 f2a414a..99939d0 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 d61e44e..24dc581 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
diff --git a/xmloff/source/style/PageMasterExportPropMapper.cxx b/xmloff/source/style/PageMasterExportPropMapper.cxx
index 2f1a5df..4ef4de9 100644
--- a/xmloff/source/style/PageMasterExportPropMapper.cxx
+++ b/xmloff/source/style/PageMasterExportPropMapper.cxx
@@ -24,8 +24,6 @@
#include <comphelper/types.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/table/BorderLine2.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/drawing/BitmapMode.hpp>
#include <PageMasterStyleMap.hxx>
#include <rtl/ref.hxx>
#include <comphelper/extract.hxx>
@@ -331,9 +329,6 @@ void XMLPageMasterExportPropMapper::ContextFilter(
XMLPropertyState* pFooterRepeatOffsetX = nullptr;
XMLPropertyState* pFooterRepeatOffsetY = nullptr;
XMLPropertyState* pFill = nullptr;
XMLPropertyState* pFillBitmapMode = nullptr;
rtl::Reference < XMLPropertySetMapper > aPropMapper(getPropertySetMapper());
// distinguish 2 cases: drawing-page export has CTF_PM_FILL, page-layout-properties export does not
@@ -372,20 +367,6 @@ void XMLPageMasterExportPropMapper::ContextFilter(
switch( nSimpleId )
{
case CTF_PM_FILL: // tdf#103602: add background-size attribute to ODT
if (nFlag != CTF_PM_HEADERFLAG && nFlag != CTF_PM_FOOTERFLAG
&& rProp.maValue.hasValue())
{
pFill = &rProp;
}
break;
case CTF_PM_FILLBITMAPMODE:
if (nFlag != CTF_PM_HEADERFLAG && nFlag != CTF_PM_FOOTERFLAG
&& rProp.maValue.hasValue())
{
pFillBitmapMode = &rProp;
}
break;
case CTF_PM_MARGINALL: pBuffer->pPMMarginAll = pProp; break;
case CTF_PM_BORDERALL: pBuffer->pPMBorderAll = pProp; break;
case CTF_PM_BORDERTOP: pBuffer->pPMBorderTop = pProp; break;
@@ -582,48 +563,6 @@ void XMLPageMasterExportPropMapper::ContextFilter(
lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_ZEROVALUES), "PrintZeroValues", rPropSet);
}
if (pFill)
{ // note: only drawing-page export should write this, because CTF_PM_FILL
uno::Any backgroundSize;
switch (pFill->maValue.get<drawing::FillStyle>())
{
case drawing::FillStyle_NONE:
break;
case drawing::FillStyle_SOLID:
case drawing::FillStyle_GRADIENT:
case drawing::FillStyle_HATCH:
backgroundSize <<= true;
break;
case drawing::FillStyle_BITMAP:
if (pFillBitmapMode)
{
switch (pFillBitmapMode->maValue.get<drawing::BitmapMode>())
{
case drawing::BitmapMode_REPEAT:
backgroundSize <<= true;
break;
case drawing::BitmapMode_STRETCH:
case drawing::BitmapMode_NO_REPEAT:
backgroundSize <<= false;
break;
default:
assert(false);
}
}
// else: leave it ambiguous if not explicitly defined
break;
default:
assert(false);
}
if (backgroundSize.hasValue())
{
auto const nIndex(aPropMapper->FindEntryIndex(CTF_PM_BACKGROUNDSIZE));
assert(0 <= nIndex);
rPropState.emplace_back(nIndex, backgroundSize);
}
}
SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rPropState, rPropSet);
}
diff --git a/xmloff/source/style/PageMasterStyleMap.cxx b/xmloff/source/style/PageMasterStyleMap.cxx
index d7b9f41..754c7d2 100644
--- a/xmloff/source/style/PageMasterStyleMap.cxx
+++ b/xmloff/source/style/PageMasterStyleMap.cxx
@@ -277,8 +277,7 @@ XMLPropertyMapEntry const g_XMLPageMasterDrawingPageStyleMap[] =
// ODF 1.3 OFFICE-3937 style of family "drawing-page" referenced from style:master-page
// duplication of relevant part of aXMLPageMasterStyleMap but as DP type
DPMAP("FillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SW_TYPE_FILLSTYLE, CTF_PM_FILL),
// this does not exist yet!
DPMAP("BackgroundFullSize", XML_NAMESPACE_DRAW, XML_BACKGROUND_SIZE, XML_SW_TYPE_PRESPAGE_BACKSIZE|MID_FLAG_NO_PROPERTY, CTF_PM_BACKGROUNDSIZE),
DPMAP("BackgroundFullSize", XML_NAMESPACE_DRAW, XML_BACKGROUND_SIZE, XML_SW_TYPE_PRESPAGE_BACKSIZE, CTF_PM_BACKGROUNDSIZE),
DPMAP("FillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, 0),
DPMAP("FillColor2", XML_NAMESPACE_DRAW, XML_SECONDARY_FILL_COLOR, XML_TYPE_COLOR, 0),
DPMAP("FillGradientName", XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_PM_FILLGRADIENTNAME),