diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-01-09 18:01:08 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-01-09 18:22:24 +0100 |
commit | 0de00e2782493e8cf78710c40c98ca57b227244a (patch) | |
tree | 873f5af3b5a252489db6be00bddc150e8f8cf0e4 | |
parent | 01541c21b61fc1f26e452196b79324344c868f8e (diff) |
sw: remove references to ODF_COMMENTRANGE
Fieldmarks of type ODF_COMMENTRANGE are no longer used, since we got
annotation marks.
Also remove two unit tests: they tested problems which are no longer
possible by design (commented text ranges are no longer fieldmarks, and
there is a single placeholder character for them, instead of 3).
Change-Id: I14bf144c436329d2aa8c48493e5ad87db862cceb
-rw-r--r-- | sw/qa/core/uwriter.cxx | 42 | ||||
-rw-r--r-- | sw/source/core/crsr/pam.cxx | 15 | ||||
-rw-r--r-- | sw/source/core/crsr/swcrsr.cxx | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/attributeoutputbase.hxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.hxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.hxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8nds.cxx | 18 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8attributeoutput.hxx | 2 |
11 files changed, 6 insertions, 110 deletions
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index 3a7a8d456024..e5110d44a874 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -73,8 +73,6 @@ public: void testSwScanner(); void testUserPerceivedCharCount(); void testGraphicAnchorDeletion(); - void testFdo57938(); - void testFdo59573(); void testTransliterate(); CPPUNIT_TEST_SUITE(SwDocTest); @@ -87,8 +85,6 @@ public: CPPUNIT_TEST(testSwScanner); CPPUNIT_TEST(testUserPerceivedCharCount); CPPUNIT_TEST(testGraphicAnchorDeletion); - CPPUNIT_TEST(testFdo57938); - CPPUNIT_TEST(testFdo59573); CPPUNIT_TEST_SUITE_END(); private: @@ -855,44 +851,6 @@ void SwDocTest::randomTest() } } -void SwDocTest::testFdo57938() -{ - SwNodeIndex aIdx(m_pDoc->GetNodes().GetEndOfContent(), -1); - SwPaM aPaM(aIdx); - - // Insert "atest" and create a fieldmark around "test". - OUString aTest("atest"); - m_pDoc->InsertString(aPaM, aTest); - aPaM.SetMark(); - aPaM.GetPoint()->nContent = 1; - IDocumentMarkAccess* pMarksAccess = m_pDoc->getIDocumentMarkAccess(); - pMarksAccess->makeFieldBookmark(aPaM, "", ODF_COMMENTRANGE); - aPaM.GetPoint()->nContent = 0; - aPaM.GetMark()->nContent = 1; - // The problem was that "a" was considered read-only, so could not be deleted. - CPPUNIT_ASSERT_EQUAL(false, aPaM.HasReadonlySel(false)); -} - -void SwDocTest::testFdo59573() -{ - SwNodeIndex aIdx(m_pDoc->GetNodes().GetEndOfContent(), -1); - SwPaM aPaM(aIdx); - - // Insert "abc" and create a fieldmark around "b". - OUString aTest("abc"); - m_pDoc->InsertString(aPaM, aTest); - aPaM.SetMark(); - aPaM.GetPoint()->nContent = 1; - aPaM.GetMark()->nContent = 2; - IDocumentMarkAccess* pMarksAccess = m_pDoc->getIDocumentMarkAccess(); - pMarksAccess->makeFieldBookmark(aPaM, "", ODF_COMMENTRANGE); - aPaM.GetPoint()->nContent = 4; - aPaM.GetMark()->nContent = 4; - // The problem was that the position after the fieldmark end and before the - // annotation anchor wasn't read-only. - CPPUNIT_ASSERT_EQUAL(true, aPaM.HasReadonlySel(false)); -} - static OUString translitTest(SwDoc & rDoc, SwPaM & rPaM, sal_uInt32 const nType) { diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index 0eaccbe3af33..cb7831413734 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -665,7 +665,6 @@ bool SwPaM::HasReadonlySel( bool bFormView, bool bAnnotationMode ) const sw::mark::IMark* pA = NULL; sw::mark::IMark* pB = NULL; bool bUnhandledMark = false; - bool bCommentrangeMark = false; const IDocumentMarkAccess* pMarksAccess = pDoc->getIDocumentMarkAccess(); if ( pDoc ) { @@ -674,18 +673,7 @@ bool SwPaM::HasReadonlySel( bool bFormView, bool bAnnotationMode ) const sw::mark::IFieldmark* pFieldmark = pMarksAccess->getFieldmarkFor( *GetPoint() ); if ( pFieldmark ) - { bUnhandledMark = pFieldmark->GetFieldname( ) == ODF_UNHANDLED; - if (!bUnhandledMark) - bCommentrangeMark = pFieldmark->GetFieldname() == ODF_COMMENTRANGE; - } - // Allow editing selection right before a commented range. - if (!bCommentrangeMark && GetMark()) - { - pFieldmark = pMarksAccess->getFieldmarkFor(*GetMark()); - if (pFieldmark) - bCommentrangeMark = pFieldmark->GetFieldname() == ODF_COMMENTRANGE; - } } if (!bRet) @@ -693,8 +681,7 @@ bool SwPaM::HasReadonlySel( bool bFormView, bool bAnnotationMode ) const // Unhandled fieldmarks case shouldn't be edited manually to avoid breaking anything if ( ( pA == pB ) && bUnhandledMark ) bRet = true; - // Allow editing of commented ranges. - else if (!bCommentrangeMark) + else { // Form protection case bool bAtStartA = pA != NULL && pA->GetMarkStart() == *GetPoint(); diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 014a006dac46..20e3655d7974 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -48,7 +48,6 @@ #include <mdiexp.hxx> #include <statstr.hrc> #include <redline.hxx> -#include <xmloff/odffields.hxx> #include <txatbase.hxx> using namespace ::com::sun::star::i18n; @@ -1340,8 +1339,8 @@ sal_Bool SwCursor::SelectWordWT( SwViewShell* pViewShell, sal_Int16 nWordType, c { // Should we select the whole fieldmark? const IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess( ); - sw::mark::IFieldmark* pMark = GetPoint() ? pMarksAccess->getFieldmarkFor( *GetPoint( ) ) : NULL; - if ( pMark && pMark->GetFieldname() != ODF_COMMENTRANGE ) + sw::mark::IMark* pMark = GetPoint() ? pMarksAccess->getFieldmarkFor( *GetPoint( ) ) : NULL; + if ( pMark ) { const SwPosition rStart = pMark->GetMarkStart(); GetPoint()->nNode = rStart.nNode; diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx index 6ae14af54d41..8ed93db386ea 100644 --- a/sw/source/filter/ww8/attributeoutputbase.hxx +++ b/sw/source/filter/ww8/attributeoutputbase.hxx @@ -187,12 +187,6 @@ public: /// for docx w:commentReference virtual void WritePostitFieldReference() {}; - /// for docx w:commentRangeStart - virtual void WritePostitFieldStart() {}; - - /// for docx w:commentRangeEnd - virtual void WritePostitFieldEnd() {}; - /// Output text (inside a run). virtual void RunText( const OUString& rText, rtl_TextEncoding eCharSet ) = 0; diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index f992e5ba5575..84ffa5823614 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4657,14 +4657,6 @@ void DocxAttributeOutput::WritePostitFieldReference() } } -void DocxAttributeOutput::WritePostitFieldStart() -{ -} - -void DocxAttributeOutput::WritePostitFieldEnd() -{ -} - void DocxAttributeOutput::WritePostitFields() { for( unsigned int i = 0; diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index 69258b9fd964..9d55df68ffb4 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -161,10 +161,6 @@ public: virtual void WritePostitFieldReference(); - virtual void WritePostitFieldStart(); - - virtual void WritePostitFieldEnd(); - /// Output text (inside a run). virtual void RunText( const OUString& rText, rtl_TextEncoding eCharSet = RTL_TEXTENCODING_UTF8 ); diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 06939ffda827..4df549c473ee 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -3255,14 +3255,6 @@ void RtfAttributeOutput::PostitField( const SwField* pFld ) m_aRunText->append('}'); } -void RtfAttributeOutput::WritePostitFieldStart() -{ -} - -void RtfAttributeOutput::WritePostitFieldEnd() -{ -} - bool RtfAttributeOutput::DropdownField( const SwField* /*pFld*/ ) { // this is handled in OutputFlyFrame_Impl() diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx index d7ce5c8a60db..5a358815502a 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.hxx +++ b/sw/source/filter/ww8/rtfattributeoutput.hxx @@ -71,10 +71,6 @@ public: /// Called after we end outputting the attributes. virtual void EndRunProperties( const SwRedlineData* pRedlineData ); - virtual void WritePostitFieldStart() SAL_OVERRIDE; - - virtual void WritePostitFieldEnd() SAL_OVERRIDE; - /// Output text (inside a run). virtual void RunText( const OUString& rText, rtl_TextEncoding eCharSet = RTL_TEXTENCODING_UTF8 ); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 9d4818b5e07d..d641cbeb6740 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -1706,10 +1706,6 @@ bool MSWordExportBase::GetBookmarks( const SwTxtNode& rNd, sal_Int32 nStt, bool bIsStartOk = ( pMark->GetMarkStart().nNode == nNd ) && ( nBStart >= nStt ) && ( nBStart <= nEnd ); bool bIsEndOk = ( pMark->GetMarkEnd().nNode == nNd ) && ( nBEnd >= nStt ) && ( nBEnd <= nEnd ); - IFieldmark* pFieldmark = dynamic_cast<IFieldmark*>(pMark); - if (pFieldmark && pFieldmark->GetFieldname() == ODF_COMMENTRANGE) - continue; - if ( bIsStartOk || bIsEndOk ) { rArr.push_back( pMark ); @@ -2030,18 +2026,13 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) } } - bool bCommentRange = pFieldmark && pFieldmark->GetFieldname() == ODF_COMMENTRANGE; - if (bCommentRange) - AttrOutput().WritePostitFieldStart(); - else - OutputField( NULL, eFieldId, sCode, WRITEFIELD_START | WRITEFIELD_CMD_START ); + OutputField( NULL, eFieldId, sCode, WRITEFIELD_START | WRITEFIELD_CMD_START ); if ( pFieldmark && pFieldmark->GetFieldname( ) == ODF_FORMTEXT ) WriteFormData( *pFieldmark ); else if ( pFieldmark && pFieldmark->GetFieldname( ) == ODF_HYPERLINK ) WriteHyperlinkData( *pFieldmark ); - if (!bCommentRange) - OutputField( NULL, lcl_getFieldId( pFieldmark ), OUString(), WRITEFIELD_CMD_END ); + OutputField( NULL, lcl_getFieldId( pFieldmark ), OUString(), WRITEFIELD_CMD_END ); if ( pFieldmark && pFieldmark->GetFieldname() == ODF_UNHANDLED ) { @@ -2076,10 +2067,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) } } - if (pFieldmark && pFieldmark->GetFieldname() == ODF_COMMENTRANGE) - AttrOutput().WritePostitFieldEnd(); - else - OutputField( NULL, eFieldId, OUString(), WRITEFIELD_CLOSE ); + OutputField( NULL, eFieldId, OUString(), WRITEFIELD_CLOSE ); if ( pFieldmark && pFieldmark->GetFieldname() == ODF_FORMTEXT ) AppendBookmark( pFieldmark->GetName(), false ); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 418d20d5aa90..4a800b16d1a0 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -2488,10 +2488,6 @@ void WW8AttributeOutput::PostitField( const SwField* pFld ) m_rWW8Export.WritePostItBegin( m_rWW8Export.pO ); } -void WW8AttributeOutput::WritePostitFieldStart() -{ -} - bool WW8AttributeOutput::DropdownField( const SwField* pFld ) { bool bExpand = true; diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx index 924060b694c6..48e1e48a468d 100644 --- a/sw/source/filter/ww8/ww8attributeoutput.hxx +++ b/sw/source/filter/ww8/ww8attributeoutput.hxx @@ -418,8 +418,6 @@ protected: virtual bool DropdownField( const SwField* pFld ); virtual bool PlaceholderField( const SwField* pFld ); - virtual void WritePostitFieldStart(); - virtual bool AnalyzeURL( const OUString& rURL, const OUString& rTarget, OUString* pLinkURL, OUString* pMark ); /// Reference to the export, where to get the data from |