diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2017-11-27 12:28:50 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-11-27 16:32:46 +0100 |
commit | 9c6b114950b36811e5cf2cb5a6a00f5c05053872 (patch) | |
tree | c7c73eff611478e6602b0098f6218cb1752d4aef | |
parent | 375c7fad77b3aaa66116a44eea3e3aa4254c3e84 (diff) |
tdf#108048: update InsertBreak slot to use PageNumberFilled param
Since commit c2ccd20c0fd92bddfff76447754541705e3eb8f3 (tdf#44689),
SwWrtShell::InsertPageBreak takes page number as optional argument.
The FN_INSERT_BREAK_DLG case in SwTextShell::Execute expects third
parameter (FN_PARAM_3) to be boolean flag indicating if page number
is filled. But corresponding sw slot was not updated to that fact.
This prevented macros inserting page breaks with page numbers to be
properly recorded, and one couldn't fix that manually, too, because
the slot didn't expect that extra param (which would be dropped in
TransformParameters).
This adds the boolean parameter named PageNumberFilled to the list
of InsertBreak slot.
Unit test included.
Change-Id: Ibccaece59b0e9848c0b754aa91b6700054b7fe97
Reviewed-on: https://gerrit.libreoffice.org/45319
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 22 | ||||
-rw-r--r-- | sw/sdi/swriter.sdi | 2 |
2 files changed, 23 insertions, 1 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 6bd634596c2f..89ca0a775383 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -287,6 +287,7 @@ public: void testTdf99689TableOfFigures(); void testTdf99689TableOfTables(); void testTdf113790(); + void testTdf108048(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -455,6 +456,7 @@ public: CPPUNIT_TEST(testTdf99689TableOfFigures); CPPUNIT_TEST(testTdf99689TableOfTables); CPPUNIT_TEST(testTdf113790); + CPPUNIT_TEST(testTdf108048); CPPUNIT_TEST_SUITE_END(); private: @@ -5579,6 +5581,26 @@ void SwUiWriterTest::testTdf113790() CPPUNIT_ASSERT(dynamic_cast<SwXTextDocument *>(mxComponent.get())); } +void SwUiWriterTest::testTdf108048() +{ + createDoc(); + + uno::Sequence<beans::PropertyValue> aPropertyValues = comphelper::InitPropertySequence({ + { "Kind", uno::makeAny(sal_Int16(3)) }, + { "TemplateName", uno::makeAny(OUString("Default Style")) }, + { "PageNumber", uno::makeAny(sal_uInt16(6)) }, // Even number to avoid auto-inserted blank page + { "PageNumberFilled", uno::makeAny(true) }, + }); + lcl_dispatchCommand(mxComponent, ".uno:InsertBreak", aPropertyValues); + CPPUNIT_ASSERT_EQUAL(2, getParagraphs()); + CPPUNIT_ASSERT_EQUAL(2, getPages()); + + // The inserted page must have page number set to 6 + uno::Reference<text::XTextRange> xPara = getParagraph(2); + sal_uInt16 nPageNumber = getProperty< sal_uInt16 >(xPara, "PageNumberOffset"); + CPPUNIT_ASSERT_EQUAL(sal_uInt16(6), nPageNumber); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 90aa48538dc7..2f0d5d9ec45a 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -2538,7 +2538,7 @@ SfxVoidItem InsertBookmark FN_INSERT_BOOKMARK ] SfxVoidItem InsertBreak FN_INSERT_BREAK_DLG -(SfxInt16Item Kind FN_INSERT_BREAK_DLG,SfxStringItem TemplateName FN_PARAM_1,SfxUInt16Item PageNumber FN_PARAM_2) +(SfxInt16Item Kind FN_INSERT_BREAK_DLG,SfxStringItem TemplateName FN_PARAM_1,SfxUInt16Item PageNumber FN_PARAM_2,SfxBoolItem PageNumberFilled FN_PARAM_3) [ AutoUpdate = FALSE, FastCall = FALSE, |