LCOV - code coverage report
Current view: top level - include/framework - menuconfiguration.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 14 14 100.0 %
Date: 2015-06-13 12:38:46 Functions: 5 5 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_FRAMEWORK_MENUCONFIGURATION_HXX
      21             : #define INCLUDED_FRAMEWORK_MENUCONFIGURATION_HXX
      22             : 
      23             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      24             : #include <com/sun/star/lang/WrappedTargetException.hpp>
      25             : #include <com/sun/star/io/XInputStream.hpp>
      26             : #include <com/sun/star/io/XOutputStream.hpp>
      27             : #include <com/sun/star/frame/XFrame.hpp>
      28             : #include <com/sun/star/container/XIndexContainer.hpp>
      29             : #include <com/sun/star/container/XIndexAccess.hpp>
      30             : #include <com/sun/star/frame/XDispatchProvider.hpp>
      31             : #include <com/sun/star/uno/XComponentContext.hpp>
      32             : 
      33             : #include <framework/fwedllapi.h>
      34             : 
      35             : #include <cppuhelper/weak.hxx>
      36             : #include <vcl/menu.hxx>
      37             : #include <vcl/toolbox.hxx>
      38             : 
      39             : #define BOOKMARK_NEWMENU        "private:menu_bookmark_new"
      40             : #define BOOKMARK_WIZARDMENU     "private:menu_bookmark_wizard"
      41             : 
      42             : // Prepare for inclusion by framework and sfx
      43             : // Please consider that there is a corresponding define also in sfxsids.hrc!! (SID_SFX_START)/(SID_ADDONS)
      44             : #define FWK_SID_SFX_START 5000
      45             : #define FWK_SID_ADDONS (FWK_SID_SFX_START+1678)
      46             : #define FWK_SID_ADDONHELP (FWK_SID_SFX_START+1684)
      47             : 
      48             : const sal_uInt16 START_ITEMID_PICKLIST      = 4500;
      49             : const sal_uInt16 END_ITEMID_PICKLIST        = 4599;
      50             : const sal_uInt16 MAX_ITEMCOUNT_PICKLIST     =   99; // difference between START_... & END_... for picklist / must be changed too, if these values are changed!
      51             : const sal_uInt16 START_ITEMID_WINDOWLIST    = 4600;
      52             : const sal_uInt16 END_ITEMID_WINDOWLIST      = 4699;
      53             : const sal_uInt16 ITEMID_ADDONLIST           = FWK_SID_ADDONS;
      54             : const sal_uInt16 ITEMID_ADDONHELP           = FWK_SID_ADDONHELP;
      55             : 
      56             : namespace framework
      57             : {
      58             : 
      59        7280 : struct FWE_DLLPUBLIC MenuAttributes
      60             : {
      61             : private:
      62             :     oslInterlockedCount refCount;
      63             : 
      64        7272 :     MenuAttributes(const OUString& rFrame, const OUString& rImageIdStr)
      65             :         : refCount(0)
      66             :         , aTargetFrame(rFrame)
      67             :         , aImageId(rImageIdStr)
      68        7272 :         , nStyle(0)
      69             :     {
      70        7272 :     }
      71             : 
      72          16 :     MenuAttributes(const css::uno::WeakReference<css::frame::XDispatchProvider>& rDispatchProvider)
      73             :         : refCount(0)
      74             :         , xDispatchProvider(rDispatchProvider)
      75          16 :         , nStyle(0)
      76             :     {
      77          16 :     }
      78             : 
      79             :     MenuAttributes(const MenuAttributes&) SAL_DELETED_FUNCTION;
      80             : 
      81             : public:
      82             :     OUString aTargetFrame;
      83             :     OUString aImageId;
      84             :     css::uno::WeakReference<css::frame::XDispatchProvider> xDispatchProvider;
      85             :     sal_Int16 nStyle;
      86             : 
      87             :     static sal_uIntPtr CreateAttribute(const OUString& rFrame, const OUString& rImageIdStr);
      88             :     static sal_uIntPtr CreateAttribute(const css::uno::WeakReference<css::frame::XDispatchProvider>& rDispatchProvider);
      89             :     static void ReleaseAttribute(sal_uIntPtr nAttributePtr);
      90             : 
      91       14560 :     void acquire()
      92             :     {
      93       14560 :         osl_atomic_increment(&refCount);
      94       14560 :     }
      95             : 
      96       14552 :     void release()
      97             :     {
      98       14552 :         if (!osl_atomic_decrement(&refCount))
      99        7280 :             delete this;
     100       14552 :     }
     101             : };
     102             : 
     103             : class FWE_DLLPUBLIC MenuConfiguration
     104             : {
     105             :     public:
     106             :         MenuConfiguration(
     107             :             // use const when giving a uno reference by reference
     108             :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
     109             : 
     110             :         virtual ~MenuConfiguration();
     111             : 
     112             :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > CreateMenuBarConfigurationFromXML(
     113             :             ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream )
     114             :             throw (css::lang::WrappedTargetException, css::uno::RuntimeException);
     115             : 
     116             :         PopupMenu* CreateBookmarkMenu(css::uno::Reference<css::frame::XFrame >& rFrame, const OUString& aURL)
     117             :             throw (css::lang::WrappedTargetException, css::uno::RuntimeException);
     118             : 
     119             :         ToolBox* CreateToolBoxFromConfiguration(
     120             :             ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream )
     121             :             throw ( ::com::sun::star::lang::WrappedTargetException );
     122             : 
     123             :         void StoreMenuBarConfigurationToXML( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rMenuBarConfiguration,
     124             :                       ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream )
     125             :             throw (css::lang::WrappedTargetException, css::uno::RuntimeException);
     126             : 
     127             :         void StoreToolBox( ToolBox* pToolBox,
     128             :                       ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream )
     129             :             throw ( ::com::sun::star::lang::WrappedTargetException );
     130             : 
     131             :     private:
     132             :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xContext;
     133             : };
     134             : 
     135             : }
     136             : 
     137             : #endif // INCLUDED_FRAMEWORK_MENUCONFIGURATION_HXX
     138             : 
     139             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11