lok: Don't attempt to select the exact text after a failed search.
[LibreOffice.git] / basctl / source / basicide / basicbox.hxx
blob3e4cc8045f04bd6eac38b0064b694089b3c2ddde
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_BASCTL_SOURCE_BASICIDE_BASICBOX_HXX
21 #define INCLUDED_BASCTL_SOURCE_BASICIDE_BASICBOX_HXX
23 #include <svl/stritem.hxx>
24 #include <sfx2/tbxctrl.hxx>
25 #include <vcl/lstbox.hxx>
27 namespace basctl
30 class LibBoxControl: public SfxToolBoxControl
32 public:
33 SFX_DECL_TOOLBOX_CONTROL();
35 LibBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
37 virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
38 const SfxPoolItem* pState ) SAL_OVERRIDE;
39 virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
42 /** base class for list boxes which need to update their content according to the list
43 of open documents
45 class DocListenerBox :public ListBox
46 ,public DocumentEventListener
48 protected:
49 DocListenerBox( vcl::Window* pParent );
50 virtual ~DocListenerBox();
51 virtual void dispose() SAL_OVERRIDE;
53 protected:
54 virtual void FillBox() = 0;
56 private:
57 // DocumentEventListener
58 virtual void onDocumentCreated( const ScriptDocument& _rDocument ) SAL_OVERRIDE;
59 virtual void onDocumentOpened( const ScriptDocument& _rDocument ) SAL_OVERRIDE;
60 virtual void onDocumentSave( const ScriptDocument& _rDocument ) SAL_OVERRIDE;
61 virtual void onDocumentSaveDone( const ScriptDocument& _rDocument ) SAL_OVERRIDE;
62 virtual void onDocumentSaveAs( const ScriptDocument& _rDocument ) SAL_OVERRIDE;
63 virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument ) SAL_OVERRIDE;
64 virtual void onDocumentClosed( const ScriptDocument& _rDocument ) SAL_OVERRIDE;
65 virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument ) SAL_OVERRIDE;
66 virtual void onDocumentModeChanged( const ScriptDocument& _rDocument ) SAL_OVERRIDE;
68 private:
69 DocumentEventNotifier m_aNotifier;
74 class LibBox : public DocListenerBox
76 private:
77 OUString aCurText;
78 bool bIgnoreSelect;
79 bool bFillBox;
80 com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
82 static void ReleaseFocus();
83 void InsertEntries( const ScriptDocument& rDocument, LibraryLocation eLocation );
85 void ClearBox();
86 void NotifyIDE();
88 // DocListenerBox
89 virtual void FillBox() SAL_OVERRIDE;
91 protected:
92 virtual void Select() SAL_OVERRIDE;
93 virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
95 public:
96 LibBox( vcl::Window* pParent,
97 const com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
98 virtual ~LibBox();
99 virtual void dispose() SAL_OVERRIDE;
101 using Window::Update;
102 void Update( const SfxStringItem* pItem );
105 class LanguageBoxControl: public SfxToolBoxControl
107 public:
108 SFX_DECL_TOOLBOX_CONTROL();
110 LanguageBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
112 virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE;
113 virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
116 class LanguageBox : public DocListenerBox
118 private:
119 OUString m_sNotLocalizedStr;
120 OUString m_sDefaultLanguageStr;
121 OUString m_sCurrentText;
123 bool m_bIgnoreSelect;
125 void ClearBox();
126 void SetLanguage();
128 // DocListenerBox
129 virtual void FillBox() SAL_OVERRIDE;
131 protected:
132 virtual void Select() SAL_OVERRIDE;
133 virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
135 public:
136 LanguageBox( vcl::Window* pParent );
137 virtual ~LanguageBox();
138 virtual void dispose() SAL_OVERRIDE;
140 using Window::Update;
141 void Update( const SfxStringItem* pItem );
144 } // namespace basctl
146 #endif // INCLUDED_BASCTL_SOURCE_BASICIDE_BASICBOX_HXX
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */