1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tbxmgr.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
37 #include "swtypes.hxx" // nur wegen aEmptyString??
43 /*************************************************************************
47 \************************************************************************/
49 SwPopupWindowTbxMgr::SwPopupWindowTbxMgr( USHORT nId, WindowAlign eAlign,
50 ResId aRIdWin, ResId aRIdTbx,
51 SfxBindings& rBindings ) :
52 SvxPopupWindowTbxMgr( nId, eAlign, aRIdWin, aRIdTbx ),
57 mrBindings( rBindings )
59 SfxObjectShell* pObjShell = SfxObjectShell::Current();
60 if(PTR_CAST(SwWebDocShell, pObjShell))
63 ToolBox& rTbx = GetTbxMgr().GetToolBox();
64 // jetzt muessen ein paar Items aus der Toolbox versteckt werden:
68 rTbx.ShowItem(FN_INSERT_FRAME_INTERACT_NOCOL);
69 rTbx.HideItem(FN_INSERT_FRAME_INTERACT);
70 rTbx.HideItem(FN_INSERT_FOOTNOTE);
71 rTbx.HideItem(FN_INSERT_ENDNOTE);
72 rTbx.HideItem(FN_PAGE_STYLE_SET_COLS);
73 rTbx.HideItem(FN_INSERT_IDX_ENTRY_DLG);
76 case FN_INSERT_FIELD_CTRL:
77 rTbx.HideItem(FN_INSERT_FLD_PGNUMBER);
78 rTbx.HideItem(FN_INSERT_FLD_PGCOUNT);
79 rTbx.HideItem(FN_INSERT_FLD_TOPIC);
80 rTbx.HideItem(FN_INSERT_FLD_TITLE);
84 else if( FN_INSERT_CTRL == nId)
86 ToolBox& rTbx = GetTbxMgr().GetToolBox();
87 rTbx.ShowItem(FN_INSERT_FRAME_INTERACT);
88 rTbx.HideItem(FN_INSERT_FRAME_INTERACT_NOCOL);
91 Size aSize = GetTbxMgr().CalcWindowSizePixel();
92 GetTbxMgr().SetPosSizePixel( Point(), aSize );
93 SetOutputSizePixel( aSize );
96 /*************************************************************************
100 \************************************************************************/
102 void SwPopupWindowTbxMgr::StateChanged(USHORT nSID, SfxItemState eState,
103 const SfxPoolItem* pState)
105 static USHORT __READONLY_DATA aInsertCtrl[] =
107 FN_INSERT_FRAME_INTERACT,
110 FN_PAGE_STYLE_SET_COLS,
111 FN_INSERT_IDX_ENTRY_DLG,
114 static USHORT __READONLY_DATA aInsertFld[] =
116 FN_INSERT_FLD_PGNUMBER,
117 FN_INSERT_FLD_PGCOUNT,
123 SfxObjectShell* pObjShell = SfxObjectShell::Current();
124 BOOL bNewWeb = 0 != PTR_CAST(SwWebDocShell, pObjShell);
129 ToolBox& rTbx = GetTbxMgr().GetToolBox();
130 // jetzt muessen ein paar Items aus der Toolbox versteckt werden:
131 const USHORT* pSid = 0;
136 pSid = &aInsertCtrl[0];
138 rTbx.ShowItem(FN_INSERT_FRAME_INTERACT_NOCOL);
140 rTbx.HideItem(FN_INSERT_FRAME_INTERACT_NOCOL);
142 case FN_INSERT_FIELD_CTRL:
143 pSid = & aInsertFld[0];
151 rTbx.HideItem(*pSid);
157 rTbx.ShowItem(*pSid);
160 Size aSize = GetTbxMgr().CalcWindowSizePixel();
161 GetTbxMgr().SetPosSizePixel( Point(), aSize );
162 SetOutputSizePixel( aSize );
166 SfxPopupWindow::StateChanged(nSID, eState, pState);
170 SfxPopupWindow* SwPopupWindowTbxMgr::Clone() const
172 return new SwPopupWindowTbxMgr(
175 // ((SwPopupWindowTbxMgr*)this)->GetTbxMgr().GetToolBox().GetAlign(),
179 // (SfxBindings&)GetBindings()