LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/sfx2 - msg.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 6 0.0 %
Date: 2012-12-27 Functions: 0 4 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             : #ifndef _SFXMSG_HXX
      20             : #define _SFXMSG_HXX
      21             : 
      22             : #include <tools/rtti.hxx>
      23             : #include <sfx2/shell.hxx>
      24             : #include <rtl/string.hxx>
      25             : #include <rtl/ustring.hxx>
      26             : #include <sfx2/dllapi.h>
      27             : 
      28             : //--------------------------------------------------------------------
      29             : 
      30             : #define SFX_SLOT_CACHABLE      0x0001L // exclusiv to VOLATILE, default
      31             : #define SFX_SLOT_VOLATILE      0x0002L // per Timer every 2s get new,
      32             :                                        // exclusiv to CACHABLE
      33             : #define SFX_SLOT_TOGGLE        0x0004L // inverted for Execute old value
      34             : #define SFX_SLOT_AUTOUPDATE    0x0008L // invalidated the status automatically
      35             :                                        // after execute
      36             : 
      37             : #define SFX_SLOT_SYNCHRON      0x0010L // exclusiv to ASYNCHRON, default
      38             : #define SFX_SLOT_ASYNCHRON     0x0020L // via Post-Message, exclusiv
      39             :                                        // to SYNCHRON
      40             : 
      41             : #define SFX_SLOT_HASCOREID     0x0040L // Slot-ID/Which-ID execute mapping
      42             : #define SFX_SLOT_HASDIALOG     0x0080L // Coordinates for dialogue after recofig
      43             : 
      44             : #define SFX_SLOT_NORECORD      0x0100L // no recording
      45             : #define SFX_SLOT_RECORDPERITEM 0x0200L // each item, one statement
      46             : #define SFX_SLOT_RECORDPERSET  0x0400L // The whole Set is a Statement, default
      47             : #define SFX_SLOT_RECORDMANUAL  0x0800L // Recording by the application
      48             :                                        // developer is default
      49             : 
      50             : #define SFX_SLOT_RECORDABSOLUTE 0x1000000L // Recording with absolute Target
      51             : #define SFX_SLOT_STANDARD       ( SFX_SLOT_CACHABLE | \
      52             :                                   SFX_SLOT_SYNCHRON | \
      53             :                                   SFX_SLOT_RECORDPERSET )
      54             : 
      55             : #define SFX_SLOT_PROPGET       0x1000L  // get property
      56             : #define SFX_SLOT_PROPSET       0x2000L  // set property, exclusiv to
      57             :                                         // SFX_SLOT_METHOD
      58             : #define SFX_SLOT_METHOD        0x4000L  // Method, exclusiv to SFX_SLOT_PROPSET
      59             : 
      60             : #define SFX_SLOT_FASTCALL      0x8000L  // No test if disabled before Execute
      61             : 
      62             : #define SFX_SLOT_STATUSBARCONFIG 0x10000L  // configurable status row
      63             : #define SFX_SLOT_MENUCONFIG      0x20000L  // configurable Menu
      64             : #define SFX_SLOT_TOOLBOXCONFIG   0x40000L  // configurable Toolboxen
      65             : #define SFX_SLOT_ACCELCONFIG     0x80000L  // configurable keys
      66             : 
      67             : #define SFX_SLOT_CONTAINER      0x100000L  // Operated by the container at
      68             :                                            // InPlace
      69             : #define SFX_SLOT_READONLYDOC    0x200000L  // also available for
      70             :                                            // read-only Documents
      71             : #define SFX_SLOT_IMAGEROTATION  0x400000L  // Rotate image on Vertical/
      72             :                                            // Bi-directional writing
      73             : #define SFX_SLOT_IMAGEREFLECTION  0x800000L // Mirror image on Vertical/
      74             :                                            // Bi-directional writing
      75             : 
      76             : //--------------------------------------------------------------------
      77             : 
      78             : class SfxRequest;
      79             : class SfxItemSet;
      80             : 
      81             : #define SFX_EXEC_STUB( aShellClass, aExecMethod) \
      82             :  void SfxStub##aShellClass##aExecMethod( \
      83             :    SfxShell *pShell, SfxRequest& rReq) \
      84             :   { \
      85             :     (( aShellClass* ) pShell )->aExecMethod( rReq ); \
      86             :   }
      87             : 
      88             : #define SFX_STATE_STUB( aShellClass, aStateMethod) \
      89             :  void  SfxStub##aShellClass##aStateMethod( \
      90             :    SfxShell *pShell, SfxItemSet& rSet) \
      91             :   { \
      92             :     (( aShellClass* ) pShell )->aStateMethod( rSet ); \
      93             :   }
      94             : 
      95             : #define SFX_STUB_PTR( aShellClass, aMethod ) \
      96             :    &SfxStub##aShellClass##aMethod
      97             : 
      98             : #define SFX_STUB_PTR_EXEC_NONE &SfxShell::EmptyExecStub
      99             : 
     100             : #define SFX_STUB_PTR_STATE_NONE &SfxShell::EmptyStateStub
     101             : 
     102             : //--------------------------------------------------------------------
     103             : 
     104             : enum SfxSlotKind
     105             : {
     106             :     SFX_KIND_STANDARD,
     107             :     SFX_KIND_ENUM,
     108             :     SFX_KIND_ATTR
     109             : };
     110             : 
     111             : //=========================================================================
     112             : 
     113             : struct SfxTypeAttrib
     114             : {
     115             :     sal_uInt16                  nAID;
     116             :     const char* pName;
     117             : };
     118             : 
     119             : struct SfxType
     120             : {
     121             :     TypeId          aTypeId;
     122             :     sal_uInt16          nAttribs;
     123             :     SfxTypeAttrib   aAttrib[16];
     124             : 
     125             :     const TypeId&   Type() const
     126             :                     { return aTypeId; }
     127             :     SfxPoolItem*    CreateItem() const
     128             :                     { return (SfxPoolItem*) aTypeId(); }
     129             : };
     130             : 
     131             : struct SfxType0
     132             : {
     133             :     TypeId          aTypeId;
     134             :     sal_uInt16          nAttribs;
     135             : 
     136             :     const TypeId&   Type() const
     137             :                     { return aTypeId; }
     138             :     SfxPoolItem*    CreateItem() const
     139             :                     { return (SfxPoolItem*) aTypeId(); }
     140             : };
     141             : 
     142             : #define SFX_DECL_TYPE(n)    struct SfxType##n                   \
     143             :                             {                                   \
     144             :                                 TypeId          aTypeId;        \
     145             :                                 sal_uInt16          nAttribs;       \
     146             :                                 SfxTypeAttrib   aAttrib[n];     \
     147             :                             }
     148             : 
     149             : #define SFX_TYPE(Class) &a##Class##_Impl
     150             : 
     151             : SFX_DECL_TYPE(1);
     152             : SFX_DECL_TYPE(2);
     153             : SFX_DECL_TYPE(3);
     154             : SFX_DECL_TYPE(4);
     155             : SFX_DECL_TYPE(5);
     156             : SFX_DECL_TYPE(6);
     157             : SFX_DECL_TYPE(7);
     158             : SFX_DECL_TYPE(8);
     159             : SFX_DECL_TYPE(10); // for SfxDocInfoItem
     160             : SFX_DECL_TYPE(11);
     161             : 
     162             : SFX_DECL_TYPE(13); // for SwAddPrinterItem, Sd...
     163             : SFX_DECL_TYPE(14);
     164             : SFX_DECL_TYPE(16); // for SwDocDisplayItem
     165             : SFX_DECL_TYPE(17); // for SvxAddressItem
     166             : SFX_DECL_TYPE(18); // for SvxSearchItem
     167             : 
     168             : // all SfxTypes must be in this header
     169             : #undef SFX_DECL_TYPE
     170             : 
     171             : #define SFX_SLOT_ARG( aShellClass, id, GroupId, ExecMethodPtr, StateMethodPtr, Flags, ItemClass, nArg0, nArgs, Name, Prop ) \
     172             :                { id, GroupId, id, Flags | Prop, \
     173             :                  USHRT_MAX, 0, \
     174             :                  ExecMethodPtr, \
     175             :                  StateMethodPtr, \
     176             :                  (const SfxType*) &a##ItemClass##_Impl, \
     177             :                  Name, Name, 0, 0, \
     178             :                  &a##aShellClass##Args_Impl[nArg0], nArgs, 0, Name \
     179             :                }
     180             : 
     181             : #define SFX_SLOT( aShellClass, id, GroupId, ExecMethodPtr, StateMethodPtr, Flags, ItemClass ) \
     182             :                { id, GroupId, id, Flags, \
     183             :                  0, 0, \
     184             :                  ExecMethodPtr, \
     185             :                  StateMethodPtr, \
     186             :                  (const SfxType*) &a##ItemClass##_Impl, \
     187             :                  0, 0, 0, 0, 0, 0, 0 \
     188             :                }
     189             : 
     190             : #define SFX_NEW_SLOT_ARG( aShellClass, id, hid, GroupId, pLinked, pNext, ExecMethodPtr, StateMethodPtr, Flags, DisableFlags, ItemClass, nArg0, nArgs, Name, Prop, UnoName ) \
     191             :                { id, GroupId, hid, Flags | Prop, \
     192             :                  USHRT_MAX, 0, \
     193             :                  ExecMethodPtr, \
     194             :                  StateMethodPtr, \
     195             :                  (const SfxType*) &a##ItemClass##_Impl, \
     196             :                  Name, Name, \
     197             :                  pLinked, pNext, \
     198             :                  &a##aShellClass##Args_Impl[nArg0], nArgs, DisableFlags, UnoName \
     199             :                }
     200             : 
     201             : #define SFX_NEW_SLOT_ENUM( SlaveId, hid, GroupId, pMaster, pNext, MasterId, Value, Flags, DisableFlags, UnoName  ) \
     202             :                { SlaveId, GroupId, hid, Flags,   \
     203             :                  MasterId,  Value, \
     204             :                  0, \
     205             :                  0, \
     206             :                  (const SfxType*) &aSfxBoolItem_Impl, \
     207             :                  0, 0, \
     208             :                  pMaster, \
     209             :                  pNext, \
     210             :                  0, 0, DisableFlags, UnoName \
     211             :                }
     212             : 
     213             : #define SFX_ARGUMENT( ArgSlotId, ArgName, ArgTypeId ) \
     214             :             { (const SfxType*) &a##ArgTypeId##_Impl, ArgName, ArgSlotId }
     215             : 
     216             : //--------------------------------------------------------------------
     217             : 
     218             : class SfxPoolItem;
     219             : 
     220             : struct SfxFormalArgument
     221             : {
     222             :     const SfxType*  pType;    // Type of the parameter (SfxPoolItem subclass)
     223             :     const char*     pName;    // Name of the sParameters
     224             :     sal_uInt16      nSlotId;  // Slot-Id for identification of the Parameters
     225             : 
     226             :     const TypeId&           Type() const
     227             :                             { return pType->aTypeId; }
     228             :     SfxPoolItem*            CreateItem() const
     229             :                             { return (SfxPoolItem*) pType->aTypeId(); }
     230             : };
     231             : 
     232             : //--------------------------------------------------------------------
     233             : 
     234             : class SfxSlot
     235             : {
     236             : public:
     237             :     sal_uInt16    nSlotId;   // Unique slot-ID in Shell
     238             :     sal_uInt16    nGroupId;  // for configuration region
     239             :     sal_uIntPtr   nHelpId;   // Usually == nSlotId
     240             :     sal_uIntPtr   nFlags;    // artihmetic ordered Flags
     241             : 
     242             :     sal_uInt16    nMasterSlotId;  // Enum-Slot for example Which-Id
     243             :     sal_uInt16    nValue;         // Value, in case of Enum-Slot
     244             : 
     245             :     SfxExecFunc   fnExec;   // Function to be excecuted
     246             :     SfxStateFunc  fnState;  // Function for Status
     247             : 
     248             :     const SfxType*  pType;        // SfxPoolItem-Type (Status)
     249             :     const char*     pName;        // Name of the Slots
     250             :     const char*     pMethodName;  // Name of the Method if different
     251             : 
     252             :     const SfxSlot*  pLinkedSlot; // Master-Slot for Enum value
     253             :     const SfxSlot*  pNextSlot;   // with the same Status-Method
     254             : 
     255             :     const SfxFormalArgument*  pFirstArgDef;  // first formal Argument-Definition
     256             :     sal_uInt16                nArgDefCount;  // Number of formal Argumentents
     257             :     long                      nDisableFlags; // DisableFlags that need to be
     258             :                                              // present, so that the Slot
     259             :                                              // can be enabled
     260             :     const char*     pUnoName;      // UnoName for the Slots
     261             : 
     262             : public:
     263             : 
     264             :     SfxSlotKind     GetKind() const;
     265             :     sal_uInt16          GetSlotId() const;
     266             :     sal_uIntPtr         GetHelpId() const;
     267             :     sal_uIntPtr         GetMode() const;
     268             :     sal_Bool            IsMode( sal_uIntPtr nMode ) const;
     269             :     sal_uInt16          GetGroupId() const;
     270             :     sal_uInt16          GetMasterSlotId() const { return nMasterSlotId; }
     271             :     sal_uInt16          GetWhich( const SfxItemPool &rPool ) const;
     272             :     sal_uInt16          GetValue() const { return nValue; }
     273           0 :     const SfxType*  GetType() const { return pType; }
     274           0 :     const char*     GetUnoName() const { return pUnoName; }
     275             :     SFX2_DLLPUBLIC rtl::OString    GetCommand() const;
     276             :     SFX2_DLLPUBLIC rtl::OUString    GetCommandString() const;
     277             : 
     278             :     sal_uInt16          GetFormalArgumentCount() const { return nArgDefCount; }
     279             :     const SfxFormalArgument& GetFormalArgument( sal_uInt16 nNo ) const
     280             :                     { return pFirstArgDef[nNo]; }
     281             : 
     282             :     SfxExecFunc     GetExecFnc() const { return fnExec; }
     283             :     SfxStateFunc    GetStateFnc() const { return fnState; }
     284             : 
     285             :     const SfxSlot*  GetLinkedSlot() const { return pLinkedSlot; }
     286             :     const SfxSlot*  GetNextSlot() const { return pNextSlot; }
     287             : };
     288             : 
     289             : //=========================================================================
     290             : 
     291             : // returns the id of the function
     292             : 
     293           0 : inline sal_uInt16 SfxSlot::GetSlotId() const
     294             : {
     295           0 :     return nSlotId;
     296             : }
     297             : //--------------------------------------------------------------------
     298             : // returns the help-id of the slot
     299             : 
     300             : inline sal_uIntPtr SfxSlot::GetHelpId() const
     301             : {
     302             :     return nHelpId;
     303             : }
     304             : 
     305             : //--------------------------------------------------------------------
     306             : 
     307             : // returns  a bitfield with flags
     308             : 
     309             : inline sal_uIntPtr SfxSlot::GetMode() const
     310             : {
     311             :     return nFlags;
     312             : }
     313             : //--------------------------------------------------------------------
     314             : 
     315             : // determines if the specified mode is assigned
     316             : 
     317           0 : inline sal_Bool SfxSlot::IsMode( sal_uIntPtr nMode ) const
     318             : {
     319           0 :     return (nFlags & nMode) != 0;
     320             : }
     321             : //--------------------------------------------------------------------
     322             : 
     323             : // returns the id of the associated group
     324             : 
     325             : inline sal_uInt16 SfxSlot::GetGroupId() const
     326             : {
     327             :     return nGroupId;
     328             : 
     329             : }
     330             : 
     331             : #endif
     332             : 
     333             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10