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 :
21 : #ifndef _SVX_RUBYDLG_HXX_
22 : #define _SVX_RUBYDLG_HXX_
23 :
24 : #include <sfx2/childwin.hxx>
25 : #include <sfx2/basedlgs.hxx>
26 : #include <vcl/lstbox.hxx>
27 : #include <vcl/fixed.hxx>
28 : #include <vcl/button.hxx>
29 : #include <vcl/edit.hxx>
30 : #include <vcl/scrbar.hxx>
31 : #include <com/sun/star/uno/Reference.h>
32 : #include "svx/svxdllapi.h"
33 :
34 : namespace com{namespace sun{namespace star{
35 : namespace view{
36 : class XSelectionChangeListener;
37 : }
38 : }}}
39 :
40 :
41 : class SvxRubyDialog;
42 0 : class RubyPreview : public Window
43 : {
44 : protected:
45 : virtual void Paint( const Rectangle& rRect );
46 : SvxRubyDialog& rParentDlg;
47 :
48 : public:
49 : RubyPreview(SvxRubyDialog& rParent, const ResId& rResId);
50 : };
51 :
52 0 : class SVX_DLLPUBLIC SvxRubyChildWindow : public SfxChildWindow
53 : {
54 : public:
55 :
56 : SvxRubyChildWindow( Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* );
57 :
58 : SFX_DECL_CHILDWINDOW( SvxRubyChildWindow );
59 :
60 : };
61 : class SvxRubyData_Impl;
62 0 : class RubyEdit : public Edit
63 : {
64 : Link aScrollHdl;
65 : Link aJumpHdl;
66 : virtual void GetFocus();
67 : virtual long PreNotify( NotifyEvent& rNEvt );
68 : public:
69 0 : RubyEdit(Window* pParent, const ResId& rResId) :
70 0 : Edit(pParent, rResId){}
71 0 : void SetScrollHdl(Link& rLink) {aScrollHdl = rLink;}
72 0 : void SetJumpHdl(Link& rLink) {aJumpHdl = rLink;}
73 : };
74 :
75 :
76 : class SvxRubyDialog : public SfxModelessDialog
77 : {
78 : using Window::SetText;
79 : using Window::GetText;
80 :
81 : friend class RubyPreview;
82 :
83 : FixedText aLeftFT;
84 : RubyEdit aLeft1ED;
85 : FixedText aRightFT;
86 : RubyEdit aRight1ED;
87 : RubyEdit aLeft2ED;
88 : RubyEdit aRight2ED;
89 : RubyEdit aLeft3ED;
90 : RubyEdit aRight3ED;
91 : RubyEdit aLeft4ED;
92 : RubyEdit aRight4ED;
93 :
94 : RubyEdit* aEditArr[8];
95 : ScrollBar aScrollSB;
96 :
97 : CheckBox aAutoDetectionCB;
98 :
99 : FixedText aAdjustFT;
100 : ListBox aAdjustLB;
101 :
102 : FixedText aPositionFT;
103 : ListBox aPositionLB;
104 :
105 : FixedText aCharStyleFT;
106 : ListBox aCharStyleLB;
107 : PushButton aStylistPB;
108 :
109 : FixedText aPreviewFT;
110 : RubyPreview aPreviewWin;
111 :
112 : OKButton aApplyPB;
113 : PushButton aClosePB;
114 : HelpButton aHelpPB;
115 :
116 : long nLastPos;
117 : long nCurrentEdit;
118 :
119 : sal_Bool bModified;
120 :
121 : com::sun::star::uno::Reference<com::sun::star::view::XSelectionChangeListener> xImpl;
122 : SfxBindings* pBindings;
123 : SvxRubyData_Impl* pImpl;
124 :
125 : DECL_LINK(ApplyHdl_Impl, void *);
126 : DECL_LINK(CloseHdl_Impl, void *);
127 : DECL_LINK(StylistHdl_Impl, void *);
128 : DECL_LINK(AutomaticHdl_Impl, CheckBox*);
129 : DECL_LINK(ScrollHdl_Impl, ScrollBar*);
130 : DECL_LINK(PositionHdl_Impl, ListBox*);
131 : DECL_LINK(AdjustHdl_Impl, ListBox*);
132 : DECL_LINK(CharStyleHdl_Impl, void *);
133 : DECL_LINK(EditModifyHdl_Impl, Edit*);
134 : DECL_LINK(EditScrollHdl_Impl, sal_Int32*);
135 : DECL_LINK(EditJumpHdl_Impl, sal_Int32*);
136 :
137 : void SetText(sal_Int32 nPos, Edit& rLeft, Edit& rRight);
138 : void GetText();
139 : void ClearCharStyleList();
140 : void AssertOneEntry();
141 :
142 : void Update();
143 : virtual sal_Bool Close();
144 :
145 0 : long GetLastPos() const {return nLastPos;}
146 0 : void SetLastPos(long nSet) {nLastPos = nSet;}
147 :
148 0 : sal_Bool IsModified() const {return bModified;}
149 0 : void SetModified(sal_Bool bSet) {bModified = bSet;}
150 :
151 0 : void EnableControls(sal_Bool bEnable)
152 : {
153 0 : aLeftFT.Enable(bEnable);
154 0 : aRightFT.Enable(bEnable);
155 0 : aLeft1ED.Enable(bEnable);
156 0 : aRight1ED.Enable(bEnable);
157 0 : aLeft2ED.Enable(bEnable);
158 0 : aRight2ED.Enable(bEnable);
159 0 : aLeft3ED.Enable(bEnable);
160 0 : aRight3ED.Enable(bEnable);
161 0 : aLeft4ED.Enable(bEnable);
162 0 : aRight4ED.Enable(bEnable);
163 0 : aScrollSB.Enable(bEnable);
164 0 : aAutoDetectionCB.Enable(bEnable);
165 0 : aAdjustFT.Enable(bEnable);
166 0 : aAdjustLB.Enable(bEnable);
167 0 : aCharStyleFT.Enable(bEnable);
168 0 : aCharStyleLB.Enable(bEnable);
169 0 : aStylistPB.Enable(bEnable);
170 0 : aPreviewFT.Enable(bEnable);
171 0 : aPreviewWin.Enable(bEnable);
172 0 : aApplyPB.Enable(bEnable);
173 0 : }
174 :
175 : void GetCurrentText(String& rBase, String& rRuby);
176 :
177 : void UpdateColors( void );
178 : protected:
179 : virtual void DataChanged( const DataChangedEvent& rDCEvt );
180 : public:
181 :
182 : SvxRubyDialog( SfxBindings *pBindings, SfxChildWindow *pCW,
183 : Window* pParent, const ResId& rResId );
184 : virtual ~SvxRubyDialog();
185 :
186 : virtual void Activate();
187 : virtual void Deactivate();
188 : };
189 :
190 : #endif // _SVX_RUBYDLG_HXX_
191 :
192 :
193 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|