18dcb2a10SAndre Fischer /**************************************************************
2*8bd26251Smseidel  *
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
10*8bd26251Smseidel  *
118dcb2a10SAndre Fischer  *   http://www.apache.org/licenses/LICENSE-2.0
12*8bd26251Smseidel  *
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.
19*8bd26251Smseidel  *
208dcb2a10SAndre Fischer  *************************************************************/
218dcb2a10SAndre Fischer 
22*8bd26251Smseidel 
23*8bd26251Smseidel 
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 (
61*8bd26251Smseidel 	Window* pParent,
62*8bd26251Smseidel 	AreaPropertyPanel& rPanel)
63*8bd26251Smseidel 	: PopupControl( pParent,SVX_RES(RID_POPUPPANEL_AREAPAGE_TRGR)),
64*8bd26251Smseidel 	  maFtTrgrCenterX(this, SVX_RES(FT_TRGR_CENTER_X)),
65*8bd26251Smseidel 	  maMtrTrgrCenterX(this, SVX_RES(MTR_TRGR_CENTER_X)),
66*8bd26251Smseidel 	  maFtTrgrCenterY(this, SVX_RES(FT_TRGR_CENTER_Y)),
67*8bd26251Smseidel 	  maMtrTrgrCenterY(this, SVX_RES(MTR_TRGR_CENTER_Y)),
68*8bd26251Smseidel 	  maFtTrgrAngle(this, SVX_RES(FT_TRGR_ANGLE)),
69*8bd26251Smseidel 	  maMtrTrgrAngle(this, SVX_RES(MTR_TRGR_ANGLE)),
70*8bd26251Smseidel 	  maBtnLeft45(this, SVX_RES(BTN_LEFT_SECOND)),
71*8bd26251Smseidel 	  maBtnRight45(this, SVX_RES(BTN_RIGHT_FIRST)),
72*8bd26251Smseidel 	  maFtTrgrStartValue(this, SVX_RES(FT_TRGR_START_VALUE)),
73*8bd26251Smseidel 	  maMtrTrgrStartValue(this, SVX_RES(MTR_TRGR_START_VALUE)),
74*8bd26251Smseidel 	  maFtTrgrEndValue(this, SVX_RES(FT_TRGR_END_VALUE)),
75*8bd26251Smseidel 	  maMtrTrgrEndValue(this, SVX_RES(MTR_TRGR_END_VALUE)),
76*8bd26251Smseidel 	  maFtTrgrBorder(this, SVX_RES(FT_TRGR_BORDER)),
77*8bd26251Smseidel 	  maMtrTrgrBorder(this, SVX_RES(MTR_TRGR_BORDER)),
78*8bd26251Smseidel 	  maRotLeft( SVX_RES(IMG_ROT_LEFT)),
79*8bd26251Smseidel 	  maRotRight( SVX_RES(IMG_ROT_RIGHT)),
80*8bd26251Smseidel 	  mrAreaPropertyPanel(rPanel),
81*8bd26251Smseidel 	  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 );
97*8bd26251Smseidel 	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 );
102*8bd26251Smseidel 	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();
110*8bd26251Smseidel 	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);
137*8bd26251Smseidel 	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
252*8bd26251Smseidel 		&& rGradient.GetYOffset() == AreaPropertyPanel::DEFAULT_CENTERY
253*8bd26251Smseidel 		&& (rGradient.GetAngle() / 10) == AreaPropertyPanel::DEFAULT_ANGLE
254*8bd26251Smseidel 		&& ((sal_uInt16)((((sal_uInt16)rGradient.GetStartColor().GetRed() + 1) * 100) / 255))
255*8bd26251Smseidel 			== AreaPropertyPanel::DEFAULT_STARTVALUE
256*8bd26251Smseidel 		&& ((sal_uInt16)((((sal_uInt16)rGradient.GetEndColor().GetRed() + 1) * 100) / 255))
257*8bd26251Smseidel 			== AreaPropertyPanel::DEFAULT_ENDVALUE
258*8bd26251Smseidel 		&& rGradient.GetBorder() == AreaPropertyPanel::DEFAULT_BORDER)
2598dcb2a10SAndre Fischer 	{
260*8bd26251Smseidel 		aGradient = mrAreaPropertyPanel.GetGradient(rGradient.GetGradientStyle());
2618dcb2a10SAndre Fischer 	}
2628dcb2a10SAndre Fischer 	else
263*8bd26251Smseidel 	{
2648dcb2a10SAndre Fischer 		aGradient = rGradient;
265*8bd26251Smseidel 	}
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));
271*8bd26251Smseidel 	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 {
279*8bd26251Smseidel 	// 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);
286*8bd26251Smseidel 	// 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 
297*8bd26251Smseidel 	mrAreaPropertyPanel.SetGradient(aTmpGradient);
2988dcb2a10SAndre Fischer 
2998dcb2a10SAndre Fischer 	SfxItemPool* pPool = NULL;
300*8bd26251Smseidel 	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