xref: /aoo41x/main/svx/inc/svx/rubydialog.hxx (revision 3334a7e6)
1*3334a7e6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*3334a7e6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*3334a7e6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*3334a7e6SAndrew Rist  * distributed with this work for additional information
6*3334a7e6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*3334a7e6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*3334a7e6SAndrew Rist  * "License"); you may not use this file except in compliance
9*3334a7e6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*3334a7e6SAndrew Rist  *
11*3334a7e6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*3334a7e6SAndrew Rist  *
13*3334a7e6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*3334a7e6SAndrew Rist  * software distributed under the License is distributed on an
15*3334a7e6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*3334a7e6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*3334a7e6SAndrew Rist  * specific language governing permissions and limitations
18*3334a7e6SAndrew Rist  * under the License.
19*3334a7e6SAndrew Rist  *
20*3334a7e6SAndrew Rist  *************************************************************/
21*3334a7e6SAndrew Rist 
22*3334a7e6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #ifndef _SVX_RUBYDLG_HXX_
26cdf0e10cSrcweir #define _SVX_RUBYDLG_HXX_
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <sfx2/childwin.hxx>
29cdf0e10cSrcweir #include <sfx2/basedlgs.hxx>
30cdf0e10cSrcweir #include <vcl/lstbox.hxx>
31cdf0e10cSrcweir #ifndef _FIXED_HXX //autogen
32cdf0e10cSrcweir #include <vcl/fixed.hxx>
33cdf0e10cSrcweir #endif
34cdf0e10cSrcweir #ifndef _SV_BUTTON_HXX
35cdf0e10cSrcweir #include <vcl/button.hxx>
36cdf0e10cSrcweir #endif
37cdf0e10cSrcweir #include <vcl/edit.hxx>
38cdf0e10cSrcweir #include <vcl/scrbar.hxx>
39cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h>
40cdf0e10cSrcweir #include "svx/svxdllapi.h"
41cdf0e10cSrcweir 
42cdf0e10cSrcweir namespace com{namespace sun{namespace star{
43cdf0e10cSrcweir     namespace view{
44cdf0e10cSrcweir         class XSelectionChangeListener;
45cdf0e10cSrcweir 	}
46cdf0e10cSrcweir }}}
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 
49cdf0e10cSrcweir class SvxRubyDialog;
50cdf0e10cSrcweir class RubyPreview : public Window
51cdf0e10cSrcweir {
52cdf0e10cSrcweir protected:
53cdf0e10cSrcweir 	virtual void Paint( const Rectangle& rRect );
54cdf0e10cSrcweir 	SvxRubyDialog&	rParentDlg;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir public:
57cdf0e10cSrcweir 	RubyPreview(SvxRubyDialog& rParent, const ResId& rResId);
58cdf0e10cSrcweir };
59cdf0e10cSrcweir 
60cdf0e10cSrcweir class SVX_DLLPUBLIC SvxRubyChildWindow : public SfxChildWindow
61cdf0e10cSrcweir {
62cdf0e10cSrcweir  public:
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 	SvxRubyChildWindow( Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* );
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 	SFX_DECL_CHILDWINDOW( SvxRubyChildWindow );
67cdf0e10cSrcweir 
68cdf0e10cSrcweir };
69cdf0e10cSrcweir class SvxRubyData_Impl;
70cdf0e10cSrcweir class RubyEdit	: public Edit
71cdf0e10cSrcweir {
72cdf0e10cSrcweir     Link    aScrollHdl;
73cdf0e10cSrcweir     Link    aJumpHdl;
74cdf0e10cSrcweir     virtual void        GetFocus();
75cdf0e10cSrcweir     virtual long        PreNotify( NotifyEvent& rNEvt );
76cdf0e10cSrcweir public:
RubyEdit(Window * pParent,const ResId & rResId)77cdf0e10cSrcweir 	RubyEdit(Window* pParent, const ResId& rResId) :
78cdf0e10cSrcweir 		Edit(pParent, rResId){}
SetScrollHdl(Link & rLink)79cdf0e10cSrcweir     void    SetScrollHdl(Link& rLink) {aScrollHdl = rLink;}
SetJumpHdl(Link & rLink)80cdf0e10cSrcweir     void    SetJumpHdl(Link& rLink) {aJumpHdl = rLink;}
81cdf0e10cSrcweir };
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 
84cdf0e10cSrcweir class SvxRubyDialog : public SfxModelessDialog
85cdf0e10cSrcweir {
86cdf0e10cSrcweir 	using Window::SetText;
87cdf0e10cSrcweir 	using Window::GetText;
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 	friend class RubyPreview;
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     FixedText               aLeftFT;
92cdf0e10cSrcweir     RubyEdit                aLeft1ED;
93cdf0e10cSrcweir     FixedText               aRightFT;
94cdf0e10cSrcweir     RubyEdit                aRight1ED;
95cdf0e10cSrcweir 	RubyEdit				aLeft2ED;
96cdf0e10cSrcweir 	RubyEdit				aRight2ED;
97cdf0e10cSrcweir 	RubyEdit				aLeft3ED;
98cdf0e10cSrcweir 	RubyEdit				aRight3ED;
99cdf0e10cSrcweir 	RubyEdit				aLeft4ED;
100cdf0e10cSrcweir 	RubyEdit				aRight4ED;
101cdf0e10cSrcweir 
102cdf0e10cSrcweir     RubyEdit*               aEditArr[8];
103cdf0e10cSrcweir 	ScrollBar			aScrollSB;
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 	CheckBox			aAutoDetectionCB;
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 	FixedText			aAdjustFT;
108cdf0e10cSrcweir 	ListBox				aAdjustLB;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     FixedText           aPositionFT;
111cdf0e10cSrcweir     ListBox             aPositionLB;
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     FixedText           aCharStyleFT;
114cdf0e10cSrcweir 	ListBox				aCharStyleLB;
115cdf0e10cSrcweir 	PushButton			aStylistPB;
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	FixedText			aPreviewFT;
118cdf0e10cSrcweir 	RubyPreview			aPreviewWin;
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 	OKButton 			aApplyPB;
121cdf0e10cSrcweir 	PushButton 			aClosePB;
122cdf0e10cSrcweir 	HelpButton 			aHelpPB;
123cdf0e10cSrcweir 
124cdf0e10cSrcweir 	long 				nLastPos;
125cdf0e10cSrcweir 	long 				nCurrentEdit;
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 	sal_Bool				bModified;
128cdf0e10cSrcweir 
129cdf0e10cSrcweir     com::sun::star::uno::Reference<com::sun::star::view::XSelectionChangeListener> xImpl;
130cdf0e10cSrcweir     SfxBindings*    pBindings;
131cdf0e10cSrcweir 	SvxRubyData_Impl* pImpl;
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 	DECL_LINK(ApplyHdl_Impl, PushButton*);
134cdf0e10cSrcweir 	DECL_LINK(CloseHdl_Impl, PushButton*);
135cdf0e10cSrcweir 	DECL_LINK(StylistHdl_Impl, PushButton*);
136cdf0e10cSrcweir 	DECL_LINK(AutomaticHdl_Impl, CheckBox*);
137cdf0e10cSrcweir 	DECL_LINK(ScrollHdl_Impl, ScrollBar*);
138cdf0e10cSrcweir     DECL_LINK(PositionHdl_Impl, ListBox*);
139cdf0e10cSrcweir     DECL_LINK(AdjustHdl_Impl, ListBox*);
140cdf0e10cSrcweir 	DECL_LINK(CharStyleHdl_Impl, ListBox*);
141cdf0e10cSrcweir 	DECL_LINK(EditModifyHdl_Impl, Edit*);
142cdf0e10cSrcweir     DECL_LINK(EditScrollHdl_Impl, sal_Int32*);
143cdf0e10cSrcweir     DECL_LINK(EditJumpHdl_Impl, sal_Int32*);
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 	void 				SetText(sal_Int32 nPos, Edit& rLeft, Edit& rRight);
146cdf0e10cSrcweir 	void 				GetText();
147cdf0e10cSrcweir 	void 				ClearCharStyleList();
148cdf0e10cSrcweir     void                AssertOneEntry();
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 	void				Update();
151cdf0e10cSrcweir 	virtual sal_Bool 		Close();
152cdf0e10cSrcweir 
GetLastPos() const153cdf0e10cSrcweir 	long 				GetLastPos() const {return nLastPos;}
SetLastPos(long nSet)154cdf0e10cSrcweir 	void				SetLastPos(long nSet) {nLastPos = nSet;}
155cdf0e10cSrcweir 
IsModified() const156cdf0e10cSrcweir 	sal_Bool 				IsModified() const {return bModified;}
SetModified(sal_Bool bSet)157cdf0e10cSrcweir 	void				SetModified(sal_Bool bSet) {bModified = bSet;}
158cdf0e10cSrcweir 
EnableControls(sal_Bool bEnable)159cdf0e10cSrcweir 	void EnableControls(sal_Bool bEnable)
160cdf0e10cSrcweir 		{
161cdf0e10cSrcweir             aLeftFT.Enable(bEnable);
162cdf0e10cSrcweir             aRightFT.Enable(bEnable);
163cdf0e10cSrcweir             aLeft1ED.Enable(bEnable);
164cdf0e10cSrcweir 			aRight1ED.Enable(bEnable);
165cdf0e10cSrcweir 			aLeft2ED.Enable(bEnable);
166cdf0e10cSrcweir 			aRight2ED.Enable(bEnable);
167cdf0e10cSrcweir 			aLeft3ED.Enable(bEnable);
168cdf0e10cSrcweir 			aRight3ED.Enable(bEnable);
169cdf0e10cSrcweir 			aLeft4ED.Enable(bEnable);
170cdf0e10cSrcweir 			aRight4ED.Enable(bEnable);
171cdf0e10cSrcweir 			aScrollSB.Enable(bEnable);
172cdf0e10cSrcweir 			aAutoDetectionCB.Enable(bEnable);
173cdf0e10cSrcweir 			aAdjustFT.Enable(bEnable);
174cdf0e10cSrcweir 			aAdjustLB.Enable(bEnable);
175cdf0e10cSrcweir 			aCharStyleFT.Enable(bEnable);
176cdf0e10cSrcweir 			aCharStyleLB.Enable(bEnable);
177cdf0e10cSrcweir 			aStylistPB.Enable(bEnable);
178cdf0e10cSrcweir 			aPreviewFT.Enable(bEnable);
179cdf0e10cSrcweir 			aPreviewWin.Enable(bEnable);
180cdf0e10cSrcweir 			aApplyPB.Enable(bEnable);
181cdf0e10cSrcweir 		}
182cdf0e10cSrcweir 
183cdf0e10cSrcweir 	void				GetCurrentText(String& rBase, String& rRuby);
184cdf0e10cSrcweir 
185cdf0e10cSrcweir 	void				UpdateColors( void );
186cdf0e10cSrcweir protected:
187cdf0e10cSrcweir 	virtual void		DataChanged( const DataChangedEvent& rDCEvt );
188cdf0e10cSrcweir public:
189cdf0e10cSrcweir 
190cdf0e10cSrcweir 						SvxRubyDialog( SfxBindings *pBindings, SfxChildWindow *pCW,
191cdf0e10cSrcweir 									Window* pParent, const ResId& rResId );
192cdf0e10cSrcweir 	virtual				~SvxRubyDialog();
193cdf0e10cSrcweir 
194cdf0e10cSrcweir 	virtual void		Activate();
195cdf0e10cSrcweir 	virtual void		Deactivate();
196cdf0e10cSrcweir };
197cdf0e10cSrcweir 
198cdf0e10cSrcweir #endif // _SVX_RUBYDLG_HXX_
199cdf0e10cSrcweir 
200cdf0e10cSrcweir 
201