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_FILLCTRL_HXX
21 #define INCLUDED_SVX_FILLCTRL_HXX
22 
23 #include <memory>
24 #include <sfx2/tbxctrl.hxx>
25 #include <svx/svxdllapi.h>
26 #include <com/sun/star/drawing/FillStyle.hpp>
27 
28 class XFillStyleItem;
29 class XFillColorItem;
30 class XFillGradientItem;
31 class XFillHatchItem;
32 class XFillBitmapItem;
33 class FillControl;
34 class SvxFillTypeBox;
35 class SvxFillAttrBox;
36 class ListBox;
37 
38 /*************************************************************************
39 |*
40 |* Class for surface attributes (controls and controller)
41 |*
42 \************************************************************************/
43 
44 class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxFillToolBoxControl final : public SfxToolBoxControl
45 {
46 private:
47     std::unique_ptr< XFillStyleItem >    mpStyleItem;
48     std::unique_ptr< XFillColorItem >    mpColorItem;
49     std::unique_ptr< XFillGradientItem > mpFillGradientItem;
50     std::unique_ptr< XFillHatchItem >    mpHatchItem;
51     std::unique_ptr< XFillBitmapItem >   mpBitmapItem;
52 
53     VclPtr<FillControl>        mpFillControl;
54     VclPtr<SvxFillTypeBox>     mpLbFillType;
55     VclPtr<ToolBox>            mpToolBoxColor;
56     VclPtr<SvxFillAttrBox>     mpLbFillAttr;
57 
58     css::drawing::FillStyle    meLastXFS;
59     sal_Int32           mnLastPosGradient;
60     sal_Int32           mnLastPosHatch;
61     sal_Int32           mnLastPosBitmap;
62 
63     DECL_LINK(SelectFillTypeHdl, ListBox&, void);
64     DECL_LINK(SelectFillAttrHdl, ListBox&, void);
65 
66 public:
67     SFX_DECL_TOOLBOX_CONTROL();
68 
69     SvxFillToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
70     virtual ~SvxFillToolBoxControl() override;
71 
72     virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) override;
73     void Update();
74     virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) override;
75 };
76 
77 class SAL_WARN_UNUSED FillControl : public vcl::Window
78 {
79 private:
80     friend class SvxFillToolBoxControl;
81 
82     VclPtr<SvxFillTypeBox>     mpLbFillType;
83     VclPtr<ToolBox>            mpToolBoxColor;
84     VclPtr<SvxFillAttrBox>     mpLbFillAttr;
85 
86     void SetOptimalSize();
87 
88     virtual void DataChanged(const DataChangedEvent& rDCEvt) override;
89 
90 public:
91     FillControl(vcl::Window* pParent);
92     virtual ~FillControl() override;
93     virtual void dispose() override;
94 
95     virtual void Resize() override;
96 };
97 
98 #endif // INCLUDED_SVX_FILLCTRL_HXX
99 
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
101