Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_BASCTL_SOURCE_BASICIDE_BASICBOX_HXX
21 : #define INCLUDED_BASCTL_SOURCE_BASICIDE_BASICBOX_HXX
22 :
23 : #include <svl/stritem.hxx>
24 : #include <sfx2/tbxctrl.hxx>
25 : #include <vcl/lstbox.hxx>
26 :
27 : namespace basctl
28 : {
29 :
30 0 : class LibBoxControl: public SfxToolBoxControl
31 : {
32 : public:
33 : SFX_DECL_TOOLBOX_CONTROL();
34 :
35 : LibBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
36 :
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;
40 : };
41 :
42 : /** base class for list boxes which need to update their content according to the list
43 : of open documents
44 : */
45 : class DocListenerBox :public ListBox
46 : ,public DocumentEventListener
47 : {
48 : protected:
49 : DocListenerBox( vcl::Window* pParent );
50 : virtual ~DocListenerBox();
51 : virtual void dispose() SAL_OVERRIDE;
52 :
53 : protected:
54 : virtual void FillBox() = 0;
55 :
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;
67 :
68 : private:
69 : DocumentEventNotifier m_aNotifier;
70 : };
71 :
72 :
73 :
74 : class LibBox : public DocListenerBox
75 : {
76 : private:
77 : OUString aCurText;
78 : bool bIgnoreSelect;
79 : bool bFillBox;
80 : com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
81 :
82 : static void ReleaseFocus();
83 : void InsertEntries( const ScriptDocument& rDocument, LibraryLocation eLocation );
84 :
85 : void ClearBox();
86 : void NotifyIDE();
87 :
88 : // DocListenerBox
89 : virtual void FillBox() SAL_OVERRIDE;
90 :
91 : protected:
92 : virtual void Select() SAL_OVERRIDE;
93 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
94 :
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;
100 :
101 : using Window::Update;
102 : void Update( const SfxStringItem* pItem );
103 : };
104 :
105 0 : class LanguageBoxControl: public SfxToolBoxControl
106 : {
107 : public:
108 : SFX_DECL_TOOLBOX_CONTROL();
109 :
110 : LanguageBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
111 :
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;
114 : };
115 :
116 : class LanguageBox : public DocListenerBox
117 : {
118 : private:
119 : OUString m_sNotLocalizedStr;
120 : OUString m_sDefaultLanguageStr;
121 : OUString m_sCurrentText;
122 :
123 : bool m_bIgnoreSelect;
124 :
125 : void ClearBox();
126 : void SetLanguage();
127 :
128 : // DocListenerBox
129 : virtual void FillBox() SAL_OVERRIDE;
130 :
131 : protected:
132 : virtual void Select() SAL_OVERRIDE;
133 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
134 :
135 : public:
136 : LanguageBox( vcl::Window* pParent );
137 : virtual ~LanguageBox();
138 : virtual void dispose() SAL_OVERRIDE;
139 :
140 : using Window::Update;
141 : void Update( const SfxStringItem* pItem );
142 : };
143 :
144 : } // namespace basctl
145 :
146 : #endif // INCLUDED_BASCTL_SOURCE_BASICIDE_BASICBOX_HXX
147 :
148 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|