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         const bool bIsEnabled);
62 
63     SfxBindings* GetBindings();
64 
65 private:
66     //ui controls
67 	::boost::scoped_ptr<Window> 			    mpTBHorizontalBackground;
68     ::boost::scoped_ptr< ToolBox >              mpTBHorizontal;
69 	::boost::scoped_ptr<Window> 			    mpTBVerticalBackground;
70     ::boost::scoped_ptr< ToolBox >              mpTBVertical;
71     ::boost::scoped_ptr< FixedText >            mpFTLeftIndent;
72     ::boost::scoped_ptr< MetricField >          mpMFLeftIndent;
73     ::boost::scoped_ptr< CheckBox >             mpCBXWrapText;
74     ::boost::scoped_ptr< CheckBox >             mpCBXMergeCell;
75     ::boost::scoped_ptr< FixedText >            mpFtRotate;
76     ::boost::scoped_ptr< svx::sidebar::SidebarDialControl > mpCtrlDial;
77     ::boost::scoped_ptr< MetricBox >            mpMtrAngle;
78     ::boost::scoped_ptr< CheckBox >             mpCbStacked;
79 
80     ::sfx2::sidebar::ControllerItem             maAlignHorControl;
81     ::sfx2::sidebar::ControllerItem             maAlignVerControl;
82     ::sfx2::sidebar::ControllerItem             maLeftIndentControl;
83     ::sfx2::sidebar::ControllerItem             maMergeCellControl;
84     ::sfx2::sidebar::ControllerItem             maWrapTextControl;
85     ::sfx2::sidebar::ControllerItem             maAngleControl;
86     ::sfx2::sidebar::ControllerItem             maStackControl;
87 
88     Image                                       maIMGAlignLeft;
89     Image                                       maIMGAlignCenter;
90     Image                                       maIMGAlignRight;
91     Image                                       maIMGAlignJust;
92     Image                                       maIMGAlignTop;
93     Image                                       maIMGAlignCenterV;
94     Image                                       maIMGAlignBottom;
95 
96     SvxCellHorJustify                           meHorAlignState;
97     SvxCellVerJustify                           meVerAlignState;
98 
99     /// bitfield
100     bool                                        mbMultiDisable : 1;
101 
102     cssu::Reference<css::frame::XFrame>         mxFrame;
103     ::sfx2::sidebar::EnumContext                maContext;
104     SfxBindings*                                mpBindings;
105 
106     DECL_LINK( TbxHorAlignSelectHdl, ToolBox* );
107     DECL_LINK( TbxVerAlignSelectHdl, ToolBox* );
108     DECL_LINK( MFLeftIndentMdyHdl, void * );
109     DECL_LINK( CBOXMergnCellClkHdl, void * );
110     DECL_LINK( CBOXWrapTextClkHdl, void * );
111     DECL_LINK( AngleModifiedHdl, void * );
112     DECL_LINK( RotationHdl, void * );
113     DECL_LINK( ClickStackHdl, void * );
114 
115     // constructor/destuctor
116     AlignmentPropertyPanel(
117         Window* pParent,
118         const cssu::Reference<css::frame::XFrame>& rxFrame,
119         SfxBindings* pBindings);
120     virtual ~AlignmentPropertyPanel();
121 
122     void Initialize();
123     void UpdateHorAlign();
124     void UpdateVerAlign();
125     void FormatDegrees(double& dTmp);
126 };
127 
128 } } // end of namespace ::sc::sidebar
129 
130 #endif
131 // eof
132