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