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: rubydialog.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 ************************************************************************/
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>
41 #ifndef _SV_BUTTON_HXX
42 #include <vcl/button.hxx>
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
{
51 class XSelectionChangeListener
;
57 class RubyPreview
: public Window
60 virtual void Paint( const Rectangle
& rRect
);
61 SvxRubyDialog
& rParentDlg
;
64 RubyPreview(SvxRubyDialog
& rParent
, const ResId
& rResId
);
67 class SVX_DLLPUBLIC SvxRubyChildWindow
: public SfxChildWindow
71 SvxRubyChildWindow( Window
*, USHORT
, SfxBindings
*, SfxChildWinInfo
* );
73 SFX_DECL_CHILDWINDOW( SvxRubyChildWindow
);
76 class SvxRubyData_Impl
;
77 class RubyEdit
: public Edit
81 virtual void GetFocus();
82 virtual long PreNotify( NotifyEvent
& rNEvt
);
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
;
109 RubyEdit
* aEditArr
[8];
112 CheckBox aAutoDetectionCB
;
117 FixedText aPositionFT
;
120 FixedText aCharStyleFT
;
121 ListBox aCharStyleLB
;
122 PushButton aStylistPB
;
124 FixedText aPreviewFT
;
125 RubyPreview aPreviewWin
;
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
);
154 void ClearCharStyleList();
155 void AssertOneEntry();
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 );
194 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
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_