1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #ifndef INCLUDED_SVX_RUBYDIALOG_HXX
22 #define INCLUDED_SVX_RUBYDIALOG_HXX
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>
35 namespace com
{namespace sun
{namespace star
{
37 class XSelectionChangeListener
;
43 class RubyPreview
: public Window
46 virtual void Paint( const Rectangle
& rRect
);
47 SvxRubyDialog
* m_pParentDlg
;
50 RubyPreview(Window
*pParent
);
51 void setRubyDialog(SvxRubyDialog
* pParentDlg
)
53 m_pParentDlg
= pParentDlg
;
55 virtual Size
GetOptimalSize() const;
58 class SVX_DLLPUBLIC SvxRubyChildWindow
: public SfxChildWindow
62 SvxRubyChildWindow( Window
*, sal_uInt16
, SfxBindings
*, SfxChildWinInfo
* );
64 SFX_DECL_CHILDWINDOW( SvxRubyChildWindow
);
67 class SvxRubyData_Impl
;
68 class RubyEdit
: public Edit
72 virtual void GetFocus();
73 virtual long PreNotify( NotifyEvent
& rNEvt
);
75 RubyEdit(Window
* pParent
, const ResId
& rResId
)
76 : Edit(pParent
, rResId
)
79 RubyEdit(Window
* pParent
)
80 : Edit(pParent
, WB_BORDER
)
83 void SetScrollHdl(Link
& rLink
) {aScrollHdl
= rLink
;}
84 void SetJumpHdl(Link
& rLink
) {aJumpHdl
= rLink
;}
88 class SvxRubyDialog
: public SfxModelessDialog
90 using Dialog::SetText
;
91 using Dialog::GetText
;
93 friend class RubyPreview
;
96 FixedText
* m_pRightFT
;
98 RubyEdit
* m_pRight1ED
;
100 RubyEdit
* m_pRight2ED
;
101 RubyEdit
* m_pLeft3ED
;
102 RubyEdit
* m_pRight3ED
;
103 RubyEdit
* m_pLeft4ED
;
104 RubyEdit
* m_pRight4ED
;
106 RubyEdit
* aEditArr
[8];
107 VclScrolledWindow
* m_pScrolledWindow
;
108 ScrollBar
* m_pScrollSB
;
110 ListBox
* m_pAdjustLB
;
112 ListBox
* m_pPositionLB
;
114 FixedText
* m_pCharStyleFT
;
115 ListBox
* m_pCharStyleLB
;
116 PushButton
* m_pStylistPB
;
118 RubyPreview
* m_pPreviewWin
;
120 PushButton
* m_pApplyPB
;
121 PushButton
* m_pClosePB
;
128 com::sun::star::uno::Reference
<com::sun::star::view::XSelectionChangeListener
> xImpl
;
129 SfxBindings
* pBindings
;
130 SvxRubyData_Impl
* pImpl
;
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
*);
143 void SetText(sal_Int32 nPos
, Edit
& rLeft
, Edit
& rRight
);
145 void ClearCharStyleList();
146 void AssertOneEntry();
149 virtual sal_Bool
Close();
151 long GetLastPos() const {return nLastPos
;}
152 void SetLastPos(long nSet
) {nLastPos
= nSet
;}
154 sal_Bool
IsModified() const {return bModified
;}
155 void SetModified(sal_Bool bSet
) {bModified
= bSet
;}
157 void EnableControls(bool bEnable
);
159 void GetCurrentText(OUString
& rBase
, OUString
& rRuby
);
161 void UpdateColors( void );
163 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
166 SvxRubyDialog(SfxBindings
*pBindings
, SfxChildWindow
*pCW
,
168 virtual ~SvxRubyDialog();
170 virtual void Activate();
171 virtual void Deactivate();
174 #endif // INCLUDED_SVX_RUBYDIALOG_HXX
177 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */