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 vcl::Window
46 virtual void Paint(vcl::RenderContext
& rRenderContext
, const Rectangle
& rRect
) SAL_OVERRIDE
;
47 VclPtr
<SvxRubyDialog
> m_pParentDlg
;
50 RubyPreview(vcl::Window
*pParent
);
51 virtual ~RubyPreview();
52 virtual void dispose() SAL_OVERRIDE
;
53 void setRubyDialog(SvxRubyDialog
* pParentDlg
)
55 m_pParentDlg
= pParentDlg
;
57 virtual Size
GetOptimalSize() const SAL_OVERRIDE
;
60 class SVX_DLLPUBLIC SvxRubyChildWindow
: public SfxChildWindow
64 SvxRubyChildWindow( vcl::Window
*, sal_uInt16
, SfxBindings
*, SfxChildWinInfo
* );
66 SFX_DECL_CHILDWINDOW( SvxRubyChildWindow
);
69 class SvxRubyData_Impl
;
70 class RubyEdit
: public Edit
74 virtual void GetFocus() SAL_OVERRIDE
;
75 virtual bool PreNotify( NotifyEvent
& rNEvt
) SAL_OVERRIDE
;
77 RubyEdit(vcl::Window
* pParent
, const ResId
& rResId
)
78 : Edit(pParent
, rResId
)
81 RubyEdit(vcl::Window
* pParent
)
82 : Edit(pParent
, WB_BORDER
)
85 void SetScrollHdl(Link
<>& rLink
) {aScrollHdl
= rLink
;}
86 void SetJumpHdl(Link
<>& rLink
) {aJumpHdl
= rLink
;}
90 class SvxRubyDialog
: public SfxModelessDialog
92 friend class RubyPreview
;
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
;
105 VclPtr
<RubyEdit
> aEditArr
[8];
106 VclPtr
<VclScrolledWindow
> m_pScrolledWindow
;
107 VclPtr
<ScrollBar
> m_pScrollSB
;
109 VclPtr
<ListBox
> m_pAdjustLB
;
111 VclPtr
<ListBox
> m_pPositionLB
;
113 VclPtr
<FixedText
> m_pCharStyleFT
;
114 VclPtr
<ListBox
> m_pCharStyleLB
;
115 VclPtr
<PushButton
> m_pStylistPB
;
117 VclPtr
<RubyPreview
> m_pPreviewWin
;
119 VclPtr
<PushButton
> m_pApplyPB
;
120 VclPtr
<PushButton
> m_pClosePB
;
127 com::sun::star::uno::Reference
<com::sun::star::view::XSelectionChangeListener
> xImpl
;
128 SfxBindings
* pBindings
;
129 SvxRubyData_Impl
* pImpl
;
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
*);
142 void SetRubyText(sal_Int32 nPos
, Edit
& rLeft
, Edit
& rRight
);
144 void ClearCharStyleList();
145 void AssertOneEntry();
148 virtual bool Close() SAL_OVERRIDE
;
150 long GetLastPos() const {return nLastPos
;}
151 void SetLastPos(long nSet
) {nLastPos
= nSet
;}
153 bool IsModified() const {return bModified
;}
154 void SetModified(bool bSet
) {bModified
= bSet
;}
156 void EnableControls(bool bEnable
);
158 void GetCurrentText(OUString
& rBase
, OUString
& rRuby
);
162 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) SAL_OVERRIDE
;
165 SvxRubyDialog(SfxBindings
*pBindings
, SfxChildWindow
*pCW
,
166 vcl::Window
* pParent
);
167 virtual ~SvxRubyDialog();
168 virtual void dispose() SAL_OVERRIDE
;
170 virtual void Activate() SAL_OVERRIDE
;
171 virtual void Deactivate() SAL_OVERRIDE
;
174 #endif // INCLUDED_SVX_RUBYDIALOG_HXX
177 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */