[Libreoffice-commits] .: lotuswordpro/source

Thorsten Behrens thorsten at kemper.freedesktop.org
Fri Jun 1 08:56:30 PDT 2012


 lotuswordpro/source/filter/lwp9reader.cxx            |    6 +-
 lotuswordpro/source/filter/lwpbulletstylemgr.cxx     |   13 ++--
 lotuswordpro/source/filter/lwpdrawobj.cxx            |   18 +++---
 lotuswordpro/source/filter/lwpdrawobj.hxx            |   10 ++-
 lotuswordpro/source/filter/lwpfribmark.cxx           |    2 
 lotuswordpro/source/filter/lwpsilverbullet.cxx       |   52 ++++++++-----------
 lotuswordpro/source/filter/lwpsilverbullet.hxx       |   10 +--
 lotuswordpro/source/filter/xfilter/xftextcontent.cxx |    4 -
 lotuswordpro/source/filter/xfilter/xftextstyle.cxx   |   12 ++--
 9 files changed, 64 insertions(+), 63 deletions(-)

New commits:
commit fcc31f1749e01e4184c4347929a9e1d7e782dee1
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Fri Jun 1 17:53:42 2012 +0200

    Targeted string re-work for lotuswordpro filter
    
    Also cleaned up commented code, and a few extraneous temporaries

diff --git a/lotuswordpro/source/filter/lwp9reader.cxx b/lotuswordpro/source/filter/lwp9reader.cxx
index bd1a81d..29c52d3 100644
--- a/lotuswordpro/source/filter/lwp9reader.cxx
+++ b/lotuswordpro/source/filter/lwp9reader.cxx
@@ -211,7 +211,7 @@ void Lwp9Reader::ParseDocument()
     pChangeMgr->ConvertAllChange(m_pStream);
 
     doc->Parse(m_pStream);
-    m_pStream->EndElement(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("office:body")));
+    m_pStream->EndElement(::rtl::OUString("office:body"));
 
     WriteDocEnd();
 }
@@ -247,7 +247,7 @@ void Lwp9Reader::WriteDocHeader()
     pAttrList->AddAttribute( A2OUSTR("office:class"), A2OUSTR("text"));
     pAttrList->AddAttribute( A2OUSTR("office:version"), A2OUSTR("1.0"));
 
-    m_pStream->StartElement( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("office:document")) );
+    m_pStream->StartElement( ::rtl::OUString("office:document") );
     pAttrList->Clear();
 
 }
@@ -256,7 +256,7 @@ void Lwp9Reader::WriteDocHeader()
  */
 void Lwp9Reader::WriteDocEnd()
 {
-    m_pStream->EndElement(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("office:document")));
+    m_pStream->EndElement(::rtl::OUString("office:document"));
     m_pStream->EndDocument();
 }
 
