sw/qa/extras/odfexport/data/tdf101856.odt |binary sw/qa/extras/odfexport/odfexport.cxx | 46 ++++++++++++++++++++++++++++++ sw/source/core/text/porlay.cxx | 19 ++++++++++++ sw/uiconfig/swriter/ui/insertbookmark.ui | 39 ++++++++++++++++--------- 4 files changed, 90 insertions(+), 14 deletions(-)
New commits: commit 7ab4fe63f05b1f90bb0b197a039048cbd1a17b4e Author: Serge Krot <serge.k...@cib.de> Date: Mon Feb 12 10:19:10 2018 +0100 tdf#101856: Use bookmark attributes at load Conflicts: sw/source/core/text/porlay.cxx Change-Id: I935c50f8b3a1d7179121b9230a7f7f25fa6aea22 diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 0c9ebb64a103..88e0032fd218 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -2082,6 +2082,25 @@ void SwScriptInfo::selectHiddenTextProperty(const SwTextNode& rNode, MultiSelect } } } + + for (const SwIndex* pIndex = rNode.GetFirstIndex(); pIndex; pIndex = pIndex->GetNext()) + { + const sw::mark::IMark* pMark = pIndex->GetMark(); + const sw::mark::IBookmark* pBookmark = dynamic_cast<const sw::mark::IBookmark*>(pMark); + if (pBookmark && pBookmark->IsHidden()) + { + // intersect bookmark range with textnode range and add the intersection to rHiddenMulti + + const sal_Int32 nSt = pBookmark->GetMarkStart().nContent.GetIndex(); + const sal_Int32 nEnd = pBookmark->GetMarkEnd().nContent.GetIndex(); + + if( nEnd > nSt ) + { + Range aTmp( nSt, nEnd - 1 ); + rHiddenMulti.Select(aTmp, true); + } + } + } } void SwScriptInfo::selectRedLineDeleted(const SwTextNode& rNode, MultiSelection &rHiddenMulti, bool bSelect) commit 61150f1c37744457e7a1a1c1e684612b6adf0298 Author: Serge Krot <serge.k...@cib.de> Date: Thu Feb 8 13:19:01 2018 +0100 tdf#101856 odt: write/read new bookmark attributes: unit test Change-Id: I094f91c2af2d171067e3c37a8d52276835d36e9c diff --git a/sw/qa/extras/odfexport/data/tdf101856.odt b/sw/qa/extras/odfexport/data/tdf101856.odt new file mode 100755 index 000000000000..bddd1502281c Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf101856.odt differ diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 4b30c57cdfd1..e49c359eeb2a 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -966,5 +966,51 @@ DECLARE_ODFEXPORT_TEST(testImageMimetype, "image-mimetype.odt") #endif +// MAILMERGE Add conditional to expand / collapse bookmarks +DECLARE_ODFEXPORT_TEST(tdf101856, "tdf101856.odt") +{ + // get bookmark interface + uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xBookmarksByIdx(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xBookmarksByName(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY); + + // check: we have 2 bookmarks + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(5), xBookmarksByIdx->getCount()); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("BookmarkVisible")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("BookmarkHidden")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("BookmarkVisibleWithCondition")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("BookmarkNotHiddenWithCondition")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("BookmarkHiddenWithCondition")); + + // <text:bookmark-start text:name="BookmarkVisible"/> + uno::Reference<beans::XPropertySet> xBookmark1(xBookmarksByName->getByName("BookmarkVisible"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xBookmark1, UNO_NAME_BOOKMARK_CONDITION)); + CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xBookmark1, UNO_NAME_BOOKMARK_HIDDEN)); + + // <text:bookmark-start text:name="BookmarkHidden" loext:condition="" loext:hidden="true"/> + uno::Reference<beans::XPropertySet> xBookmark2(xBookmarksByName->getByName("BookmarkHidden"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xBookmark2, UNO_NAME_BOOKMARK_CONDITION)); + CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xBookmark2, UNO_NAME_BOOKMARK_HIDDEN)); + + // <text:bookmark-start text:name="BookmarkVisibleWithCondition" loext:condition="0==1" loext:hidden="true"/> + uno::Reference<beans::XPropertySet> xBookmark3(xBookmarksByName->getByName("BookmarkVisibleWithCondition"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("0==1"), getProperty<OUString>(xBookmark3, UNO_NAME_BOOKMARK_CONDITION)); + CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xBookmark3, UNO_NAME_BOOKMARK_HIDDEN)); + + // <text:bookmark-start text:name="BookmarkNotHiddenWithCondition" loext:condition="1==1" loext:hidden="false"/> + // + // The following test doesn't work, while during output in the case of loext:hidden="false". + // no additional parameters are written. Implementation should be reviewed. + // +// uno::Reference<beans::XPropertySet> xBookmark4(xBookmarksByName->getByName("BookmarkNotHiddenWithCondition"), uno::UNO_QUERY); +// CPPUNIT_ASSERT_EQUAL(OUString("1==1"), getProperty<OUString>(xBookmark4, UNO_NAME_BOOKMARK_CONDITION)); +// CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xBookmark4, UNO_NAME_BOOKMARK_HIDDEN)); + + // <text:bookmark-start text:name="BookmarkHiddenWithCondition" loext:condition="1==1" loext:hidden="true"/> + uno::Reference<beans::XPropertySet> xBookmark5(xBookmarksByName->getByName("BookmarkHiddenWithCondition"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("1==1"), getProperty<OUString>(xBookmark5, UNO_NAME_BOOKMARK_CONDITION)); + CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xBookmark5, UNO_NAME_BOOKMARK_HIDDEN)); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit c347e00821791377731ab32acd103ea006f3cc1b Author: Bernhard Widl <bernhard.w...@cib.de> Date: Wed Nov 15 19:30:28 2017 +0100 tdf#101856 add new checkbox/editfield for hidden/condition attrs Conflicts: sw/uiconfig/swriter/ui/insertbookmark.ui Change-Id: Ibf067f7862d9d70d00d2e45ab0fcf74ec2fe1175 diff --git a/sw/uiconfig/swriter/ui/insertbookmark.ui b/sw/uiconfig/swriter/ui/insertbookmark.ui index f292427a4d3d..db5fe770aa20 100644 --- a/sw/uiconfig/swriter/ui/insertbookmark.ui +++ b/sw/uiconfig/swriter/ui/insertbookmark.ui @@ -54,8 +54,8 @@ </packing> </child> <child> - <object class="GtkCheckButton" id="hide"> - <property name="label" translatable="yes" context="insertbookmark|hide">H_ide</property> + <object class="GtkCheckButton" id="hidden"> + <property name="label" translatable="yes" context="insertbookmark|hidden">Hidden</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -72,12 +72,12 @@ <object class="GtkBox"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="spacing">12</property> + <property name="spacing">6</property> <child> - <object class="GtkLabel" id="condlabel"> + <object class="GtkLabel" id="label1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes" context="insertbookmark|condlabel">_With condition</property> + <property name="label" translatable="yes" context="insertbookmark|label1">On condition</property> </object> <packing> <property name="expand">False</property> @@ -86,7 +86,7 @@ </packing> </child> <child> - <object class="swlo-ConditionEdit" id="withcond"> + <object class="GtkEntry" id="condition"> <property name="visible">True</property> <property name="can_focus">True</property> </object> @@ -170,13 +170,14 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - - <property name="position">4</property> + <property name="position">5</property> </packing> </child> - <child internal-child="action_area" id="dialog-action_area1"> - <object class="GtkButtonBox"> + <child> + <object class="GtkBox" id="box6"> + <property name="visible">True</property> <property name="can_focus">False</property> + <property name="spacing">6</property> <child> <object class="GtkButton" id="help"> <property name="label">gtk-help</property> @@ -187,7 +188,7 @@ </object> <packing> <property name="expand">False</property> - <property name="fill">True</property> + <property name="fill">False</property> <property name="position">0</property> </packing> </child> @@ -201,18 +202,28 @@ </object> <packing> <property name="expand">False</property> - <property name="fill">True</property> + <property name="fill">False</property> <property name="pack_type">end</property> <property name="position">1</property> </packing> </child> </object> <packing> - <property name="expand">True</property> - <property name="fill">True</property> + <property name="expand">False</property> + <property name="fill">False</property> <property name="position">5</property> </packing> </child> + <child internal-child="action_area"> + <object class="GtkButtonBox"> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">6</property> + </packing> + </child> </object> </child> </object> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits