1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svx.hxx"
26 #include <svl/intitem.hxx>
27 
28 #include <vcl/toolbox.hxx>
29 #include <sfx2/app.hxx>
30 #include <svx/subtoolboxcontrol.hxx>
31 #include <svx/svxids.hrc>
32 
33 
34 SFX_IMPL_TOOLBOX_CONTROL( SvxSubToolBoxControl, SfxUInt16Item );
35 
36 /**********************************************************************
37 
38 **********************************************************************/
39 
SvxSubToolBoxControl(sal_uInt16 nSlotId,sal_uInt16 nId,ToolBox & rTbx)40 SvxSubToolBoxControl::SvxSubToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
41 : SfxToolBoxControl( nSlotId, nId, rTbx )
42 {
43 	rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) );
44 }
45 
46 /**********************************************************************
47 
48 **********************************************************************/
49 
~SvxSubToolBoxControl()50 SvxSubToolBoxControl::~SvxSubToolBoxControl()
51 {
52 }
53 
54 /**********************************************************************
55 
56 **********************************************************************/
57 
CreatePopupWindow()58 SfxPopupWindow* SvxSubToolBoxControl::CreatePopupWindow()
59 {
60 	const sal_Char* pResource = 0;
61 	switch( GetSlotId() )
62 	{
63 	case SID_OPTIMIZE_TABLE:
64 		pResource = "private:resource/toolbar/optimizetablebar";
65 		break;
66 	}
67 
68 	if( pResource )
69 		createAndPositionSubToolBar( rtl::OUString::createFromAscii( pResource ) );
70     return NULL;
71 }
72 
73 /**********************************************************************
74 
75 **********************************************************************/
76 
GetPopupWindowType() const77 SfxPopupWindowType	SvxSubToolBoxControl::GetPopupWindowType() const
78 {
79 	return SFX_POPUPWINDOW_ONCLICK;
80 }
81