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 #ifndef INCLUDED_SVX_FONTWORK_HXX
20 #define INCLUDED_SVX_FONTWORK_HXX
21 
22 #include <vcl/toolbox.hxx>
23 #include <vcl/fixed.hxx>
24 #include <vcl/field.hxx>
25 #include <vcl/idle.hxx>
26 #include <sfx2/dockwin.hxx>
27 #include <sfx2/ctrlitem.hxx>
28 #include <svx/svxdllapi.h>
29 
30 class SvxColorListBox;
31 
32 class XFormTextAdjustItem;
33 class XFormTextDistanceItem;
34 class XFormTextStartItem;
35 class XFormTextStyleItem;
36 class XFormTextMirrorItem;
37 class XFormTextHideFormItem;
38 class XFormTextOutlineItem;
39 class XFormTextShadowItem;
40 class XFormTextShadowColorItem;
41 class XFormTextShadowXValItem;
42 class XFormTextShadowYValItem;
43 
44 /** ControllerItem for Fontwork
45  */
46 
47 
48 class SvxFontWorkDialog;
49 
50 class SvxFontWorkControllerItem final : public SfxControllerItem
51 {
52     SvxFontWorkDialog  &rFontWorkDlg;
53 
54     virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
55                               const SfxPoolItem* pState) override;
56 
57 public:
58     SvxFontWorkControllerItem(sal_uInt16 nId, SvxFontWorkDialog&, SfxBindings&);
59 };
60 
61 /** Derived from SfxChildWindow as "container" for fontwork dialog
62  */
63 
64 class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxFontWorkChildWindow final : public SfxChildWindow
65 {
66  public:
67     SvxFontWorkChildWindow(vcl::Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo*);
68     SFX_DECL_CHILDWINDOW_WITHID(SvxFontWorkChildWindow);
69 };
70 
71 /** Floating window for setting attributes of text effects
72   */
73 
74 class SAL_WARN_UNUSED SvxFontWorkDialog : public SfxDockingWindow
75 {
76 #define CONTROLLER_COUNT 11
77 
78     SvxFontWorkControllerItem* pCtrlItems[CONTROLLER_COUNT];
79 
80     VclPtr<ToolBox>         m_pTbxStyle;
81     VclPtr<ToolBox>         m_pTbxAdjust;
82 
83     VclPtr<MetricField>     m_pMtrFldDistance;
84     VclPtr<MetricField>     m_pMtrFldTextStart;
85 
86     VclPtr<ToolBox>         m_pTbxShadow;
87 
88     VclPtr<FixedImage>      m_pFbShadowX;
89     VclPtr<MetricField>     m_pMtrFldShadowX;
90     VclPtr<FixedImage>      m_pFbShadowY;
91     VclPtr<MetricField>     m_pMtrFldShadowY;
92 
93     VclPtr<SvxColorListBox> m_pShadowColorLB;
94 
95     SfxBindings&    rBindings;
96     Idle            aInputIdle;
97 
98     sal_uInt16      nLastStyleTbxId;
99     sal_uInt16      nStyleOffId;
100     sal_uInt16      nStyleRotateId;
101     sal_uInt16      nStyleUprightId;
102     sal_uInt16      nStyleSlantXId;
103     sal_uInt16      nStyleSlantYId;
104 
105     sal_uInt16      nLastAdjustTbxId;
106     sal_uInt16      nAdjustMirrorId;
107     sal_uInt16      nAdjustLeftId;
108     sal_uInt16      nAdjustCenterId;
109     sal_uInt16      nAdjustRightId;
110     sal_uInt16      nAdjustAutoSizeId;
111 
112     sal_uInt16      nLastShadowTbxId;
113     sal_uInt16      nShowFormId;
114     sal_uInt16      nOutlineId;
115     sal_uInt16      nShadowOffId;
116     sal_uInt16      nShadowNormalId;
117     sal_uInt16      nShadowSlantId;
118 
119     long            nSaveShadowX;
120     long            nSaveShadowY;
121     long            nSaveShadowAngle;
122     long            nSaveShadowSize;
123 
124  friend class SvxFontWorkChildWindow;
125  friend class SvxFontWorkControllerItem;
126 
127     DECL_LINK( SelectStyleHdl_Impl, ToolBox *, void );
128     DECL_LINK( SelectAdjustHdl_Impl, ToolBox *, void );
129     DECL_LINK( SelectShadowHdl_Impl, ToolBox *, void );
130 
131     DECL_LINK( ModifyInputHdl_Impl, Edit&, void );
132     DECL_LINK( InputTimeoutHdl_Impl, Timer *, void );
133 
134     DECL_LINK( ColorSelectHdl_Impl, SvxColorListBox&, void );
135 
136     void SetStyle_Impl(const XFormTextStyleItem*);
137     void SetAdjust_Impl(const XFormTextAdjustItem*);
138     void SetDistance_Impl(const XFormTextDistanceItem*);
139     void SetStart_Impl(const XFormTextStartItem*);
140     void SetMirror_Impl(const XFormTextMirrorItem*);
141     void SetShowForm_Impl(const XFormTextHideFormItem*);
142     void SetOutline_Impl(const XFormTextOutlineItem*);
143     void SetShadow_Impl(const XFormTextShadowItem*, bool bRestoreValues = false);
144     void SetShadowColor_Impl(const XFormTextShadowColorItem*);
145     void SetShadowXVal_Impl(const XFormTextShadowXValItem*);
146     void SetShadowYVal_Impl(const XFormTextShadowYValItem*);
147 
148     void ApplyImageList();
149 
150  protected:
151     virtual SfxChildAlignment CheckAlignment( SfxChildAlignment eActAlign,
152                                               SfxChildAlignment eAlign ) override;
153 
154  public:
155     SvxFontWorkDialog(SfxBindings *pBinding, SfxChildWindow *pCW,
156                       vcl::Window* pParent);
157     virtual ~SvxFontWorkDialog() override;
158     virtual void dispose() override;
159 };
160 
161 #endif // INCLUDED_SVX_FONTWORK_HXX
162 
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
164