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 
228dcb2a10SAndre Fischer #include "AreaTransparencyGradientControl.hxx"
238dcb2a10SAndre Fischer #include "AreaPropertyPanel.hxx"
248dcb2a10SAndre Fischer #include "AreaPropertyPanel.hrc"
258dcb2a10SAndre Fischer 
268dcb2a10SAndre Fischer #include <svx/dialogs.hrc>
278dcb2a10SAndre Fischer #include <svx/dialmgr.hxx>
288dcb2a10SAndre Fischer #include <svx/xflftrit.hxx>
29*d29c2fc2SAndre Fischer #include <sfx2/sidebar/ResourceDefinitions.hrc>
308dcb2a10SAndre Fischer #include <sfx2/bindings.hxx>
318dcb2a10SAndre Fischer #include <sfx2/dispatch.hxx>
328dcb2a10SAndre Fischer 
338dcb2a10SAndre Fischer namespace svx { namespace sidebar {
348dcb2a10SAndre Fischer 
358dcb2a10SAndre Fischer // positioning helpers
368dcb2a10SAndre Fischer #define APOS1_1 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL), MAP_APPFONT))
378dcb2a10SAndre Fischer #define APOS2_1 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL), MAP_APPFONT))
388dcb2a10SAndre Fischer #define APOS1_2 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL), MAP_APPFONT))
398dcb2a10SAndre 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))
408dcb2a10SAndre 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))
418dcb2a10SAndre 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))
428dcb2a10SAndre 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))
438dcb2a10SAndre 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))
448dcb2a10SAndre 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))
458dcb2a10SAndre 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))
468dcb2a10SAndre 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))
478dcb2a10SAndre 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))
488dcb2a10SAndre 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))
498dcb2a10SAndre 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))
508dcb2a10SAndre Fischer #define APOS_Left_Right_1 Point(LogicToPixel(Point(LEFT_RIGHT_X1,LEFT_RIGHT_Y1), MAP_APPFONT))
518dcb2a10SAndre Fischer #define APOS_Left_Right_2 Point(LogicToPixel(Point(LEFT_RIGHT_X2,LEFT_RIGHT_Y1), MAP_APPFONT))
528dcb2a10SAndre Fischer #define APOS_Left_Right_3 Point(LogicToPixel(Point(LEFT_RIGHT_X1,LEFT_RIGHT_Y2), MAP_APPFONT))
538dcb2a10SAndre Fischer #define APOS_Left_Right_4 Point(LogicToPixel(Point(LEFT_RIGHT_X2,LEFT_RIGHT_Y2), MAP_APPFONT))
548dcb2a10SAndre Fischer 
558dcb2a10SAndre Fischer 
568dcb2a10SAndre Fischer 
578dcb2a10SAndre Fischer 
AreaTransparencyGradientControl(Window * pParent,AreaPropertyPanel & rPanel)588dcb2a10SAndre Fischer AreaTransparencyGradientControl::AreaTransparencyGradientControl (
598dcb2a10SAndre Fischer     Window* pParent,
608dcb2a10SAndre Fischer     AreaPropertyPanel& rPanel)
618dcb2a10SAndre Fischer     : PopupControl( pParent,SVX_RES(RID_POPUPPANEL_AREAPAGE_TRGR)),
628dcb2a10SAndre Fischer       maFtTrgrCenterX(this, SVX_RES(FT_TRGR_CENTER_X)),
638dcb2a10SAndre Fischer       maMtrTrgrCenterX(this, SVX_RES(MTR_TRGR_CENTER_X)),
648dcb2a10SAndre Fischer       maFtTrgrCenterY(this, SVX_RES(FT_TRGR_CENTER_Y)),
658dcb2a10SAndre Fischer       maMtrTrgrCenterY(this, SVX_RES(MTR_TRGR_CENTER_Y)),
668dcb2a10SAndre Fischer       maFtTrgrAngle(this, SVX_RES(FT_TRGR_ANGLE)),
678dcb2a10SAndre Fischer       maMtrTrgrAngle(this, SVX_RES(MTR_TRGR_ANGLE)),
68ae981a91SPavel Janík       maBtnLeft45(this, SVX_RES(BTN_LEFT_SECOND)),
69ae981a91SPavel Janík       maBtnRight45(this, SVX_RES(BTN_RIGHT_FIRST)),
708dcb2a10SAndre Fischer       maFtTrgrStartValue(this, SVX_RES(FT_TRGR_START_VALUE)),
718dcb2a10SAndre Fischer       maMtrTrgrStartValue(this, SVX_RES(MTR_TRGR_START_VALUE)),
728dcb2a10SAndre Fischer       maFtTrgrEndValue(this, SVX_RES(FT_TRGR_END_VALUE)),
738dcb2a10SAndre Fischer       maMtrTrgrEndValue(this, SVX_RES(MTR_TRGR_END_VALUE)),
748dcb2a10SAndre Fischer       maFtTrgrBorder(this, SVX_RES(FT_TRGR_BORDER)),
758dcb2a10SAndre Fischer       maMtrTrgrBorder(this, SVX_RES(MTR_TRGR_BORDER)),
768dcb2a10SAndre Fischer       maRotLeft( SVX_RES(IMG_ROT_LEFT)),
778dcb2a10SAndre Fischer       maRotRight( SVX_RES(IMG_ROT_RIGHT)),
788dcb2a10SAndre Fischer       mrAreaPropertyPanel(rPanel),
798dcb2a10SAndre Fischer       mpBindings(NULL)
808dcb2a10SAndre Fischer {
818dcb2a10SAndre Fischer 	Link aLink = LINK( this, AreaTransparencyGradientControl, ModifiedTrgrHdl_Impl);
828dcb2a10SAndre Fischer 	maMtrTrgrCenterX.SetModifyHdl( aLink );
838dcb2a10SAndre Fischer 	maMtrTrgrCenterY.SetModifyHdl( aLink );
848dcb2a10SAndre Fischer 	maMtrTrgrAngle.SetModifyHdl( aLink );
858dcb2a10SAndre Fischer 	maMtrTrgrBorder.SetModifyHdl( aLink );
868dcb2a10SAndre Fischer 	maMtrTrgrStartValue.SetModifyHdl( aLink );
878dcb2a10SAndre Fischer 	maMtrTrgrEndValue.SetModifyHdl( aLink );
888dcb2a10SAndre Fischer 	aLink = LINK( this, AreaTransparencyGradientControl, Left_Click45_Impl);
898dcb2a10SAndre Fischer 	maBtnLeft45.SetSelectHdl( aLink );
908dcb2a10SAndre Fischer 	aLink = LINK( this, AreaTransparencyGradientControl, Right_Click45_Impl);
918dcb2a10SAndre Fischer 	maBtnRight45.SetSelectHdl( aLink );
928dcb2a10SAndre Fischer 	maBtnLeft45.SetItemImage(1,maRotLeft);
938dcb2a10SAndre Fischer 	Size aTbxSize = maBtnLeft45.CalcWindowSizePixel();
948dcb2a10SAndre Fischer 	maBtnLeft45.SetOutputSizePixel( aTbxSize );
958dcb2a10SAndre Fischer 	maBtnLeft45.SetQuickHelpText(1, String(SVX_RES(STR_HELP_LEFT)));	//acc wj
968dcb2a10SAndre Fischer 
978dcb2a10SAndre Fischer 	maBtnRight45.SetItemImage(1,maRotRight);
988dcb2a10SAndre Fischer 	aTbxSize = maBtnRight45.CalcWindowSizePixel();
998dcb2a10SAndre Fischer 	maBtnRight45.SetOutputSizePixel( aTbxSize );
1008dcb2a10SAndre Fischer 	maBtnRight45.SetQuickHelpText(1, String(SVX_RES(STR_HELP_RIGHT)));	//acc wj
1018dcb2a10SAndre Fischer 
1028dcb2a10SAndre Fischer 	maBtnLeft45.SetBackground(Wallpaper());
1038dcb2a10SAndre Fischer 	maBtnLeft45.SetPaintTransparent(true);
1048dcb2a10SAndre Fischer 	maBtnRight45.SetBackground(Wallpaper());
1058dcb2a10SAndre Fischer 	maBtnRight45.SetPaintTransparent(true);
1068dcb2a10SAndre Fischer 
1078dcb2a10SAndre Fischer 	FreeResource();
1088dcb2a10SAndre Fischer     mpBindings = mrAreaPropertyPanel.GetBindings();
1098dcb2a10SAndre Fischer }
1108dcb2a10SAndre Fischer 
1118dcb2a10SAndre Fischer 
1128dcb2a10SAndre Fischer 
1138dcb2a10SAndre Fischer 
~AreaTransparencyGradientControl(void)1148dcb2a10SAndre Fischer AreaTransparencyGradientControl::~AreaTransparencyGradientControl (void)
1158dcb2a10SAndre Fischer {
1168dcb2a10SAndre Fischer }
1178dcb2a10SAndre Fischer 
1188dcb2a10SAndre Fischer 
1198dcb2a10SAndre Fischer 
1208dcb2a10SAndre Fischer 
ToGetFocus()1218dcb2a10SAndre Fischer void AreaTransparencyGradientControl::ToGetFocus()
1228dcb2a10SAndre Fischer {
1238dcb2a10SAndre Fischer 	if(maMtrTrgrCenterX.IsVisible())
1248dcb2a10SAndre Fischer 		maMtrTrgrCenterX.GrabFocus();
1258dcb2a10SAndre Fischer 	else
1268dcb2a10SAndre Fischer 		maMtrTrgrAngle.GrabFocus();
1278dcb2a10SAndre Fischer }
1288dcb2a10SAndre Fischer 
1298dcb2a10SAndre Fischer 
1308dcb2a10SAndre Fischer 
1318dcb2a10SAndre Fischer 
Rearrange(XFillFloatTransparenceItem * pGradientItem)1328dcb2a10SAndre Fischer void AreaTransparencyGradientControl::Rearrange(XFillFloatTransparenceItem* pGradientItem)
1338dcb2a10SAndre Fischer {
1348dcb2a10SAndre Fischer 	InitStatus(pGradientItem);
1358dcb2a10SAndre Fischer 	const XGradient& rGradient = pGradientItem->GetGradientValue();
1368dcb2a10SAndre Fischer 	XGradientStyle eXGS(rGradient.GetGradientStyle());
1378dcb2a10SAndre Fischer 	Size aSize(POP_WIDTH,POP_HEIGHT);
1388dcb2a10SAndre Fischer 	aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
1398dcb2a10SAndre Fischer 	Size aSize2(POP_WIDTH,POP_HEIGHT2);
1408dcb2a10SAndre Fischer 	aSize2 = LogicToPixel( aSize2, MapMode(MAP_APPFONT) );
1418dcb2a10SAndre Fischer 	long aPosY = 0;
1428dcb2a10SAndre Fischer 	Point aPointAngle;
1438dcb2a10SAndre Fischer 	Size aSizeAngle = maMtrTrgrAngle.GetSizePixel();
1448dcb2a10SAndre Fischer 	Size aTbxSize = maBtnLeft45.CalcWindowSizePixel();
1458dcb2a10SAndre Fischer 
1468dcb2a10SAndre Fischer 	switch(eXGS)
1478dcb2a10SAndre Fischer 	{
1488dcb2a10SAndre Fischer 	case XGRAD_LINEAR:
1498dcb2a10SAndre Fischer 	case XGRAD_AXIAL:
1508dcb2a10SAndre Fischer 		maFtTrgrCenterX.Hide();
1518dcb2a10SAndre Fischer 		maMtrTrgrCenterX.Hide();
1528dcb2a10SAndre Fischer 		maFtTrgrCenterY.Hide();
1538dcb2a10SAndre Fischer 		maMtrTrgrCenterY.Hide();
1548dcb2a10SAndre Fischer 		maFtTrgrAngle.Show();
1558dcb2a10SAndre Fischer 		maFtTrgrAngle.SetPosPixel(APOS1_1);
1568dcb2a10SAndre Fischer 		maMtrTrgrAngle.Show();
1578dcb2a10SAndre Fischer 		maMtrTrgrAngle.SetPosPixel(APOS2_1);
1588dcb2a10SAndre Fischer 		maFtTrgrStartValue.SetPosPixel(APOS1_3);
1598dcb2a10SAndre Fischer 		maMtrTrgrStartValue.SetPosPixel(APOS1_4);
1608dcb2a10SAndre Fischer 		maFtTrgrEndValue.SetPosPixel(APOS2_3);
1618dcb2a10SAndre Fischer 		maMtrTrgrEndValue.SetPosPixel(APOS2_4);
1628dcb2a10SAndre Fischer 		maFtTrgrBorder.SetPosPixel(APOS1_5);
1638dcb2a10SAndre Fischer 		maMtrTrgrBorder.SetPosPixel(APOS1_6);
1648dcb2a10SAndre Fischer 
1658dcb2a10SAndre Fischer 		maBtnLeft45.Show();
1668dcb2a10SAndre Fischer 		maBtnRight45.Show();
1678dcb2a10SAndre Fischer 
1688dcb2a10SAndre Fischer 		aPointAngle = maMtrTrgrAngle.GetPosPixel();
1698dcb2a10SAndre Fischer 		aPosY = aPointAngle.getY() + aSizeAngle.getHeight() - aTbxSize.getHeight();
1708dcb2a10SAndre Fischer 
1718dcb2a10SAndre Fischer 		maBtnLeft45.SetPosPixel(Point(APOS_Left_Right_1.getX(), aPosY));
1728dcb2a10SAndre Fischer 		maBtnRight45.SetPosPixel(Point(APOS_Left_Right_2.getX(), aPosY));
1738dcb2a10SAndre Fischer 
1748dcb2a10SAndre Fischer 		SetSizePixel(aSize2);
1758dcb2a10SAndre Fischer 		break;
1768dcb2a10SAndre Fischer 
1778dcb2a10SAndre Fischer 	case XGRAD_RADIAL:
1788dcb2a10SAndre Fischer 		maFtTrgrCenterX.Show();
1798dcb2a10SAndre Fischer 		maFtTrgrCenterX.SetPosPixel(APOS1_1);
1808dcb2a10SAndre Fischer 		maMtrTrgrCenterX.Show();
1818dcb2a10SAndre Fischer 		maMtrTrgrCenterX.SetPosPixel(APOS2_1);
1828dcb2a10SAndre Fischer 		maFtTrgrCenterY.Show();
1838dcb2a10SAndre Fischer 		maFtTrgrCenterY.SetPosPixel(APOS1_2);
1848dcb2a10SAndre Fischer 		maMtrTrgrCenterY.Show();
1858dcb2a10SAndre Fischer 		maMtrTrgrCenterY.SetPosPixel(APOS2_2);
1868dcb2a10SAndre Fischer 		maFtTrgrAngle.Hide();
1878dcb2a10SAndre Fischer 		maMtrTrgrAngle.Hide();
1888dcb2a10SAndre Fischer 		maFtTrgrStartValue.SetPosPixel(APOS1_3);
1898dcb2a10SAndre Fischer 		maMtrTrgrStartValue.SetPosPixel(APOS1_4);
1908dcb2a10SAndre Fischer 		maFtTrgrEndValue.SetPosPixel(APOS2_3);
1918dcb2a10SAndre Fischer 		maMtrTrgrEndValue.SetPosPixel(APOS2_4);
1928dcb2a10SAndre Fischer 		maFtTrgrBorder.SetPosPixel(APOS1_5);
1938dcb2a10SAndre Fischer 		maMtrTrgrBorder.SetPosPixel(APOS1_6);
1948dcb2a10SAndre Fischer 
1958dcb2a10SAndre Fischer 		maBtnLeft45.Hide();
1968dcb2a10SAndre Fischer 		maBtnRight45.Hide();
1978dcb2a10SAndre Fischer 
1988dcb2a10SAndre Fischer 		SetSizePixel(aSize2);
1998dcb2a10SAndre Fischer 
2008dcb2a10SAndre Fischer 		break;
2018dcb2a10SAndre Fischer 
2028dcb2a10SAndre Fischer 	case XGRAD_ELLIPTICAL:
2038dcb2a10SAndre Fischer 	case XGRAD_SQUARE:
2048dcb2a10SAndre Fischer 	case XGRAD_RECT:
2058dcb2a10SAndre Fischer 		maFtTrgrCenterX.Show();
2068dcb2a10SAndre Fischer 		maFtTrgrCenterX.SetPosPixel(APOS1_1);
2078dcb2a10SAndre Fischer 		maMtrTrgrCenterX.Show();
2088dcb2a10SAndre Fischer 		maMtrTrgrCenterX.SetPosPixel(APOS2_1);
2098dcb2a10SAndre Fischer 		maFtTrgrCenterY.Show();
2108dcb2a10SAndre Fischer 		maFtTrgrCenterY.SetPosPixel(APOS1_2);
2118dcb2a10SAndre Fischer 		maMtrTrgrCenterY.Show();
2128dcb2a10SAndre Fischer 		maMtrTrgrCenterY.SetPosPixel(APOS2_2);
2138dcb2a10SAndre Fischer 		maFtTrgrAngle.Show();
2148dcb2a10SAndre Fischer 		maFtTrgrAngle.SetPosPixel(APOS1_3);
2158dcb2a10SAndre Fischer 		maMtrTrgrAngle.Show();
2168dcb2a10SAndre Fischer 		maMtrTrgrAngle.SetPosPixel(APOS1_4);
2178dcb2a10SAndre Fischer 
2188dcb2a10SAndre Fischer 		maFtTrgrStartValue.SetPosPixel(APOS1_5);
2198dcb2a10SAndre Fischer 		maMtrTrgrStartValue.SetPosPixel(APOS1_6);
2208dcb2a10SAndre Fischer 		maFtTrgrEndValue.SetPosPixel(APOS2_5);
2218dcb2a10SAndre Fischer 		maMtrTrgrEndValue.SetPosPixel(APOS2_6);
2228dcb2a10SAndre Fischer 		maFtTrgrBorder.SetPosPixel(APOS1_7);
2238dcb2a10SAndre Fischer 		maMtrTrgrBorder.SetPosPixel(APOS1_8);
2248dcb2a10SAndre Fischer 
2258dcb2a10SAndre Fischer 		maBtnLeft45.Show();
2268dcb2a10SAndre Fischer 		maBtnRight45.Show();
2278dcb2a10SAndre Fischer 
2288dcb2a10SAndre Fischer 		aPointAngle = maMtrTrgrAngle.GetPosPixel();
2298dcb2a10SAndre Fischer 		aPosY = aPointAngle.getY() + aSizeAngle.getHeight() - aTbxSize.getHeight();
2308dcb2a10SAndre Fischer 
2318dcb2a10SAndre Fischer 		maBtnLeft45.SetPosPixel(Point(APOS_Left_Right_3.getX(), aPosY));
2328dcb2a10SAndre Fischer 		maBtnRight45.SetPosPixel(Point(APOS_Left_Right_4.getX(), aPosY));
2338dcb2a10SAndre Fischer 
2348dcb2a10SAndre Fischer 		SetSizePixel(aSize);
2358dcb2a10SAndre Fischer 
2368dcb2a10SAndre Fischer 		break;
2378dcb2a10SAndre Fischer 	}
2388dcb2a10SAndre Fischer }
2398dcb2a10SAndre Fischer 
2408dcb2a10SAndre Fischer 
2418dcb2a10SAndre Fischer 
2428dcb2a10SAndre Fischer 
InitStatus(XFillFloatTransparenceItem * pGradientItem)2438dcb2a10SAndre Fischer void AreaTransparencyGradientControl::InitStatus(XFillFloatTransparenceItem* pGradientItem)
2448dcb2a10SAndre Fischer {
2458dcb2a10SAndre Fischer 	const XGradient& rGradient = pGradientItem->GetGradientValue();
2468dcb2a10SAndre Fischer 
2478dcb2a10SAndre Fischer 	XGradient aGradient;
2488dcb2a10SAndre Fischer 
2498dcb2a10SAndre Fischer 	if (rGradient.GetXOffset() == AreaPropertyPanel::DEFAULT_CENTERX
2508dcb2a10SAndre Fischer         && rGradient.GetYOffset() == AreaPropertyPanel::DEFAULT_CENTERY
2518dcb2a10SAndre Fischer         && (rGradient.GetAngle() / 10) == AreaPropertyPanel::DEFAULT_ANGLE
2528dcb2a10SAndre Fischer         && ((sal_uInt16)((((sal_uInt16)rGradient.GetStartColor().GetRed() + 1) * 100) / 255))
2538dcb2a10SAndre Fischer             == AreaPropertyPanel::DEFAULT_STARTVALUE
2548dcb2a10SAndre Fischer         && ((sal_uInt16)((((sal_uInt16)rGradient.GetEndColor().GetRed() + 1) * 100) / 255))
2558dcb2a10SAndre Fischer             == AreaPropertyPanel::DEFAULT_ENDVALUE
2568dcb2a10SAndre Fischer         && rGradient.GetBorder() == AreaPropertyPanel::DEFAULT_BORDER)
2578dcb2a10SAndre Fischer 	{
2588dcb2a10SAndre Fischer         aGradient = mrAreaPropertyPanel.GetGradient(rGradient.GetGradientStyle());
2598dcb2a10SAndre Fischer 	}
2608dcb2a10SAndre Fischer 	else
2618dcb2a10SAndre Fischer     {
2628dcb2a10SAndre Fischer 		aGradient = rGradient;
2638dcb2a10SAndre Fischer     }
2648dcb2a10SAndre Fischer 	maMtrTrgrCenterX.SetValue(aGradient.GetXOffset());
2658dcb2a10SAndre Fischer 	maMtrTrgrCenterY.SetValue(aGradient.GetYOffset());
2668dcb2a10SAndre Fischer 	maMtrTrgrAngle.SetValue(aGradient.GetAngle() / 10);
2678dcb2a10SAndre Fischer 	maMtrTrgrStartValue.SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetStartColor().GetRed() + 1) * 100) / 255));
2688dcb2a10SAndre Fischer 	maMtrTrgrEndValue.SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetEndColor().GetRed() + 1) * 100) / 255));
2698dcb2a10SAndre Fischer 	maMtrTrgrBorder.SetValue(aGradient.GetBorder());
2708dcb2a10SAndre Fischer }
2718dcb2a10SAndre Fischer 
2728dcb2a10SAndre Fischer 
2738dcb2a10SAndre Fischer 
2748dcb2a10SAndre Fischer 
ExecuteValueModify(sal_uInt8 nStartCol,sal_uInt8 nEndCol)2758dcb2a10SAndre Fischer void AreaTransparencyGradientControl::ExecuteValueModify( sal_uInt8 nStartCol, sal_uInt8 nEndCol )
2768dcb2a10SAndre Fischer {
2778dcb2a10SAndre Fischer 	//Added
2788dcb2a10SAndre Fischer 	sal_Int16 aMtrValue = (sal_Int16)maMtrTrgrAngle.GetValue();
2798dcb2a10SAndre Fischer 	while(aMtrValue<0)
2808dcb2a10SAndre Fischer 		aMtrValue += 360;
2818dcb2a10SAndre Fischer 	sal_uInt16 nVal = aMtrValue/360;
2828dcb2a10SAndre Fischer 	nVal = aMtrValue - nVal*360;
2838dcb2a10SAndre Fischer 	maMtrTrgrAngle.SetValue(nVal);
2848dcb2a10SAndre Fischer 	//End of new code
2858dcb2a10SAndre Fischer 	XGradient aTmpGradient(
2868dcb2a10SAndre Fischer 		Color(nStartCol, nStartCol, nStartCol),
2878dcb2a10SAndre Fischer 		Color(nEndCol, nEndCol, nEndCol),
2888dcb2a10SAndre Fischer 		(XGradientStyle)(mrAreaPropertyPanel.GetSelectedTransparencyTypeIndex()-2),
2898dcb2a10SAndre Fischer 		(sal_uInt16)maMtrTrgrAngle.GetValue() * 10,
2908dcb2a10SAndre Fischer 		(sal_uInt16)maMtrTrgrCenterX.GetValue(),
2918dcb2a10SAndre Fischer 		(sal_uInt16)maMtrTrgrCenterY.GetValue(),
2928dcb2a10SAndre Fischer 		(sal_uInt16)maMtrTrgrBorder.GetValue(),
2938dcb2a10SAndre Fischer 		100, 100);
2948dcb2a10SAndre Fischer 
2958dcb2a10SAndre Fischer     mrAreaPropertyPanel.SetGradient(aTmpGradient);
2968dcb2a10SAndre Fischer 
2978dcb2a10SAndre Fischer 	SfxItemPool* pPool = NULL;
2988dcb2a10SAndre Fischer 	bool bEnable = true;
2998dcb2a10SAndre Fischer 	XFillFloatTransparenceItem aGradientItem(pPool,aTmpGradient, bEnable );
3008dcb2a10SAndre Fischer 
3018dcb2a10SAndre Fischer 	mpBindings->GetDispatcher()->Execute( SID_ATTR_FILL_FLOATTRANSPARENCE, SFX_CALLMODE_RECORD, &aGradientItem, 0L );
3028dcb2a10SAndre Fischer }
3038dcb2a10SAndre Fischer 
3048dcb2a10SAndre Fischer 
3058dcb2a10SAndre Fischer 
3068dcb2a10SAndre Fischer 
307ae981a91SPavel Janík IMPL_LINK(AreaTransparencyGradientControl, ModifiedTrgrHdl_Impl, void *, /* pControl */)
3088dcb2a10SAndre Fischer {
3098dcb2a10SAndre Fischer 	sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100);
3108dcb2a10SAndre Fischer 	sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100);
3118dcb2a10SAndre Fischer 	ExecuteValueModify( nStartCol, nEndCol );
3128dcb2a10SAndre Fischer 	return( 0L );
3138dcb2a10SAndre Fischer }
3148dcb2a10SAndre Fischer 
3158dcb2a10SAndre Fischer 
3168dcb2a10SAndre Fischer 
3178dcb2a10SAndre Fischer 
318ae981a91SPavel Janík IMPL_LINK(AreaTransparencyGradientControl, Left_Click45_Impl, void *, /* pControl */)
3198dcb2a10SAndre Fischer {
3208dcb2a10SAndre Fischer 	sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100);
3218dcb2a10SAndre Fischer 	sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100);
3228dcb2a10SAndre Fischer 	sal_uInt16 aTemp = (sal_uInt16)maMtrTrgrAngle.GetValue();
3238dcb2a10SAndre Fischer 	if(aTemp>=315)
3248dcb2a10SAndre Fischer 		aTemp -= 360;
3258dcb2a10SAndre Fischer 	aTemp += 45;
3268dcb2a10SAndre Fischer 	maMtrTrgrAngle.SetValue(aTemp);
3278dcb2a10SAndre Fischer 	ExecuteValueModify( nStartCol, nEndCol );
3288dcb2a10SAndre Fischer 	return( 0L );
3298dcb2a10SAndre Fischer }
3308dcb2a10SAndre Fischer 
3318dcb2a10SAndre Fischer 
3328dcb2a10SAndre Fischer 
3338dcb2a10SAndre Fischer 
334ae981a91SPavel Janík IMPL_LINK(AreaTransparencyGradientControl, Right_Click45_Impl, void *, /* pControl */)
3358dcb2a10SAndre Fischer {
3368dcb2a10SAndre Fischer 	sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100);
3378dcb2a10SAndre Fischer 	sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100);
3388dcb2a10SAndre Fischer 	sal_uInt16 aTemp = (sal_uInt16)maMtrTrgrAngle.GetValue();
3398dcb2a10SAndre Fischer 	if(aTemp<45)
3408dcb2a10SAndre Fischer 		aTemp += 360;
3418dcb2a10SAndre Fischer 	aTemp -= 45;
3428dcb2a10SAndre Fischer 	maMtrTrgrAngle.SetValue(aTemp);
3438dcb2a10SAndre Fischer 	ExecuteValueModify( nStartCol, nEndCol );
3448dcb2a10SAndre Fischer 	return( 0L );
3458dcb2a10SAndre Fischer }
3468dcb2a10SAndre Fischer 
3478dcb2a10SAndre Fischer } } // end of namespace svx::sidebar
3484e8031e0SArmin Le Grand 
3494e8031e0SArmin Le Grand // eof
350