Commits

Anonymous committed a899c5d Merge

CWS-TOOLING: integrate CWS oooimprovement6

  • Participants
  • Parent commits 53b74c2, 0f8853e

Comments (0)

Files changed (4)

File comphelper/source/misc/uieventslogger.cxx

             static const OUString FN_ROTATEDLOG;
             static const OUString LOGROTATE_EVENTNAME;
             static const OUString URL_UNO;
+            static const OUString URL_SPECIAL;
             static const OUString URL_FILE;
     };
 }
     const OUString UiEventsLogger_Impl::LOGROTATE_EVENTNAME = OUString::createFromAscii("onOOoImprovementLogRotated");
 
     const OUString UiEventsLogger_Impl::URL_UNO = OUString::createFromAscii(".uno:");
+    const OUString UiEventsLogger_Impl::URL_SPECIAL = OUString::createFromAscii(".special:");
     const OUString UiEventsLogger_Impl::URL_FILE = OUString::createFromAscii("file:");
 
 
         const Sequence<PropertyValue>& args)
     {
         if(!m_Active) return;
-        if(!url.Complete.match(URL_UNO) && !url.Complete.match(URL_FILE)) return;
+        if(!url.Complete.match(URL_UNO)
+            && !url.Complete.match(URL_FILE)
+            && !url.Complete.match(URL_SPECIAL))
+        {
+            return;
+        }
         checkIdleTimeout();
 
         Sequence<OUString> logdata = Sequence<OUString>(COLUMNS);

File cui/source/options/optimprove2.cxx

 #include <comphelper/synchronousdispatch.hxx>
 #include <comphelper/uieventslogger.hxx>
 #include <tools/testtoolloader.hxx>
+#include <osl/file.hxx>
 
 #define C2S(s)  ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
 
 namespace util  = ::com::sun::star::util;
 using namespace com::sun::star::system;
 
+
+namespace
+{
+    bool lcl_doesLogfileExist(const ::rtl::OUString& sLogPath)
+    {
+        ::rtl::OUString sLogFile( sLogPath );
+        sLogFile += C2S("/Current.csv");
+        ::osl::File aLogFile(sLogFile);
+        return aLogFile.open(osl_File_OpenFlag_Read) == ::osl::FileBase::E_None;
+    }
+}
+
 // class SvxImprovementOptionsPage ---------------------------------------
 
 SvxImprovementOptionsPage::SvxImprovementOptionsPage( Window* pParent, const SfxItemSet& rSet ) :
         uno::Reference< lang::XComponent > xDoc = ::comphelper::SynchronousDispatch::dispatch(
             xDesktop, sLogFile, C2S("_default"), 0, aArgs );
         if ( xDoc.is() )
+        {
+            dynamic_cast<Dialog*>(GetParent())->EndDialog( RET_CANCEL );
             return 1;
+        }
     }
 
     return 0;
                 if ( xSubst.is() )
                     sPath = xSubst->substituteVariables( sPath, sal_False );
                 m_sLogPath = sPath;
+                m_aShowDataPB.Enable(lcl_doesLogfileExist(m_sLogPath));
             }
         }
     }
     catch( uno::Exception& )
     {
+        m_aShowDataPB.Enable(false);
     }
 }
 

File extensions/source/oooimprovement/onlogrotate_job.cxx

 #include "soapsender.hxx"
 
 #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/XTerminateListener.hpp>
 #include <osl/mutex.hxx>
 #include <osl/thread.hxx>
 #include <osl/time.h>
+#include <cppuhelper/implbase1.hxx>
+#include <memory>
 
 
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::task;
 using namespace ::com::sun::star::uno;
+using ::com::sun::star::frame::XTerminateListener;
+using ::com::sun::star::frame::XDesktop;
 using ::com::sun::star::ucb::XSimpleFileAccess;
 using ::rtl::OUString;
 using ::std::vector;
         public:
             OnLogRotateThread(Reference<XMultiServiceFactory> sf);
             virtual void SAL_CALL run();
-            void disposing();
+            OnLogRotateThread* disposing();
+
         private:
             Reference<XMultiServiceFactory> m_ServiceFactory;
             ::osl::Mutex m_ServiceFactoryMutex;
         }
     }
 
-    void OnLogRotateThread::disposing()
+    OnLogRotateThread* OnLogRotateThread::disposing()
     {
         ::osl::Guard< ::osl::Mutex> service_factory_guard(m_ServiceFactoryMutex);
         m_ServiceFactory.clear();
+        return this;
     }
+
+    class OnLogRotateThreadWatcher : public ::cppu::WeakImplHelper1<XTerminateListener>
+    {
+        public:
+            OnLogRotateThreadWatcher(Reference<XMultiServiceFactory> sf)
+                : m_Thread(new OnLogRotateThread(sf))
+            {
+                m_Thread->create();
+            }
+            virtual ~OnLogRotateThreadWatcher()
+                { m_Thread->disposing()->terminate(); };
+
+            // XTerminateListener
+            virtual void SAL_CALL queryTermination(const EventObject&) throw(RuntimeException)
+                { };
+            virtual void SAL_CALL notifyTermination(const EventObject&) throw(RuntimeException)
+                { m_Thread->disposing()->terminate(); };
+            // XEventListener
+            virtual void SAL_CALL disposing(const EventObject&) throw(RuntimeException)
+                { m_Thread->disposing()->terminate(); };
+        private:
+            ::std::auto_ptr<OnLogRotateThread> m_Thread;
+    };
 }
 
 namespace oooimprovement
         const Reference<XJobListener>& listener)
         throw(RuntimeException)
     {
-        OnLogRotateThread* thread = new OnLogRotateThread(m_ServiceFactory);
-        thread->create();
-
+        Reference<XDesktop> xDesktop(
+            m_ServiceFactory->createInstance(OUString::createFromAscii("com.sun.star.frame.Desktop")),
+            UNO_QUERY);
+        if(xDesktop.is())
+            xDesktop->addTerminateListener(Reference<XTerminateListener>(new OnLogRotateThreadWatcher(m_ServiceFactory)));
         Any result;
         listener->jobFinished(Reference<XAsyncJob>(this), result);
     }

File svx/source/dialog/svxruler.cxx

 #define RULER_TAB_RTL           ((USHORT)0x0010)
 #endif
 
+#include <comphelper/uieventslogger.hxx>
+
+namespace
+{
+    void lcl_logRulerUse(const ::rtl::OUString& sURL) //#i99729#
+    {
+        using namespace ::com::sun::star;
+        util::URL aTargetURL;
+        aTargetURL.Complete = sURL;
+        aTargetURL.Main = sURL;
+        if(::comphelper::UiEventsLogger::isEnabled()) //#i88653#
+        {
+            ::rtl::OUString sAppName;
+            uno::Sequence<beans::PropertyValue> source;
+            ::comphelper::UiEventsLogger::appendDispatchOrigin(source, sAppName, ::rtl::OUString::createFromAscii("SfxRuler"));
+            ::comphelper::UiEventsLogger::logDispatch(aTargetURL, source);
+        }
+    }
+}
+
+
+
 // STATIC DATA -----------------------------------------------------------
 
 #define CTRL_ITEM_COUNT 14
 */
 
 {
+    lcl_logRulerUse(::rtl::OUString::createFromAscii(".special://SfxRuler/Click"));
 	Ruler::Click();
 	if( bActive )
 	{
 */
 
 {
+    lcl_logRulerUse(::rtl::OUString::createFromAscii(".special://SfxRuler/StartDrag"));
 	BOOL bContentProtected = pRuler_Imp->aProtectItem.IsCntntProtected();
 	if(!bValid)
 		return FALSE;
 
 */
 {
+    lcl_logRulerUse(::rtl::OUString::createFromAscii(".special://SfxRuler/EndDrag"));
 	const BOOL bUndo = IsDragCanceled();
 	const long lPos = GetDragPos();
 	DrawLine_Impl(lTabPos, 6, bHorz);