diff --git a/lotuswordpro/source/filter/lwpbulletstylemgr.cxx b/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
index 0292186..78fa738 100644
--- a/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
+++ b/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
@@ -99,24 +99,25 @@ LwpBulletStyleMgr::~LwpBulletStyleMgr()
 rtl::OUString LwpBulletStyleMgr::RegisterBulletStyle(LwpPara* pPara, LwpBulletOverride* pBullOver,
     LwpIndentOverride* pIndent)
 {
+    rtl::OUString aEmpty;
+
     if(!pPara || !pIndent || !pBullOver)
     {
-//      assert(false);
-        return rtl::OUString();
+        return aEmpty;
     }
 
     LwpSilverBullet* pSilverBullet = pPara->GetSilverBullet();
     if (!pSilverBullet)
     {
         assert(false);
-        return rtl::OUString();
+        return aEmpty;
     }
 
     LwpPara* pBulletPara = pSilverBullet->GetBulletPara();
     if (!pBulletPara)
     {
         assert(false);
-        return rtl::OUString();
+        return aEmpty;
     }
 
     LwpParaProperty* pProp = pPara->GetProperty(PP_LOCAL_INDENT);
@@ -203,7 +204,7 @@ rtl::OUString LwpBulletStyleMgr::RegisterBulletStyle(LwpPara* pPara, LwpBulletOv
                     rtl::OUString aNumber = LwpSilverBullet::GetNumCharByStyleID(pParaNumber);
                     if (pParaNumber->GetStyleID() == NUMCHAR_01 || pParaNumber->GetStyleID() == NUMCHAR_Chinese4)
                     {
-                        aPrefix += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0"));
+                        aPrefix += rtl::OUString("0");
                     }
                     aFmt.SetPrefix(aPrefix);
 
@@ -231,7 +232,7 @@ rtl::OUString LwpBulletStyleMgr::RegisterBulletStyle(LwpPara* pPara, LwpBulletOv
                     }
 
                     pListStyle->SetListBullet(nPos, LwpSilverBullet::GetNumCharByStyleID(pParaNumber).toChar(),
-                        rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Times New Roman")), aPrefix, aSuffix);
+                        rtl::OUString("Times New Roman"), aPrefix, aSuffix);
                 }
 
                 pListStyle->SetListPosition(nPos, 0.0, 0.635, 0.0);
diff --git a/lotuswordpro/source/filter/lwpdrawobj.cxx b/lotuswordpro/source/filter/lwpdrawobj.cxx
index e0eeea1..9a5f29f 100644
--- a/lotuswordpro/source/filter/lwpdrawobj.cxx
+++ b/lotuswordpro/source/filter/lwpdrawobj.cxx
@@ -339,31 +339,31 @@ rtl::OUString LwpDrawObj::GetArrowName(sal_uInt8 nArrowStyle)
     {
     default:
     case AH_ARROW_FULLARROW:
-        aArrowName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Symmetric arrow"));
+        aArrowName = rtl::OUString("Symmetric arrow");
         break;
     case AH_ARROW_HALFARROW:
-        aArrowName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Arrow concave"));
+        aArrowName = rtl::OUString("Arrow concave");
         break;
     case AH_ARROW_LINEARROW:
-        aArrowName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("arrow100"));
+        aArrowName = rtl::OUString("arrow100");
         break;
     case AH_ARROW_INVFULLARROW:
-        aArrowName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("reverse arrow"));
+        aArrowName = rtl::OUString("reverse arrow");
         break;
     case AH_ARROW_INVHALFARROW:
-        aArrowName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("reverse concave arrow"));
+        aArrowName = rtl::OUString("reverse concave arrow");
         break;
     case AH_ARROW_INVLINEARROW:
-        aArrowName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("reverse line arrow"));
+        aArrowName = rtl::OUString("reverse line arrow");
         break;
     case AH_ARROW_TEE:
-        aArrowName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Dimension lines"));
+        aArrowName = rtl::OUString("Dimension lines");
         break;
     case AH_ARROW_SQUARE:
-        aArrowName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Square"));
+        aArrowName = rtl::OUString("Square");
         break;
     case AH_ARROW_CIRCLE:
-        aArrowName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Circle"));
+        aArrowName = rtl::OUString("Circle");
         break;
     }
 
diff --git a/lotuswordpro/source/filter/lwpdrawobj.hxx b/lotuswordpro/source/filter/lwpdrawobj.hxx
index b9f2818..80a0430 100644
--- a/lotuswordpro/source/filter/lwpdrawobj.hxx
+++ b/lotuswordpro/source/filter/lwpdrawobj.hxx
@@ -156,7 +156,10 @@ public:
 
 protected:
     virtual void Read() {}
-    virtual rtl::OUString RegisterStyle() { return rtl::OUString(); }
+    virtual rtl::OUString RegisterStyle()
+    {
+        return rtl::OUString();
+    }
     virtual XFFrame* CreateDrawObj(const rtl::OUString& /*rStyleName*/) { return NULL; }
     virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& /*rStyleName*/) { return NULL; }
 };
@@ -350,7 +353,10 @@ public:
 
 protected:
     virtual void Read();
-    virtual rtl::OUString RegisterStyle() {return rtl::OUString();}
+    virtual rtl::OUString RegisterStyle()
+    {
+        return rtl::OUString();
+    }
     virtual XFFrame* CreateDrawObj(const rtl::OUString& /*rStyleName*/){return NULL;}
     virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& /*rStyleName*/){return NULL;}
 };
diff --git a/lotuswordpro/source/filter/lwpfribmark.cxx b/lotuswordpro/source/filter/lwpfribmark.cxx
index 862ebe5..77db144 100644
--- a/lotuswordpro/source/filter/lwpfribmark.cxx
+++ b/lotuswordpro/source/filter/lwpfribmark.cxx
@@ -659,8 +659,6 @@ void LwpFribField::RegisterDateTimeStyle(OUString sFormula)
         else if (sFormula == A2OUSTR("%FLeeeeoa") || sFormula == A2OUSTR("%FLffffooaa") || sFormula == A2OUSTR("%FLEEEEOA"))
         {
             pDateStyle = new XFDateStyle;
-    //      OUString lang(RTL_CONSTASCII_USTRINGPARAM("zh-CN"));
-    //      pDateStyle->SetLanguage( lang);
             rtl::OUString sText;
             pDateStyle->AddYear();
             sText = rtl::OUString(0x5e74);
diff --git a/lotuswordpro/source/filter/lwpsilverbullet.cxx b/lotuswordpro/source/filter/lwpsilverbullet.cxx
index 1417af5..320f60c 100644
--- a/lotuswordpro/source/filter/lwpsilverbullet.cxx
+++ b/lotuswordpro/source/filter/lwpsilverbullet.cxx
@@ -168,7 +168,7 @@ void LwpSilverBullet::RegisterStyle()
                     }
 
                     pListStyle->SetListBullet(nPos, this->GetNumCharByStyleID(pParaNumber).toChar(),
-                        rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Times New Roman")), aPrefix, aSuffix);
+                        rtl::OUString("Times New Roman"), aPrefix, aSuffix);
                 }
 
                 pListStyle->SetListPosition(nPos, 0.0, 0.635, 0.0);
@@ -188,16 +188,18 @@ void LwpSilverBullet::RegisterStyle()
  */
 rtl::OUString LwpSilverBullet::GetBulletFontName()
 {
+    rtl::OUString aEmpty;
+
     //foundry has been set?
     if (!m_pFoundry)
     {
-        return rtl::OUString();
+        return aEmpty;
     }
 
     LwpFontManager* pFontMgr = m_pFoundry->GetFontManger();
     if (!pFontMgr)
     {
-        return rtl::OUString();
+        return aEmpty;
     }
 
     sal_uInt32 nBulletFontID = m_pBulletPara->GetBulletFontID();
@@ -206,7 +208,7 @@ rtl::OUString LwpSilverBullet::GetBulletFontName()
     //final fontid is valid?
     if (nFinalFont > 255 || nFinalFont == 0)
     {
-        return rtl::OUString();
+        return aEmpty;
     }
 
     //get font name from font manager.
@@ -226,15 +228,6 @@ UChar32 LwpSilverBullet::GetBulletChar()
     return aBulletChar.toChar();
 }
 
-rtl::OUString LwpSilverBullet::GetPrefix()
-{
-    return rtl::OUString();
-}
-
-rtl::OUString LwpSilverBullet::GetSuffix()
-{
-    return rtl::OUString();
-}
 /**
  * @short:   Get the LwpPara object through story id.
  */
@@ -263,13 +256,15 @@ LwpPara* LwpSilverBullet::GetBulletPara()
  */
 rtl::OUString LwpSilverBullet::GetNumCharByStyleID(LwpFribParaNumber* pParaNumber)
 {
+    rtl::OUString aEmpty;
+
     if (!pParaNumber)
     {
         assert(false);
-        return rtl::OUString();
+        return aEmpty;
     }
 
-    rtl::OUString strNumChar(RTL_CONSTASCII_USTRINGPARAM("1"));
+    rtl::OUString strNumChar("1");
     sal_uInt16 nStyleID = pParaNumber->GetStyleID();
     UChar32 uC = 0x0000;
 
@@ -278,19 +273,19 @@ rtl::OUString LwpSilverBullet::GetNumCharByStyleID(LwpFribParaNumber* pParaNumbe
     case NUMCHAR_1:
     case NUMCHAR_01:
     case NUMCHAR_Chinese4:
-        strNumChar =  rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1"));
+        strNumChar =  rtl::OUString("1");
         break;
     case NUMCHAR_A :
-        strNumChar =  rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("A"));
+        strNumChar =  rtl::OUString("A");
         break;
     case NUMCHAR_a:
-        strNumChar = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("a"));
+        strNumChar = rtl::OUString("a");
         break;
     case NUMCHAR_I:
-        strNumChar = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("I"));
+        strNumChar = rtl::OUString("I");
         break;
     case NUMCHAR_i:
-        strNumChar = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("i"));
+        strNumChar = rtl::OUString("i");
         break;
     case NUMCHAR_other:
         uC = static_cast<UChar32>(pParaNumber->GetNumberChar());
@@ -315,7 +310,7 @@ rtl::OUString LwpSilverBullet::GetNumCharByStyleID(LwpFribParaNumber* pParaNumbe
         }
         break;
     case NUMCHAR_none:
-        strNumChar = rtl::OUString();
+        strNumChar = aEmpty;
         break;
     default:
         break;
@@ -374,7 +369,7 @@ sal_uInt16 LwpSilverBullet::GetDisplayLevel(sal_uInt8 nPos)
  */
 rtl::OUString LwpSilverBullet::GetAdditionalName(sal_uInt8 nPos)
 {
-    rtl::OUString aRet = rtl::OUString();
+    rtl::OUString aRet, aEmpty;
     sal_uInt16 nHideBit = (1 << nPos);
     sal_Bool bDivisionName = sal_False;
     sal_Bool bSectionName = sal_False;
@@ -382,7 +377,7 @@ rtl::OUString LwpSilverBullet::GetAdditionalName(sal_uInt8 nPos)
     LwpFrib* pParaFrib = m_pBulletPara->GetFribs()->GetFribs();
     if (!pParaFrib)
     {
-        return rtl::OUString();
+        return aEmpty;
     }
 
     while (pParaFrib)
@@ -392,7 +387,7 @@ rtl::OUString LwpSilverBullet::GetAdditionalName(sal_uInt8 nPos)
             ModifierInfo* pMoInfo = pParaFrib->GetModifiers();
             if (!pMoInfo)
             {
-                return rtl::OUString();
+                return aEmpty;
             }
             sal_uInt16 nHideLevels = pMoInfo->aTxtAttrOverride.GetHideLevels();
             sal_uInt16 nType = static_cast<LwpFribDocVar*>(pParaFrib)->GetType();
@@ -426,13 +421,13 @@ rtl::OUString LwpSilverBullet::GetAdditionalName(sal_uInt8 nPos)
 
 rtl::OUString LwpSilverBullet::GetDivisionName()
 {
+    rtl::OUString aRet;
+
     if (!m_pFoundry)
     {
-        return rtl::OUString();
+        return aRet;
     }
 
-    rtl::OUString aRet = rtl::OUString();
-
     LwpDocument* pDoc = m_pFoundry->GetDocument();
     if (pDoc)
     {
@@ -450,10 +445,11 @@ rtl::OUString LwpSilverBullet::GetDivisionName()
 
 rtl::OUString LwpSilverBullet::GetSectionName()
 {
+    rtl::OUString aEmpty;
     LwpStory* pStory = dynamic_cast<LwpStory*>(m_aStory.obj(VO_STORY));
     if (!pStory)
     {
-        return rtl::OUString();
+        return aEmpty;
     }
 
     return pStory->GetSectionName();
diff --git a/lotuswordpro/source/filter/lwpsilverbullet.hxx b/lotuswordpro/source/filter/lwpsilverbullet.hxx
index b9aca7a..82a0c45 100644
--- a/lotuswordpro/source/filter/lwpsilverbullet.hxx
+++ b/lotuswordpro/source/filter/lwpsilverbullet.hxx
@@ -81,9 +81,9 @@ const sal_uInt16 NUMCHAR_i = 0x05;      //index for numberchar "i"
 const sal_uInt16 NUMCHAR_other= 0x06;   //index for numberchar "other"
 const sal_uInt16 NUMCHAR_01 = 0x0B;     //index for numberchar "01"
 
-const sal_uInt16 NUMCHAR_Chinese1 = 0x09;       //index for numberchar "Ò¼"
-const sal_uInt16 NUMCHAR_Chinese2 = 0x08;       //index for numberchar "Ò»"
-const sal_uInt16 NUMCHAR_Chinese3= 0x0A;    //index for numberchar "¼×"
+const sal_uInt16 NUMCHAR_Chinese1 = 0x09;       //index for numberchar "Ò¼"
+const sal_uInt16 NUMCHAR_Chinese2 = 0x08;       //index for numberchar "Ò»"
+const sal_uInt16 NUMCHAR_Chinese3= 0x0A;    //index for numberchar "¼×"
 const sal_uInt16 NUMCHAR_Chinese4 = 0x13;       //index for numberchar "01" in chinese version
 
 class LwpStory;
@@ -110,9 +110,9 @@ public:
 
     UChar32 GetBulletChar();
 
-    rtl::OUString GetPrefix();
+    rtl::OUString GetPrefix() { return rtl::OUString(); }
 
-    rtl::OUString GetSuffix();
+    rtl::OUString GetSuffix() { return rtl::OUString(); }
 
     inline rtl::OUString GetNumberingName();
 
diff --git a/lotuswordpro/source/filter/xfilter/xftextcontent.cxx b/lotuswordpro/source/filter/xfilter/xftextcontent.cxx
index 1f350a6..67e543b 100644
--- a/lotuswordpro/source/filter/xfilter/xftextcontent.cxx
+++ b/lotuswordpro/source/filter/xfilter/xftextcontent.cxx
@@ -81,8 +81,8 @@ void    XFTextContent::SetText(const rtl::OUString& text)
 void    XFTextContent::ToXml(IXFStream *pStrm)
 {
 //  pStrm->Characters(m_strText);
-    rtl::OUString sSpaceToken(RTL_CONSTASCII_USTRINGPARAM(" "));
-    sSpaceToken += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" "));
+    rtl::OUString sSpaceToken(" ");
+    sSpaceToken += rtl::OUString(" ");
     rtl::OUString sSubString;
     sal_Int32 nIndex = 0;
     sal_Int32 nSize = m_strText.getLength();
diff --git a/lotuswordpro/source/filter/xfilter/xftextstyle.cxx b/lotuswordpro/source/filter/xfilter/xftextstyle.cxx
index 80b99ba..67f83ba 100644
--- a/lotuswordpro/source/filter/xfilter/xftextstyle.cxx
+++ b/lotuswordpro/source/filter/xfilter/xftextstyle.cxx
@@ -116,12 +116,12 @@ void    XFTextStyle::ToXml(IXFStream *strm)
 
     pAttrList->Clear();
     if( !style.isEmpty() )
-        pAttrList->AddAttribute(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("style:name")),GetStyleName());
+        pAttrList->AddAttribute(rtl::OUString("style:name"),GetStyleName());
     if( !GetParentStyleName().isEmpty() )
         pAttrList->AddAttribute(A2OUSTR("style:parent-style-name"),GetParentStyleName());
 
-    pAttrList->AddAttribute(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("style:family")),A2OUSTR("text") );
-    strm->StartElement(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("style:style")));
+    pAttrList->AddAttribute(rtl::OUString("style:family"),A2OUSTR("text") );
+    strm->StartElement(rtl::OUString("style:style"));
 
     //Font properties:
     pAttrList->Clear();
@@ -129,10 +129,10 @@ void    XFTextStyle::ToXml(IXFStream *strm)
     if( m_pFont )
         m_pFont->ToXml(strm);
 
-    strm->StartElement(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("style:properties")));
-    strm->EndElement(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("style:properties")));
+    strm->StartElement(rtl::OUString("style:properties"));
+    strm->EndElement(rtl::OUString("style:properties"));
 
-    strm->EndElement(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("style:style")));
+    strm->EndElement(rtl::OUString("style:style"));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list