xref: /trunk/main/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx (revision 627628354578bc12b977fd84871d68bc0860b13f)
18dcb2a10SAndre Fischer /**************************************************************
28dcb2a10SAndre Fischer  *
38dcb2a10SAndre Fischer  * Licensed to the Apache Software Foundation (ASF) under one
48dcb2a10SAndre Fischer  * or more contributor license agreements.  See the NOTICE file
58dcb2a10SAndre Fischer  * distributed with this work for additional information
68dcb2a10SAndre Fischer  * regarding copyright ownership.  The ASF licenses this file
78dcb2a10SAndre Fischer  * to you under the Apache License, Version 2.0 (the
88dcb2a10SAndre Fischer  * "License"); you may not use this file except in compliance
98dcb2a10SAndre Fischer  * with the License.  You may obtain a copy of the License at
108dcb2a10SAndre Fischer  *
118dcb2a10SAndre Fischer  *   http://www.apache.org/licenses/LICENSE-2.0
128dcb2a10SAndre Fischer  *
138dcb2a10SAndre Fischer  * Unless required by applicable law or agreed to in writing,
148dcb2a10SAndre Fischer  * software distributed under the License is distributed on an
158dcb2a10SAndre Fischer  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
168dcb2a10SAndre Fischer  * KIND, either express or implied.  See the License for the
178dcb2a10SAndre Fischer  * specific language governing permissions and limitations
188dcb2a10SAndre Fischer  * under the License.
198dcb2a10SAndre Fischer  *
208dcb2a10SAndre Fischer  *************************************************************/
218dcb2a10SAndre Fischer 
22*62762835Smseidel 
23*62762835Smseidel 
248dcb2a10SAndre Fischer #include "AreaTransparencyGradientControl.hxx"
258dcb2a10SAndre Fischer #include "AreaPropertyPanel.hxx"
268dcb2a10SAndre Fischer #include "AreaPropertyPanel.hrc"
278dcb2a10SAndre Fischer 
288dcb2a10SAndre Fischer #include <svx/dialogs.hrc>
298dcb2a10SAndre Fischer #include <svx/dialmgr.hxx>
308dcb2a10SAndre Fischer #include <svx/xflftrit.hxx>
31d29c2fc2SAndre Fischer #include <sfx2/sidebar/ResourceDefinitions.hrc>
328dcb2a10SAndre Fischer #include <sfx2/bindings.hxx>
338dcb2a10SAndre Fischer #include <sfx2/dispatch.hxx>
348dcb2a10SAndre Fischer 
358dcb2a10SAndre Fischer namespace svx { namespace sidebar {
368dcb2a10SAndre Fischer 
378dcb2a10SAndre Fischer // positioning helpers
388dcb2a10SAndre Fischer #define APOS1_1 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL), MAP_APPFONT))
398dcb2a10SAndre Fischer #define APOS2_1 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL), MAP_APPFONT))
408dcb2a10SAndre Fischer #define APOS1_2 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL), MAP_APPFONT))
418dcb2a10SAndre 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))
428dcb2a10SAndre 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))
438dcb2a10SAndre 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))
448dcb2a10SAndre 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))
458dcb2a10SAndre 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))
468dcb2a10SAndre 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))
478dcb2a10SAndre 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))
488dcb2a10SAndre 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))
498dcb2a10SAndre 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))
508dcb2a10SAndre 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))
518dcb2a10SAndre 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))
528dcb2a10SAndre Fischer #define APOS_Left_Right_1 Point(LogicToPixel(Point(LEFT_RIGHT_X1,LEFT_RIGHT_Y1), MAP_APPFONT))
538dcb2a10SAndre Fischer #define APOS_Left_Right_2 Point(LogicToPixel(Point(LEFT_RIGHT_X2,LEFT_RIGHT_Y1), MAP_APPFONT))
548dcb2a10SAndre Fischer #define APOS_Left_Right_3 Point(LogicToPixel(Point(LEFT_RIGHT_X1,LEFT_RIGHT_Y2), MAP_APPFONT))
558dcb2a10SAndre Fischer #define APOS_Left_Right_4 Point(LogicToPixel(Point(LEFT_RIGHT_X2,LEFT_RIGHT_Y2), MAP_APPFONT))
568dcb2a10SAndre Fischer 
578dcb2a10SAndre Fischer 
588dcb2a10SAndre Fischer 
598dcb2a10SAndre Fischer 
AreaTransparencyGradientControl(Window * pParent,AreaPropertyPanel & rPanel)608dcb2a10SAndre Fischer AreaTransparencyGradientControl::AreaTransparencyGradientControl (
618dcb2a10SAndre Fischer     Window* pParent,
628dcb2a10SAndre Fischer     AreaPropertyPanel& rPanel)
638dcb2a10SAndre Fischer     : PopupControl( pParent,SVX_RES(RID_POPUPPANEL_AREAPAGE_TRGR)),
648dcb2a10SAndre Fischer       maFtTrgrCenterX(this, SVX_RES(FT_TRGR_CENTER_X)),
658dcb2a10SAndre Fischer       maMtrTrgrCenterX(this, SVX_RES(MTR_TRGR_CENTER_X)),
668dcb2a10SAndre Fischer       maFtTrgrCenterY(this, SVX_RES(FT_TRGR_CENTER_Y)),
678dcb2a10SAndre Fischer       maMtrTrgrCenterY(this, SVX_RES(MTR_TRGR_CENTER_Y)),
688dcb2a10SAndre Fischer       maFtTrgrAngle(this, SVX_RES(FT_TRGR_ANGLE)),
698dcb2a10SAndre Fischer       maMtrTrgrAngle(this, SVX_RES(MTR_TRGR_ANGLE)),
70ae981a91SPavel Janík       maBtnLeft45(this, SVX_RES(BTN_LEFT_SECOND)),
71ae981a91SPavel Janík       maBtnRight45(this, SVX_RES(BTN_RIGHT_FIRST)),
728dcb2a10SAndre Fischer       maFtTrgrStartValue(this, SVX_RES(FT_TRGR_START_VALUE)),
738dcb2a10SAndre Fischer       maMtrTrgrStartValue(this, SVX_RES(MTR_TRGR_START_VALUE)),
748dcb2a10SAndre Fischer       maFtTrgrEndValue(this, SVX_RES(FT_TRGR_END_VALUE)),
758dcb2a10SAndre Fischer       maMtrTrgrEndValue(this, SVX_RES(MTR_TRGR_END_VALUE)),
768dcb2a10SAndre Fischer       maFtTrgrBorder(this, SVX_RES(FT_TRGR_BORDER)),
778dcb2a10SAndre Fischer       maMtrTrgrBorder(this, SVX_RES(MTR_TRGR_BORDER)),
788dcb2a10SAndre Fischer       maRotLeft( SVX_RES(IMG_ROT_LEFT)),
798dcb2a10SAndre Fischer       maRotRight( SVX_RES(IMG_ROT_RIGHT)),
808dcb2a10SAndre Fischer       mrAreaPropertyPanel(rPanel),
818dcb2a10SAndre Fischer       mpBindings(NULL)
828dcb2a10SAndre Fischer {
838dcb2a10SAndre Fischer     Link aLink = LINK( this, AreaTransparencyGradientControl, ModifiedTrgrHdl_Impl);
848dcb2a10SAndre Fischer     maMtrTrgrCenterX.SetModifyHdl( aLink );
858dcb2a10SAndre Fischer     maMtrTrgrCenterY.SetModifyHdl( aLink );
868dcb2a10SAndre Fischer     maMtrTrgrAngle.SetModifyHdl( aLink );
878dcb2a10SAndre Fischer     maMtrTrgrBorder.SetModifyHdl( aLink );
888dcb2a10SAndre Fischer     maMtrTrgrStartValue.SetModifyHdl( aLink );
898dcb2a10SAndre Fischer     maMtrTrgrEndValue.SetModifyHdl( aLink );
908dcb2a10SAndre Fischer     aLink = LINK( this, AreaTransparencyGradientControl, Left_Click45_Impl);
918dcb2a10SAndre Fischer     maBtnLeft45.SetSelectHdl( aLink );
928dcb2a10SAndre Fischer     aLink = LINK( this, AreaTransparencyGradientControl, Right_Click45_Impl);
938dcb2a10SAndre Fischer     maBtnRight45.SetSelectHdl( aLink );
948dcb2a10SAndre Fischer     maBtnLeft45.SetItemImage(1,maRotLeft);
958dcb2a10SAndre Fischer     Size aTbxSize = maBtnLeft45.CalcWindowSizePixel();
968dcb2a10SAndre Fischer     maBtnLeft45.SetOutputSizePixel( aTbxSize );
978dcb2a10SAndre Fischer     maBtnLeft45.SetQuickHelpText(1, String(SVX_RES(STR_HELP_LEFT))); // acc wj
988dcb2a10SAndre Fischer 
998dcb2a10SAndre Fischer     maBtnRight45.SetItemImage(1,maRotRight);
1008dcb2a10SAndre Fischer     aTbxSize = maBtnRight45.CalcWindowSizePixel();
1018dcb2a10SAndre Fischer     maBtnRight45.SetOutputSizePixel( aTbxSize );
1028dcb2a10SAndre Fischer     maBtnRight45.SetQuickHelpText(1, String(SVX_RES(STR_HELP_RIGHT))); // acc wj
1038dcb2a10SAndre Fischer 
1048dcb2a10SAndre Fischer     maBtnLeft45.SetBackground(Wallpaper());
1058dcb2a10SAndre Fischer     maBtnLeft45.SetPaintTransparent(true);
1068dcb2a10SAndre Fischer     maBtnRight45.SetBackground(Wallpaper());
1078dcb2a10SAndre Fischer     maBtnRight45.SetPaintTransparent(true);
1088dcb2a10SAndre Fischer 
1098dcb2a10SAndre Fischer     FreeResource();
1108dcb2a10SAndre Fischer     mpBindings = mrAreaPropertyPanel.GetBindings();
1118dcb2a10SAndre Fischer }
1128dcb2a10SAndre Fischer 
1138dcb2a10SAndre Fischer 
1148dcb2a10SAndre Fischer 
1158dcb2a10SAndre Fischer 
~AreaTransparencyGradientControl(void)1168dcb2a10SAndre Fischer AreaTransparencyGradientControl::~AreaTransparencyGradientControl (void)
1178dcb2a10SAndre Fischer {
1188dcb2a10SAndre Fischer }
1198dcb2a10SAndre Fischer 
1208dcb2a10SAndre Fischer 
1218dcb2a10SAndre Fischer 
1228dcb2a10SAndre Fischer 
ToGetFocus()1238dcb2a10SAndre Fischer void AreaTransparencyGradientControl::ToGetFocus()
1248dcb2a10SAndre Fischer {
1258dcb2a10SAndre Fischer     if(maMtrTrgrCenterX.IsVisible())
1268dcb2a10SAndre Fischer         maMtrTrgrCenterX.GrabFocus();
1278dcb2a10SAndre Fischer     else
1288dcb2a10SAndre Fischer         maMtrTrgrAngle.GrabFocus();
1298dcb2a10SAndre Fischer }
1308dcb2a10SAndre Fischer 
1318dcb2a10SAndre Fischer 
1328dcb2a10SAndre Fischer 
1338dcb2a10SAndre Fischer 
Rearrange(XFillFloatTransparenceItem * pGradientItem)1348dcb2a10SAndre Fischer void AreaTransparencyGradientControl::Rearrange(XFillFloatTransparenceItem* pGradientItem)
1358dcb2a10SAndre Fischer {
1368dcb2a10SAndre Fischer     InitStatus(pGradientItem);
1378dcb2a10SAndre Fischer     const XGradient& rGradient = pGradientItem->GetGradientValue();
1388dcb2a10SAndre Fischer     XGradientStyle eXGS(rGradient.GetGradientStyle());
1398dcb2a10SAndre Fischer     Size aSize(POP_WIDTH,POP_HEIGHT);
1408dcb2a10SAndre Fischer     aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
1418dcb2a10SAndre Fischer     Size aSize2(POP_WIDTH,POP_HEIGHT2);
1428dcb2a10SAndre Fischer     aSize2 = LogicToPixel( aSize2, MapMode(MAP_APPFONT) );
1438dcb2a10SAndre Fischer     long aPosY = 0;
1448dcb2a10SAndre Fischer     Point aPointAngle;
1458dcb2a10SAndre Fischer     Size aSizeAngle = maMtrTrgrAngle.GetSizePixel();
1468dcb2a10SAndre Fischer     Size aTbxSize = maBtnLeft45.CalcWindowSizePixel();
1478dcb2a10SAndre Fischer 
1488dcb2a10SAndre Fischer     switch(eXGS)
1498dcb2a10SAndre Fischer     {
1508dcb2a10SAndre Fischer     case XGRAD_LINEAR:
1518dcb2a10SAndre Fischer     case XGRAD_AXIAL:
1528dcb2a10SAndre Fischer         maFtTrgrCenterX.Hide();
1538dcb2a10SAndre Fischer         maMtrTrgrCenterX.Hide();
1548dcb2a10SAndre Fischer         maFtTrgrCenterY.Hide();
1558dcb2a10SAndre Fischer         maMtrTrgrCenterY.Hide();
1568dcb2a10SAndre Fischer         maFtTrgrAngle.Show();
1578dcb2a10SAndre Fischer         maFtTrgrAngle.SetPosPixel(APOS1_1);
1588dcb2a10SAndre Fischer         maMtrTrgrAngle.Show();
1598dcb2a10SAndre Fischer         maMtrTrgrAngle.SetPosPixel(APOS2_1);
1608dcb2a10SAndre Fischer         maFtTrgrStartValue.SetPosPixel(APOS1_3);
1618dcb2a10SAndre Fischer         maMtrTrgrStartValue.SetPosPixel(APOS1_4);
1628dcb2a10SAndre Fischer         maFtTrgrEndValue.SetPosPixel(APOS2_3);
1638dcb2a10SAndre Fischer         maMtrTrgrEndValue.SetPosPixel(APOS2_4);
1648dcb2a10SAndre Fischer         maFtTrgrBorder.SetPosPixel(APOS1_5);
1658dcb2a10SAndre Fischer         maMtrTrgrBorder.SetPosPixel(APOS1_6);
1668dcb2a10SAndre Fischer 
1678dcb2a10SAndre Fischer         maBtnLeft45.Show();
1688dcb2a10SAndre Fischer         maBtnRight45.Show();
1698dcb2a10SAndre Fischer 
1708dcb2a10SAndre Fischer         aPointAngle = maMtrTrgrAngle.GetPosPixel();
1718dcb2a10SAndre Fischer         aPosY = aPointAngle.getY() + aSizeAngle.getHeight() - aTbxSize.getHeight();
1728dcb2a10SAndre Fischer 
1738dcb2a10SAndre Fischer         maBtnLeft45.SetPosPixel(Point(APOS_Left_Right_1.getX(), aPosY));
1748dcb2a10SAndre Fischer         maBtnRight45.SetPosPixel(Point(APOS_Left_Right_2.getX(), aPosY));
1758dcb2a10SAndre Fischer 
1768dcb2a10SAndre Fischer         SetSizePixel(aSize2);
1778dcb2a10SAndre Fischer         break;
1788dcb2a10SAndre Fischer 
1798dcb2a10SAndre Fischer     case XGRAD_RADIAL:
1808dcb2a10SAndre Fischer         maFtTrgrCenterX.Show();
1818dcb2a10SAndre Fischer         maFtTrgrCenterX.SetPosPixel(APOS1_1);
1828dcb2a10SAndre Fischer         maMtrTrgrCenterX.Show();
1838dcb2a10SAndre Fischer         maMtrTrgrCenterX.SetPosPixel(APOS2_1);
1848dcb2a10SAndre Fischer         maFtTrgrCenterY.Show();
1858dcb2a10SAndre Fischer         maFtTrgrCenterY.SetPosPixel(APOS1_2);
1868dcb2a10SAndre Fischer         maMtrTrgrCenterY.Show();
1878dcb2a10SAndre Fischer         maMtrTrgrCenterY.SetPosPixel(APOS2_2);
1888dcb2a10SAndre Fischer         maFtTrgrAngle.Hide();
1898dcb2a10SAndre Fischer         maMtrTrgrAngle.Hide();
1908dcb2a10SAndre Fischer         maFtTrgrStartValue.SetPosPixel(APOS1_3);
1918dcb2a10SAndre Fischer         maMtrTrgrStartValue.SetPosPixel(APOS1_4);
1928dcb2a10SAndre Fischer         maFtTrgrEndValue.SetPosPixel(APOS2_3);
1938dcb2a10SAndre Fischer         maMtrTrgrEndValue.SetPosPixel(APOS2_4);
1948dcb2a10SAndre Fischer         maFtTrgrBorder.SetPosPixel(APOS1_5);
1958dcb2a10SAndre Fischer         maMtrTrgrBorder.SetPosPixel(APOS1_6);
1968dcb2a10SAndre Fischer 
1978dcb2a10SAndre Fischer         maBtnLeft45.Hide();
1988dcb2a10SAndre Fischer         maBtnRight45.Hide();
1998dcb2a10SAndre Fischer 
2008dcb2a10SAndre Fischer         SetSizePixel(aSize2);
2018dcb2a10SAndre Fischer 
2028dcb2a10SAndre Fischer         break;
2038dcb2a10SAndre Fischer 
2048dcb2a10SAndre Fischer     case XGRAD_ELLIPTICAL:
2058dcb2a10SAndre Fischer     case XGRAD_SQUARE:
2068dcb2a10SAndre Fischer     case XGRAD_RECT:
2078dcb2a10SAndre Fischer         maFtTrgrCenterX.Show();
2088dcb2a10SAndre Fischer         maFtTrgrCenterX.SetPosPixel(APOS1_1);
2098dcb2a10SAndre Fischer         maMtrTrgrCenterX.Show();
2108dcb2a10SAndre Fischer         maMtrTrgrCenterX.SetPosPixel(APOS2_1);
2118dcb2a10SAndre Fischer         maFtTrgrCenterY.Show();
2128dcb2a10SAndre Fischer         maFtTrgrCenterY.SetPosPixel(APOS1_2);
2138dcb2a10SAndre Fischer         maMtrTrgrCenterY.Show();
2148dcb2a10SAndre Fischer         maMtrTrgrCenterY.SetPosPixel(APOS2_2);
2158dcb2a10SAndre Fischer         maFtTrgrAngle.Show();
2168dcb2a10SAndre Fischer         maFtTrgrAngle.SetPosPixel(APOS1_3);
2178dcb2a10SAndre Fischer         maMtrTrgrAngle.Show();
2188dcb2a10SAndre Fischer         maMtrTrgrAngle.SetPosPixel(APOS1_4);
2198dcb2a10SAndre Fischer 
2208dcb2a10SAndre Fischer         maFtTrgrStartValue.SetPosPixel(APOS1_5);
2218dcb2a10SAndre Fischer         maMtrTrgrStartValue.SetPosPixel(APOS1_6);
2228dcb2a10SAndre Fischer         maFtTrgrEndValue.SetPosPixel(APOS2_5);
2238dcb2a10SAndre Fischer         maMtrTrgrEndValue.SetPosPixel(APOS2_6);
2248dcb2a10SAndre Fischer         maFtTrgrBorder.SetPosPixel(APOS1_7);
2258dcb2a10SAndre Fischer         maMtrTrgrBorder.SetPosPixel(APOS1_8);
2268dcb2a10SAndre Fischer 
2278dcb2a10SAndre Fischer         maBtnLeft45.Show();
2288dcb2a10SAndre Fischer         maBtnRight45.Show();
2298dcb2a10SAndre Fischer 
2308dcb2a10SAndre Fischer         aPointAngle = maMtrTrgrAngle.GetPosPixel();
2318dcb2a10SAndre Fischer         aPosY = aPointAngle.getY() + aSizeAngle.getHeight() - aTbxSize.getHeight();
2328dcb2a10SAndre Fischer 
2338dcb2a10SAndre Fischer         maBtnLeft45.SetPosPixel(Point(APOS_Left_Right_3.getX(), aPosY));
2348dcb2a10SAndre Fischer         maBtnRight45.SetPosPixel(Point(APOS_Left_Right_4.getX(), aPosY));
2358dcb2a10SAndre Fischer 
2368dcb2a10SAndre Fischer         SetSizePixel(aSize);
2378dcb2a10SAndre Fischer 
2388dcb2a10SAndre Fischer         break;
2398dcb2a10SAndre Fischer     }
2408dcb2a10SAndre Fischer }
2418dcb2a10SAndre Fischer 
2428dcb2a10SAndre Fischer 
2438dcb2a10SAndre Fischer 
2448dcb2a10SAndre Fischer 
InitStatus(XFillFloatTransparenceItem * pGradientItem)2458dcb2a10SAndre Fischer void AreaTransparencyGradientControl::InitStatus(XFillFloatTransparenceItem* pGradientItem)
2468dcb2a10SAndre Fischer {
2478dcb2a10SAndre Fischer     const XGradient& rGradient = pGradientItem->GetGradientValue();
2488dcb2a10SAndre Fischer 
2498dcb2a10SAndre Fischer     XGradient aGradient;
2508dcb2a10SAndre Fischer 
2518dcb2a10SAndre Fischer     if (rGradient.GetXOffset() == AreaPropertyPanel::DEFAULT_CENTERX
2528dcb2a10SAndre Fischer         && rGradient.GetYOffset() == AreaPropertyPanel::DEFAULT_CENTERY
2538dcb2a10SAndre Fischer         && (rGradient.GetAngle() / 10) == AreaPropertyPanel::DEFAULT_ANGLE
2548dcb2a10SAndre Fischer         && ((sal_uInt16)((((sal_uInt16)rGradient.GetStartColor().GetRed() + 1) * 100) / 255))
2558dcb2a10SAndre Fischer             == AreaPropertyPanel::DEFAULT_STARTVALUE
2568dcb2a10SAndre Fischer         && ((sal_uInt16)((((sal_uInt16)rGradient.GetEndColor().GetRed() + 1) * 100) / 255))
2578dcb2a10SAndre Fischer             == AreaPropertyPanel::DEFAULT_ENDVALUE
2588dcb2a10SAndre Fischer         && rGradient.GetBorder() == AreaPropertyPanel::DEFAULT_BORDER)
2598dcb2a10SAndre Fischer     {
2608dcb2a10SAndre Fischer         aGradient = mrAreaPropertyPanel.GetGradient(rGradient.GetGradientStyle());
2618dcb2a10SAndre Fischer     }
2628dcb2a10SAndre Fischer     else
2638dcb2a10SAndre Fischer     {
2648dcb2a10SAndre Fischer         aGradient = rGradient;
2658dcb2a10SAndre Fischer     }
2668dcb2a10SAndre Fischer     maMtrTrgrCenterX.SetValue(aGradient.GetXOffset());
2678dcb2a10SAndre Fischer     maMtrTrgrCenterY.SetValue(aGradient.GetYOffset());
2688dcb2a10SAndre Fischer     maMtrTrgrAngle.SetValue(aGradient.GetAngle() / 10);
2698dcb2a10SAndre Fischer     maMtrTrgrStartValue.SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetStartColor().GetRed() + 1) * 100) / 255));
2708dcb2a10SAndre Fischer     maMtrTrgrEndValue.SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetEndColor().GetRed() + 1) * 100) / 255));
2718dcb2a10SAndre Fischer     maMtrTrgrBorder.SetValue(aGradient.GetBorder());
2728dcb2a10SAndre Fischer }
2738dcb2a10SAndre Fischer 
2748dcb2a10SAndre Fischer 
2758dcb2a10SAndre Fischer 
2768dcb2a10SAndre Fischer 
ExecuteValueModify(sal_uInt8 nStartCol,sal_uInt8 nEndCol)2778dcb2a10SAndre Fischer void AreaTransparencyGradientControl::ExecuteValueModify( sal_uInt8 nStartCol, sal_uInt8 nEndCol )
2788dcb2a10SAndre Fischer {
2798dcb2a10SAndre Fischer     // Added
2808dcb2a10SAndre Fischer     sal_Int16 aMtrValue = (sal_Int16)maMtrTrgrAngle.GetValue();
2818dcb2a10SAndre Fischer     while(aMtrValue<0)
2828dcb2a10SAndre Fischer         aMtrValue += 360;
2838dcb2a10SAndre Fischer     sal_uInt16 nVal = aMtrValue/360;
2848dcb2a10SAndre Fischer     nVal = aMtrValue - nVal*360;
2858dcb2a10SAndre Fischer     maMtrTrgrAngle.SetValue(nVal);
2868dcb2a10SAndre Fischer     // End of new code
2878dcb2a10SAndre Fischer     XGradient aTmpGradient(
2888dcb2a10SAndre Fischer         Color(nStartCol, nStartCol, nStartCol),
2898dcb2a10SAndre Fischer         Color(nEndCol, nEndCol, nEndCol),
2908dcb2a10SAndre Fischer         (XGradientStyle)(mrAreaPropertyPanel.GetSelectedTransparencyTypeIndex()-2),
2918dcb2a10SAndre Fischer         (sal_uInt16)maMtrTrgrAngle.GetValue() * 10,
2928dcb2a10SAndre Fischer         (sal_uInt16)maMtrTrgrCenterX.GetValue(),
2938dcb2a10SAndre Fischer         (sal_uInt16)maMtrTrgrCenterY.GetValue(),
2948dcb2a10SAndre Fischer         (sal_uInt16)maMtrTrgrBorder.GetValue(),
2958dcb2a10SAndre Fischer         100, 100);
2968dcb2a10SAndre Fischer 
2978dcb2a10SAndre Fischer     mrAreaPropertyPanel.SetGradient(aTmpGradient);
2988dcb2a10SAndre Fischer 
2998dcb2a10SAndre Fischer     SfxItemPool* pPool = NULL;
3008dcb2a10SAndre Fischer     bool bEnable = true;
3018dcb2a10SAndre Fischer     XFillFloatTransparenceItem aGradientItem(pPool,aTmpGradient, bEnable );
3028dcb2a10SAndre Fischer 
3038dcb2a10SAndre Fischer     mpBindings->GetDispatcher()->Execute( SID_ATTR_FILL_FLOATTRANSPARENCE, SFX_CALLMODE_RECORD, &aGradientItem, 0L );
3048dcb2a10SAndre Fischer }
3058dcb2a10SAndre Fischer 
3068dcb2a10SAndre Fischer 
3078dcb2a10SAndre Fischer 
3088dcb2a10SAndre Fischer 
309ae981a91SPavel Janík IMPL_LINK(AreaTransparencyGradientControl, ModifiedTrgrHdl_Impl, void *, /* pControl */)
3108dcb2a10SAndre Fischer {
3118dcb2a10SAndre Fischer     sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100);
3128dcb2a10SAndre Fischer     sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100);
3138dcb2a10SAndre Fischer     ExecuteValueModify( nStartCol, nEndCol );
3148dcb2a10SAndre Fischer     return( 0L );
3158dcb2a10SAndre Fischer }
3168dcb2a10SAndre Fischer 
3178dcb2a10SAndre Fischer 
3188dcb2a10SAndre Fischer 
3198dcb2a10SAndre Fischer 
320ae981a91SPavel Janík IMPL_LINK(AreaTransparencyGradientControl, Left_Click45_Impl, void *, /* pControl */)
3218dcb2a10SAndre Fischer {
3228dcb2a10SAndre Fischer     sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100);
3238dcb2a10SAndre Fischer     sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100);
3248dcb2a10SAndre Fischer     sal_uInt16 aTemp = (sal_uInt16)maMtrTrgrAngle.GetValue();
3258dcb2a10SAndre Fischer     if(aTemp>=315)
3268dcb2a10SAndre Fischer         aTemp -= 360;
3278dcb2a10SAndre Fischer     aTemp += 45;
3288dcb2a10SAndre Fischer     maMtrTrgrAngle.SetValue(aTemp);
3298dcb2a10SAndre Fischer     ExecuteValueModify( nStartCol, nEndCol );
3308dcb2a10SAndre Fischer     return( 0L );
3318dcb2a10SAndre Fischer }
3328dcb2a10SAndre Fischer 
3338dcb2a10SAndre Fischer 
3348dcb2a10SAndre Fischer 
3358dcb2a10SAndre Fischer 
336ae981a91SPavel Janík IMPL_LINK(AreaTransparencyGradientControl, Right_Click45_Impl, void *, /* pControl */)
3378dcb2a10SAndre Fischer {
3388dcb2a10SAndre Fischer     sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100);
3398dcb2a10SAndre Fischer     sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100);
3408dcb2a10SAndre Fischer     sal_uInt16 aTemp = (sal_uInt16)maMtrTrgrAngle.GetValue();
3418dcb2a10SAndre Fischer     if(aTemp<45)
3428dcb2a10SAndre Fischer         aTemp += 360;
3438dcb2a10SAndre Fischer     aTemp -= 45;
3448dcb2a10SAndre Fischer     maMtrTrgrAngle.SetValue(aTemp);
3458dcb2a10SAndre Fischer     ExecuteValueModify( nStartCol, nEndCol );
3468dcb2a10SAndre Fischer     return( 0L );
3478dcb2a10SAndre Fischer }
3488dcb2a10SAndre Fischer 
3498dcb2a10SAndre Fischer } } // end of namespace svx::sidebar
3504e8031e0SArmin Le Grand 
3514e8031e0SArmin Le Grand // eof
352