[Libreoffice-commits] core.git: 4 commits - cppcanvas/source include/sfx2 include/ucbhelper sd/source sfx2/source ucbhelper/source ucb/source

Andre Fischer af at apache.org
Tue Jun 4 03:09:41 PDT 2013


 cppcanvas/source/mtfrenderer/implrenderer.cxx           |   14 ++
 include/sfx2/sidebar/ControllerItem.hxx                 |    5 +
 include/ucbhelper/fd_inputstream.hxx                    |   35 ++-----
 sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx |    1 
 sfx2/source/sidebar/ControllerItem.cxx                  |   19 +++
 ucb/source/ucp/ftp/ftpcfunc.cxx                         |   16 +--
 ucb/source/ucp/ftp/ftpcfunc.hxx                         |    2 
 ucb/source/ucp/ftp/ftpurl.cxx                           |   26 +++--
 ucb/source/ucp/ftp/ftpurl.hxx                           |    4 
 ucbhelper/source/provider/fd_inputstream.cxx            |   79 ++++++----------
 10 files changed, 111 insertions(+), 90 deletions(-)

New commits:
commit 3b55196fb07c9101f0f0f51895a8083cbf5e78fc
Author: Andre Fischer <af at apache.org>
Date:   Mon Jun 3 12:33:38 2013 +0000

    Resolves: #i122433# The sidebar ControllerItem can now...
    
    give access to the extended help text for commands
    
    (cherry picked from commit 3f483a9219b9135f9f854d62b4ad0512d3752660)
    
    Conflicts:
    	sfx2/inc/sfx2/sidebar/ControllerItem.hxx
    
    Change-Id: I22668e6f9c1c7aed174a43d7d3e04829dc6733ae
    
    Related: #i122433# fix build breaker
    
     invalid use of incomplete type 'struct Help'
    
    (cherry picked from commit 797e399967ffb1c28b8c32d328f5f57d79a8caf3)
    
    Change-Id: Ifde6fede9b91eb828c665a5a720b93171108e17b

diff --git a/include/sfx2/sidebar/ControllerItem.hxx b/include/sfx2/sidebar/ControllerItem.hxx
index 61d21ba..70b4c3d 100644
--- a/include/sfx2/sidebar/ControllerItem.hxx
+++ b/include/sfx2/sidebar/ControllerItem.hxx
@@ -100,6 +100,11 @@ public:
     */
     ::rtl::OUString GetLabel (void) const;
 
+    /** Return the extended help text for the command.
+        Returns an empty string when the UNO command name is not available.
+    */
+    ::rtl::OUString GetHelpText (void) const;
+
     /** Return the icon for the command.
     */
     Image GetIcon (void) const;
diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx
index 5abc109..eb22a18 100644
--- a/sfx2/source/sidebar/ControllerItem.cxx
+++ b/sfx2/source/sidebar/ControllerItem.cxx
@@ -25,6 +25,7 @@
 #include "sfx2/sidebar/CommandInfoProvider.hxx"
 #include <vcl/svapp.hxx>
 #include <vcl/toolbox.hxx>
+#include <vcl/help.hxx>
 
 #include <com/sun/star/frame/XFrame.hpp>
 #include <com/sun/star/frame/XFrameActionListener.hpp>
@@ -202,6 +203,23 @@ void ControllerItem::ResetFrame (void)
 
 
 
+::rtl::OUString ControllerItem::GetHelpText (void) const
+{
+    Help* pHelp = Application::GetHelp();
+    if (pHelp != NULL)
+    {
+        if (msCommandName.getLength() > 0)
+        {
+            const ::rtl::OUString sHelp (pHelp->GetHelpText(A2S(".uno:")+msCommandName, NULL));
+            return sHelp;
+        }
+    }
+    return ::rtl::OUString();
+}
+
+
+
+
 Image ControllerItem::GetIcon (void) const
 {
     return GetImage(mxFrame, A2S(".uno:")+msCommandName, sal_False);
@@ -218,6 +236,7 @@ ControllerItem::ItemUpdateReceiverInterface::~ItemUpdateReceiverInterface()
 void ControllerItem::SetupToolBoxItem (ToolBox& rToolBox, const sal_uInt16 nIndex)
 {
     rToolBox.SetQuickHelpText(nIndex, GetLabel());
+    rToolBox.SetHelpText(nIndex, GetHelpText());
     rToolBox.SetItemImage(nIndex, GetIcon());
 }
 
commit b269b4ee7c44ec33e63838412bdf4d2a0e1b4887
Author: Andre Fischer <af at apache.org>
Date:   Mon Jun 3 10:38:19 2013 +0000

    Resolves: #i122437# Fixed context notification for Draw documents
    
    (cherry picked from commit 88914c616747693083819ec44ea81c9d96fa5136)
    
    Change-Id: I6d5c7365cfe51ba7c6ce57f589264aac8b066742

diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index a215952..319371b 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -567,6 +567,7 @@ void SlideSorterViewShell::Activate (sal_Bool bIsMDIActivate)
         case ViewShell::ST_IMPRESS:
         case ViewShell::ST_SLIDE_SORTER:
         case ViewShell::ST_NOTES:
+        case ViewShell::ST_DRAW:
             eContext = EnumContext::Context_DrawPage;
             if (pMainViewShell->ISA(DrawViewShell))
             {
commit 8de6167e36506a5cba21f6a35d4f064e9c9ea368
Author: Ariel Constenla-Haile <arielch at apache.org>
Date:   Sat Jun 1 17:16:49 2013 +0000

    Resolves: #i122273# - Avoid using tmpfile()
    
    (cherry picked from commit c4ef17d5e2844ca8d2459a3bfa1f91d99ac297f2)
    
    Conflicts:
    	ucb/source/ucp/ftp/ftpcfunc.cxx
    	ucb/source/ucp/ftp/ftpinpstr.cxx
    	ucb/source/ucp/ftp/ftpinpstr.hxx
    	ucb/source/ucp/ftp/ftpurl.cxx
    
    Change-Id: I267a9191f9b922380bef8653ac74543662ebf3ef

diff --git a/include/ucbhelper/fd_inputstream.hxx b/include/ucbhelper/fd_inputstream.hxx
index df3d6e3..6246af0 100644
--- a/include/ucbhelper/fd_inputstream.hxx
+++ b/include/ucbhelper/fd_inputstream.hxx
@@ -22,23 +22,26 @@
 
 #include <rtl/ustring.hxx>
 #include <osl/mutex.hxx>
-#include <cppuhelper/weak.hxx>
-#include <cppuhelper/queryinterface.hxx>
+#include <osl/file.h>
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/io/XSeekable.hpp>
-#include <stdio.h>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/basemutex.hxx>
 
 #include "ucbhelper/ucbhelperdllapi.h"
 
 namespace ucbhelper
 {
+    typedef ::cppu::WeakImplHelper2<
+        com::sun::star::io::XInputStream,
+        com::sun::star::io::XSeekable > FdInputStream_Base;
+
     /** Implements a seekable InputStream
      *  working on a buffer.
      */
     class UCBHELPER_DLLPUBLIC FdInputStream
-        : public cppu::OWeakObject,
-          public com::sun::star::io::XInputStream,
-          public com::sun::star::io::XSeekable
+        : protected cppu::BaseMutex,
+          public FdInputStream_Base
     {
     public:
 
@@ -46,16 +49,9 @@ namespace ucbhelper
          *  on which the inputstream acts.
          */
 
-        FdInputStream(FILE* tmpfl = 0);
-
-        ~FdInputStream();
-
-        virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& rType)
-            throw(css::uno::RuntimeException);
+        FdInputStream(oslFileHandle tmpfl = 0);
 
-        virtual void SAL_CALL acquire(void) throw();
-
-        virtual void SAL_CALL release(void) throw();
+        virtual ~FdInputStream();
 
         virtual sal_Int32 SAL_CALL
         readBytes(css::uno::Sequence< sal_Int8 >& aData,
@@ -114,14 +110,9 @@ namespace ucbhelper
             throw(css::io::IOException,
                   css::uno::RuntimeException);
 
-        // additional
-//          void append(const void* pBuffer,size_t size,size_t nmemb);
-
     private:
-
-        osl::Mutex m_aMutex;
-        FILE* m_tmpfl;
-        sal_Int64 m_nLength;
+        oslFileHandle m_tmpfl;
+        sal_uInt64 m_nLength;
     };
 }
 
diff --git a/ucb/source/ucp/ftp/ftpcfunc.cxx b/ucb/source/ucp/ftp/ftpcfunc.cxx
index 1a445ab..93e11b9 100644
--- a/ucb/source/ucp/ftp/ftpcfunc.cxx
+++ b/ucb/source/ucp/ftp/ftpcfunc.cxx
@@ -23,10 +23,8 @@
  **************************************************************************
 
  *************************************************************************/
-#include <string.h>
-
+#include <osl/file.h>
 #include "ftpcontentidentifier.hxx"
-#include <stdio.h>
 
 using namespace ftp;
 using namespace com::sun::star::uno;
@@ -35,11 +33,15 @@ extern "C" {
 
     int file_write(void *buffer,size_t size,size_t nmemb,void *stream)
     {
-        FILE* file =
-            reinterpret_cast<FILE*>(stream);
-        if(!file)
+        oslFileHandle aFile = reinterpret_cast< oslFileHandle >( stream );
+        if( !aFile )
             return 0;
-        return fwrite(buffer,size,nmemb,file);
+
+        sal_uInt64 nWritten = 0;
+        sal_uInt64 nToWrite( size * nmemb );
+        osl_writeFile( aFile, buffer, nToWrite, &nWritten );
+
+        return nWritten != nToWrite ? 0 : nmemb;
     }
 
 }
diff --git a/ucb/source/ucp/ftp/ftpcfunc.hxx b/ucb/source/ucp/ftp/ftpcfunc.hxx
index 27eced5..127d04b 100644
--- a/ucb/source/ucp/ftp/ftpcfunc.hxx
+++ b/ucb/source/ucp/ftp/ftpcfunc.hxx
@@ -46,7 +46,7 @@ extern "C" {
 
     /** callback for curl_easy_perform(),
      *  forwarding the written content to the stream.
-     *  stream has to be of type 'FTPStreamContainer'.
+     *  stream has to be of type oslFileHandle.
      */
 
 
diff --git a/ucb/source/ucp/ftp/ftpurl.cxx b/ucb/source/ucp/ftp/ftpurl.cxx
index ecee9ed..50309e9 100644
--- a/ucb/source/ucp/ftp/ftpurl.cxx
+++ b/ucb/source/ucp/ftp/ftpurl.cxx
@@ -389,7 +389,7 @@ namespace ftp {
                      CURLOPT_URL,                                 \
                      urlParAscii.getStr());
 
-FILE* FTPURL::open()
+oslFileHandle FTPURL::open()
     throw(curl_exception)
 {
     if(m_aPathSegmentVec.empty())
@@ -400,18 +400,22 @@ FILE* FTPURL::open()
     SET_CONTROL_CONTAINER;
     OUString url(ident(false,true));
     SET_URL(url);
-    FILE *res = tmpfile();
-    curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,file_write);
-    curl_easy_setopt(curl,CURLOPT_WRITEDATA,res);
 
-    curl_easy_setopt(curl,CURLOPT_POSTQUOTE,0);
-    CURLcode err = curl_easy_perform(curl);
+    oslFileHandle res( NULL );
+    if ( osl_createTempFile( NULL, &res, NULL ) == osl_File_E_None )
+    {
+        curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,file_write);
+        curl_easy_setopt(curl,CURLOPT_WRITEDATA,res);
 
-    if(err == CURLE_OK)
-        rewind(res);
-    else {
-        fclose(res),res = 0;
-        throw curl_exception(err);
+        curl_easy_setopt(curl,CURLOPT_POSTQUOTE,0);
+        CURLcode err = curl_easy_perform(curl);
+
+        if(err == CURLE_OK)
+            osl_setFilePos( res, osl_Pos_Absolut, 0 );
+        else {
+            osl_closeFile(res),res = 0;
+            throw curl_exception(err);
+        }
     }
 
     return res;
diff --git a/ucb/source/ucp/ftp/ftpurl.hxx b/ucb/source/ucp/ftp/ftpurl.hxx
index 76603d2..7d13b5c 100644
--- a/ucb/source/ucp/ftp/ftpurl.hxx
+++ b/ucb/source/ucp/ftp/ftpurl.hxx
@@ -30,9 +30,9 @@
 #include <curl/easy.h>
 #include <com/sun/star/io/XOutputStream.hpp>
 
-#include <stdio.h>
 #include <rtl/ustring.hxx>
 #include <osl/mutex.hxx>
+#include <osl/file.h>
 #include <vector>
 
 #include "ftpdirp.hxx"
@@ -124,7 +124,7 @@ namespace ftp {
 
         // returns a pointer to an open tempfile,
         // seeked to the beginning of.
-        FILE* open() throw(curl_exception);
+        oslFileHandle open() throw(curl_exception);
 
         FTPDirentry direntry() const throw(curl_exception);
 
diff --git a/ucbhelper/source/provider/fd_inputstream.cxx b/ucbhelper/source/provider/fd_inputstream.cxx
index 835fd38..f70a6e9 100644
--- a/ucbhelper/source/provider/fd_inputstream.cxx
+++ b/ucbhelper/source/provider/fd_inputstream.cxx
@@ -21,7 +21,6 @@
 
 #include <rtl/alloc.h>
 #include <algorithm>
-#include <stdio.h>
 
 using namespace com::sun::star::uno;
 using namespace com::sun::star::lang;
@@ -29,48 +28,29 @@ using namespace com::sun::star::io;
 
 namespace ucbhelper
 {
-    FdInputStream::FdInputStream(FILE* tmpfl)
-        : m_tmpfl(tmpfl ? tmpfl : tmpfile())
+    FdInputStream:::FdInputStream:( oslFileHandle tmpfl )
+        : m_tmpfl(tmpfl)
+        , m_nLength( 0 )
     {
-        fseek(m_tmpfl,0,SEEK_END);
-        long pos = ftell(m_tmpfl);
-        rewind(m_tmpfl);
-        m_nLength = sal_Int64(pos);
+        if ( !m_tmpfl )
+            osl_createTempFile( NULL, &m_tmpfl, NULL );
+        OSL_ENSURE( m_tmpfl, "input stream without tempfile!" );
+
+        if ( osl_setFilePos( m_tmpfl, osl_Pos_End, 0 ) == osl_File_E_None )
+        {
+            sal_uInt64 nFileSize = 0;
+            if ( osl_getFilePos( m_tmpfl, &nFileSize ) == osl_File_E_None )
+                m_nLength = nFileSize;
+            osl_setFilePos( m_tmpfl, osl_Pos_Absolut, 0 );
+        }
     }
 
-
-
     FdInputStream::~FdInputStream()
     {
         if ( 0 != m_tmpfl)
-            fclose(m_tmpfl);
+            osl_closeFile(m_tmpfl);
     }
 
-
-    Any SAL_CALL FdInputStream::queryInterface(
-        const Type& rType
-    )
-        throw(
-            RuntimeException
-        )
-    {
-        Any aRet = ::cppu::queryInterface(rType,
-                                          (static_cast< XInputStream* >(this)),
-                                          (static_cast< XSeekable* >(this)) );
-
-        return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
-    }
-
-
-    void SAL_CALL FdInputStream::acquire( void ) throw() {
-        OWeakObject::acquire();
-    }
-
-    void SAL_CALL FdInputStream::release( void ) throw() {
-        OWeakObject::release();
-    }
-
-
     sal_Int32 SAL_CALL FdInputStream::readBytes(Sequence< sal_Int8 >& aData,
                                                  sal_Int32 nBytesToRead)
         throw(NotConnectedException,
@@ -80,15 +60,22 @@ namespace ucbhelper
     {
         osl::MutexGuard aGuard(m_aMutex);
 
-        if(0 <= nBytesToRead && aData.getLength() < nBytesToRead)
-            aData.realloc(nBytesToRead);
+        sal_uInt64 nBeforePos( 0 );
+        sal_uInt64 nBytesRequested( nBytesToRead );
+        sal_uInt64 nBytesRead( 0 );
+
+        osl_getFilePos( m_tmpfl, &nBeforePos );
+
+        if ( 0 == ( nBytesRequested = std::min< sal_uInt64 >( m_nLength - nBeforePos, nBytesRequested ) ) )
+            return 0;
+
+        if ( 0 <= nBytesToRead && aData.getLength() < nBytesToRead )
+            aData.realloc( nBytesToRead );
 
-        size_t nWanted = static_cast<size_t>(nBytesToRead);
-        size_t nRead = fread(aData.getArray(), 1, nWanted, m_tmpfl);
-        if (nRead != nWanted && ferror(m_tmpfl))
+        if ( osl_readFile( m_tmpfl, aData.getArray(), nBytesRequested, &nBytesRead ) != osl_File_E_None )
             throw IOException();
 
-        return static_cast<sal_Int32>(nRead);
+        return sal_Int32( nBytesRead );
     }
 
 
@@ -114,7 +101,7 @@ namespace ucbhelper
         if(!m_tmpfl)
             throw IOException();
 
-        fseek(m_tmpfl,long(nBytesToSkip),SEEK_CUR);
+        osl_setFilePos( m_tmpfl, osl_Pos_Current, nBytesToSkip );
     }
 
 
@@ -165,11 +152,9 @@ namespace ucbhelper
         if(!m_tmpfl)
             throw IOException();
 
-    //     fpos_t pos;
-    //     fgetpos(m_tmpfl,&pos);
-        long pos;
-        pos = ftell(m_tmpfl);
-        return sal_Int64(pos);
+        sal_uInt64 nFilePos = 0;
+        osl_getFilePos( m_tmpfl, &nFilePos );
+        return nFilePos;
     }
 
 
commit 39e21050fe9e47b0496b0f4cc9e85f6577f0f6ce
Author: Armin Le Grand <alg at apache.org>
Date:   Mon Jun 3 14:55:13 2013 +0000

    Resolves: #i120994# Corrected Line/FillColor OnOff state handling
    
    (cherry picked from commit 2d1c3f406b3390587bd800d05a07e8349b4582f5)
    
    Change-Id: I3ec3e83354c60c53263b8f823d6a0037dfc9130b

diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index 43094a3..3b03b48 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -1464,6 +1464,13 @@ namespace cppcanvas
                                            rStates.getState().lineColor,
                                            rCanvas );
                         }
+                        else
+                        {
+                            // #120994# Do switch on/off LineColor, even when a overriding one is set
+                            bool bSetting(static_cast<MetaLineColorAction*>(pCurrAct)->IsSetting());
+
+                            getState( rStates ).isLineColorSet = bSetting;
+                        }
                         break;
 
                     case META_FILLCOLOR_ACTION:
@@ -1474,6 +1481,13 @@ namespace cppcanvas
                                            rStates.getState().fillColor,
                                            rCanvas );
                         }
+                        else
+                        {
+                            // #120994# Do switch on/off FillColor, even when a overriding one is set
+                            bool bSetting(static_cast<MetaFillColorAction*>(pCurrAct)->IsSetting());
+
+                            getState( rStates ).isFillColorSet = bSetting;
+                        }
                         break;
 
                     case META_TEXTCOLOR_ACTION:


More information about the Libreoffice-commits mailing list