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

Generated by: LCOV version 1.10