summaryrefslogtreecommitdiff
path: root/svx/source/sidebar/area/AreaPropertyPanel.hxx
blob: 0d3540f6e21d037bbb72c4fa0b3c0b0d6b45bd0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */
#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREAPROPERTYPANEL_HXX
#define INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREAPROPERTYPANEL_HXX

#include <svx/sidebar/ColorPopup.hxx>
#include "AreaTransparencyGradientPopup.hxx"
#include <vcl/ctrl.hxx>
#include <sfx2/sidebar/SidebarPanelBase.hxx>
#include <sfx2/sidebar/ControllerItem.hxx>
#include <svx/xgrad.hxx>
#include <svx/itemwin.hxx>
#include <svx/xfillit0.hxx>
#include <svx/xflclit.hxx>
#include <svx/xflgrit.hxx>
#include <svx/xflhtit.hxx>
#include <svx/xbtmpit.hxx>
#include <svx/drawitem.hxx>
#include <svx/sidebar/PanelLayout.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/field.hxx>
#include <vcl/fixed.hxx>
#include <svl/intitem.hxx>
#include <svx/tbxcolorupdate.hxx>
#include <com/sun/star/ui/XUIElement.hpp>
#include <boost/scoped_ptr.hpp>


class XFillFloatTransparenceItem;
namespace svx { class ToolboxButtonColorUpdater; }


namespace svx { namespace sidebar {

class PopupContainer;
class AreaTransparencyGradientControl;

class AreaPropertyPanel
:   public PanelLayout,
    public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
{
public:
    static AreaPropertyPanel* Create(
        vcl::Window* pParent,
        const css::uno::Reference<css::frame::XFrame>& rxFrame,
        SfxBindings* pBindings);

    virtual void DataChanged(
        const DataChangedEvent& rEvent) SAL_OVERRIDE;

    virtual void NotifyItemUpdate(
        const sal_uInt16 nSId,
        const SfxItemState eState,
        const SfxPoolItem* pState,
        const bool bIsEnabled) SAL_OVERRIDE;

    SfxBindings* GetBindings() { return mpBindings;}

    const static sal_Int32 DEFAULT_CENTERX;
    const static sal_Int32 DEFAULT_CENTERY;
    const static sal_Int32 DEFAULT_ANGLE;
    const static sal_Int32 DEFAULT_STARTVALUE;
    const static sal_Int32 DEFAULT_ENDVALUE;
    const static sal_Int32 DEFAULT_BORDER;

    XGradient GetGradient (const XGradientStyle eStyle) const;
    void SetGradient (const XGradient& rGradient);
    sal_Int32 GetSelectedTransparencyTypeIndex (void) const;

private:
    sal_uInt16                                          meLastXFS;
    Color                                               maLastColor;

    sal_Int32                                           mnLastPosGradient;
    sal_Int32                                           mnLastPosHatch;
    sal_Int32                                           mnLastPosBitmap;
    sal_uInt16                                          mnLastTransSolid;

    XGradient                                           maGradientLinear;
    XGradient                                           maGradientAxial;
    XGradient                                           maGradientRadial;
    XGradient                                           maGradientElliptical;
    XGradient                                           maGradientSquare;
    XGradient                                           maGradientRect;

    //ui controls
    FixedText*                                          mpColorTextFT;
    SvxFillTypeBox*                                     mpLbFillType;
    SvxFillAttrBox*                                     mpLbFillAttr;
    ToolBox*                                            mpToolBoxColor; // for new color picker
    FixedText*                                          mpTrspTextFT;
    ListBox*                                            mpLBTransType;
    MetricField*                                        mpMTRTransparent;
    ToolBox*                                            mpBTNGradient;

    ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;

    ::boost::scoped_ptr< XFillStyleItem >               mpStyleItem;
    ::boost::scoped_ptr< XFillColorItem >               mpColorItem;
    ::boost::scoped_ptr< XFillGradientItem >            mpFillGradientItem;
    ::boost::scoped_ptr< XFillHatchItem >               mpHatchItem;
    ::boost::scoped_ptr< XFillBitmapItem >              mpBitmapItem;

    ::sfx2::sidebar::ControllerItem                     maStyleControl;
    ::sfx2::sidebar::ControllerItem                     maColorControl;
    ::sfx2::sidebar::ControllerItem                     maGradientControl;
    ::sfx2::sidebar::ControllerItem                     maHatchControl;
    ::sfx2::sidebar::ControllerItem                     maBitmapControl;
    ::sfx2::sidebar::ControllerItem                     maColorTableControl;
    ::sfx2::sidebar::ControllerItem                     maGradientListControl;
    ::sfx2::sidebar::ControllerItem                     maHatchListControl;
    ::sfx2::sidebar::ControllerItem                     maBitmapListControl;
    ::sfx2::sidebar::ControllerItem                     maFillTransparenceController;
    ::sfx2::sidebar::ControllerItem                     maFillFloatTransparenceController;

    Image                                               maImgAxial;
    Image                                               maImgElli;
    Image                                               maImgQuad;
    Image                                               maImgRadial;
    Image                                               maImgSquare;
    Image                                               maImgLinear;
    Image                                               maImgColor;

    OUString                                            msHelpFillAttr;

    AreaTransparencyGradientPopup maTrGrPopup;
    ColorPopup maColorPopup;

    ::boost::scoped_ptr< XFillFloatTransparenceItem >   mpFloatTransparenceItem;
    ::boost::scoped_ptr< SfxUInt16Item >                mpTransparanceItem;

    css::uno::Reference<css::frame::XFrame>                 mxFrame;
    SfxBindings*                                        mpBindings;

    /// bitfield
    bool                                                mbColorAvail : 1;

    DECL_LINK(SelectFillTypeHdl, ListBox* );
    DECL_LINK(SelectFillAttrHdl, ListBox* );
    DECL_LINK(ChangeTrgrTypeHdl_Impl, void*);
    DECL_LINK(ModifyTransparentHdl_Impl, void*);

    // for transparency gradient
    PopupControl* CreateTransparencyGradientControl (PopupContainer* pParent);
    DECL_LINK( ClickTrGrHdl_Impl, ToolBox* );

    // for color picker
    PopupControl* CreateColorPopupControl (PopupContainer* pParent);
    DECL_LINK(ToolBoxColorDropHdl, ToolBox *); //for new color picker

    // constructor/destuctor
    AreaPropertyPanel(
        vcl::Window* pParent,
        const css::uno::Reference<css::frame::XFrame>& rxFrame,
        SfxBindings* pBindings);
    virtual ~AreaPropertyPanel(void);

    void SetupIcons(void);
    void Initialize();
    void Update();
    void ImpUpdateTransparencies();

    const Color& GetLastColor (void) const { return maLastColor;}
    void SetColor (
        const OUString& rsColorName,
        const Color aColor);
};


} } // end of namespace ::svx::sidebar



#endif // INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREAPROPERTYPANEL_HXX

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */