1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #ifndef SC_PROPERTYPANEL_ALIGNMENT_HXX
23 #define SC_PROPERTYPANEL_ALIGNMENT_HXX
24 
25 #include <sfx2/sidebar/SidebarPanelBase.hxx>
26 #include <sfx2/sidebar/ControllerItem.hxx>
27 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
28 #include <vcl/fixed.hxx>
29 #include <boost/scoped_ptr.hpp>
30 #include <editeng/svxenum.hxx>
31 
32 class ToolBox;
33 class MetricField;
34 class MetricBox;
35 class CheckBox;
36 namespace svx { namespace sidebar { class SidebarDialControl; }}
37 
38 namespace sc { namespace sidebar {
39 
40 class AlignmentPropertyPanel
41 :   public Control,
42     public ::sfx2::sidebar::IContextChangeReceiver,
43     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
44 {
45 public:
46     static AlignmentPropertyPanel* Create(
47         Window* pParent,
48         const cssu::Reference<css::frame::XFrame>& rxFrame,
49         SfxBindings* pBindings);
50 
51     virtual void DataChanged(
52         const DataChangedEvent& rEvent);
53 
54     virtual void HandleContextChange(
55         const ::sfx2::sidebar::EnumContext aContext);
56 
57     virtual void NotifyItemUpdate(
58         const sal_uInt16 nSId,
59         const SfxItemState eState,
60         const SfxPoolItem* pState);
61 
62     SfxBindings* GetBindings();
63 
64 private:
65     //ui controls
66     ::boost::scoped_ptr< ToolBox >              mpTBHorizontal;
67     ::boost::scoped_ptr< ToolBox >              mpTBVertical;
68     ::boost::scoped_ptr< FixedText >            mpFTLeftIndent;
69     ::boost::scoped_ptr< MetricField >          mpMFLeftIndent;
70     ::boost::scoped_ptr< CheckBox >             mpCBXWrapText;
71     ::boost::scoped_ptr< CheckBox >             mpCBXMergeCell;
72     ::boost::scoped_ptr< FixedText >            mpFtRotate;
73     ::boost::scoped_ptr< svx::sidebar::SidebarDialControl > mpCtrlDial;
74     ::boost::scoped_ptr< MetricBox >            mpMtrAngle;
75     ::boost::scoped_ptr< CheckBox >             mpCbStacked;
76 
77     ::sfx2::sidebar::ControllerItem             maAlignHorControl;
78     ::sfx2::sidebar::ControllerItem             maAlignVerControl;
79     ::sfx2::sidebar::ControllerItem             maLeftIndentControl;
80     ::sfx2::sidebar::ControllerItem             maMergeCellControl;
81     ::sfx2::sidebar::ControllerItem             maWrapTextControl;
82     ::sfx2::sidebar::ControllerItem             maAngleControl;
83     ::sfx2::sidebar::ControllerItem             maStackControl;
84 
85     Image                                       maIMGAlignLeft;
86     Image                                       maIMGAlignCenter;
87     Image                                       maIMGAlignRight;
88     Image                                       maIMGAlignJust;
89     Image                                       maIMGAlignTop;
90     Image                                       maIMGAlignCenterV;
91     Image                                       maIMGAlignBottom;
92 
93     SvxCellHorJustify                           meHorAlignState;
94     SvxCellVerJustify                           meVerAlignState;
95 
96     /// bitfield
97     bool                                        mbMultiDisable : 1;
98 
99     cssu::Reference<css::frame::XFrame>         mxFrame;
100     ::sfx2::sidebar::EnumContext                maContext;
101     SfxBindings*                                mpBindings;
102 
103     DECL_LINK( TbxHorAlignSelectHdl, ToolBox* );
104     DECL_LINK( TbxVerAlignSelectHdl, ToolBox* );
105     DECL_LINK( MFLeftIndentMdyHdl, void * );
106     DECL_LINK( CBOXMergnCellClkHdl, void * );
107     DECL_LINK( CBOXWrapTextClkHdl, void * );
108     DECL_LINK( AngleModifiedHdl, void * );
109     DECL_LINK( RotationHdl, void * );
110     DECL_LINK( ClickStackHdl, void * );
111 
112     // constructor/destuctor
113     AlignmentPropertyPanel(
114         Window* pParent,
115         const cssu::Reference<css::frame::XFrame>& rxFrame,
116         SfxBindings* pBindings);
117     virtual ~AlignmentPropertyPanel();
118 
119     void Initialize();
120     void UpdateHorAlign();
121     void UpdateVerAlign();
122     void FormatDegrees(double& dTmp);
123 };
124 
125 } } // end of namespace ::sc::sidebar
126 
127 #endif
128 // eof
129