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 : #ifndef INCLUDED_FPICKER_SOURCE_OFFICE_PLACESLISTBOX_HXX
10 : #define INCLUDED_FPICKER_SOURCE_OFFICE_PLACESLISTBOX_HXX
11 :
12 : #include <iodlg.hxx>
13 :
14 : #include <svtools/place.hxx>
15 : #include <svtools/svtabbx.hxx>
16 :
17 : #include <memory>
18 : #include <vector>
19 :
20 : typedef std::shared_ptr< Place > PlacePtr;
21 :
22 : class PlacesListBox;
23 : class PlacesListBox_Impl : public SvHeaderTabListBox
24 : {
25 : private:
26 : VclPtr<HeaderBar> mpHeaderBar;
27 : VclPtr<PlacesListBox> mpParent;
28 :
29 : public:
30 : PlacesListBox_Impl( PlacesListBox* pParent, const OUString& rTitle );
31 : virtual ~PlacesListBox_Impl( );
32 : virtual void dispose() SAL_OVERRIDE;
33 :
34 : virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
35 : };
36 :
37 : /** ListBox to handle Places.
38 : */
39 : class PlacesListBox : public Control
40 : {
41 : private:
42 : std::vector< PlacePtr > maPlaces;
43 : VclPtr<SvtFileDialog> mpDlg;
44 : VclPtr<PlacesListBox_Impl> mpImpl;
45 : VclPtr<PushButton> mpAddBtn;
46 : VclPtr<PushButton> mpDelBtn;
47 : sal_Int32 mnNbEditables;
48 : bool mbUpdated;
49 : bool mbSelectionChanged;
50 :
51 : public:
52 : PlacesListBox( vcl::Window* pParent, SvtFileDialog* pFileDlg, const OUString& rTitle, WinBits nBits );
53 : virtual ~PlacesListBox( );
54 : virtual void dispose() SAL_OVERRIDE;
55 :
56 : void AppendPlace( PlacePtr pPlace );
57 : void RemovePlace( sal_uInt16 nPos );
58 : void RemoveSelectedPlace();
59 0 : sal_Int32 GetNbEditablePlaces() { return mnNbEditables;}
60 : bool IsUpdated();
61 0 : const std::vector<PlacePtr>& GetPlaces() { return maPlaces;}
62 :
63 : void SetAddHdl( const Link<>& rHdl );
64 : void SetDelHdl( const Link<>& rHdl );
65 : void SetDelEnabled( bool enabled );
66 : void SetSizePixel( const Size& rNewSize ) SAL_OVERRIDE;
67 : void updateView( );
68 :
69 : private:
70 :
71 : Image getEntryIcon( PlacePtr pPlace );
72 :
73 : DECL_LINK( Selection, void* );
74 : DECL_LINK( DoubleClick, void* );
75 : };
76 :
77 : #endif
78 :
79 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|