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 #ifndef INCLUDED_SVX_FLOAT3D_HXX 21 #define INCLUDED_SVX_FLOAT3D_HXX 22 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> 31 32 #include <svx/dlgctl3d.hxx> 33 34 35 enum class ViewType3D 36 { 37 Geo = 1, 38 Representation, 39 Light, 40 Texture, 41 Material 42 }; 43 44 class FmFormModel; 45 class Svx3DCtrlItem; 46 class SvxConvertTo3DItem; 47 class SvxColorListBox; 48 49 struct Svx3DWinImpl; 50 51 class SAL_WARN_UNUSED SVX_DLLPUBLIC Svx3DWin final : public SfxDockingWindow 52 { 53 friend class Svx3DChildWindow; 54 friend class Svx3DCtrlItem; 55 using Window::Update; 56 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; 65 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; 76 77 VclPtr<VclContainer> m_pFLSegments; 78 VclPtr<NumericField> m_pNumHorizontal; 79 VclPtr<NumericField> m_pNumVertical; 80 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; 88 89 // presentation 90 VclPtr<VclContainer> m_pFLRepresentation; 91 VclPtr<ListBox> m_pLbShademode; 92 93 VclPtr<VclContainer> m_pFLShadow; 94 VclPtr<PushButton> m_pBtnShadow3d; 95 VclPtr<FixedText> m_pFtSlant; 96 VclPtr<MetricField> m_pMtrSlant; 97 98 VclPtr<VclContainer> m_pFLCamera; 99 VclPtr<MetricField> m_pMtrDistance; 100 VclPtr<MetricField> m_pMtrFocalLength; 101 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 123 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; 138 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; 147 148 VclPtr<VclContainer> m_pFLMatSpecular; 149 VclPtr<SvxColorListBox> m_pLbMatSpecular; 150 VclPtr<PushButton> m_pBtnSpecularColor; 151 VclPtr<MetricField> m_pMtrMatSpecularIntensity; 152 153 VclPtr<Svx3DPreviewControl> m_pCtlPreview; 154 VclPtr<SvxLightCtl3D> m_pCtlLightPreview; 155 156 // bottom part 157 VclPtr<PushButton> m_pBtnConvertTo3D; 158 VclPtr<PushButton> m_pBtnLatheObject; 159 VclPtr<PushButton> m_pBtnPerspective; 160 161 // the rest ... 162 Image const aImgLightOn; 163 Image const aImgLightOff; 164 bool bUpdate; 165 ViewType3D eViewType; 166 167 // Model, Page, View etc. for favourites 168 std::unique_ptr<FmFormModel> pModel; 169 170 SfxBindings* const pBindings; 171 std::unique_ptr<Svx3DCtrlItem> pControllerItem; 172 173 std::unique_ptr<SvxConvertTo3DItem> pConvertTo3DItem; 174 std::unique_ptr<SvxConvertTo3DItem> pConvertTo3DLatheItem; 175 176 std::unique_ptr<Svx3DWinImpl> mpImpl; 177 MapUnit ePoolUnit; 178 FieldUnit eFUnit; 179 180 // ItemSet used to remember set 2d attributes 181 std::unique_ptr<SfxItemSet> mpRemember2DAttributes; 182 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); 192 193 DECL_LINK( ChangeSelectionCallbackHdl, SvxLightCtl3D*, void ); 194 195 SVX_DLLPRIVATE void Construct(); 196 SVX_DLLPRIVATE void Reset(); 197 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 ); 201 202 SVX_DLLPRIVATE bool GetUILightState( const PushButton& rBtn ) const; 203 SVX_DLLPRIVATE void SetUILightState( PushButton& aBtn, bool bState ); 204 205 virtual void Resize() override; 206 207 public: 208 Svx3DWin( SfxBindings* pBindings, SfxChildWindow *pCW, 209 vcl::Window* pParent ); 210 virtual ~Svx3DWin() override; 211 virtual void dispose() override; 212 213 void InitColorLB(); IsUpdateMode() const214 bool IsUpdateMode() const { return bUpdate; } 215 216 void Update( SfxItemSet const & rSet ); 217 void GetAttr( SfxItemSet& rSet ); 218 219 void UpdatePreview(); // upward (private) 220 void DocumentReload(); 221 }; 222 223 /************************************************************************* 224 |* 225 |* Controller item for 3D Window (Floating/Docking) 226 |* 227 \************************************************************************/ 228 229 class Svx3DCtrlItem : public SfxControllerItem 230 { 231 protected: 232 virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState, 233 const SfxPoolItem* pState ) override; 234 235 public: 236 Svx3DCtrlItem( sal_uInt16, SfxBindings* ); 237 }; 238 239 /************************************************************************* 240 |* 241 |* ControllerItem for State of a Slot 242 |* (SID_CONVERT_TO_3D, SID_CONVERT_TO_3D_LATHE_FAST) 243 |* 244 \************************************************************************/ 245 246 class SvxConvertTo3DItem : public SfxControllerItem 247 { 248 bool bState; 249 250 protected: 251 virtual void StateChanged(sal_uInt16 nSId, SfxItemState eState, const SfxPoolItem* pState) override; 252 253 public: 254 SvxConvertTo3DItem(sal_uInt16 nId, SfxBindings* pBindings); GetState() const255 bool GetState() const { return bState; } 256 }; 257 258 #endif // INCLUDED_SVX_FLOAT3D_HXX 259 260 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 261