LCOV - code coverage report
Current view: top level - include/framework - addonsoptions.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 3 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 10 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 INCLUDED_FRAMEWORK_ADDONSOPTIONS_HXX
      20             : #define INCLUDED_FRAMEWORK_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             : /*-************************************************************************************************************
      32             :     @descr          The method GetAddonsMenu() returns a list of property values.
      33             :                     Use follow defines to separate values by names.
      34             : *//*-*************************************************************************************************************/
      35             : #define ADDONSMENUITEM_STRING_URL                       "URL"
      36             : #define ADDONSMENUITEM_STRING_TITLE                     "Title"
      37             : #define ADDONSMENUITEM_STRING_TARGET                    "Target"
      38             : #define ADDONSMENUITEM_STRING_IMAGEIDENTIFIER           "ImageIdentifier"
      39             : #define ADDONSMENUITEM_STRING_CONTEXT                   "Context"
      40             : #define ADDONSMENUITEM_STRING_SUBMENU                   "Submenu"
      41             : 
      42             : #define ADDONSPOPUPMENU_URL_PREFIX_STR                  "private:menu/Addon"
      43             : 
      44             : namespace framework
      45             : {
      46             : 
      47           0 : struct FWE_DLLPUBLIC MergeMenuInstruction
      48             : {
      49             :     OUString     aMergePoint;
      50             :     OUString     aMergeCommand;
      51             :     OUString     aMergeCommandParameter;
      52             :     OUString     aMergeFallback;
      53             :     OUString     aMergeContext;
      54             :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > aMergeMenu;
      55             : };
      56             : typedef ::std::vector< MergeMenuInstruction > MergeMenuInstructionContainer;
      57             : 
      58           0 : struct FWE_DLLPUBLIC MergeToolbarInstruction
      59             : {
      60             :     OUString     aMergeToolbar;
      61             :     OUString     aMergePoint;
      62             :     OUString     aMergeCommand;
      63             :     OUString     aMergeCommandParameter;
      64             :     OUString     aMergeFallback;
      65             :     OUString     aMergeContext;
      66             :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > aMergeToolbarItems;
      67             : };
      68             : 
      69             : typedef ::std::vector< MergeToolbarInstruction > MergeToolbarInstructionContainer;
      70             : 
      71           0 : struct FWE_DLLPUBLIC MergeStatusbarInstruction
      72             : {
      73             :     ::rtl::OUString     aMergePoint;
      74             :     ::rtl::OUString     aMergeCommand;
      75             :     ::rtl::OUString     aMergeCommandParameter;
      76             :     ::rtl::OUString     aMergeFallback;
      77             :     ::rtl::OUString     aMergeContext;
      78             :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > aMergeStatusbarItems;
      79             : };
      80             : 
      81             : typedef ::std::vector< MergeStatusbarInstruction > MergeStatusbarInstructionContainer;
      82             : 
      83             : /*-************************************************************************************************************
      84             :     @short          forward declaration to our private date container implementation
      85             :     @descr          We use these class as internal member to support small memory requirements.
      86             :                     You can create the container if it is necessary. The class which use these mechanism
      87             :                     is faster and smaller then a complete implementation!
      88             : *//*-*************************************************************************************************************/
      89             : 
      90             : class AddonsOptions_Impl;
      91             : 
      92             : /*-************************************************************************************************************
      93             :     @short          collect information about menu features
      94             :     @devstatus      ready to use
      95             : *//*-*************************************************************************************************************/
      96             : 
      97             : class FWE_DLLPUBLIC AddonsOptions
      98             : {
      99             :     public:
     100             : 
     101             :         /*-****************************************************************************************************
     102             :             @short      standard constructor and destructor
     103             :             @descr      This will initialize an instance with default values.
     104             :                         We implement these class with a refcount mechanism! Every instance of this class increase it
     105             :                         at create and decrease it at delete time - but all instances use the same data container!
     106             :                         He is implemented as a static member ...
     107             : 
     108             :             @seealso    member m_nRefCount
     109             :             @seealso    member m_pDataContainer
     110             :         *//*-*****************************************************************************************************/
     111             : 
     112             :          AddonsOptions();
     113             :         ~AddonsOptions();
     114             : 
     115             :         /*-****************************************************************************************************
     116             :             @short      clears completely the addons menu
     117             :             @descr      Call this methods to clear the addons menu
     118             :                         To fill it again use AppendItem().
     119             :             @param      "eMenu" select right menu to clear.
     120             :         *//*-*****************************************************************************************************/
     121             : 
     122             :         void Clear();
     123             : 
     124             :         /*-****************************************************************************************************
     125             :             @short      returns if an addons menu is available
     126             :             @descr      Call to retrieve if a addons menu is available
     127             : 
     128             : 
     129             :             @return     true if there is a menu otherwise false
     130             :         *//*-*****************************************************************************************************/
     131             : 
     132             :         bool    HasAddonsMenu() const;
     133             : 
     134             :         /*-****************************************************************************************************
     135             :             @short      returns number of addons toolbars
     136             :             @descr      Call to retrieve the number of addons toolbars
     137             : 
     138             : 
     139             :             @return     number of addons toolbars
     140             :         *//*-*****************************************************************************************************/
     141             :         sal_Int32   GetAddonsToolBarCount() const ;
     142             : 
     143             :         /*-****************************************************************************************************
     144             :             @short      returns the  complete addons menu
     145             :             @descr      Call it to get all entries of the addon menu.
     146             :                         We return a list of all nodes with his names and properties.
     147             :             @return     A list of menu items is returned.
     148             : 
     149             :             @onerror    We return an empty list.
     150             :         *//*-*****************************************************************************************************/
     151             : 
     152             :         const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsMenu() const;
     153             : 
     154             :         /*-****************************************************************************************************
     155             :             @short      Gets the menu bar part of all addon components registered
     156             :             @return     A complete
     157             : 
     158             :             @onerror    We return sal_False
     159             :         *//*-*****************************************************************************************************/
     160             : 
     161             :         const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsMenuBarPart() const;
     162             : 
     163             :         /*-****************************************************************************************************
     164             :             @short      Gets a toolbar part of an single addon
     165             :             @return     A complete
     166             : 
     167             :             @onerror    We return sal_False
     168             :         *//*-*****************************************************************************************************/
     169             : 
     170             :         const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsToolBarPart( sal_uInt32 nIndex ) const;
     171             : 
     172             :         /*-****************************************************************************************************
     173             :             @short      Gets a unique toolbar resource name of an single addon
     174             :             @return     A complete
     175             : 
     176             :             @onerror    We return sal_False
     177             :         *//*-*****************************************************************************************************/
     178             : 
     179             :         const OUString GetAddonsToolbarResourceName( sal_uInt32 nIndex ) const;
     180             : 
     181             :         /*-****************************************************************************************************
     182             :             @short      Retrieves all available merge instructions for the Office menu bar
     183             :             @return     The filled MergeMenuDefinitionContaier
     184             : 
     185             :             @onerror    We return sal_False
     186             :         *//*-*****************************************************************************************************/
     187             : 
     188             :         const MergeMenuInstructionContainer& GetMergeMenuInstructions() const;
     189             : 
     190             :         /*-****************************************************************************************************
     191             :             @short      Retrieves all available merge instructions for a single toolbar
     192             :             @return     The filled
     193             : 
     194             :             @onerror    We return sal_False
     195             :         *//*-*****************************************************************************************************/
     196             :         bool GetMergeToolbarInstructions( const OUString& rToolbarName, MergeToolbarInstructionContainer& rToolbar ) const;
     197             : 
     198             :         /*-****************************************************************************************************
     199             :             @short      Gets the Add-On help menu part of all addon components registered
     200             :             @return     A complete
     201             : 
     202             :             @onerror    We return sal_False
     203             :         *//*-*****************************************************************************************************/
     204             :         const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsHelpMenu() const;
     205             : 
     206             :         const MergeStatusbarInstructionContainer& GetMergeStatusbarInstructions() const;
     207             : 
     208             :         /*-****************************************************************************************************
     209             :             @short      Retrieve an image for a command URL which is defined inside the addon menu configuration
     210             :             @descr      Call it to retrieve an image for a command URL which is defined inside the addon menu configuration
     211             :             @return     An image which was defined in the configuration for the menu item. The image can be empty
     212             :                         no bitmap was defined for the request image properties.
     213             : 
     214             :             @onerror    An empty image
     215             :         *//*-*****************************************************************************************************/
     216             : 
     217             :         Image GetImageFromURL( const OUString& aURL, bool bBig, bool bNoScale ) const;
     218             :         Image GetImageFromURL( const OUString& aURL, bool bBig ) const;
     219             : 
     220             : 
     221             :     //  private methods
     222             : 
     223             : 
     224             :         /*-****************************************************************************************************
     225             :             @short      return a reference to a static mutex
     226             :             @descr      These class is partially threadsafe (for de-/initialization only).
     227             :                         All access methods are'nt safe!
     228             :                         We create a static mutex only for one ime and use at different times.
     229             :             @return     A reference to a static mutex member.
     230             :         *//*-*****************************************************************************************************/
     231             : 
     232             :         static ::osl::Mutex& GetOwnStaticMutex();
     233             : 
     234             :         /*-****************************************************************************************************
     235             :             @short      return a reference to a static mutex
     236             :             @descr      These class is partially threadsafe (for de-/initialization only).
     237             :                         All access methods are'nt safe!
     238             :                         We create a static mutex only for one ime and use at different times.
     239             :             @return     A reference to a static mutex member.
     240             :         *//*-*****************************************************************************************************/
     241             :         DECL_STATIC_LINK( AddonsOptions, Notify, void* );
     242             : 
     243             :     private:
     244             : 
     245             :         /*Attention
     246             : 
     247             :             Don't initialize these static members in these headers!
     248             :             a) Double defined symbols will be detected ...
     249             :             b) and unresolved externals exist at linking time.
     250             :             Do it in your source only.
     251             :          */
     252             : 
     253             :         static AddonsOptions_Impl*  m_pDataContainer    ;
     254             :         static sal_Int32            m_nRefCount         ;
     255             : 
     256             : };
     257             : 
     258             : }
     259             : 
     260             : #endif // INCLUDED_FRAMEWORK_ADDONSOPTIONS_HXX
     261             : 
     262             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11