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 .
22 #include <sfx2/tbxctrl.hxx>
23 #include <vcl/toolbox.hxx>
24 #include <svtools/stdctrl.hxx>
25 #include <vcl/button.hxx>
30 // double entry! hrc and hxx
31 // these Ids say what the buttons below the scrollbar are doing
32 #define NID_START 20000
33 #define NID_NEXT 20000
34 #define NID_PREV 20001
39 #define NID_CTRL 20006
44 #define NID_OUTL 20011
47 #define NID_MARK 20014
48 #define NID_POSTIT 20015
49 #define NID_SRCH_REP 20016
50 #define NID_INDEX_ENTRY 20017
51 #define NID_TABLE_FORMULA 20018
52 #define NID_TABLE_FORMULA_ERROR 20019
57 //----------------------------------------------------------------------------
59 //----------------------------------------------------------------------------
61 class SwTbxInsertCtrl
: public SfxToolBoxControl
63 sal_uInt16 nLastSlotId
;
65 using SfxToolBoxControl::Select
;
66 virtual void Select( sal_Bool bMod1
= sal_False
);
69 SFX_DECL_TOOLBOX_CONTROL();
71 SwTbxInsertCtrl( sal_uInt16 nSlotId
, sal_uInt16 nId
, ToolBox
& rTbx
);
74 virtual SfxPopupWindowType
GetPopupWindowType() const;
75 virtual SfxPopupWindow
* CreatePopupWindow();
76 virtual void StateChanged( sal_uInt16 nSID
,
78 const SfxPoolItem
* pState
);
80 virtual void SAL_CALL
update() throw (::com::sun::star::uno::RuntimeException
);
83 //----------------------------------------------------------------------------
85 //----------------------------------------------------------------------------
87 class SwTbxAutoTextCtrl
: public SfxToolBoxControl
95 SFX_DECL_TOOLBOX_CONTROL();
97 SwTbxAutoTextCtrl( sal_uInt16 nSlotId
, sal_uInt16 nId
, ToolBox
& rTbx
);
98 virtual ~SwTbxAutoTextCtrl();
100 virtual SfxPopupWindowType
GetPopupWindowType() const;
101 virtual SfxPopupWindow
* CreatePopupWindow();
102 virtual void StateChanged( sal_uInt16 nSID
,
104 const SfxPoolItem
* pState
);
106 DECL_LINK(PopupHdl
, PopupMenu
*);
109 class SwTbxFieldCtrl
: public SfxToolBoxControl
117 SFX_DECL_TOOLBOX_CONTROL();
119 SwTbxFieldCtrl( sal_uInt16 nSlotId
, sal_uInt16 nId
, ToolBox
& rTbx
);
120 virtual ~SwTbxFieldCtrl();
122 virtual SfxPopupWindowType
GetPopupWindowType() const;
123 virtual SfxPopupWindow
* CreatePopupWindow();
124 virtual void StateChanged( sal_uInt16 nSID
,
126 const SfxPoolItem
* pState
);
128 DECL_LINK(PopupHdl
, PopupMenu
*);
133 //----------------------------------------------------------------------------
135 //----------------------------------------------------------------------------
137 class SwScrollNaviToolBox
: public ToolBox
139 virtual void MouseButtonUp( const MouseEvent
& rMEvt
);
140 virtual void RequestHelp( const HelpEvent
& rHEvt
);
143 SwScrollNaviToolBox(Window
* pParent
, WinBits nWinStyle
) :
144 ToolBox(pParent
, nWinStyle
) {}
147 class SwScrollNaviPopup
: public SfxPopupWindow
149 SwScrollNaviToolBox aToolBox
;
150 FixedLine aSeparator
;
151 FixedInfo aInfoField
;
154 String sQuickHelp
[2 * NID_COUNT
];
156 void ApplyImageList();
158 using Window::GetQuickHelpText
;
161 DECL_LINK(SelectHdl
, ToolBox
*);
162 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
165 SwScrollNaviPopup( sal_uInt16 nId
, const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& rFrame
);
166 ~SwScrollNaviPopup();
168 static String
GetQuickHelpText(sal_Bool bNext
);
170 virtual SfxPopupWindow
* Clone() const;
171 void GrabFocus(){aToolBox
.GrabFocus();}
174 //----------------------------------------------------------------------------
176 //----------------------------------------------------------------------------
178 class SwNaviImageButton
: public ImageButton
180 SwScrollNaviPopup
* pPopup
;
183 SfxPopupWindow
* pPopupWindow
;
184 SfxPopupWindow
* pFloatingWindow
;
185 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
> m_xFrame
;
188 DECL_LINK( PopupModeEndHdl
, void * );
189 DECL_LINK( ClosePopupWindow
, SfxPopupWindow
* );
191 virtual void Click();
192 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
193 void SetPopupWindow( SfxPopupWindow
* pWindow
);
196 SwNaviImageButton(Window
* pParent
, const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& rFrame
);
199 //----------------------------------------------------------------------------
200 // ImageButtons have to set the HelpText themselves if needed
201 //----------------------------------------------------------------------------
203 class SwHlpImageButton
: public ImageButton
207 SwHlpImageButton(Window
* pParent
, const ResId
& rResId
, sal_Bool bUpBtn
) :
208 ImageButton(pParent
, rResId
), bUp(bUpBtn
){}
210 virtual void RequestHelp( const HelpEvent
& rHEvt
);
214 class SwPreviewZoomControl
: public SfxToolBoxControl
217 SFX_DECL_TOOLBOX_CONTROL();
219 SwPreviewZoomControl( sal_uInt16 nSlotId
, sal_uInt16 nId
, ToolBox
& rTbx
);
220 ~SwPreviewZoomControl();
222 virtual void StateChanged( sal_uInt16 nSID
,
224 const SfxPoolItem
* pState
);
226 virtual Window
* CreateItemWindow( Window
*pParent
);
232 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */