1*96821c26SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*96821c26SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*96821c26SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*96821c26SAndrew Rist * distributed with this work for additional information 6*96821c26SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*96821c26SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*96821c26SAndrew Rist * "License"); you may not use this file except in compliance 9*96821c26SAndrew Rist * with the License. You may obtain a copy of the License at 10*96821c26SAndrew Rist * 11*96821c26SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*96821c26SAndrew Rist * 13*96821c26SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*96821c26SAndrew Rist * software distributed under the License is distributed on an 15*96821c26SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*96821c26SAndrew Rist * KIND, either express or implied. See the License for the 17*96821c26SAndrew Rist * specific language governing permissions and limitations 18*96821c26SAndrew Rist * under the License. 19*96821c26SAndrew Rist * 20*96821c26SAndrew Rist *************************************************************/ 21*96821c26SAndrew Rist 22*96821c26SAndrew Rist 23cdf0e10cSrcweir // 24cdf0e10cSrcweir #ifndef _BASICBOX_HXX 25cdf0e10cSrcweir #define _BASICBOX_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "doceventnotifier.hxx" 28cdf0e10cSrcweir #include <svl/stritem.hxx> 29cdf0e10cSrcweir #include <svheader.hxx> 30cdf0e10cSrcweir #include <sfx2/tbxctrl.hxx> 31cdf0e10cSrcweir #include <vcl/lstbox.hxx> 32cdf0e10cSrcweir 33cdf0e10cSrcweir 34cdf0e10cSrcweir class LibBoxControl: public SfxToolBoxControl 35cdf0e10cSrcweir { 36cdf0e10cSrcweir public: 37cdf0e10cSrcweir SFX_DECL_TOOLBOX_CONTROL(); 38cdf0e10cSrcweir 39cdf0e10cSrcweir LibBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); 40cdf0e10cSrcweir ~LibBoxControl(); 41cdf0e10cSrcweir 42cdf0e10cSrcweir virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, 43cdf0e10cSrcweir const SfxPoolItem* pState ); 44cdf0e10cSrcweir virtual Window* CreateItemWindow( Window *pParent ); 45cdf0e10cSrcweir }; 46cdf0e10cSrcweir 47cdf0e10cSrcweir /** base class for list boxes which need to update their content according to the list 48cdf0e10cSrcweir of open documents 49cdf0e10cSrcweir */ 50cdf0e10cSrcweir class DocListenerBox :public ListBox 51cdf0e10cSrcweir ,public ::basctl::DocumentEventListener 52cdf0e10cSrcweir { 53cdf0e10cSrcweir protected: 54cdf0e10cSrcweir DocListenerBox( Window* pParent ); 55cdf0e10cSrcweir ~DocListenerBox(); 56cdf0e10cSrcweir 57cdf0e10cSrcweir protected: 58cdf0e10cSrcweir virtual void FillBox() = 0; 59cdf0e10cSrcweir 60cdf0e10cSrcweir private: 61cdf0e10cSrcweir // DocumentEventListener 62cdf0e10cSrcweir virtual void onDocumentCreated( const ScriptDocument& _rDocument ); 63cdf0e10cSrcweir virtual void onDocumentOpened( const ScriptDocument& _rDocument ); 64cdf0e10cSrcweir virtual void onDocumentSave( const ScriptDocument& _rDocument ); 65cdf0e10cSrcweir virtual void onDocumentSaveDone( const ScriptDocument& _rDocument ); 66cdf0e10cSrcweir virtual void onDocumentSaveAs( const ScriptDocument& _rDocument ); 67cdf0e10cSrcweir virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument ); 68cdf0e10cSrcweir virtual void onDocumentClosed( const ScriptDocument& _rDocument ); 69cdf0e10cSrcweir virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument ); 70cdf0e10cSrcweir virtual void onDocumentModeChanged( const ScriptDocument& _rDocument ); 71cdf0e10cSrcweir 72cdf0e10cSrcweir private: 73cdf0e10cSrcweir ::basctl::DocumentEventNotifier m_aNotifier; 74cdf0e10cSrcweir }; 75cdf0e10cSrcweir 76cdf0e10cSrcweir // 77cdf0e10cSrcweir 78cdf0e10cSrcweir class BasicLibBox : public DocListenerBox 79cdf0e10cSrcweir { 80cdf0e10cSrcweir private: 81cdf0e10cSrcweir String aCurText; 82cdf0e10cSrcweir sal_Bool bIgnoreSelect; 83cdf0e10cSrcweir sal_Bool bFillBox; 84cdf0e10cSrcweir com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; 85cdf0e10cSrcweir 86cdf0e10cSrcweir void ReleaseFocus(); 87cdf0e10cSrcweir void InsertEntries( const ScriptDocument& rDocument, LibraryLocation eLocation ); 88cdf0e10cSrcweir 89cdf0e10cSrcweir void ClearBox(); 90cdf0e10cSrcweir void NotifyIDE(); 91cdf0e10cSrcweir 92cdf0e10cSrcweir // DocListenerBox 93cdf0e10cSrcweir virtual void FillBox(); 94cdf0e10cSrcweir 95cdf0e10cSrcweir protected: 96cdf0e10cSrcweir virtual void Select(); 97cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 98cdf0e10cSrcweir 99cdf0e10cSrcweir public: 100cdf0e10cSrcweir BasicLibBox( Window* pParent, 101cdf0e10cSrcweir const com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); 102cdf0e10cSrcweir ~BasicLibBox(); 103cdf0e10cSrcweir 104cdf0e10cSrcweir using Window::Update; 105cdf0e10cSrcweir void Update( const SfxStringItem* pItem ); 106cdf0e10cSrcweir }; 107cdf0e10cSrcweir 108cdf0e10cSrcweir class LanguageBoxControl: public SfxToolBoxControl 109cdf0e10cSrcweir { 110cdf0e10cSrcweir public: 111cdf0e10cSrcweir SFX_DECL_TOOLBOX_CONTROL(); 112cdf0e10cSrcweir 113cdf0e10cSrcweir LanguageBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); 114cdf0e10cSrcweir ~LanguageBoxControl(); 115cdf0e10cSrcweir 116cdf0e10cSrcweir virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); 117cdf0e10cSrcweir virtual Window* CreateItemWindow( Window *pParent ); 118cdf0e10cSrcweir }; 119cdf0e10cSrcweir 120cdf0e10cSrcweir class BasicLanguageBox : public DocListenerBox 121cdf0e10cSrcweir { 122cdf0e10cSrcweir private: 123cdf0e10cSrcweir String m_sNotLocalizedStr; 124cdf0e10cSrcweir String m_sDefaultLanguageStr; 125cdf0e10cSrcweir String m_sCurrentText; 126cdf0e10cSrcweir 127cdf0e10cSrcweir bool m_bIgnoreSelect; 128cdf0e10cSrcweir 129cdf0e10cSrcweir void ClearBox(); 130cdf0e10cSrcweir void SetLanguage(); 131cdf0e10cSrcweir 132cdf0e10cSrcweir // DocListenerBox 133cdf0e10cSrcweir virtual void FillBox(); 134cdf0e10cSrcweir 135cdf0e10cSrcweir protected: 136cdf0e10cSrcweir virtual void Select(); 137cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 138cdf0e10cSrcweir 139cdf0e10cSrcweir public: 140cdf0e10cSrcweir BasicLanguageBox( Window* pParent ); 141cdf0e10cSrcweir ~BasicLanguageBox(); 142cdf0e10cSrcweir 143cdf0e10cSrcweir using Window::Update; 144cdf0e10cSrcweir void Update( const SfxStringItem* pItem ); 145cdf0e10cSrcweir }; 146cdf0e10cSrcweir 147cdf0e10cSrcweir #endif // _BASICBOX_HXX 148cdf0e10cSrcweir 149