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 SVX_PROPERTYPANEL_AREAPAGE_HXX 23 #define SVX_PROPERTYPANEL_AREAPAGE_HXX 24 25 #include <svx/sidebar/ColorPopup.hxx> 26 #include "AreaTransparencyGradientPopup.hxx" 27 #include <vcl/ctrl.hxx> 28 #include <sfx2/sidebar/SidebarPanelBase.hxx> 29 #include <sfx2/sidebar/ControllerItem.hxx> 30 #include <sfx2/sidebar/IContextChangeReceiver.hxx> 31 #include <svx/xgrad.hxx> 32 #include <svx/itemwin.hxx> 33 #include <svx/xfillit0.hxx> 34 #include <svx/xflclit.hxx> 35 #include <svx/xflgrit.hxx> 36 #include <svx/xflhtit.hxx> 37 #include <svx/xbtmpit.hxx> 38 #include <svx/drawitem.hxx> 39 #include <vcl/lstbox.hxx> 40 #include <vcl/field.hxx> 41 #include <vcl/fixed.hxx> 42 #include <svl/intitem.hxx> 43 #include <svx/tbxcolorupdate.hxx> 44 #include <com/sun/star/ui/XUIElement.hpp> 45 #include <boost/scoped_ptr.hpp> 46 47 48 class XFillFloatTransparenceItem; 49 namespace svx { class ToolboxButtonColorUpdater; } 50 51 52 namespace svx { namespace sidebar { 53 54 class PopupContainer; 55 class AreaTransparencyGradientControl; 56 57 class AreaPropertyPanel 58 : public Control, 59 public ::sfx2::sidebar::IContextChangeReceiver, 60 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface 61 { 62 public: 63 static AreaPropertyPanel* Create( 64 Window* pParent, 65 const cssu::Reference<css::frame::XFrame>& rxFrame, 66 SfxBindings* pBindings); 67 68 virtual void DataChanged( 69 const DataChangedEvent& rEvent); 70 71 virtual void HandleContextChange( 72 const ::sfx2::sidebar::EnumContext aContext); 73 74 virtual void NotifyItemUpdate( 75 const sal_uInt16 nSId, 76 const SfxItemState eState, 77 const SfxPoolItem* pState); 78 79 SfxBindings* GetBindings(); 80 81 const static sal_Int32 DEFAULT_CENTERX; 82 const static sal_Int32 DEFAULT_CENTERY; 83 const static sal_Int32 DEFAULT_ANGLE; 84 const static sal_Int32 DEFAULT_STARTVALUE; 85 const static sal_Int32 DEFAULT_ENDVALUE; 86 const static sal_Int32 DEFAULT_BORDER; 87 88 XGradient GetGradient (const XGradientStyle eStyle) const; 89 void SetGradient (const XGradient& rGradient); 90 sal_Int32 GetSelectedTransparencyTypeIndex (void) const; 91 92 private: 93 sal_uInt16 meLastXFS; 94 Color maLastColor; 95 96 sal_uInt16 mnLastPosGradient; 97 sal_uInt16 mnLastPosHatch; 98 sal_uInt16 mnLastPosBitmap; 99 sal_uInt16 mnLastTransSolid; 100 101 XGradient maGradientLinear; 102 XGradient maGradientAxial; 103 XGradient maGradientRadial; 104 XGradient maGradientElliptical; 105 XGradient maGradientSquare; 106 XGradient maGradientRect; 107 108 //ui controls 109 ::boost::scoped_ptr< FixedText > mpColorTextFT; 110 ::boost::scoped_ptr< SvxFillTypeBox > mpLbFillType; 111 ::boost::scoped_ptr< SvxFillAttrBox > mpLbFillAttr; 112 ::boost::scoped_ptr< Window > mpToolBoxColorBackground; 113 ::boost::scoped_ptr< ToolBox > mpToolBoxColor; // for new color picker 114 ::boost::scoped_ptr< FixedText > mpTrspTextFT; 115 ::boost::scoped_ptr< ListBox > mpLBTransType; 116 ::boost::scoped_ptr< MetricField > mpMTRTransparent; 117 ::boost::scoped_ptr< Window > mpBTNGradientBackground; 118 ::boost::scoped_ptr< ToolBox > mpBTNGradient; 119 120 ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater; 121 122 ::boost::scoped_ptr< XFillStyleItem > mpStyleItem; 123 ::boost::scoped_ptr< XFillColorItem > mpColorItem; 124 ::boost::scoped_ptr< XFillGradientItem > mpFillGradientItem; 125 ::boost::scoped_ptr< XFillHatchItem > mpHatchItem; 126 ::boost::scoped_ptr< XFillBitmapItem > mpBitmapItem; 127 ::boost::scoped_ptr< SvxColorTableItem > mpColorTableItem; 128 ::boost::scoped_ptr< SvxGradientListItem > mpGradientListItem; 129 ::boost::scoped_ptr< SvxHatchListItem > mpHatchListItem; 130 ::boost::scoped_ptr< SvxBitmapListItem > mpBitmapListItem; 131 132 ::sfx2::sidebar::ControllerItem maStyleControl; 133 ::sfx2::sidebar::ControllerItem maColorControl; 134 ::sfx2::sidebar::ControllerItem maGradientControl; 135 ::sfx2::sidebar::ControllerItem maHatchControl; 136 ::sfx2::sidebar::ControllerItem maBitmapControl; 137 ::sfx2::sidebar::ControllerItem maColorTableControl; 138 ::sfx2::sidebar::ControllerItem maGradientListControl; 139 ::sfx2::sidebar::ControllerItem maHatchListControl; 140 ::sfx2::sidebar::ControllerItem maBitmapListControl; 141 ::sfx2::sidebar::ControllerItem maFillTransparenceController; 142 ::sfx2::sidebar::ControllerItem maFillFloatTransparenceController; 143 144 Image maImgAxial; 145 Image maImgElli; 146 Image maImgQuad; 147 Image maImgRadial; 148 Image maImgSquare; 149 Image maImgLinear; 150 Image maImgColor; 151 152 //for high contract 153 Image maImgAxialH; 154 Image maImgElliH; 155 Image maImgQuadH; 156 Image maImgRadialH; 157 Image maImgSquareH; 158 Image maImgLinearH; 159 Image maImgColorH; 160 161 String msHelpFillType; 162 String msHelpFillAttr; 163 164 AreaTransparencyGradientPopup maTrGrPopup; 165 ColorPopup maColorPopup; 166 167 ::boost::scoped_ptr< XFillFloatTransparenceItem > mpFloatTransparenceItem; 168 ::boost::scoped_ptr< SfxUInt16Item > mpTransparanceItem; 169 170 cssu::Reference<css::frame::XFrame> mxFrame; 171 ::sfx2::sidebar::EnumContext maContext; 172 SfxBindings* mpBindings; 173 174 /// bitfield 175 bool mbTBShow : 1; 176 bool mbColorAvail : 1; 177 178 DECL_LINK(SelectFillTypeHdl, ListBox* ); 179 DECL_LINK(SelectFillAttrHdl, ListBox* ); 180 DECL_LINK(ChangeTrgrTypeHdl_Impl, void*); 181 DECL_LINK(ModifyTransparentHdl_Impl, void*); 182 DECL_LINK( ImplPopupModeEndHdl, FloatingWindow* ); 183 184 // for transparency gradient 185 PopupControl* CreateTransparencyGradientControl (PopupContainer* pParent); 186 DECL_LINK( ClickTrGrHdl_Impl, ToolBox* ); 187 188 // for color picker 189 PopupControl* CreateColorPopupControl (PopupContainer* pParent); 190 DECL_LINK(ToolBoxColorDropHdl, ToolBox *); //for new color picker 191 192 // constructor/destuctor 193 AreaPropertyPanel( 194 Window* pParent, 195 const cssu::Reference<css::frame::XFrame>& rxFrame, 196 SfxBindings* pBindings); 197 virtual ~AreaPropertyPanel(void); 198 199 void SetupIcons(void); 200 void Initialize(); 201 void Update(); 202 void ImpUpdateTransparencies(); 203 204 Color GetLastColor (void) const; 205 void SetColor ( 206 const String& rsColorName, 207 const Color aColor); 208 }; 209 210 211 } } // end of namespace ::svx::sidebar 212 213 214 215 #endif // SVX_PROPERTYPANEL_AREAPAGE_HXX 216