Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / include / svx / rubydialog.hxx
blobc9daaaa85811a39ad71d44b4988a5e7a1429daeb
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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{
36 namespace view{
37 class XSelectionChangeListener;
39 }}}
42 class SvxRubyDialog;
43 class RubyPreview : public Window
45 protected:
46 virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
47 SvxRubyDialog* m_pParentDlg;
49 public:
50 RubyPreview(Window *pParent);
51 void setRubyDialog(SvxRubyDialog* pParentDlg)
53 m_pParentDlg = pParentDlg;
55 virtual Size GetOptimalSize() const SAL_OVERRIDE;
58 class SVX_DLLPUBLIC SvxRubyChildWindow : public SfxChildWindow
60 public:
62 SvxRubyChildWindow( Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* );
64 SFX_DECL_CHILDWINDOW( SvxRubyChildWindow );
67 class SvxRubyData_Impl;
68 class RubyEdit : public Edit
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)
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 friend class RubyPreview;
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;
103 RubyEdit* aEditArr[8];
104 VclScrolledWindow* m_pScrolledWindow;
105 ScrollBar* m_pScrollSB;
107 ListBox* m_pAdjustLB;
109 ListBox* m_pPositionLB;
111 FixedText* m_pCharStyleFT;
112 ListBox* m_pCharStyleLB;
113 PushButton* m_pStylistPB;
115 RubyPreview* m_pPreviewWin;
117 PushButton* m_pApplyPB;
118 PushButton* m_pClosePB;
120 long nLastPos;
121 long nCurrentEdit;
123 bool bModified;
125 com::sun::star::uno::Reference<com::sun::star::view::XSelectionChangeListener> xImpl;
126 SfxBindings* pBindings;
127 SvxRubyData_Impl* pImpl;
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*);
140 void SetRubyText(sal_Int32 nPos, Edit& rLeft, Edit& rRight);
141 void GetRubyText();
142 void ClearCharStyleList();
143 void AssertOneEntry();
145 void Update();
146 virtual bool Close() SAL_OVERRIDE;
148 long GetLastPos() const {return nLastPos;}
149 void SetLastPos(long nSet) {nLastPos = nSet;}
151 bool IsModified() const {return bModified;}
152 void SetModified(bool bSet) {bModified = bSet;}
154 void EnableControls(bool bEnable);
156 void GetCurrentText(OUString& rBase, OUString& rRuby);
158 void UpdateColors( void );
159 protected:
160 virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
161 public:
163 SvxRubyDialog(SfxBindings *pBindings, SfxChildWindow *pCW,
164 Window* pParent);
165 virtual ~SvxRubyDialog();
167 virtual void Activate() SAL_OVERRIDE;
168 virtual void Deactivate() SAL_OVERRIDE;
171 #endif // INCLUDED_SVX_RUBYDIALOG_HXX
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */