1*8dcb2a10SAndre Fischer /************************************************************** 2*8dcb2a10SAndre Fischer * 3*8dcb2a10SAndre Fischer * Licensed to the Apache Software Foundation (ASF) under one 4*8dcb2a10SAndre Fischer * or more contributor license agreements. See the NOTICE file 5*8dcb2a10SAndre Fischer * distributed with this work for additional information 6*8dcb2a10SAndre Fischer * regarding copyright ownership. The ASF licenses this file 7*8dcb2a10SAndre Fischer * to you under the Apache License, Version 2.0 (the 8*8dcb2a10SAndre Fischer * "License"); you may not use this file except in compliance 9*8dcb2a10SAndre Fischer * with the License. You may obtain a copy of the License at 10*8dcb2a10SAndre Fischer * 11*8dcb2a10SAndre Fischer * http://www.apache.org/licenses/LICENSE-2.0 12*8dcb2a10SAndre Fischer * 13*8dcb2a10SAndre Fischer * Unless required by applicable law or agreed to in writing, 14*8dcb2a10SAndre Fischer * software distributed under the License is distributed on an 15*8dcb2a10SAndre Fischer * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*8dcb2a10SAndre Fischer * KIND, either express or implied. See the License for the 17*8dcb2a10SAndre Fischer * specific language governing permissions and limitations 18*8dcb2a10SAndre Fischer * under the License. 19*8dcb2a10SAndre Fischer * 20*8dcb2a10SAndre Fischer *************************************************************/ 21*8dcb2a10SAndre Fischer 22*8dcb2a10SAndre Fischer #include "AreaTransparencyGradientControl.hxx" 23*8dcb2a10SAndre Fischer #include "AreaPropertyPanel.hxx" 24*8dcb2a10SAndre Fischer #include "AreaPropertyPanel.hrc" 25*8dcb2a10SAndre Fischer 26*8dcb2a10SAndre Fischer #include <svx/dialogs.hrc> 27*8dcb2a10SAndre Fischer #include <svx/dialmgr.hxx> 28*8dcb2a10SAndre Fischer #include <svx/xflftrit.hxx> 29*8dcb2a10SAndre Fischer #include <sfx2/sidebar/propertypanel.hrc> 30*8dcb2a10SAndre Fischer #include <sfx2/bindings.hxx> 31*8dcb2a10SAndre Fischer #include <sfx2/dispatch.hxx> 32*8dcb2a10SAndre Fischer 33*8dcb2a10SAndre Fischer namespace svx { namespace sidebar { 34*8dcb2a10SAndre Fischer 35*8dcb2a10SAndre Fischer // positioning helpers 36*8dcb2a10SAndre Fischer 37*8dcb2a10SAndre Fischer #define APOS1_1 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL), MAP_APPFONT)) 38*8dcb2a10SAndre Fischer #define APOS2_1 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL), MAP_APPFONT)) 39*8dcb2a10SAndre Fischer #define APOS1_2 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL), MAP_APPFONT)) 40*8dcb2a10SAndre Fischer #define APOS2_2 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL), MAP_APPFONT)) 41*8dcb2a10SAndre Fischer #define APOS1_3 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MAP_APPFONT)) 42*8dcb2a10SAndre Fischer #define APOS1_4 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MAP_APPFONT)) 43*8dcb2a10SAndre Fischer #define APOS2_3 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MAP_APPFONT)) 44*8dcb2a10SAndre Fischer #define APOS2_4 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MAP_APPFONT)) 45*8dcb2a10SAndre Fischer #define APOS1_5 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT)) 46*8dcb2a10SAndre Fischer #define APOS1_6 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+2*(MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT)) 47*8dcb2a10SAndre Fischer #define APOS2_5 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT)) 48*8dcb2a10SAndre Fischer #define APOS2_6 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+2*(MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT)) 49*8dcb2a10SAndre Fischer #define APOS1_7 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT)) 50*8dcb2a10SAndre Fischer #define APOS1_8 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 4*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+3*(MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT)) 51*8dcb2a10SAndre Fischer #define APOS_Left_Right_1 Point(LogicToPixel(Point(LEFT_RIGHT_X1,LEFT_RIGHT_Y1), MAP_APPFONT)) 52*8dcb2a10SAndre Fischer #define APOS_Left_Right_2 Point(LogicToPixel(Point(LEFT_RIGHT_X2,LEFT_RIGHT_Y1), MAP_APPFONT)) 53*8dcb2a10SAndre Fischer #define APOS_Left_Right_3 Point(LogicToPixel(Point(LEFT_RIGHT_X1,LEFT_RIGHT_Y2), MAP_APPFONT)) 54*8dcb2a10SAndre Fischer #define APOS_Left_Right_4 Point(LogicToPixel(Point(LEFT_RIGHT_X2,LEFT_RIGHT_Y2), MAP_APPFONT)) 55*8dcb2a10SAndre Fischer 56*8dcb2a10SAndre Fischer 57*8dcb2a10SAndre Fischer 58*8dcb2a10SAndre Fischer 59*8dcb2a10SAndre Fischer AreaTransparencyGradientControl::AreaTransparencyGradientControl ( 60*8dcb2a10SAndre Fischer Window* pParent, 61*8dcb2a10SAndre Fischer AreaPropertyPanel& rPanel) 62*8dcb2a10SAndre Fischer : PopupControl( pParent,SVX_RES(RID_POPUPPANEL_AREAPAGE_TRGR)), 63*8dcb2a10SAndre Fischer maFtTrgrCenterX(this, SVX_RES(FT_TRGR_CENTER_X)), 64*8dcb2a10SAndre Fischer maMtrTrgrCenterX(this, SVX_RES(MTR_TRGR_CENTER_X)), 65*8dcb2a10SAndre Fischer maFtTrgrCenterY(this, SVX_RES(FT_TRGR_CENTER_Y)), 66*8dcb2a10SAndre Fischer maMtrTrgrCenterY(this, SVX_RES(MTR_TRGR_CENTER_Y)), 67*8dcb2a10SAndre Fischer maFtTrgrAngle(this, SVX_RES(FT_TRGR_ANGLE)), 68*8dcb2a10SAndre Fischer maMtrTrgrAngle(this, SVX_RES(MTR_TRGR_ANGLE)), 69*8dcb2a10SAndre Fischer maFtTrgrStartValue(this, SVX_RES(FT_TRGR_START_VALUE)), 70*8dcb2a10SAndre Fischer maMtrTrgrStartValue(this, SVX_RES(MTR_TRGR_START_VALUE)), 71*8dcb2a10SAndre Fischer maFtTrgrEndValue(this, SVX_RES(FT_TRGR_END_VALUE)), 72*8dcb2a10SAndre Fischer maMtrTrgrEndValue(this, SVX_RES(MTR_TRGR_END_VALUE)), 73*8dcb2a10SAndre Fischer maFtTrgrBorder(this, SVX_RES(FT_TRGR_BORDER)), 74*8dcb2a10SAndre Fischer maMtrTrgrBorder(this, SVX_RES(MTR_TRGR_BORDER)), 75*8dcb2a10SAndre Fischer maBtnLeft45(this, SVX_RES(BTN_LEFT_SECOND)), 76*8dcb2a10SAndre Fischer maBtnRight45(this, SVX_RES(BTN_RIGHT_FIRST)), 77*8dcb2a10SAndre Fischer maRotLeft( SVX_RES(IMG_ROT_LEFT)), 78*8dcb2a10SAndre Fischer maRotRight( SVX_RES(IMG_ROT_RIGHT)), 79*8dcb2a10SAndre Fischer mrAreaPropertyPanel(rPanel), 80*8dcb2a10SAndre Fischer mpBindings(NULL) 81*8dcb2a10SAndre Fischer { 82*8dcb2a10SAndre Fischer Link aLink = LINK( this, AreaTransparencyGradientControl, ModifiedTrgrHdl_Impl); 83*8dcb2a10SAndre Fischer maMtrTrgrCenterX.SetModifyHdl( aLink ); 84*8dcb2a10SAndre Fischer maMtrTrgrCenterY.SetModifyHdl( aLink ); 85*8dcb2a10SAndre Fischer maMtrTrgrAngle.SetModifyHdl( aLink ); 86*8dcb2a10SAndre Fischer maMtrTrgrBorder.SetModifyHdl( aLink ); 87*8dcb2a10SAndre Fischer maMtrTrgrStartValue.SetModifyHdl( aLink ); 88*8dcb2a10SAndre Fischer maMtrTrgrEndValue.SetModifyHdl( aLink ); 89*8dcb2a10SAndre Fischer aLink = LINK( this, AreaTransparencyGradientControl, Left_Click45_Impl); 90*8dcb2a10SAndre Fischer maBtnLeft45.SetSelectHdl( aLink ); 91*8dcb2a10SAndre Fischer aLink = LINK( this, AreaTransparencyGradientControl, Right_Click45_Impl); 92*8dcb2a10SAndre Fischer maBtnRight45.SetSelectHdl( aLink ); 93*8dcb2a10SAndre Fischer maBtnLeft45.SetItemImage(1,maRotLeft); 94*8dcb2a10SAndre Fischer Size aTbxSize = maBtnLeft45.CalcWindowSizePixel(); 95*8dcb2a10SAndre Fischer maBtnLeft45.SetOutputSizePixel( aTbxSize ); 96*8dcb2a10SAndre Fischer maBtnLeft45.SetQuickHelpText(1, String(SVX_RES(STR_HELP_LEFT))); //acc wj 97*8dcb2a10SAndre Fischer 98*8dcb2a10SAndre Fischer maBtnRight45.SetItemImage(1,maRotRight); 99*8dcb2a10SAndre Fischer aTbxSize = maBtnRight45.CalcWindowSizePixel(); 100*8dcb2a10SAndre Fischer maBtnRight45.SetOutputSizePixel( aTbxSize ); 101*8dcb2a10SAndre Fischer maBtnRight45.SetQuickHelpText(1, String(SVX_RES(STR_HELP_RIGHT))); //acc wj 102*8dcb2a10SAndre Fischer 103*8dcb2a10SAndre Fischer maBtnLeft45.SetBackground(Wallpaper()); 104*8dcb2a10SAndre Fischer maBtnLeft45.SetPaintTransparent(true); 105*8dcb2a10SAndre Fischer maBtnRight45.SetBackground(Wallpaper()); 106*8dcb2a10SAndre Fischer maBtnRight45.SetPaintTransparent(true); 107*8dcb2a10SAndre Fischer 108*8dcb2a10SAndre Fischer FreeResource(); 109*8dcb2a10SAndre Fischer mpBindings = mrAreaPropertyPanel.GetBindings(); 110*8dcb2a10SAndre Fischer } 111*8dcb2a10SAndre Fischer 112*8dcb2a10SAndre Fischer 113*8dcb2a10SAndre Fischer 114*8dcb2a10SAndre Fischer 115*8dcb2a10SAndre Fischer AreaTransparencyGradientControl::~AreaTransparencyGradientControl (void) 116*8dcb2a10SAndre Fischer { 117*8dcb2a10SAndre Fischer } 118*8dcb2a10SAndre Fischer 119*8dcb2a10SAndre Fischer 120*8dcb2a10SAndre Fischer 121*8dcb2a10SAndre Fischer 122*8dcb2a10SAndre Fischer void AreaTransparencyGradientControl::ToGetFocus() 123*8dcb2a10SAndre Fischer { 124*8dcb2a10SAndre Fischer if(maMtrTrgrCenterX.IsVisible()) 125*8dcb2a10SAndre Fischer maMtrTrgrCenterX.GrabFocus(); 126*8dcb2a10SAndre Fischer else 127*8dcb2a10SAndre Fischer maMtrTrgrAngle.GrabFocus(); 128*8dcb2a10SAndre Fischer } 129*8dcb2a10SAndre Fischer 130*8dcb2a10SAndre Fischer 131*8dcb2a10SAndre Fischer 132*8dcb2a10SAndre Fischer 133*8dcb2a10SAndre Fischer void AreaTransparencyGradientControl::Rearrange(XFillFloatTransparenceItem* pGradientItem) 134*8dcb2a10SAndre Fischer { 135*8dcb2a10SAndre Fischer InitStatus(pGradientItem); 136*8dcb2a10SAndre Fischer const XGradient& rGradient = pGradientItem->GetGradientValue(); 137*8dcb2a10SAndre Fischer XGradientStyle eXGS(rGradient.GetGradientStyle()); 138*8dcb2a10SAndre Fischer Size aSize(POP_WIDTH,POP_HEIGHT); 139*8dcb2a10SAndre Fischer aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); 140*8dcb2a10SAndre Fischer Size aSize2(POP_WIDTH,POP_HEIGHT2); 141*8dcb2a10SAndre Fischer aSize2 = LogicToPixel( aSize2, MapMode(MAP_APPFONT) ); 142*8dcb2a10SAndre Fischer long aPosY = 0; 143*8dcb2a10SAndre Fischer Point aPointAngle; 144*8dcb2a10SAndre Fischer Size aSizeAngle = maMtrTrgrAngle.GetSizePixel(); 145*8dcb2a10SAndre Fischer Size aTbxSize = maBtnLeft45.CalcWindowSizePixel(); 146*8dcb2a10SAndre Fischer 147*8dcb2a10SAndre Fischer switch(eXGS) 148*8dcb2a10SAndre Fischer { 149*8dcb2a10SAndre Fischer case XGRAD_LINEAR: 150*8dcb2a10SAndre Fischer case XGRAD_AXIAL: 151*8dcb2a10SAndre Fischer maFtTrgrCenterX.Hide(); 152*8dcb2a10SAndre Fischer maMtrTrgrCenterX.Hide(); 153*8dcb2a10SAndre Fischer maFtTrgrCenterY.Hide(); 154*8dcb2a10SAndre Fischer maMtrTrgrCenterY.Hide(); 155*8dcb2a10SAndre Fischer maFtTrgrAngle.Show(); 156*8dcb2a10SAndre Fischer maFtTrgrAngle.SetPosPixel(APOS1_1); 157*8dcb2a10SAndre Fischer maMtrTrgrAngle.Show(); 158*8dcb2a10SAndre Fischer maMtrTrgrAngle.SetPosPixel(APOS2_1); 159*8dcb2a10SAndre Fischer maFtTrgrStartValue.SetPosPixel(APOS1_3); 160*8dcb2a10SAndre Fischer maMtrTrgrStartValue.SetPosPixel(APOS1_4); 161*8dcb2a10SAndre Fischer maFtTrgrEndValue.SetPosPixel(APOS2_3); 162*8dcb2a10SAndre Fischer maMtrTrgrEndValue.SetPosPixel(APOS2_4); 163*8dcb2a10SAndre Fischer maFtTrgrBorder.SetPosPixel(APOS1_5); 164*8dcb2a10SAndre Fischer maMtrTrgrBorder.SetPosPixel(APOS1_6); 165*8dcb2a10SAndre Fischer 166*8dcb2a10SAndre Fischer maBtnLeft45.Show(); 167*8dcb2a10SAndre Fischer maBtnRight45.Show(); 168*8dcb2a10SAndre Fischer 169*8dcb2a10SAndre Fischer aPointAngle = maMtrTrgrAngle.GetPosPixel(); 170*8dcb2a10SAndre Fischer aPosY = aPointAngle.getY() + aSizeAngle.getHeight() - aTbxSize.getHeight(); 171*8dcb2a10SAndre Fischer 172*8dcb2a10SAndre Fischer maBtnLeft45.SetPosPixel(Point(APOS_Left_Right_1.getX(), aPosY)); 173*8dcb2a10SAndre Fischer maBtnRight45.SetPosPixel(Point(APOS_Left_Right_2.getX(), aPosY)); 174*8dcb2a10SAndre Fischer 175*8dcb2a10SAndre Fischer SetSizePixel(aSize2); 176*8dcb2a10SAndre Fischer break; 177*8dcb2a10SAndre Fischer 178*8dcb2a10SAndre Fischer case XGRAD_RADIAL: 179*8dcb2a10SAndre Fischer maFtTrgrCenterX.Show(); 180*8dcb2a10SAndre Fischer maFtTrgrCenterX.SetPosPixel(APOS1_1); 181*8dcb2a10SAndre Fischer maMtrTrgrCenterX.Show(); 182*8dcb2a10SAndre Fischer maMtrTrgrCenterX.SetPosPixel(APOS2_1); 183*8dcb2a10SAndre Fischer maFtTrgrCenterY.Show(); 184*8dcb2a10SAndre Fischer maFtTrgrCenterY.SetPosPixel(APOS1_2); 185*8dcb2a10SAndre Fischer maMtrTrgrCenterY.Show(); 186*8dcb2a10SAndre Fischer maMtrTrgrCenterY.SetPosPixel(APOS2_2); 187*8dcb2a10SAndre Fischer maFtTrgrAngle.Hide(); 188*8dcb2a10SAndre Fischer maMtrTrgrAngle.Hide(); 189*8dcb2a10SAndre Fischer maFtTrgrStartValue.SetPosPixel(APOS1_3); 190*8dcb2a10SAndre Fischer maMtrTrgrStartValue.SetPosPixel(APOS1_4); 191*8dcb2a10SAndre Fischer maFtTrgrEndValue.SetPosPixel(APOS2_3); 192*8dcb2a10SAndre Fischer maMtrTrgrEndValue.SetPosPixel(APOS2_4); 193*8dcb2a10SAndre Fischer maFtTrgrBorder.SetPosPixel(APOS1_5); 194*8dcb2a10SAndre Fischer maMtrTrgrBorder.SetPosPixel(APOS1_6); 195*8dcb2a10SAndre Fischer 196*8dcb2a10SAndre Fischer maBtnLeft45.Hide(); 197*8dcb2a10SAndre Fischer maBtnRight45.Hide(); 198*8dcb2a10SAndre Fischer 199*8dcb2a10SAndre Fischer SetSizePixel(aSize2); 200*8dcb2a10SAndre Fischer 201*8dcb2a10SAndre Fischer break; 202*8dcb2a10SAndre Fischer 203*8dcb2a10SAndre Fischer case XGRAD_ELLIPTICAL: 204*8dcb2a10SAndre Fischer case XGRAD_SQUARE: 205*8dcb2a10SAndre Fischer case XGRAD_RECT: 206*8dcb2a10SAndre Fischer maFtTrgrCenterX.Show(); 207*8dcb2a10SAndre Fischer maFtTrgrCenterX.SetPosPixel(APOS1_1); 208*8dcb2a10SAndre Fischer maMtrTrgrCenterX.Show(); 209*8dcb2a10SAndre Fischer maMtrTrgrCenterX.SetPosPixel(APOS2_1); 210*8dcb2a10SAndre Fischer maFtTrgrCenterY.Show(); 211*8dcb2a10SAndre Fischer maFtTrgrCenterY.SetPosPixel(APOS1_2); 212*8dcb2a10SAndre Fischer maMtrTrgrCenterY.Show(); 213*8dcb2a10SAndre Fischer maMtrTrgrCenterY.SetPosPixel(APOS2_2); 214*8dcb2a10SAndre Fischer maFtTrgrAngle.Show(); 215*8dcb2a10SAndre Fischer maFtTrgrAngle.SetPosPixel(APOS1_3); 216*8dcb2a10SAndre Fischer maMtrTrgrAngle.Show(); 217*8dcb2a10SAndre Fischer maMtrTrgrAngle.SetPosPixel(APOS1_4); 218*8dcb2a10SAndre Fischer 219*8dcb2a10SAndre Fischer maFtTrgrStartValue.SetPosPixel(APOS1_5); 220*8dcb2a10SAndre Fischer maMtrTrgrStartValue.SetPosPixel(APOS1_6); 221*8dcb2a10SAndre Fischer maFtTrgrEndValue.SetPosPixel(APOS2_5); 222*8dcb2a10SAndre Fischer maMtrTrgrEndValue.SetPosPixel(APOS2_6); 223*8dcb2a10SAndre Fischer maFtTrgrBorder.SetPosPixel(APOS1_7); 224*8dcb2a10SAndre Fischer maMtrTrgrBorder.SetPosPixel(APOS1_8); 225*8dcb2a10SAndre Fischer 226*8dcb2a10SAndre Fischer maBtnLeft45.Show(); 227*8dcb2a10SAndre Fischer maBtnRight45.Show(); 228*8dcb2a10SAndre Fischer 229*8dcb2a10SAndre Fischer aPointAngle = maMtrTrgrAngle.GetPosPixel(); 230*8dcb2a10SAndre Fischer aPosY = aPointAngle.getY() + aSizeAngle.getHeight() - aTbxSize.getHeight(); 231*8dcb2a10SAndre Fischer 232*8dcb2a10SAndre Fischer maBtnLeft45.SetPosPixel(Point(APOS_Left_Right_3.getX(), aPosY)); 233*8dcb2a10SAndre Fischer maBtnRight45.SetPosPixel(Point(APOS_Left_Right_4.getX(), aPosY)); 234*8dcb2a10SAndre Fischer 235*8dcb2a10SAndre Fischer SetSizePixel(aSize); 236*8dcb2a10SAndre Fischer 237*8dcb2a10SAndre Fischer break; 238*8dcb2a10SAndre Fischer } 239*8dcb2a10SAndre Fischer } 240*8dcb2a10SAndre Fischer 241*8dcb2a10SAndre Fischer 242*8dcb2a10SAndre Fischer 243*8dcb2a10SAndre Fischer 244*8dcb2a10SAndre Fischer void AreaTransparencyGradientControl::InitStatus(XFillFloatTransparenceItem* pGradientItem) 245*8dcb2a10SAndre Fischer { 246*8dcb2a10SAndre Fischer const XGradient& rGradient = pGradientItem->GetGradientValue(); 247*8dcb2a10SAndre Fischer 248*8dcb2a10SAndre Fischer XGradient aGradient; 249*8dcb2a10SAndre Fischer 250*8dcb2a10SAndre Fischer if (rGradient.GetXOffset() == AreaPropertyPanel::DEFAULT_CENTERX 251*8dcb2a10SAndre Fischer && rGradient.GetYOffset() == AreaPropertyPanel::DEFAULT_CENTERY 252*8dcb2a10SAndre Fischer && (rGradient.GetAngle() / 10) == AreaPropertyPanel::DEFAULT_ANGLE 253*8dcb2a10SAndre Fischer && ((sal_uInt16)((((sal_uInt16)rGradient.GetStartColor().GetRed() + 1) * 100) / 255)) 254*8dcb2a10SAndre Fischer == AreaPropertyPanel::DEFAULT_STARTVALUE 255*8dcb2a10SAndre Fischer && ((sal_uInt16)((((sal_uInt16)rGradient.GetEndColor().GetRed() + 1) * 100) / 255)) 256*8dcb2a10SAndre Fischer == AreaPropertyPanel::DEFAULT_ENDVALUE 257*8dcb2a10SAndre Fischer && rGradient.GetBorder() == AreaPropertyPanel::DEFAULT_BORDER) 258*8dcb2a10SAndre Fischer { 259*8dcb2a10SAndre Fischer aGradient = mrAreaPropertyPanel.GetGradient(rGradient.GetGradientStyle()); 260*8dcb2a10SAndre Fischer } 261*8dcb2a10SAndre Fischer else 262*8dcb2a10SAndre Fischer { 263*8dcb2a10SAndre Fischer aGradient = rGradient; 264*8dcb2a10SAndre Fischer } 265*8dcb2a10SAndre Fischer maMtrTrgrCenterX.SetValue(aGradient.GetXOffset()); 266*8dcb2a10SAndre Fischer maMtrTrgrCenterY.SetValue(aGradient.GetYOffset()); 267*8dcb2a10SAndre Fischer maMtrTrgrAngle.SetValue(aGradient.GetAngle() / 10); 268*8dcb2a10SAndre Fischer maMtrTrgrStartValue.SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetStartColor().GetRed() + 1) * 100) / 255)); 269*8dcb2a10SAndre Fischer maMtrTrgrEndValue.SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetEndColor().GetRed() + 1) * 100) / 255)); 270*8dcb2a10SAndre Fischer maMtrTrgrBorder.SetValue(aGradient.GetBorder()); 271*8dcb2a10SAndre Fischer } 272*8dcb2a10SAndre Fischer 273*8dcb2a10SAndre Fischer 274*8dcb2a10SAndre Fischer 275*8dcb2a10SAndre Fischer 276*8dcb2a10SAndre Fischer void AreaTransparencyGradientControl::ExecuteValueModify( sal_uInt8 nStartCol, sal_uInt8 nEndCol ) 277*8dcb2a10SAndre Fischer { 278*8dcb2a10SAndre Fischer //Added 279*8dcb2a10SAndre Fischer sal_Int16 aMtrValue = (sal_Int16)maMtrTrgrAngle.GetValue(); 280*8dcb2a10SAndre Fischer while(aMtrValue<0) 281*8dcb2a10SAndre Fischer aMtrValue += 360; 282*8dcb2a10SAndre Fischer sal_uInt16 nVal = aMtrValue/360; 283*8dcb2a10SAndre Fischer nVal = aMtrValue - nVal*360; 284*8dcb2a10SAndre Fischer maMtrTrgrAngle.SetValue(nVal); 285*8dcb2a10SAndre Fischer //End of new code 286*8dcb2a10SAndre Fischer XGradient aTmpGradient( 287*8dcb2a10SAndre Fischer Color(nStartCol, nStartCol, nStartCol), 288*8dcb2a10SAndre Fischer Color(nEndCol, nEndCol, nEndCol), 289*8dcb2a10SAndre Fischer (XGradientStyle)(mrAreaPropertyPanel.GetSelectedTransparencyTypeIndex()-2), 290*8dcb2a10SAndre Fischer (sal_uInt16)maMtrTrgrAngle.GetValue() * 10, 291*8dcb2a10SAndre Fischer (sal_uInt16)maMtrTrgrCenterX.GetValue(), 292*8dcb2a10SAndre Fischer (sal_uInt16)maMtrTrgrCenterY.GetValue(), 293*8dcb2a10SAndre Fischer (sal_uInt16)maMtrTrgrBorder.GetValue(), 294*8dcb2a10SAndre Fischer 100, 100); 295*8dcb2a10SAndre Fischer 296*8dcb2a10SAndre Fischer mrAreaPropertyPanel.SetGradient(aTmpGradient); 297*8dcb2a10SAndre Fischer 298*8dcb2a10SAndre Fischer SfxItemPool* pPool = NULL; 299*8dcb2a10SAndre Fischer bool bEnable = true; 300*8dcb2a10SAndre Fischer XFillFloatTransparenceItem aGradientItem(pPool,aTmpGradient, bEnable ); 301*8dcb2a10SAndre Fischer 302*8dcb2a10SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_FILL_FLOATTRANSPARENCE, SFX_CALLMODE_RECORD, &aGradientItem, 0L ); 303*8dcb2a10SAndre Fischer } 304*8dcb2a10SAndre Fischer 305*8dcb2a10SAndre Fischer 306*8dcb2a10SAndre Fischer 307*8dcb2a10SAndre Fischer 308*8dcb2a10SAndre Fischer IMPL_LINK(AreaTransparencyGradientControl, ModifiedTrgrHdl_Impl, void *, pControl) 309*8dcb2a10SAndre Fischer { 310*8dcb2a10SAndre Fischer sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100); 311*8dcb2a10SAndre Fischer sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100); 312*8dcb2a10SAndre Fischer ExecuteValueModify( nStartCol, nEndCol ); 313*8dcb2a10SAndre Fischer return( 0L ); 314*8dcb2a10SAndre Fischer } 315*8dcb2a10SAndre Fischer 316*8dcb2a10SAndre Fischer 317*8dcb2a10SAndre Fischer 318*8dcb2a10SAndre Fischer 319*8dcb2a10SAndre Fischer IMPL_LINK(AreaTransparencyGradientControl, Left_Click45_Impl, void *, pControl) 320*8dcb2a10SAndre Fischer { 321*8dcb2a10SAndre Fischer sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100); 322*8dcb2a10SAndre Fischer sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100); 323*8dcb2a10SAndre Fischer sal_uInt16 aTemp = (sal_uInt16)maMtrTrgrAngle.GetValue(); 324*8dcb2a10SAndre Fischer if(aTemp>=315) 325*8dcb2a10SAndre Fischer aTemp -= 360; 326*8dcb2a10SAndre Fischer aTemp += 45; 327*8dcb2a10SAndre Fischer maMtrTrgrAngle.SetValue(aTemp); 328*8dcb2a10SAndre Fischer ExecuteValueModify( nStartCol, nEndCol ); 329*8dcb2a10SAndre Fischer return( 0L ); 330*8dcb2a10SAndre Fischer } 331*8dcb2a10SAndre Fischer 332*8dcb2a10SAndre Fischer 333*8dcb2a10SAndre Fischer 334*8dcb2a10SAndre Fischer 335*8dcb2a10SAndre Fischer IMPL_LINK(AreaTransparencyGradientControl, Right_Click45_Impl, void *, pControl) 336*8dcb2a10SAndre Fischer { 337*8dcb2a10SAndre Fischer sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100); 338*8dcb2a10SAndre Fischer sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100); 339*8dcb2a10SAndre Fischer sal_uInt16 aTemp = (sal_uInt16)maMtrTrgrAngle.GetValue(); 340*8dcb2a10SAndre Fischer if(aTemp<45) 341*8dcb2a10SAndre Fischer aTemp += 360; 342*8dcb2a10SAndre Fischer aTemp -= 45; 343*8dcb2a10SAndre Fischer maMtrTrgrAngle.SetValue(aTemp); 344*8dcb2a10SAndre Fischer ExecuteValueModify( nStartCol, nEndCol ); 345*8dcb2a10SAndre Fischer return( 0L ); 346*8dcb2a10SAndre Fischer } 347*8dcb2a10SAndre Fischer 348*8dcb2a10SAndre Fischer } } // end of namespace svx::sidebar 349