include/xmloff/XMLFontAutoStylePool.hxx |    1 
 sw/inc/SwRewriter.hxx                   |   10 +++--
 sw/source/core/undo/SwRewriter.cxx      |   52 +++++++++++++++++++++++++++-
 sw/source/core/undo/undel.cxx           |   36 +------------------
 xmloff/source/text/txtexppr.cxx         |   59 ++++++++++++++++++++++----------
 5 files changed, 101 insertions(+), 57 deletions(-)

New commits:
commit 26dc5f2ee67342bd474640e1cc39b96d3220721b
Author: Caolán McNamara <caol...@redhat.com>
Date:   Tue Aug 20 11:37:04 2013 +0100

    Resolves: fdo#67665 font names filtered out on odp/odg export
    
    Change-Id: Ia529992d15152db981379a1e0a4dec63b2dad40c

diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx
index 7c978f8..12a72a5 100644
--- a/xmloff/source/text/txtexppr.cxx
+++ b/xmloff/source/text/txtexppr.cxx
@@ -217,25 +217,48 @@ void XMLTextExportPropertySetMapper::ContextFontFilter(
     if( pFontCharsetState && (pFontCharsetState->maValue >>= nTmp ) )
         eEnc = (rtl_TextEncoding)nTmp;
 
-    OUString sName( ((SvXMLExport&)GetExport()).GetFontAutoStylePool()->Find(
-                        sFamilyName, sStyleName, nFamily, nPitch, eEnc ) );
-    if( !sName.isEmpty() )
+    //Resolves: fdo#67665 The purpose here appears to be to replace
+    //FontFamilyName and FontStyleName etc with a single FontName property. The
+    //problem is that repeated calls to here will first set
+    //pFontFamilyNameState->mnIndex to -1 to indicate it is disabled, so the
+    //next time pFontFamilyNameState is not passed here at all, which gives an
+    //empty sFamilyName resulting in disabling pFontNameState->mnIndex to -1.
+    //That doesn't seem right to me.
+    //
+    //So assuming that the main purpose is just to convert the properties in
+    //the main when we can, and to leave them alone when we can't. And with a
+    //secondary purpose to filter out empty font properties, then is would
+    //appear to make sense to base attempting the conversion if we have
+    //both of the major facts of the font description
+    //
+    //An alternative solution is to *not* fill the FontAutoStylePool with
+    //every font in the document, but to partition the fonts into the
+    //hard-attribute fonts which go into that pool and the style-attribute
+    //fonts which go into some additional pool which get merged just for
+    //the purposes of writing the embedded fonts but are not queried by
+    //"Find" which restores the original logic.
+    if (pFontFamilyNameState || pFontStyleNameState)
     {
-        pFontNameState->maValue <<= sName;
-        if( pFontFamilyNameState )
-            pFontFamilyNameState->mnIndex = -1;
-        if( pFontStyleNameState )
-            pFontStyleNameState->mnIndex = -1;
-        if( pFontFamilyState )
-            pFontFamilyState->mnIndex = -1;
-        if( pFontPitchState )
-            pFontPitchState->mnIndex = -1;
-        if( pFontCharsetState )
-            pFontCharsetState->mnIndex = -1;
-    }
-    else
-    {
-        pFontNameState->mnIndex = -1;
+        OUString sName( 
((SvXMLExport&)GetExport()).GetFontAutoStylePool()->Find(
+                            sFamilyName, sStyleName, nFamily, nPitch, eEnc ) );
+        if( !sName.isEmpty() )
+        {
+            pFontNameState->maValue <<= sName;
+            if( pFontFamilyNameState )
+                pFontFamilyNameState->mnIndex = -1;
+            if( pFontStyleNameState )
+                pFontStyleNameState->mnIndex = -1;
+            if( pFontFamilyState )
+                pFontFamilyState->mnIndex = -1;
+            if( pFontPitchState )
+                pFontPitchState->mnIndex = -1;
+            if( pFontCharsetState )
+                pFontCharsetState->mnIndex = -1;
+        }
+        else
+        {
+            pFontNameState->mnIndex = -1;
+        }
     }
 
     if( pFontFamilyNameState && sFamilyName.isEmpty() )
commit dfee01afdff0223284d17a4ea2134bece2ef440a
Author: Caolán McNamara <caol...@redhat.com>
Date:   Tue Aug 20 11:24:47 2013 +0100

    this Find is not actually implemented
    
    Change-Id: I0d8e8903bdc5943079c6ed9f123e2fca2f72467f

diff --git a/include/xmloff/XMLFontAutoStylePool.hxx 
b/include/xmloff/XMLFontAutoStylePool.hxx
index 8ee84d8..096eb3f 100644
--- a/include/xmloff/XMLFontAutoStylePool.hxx
+++ b/include/xmloff/XMLFontAutoStylePool.hxx
@@ -63,7 +63,6 @@ public:
             FontFamily nFamily,
             FontPitch nPitch,
             rtl_TextEncoding eEnc )const;
-    OUString Find( const OUString& rInternalName ) const;
 
     void exportXML();
 };
commit e47d90690c8fab3ec8b7fd7c1b79372251770f9d
Author: Matteo Casalin <matteo.casa...@yahoo.com>
Date:   Sun Aug 18 12:03:34 2013 +0200

    String to OUString, better location for class method
    
    Change-Id: Ifde0d45e35fed94d4ef6cb93b2feda172fd6608b

diff --git a/sw/inc/SwRewriter.hxx b/sw/inc/SwRewriter.hxx
index bb53508..ecf28ce 100644
--- a/sw/inc/SwRewriter.hxx
+++ b/sw/inc/SwRewriter.hxx
@@ -21,7 +21,7 @@
 #define _SW_REWRITER_HXX
 
 #include <vector>
-#include <tools/string.hxx>
+#include <rtl/ustring.hxx>
 #include <swdllapi.h>
 
 enum SwUndoArg
@@ -31,7 +31,7 @@ enum SwUndoArg
     UndoArg3
 };
 
-typedef std::pair<SwUndoArg, String> SwRewriteRule;
+typedef std::pair<SwUndoArg, OUString> SwRewriteRule;
 
 class SW_DLLPUBLIC SwRewriter
 {
@@ -42,9 +42,11 @@ public:
     SwRewriter(const SwRewriter & rSrc);
     ~SwRewriter();
 
-    void AddRule(SwUndoArg eWhat, const String & rWith);
+    void AddRule(SwUndoArg eWhat, const OUString & rWith);
 
-    String Apply(const String & rStr) const;
+    OUString Apply(const OUString & rStr) const;
+
+    static OUString GetPlaceHolder(SwUndoArg eId);
 };
 
 #endif // _SW_REWRITER_HXX
diff --git a/sw/source/core/undo/SwRewriter.cxx 
b/sw/source/core/undo/SwRewriter.cxx
index 60d094d..3d1b584 100644
--- a/sw/source/core/undo/SwRewriter.cxx
+++ b/sw/source/core/undo/SwRewriter.cxx
@@ -41,7 +41,7 @@ SwRewriter::~SwRewriter()
 {
 }
 
-void SwRewriter::AddRule(SwUndoArg eWhat, const String & rWith)
+void SwRewriter::AddRule(SwUndoArg eWhat, const OUString & rWith)
 {
     SwRewriteRule aRule(eWhat, rWith);
 
@@ -55,4 +55,54 @@ void SwRewriter::AddRule(SwUndoArg eWhat, const String & 
rWith)
         mRules.push_back(aRule);
 }
 
+namespace
+{
+
+const char UNDO_ARG1[] = "$1";
+const char UNDO_ARG2[] = "$2";
+const char UNDO_ARG3[] = "$3";
+
+}
+
+OUString SwRewriter::Apply(const OUString & rStr) const
+{
+    OUString aResult = rStr;
+    std::vector<SwRewriteRule>::const_iterator aIt;
+
+    for (aIt = mRules.begin(); aIt != mRules.end(); ++aIt)
+    {
+        switch (aIt->first)
+        {
+            case UndoArg1:
+            default:
+                aResult = aResult.replaceAll(UNDO_ARG1, aIt->second);
+                break;
+            case UndoArg2:
+                aResult = aResult.replaceAll(UNDO_ARG2, aIt->second);
+                break;
+            case UndoArg3:
+                aResult = aResult.replaceAll(UNDO_ARG3, aIt->second);
+                break;
+        }
+    }
+
+    return aResult;
+}
+
+OUString SwRewriter::GetPlaceHolder(SwUndoArg eId)
+{
+    switch (eId)
+    {
+        case UndoArg1:
+            return OUString(UNDO_ARG1);
+        case UndoArg2:
+            return OUString(UNDO_ARG2);
+        case UndoArg3:
+            return OUString(UNDO_ARG3);
+        default:
+            break;
+    }
+    return OUString(UNDO_ARG1);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 2fbe933..c6ac06c 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -552,10 +552,6 @@ static bool lcl_IsSpecialCharacter(sal_Unicode nChar)
     return false;
 }
 
-const char UNDO_ARG1[] = "$1";
-const char UNDO_ARG2[] = "$2";
-const char UNDO_ARG3[] = "$3";
-
 static String lcl_DenotedPortion(String rStr, xub_StrLen nStart,
                                  xub_StrLen nEnd)
 {
@@ -579,8 +575,7 @@ static String lcl_DenotedPortion(String rStr, xub_StrLen 
nStart,
 
             case CH_TXTATR_INWORD:
             case CH_TXTATR_BREAKWORD:
-                aResult = OUString(UNDO_ARG2);
-
+                aResult = SwRewriter::GetPlaceHolder(UndoArg2);
                 break;
 
             }
@@ -638,7 +633,7 @@ String DenoteSpecialCharacters(const String & rStr)
         aResult += lcl_DenotedPortion(rStr, nStart, rStr.Len());
     }
     else
-        aResult = OUString(UNDO_ARG2);
+        aResult = SwRewriter::GetPlaceHolder(UndoArg2);
 
     return aResult;
 }
@@ -686,7 +681,7 @@ SwRewriter SwUndoDelete::GetRewriter() const
             }
             else
             {
-                aStr = OUString(UNDO_ARG2);
+                aStr = SwRewriter::GetPlaceHolder(UndoArg2);
             }
         }
 
@@ -1082,29 +1077,4 @@ void SwUndoDelete::SetTableName(const String & rName)
     sTableName = rName;
 }
 
-String SwRewriter::Apply(const String & rStr) const
-{
-    OUString aResult = rStr;
-    std::vector<SwRewriteRule>::const_iterator aIt;
-
-    for (aIt = mRules.begin(); aIt != mRules.end(); ++aIt)
-    {
-        switch (aIt->first)
-        {
-            case UndoArg1:
-            default:
-                aResult = aResult.replaceAll(UNDO_ARG1, aIt->second);
-                break;
-            case UndoArg2:
-                aResult = aResult.replaceAll(UNDO_ARG2, aIt->second);
-                break;
-            case UndoArg3:
-                aResult = aResult.replaceAll(UNDO_ARG3, aIt->second);
-                break;
-        }
-    }
-
-    return aResult;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to