You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ch...@apache.org on 2012/09/12 10:58:20 UTC

svn commit: r1383857 - in /incubator/ooo/trunk/main/sw: inc/ndtxt.hxx source/core/inc/flyfrm.hxx source/core/inc/txtfrm.hxx source/core/layout/fly.cxx source/core/txtnode/ndtxt.cxx source/core/txtnode/txtedt.cxx

Author: chengjh
Date: Wed Sep 12 08:58:19 2012
New Revision: 1383857

URL: http://svn.apache.org/viewvc?rev=1383857&view=rev
Log:
Fix issue #120881: Page number in footer display incorrectly

* sw/inc/ndtxt.hxx
* sw/source/core/inc/flyfrm.hxx
* sw/source/core/inc/txtfrm.hxx
* sw/source/core/layout/fly.cxx
* sw/source/core/txtnode/ndtxt.cxx
* sw/source/core/txtnode/txtedt.cxx
   Core function related to Interoperability with MS Word

Patch by: Jane Kang,<ka...@gmail.com>
Found by: Yan Ji,<ya...@gmail.com>
Review by: Jian Hong Cheng,<ch...@apache.org>

Modified:
    incubator/ooo/trunk/main/sw/inc/ndtxt.hxx
    incubator/ooo/trunk/main/sw/source/core/inc/flyfrm.hxx
    incubator/ooo/trunk/main/sw/source/core/inc/txtfrm.hxx
    incubator/ooo/trunk/main/sw/source/core/layout/fly.cxx
    incubator/ooo/trunk/main/sw/source/core/txtnode/ndtxt.cxx
    incubator/ooo/trunk/main/sw/source/core/txtnode/txtedt.cxx

Modified: incubator/ooo/trunk/main/sw/inc/ndtxt.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/inc/ndtxt.hxx?rev=1383857&r1=1383856&r2=1383857&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/inc/ndtxt.hxx (original)
+++ incubator/ooo/trunk/main/sw/inc/ndtxt.hxx Wed Sep 12 08:58:19 2012
@@ -196,6 +196,9 @@ class SW_DLLPUBLIC SwTxtNode: public SwC
     SW_DLLPRIVATE void impl_FmtToTxtAttr(const SfxItemSet& i_rAttrSet);
 
 public:
+	//Bug 120881:Modify here for Directly Page Numbering
+	bool HasPageNumberField();
+	//Bug 120881(End)
     bool IsWordCountDirty() const;
     bool IsWrongDirty() const;
     bool IsGrammarCheckDirty() const;
@@ -382,6 +385,10 @@ public:
      */
     SwTxtAttr *GetTxtAttrAt(xub_StrLen const nIndex, RES_TXTATR const nWhich,
                             enum GetTxtAttrMode const eMode = DEFAULT) const;
+	//Bug 120881:Modify here for Directly Page Numbering
+	SwTxtFld  *GetTxtFld( xub_StrLen const rIdx )
+				{ return (SwTxtFld *)GetTxtAttrAt( rIdx, RES_TXTATR_FIELD ); }
+	//Bug 120881(End)
 
     /** get the innermost text attributes covering position nIndex.
         @param nWhich   only attributes with this id are returned.

Modified: incubator/ooo/trunk/main/sw/source/core/inc/flyfrm.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/inc/flyfrm.hxx?rev=1383857&r1=1383856&r2=1383857&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/core/inc/flyfrm.hxx (original)
+++ incubator/ooo/trunk/main/sw/source/core/inc/flyfrm.hxx Wed Sep 12 08:58:19 2012
@@ -150,6 +150,9 @@ protected:
 	virtual	void Modify( const SfxPoolItem*, const SfxPoolItem* );
 
 public:
+//Bug 120881:Modify here for Directly Page Numbering
+	sal_Bool IsPageNumberingFrm();
+//Bug 120881(End)
     // OD 2004-03-23 #i26791#
     TYPEINFO();
 

Modified: incubator/ooo/trunk/main/sw/source/core/inc/txtfrm.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/inc/txtfrm.hxx?rev=1383857&r1=1383856&r2=1383857&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/core/inc/txtfrm.hxx (original)
+++ incubator/ooo/trunk/main/sw/source/core/inc/txtfrm.hxx Wed Sep 12 08:58:19 2012
@@ -239,6 +239,10 @@ public:
     SwRect SmartTagScan( SwCntntNode* , sal_uInt16 );
     // Wird vom CollectAutoCmplWords gerufen
     void CollectAutoCmplWrds( SwCntntNode* , sal_uInt16 );
+	
+	//Bug 120881:Modify here for Directly Page Numbering
+	sal_Bool HasPageNumberField();
+	//Bug 120881(End)
 
     // Returns the screen position of rPos. The values are relative to the upper
     // left position of the page frame.

Modified: incubator/ooo/trunk/main/sw/source/core/layout/fly.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/layout/fly.cxx?rev=1383857&r1=1383856&r2=1383857&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/core/layout/fly.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/core/layout/fly.cxx Wed Sep 12 08:58:19 2012
@@ -1532,8 +1532,17 @@ void SwFlyFrm::Format( const SwBorderAtt
                         nNewSize = nAutoWidth;
                 }
             }
-            else
-                nNewSize -= nLR;
+            /*else
+                nNewSize -= nLR;*/
+			else
+			{//Bug 120881:For enlarging fixed size Pagenumber frame,kangjian
+				if(nNewSize <= 500 && IsPageNumberingFrm())
+					nNewSize = nNewSize - nLR + 150;
+			
+				else
+					nNewSize -= nLR;
+			//Bug 120881(End)
+			}
 
             if( nNewSize < MINFLY )
                 nNewSize = MINFLY;
@@ -2967,3 +2976,39 @@ SwFlyFrmFmt * SwFlyFrm::GetFmt()
     return static_cast< SwFlyFrmFmt * >( GetDep() );
 }
 
+//Bug 120881:Modify here for Directly Page Numbering
+sal_Bool SwFlyFrm::IsPageNumberingFrm()
+{
+	if (!GetAnchorFrm())//Invalidate frame...
+		return false;
+	if (bInCnt || bLayout)//Incorrect anchor type...
+		return false;
+	if (!(GetAnchorFrm()->IsTxtFrm() && GetAnchorFrm()->GetUpper() 
+		&& (GetAnchorFrm()->GetUpper()->FindFooterOrHeader())))//Not in header or footer frame
+		return false;
+
+	if (pNextLink || pPrevLink)//Linked...
+		return false;
+
+	SwFrmFmt* pFmt = NULL;
+	if (pFmt = GetFmt())
+	{
+		if (pLower && pLower->GetNext() && pFmt->GetCol().GetNumCols()>1)//Has more than 1 column...
+			return false;
+	}
+
+	if (!pLower)//Do not has even 1 child frame?
+		return false;
+
+	for (SwFrm* pIter = pLower;pIter!=NULL;pIter=pIter->GetNext())
+	{
+		if (pIter->IsTxtFrm() && ((SwTxtFrm*)pIter)->HasPageNumberField())
+		{
+			return true;
+		}
+	}
+	return false;
+}
+
+//Bug 120881(End)
+

Modified: incubator/ooo/trunk/main/sw/source/core/txtnode/ndtxt.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/txtnode/ndtxt.cxx?rev=1383857&r1=1383856&r2=1383857&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/core/txtnode/ndtxt.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/core/txtnode/ndtxt.cxx Wed Sep 12 08:58:19 2012
@@ -5077,4 +5077,21 @@ SwTxtNode::MakeUnoObject()
             SwXParagraph::CreateXParagraph(*GetDoc(), *this), uno::UNO_QUERY);
     return xMeta;
 }
+//Bug 120881:Modify here for Directly Page Numbering
+bool SwTxtNode::HasPageNumberField()
+{
+	xub_StrLen nEnd = Len();
+	for(xub_StrLen nStart=0;nStart<nEnd;nStart++)
+	{
+		SwTxtFld* pFld = GetTxtFld(nStart);
+		const SwField* pSwField = NULL;
+		const SwFieldType* pType = NULL;
+		if (pFld && (pSwField=pFld->GetFld().GetFld()) && 
+			(pType=pSwField->GetTyp()) && pType->Which()==RES_PAGENUMBERFLD)
+			return true;
+	}
+	return false;
+
+}
+//Bug 120881(End)
 

Modified: incubator/ooo/trunk/main/sw/source/core/txtnode/txtedt.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/txtnode/txtedt.cxx?rev=1383857&r1=1383856&r2=1383857&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/core/txtnode/txtedt.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/core/txtnode/txtedt.cxx Wed Sep 12 08:58:19 2012
@@ -2211,3 +2211,11 @@ bool SwTxtNode::IsAutoCompleteWordDirty(
 //
 // Paragraph statistics end
 //
+
+//Bug 120881:Modify here for Directly Page Numbering
+sal_Bool SwTxtFrm::HasPageNumberField() 
+{
+	return GetRegisteredIn()?((SwTxtNode*)GetRegisteredIn())->HasPageNumberField():false;
+}
+//Bug 120881(End)
+