bump product version to 5.0.4.1
[LibreOffice.git] / cui / source / tabpages / tparea.cxx
blob87e480ff4ced7af6c268e7b7e6530083d70ec23f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <stdlib.h>
22 #include <tools/urlobj.hxx>
23 #include <sfx2/app.hxx>
24 #include <sfx2/module.hxx>
25 #include <svx/dialogs.hrc>
27 #include "svx/xattr.hxx"
28 #include <svx/xpool.hxx>
29 #include <cuires.hrc>
30 #include <svx/xflbckit.hxx>
31 #include <svx/svdattr.hxx>
32 #include <svx/xtable.hxx>
33 #include <svx/xlineit0.hxx>
34 #include "svx/drawitem.hxx"
35 #include "cuitabarea.hxx"
36 #include "dlgname.hxx"
37 #include <dialmgr.hxx>
38 #include "svx/dlgutil.hxx"
39 #include <svl/intitem.hxx>
40 #include <sfx2/request.hxx>
41 #include "paragrph.hrc"
43 //UUUU
44 #include "sfx2/opengrf.hxx"
45 #include <vcl/layout.hxx>
46 #include <boost/scoped_ptr.hpp>
48 using namespace com::sun::star;
50 // static ----------------------------------------------------------------
52 const sal_uInt16 SvxAreaTabPage::pAreaRanges[] =
54 XATTR_GRADIENTSTEPCOUNT,
55 XATTR_GRADIENTSTEPCOUNT,
56 SID_ATTR_FILL_STYLE,
57 SID_ATTR_FILL_BITMAP,
61 const sal_uInt16 SvxTransparenceTabPage::pTransparenceRanges[] =
63 XATTR_FILLTRANSPARENCE,
64 XATTR_FILLTRANSPARENCE,
65 SDRATTR_SHADOWTRANSPARENCE,
66 SDRATTR_SHADOWTRANSPARENCE,
67 XATTR_FILLFLOATTRANSPARENCE,
68 XATTR_FILLFLOATTRANSPARENCE,
72 /*************************************************************************
74 |* Dialog for transparence
76 \************************************************************************/
78 IMPL_LINK_NOARG(SvxTransparenceTabPage, ClickTransOffHdl_Impl)
80 // disable all other controls
81 ActivateLinear(false);
82 ActivateGradient(false);
84 // Preview
85 rXFSet.ClearItem (XATTR_FILLTRANSPARENCE);
86 rXFSet.ClearItem (XATTR_FILLFLOATTRANSPARENCE);
87 m_pCtlXRectPreview->SetAttributes( aXFillAttr.GetItemSet() );
88 m_pCtlBitmapPreview->SetAttributes( aXFillAttr.GetItemSet() );
90 InvalidatePreview( false );
92 return 0L;
95 IMPL_LINK_NOARG(SvxTransparenceTabPage, ClickTransLinearHdl_Impl)
97 // enable linear, disable other
98 ActivateLinear(true);
99 ActivateGradient(false);
101 // preview
102 rXFSet.ClearItem (XATTR_FILLFLOATTRANSPARENCE);
103 ModifyTransparentHdl_Impl (NULL);
105 return 0L;
108 IMPL_LINK_NOARG(SvxTransparenceTabPage, ClickTransGradientHdl_Impl)
110 // enable gradient, disable other
111 ActivateLinear(false);
112 ActivateGradient(true);
114 // preview
115 rXFSet.ClearItem (XATTR_FILLTRANSPARENCE);
116 ModifiedTrgrHdl_Impl (NULL);
118 return 0L;
121 SvxTransparenceTabPage::~SvxTransparenceTabPage()
123 disposeOnce();
126 void SvxTransparenceTabPage::dispose()
128 m_pRbtTransOff.clear();
129 m_pRbtTransLinear.clear();
130 m_pRbtTransGradient.clear();
131 m_pMtrTransparent.clear();
132 m_pGridGradient.clear();
133 m_pLbTrgrGradientType.clear();
134 m_pFtTrgrCenterX.clear();
135 m_pMtrTrgrCenterX.clear();
136 m_pFtTrgrCenterY.clear();
137 m_pMtrTrgrCenterY.clear();
138 m_pFtTrgrAngle.clear();
139 m_pMtrTrgrAngle.clear();
140 m_pMtrTrgrBorder.clear();
141 m_pMtrTrgrStartValue.clear();
142 m_pMtrTrgrEndValue.clear();
143 m_pCtlBitmapPreview.clear();
144 m_pCtlXRectPreview.clear();
145 SvxTabPage::dispose();
148 void SvxTransparenceTabPage::ActivateLinear(bool bActivate)
150 m_pMtrTransparent->Enable(bActivate);
153 IMPL_LINK_NOARG(SvxTransparenceTabPage, ModifyTransparentHdl_Impl)
155 sal_uInt16 nPos = (sal_uInt16)m_pMtrTransparent->GetValue();
156 XFillTransparenceItem aItem(nPos);
157 rXFSet.Put(XFillTransparenceItem(aItem));
159 // preview
160 InvalidatePreview();
162 return 0L;
165 IMPL_LINK(SvxTransparenceTabPage, ModifiedTrgrHdl_Impl, void *, pControl)
167 if(pControl == m_pLbTrgrGradientType || pControl == this)
169 css::awt::GradientStyle eXGS = (css::awt::GradientStyle)m_pLbTrgrGradientType->GetSelectEntryPos();
170 SetControlState_Impl( eXGS );
173 // preview
174 sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)m_pMtrTrgrStartValue->GetValue() * 255) / 100);
175 sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)m_pMtrTrgrEndValue->GetValue() * 255) / 100);
176 XGradient aTmpGradient(
177 Color(nStartCol, nStartCol, nStartCol),
178 Color(nEndCol, nEndCol, nEndCol),
179 (css::awt::GradientStyle)m_pLbTrgrGradientType->GetSelectEntryPos(),
180 (sal_uInt16)m_pMtrTrgrAngle->GetValue() * 10,
181 (sal_uInt16)m_pMtrTrgrCenterX->GetValue(),
182 (sal_uInt16)m_pMtrTrgrCenterY->GetValue(),
183 (sal_uInt16)m_pMtrTrgrBorder->GetValue(),
184 100, 100);
186 XFillFloatTransparenceItem aItem( rXFSet.GetPool()/*aString*/, aTmpGradient);
187 rXFSet.Put ( aItem );
189 InvalidatePreview();
191 return 0L;
194 void SvxTransparenceTabPage::ActivateGradient(bool bActivate)
196 m_pGridGradient->Enable(bActivate);
198 if(bActivate)
200 css::awt::GradientStyle eXGS = (css::awt::GradientStyle)m_pLbTrgrGradientType->GetSelectEntryPos();
201 SetControlState_Impl( eXGS );
205 IMPL_STATIC_LINK_NOARG(
206 SvxTransparenceTabPage, ChangeTrgrTypeHdl_Impl)
208 return 0L;
211 void SvxTransparenceTabPage::SetControlState_Impl(css::awt::GradientStyle eXGS)
213 switch(eXGS)
215 case css::awt::GradientStyle_LINEAR:
216 case css::awt::GradientStyle_AXIAL:
217 m_pFtTrgrCenterX->Disable();
218 m_pMtrTrgrCenterX->Disable();
219 m_pFtTrgrCenterY->Disable();
220 m_pMtrTrgrCenterY->Disable();
221 m_pFtTrgrAngle->Enable();
222 m_pMtrTrgrAngle->Enable();
223 break;
225 case css::awt::GradientStyle_RADIAL:
226 m_pFtTrgrCenterX->Enable();
227 m_pMtrTrgrCenterX->Enable();
228 m_pFtTrgrCenterY->Enable();
229 m_pMtrTrgrCenterY->Enable();
230 m_pFtTrgrAngle->Disable();
231 m_pMtrTrgrAngle->Disable();
232 break;
234 case css::awt::GradientStyle_ELLIPTICAL:
235 m_pFtTrgrCenterX->Enable();
236 m_pMtrTrgrCenterX->Enable();
237 m_pFtTrgrCenterY->Enable();
238 m_pMtrTrgrCenterY->Enable();
239 m_pFtTrgrAngle->Enable();
240 m_pMtrTrgrAngle->Enable();
241 break;
243 case css::awt::GradientStyle_SQUARE:
244 case css::awt::GradientStyle_RECT:
245 m_pFtTrgrCenterX->Enable();
246 m_pMtrTrgrCenterX->Enable();
247 m_pFtTrgrCenterY->Enable();
248 m_pMtrTrgrCenterY->Enable();
249 m_pFtTrgrAngle->Enable();
250 m_pMtrTrgrAngle->Enable();
251 break;
252 default:
253 break;
257 SvxTransparenceTabPage::SvxTransparenceTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs)
258 : SvxTabPage ( pParent,
259 "TransparencyTabPage",
260 "cui/ui/transparencytabpage.ui",
261 rInAttrs),
262 rOutAttrs ( rInAttrs ),
263 eRP ( RP_LT ),
264 nPageType (0),
265 nDlgType (0),
266 bBitmap ( false ),
267 pXPool ( static_cast<XOutdevItemPool*>(rInAttrs.GetPool()) ),
268 aXFillAttr ( pXPool ),
269 rXFSet ( aXFillAttr.GetItemSet() )
271 get(m_pRbtTransOff,"RBT_TRANS_OFF");
272 get(m_pRbtTransLinear,"RBT_TRANS_LINEAR");
273 get(m_pRbtTransGradient,"RBT_TRANS_GRADIENT");
275 get(m_pMtrTransparent,"MTR_TRANSPARENT");
277 get(m_pGridGradient,"gridGradient");
278 get(m_pLbTrgrGradientType,"LB_TRGR_GRADIENT_TYPES");
279 get(m_pFtTrgrCenterX,"FT_TRGR_CENTER_X");
280 get(m_pMtrTrgrCenterX,"MTR_TRGR_CENTER_X");
281 get(m_pFtTrgrCenterY,"FT_TRGR_CENTER_Y");
282 get(m_pMtrTrgrCenterY,"MTR_TRGR_CENTER_Y");
283 get(m_pFtTrgrAngle,"FT_TRGR_ANGLE"),
284 get(m_pMtrTrgrAngle,"MTR_TRGR_ANGLE");
285 get(m_pMtrTrgrBorder,"MTR_TRGR_BORDER");
286 get(m_pMtrTrgrStartValue,"MTR_TRGR_START_VALUE");
287 get(m_pMtrTrgrEndValue,"MTR_TRGR_END_VALUE");
289 get(m_pCtlBitmapPreview,"CTL_BITMAP_PREVIEW");
290 get(m_pCtlXRectPreview,"CTL_TRANS_PREVIEW");
292 // main selection
293 m_pRbtTransOff->SetClickHdl(LINK(this, SvxTransparenceTabPage, ClickTransOffHdl_Impl));
294 m_pRbtTransLinear->SetClickHdl(LINK(this, SvxTransparenceTabPage, ClickTransLinearHdl_Impl));
295 m_pRbtTransGradient->SetClickHdl(LINK(this, SvxTransparenceTabPage, ClickTransGradientHdl_Impl));
297 // linear transparency
298 m_pMtrTransparent->SetValue( 50 );
299 m_pMtrTransparent->SetModifyHdl(LINK(this, SvxTransparenceTabPage, ModifyTransparentHdl_Impl));
301 // gradient transparency
302 m_pMtrTrgrEndValue->SetValue( 100 );
303 m_pMtrTrgrStartValue->SetValue( 0 );
304 m_pLbTrgrGradientType->SetSelectHdl(LINK(this, SvxTransparenceTabPage, ChangeTrgrTypeHdl_Impl));
305 Link<> aLink = LINK( this, SvxTransparenceTabPage, ModifiedTrgrHdl_Impl);
306 m_pLbTrgrGradientType->SetSelectHdl( aLink );
307 m_pMtrTrgrCenterX->SetModifyHdl( aLink );
308 m_pMtrTrgrCenterY->SetModifyHdl( aLink );
309 m_pMtrTrgrAngle->SetModifyHdl( aLink );
310 m_pMtrTrgrBorder->SetModifyHdl( aLink );
311 m_pMtrTrgrStartValue->SetModifyHdl( aLink );
312 m_pMtrTrgrEndValue->SetModifyHdl( aLink );
314 // this page needs ExchangeSupport
315 SetExchangeSupport();
318 VclPtr<SfxTabPage> SvxTransparenceTabPage::Create(vcl::Window* pWindow, const SfxItemSet* rAttrs)
320 return VclPtr<SvxTransparenceTabPage>::Create(pWindow, *rAttrs);
323 bool SvxTransparenceTabPage::FillItemSet(SfxItemSet* rAttrs)
325 const SfxPoolItem* pGradientItem = NULL;
326 const SfxPoolItem* pLinearItem = NULL;
327 SfxItemState eStateGradient(rOutAttrs.GetItemState(XATTR_FILLFLOATTRANSPARENCE, true, &pGradientItem));
328 SfxItemState eStateLinear(rOutAttrs.GetItemState(XATTR_FILLTRANSPARENCE, true, &pLinearItem));
329 bool bGradActive = (eStateGradient == SfxItemState::SET && static_cast<const XFillFloatTransparenceItem*>(pGradientItem)->IsEnabled());
330 bool bLinearActive = (eStateLinear == SfxItemState::SET && static_cast<const XFillTransparenceItem*>(pLinearItem)->GetValue() != 0);
332 // #103765#
333 bool bGradUsed = (eStateGradient == SfxItemState::DONTCARE);
334 bool bLinearUsed = (eStateLinear == SfxItemState::DONTCARE);
336 bool bModified(false);
337 bool bSwitchOffLinear(false);
338 bool bSwitchOffGradient(false);
340 if(m_pMtrTransparent->IsEnabled())
342 // linear transparence
343 sal_uInt16 nPos = (sal_uInt16)m_pMtrTransparent->GetValue();
344 if(m_pMtrTransparent->IsValueChangedFromSaved() || !bLinearActive)
346 XFillTransparenceItem aItem(nPos);
347 SdrPercentItem aShadowItem(makeSdrShadowTransparenceItem(nPos));
348 const SfxPoolItem* pOld = GetOldItem(*rAttrs, XATTR_FILLTRANSPARENCE);
349 if(!pOld || !(*static_cast<const XFillTransparenceItem*>(pOld) == aItem) || !bLinearActive)
351 rAttrs->Put(aItem);
352 rAttrs->Put(aShadowItem);
353 bModified = true;
354 bSwitchOffGradient = true;
358 else if(m_pLbTrgrGradientType->IsEnabled())
360 // transparence gradient, fill ItemSet from values
361 if(!bGradActive
362 || m_pLbTrgrGradientType->IsValueChangedFromSaved()
363 || m_pMtrTrgrAngle->IsValueChangedFromSaved()
364 || m_pMtrTrgrCenterX->IsValueChangedFromSaved()
365 || m_pMtrTrgrCenterY->IsValueChangedFromSaved()
366 || m_pMtrTrgrBorder->IsValueChangedFromSaved()
367 || m_pMtrTrgrStartValue->IsValueChangedFromSaved()
368 || m_pMtrTrgrEndValue->IsValueChangedFromSaved() )
370 sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)m_pMtrTrgrStartValue->GetValue() * 255) / 100);
371 sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)m_pMtrTrgrEndValue->GetValue() * 255) / 100);
372 XGradient aTmpGradient(
373 Color(nStartCol, nStartCol, nStartCol),
374 Color(nEndCol, nEndCol, nEndCol),
375 (css::awt::GradientStyle)m_pLbTrgrGradientType->GetSelectEntryPos(),
376 (sal_uInt16)m_pMtrTrgrAngle->GetValue() * 10,
377 (sal_uInt16)m_pMtrTrgrCenterX->GetValue(),
378 (sal_uInt16)m_pMtrTrgrCenterY->GetValue(),
379 (sal_uInt16)m_pMtrTrgrBorder->GetValue(),
380 100, 100);
382 XFillFloatTransparenceItem aItem( rXFSet.GetPool()/*aString*/, aTmpGradient);
383 const SfxPoolItem* pOld = GetOldItem(*rAttrs, XATTR_FILLFLOATTRANSPARENCE);
385 if(!pOld || !(*static_cast<const XFillFloatTransparenceItem*>(pOld) == aItem) || !bGradActive)
387 rAttrs->Put(aItem);
388 bModified = true;
389 bSwitchOffLinear = true;
393 else
395 // no transparence
396 bSwitchOffGradient = true;
397 bSwitchOffLinear = true;
400 // disable unused XFillFloatTransparenceItem
401 if(bSwitchOffGradient && (bGradActive || bGradUsed))
403 Color aColor(COL_BLACK);
404 XGradient aGrad(aColor, Color(COL_WHITE));
405 aGrad.SetStartIntens(100);
406 aGrad.SetEndIntens(100);
407 XFillFloatTransparenceItem aItem( rXFSet.GetPool()/*aString*/, aGrad);
408 aItem.SetEnabled(false);
409 rAttrs->Put(aItem);
410 bModified = true;
413 // disable unused XFillFloatTransparenceItem
414 if(bSwitchOffLinear && (bLinearActive || bLinearUsed))
416 XFillTransparenceItem aItem(0);
417 SdrPercentItem aShadowItem(makeSdrShadowTransparenceItem(0));
418 rAttrs->Put(aItem);
419 rAttrs->Put(aShadowItem);
420 bModified = true;
422 rAttrs->Put (CntUInt16Item(SID_PAGE_TYPE,nPageType));
423 return bModified;
426 void SvxTransparenceTabPage::Reset(const SfxItemSet* rAttrs)
428 const SfxPoolItem* pGradientItem = NULL;
429 SfxItemState eStateGradient(rAttrs->GetItemState(XATTR_FILLFLOATTRANSPARENCE, true, &pGradientItem));
430 if(!pGradientItem)
431 pGradientItem = &rAttrs->Get(XATTR_FILLFLOATTRANSPARENCE);
432 bool bGradActive = (eStateGradient == SfxItemState::SET && static_cast<const XFillFloatTransparenceItem*>(pGradientItem)->IsEnabled());
434 const SfxPoolItem* pLinearItem = NULL;
435 SfxItemState eStateLinear(rAttrs->GetItemState(XATTR_FILLTRANSPARENCE, true, &pLinearItem));
436 if(!pLinearItem)
437 pLinearItem = &rAttrs->Get(XATTR_FILLTRANSPARENCE);
438 bool bLinearActive = (eStateLinear == SfxItemState::SET && static_cast<const XFillTransparenceItem*>(pLinearItem)->GetValue() != 0);
440 // transparence gradient
441 const XGradient& rGradient = static_cast<const XFillFloatTransparenceItem*>(pGradientItem)->GetGradientValue();
442 css::awt::GradientStyle eXGS(rGradient.GetGradientStyle());
443 m_pLbTrgrGradientType->SelectEntryPos(sal::static_int_cast< sal_Int32 >(eXGS));
444 m_pMtrTrgrAngle->SetValue(rGradient.GetAngle() / 10);
445 m_pMtrTrgrBorder->SetValue(rGradient.GetBorder());
446 m_pMtrTrgrCenterX->SetValue(rGradient.GetXOffset());
447 m_pMtrTrgrCenterY->SetValue(rGradient.GetYOffset());
448 m_pMtrTrgrStartValue->SetValue((sal_uInt16)((((sal_uInt16)rGradient.GetStartColor().GetRed() + 1) * 100) / 255));
449 m_pMtrTrgrEndValue->SetValue((sal_uInt16)((((sal_uInt16)rGradient.GetEndColor().GetRed() + 1) * 100) / 255));
451 // linear transparence
452 sal_uInt16 nTransp = static_cast<const XFillTransparenceItem*>(pLinearItem)->GetValue();
453 m_pMtrTransparent->SetValue(bLinearActive ? nTransp : 50);
454 ModifyTransparentHdl_Impl(NULL);
456 // select the correct radio button
457 if(bGradActive)
459 // transparence gradient, set controls appropriate to item
460 m_pRbtTransGradient->Check();
461 ClickTransGradientHdl_Impl(NULL);
463 else if(bLinearActive)
465 // linear transparence
466 m_pRbtTransLinear->Check();
467 ClickTransLinearHdl_Impl(NULL);
469 else
471 // no transparence
472 m_pRbtTransOff->Check();
473 ClickTransOffHdl_Impl(NULL);
474 ModifiedTrgrHdl_Impl(NULL);
477 // save values
478 m_pMtrTransparent->SaveValue();
479 m_pLbTrgrGradientType->SaveValue();
480 m_pMtrTrgrCenterX->SaveValue();
481 m_pMtrTrgrCenterY->SaveValue();
482 m_pMtrTrgrAngle->SaveValue();
483 m_pMtrTrgrBorder->SaveValue();
484 m_pMtrTrgrStartValue->SaveValue();
485 m_pMtrTrgrEndValue->SaveValue();
487 bool bActive = InitPreview ( *rAttrs );
488 InvalidatePreview ( bActive );
491 void SvxTransparenceTabPage::ActivatePage(const SfxItemSet& rSet)
493 SFX_ITEMSET_ARG (&rSet,pPageTypeItem,CntUInt16Item,SID_PAGE_TYPE,false);
494 if (pPageTypeItem)
495 SetPageType(pPageTypeItem->GetValue());
497 if(nDlgType == 0) // area dialog
498 nPageType = PT_TRANSPARENCE;
500 InitPreview ( rSet );
503 SfxTabPage::sfxpg SvxTransparenceTabPage::DeactivatePage(SfxItemSet* _pSet)
505 if( _pSet )
506 FillItemSet( _pSet );
507 return LEAVE_PAGE;
510 void SvxTransparenceTabPage::PointChanged(vcl::Window* , RECT_POINT eRcPt)
512 eRP = eRcPt;
516 // Preview-Methods
518 bool SvxTransparenceTabPage::InitPreview ( const SfxItemSet& rSet )
520 // set transparencetyp for preview
521 if ( m_pRbtTransOff->IsChecked() )
523 ClickTransOffHdl_Impl(NULL);
524 } else if ( m_pRbtTransLinear->IsChecked() )
526 ClickTransLinearHdl_Impl(NULL);
527 } else if ( m_pRbtTransGradient->IsChecked() )
529 ClickTransGradientHdl_Impl(NULL);
532 // Get fillstyle for preview
533 rXFSet.Put ( static_cast<const XFillStyleItem&>( rSet.Get(XATTR_FILLSTYLE)) );
534 rXFSet.Put ( static_cast<const XFillColorItem&>( rSet.Get(XATTR_FILLCOLOR)) );
535 rXFSet.Put ( static_cast<const XFillGradientItem&>( rSet.Get(XATTR_FILLGRADIENT)) );
536 rXFSet.Put ( static_cast<const XFillHatchItem&>( rSet.Get(XATTR_FILLHATCH)) );
537 rXFSet.Put ( static_cast<const XFillBackgroundItem&>(rSet.Get(XATTR_FILLBACKGROUND)) );
538 rXFSet.Put ( static_cast<const XFillBitmapItem&>( rSet.Get(XATTR_FILLBITMAP)) );
540 m_pCtlXRectPreview->SetAttributes( aXFillAttr.GetItemSet() );
541 m_pCtlBitmapPreview->SetAttributes( aXFillAttr.GetItemSet() );
543 bBitmap = static_cast<const XFillStyleItem&>( rSet.Get(XATTR_FILLSTYLE) ).GetValue() == drawing::FillStyle_BITMAP;
545 // show the right preview window
546 if ( bBitmap )
548 m_pCtlBitmapPreview->Show();
549 m_pCtlXRectPreview->Hide();
551 else
553 m_pCtlBitmapPreview->Hide();
554 m_pCtlXRectPreview->Show();
557 return !m_pRbtTransOff->IsChecked();
560 void SvxTransparenceTabPage::InvalidatePreview (bool bEnable)
562 if ( bBitmap )
564 if ( bEnable )
566 m_pCtlBitmapPreview->Enable();
567 m_pCtlBitmapPreview->SetAttributes( aXFillAttr.GetItemSet() );
569 else
570 m_pCtlBitmapPreview->Disable();
571 m_pCtlBitmapPreview->Invalidate();
573 else
575 if ( bEnable )
577 m_pCtlXRectPreview->Enable();
578 m_pCtlXRectPreview->SetAttributes( aXFillAttr.GetItemSet() );
580 else
581 m_pCtlXRectPreview->Disable();
582 m_pCtlXRectPreview->Invalidate();
586 void SvxTransparenceTabPage::PageCreated(const SfxAllItemSet& aSet)
588 SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,false);
589 SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,false);
591 if (pPageTypeItem)
592 SetPageType(pPageTypeItem->GetValue());
593 if (pDlgTypeItem)
594 SetDlgType(pDlgTypeItem->GetValue());
597 /*************************************************************************
599 |* Dialog to modify fill-attributes
601 \************************************************************************/
603 SvxAreaTabPage::SvxAreaTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ) :
605 SvxTabPage( pParent,
606 "AreaTabPage",
607 "cui/ui/areatabpage.ui",
608 rInAttrs ),
609 rOutAttrs (rInAttrs ),
610 eRP( RP_LT ),
612 pColorList( NULL ),
613 pGradientList( NULL ),
614 pHatchingList( NULL ),
615 pBitmapList( NULL ),
617 // local fixed not o be changed values for local pointers
618 maFixed_ChangeType(ChangeType::NONE),
619 maFixed_sal_Bool(false),
621 // init with pointers to fixed ChangeType
622 pnColorListState(&maFixed_ChangeType),
623 pnBitmapListState(&maFixed_ChangeType),
624 pnGradientListState(&maFixed_ChangeType),
625 pnHatchingListState(&maFixed_ChangeType),
627 nPageType(0),
628 nDlgType(0),
629 nPos(0),
631 // init with pointer to fixed bool
632 pbAreaTP(&maFixed_sal_Bool),
634 pXPool ( static_cast<XOutdevItemPool*>( rInAttrs.GetPool() ) ),
635 aXFillAttr ( pXPool ),
636 rXFSet ( aXFillAttr.GetItemSet() ),
638 ePoolUnit(SFX_MAPUNIT_100TH_MM),
639 eFUnit(FUNIT_NONE),
641 //UUUU
642 mbOfferImportButton(false),
643 mbDirectGraphicSet(false),
644 maDirectGraphic()
646 get(m_pTypeLB,"LB_AREA_TYPE");
647 get(m_pFillLB,"boxLB_FILL");
648 get(m_pLbColor,"LB_COLOR");
649 get(m_pLbGradient,"LB_GRADIENT");
650 get(m_pLbHatching,"LB_HATCHING");
651 get(m_pLbBitmap,"LB_BITMAP");
652 get(m_pCtlBitmapPreview,"CTL_BITMAP_PREVIEW");
654 get(m_pTsbStepCount,"TSB_STEPCOUNT");
655 get(m_pFlStepCount,"FL_STEPCOUNT");
656 get(m_pNumFldStepCount,"NUM_FLD_STEPCOUNT");
658 get(m_pFlHatchBckgrd,"FL_HATCHCOLORS");
659 get(m_pLbHatchBckgrdColor,"LB_HATCHBCKGRDCOLOR");
660 get(m_pCbxHatchBckgrd,"CB_HATCHBCKGRD");
662 get(m_pBxBitmap,"boxBITMAP");
664 get(m_pFlSize,"FL_SIZE");
665 get(m_pGridX_Y,"gridX_Y");
666 get(m_pTsbOriginal,"TSB_ORIGINAL");
667 get(m_pTsbScale,"TSB_SCALE");
668 get(m_pFtXSize,"FT_X_SIZE");
669 get(m_pMtrFldXSize,"MTR_FLD_X_SIZE");
670 get(m_pFtYSize,"FT_Y_SIZE");
671 get(m_pMtrFldYSize,"MTR_FLD_Y_SIZE");
673 get(m_pFlPosition,"framePOSITION");
674 get(m_pCtlPosition,"CTL_POSITION");
675 get(m_pGridOffset,"gridOFFSET");
676 get(m_pMtrFldXOffset,"MTR_FLD_X_OFFSET");
677 get(m_pMtrFldYOffset,"MTR_FLD_Y_OFFSET");
678 get(m_pBxTile,"boxTILE");
679 get(m_pTsbTile,"TSB_TILE");
680 get(m_pTsbStretch,"TSB_STRETCH");
682 get(m_pFlOffset,"FL_OFFSET");
683 get(m_pRbtRow,"RBT_ROW");
684 get(m_pRbtColumn,"RBT_COLUMN");
685 get(m_pBtnImport, "btnimport");
686 get(m_pMtrFldOffset,"MTR_FLD_OFFSET");
688 get(m_pCtlXRectPreview,"CTL_COLOR_PREVIEW");
690 //so that even for "none" the size requested is the largest
691 //size required for any of the areas which might be selected
692 //later, so that there's sufficient space
693 VclContainer *pMainFrame = get<VclContainer>("mainframe");
694 Size aIncrementsSize(m_pFlStepCount->get_preferred_size());
695 Size aHatchSize(m_pFlHatchBckgrd->get_preferred_size());
696 Size aBitmapSize(m_pBxBitmap->get_preferred_size());
697 Size aMainFrame(
698 std::max(std::max(aIncrementsSize.Width(), aHatchSize.Width()), aBitmapSize.Width()),
699 std::max(std::max(aIncrementsSize.Height(), aHatchSize.Height()), aBitmapSize.Height()));
700 pMainFrame->set_width_request(aMainFrame.Width());
701 pMainFrame->set_height_request(aMainFrame.Height());
705 // groups that overlay each other
706 m_pLbBitmap->Hide();
707 m_pCtlBitmapPreview->Hide();
709 m_pFlStepCount->Hide();
711 m_pBxBitmap->Hide();
713 // Controls for Hatch-Background
714 m_pFlHatchBckgrd->Hide();
716 m_pTsbOriginal->EnableTriState( false );
718 // this page needs ExchangeSupport
719 SetExchangeSupport();
721 // set Metrics
722 eFUnit = GetModuleFieldUnit( rInAttrs );
724 switch ( eFUnit )
726 case FUNIT_M:
727 case FUNIT_KM:
728 eFUnit = FUNIT_MM;
729 break;
730 default: ;//prevent warning
732 SetFieldUnit( *m_pMtrFldXSize, eFUnit, true );
733 SetFieldUnit( *m_pMtrFldYSize, eFUnit, true );
735 // get PoolUnit
736 SfxItemPool* pPool = rOutAttrs.GetPool();
737 DBG_ASSERT( pPool, "Wo ist der Pool?" );
738 ePoolUnit = pPool->GetMetric( XATTR_FILLBMP_SIZEX );
740 // setting the output device
741 rXFSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) );
742 rXFSet.Put( XFillColorItem( OUString(), COL_BLACK ) );
743 m_pCtlXRectPreview->SetAttributes( aXFillAttr.GetItemSet() );
744 m_pCtlBitmapPreview->SetAttributes( aXFillAttr.GetItemSet() );
746 m_pLbColor->SetSelectHdl( LINK( this, SvxAreaTabPage, ModifyColorHdl_Impl ) );
747 m_pLbHatchBckgrdColor->SetSelectHdl( LINK( this, SvxAreaTabPage, ModifyHatchBckgrdColorHdl_Impl ) );
748 m_pCbxHatchBckgrd->SetToggleHdl( LINK( this, SvxAreaTabPage, ToggleHatchBckgrdColorHdl_Impl ) );
749 //UUUU
750 m_pBtnImport->SetClickHdl(LINK(this, SvxAreaTabPage, ClickImportHdl_Impl));
752 m_pLbGradient->SetSelectHdl( LINK( this, SvxAreaTabPage, ModifyGradientHdl_Impl ) );
753 m_pLbHatching->SetSelectHdl( LINK( this, SvxAreaTabPage, ModifyHatchingHdl_Impl ) );
754 m_pLbBitmap->SetSelectHdl( LINK( this, SvxAreaTabPage, ModifyBitmapHdl_Impl ) );
756 m_pTsbStepCount->SetClickHdl( LINK( this, SvxAreaTabPage, ModifyStepCountHdl_Impl ) );
757 m_pNumFldStepCount->SetModifyHdl( LINK( this, SvxAreaTabPage, ModifyStepCountHdl_Impl ) );
759 Link<> aLink( LINK( this, SvxAreaTabPage, ModifyTileHdl_Impl ) );
760 m_pTsbTile->SetClickHdl( aLink );
761 m_pTsbStretch->SetClickHdl( aLink );
762 m_pTsbOriginal->SetClickHdl( aLink );
763 m_pMtrFldXSize->SetModifyHdl( aLink );
764 m_pMtrFldYSize->SetModifyHdl( aLink );
765 m_pRbtRow->SetClickHdl( aLink );
766 m_pRbtColumn->SetClickHdl( aLink );
767 m_pMtrFldOffset->SetModifyHdl( aLink );
768 m_pMtrFldXOffset->SetModifyHdl( aLink );
769 m_pMtrFldYOffset->SetModifyHdl( aLink );
770 m_pTsbScale->SetClickHdl( LINK( this, SvxAreaTabPage, ClickScaleHdl_Impl ) );
772 m_pTypeLB->SetSelectHdl( LINK( this, SvxAreaTabPage, SelectDialogTypeHdl_Impl ) );
774 // #i76307# always paint the preview in LTR, because this is what the document does
775 m_pCtlXRectPreview->EnableRTL(false);
777 // Calcualte size of dropdown listboxes
778 Size aSize = LogicToPixel(Size(108, 103), MAP_APPFONT);
780 m_pLbColor->set_width_request(aSize.Width());
781 m_pLbColor->set_height_request(aSize.Height());
782 //m_pLbColor->
784 m_pLbGradient->set_width_request(aSize.Width());
785 m_pLbGradient->set_height_request(aSize.Height());
786 m_pLbHatching->set_width_request(aSize.Width());
787 m_pLbHatching->set_height_request(aSize.Height());
788 m_pLbBitmap->set_width_request(aSize.Width());
789 m_pLbBitmap->set_height_request(aSize.Height());
791 // Calculate size of display boxes
792 Size aSize2 = LogicToPixel(Size(110, 42), MAP_APPFONT);
793 m_pCtlBitmapPreview->set_width_request(aSize2.Width());
794 m_pCtlBitmapPreview->set_height_request(aSize2.Height());
795 m_pCtlXRectPreview->set_width_request(aSize2.Width());
796 m_pCtlXRectPreview->set_height_request(aSize2.Height());
799 SvxAreaTabPage::~SvxAreaTabPage()
801 disposeOnce();
804 void SvxAreaTabPage::dispose()
806 m_pTypeLB.clear();
807 m_pFillLB.clear();
808 m_pLbColor.clear();
809 m_pLbGradient.clear();
810 m_pLbHatching.clear();
811 m_pLbBitmap.clear();
812 m_pCtlBitmapPreview.clear();
813 m_pTsbStepCount.clear();
814 m_pFlStepCount.clear();
815 m_pNumFldStepCount.clear();
816 m_pFlHatchBckgrd.clear();
817 m_pCbxHatchBckgrd.clear();
818 m_pLbHatchBckgrdColor.clear();
819 m_pBxBitmap.clear();
820 m_pFlSize.clear();
821 m_pTsbOriginal.clear();
822 m_pTsbScale.clear();
823 m_pGridX_Y.clear();
824 m_pFtXSize.clear();
825 m_pMtrFldXSize.clear();
826 m_pFtYSize.clear();
827 m_pMtrFldYSize.clear();
828 m_pFlPosition.clear();
829 m_pCtlPosition.clear();
830 m_pGridOffset.clear();
831 m_pMtrFldXOffset.clear();
832 m_pMtrFldYOffset.clear();
833 m_pBxTile.clear();
834 m_pTsbTile.clear();
835 m_pTsbStretch.clear();
836 m_pFlOffset.clear();
837 m_pRbtRow.clear();
838 m_pRbtColumn.clear();
839 m_pMtrFldOffset.clear();
840 m_pCtlXRectPreview.clear();
841 m_pBtnImport.clear();
842 SvxTabPage::dispose();
846 void SvxAreaTabPage::Construct()
848 // fill colortables / lists
849 m_pLbColor->Fill( pColorList );
850 m_pLbHatchBckgrdColor->Fill ( pColorList );
852 m_pLbGradient->Fill( pGradientList );
853 m_pLbHatching->Fill( pHatchingList );
854 m_pLbBitmap->Fill( pBitmapList );
859 void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet )
861 sal_Int32 nCount(0);
862 SFX_ITEMSET_ARG (&rSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,false);
863 SFX_ITEMSET_ARG (&rSet,pPosItem,SfxUInt16Item,SID_TABPAGE_POS,false);
864 if (pPageTypeItem)
865 SetPageType(pPageTypeItem->GetValue());
866 if (pPosItem)
867 SetPos(pPosItem->GetValue());
868 if( nDlgType == 0 ) // area dialog
870 *pbAreaTP = true;
872 if( pColorList.is() )
874 //UUUU use evtl. previously selected entry to avoid changing values just by
875 // switching TabPages in dialogs using this TabPage
876 sal_Int32 _nPos(nPos);
878 if( *pnBitmapListState != ChangeType::NONE )
880 if( *pnBitmapListState & ChangeType::CHANGED )
881 pBitmapList = static_cast<SvxAreaTabDialog*>( GetParentDialog() )->GetNewBitmapList();
883 _nPos = m_pLbBitmap->GetSelectEntryPos();
885 m_pLbBitmap->Clear();
886 m_pLbBitmap->Fill( pBitmapList );
887 nCount = m_pLbBitmap->GetEntryCount();
888 if( nCount == 0 )
889 ; // This case should never occur
890 else if( nCount <= _nPos )
891 m_pLbBitmap->SelectEntryPos( 0 );
892 else
893 m_pLbBitmap->SelectEntryPos( _nPos );
894 ModifyBitmapHdl_Impl( this );
897 if( *pnHatchingListState != ChangeType::NONE )
899 if( *pnHatchingListState & ChangeType::CHANGED )
900 pHatchingList = static_cast<SvxAreaTabDialog*>( GetParentDialog() )->GetNewHatchingList();
902 _nPos = m_pLbHatching->GetSelectEntryPos();
904 m_pLbHatching->Clear();
905 m_pLbHatching->Fill( pHatchingList );
906 nCount = m_pLbHatching->GetEntryCount();
907 if( nCount == 0 )
908 ; // This case should never occur
909 else if( nCount <= _nPos )
910 m_pLbHatching->SelectEntryPos( 0 );
911 else
912 m_pLbHatching->SelectEntryPos( _nPos );
913 ModifyHatchingHdl_Impl( this );
915 ModifyHatchBckgrdColorHdl_Impl( this );
918 if( *pnGradientListState != ChangeType::NONE )
920 if( *pnGradientListState & ChangeType::CHANGED )
921 pGradientList = static_cast<SvxAreaTabDialog*>( GetParentDialog() )->GetNewGradientList();
923 _nPos = m_pLbGradient->GetSelectEntryPos();
925 m_pLbGradient->Clear();
926 m_pLbGradient->Fill( pGradientList );
927 nCount = m_pLbGradient->GetEntryCount();
928 if( nCount == 0 )
929 ; // This case should never occur
930 else if( nCount <= _nPos )
931 m_pLbGradient->SelectEntryPos( 0 );
932 else
933 m_pLbGradient->SelectEntryPos( _nPos );
934 ModifyGradientHdl_Impl( this );
937 if( *pnColorListState != ChangeType::NONE )
939 if( *pnColorListState & ChangeType::CHANGED )
940 pColorList = static_cast<SvxAreaTabDialog*>( GetParentDialog() )->GetNewColorList();
941 // aLbColor
942 _nPos = m_pLbColor->GetSelectEntryPos();
943 m_pLbColor->Clear();
944 m_pLbColor->Fill( pColorList );
945 nCount = m_pLbColor->GetEntryCount();
946 if( nCount == 0 )
947 ; // This case should never occur
948 else if( nCount <= _nPos )
949 m_pLbColor->SelectEntryPos( 0 );
950 else
951 m_pLbColor->SelectEntryPos( _nPos );
953 ModifyColorHdl_Impl( this );
955 // Backgroundcolor of hatch
956 _nPos = m_pLbHatchBckgrdColor->GetSelectEntryPos();
957 m_pLbHatchBckgrdColor->Clear();
958 m_pLbHatchBckgrdColor->Fill( pColorList );
959 nCount = m_pLbHatchBckgrdColor->GetEntryCount();
960 if( nCount == 0 )
961 ; // This case should never occur
962 else if( nCount <= _nPos )
963 m_pLbHatchBckgrdColor->SelectEntryPos( 0 );
964 else
965 m_pLbHatchBckgrdColor->SelectEntryPos( _nPos );
967 ModifyHatchBckgrdColorHdl_Impl( this );
970 // evaluate if any other Tabpage set another filltype
971 if( m_pTypeLB->GetSelectEntryPos() > drawing::FillStyle_NONE)
973 switch( nPageType )
975 case PT_GRADIENT:
976 m_pTypeLB->SelectEntryPos( drawing::FillStyle_GRADIENT );
977 m_pLbGradient->SelectEntryPos( _nPos );
978 ClickGradientHdl_Impl();
979 break;
981 case PT_HATCH:
982 m_pTypeLB->SelectEntryPos( drawing::FillStyle_HATCH );
983 m_pLbHatching->SelectEntryPos( _nPos );
984 ClickHatchingHdl_Impl();
985 break;
987 case PT_BITMAP:
988 m_pTypeLB->SelectEntryPos( drawing::FillStyle_BITMAP );
989 m_pLbBitmap->SelectEntryPos( _nPos );
990 ClickBitmapHdl_Impl();
991 break;
993 case PT_COLOR:
994 m_pTypeLB->SelectEntryPos( drawing::FillStyle_SOLID );
995 m_pLbColor->SelectEntryPos( _nPos );
996 m_pLbHatchBckgrdColor->SelectEntryPos( _nPos );
997 ClickColorHdl_Impl();
998 break;
1001 nPageType = PT_AREA;
1008 SfxTabPage::sfxpg SvxAreaTabPage::DeactivatePage( SfxItemSet* _pSet )
1010 if( nDlgType == 0 ) // area dialog
1012 sal_Int32 nPosOrig = nPos;
1013 drawing::FillStyle eStyle = (drawing::FillStyle) m_pTypeLB->GetSelectEntryPos();
1014 switch( eStyle )
1016 case drawing::FillStyle_GRADIENT:
1018 nPageType = PT_GRADIENT;
1019 nPos = m_pLbGradient->GetSelectEntryPos();
1020 if( nPosOrig != nPos )
1021 *pnGradientListState |= ChangeType::MODIFIED;
1023 break;
1024 case drawing::FillStyle_HATCH:
1026 nPageType = PT_HATCH;
1027 nPos = m_pLbHatching->GetSelectEntryPos();
1028 if( nPosOrig != nPos )
1029 *pnHatchingListState |= ChangeType::MODIFIED;
1031 break;
1032 case drawing::FillStyle_BITMAP:
1034 nPageType = PT_BITMAP;
1035 nPos = m_pLbBitmap->GetSelectEntryPos();
1036 if( nPosOrig != nPos )
1037 *pnBitmapListState |= ChangeType::MODIFIED;
1039 break;
1040 case drawing::FillStyle_SOLID:
1042 nPageType = PT_COLOR;
1043 nPos = m_pLbColor->GetSelectEntryPos();
1044 if( nPosOrig != nPos )
1045 *pnColorListState |= ChangeType::MODIFIED;
1047 break;
1048 default: ;//prevent warning
1052 if( _pSet )
1053 FillItemSet( _pSet );
1055 return LEAVE_PAGE;
1060 bool SvxAreaTabPage::FillItemSet( SfxItemSet* rAttrs )
1062 sal_Int32 _nPos;
1063 bool bModified = false;
1065 if( nDlgType != 0 || *pbAreaTP )
1067 const SfxPoolItem* pOld = NULL;
1068 drawing::FillStyle eStyle = (drawing::FillStyle) m_pTypeLB->GetSelectEntryPos();
1069 drawing::FillStyle eSavedStyle = (drawing::FillStyle) m_pTypeLB->GetSavedValue();
1070 switch( eStyle )
1072 default:
1073 case drawing::FillStyle_NONE:
1075 if( eSavedStyle != eStyle )
1077 XFillStyleItem aStyleItem( drawing::FillStyle_NONE );
1078 pOld = GetOldItem( *rAttrs, XATTR_FILLSTYLE );
1079 if ( !pOld || !( *static_cast<const XFillStyleItem*>(pOld) == aStyleItem ) )
1081 rAttrs->Put( aStyleItem );
1082 bModified = true;
1086 break;
1087 case drawing::FillStyle_SOLID:
1089 _nPos = m_pLbColor->GetSelectEntryPos();
1090 if( _nPos != LISTBOX_ENTRY_NOTFOUND &&
1091 m_pLbColor->IsValueChangedFromSaved() )
1093 XFillColorItem aItem( m_pLbColor->GetSelectEntry(),
1094 m_pLbColor->GetSelectEntryColor() );
1095 pOld = GetOldItem( *rAttrs, XATTR_FILLCOLOR );
1096 if ( !pOld || !( *static_cast<const XFillColorItem*>(pOld) == aItem ) )
1098 rAttrs->Put( aItem );
1099 bModified = true;
1102 // NEW
1103 if( (eSavedStyle != eStyle) &&
1104 ( bModified ||
1105 SfxItemState::SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), true ) ) )
1107 XFillStyleItem aStyleItem( drawing::FillStyle_SOLID );
1108 pOld = GetOldItem( *rAttrs, XATTR_FILLSTYLE );
1109 if ( !pOld || !( *static_cast<const XFillStyleItem*>(pOld) == aStyleItem ) )
1111 rAttrs->Put( aStyleItem );
1112 bModified = true;
1116 break;
1117 case drawing::FillStyle_GRADIENT:
1119 _nPos = m_pLbGradient->GetSelectEntryPos();
1120 if( _nPos != LISTBOX_ENTRY_NOTFOUND &&
1121 m_pLbGradient->IsValueChangedFromSaved() )
1123 XGradient aGradient = pGradientList->GetGradient( _nPos )->GetGradient();
1124 OUString aString = m_pLbGradient->GetSelectEntry();
1125 XFillGradientItem aItem( aString, aGradient );
1126 pOld = GetOldItem( *rAttrs, XATTR_FILLGRADIENT );
1127 if ( !pOld || !( *static_cast<const XFillGradientItem*>(pOld) == aItem ) )
1129 rAttrs->Put( aItem );
1130 bModified = true;
1133 // NEW
1134 if( (eSavedStyle != eStyle) &&
1135 ( bModified ||
1136 SfxItemState::SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), true ) ) )
1138 XFillStyleItem aStyleItem( drawing::FillStyle_GRADIENT );
1139 pOld = GetOldItem( *rAttrs, XATTR_FILLSTYLE );
1140 if ( !pOld || !( *static_cast<const XFillStyleItem*>(pOld) == aStyleItem ) )
1142 rAttrs->Put( aStyleItem );
1143 bModified = true;
1147 break;
1148 case drawing::FillStyle_HATCH:
1150 _nPos = m_pLbHatching->GetSelectEntryPos();
1151 if( _nPos != LISTBOX_ENTRY_NOTFOUND &&
1152 m_pLbHatching->IsValueChangedFromSaved() )
1154 XHatch aHatching = pHatchingList->GetHatch( _nPos )->GetHatch();
1155 OUString aString = m_pLbHatching->GetSelectEntry();
1156 XFillHatchItem aItem( aString, aHatching );
1157 pOld = GetOldItem( *rAttrs, XATTR_FILLHATCH );
1158 if ( !pOld || !( *static_cast<const XFillHatchItem*>(pOld) == aItem ) )
1160 rAttrs->Put( aItem );
1161 bModified = true;
1164 XFillBackgroundItem aItem ( m_pCbxHatchBckgrd->IsChecked() );
1165 rAttrs->Put( aItem );
1166 nPos = m_pLbHatchBckgrdColor->GetSelectEntryPos();
1167 if( nPos != LISTBOX_ENTRY_NOTFOUND &&
1168 m_pLbHatchBckgrdColor->IsValueChangedFromSaved() )
1170 XFillColorItem aFillColorItem( m_pLbHatchBckgrdColor->GetSelectEntry(),
1171 m_pLbHatchBckgrdColor->GetSelectEntryColor() );
1172 pOld = GetOldItem( *rAttrs, XATTR_FILLCOLOR );
1173 if ( !pOld || !( *static_cast<const XFillColorItem*>(pOld) == aFillColorItem ) )
1175 rAttrs->Put( aFillColorItem );
1176 bModified = true;
1179 // NEW
1180 if( (eSavedStyle != eStyle) &&
1181 ( bModified ||
1182 SfxItemState::SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), true ) ) )
1184 XFillStyleItem aStyleItem( drawing::FillStyle_HATCH );
1185 pOld = GetOldItem( *rAttrs, XATTR_FILLSTYLE );
1186 if ( !pOld || !( *static_cast<const XFillStyleItem*>(pOld) == aStyleItem ) )
1188 rAttrs->Put( aStyleItem );
1189 bModified = true;
1193 break;
1194 case drawing::FillStyle_BITMAP:
1196 //UUUU
1197 if(mbDirectGraphicSet && GRAPHIC_NONE != maDirectGraphic.GetType())
1199 const XFillBitmapItem aXBmpItem(maDirectName, maDirectGraphic);
1200 rAttrs->Put(XFillStyleItem(drawing::FillStyle_BITMAP));
1201 rAttrs->Put(aXBmpItem);
1202 bModified = true;
1204 else
1206 nPos = m_pLbBitmap->GetSelectEntryPos();
1207 if( nPos != LISTBOX_ENTRY_NOTFOUND &&
1208 m_pLbBitmap->IsValueChangedFromSaved() )
1210 const XBitmapEntry* pXBitmapEntry = pBitmapList->GetBitmap(nPos);
1211 const OUString aString(m_pLbBitmap->GetSelectEntry());
1212 const XFillBitmapItem aFillBitmapItem(aString, pXBitmapEntry->GetGraphicObject());
1213 pOld = GetOldItem( *rAttrs, XATTR_FILLBITMAP );
1214 if ( !pOld || !( *static_cast<const XFillBitmapItem*>(pOld) == aFillBitmapItem ) )
1216 rAttrs->Put( aFillBitmapItem );
1217 bModified = true;
1220 // NEW
1221 if( (eSavedStyle != eStyle) &&
1222 ( bModified ||
1223 SfxItemState::SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), true ) ) )
1225 XFillStyleItem aStyleItem( drawing::FillStyle_BITMAP );
1226 pOld = GetOldItem( *rAttrs, XATTR_FILLSTYLE );
1227 if ( !pOld || !( *static_cast<const XFillStyleItem*>(pOld) == aStyleItem ) )
1229 rAttrs->Put( aStyleItem );
1230 bModified = true;
1235 break;
1238 // step size
1239 if( m_pTsbStepCount->IsEnabled() )
1241 sal_uInt16 nValue = 0;
1242 bool bValueModified = false;
1243 TriState eState = m_pTsbStepCount->GetState();
1244 if( eState == TRISTATE_TRUE )
1246 if( m_pTsbStepCount->IsValueChangedFromSaved() )
1247 bValueModified = true;
1249 else
1251 // condition != Disabled ?
1252 if( !m_pNumFldStepCount->GetText().isEmpty() )
1254 nValue = (sal_uInt16) m_pNumFldStepCount->GetValue();
1255 if( m_pNumFldStepCount->IsValueChangedFromSaved() )
1256 bValueModified = true;
1259 if( bValueModified )
1261 XGradientStepCountItem aFillBitmapItem( nValue );
1262 pOld = GetOldItem( *rAttrs, XATTR_GRADIENTSTEPCOUNT );
1263 if ( !pOld || !( *static_cast<const XGradientStepCountItem*>(pOld) == aFillBitmapItem ) )
1265 rAttrs->Put( aFillBitmapItem );
1266 bModified = true;
1271 if( m_pTsbTile->IsEnabled() )
1273 TriState eState = m_pTsbTile->GetState();
1274 if( m_pTsbTile->IsValueChangedFromSaved() )
1276 XFillBmpTileItem aFillBmpTileItem( eState != TRISTATE_FALSE );
1277 pOld = GetOldItem( *rAttrs, XATTR_FILLBMP_TILE );
1278 if ( !pOld || !( *static_cast<const XFillBmpTileItem*>(pOld) == aFillBmpTileItem ) )
1280 rAttrs->Put( aFillBmpTileItem );
1281 bModified = true;
1286 if( m_pTsbStretch->IsEnabled() )
1288 TriState eState = m_pTsbStretch->GetState();
1289 if( m_pTsbStretch->IsValueChangedFromSaved() )
1291 XFillBmpStretchItem aFillBmpStretchItem(
1292 eState != TRISTATE_FALSE );
1293 pOld = GetOldItem( *rAttrs, XATTR_FILLBMP_STRETCH );
1294 if ( !pOld || !( *static_cast<const XFillBmpStretchItem*>(pOld) == aFillBmpStretchItem ) )
1296 rAttrs->Put( aFillBmpStretchItem );
1297 bModified = true;
1302 // Original size (in the UI) is used as follows:
1303 // Controls are disabled, but have to be set.
1304 // SizeX = 0; SizeY = 0; Log = sal_True
1306 //aTsbScale
1307 TriState eState = m_pTsbScale->GetState();
1308 if( m_pTsbScale->IsValueChangedFromSaved() ||
1309 ( !m_pTsbScale->IsEnabled() &&
1310 m_pTsbOriginal->IsEnabled() &&
1311 m_pTsbScale->GetSavedValue() != TRISTATE_TRUE ) )
1313 boost::scoped_ptr<XFillBmpSizeLogItem> pItem;
1314 if( m_pTsbScale->IsEnabled() )
1315 pItem.reset(new XFillBmpSizeLogItem( eState == TRISTATE_FALSE ));
1316 else if( m_pTsbOriginal->IsEnabled() && m_pTsbOriginal->GetState() == TRISTATE_TRUE )
1317 pItem.reset(new XFillBmpSizeLogItem( true ));
1319 if( pItem )
1321 pOld = GetOldItem( *rAttrs, XATTR_FILLBMP_SIZELOG );
1322 if ( !pOld || !( *static_cast<const XFillBmpSizeLogItem*>(pOld) == *pItem ) )
1324 rAttrs->Put( *pItem );
1325 bModified = true;
1330 //aMtrFldXSize
1331 OUString aStr = m_pMtrFldXSize->GetText();
1333 boost::scoped_ptr<XFillBmpSizeXItem> pItem;
1334 TriState eScaleState = m_pTsbScale->GetState();
1336 if( m_pMtrFldXSize->IsEnabled() &&
1337 !aStr.isEmpty() &&
1338 aStr != m_pMtrFldXSize->GetSavedValue() )
1340 if( eScaleState == TRISTATE_FALSE )
1341 pItem.reset(new XFillBmpSizeXItem( GetCoreValue( *m_pMtrFldXSize, ePoolUnit ) ));
1342 else
1344 // Percentage values are set negatively, so that
1345 // they aren't scaled; this is considered in the item.
1346 pItem.reset(new XFillBmpSizeXItem( -labs( static_cast<long>(m_pMtrFldXSize->GetValue()) ) ));
1349 else if( m_pTsbOriginal->IsEnabled() &&
1350 m_pTsbOriginal->GetState() == TRISTATE_TRUE &&
1351 !m_pMtrFldXSize->GetSavedValue().isEmpty() )
1352 pItem.reset(new XFillBmpSizeXItem( 0 ));
1354 if( pItem )
1356 pOld = GetOldItem( *rAttrs, XATTR_FILLBMP_SIZEX );
1357 if ( !pOld || !( *static_cast<const XFillBmpSizeXItem*>(pOld) == *pItem ) )
1359 rAttrs->Put( *pItem );
1360 bModified = true;
1365 //aMtrFldYSize
1366 aStr = m_pMtrFldYSize->GetText();
1368 boost::scoped_ptr<XFillBmpSizeYItem> pItem;
1369 TriState eScaleState = m_pTsbScale->GetState();
1371 if( m_pMtrFldYSize->IsEnabled() &&
1372 !aStr.isEmpty() &&
1373 aStr != m_pMtrFldYSize->GetSavedValue() )
1375 if( eScaleState == TRISTATE_FALSE )
1376 pItem.reset(new XFillBmpSizeYItem( GetCoreValue( *m_pMtrFldYSize, ePoolUnit ) ));
1377 else
1379 // Percentage values are set negatively, so that
1380 // they aren't scaled by the MetricItem;
1381 // this is considered in the item.
1382 pItem.reset(new XFillBmpSizeYItem( -labs( static_cast<long>(m_pMtrFldYSize->GetValue()) ) ));
1385 else if( m_pTsbOriginal->IsEnabled() &&
1386 m_pTsbOriginal->GetState() == TRISTATE_TRUE &&
1387 !m_pMtrFldYSize->GetSavedValue().isEmpty() )
1388 pItem.reset(new XFillBmpSizeYItem( 0 ));
1390 if( pItem )
1392 pOld = GetOldItem( *rAttrs, XATTR_FILLBMP_SIZEY );
1393 if ( !pOld || !( *static_cast<const XFillBmpSizeYItem*>(pOld) == *pItem ) )
1395 rAttrs->Put( *pItem );
1396 bModified = true;
1401 //aRbtRow
1402 //aRbtColumn
1403 //aMtrFldOffset
1404 if( m_pMtrFldOffset->IsEnabled() )
1406 OUString aMtrString = m_pMtrFldOffset->GetText();
1407 if( ( !aMtrString.isEmpty() &&
1408 aMtrString != m_pMtrFldOffset->GetSavedValue() ) ||
1409 m_pRbtRow->IsValueChangedFromSaved() ||
1410 m_pRbtColumn->IsValueChangedFromSaved() )
1412 if( m_pRbtRow->IsChecked() )
1414 XFillBmpTileOffsetXItem aFillBmpTileOffsetXItem( (sal_uInt16) m_pMtrFldOffset->GetValue() );
1415 pOld = GetOldItem( *rAttrs, XATTR_FILLBMP_TILEOFFSETX );
1416 if ( !pOld || !( *static_cast<const XFillBmpTileOffsetXItem*>(pOld) == aFillBmpTileOffsetXItem ) )
1418 rAttrs->Put( aFillBmpTileOffsetXItem );
1419 rAttrs->Put( XFillBmpTileOffsetYItem( 0 ) );
1420 bModified = true;
1423 else if( m_pRbtColumn->IsChecked() )
1425 XFillBmpTileOffsetYItem aFillBmpTileOffsetYItem( (sal_uInt16) m_pMtrFldOffset->GetValue() );
1426 pOld = GetOldItem( *rAttrs, XATTR_FILLBMP_TILEOFFSETY );
1427 if ( !pOld || !( *static_cast<const XFillBmpTileOffsetYItem*>(pOld) == aFillBmpTileOffsetYItem ) )
1429 rAttrs->Put( aFillBmpTileOffsetYItem );
1430 rAttrs->Put( XFillBmpTileOffsetXItem( 0 ) );
1431 bModified = true;
1437 //aCtlPosition
1438 if( m_pCtlPosition->IsEnabled() )
1440 bool bPut = false;
1441 RECT_POINT _eRP = m_pCtlPosition->GetActualRP();
1443 if( SfxItemState::DONTCARE == rOutAttrs.GetItemState( XATTR_FILLBMP_POS ) )
1444 bPut = true;
1445 else
1447 RECT_POINT eValue = static_cast<const XFillBmpPosItem&>( rOutAttrs.Get( XATTR_FILLBMP_POS ) ).GetValue();
1448 if( eValue != _eRP )
1449 bPut = true;
1451 if( bPut )
1453 XFillBmpPosItem aFillBmpPosItem( _eRP );
1454 pOld = GetOldItem( *rAttrs, XATTR_FILLBMP_POS );
1455 if ( !pOld || !( *static_cast<const XFillBmpPosItem*>(pOld) == aFillBmpPosItem ) )
1457 rAttrs->Put( aFillBmpPosItem );
1458 bModified = true;
1463 //aMtrFldXOffset
1464 if( m_pMtrFldXOffset->IsEnabled() )
1466 OUString sMtrXOffset = m_pMtrFldXOffset->GetText();
1467 if( !sMtrXOffset.isEmpty() &&
1468 m_pMtrFldXOffset->IsValueChangedFromSaved() )
1470 XFillBmpPosOffsetXItem aFillBmpPosOffsetXItem( (sal_uInt16) m_pMtrFldXOffset->GetValue() );
1471 pOld = GetOldItem( *rAttrs, XATTR_FILLBMP_POSOFFSETX );
1472 if ( !pOld || !( *static_cast<const XFillBmpPosOffsetXItem*>(pOld) == aFillBmpPosOffsetXItem ) )
1474 rAttrs->Put( aFillBmpPosOffsetXItem );
1475 bModified = true;
1480 //aMtrFldYOffset
1481 if( m_pMtrFldYOffset->IsEnabled() )
1483 OUString sMtrYOffset = m_pMtrFldYOffset->GetText();
1484 if( !sMtrYOffset.isEmpty() &&
1485 m_pMtrFldYOffset->IsValueChangedFromSaved() )
1487 XFillBmpPosOffsetYItem aFillBmpPosOffsetYItem( (sal_uInt16) m_pMtrFldYOffset->GetValue() );
1488 pOld = GetOldItem( *rAttrs, XATTR_FILLBMP_POSOFFSETY );
1489 if ( !pOld || !( *static_cast<const XFillBmpPosOffsetYItem*>(pOld) == aFillBmpPosOffsetYItem ) )
1491 rAttrs->Put( aFillBmpPosOffsetYItem );
1492 bModified = true;
1496 rAttrs->Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
1497 rAttrs->Put (SfxUInt16Item(SID_TABPAGE_POS,nPos));
1500 return bModified;
1505 void SvxAreaTabPage::Reset( const SfxItemSet* rAttrs )
1507 bool isMissingHatching(false);
1508 bool isMissingGradient(false);
1509 bool isMissingBitmap(false);
1510 drawing::FillStyle eXFS;
1511 if( rAttrs->GetItemState( XATTR_FILLSTYLE ) != SfxItemState::DONTCARE )
1513 eXFS = (drawing::FillStyle) ( static_cast<const XFillStyleItem&>( rAttrs->
1514 Get( GetWhich( XATTR_FILLSTYLE ) ) ).GetValue() );
1515 m_pTypeLB->SelectEntryPos( sal::static_int_cast< sal_Int32 >( eXFS ) );
1517 if (SfxItemState::DONTCARE != rAttrs->GetItemState(XATTR_FILLCOLOR))
1519 XFillColorItem const& rColorItem(static_cast<const XFillColorItem&>(
1520 rAttrs->Get(XATTR_FILLCOLOR)) );
1521 m_pLbColor->SelectEntry( rColorItem.GetColorValue() );
1522 m_pLbHatchBckgrdColor->SelectEntry( rColorItem.GetColorValue() );
1525 SfxItemState const eGradState(rAttrs->GetItemState(XATTR_FILLGRADIENT));
1526 XFillGradientItem const* pGradientItem(nullptr);
1527 if (SfxItemState::DONTCARE != eGradState)
1529 pGradientItem = &static_cast<const XFillGradientItem&>(
1530 rAttrs->Get(XATTR_FILLGRADIENT));
1531 OUString const aString( pGradientItem->GetName() );
1532 XGradient const aGradient( pGradientItem->GetGradientValue() );
1533 m_pLbGradient->SelectEntryByList(pGradientList, aString, aGradient);
1535 if (!m_pLbGradient->GetSelectEntryCount()
1536 && (SfxItemState::DEFAULT == eGradState
1537 || (pGradientItem && pGradientItem->GetName().isEmpty())))
1538 { // avoid relying on pool default - cannot export that
1539 m_pLbGradient->SelectEntryPos(0); // anything better than nothing
1540 isMissingGradient = true;
1543 SfxItemState const eHatchState(rAttrs->GetItemState(XATTR_FILLHATCH));
1544 XFillHatchItem const* pHatch(nullptr);
1545 if (SfxItemState::DONTCARE != eHatchState)
1547 pHatch = &static_cast<const XFillHatchItem&>(
1548 rAttrs->Get(XATTR_FILLHATCH));
1549 m_pLbHatching->SelectEntry(pHatch->GetName());
1551 if (!m_pLbHatching->GetSelectEntryCount()
1552 && (SfxItemState::DEFAULT == eHatchState
1553 || (pHatch && pHatch->GetName().isEmpty())))
1554 { // avoid relying on pool default - cannot export that
1555 m_pLbHatching->SelectEntryPos(0); // anything better than nothing
1556 isMissingHatching = true;
1558 if (SfxItemState::DONTCARE != rAttrs->GetItemState(XATTR_FILLBACKGROUND))
1560 m_pCbxHatchBckgrd->Check( static_cast<const XFillBackgroundItem&>(
1561 rAttrs->Get(XATTR_FILLBACKGROUND)).GetValue() );
1564 SfxItemState const eBitmapState(rAttrs->GetItemState(XATTR_FILLBITMAP));
1565 XFillBitmapItem const* pBitmapItem(nullptr);
1566 if (SfxItemState::DONTCARE != eBitmapState)
1568 pBitmapItem = &static_cast<const XFillBitmapItem&>(
1569 rAttrs->Get(XATTR_FILLBITMAP));
1570 m_pLbBitmap->SelectEntry(pBitmapItem->GetName());
1572 if (!m_pLbBitmap->GetSelectEntryCount()
1573 && (SfxItemState::DEFAULT == eBitmapState
1574 || (pBitmapItem && pBitmapItem->GetName().isEmpty())))
1575 { // avoid relying on pool default - cannot export that
1576 m_pLbBitmap->SelectEntryPos(0); // anything better than nothing
1577 isMissingBitmap = true;
1580 switch( eXFS )
1582 case drawing::FillStyle_NONE:
1583 ClickInvisibleHdl_Impl();
1584 break;
1586 case drawing::FillStyle_SOLID:
1587 ClickColorHdl_Impl();
1588 break;
1590 case drawing::FillStyle_GRADIENT:
1591 ClickGradientHdl_Impl();
1592 break;
1594 case drawing::FillStyle_HATCH:
1595 ClickHatchingHdl_Impl();
1596 ToggleHatchBckgrdColorHdl_Impl( this );
1597 break;
1599 case drawing::FillStyle_BITMAP:
1601 ClickBitmapHdl_Impl();
1603 break;
1605 default:
1606 assert(false);
1607 break;
1610 else
1612 // make all LBs not accessible
1613 m_pFillLB->Hide();
1615 m_pCtlBitmapPreview->Hide();
1616 m_pLbColor->Disable();
1617 m_pLbColor->Show();
1619 // so that Reset() also works correctly with Back
1620 m_pTypeLB->SetNoSelection();
1623 // step size
1624 if( ( rAttrs->GetItemState( XATTR_GRADIENTSTEPCOUNT ) != SfxItemState::DONTCARE ) ||
1625 ( rAttrs->GetItemState( XATTR_FILLSTYLE ) != SfxItemState::DONTCARE ) )
1627 m_pTsbStepCount->EnableTriState( false );
1628 sal_uInt16 nValue = static_cast<const XGradientStepCountItem&>( rAttrs->Get( XATTR_GRADIENTSTEPCOUNT ) ).GetValue();
1629 if( nValue == 0 )
1631 m_pTsbStepCount->SetState( TRISTATE_TRUE );
1632 m_pNumFldStepCount->SetText( "" );
1634 else
1636 m_pTsbStepCount->SetState( TRISTATE_FALSE );
1637 m_pNumFldStepCount->SetValue( nValue );
1639 ModifyStepCountHdl_Impl( m_pTsbStepCount );
1641 else
1643 m_pTsbStepCount->SetState( TRISTATE_INDET );
1644 m_pNumFldStepCount->SetText( "" );
1647 // attributes for the bitmap filling
1649 if( rAttrs->GetItemState( XATTR_FILLBMP_TILE ) != SfxItemState::DONTCARE )
1651 m_pTsbTile->EnableTriState( false );
1653 if( static_cast<const XFillBmpTileItem&>( rAttrs->Get( XATTR_FILLBMP_TILE ) ).GetValue() )
1654 m_pTsbTile->SetState( TRISTATE_TRUE );
1655 else
1656 m_pTsbTile->SetState( TRISTATE_FALSE );
1658 else
1659 m_pTsbTile->SetState( TRISTATE_INDET );
1661 if( rAttrs->GetItemState( XATTR_FILLBMP_STRETCH ) != SfxItemState::DONTCARE )
1663 m_pTsbStretch->EnableTriState( false );
1665 if( static_cast<const XFillBmpStretchItem&>( rAttrs->Get( XATTR_FILLBMP_STRETCH ) ).GetValue() )
1666 m_pTsbStretch->SetState( TRISTATE_TRUE );
1667 else
1668 m_pTsbStretch->SetState( TRISTATE_FALSE );
1670 else
1671 m_pTsbStretch->SetState( TRISTATE_INDET );
1674 //aTsbScale
1675 if( rAttrs->GetItemState( XATTR_FILLBMP_SIZELOG ) != SfxItemState::DONTCARE )
1677 m_pTsbScale->EnableTriState( false );
1679 if( static_cast<const XFillBmpSizeLogItem&>( rAttrs->Get( XATTR_FILLBMP_SIZELOG ) ).GetValue() )
1680 m_pTsbScale->SetState( TRISTATE_FALSE );
1681 else
1682 m_pTsbScale->SetState( TRISTATE_TRUE );
1684 ClickScaleHdl_Impl( NULL );
1686 else
1687 m_pTsbScale->SetState( TRISTATE_INDET );
1690 // determine status for the original size
1691 TriState eOriginal = TRISTATE_FALSE;
1693 //aMtrFldXSize
1694 if( rAttrs->GetItemState( XATTR_FILLBMP_SIZEX ) != SfxItemState::DONTCARE )
1696 sal_Int32 nValue = static_cast<const XFillBmpSizeXItem&>( rAttrs->Get( XATTR_FILLBMP_SIZEX ) ).GetValue();
1697 if( m_pTsbScale->GetState() == TRISTATE_TRUE )
1699 // If there's a percentage value in the item,
1700 // it is negative because of the MetricItems.
1701 m_pMtrFldXSize->SetValue( labs( nValue ) );
1703 else
1704 SetMetricValue( *m_pMtrFldXSize, nValue, ePoolUnit );
1705 m_pMtrFldXSize->SaveValue();
1707 if( nValue == 0 )
1709 eOriginal = TRISTATE_TRUE;
1710 // value would be too small otherwise when turning off the original size
1711 // (performance problem)
1712 m_pMtrFldXSize->SetValue( 100 );
1715 else
1717 m_pMtrFldXSize->SetText( "" );
1718 m_pMtrFldXSize->SaveValue();
1721 //aMtrFldYSize
1722 if( rAttrs->GetItemState( XATTR_FILLBMP_SIZEY ) != SfxItemState::DONTCARE )
1724 sal_Int32 nValue = static_cast<const XFillBmpSizeYItem&>( rAttrs->Get( XATTR_FILLBMP_SIZEY ) ).GetValue();
1725 if( m_pTsbScale->GetState() == TRISTATE_TRUE )
1727 // If there's a percentage value in the item,
1728 // it is negative because of the MetricItems.
1729 m_pMtrFldYSize->SetValue( labs( nValue ) );
1731 else
1732 SetMetricValue( *m_pMtrFldYSize, nValue, ePoolUnit );
1733 m_pMtrFldYSize->SaveValue();
1735 if( nValue == 0 )
1736 m_pMtrFldYSize->SetValue( 100 ); //s.o.
1737 else
1738 eOriginal = TRISTATE_FALSE;
1740 else
1742 m_pMtrFldYSize->SetText( "" );
1743 m_pMtrFldYSize->SaveValue();
1744 eOriginal = TRISTATE_FALSE;
1747 // aTsbOriginal
1748 m_pTsbOriginal->SetState( eOriginal );
1750 // #93372# Setting proper state after changing button
1751 ModifyTileHdl_Impl( NULL );
1753 //aRbtRow
1754 //aRbtColumn
1755 //aMtrFldOffset
1756 if( rAttrs->GetItemState( XATTR_FILLBMP_TILEOFFSETX ) != SfxItemState::DONTCARE )
1758 sal_uInt16 nValue = static_cast<const XFillBmpTileOffsetXItem&>( rAttrs->Get( XATTR_FILLBMP_TILEOFFSETX ) ).GetValue();
1759 if( nValue > 0 )
1761 m_pMtrFldOffset->SetValue( nValue );
1762 m_pRbtRow->Check();
1764 else if( rAttrs->GetItemState( XATTR_FILLBMP_TILEOFFSETY ) != SfxItemState::DONTCARE )
1766 nValue = static_cast<const XFillBmpTileOffsetYItem&>( rAttrs->Get( XATTR_FILLBMP_TILEOFFSETY ) ).GetValue();
1767 if( nValue > 0 )
1769 m_pMtrFldOffset->SetValue( nValue );
1770 m_pRbtColumn->Check();
1773 else
1774 m_pMtrFldOffset->SetValue( 0 );
1776 else
1777 m_pMtrFldOffset->SetText( "" );
1780 //aCtlPosition
1781 if( rAttrs->GetItemState( XATTR_FILLBMP_POS ) != SfxItemState::DONTCARE )
1783 RECT_POINT eValue = static_cast<const XFillBmpPosItem&>( rAttrs->Get( XATTR_FILLBMP_POS ) ).GetValue();
1784 m_pCtlPosition->SetActualRP( eValue );
1786 else
1787 m_pCtlPosition->Reset();
1789 //aMtrFldXOffset
1790 if( rAttrs->GetItemState( XATTR_FILLBMP_POSOFFSETX ) != SfxItemState::DONTCARE )
1792 sal_Int32 nValue = static_cast<const XFillBmpPosOffsetXItem&>( rAttrs->Get( XATTR_FILLBMP_POSOFFSETX ) ).GetValue();
1793 m_pMtrFldXOffset->SetValue( nValue );
1795 else
1796 m_pMtrFldXOffset->SetText( "" );
1798 //aMtrFldYOffset
1799 if( rAttrs->GetItemState( XATTR_FILLBMP_POSOFFSETY ) != SfxItemState::DONTCARE )
1801 sal_Int32 nValue = static_cast<const XFillBmpPosOffsetYItem&>( rAttrs->Get( XATTR_FILLBMP_POSOFFSETY ) ).GetValue();
1802 m_pMtrFldYOffset->SetValue( nValue );
1804 else
1805 m_pMtrFldYOffset->SetText( "" );
1807 // not earlier so that tile and stretch are considered
1808 if( m_pTypeLB->GetSelectEntryPos() == drawing::FillStyle_BITMAP )
1809 ClickBitmapHdl_Impl();
1811 m_pTypeLB->SaveValue();
1812 m_pLbColor->SaveValue();
1813 if (!isMissingGradient)
1814 m_pLbGradient->SaveValue();
1815 if (!isMissingHatching)
1816 m_pLbHatching->SaveValue();
1817 m_pLbHatchBckgrdColor->SaveValue();
1818 if (!isMissingBitmap)
1819 m_pLbBitmap->SaveValue();
1820 m_pTsbStepCount->SaveValue();
1821 m_pNumFldStepCount->SaveValue();
1822 m_pTsbTile->SaveValue();
1823 m_pTsbStretch->SaveValue();
1824 m_pTsbScale->SaveValue();
1825 m_pRbtRow->SaveValue();
1826 m_pRbtColumn->SaveValue();
1827 m_pMtrFldOffset->SaveValue();
1828 m_pMtrFldXOffset->SaveValue();
1829 m_pMtrFldYOffset->SaveValue();
1834 VclPtr<SfxTabPage> SvxAreaTabPage::Create( vcl::Window* pWindow,
1835 const SfxItemSet* rAttrs )
1837 return VclPtr<SvxAreaTabPage>::Create( pWindow, *rAttrs );
1842 IMPL_LINK_NOARG(SvxAreaTabPage, SelectDialogTypeHdl_Impl)
1844 switch( (drawing::FillStyle)m_pTypeLB->GetSelectEntryPos() )
1846 default:
1847 case drawing::FillStyle_NONE: ClickInvisibleHdl_Impl(); break;
1848 case drawing::FillStyle_SOLID: ClickColorHdl_Impl(); break;
1849 case drawing::FillStyle_GRADIENT: ClickGradientHdl_Impl(); break;
1850 case drawing::FillStyle_HATCH: ClickHatchingHdl_Impl(); break;
1851 case drawing::FillStyle_BITMAP: ClickBitmapHdl_Impl(); break;
1854 return 0;
1857 void SvxAreaTabPage::ClickInvisibleHdl_Impl()
1859 m_pBxBitmap->Hide();
1861 m_pFillLB->Hide();
1863 m_pCtlXRectPreview->Hide();
1864 m_pCtlBitmapPreview->Hide();
1866 m_pFlStepCount->Hide();
1868 // Controls for Hatch-Background
1869 m_pFlHatchBckgrd->Hide();
1871 rXFSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
1872 m_pCtlXRectPreview->SetAttributes( aXFillAttr.GetItemSet() );
1873 m_pCtlBitmapPreview->SetAttributes( aXFillAttr.GetItemSet() );
1875 m_pCtlXRectPreview->Invalidate();
1876 m_pCtlBitmapPreview->Invalidate();
1881 void SvxAreaTabPage::ClickColorHdl_Impl()
1883 m_pBxBitmap->Hide();
1885 m_pFillLB->Show();
1886 m_pLbColor->Enable();
1887 m_pLbColor->Show();
1888 m_pLbGradient->Hide();
1889 m_pLbHatching->Hide();
1890 m_pLbBitmap->Hide();
1891 m_pCtlXRectPreview->Enable();
1892 m_pCtlXRectPreview->Show();
1893 m_pCtlBitmapPreview->Hide();
1895 m_pFlStepCount->Hide();
1897 // Controls for Hatch-Background
1898 m_pFlHatchBckgrd->Hide();
1900 ModifyColorHdl_Impl( this );
1905 IMPL_LINK_NOARG(SvxAreaTabPage, ModifyColorHdl_Impl)
1907 const SfxPoolItem* pPoolItem = NULL;
1908 sal_Int32 _nPos = m_pLbColor->GetSelectEntryPos();
1909 m_pLbHatchBckgrdColor->SelectEntryPos( _nPos );
1910 if( _nPos != LISTBOX_ENTRY_NOTFOUND )
1912 rXFSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) );
1913 rXFSet.Put( XFillColorItem( OUString(), m_pLbColor->GetSelectEntryColor() ) );
1915 // NEW
1916 else if( SfxItemState::SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), true, &pPoolItem ) )
1918 rXFSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) );
1919 Color aColor( static_cast<const XFillColorItem*>( pPoolItem )->GetColorValue() );
1920 rXFSet.Put( XFillColorItem( OUString(), aColor ) );
1922 else
1923 rXFSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
1925 m_pCtlXRectPreview->SetAttributes( aXFillAttr.GetItemSet() );
1926 m_pCtlXRectPreview->Invalidate();
1928 return 0L;
1932 void SvxAreaTabPage::ClickGradientHdl_Impl()
1934 m_pBxBitmap->Hide();
1936 m_pFillLB->Show();
1937 m_pLbColor->Hide();
1938 m_pLbGradient->Enable();
1939 m_pLbGradient->Show();
1940 m_pLbHatching->Hide();
1941 m_pLbBitmap->Hide();
1942 m_pCtlXRectPreview->Enable();
1943 m_pCtlXRectPreview->Show();
1944 m_pCtlBitmapPreview->Hide();
1946 m_pFlStepCount->Enable();
1947 m_pFlStepCount->Show();
1948 m_pTsbStepCount->Enable();
1949 m_pTsbStepCount->Show();
1950 m_pNumFldStepCount->Show();
1952 // Controls for Hatch-Background
1953 m_pFlHatchBckgrd->Hide();
1955 ModifyGradientHdl_Impl( this );
1956 ModifyStepCountHdl_Impl( m_pTsbStepCount );
1961 IMPL_LINK_NOARG(SvxAreaTabPage, ModifyGradientHdl_Impl)
1963 const SfxPoolItem* pPoolItem = NULL;
1964 sal_Int32 _nPos = m_pLbGradient->GetSelectEntryPos();
1965 if( _nPos != LISTBOX_ENTRY_NOTFOUND )
1967 // fill ItemSet and pass it on to aCtlXRectPreview
1968 XGradientEntry* pEntry = pGradientList->GetGradient( _nPos );
1970 rXFSet.Put( XFillStyleItem( drawing::FillStyle_GRADIENT ) );
1971 rXFSet.Put( XFillGradientItem( OUString(), pEntry->GetGradient() ) );
1973 else if( SfxItemState::SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), true, &pPoolItem ) )
1975 rXFSet.Put( XFillStyleItem( drawing::FillStyle_GRADIENT ) );
1976 rXFSet.Put( XFillGradientItem( OUString(), static_cast<const XFillGradientItem*>( pPoolItem )->GetGradientValue() ) );
1978 else
1979 rXFSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
1981 m_pCtlXRectPreview->SetAttributes( aXFillAttr.GetItemSet() );
1982 m_pCtlXRectPreview->Invalidate();
1984 return 0L;
1989 void SvxAreaTabPage::ClickHatchingHdl_Impl()
1991 m_pFillLB->Show();
1992 m_pLbColor->Hide();
1993 m_pLbGradient->Hide();
1994 m_pLbHatching->Enable();
1995 m_pLbHatching->Show();
1996 m_pLbBitmap->Hide();
1997 m_pCtlXRectPreview->Enable();
1998 m_pCtlXRectPreview->Show();
1999 m_pCtlBitmapPreview->Hide();
2001 m_pFlStepCount->Hide();
2003 m_pBxBitmap->Hide();
2005 // Controls for Hatch-Background
2006 m_pFlHatchBckgrd->Show();
2007 m_pCbxHatchBckgrd->Enable();
2008 m_pLbHatchBckgrdColor->Enable();
2010 ModifyHatchingHdl_Impl( this );
2011 ModifyHatchBckgrdColorHdl_Impl( this );
2012 ToggleHatchBckgrdColorHdl_Impl( this );
2017 IMPL_LINK_NOARG(SvxAreaTabPage, ModifyHatchingHdl_Impl)
2019 const SfxPoolItem* pPoolItem = NULL;
2020 sal_Int32 _nPos = m_pLbHatching->GetSelectEntryPos();
2021 if( _nPos != LISTBOX_ENTRY_NOTFOUND )
2023 // fill ItemSet and pass it on to aCtlXRectPreview
2024 XHatchEntry* pEntry = pHatchingList->GetHatch( _nPos );
2026 rXFSet.Put( XFillStyleItem( drawing::FillStyle_HATCH ) );
2027 rXFSet.Put( XFillHatchItem( OUString(), pEntry->GetHatch() ) );
2029 else if( SfxItemState::SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), true, &pPoolItem ) )
2031 rXFSet.Put( XFillStyleItem( drawing::FillStyle_HATCH ) );
2032 rXFSet.Put( XFillHatchItem( OUString(), static_cast<const XFillHatchItem*>( pPoolItem )->GetHatchValue() ) );
2034 else
2035 rXFSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
2037 m_pCtlXRectPreview->SetAttributes( aXFillAttr.GetItemSet() );
2038 m_pCtlXRectPreview->Invalidate();
2040 return 0L;
2045 IMPL_LINK_NOARG(SvxAreaTabPage, ModifyHatchBckgrdColorHdl_Impl)
2047 const SfxPoolItem* pPoolItem = NULL;
2048 sal_Int32 _nPos = m_pLbHatchBckgrdColor->GetSelectEntryPos();
2049 m_pLbColor->SelectEntryPos( _nPos );
2050 if( _nPos != LISTBOX_ENTRY_NOTFOUND )
2052 rXFSet.Put( XFillColorItem( OUString(), m_pLbHatchBckgrdColor->GetSelectEntryColor() ) );
2054 else if( SfxItemState::SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), true, &pPoolItem ) )
2056 Color aColor( static_cast<const XFillColorItem*>( pPoolItem )->GetColorValue() );
2057 rXFSet.Put( XFillColorItem( OUString(), aColor ) );
2059 else
2060 rXFSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
2062 m_pCtlXRectPreview->SetAttributes( aXFillAttr.GetItemSet() );
2063 m_pCtlXRectPreview->Invalidate();
2065 return 0L;
2070 IMPL_LINK_NOARG(SvxAreaTabPage, ToggleHatchBckgrdColorHdl_Impl)
2072 // switch on/off backgroundcolor for hatches
2073 m_pLbHatchBckgrdColor->Enable( m_pCbxHatchBckgrd->IsChecked() );
2075 XFillBackgroundItem aItem( m_pCbxHatchBckgrd->IsChecked() );
2076 rXFSet.Put ( aItem, XATTR_FILLBACKGROUND );
2078 m_pCtlXRectPreview->SetAttributes( aXFillAttr.GetItemSet() );
2079 m_pCtlXRectPreview->Invalidate();
2081 if( m_pLbHatchBckgrdColor->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND )
2083 if ( SfxItemState::SET == rOutAttrs.GetItemState( XATTR_FILLCOLOR ) )//>= SfxItemState::DEFAULT )
2085 XFillColorItem aColorItem( static_cast<const XFillColorItem&>(rOutAttrs.Get( XATTR_FILLCOLOR )) );
2086 m_pLbHatchBckgrdColor->SelectEntry( aColorItem.GetColorValue() );
2090 return 0L;
2095 void SvxAreaTabPage::ClickBitmapHdl_Impl()
2097 m_pFillLB->Show();
2098 m_pLbColor->Hide();
2099 m_pLbGradient->Hide();
2100 m_pLbHatching->Hide();
2102 //UUUU
2103 if(mbOfferImportButton)
2105 m_pBtnImport->Show();
2106 m_pBtnImport->Enable();
2108 else
2110 m_pBtnImport->Hide();
2111 m_pBtnImport->Disable();
2114 m_pLbBitmap->Enable();
2115 m_pLbBitmap->Show();
2116 m_pCtlBitmapPreview->Enable();
2117 m_pCtlBitmapPreview->Show();
2118 m_pCtlXRectPreview->Hide();
2120 m_pFlStepCount->Hide();
2122 m_pBxTile->Enable();
2124 m_pFlSize->Enable();
2125 m_pFlPosition->Enable();
2126 m_pFlOffset->Enable();
2128 if (!m_pRbtRow->IsChecked() && !m_pRbtColumn->IsChecked())
2129 m_pRbtRow->Check();
2131 // Controls for Hatch-Background
2132 m_pFlHatchBckgrd->Hide();
2134 m_pBxBitmap->Show();
2136 ModifyBitmapHdl_Impl( this );
2137 ModifyTileHdl_Impl( m_pTsbOriginal );
2142 IMPL_LINK_NOARG(SvxAreaTabPage, ModifyBitmapHdl_Impl)
2144 //UUUU
2145 mbDirectGraphicSet = false;
2146 maDirectGraphic.Clear();
2147 maDirectName.clear();
2149 const SfxPoolItem* pPoolItem = NULL;
2150 sal_Int32 _nPos = m_pLbBitmap->GetSelectEntryPos();
2151 if( _nPos != LISTBOX_ENTRY_NOTFOUND )
2153 // fill ItemSet and pass it on to aCtlXRectPreview
2154 const XBitmapEntry* pEntry = pBitmapList->GetBitmap(_nPos);
2156 rXFSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP));
2157 rXFSet.Put(XFillBitmapItem(OUString(), pEntry->GetGraphicObject()));
2159 else if( SfxItemState::SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), true, &pPoolItem ) )
2161 rXFSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP));
2162 rXFSet.Put(XFillBitmapItem(OUString(), static_cast<const XFillBitmapItem*>(pPoolItem)->GetGraphicObject()));
2164 else
2165 rXFSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
2167 m_pCtlBitmapPreview->SetAttributes( aXFillAttr.GetItemSet() );
2168 m_pCtlBitmapPreview->Invalidate();
2170 return 0L;
2175 IMPL_LINK( SvxAreaTabPage, ModifyStepCountHdl_Impl, void *, p )
2177 if( p == m_pTsbStepCount )
2179 if( m_pTsbStepCount->GetState() == TRISTATE_FALSE )
2181 if( m_pNumFldStepCount->GetText().isEmpty() )
2182 m_pNumFldStepCount->SetText("64");
2184 m_pNumFldStepCount->Enable();
2186 else
2187 m_pNumFldStepCount->Disable();
2190 sal_uInt16 nValue = 0;
2191 if( m_pTsbStepCount->GetState() != TRISTATE_TRUE )
2193 // condition != Disabled ?
2194 if( !m_pNumFldStepCount->GetText().isEmpty() )
2195 nValue = (sal_uInt16) m_pNumFldStepCount->GetValue();
2197 rXFSet.Put( XGradientStepCountItem( nValue ) );
2198 m_pCtlXRectPreview->SetAttributes( aXFillAttr.GetItemSet() );
2199 m_pCtlXRectPreview->Invalidate();
2201 return 0L;
2204 IMPL_LINK_NOARG( SvxAreaTabPage, ClickImportHdl_Impl )
2206 ResMgr& rMgr = CUI_MGR();
2207 SvxOpenGraphicDialog aDlg("Import");
2208 aDlg.EnableLink(false);
2210 if(!aDlg.Execute())
2212 EnterWait();
2213 const int nError(aDlg.GetGraphic(maDirectGraphic));
2214 LeaveWait();
2216 if(!nError && GRAPHIC_NONE != maDirectGraphic.GetType())
2218 // extract name from filename
2219 const INetURLObject aURL(aDlg.GetPath());
2220 maDirectName = aURL.GetName().getToken( 0, '.' );
2222 // use loaded graphic
2223 const XFillBitmapItem aXBmpItem(maDirectName, maDirectGraphic);
2224 rXFSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP));
2225 rXFSet.Put(aXBmpItem);
2227 // trigger state flag for directly loaded graphic
2228 mbDirectGraphicSet = true;
2230 // preview
2231 m_pCtlBitmapPreview->SetAttributes(aXFillAttr.GetItemSet());
2232 m_pCtlBitmapPreview->Invalidate();
2234 else
2236 // graphic could not be loaded
2237 ScopedVclPtrInstance<MessageDialog>::Create (this, OUString(ResId(RID_SVXSTR_READ_DATA_ERROR, rMgr)))->Execute();
2241 return 0L;
2244 //------------------------------------------------------------------------
2246 IMPL_LINK_NOARG(SvxAreaTabPage, ModifyTileHdl_Impl)
2248 TriState eState = m_pTsbTile->GetState();
2249 if( eState == TRISTATE_TRUE )
2251 // tiled
2252 // disable stretched for tiled graphic
2253 m_pTsbStretch->Disable();
2254 m_pFlOffset->Enable();
2256 // allow positioning
2257 m_pCtlPosition->Invalidate();
2258 // allow 'Position" title
2259 m_pFlPosition->Enable();
2261 // allow size definitions
2262 m_pFlSize->Enable();
2264 else if( eState == TRISTATE_FALSE )
2266 // non-tiled
2267 // enable stretch selection
2268 m_pTsbStretch->Enable();
2269 // no need for offsets, only position is supported in non-tiled
2270 m_pFlOffset->Disable();
2272 if( m_pTsbStretch->GetState() != TRISTATE_FALSE )
2274 // non-tiled, stretched
2275 // no need for positioning
2276 m_pCtlPosition->Invalidate();
2277 // no need for 'Position" title, all deactivated
2278 m_pFlPosition->Disable();
2280 // no need for size definitions
2281 m_pFlSize->Disable();
2283 else
2285 // non-tiled, non-stretched
2286 // allow positioning
2287 m_pCtlPosition->Enable();
2288 m_pCtlPosition->Invalidate();
2289 // allow 'Position" title, positioning is active
2290 m_pFlPosition->Enable();
2291 m_pFlSize->Enable();
2294 else
2296 // disable all when tiling is undefined
2297 m_pTsbStretch->Disable();
2298 m_pFlOffset->Disable();
2300 m_pCtlPosition->Invalidate();
2301 m_pFlPosition->Disable();
2303 m_pFlSize->Disable();
2306 if( m_pTsbOriginal->GetState() == TRISTATE_TRUE )
2308 m_pMtrFldXSize->SetText( "" );
2309 m_pMtrFldYSize->SetText( "" );
2310 m_pGridX_Y->Disable();
2311 m_pTsbScale->Disable();
2313 else
2315 m_pMtrFldXSize->SetValue( m_pMtrFldXSize->GetValue() );
2316 m_pMtrFldYSize->SetValue( m_pMtrFldYSize->GetValue() );
2319 rXFSet.Put( XFillBmpTileItem( eState != TRISTATE_FALSE ) );
2321 if( m_pTsbStretch->IsEnabled() )
2322 rXFSet.Put(
2323 XFillBmpStretchItem(
2324 m_pTsbStretch->GetState() != TRISTATE_FALSE ) );
2326 if( m_pTsbScale->IsEnabled() )
2327 rXFSet.Put( XFillBmpSizeLogItem( m_pTsbScale->GetState() == TRISTATE_FALSE ) );
2329 if( m_pMtrFldXSize->IsEnabled() )
2331 boost::scoped_ptr<XFillBmpSizeXItem> pItem;
2332 TriState eScaleState = m_pTsbScale->GetState();
2334 if( eScaleState == TRISTATE_FALSE )
2335 pItem.reset(new XFillBmpSizeXItem( GetCoreValue( *m_pMtrFldXSize, ePoolUnit ) ));
2336 else
2337 pItem.reset(new XFillBmpSizeXItem( -labs( static_cast<long>(m_pMtrFldXSize->GetValue()) ) ));
2339 rXFSet.Put( *pItem );
2341 else if( m_pTsbOriginal->IsEnabled() && m_pTsbOriginal->GetState() == TRISTATE_TRUE )
2343 // original size -> size == 0
2344 rXFSet.Put( XFillBmpSizeXItem( 0 ) );
2345 rXFSet.Put( XFillBmpSizeLogItem( true ) );
2348 if( m_pMtrFldYSize->IsEnabled() )
2350 boost::scoped_ptr<XFillBmpSizeYItem> pItem;
2351 TriState eScaleState = m_pTsbScale->GetState();
2353 if( eScaleState == TRISTATE_FALSE )
2354 pItem.reset(new XFillBmpSizeYItem( GetCoreValue( *m_pMtrFldYSize, ePoolUnit ) ));
2355 else
2356 pItem.reset(new XFillBmpSizeYItem( -labs( static_cast<long>(m_pMtrFldYSize->GetValue()) ) ));
2358 rXFSet.Put( *pItem );
2360 else if( m_pTsbOriginal->IsEnabled() && m_pTsbOriginal->GetState() == TRISTATE_TRUE )
2362 // original size -> size == 0
2363 rXFSet.Put( XFillBmpSizeYItem( 0 ) );
2364 rXFSet.Put( XFillBmpSizeLogItem( true ) );
2367 if( m_pMtrFldOffset->IsEnabled() )
2369 if( m_pRbtRow->IsChecked() )
2371 rXFSet.Put( XFillBmpTileOffsetXItem( (sal_uInt16) m_pMtrFldOffset->GetValue() ) );
2372 rXFSet.Put( XFillBmpTileOffsetYItem( (sal_uInt16) 0 ) );
2374 else if( m_pRbtColumn->IsChecked() )
2376 rXFSet.Put( XFillBmpTileOffsetXItem( (sal_uInt16) 0 ) );
2377 rXFSet.Put( XFillBmpTileOffsetYItem( (sal_uInt16) m_pMtrFldOffset->GetValue() ) );
2381 if( m_pCtlPosition->IsEnabled() )
2382 rXFSet.Put( XFillBmpPosItem( m_pCtlPosition->GetActualRP() ) );
2384 if( m_pMtrFldXOffset->IsEnabled() )
2385 rXFSet.Put( XFillBmpPosOffsetXItem( (sal_uInt16) m_pMtrFldXOffset->GetValue() ) );
2387 if( m_pMtrFldYOffset->IsEnabled() )
2388 rXFSet.Put( XFillBmpPosOffsetYItem( (sal_uInt16) m_pMtrFldYOffset->GetValue() ) );
2391 m_pCtlBitmapPreview->SetAttributes( aXFillAttr.GetItemSet() );
2392 m_pCtlBitmapPreview->Invalidate();
2394 return 0L;
2399 IMPL_LINK_NOARG(SvxAreaTabPage, ClickScaleHdl_Impl)
2401 if( m_pTsbScale->GetState() == TRISTATE_TRUE )
2403 m_pMtrFldXSize->SetDecimalDigits( 0 );
2404 m_pMtrFldXSize->SetUnit(FUNIT_PERCENT);
2405 m_pMtrFldXSize->SetValue( 100 );
2406 m_pMtrFldXSize->SetMax( 100 );
2407 m_pMtrFldXSize->SetLast( 100 );
2409 m_pMtrFldYSize->SetDecimalDigits( 0 );
2410 m_pMtrFldYSize->SetUnit(FUNIT_PERCENT);
2411 m_pMtrFldYSize->SetValue( 100 );
2412 m_pMtrFldYSize->SetMax( 100 );
2413 m_pMtrFldYSize->SetLast( 100 );
2415 else
2417 m_pMtrFldXSize->SetDecimalDigits( 2 );
2418 m_pMtrFldXSize->SetUnit( eFUnit );
2419 m_pMtrFldXSize->SetValue( 100 );
2420 m_pMtrFldXSize->SetMax( 999900 );
2421 m_pMtrFldXSize->SetLast( 100000 );
2423 m_pMtrFldYSize->SetDecimalDigits( 2 );
2424 m_pMtrFldYSize->SetUnit( eFUnit );
2425 m_pMtrFldYSize->SetValue( 100 );
2426 m_pMtrFldYSize->SetMax( 999900 );
2427 m_pMtrFldYSize->SetLast( 100000 );
2430 ModifyTileHdl_Impl( NULL );
2432 return 0L;
2437 void SvxAreaTabPage::PointChanged( vcl::Window* pWindow, RECT_POINT eRcPt )
2439 eRP = eRcPt;
2441 // alignment of the bitmap fill
2442 ModifyTileHdl_Impl( pWindow );
2445 void SvxAreaTabPage::PageCreated(const SfxAllItemSet& aSet)
2447 SFX_ITEMSET_ARG (&aSet,pColorListItem,SvxColorListItem,SID_COLOR_TABLE,false);
2448 SFX_ITEMSET_ARG (&aSet,pGradientListItem,SvxGradientListItem,SID_GRADIENT_LIST,false);
2449 SFX_ITEMSET_ARG (&aSet,pHatchingListItem,SvxHatchListItem,SID_HATCH_LIST,false);
2450 SFX_ITEMSET_ARG (&aSet,pBitmapListItem,SvxBitmapListItem,SID_BITMAP_LIST,false);
2451 SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,false);
2452 SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,false);
2453 SFX_ITEMSET_ARG (&aSet,pPosItem,SfxUInt16Item,SID_TABPAGE_POS,false);
2455 //UUUU
2456 SFX_ITEMSET_ARG (&aSet, pOfferImportItem, SfxBoolItem, SID_OFFER_IMPORT, false);
2458 if (pColorListItem)
2459 SetColorList(pColorListItem->GetColorList());
2460 if (pGradientListItem)
2461 SetGradientList(pGradientListItem->GetGradientList());
2462 if (pHatchingListItem)
2463 SetHatchingList(pHatchingListItem->GetHatchList());
2464 if (pBitmapListItem)
2465 SetBitmapList(pBitmapListItem->GetBitmapList());
2466 if (pPageTypeItem)
2467 SetPageType(pPageTypeItem->GetValue());
2468 if (pDlgTypeItem)
2469 SetDlgType(pDlgTypeItem->GetValue());
2470 if (pPosItem)
2471 SetPos(pPosItem->GetValue());
2473 //UUUU
2474 if(pOfferImportItem)
2476 const bool bNew(pOfferImportItem->GetValue());
2478 if(mbOfferImportButton != bNew)
2480 mbOfferImportButton = bNew;
2484 Construct();
2487 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */