openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o..@apache.org
Subject svn commit: r1556797 - in /openoffice/trunk/main/sw: inc/ source/core/doc/ source/core/txtnode/ source/filter/ww8/ source/ui/chrdlg/ source/ui/shells/
Date Thu, 09 Jan 2014 12:59:28 GMT
Author: orw
Date: Thu Jan  9 12:59:28 2014
New Revision: 1556797

URL: http://svn.apache.org/r1556797
Log:
123988: assure that hyperlink attribute (<SwFmtINetFmt>) always provides character style
names for visited and unvisited state


Modified:
    openoffice/trunk/main/sw/inc/fmtinfmt.hxx
    openoffice/trunk/main/sw/source/core/doc/doctxm.cxx
    openoffice/trunk/main/sw/source/core/txtnode/fmtatr2.cxx
    openoffice/trunk/main/sw/source/core/txtnode/txtatr2.cxx
    openoffice/trunk/main/sw/source/filter/ww8/ww8atr.cxx
    openoffice/trunk/main/sw/source/filter/ww8/ww8par5.cxx
    openoffice/trunk/main/sw/source/ui/chrdlg/chardlg.cxx
    openoffice/trunk/main/sw/source/ui/shells/txtattr.cxx

Modified: openoffice/trunk/main/sw/inc/fmtinfmt.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/inc/fmtinfmt.hxx?rev=1556797&r1=1556796&r2=1556797&view=diff
==============================================================================
--- openoffice/trunk/main/sw/inc/fmtinfmt.hxx (original)
+++ openoffice/trunk/main/sw/inc/fmtinfmt.hxx Thu Jan  9 12:59:28 2014
@@ -38,15 +38,15 @@ class SW_DLLPUBLIC SwFmtINetFmt: public 
 {
 	friend class SwTxtINetFmt;
 
-	String aURL;					// die URL
-	String aTargetFrame;			// in diesen Frame soll die URL
-	String aINetFmt;
-	String aVisitedFmt;
-	String aName;					// Name des Links
-	SvxMacroTableDtor* pMacroTbl;
-	SwTxtINetFmt* pTxtAttr;			// mein TextAttribut
-	sal_uInt16 nINetId;
-	sal_uInt16 nVisitedId;
+	String msURL;					// die URL
+	String msTargetFrame;			// in diesen Frame soll die URL
+	String msINetFmtName;
+	String msVisitedFmtName;
+	String msHyperlinkName;					// Name des Links
+	SvxMacroTableDtor* mpMacroTbl;
+	SwTxtINetFmt* mpTxtAttr;			// mein TextAttribut
+	sal_uInt16 mnINetFmtId;
+	sal_uInt16 mnVisitedFmtId;
 public:
 	SwFmtINetFmt( const String& rURL, const String& rTarget );
 	SwFmtINetFmt( const SwFmtINetFmt& rAttr );
@@ -70,34 +70,81 @@ public:
 										sal_uInt8 nMemberId = 0 );
 
 
-	const SwTxtINetFmt* GetTxtINetFmt() const	{ return pTxtAttr; }
-	SwTxtINetFmt* GetTxtINetFmt()				{ return pTxtAttr; }
-
-	const String& GetValue() const 			{ return aURL; }
-
-	const String& GetName() const 			{ return aName; }
-	void SetName( const String& rNm )		{ aName = rNm; }
-
-	const String& GetTargetFrame() const 	{ return aTargetFrame; }
-
-	const String& GetINetFmt() const		{ return aINetFmt; }
-	void SetINetFmt( const String& rNm )	{ aINetFmt = rNm; }
-
-	const String& GetVisitedFmt() const		{ return aVisitedFmt; }
-	void SetVisitedFmt( const String& rNm )	{ aVisitedFmt = rNm; }
-
-	sal_uInt16 GetINetFmtId() const				{ return nINetId; }
-	void SetINetFmtId( sal_uInt16 nNew )		{ nINetId = nNew; }
-
-	sal_uInt16 GetVisitedFmtId() const			{ return nVisitedId; }
-	void SetVisitedFmtId( sal_uInt16 nNew )		{ nVisitedId = nNew; }
+	const SwTxtINetFmt* GetTxtINetFmt() const
+	{
+	    return mpTxtAttr;
+	}
+	SwTxtINetFmt* GetTxtINetFmt()
+	{
+	    return mpTxtAttr;
+	}
+
+	const String& GetValue() const
+	{
+	    return msURL;
+	}
+
+	const String& GetName() const
+	{
+	    return msHyperlinkName;
+	}
+	void SetName( const String& rNm )
+	{
+	    msHyperlinkName = rNm;
+	}
+
+	const String& GetTargetFrame() const
+	{
+	    return msTargetFrame;
+	}
+
+    void SetINetFmtAndId(
+            const String& rNm,
+            const sal_uInt16 nId )
+    {
+        msINetFmtName = rNm;
+        mnINetFmtId = nId;
+    }
+
+    const String& GetINetFmt() const
+    {
+        return msINetFmtName;
+    }
+
+    sal_uInt16 GetINetFmtId() const
+    {
+        return mnINetFmtId;
+    }
+
+    void SetVisitedFmtAndId(
+            const String& rNm,
+            const sal_uInt16 nId )
+    {
+        msVisitedFmtName = rNm;
+        mnVisitedFmtId = nId;
+    }
+
+    const String& GetVisitedFmt() const
+    {
+        return msVisitedFmtName;
+    }
+
+    sal_uInt16 GetVisitedFmtId() const
+    {
+        return mnVisitedFmtId;
+    }
 
 	// setze eine neue oder loesche die akt. MakroTabelle
 	void SetMacroTbl( const SvxMacroTableDtor* pTbl = 0 );
-	const SvxMacroTableDtor* GetMacroTbl() const	{ return pMacroTbl; }
+	const SvxMacroTableDtor* GetMacroTbl() const
+	{
+	    return mpMacroTbl;
+	}
 
 	// setze / erfrage ein Makro
-	void SetMacro( sal_uInt16 nEvent, const SvxMacro& rMacro );
+	void SetMacro(
+	        sal_uInt16 nEvent,
+	        const SvxMacro& rMacro );
 	const SvxMacro* GetMacro( sal_uInt16 nEvent ) const;
 };
 

Modified: openoffice/trunk/main/sw/source/core/doc/doctxm.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/doc/doctxm.cxx?rev=1556797&r1=1556796&r2=1556797&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/doc/doctxm.cxx (original)
+++ openoffice/trunk/main/sw/source/core/doc/doctxm.cxx Thu Jan  9 12:59:28 2014
@@ -1877,20 +1877,12 @@ void SwTOXBaseSection::GenerateText( sal
 					}
                     LinkStruct* pNewLink = new LinkStruct(sURL, nLinkStartPosition,
                                                     nEnd);
-                    pNewLink->aINetFmt.SetVisitedFmt(sLinkCharacterStyle);
-                    pNewLink->aINetFmt.SetINetFmt(sLinkCharacterStyle);
-                    if(sLinkCharacterStyle.Len())
-                    {
-                        sal_uInt16 nPoolId =
-                            SwStyleNameMapper::GetPoolIdFromUIName( sLinkCharacterStyle,
nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
-                        pNewLink->aINetFmt.SetVisitedFmtId(nPoolId);
-                        pNewLink->aINetFmt.SetINetFmtId(nPoolId);
-                    }
-                    else
-                    {
-                        pNewLink->aINetFmt.SetVisitedFmtId(USHRT_MAX);
-                        pNewLink->aINetFmt.SetINetFmtId(USHRT_MAX);
-                    }
+                    const sal_uInt16 nPoolId =
+                            sLinkCharacterStyle.Len() == 0
+                            ? USHRT_MAX
+                            : SwStyleNameMapper::GetPoolIdFromUIName( sLinkCharacterStyle,
nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
+                    pNewLink->aINetFmt.SetVisitedFmtAndId( sLinkCharacterStyle, nPoolId
);
+                    pNewLink->aINetFmt.SetINetFmtAndId( sLinkCharacterStyle, nPoolId );
                     aLinkArr.Insert( pNewLink, aLinkArr.Count() );
 					nLinkStartPosition = STRING_NOTFOUND;
                     sLinkCharacterStyle.Erase();

Modified: openoffice/trunk/main/sw/source/core/txtnode/fmtatr2.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/txtnode/fmtatr2.cxx?rev=1556797&r1=1556796&r2=1556797&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/txtnode/fmtatr2.cxx (original)
+++ openoffice/trunk/main/sw/source/core/txtnode/fmtatr2.cxx Thu Jan  9 12:59:28 2014
@@ -24,7 +24,8 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
-#include "hintids.hxx"
+#include <hintids.hxx>
+#include <poolfmt.hxx>
 #include "unomid.h"
 
 #include <basic/sbxvar.hxx>
@@ -194,43 +195,53 @@ sal_Bool SwFmtAutoFmt::PutValue( const u
 *************************************************************************/
 
 SwFmtINetFmt::SwFmtINetFmt()
-	: SfxPoolItem( RES_TXTATR_INETFMT ),
-    pMacroTbl( 0 ),
-    pTxtAttr( 0 ),
-    nINetId( 0 ),
-	nVisitedId( 0 )
+	: SfxPoolItem( RES_TXTATR_INETFMT )
+    , msURL()
+    , msTargetFrame()
+    , msINetFmtName()
+    , msVisitedFmtName()
+    , msHyperlinkName()
+    , mpMacroTbl( 0 )
+    , mpTxtAttr( 0 )
+    , mnINetFmtId( 0 )
+    , mnVisitedFmtId( 0 )
 {}
 
 SwFmtINetFmt::SwFmtINetFmt( const XubString& rURL, const XubString& rTarget )
-	: SfxPoolItem( RES_TXTATR_INETFMT ),
-	aURL( rURL ),
-	aTargetFrame( rTarget ),
-    pMacroTbl( 0 ),
-    pTxtAttr( 0 ),
-    nINetId( 0 ),
-	nVisitedId( 0 )
+    : SfxPoolItem( RES_TXTATR_INETFMT )
+    , msURL( rURL )
+    , msTargetFrame( rTarget )
+    , msINetFmtName()
+    , msVisitedFmtName()
+    , msHyperlinkName()
+    , mpMacroTbl( 0 )
+    , mpTxtAttr( 0 )
+    , mnINetFmtId( RES_POOLCHR_INET_NORMAL )
+    , mnVisitedFmtId( RES_POOLCHR_INET_VISIT )
 {
+    SwStyleNameMapper::FillUIName( mnINetFmtId, msINetFmtName );
+    SwStyleNameMapper::FillUIName( mnVisitedFmtId, msVisitedFmtName );
 }
 
 SwFmtINetFmt::SwFmtINetFmt( const SwFmtINetFmt& rAttr )
-	: SfxPoolItem( RES_TXTATR_INETFMT ),
-	aURL( rAttr.GetValue() ),
-    aTargetFrame( rAttr.aTargetFrame ),
-    aINetFmt( rAttr.aINetFmt ),
-    aVisitedFmt( rAttr.aVisitedFmt ),
-    aName( rAttr.aName ),
-    pMacroTbl( 0 ),
-    pTxtAttr( 0 ),
-    nINetId( rAttr.nINetId ),
-	nVisitedId( rAttr.nVisitedId )
+	: SfxPoolItem( RES_TXTATR_INETFMT )
+    , msURL( rAttr.GetValue() )
+    , msTargetFrame( rAttr.msTargetFrame )
+    , msINetFmtName( rAttr.msINetFmtName )
+    , msVisitedFmtName( rAttr.msVisitedFmtName )
+    , msHyperlinkName( rAttr.msHyperlinkName )
+    , mpMacroTbl( 0 )
+    , mpTxtAttr( 0 )
+    , mnINetFmtId( rAttr.mnINetFmtId )
+    , mnVisitedFmtId( rAttr.mnVisitedFmtId )
 {
-	if( rAttr.GetMacroTbl() )
-		pMacroTbl = new SvxMacroTableDtor( *rAttr.GetMacroTbl() );
+    if ( rAttr.GetMacroTbl() )
+        mpMacroTbl = new SvxMacroTableDtor( *rAttr.GetMacroTbl() );
 }
 
 SwFmtINetFmt::~SwFmtINetFmt()
 {
-	delete pMacroTbl;
+	delete mpMacroTbl;
 }
 
 
@@ -239,24 +250,24 @@ int SwFmtINetFmt::operator==( const SfxP
 {
 	ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
 	sal_Bool bRet = SfxPoolItem::operator==( (SfxPoolItem&) rAttr )
-				&& aURL == ((SwFmtINetFmt&)rAttr).aURL
-				&& aName == ((SwFmtINetFmt&)rAttr).aName
-				&& aTargetFrame == ((SwFmtINetFmt&)rAttr).aTargetFrame
-				&& aINetFmt == ((SwFmtINetFmt&)rAttr).aINetFmt
-				&& aVisitedFmt == ((SwFmtINetFmt&)rAttr).aVisitedFmt
-				&& nINetId == ((SwFmtINetFmt&)rAttr).nINetId
-				&& nVisitedId == ((SwFmtINetFmt&)rAttr).nVisitedId;
+				&& msURL == ((SwFmtINetFmt&)rAttr).msURL
+				&& msHyperlinkName == ((SwFmtINetFmt&)rAttr).msHyperlinkName
+				&& msTargetFrame == ((SwFmtINetFmt&)rAttr).msTargetFrame
+				&& msINetFmtName == ((SwFmtINetFmt&)rAttr).msINetFmtName
+				&& msVisitedFmtName == ((SwFmtINetFmt&)rAttr).msVisitedFmtName
+				&& mnINetFmtId == ((SwFmtINetFmt&)rAttr).mnINetFmtId
+				&& mnVisitedFmtId == ((SwFmtINetFmt&)rAttr).mnVisitedFmtId;
 
 	if( !bRet )
 		return sal_False;
 
-	const SvxMacroTableDtor* pOther = ((SwFmtINetFmt&)rAttr).pMacroTbl;
-	if( !pMacroTbl )
+	const SvxMacroTableDtor* pOther = ((SwFmtINetFmt&)rAttr).mpMacroTbl;
+	if( !mpMacroTbl )
 		return ( !pOther || !pOther->Count() );
 	if( !pOther )
-		return 0 == pMacroTbl->Count();
+		return 0 == mpMacroTbl->Count();
 
-	const SvxMacroTableDtor& rOwn = *pMacroTbl;
+	const SvxMacroTableDtor& rOwn = *mpMacroTbl;
 	const SvxMacroTableDtor& rOther = *pOther;
 
 	// Anzahl unterschiedlich => auf jeden Fall ungleich
@@ -289,30 +300,30 @@ void SwFmtINetFmt::SetMacroTbl( const Sv
 {
 	if( pNewTbl )
 	{
-		if( pMacroTbl )
-			*pMacroTbl = *pNewTbl;
+		if( mpMacroTbl )
+			*mpMacroTbl = *pNewTbl;
 		else
-			pMacroTbl = new SvxMacroTableDtor( *pNewTbl );
+			mpMacroTbl = new SvxMacroTableDtor( *pNewTbl );
 	}
-	else if( pMacroTbl )
-		delete pMacroTbl, pMacroTbl = 0;
+	else if( mpMacroTbl )
+		delete mpMacroTbl, mpMacroTbl = 0;
 }
 
 
 
 void SwFmtINetFmt::SetMacro( sal_uInt16 nEvent, const SvxMacro& rMacro )
 {
-	if( !pMacroTbl )
-		pMacroTbl = new SvxMacroTableDtor;
+	if( !mpMacroTbl )
+		mpMacroTbl = new SvxMacroTableDtor;
 
 	SvxMacro *pOldMacro;
-	if( 0 != ( pOldMacro = pMacroTbl->Get( nEvent )) )
+	if( 0 != ( pOldMacro = mpMacroTbl->Get( nEvent )) )
 	{
 		delete pOldMacro;
-		pMacroTbl->Replace( nEvent, new SvxMacro( rMacro ) );
+		mpMacroTbl->Replace( nEvent, new SvxMacro( rMacro ) );
 	}
 	else
-		pMacroTbl->Insert( nEvent, new SvxMacro( rMacro ) );
+		mpMacroTbl->Insert( nEvent, new SvxMacro( rMacro ) );
 }
 
 
@@ -320,8 +331,8 @@ void SwFmtINetFmt::SetMacro( sal_uInt16 
 const SvxMacro* SwFmtINetFmt::GetMacro( sal_uInt16 nEvent ) const
 {
 	const SvxMacro* pRet = 0;
-	if( pMacroTbl && pMacroTbl->IsKeyValid( nEvent ) )
-		pRet = pMacroTbl->Get( nEvent );
+	if( mpMacroTbl && mpMacroTbl->IsKeyValid( nEvent ) )
+		pRet = mpMacroTbl->Get( nEvent );
 	return pRet;
 }
 
@@ -335,25 +346,25 @@ sal_Bool SwFmtINetFmt::QueryValue( uno::
 	switch(nMemberId)
 	{
 		case MID_URL_URL:
-			sVal = aURL;
+			sVal = msURL;
 		break;
 		case MID_URL_TARGET:
-			sVal = aTargetFrame;
+			sVal = msTargetFrame;
 		break;
 		case MID_URL_HYPERLINKNAME:
-			sVal = aName;
+			sVal = msHyperlinkName;
 		break;
 		case MID_URL_VISITED_FMT:
-			sVal = aVisitedFmt;
-			if( !sVal.Len() && nVisitedId != 0 )
-				SwStyleNameMapper::FillUIName( nVisitedId, sVal );
+			sVal = msVisitedFmtName;
+			if( !sVal.Len() && mnVisitedFmtId != 0 )
+				SwStyleNameMapper::FillUIName( mnVisitedFmtId, sVal );
 			if( sVal.Len() )
 				SwStyleNameMapper::FillProgName( sVal, sVal, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
sal_True );
 		break;
 		case MID_URL_UNVISITED_FMT:
-			sVal = aINetFmt;
-			if( !sVal.Len() && nINetId != 0 )
-				SwStyleNameMapper::FillUIName( nINetId, sVal );
+			sVal = msINetFmtName;
+			if( !sVal.Len() && mnINetFmtId != 0 )
+				SwStyleNameMapper::FillUIName( mnINetFmtId, sVal );
 			if( sVal.Len() )
 				SwStyleNameMapper::FillProgName( sVal, sVal, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
sal_True );
 		break;
@@ -411,20 +422,20 @@ sal_Bool SwFmtINetFmt::PutValue( const u
 		switch(nMemberId)
 		{
 			case MID_URL_URL:
-				aURL = sVal;
+				msURL = sVal;
 				break;
 			case MID_URL_TARGET:
-				aTargetFrame = sVal;
+				msTargetFrame = sVal;
 				break;
 			case MID_URL_HYPERLINKNAME:
-				aName = sVal;
+				msHyperlinkName = sVal;
 				break;
 			case MID_URL_VISITED_FMT:
 			{
 				String aString;
 				SwStyleNameMapper::FillUIName( sVal, aString, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
sal_True );
-				aVisitedFmt = OUString ( aString );
-				nVisitedId = SwStyleNameMapper::GetPoolIdFromUIName( aVisitedFmt,
+				msVisitedFmtName = OUString ( aString );
+				mnVisitedFmtId = SwStyleNameMapper::GetPoolIdFromUIName( msVisitedFmtName,
 											   nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
 			}
 			break;
@@ -432,8 +443,8 @@ sal_Bool SwFmtINetFmt::PutValue( const u
 			{
 				String aString;
 				SwStyleNameMapper::FillUIName( sVal, aString, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
sal_True );
-				aINetFmt = OUString ( aString );
-				nINetId = SwStyleNameMapper::GetPoolIdFromUIName( aINetFmt,	nsSwGetPoolIdFromName::GET_POOLID_CHRFMT
);
+				msINetFmtName = OUString ( aString );
+				mnINetFmtId = SwStyleNameMapper::GetPoolIdFromUIName( msINetFmtName,	nsSwGetPoolIdFromName::GET_POOLID_CHRFMT
);
 			}
 			break;
 			default:

Modified: openoffice/trunk/main/sw/source/core/txtnode/txtatr2.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/txtnode/txtatr2.cxx?rev=1556797&r1=1556796&r2=1556797&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/txtnode/txtatr2.cxx (original)
+++ openoffice/trunk/main/sw/source/core/txtnode/txtatr2.cxx Thu Jan  9 12:59:28 2014
@@ -123,7 +123,7 @@ SwTxtINetFmt::SwTxtINetFmt( SwFmtINetFmt
     , m_bVisited( false )
     , m_bVisitedValid( false )
 {
-    rAttr.pTxtAttr  = this;
+    rAttr.mpTxtAttr  = this;
     SetCharFmtAttr( true );
 }
 
@@ -133,52 +133,52 @@ SwTxtINetFmt::~SwTxtINetFmt( )
 
 SwCharFmt* SwTxtINetFmt::GetCharFmt()
 {
-	const SwFmtINetFmt& rFmt = SwTxtAttrEnd::GetINetFmt();
-	SwCharFmt* pRet = NULL;
+    const SwFmtINetFmt& rFmt = SwTxtAttrEnd::GetINetFmt();
+    SwCharFmt* pRet = NULL;
 
-	if( rFmt.GetValue().Len() )
-	{
-		const SwDoc* pDoc = GetTxtNode().GetDoc();
+    if ( rFmt.GetValue().Len() )
+    {
+        const SwDoc* pDoc = GetTxtNode().GetDoc();
         if( !IsVisitedValid() )
         {
-			SetVisited( pDoc->IsVisitedURL( rFmt.GetValue() ) );
+            SetVisited( pDoc->IsVisitedURL( rFmt.GetValue() ) );
             SetVisitedValid( true );
         }
-		sal_uInt16 nId;
-		const String& rStr = IsVisited() ? rFmt.GetVisitedFmt()
-										   : rFmt.GetINetFmt();
-		if( rStr.Len() )
-			nId = IsVisited() ? rFmt.GetVisitedFmtId() : rFmt.GetINetFmtId();
-		else
-			nId = static_cast<sal_uInt16>(IsVisited() ? RES_POOLCHR_INET_VISIT : RES_POOLCHR_INET_NORMAL);
 
-		// JP 10.02.2000, Bug 72806: dont modify the doc for getting the
-		//		correct charstyle.
-		sal_Bool bResetMod = !pDoc->IsModified();
-		Link aOle2Lnk;
-		if( bResetMod )
-		{
-			aOle2Lnk = pDoc->GetOle2Link();
-			((SwDoc*)pDoc)->SetOle2Link( Link() );
-		}
+        const sal_uInt16 nId = IsVisited() ? rFmt.GetVisitedFmtId() : rFmt.GetINetFmtId();
+        const String& rStr = IsVisited() ? rFmt.GetVisitedFmt() : rFmt.GetINetFmt();
+        if ( rStr.Len() == 0 )
+        {
+            ASSERT( false, "<SwTxtINetFmt::GetCharFmt()> - missing character format
at hyperlink attribute");
+        }
 
-		pRet = IsPoolUserFmt( nId )
-				? ((SwDoc*)pDoc)->FindCharFmtByName( rStr )
-				: ((SwDoc*)pDoc)->GetCharFmtFromPool( nId );
+        // JP 10.02.2000, Bug 72806: dont modify the doc for getting the
+        //		correct charstyle.
+        sal_Bool bResetMod = !pDoc->IsModified();
+        Link aOle2Lnk;
+        if ( bResetMod )
+        {
+            aOle2Lnk = pDoc->GetOle2Link();
+            ( (SwDoc*) pDoc )->SetOle2Link( Link() );
+        }
 
-		if( bResetMod )
-		{
-			((SwDoc*)pDoc)->ResetModified();
-			((SwDoc*)pDoc)->SetOle2Link( aOle2Lnk );
-		}
-	}
+        pRet = IsPoolUserFmt( nId )
+               ? ( (SwDoc*) pDoc )->FindCharFmtByName( rStr )
+               : ( (SwDoc*) pDoc )->GetCharFmtFromPool( nId );
 
-	if( pRet )
-		pRet->Add( this );
-	else if( GetRegisteredIn() )
-		GetRegisteredInNonConst()->Remove( this );
+        if ( bResetMod )
+        {
+            ( (SwDoc*) pDoc )->ResetModified();
+            ( (SwDoc*) pDoc )->SetOle2Link( aOle2Lnk );
+        }
+    }
 
-	return pRet;
+    if ( pRet )
+        pRet->Add( this );
+    else if ( GetRegisteredIn() )
+        GetRegisteredInNonConst()->Remove( this );
+
+    return pRet;
 }
 
 void SwTxtINetFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )

Modified: openoffice/trunk/main/sw/source/filter/ww8/ww8atr.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/ww8/ww8atr.cxx?rev=1556797&r1=1556796&r2=1556797&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/ww8/ww8atr.cxx (original)
+++ openoffice/trunk/main/sw/source/filter/ww8/ww8atr.cxx Thu Jan  9 12:59:28 2014
@@ -1680,12 +1680,12 @@ void WW8AttributeOutput::TextINetFormat(
 {
     if ( rINet.GetValue().Len() )
     {
-        sal_uInt16 nId;
+        const sal_uInt16 nId = rINet.GetINetFmtId();
         const String& rStr = rINet.GetINetFmt();
-        if ( rStr.Len() )
-            nId = rINet.GetINetFmtId();
-        else
-            nId = RES_POOLCHR_INET_NORMAL;
+        if ( rStr.Len() == 0 )
+        {
+            ASSERT( false, "WW8AttributeOutput::TextINetFormat(..) - missing unvisited character
format at hyperlink attribute" );
+        }
 
         const SwCharFmt* pFmt = IsPoolUserFmt( nId )
                         ? m_rWW8Export.pDoc->FindCharFmtByName( rStr )

Modified: openoffice/trunk/main/sw/source/filter/ww8/ww8par5.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/ww8/ww8par5.cxx?rev=1556797&r1=1556796&r2=1556797&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/ww8/ww8par5.cxx (original)
+++ openoffice/trunk/main/sw/source/filter/ww8/ww8par5.cxx Thu Jan  9 12:59:28 2014
@@ -2195,13 +2195,11 @@ eF_ResT SwWW8ImplReader::Read_F_PgRef( W
             sURL += sBookmarkName;
             const String sTarget;
             SwFmtINetFmt aURL( sURL, sTarget );
-            String sLinkStyle = String::CreateFromAscii("Index Link");
-            sal_uInt16 nPoolId =
+            const String sLinkStyle = String::CreateFromAscii("Index Link");
+            const sal_uInt16 nPoolId =
                 SwStyleNameMapper::GetPoolIdFromUIName( sLinkStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT
);
-            aURL.SetVisitedFmt(sLinkStyle);
-            aURL.SetINetFmt(sLinkStyle);
-            aURL.SetVisitedFmtId(nPoolId);
-            aURL.SetINetFmtId(nPoolId);
+            aURL.SetVisitedFmtAndId( sLinkStyle, nPoolId);
+            aURL.SetINetFmtAndId( sLinkStyle, nPoolId );
             pCtrlStck->NewAttr( *pPaM->GetPoint(), aURL );
         }
         return FLD_TEXT;
@@ -3659,10 +3657,8 @@ eF_ResT SwWW8ImplReader::Read_F_Hyperlin
         String sLinkStyle = String::CreateFromAscii("Index Link");
         sal_uInt16 nPoolId =
             SwStyleNameMapper::GetPoolIdFromUIName( sLinkStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT
);
-        aURL.SetVisitedFmt(sLinkStyle);
-        aURL.SetINetFmt(sLinkStyle);
-        aURL.SetVisitedFmtId(nPoolId);
-        aURL.SetINetFmtId(nPoolId);
+        aURL.SetVisitedFmtAndId( sLinkStyle, nPoolId );
+        aURL.SetINetFmtAndId( sLinkStyle, nPoolId );
     }
 
     //As an attribute this needs to be closed, and that'll happen from

Modified: openoffice/trunk/main/sw/source/ui/chrdlg/chardlg.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/ui/chrdlg/chardlg.cxx?rev=1556797&r1=1556796&r2=1556797&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/ui/chrdlg/chardlg.cxx (original)
+++ openoffice/trunk/main/sw/source/ui/chrdlg/chardlg.cxx Thu Jan  9 12:59:28 2014
@@ -275,24 +275,31 @@ SwCharURLPage::~SwCharURLPage()
 
 void SwCharURLPage::Reset(const SfxItemSet& rSet)
 {
-	const SfxPoolItem* pItem;
-	if(SFX_ITEM_SET == rSet.GetItemState(RES_TXTATR_INETFMT, sal_False, &pItem))
-	{
-		const SwFmtINetFmt* pINetFmt = (const SwFmtINetFmt*)pItem;
-		aURLED.SetText( INetURLObject::decode( pINetFmt->GetValue(),
-										INET_HEX_ESCAPE,
-						   				INetURLObject::DECODE_UNAMBIGUOUS,
-										RTL_TEXTENCODING_UTF8 ));
-		aURLED.SaveValue();
-		aNameED.SetText(pINetFmt->GetName());
-		String sEntry = pINetFmt->GetVisitedFmt();
-		if( !sEntry.Len() )
-			SwStyleNameMapper::FillUIName( RES_POOLCHR_INET_VISIT, sEntry );
-		aVisitedLB.SelectEntry(sEntry);
-		sEntry = pINetFmt->GetINetFmt();
-		if(!sEntry.Len())
-			SwStyleNameMapper::FillUIName( RES_POOLCHR_INET_NORMAL, sEntry );
-		aNotVisitedLB.SelectEntry(sEntry);
+    const SfxPoolItem* pItem;
+    if ( SFX_ITEM_SET == rSet.GetItemState( RES_TXTATR_INETFMT, sal_False, &pItem ) )
+    {
+        const SwFmtINetFmt* pINetFmt = (const SwFmtINetFmt*) pItem;
+        aURLED.SetText( INetURLObject::decode( pINetFmt->GetValue(),
+        INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS,
+        RTL_TEXTENCODING_UTF8 ) );
+        aURLED.SaveValue();
+        aNameED.SetText( pINetFmt->GetName() );
+
+        String sEntry = pINetFmt->GetVisitedFmt();
+        if ( sEntry.Len() == 0 )
+        {
+            ASSERT( false, "<SwCharURLPage::Reset(..)> - missing visited character
format at hyperlink attribute" );
+            SwStyleNameMapper::FillUIName( RES_POOLCHR_INET_VISIT, sEntry );
+        }
+        aVisitedLB.SelectEntry( sEntry );
+
+        sEntry = pINetFmt->GetINetFmt();
+        if ( sEntry.Len() == 0 )
+        {
+            ASSERT( false, "<SwCharURLPage::Reset(..)> - missing unvisited character
format at hyperlink attribute" );
+            SwStyleNameMapper::FillUIName( RES_POOLCHR_INET_NORMAL, sEntry );
+        }
+        aNotVisitedLB.SelectEntry( sEntry );
 
 		aTargetFrmLB.SetText(pINetFmt->GetTargetFrame());
 		aVisitedLB.   SaveValue();
@@ -337,13 +344,11 @@ sal_Bool SwCharURLPage::FillItemSet(SfxI
 	//zuerst die gueltigen Einstellungen setzen
 	String sEntry = aVisitedLB.GetSelectEntry();
 	sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( sEntry, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
-	aINetFmt.SetVisitedFmtId(nId);
-	aINetFmt.SetVisitedFmt(nId == RES_POOLCHR_INET_VISIT ? aEmptyStr : sEntry);
+	aINetFmt.SetVisitedFmtAndId( sEntry, nId );
 
 	sEntry = aNotVisitedLB.GetSelectEntry();
 	nId = SwStyleNameMapper::GetPoolIdFromUIName( sEntry, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
-	aINetFmt.SetINetFmtId( nId );
-	aINetFmt.SetINetFmt(nId == RES_POOLCHR_INET_NORMAL ? aEmptyStr : sEntry);
+	aINetFmt.SetINetFmtAndId( sEntry, nId );
 
 	if( pINetItem && pINetItem->GetMacroTable().Count() )
 		aINetFmt.SetMacroTbl( &pINetItem->GetMacroTable() );

Modified: openoffice/trunk/main/sw/source/ui/shells/txtattr.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/ui/shells/txtattr.cxx?rev=1556797&r1=1556796&r2=1556797&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/ui/shells/txtattr.cxx (original)
+++ openoffice/trunk/main/sw/source/ui/shells/txtattr.cxx Thu Jan  9 12:59:28 2014
@@ -197,47 +197,52 @@ void SwTextShell::ExecCharAttr(SfxReques
 void SwTextShell::ExecCharAttrArgs(SfxRequest &rReq)
 {
     sal_uInt16 nSlot = rReq.GetSlot();
-	const SfxItemSet* pArgs = rReq.GetArgs();
-	sal_Bool bArgs = pArgs != 0 && pArgs->Count() > 0;
-	int bGrow = sal_False;
-	SwWrtShell& rWrtSh = GetShell();
-	SwTxtFmtColl* pColl = 0;
+    const SfxItemSet* pArgs = rReq.GetArgs();
+    sal_Bool bArgs = pArgs != 0 && pArgs->Count() > 0;
+    int bGrow = sal_False;
+    SwWrtShell& rWrtSh = GetShell();
+    SwTxtFmtColl* pColl = 0;
 
-	// nur gesetzt, wenn gesamter Absatz selektiert ist und AutoUpdateFmt gesetzt ist
-	if( rWrtSh.HasSelection() && rWrtSh.IsSelFullPara() )
-	{
-		pColl = rWrtSh.GetCurTxtFmtColl();
-		if(pColl && !pColl->IsAutoUpdateFmt())
-			pColl = 0;
-	}
-	SfxItemPool& rPool = GetPool();
-	sal_uInt16 nWhich = rPool.GetWhich(nSlot);
-	switch ( nSlot )
-	{
-		case FN_TXTATR_INET:
-		// Sonderbehandlung der PoolId des SwFmtInetFmt
-		if(bArgs)
-		{
-			const SfxPoolItem& rItem = pArgs->Get(nWhich );
+    // nur gesetzt, wenn gesamter Absatz selektiert ist und AutoUpdateFmt gesetzt ist
+    if ( rWrtSh.HasSelection() && rWrtSh.IsSelFullPara() )
+    {
+        pColl = rWrtSh.GetCurTxtFmtColl();
+        if ( pColl && !pColl->IsAutoUpdateFmt() )
+            pColl = 0;
+    }
+    SfxItemPool& rPool = GetPool();
+    sal_uInt16 nWhich = rPool.GetWhich( nSlot );
+    switch (nSlot)
+    {
+    case FN_TXTATR_INET:
+        // Sonderbehandlung der PoolId des SwFmtInetFmt
+        if ( bArgs )
+        {
+            const SfxPoolItem& rItem = pArgs->Get( nWhich );
 
-			SwFmtINetFmt aINetFmt((const SwFmtINetFmt&)rItem);
-			if( USHRT_MAX == aINetFmt.GetVisitedFmtId() )
-			{
-				aINetFmt.SetVisitedFmtId(
-						SwStyleNameMapper::GetPoolIdFromUIName( aINetFmt.GetVisitedFmt(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT));
-			}
-			if( USHRT_MAX == aINetFmt.GetINetFmtId() )
-			{
-				aINetFmt.SetINetFmtId(
-						SwStyleNameMapper::GetPoolIdFromUIName( aINetFmt.GetINetFmt(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT));
-			}
+            SwFmtINetFmt aINetFmt( (const SwFmtINetFmt&) rItem );
+            if ( USHRT_MAX == aINetFmt.GetVisitedFmtId() )
+            {
+                ASSERT( false, "<SwTextShell::ExecCharAttrArgs(..)> - unexpected visited
character format ID at hyperlink attribute" );
+                aINetFmt.SetVisitedFmtAndId(
+                        aINetFmt.GetVisitedFmt(),
+                        SwStyleNameMapper::GetPoolIdFromUIName( aINetFmt.GetVisitedFmt(),
nsSwGetPoolIdFromName::GET_POOLID_CHRFMT ) );
+            }
+            if ( USHRT_MAX == aINetFmt.GetINetFmtId() )
+            {
+                ASSERT( false, "<SwTextShell::ExecCharAttrArgs(..)> - unexpected unvisited
character format ID at hyperlink attribute" );
+                aINetFmt.SetINetFmtAndId(
+                        aINetFmt.GetINetFmt(),
+                        SwStyleNameMapper::GetPoolIdFromUIName( aINetFmt.GetINetFmt(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT
) );
+            }
 
-			if ( pColl )
+            if ( pColl )
                 pColl->SetFmtAttr( aINetFmt );
-			else rWrtSh.SetAttrItem( aINetFmt );
+            else
+                rWrtSh.SetAttrItem( aINetFmt );
             rReq.Done();
-		}
-		break;
+        }
+        break;
 
 		case FN_GROW_FONT_SIZE:
 			bGrow = sal_True;



Mime
View raw message