xref: /AOO41X/main/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx (revision e89b8a96dbf3465b971d6a0306eb2e19b8528704)
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 <sfx2/sidebar/propertypanel.hrc>
238dcb2a10SAndre Fischer #include <sfx2/sidebar/Theme.hxx>
248dcb2a10SAndre Fischer #include <sfx2/sidebar/ControlFactory.hxx>
258dcb2a10SAndre Fischer #include <GraphicPropertyPanel.hxx>
268dcb2a10SAndre Fischer #include <GraphicPropertyPanel.hrc>
278dcb2a10SAndre Fischer #include <svx/dialogs.hrc>
288dcb2a10SAndre Fischer #include <svx/dialmgr.hxx>
298dcb2a10SAndre Fischer #include <vcl/field.hxx>
308dcb2a10SAndre Fischer #include <vcl/lstbox.hxx>
318dcb2a10SAndre Fischer #include <svl/intitem.hxx>
328dcb2a10SAndre Fischer #include <sfx2/bindings.hxx>
338dcb2a10SAndre Fischer #include <sfx2/dispatch.hxx>
348dcb2a10SAndre Fischer 
358dcb2a10SAndre Fischer using namespace css;
368dcb2a10SAndre Fischer using namespace cssu;
378dcb2a10SAndre Fischer using ::sfx2::sidebar::Theme;
388dcb2a10SAndre Fischer 
398dcb2a10SAndre Fischer #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
408dcb2a10SAndre Fischer 
418dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
428dcb2a10SAndre Fischer // namespace open
438dcb2a10SAndre Fischer 
448dcb2a10SAndre Fischer namespace svx { namespace sidebar {
458dcb2a10SAndre Fischer 
468dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
478dcb2a10SAndre Fischer 
488dcb2a10SAndre Fischer GraphicPropertyPanel::GraphicPropertyPanel(
498dcb2a10SAndre Fischer     Window* pParent,
508dcb2a10SAndre Fischer     const cssu::Reference<css::frame::XFrame>& rxFrame,
518dcb2a10SAndre Fischer     SfxBindings* pBindings)
528dcb2a10SAndre Fischer :   Control(
538dcb2a10SAndre Fischer         pParent,
548dcb2a10SAndre Fischer         SVX_RES(RID_SIDEBAR_GRAPHIC_PANEL)),
558dcb2a10SAndre Fischer     mpFtBrightness(new FixedText(this, SVX_RES(FT_BRIGHTNESS))),
568dcb2a10SAndre Fischer     mpMtrBrightness(new MetricField(this, SVX_RES(MTR_BRIGHTNESS))),
578dcb2a10SAndre Fischer     mpFtContrast(new FixedText(this, SVX_RES(FT_CONTRAST))),
588dcb2a10SAndre Fischer     mpMtrContrast(new MetricField(this, SVX_RES(MTR_CONTRAST))),
598dcb2a10SAndre Fischer     mpFtColorMode(new FixedText(this, SVX_RES(FT_COLOR_MODE))),
608dcb2a10SAndre Fischer     mpLBColorMode(new ListBox(this, SVX_RES(LB_COLOR_MODE))),
618dcb2a10SAndre Fischer     mpFtTrans(new FixedText(this, SVX_RES(FT_TRANSPARENT))),
628dcb2a10SAndre Fischer     mpMtrTrans(new MetricField(this, SVX_RES(MTR_TRANSPARENT))),
638dcb2a10SAndre Fischer     mpMtrRed(new MetricField(this, SVX_RES(MF_RED))),
648dcb2a10SAndre Fischer     mpMtrGreen(new MetricField(this, SVX_RES(MF_GREEN))),
658dcb2a10SAndre Fischer     mpMtrBlue(new MetricField(this, SVX_RES(MF_BLUE))),
668dcb2a10SAndre Fischer     mpMtrGamma(new MetricField(this, SVX_RES(MF_GAMMA))),
678dcb2a10SAndre Fischer     maBrightControl(SID_ATTR_GRAF_LUMINANCE, *pBindings, *this),
688dcb2a10SAndre Fischer     maContrastControl(SID_ATTR_GRAF_CONTRAST, *pBindings, *this),
698dcb2a10SAndre Fischer     maTransparenceControl(SID_ATTR_GRAF_TRANSPARENCE, *pBindings, *this),
708dcb2a10SAndre Fischer     maRedControl(SID_ATTR_GRAF_RED, *pBindings, *this),
718dcb2a10SAndre Fischer     maGreenControl(SID_ATTR_GRAF_GREEN, *pBindings, *this),
728dcb2a10SAndre Fischer     maBlueControl(SID_ATTR_GRAF_BLUE, *pBindings, *this),
738dcb2a10SAndre Fischer     maGammaControl(SID_ATTR_GRAF_GAMMA, *pBindings, *this),
748dcb2a10SAndre Fischer     maModeControl(SID_ATTR_GRAF_MODE, *pBindings, *this),
758dcb2a10SAndre Fischer     maImgNormal(SVX_RES(IMG_NORMAL)),
768dcb2a10SAndre Fischer     maImgBW(SVX_RES(IMG_BW)),
778dcb2a10SAndre Fischer     maImgGray(SVX_RES(IMG_GRAY)),
788dcb2a10SAndre Fischer     maImgWater(SVX_RES(IMG_WATER)),
798dcb2a10SAndre Fischer     maImgRed(this, SVX_RES(IMG_RED)),
808dcb2a10SAndre Fischer     maImgGreen(this, SVX_RES(IMG_GREEN)),
818dcb2a10SAndre Fischer     maImgBlue(this, SVX_RES(IMG_BLUE)),
828dcb2a10SAndre Fischer     maImgGamma(this, SVX_RES(IMG_GAMMA)),
838dcb2a10SAndre Fischer     msNormal(SVX_RES(STR_NORMAL)),
848dcb2a10SAndre Fischer     msBW(SVX_RES(STR_BW)),
858dcb2a10SAndre Fischer     msGray(SVX_RES(STR_GRAY)),
868dcb2a10SAndre Fischer     msWater(SVX_RES(STR_WATER)),
878dcb2a10SAndre Fischer     mxFrame(rxFrame),
888dcb2a10SAndre Fischer     mpBindings(pBindings)
898dcb2a10SAndre Fischer {
908dcb2a10SAndre Fischer     Initialize();
918dcb2a10SAndre Fischer     FreeResource();
928dcb2a10SAndre Fischer }
938dcb2a10SAndre Fischer 
948dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
958dcb2a10SAndre Fischer 
968dcb2a10SAndre Fischer GraphicPropertyPanel::~GraphicPropertyPanel()
978dcb2a10SAndre Fischer {
988dcb2a10SAndre Fischer }
998dcb2a10SAndre Fischer 
1008dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
1018dcb2a10SAndre Fischer 
1028dcb2a10SAndre Fischer void GraphicPropertyPanel::Initialize()
1038dcb2a10SAndre Fischer {
10437fee4fdSAndre Fischer     mpFtBrightness->SetBackground(Wallpaper());
10537fee4fdSAndre Fischer     mpFtContrast->SetBackground(Wallpaper());
10637fee4fdSAndre Fischer     mpFtColorMode->SetBackground(Wallpaper());
10737fee4fdSAndre Fischer     mpFtTrans->SetBackground(Wallpaper());
10837fee4fdSAndre Fischer 
1098dcb2a10SAndre Fischer     mpMtrBrightness->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyBrightnessHdl ) );
1108dcb2a10SAndre Fischer 	mpMtrBrightness->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Brightness")));	//wj acc
1118dcb2a10SAndre Fischer 	mpMtrContrast->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyContrastHdl ) );
1128dcb2a10SAndre Fischer 	mpMtrContrast->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Contrast")));	//wj acc
1138dcb2a10SAndre Fischer 	mpMtrTrans->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyTransHdl ) );
1148dcb2a10SAndre Fischer 	mpMtrTrans->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency")));	//wj acc
1158dcb2a10SAndre Fischer 
1168dcb2a10SAndre Fischer 	mpLBColorMode->InsertEntry( msNormal, maImgNormal );
1178dcb2a10SAndre Fischer 	mpLBColorMode->InsertEntry( msGray, maImgGray );
1188dcb2a10SAndre Fischer 	mpLBColorMode->InsertEntry( msBW, maImgBW );
1198dcb2a10SAndre Fischer 	mpLBColorMode->InsertEntry( msWater, maImgWater );
1208dcb2a10SAndre Fischer 	mpLBColorMode->SetSelectHdl( LINK( this, GraphicPropertyPanel, ClickColorModeHdl ));
1218dcb2a10SAndre Fischer 	mpLBColorMode->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Color mode")));	//wj acc
1228dcb2a10SAndre Fischer 
1238dcb2a10SAndre Fischer 	mpMtrRed->SetModifyHdl( LINK( this, GraphicPropertyPanel, RedHdl ) );
1248dcb2a10SAndre Fischer 	mpMtrGreen->SetModifyHdl( LINK( this, GraphicPropertyPanel, GreenHdl ) );
1258dcb2a10SAndre Fischer 	mpMtrBlue->SetModifyHdl( LINK( this, GraphicPropertyPanel, BlueHdl ) );
1268dcb2a10SAndre Fischer 	mpMtrGamma->SetModifyHdl( LINK( this, GraphicPropertyPanel, GammaHdl ) );
1278dcb2a10SAndre Fischer 	mpMtrRed->SetAccessibleName(mpMtrRed->GetQuickHelpText());	//wj acc
1288dcb2a10SAndre Fischer 	mpMtrGreen->SetAccessibleName(mpMtrGreen->GetQuickHelpText());	//wj acc
1298dcb2a10SAndre Fischer 	mpMtrBlue->SetAccessibleName(mpMtrBlue->GetQuickHelpText());		//wj acc
1308dcb2a10SAndre Fischer 	mpMtrGamma->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Gamma value")));	//wj acc
1318dcb2a10SAndre Fischer 
1328dcb2a10SAndre Fischer     mpMtrRed->SetAccessibleRelationLabeledBy(mpMtrRed.get());
1338dcb2a10SAndre Fischer 	mpMtrGreen->SetAccessibleRelationLabeledBy(mpMtrGreen.get());
1348dcb2a10SAndre Fischer 	mpMtrBlue->SetAccessibleRelationLabeledBy(mpMtrBlue.get());
1358dcb2a10SAndre Fischer 	mpMtrGamma->SetAccessibleRelationLabeledBy(mpMtrGamma.get());
1368dcb2a10SAndre Fischer 	mpMtrBrightness->SetAccessibleRelationLabeledBy(mpFtBrightness.get());	//7874
1378dcb2a10SAndre Fischer 	mpMtrContrast->SetAccessibleRelationLabeledBy(mpFtContrast.get());	//7874
1388dcb2a10SAndre Fischer 	mpMtrTrans->SetAccessibleRelationLabeledBy(mpFtTrans.get());	//7874
1398dcb2a10SAndre Fischer 	mpLBColorMode->SetAccessibleRelationLabeledBy(mpFtColorMode.get());	//7874
1408dcb2a10SAndre Fischer }
1418dcb2a10SAndre Fischer 
1428dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
1438dcb2a10SAndre Fischer 
1448dcb2a10SAndre Fischer IMPL_LINK( GraphicPropertyPanel, ModifyBrightnessHdl, void *, EMPTYARG )
1458dcb2a10SAndre Fischer {
1468dcb2a10SAndre Fischer 	sal_Int16 nBright = mpMtrBrightness->GetValue();
1478dcb2a10SAndre Fischer 	SfxInt16Item aBrightItem( SID_ATTR_GRAF_LUMINANCE, nBright );
1488dcb2a10SAndre Fischer 	GetBindings()->GetDispatcher()->Execute(
1498dcb2a10SAndre Fischer 		SID_ATTR_GRAF_LUMINANCE, SFX_CALLMODE_RECORD, &aBrightItem, 0L);
1508dcb2a10SAndre Fischer 	return 0L;
1518dcb2a10SAndre Fischer }
1528dcb2a10SAndre Fischer 
1538dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
1548dcb2a10SAndre Fischer 
1558dcb2a10SAndre Fischer IMPL_LINK( GraphicPropertyPanel, ModifyContrastHdl, void *, EMPTYARG )
1568dcb2a10SAndre Fischer {
1578dcb2a10SAndre Fischer 	sal_Int16 nContrast = mpMtrContrast->GetValue();
1588dcb2a10SAndre Fischer 	SfxInt16Item aContrastItem( SID_ATTR_GRAF_CONTRAST, nContrast );
1598dcb2a10SAndre Fischer 	GetBindings()->GetDispatcher()->Execute(
1608dcb2a10SAndre Fischer 		SID_ATTR_GRAF_CONTRAST, SFX_CALLMODE_RECORD, &aContrastItem, 0L);
1618dcb2a10SAndre Fischer 	return 0L;
1628dcb2a10SAndre Fischer }
1638dcb2a10SAndre Fischer 
1648dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
1658dcb2a10SAndre Fischer 
1668dcb2a10SAndre Fischer IMPL_LINK( GraphicPropertyPanel, ModifyTransHdl, void *, EMPTYARG )
1678dcb2a10SAndre Fischer {
1688dcb2a10SAndre Fischer 	sal_Int16 nTrans = mpMtrTrans->GetValue();
1698dcb2a10SAndre Fischer 	SfxInt16Item aTransItem( SID_ATTR_GRAF_TRANSPARENCE, nTrans );
1708dcb2a10SAndre Fischer 	GetBindings()->GetDispatcher()->Execute(
1718dcb2a10SAndre Fischer 		SID_ATTR_GRAF_TRANSPARENCE, SFX_CALLMODE_RECORD, &aTransItem, 0L);
1728dcb2a10SAndre Fischer 	return 0L;
1738dcb2a10SAndre Fischer }
1748dcb2a10SAndre Fischer 
1758dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
1768dcb2a10SAndre Fischer 
177*e89b8a96SPavel Janík IMPL_LINK( GraphicPropertyPanel, ClickColorModeHdl, ToolBox *, /* pBox */)
1788dcb2a10SAndre Fischer {
1798dcb2a10SAndre Fischer 	sal_Int16 nTrans = mpLBColorMode->GetSelectEntryPos();
1808dcb2a10SAndre Fischer 	SfxInt16Item aTransItem( SID_ATTR_GRAF_MODE, nTrans );
1818dcb2a10SAndre Fischer 	GetBindings()->GetDispatcher()->Execute(
1828dcb2a10SAndre Fischer 		SID_ATTR_GRAF_MODE, SFX_CALLMODE_RECORD, &aTransItem, 0L);
1838dcb2a10SAndre Fischer 	return 0L;
1848dcb2a10SAndre Fischer }
1858dcb2a10SAndre Fischer 
1868dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
1878dcb2a10SAndre Fischer 
1888dcb2a10SAndre Fischer IMPL_LINK( GraphicPropertyPanel, RedHdl, void*, EMPTYARG )
1898dcb2a10SAndre Fischer {
1908dcb2a10SAndre Fischer 	sal_Int16 nRed = mpMtrRed->GetValue();
1918dcb2a10SAndre Fischer 	SfxInt16Item aRedItem( SID_ATTR_GRAF_RED, nRed );
1928dcb2a10SAndre Fischer 	GetBindings()->GetDispatcher()->Execute(
1938dcb2a10SAndre Fischer 		SID_ATTR_GRAF_RED, SFX_CALLMODE_RECORD, &aRedItem, 0L);
1948dcb2a10SAndre Fischer 	return 0L;
1958dcb2a10SAndre Fischer }
1968dcb2a10SAndre Fischer 
1978dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
1988dcb2a10SAndre Fischer 
1998dcb2a10SAndre Fischer IMPL_LINK( GraphicPropertyPanel, GreenHdl, void*, EMPTYARG )
2008dcb2a10SAndre Fischer {
2018dcb2a10SAndre Fischer 	sal_Int16 nGreen = mpMtrGreen->GetValue();
2028dcb2a10SAndre Fischer 	SfxInt16Item aGreenItem( SID_ATTR_GRAF_GREEN, nGreen );
2038dcb2a10SAndre Fischer 	GetBindings()->GetDispatcher()->Execute(
2048dcb2a10SAndre Fischer 		SID_ATTR_GRAF_GREEN, SFX_CALLMODE_RECORD, &aGreenItem, 0L);
2058dcb2a10SAndre Fischer 	return 0L;
2068dcb2a10SAndre Fischer }
2078dcb2a10SAndre Fischer 
2088dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
2098dcb2a10SAndre Fischer 
2108dcb2a10SAndre Fischer IMPL_LINK(GraphicPropertyPanel, BlueHdl, void *, EMPTYARG)
2118dcb2a10SAndre Fischer {
2128dcb2a10SAndre Fischer 	sal_Int16 nBlue = mpMtrBlue->GetValue();
2138dcb2a10SAndre Fischer 	SfxInt16Item aBlueItem( SID_ATTR_GRAF_BLUE, nBlue );
2148dcb2a10SAndre Fischer 	GetBindings()->GetDispatcher()->Execute(
2158dcb2a10SAndre Fischer 		SID_ATTR_GRAF_BLUE, SFX_CALLMODE_RECORD, &aBlueItem, 0L);
2168dcb2a10SAndre Fischer 	return 0L;
2178dcb2a10SAndre Fischer }
2188dcb2a10SAndre Fischer 
2198dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
2208dcb2a10SAndre Fischer 
2218dcb2a10SAndre Fischer IMPL_LINK(GraphicPropertyPanel, GammaHdl, void *, EMPTYARG)
2228dcb2a10SAndre Fischer {
2238dcb2a10SAndre Fischer 	sal_Int32 nGamma = mpMtrGamma->GetValue();
2248dcb2a10SAndre Fischer 	SfxInt32Item nGammaItem( SID_ATTR_GRAF_GAMMA, nGamma );
2258dcb2a10SAndre Fischer 	GetBindings()->GetDispatcher()->Execute(
2268dcb2a10SAndre Fischer 		SID_ATTR_GRAF_GAMMA, SFX_CALLMODE_RECORD, &nGammaItem, 0L);
2278dcb2a10SAndre Fischer 	return 0L;
2288dcb2a10SAndre Fischer }
2298dcb2a10SAndre Fischer 
2308dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
2318dcb2a10SAndre Fischer 
2328dcb2a10SAndre Fischer void GraphicPropertyPanel::SetupIcons(void)
2338dcb2a10SAndre Fischer {
2348dcb2a10SAndre Fischer     if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons))
2358dcb2a10SAndre Fischer     {
2368dcb2a10SAndre Fischer         // todo
2378dcb2a10SAndre Fischer     }
2388dcb2a10SAndre Fischer     else
2398dcb2a10SAndre Fischer     {
2408dcb2a10SAndre Fischer         // todo
2418dcb2a10SAndre Fischer     }
2428dcb2a10SAndre Fischer }
2438dcb2a10SAndre Fischer 
2448dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
2458dcb2a10SAndre Fischer 
2468dcb2a10SAndre Fischer GraphicPropertyPanel* GraphicPropertyPanel::Create (
2478dcb2a10SAndre Fischer     Window* pParent,
2488dcb2a10SAndre Fischer     const cssu::Reference<css::frame::XFrame>& rxFrame,
2498dcb2a10SAndre Fischer     SfxBindings* pBindings)
2508dcb2a10SAndre Fischer {
2518dcb2a10SAndre Fischer     if (pParent == NULL)
2528dcb2a10SAndre Fischer         throw lang::IllegalArgumentException(A2S("no parent Window given to GraphicPropertyPanel::Create"), NULL, 0);
2538dcb2a10SAndre Fischer     if ( ! rxFrame.is())
2548dcb2a10SAndre Fischer         throw lang::IllegalArgumentException(A2S("no XFrame given to GraphicPropertyPanel::Create"), NULL, 1);
2558dcb2a10SAndre Fischer     if (pBindings == NULL)
2568dcb2a10SAndre Fischer         throw lang::IllegalArgumentException(A2S("no SfxBindings given to GraphicPropertyPanel::Create"), NULL, 2);
2578dcb2a10SAndre Fischer 
2588dcb2a10SAndre Fischer     return new GraphicPropertyPanel(
2598dcb2a10SAndre Fischer         pParent,
2608dcb2a10SAndre Fischer         rxFrame,
2618dcb2a10SAndre Fischer         pBindings);
2628dcb2a10SAndre Fischer }
2638dcb2a10SAndre Fischer 
2648dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
2658dcb2a10SAndre Fischer 
2668dcb2a10SAndre Fischer void GraphicPropertyPanel::DataChanged(
2678dcb2a10SAndre Fischer     const DataChangedEvent& rEvent)
2688dcb2a10SAndre Fischer {
2698dcb2a10SAndre Fischer     (void)rEvent;
2708dcb2a10SAndre Fischer 
2718dcb2a10SAndre Fischer     SetupIcons();
2728dcb2a10SAndre Fischer }
2738dcb2a10SAndre Fischer 
2748dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
2758dcb2a10SAndre Fischer 
2768dcb2a10SAndre Fischer void GraphicPropertyPanel::NotifyItemUpdate(
2778dcb2a10SAndre Fischer     sal_uInt16 nSID,
2788dcb2a10SAndre Fischer     SfxItemState eState,
2798dcb2a10SAndre Fischer     const SfxPoolItem* pState)
2808dcb2a10SAndre Fischer {
2818dcb2a10SAndre Fischer 	switch( nSID )
2828dcb2a10SAndre Fischer 	{
2838dcb2a10SAndre Fischer 	case SID_ATTR_GRAF_LUMINANCE:
2848dcb2a10SAndre Fischer 		if( eState >= SFX_ITEM_AVAILABLE)
2858dcb2a10SAndre Fischer 		{
2868dcb2a10SAndre Fischer 			mpMtrBrightness->Enable();
2878dcb2a10SAndre Fischer             const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
2888dcb2a10SAndre Fischer 
2898dcb2a10SAndre Fischer 			if(pItem)
2908dcb2a10SAndre Fischer 			{
2918dcb2a10SAndre Fischer 				sal_Int64 nBright = pItem->GetValue();
2928dcb2a10SAndre Fischer 				mpMtrBrightness->SetValue(nBright);
2938dcb2a10SAndre Fischer 			}
2948dcb2a10SAndre Fischer 		}
2958dcb2a10SAndre Fischer 		else if( eState == SFX_ITEM_DISABLED )
2968dcb2a10SAndre Fischer 			mpMtrBrightness->Disable();
2978dcb2a10SAndre Fischer 		else
2988dcb2a10SAndre Fischer 		{
2998dcb2a10SAndre Fischer 			mpMtrBrightness->Enable();
3008dcb2a10SAndre Fischer 			mpMtrBrightness->SetText( String());
3018dcb2a10SAndre Fischer 		}
3028dcb2a10SAndre Fischer 		break;
3038dcb2a10SAndre Fischer 	case SID_ATTR_GRAF_CONTRAST:
3048dcb2a10SAndre Fischer 		if( eState >= SFX_ITEM_AVAILABLE)
3058dcb2a10SAndre Fischer 		{
3068dcb2a10SAndre Fischer 			mpMtrContrast->Enable();
3078dcb2a10SAndre Fischer             const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
3088dcb2a10SAndre Fischer 
3098dcb2a10SAndre Fischer             if(pItem)
3108dcb2a10SAndre Fischer 			{
3118dcb2a10SAndre Fischer 				sal_Int64 nContrast = pItem->GetValue();
3128dcb2a10SAndre Fischer 				mpMtrContrast->SetValue(nContrast);
3138dcb2a10SAndre Fischer 			}
3148dcb2a10SAndre Fischer 		}
3158dcb2a10SAndre Fischer 		else if( eState == SFX_ITEM_DISABLED )
3168dcb2a10SAndre Fischer 			mpMtrContrast->Disable();
3178dcb2a10SAndre Fischer 		else
3188dcb2a10SAndre Fischer 		{
3198dcb2a10SAndre Fischer 			mpMtrContrast->Enable();
3208dcb2a10SAndre Fischer 			mpMtrContrast->SetText( String());
3218dcb2a10SAndre Fischer 		}
3228dcb2a10SAndre Fischer 		break;
3238dcb2a10SAndre Fischer 	case SID_ATTR_GRAF_TRANSPARENCE:
3248dcb2a10SAndre Fischer 		if( eState >= SFX_ITEM_AVAILABLE)
3258dcb2a10SAndre Fischer 		{
3268dcb2a10SAndre Fischer 			mpMtrTrans->Enable();
3278dcb2a10SAndre Fischer             const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState);
3288dcb2a10SAndre Fischer 
3298dcb2a10SAndre Fischer 			if(pItem)
3308dcb2a10SAndre Fischer 			{
3318dcb2a10SAndre Fischer 				sal_Int64 nTrans = pItem->GetValue();
3328dcb2a10SAndre Fischer 				mpMtrTrans->SetValue(nTrans);
3338dcb2a10SAndre Fischer 			}
3348dcb2a10SAndre Fischer 		}
3358dcb2a10SAndre Fischer 		else if( eState == SFX_ITEM_DISABLED )
3368dcb2a10SAndre Fischer 			mpMtrTrans->Disable();
3378dcb2a10SAndre Fischer 		else
3388dcb2a10SAndre Fischer 		{
3398dcb2a10SAndre Fischer 			mpMtrTrans->Enable();
3408dcb2a10SAndre Fischer 			mpMtrTrans->SetText( String());
3418dcb2a10SAndre Fischer 		}
3428dcb2a10SAndre Fischer 		break;
3438dcb2a10SAndre Fischer 	case SID_ATTR_GRAF_MODE:
3448dcb2a10SAndre Fischer 		if( eState >= SFX_ITEM_AVAILABLE)
3458dcb2a10SAndre Fischer 		{
3468dcb2a10SAndre Fischer 			mpLBColorMode->Enable();
3478dcb2a10SAndre Fischer             const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState);
3488dcb2a10SAndre Fischer 
3498dcb2a10SAndre Fischer 			if(pItem)
3508dcb2a10SAndre Fischer 			{
3518dcb2a10SAndre Fischer 				sal_Int64 nTrans = pItem->GetValue();
3528dcb2a10SAndre Fischer 				mpLBColorMode->SelectEntryPos(nTrans);
3538dcb2a10SAndre Fischer 			}
3548dcb2a10SAndre Fischer 		}
3558dcb2a10SAndre Fischer 		else if( eState == SFX_ITEM_DISABLED )
3568dcb2a10SAndre Fischer 			mpLBColorMode->Disable();
3578dcb2a10SAndre Fischer 		else
3588dcb2a10SAndre Fischer 		{
3598dcb2a10SAndre Fischer 			mpLBColorMode->Enable();
3608dcb2a10SAndre Fischer 			mpLBColorMode->SetNoSelection();
3618dcb2a10SAndre Fischer 		}
3628dcb2a10SAndre Fischer 		break;
3638dcb2a10SAndre Fischer 	case SID_ATTR_GRAF_RED:
3648dcb2a10SAndre Fischer 		if( eState >= SFX_ITEM_AVAILABLE)
3658dcb2a10SAndre Fischer 		{
3668dcb2a10SAndre Fischer 			mpMtrRed->Enable();
3678dcb2a10SAndre Fischer             const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
3688dcb2a10SAndre Fischer 
3698dcb2a10SAndre Fischer 			if(pItem)
3708dcb2a10SAndre Fischer 			{
3718dcb2a10SAndre Fischer 				sal_Int64 nRed = pItem->GetValue();
3728dcb2a10SAndre Fischer 				mpMtrRed->SetValue( nRed );
3738dcb2a10SAndre Fischer 			}
3748dcb2a10SAndre Fischer 		}
3758dcb2a10SAndre Fischer 		else if( eState == SFX_ITEM_DISABLED )
3768dcb2a10SAndre Fischer 			mpMtrRed->Disable();
3778dcb2a10SAndre Fischer 		else
3788dcb2a10SAndre Fischer 		{
3798dcb2a10SAndre Fischer 			mpMtrRed->Enable();
3808dcb2a10SAndre Fischer 			mpMtrRed->SetText( String());
3818dcb2a10SAndre Fischer 		}
3828dcb2a10SAndre Fischer 		break;
3838dcb2a10SAndre Fischer 	case SID_ATTR_GRAF_GREEN:
3848dcb2a10SAndre Fischer 		if( eState >= SFX_ITEM_AVAILABLE)
3858dcb2a10SAndre Fischer 		{
3868dcb2a10SAndre Fischer 			mpMtrGreen->Enable();
3878dcb2a10SAndre Fischer             const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
3888dcb2a10SAndre Fischer 
3898dcb2a10SAndre Fischer 			if(pItem)
3908dcb2a10SAndre Fischer 			{
3918dcb2a10SAndre Fischer 				sal_Int64 nGreen = pItem->GetValue();
3928dcb2a10SAndre Fischer 				mpMtrGreen->SetValue( nGreen );
3938dcb2a10SAndre Fischer 			}
3948dcb2a10SAndre Fischer 		}
3958dcb2a10SAndre Fischer 		else if( eState == SFX_ITEM_DISABLED )
3968dcb2a10SAndre Fischer 			mpMtrGreen->Disable();
3978dcb2a10SAndre Fischer 		else
3988dcb2a10SAndre Fischer 		{
3998dcb2a10SAndre Fischer 			mpMtrGreen->Enable();
4008dcb2a10SAndre Fischer 			mpMtrGreen->SetText( String());
4018dcb2a10SAndre Fischer 		}
4028dcb2a10SAndre Fischer 		break;
4038dcb2a10SAndre Fischer 	case SID_ATTR_GRAF_BLUE:
4048dcb2a10SAndre Fischer 		if( eState >= SFX_ITEM_AVAILABLE)
4058dcb2a10SAndre Fischer 		{
4068dcb2a10SAndre Fischer 			mpMtrBlue->Enable();
4078dcb2a10SAndre Fischer             const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
4088dcb2a10SAndre Fischer 
4098dcb2a10SAndre Fischer 			if(pItem)
4108dcb2a10SAndre Fischer 			{
4118dcb2a10SAndre Fischer 				sal_Int64 nBlue = pItem->GetValue();
4128dcb2a10SAndre Fischer 				mpMtrBlue->SetValue( nBlue );
4138dcb2a10SAndre Fischer 			}
4148dcb2a10SAndre Fischer 		}
4158dcb2a10SAndre Fischer 		else if( eState == SFX_ITEM_DISABLED )
4168dcb2a10SAndre Fischer 			mpMtrBlue->Disable();
4178dcb2a10SAndre Fischer 		else
4188dcb2a10SAndre Fischer 		{
4198dcb2a10SAndre Fischer 			mpMtrBlue->Enable();
4208dcb2a10SAndre Fischer 			mpMtrBlue->SetText( String());
4218dcb2a10SAndre Fischer 		}
4228dcb2a10SAndre Fischer 		break;
4238dcb2a10SAndre Fischer 	case SID_ATTR_GRAF_GAMMA:
4248dcb2a10SAndre Fischer 		if( eState >= SFX_ITEM_AVAILABLE)
4258dcb2a10SAndre Fischer 		{
4268dcb2a10SAndre Fischer 			mpMtrGamma->Enable();
4278dcb2a10SAndre Fischer             const SfxUInt32Item* pItem = dynamic_cast< const SfxUInt32Item* >(pState);
4288dcb2a10SAndre Fischer 
4298dcb2a10SAndre Fischer 			if(pItem)
4308dcb2a10SAndre Fischer 			{
4318dcb2a10SAndre Fischer 				sal_Int64 nGamma = pItem->GetValue();
4328dcb2a10SAndre Fischer 				mpMtrGamma->SetValue( nGamma );
4338dcb2a10SAndre Fischer 			}
4348dcb2a10SAndre Fischer 		}
4358dcb2a10SAndre Fischer 		else if( eState == SFX_ITEM_DISABLED )
4368dcb2a10SAndre Fischer 			mpMtrGamma->Disable();
4378dcb2a10SAndre Fischer 		else
4388dcb2a10SAndre Fischer 		{
4398dcb2a10SAndre Fischer 			mpMtrGamma->Enable();
4408dcb2a10SAndre Fischer 			mpMtrGamma->SetText( String());
4418dcb2a10SAndre Fischer 		}
4428dcb2a10SAndre Fischer 		break;
4438dcb2a10SAndre Fischer 	}
4448dcb2a10SAndre Fischer }
4458dcb2a10SAndre Fischer 
4468dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
4478dcb2a10SAndre Fischer 
4488dcb2a10SAndre Fischer SfxBindings* GraphicPropertyPanel::GetBindings()
4498dcb2a10SAndre Fischer {
4508dcb2a10SAndre Fischer     return mpBindings;
4518dcb2a10SAndre Fischer }
4528dcb2a10SAndre Fischer 
4538dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
4548dcb2a10SAndre Fischer // namespace close
4558dcb2a10SAndre Fischer 
4568dcb2a10SAndre Fischer }} // end of namespace ::svx::sidebar
4578dcb2a10SAndre Fischer 
4588dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
4598dcb2a10SAndre Fischer // eof
460