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/layout.hxx>
27 : #include <vcl/lstbox.hxx>
28 : #include <vcl/fixed.hxx>
29 : #include <vcl/button.hxx>
30 : #include <vcl/edit.hxx>
31 : #include <vcl/scrbar.hxx>
32 : #include <com/sun/star/uno/Reference.h>
33 : #include "svx/svxdllapi.h"
34 :
35 : namespace com{namespace sun{namespace star{
36 : namespace view{
37 : class XSelectionChangeListener;
38 : }
39 : }}}
40 :
41 :
42 : class SvxRubyDialog;
43 0 : class RubyPreview : public Window
44 : {
45 : protected:
46 : virtual void Paint( const Rectangle& rRect );
47 : SvxRubyDialog* m_pParentDlg;
48 :
49 : public:
50 : RubyPreview(Window *pParent);
51 0 : void setRubyDialog(SvxRubyDialog* pParentDlg)
52 : {
53 0 : m_pParentDlg = pParentDlg;
54 0 : }
55 : virtual Size GetOptimalSize() const;
56 : };
57 :
58 0 : class SVX_DLLPUBLIC SvxRubyChildWindow : public SfxChildWindow
59 : {
60 : public:
61 :
62 : SvxRubyChildWindow( Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* );
63 :
64 : SFX_DECL_CHILDWINDOW( SvxRubyChildWindow );
65 :
66 : };
67 : class SvxRubyData_Impl;
68 0 : class RubyEdit : public Edit
69 : {
70 : Link aScrollHdl;
71 : Link aJumpHdl;
72 : virtual void GetFocus();
73 : virtual long PreNotify( NotifyEvent& rNEvt );
74 : public:
75 : RubyEdit(Window* pParent, const ResId& rResId)
76 : : Edit(pParent, rResId)
77 : {
78 : }
79 0 : RubyEdit(Window* pParent)
80 0 : : Edit(pParent, WB_BORDER)
81 : {
82 0 : }
83 0 : void SetScrollHdl(Link& rLink) {aScrollHdl = rLink;}
84 0 : void SetJumpHdl(Link& rLink) {aJumpHdl = rLink;}
85 : };
86 :
87 :
88 : class SvxRubyDialog : public SfxModelessDialog
89 : {
90 : using Dialog::SetText;
91 : using Dialog::GetText;
92 :
93 : friend class RubyPreview;
94 :
95 : FixedText* m_pLeftFT;
96 : FixedText* m_pRightFT;
97 : RubyEdit* m_pLeft1ED;
98 : RubyEdit* m_pRight1ED;
99 : RubyEdit* m_pLeft2ED;
100 : RubyEdit* m_pRight2ED;
101 : RubyEdit* m_pLeft3ED;
102 : RubyEdit* m_pRight3ED;
103 : RubyEdit* m_pLeft4ED;
104 : RubyEdit* m_pRight4ED;
105 :
106 : RubyEdit* aEditArr[8];
107 : VclScrolledWindow* m_pScrolledWindow;
108 : ScrollBar* m_pScrollSB;
109 :
110 : ListBox* m_pAdjustLB;
111 :
112 : ListBox* m_pPositionLB;
113 :
114 : FixedText* m_pCharStyleFT;
115 : ListBox* m_pCharStyleLB;
116 : PushButton* m_pStylistPB;
117 :
118 : RubyPreview* m_pPreviewWin;
119 :
120 : PushButton* m_pApplyPB;
121 : PushButton* m_pClosePB;
122 :
123 : long nLastPos;
124 : long nCurrentEdit;
125 :
126 : sal_Bool bModified;
127 :
128 : com::sun::star::uno::Reference<com::sun::star::view::XSelectionChangeListener> xImpl;
129 : SfxBindings* pBindings;
130 : SvxRubyData_Impl* pImpl;
131 :
132 : DECL_LINK(ApplyHdl_Impl, void *);
133 : DECL_LINK(CloseHdl_Impl, void *);
134 : DECL_LINK(StylistHdl_Impl, void *);
135 : DECL_LINK(ScrollHdl_Impl, ScrollBar*);
136 : DECL_LINK(PositionHdl_Impl, ListBox*);
137 : DECL_LINK(AdjustHdl_Impl, ListBox*);
138 : DECL_LINK(CharStyleHdl_Impl, void *);
139 : DECL_LINK(EditModifyHdl_Impl, Edit*);
140 : DECL_LINK(EditScrollHdl_Impl, sal_Int32*);
141 : DECL_LINK(EditJumpHdl_Impl, sal_Int32*);
142 :
143 : void SetText(sal_Int32 nPos, Edit& rLeft, Edit& rRight);
144 : void GetText();
145 : void ClearCharStyleList();
146 : void AssertOneEntry();
147 :
148 : void Update();
149 : virtual sal_Bool Close();
150 :
151 0 : long GetLastPos() const {return nLastPos;}
152 0 : void SetLastPos(long nSet) {nLastPos = nSet;}
153 :
154 0 : sal_Bool IsModified() const {return bModified;}
155 0 : void SetModified(sal_Bool bSet) {bModified = bSet;}
156 :
157 : void EnableControls(bool bEnable);
158 :
159 : void GetCurrentText(String& rBase, String& rRuby);
160 :
161 : void UpdateColors( void );
162 : protected:
163 : virtual void DataChanged( const DataChangedEvent& rDCEvt );
164 : public:
165 :
166 : SvxRubyDialog(SfxBindings *pBindings, SfxChildWindow *pCW,
167 : Window* pParent);
168 : virtual ~SvxRubyDialog();
169 :
170 : virtual void Activate();
171 : virtual void Deactivate();
172 : };
173 :
174 : #endif // _SVX_RUBYDLG_HXX_
175 :
176 :
177 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|