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 .
20 #ifndef INCLUDED_SVX_FLOAT3D_HXX
21 #define INCLUDED_SVX_FLOAT3D_HXX
24 #include <sfx2/ctrlitem.hxx>
25 #include <sfx2/dockwin.hxx>
26 #include <vcl/weld.hxx>
27 #include <svx/svxdllapi.h>
29 #include <svx/dlgctl3d.hxx>
43 class SvxConvertTo3DItem
;
48 class SVX_DLLPUBLIC LightButton final
51 explicit LightButton(std::unique_ptr
<weld::ToggleButton
> xButton
);
53 void switchLightOn(bool bOn
);
54 bool isLightOn() const { return m_bLightOn
;}
56 bool get_active() const { return m_xButton
->get_active(); }
57 void set_active(bool bActive
) { m_xButton
->set_active(bActive
); }
59 TriState
get_state() const { return m_xButton
->get_state(); }
60 void set_state(TriState eState
) { m_xButton
->set_state(eState
); }
62 weld::ToggleButton
* get_widget() const { return m_xButton
.get(); }
64 void connect_clicked(const Link
<weld::Button
&, void>& rLink
)
66 m_xButton
->connect_clicked(rLink
);
69 bool get_prev_active() const { return m_bButtonPrevActive
; }
70 void set_prev_active(bool bPrevActive
) { m_bButtonPrevActive
= bPrevActive
; }
73 std::unique_ptr
<weld::ToggleButton
> m_xButton
;
75 bool m_bButtonPrevActive
;
78 class SAL_WARN_UNUSED SVX_DLLPUBLIC Svx3DWin final
: public SfxDockingWindow
80 friend class Svx3DChildWindow
;
81 friend class Svx3DCtrlItem
;
84 std::unique_ptr
<weld::ToggleButton
> m_xBtnGeo
;
85 std::unique_ptr
<weld::ToggleButton
> m_xBtnRepresentation
;
86 std::unique_ptr
<weld::ToggleButton
> m_xBtnLight
;
87 std::unique_ptr
<weld::ToggleButton
> m_xBtnTexture
;
88 std::unique_ptr
<weld::ToggleButton
> m_xBtnMaterial
;
89 std::unique_ptr
<weld::ToggleButton
> m_xBtnUpdate
;
90 std::unique_ptr
<weld::Button
> m_xBtnAssign
;
93 std::unique_ptr
<weld::Container
> m_xFLGeometrie
;
94 std::unique_ptr
<weld::Label
> m_xFtPercentDiagonal
;
95 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrPercentDiagonal
;
96 std::unique_ptr
<weld::Label
> m_xFtBackscale
;
97 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrBackscale
;
98 std::unique_ptr
<weld::Label
> m_xFtEndAngle
;
99 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrEndAngle
;
100 std::unique_ptr
<weld::Label
> m_xFtDepth
;
101 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrDepth
;
103 std::unique_ptr
<weld::Container
> m_xFLSegments
;
104 std::unique_ptr
<weld::SpinButton
> m_xNumHorizontal
;
105 std::unique_ptr
<weld::SpinButton
> m_xNumVertical
;
107 std::unique_ptr
<weld::Container
> m_xFLNormals
;
108 std::unique_ptr
<weld::ToggleButton
> m_xBtnNormalsObj
;
109 std::unique_ptr
<weld::ToggleButton
> m_xBtnNormalsFlat
;
110 std::unique_ptr
<weld::ToggleButton
> m_xBtnNormalsSphere
;
111 std::unique_ptr
<weld::ToggleButton
> m_xBtnNormalsInvert
;
112 std::unique_ptr
<weld::ToggleButton
> m_xBtnTwoSidedLighting
;
113 std::unique_ptr
<weld::ToggleButton
> m_xBtnDoubleSided
;
116 std::unique_ptr
<weld::Container
> m_xFLRepresentation
;
117 std::unique_ptr
<weld::ComboBox
> m_xLbShademode
;
119 std::unique_ptr
<weld::Container
> m_xFLShadow
;
120 std::unique_ptr
<weld::ToggleButton
> m_xBtnShadow3d
;
121 std::unique_ptr
<weld::Label
> m_xFtSlant
;
122 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrSlant
;
124 std::unique_ptr
<weld::Container
> m_xFLCamera
;
125 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrDistance
;
126 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrFocalLength
;
129 std::unique_ptr
<weld::Container
> m_xFLLight
;
130 std::unique_ptr
<LightButton
> m_xBtnLight1
;
131 std::unique_ptr
<LightButton
> m_xBtnLight2
;
132 std::unique_ptr
<LightButton
> m_xBtnLight3
;
133 std::unique_ptr
<LightButton
> m_xBtnLight4
;
134 std::unique_ptr
<LightButton
> m_xBtnLight5
;
135 std::unique_ptr
<LightButton
> m_xBtnLight6
;
136 std::unique_ptr
<LightButton
> m_xBtnLight7
;
137 std::unique_ptr
<LightButton
> m_xBtnLight8
;
138 std::unique_ptr
<ColorListBox
> m_xLbLight1
;
139 std::unique_ptr
<ColorListBox
> m_xLbLight2
;
140 std::unique_ptr
<ColorListBox
> m_xLbLight3
;
141 std::unique_ptr
<ColorListBox
> m_xLbLight4
;
142 std::unique_ptr
<ColorListBox
> m_xLbLight5
;
143 std::unique_ptr
<ColorListBox
> m_xLbLight6
;
144 std::unique_ptr
<ColorListBox
> m_xLbLight7
;
145 std::unique_ptr
<ColorListBox
> m_xLbLight8
;
146 std::unique_ptr
<weld::Button
> m_xBtnLightColor
;
147 std::unique_ptr
<ColorListBox
> m_xLbAmbientlight
; // ListBox
148 std::unique_ptr
<weld::Button
> m_xBtnAmbientColor
; // color button
151 std::unique_ptr
<weld::Container
> m_xFLTexture
;
152 std::unique_ptr
<weld::ToggleButton
> m_xBtnTexLuminance
;
153 std::unique_ptr
<weld::ToggleButton
> m_xBtnTexColor
;
154 std::unique_ptr
<weld::ToggleButton
> m_xBtnTexReplace
;
155 std::unique_ptr
<weld::ToggleButton
> m_xBtnTexModulate
;
156 std::unique_ptr
<weld::ToggleButton
> m_xBtnTexBlend
;
157 std::unique_ptr
<weld::ToggleButton
> m_xBtnTexObjectX
;
158 std::unique_ptr
<weld::ToggleButton
> m_xBtnTexParallelX
;
159 std::unique_ptr
<weld::ToggleButton
> m_xBtnTexCircleX
;
160 std::unique_ptr
<weld::ToggleButton
> m_xBtnTexObjectY
;
161 std::unique_ptr
<weld::ToggleButton
> m_xBtnTexParallelY
;
162 std::unique_ptr
<weld::ToggleButton
> m_xBtnTexCircleY
;
163 std::unique_ptr
<weld::ToggleButton
> m_xBtnTexFilter
;
167 std::unique_ptr
<weld::Container
> m_xFLMaterial
;
168 std::unique_ptr
<weld::ComboBox
> m_xLbMatFavorites
;
169 std::unique_ptr
<ColorListBox
> m_xLbMatColor
;
170 std::unique_ptr
<weld::Button
> m_xBtnMatColor
;
171 std::unique_ptr
<ColorListBox
> m_xLbMatEmission
;
172 std::unique_ptr
<weld::Button
> m_xBtnEmissionColor
;
174 std::unique_ptr
<weld::Container
> m_xFLMatSpecular
;
175 std::unique_ptr
<ColorListBox
> m_xLbMatSpecular
;
176 std::unique_ptr
<weld::Button
> m_xBtnSpecularColor
;
177 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrMatSpecularIntensity
;
179 std::unique_ptr
<Svx3DPreviewControl
> m_xCtlPreview
;
180 std::unique_ptr
<weld::CustomWeld
> m_xCtlPreviewWin
;
182 std::unique_ptr
<weld::Widget
> m_xLightPreviewGrid
;
183 std::unique_ptr
<weld::Scale
> m_xHoriScale
;
184 std::unique_ptr
<weld::Scale
> m_xVertScale
;
185 std::unique_ptr
<weld::Button
> m_xBtn_Corner
;
186 std::unique_ptr
<Svx3DLightControl
> m_xLightPreview
;
187 std::unique_ptr
<weld::CustomWeld
> m_xCtlLightPreviewWin
;
188 std::unique_ptr
<SvxLightCtl3D
> m_xCtlLightPreview
;
191 std::unique_ptr
<weld::Button
> m_xBtnConvertTo3D
;
192 std::unique_ptr
<weld::Button
> m_xBtnLatheObject
;
193 std::unique_ptr
<weld::ToggleButton
> m_xBtnPerspective
;
197 ViewType3D eViewType
;
199 // Model, Page, View etc. for favourites
200 std::unique_ptr
<FmFormModel
> pModel
;
202 SfxBindings
* pBindings
;
203 std::unique_ptr
<Svx3DCtrlItem
> pControllerItem
;
205 std::unique_ptr
<SvxConvertTo3DItem
> pConvertTo3DItem
;
206 std::unique_ptr
<SvxConvertTo3DItem
> pConvertTo3DLatheItem
;
208 std::unique_ptr
<Svx3DWinImpl
> mpImpl
;
212 // ItemSet used to remember set 2d attributes
213 std::unique_ptr
<SfxItemSet
> mpRemember2DAttributes
;
215 DECL_LINK( ClickViewTypeHdl
, weld::Button
&, void );
216 DECL_LINK( ClickUpdateHdl
, weld::ToggleButton
&, void );
217 DECL_LINK( ClickAssignHdl
, weld::Button
&, void );
218 DECL_LINK( ClickHdl
, weld::Button
&, void );
219 DECL_LINK( ClickColorHdl
, weld::Button
&, void );
220 DECL_LINK( SelectHdl
, weld::ComboBox
&, void );
221 DECL_LINK( SelectColorHdl
, ColorListBox
&, void );
222 DECL_LINK( ModifyMetricHdl
, weld::MetricSpinButton
&, void );
223 DECL_LINK( ModifySpinHdl
, weld::SpinButton
&, void );
224 void ClickLight(const LightButton
& rBtn
);
226 DECL_LINK( ChangeSelectionCallbackHdl
, SvxLightCtl3D
*, void );
228 SVX_DLLPRIVATE
void Construct();
229 SVX_DLLPRIVATE
void Reset();
231 SVX_DLLPRIVATE
static void LBSelectColor( ColorListBox
* pLb
, const Color
& rColor
);
232 SVX_DLLPRIVATE sal_uInt16
GetLightSource( const LightButton
* pBtn
);
233 SVX_DLLPRIVATE ColorListBox
* GetCLbByButton( const LightButton
* pBtn
= nullptr );
234 SVX_DLLPRIVATE LightButton
* GetLbByButton( const weld::Button
* pBtn
);
236 virtual void Resize() override
;
239 Svx3DWin( SfxBindings
* pBindings
, SfxChildWindow
*pCW
,
240 vcl::Window
* pParent
);
241 virtual ~Svx3DWin() override
;
242 virtual void dispose() override
;
245 bool IsUpdateMode() const { return bUpdate
; }
247 void Update( SfxItemSet
const & rSet
);
248 void GetAttr( SfxItemSet
& rSet
);
250 void UpdatePreview(); // upward (private)
251 void DocumentReload();
254 /*************************************************************************
256 |* Controller item for 3D Window (Floating/Docking)
258 \************************************************************************/
260 class Svx3DCtrlItem
: public SfxControllerItem
263 virtual void StateChanged( sal_uInt16 nSId
, SfxItemState eState
,
264 const SfxPoolItem
* pState
) override
;
267 Svx3DCtrlItem( sal_uInt16
, SfxBindings
* );
270 /*************************************************************************
272 |* ControllerItem for State of a Slot
273 |* (SID_CONVERT_TO_3D, SID_CONVERT_TO_3D_LATHE_FAST)
275 \************************************************************************/
277 class SvxConvertTo3DItem
: public SfxControllerItem
282 virtual void StateChanged(sal_uInt16 nSId
, SfxItemState eState
, const SfxPoolItem
* pState
) override
;
285 SvxConvertTo3DItem(sal_uInt16 nId
, SfxBindings
* pBindings
);
286 bool GetState() const { return bState
; }
289 #endif // INCLUDED_SVX_FLOAT3D_HXX
291 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */