LCOV - code coverage report
Current view: top level - framework/inc/framework - addonsoptions.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 2 50.0 %
Date: 2012-08-25 Functions: 3 7 42.9 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 3 14 21.4 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #ifndef __FRAMEWORK_CLASSES_ADDONSOPTIONS_HXX_
      29                 :            : #define __FRAMEWORK_CLASSES_ADDONSOPTIONS_HXX_
      30                 :            : 
      31                 :            : #include <sal/types.h>
      32                 :            : #include <osl/mutex.hxx>
      33                 :            : #include <vcl/image.hxx>
      34                 :            : #include <vcl/bitmap.hxx>
      35                 :            : #include <vcl/svapp.hxx>
      36                 :            : #include <com/sun/star/uno/Sequence.h>
      37                 :            : #include <com/sun/star/beans/PropertyValue.hpp>
      38                 :            : #include <framework/fwedllapi.h>
      39                 :            : //_________________________________________________________________________________________________________________
      40                 :            : //  types, enums, ...
      41                 :            : //_________________________________________________________________________________________________________________
      42                 :            : 
      43                 :            : /*-************************************************************************************************************//**
      44                 :            :     @descr          The method GetAddonsMenu() returns a list of property values.
      45                 :            :                     Use follow defines to seperate values by names.
      46                 :            : *//*-*************************************************************************************************************/
      47                 :            : #define ADDONSMENUITEM_STRING_URL                       "URL"
      48                 :            : #define ADDONSMENUITEM_STRING_TITLE                     "Title"
      49                 :            : #define ADDONSMENUITEM_STRING_TARGET                    "Target"
      50                 :            : #define ADDONSMENUITEM_STRING_IMAGEIDENTIFIER           "ImageIdentifier"
      51                 :            : #define ADDONSMENUITEM_STRING_CONTEXT                   "Context"
      52                 :            : #define ADDONSMENUITEM_STRING_SUBMENU                   "Submenu"
      53                 :            : #define ADDONSMENUITEM_STRING_CONTROLTYPE               "ControlType"
      54                 :            : #define ADDONSMENUITEM_STRING_WIDTH                     "Width"
      55                 :            : 
      56                 :            : #define ADDONSMENUITEM_URL_LEN                          3
      57                 :            : #define ADDONSMENUITEM_TITLE_LEN                        5
      58                 :            : #define ADDONSMENUITEM_TARGET_LEN                       6
      59                 :            : #define ADDONSMENUITEM_SUBMENU_LEN                      7
      60                 :            : #define ADDONSMENUITEM_CONTEXT_LEN                      7
      61                 :            : #define ADDONSMENUITEM_IMAGEIDENTIFIER_LEN              15
      62                 :            : 
      63                 :            : #define ADDONSMENUITEM_PROPERTYNAME_URL                 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_URL             ))
      64                 :            : #define ADDONSMENUITEM_PROPERTYNAME_TITLE               ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_TITLE           ))
      65                 :            : #define ADDONSMENUITEM_PROPERTYNAME_TARGET              ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_TARGET          ))
      66                 :            : #define ADDONSMENUITEM_PROPERTYNAME_IMAGEIDENTIFIER     ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_IMAGEIDENTIFIER ))
      67                 :            : #define ADDONSMENUITEM_PROPERTYNAME_CONTEXT             ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_CONTEXT         ))
      68                 :            : #define ADDONSMENUITEM_PROPERTYNAME_SUBMENU             ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_SUBMENU         ))
      69                 :            : #define ADDONSMENUITEM_PROPERTYNAME_CONTROLTYPE         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_CONTROLTYPE     ))
      70                 :            : #define ADDONSMENUITEM_PROPERTYNAME_WIDTH               ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_WIDTH           ))
      71                 :            : 
      72                 :            : #define ADDONSPOPUPMENU_URL_PREFIX_STR                  "private:menu/Addon"
      73                 :            : 
      74                 :            : #define ADDONSPOPUPMENU_URL_PREFIX                      ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ADDONSPOPUPMENU_URL_PREFIX_STR ))
      75                 :            : 
      76                 :            : namespace framework
      77                 :            : {
      78                 :            : 
      79                 :            : typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > MergeMenuDefinition;
      80                 :            : 
      81 [ +  - ][ +  - ]:       3560 : struct FWE_DLLPUBLIC MergeMenuInstruction
                 [ +  - ]
      82                 :            : {
      83                 :            :     ::rtl::OUString     aMergePoint;
      84                 :            :     ::rtl::OUString     aMergeCommand;
      85                 :            :     ::rtl::OUString     aMergeCommandParameter;
      86                 :            :     ::rtl::OUString     aMergeFallback;
      87                 :            :     ::rtl::OUString     aMergeContext;
      88                 :            :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > aMergeMenu;
      89                 :            : };
      90                 :            : typedef ::std::vector< MergeMenuInstruction > MergeMenuInstructionContainer;
      91                 :            : 
      92 [ #  # ][ #  # ]:          0 : struct FWE_DLLPUBLIC MergeToolbarInstruction
         [ #  # ][ #  # ]
      93                 :            : {
      94                 :            :     ::rtl::OUString     aMergeToolbar;
      95                 :            :     ::rtl::OUString     aMergePoint;
      96                 :            :     ::rtl::OUString     aMergeCommand;
      97                 :            :     ::rtl::OUString     aMergeCommandParameter;
      98                 :            :     ::rtl::OUString     aMergeFallback;
      99                 :            :     ::rtl::OUString     aMergeContext;
     100                 :            :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > aMergeToolbarItems;
     101                 :            : };
     102                 :            : 
     103                 :            : typedef ::std::vector< MergeToolbarInstruction > MergeToolbarInstructionContainer;
     104                 :            : 
     105                 :            : //_________________________________________________________________________________________________________________
     106                 :            : //  forward declarations
     107                 :            : //_________________________________________________________________________________________________________________
     108                 :            : 
     109                 :            : /*-************************************************************************************************************//**
     110                 :            :     @short          forward declaration to our private date container implementation
     111                 :            :     @descr          We use these class as internal member to support small memory requirements.
     112                 :            :                     You can create the container if it is neccessary. The class which use these mechanism
     113                 :            :                     is faster and smaller then a complete implementation!
     114                 :            : *//*-*************************************************************************************************************/
     115                 :            : 
     116                 :            : class AddonsOptions_Impl;
     117                 :            : 
     118                 :            : /*-************************************************************************************************************//**
     119                 :            :     @short          collect informations about menu features
     120                 :            :     @descr          -
     121                 :            : 
     122                 :            :     @implements     -
     123                 :            :     @base           -
     124                 :            : 
     125                 :            :     @devstatus      ready to use
     126                 :            : *//*-*************************************************************************************************************/
     127                 :            : 
     128                 :            : class FWE_DLLPUBLIC AddonsOptions
     129                 :            : {
     130                 :            :     //-------------------------------------------------------------------------------------------------------------
     131                 :            :     //  public methods
     132                 :            :     //-------------------------------------------------------------------------------------------------------------
     133                 :            : 
     134                 :            :     public:
     135                 :            :         //---------------------------------------------------------------------------------------------------------
     136                 :            :         //  constructor / destructor
     137                 :            :         //---------------------------------------------------------------------------------------------------------
     138                 :            : 
     139                 :            :         /*-****************************************************************************************************//**
     140                 :            :             @short      standard constructor and destructor
     141                 :            :             @descr      This will initialize an instance with default values.
     142                 :            :                         We implement these class with a refcount mechanism! Every instance of this class increase it
     143                 :            :                         at create and decrease it at delete time - but all instances use the same data container!
     144                 :            :                         He is implemented as a static member ...
     145                 :            : 
     146                 :            :             @seealso    member m_nRefCount
     147                 :            :             @seealso    member m_pDataContainer
     148                 :            : 
     149                 :            :             @param      -
     150                 :            :             @return     -
     151                 :            : 
     152                 :            :             @onerror    -
     153                 :            :         *//*-*****************************************************************************************************/
     154                 :            : 
     155                 :            :          AddonsOptions();
     156                 :            :         ~AddonsOptions();
     157                 :            : 
     158                 :            :         //---------------------------------------------------------------------------------------------------------
     159                 :            :         //  interface
     160                 :            :         //---------------------------------------------------------------------------------------------------------
     161                 :            : 
     162                 :            :         /*-****************************************************************************************************//**
     163                 :            :             @short      clears completely the addons menu
     164                 :            :             @descr      Call this methods to clear the addons menu
     165                 :            :                         To fill it again use AppendItem().
     166                 :            : 
     167                 :            :             @seealso    -
     168                 :            : 
     169                 :            :             @param      "eMenu" select right menu to clear.
     170                 :            :             @return     -
     171                 :            : 
     172                 :            :             @onerror    -
     173                 :            :         *//*-*****************************************************************************************************/
     174                 :            : 
     175                 :            :         void Clear();
     176                 :            : 
     177                 :            :         /*-****************************************************************************************************//**
     178                 :            :             @short      returns if an addons menu is available
     179                 :            :             @descr      Call to retrieve if a addons menu is available
     180                 :            : 
     181                 :            : 
     182                 :            :             @return     sal_True if there is a menu otherwise sal_False
     183                 :            :         *//*-*****************************************************************************************************/
     184                 :            : 
     185                 :            :         sal_Bool    HasAddonsMenu() const;
     186                 :            : 
     187                 :            :         /*-****************************************************************************************************//**
     188                 :            :             @short      returns number of addons toolbars
     189                 :            :             @descr      Call to retrieve the number of addons toolbars
     190                 :            : 
     191                 :            : 
     192                 :            :             @return     number of addons toolbars
     193                 :            :         *//*-*****************************************************************************************************/
     194                 :            :         sal_Int32   GetAddonsToolBarCount() const ;
     195                 :            : 
     196                 :            :         /*-****************************************************************************************************//**
     197                 :            :             @short      returns the  complete addons menu
     198                 :            :             @descr      Call it to get all entries of the addon menu.
     199                 :            :                         We return a list of all nodes with his names and properties.
     200                 :            : 
     201                 :            :             @seealso    -
     202                 :            : 
     203                 :            :             @return     A list of menu items is returned.
     204                 :            : 
     205                 :            :             @onerror    We return an empty list.
     206                 :            :         *//*-*****************************************************************************************************/
     207                 :            : 
     208                 :            :         const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsMenu() const;
     209                 :            : 
     210                 :            :         /*-****************************************************************************************************//**
     211                 :            :             @short      Gets the menu bar part of all addon components registered
     212                 :            :             @descr      -
     213                 :            : 
     214                 :            :             @seealso    -
     215                 :            : 
     216                 :            :             @return     A complete
     217                 :            : 
     218                 :            :             @onerror    We return sal_False
     219                 :            :         *//*-*****************************************************************************************************/
     220                 :            : 
     221                 :            :         const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsMenuBarPart() const;
     222                 :            : 
     223                 :            :         /*-****************************************************************************************************//**
     224                 :            :             @short      Gets a toolbar part of an single addon
     225                 :            :             @descr      -
     226                 :            : 
     227                 :            :             @seealso    -
     228                 :            : 
     229                 :            :             @return     A complete
     230                 :            : 
     231                 :            :             @onerror    We return sal_False
     232                 :            :         *//*-*****************************************************************************************************/
     233                 :            : 
     234                 :            :         const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsToolBarPart( sal_uInt32 nIndex ) const;
     235                 :            : 
     236                 :            :         /*-****************************************************************************************************//**
     237                 :            :             @short      Gets a unique toolbar resource name of an single addon
     238                 :            :             @descr      -
     239                 :            : 
     240                 :            :             @seealso    -
     241                 :            : 
     242                 :            :             @return     A complete
     243                 :            : 
     244                 :            :             @onerror    We return sal_False
     245                 :            :         *//*-*****************************************************************************************************/
     246                 :            : 
     247                 :            :         const ::rtl::OUString GetAddonsToolbarResourceName( sal_uInt32 nIndex ) const;
     248                 :            : 
     249                 :            :         /*-****************************************************************************************************//**
     250                 :            :             @short      Retrieves all available merge instructions for the Office menu bar
     251                 :            :             @descr      -
     252                 :            : 
     253                 :            :             @seealso    -
     254                 :            : 
     255                 :            :             @return     The filled MergeMenuDefinitionContaier
     256                 :            : 
     257                 :            :             @onerror    We return sal_False
     258                 :            :         *//*-*****************************************************************************************************/
     259                 :            : 
     260                 :            :         const MergeMenuInstructionContainer& GetMergeMenuInstructions() const;
     261                 :            : 
     262                 :            :         /*-****************************************************************************************************//**
     263                 :            :             @short      Retrieves all available merge instructions for a single toolbar
     264                 :            :             @descr      -
     265                 :            : 
     266                 :            :             @seealso    -
     267                 :            : 
     268                 :            :             @return     The filled
     269                 :            : 
     270                 :            :             @onerror    We return sal_False
     271                 :            :         *//*-*****************************************************************************************************/
     272                 :            :         bool GetMergeToolbarInstructions( const ::rtl::OUString& rToolbarName, MergeToolbarInstructionContainer& rToolbar ) const;
     273                 :            : 
     274                 :            :         /*-****************************************************************************************************//**
     275                 :            :             @short      Gets the Add-On help menu part of all addon components registered
     276                 :            :             @descr      -
     277                 :            : 
     278                 :            :             @seealso    -
     279                 :            : 
     280                 :            :             @return     A complete
     281                 :            : 
     282                 :            :             @onerror    We return sal_False
     283                 :            :         *//*-*****************************************************************************************************/
     284                 :            :         const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsHelpMenu() const;
     285                 :            : 
     286                 :            :         /*-****************************************************************************************************//**
     287                 :            :             @short      Retrieve an image for a command URL which is defined inside the addon menu configuration
     288                 :            :             @descr      Call it to retrieve an image for a command URL which is defined inside the addon menu configuration
     289                 :            : 
     290                 :            :             @seealso    -
     291                 :            : 
     292                 :            :             @return     An image which was defined in the configuration for the menu item. The image can be empty
     293                 :            :                         no bitmap was defined for the request image properties.
     294                 :            : 
     295                 :            :             @onerror    An empty image
     296                 :            :         *//*-*****************************************************************************************************/
     297                 :            : 
     298                 :            :         Image GetImageFromURL( const rtl::OUString& aURL, sal_Bool bBig, sal_Bool bNoScale ) const;
     299                 :            :         Image GetImageFromURL( const rtl::OUString& aURL, sal_Bool bBig ) const;
     300                 :            : 
     301                 :            :     //-------------------------------------------------------------------------------------------------------------
     302                 :            :     //  private methods
     303                 :            :     //-------------------------------------------------------------------------------------------------------------
     304                 :            : 
     305                 :            :         /*-****************************************************************************************************//**
     306                 :            :             @short      return a reference to a static mutex
     307                 :            :             @descr      These class is partially threadsafe (for de-/initialization only).
     308                 :            :                         All access methods are'nt safe!
     309                 :            :                         We create a static mutex only for one ime and use at different times.
     310                 :            : 
     311                 :            :             @seealso    -
     312                 :            : 
     313                 :            :             @param      -
     314                 :            :             @return     A reference to a static mutex member.
     315                 :            : 
     316                 :            :             @onerror    -
     317                 :            :         *//*-*****************************************************************************************************/
     318                 :            : 
     319                 :            :         static ::osl::Mutex& GetOwnStaticMutex();
     320                 :            : 
     321                 :            :         /*-****************************************************************************************************//**
     322                 :            :             @short      return a reference to a static mutex
     323                 :            :             @descr      These class is partially threadsafe (for de-/initialization only).
     324                 :            :                         All access methods are'nt safe!
     325                 :            :                         We create a static mutex only for one ime and use at different times.
     326                 :            : 
     327                 :            :             @seealso    -
     328                 :            : 
     329                 :            :             @param      -
     330                 :            :             @return     A reference to a static mutex member.
     331                 :            : 
     332                 :            :             @onerror    -
     333                 :            :         *//*-*****************************************************************************************************/
     334                 :            :         DECL_STATIC_LINK( AddonsOptions, Notify, void* );
     335                 :            : 
     336                 :            :     //-------------------------------------------------------------------------------------------------------------
     337                 :            :     //  private member
     338                 :            :     //-------------------------------------------------------------------------------------------------------------
     339                 :            : 
     340                 :            :     private:
     341                 :            : 
     342                 :            :         /*Attention
     343                 :            : 
     344                 :            :             Don't initialize these static member in these header!
     345                 :            :             a) Double dfined symbols will be detected ...
     346                 :            :             b) and unresolved externals exist at linking time.
     347                 :            :             Do it in your source only.
     348                 :            :          */
     349                 :            : 
     350                 :            :         static AddonsOptions_Impl*  m_pDataContainer    ;   /// impl. data container as dynamic pointer for smaller memory requirements!
     351                 :            :         static sal_Int32            m_nRefCount         ;   /// internal ref count mechanism
     352                 :            : 
     353                 :            : };      // class SvtMenuOptions
     354                 :            : 
     355                 :            : }
     356                 :            : 
     357                 :            : #endif  // #ifndef __FRAMEWORK_CLASSES_ADDONSOPTIONS_HXX_
     358                 :            : 
     359                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10