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/customweld.hxx> 27 #include <svx/svxdllapi.h> 28 #include <rtl/ref.hxx> 29 30 class SvxRubyDialog; 31 class RubyPreview final : public weld::CustomWidgetController 32 { 33 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; 34 SvxRubyDialog* m_pParentDlg; 35 36 public: 37 RubyPreview(); 38 virtual ~RubyPreview() override; setRubyDialog(SvxRubyDialog * pParentDlg)39 void setRubyDialog(SvxRubyDialog* pParentDlg) 40 { 41 m_pParentDlg = pParentDlg; 42 } 43 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; 44 }; 45 46 class SVX_DLLPUBLIC SvxRubyChildWindow final : public SfxChildWindow 47 { 48 public: 49 SvxRubyChildWindow( vcl::Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo const * ); 50 SFX_DECL_CHILDWINDOW( SvxRubyChildWindow ); 51 }; 52 53 class SvxRubyData_Impl; 54 55 class SvxRubyDialog : public SfxModelessDialogController 56 { 57 friend class RubyPreview; 58 59 60 long nLastPos; 61 long nCurrentEdit; 62 bool bModified; 63 SfxBindings* pBindings; 64 rtl::Reference<SvxRubyData_Impl> m_pImpl; 65 weld::Entry* aEditArr[8]; 66 67 std::unique_ptr<weld::Label> m_xLeftFT; 68 std::unique_ptr<weld::Label> m_xRightFT; 69 std::unique_ptr<weld::Entry> m_xLeft1ED; 70 std::unique_ptr<weld::Entry> m_xRight1ED; 71 std::unique_ptr<weld::Entry> m_xLeft2ED; 72 std::unique_ptr<weld::Entry> m_xRight2ED; 73 std::unique_ptr<weld::Entry> m_xLeft3ED; 74 std::unique_ptr<weld::Entry> m_xRight3ED; 75 std::unique_ptr<weld::Entry> m_xLeft4ED; 76 std::unique_ptr<weld::Entry> m_xRight4ED; 77 78 std::unique_ptr<weld::ScrolledWindow> m_xScrolledWindow; 79 80 std::unique_ptr<weld::ComboBox> m_xAdjustLB; 81 82 std::unique_ptr<weld::ComboBox> m_xPositionLB; 83 84 std::unique_ptr<weld::Label> m_xCharStyleFT; 85 std::unique_ptr<weld::ComboBox> m_xCharStyleLB; 86 std::unique_ptr<weld::Button> m_xStylistPB; 87 88 std::unique_ptr<weld::Button> m_xApplyPB; 89 std::unique_ptr<weld::Button> m_xClosePB; 90 91 std::unique_ptr<weld::Container> m_xContentArea; 92 std::unique_ptr<weld::Widget> m_xGrid; 93 94 std::unique_ptr<RubyPreview> m_xPreviewWin; 95 std::unique_ptr<weld::CustomWeld> m_xPreview; 96 97 DECL_LINK(ApplyHdl_Impl, weld::Button&, void); 98 DECL_LINK(CloseHdl_Impl, weld::Button&, void); 99 DECL_LINK(StylistHdl_Impl, weld::Button&, void); 100 DECL_LINK(ScrollHdl_Impl, weld::ScrolledWindow&, void); 101 DECL_LINK(PositionHdl_Impl, weld::ComboBox&, void); 102 DECL_LINK(AdjustHdl_Impl, weld::ComboBox&, void); 103 DECL_LINK(CharStyleHdl_Impl, weld::ComboBox&, void); 104 DECL_LINK(EditModifyHdl_Impl, weld::Entry&, void); 105 DECL_LINK(EditFocusHdl_Impl, weld::Widget&, void); 106 DECL_LINK(KeyUpDownHdl_Impl, const KeyEvent&, bool); 107 DECL_LINK(KeyUpDownTabHdl_Impl, const KeyEvent&, bool); 108 109 bool EditScrollHdl_Impl(sal_Int32 nParam); 110 bool EditJumpHdl_Impl(sal_Int32 nParam); 111 112 void SetRubyText(sal_Int32 nPos, weld::Entry& rLeft, weld::Entry& rRight); 113 void GetRubyText(); 114 void ClearCharStyleList(); 115 void AssertOneEntry(); 116 117 void Update(); 118 virtual void Close() override; 119 GetLastPos() const120 long GetLastPos() const {return nLastPos;} SetLastPos(long nSet)121 void SetLastPos(long nSet) {nLastPos = nSet;} 122 IsModified() const123 bool IsModified() const {return bModified;} SetModified(bool bSet)124 void SetModified(bool bSet) {bModified = bSet;} 125 126 void EnableControls(bool bEnable); 127 128 void GetCurrentText(OUString& rBase, OUString& rRuby); 129 130 public: 131 SvxRubyDialog(SfxBindings *pBindings, SfxChildWindow *pCW, weld::Window* pParent); 132 virtual ~SvxRubyDialog() override; 133 134 virtual void Activate() override; 135 }; 136 137 #endif // INCLUDED_SVX_RUBYDIALOG_HXX 138 139 140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 141