[Libreoffice-commits] core.git: 4 commits - sw/inc sw/qa sw/source

Michael Stahl mstahl at redhat.com
Fri Sep 11 08:50:07 PDT 2015


 sw/inc/IDocumentContentOperations.hxx                   |    3 
 sw/inc/fmtcol.hxx                                       |   10 +
 sw/inc/modcfg.hxx                                       |    8 -
 sw/qa/extras/uiwriter/data/redlineFrame.fodt            |   81 ++++++++++++++++
 sw/qa/extras/uiwriter/uiwriter.cxx                      |   27 +++++
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   59 +++++------
 sw/source/core/doc/docnew.cxx                           |    1 
 sw/source/core/doc/fmtcol.cxx                           |   52 +++++-----
 sw/source/core/doc/tblafmt.cxx                          |    2 
 sw/source/core/fields/reffld.cxx                        |    6 -
 sw/source/core/inc/DocumentContentOperationsManager.hxx |    6 -
 sw/source/core/inc/UndoCore.hxx                         |    2 
 sw/source/core/layout/layhelp.hxx                       |    3 
 sw/source/filter/html/swhtml.hxx                        |    2 
 sw/source/filter/ww8/wrtww8.hxx                         |   12 +-
 sw/source/filter/xml/xmlfmt.cxx                         |    2 
 sw/source/filter/xml/xmltbli.cxx                        |    6 -
 sw/source/filter/xml/xmltexte.cxx                       |    2 
 sw/source/uibase/config/modcfg.cxx                      |    6 -
 19 files changed, 212 insertions(+), 78 deletions(-)

New commits:
commit 3aec17698adc403eac018a5c9f00bf75640b1e42
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Sep 11 16:22:36 2015 +0200

    sw: replace boost::ptr_vector with std::vector<std::unique_ptr>
    
    Change-Id: I8baa909f5e3ddb6b227337f3731e4d4b4ca183e5

diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx
index 65ffe39..5ab04ac 100644
--- a/sw/inc/fmtcol.hxx
+++ b/sw/inc/fmtcol.hxx
@@ -22,9 +22,11 @@
 #include "swdllapi.h"
 #include <frmatr.hxx>
 #include <swtypes.hxx>
-#include <boost/ptr_container/ptr_vector.hpp>
 #include <rtl/ustring.hxx>
 
+#include <vector>
+#include <memory>
+
 class SwDoc;
 namespace sw{ class DocumentStylePoolManager; }
 
@@ -211,14 +213,14 @@ public:
     void RegisterToFormat( SwFormat& );
 };
 
-class SwFormatCollConditions : public boost::ptr_vector<SwCollCondition> {};
+class SwFormatCollConditions : public std::vector<std::unique_ptr<SwCollCondition>> {};
 
 class SW_DLLPUBLIC SwConditionTextFormatColl : public SwTextFormatColl
 {
     friend class SwDoc;
     friend class ::sw::DocumentStylePoolManager;
 protected:
-    SwFormatCollConditions aCondColls;
+    SwFormatCollConditions m_CondColls;
 
     SwConditionTextFormatColl( SwAttrPool& rPool, const sal_Char* pFormatCollName,
                             SwTextFormatColl* pDerFrom = 0 )
@@ -235,7 +237,7 @@ public:
     virtual ~SwConditionTextFormatColl();
 
     const SwCollCondition* HasCondition( const SwCollCondition& rCond ) const;
-    const SwFormatCollConditions& GetCondColls() const     { return aCondColls; }
+    const SwFormatCollConditions& GetCondColls() const { return m_CondColls; }
     void InsertCondition( const SwCollCondition& rCond );
     bool RemoveCondition( const SwCollCondition& rCond );
 
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 886349c..24ef818 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -74,6 +74,8 @@
 #include <editeng/formatbreakitem.hxx>
 #include <com/sun/star/i18n/Boundary.hpp>
 
+#include <boost/ptr_container/ptr_vector.hpp>
+
 using namespace ::com::sun::star::i18n;
 
 namespace
diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx
index 299a8cb..28afa7c 100644
--- a/sw/source/core/doc/fmtcol.cxx
+++ b/sw/source/core/doc/fmtcol.cxx
@@ -565,36 +565,42 @@ SwConditionTextFormatColl::~SwConditionTextFormatColl()
 const SwCollCondition* SwConditionTextFormatColl::HasCondition(
                         const SwCollCondition& rCond ) const
 {
-    for( const auto &rFnd : aCondColls )
-        if( rFnd == rCond )
-            return &rFnd;
+    for (const auto &rpFnd : m_CondColls)
+    {
+        if (*rpFnd == rCond)
+            return rpFnd.get();
+    }
 
     return nullptr;
 }
 
 void SwConditionTextFormatColl::InsertCondition( const SwCollCondition& rCond )
 {
-    for( SwFormatCollConditions::size_type n = 0; n < aCondColls.size(); ++n )
-        if( aCondColls[ n ] == rCond )
+    for (SwFormatCollConditions::size_type n = 0; n < m_CondColls.size(); ++n)
+    {
+        if (*m_CondColls[ n ] == rCond)
         {
-            aCondColls.erase( aCondColls.begin() + n );
+            m_CondColls.erase( m_CondColls.begin() + n );
             break;
         }
+    }
 
     // Not found -> so insert it
-    SwCollCondition* pNew = new SwCollCondition( rCond );
-    aCondColls.push_back( pNew );
+    std::unique_ptr<SwCollCondition> pNew(new SwCollCondition( rCond ));
+    m_CondColls.push_back( std::move(pNew) );
 }
 
 bool SwConditionTextFormatColl::RemoveCondition( const SwCollCondition& rCond )
 {
     bool bRet = false;
-    for( SwFormatCollConditions::size_type n = 0; n < aCondColls.size(); ++n )
-        if( aCondColls[ n ] == rCond )
+    for (SwFormatCollConditions::size_type n = 0; n < m_CondColls.size(); ++n)
+    {
+        if (*m_CondColls[ n ] == rCond)
         {
-            aCondColls.erase( aCondColls.begin() + n );
+            m_CondColls.erase( m_CondColls.begin() + n );
             bRet = true;
         }
+    }
 
     return bRet;
 }
@@ -602,21 +608,21 @@ bool SwConditionTextFormatColl::RemoveCondition( const SwCollCondition& rCond )
 void SwConditionTextFormatColl::SetConditions( const SwFormatCollConditions& rCndClls )
 {
     // Copy the Conditions, but first delete the old ones
-    aCondColls.clear();
+    m_CondColls.clear();
     SwDoc& rDoc = *GetDoc();
-    for( const auto &rFnd : rCndClls )
+    for (const auto &rpFnd : rCndClls)
     {
-        SwTextFormatColl* pTmpColl = rFnd.GetTextFormatColl()
-                                    ? rDoc.CopyTextColl( *rFnd.GetTextFormatColl() )
-                                    : 0;
-        SwCollCondition* pNew;
-        if( USRFLD_EXPRESSION & rFnd.GetCondition() )
-            pNew = new SwCollCondition( pTmpColl, rFnd.GetCondition(),
-                                        *rFnd.GetFieldExpression() );
+        SwTextFormatColl *const pTmpColl = rpFnd->GetTextFormatColl()
+                            ? rDoc.CopyTextColl( *rpFnd->GetTextFormatColl() )
+                            : 0;
+        std::unique_ptr<SwCollCondition> pNew;
+        if (USRFLD_EXPRESSION & rpFnd->GetCondition())
+            pNew.reset(new SwCollCondition( pTmpColl, rpFnd->GetCondition(),
+                                            *rpFnd->GetFieldExpression() ));
         else
-            pNew = new SwCollCondition( pTmpColl, rFnd.GetCondition(),
-                                        rFnd.GetSubCondition() );
-        aCondColls.push_back( pNew );
+            pNew.reset(new SwCollCondition( pTmpColl, rpFnd->GetCondition(),
+                                            rpFnd->GetSubCondition() ));
+        m_CondColls.push_back( std::move(pNew) );
     }
 }
 
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index f7d3106..d35ccc2 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -40,6 +40,8 @@
 #include <hintids.hxx>
 #include <fmtornt.hxx>
 #include <editsh.hxx>
+
+#include <boost/ptr_container/ptr_vector.hpp>
 #include <boost/noncopyable.hpp>
 
 /*
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index f9bc95e..099d699 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -58,12 +58,14 @@
 #include <SwNodeNum.hxx>
 #include <calbck.hxx>
 
+#include <sfx2/childwin.hxx>
+
+#include <boost/ptr_container/ptr_vector.hpp>
+
 #include <set>
 #include <map>
 #include <algorithm>
 
-#include <sfx2/childwin.hxx>
-
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::text;
 using namespace ::com::sun::star::lang;
diff --git a/sw/source/core/inc/UndoCore.hxx b/sw/source/core/inc/UndoCore.hxx
index 5863bc3..545b80b 100644
--- a/sw/source/core/inc/UndoCore.hxx
+++ b/sw/source/core/inc/UndoCore.hxx
@@ -25,6 +25,8 @@
 #include <rtl/ustring.hxx>
 #include <redline.hxx>
 
+#include <boost/ptr_container/ptr_vector.hpp>
+
 class SfxItemSet;
 class SwFormatColl;
 class SwFormatAnchor;
diff --git a/sw/source/core/layout/layhelp.hxx b/sw/source/core/layout/layhelp.hxx
index 148c1c9..ddfdad9 100644
--- a/sw/source/core/layout/layhelp.hxx
+++ b/sw/source/core/layout/layhelp.hxx
@@ -21,6 +21,9 @@
 #define INCLUDED_SW_SOURCE_CORE_LAYOUT_LAYHELP_HXX
 
 #include <swrect.hxx>
+
+#include <boost/ptr_container/ptr_vector.hpp>
+
 #include <vector>
 #include <deque>
 
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index dfe7886..1f052ab 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -31,6 +31,8 @@
 #include "calbck.hxx"
 #include "htmlvsh.hxx"
 
+#include <boost/ptr_container/ptr_vector.hpp>
+
 #include <deque>
 
 class SfxMedium;
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 365513a..5f63e60 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -24,10 +24,6 @@
 #include <tools/solar.h>
 #include <tools/gen.hxx>
 #include <editeng/editdata.hxx>
-#include <boost/optional.hpp>
-
-#include <map>
-#include <vector>
 
 #include <shellio.hxx>
 #include <wrt_fn.hxx>
@@ -41,6 +37,14 @@
 #include <expfld.hxx>
 
 #include <vcl/graph.hxx>
+
+#include <boost/optional.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
+
+#include <map>
+#include <vector>
+
+
 class SvxBrushItem;
 
 // some forward declarations
diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx
index e44179e..7d4e8df 100644
--- a/sw/source/filter/xml/xmlfmt.cxx
+++ b/sw/source/filter/xml/xmlfmt.cxx
@@ -1015,7 +1015,7 @@ void SwXMLImport::UpdateTextCollConditions( SwDoc *pDoc )
             bool bSendModify = false;
             for( size_t j=0; j < rConditions.size() && !bSendModify; ++j )
             {
-                const SwCollCondition& rCond = rConditions[j];
+                const SwCollCondition& rCond = *rConditions[j];
                 switch( rCond.GetCondition() )
                 {
                 case PARA_IN_TABLEHEAD:
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 518d8ee..c09ea95 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -19,7 +19,6 @@
 
 #include "hintids.hxx"
 
-#include <limits.h>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/text/XTextTable.hpp>
 #include <com/sun/star/table/XCellRange.hpp>
@@ -59,6 +58,11 @@
 #include <osl/mutex.hxx>
 #include "ndtxt.hxx"
 
+#include <boost/ptr_container/ptr_vector.hpp>
+
+#include <limits.h>
+
+
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx
index 3cfb48d..fe2a073 100644
--- a/sw/source/filter/xml/xmltexte.cxx
+++ b/sw/source/filter/xml/xmltexte.cxx
@@ -102,7 +102,7 @@ void SwXMLTextParagraphExport::exportStyleContent(
                 static_cast<const SwConditionTextFormatColl *>(pColl)->GetCondColls();
             for( size_t i=0; i < rConditions.size(); ++i )
             {
-                const SwCollCondition& rCond = rConditions[i];
+                const SwCollCondition& rCond = *rConditions[i];
 
                 enum XMLTokenEnum eFunc = XML_TOKEN_INVALID;
                 OUString sVal;
commit a0c41f53cd13f12d6e122c92e530bd0bd9c14d79
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Sep 11 15:59:57 2015 +0200

    sw: replace boost::ptr_vector with std::vector<std::unique_ptr>
    
    Change-Id: I5316874cb8abe191da4fd385b281599d422a23ee

diff --git a/sw/inc/modcfg.hxx b/sw/inc/modcfg.hxx
index 02d0a18..80e43f8 100644
--- a/sw/inc/modcfg.hxx
+++ b/sw/inc/modcfg.hxx
@@ -19,7 +19,6 @@
 #ifndef INCLUDED_SW_INC_MODCFG_HXX
 #define INCLUDED_SW_INC_MODCFG_HXX
 
-#include <boost/ptr_container/ptr_vector.hpp>
 #include <tools/wintypes.hxx>
 #include <vcl/field.hxx>
 #include <unotools/configitem.hxx>
@@ -32,6 +31,9 @@
 #include <editeng/svxenum.hxx>
 #include <o3tl/typed_flags_set.hxx>
 
+#include <vector>
+#include <memory>
+
 class SwModuleOptions;
 class InsCaptionOpt;
 
@@ -53,8 +55,8 @@ namespace o3tl
 class InsCaptionOptArr
 {
 private:
-    typedef boost::ptr_vector<InsCaptionOpt> InsCapOptArr;
-    InsCapOptArr m_aInsCapOptArr;
+    typedef std::vector<std::unique_ptr<InsCaptionOpt>> InsCapOptArr;
+    InsCapOptArr m_InsCapOptArr;
 public:
     InsCaptionOpt* Find(const SwCapObjType eType, const SvGlobalName *pOleId = 0);
     void Insert(InsCaptionOpt* pObj);
diff --git a/sw/source/uibase/config/modcfg.cxx b/sw/source/uibase/config/modcfg.cxx
index 0121f72..be274b9 100644
--- a/sw/source/uibase/config/modcfg.cxx
+++ b/sw/source/uibase/config/modcfg.cxx
@@ -49,9 +49,9 @@ using namespace com::sun::star::uno;
 
 InsCaptionOpt* InsCaptionOptArr::Find(const SwCapObjType eType, const SvGlobalName *pOleId)
 {
-    for (InsCapOptArr::iterator aI = m_aInsCapOptArr.begin(); aI != m_aInsCapOptArr.end(); ++aI)
+    for (auto const& it : m_InsCapOptArr)
     {
-        InsCaptionOpt &rObj = *aI;
+        InsCaptionOpt &rObj = *it;
         if (rObj.GetObjType() == eType && (eType != OLE_CAP || (pOleId && rObj.GetOleId() == *pOleId)))
             return &rObj;
     }
@@ -61,7 +61,7 @@ InsCaptionOpt* InsCaptionOptArr::Find(const SwCapObjType eType, const SvGlobalNa
 
 void InsCaptionOptArr::Insert(InsCaptionOpt* pObj)
 {
-    m_aInsCapOptArr.push_back(pObj); //takes ownership
+    m_InsCapOptArr.push_back(std::unique_ptr<InsCaptionOpt>(pObj)); //takes ownership
 }
 
 const InsCaptionOpt* SwModuleOptions::GetCapOption(
commit d5ffcba07acb4dd5bd68373d40f07af825f07fba
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Sep 11 16:59:27 2015 +0200

    sw: add unit test for the redline frame duplication regression
    
    Change-Id: I4b0f6199ebb8a9f462e53f3fdf8be871a267ba69

diff --git a/sw/qa/extras/uiwriter/data/redlineFrame.fodt b/sw/qa/extras/uiwriter/data/redlineFrame.fodt
new file mode 100644
index 0000000..31c5f50
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/redlineFrame.fodt
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oas
 is:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:
 experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:meta><meta:initial-creator>ms </meta:initial-creator><meta:creation-date>2015-08-24T21:49:45.305718699</meta:creation-date><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="0" meta:word-count="0" meta:character-count="0" meta:non-whitespace-character-count="0"/><meta:generator>LibreOfficeDev/4.3.7.2$Linux_X86_64 LibreOffice_project/8a35821d8636a03b8bf4e15b48f59794652c68ba</meta:generator></office:meta>
+ <office:font-face-decls>
+  <style:font-face style:name="Lohit Devanagari1" svg:font-family="'Lohit Devanagari'"/>
+  <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/>
+  <style:font-face style:name="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/>
+  <style:font-face style:name="Lohit Devanagari" svg:font-family="'Lohit Devanagari'" style:font-family-generic="system" style:font-pitch="variable"/>
+  <style:font-face style:name="Source Han Sans CN Regular" svg:font-family="'Source Han Sans CN Regular'" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+  <style:default-style style:family="graphic">
+   <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
+   <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties style:use-window-font-color="true" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Sans CN Regular" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/>
+  </style:default-style>
+  <style:default-style style:family="paragraph">
+   <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
+   <style:text-properties style:use-window-font-color="true" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Sans CN Regular" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>
+  </style:default-style>
+  <style:default-style style:family="table">
+   <style:table-properties table:border-model="collapsing"/>
+  </style:default-style>
+  <style:default-style style:family="table-row">
+   <style:table-row-properties fo:keep-together="auto"/>
+  </style:default-style>
+  <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
+ </office:styles>
+ <office:automatic-styles>
+  <style:page-layout style:name="pm1">
+   <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm">
+    <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+   </style:page-layout-properties>
+   <style:header-style/>
+   <style:footer-style/>
+  </style:page-layout>
+
+  <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard">
+    <style:text-properties officeooo:rsid="000b01fe" officeooo:paragraph-rsid="000b01fe"/>
+  </style:style>
+  <style:style style:name="P2" style:family="paragraph" style:parent-style-name="Standard">
+    <style:text-properties officeooo:rsid="000b01fe" officeooo:paragraph-rsid="000b01fe"/>
+  </style:style>
+  <style:style style:name="fr1" style:family="graphic" style:parent-style-name="Frame">
+    <style:graphic-properties style:vertical-pos="top" style:vertical-rel="paragraph-content" style:horizontal-pos="center" style:horizontal-rel="paragraph"/>
+  </style:style>
+ </office:automatic-styles>
+ <office:master-styles>
+  <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+  <office:text>
+
+      <text:tracked-changes>
+        <text:changed-region xml:id="ct52929984" text:id="ct52929984">
+          <text:insertion>
+            <office:change-info>
+              <dc:creator>ms </dc:creator>
+              <dc:date>2015-09-10T15:36:00</dc:date>
+            </office:change-info>
+          </text:insertion>
+        </text:changed-region>
+        <text:changed-region xml:id="ct58510944" text:id="ct58510944">
+          <text:deletion>
+            <office:change-info>
+              <dc:creator>ms </dc:creator>
+              <dc:date>2015-09-10T15:36:00</dc:date>
+            </office:change-info>
+            <text:p text:style-name="P1"/>
+            <text:p text:style-name="P1">Removed text</text:p>
+          </text:deletion>
+        </text:changed-region>
+      </text:tracked-changes>
+      <text:p text:style-name="P1"><draw:frame draw:style-name="fr1" draw:name="Frame1" text:anchor-type="char" svg:width="2cm" draw:z-index="0"><draw:text-box fo:min-height="0.499cm"><text:p text:style-name="Frame_20_contents"/></draw:text-box></draw:frame><text:change-start text:change-id="ct52929984"/>Added text<text:change-end text:change-id="ct52929984"/><text:change text:change-id="ct58510944"/></text:p>
+
+  </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 764ad7a..752343b 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -95,6 +95,7 @@ public:
     //Regression test of fdo#70143
     //EDITING: undo search&replace corrupt text when searching backward
     void testReplaceBackward();
+    void testRedlineFrame();
     void testFdo69893();
     void testFdo70807();
     void testImportRTF();
@@ -168,6 +169,7 @@ public:
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
     CPPUNIT_TEST(testReplaceForward);
     CPPUNIT_TEST(testReplaceBackward);
+    CPPUNIT_TEST(testRedlineFrame);
     CPPUNIT_TEST(testFdo69893);
     CPPUNIT_TEST(testFdo70807);
     CPPUNIT_TEST(testImportRTF);
@@ -289,6 +291,31 @@ void SwUiWriterTest::testReplaceForward()
     CPPUNIT_ASSERT_EQUAL(ORIGINAL_REPLACE_CONTENT, pTextNode->GetText());
 }
 
+void SwUiWriterTest::testRedlineFrame()
+{
+    SwDoc * pDoc(createDoc("redlineFrame.fodt"));
+    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+    uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
+    // there is exactly one frame
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount());
+
+    sal_uInt16 nMode = pWrtShell->GetRedlineMode();
+    CPPUNIT_ASSERT(nMode & nsRedlineMode_t::REDLINE_SHOW_DELETE);
+
+    // hide delete redlines
+    pWrtShell->SetRedlineMode(nMode & ~nsRedlineMode_t::REDLINE_SHOW_DELETE);
+
+    // there is still exactly one frame
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount());
+
+    pWrtShell->SetRedlineMode(nMode); // show again
+
+    // there is still exactly one frame
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount());
+}
+
 void SwUiWriterTest::testFdo75110()
 {
     SwDoc* pDoc = createDoc("fdo75110.odt");
commit e84f0a9b3223f49b0829f2f55dacbf11ae201c1e
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Sep 11 17:20:27 2015 +0200

    Revert "Fix single node CopyRange"
    
    This reverts commit 9099e21b89184bd4e39def497e483cac4a77ec5a.
    
    It causes the problem that frames anchored to the same node where
    redlines start or end get duplicated during Hide.
    
    Jan-Marek said that the original mail-merge related problem this change
    was fixing is now most likely fixed differently, and the test in
    testMultiPageAnchoredDraws() still passes.
    
    Change-Id: Ie84fed3f64be7696782bc557004eb18fccc5b64b

diff --git a/sw/inc/IDocumentContentOperations.hxx b/sw/inc/IDocumentContentOperations.hxx
index 91ca8ce..75b4f84 100644
--- a/sw/inc/IDocumentContentOperations.hxx
+++ b/sw/inc/IDocumentContentOperations.hxx
@@ -79,6 +79,9 @@ public:
         The position can be in the same or in an another document. It can also
         be within the range!
 
+        \warning The range has to include at least two nodes or has to be a
+        SwDoc::IsColumnSelection!
+
         Normally this function should work only with content nodes. But there
         is a special case used by SwDoc::Paste, which starts the SwPaM at the
         content start node. This position doesn't contain any content:
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index cfb2976..886349c 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -1584,7 +1584,7 @@ DocumentContentOperationsManager::CopyRange( SwPaM& rPam, SwPosition& rPos, cons
     bool bColumnSel = pDoc->IsClipBoard() && pDoc->IsColumnSelection();
 
     // Catch if there's no copy to do
-    if( !rPam.HasMark() || ( *pStt > *pEnd && !bColumnSel ) )
+    if( !rPam.HasMark() || ( *pStt >= *pEnd && !bColumnSel ) )
         return false;
 
     // Prevent copying in Flys that are anchored in the area
@@ -3132,8 +3132,7 @@ void DocumentContentOperationsManager::CopyWithFlyInFly(
     const SwPaM* pCopiedPaM,
     const bool bMakeNewFrms,
     const bool bDelRedlines,
-    const bool bCopyFlyAtFly,
-    const bool bMergedFirstNode ) const
+    const bool bCopyFlyAtFly ) const
 {
     SwDoc* pDest = rInsPos.GetNode().GetDoc();
 
@@ -3141,17 +3140,13 @@ void DocumentContentOperationsManager::CopyWithFlyInFly(
 
     SwNodeIndex aSavePos( rInsPos, -1 );
     bool bEndIsEqualEndPos = rInsPos == rRg.aEnd;
-    SwNodeRange aRg( rRg );
-    if ( bMergedFirstNode )
-        aRg.aStart++;
-    if ( aRg.aStart <= aRg.aEnd )
-        m_rDoc.GetNodes()._CopyNodes( aRg, rInsPos, bMakeNewFrms, true );
-    if ( !bMergedFirstNode )
-        ++aSavePos;
-    if ( bEndIsEqualEndPos )
+    m_rDoc.GetNodes()._CopyNodes( rRg, rInsPos, bMakeNewFrms, true );
+    ++aSavePos;
+    if( bEndIsEqualEndPos )
         const_cast<SwNodeIndex&>(rRg.aEnd) = aSavePos;
 
     aRedlRest.Restore();
+
 #if OSL_DEBUG_LEVEL > 0
     {
         //JP 17.06.99: Bug 66973 - check count only if the selection is in
@@ -3165,9 +3160,9 @@ void DocumentContentOperationsManager::CopyWithFlyInFly(
             !aTmpI.GetNode().IsEndNode() )
         {
             // If the range starts with a SwStartNode, it isn't copied
-            sal_uInt16 offset = (aRg.aStart.GetNode().GetNodeType() != ND_STARTNODE) ? 1 : 0;
+            sal_uInt16 offset = (rRg.aStart.GetNode().GetNodeType() != ND_STARTNODE) ? 1 : 0;
             OSL_ENSURE( rInsPos.GetIndex() - aSavePos.GetIndex() ==
-                    aRg.aEnd.GetIndex() - aRg.aStart.GetIndex() - 1 + offset,
+                    rRg.aEnd.GetIndex() - rRg.aStart.GetIndex() - 1 + offset,
                     "An insufficient number of nodes were copied!" );
         }
     }
@@ -3175,7 +3170,7 @@ void DocumentContentOperationsManager::CopyWithFlyInFly(
 
     {
         ::sw::UndoGuard const undoGuard(pDest->GetIDocumentUndoRedo());
-        CopyFlyInFlyImpl( rRg, nEndContentIndex, aSavePos, bCopyFlyAtFly, bMergedFirstNode );
+        CopyFlyInFlyImpl( rRg, nEndContentIndex, aSavePos, bCopyFlyAtFly );
     }
 
     SwNodeRange aCpyRange( aSavePos, rInsPos );
@@ -3201,8 +3196,7 @@ void DocumentContentOperationsManager::CopyFlyInFlyImpl(
     const SwNodeRange& rRg,
     const sal_Int32 nEndContentIndex,
     const SwNodeIndex& rStartIdx,
-    const bool bCopyFlyAtFly,
-    const bool bMergedFirstNode ) const
+    const bool bCopyFlyAtFly ) const
 {
     // First collect all Flys, sort them according to their ordering number,
     // and then only copy them. This maintains the ordering numbers (which are only
@@ -3335,8 +3329,6 @@ void DocumentContentOperationsManager::CopyFlyInFlyImpl(
 
                 ++aIdx;
             }
-            if ( bMergedFirstNode )
-                nAnchorTextNdNumInRange--;
 
             if ( !bAnchorTextNdFound )
             {
@@ -4105,7 +4097,7 @@ bool DocumentContentOperationsManager::CopyImpl( SwPaM& rPam, SwPosition& rPos,
     SwPosition* pEnd = rPam.End();
 
     // Catch when there's no copy to do.
-    if( !rPam.HasMark() || ( *pStt > *pEnd && !bColumnSel ) ||
+    if( !rPam.HasMark() || ( *pStt >= *pEnd && !bColumnSel ) ||
         //JP 29.6.2001: 88963 - dont copy if inspos is in region of start to end
         //JP 15.11.2001: don't test inclusive the end, ever exclusive
         ( pDoc == &m_rDoc && *pStt <= rPos && rPos < *pEnd ))
@@ -4193,8 +4185,6 @@ bool DocumentContentOperationsManager::CopyImpl( SwPaM& rPam, SwPosition& rPos,
         pNumRuleToPropagate = 0;
     }
 
-    bool bHandledStartNode = false;
-
     // This do/while block is only there so that we can break out of it!
     do {
         if( pSttTextNd )
@@ -4202,8 +4192,6 @@ bool DocumentContentOperationsManager::CopyImpl( SwPaM& rPam, SwPosition& rPos,
             // Don't copy the beginning completely?
             if( !bCopyCollFormat || bColumnSel || pStt->nContent.GetIndex() )
             {
-                bHandledStartNode = true;
-
                 SwIndex aDestIdx( rPos.nContent );
                 bool bCopyOk = false;
                 if( !pDestTextNd )
@@ -4279,11 +4267,18 @@ bool DocumentContentOperationsManager::CopyImpl( SwPaM& rPam, SwPosition& rPos,
                         pEnd->nContent -= nCpyLen;
                 }
 
-                if( bCopyCollFormat && bOneNode )
+                if( bOneNode )
                 {
-                    pSttTextNd->CopyCollFormat( *pDestTextNd );
-                    POP_NUMRULE_STATE
+                    if (bCopyCollFormat)
+                    {
+                        pSttTextNd->CopyCollFormat( *pDestTextNd );
+                        POP_NUMRULE_STATE
+                    }
+
+                    break;
                 }
+
+                aRg.aStart++;
             }
         }
         else if( pDestTextNd )
@@ -4340,7 +4335,7 @@ bool DocumentContentOperationsManager::CopyImpl( SwPaM& rPam, SwPosition& rPos,
         }
 
         pDestTextNd = aInsPos.GetNode().GetTextNode();
-        if( pEndTextNd && (!bOneNode || !bHandledStartNode) )
+        if (pEndTextNd)
         {
             SwIndex aDestIdx( rPos.nContent );
             if( !pDestTextNd )
@@ -4384,7 +4379,7 @@ bool DocumentContentOperationsManager::CopyImpl( SwPaM& rPam, SwPosition& rPos,
         if( bCopyAll || aRg.aStart != aRg.aEnd )
         {
             SfxItemSet aBrkSet( pDoc->GetAttrPool(), aBreakSetRange );
-            if( !bOneNode && pSttTextNd && bCopyCollFormat && pDestTextNd->HasSwAttrSet() )
+            if (pSttTextNd && bCopyCollFormat && pDestTextNd->HasSwAttrSet())
             {
                 aBrkSet.Put( *pDestTextNd->GetpSwAttrSet() );
                 if( SfxItemState::SET == aBrkSet.GetItemState( RES_BREAK, false ) )
@@ -4396,15 +4391,13 @@ bool DocumentContentOperationsManager::CopyImpl( SwPaM& rPam, SwPosition& rPos,
             if( aInsPos == pEnd->nNode )
             {
                 SwNodeIndex aSaveIdx( aInsPos, -1 );
-                CopyWithFlyInFly( aRg, 0, aInsPos, &rPam, bMakeNewFrms,
-                                  false, false, bHandledStartNode );
+                CopyWithFlyInFly( aRg, 0,aInsPos, &rPam, bMakeNewFrms, false );
                 ++aSaveIdx;
                 pEnd->nNode = aSaveIdx;
                 pEnd->nContent.Assign( aSaveIdx.GetNode().GetTextNode(), 0 );
             }
             else
-                CopyWithFlyInFly( aRg, pEnd->nContent.GetIndex(), aInsPos, &rPam,
-                                  bMakeNewFrms, false, false, bHandledStartNode );
+                CopyWithFlyInFly( aRg, pEnd->nContent.GetIndex(), aInsPos, &rPam, bMakeNewFrms, false );
 
             bCopyBookmarks = false;
 
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index e4501d2..af5bd1f 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -912,6 +912,7 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu
             SwPageDesc *const pTargetPageDesc, bool const bDeletePrevious, int pageOffset)
 {
     // GetEndOfExtras + 1 = StartOfContent == no content node!
+    // this ensures, that we have at least two nodes in the SwPaM.
     // @see IDocumentContentOperations::CopyRange
     SwNodeIndex aSourceIdx( rSource.GetNodes().GetEndOfExtras(), 1 );
     SwNodeIndex aSourceEndIdx( rSource.GetNodes().GetEndOfContent(), -1 );
diff --git a/sw/source/core/inc/DocumentContentOperationsManager.hxx b/sw/source/core/inc/DocumentContentOperationsManager.hxx
index a602933..48f2384 100644
--- a/sw/source/core/inc/DocumentContentOperationsManager.hxx
+++ b/sw/source/core/inc/DocumentContentOperationsManager.hxx
@@ -106,13 +106,11 @@ public:
                             const SwPaM* pCopiedPaM = NULL,
                             bool bMakeNewFrms = true,
                             bool bDelRedlines = true,
-                            bool bCopyFlyAtFly = false,
-                            const bool bMergedFirstNode = false ) const;
+                            bool bCopyFlyAtFly = false ) const;
     void CopyFlyInFlyImpl(  const SwNodeRange& rRg,
                             const sal_Int32 nEndContentIndex,
                             const SwNodeIndex& rStartIdx,
-                            const bool bCopyFlyAtFly = false,
-                            const bool bMergedFirstNode = false ) const;
+                            const bool bCopyFlyAtFly = false ) const;
 
     /// Parameters for _Rst and lcl_SetTextFormatColl
     //originallyfrom docfmt.cxx


More information about the Libreoffice-commits mailing list