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: basicbox.hxx,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 ************************************************************************/
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
44 SFX_DECL_TOOLBOX_CONTROL();
46 LibBoxControl( USHORT nSlotId
, USHORT nId
, ToolBox
& rTbx
);
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
57 class DocListenerBox
:public ListBox
58 ,public ::basctl::DocumentEventListener
61 DocListenerBox( Window
* pParent
);
65 virtual void FillBox() = 0;
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
);
80 ::basctl::DocumentEventNotifier m_aNotifier
;
85 class BasicLibBox
: public DocListenerBox
91 com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
> m_xFrame
;
94 void InsertEntries( const ScriptDocument
& rDocument
, LibraryLocation eLocation
);
100 virtual void FillBox();
103 virtual void Select();
104 virtual long PreNotify( NotifyEvent
& rNEvt
);
107 BasicLibBox( Window
* pParent
,
108 const com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& rFrame
);
111 using Window::Update
;
112 void Update( const SfxStringItem
* pItem
);
115 class LanguageBoxControl
: public SfxToolBoxControl
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
130 String m_sNotLocalizedStr
;
131 String m_sDefaultLanguageStr
;
132 String m_sCurrentText
;
134 bool m_bIgnoreSelect
;
140 virtual void FillBox();
143 virtual void Select();
144 virtual long PreNotify( NotifyEvent
& rNEvt
);
147 BasicLanguageBox( Window
* pParent
);
150 using Window::Update
;
151 void Update( const SfxStringItem
* pItem
);
154 #endif // _BASICBOX_HXX