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 <vcl/fixed.hxx>
26 #include <vcl/field.hxx>
27 #include <sfx2/dockwin.hxx>
28 #include <vcl/button.hxx>
29 #include <vcl/layout.hxx>
30 #include <svx/svxdllapi.h>
32 #include <svx/f3dchild.hxx>
33 #include <svx/dlgctl3d.hxx>
34 #include <svx/dlgctrl.hxx>
35 #include <svx/svdmodel.hxx>
52 class SvxConvertTo3DItem
;
53 class SvxColorListBox
;
57 class SAL_WARN_UNUSED SVX_DLLPUBLIC Svx3DWin
: public SfxDockingWindow
59 friend class Svx3DChildWindow
;
60 friend class Svx3DCtrlItem
;
64 VclPtr
<PushButton
> m_pBtnGeo
;
65 VclPtr
<PushButton
> m_pBtnRepresentation
;
66 VclPtr
<PushButton
> m_pBtnLight
;
67 VclPtr
<PushButton
> m_pBtnTexture
;
68 VclPtr
<PushButton
> m_pBtnMaterial
;
69 VclPtr
<PushButton
> m_pBtnUpdate
;
70 VclPtr
<PushButton
> m_pBtnAssign
;
73 VclPtr
<VclContainer
> m_pFLGeometrie
;
74 VclPtr
<FixedText
> m_pFtPercentDiagonal
;
75 VclPtr
<MetricField
> m_pMtrPercentDiagonal
;
76 VclPtr
<FixedText
> m_pFtBackscale
;
77 VclPtr
<MetricField
> m_pMtrBackscale
;
78 VclPtr
<FixedText
> m_pFtEndAngle
;
79 VclPtr
<MetricField
> m_pMtrEndAngle
;
80 VclPtr
<FixedText
> m_pFtDepth
;
81 VclPtr
<MetricField
> m_pMtrDepth
;
83 VclPtr
<VclContainer
> m_pFLSegments
;
84 VclPtr
<NumericField
> m_pNumHorizontal
;
85 VclPtr
<NumericField
> m_pNumVertical
;
87 VclPtr
<VclContainer
> m_pFLNormals
;
88 VclPtr
<PushButton
> m_pBtnNormalsObj
;
89 VclPtr
<PushButton
> m_pBtnNormalsFlat
;
90 VclPtr
<PushButton
> m_pBtnNormalsSphere
;
91 VclPtr
<PushButton
> m_pBtnNormalsInvert
;
92 VclPtr
<PushButton
> m_pBtnTwoSidedLighting
;
93 VclPtr
<PushButton
> m_pBtnDoubleSided
;
96 VclPtr
<VclContainer
> m_pFLRepresentation
;
97 VclPtr
<ListBox
> m_pLbShademode
;
99 VclPtr
<VclContainer
> m_pFLShadow
;
100 VclPtr
<PushButton
> m_pBtnShadow3d
;
101 VclPtr
<FixedText
> m_pFtSlant
;
102 VclPtr
<MetricField
> m_pMtrSlant
;
104 VclPtr
<VclContainer
> m_pFLCamera
;
105 VclPtr
<MetricField
> m_pMtrDistance
;
106 VclPtr
<MetricField
> m_pMtrFocalLength
;
109 VclPtr
<VclContainer
> m_pFLLight
;
110 VclPtr
<PushButton
> m_pBtnLight1
;
111 VclPtr
<PushButton
> m_pBtnLight2
;
112 VclPtr
<PushButton
> m_pBtnLight3
;
113 VclPtr
<PushButton
> m_pBtnLight4
;
114 VclPtr
<PushButton
> m_pBtnLight5
;
115 VclPtr
<PushButton
> m_pBtnLight6
;
116 VclPtr
<PushButton
> m_pBtnLight7
;
117 VclPtr
<PushButton
> m_pBtnLight8
;
118 VclPtr
<SvxColorListBox
> m_pLbLight1
;
119 VclPtr
<SvxColorListBox
> m_pLbLight2
;
120 VclPtr
<SvxColorListBox
> m_pLbLight3
;
121 VclPtr
<SvxColorListBox
> m_pLbLight4
;
122 VclPtr
<SvxColorListBox
> m_pLbLight5
;
123 VclPtr
<SvxColorListBox
> m_pLbLight6
;
124 VclPtr
<SvxColorListBox
> m_pLbLight7
;
125 VclPtr
<SvxColorListBox
> m_pLbLight8
;
126 VclPtr
<PushButton
> m_pBtnLightColor
;
127 VclPtr
<SvxColorListBox
> m_pLbAmbientlight
; // ListBox
128 VclPtr
<PushButton
> m_pBtnAmbientColor
; // color button
131 VclPtr
<VclContainer
> m_pFLTexture
;
132 VclPtr
<PushButton
> m_pBtnTexLuminance
;
133 VclPtr
<PushButton
> m_pBtnTexColor
;
134 VclPtr
<PushButton
> m_pBtnTexReplace
;
135 VclPtr
<PushButton
> m_pBtnTexModulate
;
136 VclPtr
<PushButton
> m_pBtnTexBlend
;
137 VclPtr
<PushButton
> m_pBtnTexObjectX
;
138 VclPtr
<PushButton
> m_pBtnTexParallelX
;
139 VclPtr
<PushButton
> m_pBtnTexCircleX
;
140 VclPtr
<PushButton
> m_pBtnTexObjectY
;
141 VclPtr
<PushButton
> m_pBtnTexParallelY
;
142 VclPtr
<PushButton
> m_pBtnTexCircleY
;
143 VclPtr
<PushButton
> m_pBtnTexFilter
;
147 VclPtr
<VclContainer
> m_pFLMaterial
;
148 VclPtr
<ListBox
> m_pLbMatFavorites
;
149 VclPtr
<SvxColorListBox
> m_pLbMatColor
;
150 VclPtr
<PushButton
> m_pBtnMatColor
;
151 VclPtr
<SvxColorListBox
> m_pLbMatEmission
;
152 VclPtr
<PushButton
> m_pBtnEmissionColor
;
154 VclPtr
<VclContainer
> m_pFLMatSpecular
;
155 VclPtr
<SvxColorListBox
> m_pLbMatSpecular
;
156 VclPtr
<PushButton
> m_pBtnSpecularColor
;
157 VclPtr
<MetricField
> m_pMtrMatSpecularIntensity
;
159 VclPtr
<Svx3DPreviewControl
> m_pCtlPreview
;
160 VclPtr
<SvxLightCtl3D
> m_pCtlLightPreview
;
163 VclPtr
<PushButton
> m_pBtnConvertTo3D
;
164 VclPtr
<PushButton
> m_pBtnLatheObject
;
165 VclPtr
<PushButton
> m_pBtnPerspective
;
168 Image
const aImgLightOn
;
169 Image
const aImgLightOff
;
171 ViewType3D eViewType
;
173 // Model, Page, View etc. for favourites
174 std::unique_ptr
<FmFormModel
> pModel
;
176 SfxBindings
* const pBindings
;
177 std::unique_ptr
<Svx3DCtrlItem
> pControllerItem
;
179 std::unique_ptr
<SvxConvertTo3DItem
> pConvertTo3DItem
;
180 std::unique_ptr
<SvxConvertTo3DItem
> pConvertTo3DLatheItem
;
182 std::unique_ptr
<Svx3DWinImpl
> mpImpl
;
186 // ItemSet used to remember set 2d attributes
187 std::unique_ptr
<SfxItemSet
> mpRemember2DAttributes
;
189 DECL_LINK( ClickViewTypeHdl
, Button
*, void );
190 DECL_LINK( ClickUpdateHdl
, Button
*, void );
191 DECL_LINK( ClickAssignHdl
, Button
*, void );
192 DECL_LINK( ClickHdl
, Button
*, void );
193 DECL_LINK( ClickColorHdl
, Button
*, void );
194 DECL_LINK( SelectHdl
, ListBox
&, void );
195 DECL_LINK( SelectColorHdl
, SvxColorListBox
&, void );
196 DECL_LINK( ModifyHdl
, Edit
&, void );
197 void ClickLight(PushButton
&rBtn
);
199 DECL_LINK( ChangeSelectionCallbackHdl
, SvxLightCtl3D
*, void );
201 SVX_DLLPRIVATE
void Construct();
202 SVX_DLLPRIVATE
void Reset();
204 SVX_DLLPRIVATE
static void LBSelectColor( SvxColorListBox
* pLb
, const Color
& rColor
);
205 SVX_DLLPRIVATE sal_uInt16
GetLightSource( const PushButton
* pBtn
);
206 SVX_DLLPRIVATE SvxColorListBox
* GetLbByButton( const PushButton
* pBtn
= nullptr );
208 SVX_DLLPRIVATE
bool GetUILightState( const PushButton
& rBtn
) const;
209 SVX_DLLPRIVATE
void SetUILightState( PushButton
& aBtn
, bool bState
);
212 virtual void Resize() override
;
215 Svx3DWin( SfxBindings
* pBindings
, SfxChildWindow
*pCW
,
216 vcl::Window
* pParent
);
217 virtual ~Svx3DWin() override
;
218 virtual void dispose() override
;
221 bool IsUpdateMode() const { return bUpdate
; }
223 void Update( SfxItemSet
const & rSet
);
224 void GetAttr( SfxItemSet
& rSet
);
226 void UpdatePreview(); // upward (private)
227 void DocumentReload();
230 /*************************************************************************
232 |* Controller item for 3D Window (Floating/Docking)
234 \************************************************************************/
236 class Svx3DCtrlItem
: public SfxControllerItem
239 virtual void StateChanged( sal_uInt16 nSId
, SfxItemState eState
,
240 const SfxPoolItem
* pState
) override
;
243 Svx3DCtrlItem( sal_uInt16
, SfxBindings
* );
246 /*************************************************************************
248 |* ControllerItem for State of a Slot
249 |* (SID_CONVERT_TO_3D, SID_CONVERT_TO_3D_LATHE_FAST)
251 \************************************************************************/
253 class SvxConvertTo3DItem
: public SfxControllerItem
258 virtual void StateChanged(sal_uInt16 nSId
, SfxItemState eState
, const SfxPoolItem
* pState
) override
;
261 SvxConvertTo3DItem(sal_uInt16 nId
, SfxBindings
* pBindings
);
262 bool GetState() const { return bState
; }
265 #endif // INCLUDED_SVX_FLOAT3D_HXX
267 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */