[Libreoffice-commits] core.git: Branch 'aoo/trunk' - sw/inc sw/source
Oliver-Rainer Wittmann
orw at apache.org
Thu Jan 9 06:08:15 PST 2014
sw/inc/fmtinfmt.hxx | 111 ++++++++++++++++++++---------
sw/source/core/doc/doctxm.cxx | 20 +----
sw/source/core/txtnode/fmtatr2.cxx | 141 +++++++++++++++++++------------------
sw/source/core/txtnode/txtatr2.cxx | 36 ++++-----
sw/source/filter/ww8/ww8atr.cxx | 10 +-
sw/source/filter/ww8/ww8par5.cxx | 16 +---
sw/source/ui/chrdlg/chardlg.cxx | 33 ++++----
sw/source/ui/shells/txtattr.cxx | 35 +++++----
8 files changed, 229 insertions(+), 173 deletions(-)
New commits:
commit c15b814d6e8ea429287def9a0bf3ac71db414119
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Thu Jan 9 12:59:28 2014 +0000
123988: assure that hyperlink attribute (<SwFmtINetFmt>) always provides character style names for visited and unvisited state
diff --git a/sw/inc/fmtinfmt.hxx b/sw/inc/fmtinfmt.hxx
index 276f8df..e7c4652 100644
--- a/sw/inc/fmtinfmt.hxx
+++ b/sw/inc/fmtinfmt.hxx
@@ -38,15 +38,15 @@ class SW_DLLPUBLIC SwFmtINetFmt: public SfxPoolItem
{
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;
};
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index e2f07aa..bf33301 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1877,20 +1877,12 @@ void SwTOXBaseSection::GenerateText( sal_uInt16 nArrayIdx,
}
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();
diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx
index 273fe53..4d98c0a 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -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 uno::Any& , sal_uInt8 )
*************************************************************************/
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 SfxPoolItem& rAttr ) const
{
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 SvxMacroTableDtor* pNewTbl )
{
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 nEvent, const SvxMacro& rMacro )
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::Any& rVal, sal_uInt8 nMemberId ) const
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 uno::Any& rVal, sal_uInt8 nMemberId )
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 uno::Any& rVal, sal_uInt8 nMemberId )
{
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:
diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx
index e2bf0fe..061dd9d 100644
--- a/sw/source/core/txtnode/txtatr2.cxx
+++ b/sw/source/core/txtnode/txtatr2.cxx
@@ -123,7 +123,7 @@ SwTxtINetFmt::SwTxtINetFmt( SwFmtINetFmt& rAttr,
, m_bVisited( false )
, m_bVisitedValid( false )
{
- rAttr.pTxtAttr = this;
+ rAttr.mpTxtAttr = this;
SetCharFmtAttr( true );
}
@@ -136,7 +136,7 @@ SwCharFmt* SwTxtINetFmt::GetCharFmt()
const SwFmtINetFmt& rFmt = SwTxtAttrEnd::GetINetFmt();
SwCharFmt* pRet = NULL;
- if( rFmt.GetValue().Len() )
+ if ( rFmt.GetValue().Len() )
{
const SwDoc* pDoc = GetTxtNode().GetDoc();
if( !IsVisitedValid() )
@@ -144,38 +144,38 @@ SwCharFmt* SwTxtINetFmt::GetCharFmt()
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);
+
+ 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");
+ }
// JP 10.02.2000, Bug 72806: dont modify the doc for getting the
// correct charstyle.
sal_Bool bResetMod = !pDoc->IsModified();
Link aOle2Lnk;
- if( bResetMod )
+ if ( bResetMod )
{
aOle2Lnk = pDoc->GetOle2Link();
- ((SwDoc*)pDoc)->SetOle2Link( Link() );
+ ( (SwDoc*) pDoc )->SetOle2Link( Link() );
}
pRet = IsPoolUserFmt( nId )
- ? ((SwDoc*)pDoc)->FindCharFmtByName( rStr )
- : ((SwDoc*)pDoc)->GetCharFmtFromPool( nId );
+ ? ( (SwDoc*) pDoc )->FindCharFmtByName( rStr )
+ : ( (SwDoc*) pDoc )->GetCharFmtFromPool( nId );
- if( bResetMod )
+ if ( bResetMod )
{
- ((SwDoc*)pDoc)->ResetModified();
- ((SwDoc*)pDoc)->SetOle2Link( aOle2Lnk );
+ ( (SwDoc*) pDoc )->ResetModified();
+ ( (SwDoc*) pDoc )->SetOle2Link( aOle2Lnk );
}
}
- if( pRet )
+ if ( pRet )
pRet->Add( this );
- else if( GetRegisteredIn() )
+ else if ( GetRegisteredIn() )
GetRegisteredInNonConst()->Remove( this );
return pRet;
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index f9be5f8..53e8603 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -1680,12 +1680,12 @@ void WW8AttributeOutput::TextINetFormat( const SwFmtINetFmt& rINet )
{
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 )
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 115d982..cad23eb 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2195,13 +2195,11 @@ eF_ResT SwWW8ImplReader::Read_F_PgRef( WW8FieldDesc*, String& rStr )
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_Hyperlink( WW8FieldDesc* /*pF*/, String& rStr )
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
diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx
index 012bacf..bf72ab6 100644
--- a/sw/source/ui/chrdlg/chardlg.cxx
+++ b/sw/source/ui/chrdlg/chardlg.cxx
@@ -276,23 +276,30 @@ SwCharURLPage::~SwCharURLPage()
void SwCharURLPage::Reset(const SfxItemSet& rSet)
{
const SfxPoolItem* pItem;
- if(SFX_ITEM_SET == rSet.GetItemState(RES_TXTATR_INETFMT, sal_False, &pItem))
+ if ( SFX_ITEM_SET == rSet.GetItemState( RES_TXTATR_INETFMT, sal_False, &pItem ) )
{
- const SwFmtINetFmt* pINetFmt = (const SwFmtINetFmt*)pItem;
+ const SwFmtINetFmt* pINetFmt = (const SwFmtINetFmt*) pItem;
aURLED.SetText( INetURLObject::decode( pINetFmt->GetValue(),
- INET_HEX_ESCAPE,
- INetURLObject::DECODE_UNAMBIGUOUS,
- RTL_TEXTENCODING_UTF8 ));
+ INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS,
+ RTL_TEXTENCODING_UTF8 ) );
aURLED.SaveValue();
- aNameED.SetText(pINetFmt->GetName());
+ aNameED.SetText( pINetFmt->GetName() );
+
String sEntry = pINetFmt->GetVisitedFmt();
- if( !sEntry.Len() )
+ 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);
+ }
+ aVisitedLB.SelectEntry( sEntry );
+
sEntry = pINetFmt->GetINetFmt();
- if(!sEntry.Len())
+ 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);
+ }
+ aNotVisitedLB.SelectEntry( sEntry );
aTargetFrmLB.SetText(pINetFmt->GetTargetFrame());
aVisitedLB. SaveValue();
@@ -337,13 +344,11 @@ sal_Bool SwCharURLPage::FillItemSet(SfxItemSet& rSet)
//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() );
diff --git a/sw/source/ui/shells/txtattr.cxx b/sw/source/ui/shells/txtattr.cxx
index f955b18..ba2ef4d 100644
--- a/sw/source/ui/shells/txtattr.cxx
+++ b/sw/source/ui/shells/txtattr.cxx
@@ -204,37 +204,42 @@ void SwTextShell::ExecCharAttrArgs(SfxRequest &rReq)
SwTxtFmtColl* pColl = 0;
// nur gesetzt, wenn gesamter Absatz selektiert ist und AutoUpdateFmt gesetzt ist
- if( rWrtSh.HasSelection() && rWrtSh.IsSelFullPara() )
+ if ( rWrtSh.HasSelection() && rWrtSh.IsSelFullPara() )
{
pColl = rWrtSh.GetCurTxtFmtColl();
- if(pColl && !pColl->IsAutoUpdateFmt())
+ if ( pColl && !pColl->IsAutoUpdateFmt() )
pColl = 0;
}
SfxItemPool& rPool = GetPool();
- sal_uInt16 nWhich = rPool.GetWhich(nSlot);
- switch ( nSlot )
+ sal_uInt16 nWhich = rPool.GetWhich( nSlot );
+ switch (nSlot)
{
- case FN_TXTATR_INET:
+ case FN_TXTATR_INET:
// Sonderbehandlung der PoolId des SwFmtInetFmt
- if(bArgs)
+ if ( bArgs )
{
- const SfxPoolItem& rItem = pArgs->Get(nWhich );
+ const SfxPoolItem& rItem = pArgs->Get( nWhich );
- SwFmtINetFmt aINetFmt((const SwFmtINetFmt&)rItem);
- if( USHRT_MAX == aINetFmt.GetVisitedFmtId() )
+ SwFmtINetFmt aINetFmt( (const SwFmtINetFmt&) rItem );
+ if ( USHRT_MAX == aINetFmt.GetVisitedFmtId() )
{
- aINetFmt.SetVisitedFmtId(
- SwStyleNameMapper::GetPoolIdFromUIName( aINetFmt.GetVisitedFmt(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT));
+ 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() )
+ if ( USHRT_MAX == aINetFmt.GetINetFmtId() )
{
- aINetFmt.SetINetFmtId(
- SwStyleNameMapper::GetPoolIdFromUIName( aINetFmt.GetINetFmt(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT));
+ 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 )
pColl->SetFmtAttr( aINetFmt );
- else rWrtSh.SetAttrItem( aINetFmt );
+ else
+ rWrtSh.SetAttrItem( aINetFmt );
rReq.Done();
}
break;
More information about the Libreoffice-commits
mailing list