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 <svx/svxdllapi.h>
33 #include <rtl/ref.hxx>
37 class RubyPreview
: public vcl::Window
40 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
41 VclPtr
<SvxRubyDialog
> m_pParentDlg
;
44 RubyPreview(vcl::Window
*pParent
);
45 virtual ~RubyPreview() override
;
46 virtual void dispose() override
;
47 void setRubyDialog(SvxRubyDialog
* pParentDlg
)
49 m_pParentDlg
= pParentDlg
;
51 virtual Size
GetOptimalSize() const override
;
54 class SVX_DLLPUBLIC SvxRubyChildWindow
: public SfxChildWindow
58 SvxRubyChildWindow( vcl::Window
*, sal_uInt16
, SfxBindings
*, SfxChildWinInfo
* );
60 SFX_DECL_CHILDWINDOW( SvxRubyChildWindow
);
63 class SvxRubyData_Impl
;
64 class RubyEdit
: public Edit
66 Link
<sal_Int32
,bool> aScrollHdl
;
67 Link
<sal_Int32
,void> aJumpHdl
;
68 virtual void GetFocus() override
;
69 virtual bool PreNotify( NotifyEvent
& rNEvt
) override
;
71 RubyEdit(vcl::Window
* pParent
)
72 : Edit(pParent
, WB_BORDER
)
75 void SetScrollHdl(Link
<sal_Int32
,bool>& rLink
) {aScrollHdl
= rLink
;}
76 void SetJumpHdl(Link
<sal_Int32
,void>& rLink
) {aJumpHdl
= rLink
;}
80 class SvxRubyDialog
: public SfxModelessDialog
82 friend class RubyPreview
;
84 VclPtr
<FixedText
> m_pLeftFT
;
85 VclPtr
<FixedText
> m_pRightFT
;
86 VclPtr
<RubyEdit
> m_pLeft1ED
;
87 VclPtr
<RubyEdit
> m_pRight1ED
;
88 VclPtr
<RubyEdit
> m_pLeft2ED
;
89 VclPtr
<RubyEdit
> m_pRight2ED
;
90 VclPtr
<RubyEdit
> m_pLeft3ED
;
91 VclPtr
<RubyEdit
> m_pRight3ED
;
92 VclPtr
<RubyEdit
> m_pLeft4ED
;
93 VclPtr
<RubyEdit
> m_pRight4ED
;
95 VclPtr
<RubyEdit
> aEditArr
[8];
96 VclPtr
<VclScrolledWindow
> m_pScrolledWindow
;
97 VclPtr
<ScrollBar
> m_pScrollSB
;
99 VclPtr
<ListBox
> m_pAdjustLB
;
101 VclPtr
<ListBox
> m_pPositionLB
;
103 VclPtr
<FixedText
> m_pCharStyleFT
;
104 VclPtr
<ListBox
> m_pCharStyleLB
;
105 VclPtr
<PushButton
> m_pStylistPB
;
107 VclPtr
<RubyPreview
> m_pPreviewWin
;
109 VclPtr
<PushButton
> m_pApplyPB
;
110 VclPtr
<PushButton
> m_pClosePB
;
117 SfxBindings
* pBindings
;
119 DECL_LINK(ApplyHdl_Impl
, Button
*, void);
120 DECL_LINK(CloseHdl_Impl
, Button
*, void);
121 DECL_LINK(StylistHdl_Impl
, Button
*, void);
122 DECL_LINK(ScrollHdl_Impl
, ScrollBar
*, void);
123 DECL_LINK(PositionHdl_Impl
, ListBox
&, void);
124 DECL_LINK(AdjustHdl_Impl
, ListBox
&, void);
125 DECL_LINK(CharStyleHdl_Impl
, ListBox
&, void);
126 DECL_LINK(EditModifyHdl_Impl
, Edit
&, void);
127 DECL_LINK(EditScrollHdl_Impl
, sal_Int32
, bool);
128 DECL_LINK(EditJumpHdl_Impl
, sal_Int32
, void);
130 void SetRubyText(sal_Int32 nPos
, Edit
& rLeft
, Edit
& rRight
);
132 void ClearCharStyleList();
133 void AssertOneEntry();
136 virtual bool Close() override
;
138 long GetLastPos() const {return nLastPos
;}
139 void SetLastPos(long nSet
) {nLastPos
= nSet
;}
141 bool IsModified() const {return bModified
;}
142 void SetModified(bool bSet
) {bModified
= bSet
;}
144 void EnableControls(bool bEnable
);
146 void GetCurrentText(OUString
& rBase
, OUString
& rRuby
);
151 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
154 SvxRubyDialog(SfxBindings
*pBindings
, SfxChildWindow
*pCW
,
155 vcl::Window
* pParent
);
156 virtual ~SvxRubyDialog() override
;
157 virtual void dispose() override
;
159 virtual void Activate() override
;
162 rtl::Reference
<SvxRubyData_Impl
> m_pImpl
;
165 #endif // INCLUDED_SVX_RUBYDIALOG_HXX
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */