[Libreoffice-commits] core.git: 3 commits - sfx2/source svl/source xmloff/source

Radek Doulik rodo at novell.com
Fri Feb 22 09:16:03 PST 2013


 sfx2/source/appl/sfxhelp.cxx         |   43 ++++++++++++++++++-----------------
 sfx2/source/bastyp/helper.cxx        |   10 ++++----
 sfx2/source/inc/helper.hxx           |    4 +--
 svl/source/items/custritm.cxx        |   16 ++-----------
 xmloff/source/draw/sdxmlimp.cxx      |   11 ++++++++
 xmloff/source/draw/sdxmlimp_impl.hxx |    1 
 6 files changed, 45 insertions(+), 40 deletions(-)

New commits:
commit eb451cbc1aa2f96b1a913d85823ef27275ad367b
Author: Radek Doulik <rodo at novell.com>
Date:   Fri Feb 22 18:15:22 2013 +0100

    set document settings / embed fonts when importing odp
    
    Change-Id: Ib7160c3b00399e704cd02a41735b0ff4f13d8554

diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx
index 6797c73..3c86883 100644
--- a/xmloff/source/draw/sdxmlimp.cxx
+++ b/xmloff/source/draw/sdxmlimp.cxx
@@ -1068,4 +1068,15 @@ void SdXMLImport::AddDateTimeDecl( const ::rtl::OUString& rName, const ::rtl::OU
     return aDecl.maStrText;
 }
 
+void SdXMLImport::NotifyEmbeddedFontRead()
+{
+    uno::Reference< lang::XMultiServiceFactory > xFac( GetModel(), uno::UNO_QUERY );
+    if( xFac.is() )
+    {
+        uno::Reference< beans::XPropertySet > xProps( xFac->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.Settings" ) ) ), uno::UNO_QUERY );
+        if( xProps.is() )
+            xProps->setPropertyValue("EmbedFonts", uno::makeAny( true ) );
+    }
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/sdxmlimp_impl.hxx b/xmloff/source/draw/sdxmlimp_impl.hxx
index dbede52..43ba353 100644
--- a/xmloff/source/draw/sdxmlimp_impl.hxx
+++ b/xmloff/source/draw/sdxmlimp_impl.hxx
@@ -310,6 +310,7 @@ public:
     ::rtl::OUString GetFooterDecl( const ::rtl::OUString& rName ) const;
     ::rtl::OUString GetDateTimeDecl( const ::rtl::OUString& rName, sal_Bool& rbFixed, ::rtl::OUString& rDateTimeFormat );
 
+    virtual void NotifyEmbeddedFontRead() SAL_OVERRIDE;
 };
 
 #endif  //  _SDXMLIMP_HXX
commit 046ad9ffad7b4647fcc66291dec73bbb67a7fe85
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Fri Feb 22 21:09:12 2013 +0400

    fix string conversion in 1da3af5f1eb6a32fd0ab10da7cf2f8ddb298a3a1
    
    Change-Id: I683002c12f9bb8f053dafea70c889a2881a70b99

diff --git a/svl/source/items/custritm.cxx b/svl/source/items/custritm.cxx
index 3b3128d..d44b43c 100644
--- a/svl/source/items/custritm.cxx
+++ b/svl/source/items/custritm.cxx
@@ -54,19 +54,9 @@ int CntUnencodedStringItem::Compare(SfxPoolItem const & rWith) const
     DBG_CHKTHIS(CntUnencodedStringItem, 0);
     DBG_ASSERT(rWith.ISA(CntUnencodedStringItem),
                 "CntUnencodedStringItem::Compare(): Bad type");
-    switch (m_aValue.compareTo(static_cast< CntUnencodedStringItem const * >(
-                                       &rWith)->
-                                   m_aValue))
-    {
-        case COMPARE_LESS:
-            return -1;
-
-        case COMPARE_EQUAL:
-            return 0;
-
-        default: // COMPARE_GREATER
-            return 1;
-    }
+    sal_Int32 nCmp = m_aValue.compareTo(
+        static_cast< CntUnencodedStringItem const * >(&rWith)->m_aValue);
+    return (nCmp == 0) ? 0 : (nCmp < 0) ? -1 : 1;
 }
 
 //============================================================================
commit 3a5ae29f0d2f4467ec75803d6e3b5b461672428a
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Fri Feb 22 15:19:38 2013 +0400

    String -> OUString
    
    Change-Id: I5b577a8e0675d7849ca22e24bb99ee2d8602ae6a

diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index fa346a8..6b6aeea 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -126,12 +126,12 @@ static OUString HelpLocaleString()
             if (!osl::DirectoryItem::get(sHelpPath, aDirItem) == osl::FileBase::E_None)
             {
                 bOk = false;
-                String sLang(aLocaleStr);
-                xub_StrLen nSepPos = sLang.Search( '-' );
-                if (nSepPos != STRING_NOTFOUND)
+                OUString sLang(aLocaleStr);
+                sal_Int32 nSepPos = sLang.indexOf( '-' );
+                if (nSepPos != -1)
                 {
                     bOk = true;
-                    sLang = sLang.Copy( 0, nSepPos );
+                    sLang = sLang.copy( 0, nSepPos );
                     sHelpPath = aBaseInstallPath +
                         OUString::createFromAscii(szHelpPath) + sLang;
                     if (!osl::DirectoryItem::get(sHelpPath, aDirItem) == osl::FileBase::E_None)
@@ -185,7 +185,7 @@ sal_Bool GetHelpAnchor_Impl( const OUString& _rURL, OUString& _rAnchor )
 
             if ( !sAnchor.isEmpty() )
             {
-                _rAnchor = String( sAnchor );
+                _rAnchor = sAnchor;
                 bRet = sal_True;
             }
         }
@@ -307,7 +307,7 @@ public:
     ~SfxHelp_Impl();
 
     SfxHelpOptions_Impl*    GetOptions();
-    static String           GetHelpText( const OUString& aCommandURL, const String& rModule );
+    static OUString         GetHelpText( const OUString& aCommandURL, const OUString& rModule );
 };
 
 SfxHelp_Impl::SfxHelp_Impl() :
@@ -322,14 +322,17 @@ SfxHelp_Impl::~SfxHelp_Impl()
     delete m_pOpt;
 }
 
-String SfxHelp_Impl::GetHelpText( const OUString& aCommandURL, const String& rModule )
+OUString SfxHelp_Impl::GetHelpText( const OUString& aCommandURL, const OUString& rModule )
 {
     // create help url
-    String aHelpURL = SfxHelp::CreateHelpURL( aCommandURL, rModule );
+    OUStringBuffer aHelpURL( SfxHelp::CreateHelpURL( aCommandURL, rModule ) );
     // added 'active' parameter
-    aHelpURL.Insert( String( "&Active=true" ), aHelpURL.SearchBackward( '#' ) );
+    sal_Int32 nIndex = aHelpURL.lastIndexOf( '#' );
+    if ( nIndex < 0 )
+        nIndex = aHelpURL.getLength();
+    aHelpURL.insert( nIndex, "&Active=true" );
     // load help string
-    return SfxContentHelper::GetActiveHelpString( aHelpURL );
+    return SfxContentHelper::GetActiveHelpString( aHelpURL.makeStringAndClear() );
 }
 
 SfxHelpOptions_Impl* SfxHelp_Impl::GetOptions()
@@ -619,13 +622,13 @@ OUString SfxHelp::GetHelpText( const OUString& aCommandURL, const Window* pWindo
     if ( bIsDebug )
     {
         sHelpText += "\n-------------\n";
-        sHelpText += String( sModuleName );
+        sHelpText += sModuleName;
         sHelpText += ": ";
         sHelpText += aCommandURL;
         if ( !aNewHelpId.isEmpty() )
         {
             sHelpText += " - ";
-            sHelpText += String(OStringToOUString(aNewHelpId, RTL_TEXTENCODING_UTF8));
+            sHelpText += OStringToOUString(aNewHelpId, RTL_TEXTENCODING_UTF8);
         }
     }
 
@@ -644,7 +647,7 @@ static bool impl_hasHelpInstalled( const OUString &rLang = OUString() )
 
 sal_Bool SfxHelp::SearchKeyword( const OUString& rKeyword )
 {
-    return Start_Impl( String(), NULL, rKeyword );
+    return Start_Impl( OUString(), NULL, rKeyword );
 }
 
 sal_Bool SfxHelp::Start( const OUString& rURL, const Window* pWindow )
@@ -653,14 +656,14 @@ sal_Bool SfxHelp::Start( const OUString& rURL, const Window* pWindow )
 }
 
 /// Redirect the vnd.sun.star.help:// urls to http://help.libreoffice.org
-static bool impl_showOnlineHelp( const String& rURL )
+static bool impl_showOnlineHelp( const OUString& rURL )
 {
-    String aInternal( "vnd.sun.star.help://"  );
-    if ( rURL.Len() <= aInternal.Len() || rURL.Copy( 0, aInternal.Len() ) != aInternal )
+    OUString aInternal( "vnd.sun.star.help://"  );
+    if ( rURL.getLength() <= aInternal.getLength() || !rURL.startsWith(aInternal) )
         return false;
 
     OUString aHelpLink( "http://help.libreoffice.org/"  );
-    aHelpLink += rURL.Copy( aInternal.Len() );
+    aHelpLink += rURL.copy( aInternal.getLength() );
     try
     {
         Reference< XSystemShellExecute > xSystemShell(
@@ -692,10 +695,10 @@ sal_Bool SfxHelp::Start_Impl(const OUString& rURL, const Window* pWindow, const
        Help keyword search now is implemented as own method; in former versions it
        was done via Help::Start, but this implementation conflicted with the upward search.
     */
-    String aHelpURL;
+    OUString aHelpURL;
     INetURLObject aParser( rURL );
     INetProtocol nProtocol = aParser.GetProtocol();
-    String aHelpModuleName( GetHelpModuleName_Impl() );
+    OUString aHelpModuleName( GetHelpModuleName_Impl() );
 
     switch ( nProtocol )
     {
@@ -727,7 +730,7 @@ sal_Bool SfxHelp::Start_Impl(const OUString& rURL, const Window* pWindow, const
                         if (!pParent)
                         {
                             // create help url of start page ( helpid == 0 -> start page)
-                            aHelpURL = CreateHelpURL( String(), aHelpModuleName );
+                            aHelpURL = CreateHelpURL( OUString(), aHelpModuleName );
                         }
                         else if (pParent->IsDialog() && !bTriedTabPage)
                         {
diff --git a/sfx2/source/bastyp/helper.cxx b/sfx2/source/bastyp/helper.cxx
index c97d92f..5e96afc 100644
--- a/sfx2/source/bastyp/helper.cxx
+++ b/sfx2/source/bastyp/helper.cxx
@@ -248,9 +248,9 @@ uno::Sequence< OUString > SfxContentHelper::GetHelpTreeViewContents( const Strin
 
 // -----------------------------------------------------------------------
 
-String SfxContentHelper::GetActiveHelpString( const String& rURL )
+OUString SfxContentHelper::GetActiveHelpString( const OUString& rURL )
 {
-    String aRet;
+    OUStringBuffer aRet;
     try
     {
         uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
@@ -268,7 +268,7 @@ String SfxContentHelper::GetActiveHelpString( const String& rURL )
             for( sal_Int32 i = 0; i < nRead; ++i )
                 sBuffer.append( (sal_Char)lData[i] );
             OUString sString = OStringToOUString( sBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 );
-            aRet += String( sString );
+            aRet.append( sString );
 
             nRead = xStream->readBytes( lData, 1024 );
         }
@@ -277,12 +277,12 @@ String SfxContentHelper::GetActiveHelpString( const String& rURL )
     {
     }
 
-    return aRet;
+    return aRet.makeStringAndClear();
 }
 
 // -----------------------------------------------------------------------
 
-sal_Bool SfxContentHelper::IsHelpErrorDocument( const String& rURL )
+sal_Bool SfxContentHelper::IsHelpErrorDocument( const OUString& rURL )
 {
     sal_Bool bRet = sal_False;
     try
diff --git a/sfx2/source/inc/helper.hxx b/sfx2/source/inc/helper.hxx
index 30a7103..6c008d4 100644
--- a/sfx2/source/inc/helper.hxx
+++ b/sfx2/source/inc/helper.hxx
@@ -34,8 +34,8 @@ public:
                                 GetResultSet( const String& rURL );
     static ::com::sun::star::uno::Sequence< ::rtl::OUString >
                                 GetHelpTreeViewContents( const String& rURL );
-    static String               GetActiveHelpString( const String& rURL );
-    static sal_Bool             IsHelpErrorDocument( const String& rURL );
+    static OUString             GetActiveHelpString( const OUString& rURL );
+    static sal_Bool             IsHelpErrorDocument( const OUString& rURL );
 
     static sal_uIntPtr              GetSize( const String& rContent );
 };


More information about the Libreoffice-commits mailing list