[Libreoffice-commits] .: 2 commits - starmath/inc sw/source

Caolán McNamara caolan at kemper.freedesktop.org
Wed Feb 23 03:04:38 PST 2011


 starmath/inc/symbol.hxx         |    2 +-
 sw/source/filter/ww8/ww8par.cxx |   40 ++++++++++++++++++++++++++++++----------
 sw/source/filter/ww8/ww8par.hxx |    3 ++-
 3 files changed, 33 insertions(+), 12 deletions(-)

New commits:
commit 4e9fcdafe0bf3287529c253e3725748a5207e19c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 23 10:54:53 2011 +0000

    Related: fdo#34319 document requirements for MSWord FTC/LID emulation

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index d0a46c0..94e2564 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2610,7 +2610,7 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs)
 
         sPlainCharsBuf.ReleaseBufferAccess( nEndUsed );
 
-        AddTextToParagraph(sPlainCharsBuf);
+        emulateMSWordAddTextToParagraph(sPlainCharsBuf);
         rPos += nL2;
         if (!maApos.back()) //a para end in apo doesn't count
             bWasParaEnd = false;            //kein CR
@@ -2622,20 +2622,40 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs)
     return nL2 >= nLen;
 }
 
-bool SwWW8ImplReader::AddTextToParagraph(const String& rAddString)
+//TODO: In writer we categorize text into CJK, CTL and "Western" for everything
+//else. Microsoft Word basically categorizes text into East Asian, Non-East
+//Asian and ASCII, with some shared characters and some properties to
+//to hint as to which way to bias those shared characters.
+//
+//Here we must find out "what would word do" to see what font/language
+//word would assign to characters based on the unicode range they fall
+//into, taking into account the idctHint property if it exists.
+//
+//Where this differs from the default category that writer would assign it to
+//we're then forced (because we don't have an equivalent hint) to mirror the
+//properties of the source MSWord category into the properties of the dest
+//Writer category for that range of text in order to get the right results.
+bool SwWW8ImplReader::emulateMSWordAddTextToParagraph(const String& rAddString)
+{
+    return simpleAddTextToParagraph(rAddString);
+}
+
+bool SwWW8ImplReader::simpleAddTextToParagraph(const String& rAddString)
 {
     const SwTxtNode* pNd = pPaM->GetCntntNode()->GetTxtNode();
     if (rAddString.Len())
     {
-/*
+
 #ifdef DEBUG
-//!! does not compile with debug=t -> unresolved external (dbg_out),
-//!! sommeone who knows what he wants to get should fix this
-//        ::std::clog << "<addTextToParagraph>" << dbg_out(rAddString)
-//        << "</addTextToParagraph>" << ::std::endl;
+        {
+            rtl::OString sText(rtl::OUStringToOString(rAddString, RTL_TEXTENCODING_UTF8));
+            ::std::clog <<
+                "<addTextToParagraph>" << sText.getStr() << "</addTextToParagraph>"
+                << ::std::endl;
+        }
 #endif
-*/
-        if ((pNd->GetTxt().Len() + rAddString.Len()) < STRING_MAXLEN -1)
+
+        if ((pNd->GetTxt().Len() + rAddString.Len()) < STRING_MAXLEN-1)
         {
             rDoc.InsertString(*pPaM, rAddString);
         }
@@ -2913,7 +2933,7 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs)
     {
         String sInsert = ByteString::ConvertToUnicode(cInsert,
             RTL_TEXTENCODING_MS_1252 );
-        AddTextToParagraph(sInsert);
+        emulateMSWordAddTextToParagraph(sInsert);
     }
     if (!maApos.back()) //a para end in apo doesn't count
         bWasParaEnd = bNewParaEnd;
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index de3352b..4be96b7 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1117,7 +1117,8 @@ private:
         pReffingStck = 0;
     }
     void DeleteAnchorStk()  { DeleteStk( pAnchorStck ); pAnchorStck = 0; }
-    bool AddTextToParagraph(const String& sAddString);
+    bool emulateMSWordAddTextToParagraph(const String& sAddString);
+    bool simpleAddTextToParagraph(const String& sAddString);
     bool HandlePageBreakChar();
     bool ReadChar(long nPosCp, long nCpOfs);
     bool ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs);
commit 5d766a22248f7f95101e19822459f2877dc91d60
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 23 09:09:03 2011 +0000

    this can be const

diff --git a/starmath/inc/symbol.hxx b/starmath/inc/symbol.hxx
index 7740dca..885bbf0 100644
--- a/starmath/inc/symbol.hxx
+++ b/starmath/inc/symbol.hxx
@@ -139,7 +139,7 @@ typedef std::vector< const SmSym * >            SymbolPtrVec_t;
 
 struct lt_SmSymPtr : public std::binary_function< const SmSym *, const SmSym *, bool >
 {
-    bool operator() ( const SmSym *pSym1, const SmSym *pSym2 )
+    bool operator() ( const SmSym *pSym1, const SmSym *pSym2 ) const
     {
         return pSym1->GetCharacter() < pSym2->GetCharacter();
     }


More information about the Libreoffice-commits mailing list