xref: /AOO41X/main/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx (revision 8dcb2a100eb78f12871a9e67d867e1bc0c7bdb07)
1*8dcb2a10SAndre Fischer /**************************************************************
2*8dcb2a10SAndre Fischer  *
3*8dcb2a10SAndre Fischer  * Licensed to the Apache Software Foundation (ASF) under one
4*8dcb2a10SAndre Fischer  * or more contributor license agreements.  See the NOTICE file
5*8dcb2a10SAndre Fischer  * distributed with this work for additional information
6*8dcb2a10SAndre Fischer  * regarding copyright ownership.  The ASF licenses this file
7*8dcb2a10SAndre Fischer  * to you under the Apache License, Version 2.0 (the
8*8dcb2a10SAndre Fischer  * "License"); you may not use this file except in compliance
9*8dcb2a10SAndre Fischer  * with the License.  You may obtain a copy of the License at
10*8dcb2a10SAndre Fischer  *
11*8dcb2a10SAndre Fischer  *   http://www.apache.org/licenses/LICENSE-2.0
12*8dcb2a10SAndre Fischer  *
13*8dcb2a10SAndre Fischer  * Unless required by applicable law or agreed to in writing,
14*8dcb2a10SAndre Fischer  * software distributed under the License is distributed on an
15*8dcb2a10SAndre Fischer  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*8dcb2a10SAndre Fischer  * KIND, either express or implied.  See the License for the
17*8dcb2a10SAndre Fischer  * specific language governing permissions and limitations
18*8dcb2a10SAndre Fischer  * under the License.
19*8dcb2a10SAndre Fischer  *
20*8dcb2a10SAndre Fischer  *************************************************************/
21*8dcb2a10SAndre Fischer 
22*8dcb2a10SAndre Fischer #include <sfx2/sidebar/propertypanel.hrc>
23*8dcb2a10SAndre Fischer #include <sfx2/sidebar/Theme.hxx>
24*8dcb2a10SAndre Fischer #include <sfx2/sidebar/ControlFactory.hxx>
25*8dcb2a10SAndre Fischer #include <GraphicPropertyPanel.hxx>
26*8dcb2a10SAndre Fischer #include <GraphicPropertyPanel.hrc>
27*8dcb2a10SAndre Fischer #include <svx/dialogs.hrc>
28*8dcb2a10SAndre Fischer #include <svx/dialmgr.hxx>
29*8dcb2a10SAndre Fischer #include <vcl/field.hxx>
30*8dcb2a10SAndre Fischer #include <vcl/lstbox.hxx>
31*8dcb2a10SAndre Fischer #include <svl/intitem.hxx>
32*8dcb2a10SAndre Fischer #include <sfx2/bindings.hxx>
33*8dcb2a10SAndre Fischer #include <sfx2/dispatch.hxx>
34*8dcb2a10SAndre Fischer 
35*8dcb2a10SAndre Fischer using namespace css;
36*8dcb2a10SAndre Fischer using namespace cssu;
37*8dcb2a10SAndre Fischer using ::sfx2::sidebar::Theme;
38*8dcb2a10SAndre Fischer 
39*8dcb2a10SAndre Fischer #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
40*8dcb2a10SAndre Fischer 
41*8dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
42*8dcb2a10SAndre Fischer // namespace open
43*8dcb2a10SAndre Fischer 
44*8dcb2a10SAndre Fischer namespace svx { namespace sidebar {
45*8dcb2a10SAndre Fischer 
46*8dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
47*8dcb2a10SAndre Fischer 
48*8dcb2a10SAndre Fischer GraphicPropertyPanel::GraphicPropertyPanel(
49*8dcb2a10SAndre Fischer     Window* pParent,
50*8dcb2a10SAndre Fischer     const cssu::Reference<css::frame::XFrame>& rxFrame,
51*8dcb2a10SAndre Fischer     SfxBindings* pBindings)
52*8dcb2a10SAndre Fischer :   Control(
53*8dcb2a10SAndre Fischer         pParent,
54*8dcb2a10SAndre Fischer         SVX_RES(RID_SIDEBAR_GRAPHIC_PANEL)),
55*8dcb2a10SAndre Fischer     mpFtBrightness(new FixedText(this, SVX_RES(FT_BRIGHTNESS))),
56*8dcb2a10SAndre Fischer     mpMtrBrightness(new MetricField(this, SVX_RES(MTR_BRIGHTNESS))),
57*8dcb2a10SAndre Fischer     mpFtContrast(new FixedText(this, SVX_RES(FT_CONTRAST))),
58*8dcb2a10SAndre Fischer     mpMtrContrast(new MetricField(this, SVX_RES(MTR_CONTRAST))),
59*8dcb2a10SAndre Fischer     mpFtColorMode(new FixedText(this, SVX_RES(FT_COLOR_MODE))),
60*8dcb2a10SAndre Fischer     mpLBColorMode(new ListBox(this, SVX_RES(LB_COLOR_MODE))),
61*8dcb2a10SAndre Fischer     mpFtTrans(new FixedText(this, SVX_RES(FT_TRANSPARENT))),
62*8dcb2a10SAndre Fischer     mpMtrTrans(new MetricField(this, SVX_RES(MTR_TRANSPARENT))),
63*8dcb2a10SAndre Fischer     mpMtrRed(new MetricField(this, SVX_RES(MF_RED))),
64*8dcb2a10SAndre Fischer     mpMtrGreen(new MetricField(this, SVX_RES(MF_GREEN))),
65*8dcb2a10SAndre Fischer     mpMtrBlue(new MetricField(this, SVX_RES(MF_BLUE))),
66*8dcb2a10SAndre Fischer     mpMtrGamma(new MetricField(this, SVX_RES(MF_GAMMA))),
67*8dcb2a10SAndre Fischer     maBrightControl(SID_ATTR_GRAF_LUMINANCE, *pBindings, *this),
68*8dcb2a10SAndre Fischer     maContrastControl(SID_ATTR_GRAF_CONTRAST, *pBindings, *this),
69*8dcb2a10SAndre Fischer     maTransparenceControl(SID_ATTR_GRAF_TRANSPARENCE, *pBindings, *this),
70*8dcb2a10SAndre Fischer     maRedControl(SID_ATTR_GRAF_RED, *pBindings, *this),
71*8dcb2a10SAndre Fischer     maGreenControl(SID_ATTR_GRAF_GREEN, *pBindings, *this),
72*8dcb2a10SAndre Fischer     maBlueControl(SID_ATTR_GRAF_BLUE, *pBindings, *this),
73*8dcb2a10SAndre Fischer     maGammaControl(SID_ATTR_GRAF_GAMMA, *pBindings, *this),
74*8dcb2a10SAndre Fischer     maModeControl(SID_ATTR_GRAF_MODE, *pBindings, *this),
75*8dcb2a10SAndre Fischer     maImgNormal(SVX_RES(IMG_NORMAL)),
76*8dcb2a10SAndre Fischer     maImgBW(SVX_RES(IMG_BW)),
77*8dcb2a10SAndre Fischer     maImgGray(SVX_RES(IMG_GRAY)),
78*8dcb2a10SAndre Fischer     maImgWater(SVX_RES(IMG_WATER)),
79*8dcb2a10SAndre Fischer     maImgRed(this, SVX_RES(IMG_RED)),
80*8dcb2a10SAndre Fischer     maImgGreen(this, SVX_RES(IMG_GREEN)),
81*8dcb2a10SAndre Fischer     maImgBlue(this, SVX_RES(IMG_BLUE)),
82*8dcb2a10SAndre Fischer     maImgGamma(this, SVX_RES(IMG_GAMMA)),
83*8dcb2a10SAndre Fischer     msNormal(SVX_RES(STR_NORMAL)),
84*8dcb2a10SAndre Fischer     msBW(SVX_RES(STR_BW)),
85*8dcb2a10SAndre Fischer     msGray(SVX_RES(STR_GRAY)),
86*8dcb2a10SAndre Fischer     msWater(SVX_RES(STR_WATER)),
87*8dcb2a10SAndre Fischer     mxFrame(rxFrame),
88*8dcb2a10SAndre Fischer     maContext(),
89*8dcb2a10SAndre Fischer     mpBindings(pBindings)
90*8dcb2a10SAndre Fischer {
91*8dcb2a10SAndre Fischer     Initialize();
92*8dcb2a10SAndre Fischer     FreeResource();
93*8dcb2a10SAndre Fischer }
94*8dcb2a10SAndre Fischer 
95*8dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
96*8dcb2a10SAndre Fischer 
97*8dcb2a10SAndre Fischer GraphicPropertyPanel::~GraphicPropertyPanel()
98*8dcb2a10SAndre Fischer {
99*8dcb2a10SAndre Fischer }
100*8dcb2a10SAndre Fischer 
101*8dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
102*8dcb2a10SAndre Fischer 
103*8dcb2a10SAndre Fischer void GraphicPropertyPanel::Initialize()
104*8dcb2a10SAndre Fischer {
105*8dcb2a10SAndre Fischer 	mpMtrBrightness->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyBrightnessHdl ) );
106*8dcb2a10SAndre Fischer 	mpMtrBrightness->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Brightness")));	//wj acc
107*8dcb2a10SAndre Fischer 	mpMtrContrast->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyContrastHdl ) );
108*8dcb2a10SAndre Fischer 	mpMtrContrast->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Contrast")));	//wj acc
109*8dcb2a10SAndre Fischer 	mpMtrTrans->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyTransHdl ) );
110*8dcb2a10SAndre Fischer 	mpMtrTrans->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency")));	//wj acc
111*8dcb2a10SAndre Fischer 
112*8dcb2a10SAndre Fischer 	mpLBColorMode->InsertEntry( msNormal, maImgNormal );
113*8dcb2a10SAndre Fischer 	mpLBColorMode->InsertEntry( msGray, maImgGray );
114*8dcb2a10SAndre Fischer 	mpLBColorMode->InsertEntry( msBW, maImgBW );
115*8dcb2a10SAndre Fischer 	mpLBColorMode->InsertEntry( msWater, maImgWater );
116*8dcb2a10SAndre Fischer 	mpLBColorMode->SetSelectHdl( LINK( this, GraphicPropertyPanel, ClickColorModeHdl ));
117*8dcb2a10SAndre Fischer 	mpLBColorMode->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Color mode")));	//wj acc
118*8dcb2a10SAndre Fischer 
119*8dcb2a10SAndre Fischer 	mpMtrRed->SetModifyHdl( LINK( this, GraphicPropertyPanel, RedHdl ) );
120*8dcb2a10SAndre Fischer 	mpMtrGreen->SetModifyHdl( LINK( this, GraphicPropertyPanel, GreenHdl ) );
121*8dcb2a10SAndre Fischer 	mpMtrBlue->SetModifyHdl( LINK( this, GraphicPropertyPanel, BlueHdl ) );
122*8dcb2a10SAndre Fischer 	mpMtrGamma->SetModifyHdl( LINK( this, GraphicPropertyPanel, GammaHdl ) );
123*8dcb2a10SAndre Fischer 	mpMtrRed->SetAccessibleName(mpMtrRed->GetQuickHelpText());	//wj acc
124*8dcb2a10SAndre Fischer 	mpMtrGreen->SetAccessibleName(mpMtrGreen->GetQuickHelpText());	//wj acc
125*8dcb2a10SAndre Fischer 	mpMtrBlue->SetAccessibleName(mpMtrBlue->GetQuickHelpText());		//wj acc
126*8dcb2a10SAndre Fischer 	mpMtrGamma->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Gamma value")));	//wj acc
127*8dcb2a10SAndre Fischer 
128*8dcb2a10SAndre Fischer     mpMtrRed->SetAccessibleRelationLabeledBy(mpMtrRed.get());
129*8dcb2a10SAndre Fischer 	mpMtrGreen->SetAccessibleRelationLabeledBy(mpMtrGreen.get());
130*8dcb2a10SAndre Fischer 	mpMtrBlue->SetAccessibleRelationLabeledBy(mpMtrBlue.get());
131*8dcb2a10SAndre Fischer 	mpMtrGamma->SetAccessibleRelationLabeledBy(mpMtrGamma.get());
132*8dcb2a10SAndre Fischer 	mpMtrBrightness->SetAccessibleRelationLabeledBy(mpFtBrightness.get());	//7874
133*8dcb2a10SAndre Fischer 	mpMtrContrast->SetAccessibleRelationLabeledBy(mpFtContrast.get());	//7874
134*8dcb2a10SAndre Fischer 	mpMtrTrans->SetAccessibleRelationLabeledBy(mpFtTrans.get());	//7874
135*8dcb2a10SAndre Fischer 	mpLBColorMode->SetAccessibleRelationLabeledBy(mpFtColorMode.get());	//7874
136*8dcb2a10SAndre Fischer }
137*8dcb2a10SAndre Fischer 
138*8dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
139*8dcb2a10SAndre Fischer 
140*8dcb2a10SAndre Fischer IMPL_LINK( GraphicPropertyPanel, ModifyBrightnessHdl, void *, EMPTYARG )
141*8dcb2a10SAndre Fischer {
142*8dcb2a10SAndre Fischer 	sal_Int16 nBright = mpMtrBrightness->GetValue();
143*8dcb2a10SAndre Fischer 	SfxInt16Item aBrightItem( SID_ATTR_GRAF_LUMINANCE, nBright );
144*8dcb2a10SAndre Fischer 	GetBindings()->GetDispatcher()->Execute(
145*8dcb2a10SAndre Fischer 		SID_ATTR_GRAF_LUMINANCE, SFX_CALLMODE_RECORD, &aBrightItem, 0L);
146*8dcb2a10SAndre Fischer 	return 0L;
147*8dcb2a10SAndre Fischer }
148*8dcb2a10SAndre Fischer 
149*8dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
150*8dcb2a10SAndre Fischer 
151*8dcb2a10SAndre Fischer IMPL_LINK( GraphicPropertyPanel, ModifyContrastHdl, void *, EMPTYARG )
152*8dcb2a10SAndre Fischer {
153*8dcb2a10SAndre Fischer 	sal_Int16 nContrast = mpMtrContrast->GetValue();
154*8dcb2a10SAndre Fischer 	SfxInt16Item aContrastItem( SID_ATTR_GRAF_CONTRAST, nContrast );
155*8dcb2a10SAndre Fischer 	GetBindings()->GetDispatcher()->Execute(
156*8dcb2a10SAndre Fischer 		SID_ATTR_GRAF_CONTRAST, SFX_CALLMODE_RECORD, &aContrastItem, 0L);
157*8dcb2a10SAndre Fischer 	return 0L;
158*8dcb2a10SAndre Fischer }
159*8dcb2a10SAndre Fischer 
160*8dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
161*8dcb2a10SAndre Fischer 
162*8dcb2a10SAndre Fischer IMPL_LINK( GraphicPropertyPanel, ModifyTransHdl, void *, EMPTYARG )
163*8dcb2a10SAndre Fischer {
164*8dcb2a10SAndre Fischer 	sal_Int16 nTrans = mpMtrTrans->GetValue();
165*8dcb2a10SAndre Fischer 	SfxInt16Item aTransItem( SID_ATTR_GRAF_TRANSPARENCE, nTrans );
166*8dcb2a10SAndre Fischer 	GetBindings()->GetDispatcher()->Execute(
167*8dcb2a10SAndre Fischer 		SID_ATTR_GRAF_TRANSPARENCE, SFX_CALLMODE_RECORD, &aTransItem, 0L);
168*8dcb2a10SAndre Fischer 	return 0L;
169*8dcb2a10SAndre Fischer }
170*8dcb2a10SAndre Fischer 
171*8dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
172*8dcb2a10SAndre Fischer 
173*8dcb2a10SAndre Fischer IMPL_LINK( GraphicPropertyPanel, ClickColorModeHdl, ToolBox *, pBox )
174*8dcb2a10SAndre Fischer {
175*8dcb2a10SAndre Fischer 	sal_Int16 nTrans = mpLBColorMode->GetSelectEntryPos();
176*8dcb2a10SAndre Fischer 	SfxInt16Item aTransItem( SID_ATTR_GRAF_MODE, nTrans );
177*8dcb2a10SAndre Fischer 	GetBindings()->GetDispatcher()->Execute(
178*8dcb2a10SAndre Fischer 		SID_ATTR_GRAF_MODE, SFX_CALLMODE_RECORD, &aTransItem, 0L);
179*8dcb2a10SAndre Fischer 	return 0L;
180*8dcb2a10SAndre Fischer }
181*8dcb2a10SAndre Fischer 
182*8dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
183*8dcb2a10SAndre Fischer 
184*8dcb2a10SAndre Fischer IMPL_LINK( GraphicPropertyPanel, RedHdl, void*, EMPTYARG )
185*8dcb2a10SAndre Fischer {
186*8dcb2a10SAndre Fischer 	sal_Int16 nRed = mpMtrRed->GetValue();
187*8dcb2a10SAndre Fischer 	SfxInt16Item aRedItem( SID_ATTR_GRAF_RED, nRed );
188*8dcb2a10SAndre Fischer 	GetBindings()->GetDispatcher()->Execute(
189*8dcb2a10SAndre Fischer 		SID_ATTR_GRAF_RED, SFX_CALLMODE_RECORD, &aRedItem, 0L);
190*8dcb2a10SAndre Fischer 	return 0L;
191*8dcb2a10SAndre Fischer }
192*8dcb2a10SAndre Fischer 
193*8dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
194*8dcb2a10SAndre Fischer 
195*8dcb2a10SAndre Fischer IMPL_LINK( GraphicPropertyPanel, GreenHdl, void*, EMPTYARG )
196*8dcb2a10SAndre Fischer {
197*8dcb2a10SAndre Fischer 	sal_Int16 nGreen = mpMtrGreen->GetValue();
198*8dcb2a10SAndre Fischer 	SfxInt16Item aGreenItem( SID_ATTR_GRAF_GREEN, nGreen );
199*8dcb2a10SAndre Fischer 	GetBindings()->GetDispatcher()->Execute(
200*8dcb2a10SAndre Fischer 		SID_ATTR_GRAF_GREEN, SFX_CALLMODE_RECORD, &aGreenItem, 0L);
201*8dcb2a10SAndre Fischer 	return 0L;
202*8dcb2a10SAndre Fischer }
203*8dcb2a10SAndre Fischer 
204*8dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
205*8dcb2a10SAndre Fischer 
206*8dcb2a10SAndre Fischer IMPL_LINK(GraphicPropertyPanel, BlueHdl, void *, EMPTYARG)
207*8dcb2a10SAndre Fischer {
208*8dcb2a10SAndre Fischer 	sal_Int16 nBlue = mpMtrBlue->GetValue();
209*8dcb2a10SAndre Fischer 	SfxInt16Item aBlueItem( SID_ATTR_GRAF_BLUE, nBlue );
210*8dcb2a10SAndre Fischer 	GetBindings()->GetDispatcher()->Execute(
211*8dcb2a10SAndre Fischer 		SID_ATTR_GRAF_BLUE, SFX_CALLMODE_RECORD, &aBlueItem, 0L);
212*8dcb2a10SAndre Fischer 	return 0L;
213*8dcb2a10SAndre Fischer }
214*8dcb2a10SAndre Fischer 
215*8dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
216*8dcb2a10SAndre Fischer 
217*8dcb2a10SAndre Fischer IMPL_LINK(GraphicPropertyPanel, GammaHdl, void *, EMPTYARG)
218*8dcb2a10SAndre Fischer {
219*8dcb2a10SAndre Fischer 	sal_Int32 nGamma = mpMtrGamma->GetValue();
220*8dcb2a10SAndre Fischer 	SfxInt32Item nGammaItem( SID_ATTR_GRAF_GAMMA, nGamma );
221*8dcb2a10SAndre Fischer 	GetBindings()->GetDispatcher()->Execute(
222*8dcb2a10SAndre Fischer 		SID_ATTR_GRAF_GAMMA, SFX_CALLMODE_RECORD, &nGammaItem, 0L);
223*8dcb2a10SAndre Fischer 	return 0L;
224*8dcb2a10SAndre Fischer }
225*8dcb2a10SAndre Fischer 
226*8dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
227*8dcb2a10SAndre Fischer 
228*8dcb2a10SAndre Fischer void GraphicPropertyPanel::SetupIcons(void)
229*8dcb2a10SAndre Fischer {
230*8dcb2a10SAndre Fischer     if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons))
231*8dcb2a10SAndre Fischer     {
232*8dcb2a10SAndre Fischer         // todo
233*8dcb2a10SAndre Fischer     }
234*8dcb2a10SAndre Fischer     else
235*8dcb2a10SAndre Fischer     {
236*8dcb2a10SAndre Fischer         // todo
237*8dcb2a10SAndre Fischer     }
238*8dcb2a10SAndre Fischer }
239*8dcb2a10SAndre Fischer 
240*8dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
241*8dcb2a10SAndre Fischer 
242*8dcb2a10SAndre Fischer GraphicPropertyPanel* GraphicPropertyPanel::Create (
243*8dcb2a10SAndre Fischer     Window* pParent,
244*8dcb2a10SAndre Fischer     const cssu::Reference<css::frame::XFrame>& rxFrame,
245*8dcb2a10SAndre Fischer     SfxBindings* pBindings)
246*8dcb2a10SAndre Fischer {
247*8dcb2a10SAndre Fischer     if (pParent == NULL)
248*8dcb2a10SAndre Fischer         throw lang::IllegalArgumentException(A2S("no parent Window given to GraphicPropertyPanel::Create"), NULL, 0);
249*8dcb2a10SAndre Fischer     if ( ! rxFrame.is())
250*8dcb2a10SAndre Fischer         throw lang::IllegalArgumentException(A2S("no XFrame given to GraphicPropertyPanel::Create"), NULL, 1);
251*8dcb2a10SAndre Fischer     if (pBindings == NULL)
252*8dcb2a10SAndre Fischer         throw lang::IllegalArgumentException(A2S("no SfxBindings given to GraphicPropertyPanel::Create"), NULL, 2);
253*8dcb2a10SAndre Fischer 
254*8dcb2a10SAndre Fischer     return new GraphicPropertyPanel(
255*8dcb2a10SAndre Fischer         pParent,
256*8dcb2a10SAndre Fischer         rxFrame,
257*8dcb2a10SAndre Fischer         pBindings);
258*8dcb2a10SAndre Fischer }
259*8dcb2a10SAndre Fischer 
260*8dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
261*8dcb2a10SAndre Fischer 
262*8dcb2a10SAndre Fischer void GraphicPropertyPanel::DataChanged(
263*8dcb2a10SAndre Fischer     const DataChangedEvent& rEvent)
264*8dcb2a10SAndre Fischer {
265*8dcb2a10SAndre Fischer     (void)rEvent;
266*8dcb2a10SAndre Fischer 
267*8dcb2a10SAndre Fischer     SetupIcons();
268*8dcb2a10SAndre Fischer }
269*8dcb2a10SAndre Fischer 
270*8dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
271*8dcb2a10SAndre Fischer 
272*8dcb2a10SAndre Fischer void GraphicPropertyPanel::HandleContextChange(
273*8dcb2a10SAndre Fischer     const ::sfx2::sidebar::EnumContext aContext)
274*8dcb2a10SAndre Fischer {
275*8dcb2a10SAndre Fischer     if(maContext == aContext)
276*8dcb2a10SAndre Fischer     {
277*8dcb2a10SAndre Fischer         // Nothing to do.
278*8dcb2a10SAndre Fischer         return;
279*8dcb2a10SAndre Fischer     }
280*8dcb2a10SAndre Fischer 
281*8dcb2a10SAndre Fischer     maContext = aContext;
282*8dcb2a10SAndre Fischer 
283*8dcb2a10SAndre Fischer 
284*8dcb2a10SAndre Fischer 
285*8dcb2a10SAndre Fischer     // todo
286*8dcb2a10SAndre Fischer }
287*8dcb2a10SAndre Fischer 
288*8dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
289*8dcb2a10SAndre Fischer 
290*8dcb2a10SAndre Fischer void GraphicPropertyPanel::NotifyItemUpdate(
291*8dcb2a10SAndre Fischer     sal_uInt16 nSID,
292*8dcb2a10SAndre Fischer     SfxItemState eState,
293*8dcb2a10SAndre Fischer     const SfxPoolItem* pState)
294*8dcb2a10SAndre Fischer {
295*8dcb2a10SAndre Fischer 	switch( nSID )
296*8dcb2a10SAndre Fischer 	{
297*8dcb2a10SAndre Fischer 	case SID_ATTR_GRAF_LUMINANCE:
298*8dcb2a10SAndre Fischer 		if( eState >= SFX_ITEM_AVAILABLE)
299*8dcb2a10SAndre Fischer 		{
300*8dcb2a10SAndre Fischer 			mpMtrBrightness->Enable();
301*8dcb2a10SAndre Fischer             const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
302*8dcb2a10SAndre Fischer 
303*8dcb2a10SAndre Fischer 			if(pItem)
304*8dcb2a10SAndre Fischer 			{
305*8dcb2a10SAndre Fischer 				sal_Int64 nBright = pItem->GetValue();
306*8dcb2a10SAndre Fischer 				mpMtrBrightness->SetValue(nBright);
307*8dcb2a10SAndre Fischer 			}
308*8dcb2a10SAndre Fischer 		}
309*8dcb2a10SAndre Fischer 		else if( eState == SFX_ITEM_DISABLED )
310*8dcb2a10SAndre Fischer 			mpMtrBrightness->Disable();
311*8dcb2a10SAndre Fischer 		else
312*8dcb2a10SAndre Fischer 		{
313*8dcb2a10SAndre Fischer 			mpMtrBrightness->Enable();
314*8dcb2a10SAndre Fischer 			mpMtrBrightness->SetText( String());
315*8dcb2a10SAndre Fischer 		}
316*8dcb2a10SAndre Fischer 		break;
317*8dcb2a10SAndre Fischer 	case SID_ATTR_GRAF_CONTRAST:
318*8dcb2a10SAndre Fischer 		if( eState >= SFX_ITEM_AVAILABLE)
319*8dcb2a10SAndre Fischer 		{
320*8dcb2a10SAndre Fischer 			mpMtrContrast->Enable();
321*8dcb2a10SAndre Fischer             const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
322*8dcb2a10SAndre Fischer 
323*8dcb2a10SAndre Fischer             if(pItem)
324*8dcb2a10SAndre Fischer 			{
325*8dcb2a10SAndre Fischer 				sal_Int64 nContrast = pItem->GetValue();
326*8dcb2a10SAndre Fischer 				mpMtrContrast->SetValue(nContrast);
327*8dcb2a10SAndre Fischer 			}
328*8dcb2a10SAndre Fischer 		}
329*8dcb2a10SAndre Fischer 		else if( eState == SFX_ITEM_DISABLED )
330*8dcb2a10SAndre Fischer 			mpMtrContrast->Disable();
331*8dcb2a10SAndre Fischer 		else
332*8dcb2a10SAndre Fischer 		{
333*8dcb2a10SAndre Fischer 			mpMtrContrast->Enable();
334*8dcb2a10SAndre Fischer 			mpMtrContrast->SetText( String());
335*8dcb2a10SAndre Fischer 		}
336*8dcb2a10SAndre Fischer 		break;
337*8dcb2a10SAndre Fischer 	case SID_ATTR_GRAF_TRANSPARENCE:
338*8dcb2a10SAndre Fischer 		if( eState >= SFX_ITEM_AVAILABLE)
339*8dcb2a10SAndre Fischer 		{
340*8dcb2a10SAndre Fischer 			mpMtrTrans->Enable();
341*8dcb2a10SAndre Fischer             const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState);
342*8dcb2a10SAndre Fischer 
343*8dcb2a10SAndre Fischer 			if(pItem)
344*8dcb2a10SAndre Fischer 			{
345*8dcb2a10SAndre Fischer 				sal_Int64 nTrans = pItem->GetValue();
346*8dcb2a10SAndre Fischer 				mpMtrTrans->SetValue(nTrans);
347*8dcb2a10SAndre Fischer 			}
348*8dcb2a10SAndre Fischer 		}
349*8dcb2a10SAndre Fischer 		else if( eState == SFX_ITEM_DISABLED )
350*8dcb2a10SAndre Fischer 			mpMtrTrans->Disable();
351*8dcb2a10SAndre Fischer 		else
352*8dcb2a10SAndre Fischer 		{
353*8dcb2a10SAndre Fischer 			mpMtrTrans->Enable();
354*8dcb2a10SAndre Fischer 			mpMtrTrans->SetText( String());
355*8dcb2a10SAndre Fischer 		}
356*8dcb2a10SAndre Fischer 		break;
357*8dcb2a10SAndre Fischer 	case SID_ATTR_GRAF_MODE:
358*8dcb2a10SAndre Fischer 		if( eState >= SFX_ITEM_AVAILABLE)
359*8dcb2a10SAndre Fischer 		{
360*8dcb2a10SAndre Fischer 			mpLBColorMode->Enable();
361*8dcb2a10SAndre Fischer             const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState);
362*8dcb2a10SAndre Fischer 
363*8dcb2a10SAndre Fischer 			if(pItem)
364*8dcb2a10SAndre Fischer 			{
365*8dcb2a10SAndre Fischer 				sal_Int64 nTrans = pItem->GetValue();
366*8dcb2a10SAndre Fischer 				mpLBColorMode->SelectEntryPos(nTrans);
367*8dcb2a10SAndre Fischer 			}
368*8dcb2a10SAndre Fischer 		}
369*8dcb2a10SAndre Fischer 		else if( eState == SFX_ITEM_DISABLED )
370*8dcb2a10SAndre Fischer 			mpLBColorMode->Disable();
371*8dcb2a10SAndre Fischer 		else
372*8dcb2a10SAndre Fischer 		{
373*8dcb2a10SAndre Fischer 			mpLBColorMode->Enable();
374*8dcb2a10SAndre Fischer 			mpLBColorMode->SetNoSelection();
375*8dcb2a10SAndre Fischer 		}
376*8dcb2a10SAndre Fischer 		break;
377*8dcb2a10SAndre Fischer 	case SID_ATTR_GRAF_RED:
378*8dcb2a10SAndre Fischer 		if( eState >= SFX_ITEM_AVAILABLE)
379*8dcb2a10SAndre Fischer 		{
380*8dcb2a10SAndre Fischer 			mpMtrRed->Enable();
381*8dcb2a10SAndre Fischer             const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
382*8dcb2a10SAndre Fischer 
383*8dcb2a10SAndre Fischer 			if(pItem)
384*8dcb2a10SAndre Fischer 			{
385*8dcb2a10SAndre Fischer 				sal_Int64 nRed = pItem->GetValue();
386*8dcb2a10SAndre Fischer 				mpMtrRed->SetValue( nRed );
387*8dcb2a10SAndre Fischer 			}
388*8dcb2a10SAndre Fischer 		}
389*8dcb2a10SAndre Fischer 		else if( eState == SFX_ITEM_DISABLED )
390*8dcb2a10SAndre Fischer 			mpMtrRed->Disable();
391*8dcb2a10SAndre Fischer 		else
392*8dcb2a10SAndre Fischer 		{
393*8dcb2a10SAndre Fischer 			mpMtrRed->Enable();
394*8dcb2a10SAndre Fischer 			mpMtrRed->SetText( String());
395*8dcb2a10SAndre Fischer 		}
396*8dcb2a10SAndre Fischer 		break;
397*8dcb2a10SAndre Fischer 	case SID_ATTR_GRAF_GREEN:
398*8dcb2a10SAndre Fischer 		if( eState >= SFX_ITEM_AVAILABLE)
399*8dcb2a10SAndre Fischer 		{
400*8dcb2a10SAndre Fischer 			mpMtrGreen->Enable();
401*8dcb2a10SAndre Fischer             const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
402*8dcb2a10SAndre Fischer 
403*8dcb2a10SAndre Fischer 			if(pItem)
404*8dcb2a10SAndre Fischer 			{
405*8dcb2a10SAndre Fischer 				sal_Int64 nGreen = pItem->GetValue();
406*8dcb2a10SAndre Fischer 				mpMtrGreen->SetValue( nGreen );
407*8dcb2a10SAndre Fischer 			}
408*8dcb2a10SAndre Fischer 		}
409*8dcb2a10SAndre Fischer 		else if( eState == SFX_ITEM_DISABLED )
410*8dcb2a10SAndre Fischer 			mpMtrGreen->Disable();
411*8dcb2a10SAndre Fischer 		else
412*8dcb2a10SAndre Fischer 		{
413*8dcb2a10SAndre Fischer 			mpMtrGreen->Enable();
414*8dcb2a10SAndre Fischer 			mpMtrGreen->SetText( String());
415*8dcb2a10SAndre Fischer 		}
416*8dcb2a10SAndre Fischer 		break;
417*8dcb2a10SAndre Fischer 	case SID_ATTR_GRAF_BLUE:
418*8dcb2a10SAndre Fischer 		if( eState >= SFX_ITEM_AVAILABLE)
419*8dcb2a10SAndre Fischer 		{
420*8dcb2a10SAndre Fischer 			mpMtrBlue->Enable();
421*8dcb2a10SAndre Fischer             const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
422*8dcb2a10SAndre Fischer 
423*8dcb2a10SAndre Fischer 			if(pItem)
424*8dcb2a10SAndre Fischer 			{
425*8dcb2a10SAndre Fischer 				sal_Int64 nBlue = pItem->GetValue();
426*8dcb2a10SAndre Fischer 				mpMtrBlue->SetValue( nBlue );
427*8dcb2a10SAndre Fischer 			}
428*8dcb2a10SAndre Fischer 		}
429*8dcb2a10SAndre Fischer 		else if( eState == SFX_ITEM_DISABLED )
430*8dcb2a10SAndre Fischer 			mpMtrBlue->Disable();
431*8dcb2a10SAndre Fischer 		else
432*8dcb2a10SAndre Fischer 		{
433*8dcb2a10SAndre Fischer 			mpMtrBlue->Enable();
434*8dcb2a10SAndre Fischer 			mpMtrBlue->SetText( String());
435*8dcb2a10SAndre Fischer 		}
436*8dcb2a10SAndre Fischer 		break;
437*8dcb2a10SAndre Fischer 	case SID_ATTR_GRAF_GAMMA:
438*8dcb2a10SAndre Fischer 		if( eState >= SFX_ITEM_AVAILABLE)
439*8dcb2a10SAndre Fischer 		{
440*8dcb2a10SAndre Fischer 			mpMtrGamma->Enable();
441*8dcb2a10SAndre Fischer             const SfxUInt32Item* pItem = dynamic_cast< const SfxUInt32Item* >(pState);
442*8dcb2a10SAndre Fischer 
443*8dcb2a10SAndre Fischer 			if(pItem)
444*8dcb2a10SAndre Fischer 			{
445*8dcb2a10SAndre Fischer 				sal_Int64 nGamma = pItem->GetValue();
446*8dcb2a10SAndre Fischer 				mpMtrGamma->SetValue( nGamma );
447*8dcb2a10SAndre Fischer 			}
448*8dcb2a10SAndre Fischer 		}
449*8dcb2a10SAndre Fischer 		else if( eState == SFX_ITEM_DISABLED )
450*8dcb2a10SAndre Fischer 			mpMtrGamma->Disable();
451*8dcb2a10SAndre Fischer 		else
452*8dcb2a10SAndre Fischer 		{
453*8dcb2a10SAndre Fischer 			mpMtrGamma->Enable();
454*8dcb2a10SAndre Fischer 			mpMtrGamma->SetText( String());
455*8dcb2a10SAndre Fischer 		}
456*8dcb2a10SAndre Fischer 		break;
457*8dcb2a10SAndre Fischer 	}
458*8dcb2a10SAndre Fischer }
459*8dcb2a10SAndre Fischer 
460*8dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
461*8dcb2a10SAndre Fischer 
462*8dcb2a10SAndre Fischer SfxBindings* GraphicPropertyPanel::GetBindings()
463*8dcb2a10SAndre Fischer {
464*8dcb2a10SAndre Fischer     return mpBindings;
465*8dcb2a10SAndre Fischer }
466*8dcb2a10SAndre Fischer 
467*8dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
468*8dcb2a10SAndre Fischer // namespace close
469*8dcb2a10SAndre Fischer 
470*8dcb2a10SAndre Fischer }} // end of namespace ::svx::sidebar
471*8dcb2a10SAndre Fischer 
472*8dcb2a10SAndre Fischer //////////////////////////////////////////////////////////////////////////////
473*8dcb2a10SAndre Fischer // eof
474