LCOV - code coverage report
Current view: top level - libreoffice/sfx2/source/inc - sfxpicklist.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 4 25.0 %
Date: 2012-12-27 Functions: 1 3 33.3 %
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 _SFX_PICKLIST_HXX_
      21             : #define _SFX_PICKLIST_HXX_
      22             : 
      23             : #include <osl/mutex.hxx>
      24             : #include <vcl/menu.hxx>
      25             : #include <svl/lstner.hxx>
      26             : #include <com/sun/star/util/XStringWidth.hpp>
      27             : 
      28             : #include <vector>
      29             : 
      30             : #define PICKLIST_MAXSIZE  100
      31             : 
      32             : class SfxPickList : public SfxListener
      33             : {
      34           0 :     struct PickListEntry
      35             :     {
      36           0 :         PickListEntry( const ::rtl::OUString& _aName, const ::rtl::OUString& _aFilter, const ::rtl::OUString& _aTitle ) :
      37           0 :             aName( _aName ), aFilter( _aFilter ), aTitle( _aTitle ) {}
      38             : 
      39             :         ::rtl::OUString aName;
      40             :         ::rtl::OUString aFilter;
      41             :         ::rtl::OUString aTitle;
      42             :         ::rtl::OUString aOptions;
      43             :     };
      44             : 
      45             :     std::vector< PickListEntry* >   m_aPicklistVector;
      46             :     sal_uInt32                      m_nAllowedMenuSize;
      47             :     ::com::sun::star::uno::Reference< ::com::sun::star::util::XStringWidth > m_xStringLength;
      48             : 
      49             :                             SfxPickList( sal_uInt32 nMenuSize );
      50             :                             ~SfxPickList();
      51             : 
      52             :     void                    CreatePicklistMenuTitle( Menu* pMenu, sal_uInt16 nItemId, const ::rtl::OUString& aURL, sal_uInt32 nNo );
      53             :     PickListEntry*          GetPickListEntry( sal_uInt32 nIndex );
      54             :     void                    CreatePickListEntries();
      55             :     void                    RemovePickListEntries();
      56             :     /**
      57             :      * Adds the given document to the pick list (recent documents) if it satisfies
      58             :        certain requirements, e.g. being writable. Check implementation for requirement
      59             :        details.
      60             :      */
      61             :     void                    AddDocumentToPickList( SfxObjectShell* pDocShell );
      62             : 
      63             :     public:
      64             :         static SfxPickList& Get();
      65          19 :         static void ensure() { Get(); }
      66             : 
      67             :         sal_uInt32          GetAllowedMenuSize() { return m_nAllowedMenuSize; }
      68             :         sal_uInt32          GetNumOfEntries() const { return m_aPicklistVector.size(); }
      69             :         void                CreateMenuEntries( Menu* pMenu );
      70             :         void                ExecuteMenuEntry( sal_uInt16 nId );
      71             :         void                ExecuteEntry( sal_uInt32 nIndex );
      72             : 
      73             :         virtual void        Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
      74             : };
      75             : 
      76             : #endif // _SFX_PICKLIST_HXX_
      77             : 
      78             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10