sw/qa/extras/odfexport/odfexport.cxx | 150 ++++--- sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 91 ++-- sw/source/core/access/accmap.cxx | 201 +++++----- sw/source/core/access/accpara.cxx | 49 +- sw/source/core/doc/doc.cxx | 211 +++++------ sw/source/core/doc/docftn.cxx | 222 +++++------ sw/source/core/doc/docredln.cxx | 115 +++--- sw/source/core/doc/tblrwcl.cxx | 91 ++-- sw/source/core/doc/textboxhelper.cxx | 117 +++--- sw/source/core/docnode/ndsect.cxx | 85 ++-- sw/source/core/docnode/ndtbl1.cxx | 403 ++++++++++----------- sw/source/core/edit/autofmt.cxx | 73 +-- sw/source/core/edit/edfcol.cxx | 241 ++++++------ sw/source/core/edit/editsh.cxx | 43 +- sw/source/core/edit/edlingu.cxx | 310 ++++++++-------- sw/source/core/frmedt/fefly1.cxx | 67 +-- sw/source/core/frmedt/feshview.cxx | 202 +++++----- sw/source/core/frmedt/fews.cxx | 215 +++++------ sw/source/core/layout/fly.cxx | 337 ++++++++--------- sw/source/core/layout/pagechg.cxx | 45 +- sw/source/core/layout/paintfrm.cxx | 336 ++++++++--------- sw/source/core/layout/sectfrm.cxx | 428 +++++++++++----------- sw/source/core/layout/virtoutp.cxx | 71 +-- sw/source/core/layout/wsfrm.cxx | 75 +-- sw/source/core/table/swtable.cxx | 332 ++++++++--------- sw/source/core/text/frmpaint.cxx | 334 ++++++++--------- sw/source/core/text/inftxt.cxx | 75 +-- sw/source/core/text/itrform2.cxx | 238 ++++++------ sw/source/core/text/porfld.cxx | 228 ++++++----- sw/source/core/text/portxt.cxx | 55 +- sw/source/core/txtnode/fntcache.cxx | 39 +- sw/source/core/undo/SwUndoPageDesc.cxx | 110 ++--- sw/source/core/unocore/unodraw.cxx | 63 +-- sw/source/core/unocore/unoobj.cxx | 110 ++--- sw/source/core/view/vdraw.cxx | 113 ++--- sw/source/filter/html/htmlatr.cxx | 173 ++++----- sw/source/filter/html/htmltab.cxx | 141 +++---- sw/source/filter/ww8/docxattributeoutput.cxx | 222 +++++------ sw/source/filter/ww8/docxsdrexport.cxx | 85 ++-- sw/source/filter/ww8/rtfattributeoutput.cxx | 95 ++-- sw/source/filter/ww8/wrtw8esh.cxx | 42 +- sw/source/filter/ww8/ww8par2.cxx | 172 ++++----- sw/source/filter/ww8/ww8par5.cxx | 139 +++---- sw/source/filter/xml/xmltble.cxx | 51 +- sw/source/ui/config/optload.cxx | 47 +- sw/source/ui/config/optpage.cxx | 37 - sw/source/ui/dbui/mmaddressblockpage.cxx | 115 +++--- sw/source/ui/dbui/mmresultdialogs.cxx | 53 +- sw/source/ui/dbui/selectdbtabledialog.cxx | 57 +- sw/source/ui/dialog/uiregionsw.cxx | 239 ++++++------ sw/source/ui/envelp/labfmt.cxx | 33 - sw/source/ui/fldui/flddb.cxx | 183 ++++----- sw/source/ui/fldui/flddok.cxx | 365 +++++++++---------- sw/source/ui/fldui/fldfunc.cxx | 285 +++++++------- sw/source/ui/fldui/fldref.cxx | 99 ++--- sw/source/ui/frmdlg/frmpage.cxx | 102 ++--- sw/source/ui/misc/pggrid.cxx | 99 ++--- sw/source/ui/table/tautofmt.cxx | 141 +++---- sw/source/uibase/app/applab.cxx | 403 ++++++++++----------- sw/source/uibase/dialog/regionsw.cxx | 47 +- sw/source/uibase/docvw/AnnotationWin2.cxx | 35 - sw/source/uibase/docvw/edtwin.cxx | 514 +++++++++++++-------------- sw/source/uibase/docvw/srcedtw.cxx | 112 ++--- sw/source/uibase/envelp/labimg.cxx | 43 +- sw/source/uibase/frmdlg/colex.cxx | 167 ++++---- sw/source/uibase/shells/annotsh.cxx | 105 ++--- sw/source/uibase/shells/basesh.cxx | 155 ++++---- sw/source/uibase/shells/drwtxtsh.cxx | 105 ++--- sw/source/uibase/shells/textfld.cxx | 104 ++--- sw/source/uibase/shells/textsh1.cxx | 89 ++-- sw/source/uibase/uiview/view.cxx | 375 +++++++++---------- sw/source/uibase/uiview/view2.cxx | 43 +- sw/source/uibase/utlui/glbltree.cxx | 145 +++---- sw/source/uibase/utlui/numfmtlb.cxx | 348 +++++++++--------- sw/source/uibase/utlui/unotools.cxx | 57 +- 75 files changed, 5901 insertions(+), 5796 deletions(-)
New commits: commit a60ffa6985dec32cc73032a7774f58694a6ee9a7 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Mon Nov 20 09:25:11 2017 +0200 loplugin:flatten in sw Change-Id: I64176f48d90303f078e326c8838da9eb2daf8126 Reviewed-on: https://gerrit.libreoffice.org/44937 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index ed4d67002ffe..60a1ceef489f 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -1561,60 +1561,62 @@ DECLARE_ODFEXPORT_TEST(testTableStyles2, "table_styles_2.odt") DECLARE_ODFEXPORT_TEST(testTableStyles3, "table_styles_3.odt") { // This test checks if default valued attributes aren't exported. - if (xmlDocPtr pXmlDoc = parseExport("styles.xml")) - { - // <style:paragraph-properties> - // For this element the only exported attributes are: "border-left", "border-bottom" - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "background-color"); - // border-left place - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "border-right"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "border-top"); - // border-bottom place - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "padding"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "padding-left"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "padding-right"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "padding-top"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "padding-bottom"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "writing-mode"); - - // <style:paragraph-properties> should be absent, because it has only "text-align" attribute, which shouldn't be exported. - // Assume that style:paragraph-properties and style:text-properties exists. - assertXPathChildren(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']", 2); - - // <style:text-properties> - // For this element the only exported attributes are: "use-window-font-color place", "font-size-asian", "font-name-asian", "font-family-asian", "font-name-complex", "font-family-complex" - // use-window-font-color place - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "text-shadow"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "text-outline"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "text-line-through-style"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "text-line-through-type"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "text-underline-style"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "text-underline-color"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-size"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-weight"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-style"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-name"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-family"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-style-name"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-family-generic"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-pitch"); - // font-size-asian place - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-weight-asian"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-style-asian"); - // font-name-asian place - // font-family-asian place - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-style-name-asian"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-family-generic-asian"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-pitch-asian"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-size-complex"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-weight-complex"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-style-complex"); - // font-name-complex place - // font-family-complex place - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-style-name-complex"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-family-generic-complex"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-pitch-complex"); - } + xmlDocPtr pXmlDoc = parseExport("styles.xml"); + if (!pXmlDoc) + return; + + // <style:paragraph-properties> + // For this element the only exported attributes are: "border-left", "border-bottom" + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "background-color"); + // border-left place + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "border-right"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "border-top"); + // border-bottom place + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "padding"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "padding-left"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "padding-right"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "padding-top"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "padding-bottom"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "writing-mode"); + + // <style:paragraph-properties> should be absent, because it has only "text-align" attribute, which shouldn't be exported. + // Assume that style:paragraph-properties and style:text-properties exists. + assertXPathChildren(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']", 2); + + // <style:text-properties> + // For this element the only exported attributes are: "use-window-font-color place", "font-size-asian", "font-name-asian", "font-family-asian", "font-name-complex", "font-family-complex" + // use-window-font-color place + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "text-shadow"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "text-outline"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "text-line-through-style"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "text-line-through-type"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "text-underline-style"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "text-underline-color"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-size"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-weight"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-style"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-name"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-family"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-style-name"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-family-generic"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-pitch"); + // font-size-asian place + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-weight-asian"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-style-asian"); + // font-name-asian place + // font-family-asian place + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-style-name-asian"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-family-generic-asian"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-pitch-asian"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-size-complex"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-weight-complex"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-style-complex"); + // font-name-complex place + // font-family-complex place + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-style-name-complex"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-family-generic-complex"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-pitch-complex"); + } DECLARE_ODFIMPORT_TEST(testTableStyles4, "table_styles_4.odt") @@ -1633,25 +1635,27 @@ DECLARE_ODFIMPORT_TEST(testTableStyles4, "table_styles_4.odt") DECLARE_ODFEXPORT_TEST(testTableStyles5, "table_styles_5.odt") { // Test if cell styles doesn't have a style:parent-style-name attribute. - if (xmlDocPtr pXmlDoc = parseExport("styles.xml")) - { - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.1']", "parent-style-name"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.2']", "parent-style-name"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.3']", "parent-style-name"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.4']", "parent-style-name"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.5']", "parent-style-name"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.6']", "parent-style-name"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.7']", "parent-style-name"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.8']", "parent-style-name"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.9']", "parent-style-name"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.10']", "parent-style-name"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.11']", "parent-style-name"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.12']", "parent-style-name"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.13']", "parent-style-name"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.14']", "parent-style-name"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.15']", "parent-style-name"); - assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.16']", "parent-style-name"); - } + xmlDocPtr pXmlDoc = parseExport("styles.xml"); + if (!pXmlDoc) + return; + + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.1']", "parent-style-name"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.2']", "parent-style-name"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.3']", "parent-style-name"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.4']", "parent-style-name"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.5']", "parent-style-name"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.6']", "parent-style-name"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.7']", "parent-style-name"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.8']", "parent-style-name"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.9']", "parent-style-name"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.10']", "parent-style-name"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.11']", "parent-style-name"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.12']", "parent-style-name"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.13']", "parent-style-name"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.14']", "parent-style-name"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.15']", "parent-style-name"); + assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.16']", "parent-style-name"); + } DECLARE_ODFEXPORT_TEST(testImageMimetype, "image-mimetype.odt") diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 3dd23fbf5eaf..536eea8c6d07 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -425,21 +425,24 @@ DECLARE_OOXMLEXPORT_TEST(testMsoPosition, "bnc884615-mso-position.docx") CPPUNIT_ASSERT( style3.indexOf( ";mso-position-horizontal-relative:text" ) >= 0 ); CPPUNIT_ASSERT( style3.indexOf( ";mso-position-vertical-relative:text" ) >= 0 ); } - if(xmlDocPtr doc = parseExport("word/header1.xml")) - { - OUString style1 = getXPath(doc, "/w:hdr/w:p/w:r[2]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style"); - CPPUNIT_ASSERT( style1.indexOf( ";width:335.75pt;" ) >= 0 ); - CPPUNIT_ASSERT( style1.indexOf( ";mso-position-horizontal-relative:page" ) >= 0 ); - CPPUNIT_ASSERT( style1.indexOf( ";mso-position-vertical-relative:page" ) >= 0 ); - OUString style2 = getXPath(doc, "/w:hdr/w:p/w:r[3]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style"); - CPPUNIT_ASSERT( style2.indexOf( ";width:138.15pt;" ) >= 0 ); - CPPUNIT_ASSERT( style2.indexOf( ";mso-position-horizontal-relative:page" ) >= 0 ); - CPPUNIT_ASSERT( style2.indexOf( ";mso-position-vertical-relative:page" ) >= 0 ); - OUString style3 = getXPath(doc, "/w:hdr/w:p/w:r[4]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style"); - CPPUNIT_ASSERT( style3.indexOf( ";width:163.8pt;" ) >= 0 ); - CPPUNIT_ASSERT( style3.indexOf( ";mso-position-horizontal-relative:page" ) >= 0 ); - CPPUNIT_ASSERT( style3.indexOf( ";mso-position-vertical-relative:page" ) >= 0 ); - } + + xmlDocPtr doc = parseExport("word/header1.xml"); + if(!doc) + return; + + OUString style1 = getXPath(doc, "/w:hdr/w:p/w:r[2]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style"); + CPPUNIT_ASSERT( style1.indexOf( ";width:335.75pt;" ) >= 0 ); + CPPUNIT_ASSERT( style1.indexOf( ";mso-position-horizontal-relative:page" ) >= 0 ); + CPPUNIT_ASSERT( style1.indexOf( ";mso-position-vertical-relative:page" ) >= 0 ); + OUString style2 = getXPath(doc, "/w:hdr/w:p/w:r[3]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style"); + CPPUNIT_ASSERT( style2.indexOf( ";width:138.15pt;" ) >= 0 ); + CPPUNIT_ASSERT( style2.indexOf( ";mso-position-horizontal-relative:page" ) >= 0 ); + CPPUNIT_ASSERT( style2.indexOf( ";mso-position-vertical-relative:page" ) >= 0 ); + OUString style3 = getXPath(doc, "/w:hdr/w:p/w:r[4]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style"); + CPPUNIT_ASSERT( style3.indexOf( ";width:163.8pt;" ) >= 0 ); + CPPUNIT_ASSERT( style3.indexOf( ";mso-position-horizontal-relative:page" ) >= 0 ); + CPPUNIT_ASSERT( style3.indexOf( ";mso-position-vertical-relative:page" ) >= 0 ); + } DECLARE_OOXMLEXPORT_TEST(testWpsCharColor, "wps-char-color.docx") @@ -651,34 +654,36 @@ DECLARE_OOXMLEXPORT_TEST(testOoxmlNumListZHCN, "numlist-zhcn.odt") DECLARE_OOXMLEXPORT_TEST(testOOxmlOutlineNumberTypes, "outline-number-types.odt") { - if (xmlDocPtr pXmlDoc = parseExport("word/numbering.xml")) - { - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:pStyle", "val", "Heading1"); - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:numFmt", "val", "none"); - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[2]/w:numFmt", "val", "decimalEnclosedCircle"); - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[3]/w:numFmt", "val", "decimal"); // CHARS_GREEK_UPPER_LETTER fallback to decimal - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[4]/w:numFmt", "val", "decimal"); // CHARS_GREEK_LOWER_LETTER fallback to decimal - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[5]/w:numFmt", "val", "arabicAlpha"); - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[6]/w:numFmt", "val", "hindiVowels"); - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[7]/w:numFmt", "val", "thaiLetters"); - - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[1]/w:numFmt", "val", "decimal"); - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[2]/w:numFmt", "val", "decimal"); - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[3]/w:numFmt", "val", "decimal"); - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[4]/w:numFmt", "val", "decimal"); - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[5]/w:numFmt", "val", "decimal"); - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[6]/w:numFmt", "val", "decimal"); - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[7]/w:numFmt", "val", "decimal"); - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[8]/w:numFmt", "val", "decimal"); - - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[3]/w:lvl[1]/w:numFmt", "val", "decimal"); - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[3]/w:lvl[2]/w:numFmt", "val", "decimal"); - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[3]/w:lvl[3]/w:numFmt", "val", "decimal"); - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[3]/w:lvl[4]/w:numFmt", "val", "decimal"); - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[3]/w:lvl[5]/w:numFmt", "val", "decimal"); - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[3]/w:lvl[6]/w:numFmt", "val", "decimal"); - assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[3]/w:lvl[7]/w:numFmt", "val", "decimal"); - } + xmlDocPtr pXmlDoc = parseExport("word/numbering.xml"); + if (!pXmlDoc) + return; + + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:pStyle", "val", "Heading1"); + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:numFmt", "val", "none"); + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[2]/w:numFmt", "val", "decimalEnclosedCircle"); + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[3]/w:numFmt", "val", "decimal"); // CHARS_GREEK_UPPER_LETTER fallback to decimal + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[4]/w:numFmt", "val", "decimal"); // CHARS_GREEK_LOWER_LETTER fallback to decimal + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[5]/w:numFmt", "val", "arabicAlpha"); + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[6]/w:numFmt", "val", "hindiVowels"); + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[7]/w:numFmt", "val", "thaiLetters"); + + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[1]/w:numFmt", "val", "decimal"); + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[2]/w:numFmt", "val", "decimal"); + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[3]/w:numFmt", "val", "decimal"); + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[4]/w:numFmt", "val", "decimal"); + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[5]/w:numFmt", "val", "decimal"); + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[6]/w:numFmt", "val", "decimal"); + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[7]/w:numFmt", "val", "decimal"); + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[8]/w:numFmt", "val", "decimal"); + + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[3]/w:lvl[1]/w:numFmt", "val", "decimal"); + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[3]/w:lvl[2]/w:numFmt", "val", "decimal"); + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[3]/w:lvl[3]/w:numFmt", "val", "decimal"); + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[3]/w:lvl[4]/w:numFmt", "val", "decimal"); + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[3]/w:lvl[5]/w:numFmt", "val", "decimal"); + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[3]/w:lvl[6]/w:numFmt", "val", "decimal"); + assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[3]/w:lvl[7]/w:numFmt", "val", "decimal"); + } DECLARE_OOXMLEXPORT_TEST(testNumParentStyle, "num-parent-style.docx") diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 66a022d49356..98a50e784b5b 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -1438,151 +1438,152 @@ void SwAccessibleMap::DoInvalidateShapeSelection(bool bInvalidateFocusMode /*=fa pShapes = mpShapeMap->Copy( nShapes, pFESh, &pSelShape ); } - if( pShapes ) - { - typedef std::vector< ::rtl::Reference < ::accessibility::AccessibleShape > > VEC_SHAPE; - VEC_SHAPE vecxShapeAdd; - VEC_SHAPE vecxShapeRemove; - int nCountSelectedShape=0; + if( !pShapes ) + return; - vcl::Window *pWin = GetShell()->GetWin(); - bool bFocused = pWin && pWin->HasFocus(); - SwAccessibleObjShape_Impl *pShape = pShapes; - int nShapeCount = nShapes; - while( nShapeCount ) + typedef std::vector< ::rtl::Reference < ::accessibility::AccessibleShape > > VEC_SHAPE; + VEC_SHAPE vecxShapeAdd; + VEC_SHAPE vecxShapeRemove; + int nCountSelectedShape=0; + + vcl::Window *pWin = GetShell()->GetWin(); + bool bFocused = pWin && pWin->HasFocus(); + SwAccessibleObjShape_Impl *pShape = pShapes; + int nShapeCount = nShapes; + while( nShapeCount ) + { + if (pShape->second.is() && IsInSameLevel(pShape->first, pFESh)) { - if (pShape->second.is() && IsInSameLevel(pShape->first, pFESh)) + if( pShape < pSelShape ) { - if( pShape < pSelShape ) + if(pShape->second->ResetState( AccessibleStateType::SELECTED )) { - if(pShape->second->ResetState( AccessibleStateType::SELECTED )) - { - vecxShapeRemove.push_back(pShape->second); - } - pShape->second->ResetState( AccessibleStateType::FOCUSED ); + vecxShapeRemove.push_back(pShape->second); } + pShape->second->ResetState( AccessibleStateType::FOCUSED ); } - --nShapeCount; - ++pShape; } + --nShapeCount; + ++pShape; + } - VEC_SHAPE::iterator vi =vecxShapeRemove.begin(); - for (; vi != vecxShapeRemove.end(); ++vi) + VEC_SHAPE::iterator vi =vecxShapeRemove.begin(); + for (; vi != vecxShapeRemove.end(); ++vi) + { + ::accessibility::AccessibleShape *pAccShape = vi->get(); + if (pAccShape) { - ::accessibility::AccessibleShape *pAccShape = vi->get(); - if (pAccShape) - { - pAccShape->CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE, uno::Any(), uno::Any()); - } + pAccShape->CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE, uno::Any(), uno::Any()); } + } - pShape = pShapes; + pShape = pShapes; - while( nShapes ) + while( nShapes ) + { + if (pShape->second.is() && IsInSameLevel(pShape->first, pFESh)) { - if (pShape->second.is() && IsInSameLevel(pShape->first, pFESh)) + if( pShape >= pSelShape ) { - if( pShape >= pSelShape ) - { - //first fire focus event - if( bFocused && 1 == nSelShapes ) - pShape->second->SetState( AccessibleStateType::FOCUSED ); - else - pShape->second->ResetState( AccessibleStateType::FOCUSED ); + //first fire focus event + if( bFocused && 1 == nSelShapes ) + pShape->second->SetState( AccessibleStateType::FOCUSED ); + else + pShape->second->ResetState( AccessibleStateType::FOCUSED ); - if(pShape->second->SetState( AccessibleStateType::SELECTED )) - { - vecxShapeAdd.push_back(pShape->second); - } - ++nCountSelectedShape; + if(pShape->second->SetState( AccessibleStateType::SELECTED )) + { + vecxShapeAdd.push_back(pShape->second); } + ++nCountSelectedShape; } - - --nShapes; - ++pShape; } - const unsigned int SELECTION_WITH_NUM = 10; - if (vecxShapeAdd.size() > SELECTION_WITH_NUM ) + --nShapes; + ++pShape; + } + + const unsigned int SELECTION_WITH_NUM = 10; + if (vecxShapeAdd.size() > SELECTION_WITH_NUM ) + { + uno::Reference< XAccessible > xDoc = GetDocumentView( ); + SwAccessibleContext * pCont = static_cast<SwAccessibleContext *>(xDoc.get()); + if (pCont) + { + AccessibleEventObject aEvent; + aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN; + pCont->FireAccessibleEvent(aEvent); + } + } + else + { + short nEventID = AccessibleEventId::SELECTION_CHANGED_ADD; + if (nCountSelectedShape <= 1 && vecxShapeAdd.size() == 1 ) { - uno::Reference< XAccessible > xDoc = GetDocumentView( ); - SwAccessibleContext * pCont = static_cast<SwAccessibleContext *>(xDoc.get()); - if (pCont) - { - AccessibleEventObject aEvent; - aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN; - pCont->FireAccessibleEvent(aEvent); - } + nEventID = AccessibleEventId::SELECTION_CHANGED; } - else + vi = vecxShapeAdd.begin(); + for (; vi != vecxShapeAdd.end(); ++vi) { - short nEventID = AccessibleEventId::SELECTION_CHANGED_ADD; - if (nCountSelectedShape <= 1 && vecxShapeAdd.size() == 1 ) - { - nEventID = AccessibleEventId::SELECTION_CHANGED; - } - vi = vecxShapeAdd.begin(); - for (; vi != vecxShapeAdd.end(); ++vi) + ::accessibility::AccessibleShape *pAccShape = vi->get(); + if (pAccShape) { - ::accessibility::AccessibleShape *pAccShape = vi->get(); - if (pAccShape) - { - pAccShape->CommitChange(nEventID, uno::Any(), uno::Any()); - } + pAccShape->CommitChange(nEventID, uno::Any(), uno::Any()); } } + } - vi = vecxShapeAdd.begin(); - for (; vi != vecxShapeAdd.end(); ++vi) + vi = vecxShapeAdd.begin(); + for (; vi != vecxShapeAdd.end(); ++vi) + { + ::accessibility::AccessibleShape *pAccShape = vi->get(); + if (pAccShape) { - ::accessibility::AccessibleShape *pAccShape = vi->get(); - if (pAccShape) + SdrObject *pObj = GetSdrObjectFromXShape(pAccShape->GetXShape()); + SwFrameFormat *pFrameFormat = pObj ? FindFrameFormat( pObj ) : nullptr; + if (pFrameFormat) { - SdrObject *pObj = GetSdrObjectFromXShape(pAccShape->GetXShape()); - SwFrameFormat *pFrameFormat = pObj ? FindFrameFormat( pObj ) : nullptr; - if (pFrameFormat) + const SwFormatAnchor& rAnchor = pFrameFormat->GetAnchor(); + if( rAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR ) { - const SwFormatAnchor& rAnchor = pFrameFormat->GetAnchor(); - if( rAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR ) + uno::Reference< XAccessible > xPara = pAccShape->getAccessibleParent(); + if (xPara.is()) { - uno::Reference< XAccessible > xPara = pAccShape->getAccessibleParent(); - if (xPara.is()) + uno::Reference< XAccessibleContext > xParaContext = xPara->getAccessibleContext(); + if (xParaContext.is() && xParaContext->getAccessibleRole() == AccessibleRole::PARAGRAPH) { - uno::Reference< XAccessibleContext > xParaContext = xPara->getAccessibleContext(); - if (xParaContext.is() && xParaContext->getAccessibleRole() == AccessibleRole::PARAGRAPH) + SwAccessibleParagraph* pAccPara = static_cast< SwAccessibleParagraph *>(xPara.get()); + if (pAccPara) { - SwAccessibleParagraph* pAccPara = static_cast< SwAccessibleParagraph *>(xPara.get()); - if (pAccPara) - { - m_setParaAdd.insert(pAccPara); - } + m_setParaAdd.insert(pAccPara); } } } } } } - vi = vecxShapeRemove.begin(); - for (; vi != vecxShapeRemove.end(); ++vi) + } + vi = vecxShapeRemove.begin(); + for (; vi != vecxShapeRemove.end(); ++vi) + { + ::accessibility::AccessibleShape *pAccShape = vi->get(); + if (pAccShape) { - ::accessibility::AccessibleShape *pAccShape = vi->get(); - if (pAccShape) + uno::Reference< XAccessible > xPara = pAccShape->getAccessibleParent(); + uno::Reference< XAccessibleContext > xParaContext = xPara->getAccessibleContext(); + if (xParaContext.is() && xParaContext->getAccessibleRole() == AccessibleRole::PARAGRAPH) { - uno::Reference< XAccessible > xPara = pAccShape->getAccessibleParent(); - uno::Reference< XAccessibleContext > xParaContext = xPara->getAccessibleContext(); - if (xParaContext.is() && xParaContext->getAccessibleRole() == AccessibleRole::PARAGRAPH) + SwAccessibleParagraph* pAccPara = static_cast< SwAccessibleParagraph *>(xPara.get()); + if (m_setParaAdd.count(pAccPara) == 0 ) { - SwAccessibleParagraph* pAccPara = static_cast< SwAccessibleParagraph *>(xPara.get()); - if (m_setParaAdd.count(pAccPara) == 0 ) - { - m_setParaRemove.insert(pAccPara); - } + m_setParaRemove.insert(pAccPara); } } } - - delete[] pShapes; } + + delete[] pShapes; + } //Marge with DoInvalidateShapeSelection diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 84fded6f5a2c..0d60a9d09af3 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -480,34 +480,35 @@ void SwAccessibleParagraph::InvalidateCursorPos_() } vcl::Window *pWin = GetWindow(); - if( nOld != nNew ) - { - // The cursor's node position is simulated by the focus! - if( pWin && pWin->HasFocus() && -1 == nOld ) - FireStateChangedEvent( AccessibleStateType::FOCUSED, true ); + if( nOld == nNew ) + return; - AccessibleEventObject aEvent; - aEvent.EventId = AccessibleEventId::CARET_CHANGED; - aEvent.OldValue <<= nOld; - aEvent.NewValue <<= nNew; + // The cursor's node position is simulated by the focus! + if( pWin && pWin->HasFocus() && -1 == nOld ) + FireStateChangedEvent( AccessibleStateType::FOCUSED, true ); - FireAccessibleEvent( aEvent ); + AccessibleEventObject aEvent; + aEvent.EventId = AccessibleEventId::CARET_CHANGED; + aEvent.OldValue <<= nOld; + aEvent.NewValue <<= nNew; - if( pWin && pWin->HasFocus() && -1 == nNew ) - FireStateChangedEvent( AccessibleStateType::FOCUSED, false ); - //To send TEXT_SELECTION_CHANGED event - sal_Int32 nStart=0; - sal_Int32 nEnd =0; - bool bCurSelection=GetSelection(nStart,nEnd); - if(m_bLastHasSelection || bCurSelection ) - { - aEvent.EventId = AccessibleEventId::TEXT_SELECTION_CHANGED; - aEvent.OldValue.clear(); - aEvent.NewValue.clear(); - FireAccessibleEvent(aEvent); - } - m_bLastHasSelection =bCurSelection; + FireAccessibleEvent( aEvent ); + + if( pWin && pWin->HasFocus() && -1 == nNew ) + FireStateChangedEvent( AccessibleStateType::FOCUSED, false ); + //To send TEXT_SELECTION_CHANGED event + sal_Int32 nStart=0; + sal_Int32 nEnd =0; + bool bCurSelection=GetSelection(nStart,nEnd); + if(m_bLastHasSelection || bCurSelection ) + { + aEvent.EventId = AccessibleEventId::TEXT_SELECTION_CHANGED; + aEvent.OldValue.clear(); + aEvent.NewValue.clear(); + FireAccessibleEvent(aEvent); } + m_bLastHasSelection =bCurSelection; + } void SwAccessibleParagraph::InvalidateFocus_() diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index d0c0839ec0ae..2d45bac285f0 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -777,131 +777,132 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( && "print post-its without post-it data?"); const SetGetExpFields::size_type nPostItCount = rData.HasPostItData() ? rData.m_pPostItFields->size() : 0; - if (nPostItMode != SwPostItMode::NONE && nPostItCount > 0) + if (nPostItMode == SwPostItMode::NONE || nPostItCount <= 0) + return; + + SET_CURR_SHELL( rData.m_pPostItShell.get() ); + + // clear document and move to end of it + SwDoc & rPostItDoc(*rData.m_pPostItShell->GetDoc()); + SwPaM aPam(rPostItDoc.GetNodes().GetEndOfContent()); + aPam.Move( fnMoveBackward, GoInDoc ); + aPam.SetMark(); + aPam.Move( fnMoveForward, GoInDoc ); + rPostItDoc.getIDocumentContentOperations().DeleteRange( aPam ); + + const StringRangeEnumerator aRangeEnum( rData.GetPageRange(), 1, nDocPageCount, 0 ); + + // For mode SwPostItMode::EndPage: + // maps a physical page number to the page number in post-it document that holds + // the first post-it for that physical page . Needed to relate the correct start frames + // from the post-it doc to the physical page of the document + std::map< sal_Int32, sal_Int32 > aPostItLastStartPageNum; + + // add all post-its on valid pages within the page range to the + // temporary post-it document. + // Since the array of post-it fields is sorted by page and line number we will + // already get them in the correct order + sal_uInt16 nVirtPg = 0, nLineNo = 0, nLastPageNum = 0, nPhyPageNum = 0; + bool bIsFirstPostIt = true; + for (SetGetExpFields::size_type i = 0; i < nPostItCount; ++i) { - SET_CURR_SHELL( rData.m_pPostItShell.get() ); - - // clear document and move to end of it - SwDoc & rPostItDoc(*rData.m_pPostItShell->GetDoc()); - SwPaM aPam(rPostItDoc.GetNodes().GetEndOfContent()); - aPam.Move( fnMoveBackward, GoInDoc ); - aPam.SetMark(); - aPam.Move( fnMoveForward, GoInDoc ); - rPostItDoc.getIDocumentContentOperations().DeleteRange( aPam ); - - const StringRangeEnumerator aRangeEnum( rData.GetPageRange(), 1, nDocPageCount, 0 ); - - // For mode SwPostItMode::EndPage: - // maps a physical page number to the page number in post-it document that holds - // the first post-it for that physical page . Needed to relate the correct start frames - // from the post-it doc to the physical page of the document - std::map< sal_Int32, sal_Int32 > aPostItLastStartPageNum; - - // add all post-its on valid pages within the page range to the - // temporary post-it document. - // Since the array of post-it fields is sorted by page and line number we will - // already get them in the correct order - sal_uInt16 nVirtPg = 0, nLineNo = 0, nLastPageNum = 0, nPhyPageNum = 0; - bool bIsFirstPostIt = true; - for (SetGetExpFields::size_type i = 0; i < nPostItCount; ++i) + PostItField_& rPostIt = static_cast<PostItField_&>(*(*rData.m_pPostItFields)[ i ]); + nLastPageNum = nPhyPageNum; + nPhyPageNum = rPostIt.GetPageNo( + aRangeEnum, rData.GetValidPagesSet(), nVirtPg, nLineNo ); + if (nPhyPageNum) { - PostItField_& rPostIt = static_cast<PostItField_&>(*(*rData.m_pPostItFields)[ i ]); - nLastPageNum = nPhyPageNum; - nPhyPageNum = rPostIt.GetPageNo( - aRangeEnum, rData.GetValidPagesSet(), nVirtPg, nLineNo ); - if (nPhyPageNum) - { - // need to insert a page break? - // In SwPostItMode::EndPage mode for each document page the following - // post-it page needs to start on a new page - const bool bNewPage = nPostItMode == SwPostItMode::EndPage && - !bIsFirstPostIt && nPhyPageNum != nLastPageNum; + // need to insert a page break? + // In SwPostItMode::EndPage mode for each document page the following + // post-it page needs to start on a new page + const bool bNewPage = nPostItMode == SwPostItMode::EndPage && + !bIsFirstPostIt && nPhyPageNum != nLastPageNum; - lcl_FormatPostIt( &rData.m_pPostItShell->GetDoc()->getIDocumentContentOperations(), aPam, - rPostIt.GetPostIt(), bNewPage, bIsFirstPostIt, nVirtPg, nLineNo ); - bIsFirstPostIt = false; + lcl_FormatPostIt( &rData.m_pPostItShell->GetDoc()->getIDocumentContentOperations(), aPam, + rPostIt.GetPostIt(), bNewPage, bIsFirstPostIt, nVirtPg, nLineNo ); + bIsFirstPostIt = false; - if (nPostItMode == SwPostItMode::EndPage) - { - // get the correct number of current pages for the post-it document - rData.m_pPostItShell->CalcLayout(); - const sal_Int32 nPages = rData.m_pPostItShell->GetPageCount(); - aPostItLastStartPageNum[ nPhyPageNum ] = nPages; - } + if (nPostItMode == SwPostItMode::EndPage) + { + // get the correct number of current pages for the post-it document + rData.m_pPostItShell->CalcLayout(); + const sal_Int32 nPages = rData.m_pPostItShell->GetPageCount(); + aPostItLastStartPageNum[ nPhyPageNum ] = nPages; } } + } - // format post-it doc to get correct number of pages - rData.m_pPostItShell->CalcLayout(); + // format post-it doc to get correct number of pages + rData.m_pPostItShell->CalcLayout(); - SwRootFrame* pPostItRoot = rData.m_pPostItShell->GetLayout(); - //tdf#103313 print dialog maxes out cpu as Idles never get to - //complete this postitshell's desire to complete formatting - pPostItRoot->ResetIdleFormat(); + SwRootFrame* pPostItRoot = rData.m_pPostItShell->GetLayout(); + //tdf#103313 print dialog maxes out cpu as Idles never get to + //complete this postitshell's desire to complete formatting + pPostItRoot->ResetIdleFormat(); - const sal_Int32 nPostItDocPageCount = rData.m_pPostItShell->GetPageCount(); + const sal_Int32 nPostItDocPageCount = rData.m_pPostItShell->GetPageCount(); - if (nPostItMode == SwPostItMode::Only || nPostItMode == SwPostItMode::EndDoc) - { - // now add those post-it pages to the vector of pages to print - // or replace them if only post-its should be printed + if (nPostItMode == SwPostItMode::Only || nPostItMode == SwPostItMode::EndDoc) + { + // now add those post-it pages to the vector of pages to print + // or replace them if only post-its should be printed - if (nPostItMode == SwPostItMode::Only) - { - // no document page to be printed - rData.GetPagesToPrint().clear(); - } + if (nPostItMode == SwPostItMode::Only) + { + // no document page to be printed + rData.GetPagesToPrint().clear(); + } - // now we just need to add the post-it pages to be printed to the - // end of the vector of pages to print - sal_Int32 nPageNum = 0; - const SwPageFrame * pPageFrame = static_cast<SwPageFrame*>(pPostItRoot->Lower()); - while( pPageFrame && nPageNum < nPostItDocPageCount ) - { - ++nPageNum; - // negative page number indicates page is from the post-it doc - rData.GetPagesToPrint().push_back( -nPageNum ); - pPageFrame = static_cast<const SwPageFrame*>(pPageFrame->GetNext()); - } - OSL_ENSURE( nPageNum == nPostItDocPageCount, "unexpected number of pages" ); + // now we just need to add the post-it pages to be printed to the + // end of the vector of pages to print + sal_Int32 nPageNum = 0; + const SwPageFrame * pPageFrame = static_cast<SwPageFrame*>(pPostItRoot->Lower()); + while( pPageFrame && nPageNum < nPostItDocPageCount ) + { + ++nPageNum; + // negative page number indicates page is from the post-it doc + rData.GetPagesToPrint().push_back( -nPageNum ); + pPageFrame = static_cast<const SwPageFrame*>(pPageFrame->GetNext()); } - else if (nPostItMode == SwPostItMode::EndPage) + OSL_ENSURE( nPageNum == nPostItDocPageCount, "unexpected number of pages" ); + } + else if (nPostItMode == SwPostItMode::EndPage) + { + // the next step is to find all the pages from the post-it + // document that should be printed for a given physical page + // of the document + + std::vector< sal_Int32 > aTmpPagesToPrint; + sal_Int32 nLastPostItPage(0); + const size_t nNum = rData.GetPagesToPrint().size(); + for (size_t i = 0 ; i < nNum; ++i) { - // the next step is to find all the pages from the post-it - // document that should be printed for a given physical page - // of the document - - std::vector< sal_Int32 > aTmpPagesToPrint; - sal_Int32 nLastPostItPage(0); - const size_t nNum = rData.GetPagesToPrint().size(); - for (size_t i = 0 ; i < nNum; ++i) + // add the physical page to print from the document + const sal_Int32 nPhysPage = rData.GetPagesToPrint()[i]; + aTmpPagesToPrint.push_back( nPhysPage ); + + // add the post-it document pages to print, i.e those + // post-it pages that have the data for the above physical page + std::map<sal_Int32, sal_Int32>::const_iterator const iter( + aPostItLastStartPageNum.find(nPhysPage)); + if (iter != aPostItLastStartPageNum.end()) { - // add the physical page to print from the document - const sal_Int32 nPhysPage = rData.GetPagesToPrint()[i]; - aTmpPagesToPrint.push_back( nPhysPage ); - - // add the post-it document pages to print, i.e those - // post-it pages that have the data for the above physical page - std::map<sal_Int32, sal_Int32>::const_iterator const iter( - aPostItLastStartPageNum.find(nPhysPage)); - if (iter != aPostItLastStartPageNum.end()) + for (sal_Int32 j = nLastPostItPage + 1; + j <= iter->second; ++j) { - for (sal_Int32 j = nLastPostItPage + 1; - j <= iter->second; ++j) - { - // negative page number indicates page is from the - aTmpPagesToPrint.push_back(-j); // post-it document - } - nLastPostItPage = iter->second; + // negative page number indicates page is from the + aTmpPagesToPrint.push_back(-j); // post-it document } + nLastPostItPage = iter->second; } - - // finally we need to assign those vectors to the resulting ones. - // swapping the data should be more efficient than assigning since - // we won't need the temporary vectors anymore - rData.GetPagesToPrint().swap( aTmpPagesToPrint ); } + + // finally we need to assign those vectors to the resulting ones. + // swapping the data should be more efficient than assigning since + // we won't need the temporary vectors anymore + rData.GetPagesToPrint().swap( aTmpPagesToPrint ); } + } void SwDoc::CalculatePagePairsForProspectPrinting( diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx index afafe83ac769..3e333adcdecc 100644 --- a/sw/source/core/doc/docftn.cxx +++ b/sw/source/core/doc/docftn.cxx @@ -251,111 +251,43 @@ SwFootnoteInfo::SwFootnoteInfo() : void SwDoc::SetFootnoteInfo(const SwFootnoteInfo& rInfo) { SwRootFrame* pTmpRoot = getIDocumentLayoutAccess().GetCurrentLayout(); - if( !(GetFootnoteInfo() == rInfo) ) - { - const SwFootnoteInfo &rOld = GetFootnoteInfo(); + if( GetFootnoteInfo() == rInfo ) + return; - if (GetIDocumentUndoRedo().DoesUndo()) - { - GetIDocumentUndoRedo().AppendUndo( new SwUndoFootNoteInfo(rOld, this) ); - } + const SwFootnoteInfo &rOld = GetFootnoteInfo(); - bool bFootnotePos = rInfo.ePos != rOld.ePos; - bool bFootnoteDesc = rOld.ePos == FTNPOS_CHAPTER && - rInfo.GetPageDesc( *this ) != rOld.GetPageDesc( *this ); - bool bExtra = rInfo.aQuoVadis != rOld.aQuoVadis || - rInfo.aErgoSum != rOld.aErgoSum || - rInfo.aFormat.GetNumberingType() != rOld.aFormat.GetNumberingType() || - rInfo.GetPrefix() != rOld.GetPrefix() || - rInfo.GetSuffix() != rOld.GetSuffix(); - SwCharFormat *pOldChrFormat = rOld.GetCharFormat( *this ), - *pNewChrFormat = rInfo.GetCharFormat( *this ); - bool bFootnoteChrFormats = pOldChrFormat != pNewChrFormat; - - *mpFootnoteInfo = rInfo; - - if (pTmpRoot) - { - std::set<SwRootFrame*> aAllLayouts = GetAllLayouts(); - if ( bFootnotePos ) - for( auto aLayout : aAllLayouts ) - aLayout->AllRemoveFootnotes(); - else - { - for( auto aLayout : aAllLayouts ) - aLayout->UpdateFootnoteNums(); - if ( bFootnoteDesc ) - for( auto aLayout : aAllLayouts ) - aLayout->CheckFootnotePageDescs(false); - if ( bExtra ) - { - // For messages regarding ErgoSum etc. we save the extra code and use the - // available methods. - SwFootnoteIdxs& rFootnoteIdxs = GetFootnoteIdxs(); - for( size_t nPos = 0; nPos < rFootnoteIdxs.size(); ++nPos ) - { - SwTextFootnote *pTextFootnote = rFootnoteIdxs[ nPos ]; - const SwFormatFootnote &rFootnote = pTextFootnote->GetFootnote(); - if ( !rFootnote.IsEndNote() ) - pTextFootnote->SetNumber(rFootnote.GetNumber(), rFootnote.GetNumStr()); - } - } - } - } - if( FTNNUM_PAGE != rInfo.eNum ) - GetFootnoteIdxs().UpdateAllFootnote(); - else if( bFootnoteChrFormats ) - { - SwFormatChg aOld( pOldChrFormat ); - SwFormatChg aNew( pNewChrFormat ); - mpFootnoteInfo->ModifyNotification( &aOld, &aNew ); - } - - // #i81002# no update during loading - if ( !IsInReading() ) - { - getIDocumentFieldsAccess().UpdateRefFields(); - } - getIDocumentState().SetModified(); + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().AppendUndo( new SwUndoFootNoteInfo(rOld, this) ); } -} -void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo) -{ - SwRootFrame* pTmpRoot = getIDocumentLayoutAccess().GetCurrentLayout(); - if( !(GetEndNoteInfo() == rInfo) ) + bool bFootnotePos = rInfo.ePos != rOld.ePos; + bool bFootnoteDesc = rOld.ePos == FTNPOS_CHAPTER && + rInfo.GetPageDesc( *this ) != rOld.GetPageDesc( *this ); + bool bExtra = rInfo.aQuoVadis != rOld.aQuoVadis || + rInfo.aErgoSum != rOld.aErgoSum || + rInfo.aFormat.GetNumberingType() != rOld.aFormat.GetNumberingType() || + rInfo.GetPrefix() != rOld.GetPrefix() || + rInfo.GetSuffix() != rOld.GetSuffix(); + SwCharFormat *pOldChrFormat = rOld.GetCharFormat( *this ), + *pNewChrFormat = rInfo.GetCharFormat( *this ); + bool bFootnoteChrFormats = pOldChrFormat != pNewChrFormat; + + *mpFootnoteInfo = rInfo; + + if (pTmpRoot) { - if(GetIDocumentUndoRedo().DoesUndo()) - { - SwUndo *const pUndo( new SwUndoEndNoteInfo( GetEndNoteInfo(), this ) ); - GetIDocumentUndoRedo().AppendUndo(pUndo); - } - - bool bNumChg = rInfo.nFootnoteOffset != GetEndNoteInfo().nFootnoteOffset; - // this seems to be an optimization: UpdateAllFootnote() is only called - // if the offset changes; if the offset is the same, - // but type/prefix/suffix changes, just set new numbers. - bool const bExtra = !bNumChg && - ( (rInfo.aFormat.GetNumberingType() != - GetEndNoteInfo().aFormat.GetNumberingType()) - || (rInfo.GetPrefix() != GetEndNoteInfo().GetPrefix()) - || (rInfo.GetSuffix() != GetEndNoteInfo().GetSuffix()) - ); - bool bFootnoteDesc = rInfo.GetPageDesc( *this ) != - GetEndNoteInfo().GetPageDesc( *this ); - SwCharFormat *pOldChrFormat = GetEndNoteInfo().GetCharFormat( *this ), - *pNewChrFormat = rInfo.GetCharFormat( *this ); - bool bFootnoteChrFormats = pOldChrFormat != pNewChrFormat; - - *mpEndNoteInfo = rInfo; - - if ( pTmpRoot ) + std::set<SwRootFrame*> aAllLayouts = GetAllLayouts(); + if ( bFootnotePos ) + for( auto aLayout : aAllLayouts ) + aLayout->AllRemoveFootnotes(); + else { + for( auto aLayout : aAllLayouts ) + aLayout->UpdateFootnoteNums(); if ( bFootnoteDesc ) - { - for( auto aLayout : GetAllLayouts() ) - aLayout->CheckFootnotePageDescs(true); - } + for( auto aLayout : aAllLayouts ) + aLayout->CheckFootnotePageDescs(false); if ( bExtra ) { // For messages regarding ErgoSum etc. we save the extra code and use the @@ -365,27 +297,97 @@ void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo) { SwTextFootnote *pTextFootnote = rFootnoteIdxs[ nPos ]; const SwFormatFootnote &rFootnote = pTextFootnote->GetFootnote(); - if ( rFootnote.IsEndNote() ) + if ( !rFootnote.IsEndNote() ) pTextFootnote->SetNumber(rFootnote.GetNumber(), rFootnote.GetNumStr()); } } } - if( bNumChg ) - GetFootnoteIdxs().UpdateAllFootnote(); - else if( bFootnoteChrFormats ) + } + if( FTNNUM_PAGE != rInfo.eNum ) + GetFootnoteIdxs().UpdateAllFootnote(); + else if( bFootnoteChrFormats ) + { + SwFormatChg aOld( pOldChrFormat ); + SwFormatChg aNew( pNewChrFormat ); + mpFootnoteInfo->ModifyNotification( &aOld, &aNew ); + } + + // #i81002# no update during loading + if ( !IsInReading() ) + { + getIDocumentFieldsAccess().UpdateRefFields(); + } + getIDocumentState().SetModified(); + +} + +void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo) +{ + SwRootFrame* pTmpRoot = getIDocumentLayoutAccess().GetCurrentLayout(); + if( GetEndNoteInfo() == rInfo ) + return; + + if(GetIDocumentUndoRedo().DoesUndo()) + { + SwUndo *const pUndo( new SwUndoEndNoteInfo( GetEndNoteInfo(), this ) ); + GetIDocumentUndoRedo().AppendUndo(pUndo); + } + + bool bNumChg = rInfo.nFootnoteOffset != GetEndNoteInfo().nFootnoteOffset; + // this seems to be an optimization: UpdateAllFootnote() is only called + // if the offset changes; if the offset is the same, + // but type/prefix/suffix changes, just set new numbers. + bool const bExtra = !bNumChg && + ( (rInfo.aFormat.GetNumberingType() != + GetEndNoteInfo().aFormat.GetNumberingType()) + || (rInfo.GetPrefix() != GetEndNoteInfo().GetPrefix()) + || (rInfo.GetSuffix() != GetEndNoteInfo().GetSuffix()) + ); + bool bFootnoteDesc = rInfo.GetPageDesc( *this ) != + GetEndNoteInfo().GetPageDesc( *this ); + SwCharFormat *pOldChrFormat = GetEndNoteInfo().GetCharFormat( *this ), + *pNewChrFormat = rInfo.GetCharFormat( *this ); + bool bFootnoteChrFormats = pOldChrFormat != pNewChrFormat; + + *mpEndNoteInfo = rInfo; + + if ( pTmpRoot ) + { + if ( bFootnoteDesc ) { - SwFormatChg aOld( pOldChrFormat ); - SwFormatChg aNew( pNewChrFormat ); - mpEndNoteInfo->ModifyNotification( &aOld, &aNew ); + for( auto aLayout : GetAllLayouts() ) + aLayout->CheckFootnotePageDescs(true); } - - // #i81002# no update during loading - if ( !IsInReading() ) + if ( bExtra ) { - getIDocumentFieldsAccess().UpdateRefFields(); + // For messages regarding ErgoSum etc. we save the extra code and use the + // available methods. + SwFootnoteIdxs& rFootnoteIdxs = GetFootnoteIdxs(); + for( size_t nPos = 0; nPos < rFootnoteIdxs.size(); ++nPos ) + { + SwTextFootnote *pTextFootnote = rFootnoteIdxs[ nPos ]; + const SwFormatFootnote &rFootnote = pTextFootnote->GetFootnote(); + if ( rFootnote.IsEndNote() ) + pTextFootnote->SetNumber(rFootnote.GetNumber(), rFootnote.GetNumStr()); + } } - getIDocumentState().SetModified(); } + if( bNumChg ) + GetFootnoteIdxs().UpdateAllFootnote(); + else if( bFootnoteChrFormats ) + { + SwFormatChg aOld( pOldChrFormat ); + SwFormatChg aNew( pNewChrFormat ); + mpEndNoteInfo->ModifyNotification( &aOld, &aNew ); + } + + // #i81002# no update during loading + if ( !IsInReading() ) + { + getIDocumentFieldsAccess().UpdateRefFields(); + } + getIDocumentState().SetModified(); + } bool SwDoc::SetCurFootnote( const SwPaM& rPam, const OUString& rNumStr, diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 347c8cc8c91f..7644a107200e 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -1364,78 +1364,79 @@ void SwRangeRedline::MoveToSection() void SwRangeRedline::CopyToSection() { - if( !pContentSect ) - { - const SwPosition* pStt = Start(), - * pEnd = pStt == GetPoint() ? GetMark() : GetPoint(); + if( pContentSect ) + return; - SwContentNode* pCSttNd = pStt->nNode.GetNode().GetContentNode(); - SwContentNode* pCEndNd = pEnd->nNode.GetNode().GetContentNode(); + const SwPosition* pStt = Start(), + * pEnd = pStt == GetPoint() ? GetMark() : GetPoint(); - SwStartNode* pSttNd; - SwDoc* pDoc = GetDoc(); - SwNodes& rNds = pDoc->GetNodes(); + SwContentNode* pCSttNd = pStt->nNode.GetNode().GetContentNode(); + SwContentNode* pCEndNd = pEnd->nNode.GetNode().GetContentNode(); - bool bSaveCopyFlag = pDoc->IsCopyIsMove(), - bSaveRdlMoveFlg = pDoc->getIDocumentRedlineAccess().IsRedlineMove(); - pDoc->SetCopyIsMove( true ); + SwStartNode* pSttNd; + SwDoc* pDoc = GetDoc(); + SwNodes& rNds = pDoc->GetNodes(); - // The IsRedlineMove() flag causes the behaviour of the - // SwDoc::_CopyFlyInFly method to change, which will eventually be - // called by the pDoc->Copy line below (through SwDoc::Copy_, - // SwDoc::CopyWithFlyInFly). This rather obscure bugfix - // apparently never really worked. - pDoc->getIDocumentRedlineAccess().SetRedlineMove( pStt->nContent == 0 ); + bool bSaveCopyFlag = pDoc->IsCopyIsMove(), + bSaveRdlMoveFlg = pDoc->getIDocumentRedlineAccess().IsRedlineMove(); + pDoc->SetCopyIsMove( true ); - if( pCSttNd ) - { - SwTextFormatColl* pColl = (pCSttNd && pCSttNd->IsTextNode() ) - ? pCSttNd->GetTextNode()->GetTextColl() - : pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD); + // The IsRedlineMove() flag causes the behaviour of the + // SwDoc::_CopyFlyInFly method to change, which will eventually be + // called by the pDoc->Copy line below (through SwDoc::Copy_, + // SwDoc::CopyWithFlyInFly). This rather obscure bugfix + // apparently never really worked. + pDoc->getIDocumentRedlineAccess().SetRedlineMove( pStt->nContent == 0 ); - pSttNd = rNds.MakeTextSection( SwNodeIndex( rNds.GetEndOfRedlines() ), - SwNormalStartNode, pColl ); + if( pCSttNd ) + { + SwTextFormatColl* pColl = (pCSttNd && pCSttNd->IsTextNode() ) + ? pCSttNd->GetTextNode()->GetTextColl() + : pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD); - SwNodeIndex aNdIdx( *pSttNd, 1 ); - SwTextNode* pTextNd = aNdIdx.GetNode().GetTextNode(); - SwPosition aPos( aNdIdx, SwIndex( pTextNd )); - pDoc->getIDocumentContentOperations().CopyRange( *this, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true ); + pSttNd = rNds.MakeTextSection( SwNodeIndex( rNds.GetEndOfRedlines() ), + SwNormalStartNode, pColl ); - // Take over the style from the EndNode if needed - // We don't want this in Doc::Copy - if( pCEndNd && pCEndNd != pCSttNd ) + SwNodeIndex aNdIdx( *pSttNd, 1 ); + SwTextNode* pTextNd = aNdIdx.GetNode().GetTextNode(); + SwPosition aPos( aNdIdx, SwIndex( pTextNd )); + pDoc->getIDocumentContentOperations().CopyRange( *this, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true ); + + // Take over the style from the EndNode if needed + // We don't want this in Doc::Copy + if( pCEndNd && pCEndNd != pCSttNd ) + { + SwContentNode* pDestNd = aPos.nNode.GetNode().GetContentNode(); + if( pDestNd ) { - SwContentNode* pDestNd = aPos.nNode.GetNode().GetContentNode(); - if( pDestNd ) - { - if( pDestNd->IsTextNode() && pCEndNd->IsTextNode() ) - pCEndNd->GetTextNode()->CopyCollFormat(*pDestNd->GetTextNode()); - else - pDestNd->ChgFormatColl( pCEndNd->GetFormatColl() ); - } + if( pDestNd->IsTextNode() && pCEndNd->IsTextNode() ) + pCEndNd->GetTextNode()->CopyCollFormat(*pDestNd->GetTextNode()); + else + pDestNd->ChgFormatColl( pCEndNd->GetFormatColl() ); } } + } + else + { + pSttNd = SwNodes::MakeEmptySection( SwNodeIndex( rNds.GetEndOfRedlines() ) ); + + if( pCEndNd ) + { + SwPosition aPos( *pSttNd->EndOfSectionNode() ); + pDoc->getIDocumentContentOperations().CopyRange( *this, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true ); + } else { - pSttNd = SwNodes::MakeEmptySection( SwNodeIndex( rNds.GetEndOfRedlines() ) ); - - if( pCEndNd ) - { - SwPosition aPos( *pSttNd->EndOfSectionNode() ); - pDoc->getIDocumentContentOperations().CopyRange( *this, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true ); - } - else - { - SwNodeIndex aInsPos( *pSttNd->EndOfSectionNode() ); - SwNodeRange aRg( pStt->nNode, 0, pEnd->nNode, 1 ); - pDoc->GetDocumentContentOperationsManager().CopyWithFlyInFly( aRg, 0, aInsPos ); - } + SwNodeIndex aInsPos( *pSttNd->EndOfSectionNode() ); + SwNodeRange aRg( pStt->nNode, 0, pEnd->nNode, 1 ); + pDoc->GetDocumentContentOperationsManager().CopyWithFlyInFly( aRg, 0, aInsPos ); } - pContentSect = new SwNodeIndex( *pSttNd ); - - pDoc->SetCopyIsMove( bSaveCopyFlag ); - pDoc->getIDocumentRedlineAccess().SetRedlineMove( bSaveRdlMoveFlg ); } + pContentSect = new SwNodeIndex( *pSttNd ); + + pDoc->SetCopyIsMove( bSaveCopyFlag ); + pDoc->getIDocumentRedlineAccess().SetRedlineMove( bSaveRdlMoveFlg ); + } void SwRangeRedline::DelCopyOfSection(size_t nMyPos) diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 626bf644a6bc..6ce5831ff6de 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -901,61 +901,62 @@ lcl_SaveUpperLowerBorder( SwTable& rTable, const SwTableBox& rBox, const SvxBoxItem& rBoxItem = rBox.GetFrameFormat()->GetBox(); // then the top/bottom edges - if( rBoxItem.GetTop() || rBoxItem.GetBottom() ) - { - bool bChgd = false; - const SwTableLines* pTableLns; - if( pUpperBox ) - pTableLns = &pUpperBox->GetTabLines(); - else - pTableLns = &rTable.GetTabLines(); + if( !rBoxItem.GetTop() && !rBoxItem.GetBottom() ) + return; + + bool bChgd = false; + const SwTableLines* pTableLns; + if( pUpperBox ) + pTableLns = &pUpperBox->GetTabLines(); + else + pTableLns = &rTable.GetTabLines(); - sal_uInt16 nLnPos = pTableLns->GetPos( pLine ); + sal_uInt16 nLnPos = pTableLns->GetPos( pLine ); - // Calculate the attribute position of the top-be-deleted Box and then - // search in the top/bottom Line of the respective counterparts. - SwTwips nBoxStt = 0; - for( sal_uInt16 n = 0; n < nDelPos; ++n ) - nBoxStt += rTableBoxes[ n ]->GetFrameFormat()->GetFrameSize().GetWidth(); - SwTwips nBoxWidth = rBox.GetFrameFormat()->GetFrameSize().GetWidth(); + // Calculate the attribute position of the top-be-deleted Box and then + // search in the top/bottom Line of the respective counterparts. + SwTwips nBoxStt = 0; + for( sal_uInt16 n = 0; n < nDelPos; ++n ) + nBoxStt += rTableBoxes[ n ]->GetFrameFormat()->GetFrameSize().GetWidth(); + SwTwips nBoxWidth = rBox.GetFrameFormat()->GetFrameSize().GetWidth(); - SwTableBox *pPrvBox = nullptr, *pNxtBox = nullptr; - if( nLnPos ) // Predecessor? - pPrvBox = ::lcl_FndNxtPrvDelBox( *pTableLns, nBoxStt, nBoxWidth, - nLnPos, false, pAllDelBoxes, pCurPos ); + SwTableBox *pPrvBox = nullptr, *pNxtBox = nullptr; + if( nLnPos ) // Predecessor? + pPrvBox = ::lcl_FndNxtPrvDelBox( *pTableLns, nBoxStt, nBoxWidth, + nLnPos, false, pAllDelBoxes, pCurPos ); - if( nLnPos + 1 < (sal_uInt16)pTableLns->size() ) // Successor? - pNxtBox = ::lcl_FndNxtPrvDelBox( *pTableLns, nBoxStt, nBoxWidth, - nLnPos, true, pAllDelBoxes, pCurPos ); + if( nLnPos + 1 < (sal_uInt16)pTableLns->size() ) // Successor? + pNxtBox = ::lcl_FndNxtPrvDelBox( *pTableLns, nBoxStt, nBoxWidth, + nLnPos, true, pAllDelBoxes, pCurPos ); - if( pNxtBox && pNxtBox->GetSttNd() ) + if( pNxtBox && pNxtBox->GetSttNd() ) + { + const SvxBoxItem& rNxtBoxItem = pNxtBox->GetFrameFormat()->GetBox(); + if( !rNxtBoxItem.GetTop() && ( !pPrvBox || + !pPrvBox->GetFrameFormat()->GetBox().GetBottom()) ) { - const SvxBoxItem& rNxtBoxItem = pNxtBox->GetFrameFormat()->GetBox(); - if( !rNxtBoxItem.GetTop() && ( !pPrvBox || - !pPrvBox->GetFrameFormat()->GetBox().GetBottom()) ) - { - SvxBoxItem aTmp( rNxtBoxItem ); - aTmp.SetLine( rBoxItem.GetTop() ? rBoxItem.GetTop() - : rBoxItem.GetBottom(), - SvxBoxItemLine::TOP ); - rShareFormats.SetAttr( *pNxtBox, aTmp ); - bChgd = true; - } + SvxBoxItem aTmp( rNxtBoxItem ); + aTmp.SetLine( rBoxItem.GetTop() ? rBoxItem.GetTop() + : rBoxItem.GetBottom(), + SvxBoxItemLine::TOP ); + rShareFormats.SetAttr( *pNxtBox, aTmp ); + bChgd = true; } - if( !bChgd && pPrvBox && pPrvBox->GetSttNd() ) + } + if( !bChgd && pPrvBox && pPrvBox->GetSttNd() ) + { + const SvxBoxItem& rPrvBoxItem = pPrvBox->GetFrameFormat()->GetBox(); + if( !rPrvBoxItem.GetTop() && ( !pNxtBox || + !pNxtBox->GetFrameFormat()->GetBox().GetTop()) ) { - const SvxBoxItem& rPrvBoxItem = pPrvBox->GetFrameFormat()->GetBox(); - if( !rPrvBoxItem.GetTop() && ( !pNxtBox || - !pNxtBox->GetFrameFormat()->GetBox().GetTop()) ) - { - SvxBoxItem aTmp( rPrvBoxItem ); - aTmp.SetLine( rBoxItem.GetTop() ? rBoxItem.GetTop() - : rBoxItem.GetBottom(), - SvxBoxItemLine::BOTTOM ); - rShareFormats.SetAttr( *pPrvBox, aTmp ); - } + SvxBoxItem aTmp( rPrvBoxItem ); + aTmp.SetLine( rBoxItem.GetTop() ? rBoxItem.GetTop() + : rBoxItem.GetBottom(), + SvxBoxItemLine::BOTTOM ); + rShareFormats.SetAttr( *pPrvBox, aTmp ); } } + } bool SwTable::DeleteSel( diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index 2bc005b247c3..050d5339961c 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -49,66 +49,67 @@ using namespace com::sun::star; void SwTextBoxHelper::create(SwFrameFormat* pShape) { // If TextBox wasn't enabled previously - if (!pShape->GetAttrSet().HasItem(RES_CNTNT)) - { - // Create the associated TextFrame and insert it into the document. - uno::Reference<text::XTextContent> xTextFrame(SwXServiceProvider::MakeInstance(SwServiceType::TypeTextFrame, *pShape->GetDoc()), uno::UNO_QUERY); - uno::Reference<text::XTextDocument> xTextDocument(pShape->GetDoc()->GetDocShell()->GetBaseModel(), uno::UNO_QUERY); - uno::Reference<text::XTextContentAppend> xTextContentAppend(xTextDocument->getText(), uno::UNO_QUERY); - xTextContentAppend->appendTextContent(xTextFrame, uno::Sequence<beans::PropertyValue>()); - - // Link FLY and DRAW formats, so it becomes a text box (needed for syncProperty calls). - uno::Reference<text::XTextFrame> xRealTextFrame(xTextFrame, uno::UNO_QUERY); - auto pTextFrame = dynamic_cast<SwXTextFrame*>(xRealTextFrame.get()); - assert(nullptr != pTextFrame); - SwFrameFormat* pFormat = pTextFrame->GetFrameFormat(); - - assert(nullptr != dynamic_cast<SwDrawFrameFormat*>(pShape)); - assert(nullptr != dynamic_cast<SwFlyFrameFormat*>(pFormat)); - - pShape->SetOtherTextBoxFormat(pFormat); - pFormat->SetOtherTextBoxFormat(pShape); - - // Initialize properties. - uno::Reference<beans::XPropertySet> xPropertySet(xTextFrame, uno::UNO_QUERY); - uno::Any aEmptyBorder = uno::makeAny(table::BorderLine2()); - xPropertySet->setPropertyValue(UNO_NAME_TOP_BORDER, aEmptyBorder); - xPropertySet->setPropertyValue(UNO_NAME_BOTTOM_BORDER, aEmptyBorder); - xPropertySet->setPropertyValue(UNO_NAME_LEFT_BORDER, aEmptyBorder); - xPropertySet->setPropertyValue(UNO_NAME_RIGHT_BORDER, aEmptyBorder); - - xPropertySet->setPropertyValue(UNO_NAME_FILL_TRANSPARENCE, uno::makeAny(sal_Int32(100))); - - xPropertySet->setPropertyValue(UNO_NAME_SIZE_TYPE, uno::makeAny(text::SizeType::FIX)); - - uno::Reference<container::XNamed> xNamed(xTextFrame, uno::UNO_QUERY); - xNamed->setName(pShape->GetDoc()->GetUniqueFrameName()); - - // Link its text range to the original shape. - uno::Reference<text::XTextRange> xTextBox(xTextFrame, uno::UNO_QUERY_THROW); - SwUnoInternalPaM aInternalPaM(*pShape->GetDoc()); - if (sw::XTextRangeToSwPaM(aInternalPaM, xTextBox)) - { - SwAttrSet aSet(pShape->GetAttrSet()); - SwFormatContent aContent(aInternalPaM.GetNode().StartOfSectionNode()); - aSet.Put(aContent); - pShape->SetFormatAttr(aSet); - } + if (pShape->GetAttrSet().HasItem(RES_CNTNT)) + return; + + // Create the associated TextFrame and insert it into the document. + uno::Reference<text::XTextContent> xTextFrame(SwXServiceProvider::MakeInstance(SwServiceType::TypeTextFrame, *pShape->GetDoc()), uno::UNO_QUERY); + uno::Reference<text::XTextDocument> xTextDocument(pShape->GetDoc()->GetDocShell()->GetBaseModel(), uno::UNO_QUERY); + uno::Reference<text::XTextContentAppend> xTextContentAppend(xTextDocument->getText(), uno::UNO_QUERY); + xTextContentAppend->appendTextContent(xTextFrame, uno::Sequence<beans::PropertyValue>()); + + // Link FLY and DRAW formats, so it becomes a text box (needed for syncProperty calls). + uno::Reference<text::XTextFrame> xRealTextFrame(xTextFrame, uno::UNO_QUERY); + auto pTextFrame = dynamic_cast<SwXTextFrame*>(xRealTextFrame.get()); + assert(nullptr != pTextFrame); + SwFrameFormat* pFormat = pTextFrame->GetFrameFormat(); + + assert(nullptr != dynamic_cast<SwDrawFrameFormat*>(pShape)); + assert(nullptr != dynamic_cast<SwFlyFrameFormat*>(pFormat)); + + pShape->SetOtherTextBoxFormat(pFormat); + pFormat->SetOtherTextBoxFormat(pShape); - // Also initialize the properties, which are not constant, but inherited from the shape's ones. - uno::Reference<drawing::XShape> xShape(pShape->FindRealSdrObject()->getUnoShape(), uno::UNO_QUERY); - syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_SIZE, uno::makeAny(xShape->getSize())); - - uno::Reference<beans::XPropertySet> xShapePropertySet(xShape, uno::UNO_QUERY); - syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_ORIENT, xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT)); - syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_RELATION, xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_RELATION)); - syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_ORIENT, xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT)); - syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_RELATION, xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_RELATION)); - syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_POSITION, xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_POSITION)); - syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_POSITION, xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_POSITION)); - syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_IS_AUTO_HEIGHT, xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_AUTOGROWHEIGHT)); - syncProperty(pShape, RES_TEXT_VERT_ADJUST, 0, xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_VERT_ADJUST)); + // Initialize properties. + uno::Reference<beans::XPropertySet> xPropertySet(xTextFrame, uno::UNO_QUERY); + uno::Any aEmptyBorder = uno::makeAny(table::BorderLine2()); + xPropertySet->setPropertyValue(UNO_NAME_TOP_BORDER, aEmptyBorder); + xPropertySet->setPropertyValue(UNO_NAME_BOTTOM_BORDER, aEmptyBorder); + xPropertySet->setPropertyValue(UNO_NAME_LEFT_BORDER, aEmptyBorder); + xPropertySet->setPropertyValue(UNO_NAME_RIGHT_BORDER, aEmptyBorder); + + xPropertySet->setPropertyValue(UNO_NAME_FILL_TRANSPARENCE, uno::makeAny(sal_Int32(100))); + + xPropertySet->setPropertyValue(UNO_NAME_SIZE_TYPE, uno::makeAny(text::SizeType::FIX)); + + uno::Reference<container::XNamed> xNamed(xTextFrame, uno::UNO_QUERY); + xNamed->setName(pShape->GetDoc()->GetUniqueFrameName()); + + // Link its text range to the original shape. + uno::Reference<text::XTextRange> xTextBox(xTextFrame, uno::UNO_QUERY_THROW); + SwUnoInternalPaM aInternalPaM(*pShape->GetDoc()); + if (sw::XTextRangeToSwPaM(aInternalPaM, xTextBox)) + { + SwAttrSet aSet(pShape->GetAttrSet()); + SwFormatContent aContent(aInternalPaM.GetNode().StartOfSectionNode()); + aSet.Put(aContent); + pShape->SetFormatAttr(aSet); } + + // Also initialize the properties, which are not constant, but inherited from the shape's ones. + uno::Reference<drawing::XShape> xShape(pShape->FindRealSdrObject()->getUnoShape(), uno::UNO_QUERY); + syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_SIZE, uno::makeAny(xShape->getSize())); + + uno::Reference<beans::XPropertySet> xShapePropertySet(xShape, uno::UNO_QUERY); + syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_ORIENT, xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT)); + syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_RELATION, xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_RELATION)); + syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_ORIENT, xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT)); + syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_RELATION, xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_RELATION)); + syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_POSITION, xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_POSITION)); + syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_POSITION, xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_POSITION)); + syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_IS_AUTO_HEIGHT, xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_AUTOGROWHEIGHT)); + syncProperty(pShape, RES_TEXT_VERT_ADJUST, 0, xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_VERT_ADJUST)); + } void SwTextBoxHelper::destroy(SwFrameFormat* pShape) diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index 9b72c028dbbe..8c8edb5ed218 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -1292,58 +1292,59 @@ bool SwSectionNode::IsContentHidden() const void SwSectionNode::NodesArrChgd() { SwSectionFormat *const pFormat = m_pSection->GetFormat(); - if( pFormat ) - { - SwNodes& rNds = GetNodes(); - SwDoc* pDoc = pFormat->GetDoc(); + if( !pFormat ) + return; - if( !rNds.IsDocNodes() ) - { - SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, pFormat ); - pFormat->ModifyNotification( &aMsgHint, &aMsgHint ); - } + SwNodes& rNds = GetNodes(); + SwDoc* pDoc = pFormat->GetDoc(); - pFormat->LockModify(); - pFormat->SetFormatAttr( SwFormatContent( this )); - pFormat->UnlockModify(); + if( !rNds.IsDocNodes() ) + { + SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, pFormat ); + pFormat->ModifyNotification( &aMsgHint, &aMsgHint ); + } - SwSectionNode* pSectNd = StartOfSectionNode()->FindSectionNode(); - // set the correct parent from the new section - pFormat->SetDerivedFrom( pSectNd ? pSectNd->GetSection().GetFormat() - : pDoc->GetDfltFrameFormat() ); + pFormat->LockModify(); + pFormat->SetFormatAttr( SwFormatContent( this )); + pFormat->UnlockModify(); - // Set the right StartNode for all in this Area - sal_uLong nStart = GetIndex()+1, nEnde = EndOfSectionIndex(); - for( sal_uLong n = nStart; n < nEnde; ++n ) - // Make up the Format's nesting - if( nullptr != ( pSectNd = rNds[ n ]->GetSectionNode() ) ) - { - pSectNd->GetSection().GetFormat()->SetDerivedFrom( pFormat ); - n = pSectNd->EndOfSectionIndex(); - } + SwSectionNode* pSectNd = StartOfSectionNode()->FindSectionNode(); + // set the correct parent from the new section + pFormat->SetDerivedFrom( pSectNd ? pSectNd->GetSection().GetFormat() + : pDoc->GetDfltFrameFormat() ); - // Moving Nodes to the UndoNodes array? - if( rNds.IsDocNodes() ) + // Set the right StartNode for all in this Area + sal_uLong nStart = GetIndex()+1, nEnde = EndOfSectionIndex(); + for( sal_uLong n = nStart; n < nEnde; ++n ) + // Make up the Format's nesting + if( nullptr != ( pSectNd = rNds[ n ]->GetSectionNode() ) ) { - OSL_ENSURE( pDoc == GetDoc(), - "Moving to different Documents?" ); - if( m_pSection->IsLinkType() ) // Remove the Link - m_pSection->CreateLink( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() ? CREATE_CONNECT : CREATE_NONE ); - - if (m_pSection->IsServer()) - pDoc->getIDocumentLinksAdministration().GetLinkManager().InsertServer( m_pSection->GetObject() ); + pSectNd->GetSection().GetFormat()->SetDerivedFrom( pFormat ); + n = pSectNd->EndOfSectionIndex(); } - else + + // Moving Nodes to the UndoNodes array? + if( rNds.IsDocNodes() ) + { + OSL_ENSURE( pDoc == GetDoc(), + "Moving to different Documents?" ); + if( m_pSection->IsLinkType() ) // Remove the Link + m_pSection->CreateLink( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() ? CREATE_CONNECT : CREATE_NONE ); + + if (m_pSection->IsServer()) + pDoc->getIDocumentLinksAdministration().GetLinkManager().InsertServer( m_pSection->GetObject() ); + } + else + { + if (CONTENT_SECTION != m_pSection->GetType() + && m_pSection->IsConnected()) { - if (CONTENT_SECTION != m_pSection->GetType() - && m_pSection->IsConnected()) - { - pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( &m_pSection->GetBaseLink() ); - } - if (m_pSection->IsServer()) - pDoc->getIDocumentLinksAdministration().GetLinkManager().RemoveServer( m_pSection->GetObject() ); + pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( &m_pSection->GetBaseLink() ); } + if (m_pSection->IsServer()) + pDoc->getIDocumentLinksAdministration().GetLinkManager().RemoveServer( m_pSection->GetObject() ); } + } OUString SwDoc::GetUniqueSectionName( const OUString* pChkStr ) const diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index a589cbf5091e..fbe12fd69018 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -561,255 +561,256 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) SwSelUnions aUnions; ::MakeSelUnions( aUnions, pStart, pEnd ); - if( !aUnions.empty() ) + if( aUnions.empty() ) + return; + + SwTable& rTable = pTableNd->GetTable(); + if (GetIDocumentUndoRedo().DoesUndo()) { - SwTable& rTable = pTableNd->GetTable(); - if (GetIDocumentUndoRedo().DoesUndo()) - { - GetIDocumentUndoRedo().AppendUndo( new SwUndoAttrTable(*pTableNd) ); - } + GetIDocumentUndoRedo().AppendUndo( new SwUndoAttrTable(*pTableNd) ); + } - std::vector<SwTableFormatCmp*> aFormatCmp; - aFormatCmp.reserve( 255 ); - const SvxBoxItem* pSetBox; - const SvxBoxInfoItem *pSetBoxInfo; - - const SvxBorderLine* pLeft = nullptr; - const SvxBorderLine* pRight = nullptr; - const SvxBorderLine* pTop = nullptr; - const SvxBorderLine* pBottom = nullptr; - const SvxBorderLine* pHori = nullptr; - const SvxBorderLine* pVert = nullptr; - bool bHoriValid = true, bVertValid = true, - bTopValid = true, bBottomValid = true, - bLeftValid = true, bRightValid = true; - - // The Flags in the BoxInfo Item decide whether a BorderLine is valid! - if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_BORDER_INNER, false, - reinterpret_cast<const SfxPoolItem**>(&pSetBoxInfo)) ) - { - pHori = pSetBoxInfo->GetHori(); - pVert = pSetBoxInfo->GetVert(); + std::vector<SwTableFormatCmp*> aFormatCmp; + aFormatCmp.reserve( 255 ); + const SvxBoxItem* pSetBox; + const SvxBoxInfoItem *pSetBoxInfo; + + const SvxBorderLine* pLeft = nullptr; + const SvxBorderLine* pRight = nullptr; + const SvxBorderLine* pTop = nullptr; + const SvxBorderLine* pBottom = nullptr; + const SvxBorderLine* pHori = nullptr; + const SvxBorderLine* pVert = nullptr; + bool bHoriValid = true, bVertValid = true, + bTopValid = true, bBottomValid = true, + bLeftValid = true, bRightValid = true; + + // The Flags in the BoxInfo Item decide whether a BorderLine is valid! + if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_BORDER_INNER, false, + reinterpret_cast<const SfxPoolItem**>(&pSetBoxInfo)) ) + { + pHori = pSetBoxInfo->GetHori(); + pVert = pSetBoxInfo->GetVert(); - bHoriValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::HORI); - bVertValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::VERT); + bHoriValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::HORI); + bVertValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::VERT); - // Do we want to evaluate these? - bTopValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::TOP); - bBottomValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::BOTTOM); - bLeftValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::LEFT); - bRightValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::RIGHT); - } + // Do we want to evaluate these? + bTopValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::TOP); + bBottomValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::BOTTOM); + bLeftValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::LEFT); + bRightValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::RIGHT); + } - if( SfxItemState::SET == rSet.GetItemState( RES_BOX, false, - reinterpret_cast<const SfxPoolItem**>(&pSetBox)) ) - { - pLeft = pSetBox->GetLeft(); - pRight = pSetBox->GetRight(); - pTop = pSetBox->GetTop(); - pBottom = pSetBox->GetBottom(); - } - else - { - // Not set, thus not valid values - bTopValid = bBottomValid = bLeftValid = bRightValid = false; - pSetBox = nullptr; - } + if( SfxItemState::SET == rSet.GetItemState( RES_BOX, false, + reinterpret_cast<const SfxPoolItem**>(&pSetBox)) ) + { + pLeft = pSetBox->GetLeft(); + pRight = pSetBox->GetRight(); + pTop = pSetBox->GetTop(); + pBottom = pSetBox->GetBottom(); + } + else + { + // Not set, thus not valid values + bTopValid = bBottomValid = bLeftValid = bRightValid = false; + pSetBox = nullptr; + } - bool bFirst = true; - for ( SwSelUnions::size_type i = 0; i < aUnions.size(); ++i ) + bool bFirst = true; + for ( SwSelUnions::size_type i = 0; i < aUnions.size(); ++i ) + { + SwSelUnion *pUnion = &aUnions[i]; + SwTabFrame *pTab = pUnion->GetTable(); + const SwRect &rUnion = pUnion->GetUnion(); + const bool bLast = (i == aUnions.size() - 1); + + std::vector<SwCellFrame*> aCellArr; + aCellArr.reserve( 255 ); + ::lcl_CollectCells( aCellArr, pUnion->GetUnion(), pTab ); + + // All Cell Borders that match the UnionRect or extend it are + // Outer Borders. All others are Inner Borders. + + // New: The Outer Borders can, depending on whether it's a + // Start/Middle/Follow Table (for Selection via FollowTabs), + // also not be Outer Borders. + // Outer Borders are set on the left, right, at the top and at the bottom. + // Inner Borders are only set at the top and on the left. + for ( auto pCell : aCellArr ) { - SwSelUnion *pUnion = &aUnions[i]; - SwTabFrame *pTab = pUnion->GetTable(); - const SwRect &rUnion = pUnion->GetUnion(); - const bool bLast = (i == aUnions.size() - 1); + const bool bVert = pTab->IsVertical(); + const bool bRTL = pTab->IsRightToLeft(); + bool bTopOver, bLeftOver, bRightOver, bBottomOver; + if ( bVert ) + { + bTopOver = pCell->getFrameArea().Right() >= rUnion.Right(); + bLeftOver = pCell->getFrameArea().Top() <= rUnion.Top(); + bRightOver = pCell->getFrameArea().Bottom() >= rUnion.Bottom(); + bBottomOver = pCell->getFrameArea().Left() <= rUnion.Left(); + } + else + { + bTopOver = pCell->getFrameArea().Top() <= rUnion.Top(); + bLeftOver = pCell->getFrameArea().Left() <= rUnion.Left(); + bRightOver = pCell->getFrameArea().Right() >= rUnion.Right(); + bBottomOver = pCell->getFrameArea().Bottom() >= rUnion.Bottom(); + } - std::vector<SwCellFrame*> aCellArr; - aCellArr.reserve( 255 ); - ::lcl_CollectCells( aCellArr, pUnion->GetUnion(), pTab ); + if ( bRTL ) + { + bool bTmp = bRightOver; + bRightOver = bLeftOver; + bLeftOver = bTmp; + } - // All Cell Borders that match the UnionRect or extend it are - // Outer Borders. All others are Inner Borders. + // Do not set anything by default in HeadlineRepeats + if ( pTab->IsFollow() && + ( pTab->IsInHeadline( *pCell ) || + // Same holds for follow flow rows + pCell->IsInFollowFlowRow() ) ) + continue; - // New: The Outer Borders can, depending on whether it's a - // Start/Middle/Follow Table (for Selection via FollowTabs), - // also not be Outer Borders. - // Outer Borders are set on the left, right, at the top and at the bottom. - // Inner Borders are only set at the top and on the left. - for ( auto pCell : aCellArr ) + SvxBoxItem aBox( pCell->GetFormat()->GetBox() ); + + sal_Int16 nType = 0; + + // Top Border + if( bTopValid ) { - const bool bVert = pTab->IsVertical(); - const bool bRTL = pTab->IsRightToLeft(); - bool bTopOver, bLeftOver, bRightOver, bBottomOver; - if ( bVert ) + if ( bFirst && bTopOver ) { - bTopOver = pCell->getFrameArea().Right() >= rUnion.Right(); - bLeftOver = pCell->getFrameArea().Top() <= rUnion.Top(); - bRightOver = pCell->getFrameArea().Bottom() >= rUnion.Bottom(); - bBottomOver = pCell->getFrameArea().Left() <= rUnion.Left(); + aBox.SetLine( pTop, SvxBoxItemLine::TOP ); + nType |= 0x0001; } - else + else if ( bHoriValid ) { - bTopOver = pCell->getFrameArea().Top() <= rUnion.Top(); - bLeftOver = pCell->getFrameArea().Left() <= rUnion.Left(); - bRightOver = pCell->getFrameArea().Right() >= rUnion.Right(); - bBottomOver = pCell->getFrameArea().Bottom() >= rUnion.Bottom(); + aBox.SetLine( nullptr, SvxBoxItemLine::TOP ); + nType |= 0x0002; } + } - if ( bRTL ) - { - bool bTmp = bRightOver; - bRightOver = bLeftOver; - bLeftOver = bTmp; - } - - // Do not set anything by default in HeadlineRepeats - if ( pTab->IsFollow() && - ( pTab->IsInHeadline( *pCell ) || - // Same holds for follow flow rows - pCell->IsInFollowFlowRow() ) ) - continue; - - SvxBoxItem aBox( pCell->GetFormat()->GetBox() ); - - sal_Int16 nType = 0; - - // Top Border - if( bTopValid ) - { - if ( bFirst && bTopOver ) - { - aBox.SetLine( pTop, SvxBoxItemLine::TOP ); - nType |= 0x0001; - } - else if ( bHoriValid ) + // Fix fdo#62470 correct the input for RTL table + if (bRTL) + { + if( bLeftOver && bRightOver) { - aBox.SetLine( nullptr, SvxBoxItemLine::TOP ); - nType |= 0x0002; - } - } - - // Fix fdo#62470 correct the input for RTL table - if (bRTL) - { - if( bLeftOver && bRightOver) + if ( bLeftValid ) { - if ( bLeftValid ) - { - aBox.SetLine( pLeft, SvxBoxItemLine::RIGHT ); - nType |= 0x0010; - } - if ( bRightValid ) - { - aBox.SetLine( pRight, SvxBoxItemLine::LEFT ); - nType |= 0x0004; - } ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits