[Libreoffice-commits] core.git: 3 commits - include/unotools sw/source vcl/unx writerfilter/source

Luboš Luňák l.lunak at suse.cz
Tue Jun 11 07:22:31 PDT 2013


 include/unotools/fontdefs.hxx             |    1 
 sw/source/core/txtnode/fntcache.cxx       |   17 ++++++++++
 vcl/unx/kde4/KDE4FilePicker.cxx           |   47 +++---------------------------
 writerfilter/source/dmapper/FontTable.cxx |    8 +++++
 4 files changed, 31 insertions(+), 42 deletions(-)

New commits:
commit 03f666103d80f7a0c79150dae2367079b80e50a6
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Mon Jun 10 15:26:40 2013 +0200

    fix and simplify getting files from the KDE4 file dialog
    
    - Fix multiple selection handling.
    - The "double click selection KDE4 bug" does not exist (anymore?) as far
      as I can tell.
    - Apparently it's not true that multiselect needs the first item in the list
      to be the directory.
    - KFileDialog can already give full URLs.
    
    Change-Id: I5bb651902fb6c1d75af40b78bf32c79b004b7358

diff --git a/vcl/unx/kde4/KDE4FilePicker.cxx b/vcl/unx/kde4/KDE4FilePicker.cxx
index 4be3b9a..01493d0 100644
--- a/vcl/unx/kde4/KDE4FilePicker.cxx
+++ b/vcl/unx/kde4/KDE4FilePicker.cxx
@@ -218,48 +218,11 @@ OUString SAL_CALL KDE4FilePicker::getDisplayDirectory()
 uno::Sequence< OUString > SAL_CALL KDE4FilePicker::getFiles()
     throw( uno::RuntimeException )
 {
-    QStringList rawFiles = _dialog->selectedFiles();
-    QStringList files;
-
-    // Workaround for the double click selection KDE4 bug
-    // kde file picker returns the file and directories for selectedFiles()
-    // when a file is double clicked
-    // make a true list of files
-    const QString dir = KUrl(rawFiles[0]).directory();
-
-    bool singleFile = true;
-    if (rawFiles.size() > 1)
-    {
-        singleFile = false;
-        //for multi file sequences, oo expects the first param to be the directory
-        //can't treat all cases like multi file because in some instances (inserting image)
-        //oo WANTS only one entry in the final list
-        files.append(dir);
-    }
-
-    for (sal_uInt16 i = 0; i < rawFiles.size(); ++i)
-    {
-        // if the raw file is not the base directory (see above kde bug)
-        // we add the file to list of avail files
-        if ((dir + "/") != ( rawFiles[i]))
-        {
-            QString filename = KUrl(rawFiles[i]).fileName();
-
-            if (singleFile)
-                filename.prepend(dir + "/");
-            files.append(filename);
-        }
-    }
-
-    // add all files and leading directory to outgoing OO sequence
-    uno::Sequence< OUString > seq(files.size());
-    for (int i = 0; i < files.size(); ++i)
-    {
-        OUString aFile(toOUString(files[i])), aURL;
-        osl_getFileURLFromSystemPath(aFile.pData, &aURL.pData );
-        seq[i] = aURL;
-    }
-
+    KUrl::List urls = _dialog->selectedUrls();
+    uno::Sequence< OUString > seq( urls.size());
+    int i = 0;
+    foreach( const KUrl& url, urls )
+        seq[ i++ ]= toOUString( url.url());
     return seq;
 }
 
commit f235df85447f1d159b70d8ace4d2849cf782abe6
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri Jun 7 11:31:05 2013 +0200

    ugly workaround for external leading with symbol fonts (bnc#823626)
    
    I'd much rather find the code using external leading in Writer's layout,
    but this font rendering and layout stuff is so complicated.
    
    Change-Id: Iaf58af387a6727eb18f5a9d1613de3ae30d7c35e

diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 77ae849..4b04cc7 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -379,6 +379,23 @@ sal_uInt16 SwFntObj::GetFontLeading( const ViewShell *pSh, const OutputDevice& r
             bSymbol = RTL_TEXTENCODING_SYMBOL == aMet.GetCharSet();
             GuessLeading( *pSh, aMet );
             nExtLeading = static_cast<sal_uInt16>(aMet.GetExtLeading());
+            /* HACK: There is something wrong with Writer's bullet rendering, causing lines
+               with bullets to be higher than they should be. I think this is because
+               Writer uses font's external leading incorrect, as the vertical distance
+               added to every line instead of only a distance between multiple lines,
+               which means a single bullet has external leading added even though it
+               shouldn't, but frankly this is just an educated guess rather than understanding
+               Writer's layout (heh).
+               Symbol font in some documents is 'StarSymbol; Arial Unicode MS', and Windows
+               machines often do not have StarSymbol, falling back to Arial Unicode MS, which
+               has unusually high external leading. So just reset external leading for fonts
+               which are used to bullets, as those should not be used on multiple lines anyway,
+               so in correct rendering external leading should be irrelevant anyway.
+               Interestingly enough, bSymbol is false for 'StarSymbol; Arial Unicode MS', so
+               also check explicitly.
+            */
+            if( bSymbol || IsStarSymbol( pPrtFont->GetName()))
+                nExtLeading = 0;
         }
 
         const IDocumentSettingAccess& rIDSA = *pSh->getIDocumentSettingAccess();
commit 47f218fcf4ba9de325e5721d2c4f27794677e87f
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Thu Jun 6 19:48:03 2013 +0200

    hack for reading properly textencoding for opensymbol from old LO
    
    Which did it because of bullet font not having it correctly
    (fixed in 44c133ef996e32ebdfc9560bcf14b0cd77196a9e).
    
    Change-Id: I6992de03816661cf6970140eb35816e26cf0e612

diff --git a/include/unotools/fontdefs.hxx b/include/unotools/fontdefs.hxx
index d1bf777..e57abd4 100644
--- a/include/unotools/fontdefs.hxx
+++ b/include/unotools/fontdefs.hxx
@@ -97,6 +97,7 @@ UNOTOOLS_DLLPUBLIC void GetEnglishSearchFontName( OUString& rName );
 
     @return true if this is Star|Open Symbol
 */
+// FIXME It's quite possible that code using this should instead check for RTL_TEXTENCODING_SYMBOL.
 UNOTOOLS_DLLPUBLIC bool IsStarSymbol(const OUString &rFontName);
 
 #endif
diff --git a/writerfilter/source/dmapper/FontTable.cxx b/writerfilter/source/dmapper/FontTable.cxx
index 47fdc01..8466147 100644
--- a/writerfilter/source/dmapper/FontTable.cxx
+++ b/writerfilter/source/dmapper/FontTable.cxx
@@ -25,6 +25,7 @@
 #include <stdio.h>
 #include <rtl/tencinfo.h>
 #include <vcl/embeddedfontshelper.hxx>
+#include <unotools/fontdefs.hxx>
 
 #include "dmapperLoggers.hxx"
 
@@ -100,13 +101,20 @@ void FontTable::lcl_attribute(Id Name, Value & val)
         case NS_ooxml::LN_CT_Charset_val:
             // w:characterSet has higher priority, set only if that one is not set
             if( m_pImpl->pCurrentEntry->nTextEncoding == RTL_TEXTENCODING_DONTKNOW )
+            {
                 m_pImpl->pCurrentEntry->nTextEncoding = rtl_getTextEncodingFromWindowsCharset( nIntValue );
+                if( IsStarSymbol( m_pImpl->pCurrentEntry->sFontName ))
+                    m_pImpl->pCurrentEntry->nTextEncoding = RTL_TEXTENCODING_SYMBOL;
+            }
         break;
         case NS_ooxml::LN_CT_Charset_characterSet:
         {
             OString tmp;
             sValue.convertToString( &tmp, RTL_TEXTENCODING_ASCII_US, OUSTRING_TO_OSTRING_CVTFLAGS );
             m_pImpl->pCurrentEntry->nTextEncoding = rtl_getTextEncodingFromMimeCharset( tmp.getStr() );
+            // Older LO versions used to write incorrect character set for OpenSymbol, fix.
+            if( IsStarSymbol( m_pImpl->pCurrentEntry->sFontName ))
+                m_pImpl->pCurrentEntry->nTextEncoding = RTL_TEXTENCODING_SYMBOL;
         break;
         }
         default:


More information about the Libreoffice-commits mailing list