Bump version to 4.1-6
[LibreOffice.git] / sfx2 / source / inc / sfxpicklist.hxx
blob443e85df4491cc633d99666df0974e91da53d25a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 _SFX_PICKLIST_HXX_
21 #define _SFX_PICKLIST_HXX_
23 #include <osl/mutex.hxx>
24 #include <vcl/menu.hxx>
25 #include <svl/lstner.hxx>
26 #include <com/sun/star/util/XStringWidth.hpp>
28 #include <vector>
30 #define PICKLIST_MAXSIZE 100
32 class SfxPickList : public SfxListener
34 struct PickListEntry
36 PickListEntry( const OUString& _aName, const OUString& _aFilter, const OUString& _aTitle ) :
37 aName( _aName ), aFilter( _aFilter ), aTitle( _aTitle ) {}
39 OUString aName;
40 OUString aFilter;
41 OUString aTitle;
42 OUString aOptions;
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 ~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();
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.
61 void AddDocumentToPickList( SfxObjectShell* pDocShell );
63 public:
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 void ExecuteMenuEntry( sal_uInt16 nId );
71 void ExecuteEntry( sal_uInt32 nIndex );
73 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
76 #endif // _SFX_PICKLIST_HXX_
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */