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/ControllerItem.hxx>
26 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
27 #include <vcl/fixed.hxx>
28 #include <boost/scoped_ptr.hpp>
29 #include <editeng/svxenum.hxx>
30 
31 class ToolBox;
32 class MetricField;
33 class MetricBox;
34 class CheckBox;
35 namespace svx { namespace sidebar { class SidebarDialControl; }}
36 
37 namespace sc { namespace sidebar {
38 
39 class AlignmentPropertyPanel
40 :   public Control,
41     public ::sfx2::sidebar::IContextChangeReceiver,
42     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
43 {
44 public:
45     static AlignmentPropertyPanel* Create(
46         Window* pParent,
47         const cssu::Reference<css::frame::XFrame>& rxFrame,
48         SfxBindings* pBindings);
49 
50     virtual void DataChanged(
51         const DataChangedEvent& rEvent);
52 
53     virtual void HandleContextChange(
54         const ::sfx2::sidebar::EnumContext aContext);
55 
56     virtual void NotifyItemUpdate(
57         const sal_uInt16 nSId,
58         const SfxItemState eState,
59         const SfxPoolItem* pState,
60         const bool bIsEnabled);
61 
62     SfxBindings* GetBindings();
63 
64 private:
65     //ui controls
66 	::boost::scoped_ptr<Window> 			    mpTBHorizontalBackground;
67     ::boost::scoped_ptr< ToolBox >              mpTBHorizontal;
68 	::boost::scoped_ptr<Window> 			    mpTBVerticalBackground;
69     ::boost::scoped_ptr< ToolBox >              mpTBVertical;
70     ::boost::scoped_ptr< FixedText >            mpFTLeftIndent;
71     ::boost::scoped_ptr< MetricField >          mpMFLeftIndent;
72     ::boost::scoped_ptr< CheckBox >             mpCBXWrapText;
73     ::boost::scoped_ptr< CheckBox >             mpCBXMergeCell;
74     ::boost::scoped_ptr< FixedText >            mpFtRotate;
75     ::boost::scoped_ptr< svx::sidebar::SidebarDialControl > mpCtrlDial;
76     ::boost::scoped_ptr< MetricBox >            mpMtrAngle;
77     ::boost::scoped_ptr< CheckBox >             mpCbStacked;
78 
79     ::sfx2::sidebar::ControllerItem             maAlignHorControl;
80     ::sfx2::sidebar::ControllerItem             maAlignVerControl;
81     ::sfx2::sidebar::ControllerItem             maLeftIndentControl;
82     ::sfx2::sidebar::ControllerItem             maMergeCellControl;
83     ::sfx2::sidebar::ControllerItem             maWrapTextControl;
84     ::sfx2::sidebar::ControllerItem             maAngleControl;
85     ::sfx2::sidebar::ControllerItem             maStackControl;
86 
87     Image                                       maIMGAlignLeft;
88     Image                                       maIMGAlignCenter;
89     Image                                       maIMGAlignRight;
90     Image                                       maIMGAlignJust;
91     Image                                       maIMGAlignTop;
92     Image                                       maIMGAlignCenterV;
93     Image                                       maIMGAlignBottom;
94 
95     SvxCellHorJustify                           meHorAlignState;
96     SvxCellVerJustify                           meVerAlignState;
97 
98     /// bitfield
99     bool                                        mbMultiDisable : 1;
100 
101     cssu::Reference<css::frame::XFrame>         mxFrame;
102     ::sfx2::sidebar::EnumContext                maContext;
103     SfxBindings*                                mpBindings;
104 
105     DECL_LINK( TbxHorAlignSelectHdl, ToolBox* );
106     DECL_LINK( TbxVerAlignSelectHdl, ToolBox* );
107     DECL_LINK( MFLeftIndentMdyHdl, void * );
108     DECL_LINK( CBOXMergnCellClkHdl, void * );
109     DECL_LINK( CBOXWrapTextClkHdl, void * );
110     DECL_LINK( AngleModifiedHdl, void * );
111     DECL_LINK( RotationHdl, void * );
112     DECL_LINK( ClickStackHdl, void * );
113 
114     // constructor/destuctor
115     AlignmentPropertyPanel(
116         Window* pParent,
117         const cssu::Reference<css::frame::XFrame>& rxFrame,
118         SfxBindings* pBindings);
119     virtual ~AlignmentPropertyPanel();
120 
121     void Initialize();
122     void UpdateHorAlign();
123     void UpdateVerAlign();
124     void FormatDegrees(double& dTmp);
125 };
126 
127 } } // end of namespace ::sc::sidebar
128 
129 #endif
130 // eof
131