1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SFX2_SOURCE_INC_SFXPICKLIST_HXX
21 #define INCLUDED_SFX2_SOURCE_INC_SFXPICKLIST_HXX
23 #include <osl/mutex.hxx>
24 #include <vcl/menu.hxx>
25 #include <svl/lstner.hxx>
26 #include <com/sun/star/util/XStringWidth.hpp>
30 #define PICKLIST_MAXSIZE 100
32 class SfxPickList
: public SfxListener
36 PickListEntry( const OUString
& _aName
, const OUString
& _aFilter
, const OUString
& _aTitle
) :
37 aName( _aName
), aFilter( _aFilter
), aTitle( _aTitle
) {}
45 std::vector
< PickListEntry
* > m_aPicklistVector
;
46 sal_uInt32 m_nAllowedMenuSize
;
47 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XStringWidth
> m_xStringLength
;
49 SfxPickList( sal_uInt32 nMenuSize
);
50 virtual ~SfxPickList();
52 void CreatePicklistMenuTitle( Menu
* pMenu
, sal_uInt16 nItemId
, const OUString
& aURL
, sal_uInt32 nNo
);
53 PickListEntry
* GetPickListEntry( sal_uInt32 nIndex
);
54 void CreatePickListEntries();
55 void RemovePickListEntries();
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
61 static void AddDocumentToPickList( SfxObjectShell
* pDocShell
);
64 static SfxPickList
& Get();
65 static void ensure() { Get(); }
67 sal_uInt32
GetAllowedMenuSize() { return m_nAllowedMenuSize
; }
68 sal_uInt32
GetNumOfEntries() const { return m_aPicklistVector
.size(); }
69 void CreateMenuEntries( Menu
* pMenu
);
70 static void ExecuteMenuEntry( sal_uInt16 nId
);
71 static void ExecuteEntry( sal_uInt32 nIndex
);
73 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
76 #endif // INCLUDED_SFX2_SOURCE_INC_SFXPICKLIST_HXX
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */