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 INCLUDED_SVX_RUBYDIALOG_HXX
22 : #define INCLUDED_SVX_RUBYDIALOG_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 ) SAL_OVERRIDE;
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 SAL_OVERRIDE;
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() SAL_OVERRIDE;
73 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
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 : friend class RubyPreview;
91 :
92 : FixedText* m_pLeftFT;
93 : FixedText* m_pRightFT;
94 : RubyEdit* m_pLeft1ED;
95 : RubyEdit* m_pRight1ED;
96 : RubyEdit* m_pLeft2ED;
97 : RubyEdit* m_pRight2ED;
98 : RubyEdit* m_pLeft3ED;
99 : RubyEdit* m_pRight3ED;
100 : RubyEdit* m_pLeft4ED;
101 : RubyEdit* m_pRight4ED;
102 :
103 : RubyEdit* aEditArr[8];
104 : VclScrolledWindow* m_pScrolledWindow;
105 : ScrollBar* m_pScrollSB;
106 :
107 : ListBox* m_pAdjustLB;
108 :
109 : ListBox* m_pPositionLB;
110 :
111 : FixedText* m_pCharStyleFT;
112 : ListBox* m_pCharStyleLB;
113 : PushButton* m_pStylistPB;
114 :
115 : RubyPreview* m_pPreviewWin;
116 :
117 : PushButton* m_pApplyPB;
118 : PushButton* m_pClosePB;
119 :
120 : long nLastPos;
121 : long nCurrentEdit;
122 :
123 : bool bModified;
124 :
125 : com::sun::star::uno::Reference<com::sun::star::view::XSelectionChangeListener> xImpl;
126 : SfxBindings* pBindings;
127 : SvxRubyData_Impl* pImpl;
128 :
129 : DECL_LINK(ApplyHdl_Impl, void *);
130 : DECL_LINK(CloseHdl_Impl, void *);
131 : DECL_LINK(StylistHdl_Impl, void *);
132 : DECL_LINK(ScrollHdl_Impl, ScrollBar*);
133 : DECL_LINK(PositionHdl_Impl, ListBox*);
134 : DECL_LINK(AdjustHdl_Impl, ListBox*);
135 : DECL_LINK(CharStyleHdl_Impl, void *);
136 : DECL_LINK(EditModifyHdl_Impl, Edit*);
137 : DECL_LINK(EditScrollHdl_Impl, sal_Int32*);
138 : DECL_LINK(EditJumpHdl_Impl, sal_Int32*);
139 :
140 : void SetRubyText(sal_Int32 nPos, Edit& rLeft, Edit& rRight);
141 : void GetRubyText();
142 : void ClearCharStyleList();
143 : void AssertOneEntry();
144 :
145 : void Update();
146 : virtual bool Close() SAL_OVERRIDE;
147 :
148 0 : long GetLastPos() const {return nLastPos;}
149 0 : void SetLastPos(long nSet) {nLastPos = nSet;}
150 :
151 0 : bool IsModified() const {return bModified;}
152 0 : void SetModified(bool bSet) {bModified = bSet;}
153 :
154 : void EnableControls(bool bEnable);
155 :
156 : void GetCurrentText(OUString& rBase, OUString& rRuby);
157 :
158 : void UpdateColors( void );
159 : protected:
160 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
161 : public:
162 :
163 : SvxRubyDialog(SfxBindings *pBindings, SfxChildWindow *pCW,
164 : Window* pParent);
165 : virtual ~SvxRubyDialog();
166 :
167 : virtual void Activate() SAL_OVERRIDE;
168 : virtual void Deactivate() SAL_OVERRIDE;
169 : };
170 :
171 : #endif // INCLUDED_SVX_RUBYDIALOG_HXX
172 :
173 :
174 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|