12bdfcea1SArmin Le Grand /**************************************************************
22bdfcea1SArmin Le Grand  *
32bdfcea1SArmin Le Grand  * Licensed to the Apache Software Foundation (ASF) under one
42bdfcea1SArmin Le Grand  * or more contributor license agreements.  See the NOTICE file
52bdfcea1SArmin Le Grand  * distributed with this work for additional information
62bdfcea1SArmin Le Grand  * regarding copyright ownership.  The ASF licenses this file
72bdfcea1SArmin Le Grand  * to you under the Apache License, Version 2.0 (the
82bdfcea1SArmin Le Grand  * "License"); you may not use this file except in compliance
92bdfcea1SArmin Le Grand  * with the License.  You may obtain a copy of the License at
102bdfcea1SArmin Le Grand  *
112bdfcea1SArmin Le Grand  *   http://www.apache.org/licenses/LICENSE-2.0
122bdfcea1SArmin Le Grand  *
132bdfcea1SArmin Le Grand  * Unless required by applicable law or agreed to in writing,
142bdfcea1SArmin Le Grand  * software distributed under the License is distributed on an
152bdfcea1SArmin Le Grand  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
162bdfcea1SArmin Le Grand  * KIND, either express or implied.  See the License for the
172bdfcea1SArmin Le Grand  * specific language governing permissions and limitations
182bdfcea1SArmin Le Grand  * under the License.
192bdfcea1SArmin Le Grand  *
202bdfcea1SArmin Le Grand  *************************************************************/
212bdfcea1SArmin Le Grand 
222bdfcea1SArmin Le Grand #include <sfx2/sidebar/propertypanel.hrc>
232bdfcea1SArmin Le Grand #include <sfx2/sidebar/Theme.hxx>
242bdfcea1SArmin Le Grand #include <sfx2/sidebar/ControlFactory.hxx>
252bdfcea1SArmin Le Grand #include <GraphicPropertyPanel.hxx>
262bdfcea1SArmin Le Grand #include <GraphicPropertyPanel.hrc>
272bdfcea1SArmin Le Grand #include <svx/dialogs.hrc>
282bdfcea1SArmin Le Grand #include <svx/dialmgr.hxx>
292bdfcea1SArmin Le Grand #include <vcl/field.hxx>
302bdfcea1SArmin Le Grand #include <vcl/lstbox.hxx>
312bdfcea1SArmin Le Grand #include <svl/intitem.hxx>
322bdfcea1SArmin Le Grand #include <sfx2/bindings.hxx>
332bdfcea1SArmin Le Grand #include <sfx2/dispatch.hxx>
34*87ab04d0SAndre Fischer #include "svx/dialogs.hrc"
352bdfcea1SArmin Le Grand 
362bdfcea1SArmin Le Grand using namespace css;
372bdfcea1SArmin Le Grand using namespace cssu;
382bdfcea1SArmin Le Grand using ::sfx2::sidebar::Theme;
392bdfcea1SArmin Le Grand 
402bdfcea1SArmin Le Grand #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
412bdfcea1SArmin Le Grand 
422bdfcea1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
432bdfcea1SArmin Le Grand // namespace open
442bdfcea1SArmin Le Grand 
452bdfcea1SArmin Le Grand namespace svx { namespace sidebar {
462bdfcea1SArmin Le Grand 
472bdfcea1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
482bdfcea1SArmin Le Grand 
492bdfcea1SArmin Le Grand GraphicPropertyPanel::GraphicPropertyPanel(
502bdfcea1SArmin Le Grand     Window* pParent,
512bdfcea1SArmin Le Grand     const cssu::Reference<css::frame::XFrame>& rxFrame,
522bdfcea1SArmin Le Grand     SfxBindings* pBindings)
532bdfcea1SArmin Le Grand :   Control(
542bdfcea1SArmin Le Grand         pParent,
552bdfcea1SArmin Le Grand         SVX_RES(RID_SIDEBAR_GRAPHIC_PANEL)),
562bdfcea1SArmin Le Grand     mpFtBrightness(new FixedText(this, SVX_RES(FT_BRIGHTNESS))),
572bdfcea1SArmin Le Grand     mpMtrBrightness(new MetricField(this, SVX_RES(MTR_BRIGHTNESS))),
582bdfcea1SArmin Le Grand     mpFtContrast(new FixedText(this, SVX_RES(FT_CONTRAST))),
592bdfcea1SArmin Le Grand     mpMtrContrast(new MetricField(this, SVX_RES(MTR_CONTRAST))),
602bdfcea1SArmin Le Grand     mpFtColorMode(new FixedText(this, SVX_RES(FT_COLOR_MODE))),
612bdfcea1SArmin Le Grand     mpLBColorMode(new ListBox(this, SVX_RES(LB_COLOR_MODE))),
622bdfcea1SArmin Le Grand     mpFtTrans(new FixedText(this, SVX_RES(FT_TRANSPARENT))),
632bdfcea1SArmin Le Grand     mpMtrTrans(new MetricField(this, SVX_RES(MTR_TRANSPARENT))),
642bdfcea1SArmin Le Grand     mpMtrRed(new MetricField(this, SVX_RES(MF_RED))),
652bdfcea1SArmin Le Grand     mpMtrGreen(new MetricField(this, SVX_RES(MF_GREEN))),
662bdfcea1SArmin Le Grand     mpMtrBlue(new MetricField(this, SVX_RES(MF_BLUE))),
672bdfcea1SArmin Le Grand     mpMtrGamma(new MetricField(this, SVX_RES(MF_GAMMA))),
682bdfcea1SArmin Le Grand     maBrightControl(SID_ATTR_GRAF_LUMINANCE, *pBindings, *this),
692bdfcea1SArmin Le Grand     maContrastControl(SID_ATTR_GRAF_CONTRAST, *pBindings, *this),
702bdfcea1SArmin Le Grand     maTransparenceControl(SID_ATTR_GRAF_TRANSPARENCE, *pBindings, *this),
712bdfcea1SArmin Le Grand     maRedControl(SID_ATTR_GRAF_RED, *pBindings, *this),
722bdfcea1SArmin Le Grand     maGreenControl(SID_ATTR_GRAF_GREEN, *pBindings, *this),
732bdfcea1SArmin Le Grand     maBlueControl(SID_ATTR_GRAF_BLUE, *pBindings, *this),
742bdfcea1SArmin Le Grand     maGammaControl(SID_ATTR_GRAF_GAMMA, *pBindings, *this),
752bdfcea1SArmin Le Grand     maModeControl(SID_ATTR_GRAF_MODE, *pBindings, *this),
762bdfcea1SArmin Le Grand     maImgRed(this, SVX_RES(IMG_RED)),
772bdfcea1SArmin Le Grand     maImgGreen(this, SVX_RES(IMG_GREEN)),
782bdfcea1SArmin Le Grand     maImgBlue(this, SVX_RES(IMG_BLUE)),
792bdfcea1SArmin Le Grand     maImgGamma(this, SVX_RES(IMG_GAMMA)),
802bdfcea1SArmin Le Grand     mxFrame(rxFrame),
812bdfcea1SArmin Le Grand     mpBindings(pBindings)
822bdfcea1SArmin Le Grand {
832bdfcea1SArmin Le Grand     Initialize();
842bdfcea1SArmin Le Grand     FreeResource();
852bdfcea1SArmin Le Grand }
862bdfcea1SArmin Le Grand 
872bdfcea1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
882bdfcea1SArmin Le Grand 
892bdfcea1SArmin Le Grand GraphicPropertyPanel::~GraphicPropertyPanel()
902bdfcea1SArmin Le Grand {
912bdfcea1SArmin Le Grand }
922bdfcea1SArmin Le Grand 
932bdfcea1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
942bdfcea1SArmin Le Grand 
952bdfcea1SArmin Le Grand void GraphicPropertyPanel::Initialize()
962bdfcea1SArmin Le Grand {
9737fee4fdSAndre Fischer     mpFtBrightness->SetBackground(Wallpaper());
9837fee4fdSAndre Fischer     mpFtContrast->SetBackground(Wallpaper());
9937fee4fdSAndre Fischer     mpFtColorMode->SetBackground(Wallpaper());
10037fee4fdSAndre Fischer     mpFtTrans->SetBackground(Wallpaper());
10137fee4fdSAndre Fischer 
10237fee4fdSAndre Fischer     mpMtrBrightness->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyBrightnessHdl ) );
103*87ab04d0SAndre Fischer     mpMtrBrightness->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Brightness")));
104d74d90d6SArmin Le Grand     mpMtrContrast->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyContrastHdl ) );
105*87ab04d0SAndre Fischer     mpMtrContrast->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Contrast")));
106d74d90d6SArmin Le Grand     mpMtrTrans->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyTransHdl ) );
107*87ab04d0SAndre Fischer     mpMtrTrans->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency")));
108d74d90d6SArmin Le Grand 
109*87ab04d0SAndre Fischer     mpLBColorMode->InsertEntry(String(SVX_RES(RID_SVXSTR_GRAFMODE_STANDARD)));
110*87ab04d0SAndre Fischer     mpLBColorMode->InsertEntry(String(SVX_RES(RID_SVXSTR_GRAFMODE_GREYS)));
111*87ab04d0SAndre Fischer     mpLBColorMode->InsertEntry(String(SVX_RES(RID_SVXSTR_GRAFMODE_MONO)));
112*87ab04d0SAndre Fischer     mpLBColorMode->InsertEntry(String(SVX_RES(RID_SVXSTR_GRAFMODE_WATERMARK)));
113d74d90d6SArmin Le Grand     mpLBColorMode->SetSelectHdl( LINK( this, GraphicPropertyPanel, ClickColorModeHdl ));
114*87ab04d0SAndre Fischer     mpLBColorMode->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Color mode")));
115d74d90d6SArmin Le Grand 
116d74d90d6SArmin Le Grand     mpMtrRed->SetModifyHdl( LINK( this, GraphicPropertyPanel, RedHdl ) );
117d74d90d6SArmin Le Grand     mpMtrGreen->SetModifyHdl( LINK( this, GraphicPropertyPanel, GreenHdl ) );
118d74d90d6SArmin Le Grand     mpMtrBlue->SetModifyHdl( LINK( this, GraphicPropertyPanel, BlueHdl ) );
119d74d90d6SArmin Le Grand     mpMtrGamma->SetModifyHdl( LINK( this, GraphicPropertyPanel, GammaHdl ) );
120*87ab04d0SAndre Fischer     mpMtrRed->SetAccessibleName(mpMtrRed->GetQuickHelpText());
121*87ab04d0SAndre Fischer     mpMtrGreen->SetAccessibleName(mpMtrGreen->GetQuickHelpText());
122*87ab04d0SAndre Fischer     mpMtrBlue->SetAccessibleName(mpMtrBlue->GetQuickHelpText());
123*87ab04d0SAndre Fischer     mpMtrGamma->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Gamma value")));
1242bdfcea1SArmin Le Grand 
12589729eb3SArmin Le Grand     mpMtrRed->SetAccessibleRelationLabeledBy(mpMtrRed.get());
126d74d90d6SArmin Le Grand     mpMtrGreen->SetAccessibleRelationLabeledBy(mpMtrGreen.get());
127d74d90d6SArmin Le Grand     mpMtrBlue->SetAccessibleRelationLabeledBy(mpMtrBlue.get());
128d74d90d6SArmin Le Grand     mpMtrGamma->SetAccessibleRelationLabeledBy(mpMtrGamma.get());
129*87ab04d0SAndre Fischer     mpMtrBrightness->SetAccessibleRelationLabeledBy(mpFtBrightness.get());
130*87ab04d0SAndre Fischer     mpMtrContrast->SetAccessibleRelationLabeledBy(mpFtContrast.get());
131*87ab04d0SAndre Fischer     mpMtrTrans->SetAccessibleRelationLabeledBy(mpFtTrans.get());
132*87ab04d0SAndre Fischer     mpLBColorMode->SetAccessibleRelationLabeledBy(mpFtColorMode.get());
133*87ab04d0SAndre Fischer 
134*87ab04d0SAndre Fischer     // Fix left position of some controls that may be wrong due to
135*87ab04d0SAndre Fischer     // rounding errors.
136*87ab04d0SAndre Fischer     const sal_Int32 nRight0 (mpLBColorMode->GetPosPixel().X() + mpLBColorMode->GetSizePixel().Width());
137*87ab04d0SAndre Fischer     const sal_Int32 nRight1 (mpMtrTrans->GetPosPixel().X() + mpMtrTrans->GetSizePixel().Width());
138*87ab04d0SAndre Fischer     mpMtrRed->SetPosPixel(Point(
139*87ab04d0SAndre Fischer             nRight0 - mpMtrRed->GetSizePixel().Width(),
140*87ab04d0SAndre Fischer             mpMtrRed->GetPosPixel().Y()));
141*87ab04d0SAndre Fischer     mpMtrBlue->SetPosPixel(Point(
142*87ab04d0SAndre Fischer             nRight0 - mpMtrBlue->GetSizePixel().Width(),
143*87ab04d0SAndre Fischer             mpMtrBlue->GetPosPixel().Y()));
144*87ab04d0SAndre Fischer     mpMtrGreen->SetPosPixel(Point(
145*87ab04d0SAndre Fischer             nRight1 - mpMtrGreen->GetSizePixel().Width(),
146*87ab04d0SAndre Fischer             mpMtrGreen->GetPosPixel().Y()));
147*87ab04d0SAndre Fischer     mpMtrGamma->SetPosPixel(Point(
148*87ab04d0SAndre Fischer             nRight1 - mpMtrGamma->GetSizePixel().Width(),
149*87ab04d0SAndre Fischer             mpMtrGamma->GetPosPixel().Y()));
1502bdfcea1SArmin Le Grand }
1512bdfcea1SArmin Le Grand 
152*87ab04d0SAndre Fischer 
153*87ab04d0SAndre Fischer 
154*87ab04d0SAndre Fischer 
1552bdfcea1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
1562bdfcea1SArmin Le Grand 
1572bdfcea1SArmin Le Grand IMPL_LINK( GraphicPropertyPanel, ModifyBrightnessHdl, void *, EMPTYARG )
1582bdfcea1SArmin Le Grand {
159d74d90d6SArmin Le Grand     const sal_Int16 nBright = mpMtrBrightness->GetValue();
160d74d90d6SArmin Le Grand     const SfxInt16Item aBrightItem( SID_ATTR_GRAF_LUMINANCE, nBright );
161d74d90d6SArmin Le Grand     GetBindings()->GetDispatcher()->Execute(SID_ATTR_GRAF_LUMINANCE, SFX_CALLMODE_RECORD, &aBrightItem, 0L);
162d74d90d6SArmin Le Grand     return 0L;
1632bdfcea1SArmin Le Grand }
1642bdfcea1SArmin Le Grand 
1652bdfcea1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
1662bdfcea1SArmin Le Grand 
1672bdfcea1SArmin Le Grand IMPL_LINK( GraphicPropertyPanel, ModifyContrastHdl, void *, EMPTYARG )
1682bdfcea1SArmin Le Grand {
169d74d90d6SArmin Le Grand     const sal_Int16 nContrast = mpMtrContrast->GetValue();
170d74d90d6SArmin Le Grand     const SfxInt16Item aContrastItem( SID_ATTR_GRAF_CONTRAST, nContrast );
171d74d90d6SArmin Le Grand     GetBindings()->GetDispatcher()->Execute(SID_ATTR_GRAF_CONTRAST, SFX_CALLMODE_RECORD, &aContrastItem, 0L);
172d74d90d6SArmin Le Grand     return 0L;
1732bdfcea1SArmin Le Grand }
1742bdfcea1SArmin Le Grand 
1752bdfcea1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
1762bdfcea1SArmin Le Grand 
1772bdfcea1SArmin Le Grand IMPL_LINK( GraphicPropertyPanel, ModifyTransHdl, void *, EMPTYARG )
1782bdfcea1SArmin Le Grand {
179d74d90d6SArmin Le Grand     const sal_Int16 nTrans = mpMtrTrans->GetValue();
180d74d90d6SArmin Le Grand     const SfxInt16Item aTransItem( SID_ATTR_GRAF_TRANSPARENCE, nTrans );
181d74d90d6SArmin Le Grand     GetBindings()->GetDispatcher()->Execute(SID_ATTR_GRAF_TRANSPARENCE, SFX_CALLMODE_RECORD, &aTransItem, 0L);
182d74d90d6SArmin Le Grand     return 0L;
1832bdfcea1SArmin Le Grand }
1842bdfcea1SArmin Le Grand 
1852bdfcea1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
1862bdfcea1SArmin Le Grand 
187e89b8a96SPavel Janík IMPL_LINK( GraphicPropertyPanel, ClickColorModeHdl, ToolBox *, /* pBox */)
1882bdfcea1SArmin Le Grand {
189d74d90d6SArmin Le Grand     const sal_Int16 nTrans = mpLBColorMode->GetSelectEntryPos();
190d74d90d6SArmin Le Grand     const SfxInt16Item aTransItem( SID_ATTR_GRAF_MODE, nTrans );
191d74d90d6SArmin Le Grand     GetBindings()->GetDispatcher()->Execute(SID_ATTR_GRAF_MODE, SFX_CALLMODE_RECORD, &aTransItem, 0L);
192d74d90d6SArmin Le Grand     return 0L;
1932bdfcea1SArmin Le Grand }
1942bdfcea1SArmin Le Grand 
1952bdfcea1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
1962bdfcea1SArmin Le Grand 
1972bdfcea1SArmin Le Grand IMPL_LINK( GraphicPropertyPanel, RedHdl, void*, EMPTYARG )
1982bdfcea1SArmin Le Grand {
199d74d90d6SArmin Le Grand     const sal_Int16 nRed = mpMtrRed->GetValue();
200d74d90d6SArmin Le Grand     const SfxInt16Item aRedItem( SID_ATTR_GRAF_RED, nRed );
201d74d90d6SArmin Le Grand     GetBindings()->GetDispatcher()->Execute(SID_ATTR_GRAF_RED, SFX_CALLMODE_RECORD, &aRedItem, 0L);
202d74d90d6SArmin Le Grand     return 0L;
2032bdfcea1SArmin Le Grand }
2042bdfcea1SArmin Le Grand 
2052bdfcea1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
2062bdfcea1SArmin Le Grand 
2072bdfcea1SArmin Le Grand IMPL_LINK( GraphicPropertyPanel, GreenHdl, void*, EMPTYARG )
2082bdfcea1SArmin Le Grand {
209d74d90d6SArmin Le Grand     const sal_Int16 nGreen = mpMtrGreen->GetValue();
210d74d90d6SArmin Le Grand     const SfxInt16Item aGreenItem( SID_ATTR_GRAF_GREEN, nGreen );
211d74d90d6SArmin Le Grand     GetBindings()->GetDispatcher()->Execute(SID_ATTR_GRAF_GREEN, SFX_CALLMODE_RECORD, &aGreenItem, 0L);
212d74d90d6SArmin Le Grand     return 0L;
2132bdfcea1SArmin Le Grand }
2142bdfcea1SArmin Le Grand 
2152bdfcea1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
2162bdfcea1SArmin Le Grand 
2172bdfcea1SArmin Le Grand IMPL_LINK(GraphicPropertyPanel, BlueHdl, void *, EMPTYARG)
2182bdfcea1SArmin Le Grand {
219d74d90d6SArmin Le Grand     const sal_Int16 nBlue = mpMtrBlue->GetValue();
220d74d90d6SArmin Le Grand     const SfxInt16Item aBlueItem( SID_ATTR_GRAF_BLUE, nBlue );
221d74d90d6SArmin Le Grand     GetBindings()->GetDispatcher()->Execute(SID_ATTR_GRAF_BLUE, SFX_CALLMODE_RECORD, &aBlueItem, 0L);
222d74d90d6SArmin Le Grand     return 0L;
2232bdfcea1SArmin Le Grand }
2242bdfcea1SArmin Le Grand 
2252bdfcea1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
2262bdfcea1SArmin Le Grand 
2272bdfcea1SArmin Le Grand IMPL_LINK(GraphicPropertyPanel, GammaHdl, void *, EMPTYARG)
2282bdfcea1SArmin Le Grand {
229d74d90d6SArmin Le Grand     const sal_Int32 nGamma = mpMtrGamma->GetValue();
230d74d90d6SArmin Le Grand     const SfxInt32Item nGammaItem( SID_ATTR_GRAF_GAMMA, nGamma );
231d74d90d6SArmin Le Grand     GetBindings()->GetDispatcher()->Execute(SID_ATTR_GRAF_GAMMA, SFX_CALLMODE_RECORD, &nGammaItem, 0L);
232d74d90d6SArmin Le Grand     return 0L;
2332bdfcea1SArmin Le Grand }
2342bdfcea1SArmin Le Grand 
2352bdfcea1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
2362bdfcea1SArmin Le Grand 
2372bdfcea1SArmin Le Grand void GraphicPropertyPanel::SetupIcons(void)
2382bdfcea1SArmin Le Grand {
2392bdfcea1SArmin Le Grand     if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons))
2402bdfcea1SArmin Le Grand     {
2412bdfcea1SArmin Le Grand         // todo
2422bdfcea1SArmin Le Grand     }
2432bdfcea1SArmin Le Grand     else
2442bdfcea1SArmin Le Grand     {
2452bdfcea1SArmin Le Grand         // todo
2462bdfcea1SArmin Le Grand     }
2472bdfcea1SArmin Le Grand }
2482bdfcea1SArmin Le Grand 
2492bdfcea1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
2502bdfcea1SArmin Le Grand 
2512bdfcea1SArmin Le Grand GraphicPropertyPanel* GraphicPropertyPanel::Create (
2522bdfcea1SArmin Le Grand     Window* pParent,
2532bdfcea1SArmin Le Grand     const cssu::Reference<css::frame::XFrame>& rxFrame,
2542bdfcea1SArmin Le Grand     SfxBindings* pBindings)
2552bdfcea1SArmin Le Grand {
2562bdfcea1SArmin Le Grand     if (pParent == NULL)
2572bdfcea1SArmin Le Grand         throw lang::IllegalArgumentException(A2S("no parent Window given to GraphicPropertyPanel::Create"), NULL, 0);
2582bdfcea1SArmin Le Grand     if ( ! rxFrame.is())
2592bdfcea1SArmin Le Grand         throw lang::IllegalArgumentException(A2S("no XFrame given to GraphicPropertyPanel::Create"), NULL, 1);
2602bdfcea1SArmin Le Grand     if (pBindings == NULL)
2612bdfcea1SArmin Le Grand         throw lang::IllegalArgumentException(A2S("no SfxBindings given to GraphicPropertyPanel::Create"), NULL, 2);
2622bdfcea1SArmin Le Grand 
2632bdfcea1SArmin Le Grand     return new GraphicPropertyPanel(
2642bdfcea1SArmin Le Grand         pParent,
2652bdfcea1SArmin Le Grand         rxFrame,
2662bdfcea1SArmin Le Grand         pBindings);
2672bdfcea1SArmin Le Grand }
2682bdfcea1SArmin Le Grand 
2692bdfcea1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
2702bdfcea1SArmin Le Grand 
2712bdfcea1SArmin Le Grand void GraphicPropertyPanel::DataChanged(
2722bdfcea1SArmin Le Grand     const DataChangedEvent& rEvent)
2732bdfcea1SArmin Le Grand {
2742bdfcea1SArmin Le Grand     (void)rEvent;
2752bdfcea1SArmin Le Grand 
2762bdfcea1SArmin Le Grand     SetupIcons();
2772bdfcea1SArmin Le Grand }
2782bdfcea1SArmin Le Grand 
2792bdfcea1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
2802bdfcea1SArmin Le Grand 
2812bdfcea1SArmin Le Grand void GraphicPropertyPanel::NotifyItemUpdate(
2822bdfcea1SArmin Le Grand     sal_uInt16 nSID,
2832bdfcea1SArmin Le Grand     SfxItemState eState,
28445da7d5eSAndre Fischer     const SfxPoolItem* pState,
28545da7d5eSAndre Fischer     const bool bIsEnabled)
2862bdfcea1SArmin Le Grand {
28745da7d5eSAndre Fischer     (void)bIsEnabled;
28845da7d5eSAndre Fischer 
289d74d90d6SArmin Le Grand     switch( nSID )
290d74d90d6SArmin Le Grand     {
291d74d90d6SArmin Le Grand         case SID_ATTR_GRAF_LUMINANCE:
292d74d90d6SArmin Le Grand         {
293d74d90d6SArmin Le Grand             if(eState >= SFX_ITEM_AVAILABLE)
294d74d90d6SArmin Le Grand             {
295d74d90d6SArmin Le Grand                 mpMtrBrightness->Enable();
296d74d90d6SArmin Le Grand                 const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
297d74d90d6SArmin Le Grand 
298d74d90d6SArmin Le Grand                 if(pItem)
299d74d90d6SArmin Le Grand                 {
300d74d90d6SArmin Le Grand                     const sal_Int64 nBright = pItem->GetValue();
301d74d90d6SArmin Le Grand                     mpMtrBrightness->SetValue(nBright);
302d74d90d6SArmin Le Grand                 }
303d74d90d6SArmin Le Grand             }
304d74d90d6SArmin Le Grand             else if(SFX_ITEM_DISABLED == eState)
305d74d90d6SArmin Le Grand             {
306d74d90d6SArmin Le Grand                 mpMtrBrightness->Disable();
307d74d90d6SArmin Le Grand             }
308d74d90d6SArmin Le Grand             else
309d74d90d6SArmin Le Grand             {
310d74d90d6SArmin Le Grand                 mpMtrBrightness->Enable();
311d74d90d6SArmin Le Grand                 mpMtrBrightness->SetText(String());
312d74d90d6SArmin Le Grand             }
313d74d90d6SArmin Le Grand             break;
314d74d90d6SArmin Le Grand         }
315d74d90d6SArmin Le Grand         case SID_ATTR_GRAF_CONTRAST:
316d74d90d6SArmin Le Grand         {
317d74d90d6SArmin Le Grand             if(eState >= SFX_ITEM_AVAILABLE)
318d74d90d6SArmin Le Grand             {
319d74d90d6SArmin Le Grand                 mpMtrContrast->Enable();
320d74d90d6SArmin Le Grand                 const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
321d74d90d6SArmin Le Grand 
322d74d90d6SArmin Le Grand                 if(pItem)
323d74d90d6SArmin Le Grand                 {
324d74d90d6SArmin Le Grand                     const sal_Int64 nContrast = pItem->GetValue();
325d74d90d6SArmin Le Grand                     mpMtrContrast->SetValue(nContrast);
326d74d90d6SArmin Le Grand                 }
327d74d90d6SArmin Le Grand             }
328d74d90d6SArmin Le Grand             else if(SFX_ITEM_DISABLED == eState)
329d74d90d6SArmin Le Grand             {
330d74d90d6SArmin Le Grand                 mpMtrContrast->Disable();
331d74d90d6SArmin Le Grand             }
332d74d90d6SArmin Le Grand             else
333d74d90d6SArmin Le Grand             {
334d74d90d6SArmin Le Grand                 mpMtrContrast->Enable();
335d74d90d6SArmin Le Grand                 mpMtrContrast->SetText(String());
336d74d90d6SArmin Le Grand             }
337d74d90d6SArmin Le Grand             break;
338d74d90d6SArmin Le Grand         }
339d74d90d6SArmin Le Grand         case SID_ATTR_GRAF_TRANSPARENCE:
340d74d90d6SArmin Le Grand         {
341d74d90d6SArmin Le Grand             if(eState >= SFX_ITEM_AVAILABLE)
342d74d90d6SArmin Le Grand             {
343d74d90d6SArmin Le Grand                 mpMtrTrans->Enable();
344d74d90d6SArmin Le Grand                 const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState);
345d74d90d6SArmin Le Grand 
346d74d90d6SArmin Le Grand                 if(pItem)
347d74d90d6SArmin Le Grand                 {
348d74d90d6SArmin Le Grand                     const sal_Int64 nTrans = pItem->GetValue();
349d74d90d6SArmin Le Grand                     mpMtrTrans->SetValue(nTrans);
350d74d90d6SArmin Le Grand                 }
351d74d90d6SArmin Le Grand             }
352d74d90d6SArmin Le Grand             else if(SFX_ITEM_DISABLED == eState)
353d74d90d6SArmin Le Grand             {
354d74d90d6SArmin Le Grand                 mpMtrTrans->Disable();
355d74d90d6SArmin Le Grand             }
356d74d90d6SArmin Le Grand             else
357d74d90d6SArmin Le Grand             {
358d74d90d6SArmin Le Grand                 mpMtrTrans->Enable();
359d74d90d6SArmin Le Grand                 mpMtrTrans->SetText(String());
360d74d90d6SArmin Le Grand             }
361d74d90d6SArmin Le Grand             break;
362d74d90d6SArmin Le Grand         }
363d74d90d6SArmin Le Grand         case SID_ATTR_GRAF_MODE:
364d74d90d6SArmin Le Grand         {
365d74d90d6SArmin Le Grand             if(eState >= SFX_ITEM_AVAILABLE)
366d74d90d6SArmin Le Grand             {
367d74d90d6SArmin Le Grand                 mpLBColorMode->Enable();
368d74d90d6SArmin Le Grand                 const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState);
369d74d90d6SArmin Le Grand 
370d74d90d6SArmin Le Grand                 if(pItem)
371d74d90d6SArmin Le Grand                 {
372d74d90d6SArmin Le Grand                     const sal_Int64 nTrans = pItem->GetValue();
373d74d90d6SArmin Le Grand                     mpLBColorMode->SelectEntryPos(nTrans);
374d74d90d6SArmin Le Grand                 }
375d74d90d6SArmin Le Grand             }
376d74d90d6SArmin Le Grand             else if(SFX_ITEM_DISABLED == eState)
377d74d90d6SArmin Le Grand             {
378d74d90d6SArmin Le Grand                 mpLBColorMode->Disable();
379d74d90d6SArmin Le Grand             }
380d74d90d6SArmin Le Grand             else
381d74d90d6SArmin Le Grand             {
382d74d90d6SArmin Le Grand                 mpLBColorMode->Enable();
383d74d90d6SArmin Le Grand                 mpLBColorMode->SetNoSelection();
384d74d90d6SArmin Le Grand             }
385d74d90d6SArmin Le Grand             break;
386d74d90d6SArmin Le Grand         }
387d74d90d6SArmin Le Grand         case SID_ATTR_GRAF_RED:
388d74d90d6SArmin Le Grand         {
389d74d90d6SArmin Le Grand             if(eState >= SFX_ITEM_AVAILABLE)
390d74d90d6SArmin Le Grand             {
391d74d90d6SArmin Le Grand                 mpMtrRed->Enable();
392d74d90d6SArmin Le Grand                 const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
393d74d90d6SArmin Le Grand 
394d74d90d6SArmin Le Grand                 if(pItem)
395d74d90d6SArmin Le Grand                 {
396d74d90d6SArmin Le Grand                     const sal_Int64 nRed = pItem->GetValue();
397d74d90d6SArmin Le Grand                     mpMtrRed->SetValue( nRed );
398d74d90d6SArmin Le Grand                 }
399d74d90d6SArmin Le Grand             }
400d74d90d6SArmin Le Grand             else if(SFX_ITEM_DISABLED == eState)
401d74d90d6SArmin Le Grand             {
402d74d90d6SArmin Le Grand                 mpMtrRed->Disable();
403d74d90d6SArmin Le Grand             }
404d74d90d6SArmin Le Grand             else
405d74d90d6SArmin Le Grand             {
406d74d90d6SArmin Le Grand                 mpMtrRed->Enable();
407d74d90d6SArmin Le Grand                 mpMtrRed->SetText(String());
408d74d90d6SArmin Le Grand             }
409d74d90d6SArmin Le Grand             break;
410d74d90d6SArmin Le Grand         }
411d74d90d6SArmin Le Grand         case SID_ATTR_GRAF_GREEN:
412d74d90d6SArmin Le Grand         {
413d74d90d6SArmin Le Grand             if(eState >= SFX_ITEM_AVAILABLE)
414d74d90d6SArmin Le Grand             {
415d74d90d6SArmin Le Grand                 mpMtrGreen->Enable();
416d74d90d6SArmin Le Grand                 const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
417d74d90d6SArmin Le Grand 
418d74d90d6SArmin Le Grand                 if(pItem)
419d74d90d6SArmin Le Grand                 {
420d74d90d6SArmin Le Grand                     const sal_Int64 nGreen = pItem->GetValue();
421d74d90d6SArmin Le Grand                     mpMtrGreen->SetValue( nGreen );
422d74d90d6SArmin Le Grand                 }
423d74d90d6SArmin Le Grand             }
424d74d90d6SArmin Le Grand             else if(SFX_ITEM_DISABLED == eState)
425d74d90d6SArmin Le Grand             {
426d74d90d6SArmin Le Grand                 mpMtrGreen->Disable();
427d74d90d6SArmin Le Grand             }
428d74d90d6SArmin Le Grand             else
429d74d90d6SArmin Le Grand             {
430d74d90d6SArmin Le Grand                 mpMtrGreen->Enable();
431d74d90d6SArmin Le Grand                 mpMtrGreen->SetText(String());
432d74d90d6SArmin Le Grand             }
433d74d90d6SArmin Le Grand             break;
434d74d90d6SArmin Le Grand         }
435d74d90d6SArmin Le Grand         case SID_ATTR_GRAF_BLUE:
436d74d90d6SArmin Le Grand         {
437d74d90d6SArmin Le Grand             if(eState >= SFX_ITEM_AVAILABLE)
438d74d90d6SArmin Le Grand             {
439d74d90d6SArmin Le Grand                 mpMtrBlue->Enable();
440d74d90d6SArmin Le Grand                 const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
441d74d90d6SArmin Le Grand 
442d74d90d6SArmin Le Grand                 if(pItem)
443d74d90d6SArmin Le Grand                 {
444d74d90d6SArmin Le Grand                     const sal_Int64 nBlue = pItem->GetValue();
445d74d90d6SArmin Le Grand                     mpMtrBlue->SetValue( nBlue );
446d74d90d6SArmin Le Grand                 }
447d74d90d6SArmin Le Grand             }
448d74d90d6SArmin Le Grand             else if(SFX_ITEM_DISABLED == eState)
449d74d90d6SArmin Le Grand             {
450d74d90d6SArmin Le Grand                 mpMtrBlue->Disable();
451d74d90d6SArmin Le Grand             }
452d74d90d6SArmin Le Grand             else
453d74d90d6SArmin Le Grand             {
454d74d90d6SArmin Le Grand                 mpMtrBlue->Enable();
455d74d90d6SArmin Le Grand                 mpMtrBlue->SetText(String());
456d74d90d6SArmin Le Grand             }
457d74d90d6SArmin Le Grand             break;
458d74d90d6SArmin Le Grand         }
459d74d90d6SArmin Le Grand         case SID_ATTR_GRAF_GAMMA:
460d74d90d6SArmin Le Grand         {
461d74d90d6SArmin Le Grand             if(eState >= SFX_ITEM_AVAILABLE)
462d74d90d6SArmin Le Grand             {
463d74d90d6SArmin Le Grand                 mpMtrGamma->Enable();
464d74d90d6SArmin Le Grand                 const SfxUInt32Item* pItem = dynamic_cast< const SfxUInt32Item* >(pState);
465d74d90d6SArmin Le Grand 
466d74d90d6SArmin Le Grand                 if(pItem)
467d74d90d6SArmin Le Grand                 {
468d74d90d6SArmin Le Grand                     const sal_Int64 nGamma = pItem->GetValue();
469d74d90d6SArmin Le Grand                     mpMtrGamma->SetValue( nGamma );
470d74d90d6SArmin Le Grand                 }
471d74d90d6SArmin Le Grand             }
472d74d90d6SArmin Le Grand             else if(SFX_ITEM_DISABLED == eState)
473d74d90d6SArmin Le Grand             {
474d74d90d6SArmin Le Grand                 mpMtrGamma->Disable();
475d74d90d6SArmin Le Grand             }
476d74d90d6SArmin Le Grand             else
477d74d90d6SArmin Le Grand             {
478d74d90d6SArmin Le Grand                 mpMtrGamma->Enable();
479d74d90d6SArmin Le Grand                 mpMtrGamma->SetText(String());
480d74d90d6SArmin Le Grand             }
481d74d90d6SArmin Le Grand             break;
482d74d90d6SArmin Le Grand         }
483d74d90d6SArmin Le Grand     }
4842bdfcea1SArmin Le Grand }
4852bdfcea1SArmin Le Grand 
48645da7d5eSAndre Fischer 
48745da7d5eSAndre Fischer 
48845da7d5eSAndre Fischer 
4892bdfcea1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
4902bdfcea1SArmin Le Grand 
4912bdfcea1SArmin Le Grand SfxBindings* GraphicPropertyPanel::GetBindings()
4922bdfcea1SArmin Le Grand {
4932bdfcea1SArmin Le Grand     return mpBindings;
4942bdfcea1SArmin Le Grand }
4952bdfcea1SArmin Le Grand 
4962bdfcea1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
4972bdfcea1SArmin Le Grand // namespace close
4982bdfcea1SArmin Le Grand 
4992bdfcea1SArmin Le Grand }} // end of namespace ::svx::sidebar
5002bdfcea1SArmin Le Grand 
5012bdfcea1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
5022bdfcea1SArmin Le Grand // eof
503