String to OUString and some optimizations

Change-Id: I9d93d6aa26b2c9d20f7be8d201051a51e8e4ce7a
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 973dd63..9698c90 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -598,7 +598,7 @@ String SvxNumberFormat::CreateRomanString( sal_uLong nNo, sal_Bool bUpper )
    return sRet;
}

const String&   SvxNumberFormat::GetCharFmtName()const
OUString SvxNumberFormat::GetCharFmtName()const
{
    return sCharStyleName;
}
diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
index 9f88e79..fbe59e6 100644
--- a/include/editeng/numitem.hxx
+++ b/include/editeng/numitem.hxx
@@ -176,7 +176,7 @@ public:
    const OUString&   GetSuffix() const { return sSuffix;}

    void                    SetCharFmtName(const String& rSet){ sCharStyleName = rSet; }
    virtual const String&   GetCharFmtName()const;
    virtual OUString        GetCharFmtName()const;

    void            SetBulletFont(const Font* pFont);
    const Font*     GetBulletFont() const {return pBulletFont;}
diff --git a/sw/inc/cellfml.hxx b/sw/inc/cellfml.hxx
index 301c908..0938375 100644
--- a/sw/inc/cellfml.hxx
+++ b/sw/inc/cellfml.hxx
@@ -83,7 +83,7 @@ typedef void (SwTableFormula:: *FnScanFormel)( const SwTable&, String&,
    String ScanString( FnScanFormel fnFormel, const SwTable& rTbl,
                        void* = 0 ) const;

    const SwTable* FindTable( SwDoc& rDoc, const String& rNm ) const;
    const SwTable* FindTable( SwDoc& rDoc, const OUString& rNm ) const;

protected:
    enum NameType { EXTRNL_NAME, INTRNL_NAME, REL_NAME };
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index ffb2188..e80ce34 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -633,8 +633,7 @@ private:
                        FNCopyFmt fnCopyFmt, SwFmt& rDfltFmt );
    void CopyPageDescHeaderFooterImpl( bool bCpyHeader,
                                const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt );
    SwFmt* FindFmtByName( const SwFmtsBase& rFmtArr,
                                    const String& rName ) const;
    SwFmt* FindFmtByName( const SwFmtsBase& rFmtArr, const OUString& rName ) const;

    VirtualDevice& CreateVirtualDevice_() const;
    SfxPrinter& CreatePrinter_() const;
@@ -1160,8 +1159,8 @@ public:

    std::set<SwRootFrm*> GetAllLayouts();//swmod 080225

    void SetFlyName( SwFlyFrmFmt& rFmt, const String& rName );
    const SwFlyFrmFmt* FindFlyByName( const String& rName, sal_Int8 nNdTyp = 0 ) const;
    void SetFlyName( SwFlyFrmFmt& rFmt, const OUString& rName );
    const SwFlyFrmFmt* FindFlyByName( const OUString& rName, sal_Int8 nNdTyp = 0 ) const;

    void GetGrfNms( const SwFlyFrmFmt& rFmt, String* pGrfName,
                    String* pFltName ) const;
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index c68a6c0..7f9499f 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -415,7 +415,7 @@ public:

    /// Set name at selected FlyFrame.
    void SetFlyName( const String& rName );
    const String& GetFlyName() const;
    OUString GetFlyName() const;

    /// get reference to OLE object (if there is one) for selected FlyFrame
    const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetOleRef() const;
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index 09dde27..6e8ad24 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -36,7 +36,7 @@ class SwDoc;
/// Base class for various Writer styles.
class SW_DLLPUBLIC SwFmt : public SwModify
{
    String aFmtName;
    OUString aFmtName;
    SwAttrSet aSet;

    sal_uInt16 nWhichId;
@@ -57,7 +57,7 @@ class SW_DLLPUBLIC SwFmt : public SwModify
protected:
    SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
            const sal_uInt16* pWhichRanges, SwFmt *pDrvdFrm, sal_uInt16 nFmtWhich );
    SwFmt( SwAttrPool& rPool, const String &rFmtNm, const sal_uInt16* pWhichRanges,
    SwFmt( SwAttrPool& rPool, const OUString &rFmtNm, const sal_uInt16* pWhichRanges,
            SwFmt *pDrvdFrm, sal_uInt16 nFmtWhich );
    SwFmt( const SwFmt& rFmt );
   virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNewValue );
@@ -101,8 +101,8 @@ public:
    inline SwFmt* DerivedFrom() const { return (SwFmt*)GetRegisteredIn(); }
    inline sal_Bool IsDefault() const { return DerivedFrom() == 0; }

    inline const String& GetName() const        { return aFmtName; }
    void SetName( const String& rNewName, sal_Bool bBroadcast=sal_False );
    inline OUString GetName() const   { return aFmtName; }
    void SetName( const OUString& rNewName, sal_Bool bBroadcast=sal_False );
    inline void SetName( const sal_Char* pNewName,
                         sal_Bool bBroadcast=sal_False);

diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx
index 225933a..fe25ce8 100644
--- a/sw/inc/numrule.hxx
+++ b/sw/inc/numrule.hxx
@@ -76,7 +76,7 @@ public:
    void SetCharFmt( SwCharFmt* );

    virtual void            SetCharFmtName(const String& rSet);
    virtual const String&   GetCharFmtName()const;
    virtual OUString        GetCharFmtName()const;

    //For i120928,access the cp info of graphic within bullet
    void            SetGrfBulletCP(sal_Unicode cP){cGrfBulletCP = cP;}
diff --git a/sw/source/core/access/accframebase.cxx b/sw/source/core/access/accframebase.cxx
index 4953bb3..cd5297f 100644
--- a/sw/source/core/access/accframebase.cxx
+++ b/sw/source/core/access/accframebase.cxx
@@ -215,15 +215,14 @@ void SwAccessibleFrameBase::Modify( const SfxPoolItem* pOld, const SfxPoolItem *
            const SwFrmFmt *pFrmFmt = pFlyFrm->GetFmt();
            OSL_ENSURE( pFrmFmt == GetRegisteredIn(), "invalid frame" );

            OUString sOldName( GetName() );
            const OUString sOldName( GetName() );
            OSL_ENSURE( !pOld ||
                    static_cast < const SwStringMsgPoolItem * >( pOld )->GetString() == String( sOldName ),
                    static_cast < const SwStringMsgPoolItem * >( pOld )->GetString() == GetName(),
                    "invalid old name" );

            const String& rNewName = pFrmFmt->GetName();
            SetName( rNewName );
            SetName( pFrmFmt->GetName() );
            OSL_ENSURE( !pNew ||
                    static_cast < const SwStringMsgPoolItem * >( pNew )->GetString() == rNewName,
                    static_cast < const SwStringMsgPoolItem * >( pNew )->GetString() == GetName(),
                    "invalid new name" );

            if( sOldName != GetName() )
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 3b6ef33..c97d162 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -1284,7 +1284,7 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl(
            {
                PropertyValue rPropVal;
                rPropVal.Name = sParaStyleName;
                uno::Any aVal( uno::makeAny( OUString( pTxtNode->GetTxtColl()->GetName() ) ) );
                uno::Any aVal( uno::makeAny( pTxtNode->GetTxtColl()->GetName() ) );
                rPropVal.Value = aVal;
                rPropVal.Handle = -1;
                rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx
index f744730..214ba18 100644
--- a/sw/source/core/access/acctable.cxx
+++ b/sw/source/core/access/acctable.cxx
@@ -679,13 +679,11 @@ SwAccessibleTable::SwAccessibleTable(

    const SwFrmFmt *pFrmFmt = pTabFrm->GetFmt();
    const_cast< SwFrmFmt * >( pFrmFmt )->Add( this );
    const String& rName = pFrmFmt->GetName();

    SetName( OUString( rName ) + "-" + OUString::number( pTabFrm->GetPhyPageNum() ) );
    SetName( pFrmFmt->GetName() + "-" + OUString::number( pTabFrm->GetPhyPageNum() ) );

    OUString sArg1( static_cast< const SwTabFrm * >( GetFrm() )
                                        ->GetFmt()->GetName() );
    OUString sArg2( GetFormattedPageNumber() );
    const OUString sArg1( static_cast< const SwTabFrm * >( GetFrm() )->GetFmt()->GetName() );
    const OUString sArg2( GetFormattedPageNumber() );

    sDesc = GetResource( STR_ACCESS_TABLE_DESC, &sArg1, &sArg2 );
}
@@ -709,11 +707,10 @@ void SwAccessibleTable::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew
            const SwFrmFmt *pFrmFmt = pTabFrm->GetFmt();
            OSL_ENSURE( pFrmFmt == GetRegisteredIn(), "invalid frame" );

            OUString sOldName( GetName() );
            const OUString sOldName( GetName() );
            const OUString sNewTabName = pFrmFmt->GetName();

            const String& rNewTabName = pFrmFmt->GetName();

            SetName( OUString(rNewTabName) + "-" + OUString::number( pTabFrm->GetPhyPageNum() ) );
            SetName( sNewTabName + "-" + OUString::number( pTabFrm->GetPhyPageNum() ) );

            if( sOldName != GetName() )
            {
@@ -724,11 +721,10 @@ void SwAccessibleTable::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew
                FireAccessibleEvent( aEvent );
            }

            OUString sOldDesc( sDesc );
            OUString sArg1( rNewTabName );
            OUString sArg2( GetFormattedPageNumber() );
            const OUString sOldDesc( sDesc );
            const OUString sArg2( GetFormattedPageNumber() );

            sDesc = GetResource( STR_ACCESS_TABLE_DESC, &sArg1, &sArg2 );
            sDesc = GetResource( STR_ACCESS_TABLE_DESC, &sNewTabName, &sArg2 );
            if( sDesc != sOldDesc )
            {
                AccessibleEventObject aEvent;
@@ -1588,15 +1584,13 @@ SwAccessibleTableColHeaders::SwAccessibleTableColHeaders( SwAccessibleMap *pMap2

    const SwFrmFmt *pFrmFmt = pTabFrm->GetFmt();
    const_cast< SwFrmFmt * >( pFrmFmt )->Add( this );
    const String& rName = pFrmFmt->GetName();
    const OUString aName = pFrmFmt->GetName() + "-ColumnHeaders";

    SetName( OUString(rName) + "-ColumnHeaders-" +  OUString::number( pTabFrm->GetPhyPageNum() ) );
    SetName( aName + "-" + OUString::number( pTabFrm->GetPhyPageNum() ) );

    OUString sArg1( OUString(rName) + "-ColumnHeaders" );
    OUString sArg2( GetFormattedPageNumber() );
    const OUString sArg2( GetFormattedPageNumber() );

    OUString sDesc2 = GetResource( STR_ACCESS_TABLE_DESC, &sArg1, &sArg2 );
    SetDesc( sDesc2 );
    SetDesc( GetResource( STR_ACCESS_TABLE_DESC, &aName, &sArg2 ) );

    NotRegisteredAtAccessibleMap(); // #i85634#
}
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index 6229764..6777a2b 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -32,6 +32,7 @@ SwFmt::SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
              const sal_uInt16* pWhichRanges, SwFmt *pDrvdFrm,
              sal_uInt16 nFmtWhich )
    : SwModify( pDrvdFrm ),
    aFmtName( OUString::createFromAscii(pFmtNm) ),
    aSet( rPool, pWhichRanges ),
    nWhichId( nFmtWhich ),
    nFmtId( 0 ),
@@ -39,7 +40,6 @@ SwFmt::SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
    nPoolHelpId( USHRT_MAX ),
    nPoolHlpFileId( UCHAR_MAX )
{
    aFmtName.AssignAscii( pFmtNm );
    bWritten = bFmtInDTOR = bAutoUpdateFmt = sal_False; // LAYER_IMPL
    bAutoFmt = sal_True;
    bHidden = false;
@@ -48,7 +48,7 @@ SwFmt::SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
        aSet.SetParent( &pDrvdFrm->aSet );
}

SwFmt::SwFmt( SwAttrPool& rPool, const String& rFmtNm,
SwFmt::SwFmt( SwAttrPool& rPool, const OUString& rFmtNm,
              const sal_uInt16* pWhichRanges, SwFmt* pDrvdFrm,
              sal_uInt16 nFmtWhich )
    : SwModify( pDrvdFrm ),
@@ -140,7 +140,7 @@ SwFmt &SwFmt::operator=(const SwFmt& rFmt)
    return *this;
}

void SwFmt::SetName( const String& rNewName, sal_Bool bBroadcast )
void SwFmt::SetName( const OUString& rNewName, sal_Bool bBroadcast )
{
    OSL_ENSURE( !IsDefault(), "SetName: Defaultformat" );
    if( bBroadcast )
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 7fe4e19..a9d9f04 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1790,7 +1790,7 @@ SwFmt* SwDoc::CopyFmt( const SwFmt& rFmt,
        for( sal_uInt16 n = 0; n < rFmtArr.GetFmtCount(); n++ )
        {
            // Does the Doc already contain the template?
            if( rFmtArr.GetFmt(n)->GetName().Equals( rFmt.GetName() ))
            if( rFmtArr.GetFmt(n)->GetName()==rFmt.GetName() )
                return (SwFmt*)rFmtArr.GetFmt(n);
        }

@@ -2257,7 +2257,7 @@ void SwDoc::ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles )
}

SwFmt* SwDoc::FindFmtByName( const SwFmtsBase& rFmtArr,
                                    const String& rName ) const
                             const OUString& rName ) const
{
    SwFmt* pFnd = 0;
    for( sal_uInt16 n = 0; n < rFmtArr.GetFmtCount(); n++ )
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index e34ea51..c75df79 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -409,14 +409,14 @@ SwFrmFmt *SwDoc::CopyLayoutFmt( const SwFrmFmt& rSource,
        if( !mbCopyIsMove || this != pSrcDoc )
        {
            if( mbInReading )
                pDest->SetName( aEmptyStr );
                pDest->SetName( OUString() );
            else
            {
                // Test first if the name is already taken, if so generate a new one.
                sal_Int8 nNdTyp = aRg.aStart.GetNode().GetNodeType();

                String sOld( pDest->GetName() );
                pDest->SetName( aEmptyStr );
                OUString sOld( pDest->GetName() );
                pDest->SetName( OUString() );
                if( FindFlyByName( sOld, nNdTyp ) )     // found one
                    switch( nNdTyp )
                    {
@@ -1148,7 +1148,7 @@ lcl_InsertLabel(SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl,
    {
        for( sal_uInt16 i = pTxtFmtCollTbl->size(); i; )
        {
            if( (*pTxtFmtCollTbl)[ --i ]->GetName().Equals(pType->GetName()) )
            if( (*pTxtFmtCollTbl)[ --i ]->GetName()==pType->GetName() )
            {
                pColl = (*pTxtFmtCollTbl)[i];
                break;
@@ -1500,7 +1500,7 @@ lcl_InsertDrawLabel( SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl,
    {
        for( sal_uInt16 i = pTxtFmtCollTbl->size(); i; )
        {
            if( (*pTxtFmtCollTbl)[ --i ]->GetName().Equals(pType->GetName()) )
            if( (*pTxtFmtCollTbl)[ --i ]->GetName()==pType->GetName() )
            {
                pColl = (*pTxtFmtCollTbl)[i];
                break;
@@ -1919,10 +1919,10 @@ static String lcl_GetUniqueFlyName( const SwDoc* pDoc, sal_uInt16 nDefStrId )
    {
        const SwFrmFmt* pFlyFmt = rFmts[ n ];
        if( RES_FLYFRMFMT == pFlyFmt->Which() &&
            pFlyFmt->GetName().Match( aName ) == nNmLen )
            pFlyFmt->GetName().startsWith( aName ) )
        {
            // Only get and set the Flag
            nNum = static_cast< sal_uInt16 >( pFlyFmt->GetName().Copy( nNmLen ).ToInt32() );
            nNum = static_cast< sal_uInt16 >( pFlyFmt->GetName().copy( nNmLen ).toInt32() );
            if( nNum-- && nNum < rFmts.size() )
                pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
        }
@@ -1959,7 +1959,7 @@ String SwDoc::GetUniqueFrameName() const
    return lcl_GetUniqueFlyName( this, STR_FRAME_DEFNAME );
}

const SwFlyFrmFmt* SwDoc::FindFlyByName( const String& rName, sal_Int8 nNdTyp ) const
const SwFlyFrmFmt* SwDoc::FindFlyByName( const OUString& rName, sal_Int8 nNdTyp ) const
{
    const SwFrmFmts& rFmts = *GetSpzFrmFmts();
    for( sal_uInt16 n = rFmts.size(); n; )
@@ -1986,10 +1986,10 @@ const SwFlyFrmFmt* SwDoc::FindFlyByName( const String& rName, sal_Int8 nNdTyp ) 
    return 0;
}

void SwDoc::SetFlyName( SwFlyFrmFmt& rFmt, const String& rName )
void SwDoc::SetFlyName( SwFlyFrmFmt& rFmt, const OUString& rName )
{
    String sName( rName );
    if( !rName.Len() || FindFlyByName( rName ) )
    OUString sName( rName );
    if( sName.isEmpty() || FindFlyByName( sName ) )
    {
        sal_uInt16 nTyp = STR_FRAME_DEFNAME;
        const SwNodeIndex* pIdx = rFmt.GetCntnt().GetCntntIdx();
@@ -2028,19 +2028,32 @@ void SwDoc::SetAllUniqueFlyNames()
        if( RES_FLYFRMFMT == (pFlyFmt = (*GetSpzFrmFmts())[ --n ])->Which() )
        {
            sal_uInt16 *pNum = 0;
            xub_StrLen nLen;
            const String& rNm = pFlyFmt->GetName();
            if( rNm.Len() )
            const OUString aNm = pFlyFmt->GetName();
            if ( !aNm.isEmpty() )
            {
                if( rNm.Match( sGrfNm ) == ( nLen = sGrfNm.Len() ))
                xub_StrLen nLen = 0;
                if ( aNm.startsWith(sGrfNm) )
                {
                    nLen = sGrfNm.Len();
                    pNum = &nGrfNum;
                else if( rNm.Match( sFlyNm ) == ( nLen = sFlyNm.Len() ))
                }
                else if( aNm.startsWith(sFlyNm) )
                {
                    nLen = sFlyNm.Len();
                    pNum = &nFlyNum;
                else if( rNm.Match( sOLENm ) == ( nLen = sOLENm.Len() ))
                }
                else if( aNm.startsWith(sOLENm) )
                {
                    nLen = sOLENm.Len();
                    pNum = &nOLENum;
                }

                if ( pNum && *pNum < ( nLen = static_cast< xub_StrLen >( rNm.Copy( nLen ).ToInt32() ) ) )
                    *pNum = nLen;
                if ( pNum )
                {
                    const xub_StrLen nNewLen = static_cast< xub_StrLen >( aNm.copy( nLen ).toInt32() );
                    if (*pNum < nNewLen)
                        *pNum = nNewLen;
                }
            }
            else
                // we want to set that afterwards
@@ -2066,7 +2079,7 @@ void SwDoc::SetAllUniqueFlyNames()
            && pIdx->GetNode().GetNodes().IsDocNodes() )
        {
            sal_uInt16 nNum;
            String sNm;
            OUString sNm;
            switch( GetNodes()[ pIdx->GetIndex() + 1 ]->GetNodeType() )
            {
            case ND_GRFNODE:
@@ -2082,7 +2095,7 @@ void SwDoc::SetAllUniqueFlyNames()
                nNum = ++nFlyNum;
                break;
            }
            pFlyFmt->SetName( sNm += OUString::number( nNum ));
            pFlyFmt->SetName( sNm + OUString::number( nNum ));
        }
    aArr.clear();

diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 9c98029..10fc1ee 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -305,12 +305,12 @@ void SwNumFmt::SetCharFmtName(const String& rSet)
    SvxNumberFormat::SetCharFmtName(rSet);
}

const String&   SwNumFmt::GetCharFmtName() const
OUString SwNumFmt::GetCharFmtName() const
{
    if((SwCharFmt*)GetRegisteredIn())
        return ((SwCharFmt*)GetRegisteredIn())->GetName();
    else
        return aEmptyStr;

    return OUString();
}

void    SwNumFmt::SetGraphicBrush( const SvxBrushItem* pBrushItem, const Size* pSize,
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index 7df0ae4..a23d4eb 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -416,7 +416,7 @@ SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
    }

    // Copy the TableFrmFmt
    String sTblName( GetTable().GetFrmFmt()->GetName() );
    OUString sTblName( GetTable().GetFrmFmt()->GetName() );
    if( !pDoc->IsCopyIsMove() )
    {
        const SwFrmFmts& rTblFmts = *pDoc->GetTblFrmFmts();
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index f8b224f..3a7ad43 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -3884,8 +3884,7 @@ sal_Bool SwDoc::GetTableAutoFmt( const SwSelBoxes& rBoxes, SwTableAutoFmt& rGet 
String SwDoc::GetUniqueTblName() const
{
    ResId aId( STR_TABLE_DEFNAME, *pSwResMgr );
    String aName( aId );
    xub_StrLen nNmLen = aName.Len();
    const OUString aName( aId );

    sal_uInt16 nNum, nTmp, nFlagSize = ( mpTblFrmFmtTbl->size() / 8 ) +2;
    sal_uInt16 n;
@@ -3897,10 +3896,11 @@ String SwDoc::GetUniqueTblName() const
    {
        const SwFrmFmt* pFmt = (*mpTblFrmFmtTbl)[ n ];
        if( !pFmt->IsDefault() && IsUsed( *pFmt )  &&
            pFmt->GetName().Match( aName ) == nNmLen )
            pFmt->GetName().startsWith( aName ) )
        {
            // Get number and set the Flag
            nNum = static_cast<sal_uInt16>(pFmt->GetName().Copy( nNmLen ).ToInt32());
            const sal_Int32 nNmLen = aName.getLength();
            nNum = static_cast<sal_uInt16>(pFmt->GetName().copy( nNmLen ).toInt32());
            if( nNum-- && nNum < mpTblFrmFmtTbl->size() )
                pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
        }
@@ -3919,7 +3919,7 @@ String SwDoc::GetUniqueTblName() const
        }

    delete [] pSetFlags;
    return aName += OUString::number( ++nNum );
    return aName + OUString::number( ++nNum );
}

SwTableFmt* SwDoc::FindTblFmtByName( const String& rName, sal_Bool bAll ) const
diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx
index fbec264..873cacb 100644
--- a/sw/source/core/edit/edglss.cxx
+++ b/sw/source/core/edit/edglss.cxx
@@ -191,7 +191,7 @@ sal_Bool SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd )
            sal_Bool bCpyTblNm = aBoxes.size() == pTblNd->GetTable().GetTabSortBoxes().size();
            if( bCpyTblNm )
            {
                const String& rTblName = pTblNd->GetTable().GetFrmFmt()->GetName();
                const OUString rTblName = pTblNd->GetTable().GetFrmFmt()->GetName();
                const SwFrmFmts& rTblFmts = *pInsDoc->GetTblFrmFmts();
                for( sal_uInt16 n = rTblFmts.size(); n; )
                    if( rTblFmts[ --n ]->GetName() == rTblName )
diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx
index 239402e..1e670da 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -660,7 +660,7 @@ String SwTableFormula::ScanString( FnScanFormel fnFormel, const SwTable& rTbl,
    return aStr;
}

const SwTable* SwTableFormula::FindTable( SwDoc& rDoc, const String& rNm ) const
const SwTable* SwTableFormula::FindTable( SwDoc& rDoc, const OUString& rNm ) const
{
    const SwFrmFmts& rTblFmts = *rDoc.GetTblFrmFmts();
    const SwTable* pTmpTbl, *pRet = 0;
@@ -669,8 +669,7 @@ const SwTable* SwTableFormula::FindTable( SwDoc& rDoc, const String& rNm ) const
        SwFrmFmt* pFmt = rTblFmts[ --nFmtCnt ];
        // if we are called from Sw3Writer, a number is dependent on the format name
        SwTableBox* pFBox;
        if( COMPARE_EQUAL == rNm.CompareTo( pFmt->GetName(),
                                        pFmt->GetName().Search( 0x0a ) ) &&
        if ( rNm.startsWith(pFmt->GetName().getToken(0, 0x0a)) &&
            0 != ( pTmpTbl = SwTable::FindTable( pFmt ) ) &&
            0 != (pFBox = pTmpTbl->GetTabSortBoxes()[0] ) &&
            pFBox->GetSttNd() &&
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 80e34e6..fa630b2 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -1514,14 +1514,14 @@ void SwFEShell::SetFlyName( const String& rName )
    }
}

const String& SwFEShell::GetFlyName() const
OUString SwFEShell::GetFlyName() const
{
    SwLayoutFrm *pFly = FindFlyFrm();
    if( pFly )
        return pFly->GetFmt()->GetName();

    OSL_ENSURE( !this, "no FlyFrame selected" );
    return aEmptyStr;
    return OUString();
}


@@ -1975,7 +1975,7 @@ void SwFEShell::GetConnectableFrmFmts(SwFrmFmt & rFmt,

        for (aIt = aTmpSpzArray.begin(); aIt != aTmpSpzArray.end(); ++aIt)
        {
            String  aString = (*aIt)->GetName();
            const String aString = (*aIt)->GetName();

            /* rFmt is not a vaild successor or predecessor of
               itself */
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 4410cc8..d35e47b 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -72,13 +72,15 @@ static void lcl_GetCharRectInsideField( SwTxtSizeInfo& rInf, SwRect& rOrig,
        sal_Int32 nFldIdx = 0;
        sal_Int32 nFldLen = 0;

        OUString sString;
        const OUString* pString = 0;
        const SwLinePortion* pPor = &rPor;
        do
        {
            if ( pPor->InFldGrp() )
            {
                pString = &((SwFldPortion*)pPor)->GetExp();
                sString = ((SwFldPortion*)pPor)->GetExp();
                pString = &sString;
                nFldLen = pString->getLength();
            }
            else
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index ec7a7a4..80fb84d 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -526,7 +526,7 @@ sal_Bool SwHiddenPortion::GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt )
 *                      class SwNumberPortion
 *************************************************************************/

SwNumberPortion::SwNumberPortion( const XubString &rExpand,
SwNumberPortion::SwNumberPortion( const OUString &rExpand,
                                  SwFont *pFont,
                                  const sal_Bool bLft,
                                  const sal_Bool bCntr,
@@ -779,13 +779,13 @@ static sal_Char const sDoubleSpace[] = "  ";
 *************************************************************************/

SwBulletPortion::SwBulletPortion( const sal_Unicode cBullet,
                                  const XubString& rBulletFollowedBy,
                                  const OUString& rBulletFollowedBy,
                                  SwFont *pFont,
                                  const sal_Bool bLft,
                                  const sal_Bool bCntr,
                                  const KSHORT nMinDst,
                                  const bool bLabelAlignmentPosAndSpaceModeActive )
    : SwNumberPortion( XubString( rBulletFollowedBy ).Insert( cBullet, 0 ) ,
    : SwNumberPortion( OUString(cBullet) + rBulletFollowedBy,
                       pFont, bLft, bCntr, nMinDst,
                       bLabelAlignmentPosAndSpaceModeActive )
{
@@ -800,7 +800,7 @@ SwBulletPortion::SwBulletPortion( const sal_Unicode cBullet,

SwGrfNumPortion::SwGrfNumPortion(
        SwFrm*,
        const XubString& rGraphicFollowedBy,
        const OUString& rGraphicFollowedBy,
        const SvxBrushItem* pGrfBrush,
        const SwFmtVertOrient* pGrfOrient, const Size& rGrfSize,
        const sal_Bool bLft, const sal_Bool bCntr, const KSHORT nMinDst,
@@ -1088,7 +1088,7 @@ void SwTxtFrm::StopAnimation( OutputDevice* pOut )
 * initializes the script array and clears the width array
 *************************************************************************/

SwCombinedPortion::SwCombinedPortion( const XubString &rTxt )
SwCombinedPortion::SwCombinedPortion( const OUString &rTxt )
     : SwFldPortion( rTxt )
{
    SetLen(1);
@@ -1100,7 +1100,7 @@ SwCombinedPortion::SwCombinedPortion( const XubString &rTxt )
    if( g_pBreakIt->GetBreakIter().is() )
    {
        sal_uInt8 nScr = SW_SCRIPTS;
        for( sal_uInt16 i = 0; i < rTxt.Len(); ++i )
        for( sal_Int32 i = 0; i < rTxt.getLength(); ++i )
        {
            sal_uInt16 nScript = g_pBreakIt->GetBreakIter()->getScriptType( rTxt, i );
            switch ( nScript ) {
@@ -1113,8 +1113,8 @@ SwCombinedPortion::SwCombinedPortion( const XubString &rTxt )
    }
    else
    {
        for( sal_uInt16 i = 0; i < 6; aScrType[i++] = 0 )
            ; // nothing
        for( sal_uInt16 i = 0; i < 6; ++i )
            aScrType[i] = 0;
    }
    memset( &aWidth, 0, sizeof(aWidth) );
}
diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx
index 94f43b9..e0df8b4 100644
--- a/sw/source/core/text/porfld.hxx
+++ b/sw/source/core/text/porfld.hxx
@@ -67,7 +67,7 @@ public:
    // #i89179# - made public
    inline const SwFont *GetFont() const { return pFnt; }

    inline const OUString &GetExp() const { return aExpand; }
    inline OUString GetExp() const { return aExpand; }
    virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const;
    virtual sal_Bool Format( SwTxtFormatInfo &rInf );
    virtual void Paint( const SwTxtPaintInfo &rInf ) const;
@@ -118,7 +118,7 @@ public:
class SwHiddenPortion : public SwFldPortion
{
public:
    inline SwHiddenPortion( const XubString &rExpand, SwFont *pFntL = 0 )
    inline SwHiddenPortion( const OUString &rExpand, SwFont *pFntL = 0 )
         : SwFldPortion( rExpand, pFntL )
        { SetLen(1); SetWhichPor( POR_HIDDEN ); }
    virtual void Paint( const SwTxtPaintInfo &rInf ) const;
@@ -141,7 +141,7 @@ protected:
    bool    mbLabelAlignmentPosAndSpaceModeActive;

public:
    SwNumberPortion( const XubString &rExpand,
    SwNumberPortion( const OUString &rExpand,
                     SwFont *pFnt,
                     const sal_Bool bLeft,
                     const sal_Bool bCenter,
@@ -166,7 +166,7 @@ class SwBulletPortion : public SwNumberPortion
{
public:
    SwBulletPortion( const sal_Unicode cCh,
                     const XubString& rBulletFollowedBy,
                     const OUString& rBulletFollowedBy,
                     SwFont *pFnt,
                     const sal_Bool bLeft,
                     const sal_Bool bCenter,
@@ -188,7 +188,7 @@ class SwGrfNumPortion : public SwNumberPortion
    sal_Int16       eOrient;
public:
    SwGrfNumPortion( SwFrm *pFrm,
                     const XubString& rGraphicFollowedBy,
                     const OUString& rGraphicFollowedBy,
                     const SvxBrushItem* pGrfBrush,
                     const SwFmtVertOrient* pGrfOrient,
                     const Size& rGrfSize,
@@ -239,7 +239,7 @@ class SwCombinedPortion : public SwFldPortion
    sal_uInt16 nLowPos;     // the Y position of the lower baseline
    sal_uInt8 nProportion;  // relative font height
public:
    SwCombinedPortion( const XubString &rExpand );
    SwCombinedPortion( const OUString &rExpand );
    virtual void Paint( const SwTxtPaintInfo &rInf ) const;
    virtual sal_Bool Format( SwTxtFormatInfo &rInf );
    virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const;
diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx
index d916be9..b0a060a 100644
--- a/sw/source/core/tox/txmsrt.cxx
+++ b/sw/source/core/tox/txmsrt.cxx
@@ -659,7 +659,7 @@ sal_uInt16 SwTOXPara::GetLevel() const

String SwTOXPara::GetURL() const
{
    String aTxt;
    OUString aTxt;
    const SwCntntNode* pNd = aTOXSources[0].pNd;
    switch( eType )
    {
@@ -672,9 +672,7 @@ String SwTOXPara::GetURL() const
            ::sw::mark::IMark const * const pMark = pDoc->getIDocumentMarkAccess()->getMarkForTxtNode(
                                *(pTxtNd),
                                IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK);
            aTxt = '#';
            const String aMarkName( pMark->GetName() );
            aTxt += aMarkName;
            aTxt = "#" + pMark->GetName();
        }
        break;

@@ -686,7 +684,7 @@ String SwTOXPara::GetURL() const
            SwFrmFmt* pFly = pNd->GetFlyFmt();
            if( pFly )
            {
                (( aTxt = '#' ) += pFly->GetName() ) += cMarkSeparator;
                aTxt = "#" + pFly->GetName() + OUString(cMarkSeparator);
                const sal_Char* pStr;
                switch( eType )
                {
@@ -696,16 +694,14 @@ String SwTOXPara::GetURL() const
                default:            pStr = 0;
                }
                if( pStr )
                    aTxt.AppendAscii( pStr );
                    aTxt += OUString::createFromAscii( pStr );
            }
        }
        break;
    case nsSwTOXElement::TOX_SEQUENCE:
        {
            aTxt = '#';
            aTxt += m_sSequenceName;
            aTxt += cMarkSeparator;
            aTxt.AppendAscii( pMarkToSequence );
            aTxt = "#" + m_sSequenceName + OUString(cMarkSeparator)
                 + OUString::createFromAscii(pMarkToSequence);
        }
        break;
    default: break;
@@ -748,18 +744,19 @@ sal_uInt16 SwTOXTable::GetLevel() const

String SwTOXTable::GetURL() const
{
    String aTxt;
    const SwNode* pNd = aTOXSources[0].pNd;
    if( pNd && 0 != ( pNd = pNd->FindTableNode() ) )
    {
        aTxt = ((SwTableNode*)pNd)->GetTable().GetFrmFmt()->GetName();
        if( aTxt.Len() )
        {
            ( aTxt.Insert( '#', 0 ) += cMarkSeparator ).
                                            AppendAscii( pMarkToTable );
        }
    }
    return aTxt;
    if (!pNd)
        return String();

    pNd = pNd->FindTableNode();
    if (!pNd)
        return String();

    const OUString sName = ((SwTableNode*)pNd)->GetTable().GetFrmFmt()->GetName();
    if ( sName.isEmpty() )
        return String();

    return "#" + sName + OUString(cMarkSeparator) + OUString::createFromAscii( pMarkToTable );
}

SwTOXAuthority::SwTOXAuthority( const SwCntntNode& rNd,
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 294bc5a..a46bb1b 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1257,16 +1257,16 @@ SwTxtNode::GetTxtAttrAt(xub_StrLen const nIndex, RES_TXTATR const nWhich,
 *                          CopyHint()
 *************************************************************************/

static SwCharFmt* lcl_FindCharFmt( const SwCharFmts* pCharFmts, const XubString& rName )
static SwCharFmt* lcl_FindCharFmt( const SwCharFmts* pCharFmts, const OUString& rName )
{
    if( rName.Len() )
    if( !rName.isEmpty() )
    {
        SwCharFmt* pFmt;
        sal_uInt16 nArrLen = pCharFmts->size();
        for( sal_uInt16 i = 1; i < nArrLen; i++ )
        {
            pFmt = (*pCharFmts)[ i ];
            if( pFmt->GetName().CompareTo( rName ) == COMPARE_EQUAL )
            if( pFmt->GetName()==rName )
                return pFmt;
        }
    }
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index 363c45c..d3b1feb 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -352,7 +352,7 @@ static bool GetTableAndCellsFromRangeRep(
    return bSuccess;
}

static void GetTableByName( const SwDoc &rDoc, const String &rTableName,
static void GetTableByName( const SwDoc &rDoc, const OUString &rTableName,
        SwFrmFmt **ppTblFmt, SwTable **ppTable)
{
    SwFrmFmt *pTblFmt = NULL;
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index 9f6e263..3230129 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -898,9 +898,8 @@ uno::Any SwXTextTables::getByName(const OUString& rItemName)
        uno::Reference< XTextTable >  xTbl;
        for( sal_uInt16 i = 0; i < nCount; i++)
        {
            String aName(rItemName);
            SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt(i, true);
            if(aName == rFmt.GetName())
            if (rItemName == rFmt.GetName())
            {
                xTbl = SwXTextTables::GetObject(rFmt);
                aRet.setValue(&xTbl,
@@ -931,7 +930,7 @@ uno::Sequence< OUString > SwXTextTables::getElementNames(void)
        {
            SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt(i, true);

            pArray[i] = OUString(rFmt.GetName());
            pArray[i] = rFmt.GetName();
        }
    }
    return aSeq;
@@ -947,9 +946,8 @@ sal_Bool SwXTextTables::hasByName(const OUString& rName)
        sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(true);
        for( sal_uInt16 i = 0; i < nCount; i++)
        {
            String aName(rName);
            SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt(i, true);
            if(aName == rFmt.GetName())
            if (rName == rFmt.GetName())
            {
                bRet = sal_True;
                break;
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 9e231fe..65d4cf2 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1301,10 +1301,9 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
        else if(0 != (bNextFrame = (rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_NEXT_NAME))))
            || rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_PREV_NAME)))
        {
            OUString uTemp;
            aValue >>= uTemp;
            String sChainName(uTemp);
            if(!sChainName.Len())
            OUString sChainName;
            aValue >>= sChainName;
            if (sChainName.isEmpty())
            {
                if(bNextFrame)
                    pDoc->Unchain(*pFmt);
@@ -1688,7 +1687,7 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
        }
        else if(FN_PARAM_LINK_DISPLAY_NAME == pEntry->nWID)
        {
            aAny <<= OUString(pFmt->GetName());
            aAny <<= pFmt->GetName();
        }
        else if(FN_UNO_Z_ORDER == pEntry->nWID)
        {
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index 389165c..588703f 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -497,7 +497,7 @@ uno::Any SwXFootnoteProperties::getPropertyValue(const OUString& rPropertyName)
                    SwTxtFmtColl* pColl = rFtnInfo.GetFtnTxtColl();
                    OUString aString;
                    if(pColl)
                        aString = String ( pColl->GetName() );
                        aString = pColl->GetName();
                    SwStyleNameMapper::FillProgName(aString, aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, true);
                    aRet <<= aString;
                }
@@ -1516,7 +1516,7 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex(
                aAny >>= aUString;
            }
            else
                aUString = aEmptyStr;
                aUString = OUString();
            pData = new PropValData((void*)&aUString, SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_URL), ::getCppuType((const OUString*)0));
            aPropertyValues.push_back(pData);

@@ -1551,7 +1551,7 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex(
    else
    {
        //Vorlagenname
        String sValue(SW_RES(STR_POOLCOLL_HEADLINE1 + nIndex));
        OUString sValue(SW_RES(STR_POOLCOLL_HEADLINE1 + nIndex));
        const SwTxtFmtColls* pColls = pDocShell->GetDoc()->GetTxtFmtColls();
        const sal_uInt16 nCount = pColls->size();
        for(sal_uInt16 i = 0; i < nCount;++i)
@@ -1573,7 +1573,7 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex(
            {
                // if the default for the level is existing, but its
                // level is different, then it cannot be the default.
                sValue.Erase();
                sValue = OUString();
            }
        }
        OUString aName;
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 6a9efa4..4f4045cf0 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -295,7 +295,7 @@ static uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimp
        }
        break;
        case FN_PARAM_LINK_DISPLAY_NAME :
            aRet <<= OUString(pFmt->GetName());
            aRet <<= pFmt->GetName();
        break;
        case FN_UNO_REDLINE_NODE_START:
        case FN_UNO_REDLINE_NODE_END:
@@ -3527,51 +3527,40 @@ void SwXTextTable::removeVetoableChangeListener(const OUString& /*rPropertyName*
OUString SwXTextTable::getName(void) throw( uno::RuntimeException )
{
    SolarMutexGuard aGuard;
    String sRet;
    SwFrmFmt* pFmt = GetFrmFmt();
    if(!pFmt && !bIsDescriptor)
        throw uno::RuntimeException();
    if(pFmt)
    {
        sRet = pFmt->GetName();
        return pFmt->GetName();
    }
    else
        sRet = m_sTableName;
    return sRet;
    return m_sTableName;
}

void SwXTextTable::setName(const OUString& rName) throw( uno::RuntimeException )
{
    SolarMutexGuard aGuard;
    SwFrmFmt* pFmt = GetFrmFmt();
    String sNewTblName(rName);
    if((!pFmt && !bIsDescriptor) ||
       !sNewTblName.Len() ||
       STRING_NOTFOUND != sNewTblName.Search('.') ||
       STRING_NOTFOUND != sNewTblName.Search(' ')  )
       rName.isEmpty() ||
       rName.indexOf('.')>=0 ||
       rName.indexOf(' ')>=0 )
        throw uno::RuntimeException();

    if(pFmt)
    {
        const String aOldName( pFmt->GetName() );
        bool bNameFound = false;
        SwFrmFmt* pTmpFmt;
        const SwFrmFmts* pTbl = pFmt->GetDoc()->GetTblFrmFmts();
        for( sal_uInt16 i = pTbl->size(); i; )
            if( !( pTmpFmt = (*pTbl)[ --i ] )->IsDefault() &&
                pTmpFmt->GetName() == sNewTblName &&
                pTmpFmt->GetName() == rName &&
                            pFmt->GetDoc()->IsUsed( *pTmpFmt ))
            {
                bNameFound = true;
                break;
                throw uno::RuntimeException();
            }

        if(bNameFound)
        {
            throw uno::RuntimeException();
        }
        pFmt->SetName( sNewTblName );

        pFmt->SetName( rName );

        SwStartNode *pStNd;
        SwNodeIndex aIdx( *pFmt->GetDoc()->GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 );
@@ -3582,7 +3571,7 @@ void SwXTextTable::setName(const OUString& rName) throw( uno::RuntimeException )
            if ( pNd->IsOLENode() &&
                aOldName == ((SwOLENode*)pNd)->GetChartTblName() )
            {
                ((SwOLENode*)pNd)->SetChartTblName( sNewTblName );
                ((SwOLENode*)pNd)->SetChartTblName( rName );

                ((SwOLENode*)pNd)->GetOLEObj();

@@ -3595,7 +3584,7 @@ void SwXTextTable::setName(const OUString& rName) throw( uno::RuntimeException )
        pFmt->GetDoc()->SetModified();
    }
    else
        m_sTableName = sNewTblName;
        m_sTableName = rName;
}

sal_uInt16 SwXTextTable::getRowCount(void)
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index 51fbc24..7928f2e 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -683,8 +683,8 @@ sal_uInt16 SwHTMLWriter::GetCSS1Selector( const SwFmt *pFmt, OString& rToken,
        if( USER_FMT & nPoolId )
        {
            // Benutzer-Vorlagen
            const OUString& rNm = pPFmt->GetName();
            switch( rNm[0] )
            const OUString aNm = pPFmt->GetName();
            switch( aNm[0] )
            {
                        // nicht mehr unterstuetzt:
                        // OOO_STRING_SVTOOLS_HTML_author
@@ -694,7 +694,7 @@ sal_uInt16 SwHTMLWriter::GetCSS1Selector( const SwFmt *pFmt, OString& rToken,
                        // OOO_STRING_SVTOOLS_HTML_insertedtext
                        // OOO_STRING_SVTOOLS_HTML_language
                        // OOO_STRING_SVTOOLS_HTML_person
            case 'B':   if( !bChrFmt && rNm == OOO_STRING_SVTOOLS_HTML_blockquote )
            case 'B':   if( !bChrFmt && aNm == OOO_STRING_SVTOOLS_HTML_blockquote )
                        {
                            rRefPoolId = RES_POOLCOLL_HTML_BLOCKQUOTE;
                            rToken = OString(OOO_STRING_SVTOOLS_HTML_blockquote);
@@ -702,26 +702,26 @@ sal_uInt16 SwHTMLWriter::GetCSS1Selector( const SwFmt *pFmt, OString& rToken,
                        break;
            case 'C':   if( bChrFmt )
                        {
                            if( rNm == OOO_STRING_SVTOOLS_HTML_citiation )
                            if( aNm == OOO_STRING_SVTOOLS_HTML_citiation )
                            {
                                rRefPoolId = RES_POOLCHR_HTML_CITIATION;
                                rToken = OString(OOO_STRING_SVTOOLS_HTML_citiation);
                            }
                            else if( rNm == OOO_STRING_SVTOOLS_HTML_code )
                            else if( aNm == OOO_STRING_SVTOOLS_HTML_code )
                            {
                                rRefPoolId = RES_POOLCHR_HTML_CODE;
                                rToken = OString(OOO_STRING_SVTOOLS_HTML_code);
                            }
                        }
                        break;
            case 'D':   if( bChrFmt && rNm == OOO_STRING_SVTOOLS_HTML_definstance )
            case 'D':   if( bChrFmt && aNm == OOO_STRING_SVTOOLS_HTML_definstance )
                        {
                            rRefPoolId = RES_POOLCHR_HTML_DEFINSTANCE;
                            rToken = OString(OOO_STRING_SVTOOLS_HTML_definstance);
                        }
                        else if( !bChrFmt )
                        {
                            sal_uInt16 nDefListLvl = GetDefListLvl( rNm, nPoolId );
                            sal_uInt16 nDefListLvl = GetDefListLvl( aNm, nPoolId );
                            // Die Vorlagen DD 1/DT 1 werden ausgegeben,
                            // aber keine von ihnen abgeleiteten Vorlagen,
                            // auch nicht DD 2/DT 2 etc.
@@ -745,23 +745,23 @@ sal_uInt16 SwHTMLWriter::GetCSS1Selector( const SwFmt *pFmt, OString& rToken,
                            }
                        }
                        break;
            case 'E':   if( bChrFmt && rNm == OOO_STRING_SVTOOLS_HTML_emphasis )
            case 'E':   if( bChrFmt && aNm == OOO_STRING_SVTOOLS_HTML_emphasis )
                        {
                            rRefPoolId = RES_POOLCHR_HTML_EMPHASIS;
                            rToken = OString(OOO_STRING_SVTOOLS_HTML_emphasis);
                        }
                        break;
            case 'H':   if( !bChrFmt && rNm == OOO_STRING_SVTOOLS_HTML_horzrule )
            case 'H':   if( !bChrFmt && aNm == OOO_STRING_SVTOOLS_HTML_horzrule )
                            // HR nicht ausgeben!
                            bStop = (nDeep==0);
                        break;
            case 'K':   if( bChrFmt && rNm == OOO_STRING_SVTOOLS_HTML_keyboard )
            case 'K':   if( bChrFmt && aNm == OOO_STRING_SVTOOLS_HTML_keyboard )
                        {
                            rRefPoolId = RES_POOLCHR_HTML_KEYBOARD;
                            rToken = OString(OOO_STRING_SVTOOLS_HTML_keyboard);
                        }
                        break;
            case 'L':   if( !bChrFmt && rNm == OOO_STRING_SVTOOLS_HTML_listing )
            case 'L':   if( !bChrFmt && aNm == OOO_STRING_SVTOOLS_HTML_listing )
                        {
                            // Listing als PRE exportieren bzw. von
                            // PRE abgeleitete Vorlage exportieren
@@ -770,7 +770,7 @@ sal_uInt16 SwHTMLWriter::GetCSS1Selector( const SwFmt *pFmt, OString& rToken,
                            nDeep = CSS1_FMT_CMPREF;
                        }
                        break;
            case 'P':   if( !bChrFmt && rNm == OOO_STRING_SVTOOLS_HTML_preformtxt )
            case 'P':   if( !bChrFmt && aNm == OOO_STRING_SVTOOLS_HTML_preformtxt )
                        {
                            rRefPoolId = RES_POOLCOLL_HTML_PRE;
                            rToken = OString(OOO_STRING_SVTOOLS_HTML_preformtxt);
@@ -778,31 +778,31 @@ sal_uInt16 SwHTMLWriter::GetCSS1Selector( const SwFmt *pFmt, OString& rToken,
                        break;
            case 'S':   if( bChrFmt )
                        {
                            if( rNm == OOO_STRING_SVTOOLS_HTML_sample )
                            if( aNm == OOO_STRING_SVTOOLS_HTML_sample )
                            {
                                rRefPoolId = RES_POOLCHR_HTML_SAMPLE;
                                rToken = OString(OOO_STRING_SVTOOLS_HTML_sample);
                            }
                            else if( rNm == OOO_STRING_SVTOOLS_HTML_strong )
                            else if( aNm == OOO_STRING_SVTOOLS_HTML_strong )
                            {
                                rRefPoolId = RES_POOLCHR_HTML_STRONG;
                                rToken = OString(OOO_STRING_SVTOOLS_HTML_strong);
                            }
                        }
                        break;
            case 'T':   if( bChrFmt && rNm == OOO_STRING_SVTOOLS_HTML_teletype )
            case 'T':   if( bChrFmt && aNm == OOO_STRING_SVTOOLS_HTML_teletype )
                        {
                            rRefPoolId = RES_POOLCHR_HTML_TELETYPE;
                            rToken = OString(OOO_STRING_SVTOOLS_HTML_teletype);
                        }
                        break;
            case 'V':   if( bChrFmt && rNm == OOO_STRING_SVTOOLS_HTML_variable )
            case 'V':   if( bChrFmt && aNm == OOO_STRING_SVTOOLS_HTML_variable )
                        {
                            rRefPoolId = RES_POOLCHR_HTML_VARIABLE;
                            rToken = OString(OOO_STRING_SVTOOLS_HTML_variable);
                        }
                        break;
            case 'X':   if( !bChrFmt && rNm == OOO_STRING_SVTOOLS_HTML_xmp )
            case 'X':   if( !bChrFmt && aNm == OOO_STRING_SVTOOLS_HTML_xmp )
                        {
                            // XMP als PRE exportieren (aber nicht die
                            // Vorlage als Style)
@@ -1638,19 +1638,19 @@ static Writer& OutCSS1_SwFmt( Writer& rWrt, const SwFmt& rFmt,
        if( USER_FMT & nPoolFmtId )
        {
            // Benutzer-Vorlagen
            const OUString& rNm = rFmt.GetName();
            switch( rNm[0] )
            const OUString aNm = rFmt.GetName();
            switch( aNm[0] )
            {
            case 'D':   if( rNm == "DD 1" || rNm == "DT 1" )
            case 'D':   if( aNm == "DD 1" || aNm == "DT 1" )
                            rHTMLWrt.nDfltBottomMargin = 0;
                        break;
            case 'L':   if(rNm == OOO_STRING_SVTOOLS_HTML_listing )
            case 'L':   if(aNm == OOO_STRING_SVTOOLS_HTML_listing )
                            rHTMLWrt.nDfltBottomMargin = 0;
                        break;
            case 'P':   if( rNm == OOO_STRING_SVTOOLS_HTML_preformtxt )
            case 'P':   if( aNm == OOO_STRING_SVTOOLS_HTML_preformtxt )
                            rHTMLWrt.nDfltBottomMargin = 0;
                        break;
            case 'X':   if( rNm == OOO_STRING_SVTOOLS_HTML_xmp )
            case 'X':   if( aNm == OOO_STRING_SVTOOLS_HTML_xmp )
                            rHTMLWrt.nDfltBottomMargin = 0;
                        break;
            }
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index 819b6ac..02fcb4a8 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -528,8 +528,7 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt,
                                      rHWrt.nCSS1Script,
                                      false );
        rHWrt.aTxtCollInfos.insert( pFmtInfo );
        OUString aName( rFmt.GetName() );
        if( 0 != rHWrt.aScriptParaStyles.count( aName ) )
        if( rHWrt.aScriptParaStyles.count( rFmt.GetName() ) )
            ((SwHTMLFmtInfo *)pFmtInfo)->bScriptDependent = true;
    }

@@ -1626,8 +1625,7 @@ const SwHTMLFmtInfo *HTMLEndPosLst::GetFmtInfo( const SwFmt& rFmt,
        pFmtInfo = new SwHTMLFmtInfo( &rFmt, pDoc, pTemplate,
                                      bOutStyles );
        rFmtInfos.insert( pFmtInfo );
        OUString aName( rFmt.GetName() );
        if( 0 != rScriptTxtStyles.count( aName ) )
        if ( rScriptTxtStyles.count( rFmt.GetName() ) )
            ((SwHTMLFmtInfo *)pFmtInfo)->bScriptDependent = true;
    }

@@ -2039,7 +2037,7 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode )
    sal_uInt16 nPoolId = pNd->GetAnyFmtColl().GetPoolFmtId();

    if( !nEnde && (RES_POOLCOLL_HTML_HR==nPoolId ||
                   pNd->GetAnyFmtColl().GetName().EqualsAscii( OOO_STRING_SVTOOLS_HTML_horzrule) ) )
                   pNd->GetAnyFmtColl().GetName() == OOO_STRING_SVTOOLS_HTML_horzrule) )
    {
        // dann die absatz-gebundenen Grafiken/OLE-Objekte im Absatz
        // MIB 8.7.97: Ein <PRE> spannen wir um die Linie auf. Dann stimmen
diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx
index 77871a1..ab80587 100644
--- a/sw/source/filter/html/htmlcss1.cxx
+++ b/sw/source/filter/html/htmlcss1.cxx
@@ -1043,7 +1043,8 @@ sal_Bool SwCSS1Parser::StyleParsed( const CSS1Selector *pSelector,
                // die Attribute in das DropCap-Attribut einfuegen
                if( CSS1_SCRIPT_ALL == nScript )
                {
                    FillDropCap( aDrop, rItemSet, &pColl->GetName() );
                    OUString sName(pColl->GetName());
                    FillDropCap( aDrop, rItemSet, &sName );
                }
                else
                {
@@ -1069,7 +1070,8 @@ sal_Bool SwCSS1Parser::StyleParsed( const CSS1Selector *pSelector,
                        aScriptItemSet.ClearItem( RES_CHRATR_CTL_POSTURE );
                        aScriptItemSet.ClearItem( RES_CHRATR_CTL_WEIGHT );
                    }
                    FillDropCap( aDrop, aScriptItemSet, &pColl->GetName() );
                    OUString sName(pColl->GetName());
                    FillDropCap( aDrop, aScriptItemSet, &sName );
                }

                // Das Attribut nur setzen, wenn float: left angegeben wurde
@@ -1488,7 +1490,7 @@ void SwCSS1Parser::AddClassName( OUString& rFmtName, const OUString& rClass )

void SwCSS1Parser::FillDropCap( SwFmtDrop& rDrop,
                                SfxItemSet& rItemSet,
                                const String *pName )
                                const OUString *pName )
{
    // die Anzahl der Zeilen entspricht in etwa einer %-Angabe
    // fuer die Hoehe (was passiert mit absoluten Hoehen???)
diff --git a/sw/source/filter/html/htmlfly.cxx b/sw/source/filter/html/htmlfly.cxx
index 7889ebf..2251fc2 100644
--- a/sw/source/filter/html/htmlfly.cxx
+++ b/sw/source/filter/html/htmlfly.cxx
@@ -538,7 +538,7 @@ OString SwHTMLWriter::OutFrmFmtOptions( const SwFrmFmt &rFrmFmt,

    // Name
    if( (nFrmOpts & (HTML_FRMOPT_ID|HTML_FRMOPT_NAME)) &&
        rFrmFmt.GetName().Len() )
        !rFrmFmt.GetName().isEmpty() )
    {
        const sal_Char *pStr =
            (nFrmOpts & HTML_FRMOPT_ID) ? OOO_STRING_SVTOOLS_HTML_O_id : OOO_STRING_SVTOOLS_HTML_O_name;
@@ -978,7 +978,7 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrmFmt &rFrmFmt,
    OString aEndTags;

    // implizite Sprungmarke -> <A NAME=...></A>...<IMG ...>
    if( pMarkType && rFrmFmt.GetName().Len() )
    if( pMarkType && !rFrmFmt.GetName().isEmpty() )
        rHTMLWrt.OutImplicitMark( rFrmFmt.GetName(), pMarkType );

    // URL -> <A>...<IMG ... >...</A>
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index 2d9b010..23ddcbd 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -1009,7 +1009,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt,
    if( rHTMLWrt.bLFPossible )
        rHTMLWrt.OutNewLine( sal_True );

    if( rFrmFmt.GetName().Len() )
    if( !rFrmFmt.GetName().isEmpty() )
        rHTMLWrt.OutImplicitMark( rFrmFmt.GetName(),
                                  pMarkToOLE );
    uno::Any aAny;
diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx
index 1e940b8..eb48608 100644
--- a/sw/source/filter/html/htmltabw.cxx
+++ b/sw/source/filter/html/htmltabw.cxx
@@ -1097,7 +1097,7 @@ Writer& OutHTML_SwTblNode( Writer& rWrt, SwTableNode & rNode,
    if( text::HoriOrientation::NONE==eTabHoriOri )
        nFlyHSpace = nFlyVSpace = 0;

    if( pFmt->GetName().Len() )
    if( !pFmt->GetName().isEmpty() )
        rHTMLWrt.OutImplicitMark( pFmt->GetName(), pMarkToTable );

    if( text::HoriOrientation::NONE!=eDivHoriOri )
diff --git a/sw/source/filter/html/swcss1.hxx b/sw/source/filter/html/swcss1.hxx
index d45ae37..dfce455 100644
--- a/sw/source/filter/html/swcss1.hxx
+++ b/sw/source/filter/html/swcss1.hxx
@@ -124,7 +124,7 @@ public:

    // Fuellen eines DropCap-Attributs
    void FillDropCap( SwFmtDrop& rDrop, SfxItemSet& rItemSet,
                      const String *pName=0 );
                      const OUString *pName=0 );

    sal_Bool SetFmtBreak( SfxItemSet& rItemSet,
                      const SvxCSS1PropertyInfo& rPropInfo );
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index ce78a87..f320ce4 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2627,10 +2627,10 @@ void WW8AttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFmt, const Point
                // because we deliver the normal content of the table cell, and no border
                // ( Flag was deleted above in aSaveData() )
                m_rWW8Export.bOutTable = true;
                const String& rName = rFrmFmt.GetName();
                m_rWW8Export.StartCommentOutput(rName);
                const OUString aName = rFrmFmt.GetName();
                m_rWW8Export.StartCommentOutput(aName);
                m_rWW8Export.WriteText();
                m_rWW8Export.EndCommentOutput(rName);
                m_rWW8Export.EndCommentOutput(aName);
            }
            else
                m_rWW8Export.WriteText();
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 6c02203..3af5046 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -526,31 +526,34 @@ void MSWordStyles::OutputStyle( SwFmt* pFmt, sal_uInt16 nPos )

        GetStyleData( pFmt, bFmtColl, nBase, nWwNext );

        String aName = pFmt->GetName();
        OUString aName = pFmt->GetName();
        // We want to map LO's default style to Word's "Normal" style.
        // Word looks for this specific style name when reading docx files.
        // (It must be the English word regardless of language settings)
        if ( nPos == 0 ) {
        if ( nPos == 0 )
        {
            assert( pFmt->GetPoolFmtId() == RES_POOLCOLL_STANDARD );
            aName = OUString("Normal");
        } else if (aName.EqualsIgnoreCaseAscii("Normal")) {
            aName = "Normal";
        }
        else if (aName.equalsIgnoreAsciiCase("Normal"))
        {
            // If LO has a style named "Normal"(!) rename it to something unique
            aName.InsertAscii("LO-" , 0);
            String aBaseName = aName;
            const OUString aBaseName = "LO-" + aName;
            aName = aBaseName;
            // Check if we still have a clash, in which case we add a suffix
            for ( int nSuffix = 0; ; ++nSuffix ) {
                bool clash=false;
                for ( int n = 1; n < nUsedSlots; ++n )
                for ( sal_uInt16 n = 1; n < nUsedSlots; ++n )
                    if ( pFmtA[n] &&
                         pFmtA[n]->GetName().EqualsIgnoreCaseAscii(aName) )
                         pFmtA[n]->GetName().equalsIgnoreAsciiCase(aName) )
                    {
                        clash = true;
                        break;
                    }
                if (!clash)
                    break;
                aName = aBaseName;
                aName += OUString::number(++nSuffix);
                // TODO: verify if we really need to increment nSuffix in 2 places
                aName = aBaseName + OUString::number(++nSuffix);
            }
        }

diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index a36556a..ed1ef20 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2853,9 +2853,9 @@ bool SwWW8ImplReader::AddExtraOutlinesAsExtraStyles(SwTOXBase& rBase)
                 nStyleLevel < nMaxLevel
               )
            {
                String sStyles(rBase.GetStyleNames(rSI.nOutlineLevel));
                if( sStyles.Len())
                    sStyles += TOX_STYLE_DELIMITER;
                OUString sStyles(rBase.GetStyleNames(rSI.nOutlineLevel));
                if ( !sStyles.isEmpty())
                    sStyles += OUString(TOX_STYLE_DELIMITER);
                sStyles += pFmt->GetName();
                rBase.SetStyleNames(sStyles, rSI.nOutlineLevel);
                bExtras = true;
diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx
index 0f0f012..450b1cc 100644
--- a/sw/source/filter/xml/xmltble.cxx
+++ b/sw/source/filter/xml/xmltble.cxx
@@ -286,20 +286,14 @@ bool SwXMLTableFrmFmtsSort_Impl::AddRow( SwFrmFmt& rFrmFmt,
            continue;

        // found!
        const String& rFmtName = pTestFmt->GetName();
        rFrmFmt.SetName( rFmtName );
        rFrmFmt.SetName( pTestFmt->GetName() );
        bInsert = false;
        break;
    }

    if( bInsert )
    {
        OUStringBuffer sBuffer( rNamePrefix.getLength() + 4UL );
        sBuffer.append( rNamePrefix );
        sBuffer.append( (sal_Unicode)'.' );
        sBuffer.append( (sal_Int32)(nLine+1UL) );

        rFrmFmt.SetName( sBuffer.makeStringAndClear() );
        rFrmFmt.SetName( rNamePrefix + "." + OUString::number(nLine+1UL) );
        if ( i != aFormatList.end() ) ++i;
        aFormatList.insert( i, &rFrmFmt );
    }
@@ -466,8 +460,7 @@ bool SwXMLTableFrmFmtsSort_Impl::AddCell( SwFrmFmt& rFrmFmt,
            continue;

        // found!
        const String& rFmtName = pTestFmt->GetName();
        rFrmFmt.SetName( rFmtName );
        rFrmFmt.SetName( pTestFmt->GetName() );
        bInsert = false;
        break;
    }
@@ -782,10 +775,10 @@ void SwXMLExport::ExportTableBox( const SwTableBox& rBox,
        const SwFrmFmt *pFrmFmt = rBox.GetFrmFmt();
        if( pFrmFmt )
        {
            const String& rName = pFrmFmt->GetName();
            if( rName.Len() )
            const OUString sName = pFrmFmt->GetName();
            if( !sName.isEmpty() )
            {
                AddAttribute( XML_NAMESPACE_TABLE, XML_STYLE_NAME, EncodeStyleName(rName) );
                AddAttribute( XML_NAMESPACE_TABLE, XML_STYLE_NAME, EncodeStyleName(sName) );
            }
        }
    }
@@ -922,10 +915,10 @@ void SwXMLExport::ExportTableLine( const SwTableLine& rLine,
    const SwFrmFmt *pFrmFmt = rLine.GetFrmFmt();
    if( pFrmFmt )
    {
        const String& rName = pFrmFmt->GetName();
        if( rName.Len() )
        const OUString sName = pFrmFmt->GetName();
        if( !sName.isEmpty() )
        {
            AddAttribute( XML_NAMESPACE_TABLE, XML_STYLE_NAME, EncodeStyleName(rName) );
            AddAttribute( XML_NAMESPACE_TABLE, XML_STYLE_NAME, EncodeStyleName(sName) );
        }
    }

@@ -1096,8 +1089,8 @@ static void lcl_xmltble_ClearName_Box( SwTableBox* pBox )
    else
    {
        SwFrmFmt *pFrmFmt = pBox->GetFrmFmt();
        if( pFrmFmt && pFrmFmt->GetName().Len() )
            pFrmFmt->SetName( aEmptyStr );
        if( pFrmFmt && !pFrmFmt->GetName().isEmpty() )
            pFrmFmt->SetName( OUString() );
    }
}

@@ -1111,7 +1104,7 @@ void SwXMLExport::ExportTable( const SwTableNode& rTblNd )
{
    const SwTable& rTbl = rTblNd.GetTable();
    const SwFrmFmt *pTblFmt = rTbl.GetFrmFmt();
    if( pTblFmt && pTblFmt->GetName().Len() )
    if( pTblFmt && !pTblFmt->GetName().isEmpty() )
    {
        AddAttribute( XML_NAMESPACE_TABLE, XML_NAME, pTblFmt->GetName() );
        AddAttribute( XML_NAMESPACE_TABLE, XML_STYLE_NAME,
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 1953bfe..60815e0 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -1369,14 +1369,14 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport,

    SwDoc *pDoc = SwImport::GetDocFromXMLImport( GetSwImport() );

    String sTblName;
    OUString sTblName;
    if( !aName.isEmpty() )
    {
        const SwTableFmt *pTblFmt = pDoc->FindTblFmtByName( aName );
        if( !pTblFmt )
            sTblName = aName;
    }
    if( !sTblName.Len() )
    if( sTblName.isEmpty() )
    {
        sTblName = pDoc->GetUniqueTblName();
        GetImport().GetTextImport()
diff --git a/sw/source/ui/app/appenv.cxx b/sw/source/ui/app/appenv.cxx
index 235f34d..7805d04 100644
--- a/sw/source/ui/app/appenv.cxx
+++ b/sw/source/ui/app/appenv.cxx
@@ -247,8 +247,8 @@ void SwModule::InsertEnv( SfxRequest& rReq )
        const SwPageDesc* pFollow = 0;
        SwTxtFmtColl *pSend = pTmp->GetTxtCollFromPool( RES_POOLCOLL_SENDADRESS ),
                     *pAddr = pTmp->GetTxtCollFromPool( RES_POOLCOLL_JAKETADRESS);
        const String &rSendMark = pSend->GetName();
        const String &rAddrMark = pAddr->GetName();
        const OUString sSendMark = pSend->GetName();
        const OUString sAddrMark = pAddr->GetName();

        if (nMode == ENV_INSERT)
        {
@@ -276,12 +276,12 @@ void SwModule::InsertEnv( SfxRequest& rReq )
                    pSh->EndPg(sal_True);
                pSh->DelRight();
                // Delete frame of the first page
                if( pSh->GotoFly( rSendMark ) )
                if ( pSh->GotoFly(sSendMark) )
                {
                    pSh->EnterSelFrmMode();
                    pSh->DelRight();
                }
                if ( pSh->GotoFly( rAddrMark ) )
                if ( pSh->GotoFly(sAddrMark) )
                {
                    pSh->EnterSelFrmMode();
                    pSh->DelRight();
@@ -427,7 +427,7 @@ void SwModule::InsertEnv( SfxRequest& rReq )
                Size (rItem.lAddrFromLeft - rItem.lSendFromLeft, 0));

            pSh->EnterSelFrmMode();
            pSh->SetFlyName( rSendMark );
            pSh->SetFlyName(sSendMark);
            pSh->UnSelectFrm();
            pSh->LeaveSelFrmMode();
            pSh->SetTxtFmtColl( pSend );
@@ -442,7 +442,7 @@ void SwModule::InsertEnv( SfxRequest& rReq )
            Point(rItem.lAddrFromLeft + lLeft, rItem.lAddrFromTop  + lUpper),
            Size (nPageW - rItem.lAddrFromLeft - 566, 0));
        pSh->EnterSelFrmMode();
        pSh->SetFlyName( rAddrMark );
        pSh->SetFlyName(sAddrMark);
        pSh->UnSelectFrm();
        pSh->LeaveSelFrmMode();
        pSh->SetTxtFmtColl( pAddr );
diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx
index 4ee1310..1f32f1d 100644
--- a/sw/source/ui/app/docstyle.cxx
+++ b/sw/source/ui/app/docstyle.cxx
@@ -833,7 +833,7 @@ bool  SwDocStyleSheet::SetName( const OUString& rStr)
            OSL_ENSURE(pColl, "Collection missing!");
            if( pColl && pColl->GetName() != rStr )
            {
                if (pColl->GetName().Len() > 0)
                if (!pColl->GetName().isEmpty())
                    rDoc.RenameFmt(*pColl, rStr);
                else
                    pColl->SetName(rStr);
@@ -847,7 +847,7 @@ bool  SwDocStyleSheet::SetName( const OUString& rStr)
            OSL_ENSURE(pFrmFmt, "FrmFmt missing!");
            if( pFrmFmt && pFrmFmt->GetName() != rStr )
            {
                if (pFrmFmt->GetName().Len() > 0)
                if (!pFrmFmt->GetName().isEmpty())
                    rDoc.RenameFmt(*pFrmFmt, rStr);
                else
                    pFrmFmt->SetName( rStr );
@@ -2477,8 +2477,8 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
            }

            aLst.Append( cCHAR, pFmt == rDoc.GetDfltCharFmt()
                        ? String(SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_STANDARD -
                                                RES_POOLCOLL_TEXT_BEGIN ])
                        ? SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_STANDARD -
                                                RES_POOLCOLL_TEXT_BEGIN ]
                        : pFmt->GetName() );
        }

diff --git a/sw/source/ui/chrdlg/swuiccoll.cxx b/sw/source/ui/chrdlg/swuiccoll.cxx
index 2c08cca..994ccb2 100644
--- a/sw/source/ui/chrdlg/swuiccoll.cxx
+++ b/sw/source/ui/chrdlg/swuiccoll.cxx
@@ -197,8 +197,7 @@ void SwCondCollPage::Reset(const SfxItemSet &/*rSet*/)

    for( sal_uInt16 n = 0; n < aStrArr.Count(); n++)
    {
        String aEntry( aStrArr.GetString(n) );
        aEntry += '\t';
        OUString aEntry( aStrArr.GetString(n) + "\t" );

        const SwCollCondition* pCond = 0;
        if( pFmt && RES_CONDTXTFMTCOLL == pFmt->Which() &&
diff --git a/sw/source/ui/config/uinums.cxx b/sw/source/ui/config/uinums.cxx
index b13461f..a09a838 100644
--- a/sw/source/ui/config/uinums.cxx
+++ b/sw/source/ui/config/uinums.cxx
@@ -539,7 +539,7 @@ void SwNumRulesWithName::_SwNumFmtGlobal::ChgNumFmt( SwWrtShell& rSh,
        for( sal_uInt16 i = 1; i < nArrLen; ++i )
        {
            pFmt = &rSh.GetCharFmt( i );
            if( COMPARE_EQUAL == pFmt->GetName().CompareTo( sCharFmtName ))
            if (pFmt->GetName()==sCharFmtName)
                // exists, so leave attributes as they are!
                break;
            pFmt = 0;
diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx
index 397af1a..e49a991 100644
--- a/sw/source/ui/envelp/envfmt.cxx
+++ b/sw/source/ui/envelp/envfmt.cxx
@@ -292,7 +292,8 @@ IMPL_LINK( SwEnvFmtPage, EditHdl, MenuButton *, pButton )
            SwAbstractDialogFactory* pFact = swui::GetFactory();
            OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");

            SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, DLG_CHAR_ENV, &pColl->GetName());
            const String sFmtStr = pColl->GetName();
            SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, DLG_CHAR_ENV, &sFmtStr);
            OSL_ENSURE(pDlg, "Dialogdiet fail!");
            if (pDlg->Execute() == RET_OK)
            {
@@ -332,7 +333,8 @@ IMPL_LINK( SwEnvFmtPage, EditHdl, MenuButton *, pButton )
            // set BoxInfo
            ::PrepareBoxInfo( aTmpSet, *pSh );

            SwParaDlg *pDlg = new SwParaDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, DLG_ENVELOP, &pColl->GetName());
            const String sFmtStr = pColl->GetName();
            SwParaDlg *pDlg = new SwParaDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, DLG_ENVELOP, &sFmtStr);

            if ( pDlg->Execute() == RET_OK )
            {
diff --git a/sw/source/ui/inc/wrtsh.hxx b/sw/source/ui/inc/wrtsh.hxx
index 89030ce..1030328 100644
--- a/sw/source/ui/inc/wrtsh.hxx
+++ b/sw/source/ui/inc/wrtsh.hxx
@@ -345,7 +345,7 @@ typedef sal_Bool (SwWrtShell:: *FNSimpleMove)();
                                    GetStyle eCreate = GETSTYLE_NOCREATE);
    SwCharFmt*      GetCharStyle(const String &rFmtName,
                                    GetStyle eCreate = GETSTYLE_NOCREATE);
    SwFrmFmt*       GetTblStyle(const String &rFmtName);
    SwFrmFmt*       GetTblStyle(const OUString &rFmtName);

    void    SetPageStyle(const String &rCollName);

diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 95e9d8f..b8f552c 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -752,21 +752,17 @@ SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(Window* pParent,
        if(pColl->IsDefault())
            continue;

        const String& rName = pColl->GetName();

        if(rName.Len() > 0)
        const OUString aName = pColl->GetName();
        if (!aName.isEmpty())
        {
            SvTreeListEntry* pEntry = rTLB.First();
            bool bFound = false;
            while(pEntry && !bFound)
            while (pEntry && rTLB.GetEntryText(pEntry)!=aName)
            {
                if(rTLB.GetEntryText(pEntry) == rName)
                    bFound = true;
                pEntry = rTLB.Next(pEntry);
            }
            if(!bFound)
            if (!pEntry)
            {
                rTLB.InsertEntry(rName)->SetUserData((void*)USHRT_MAX);
                rTLB.InsertEntry(aName)->SetUserData((void*)USHRT_MAX);
            }
        }
    }
diff --git a/sw/source/ui/shells/frmsh.cxx b/sw/source/ui/shells/frmsh.cxx
index 8c70438..038f489 100644
--- a/sw/source/ui/shells/frmsh.cxx
+++ b/sw/source/ui/shells/frmsh.cxx
@@ -86,7 +86,7 @@ using namespace ::com::sun::star::uno;

// Prototypes
static void lcl_FrmGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine);
static const SwFrmFmt* lcl_GetFrmFmtByName(SwWrtShell& rSh, const String& rName)
static const SwFrmFmt* lcl_GetFrmFmtByName(SwWrtShell& rSh, const OUString& rName)
{
    sal_uInt16 nCount = rSh.GetFlyCount(FLYCNTTYPE_FRM);
    for( sal_uInt16 i = 0; i < nCount; i++)
@@ -534,7 +534,7 @@ void SwFrameShell::Execute(SfxRequest &rReq)
                        {
                            rSh.HideChainMarker();

                            String sPrevName =
                            OUString sPrevName =
                                ((const SfxStringItem*)pItem)->GetValue();
                            const SwFmtChain &rChain = pCurrFlyFmt->GetChain();
                            //needs cast - no non-const method available
@@ -547,10 +547,10 @@ void SwFrameShell::Execute(SfxRequest &rReq)
                                    rSh.Unchain(*pFlyFmt);
                                }
                                else
                                    sPrevName.Erase();
                                    sPrevName = OUString();
                            }

                            if(sPrevName.Len())
                            if (!sPrevName.isEmpty())
                            {
                                //needs cast - no non-const method available
                                SwFrmFmt* pPrevFmt = (SwFrmFmt*)
@@ -568,7 +568,7 @@ void SwFrameShell::Execute(SfxRequest &rReq)
                                                 &pItem))
                        {
                            rSh.HideChainMarker();
                            String sNextName =
                            OUString sNextName =
                                ((const SfxStringItem*)pItem)->GetValue();
                            const SwFmtChain &rChain = pCurrFlyFmt->GetChain();
                            //needs cast - no non-const method available
@@ -581,10 +581,10 @@ void SwFrameShell::Execute(SfxRequest &rReq)
                                    rSh.Unchain(*((SwFlyFrmFmt*) pCurrFlyFmt));
                                }
                                else
                                    sNextName.Erase();
                                    sNextName = OUString();
                            }

                            if(sNextName.Len())
                            if (!sNextName.isEmpty())
                            {
                                //needs cast - no non-const method available
                                SwFrmFmt* pNextFmt = (SwFrmFmt*)
diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx
index 32120c1..3551749 100644
--- a/sw/source/ui/shells/textsh.cxx
+++ b/sw/source/ui/shells/textsh.cxx
@@ -404,8 +404,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
                if (!GetShell().IsTblComplexForChart())
                {
                    SwFrmFmt* pTblFmt = GetShell().GetTableFmt();
                    String aCurrentTblName = pTblFmt->GetName();
                    aRangeString = aCurrentTblName;
                    aRangeString = pTblFmt->GetName();
                    aRangeString += OUString::valueOf( sal_Unicode('.') );
                    aRangeString += GetShell().GetBoxNms();

diff --git a/sw/source/ui/table/chartins.cxx b/sw/source/ui/table/chartins.cxx
index 10deb9f..f4b01ee 100644
--- a/sw/source/ui/table/chartins.cxx
+++ b/sw/source/ui/table/chartins.cxx
@@ -157,8 +157,7 @@ void SwInsertChart(Window* pParent, SfxBindings* pBindings )
        if( ! rWrtShell.IsTblComplexForChart())
        {
            SwFrmFmt* pTblFmt = rWrtShell.GetTableFmt();
            String aCurrentTblName = pTblFmt->GetName();
            aRangeString = aCurrentTblName;
            aRangeString = pTblFmt->GetName();
            aRangeString += OUString::valueOf( sal_Unicode('.') );
            aRangeString += rWrtShell.GetBoxNms();

diff --git a/sw/source/ui/table/tablemgr.cxx b/sw/source/ui/table/tablemgr.cxx
index a76b624..947e3dd 100644
--- a/sw/source/ui/table/tablemgr.cxx
+++ b/sw/source/ui/table/tablemgr.cxx
@@ -208,7 +208,7 @@ uno::Reference< frame::XModel > SwTableFUNC::InsertChart(
    pSh->StartUndo( UNDO_UI_INSERT_CHART );
    pSh->StartAllAction();

    String aName;
    OUString aName;
    if (pSh->IsCrsrInTbl())
    {
        aName = pSh->GetTableFmt()->GetName();
@@ -247,7 +247,7 @@ uno::Reference< frame::XModel > SwTableFUNC::InsertChart(
        }

        // set the table name at the OLE-node
        if (aName.Len())
        if (!aName.isEmpty())
            pSh->SetChartName( aName );
    }
    pSh->EndAllAction();
diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx
index 67a0c09..5b54d0e 100644
--- a/sw/source/ui/utlui/content.cxx
+++ b/sw/source/ui/utlui/content.cxx
@@ -523,7 +523,7 @@ void    SwContentType::FillMemberList(sal_Bool* pbLevelOrVisibilityChanged)
            for(sal_uInt16 i = 0; i < nMemberCount; i++)
            {
                const SwFrmFmt& rTblFmt = pWrtShell->GetTblFrmFmt(i, true);
                String sTblName( rTblFmt.GetName() );
                const OUString sTblName( rTblFmt.GetName() );

                SwContent* pCnt = new SwContent(this, sTblName,
                        rTblFmt.FindLayoutRect(sal_False, &aNullPt).Top() );
@@ -555,7 +555,7 @@ void    SwContentType::FillMemberList(sal_Bool* pbLevelOrVisibilityChanged)
            for(sal_uInt16 i = 0; i < nMemberCount; i++)
            {
                const SwFrmFmt* pFrmFmt = pWrtShell->GetFlyNum(i,eType);
                String sFrmName = pFrmFmt->GetName();
                const OUString sFrmName = pFrmFmt->GetName();

                SwContent* pCnt;
                if(CONTENT_TYPE_GRAPHIC == nContentType)
diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx
index df5cd69a..a029164 100644
--- a/sw/source/ui/wrtsh/wrtsh1.cxx
+++ b/sw/source/ui/wrtsh/wrtsh1.cxx
@@ -1479,7 +1479,7 @@ SwCharFmt *SwWrtShell::GetCharStyle(const String &rFmtName, GetStyle eCreate )
//            frame format with this name exists or
//            this is a default format or the format is automatic.

SwFrmFmt *SwWrtShell::GetTblStyle(const String &rFmtName)
SwFrmFmt *SwWrtShell::GetTblStyle(const OUString &rFmtName)
{
    SwFrmFmt *pFmt = 0;
    for( sal_uInt16 i = GetTblFrmFmtCount(); i; )