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