Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _BIB_TOOLBAR_HXX
30 : : #define _BIB_TOOLBAR_HXX
31 : :
32 : : #include <com/sun/star/frame/XController.hpp>
33 : : #include <com/sun/star/frame/XStatusListener.hpp>
34 : :
35 : :
36 : : #include <vcl/toolbox.hxx>
37 : : #include <vcl/lstbox.hxx>
38 : : #include <vcl/edit.hxx>
39 : : #include <vcl/fixed.hxx>
40 : : #include <vcl/timer.hxx>
41 : : #include <cppuhelper/implbase1.hxx> // helper for implementations
42 : : #include <boost/ptr_container/ptr_vector.hpp>
43 : :
44 : : class BibDataManager;
45 : : class BibToolBar;
46 : :
47 : : class BibToolBarListener: public cppu::WeakImplHelper1 < ::com::sun::star::frame::XStatusListener>
48 : : {
49 : : private:
50 : :
51 : : sal_uInt16 nIndex;
52 : : rtl::OUString aCommand;
53 : :
54 : : protected:
55 : :
56 : : BibToolBar *pToolBar;
57 : :
58 : : public:
59 : :
60 : : BibToolBarListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId);
61 : : ~BibToolBarListener();
62 : :
63 : : rtl::OUString GetCommand() const;
64 : :
65 : : // ::com::sun::star::lang::XEventListener
66 : : // we do not hold References to dispatches, so there is nothing to do on disposal
67 : 0 : virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& /*Source*/)
68 : 0 : throw( ::com::sun::star::uno::RuntimeException ){};
69 : :
70 : : // ::com::sun::star::frame::XStatusListener
71 : : virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
72 : : throw( ::com::sun::star::uno::RuntimeException );
73 : :
74 : : };
75 : :
76 : : class BibTBListBoxListener: public BibToolBarListener
77 : : {
78 : : public:
79 : :
80 : : BibTBListBoxListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId);
81 : : ~BibTBListBoxListener();
82 : :
83 : : virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
84 : : throw( ::com::sun::star::uno::RuntimeException );
85 : :
86 : : };
87 : :
88 : : class BibTBEditListener: public BibToolBarListener
89 : : {
90 : : public:
91 : :
92 : : BibTBEditListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId);
93 : : ~BibTBEditListener();
94 : :
95 : : virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
96 : : throw( ::com::sun::star::uno::RuntimeException );
97 : :
98 : : };
99 : :
100 : : class BibTBQueryMenuListener: public BibToolBarListener
101 : : {
102 : : public:
103 : :
104 : : BibTBQueryMenuListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId);
105 : : ~BibTBQueryMenuListener();
106 : :
107 : : virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
108 : : throw( ::com::sun::star::uno::RuntimeException );
109 : :
110 : : };
111 : :
112 : :
113 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener> BibToolBarListenerRef;
114 : : typedef boost::ptr_vector<BibToolBarListenerRef> BibToolBarListenerArr;
115 : :
116 : : class BibToolBar: public ToolBox
117 : : {
118 : : private:
119 : :
120 : : BibToolBarListenerArr aListenerArr;
121 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > xController;
122 : : Timer aTimer;
123 : : ImageList aImgLst;
124 : : ImageList aImgLstHC;
125 : : ImageList aBigImgLst;
126 : : ImageList aBigImgLstHC;
127 : : FixedText aFtSource;
128 : : ListBox aLBSource;
129 : : FixedText aFtQuery;
130 : : Edit aEdQuery;
131 : : PopupMenu aPopupMenu;
132 : : sal_uInt16 nMenuId;
133 : : sal_uInt16 nSelMenuItem;
134 : : rtl::OUString aQueryField;
135 : : Link aLayoutManager;
136 : : sal_Int16 nSymbolsSize;
137 : : sal_Int16 nOutStyle;
138 : :
139 : : BibDataManager* pDatMan;
140 : : DECL_LINK( SelHdl, ListBox* );
141 : : DECL_LINK( SendSelHdl, Timer* );
142 : : DECL_LINK( MenuHdl, ToolBox* );
143 : : DECL_LINK( OptionsChanged_Impl, void* );
144 : : DECL_LINK( SettingsChanged_Impl, void* );
145 : :
146 : : void ApplyImageList();
147 : : void RebuildToolbar();
148 : :
149 : : protected:
150 : :
151 : : void DataChanged( const DataChangedEvent& rDCEvt );
152 : : void InitListener();
153 : : virtual void Select();
154 : : virtual void Click();
155 : : long PreNotify( NotifyEvent& rNEvt );
156 : :
157 : :
158 : : public:
159 : :
160 : : BibToolBar(Window* pParent, Link aLink, WinBits nStyle = WB_3DLOOK );
161 : : ~BibToolBar();
162 : :
163 : : void SetXController(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > &);
164 : :
165 : : void ClearSourceList();
166 : : void UpdateSourceList(sal_Bool bFlag=sal_True);
167 : : void EnableSourceList(sal_Bool bFlag=sal_True);
168 : : void InsertSourceEntry(const XubString&,sal_uInt16 nPos=LISTBOX_APPEND );
169 : : void SelectSourceEntry(const XubString& );
170 : :
171 : : void EnableQuery(sal_Bool bFlag=sal_True);
172 : : void SetQueryString(const XubString& );
173 : : void AdjustToolBox();
174 : :
175 : : void ClearFilterMenu();
176 : : sal_uInt16 InsertFilterItem(const XubString& );
177 : : void SelectFilterItem(sal_uInt16 nId);
178 : :
179 : : void statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
180 : : throw( ::com::sun::star::uno::RuntimeException );
181 : :
182 : 0 : void SetDatMan(BibDataManager& rDatMan) {pDatMan = &rDatMan;}
183 : : void SendDispatch(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs);
184 : : };
185 : :
186 : :
187 : :
188 : :
189 : : #endif
190 : :
191 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|