merge the formfield patch from ooo-build
[ooovba.git] / basctl / source / basicide / basicbox.hxx
blob09ec340a2d5760e4a085a209fd59a7ec38f66971
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: basicbox.hxx,v $
10 * $Revision: 1.10 $
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 #ifndef _BASICBOX_HXX
32 #define _BASICBOX_HXX
34 #include "doceventnotifier.hxx"
35 #include <svtools/stritem.hxx>
36 #include <svheader.hxx>
37 #include <sfx2/tbxctrl.hxx>
38 #include <vcl/lstbox.hxx>
41 class LibBoxControl: public SfxToolBoxControl
43 public:
44 SFX_DECL_TOOLBOX_CONTROL();
46 LibBoxControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx );
47 ~LibBoxControl();
49 virtual void StateChanged( USHORT nSID, SfxItemState eState,
50 const SfxPoolItem* pState );
51 virtual Window* CreateItemWindow( Window *pParent );
54 /** base class for list boxes which need to update their content according to the list
55 of open documents
57 class DocListenerBox :public ListBox
58 ,public ::basctl::DocumentEventListener
60 protected:
61 DocListenerBox( Window* pParent );
62 ~DocListenerBox();
64 protected:
65 virtual void FillBox() = 0;
67 private:
68 // DocumentEventListener
69 virtual void onDocumentCreated( const ScriptDocument& _rDocument );
70 virtual void onDocumentOpened( const ScriptDocument& _rDocument );
71 virtual void onDocumentSave( const ScriptDocument& _rDocument );
72 virtual void onDocumentSaveDone( const ScriptDocument& _rDocument );
73 virtual void onDocumentSaveAs( const ScriptDocument& _rDocument );
74 virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument );
75 virtual void onDocumentClosed( const ScriptDocument& _rDocument );
76 virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument );
77 virtual void onDocumentModeChanged( const ScriptDocument& _rDocument );
79 private:
80 ::basctl::DocumentEventNotifier m_aNotifier;
85 class BasicLibBox : public DocListenerBox
87 private:
88 String aCurText;
89 BOOL bIgnoreSelect;
90 BOOL bFillBox;
91 com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
93 void ReleaseFocus();
94 void InsertEntries( const ScriptDocument& rDocument, LibraryLocation eLocation );
96 void ClearBox();
97 void NotifyIDE();
99 // DocListenerBox
100 virtual void FillBox();
102 protected:
103 virtual void Select();
104 virtual long PreNotify( NotifyEvent& rNEvt );
106 public:
107 BasicLibBox( Window* pParent,
108 const com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
109 ~BasicLibBox();
111 using Window::Update;
112 void Update( const SfxStringItem* pItem );
115 class LanguageBoxControl: public SfxToolBoxControl
117 public:
118 SFX_DECL_TOOLBOX_CONTROL();
120 LanguageBoxControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx );
121 ~LanguageBoxControl();
123 virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState );
124 virtual Window* CreateItemWindow( Window *pParent );
127 class BasicLanguageBox : public DocListenerBox
129 private:
130 String m_sNotLocalizedStr;
131 String m_sDefaultLanguageStr;
132 String m_sCurrentText;
134 bool m_bIgnoreSelect;
136 void ClearBox();
137 void SetLanguage();
139 // DocListenerBox
140 virtual void FillBox();
142 protected:
143 virtual void Select();
144 virtual long PreNotify( NotifyEvent& rNEvt );
146 public:
147 BasicLanguageBox( Window* pParent );
148 ~BasicLanguageBox();
150 using Window::Update;
151 void Update( const SfxStringItem* pItem );
154 #endif // _BASICBOX_HXX