lok: calc - send other views our selection in their co-ordinates.
[LibreOffice.git] / include / svx / float3d.hxx
blob2390633c9a1815d6edcdc20026286d4d0765b036
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 .
20 #ifndef INCLUDED_SVX_FLOAT3D_HXX
21 #define INCLUDED_SVX_FLOAT3D_HXX
23 #include <memory>
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/dlgctl3d.hxx>
35 enum class ViewType3D
37 Geo = 1,
38 Representation,
39 Light,
40 Texture,
41 Material
44 class FmFormModel;
45 class Svx3DCtrlItem;
46 class SvxConvertTo3DItem;
47 class SvxColorListBox;
49 struct Svx3DWinImpl;
51 class SAL_WARN_UNUSED SVX_DLLPUBLIC Svx3DWin final : public SfxDockingWindow
53 friend class Svx3DChildWindow;
54 friend class Svx3DCtrlItem;
55 using Window::Update;
57 private:
58 VclPtr<PushButton> m_pBtnGeo;
59 VclPtr<PushButton> m_pBtnRepresentation;
60 VclPtr<PushButton> m_pBtnLight;
61 VclPtr<PushButton> m_pBtnTexture;
62 VclPtr<PushButton> m_pBtnMaterial;
63 VclPtr<PushButton> m_pBtnUpdate;
64 VclPtr<PushButton> m_pBtnAssign;
66 // geometry
67 VclPtr<VclContainer> m_pFLGeometrie;
68 VclPtr<FixedText> m_pFtPercentDiagonal;
69 VclPtr<MetricField> m_pMtrPercentDiagonal;
70 VclPtr<FixedText> m_pFtBackscale;
71 VclPtr<MetricField> m_pMtrBackscale;
72 VclPtr<FixedText> m_pFtEndAngle;
73 VclPtr<MetricField> m_pMtrEndAngle;
74 VclPtr<FixedText> m_pFtDepth;
75 VclPtr<MetricField> m_pMtrDepth;
77 VclPtr<VclContainer> m_pFLSegments;
78 VclPtr<NumericField> m_pNumHorizontal;
79 VclPtr<NumericField> m_pNumVertical;
81 VclPtr<VclContainer> m_pFLNormals;
82 VclPtr<PushButton> m_pBtnNormalsObj;
83 VclPtr<PushButton> m_pBtnNormalsFlat;
84 VclPtr<PushButton> m_pBtnNormalsSphere;
85 VclPtr<PushButton> m_pBtnNormalsInvert;
86 VclPtr<PushButton> m_pBtnTwoSidedLighting;
87 VclPtr<PushButton> m_pBtnDoubleSided;
89 // presentation
90 VclPtr<VclContainer> m_pFLRepresentation;
91 VclPtr<ListBox> m_pLbShademode;
93 VclPtr<VclContainer> m_pFLShadow;
94 VclPtr<PushButton> m_pBtnShadow3d;
95 VclPtr<FixedText> m_pFtSlant;
96 VclPtr<MetricField> m_pMtrSlant;
98 VclPtr<VclContainer> m_pFLCamera;
99 VclPtr<MetricField> m_pMtrDistance;
100 VclPtr<MetricField> m_pMtrFocalLength;
102 // lighting
103 VclPtr<VclContainer> m_pFLLight;
104 VclPtr<PushButton> m_pBtnLight1;
105 VclPtr<PushButton> m_pBtnLight2;
106 VclPtr<PushButton> m_pBtnLight3;
107 VclPtr<PushButton> m_pBtnLight4;
108 VclPtr<PushButton> m_pBtnLight5;
109 VclPtr<PushButton> m_pBtnLight6;
110 VclPtr<PushButton> m_pBtnLight7;
111 VclPtr<PushButton> m_pBtnLight8;
112 VclPtr<SvxColorListBox> m_pLbLight1;
113 VclPtr<SvxColorListBox> m_pLbLight2;
114 VclPtr<SvxColorListBox> m_pLbLight3;
115 VclPtr<SvxColorListBox> m_pLbLight4;
116 VclPtr<SvxColorListBox> m_pLbLight5;
117 VclPtr<SvxColorListBox> m_pLbLight6;
118 VclPtr<SvxColorListBox> m_pLbLight7;
119 VclPtr<SvxColorListBox> m_pLbLight8;
120 VclPtr<PushButton> m_pBtnLightColor;
121 VclPtr<SvxColorListBox> m_pLbAmbientlight; // ListBox
122 VclPtr<PushButton> m_pBtnAmbientColor; // color button
124 // Textures
125 VclPtr<VclContainer> m_pFLTexture;
126 VclPtr<PushButton> m_pBtnTexLuminance;
127 VclPtr<PushButton> m_pBtnTexColor;
128 VclPtr<PushButton> m_pBtnTexReplace;
129 VclPtr<PushButton> m_pBtnTexModulate;
130 VclPtr<PushButton> m_pBtnTexBlend;
131 VclPtr<PushButton> m_pBtnTexObjectX;
132 VclPtr<PushButton> m_pBtnTexParallelX;
133 VclPtr<PushButton> m_pBtnTexCircleX;
134 VclPtr<PushButton> m_pBtnTexObjectY;
135 VclPtr<PushButton> m_pBtnTexParallelY;
136 VclPtr<PushButton> m_pBtnTexCircleY;
137 VclPtr<PushButton> m_pBtnTexFilter;
139 // material
140 // material editor
141 VclPtr<VclContainer> m_pFLMaterial;
142 VclPtr<ListBox> m_pLbMatFavorites;
143 VclPtr<SvxColorListBox> m_pLbMatColor;
144 VclPtr<PushButton> m_pBtnMatColor;
145 VclPtr<SvxColorListBox> m_pLbMatEmission;
146 VclPtr<PushButton> m_pBtnEmissionColor;
148 VclPtr<VclContainer> m_pFLMatSpecular;
149 VclPtr<SvxColorListBox> m_pLbMatSpecular;
150 VclPtr<PushButton> m_pBtnSpecularColor;
151 VclPtr<MetricField> m_pMtrMatSpecularIntensity;
153 VclPtr<Svx3DPreviewControl> m_pCtlPreview;
154 VclPtr<SvxLightCtl3D> m_pCtlLightPreview;
156 // bottom part
157 VclPtr<PushButton> m_pBtnConvertTo3D;
158 VclPtr<PushButton> m_pBtnLatheObject;
159 VclPtr<PushButton> m_pBtnPerspective;
161 // the rest ...
162 Image const aImgLightOn;
163 Image const aImgLightOff;
164 bool bUpdate;
165 ViewType3D eViewType;
167 // Model, Page, View etc. for favourites
168 std::unique_ptr<FmFormModel> pModel;
170 SfxBindings* const pBindings;
171 std::unique_ptr<Svx3DCtrlItem> pControllerItem;
173 std::unique_ptr<SvxConvertTo3DItem> pConvertTo3DItem;
174 std::unique_ptr<SvxConvertTo3DItem> pConvertTo3DLatheItem;
176 std::unique_ptr<Svx3DWinImpl> mpImpl;
177 MapUnit ePoolUnit;
178 FieldUnit eFUnit;
180 // ItemSet used to remember set 2d attributes
181 std::unique_ptr<SfxItemSet> mpRemember2DAttributes;
183 DECL_LINK( ClickViewTypeHdl, Button*, void );
184 DECL_LINK( ClickUpdateHdl, Button*, void );
185 DECL_LINK( ClickAssignHdl, Button*, void );
186 DECL_LINK( ClickHdl, Button*, void );
187 DECL_LINK( ClickColorHdl, Button*, void );
188 DECL_LINK( SelectHdl, ListBox&, void );
189 DECL_LINK( SelectColorHdl, SvxColorListBox&, void );
190 DECL_LINK( ModifyHdl, Edit&, void );
191 void ClickLight(PushButton &rBtn);
193 DECL_LINK( ChangeSelectionCallbackHdl, SvxLightCtl3D*, void );
195 SVX_DLLPRIVATE void Construct();
196 SVX_DLLPRIVATE void Reset();
198 SVX_DLLPRIVATE static void LBSelectColor( SvxColorListBox* pLb, const Color& rColor );
199 SVX_DLLPRIVATE sal_uInt16 GetLightSource( const PushButton* pBtn );
200 SVX_DLLPRIVATE SvxColorListBox* GetLbByButton( const PushButton* pBtn = nullptr );
202 SVX_DLLPRIVATE bool GetUILightState( const PushButton& rBtn ) const;
203 SVX_DLLPRIVATE void SetUILightState( PushButton& aBtn, bool bState );
205 virtual void Resize() override;
207 public:
208 Svx3DWin( SfxBindings* pBindings, SfxChildWindow *pCW,
209 vcl::Window* pParent );
210 virtual ~Svx3DWin() override;
211 virtual void dispose() override;
213 void InitColorLB();
214 bool IsUpdateMode() const { return bUpdate; }
216 void Update( SfxItemSet const & rSet );
217 void GetAttr( SfxItemSet& rSet );
219 void UpdatePreview(); // upward (private)
220 void DocumentReload();
223 /*************************************************************************
225 |* Controller item for 3D Window (Floating/Docking)
227 \************************************************************************/
229 class Svx3DCtrlItem : public SfxControllerItem
231 protected:
232 virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
233 const SfxPoolItem* pState ) override;
235 public:
236 Svx3DCtrlItem( sal_uInt16, SfxBindings* );
239 /*************************************************************************
241 |* ControllerItem for State of a Slot
242 |* (SID_CONVERT_TO_3D, SID_CONVERT_TO_3D_LATHE_FAST)
244 \************************************************************************/
246 class SvxConvertTo3DItem : public SfxControllerItem
248 bool bState;
250 protected:
251 virtual void StateChanged(sal_uInt16 nSId, SfxItemState eState, const SfxPoolItem* pState) override;
253 public:
254 SvxConvertTo3DItem(sal_uInt16 nId, SfxBindings* pBindings);
255 bool GetState() const { return bState; }
258 #endif // INCLUDED_SVX_FLOAT3D_HXX
260 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */