1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #include <tools/string.hxx> 25 #include <tools/link.hxx> 26 #include <vcl/timer.hxx> 27 28 class ToolBox; 29 class Window; 30 class VclSimpleEvent; 31 32 class MacroRecorder 33 { 34 private: 35 Window* GetParentWithID( Window* pThis ); 36 rtl::OString GetParentID( Window* pThis ); 37 38 Link aEventListenerHdl; 39 DECL_LINK( EventListener, VclSimpleEvent* ); 40 41 Window* pLastWin; 42 Window* pEditModify; 43 String aEditModifyString; 44 45 ToolBox *pActionParent; // toolbox from which a tearoff or OpenMenu might happen 46 47 // record keys 48 String aKeyString; 49 rtl::OString aKeyUniqueID; // has to be remembered seperately since Window might be gone when needed 50 Window* pKeyWin; 51 sal_Bool bKeyFollowFocus; 52 53 AutoTimer aHookRefresh; 54 void AddEventHooks(); 55 void RemoveEventHooks(); 56 DECL_LINK( HookRefreshHdl, void* ); 57 58 void LogVCL( rtl::OString aParentID, sal_uInt16 nVCLWindowType, rtl::OString aID, String aMethod, sal_uInt16 aParam ); 59 void LogVCL( rtl::OString aParentID, sal_uInt16 nVCLWindowType, rtl::OString aID, String aMethod ); 60 61 static MacroRecorder *pMacroRecorder; 62 63 MacroRecorder(); 64 ~MacroRecorder(); 65 void CheckDelete(); 66 67 // Actions to perform 68 sal_Bool m_bRecord; 69 sal_Bool m_bLog; 70 71 public: 72 SetActionRecord(sal_Bool bRecord=sal_True)73 void SetActionRecord( sal_Bool bRecord = sal_True ) { m_bRecord = bRecord; CheckDelete(); }; SetActionLog(sal_Bool bLog=sal_True)74 void SetActionLog( sal_Bool bLog = sal_True ) { m_bLog = bLog; CheckDelete(); }; 75 76 static MacroRecorder* GetMacroRecorder(); 77 static sal_Bool HasMacroRecorder(); 78 }; 79 80