LCOV - code coverage report
Current view: top level - include/vcl - cmdevt.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 98 0.0 %
Date: 2014-04-11 Functions: 0 44 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_VCL_CMDEVT_HXX
      21             : #define INCLUDED_VCL_CMDEVT_HXX
      22             : 
      23             : #include <tools/gen.hxx>
      24             : #include <tools/solar.h>
      25             : #include <vcl/dllapi.h>
      26             : #include <vcl/keycod.hxx>
      27             : #include <vcl/font.hxx>
      28             : 
      29             : 
      30             : // - CommandExtTextInputData -
      31             : 
      32             : 
      33             : #define EXTTEXTINPUT_ATTR_GRAYWAVELINE          ((sal_uInt16)0x0100)
      34             : #define EXTTEXTINPUT_ATTR_UNDERLINE             ((sal_uInt16)0x0200)
      35             : #define EXTTEXTINPUT_ATTR_BOLDUNDERLINE         ((sal_uInt16)0x0400)
      36             : #define EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE       ((sal_uInt16)0x0800)
      37             : #define EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE      ((sal_uInt16)0x1000)
      38             : #define EXTTEXTINPUT_ATTR_HIGHLIGHT             ((sal_uInt16)0x2000)
      39             : #define EXTTEXTINPUT_ATTR_REDTEXT               ((sal_uInt16)0x4000)
      40             : #define EXTTEXTINPUT_ATTR_HALFTONETEXT          ((sal_uInt16)0x8000)
      41             : 
      42             : #define EXTTEXTINPUT_CURSOR_INVISIBLE           ((sal_uInt16)0x0001)
      43             : #define EXTTEXTINPUT_CURSOR_OVERWRITE           ((sal_uInt16)0x0002)
      44             : 
      45             : class VCL_DLLPUBLIC CommandExtTextInputData
      46             : {
      47             : private:
      48             :     OUString            maText;
      49             :     sal_uInt16*         mpTextAttr;
      50             :     sal_Int32           mnCursorPos;
      51             :     sal_uInt16          mnCursorFlags;
      52             :     bool                mbOnlyCursor;
      53             : 
      54             : public:
      55             :                         CommandExtTextInputData( const OUString& rText,
      56             :                                                  const sal_uInt16* pTextAttr,
      57             :                                                  sal_Int32 nCursorPos,
      58             :                                                  sal_uInt16 nCursorFlags,
      59             :                                                  bool bOnlyCursor );
      60             :                         CommandExtTextInputData( const CommandExtTextInputData& rData );
      61             :                         ~CommandExtTextInputData();
      62             : 
      63           0 :     const OUString&     GetText() const { return maText; }
      64           0 :     const sal_uInt16*   GetTextAttr() const { return mpTextAttr; }
      65             :     sal_uInt16          GetCharTextAttr(sal_Int32 nIndex) const
      66             :     {
      67             :         assert(nIndex >= 0);
      68             :         if (mpTextAttr && nIndex < maText.getLength() && nIndex >=0)
      69             :             return mpTextAttr[nIndex];
      70             :         else
      71             :             return 0;
      72             :     }
      73             : 
      74           0 :     sal_Int32           GetCursorPos() const { return mnCursorPos; }
      75           0 :     bool                IsCursorVisible() const { return (mnCursorFlags & EXTTEXTINPUT_CURSOR_INVISIBLE) == 0; }
      76           0 :     bool                IsCursorOverwrite() const { return (mnCursorFlags & EXTTEXTINPUT_CURSOR_OVERWRITE) != 0; }
      77             :     sal_uInt16          GetCursorFlags() const { return mnCursorFlags; }
      78           0 :     bool                IsOnlyCursorChanged() const { return mbOnlyCursor; }
      79             : };
      80             : 
      81             : 
      82             : // - CommandInputContextData -
      83             : 
      84             : 
      85             : class VCL_DLLPUBLIC CommandInputContextData
      86             : {
      87             : private:
      88             :     LanguageType    meLanguage;
      89             : 
      90             : public:
      91             :                     CommandInputContextData();
      92             :                     CommandInputContextData( LanguageType eLang );
      93             : 
      94             :     LanguageType    GetLanguage() const { return meLanguage; }
      95             : };
      96             : 
      97             : inline CommandInputContextData::CommandInputContextData()
      98             : {
      99             :     meLanguage = LANGUAGE_DONTKNOW;
     100             : }
     101             : 
     102           0 : inline CommandInputContextData::CommandInputContextData( LanguageType eLang )
     103             : {
     104           0 :     meLanguage = eLang;
     105           0 : }
     106             : 
     107             : 
     108             : // - CommandWheelData -
     109             : 
     110             : 
     111             : #define COMMAND_WHEEL_SCROLL            ((sal_uInt16)0x0001)
     112             : #define COMMAND_WHEEL_ZOOM              ((sal_uInt16)0x0002)
     113             : #define COMMAND_WHEEL_ZOOM_SCALE        ((sal_uInt16)0x0003)
     114             : #define COMMAND_WHEEL_DATAZOOM          ((sal_uInt16)0x0004)
     115             : 
     116             : #define COMMAND_WHEEL_PAGESCROLL        ((sal_uLong)0xFFFFFFFF)
     117             : 
     118             : class VCL_DLLPUBLIC CommandWheelData
     119             : {
     120             : private:
     121             :     long            mnDelta;
     122             :     long            mnNotchDelta;
     123             :     sal_uLong           mnLines;
     124             :     sal_uInt16          mnMode;
     125             :     sal_uInt16          mnCode;
     126             :     bool            mbHorz;
     127             :     bool            mbDeltaIsPixel;
     128             : 
     129             : public:
     130             :                     CommandWheelData();
     131             :                     CommandWheelData( long nWheelDelta, long nWheelNotchDelta,
     132             :                                       sal_uLong nScrollLines,
     133             :                                       sal_uInt16 nWheelMode, sal_uInt16 nKeyModifier,
     134             :                                       bool bHorz = false, bool bDeltaIsPixel = false );
     135             : 
     136           0 :     long            GetDelta() const { return mnDelta; }
     137           0 :     long            GetNotchDelta() const { return mnNotchDelta; }
     138           0 :     sal_uLong           GetScrollLines() const { return mnLines; }
     139           0 :     bool            IsHorz() const { return mbHorz; }
     140           0 :     bool            IsDeltaPixel() const { return mbDeltaIsPixel; }
     141             : 
     142           0 :     sal_uInt16          GetMode() const { return mnMode; }
     143             : 
     144           0 :     sal_uInt16          GetModifier() const
     145           0 :                         { return (mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)); }
     146           0 :     bool            IsShift() const
     147           0 :                         { return ((mnCode & KEY_SHIFT) != 0); }
     148           0 :     bool            IsMod1() const
     149           0 :                         { return ((mnCode & KEY_MOD1) != 0); }
     150           0 :     bool            IsMod2() const
     151           0 :                         { return ((mnCode & KEY_MOD2) != 0); }
     152             :     bool            IsMod3() const
     153             :                         { return ((mnCode & KEY_MOD3) != 0); }
     154             : };
     155             : 
     156             : inline CommandWheelData::CommandWheelData()
     157             : {
     158             :     mnDelta         = 0;
     159             :     mnNotchDelta    = 0;
     160             :     mnLines         = 0;
     161             :     mnMode          = 0;
     162             :     mnCode          = 0;
     163             :     mbHorz          = false;
     164             :     mbDeltaIsPixel  = false;
     165             : }
     166             : 
     167           0 : inline CommandWheelData::CommandWheelData( long nWheelDelta, long nWheelNotchDelta,
     168             :                                            sal_uLong nScrollLines,
     169             :                                            sal_uInt16 nWheelMode, sal_uInt16 nKeyModifier,
     170             :                                            bool bHorz, bool bDeltaIsPixel )
     171             : {
     172           0 :     mnDelta         = nWheelDelta;
     173           0 :     mnNotchDelta    = nWheelNotchDelta;
     174           0 :     mnLines         = nScrollLines;
     175           0 :     mnMode          = nWheelMode;
     176           0 :     mnCode          = nKeyModifier;
     177           0 :     mbHorz          = bHorz;
     178           0 :     mbDeltaIsPixel  = bDeltaIsPixel;
     179           0 : }
     180             : 
     181             : 
     182             : // - CommandScrollData -
     183             : 
     184             : 
     185             : class VCL_DLLPUBLIC CommandScrollData
     186             : {
     187             : private:
     188             :     long            mnDeltaX;
     189             :     long            mnDeltaY;
     190             : 
     191             : public:
     192             :                     CommandScrollData();
     193             :                     CommandScrollData( long nDeltaX, long nDeltaY );
     194             : 
     195           0 :     long            GetDeltaX() const { return mnDeltaX; }
     196           0 :     long            GetDeltaY() const { return mnDeltaY; }
     197             : };
     198             : 
     199           0 : inline CommandScrollData::CommandScrollData()
     200             : {
     201           0 :     mnDeltaX    = 0;
     202           0 :     mnDeltaY    = 0;
     203           0 : }
     204             : 
     205           0 : inline CommandScrollData::CommandScrollData( long nDeltaX, long nDeltaY )
     206             : {
     207           0 :     mnDeltaX    = nDeltaX;
     208           0 :     mnDeltaY    = nDeltaY;
     209           0 : }
     210             : 
     211             : 
     212             : // - CommandModKeyData -
     213             : 
     214             : 
     215             : class VCL_DLLPUBLIC CommandModKeyData
     216             : {
     217             : private:
     218             :     sal_uInt16          mnCode;
     219             : 
     220             : public:
     221             :                     CommandModKeyData();
     222             :                     CommandModKeyData( sal_uInt16 nCode );
     223             : 
     224             :     bool            IsShift()   const { return (mnCode & MODKEY_SHIFT) != 0; }
     225           0 :     bool            IsMod1()    const { return (mnCode & MODKEY_MOD1) != 0; }
     226           0 :     bool            IsMod2()    const { return (mnCode & MODKEY_MOD2) != 0; }
     227             :     bool            IsMod3()    const { return (mnCode & MODKEY_MOD3) != 0; }
     228             : 
     229           0 :     bool            IsLeftShift() const { return (mnCode & MODKEY_LSHIFT) != 0; }
     230             :     bool            IsLeftMod1()  const { return (mnCode & MODKEY_LMOD1) != 0; }
     231             :     bool            IsLeftMod2()  const { return (mnCode & MODKEY_LMOD2) != 0; }
     232             :     bool            IsLeftMod3()  const { return (mnCode & MODKEY_LMOD3) != 0; }
     233             : 
     234           0 :     bool            IsRightShift() const { return (mnCode & MODKEY_RSHIFT) != 0; }
     235             :     bool            IsRightMod1()  const { return (mnCode & MODKEY_RMOD1) != 0; }
     236             :     bool            IsRightMod2()  const { return (mnCode & MODKEY_RMOD2) != 0; }
     237             :     bool            IsRightMod3()  const { return (mnCode & MODKEY_RMOD3) != 0; }
     238             : };
     239             : 
     240             : inline CommandModKeyData::CommandModKeyData()
     241             : {
     242             :     mnCode = 0L;
     243             : }
     244             : 
     245           0 : inline CommandModKeyData::CommandModKeyData( sal_uInt16 nCode )
     246             : {
     247           0 :     mnCode = nCode;
     248           0 : }
     249             : 
     250             : 
     251             : // - CommanDialogData -
     252             : 
     253             : 
     254             : #define SHOWDIALOG_ID_PREFERENCES       1
     255             : #define SHOWDIALOG_ID_ABOUT             2
     256             : 
     257             : class VCL_DLLPUBLIC CommandDialogData
     258             : {
     259             :     int             m_nDialogId;
     260             :     public:
     261           0 :     CommandDialogData( int nDialogId = SHOWDIALOG_ID_PREFERENCES )
     262           0 :     : m_nDialogId( nDialogId )
     263           0 :     {}
     264             : 
     265           0 :     int GetDialogId() const { return m_nDialogId; }
     266             : };
     267             : 
     268             : 
     269             : // Media Commands
     270             : 
     271             : 
     272             : #define MEDIA_COMMAND_CHANNEL_DOWN           ((sal_Int16)1) // Decrement the channel value, for example, for a TV or radio tuner.
     273             : #define MEDIA_COMMAND_CHANNEL_UP             ((sal_Int16)2) // Increment the channel value, for example, for a TV or radio tuner.
     274             : #define MEDIA_COMMAND_NEXTTRACK              ((sal_Int16)3) // Go to next media track/slide.
     275             : #define MEDIA_COMMAND_PAUSE                  ((sal_Int16)4) // Pause. If already paused, take no further action. This is a direct PAUSE command that has no state.
     276             : #define MEDIA_COMMAND_PLAY                   ((sal_Int16)5) // Begin playing at the current position. If already paused, it will resume. This is a direct PLAY command that has no state.
     277             : #define MEDIA_COMMAND_PLAY_PAUSE             ((sal_Int16)6) // Play or pause playback.
     278             : #define MEDIA_COMMAND_PREVIOUSTRACK          ((sal_Int16)7) // Go to previous media track/slide.
     279             : #define MEDIA_COMMAND_RECORD                 ((sal_Int16)8) // Begin recording the current stream.
     280             : #define MEDIA_COMMAND_REWIND                 ((sal_Int16)9)// Go backward in a stream at a higher rate of speed.
     281             : #define MEDIA_COMMAND_STOP                   ((sal_Int16)10)// Stop playback.
     282             : #define MEDIA_COMMAND_MIC_ON_OFF_TOGGLE      ((sal_Int16)11)// Toggle the microphone.
     283             : #define MEDIA_COMMAND_MICROPHONE_VOLUME_DOWN ((sal_Int16)12)// Increase microphone volume.
     284             : #define MEDIA_COMMAND_MICROPHONE_VOLUME_MUTE ((sal_Int16)13)// Mute the microphone.
     285             : #define MEDIA_COMMAND_MICROPHONE_VOLUME_UP   ((sal_Int16)14)// Decrease microphone volume.
     286             : #define MEDIA_COMMAND_VOLUME_DOWN            ((sal_Int16)15)// Lower the volume.
     287             : #define MEDIA_COMMAND_VOLUME_MUTE            ((sal_Int16)16)// Mute the volume.
     288             : #define MEDIA_COMMAND_VOLUME_UP              ((sal_Int16)17)// Raise the volume.
     289             : #define MEDIA_COMMAND_MENU                   ((sal_Int16)18)// Button Menu pressed.
     290             : #define MEDIA_COMMAND_MENU_HOLD              ((sal_Int16)19)// Button Menu (long) pressed.
     291             : #define MEDIA_COMMAND_PLAY_HOLD              ((sal_Int16)20)// Button Play (long) pressed.
     292             : #define MEDIA_COMMAND_NEXTTRACK_HOLD         ((sal_Int16)21)// Button Right holding pressed.
     293             : #define MEDIA_COMMAND_PREVIOUSTRACK_HOLD     ((sal_Int16)22)// Button Left holding pressed.
     294             : 
     295             : 
     296             : 
     297             : // - CommandSelectionChangeData -
     298             : 
     299             : 
     300             : class VCL_DLLPUBLIC CommandSelectionChangeData
     301             : {
     302             : private:
     303             :     sal_uLong          mnStart;
     304             :     sal_uLong          mnEnd;
     305             : 
     306             : public:
     307             :     CommandSelectionChangeData();
     308             :     CommandSelectionChangeData( sal_uLong nStart, sal_uLong nEnd );
     309             : 
     310           0 :     sal_uLong          GetStart() const { return mnStart; }
     311           0 :     sal_uLong          GetEnd() const { return mnEnd; }
     312             : };
     313             : 
     314             : inline CommandSelectionChangeData::CommandSelectionChangeData()
     315             : {
     316             :     mnStart = mnEnd = 0;
     317             : }
     318             : 
     319           0 : inline CommandSelectionChangeData::CommandSelectionChangeData( sal_uLong nStart,
     320             :                                    sal_uLong nEnd )
     321             : {
     322           0 :     mnStart = nStart;
     323           0 :     mnEnd = nEnd;
     324           0 : }
     325             : 
     326             : 
     327             : // - CommandEvent -
     328             : 
     329             : 
     330             : #define COMMAND_CONTEXTMENU             ((sal_uInt16)1)
     331             : #define COMMAND_STARTDRAG               ((sal_uInt16)2)
     332             : #define COMMAND_WHEEL                   ((sal_uInt16)3)
     333             : #define COMMAND_STARTAUTOSCROLL         ((sal_uInt16)4)
     334             : #define COMMAND_AUTOSCROLL              ((sal_uInt16)5)
     335             : #define COMMAND_STARTEXTTEXTINPUT       ((sal_uInt16)7)
     336             : #define COMMAND_EXTTEXTINPUT            ((sal_uInt16)8)
     337             : #define COMMAND_ENDEXTTEXTINPUT         ((sal_uInt16)9)
     338             : #define COMMAND_INPUTCONTEXTCHANGE      ((sal_uInt16)10)
     339             : #define COMMAND_CURSORPOS               ((sal_uInt16)11)
     340             : #define COMMAND_PASTESELECTION          ((sal_uInt16)12)
     341             : #define COMMAND_MODKEYCHANGE            ((sal_uInt16)13)
     342             : #define COMMAND_HANGUL_HANJA_CONVERSION ((sal_uInt16)14)
     343             : #define COMMAND_INPUTLANGUAGECHANGE     ((sal_uInt16)15)
     344             : #define COMMAND_SHOWDIALOG              ((sal_uInt16)16)
     345             : #define COMMAND_MEDIA                   ((sal_uInt16)17)
     346             : #define COMMAND_SELECTIONCHANGE         ((sal_uInt16)18)
     347             : #define COMMAND_PREPARERECONVERSION     ((sal_uInt16)19)
     348             : #define COMMAND_QUERYCHARPOSITION       ((sal_uInt16)20)
     349             : 
     350             : 
     351             : class VCL_DLLPUBLIC CommandEvent
     352             : {
     353             : private:
     354             :     Point                               maPos;
     355             :     void*                               mpData;
     356             :     sal_uInt16                              mnCommand;
     357             :     bool                                mbMouseEvent;
     358             : 
     359             : public:
     360             :                                         CommandEvent();
     361             :                                         CommandEvent( const Point& rMousePos, sal_uInt16 nCmd,
     362             :                                                       bool bMEvt = false, const void* pCmdData = NULL );
     363             : 
     364           0 :     sal_uInt16                              GetCommand() const { return mnCommand; }
     365           0 :     const Point&                        GetMousePosPixel() const { return maPos; }
     366           0 :     bool                                IsMouseEvent() const { return mbMouseEvent; }
     367           0 :     void*                               GetData() const { return mpData; }
     368             : 
     369             :     const CommandExtTextInputData*      GetExtTextInputData() const;
     370             :     const CommandInputContextData*      GetInputContextChangeData() const;
     371             :     const CommandWheelData*             GetWheelData() const;
     372             :     const CommandScrollData*            GetAutoScrollData() const;
     373             :     const CommandModKeyData*            GetModKeyData() const;
     374             :     const CommandDialogData*            GetDialogData() const;
     375             :     sal_Int16                           GetMediaCommand() const;
     376             :     const CommandSelectionChangeData*   GetSelectionChangeData() const;
     377             : };
     378             : 
     379           0 : inline CommandEvent::CommandEvent()
     380             : {
     381           0 :     mpData          = NULL;
     382           0 :     mnCommand       = 0;
     383           0 :     mbMouseEvent    = false;
     384           0 : }
     385             : 
     386           0 : inline CommandEvent::CommandEvent( const Point& rMousePos,
     387             :                                    sal_uInt16 nCmd, bool bMEvt, const void* pCmdData ) :
     388           0 :             maPos( rMousePos )
     389             : {
     390           0 :     mpData          = (void*)pCmdData;
     391           0 :     mnCommand       = nCmd;
     392           0 :     mbMouseEvent    = bMEvt;
     393           0 : }
     394             : 
     395           0 : inline const CommandExtTextInputData* CommandEvent::GetExtTextInputData() const
     396             : {
     397           0 :     if ( mnCommand == COMMAND_EXTTEXTINPUT )
     398           0 :         return (const CommandExtTextInputData*)mpData;
     399             :     else
     400           0 :         return NULL;
     401             : }
     402             : 
     403             : inline const CommandInputContextData* CommandEvent::GetInputContextChangeData() const
     404             : {
     405             :     if ( mnCommand == COMMAND_INPUTCONTEXTCHANGE )
     406             :         return (const CommandInputContextData*)mpData;
     407             :     else
     408             :         return NULL;
     409             : }
     410             : 
     411           0 : inline const CommandWheelData* CommandEvent::GetWheelData() const
     412             : {
     413           0 :     if ( mnCommand == COMMAND_WHEEL )
     414           0 :         return (const CommandWheelData*)mpData;
     415             :     else
     416           0 :         return NULL;
     417             : }
     418             : 
     419           0 : inline const CommandScrollData* CommandEvent::GetAutoScrollData() const
     420             : {
     421           0 :     if ( mnCommand == COMMAND_AUTOSCROLL )
     422           0 :         return (const CommandScrollData*)mpData;
     423             :     else
     424           0 :         return NULL;
     425             : }
     426             : 
     427             : inline const CommandModKeyData* CommandEvent::GetModKeyData() const
     428             : {
     429             :     if( mnCommand == COMMAND_MODKEYCHANGE )
     430             :         return (const CommandModKeyData*)mpData;
     431             :     else
     432             :         return NULL;
     433             : }
     434             : 
     435           0 : inline const CommandDialogData* CommandEvent::GetDialogData() const
     436             : {
     437           0 :     if( mnCommand == COMMAND_SHOWDIALOG )
     438           0 :         return (const CommandDialogData*)mpData;
     439             :     else
     440           0 :         return NULL;
     441             : }
     442             : 
     443           0 : inline sal_Int16 CommandEvent::GetMediaCommand() const
     444             : {
     445           0 :     if( mnCommand == COMMAND_MEDIA )
     446           0 :         return *(const sal_Int16*)(mpData);
     447             :     else
     448           0 :         return 0;
     449             : }
     450             : 
     451           0 : inline const CommandSelectionChangeData* CommandEvent::GetSelectionChangeData() const
     452             : {
     453           0 :     if( mnCommand == COMMAND_SELECTIONCHANGE )
     454           0 :     return (const CommandSelectionChangeData*)mpData;
     455             :     else
     456           0 :     return NULL;
     457             : }
     458             : 
     459             : 
     460             : #endif // INCLUDED_VCL_CMDEVT_HXX
     461             : 
     462             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10