Update ooo320-m1
[ooovba.git] / svx / inc / rubydialog.hxx
bloba36c82189d0099de297a5c73afe0b9ed5792ae62
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: rubydialog.hxx,v $
10 * $Revision: 1.15 $
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 ************************************************************************/
32 #ifndef _SVX_RUBYDLG_HXX_
33 #define _SVX_RUBYDLG_HXX_
35 #include <sfx2/childwin.hxx>
36 #include <sfx2/basedlgs.hxx>
37 #include <vcl/lstbox.hxx>
38 #ifndef _FIXED_HXX //autogen
39 #include <vcl/fixed.hxx>
40 #endif
41 #ifndef _SV_BUTTON_HXX
42 #include <vcl/button.hxx>
43 #endif
44 #include <vcl/edit.hxx>
45 #include <vcl/scrbar.hxx>
46 #include <com/sun/star/uno/Reference.h>
47 #include "svx/svxdllapi.h"
49 namespace com{namespace sun{namespace star{
50 namespace view{
51 class XSelectionChangeListener;
53 }}}
56 class SvxRubyDialog;
57 class RubyPreview : public Window
59 protected:
60 virtual void Paint( const Rectangle& rRect );
61 SvxRubyDialog& rParentDlg;
63 public:
64 RubyPreview(SvxRubyDialog& rParent, const ResId& rResId);
67 class SVX_DLLPUBLIC SvxRubyChildWindow : public SfxChildWindow
69 public:
71 SvxRubyChildWindow( Window*, USHORT, SfxBindings*, SfxChildWinInfo* );
73 SFX_DECL_CHILDWINDOW( SvxRubyChildWindow );
76 class SvxRubyData_Impl;
77 class RubyEdit : public Edit
79 Link aScrollHdl;
80 Link aJumpHdl;
81 virtual void GetFocus();
82 virtual long PreNotify( NotifyEvent& rNEvt );
83 public:
84 RubyEdit(Window* pParent, const ResId& rResId) :
85 Edit(pParent, rResId){}
86 void SetScrollHdl(Link& rLink) {aScrollHdl = rLink;}
87 void SetJumpHdl(Link& rLink) {aJumpHdl = rLink;}
91 class SvxRubyDialog : public SfxModelessDialog
93 using Window::SetText;
94 using Window::GetText;
96 friend class RubyPreview;
98 FixedText aLeftFT;
99 RubyEdit aLeft1ED;
100 FixedText aRightFT;
101 RubyEdit aRight1ED;
102 RubyEdit aLeft2ED;
103 RubyEdit aRight2ED;
104 RubyEdit aLeft3ED;
105 RubyEdit aRight3ED;
106 RubyEdit aLeft4ED;
107 RubyEdit aRight4ED;
109 RubyEdit* aEditArr[8];
110 ScrollBar aScrollSB;
112 CheckBox aAutoDetectionCB;
114 FixedText aAdjustFT;
115 ListBox aAdjustLB;
117 FixedText aPositionFT;
118 ListBox aPositionLB;
120 FixedText aCharStyleFT;
121 ListBox aCharStyleLB;
122 PushButton aStylistPB;
124 FixedText aPreviewFT;
125 RubyPreview aPreviewWin;
127 OKButton aApplyPB;
128 PushButton aClosePB;
129 HelpButton aHelpPB;
131 long nLastPos;
132 long nCurrentEdit;
134 BOOL bModified;
136 com::sun::star::uno::Reference<com::sun::star::view::XSelectionChangeListener> xImpl;
137 SfxBindings* pBindings;
138 SvxRubyData_Impl* pImpl;
140 DECL_LINK(ApplyHdl_Impl, PushButton*);
141 DECL_LINK(CloseHdl_Impl, PushButton*);
142 DECL_LINK(StylistHdl_Impl, PushButton*);
143 DECL_LINK(AutomaticHdl_Impl, CheckBox*);
144 DECL_LINK(ScrollHdl_Impl, ScrollBar*);
145 DECL_LINK(PositionHdl_Impl, ListBox*);
146 DECL_LINK(AdjustHdl_Impl, ListBox*);
147 DECL_LINK(CharStyleHdl_Impl, ListBox*);
148 DECL_LINK(EditModifyHdl_Impl, Edit*);
149 DECL_LINK(EditScrollHdl_Impl, sal_Int32*);
150 DECL_LINK(EditJumpHdl_Impl, sal_Int32*);
152 void SetText(sal_Int32 nPos, Edit& rLeft, Edit& rRight);
153 void GetText();
154 void ClearCharStyleList();
155 void AssertOneEntry();
157 void Update();
158 virtual BOOL Close();
160 long GetLastPos() const {return nLastPos;}
161 void SetLastPos(long nSet) {nLastPos = nSet;}
163 BOOL IsModified() const {return bModified;}
164 void SetModified(BOOL bSet) {bModified = bSet;}
166 void EnableControls(sal_Bool bEnable)
168 aLeftFT.Enable(bEnable);
169 aRightFT.Enable(bEnable);
170 aLeft1ED.Enable(bEnable);
171 aRight1ED.Enable(bEnable);
172 aLeft2ED.Enable(bEnable);
173 aRight2ED.Enable(bEnable);
174 aLeft3ED.Enable(bEnable);
175 aRight3ED.Enable(bEnable);
176 aLeft4ED.Enable(bEnable);
177 aRight4ED.Enable(bEnable);
178 aScrollSB.Enable(bEnable);
179 aAutoDetectionCB.Enable(bEnable);
180 aAdjustFT.Enable(bEnable);
181 aAdjustLB.Enable(bEnable);
182 aCharStyleFT.Enable(bEnable);
183 aCharStyleLB.Enable(bEnable);
184 aStylistPB.Enable(bEnable);
185 aPreviewFT.Enable(bEnable);
186 aPreviewWin.Enable(bEnable);
187 aApplyPB.Enable(bEnable);
190 void GetCurrentText(String& rBase, String& rRuby);
192 void UpdateColors( void );
193 protected:
194 virtual void DataChanged( const DataChangedEvent& rDCEvt );
195 public:
197 SvxRubyDialog( SfxBindings *pBindings, SfxChildWindow *pCW,
198 Window* pParent, const ResId& rResId );
199 virtual ~SvxRubyDialog();
201 virtual void Activate();
202 virtual void Deactivate();
205 #endif // _SVX_RUBYDLG_HXX_