summaryrefslogtreecommitdiff
path: root/svx/source/sidebar/area
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/sidebar/area')
-rw-r--r--svx/source/sidebar/area/AreaPropertyPanel.cxx1361
-rw-r--r--svx/source/sidebar/area/AreaPropertyPanel.hrc82
-rw-r--r--svx/source/sidebar/area/AreaPropertyPanel.hxx198
-rw-r--r--svx/source/sidebar/area/AreaPropertyPanel.src389
-rw-r--r--svx/source/sidebar/area/AreaTransparencyGradientControl.cxx345
-rw-r--r--svx/source/sidebar/area/AreaTransparencyGradientControl.hxx74
-rw-r--r--svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx56
-rw-r--r--svx/source/sidebar/area/AreaTransparencyGradientPopup.hxx47
8 files changed, 2552 insertions, 0 deletions
diff --git a/svx/source/sidebar/area/AreaPropertyPanel.cxx b/svx/source/sidebar/area/AreaPropertyPanel.cxx
new file mode 100644
index 000000000000..0e746aa44d63
--- /dev/null
+++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx
@@ -0,0 +1,1361 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include "svx/sidebar/PopupContainer.hxx"
+#include "AreaTransparencyGradientControl.hxx"
+
+#include <sfx2/sidebar/ResourceDefinitions.hrc>
+#include <sfx2/sidebar/Theme.hxx>
+#include <sfx2/sidebar/ControlFactory.hxx>
+#include <AreaPropertyPanel.hxx>
+#include <AreaPropertyPanel.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <sfx2/objsh.hxx>
+#include <svx/xfltrit.hxx>
+#include <svx/xflftrit.hxx>
+#include <svx/xtable.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/bindings.hxx>
+#include <helpid.hrc>
+#include <svtools/valueset.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svx/svxitems.hrc>
+#include <vcl/toolbox.hxx>
+#include <svtools/toolbarmenu.hxx>
+#include <svx/sidebar/ColorControl.hxx>
+
+#include <boost/bind.hpp>
+
+using namespace css;
+using namespace cssu;
+using ::sfx2::sidebar::Theme;
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+
+
+
+namespace svx { namespace sidebar {
+
+const sal_Int32 AreaPropertyPanel::DEFAULT_CENTERX = 50;
+const sal_Int32 AreaPropertyPanel::DEFAULT_CENTERY = 50;
+const sal_Int32 AreaPropertyPanel::DEFAULT_ANGLE = 0;
+const sal_Int32 AreaPropertyPanel::DEFAULT_STARTVALUE = 0;
+const sal_Int32 AreaPropertyPanel::DEFAULT_ENDVALUE = 16777215;
+const sal_Int32 AreaPropertyPanel::DEFAULT_BORDER = 0;
+
+
+AreaPropertyPanel::AreaPropertyPanel(
+ Window* pParent,
+ const cssu::Reference<css::frame::XFrame>& rxFrame,
+ SfxBindings* pBindings)
+ : Control(pParent, SVX_RES(RID_SIDEBAR_AREA_PANEL)),
+ meLastXFS(-1),
+ maLastColor(Color(COL_DEFAULT_SHAPE_FILLING)),
+ mnLastPosGradient(0),
+ mnLastPosHatch(0),
+ mnLastPosBitmap(0),
+ mnLastTransSolid(50),
+ maGradientLinear(),
+ maGradientAxial(),
+ maGradientRadial(),
+ maGradientElliptical(),
+ maGradientSquare(),
+ maGradientRect(),
+ mpColorTextFT(new FixedText(this, SVX_RES(FT_COLOR_LIST))),
+ mpLbFillType(new SvxFillTypeBox(this)),
+ mpLbFillAttr(new SvxFillAttrBox(this)),
+ mpToolBoxColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
+ mpToolBoxColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpToolBoxColorBackground.get(), SVX_RES(TB_COLOR))),
+ mpTrspTextFT(new FixedText(this, SVX_RES(FL_TRSP_TEXT))),
+ mpLBTransType(new ListBox(this, SVX_RES(LB_TRGR_TYPES))),
+ mpMTRTransparent(new MetricField(this, SVX_RES(MTR_TRANSPARENT))),
+ mpBTNGradientBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
+ mpBTNGradient(sfx2::sidebar::ControlFactory::CreateToolBox(mpBTNGradientBackground.get(), SVX_RES(BTN_GRADIENT))),
+ mpColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_ATTR_FILL_COLOR, TBI_COLOR, mpToolBoxColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)),
+ mpStyleItem(),
+ mpColorItem(),
+ mpFillGradientItem(),
+ mpHatchItem(),
+ mpBitmapItem(),
+ mpColorListItem(),
+ mpGradientListItem(),
+ mpHatchListItem(),
+ mpBitmapListItem(),
+ maStyleControl(SID_ATTR_FILL_STYLE, *pBindings, *this),
+ maColorControl(SID_ATTR_FILL_COLOR, *pBindings, *this),
+ maGradientControl(SID_ATTR_FILL_GRADIENT, *pBindings, *this),
+ maHatchControl(SID_ATTR_FILL_HATCH, *pBindings, *this),
+ maBitmapControl(SID_ATTR_FILL_BITMAP, *pBindings, *this),
+ maColorTableControl(SID_COLOR_TABLE, *pBindings, *this),
+ maGradientListControl(SID_GRADIENT_LIST, *pBindings, *this),
+ maHatchListControl(SID_HATCH_LIST, *pBindings, *this),
+ maBitmapListControl(SID_BITMAP_LIST, *pBindings, *this),
+ maFillTransparenceController(SID_ATTR_FILL_TRANSPARENCE, *pBindings, *this),
+ maFillFloatTransparenceController(SID_ATTR_FILL_FLOATTRANSPARENCE, *pBindings, *this),
+ maImgAxial(SVX_RES(IMG_AXIAL)),
+ maImgElli(SVX_RES(IMG_ELLI)),
+ maImgQuad(SVX_RES(IMG_QUAD)),
+ maImgRadial(SVX_RES(IMG_RADIAL)),
+ maImgSquare(SVX_RES(IMG_SQUARE)),
+ maImgLinear(SVX_RES(IMG_LINEAR)),
+ maImgColor(SVX_RES(IMG_COLOR)),
+ msHelpFillType(SVX_RES(STR_HELP_TYPE)),
+ msHelpFillAttr(SVX_RES(STR_HELP_ATTR)),
+ maTrGrPopup(this, ::boost::bind(&AreaPropertyPanel::CreateTransparencyGradientControl, this, _1)),
+ maColorPopup(this, ::boost::bind(&AreaPropertyPanel::CreateColorPopupControl, this, _1)),
+ mpFloatTransparenceItem(),
+ mpTransparanceItem(),
+ mxFrame(rxFrame),
+ mpBindings(pBindings),
+ mbTBShow(true),
+ mbColorAvail(true)
+{
+ Initialize();
+ FreeResource();
+}
+
+
+
+AreaPropertyPanel::~AreaPropertyPanel()
+{
+ // Destroy the toolboxes, then their background windows.
+ mpToolBoxColor.reset();
+ mpBTNGradient.reset();
+ mpToolBoxColorBackground.reset();
+ mpBTNGradientBackground.reset();
+}
+
+
+
+void AreaPropertyPanel::Initialize()
+{
+ mpColorTextFT->SetBackground(Wallpaper());
+ mpTrspTextFT->SetBackground(Wallpaper());
+
+ maGradientLinear.SetXOffset(DEFAULT_CENTERX);
+ maGradientLinear.SetYOffset(DEFAULT_CENTERY);
+ maGradientLinear.SetAngle(DEFAULT_ANGLE);
+ maGradientLinear.SetStartColor(Color(DEFAULT_STARTVALUE));
+ maGradientLinear.SetEndColor(Color(DEFAULT_ENDVALUE));
+ maGradientLinear.SetBorder(DEFAULT_BORDER);
+ maGradientLinear.SetGradientStyle(XGRAD_LINEAR);
+
+ maGradientAxial = maGradientLinear;
+ maGradientAxial.SetGradientStyle(XGRAD_AXIAL);
+
+ maGradientRadial = maGradientLinear;
+ maGradientRadial.SetGradientStyle(XGRAD_RADIAL);
+
+ maGradientElliptical = maGradientLinear;
+ maGradientElliptical.SetGradientStyle(XGRAD_ELLIPTICAL);
+
+ maGradientSquare = maGradientLinear;
+ maGradientSquare.SetGradientStyle(XGRAD_SQUARE);
+
+ maGradientRect = maGradientLinear;
+ maGradientRect.SetGradientStyle(XGRAD_RECT);
+
+ Size aLogicalFillSize(MBOX_WIDTH,LISTBOX_HEIGHT);
+ Size aLogicalAttrSize(MBOX_WIDTH + 1,LISTBOX_HEIGHT);
+
+ Point aPoint(SECTIONPAGE_MARGIN_HORIZONTAL,SECTIONPAGE_MARGIN_VERTICAL_TOP + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL);
+ Point aPoint_Picker(SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL,SECTIONPAGE_MARGIN_VERTICAL_TOP + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL);
+
+ Size aTypeSize(LogicToPixel(aLogicalFillSize, MAP_APPFONT));
+ Size aAttrSize(LogicToPixel(aLogicalAttrSize, MAP_APPFONT));
+
+ Point aTypePoint(LogicToPixel(aPoint, MAP_APPFONT));
+ Point aAttrPoint(LogicToPixel(aPoint_Picker, MAP_APPFONT));
+
+ mpLbFillType->SetPosSizePixel(aTypePoint,aTypeSize);
+ mpLbFillAttr->SetPosSizePixel(aAttrPoint,aAttrSize);
+
+ mpLbFillType->SetHelpId(HID_PPROPERTYPANEL_AREA_LB_FILL_TYPES);
+ mpLbFillAttr->SetHelpId(HID_PPROPERTYPANEL_AREA_LB_FILL_ATTR);
+
+ mpLbFillType->SetQuickHelpText(msHelpFillType);
+ mpLbFillAttr->SetQuickHelpText(msHelpFillAttr);
+
+ mpLbFillType->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Fill"))); //wj acc
+ mpLbFillAttr->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Fill"))); //wj acc
+
+ Link aLink = LINK( this, AreaPropertyPanel, SelectFillTypeHdl );
+ mpLbFillType->SetSelectHdl( aLink );
+
+ aLink = LINK( this, AreaPropertyPanel, SelectFillAttrHdl );
+ mpLbFillAttr->SetSelectHdl( aLink );
+
+ //add for new color picker
+ mpLbFillAttr->Hide();
+ mpToolBoxColor->SetItemImage(TBI_COLOR, maImgColor);
+ Size aTbxSize( mpToolBoxColor->CalcWindowSizePixel() );
+ mpToolBoxColor->SetOutputSizePixel( aTbxSize );
+ mpToolBoxColor->SetItemBits( TBI_COLOR, mpToolBoxColor->GetItemBits( TBI_COLOR ) | TIB_DROPDOWNONLY );
+ mpToolBoxColor->SetBackground(Wallpaper());
+ mpToolBoxColor->SetPaintTransparent(true);
+ mpToolBoxColor->SetQuickHelpText(TBI_COLOR, String(SVX_RES(STR_HELP_COLOR))); //wj acc
+ //mpToolBoxColor->SetItemText(TBI_COLOR, msHelpFillAttr);
+
+ long aHeightLBStyle = mpLbFillType->GetSizePixel().getHeight();
+ long aLBPosY = mpLbFillType->GetPosPixel().getY();
+ long aHeightTBAttr = mpToolBoxColor->GetSizePixel().getHeight();
+ Point aPointTBAttr = mpToolBoxColor->GetPosPixel();
+ aPointTBAttr.setY( aLBPosY + aHeightLBStyle / 2 - aHeightTBAttr / 2);
+ mpToolBoxColor->SetPosPixel(aPointTBAttr);
+
+ aLink = LINK(this, AreaPropertyPanel, ToolBoxColorDropHdl);
+ mpToolBoxColor->SetDropdownClickHdl ( aLink );
+ mpToolBoxColor->SetSelectHdl ( aLink );
+
+ //add end
+ mpLBTransType->SetSelectHdl(LINK(this, AreaPropertyPanel, ChangeTrgrTypeHdl_Impl));
+ mpLBTransType->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency"))); //wj acc
+
+ mpMTRTransparent->SetValue( 50 );
+ mpMTRTransparent->SetModifyHdl(LINK(this, AreaPropertyPanel, ModifyTransparentHdl_Impl));
+ mpMTRTransparent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency"))); //wj acc
+
+ mpBTNGradient->SetItemBits( TBI_BTX_GRADIENT, mpBTNGradient->GetItemBits( TBI_BTX_GRADIENT ) | TIB_DROPDOWNONLY );
+ aLink = LINK( this, AreaPropertyPanel, ClickTrGrHdl_Impl );
+ mpBTNGradient->SetDropdownClickHdl( aLink );
+ mpBTNGradient->SetSelectHdl( aLink );
+ aTbxSize = mpBTNGradient->CalcWindowSizePixel();
+ mpBTNGradient->SetOutputSizePixel( aTbxSize );
+ mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,maImgLinear);
+ mpBTNGradient->SetQuickHelpText(TBI_BTX_GRADIENT, String(SVX_RES(STR_HELP_GRADIENT))); //wj acc
+ mpBTNGradient->Hide();
+
+ long aHeightLBTrans = mpLBTransType->GetSizePixel().getHeight();
+ Point aPointLB = mpLBTransType->GetPosPixel();
+ long aPosY = aPointLB.getY();
+
+ Point aPointMetric = mpMTRTransparent->GetPosPixel();
+ Point aPointTB = mpMTRTransparent->GetPosPixel();
+ long aHeightMetric = mpMTRTransparent->GetSizePixel().getHeight();
+ long aHeightTool = mpBTNGradient->GetSizePixel().getHeight();
+ aPointMetric.setY(aPosY+aHeightLBTrans/2-aHeightMetric/2);
+ aPointTB.setY(aPosY+aHeightLBTrans/2-aHeightTool/2);
+ aPointTB.setX(aPointTB.getX()+3);
+ mpMTRTransparent->SetPosPixel(aPointMetric);
+ mpBTNGradient->SetPosPixel(aPointTB);
+
+ mpLbFillType->SetAccessibleRelationLabeledBy(mpColorTextFT.get());
+ mpLbFillAttr->SetAccessibleRelationLabeledBy(mpLbFillAttr.get());
+ mpToolBoxColor->SetAccessibleRelationLabeledBy(mpToolBoxColor.get());
+ mpLBTransType->SetAccessibleRelationLabeledBy(mpTrspTextFT.get());
+ mpMTRTransparent->SetAccessibleRelationLabeledBy(mpMTRTransparent.get());
+ mpBTNGradient->SetAccessibleRelationLabeledBy(mpBTNGradient.get());
+
+ SetupIcons();
+}
+
+
+
+IMPL_LINK( AreaPropertyPanel, SelectFillTypeHdl, ListBox *, pToolBox )
+{
+ XFillStyle eXFS = (XFillStyle)mpLbFillType->GetSelectEntryPos();
+
+ if( (XFillStyle) meLastXFS != eXFS )
+ {
+ mpLbFillAttr->Clear();
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+ XFillStyleItem aXFillStyleItem( eXFS );
+ GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_STYLE, SFX_CALLMODE_RECORD, &aXFillStyleItem, 0L);
+
+ switch( eXFS )
+ {
+ case XFILL_NONE:
+ {
+ mpLbFillAttr->Show();
+ mpToolBoxColor->Hide();
+ mbTBShow = false;
+ mpLbFillType->Selected();
+ mpLbFillAttr->Disable();
+ }
+ break;
+
+ case XFILL_SOLID:
+ {
+ mpLbFillAttr->Hide();
+ mpToolBoxColor->Show();
+ mbTBShow = true;
+ String aTmpStr;
+ Color aColor = maLastColor;
+ XFillColorItem aXFillColorItem( aTmpStr, aColor );
+ GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_COLOR, SFX_CALLMODE_RECORD, &aXFillColorItem, 0L);
+ }
+ break;
+
+ case XFILL_GRADIENT:
+ {
+ mpLbFillAttr->Show();
+ mpToolBoxColor->Hide();
+ mbTBShow = false;
+ if ( pSh && pSh->GetItem( SID_GRADIENT_LIST ) )
+ {
+ if(mpLbFillAttr->GetEntryCount() == 0)
+ {
+ SvxGradientListItem aItem( *(const SvxGradientListItem*)(
+ pSh->GetItem( SID_GRADIENT_LIST ) ) );
+ mpLbFillAttr->Enable();
+ mpLbFillAttr->Clear();
+ mpLbFillAttr->Fill( aItem.GetGradientList() );
+ }
+
+ mpLbFillAttr->SetDropDownLineCount(std::min(sal_uInt16(20), mpLbFillAttr->GetEntryCount()));
+
+ if ( mnLastPosGradient != LISTBOX_ENTRY_NOTFOUND)
+ {
+ SvxGradientListItem aItem( *(const SvxGradientListItem*)( pSh->GetItem( SID_GRADIENT_LIST ) ) );
+ if ( mnLastPosGradient < aItem.GetGradientList()->Count() )
+ {
+ XGradient aGradient = aItem.GetGradientList()->GetGradient( mnLastPosGradient )->GetGradient();
+ XFillGradientItem aXFillGradientItem( mpLbFillAttr->GetEntry(mnLastPosGradient), aGradient );
+ GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_GRADIENT, SFX_CALLMODE_RECORD, &aXFillGradientItem, 0L);
+ mpLbFillAttr->SelectEntryPos(mnLastPosGradient); //add
+ }
+ }
+ }
+ else
+ mpLbFillAttr->Disable();
+ }
+ break;
+
+ case XFILL_HATCH:
+ {
+ mpLbFillAttr->Show();
+ mpToolBoxColor->Hide();
+ mbTBShow = false;
+ if ( pSh && pSh->GetItem( SID_HATCH_LIST ) )
+ {
+ if(mpLbFillAttr->GetEntryCount() == 0)
+ {
+ SvxHatchListItem aItem( *(const SvxHatchListItem*)(
+ pSh->GetItem( SID_HATCH_LIST ) ) );
+ mpLbFillAttr->Enable();
+ mpLbFillAttr->Clear();
+ mpLbFillAttr->Fill( aItem.GetHatchList() );
+ }
+
+ mpLbFillAttr->SetDropDownLineCount(std::min(sal_uInt16(20), mpLbFillAttr->GetEntryCount()));
+
+ if ( mnLastPosHatch != LISTBOX_ENTRY_NOTFOUND )
+ {
+ SvxHatchListItem aItem( *(const SvxHatchListItem*)( pSh->GetItem( SID_HATCH_LIST ) ) );
+ if ( mnLastPosHatch < aItem.GetHatchList()->Count() )
+ {
+ XHatch aHatch = aItem.GetHatchList()->GetHatch( mnLastPosHatch )->GetHatch();
+ XFillHatchItem aXFillHatchItem( mpLbFillAttr->GetSelectEntry(), aHatch );
+ GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_HATCH, SFX_CALLMODE_RECORD, &aXFillHatchItem, 0L);
+ mpLbFillAttr->SelectEntryPos(mnLastPosHatch); //add
+ }
+ }
+ }
+ else
+ mpLbFillAttr->Disable();
+ }
+ break;
+
+ case XFILL_BITMAP:
+ {
+ mpLbFillAttr->Show();
+ mpToolBoxColor->Hide();
+ mbTBShow = false;
+ if ( pSh && pSh->GetItem( SID_BITMAP_LIST ) )
+ {
+ if(mpLbFillAttr->GetEntryCount() == 0)
+ {
+ SvxBitmapListItem aItem( *(const SvxBitmapListItem*)(
+ pSh->GetItem( SID_BITMAP_LIST ) ) );
+ mpLbFillAttr->Enable();
+ mpLbFillAttr->Clear();
+ mpLbFillAttr->Fill( aItem.GetBitmapList() );
+ }
+
+ mpLbFillAttr->SetDropDownLineCount(std::min(sal_uInt16(20), mpLbFillAttr->GetEntryCount()));
+
+ if ( mnLastPosBitmap != LISTBOX_ENTRY_NOTFOUND )
+ {
+ SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( pSh->GetItem( SID_BITMAP_LIST ) ) );
+ if ( mnLastPosBitmap < aItem.GetBitmapList()->Count() )
+ {
+ const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(mnLastPosBitmap);
+ XFillBitmapItem aXFillBitmapItem( mpLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject() );
+ GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_BITMAP, SFX_CALLMODE_RECORD, &aXFillBitmapItem, 0L);
+ mpLbFillAttr->SelectEntryPos(mnLastPosBitmap); //add
+ }
+ }
+ }
+ else
+ mpLbFillAttr->Disable();
+ }
+ break;
+ }
+ meLastXFS = (sal_uInt16)eXFS;
+ if( eXFS != XFILL_NONE )
+ {
+ if ( pToolBox )
+ mpLbFillType->Selected();
+ }
+ }
+ return 0;
+}
+
+
+
+IMPL_LINK( AreaPropertyPanel, SelectFillAttrHdl, ListBox*, pToolBox )
+{
+ XFillStyle eXFS = (XFillStyle)mpLbFillType->GetSelectEntryPos();
+ XFillStyleItem aXFillStyleItem( eXFS );
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+
+ if(pToolBox)
+ {
+ if( (XFillStyle) meLastXFS != eXFS )
+ {
+ GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_STYLE, SFX_CALLMODE_RECORD, &aXFillStyleItem, 0L); //Added 20090909
+ }
+
+ switch( eXFS )
+ {
+ case XFILL_SOLID:
+ //{
+ // //String aTmpStr = mpLbFillAttr->GetSelectEntry();
+ // //Color aColor = mpLbFillAttr->GetSelectEntryColor();
+ // //if(aColor.GetColor() == 0 && aTmpStr.Equals(String::CreateFromAscii("")))
+ // String aTmpStr;
+ // Color aColor = maLastColor;
+ // XFillColorItem aXFillColorItem( aTmpStr, aColor );
+ // GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_COLOR, SFX_CALLMODE_RECORD, &aXFillColorItem, 0L);
+ // maLastColor = aColor;
+ //}
+ break;
+
+ case XFILL_GRADIENT:
+ {
+ sal_uInt16 nPos = mpLbFillAttr->GetSelectEntryPos();
+ if( nPos == LISTBOX_ENTRY_NOTFOUND )
+ nPos = mnLastPosGradient;
+
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_GRADIENT_LIST ) )
+ {
+ SvxGradientListItem aItem( *(const SvxGradientListItem*)( pSh->GetItem( SID_GRADIENT_LIST ) ) );
+ if ( nPos < aItem.GetGradientList()->Count() )
+ {
+ XGradient aGradient = aItem.GetGradientList()->GetGradient( nPos )->GetGradient();
+ XFillGradientItem aXFillGradientItem( mpLbFillAttr->GetSelectEntry(), aGradient );
+ GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_GRADIENT, SFX_CALLMODE_RECORD, &aXFillGradientItem, 0L);
+ }
+ }
+ if(nPos != LISTBOX_ENTRY_NOTFOUND)
+ mnLastPosGradient = nPos;
+ }
+ break;
+
+ case XFILL_HATCH:
+ {
+ sal_uInt16 nPos = mpLbFillAttr->GetSelectEntryPos();
+ if( nPos == LISTBOX_ENTRY_NOTFOUND )
+ nPos = mnLastPosHatch;
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_HATCH_LIST ) )
+ {
+ SvxHatchListItem aItem( *(const SvxHatchListItem*)( pSh->GetItem( SID_HATCH_LIST ) ) );
+ if ( nPos < aItem.GetHatchList()->Count() )
+ {
+ XHatch aHatch = aItem.GetHatchList()->GetHatch( nPos )->GetHatch();
+ XFillHatchItem aXFillHatchItem( mpLbFillAttr->GetSelectEntry(), aHatch );
+ GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_HATCH, SFX_CALLMODE_RECORD, &aXFillHatchItem, 0L);
+ }
+ }
+ if(nPos != LISTBOX_ENTRY_NOTFOUND)
+ mnLastPosHatch = nPos;
+ }
+ break;
+
+ case XFILL_BITMAP:
+ {
+ sal_uInt16 nPos = mpLbFillAttr->GetSelectEntryPos();
+ if( nPos == LISTBOX_ENTRY_NOTFOUND )
+ nPos = mnLastPosBitmap;
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_BITMAP_LIST ) )
+ {
+ SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( pSh->GetItem( SID_BITMAP_LIST ) ) );
+ if ( nPos < aItem.GetBitmapList()->Count() )
+ {
+ const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(nPos);
+ XFillBitmapItem aXFillBitmapItem( mpLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject() );
+ GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_BITMAP, SFX_CALLMODE_RECORD, &aXFillBitmapItem, 0L);
+ }
+ }
+ if(nPos != LISTBOX_ENTRY_NOTFOUND)
+ mnLastPosBitmap = nPos;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ return 0;
+}
+
+
+//add for color picker
+
+IMPL_LINK(AreaPropertyPanel, ToolBoxColorDropHdl, ToolBox*, pToolBox)
+{
+ sal_uInt16 nId = pToolBox->GetCurItemId();
+
+ if(nId == TBI_COLOR)
+ {
+ maColorPopup.Show(*pToolBox);
+ if (mpColorItem)
+ maColorPopup.SetCurrentColor(mpColorItem->GetColorValue(), mbColorAvail);
+ else
+ maColorPopup.SetCurrentColor(COL_WHITE, false);
+ }
+
+ return 0;
+}
+
+
+
+void AreaPropertyPanel::SetColor (
+ const String& rsColorName,
+ const Color aColor)
+{
+ XFillColorItem aXFillColorItem (rsColorName, aColor);
+ mpBindings->GetDispatcher()->Execute(SID_ATTR_FILL_COLOR, SFX_CALLMODE_RECORD, &aXFillColorItem, 0L);
+ maLastColor = aColor;
+}
+
+
+
+
+PopupControl* AreaPropertyPanel::CreateTransparencyGradientControl (PopupContainer* pParent)
+{
+ return new AreaTransparencyGradientControl(pParent, *this);
+}
+
+
+
+
+PopupControl* AreaPropertyPanel::CreateColorPopupControl (PopupContainer* pParent)
+{
+ return new ColorControl(
+ pParent,
+ mpBindings,
+ SVX_RES(RID_POPUPPANEL_AERAPAGE_COLOR),
+ SVX_RES(VS_COLOR),
+ ::boost::bind(&AreaPropertyPanel::GetLastColor, this),
+ ::boost::bind(&AreaPropertyPanel::SetColor, this, _1,_2),
+ pParent,
+ 0);
+}
+
+
+
+
+void AreaPropertyPanel::SetupIcons(void)
+{
+ if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons))
+ {
+ // todo
+ }
+ else
+ {
+ // todo
+ }
+}
+
+
+
+AreaPropertyPanel* AreaPropertyPanel::Create (
+ Window* pParent,
+ const cssu::Reference<css::frame::XFrame>& rxFrame,
+ SfxBindings* pBindings)
+{
+ if (pParent == NULL)
+ throw lang::IllegalArgumentException(A2S("no parent Window given to AreaPropertyPanel::Create"), NULL, 0);
+ if ( ! rxFrame.is())
+ throw lang::IllegalArgumentException(A2S("no XFrame given to AreaPropertyPanel::Create"), NULL, 1);
+ if (pBindings == NULL)
+ throw lang::IllegalArgumentException(A2S("no SfxBindings given to AreaPropertyPanel::Create"), NULL, 2);
+
+ return new AreaPropertyPanel(
+ pParent,
+ rxFrame,
+ pBindings);
+}
+
+
+
+void AreaPropertyPanel::DataChanged(
+ const DataChangedEvent& rEvent)
+{
+ (void)rEvent;
+
+ SetupIcons();
+}
+
+
+
+void AreaPropertyPanel::ImpUpdateTransparencies()
+{
+ if(mpTransparanceItem.get() || mpFloatTransparenceItem.get())
+ {
+ bool bZeroValue(false);
+
+ if(mpTransparanceItem.get())
+ {
+ const sal_uInt16 nValue(mpTransparanceItem->GetValue());
+
+ if(!nValue)
+ {
+ bZeroValue = true;
+ }
+ else if(nValue <= 100)
+ {
+ mpLBTransType->Enable();
+ mpLBTransType->SelectEntryPos(1);
+ mpBTNGradient->Hide();
+ mpMTRTransparent->Show();
+ mpMTRTransparent->Enable();
+ mpMTRTransparent->SetValue(nValue);
+ }
+
+ if(!bZeroValue)
+ {
+ maTrGrPopup.Hide();
+ }
+ }
+
+ if(bZeroValue && mpFloatTransparenceItem.get())
+ {
+ if(mpFloatTransparenceItem->IsEnabled())
+ {
+ const XGradient& rGradient = mpFloatTransparenceItem->GetGradientValue();
+ sal_uInt16 nEntryPos(0);
+ Image* pImage = 0;
+
+ mpLBTransType->Enable();
+ mpMTRTransparent->Hide();
+ mpBTNGradient->Enable();
+ mpBTNGradient->Show();
+
+ switch(rGradient.GetGradientStyle())
+ {
+ case XGRAD_LINEAR:
+ {
+ nEntryPos = 2;
+ pImage = &maImgLinear;
+ break;
+ }
+ case XGRAD_AXIAL:
+ {
+ nEntryPos = 3;
+ pImage = &maImgAxial;
+ break;
+ }
+ case XGRAD_RADIAL:
+ {
+ nEntryPos = 4;
+ pImage = &maImgRadial;
+ break;
+ }
+ case XGRAD_ELLIPTICAL:
+ {
+ nEntryPos = 5;
+ pImage = &maImgElli;
+ break;
+ }
+ case XGRAD_SQUARE:
+ {
+ nEntryPos = 6;
+ pImage = &maImgQuad;
+ break;
+ }
+ case XGRAD_RECT:
+ {
+ nEntryPos = 7;
+ pImage = &maImgSquare;
+ break;
+ }
+ }
+
+ mpLBTransType->SelectEntryPos(nEntryPos);
+ mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, *pImage);
+ bZeroValue = false;
+ }
+ else
+ {
+ bZeroValue = true;
+ }
+ }
+
+ if(bZeroValue)
+ {
+ mpLBTransType->Enable();
+ mpLBTransType->SelectEntryPos(0);
+ mpBTNGradient->Hide();
+ mpMTRTransparent->Enable();
+ mpMTRTransparent->Show();
+ mpMTRTransparent->SetValue(0);
+ }
+ }
+ else
+ {
+ // no transparency at all
+ mpLBTransType->SetNoSelection();
+ mpMTRTransparent->Disable();
+ mpMTRTransparent->Show();
+ mpBTNGradient->Disable();
+ mpBTNGradient->Hide();
+ }
+}
+
+
+
+void AreaPropertyPanel::NotifyItemUpdate(
+ sal_uInt16 nSID,
+ SfxItemState eState,
+ const SfxPoolItem* pState)
+{
+ XFillStyle eXFS;
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+ bool bFillTransparenceChanged(false);
+
+ if(SID_ATTR_FILL_TRANSPARENCE == nSID)
+ {
+ bFillTransparenceChanged = true;
+
+ if(eState >= SFX_ITEM_AVAILABLE)
+ {
+ const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState);
+
+ if(pItem && (!mpTransparanceItem || *pItem != *mpTransparanceItem))
+ {
+ mpTransparanceItem.reset((SfxUInt16Item*)pItem->Clone());
+ }
+ else
+ {
+ mpTransparanceItem.reset();
+ }
+ }
+ else
+ {
+ mpTransparanceItem.reset();
+ }
+ }
+ else if(SID_ATTR_FILL_FLOATTRANSPARENCE == nSID)
+ {
+ bFillTransparenceChanged = true;
+
+ if(eState >= SFX_ITEM_AVAILABLE)
+ {
+ const XFillFloatTransparenceItem* pItem = dynamic_cast< const XFillFloatTransparenceItem* >(pState);
+
+ if(pItem && (!mpFloatTransparenceItem || *pItem != *mpFloatTransparenceItem))
+ {
+ mpFloatTransparenceItem.reset((XFillFloatTransparenceItem*)pItem->Clone());
+ }
+ else
+ {
+ mpFloatTransparenceItem.reset();
+ }
+ }
+ else
+ {
+ mpFloatTransparenceItem.reset();
+ }
+ }
+
+ if(bFillTransparenceChanged)
+ {
+ // update transparency settings dependent of mpTransparanceItem and mpFloatTransparenceItem
+ ImpUpdateTransparencies();
+ }
+
+ if (nSID == SID_ATTR_FILL_STYLE )
+ {
+ if( eState == SFX_ITEM_DISABLED )
+ {
+ mpLbFillType->Disable();
+ mpLbFillType->SetNoSelection();
+ mpLbFillAttr->Show();
+ mpLbFillAttr->Disable();
+ mpLbFillAttr->SetNoSelection();
+ mpToolBoxColor->Hide();
+ mbTBShow = false;
+ meLastXFS = -1;
+ mpStyleItem.reset();
+ }
+ else if( SFX_ITEM_AVAILABLE == eState )
+ {
+ mpStyleItem.reset(pState ? (XFillStyleItem*)pState->Clone() : 0);
+ mpLbFillType->Enable();
+
+ eXFS = (XFillStyle)mpStyleItem->GetValue();
+ meLastXFS = eXFS;
+ mpLbFillType->SelectEntryPos(
+ sal::static_int_cast< sal_uInt16 >( eXFS ) );
+ //Added for select invisable
+ if(eXFS == XFILL_NONE)
+ {
+ mpLbFillAttr->SetNoSelection();
+ mpLbFillAttr->Disable();
+ }
+ //else
+ // mpLbFillAttr->Enable();
+ Update();
+ //SelectFillTypeHdl( NULL );
+ }
+ else
+ {
+ mpLbFillType->SetNoSelection();
+ mpLbFillAttr->Show();
+ mpLbFillAttr->Disable();
+ mpLbFillAttr->SetNoSelection();
+ mpToolBoxColor->Hide();
+ mbTBShow = false;
+ meLastXFS = -1; //Added
+ mpStyleItem.reset();
+ }
+ }
+ else if(nSID == SID_ATTR_FILL_COLOR)
+ {
+ if( SFX_ITEM_AVAILABLE == eState)
+ {
+ mpColorItem.reset(pState ? (XFillColorItem*)pState->Clone() : 0);
+ }
+ if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_SOLID)
+ {
+ mpLbFillAttr->Hide();
+ mpToolBoxColor->Show();
+ mbTBShow = true;
+ if( SFX_ITEM_AVAILABLE == eState)
+ {
+ mpToolBoxColor->Enable();
+ mbColorAvail = true; //
+ // maLastColor = mpColorItem->GetColorValue();
+ Update();
+ }
+ else if(SFX_ITEM_DISABLED == eState )
+ {
+ mpToolBoxColor->Disable();
+ mbColorAvail = false; //
+ mpColorUpdater->Update(COL_WHITE);
+ }
+ else
+ {
+ mbColorAvail = false; //
+ mpColorUpdater->Update(COL_WHITE);
+ }
+ }
+ }
+ else if(nSID == SID_ATTR_FILL_GRADIENT)
+ {
+ if( SFX_ITEM_AVAILABLE == eState)
+ {
+ mpFillGradientItem.reset(pState ? (XFillGradientItem*)pState->Clone() : 0);
+ }
+ if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_GRADIENT )
+ {
+ mpLbFillAttr->Show();
+ mpToolBoxColor->Hide();
+ mbTBShow = false;
+ if( SFX_ITEM_AVAILABLE == eState)
+ {
+ mpLbFillAttr->Enable();
+ Update();
+ }
+
+ else if(SFX_ITEM_DISABLED == eState )
+ {
+ mpLbFillAttr->Disable();
+ mpLbFillAttr->SetNoSelection();
+ }
+ else
+ mpLbFillAttr->SetNoSelection();
+ }
+ }
+ else if(nSID == SID_ATTR_FILL_HATCH)
+ {
+ if( SFX_ITEM_AVAILABLE == eState)
+ {
+ mpHatchItem.reset(pState ? (XFillHatchItem*)pState->Clone() : 0);
+ }
+ if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_HATCH )
+ {
+ mpLbFillAttr->Show();
+ mpToolBoxColor->Hide();
+ mbTBShow = false;
+ if( SFX_ITEM_AVAILABLE == eState)
+ {
+ mpLbFillAttr->Enable();
+ Update();
+ }
+ else if(SFX_ITEM_DISABLED == eState )
+ {
+ mpLbFillAttr->Disable();
+ mpLbFillAttr->SetNoSelection();
+ }
+ else
+ mpLbFillAttr->SetNoSelection();
+ }
+ }
+ else if(nSID == SID_ATTR_FILL_BITMAP)
+ {
+ if( SFX_ITEM_AVAILABLE == eState)
+ {
+ mpBitmapItem.reset(pState ? (XFillBitmapItem*)pState->Clone() : 0);
+ }
+ if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_BITMAP )
+ {
+ mpLbFillAttr->Show();
+ mpToolBoxColor->Hide();
+ mbTBShow = false;
+ if( SFX_ITEM_AVAILABLE == eState)
+ {
+ mpLbFillAttr->Enable();
+ Update();
+ }
+ else if(SFX_ITEM_DISABLED == eState )
+ {
+ mpLbFillAttr->Disable();
+ mpLbFillAttr->SetNoSelection();
+ }
+ else
+ mpLbFillAttr->SetNoSelection();
+ }
+ }
+ else if(nSID == SID_COLOR_TABLE)
+ {
+ if( SFX_ITEM_AVAILABLE == eState)
+ {
+ mpColorListItem.reset(pState ? (SvxColorListItem*)pState->Clone() : 0);
+
+ if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue()== XFILL_SOLID)
+ {
+ if ( mpColorItem )
+ {
+ String aString( mpColorItem->GetName() );
+ Color aColor = mpColorItem->GetColorValue();
+ mpLbFillAttr->Clear();
+ SvxColorListItem aItem( *(const SvxColorListItem*)(
+ pSh->GetItem( SID_COLOR_TABLE ) ) );
+ mpLbFillAttr->Enable();
+ mpLbFillAttr->Fill( aItem.GetColorList() );
+ mpLbFillAttr->SelectEntry( aColor );
+ }
+ else
+ mpLbFillAttr->SetNoSelection();
+ }
+ }
+ }
+ else if(nSID == SID_GRADIENT_LIST)
+ {
+ if( SFX_ITEM_AVAILABLE == eState)
+ {
+ mpGradientListItem.reset(pState ? (SvxGradientListItem*)pState->Clone() : 0);
+
+ if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_GRADIENT)
+ {
+ if ( mpFillGradientItem )
+ {
+ String aString( mpFillGradientItem->GetName() );
+ mpLbFillAttr->Clear();
+ SvxGradientListItem aItem( *(const SvxGradientListItem*)(
+ pSh->GetItem( SID_GRADIENT_LIST ) ) );
+ mpLbFillAttr->Enable();
+ mpLbFillAttr->Fill( aItem.GetGradientList() );
+ mpLbFillAttr->SelectEntry( aString );
+ }
+ else
+ mpLbFillAttr->SetNoSelection();
+ }
+ }
+ }
+ else if(nSID == SID_HATCH_LIST)
+ {
+ if( SFX_ITEM_AVAILABLE == eState)
+ {
+ mpHatchListItem.reset(pState ? (SvxHatchListItem*)pState->Clone() : 0);
+
+ if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_HATCH )
+ {
+ if ( mpHatchItem)
+ {
+ String aString( mpHatchItem->GetName() );
+ mpLbFillAttr->Clear();
+ SvxHatchListItem aItem( *(const SvxHatchListItem*)(
+ pSh->GetItem( SID_HATCH_LIST ) ) );
+ mpLbFillAttr->Enable();
+ mpLbFillAttr->Fill( aItem.GetHatchList() );
+ mpLbFillAttr->SelectEntry( aString );
+ }
+ else
+ mpLbFillAttr->SetNoSelection();
+ }
+ }
+ }
+ else if(nSID == SID_BITMAP_LIST)
+ {
+ if( SFX_ITEM_AVAILABLE == eState)
+ {
+ mpBitmapListItem.reset(pState ? (SvxBitmapListItem*)pState->Clone() : 0);
+
+ if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_BITMAP )
+ {
+ if ( mpBitmapItem )
+ {
+ String aString( mpBitmapItem->GetName() );
+ mpLbFillAttr->Clear();
+ SvxBitmapListItem aItem( *(const SvxBitmapListItem*)(
+ pSh->GetItem( SID_BITMAP_LIST ) ) );
+ mpLbFillAttr->Enable();
+ mpLbFillAttr->Fill( aItem.GetBitmapList() );
+ mpLbFillAttr->SelectEntry( aString );
+ }
+ else
+ mpLbFillAttr->SetNoSelection();
+ }
+ }
+ }
+}
+
+
+
+SfxBindings* AreaPropertyPanel::GetBindings()
+{
+ return mpBindings;
+}
+
+
+
+void AreaPropertyPanel::Update()
+{
+ if ( mpStyleItem )
+ {
+ XFillStyle eXFS = (XFillStyle)mpStyleItem->GetValue();
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+
+ switch( eXFS )
+ {
+ case XFILL_NONE:
+ {
+ mpLbFillAttr->Show(); //wj for new color picker
+ mpToolBoxColor->Hide(); //wj for new color picker
+ mbTBShow = false;
+ }
+ break;
+
+ case XFILL_SOLID:
+ {
+ if ( mpColorItem )
+ {
+ mpLbFillAttr->Hide(); //wj for new color picker
+ mpToolBoxColor->Show(); //wj for new color picker
+ mbTBShow = true;
+ mpColorUpdater->Update(mpColorItem->GetColorValue());
+ }
+ else
+ mpColorUpdater->Update(COL_WHITE);
+ }
+ break;
+
+ case XFILL_GRADIENT:
+ {
+ mpLbFillAttr->Show(); //wj for new color picker
+ mpToolBoxColor->Hide(); //wj for new color picker
+ mbTBShow = false;
+ if ( pSh && pSh->GetItem( SID_GRADIENT_LIST ) )
+ {
+ SvxGradientListItem aItem( *(const SvxGradientListItem*)(
+ pSh->GetItem( SID_GRADIENT_LIST ) ) );
+ mpLbFillAttr->Enable();
+ mpLbFillAttr->Clear();
+ mpLbFillAttr->Fill( aItem.GetGradientList() );
+ if ( mpFillGradientItem )
+ {
+ String aString( mpFillGradientItem->GetName() );
+ mpLbFillAttr->SelectEntry( aString );
+ }
+ else
+ mpLbFillAttr->SetNoSelection();
+ }
+ else
+ mpLbFillAttr->SetNoSelection();
+ }
+ break;
+
+ case XFILL_HATCH:
+ {
+ mpLbFillAttr->Show(); //wj for new color picker
+ mpToolBoxColor->Hide(); //wj for new color picker
+ mbTBShow = false;
+ if ( pSh && pSh->GetItem( SID_HATCH_LIST ) )
+ {
+ SvxHatchListItem aItem( *(const SvxHatchListItem*)(
+ pSh->GetItem( SID_HATCH_LIST ) ) );
+ mpLbFillAttr->Enable();
+ mpLbFillAttr->Clear();
+ mpLbFillAttr->Fill( aItem.GetHatchList() );
+ if ( mpHatchItem )
+ {
+ String aString( mpHatchItem->GetName() );
+ mpLbFillAttr->SelectEntry( aString );
+ }
+ else
+ mpLbFillAttr->SetNoSelection();
+ }
+ else
+ mpLbFillAttr->SetNoSelection();
+ }
+ break;
+
+ case XFILL_BITMAP:
+ {
+ mpLbFillAttr->Show(); //wj for new color picker
+ mpToolBoxColor->Hide(); //wj for new color picker
+ mbTBShow = false;
+ //mpLbFillAttr->Fill( mpBitmapListItem->GetBitmapList() );
+ if ( pSh && pSh->GetItem( SID_BITMAP_LIST ) )
+ {
+ SvxBitmapListItem aItem( *(const SvxBitmapListItem*)(
+ pSh->GetItem( SID_BITMAP_LIST ) ) );
+ mpLbFillAttr->Enable();
+ mpLbFillAttr->Clear();
+ mpLbFillAttr->Fill( aItem.GetBitmapList() );
+ if ( mpBitmapItem )
+ {
+ String aString( mpBitmapItem->GetName() );
+ mpLbFillAttr->SelectEntry( aString );
+ }
+ else
+ mpLbFillAttr->SetNoSelection();
+ }
+ else
+ mpLbFillAttr->SetNoSelection();
+ }
+ break;
+
+ default:
+ OSL_ENSURE(false, "Nicht unterstuetzter Flaechentyp");
+ break;
+ }
+ }
+}
+
+
+
+IMPL_LINK( AreaPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG )
+{
+ return 0;
+}
+
+
+
+IMPL_LINK( AreaPropertyPanel, ClickTrGrHdl_Impl, ToolBox*, pToolBox )
+{
+ maTrGrPopup.Rearrange(mpFloatTransparenceItem.get());
+
+ OSL_ASSERT(pToolBox->GetCurItemId() == TBI_BTX_GRADIENT);
+
+ maTrGrPopup.Show(*pToolBox);
+
+ return (0L);
+}
+
+
+
+IMPL_LINK(AreaPropertyPanel, ChangeTrgrTypeHdl_Impl, void *, EMPTYARG)
+{
+ sal_uInt16 nSelectType = mpLBTransType->GetSelectEntryPos();
+ bool bGradient = false;
+ sal_uInt16 nTrans = 0;
+
+ if (nSelectType == 0)
+ {
+ mpBTNGradient->Hide();
+ mpMTRTransparent->Show();
+ mpMTRTransparent->Enable();
+ mpMTRTransparent->SetValue(0);
+ }
+ else if (nSelectType == 1)
+ {
+ mpBTNGradient->Hide();
+ mpMTRTransparent->Show();
+ nTrans = mnLastTransSolid;
+ mpMTRTransparent->SetValue(nTrans);
+ mpLBTransType->SelectEntryPos(1);// for multi-selected, choose solid no selection
+ mpMTRTransparent->Enable();
+ }
+ else
+ {
+ mpBTNGradient->Show();
+ //for beta1
+ switch ( nSelectType )
+ {
+ case 2:
+ mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, maImgLinear); // high contrast
+ break;
+ case 3:
+ mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, maImgAxial);
+ break;
+ case 4:
+ mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, maImgRadial);
+ break;
+ case 5:
+ mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, maImgElli );
+ break;
+ case 6:
+ mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, maImgQuad );
+ break;
+ case 7:
+ mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, maImgSquare);
+ break;
+ }
+ //end of new code
+ mpMTRTransparent->Hide();
+ mpBTNGradient->Enable();
+ bGradient = true;
+ }
+
+ XFillTransparenceItem aLinearItem(nTrans);
+ GetBindings()->GetDispatcher()->Execute( SID_ATTR_FILL_TRANSPARENCE, SFX_CALLMODE_RECORD, &aLinearItem, 0L );
+
+ if (nSelectType > 1) nSelectType = nSelectType-2;
+
+ XGradient aTmpGradient;
+
+ switch(nSelectType)
+ {
+ case XGRAD_LINEAR:
+ aTmpGradient = maGradientLinear;
+ break;
+ case XGRAD_AXIAL:
+ aTmpGradient = maGradientAxial;
+ break;
+ case XGRAD_RADIAL:
+ aTmpGradient = maGradientRadial;
+ break;
+ case XGRAD_ELLIPTICAL:
+ aTmpGradient = maGradientElliptical;
+ break;
+ case XGRAD_SQUARE:
+ aTmpGradient = maGradientSquare;
+ break;
+ case XGRAD_RECT:
+ aTmpGradient = maGradientRect;
+ break;
+ }
+ SfxItemPool* pPool = NULL;
+ bool bEnable = false;
+ if (bGradient) bEnable = true;
+ XFillFloatTransparenceItem aGradientItem(pPool,aTmpGradient, bEnable );
+
+ GetBindings()->GetDispatcher()->Execute( SID_ATTR_FILL_FLOATTRANSPARENCE, SFX_CALLMODE_RECORD, &aGradientItem, 0L );
+
+ return( 0L );
+}
+
+
+
+IMPL_LINK(AreaPropertyPanel, ModifyTransparentHdl_Impl, void*, EMPTYARG)
+{
+ sal_uInt16 nTrans = (sal_uInt16)mpMTRTransparent->GetValue();
+ mnLastTransSolid = nTrans;
+ sal_uInt16 nSelectType = mpLBTransType->GetSelectEntryPos();
+ if (nTrans != 0 && nSelectType == 0)
+ mpLBTransType->SelectEntryPos(1);
+ XFillTransparenceItem aLinearItem(nTrans);
+ GetBindings()->GetDispatcher()->Execute( SID_ATTR_FILL_TRANSPARENCE, SFX_CALLMODE_RECORD, &aLinearItem, 0L );
+
+ return 0L;
+}
+
+
+Color AreaPropertyPanel::GetLastColor (void) const
+{
+ return maLastColor;
+}
+
+
+
+
+XGradient AreaPropertyPanel::GetGradient (const XGradientStyle eStyle) const
+{
+ switch (eStyle)
+ {
+ default:
+ case XGRAD_LINEAR:
+ return maGradientLinear;
+ case XGRAD_AXIAL:
+ return maGradientAxial;
+ case XGRAD_RADIAL:
+ return maGradientRadial;
+ case XGRAD_ELLIPTICAL:
+ return maGradientElliptical;
+ case XGRAD_SQUARE:
+ return maGradientSquare;
+ case XGRAD_RECT:
+ return maGradientRect;
+ }
+}
+
+
+
+
+void AreaPropertyPanel::SetGradient (const XGradient& rGradient)
+{
+ switch (rGradient.GetGradientStyle())
+ {
+ case XGRAD_LINEAR:
+ maGradientLinear = rGradient;
+ break;
+ case XGRAD_AXIAL:
+ maGradientAxial = rGradient;
+ break;
+ case XGRAD_RADIAL:
+ maGradientRadial = rGradient;
+ break;
+ case XGRAD_ELLIPTICAL:
+ maGradientElliptical = rGradient;
+ break;
+ case XGRAD_SQUARE:
+ maGradientSquare = rGradient;
+ break;
+ case XGRAD_RECT:
+ maGradientRect = rGradient;
+ break;
+ }
+}
+
+
+
+
+sal_Int32 AreaPropertyPanel::GetSelectedTransparencyTypeIndex (void) const
+{
+ return mpLBTransType->GetSelectEntryPos();
+}
+
+} } // end of namespace svx::sidebar
+
+// eof
diff --git a/svx/source/sidebar/area/AreaPropertyPanel.hrc b/svx/source/sidebar/area/AreaPropertyPanel.hrc
new file mode 100644
index 000000000000..a11a54faaf94
--- /dev/null
+++ b/svx/source/sidebar/area/AreaPropertyPanel.hrc
@@ -0,0 +1,82 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+// RID_SIDEBAR_AREA_PANEL--------------------------------------------------------------
+#define FT_COLOR_LIST 1
+#define TB_COLOR 2
+#define TBI_COLOR 3
+#define IMG_COLOR 5
+
+#define VS_COLOR 1
+
+#define TBI_LEFT 1
+#define TBI_RIGHT 1
+#define TBI_BTX_GRADIENT 51
+#define FL_TRSP_TEXT 4
+
+#define LB_TRGR_TYPES 6
+#define MTR_TRANSPARENT 7
+#define BTN_GRADIENT 8
+
+#define FT_TRGR_CENTER_X 9
+#define MTR_TRGR_CENTER_X 10
+#define FT_TRGR_CENTER_Y 11
+#define MTR_TRGR_CENTER_Y 12
+#define FT_TRGR_ANGLE 13
+#define MTR_TRGR_ANGLE 14
+#define FT_TRGR_START_VALUE 15
+#define MTR_TRGR_START_VALUE 16
+#define FT_TRGR_END_VALUE 17
+#define MTR_TRGR_END_VALUE 18
+#define FT_TRGR_BORDER 19
+#define MTR_TRGR_BORDER 20
+#define STR_HELP_LEFT 24
+#define STR_HELP_RIGHT 25
+
+#define BTN_LEFT_SECOND 22
+#define BTN_RIGHT_FIRST 23
+
+#define IMG_AXIAL 24
+#define IMG_ELLI 25
+#define IMG_QUAD 26
+#define IMG_RADIAL 27
+#define IMG_SQUARE 28
+#define IMG_LINEAR 29
+#define IMG_ROT_LEFT 30
+#define IMG_ROT_RIGHT 31
+#define STR_HELP_TYPE 32
+#define STR_HELP_ATTR 33
+#define STR_HELP_COLOR 41
+#define STR_HELP_GRADIENT 42
+
+#define FIXED_TEXT_HEIGHT 9
+#define FIXED_TEXT_WIDTH 40
+#define MBOX_WIDTH 50
+#define CONTROL_HEIGHT 12
+#define CONTROL_WIDTH 45
+#define LISTBOX_HEIGHT 80
+#define ROTATE_BUTTON_WIDTH 13
+#define ROTATE_BUTTON_SPACING 15
+#define POP_WIDTH 2*POPUPPANEL_MARGIN_HORIZONTAL+2*CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL
+#define POP_HEIGHT 2*POPUPPANEL_MARGIN_VERTICAL + 4*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + MBOX_HEIGHT ) + 3*CONTROL_SPACING_VERTICAL
+#define POP_HEIGHT2 2*POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + MBOX_HEIGHT ) + 2*CONTROL_SPACING_VERTICAL
+#define LEFT_RIGHT_X1 POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL + 1
+#define LEFT_RIGHT_Y1 POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL - 2
+#define LEFT_RIGHT_X2 POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL + ROTATE_BUTTON_SPACING
+#define LEFT_RIGHT_Y2 POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL - 2
+
+// eof
diff --git a/svx/source/sidebar/area/AreaPropertyPanel.hxx b/svx/source/sidebar/area/AreaPropertyPanel.hxx
new file mode 100644
index 000000000000..69617a0cc13a
--- /dev/null
+++ b/svx/source/sidebar/area/AreaPropertyPanel.hxx
@@ -0,0 +1,198 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef SVX_PROPERTYPANEL_AREAPAGE_HXX
+#define SVX_PROPERTYPANEL_AREAPAGE_HXX
+
+#include <svx/sidebar/ColorPopup.hxx>
+#include "AreaTransparencyGradientPopup.hxx"
+#include <vcl/ctrl.hxx>
+#include <sfx2/sidebar/SidebarPanelBase.hxx>
+#include <sfx2/sidebar/ControllerItem.hxx>
+#include <svx/xgrad.hxx>
+#include <svx/itemwin.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xflgrit.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/drawitem.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <svl/intitem.hxx>
+#include <svx/tbxcolorupdate.hxx>
+#include <com/sun/star/ui/XUIElement.hpp>
+#include <boost/scoped_ptr.hpp>
+
+
+class XFillFloatTransparenceItem;
+namespace svx { class ToolboxButtonColorUpdater; }
+
+
+namespace svx { namespace sidebar {
+
+class PopupContainer;
+class AreaTransparencyGradientControl;
+
+class AreaPropertyPanel
+: public Control,
+ public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
+{
+public:
+ static AreaPropertyPanel* Create(
+ Window* pParent,
+ const cssu::Reference<css::frame::XFrame>& rxFrame,
+ SfxBindings* pBindings);
+
+ virtual void DataChanged(
+ const DataChangedEvent& rEvent);
+
+ virtual void NotifyItemUpdate(
+ const sal_uInt16 nSId,
+ const SfxItemState eState,
+ const SfxPoolItem* pState);
+
+ SfxBindings* GetBindings();
+
+ const static sal_Int32 DEFAULT_CENTERX;
+ const static sal_Int32 DEFAULT_CENTERY;
+ const static sal_Int32 DEFAULT_ANGLE;
+ const static sal_Int32 DEFAULT_STARTVALUE;
+ const static sal_Int32 DEFAULT_ENDVALUE;
+ const static sal_Int32 DEFAULT_BORDER;
+
+ XGradient GetGradient (const XGradientStyle eStyle) const;
+ void SetGradient (const XGradient& rGradient);
+ sal_Int32 GetSelectedTransparencyTypeIndex (void) const;
+
+private:
+ sal_uInt16 meLastXFS;
+ Color maLastColor;
+
+ sal_uInt16 mnLastPosGradient;
+ sal_uInt16 mnLastPosHatch;
+ sal_uInt16 mnLastPosBitmap;
+ sal_uInt16 mnLastTransSolid;
+
+ XGradient maGradientLinear;
+ XGradient maGradientAxial;
+ XGradient maGradientRadial;
+ XGradient maGradientElliptical;
+ XGradient maGradientSquare;
+ XGradient maGradientRect;
+
+ //ui controls
+ ::boost::scoped_ptr< FixedText > mpColorTextFT;
+ ::boost::scoped_ptr< SvxFillTypeBox > mpLbFillType;
+ ::boost::scoped_ptr< SvxFillAttrBox > mpLbFillAttr;
+ ::boost::scoped_ptr< Window > mpToolBoxColorBackground;
+ ::boost::scoped_ptr< ToolBox > mpToolBoxColor; // for new color picker
+ ::boost::scoped_ptr< FixedText > mpTrspTextFT;
+ ::boost::scoped_ptr< ListBox > mpLBTransType;
+ ::boost::scoped_ptr< MetricField > mpMTRTransparent;
+ ::boost::scoped_ptr< Window > mpBTNGradientBackground;
+ ::boost::scoped_ptr< ToolBox > mpBTNGradient;
+
+ ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
+
+ ::boost::scoped_ptr< XFillStyleItem > mpStyleItem;
+ ::boost::scoped_ptr< XFillColorItem > mpColorItem;
+ ::boost::scoped_ptr< XFillGradientItem > mpFillGradientItem;
+ ::boost::scoped_ptr< XFillHatchItem > mpHatchItem;
+ ::boost::scoped_ptr< XFillBitmapItem > mpBitmapItem;
+ ::boost::scoped_ptr< SvxColorListItem > mpColorListItem;
+ ::boost::scoped_ptr< SvxGradientListItem > mpGradientListItem;
+ ::boost::scoped_ptr< SvxHatchListItem > mpHatchListItem;
+ ::boost::scoped_ptr< SvxBitmapListItem > mpBitmapListItem;
+
+ ::sfx2::sidebar::ControllerItem maStyleControl;
+ ::sfx2::sidebar::ControllerItem maColorControl;
+ ::sfx2::sidebar::ControllerItem maGradientControl;
+ ::sfx2::sidebar::ControllerItem maHatchControl;
+ ::sfx2::sidebar::ControllerItem maBitmapControl;
+ ::sfx2::sidebar::ControllerItem maColorTableControl;
+ ::sfx2::sidebar::ControllerItem maGradientListControl;
+ ::sfx2::sidebar::ControllerItem maHatchListControl;
+ ::sfx2::sidebar::ControllerItem maBitmapListControl;
+ ::sfx2::sidebar::ControllerItem maFillTransparenceController;
+ ::sfx2::sidebar::ControllerItem maFillFloatTransparenceController;
+
+ Image maImgAxial;
+ Image maImgElli;
+ Image maImgQuad;
+ Image maImgRadial;
+ Image maImgSquare;
+ Image maImgLinear;
+ Image maImgColor;
+
+ String msHelpFillType;
+ String msHelpFillAttr;
+
+ AreaTransparencyGradientPopup maTrGrPopup;
+ ColorPopup maColorPopup;
+
+ ::boost::scoped_ptr< XFillFloatTransparenceItem > mpFloatTransparenceItem;
+ ::boost::scoped_ptr< SfxUInt16Item > mpTransparanceItem;
+
+ cssu::Reference<css::frame::XFrame> mxFrame;
+ SfxBindings* mpBindings;
+
+ /// bitfield
+ bool mbTBShow : 1;
+ bool mbColorAvail : 1;
+
+ DECL_LINK(SelectFillTypeHdl, ListBox* );
+ DECL_LINK(SelectFillAttrHdl, ListBox* );
+ DECL_LINK(ChangeTrgrTypeHdl_Impl, void*);
+ DECL_LINK(ModifyTransparentHdl_Impl, void*);
+ DECL_LINK( ImplPopupModeEndHdl, FloatingWindow* );
+
+ // for transparency gradient
+ PopupControl* CreateTransparencyGradientControl (PopupContainer* pParent);
+ DECL_LINK( ClickTrGrHdl_Impl, ToolBox* );
+
+ // for color picker
+ PopupControl* CreateColorPopupControl (PopupContainer* pParent);
+ DECL_LINK(ToolBoxColorDropHdl, ToolBox *); //for new color picker
+
+ // constructor/destuctor
+ AreaPropertyPanel(
+ Window* pParent,
+ const cssu::Reference<css::frame::XFrame>& rxFrame,
+ SfxBindings* pBindings);
+ virtual ~AreaPropertyPanel(void);
+
+ void SetupIcons(void);
+ void Initialize();
+ void Update();
+ void ImpUpdateTransparencies();
+
+ Color GetLastColor (void) const;
+ void SetColor (
+ const String& rsColorName,
+ const Color aColor);
+};
+
+
+} } // end of namespace ::svx::sidebar
+
+
+
+#endif // SVX_PROPERTYPANEL_AREAPAGE_HXX
+
+// eof
diff --git a/svx/source/sidebar/area/AreaPropertyPanel.src b/svx/source/sidebar/area/AreaPropertyPanel.src
new file mode 100644
index 000000000000..32696ed78b60
--- /dev/null
+++ b/svx/source/sidebar/area/AreaPropertyPanel.src
@@ -0,0 +1,389 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include "AreaPropertyPanel.hrc"
+#include <sfx2/sidebar/ResourceDefinitions.hrc>
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+
+#define TOOLBOX_WIDTH 50
+#define TOOLBOX_HEIGHT 17
+
+Control RID_SIDEBAR_AREA_PANEL
+{
+ OutputSize = TRUE;
+ DialogControl = TRUE;
+ Border = FALSE;
+ Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, SECTIONPAGE_MARGIN_VERTICAL_TOP + SECTIONPAGE_MARGIN_VERTICAL_BOT + 2*( FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + CBOX_HEIGHT) + CONTROL_SPACING_VERTICAL );
+ HelpID = HID_PROPERTYPANEL_AREA_SECTION ;
+ Text [ en-US ] = "Area";
+
+ FixedText FT_COLOR_LIST
+ {
+ Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP ) ;
+ Size = MAP_APPFONT ( FIXED_TEXT_WIDTH + 50, FIXED_TEXT_HEIGHT ) ;
+ Text [ en-US ] = "~Fill:";
+ };
+ FixedText FL_TRSP_TEXT
+ {
+ Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL ) ;
+ Size = MAP_APPFONT ( FIXED_TEXT_WIDTH + 50, FIXED_TEXT_HEIGHT ) ;
+ Text [ en-US ] = "~Transparency:";
+ };
+ ToolBox TB_COLOR
+ {
+ HelpID = HID_PPROPERTYPANEL_AREA_TBX_COLOR;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + FIXED_TEXT_HEIGHT + 1) ;
+ Size = MAP_APPFONT (TOOLBOX_WIDTH ,TOOLBOX_HEIGHT ) ;
+ TabStop = TRUE ;
+ Text = "Color";
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = TBI_COLOR ;
+ HelpID = HID_PPROPERTYPANEL_AREA_TBI_COLOR;
+ DropDown = TRUE ;
+ Text = "Color" ;
+ };
+ };
+ };
+ String STR_HELP_COLOR
+ {
+ Text [ en-US ] = "Select the color to apply." ;
+ };
+ String STR_HELP_TYPE
+ {
+ Text [en-US] = "Select the fill type to apply.";
+ };
+ String STR_HELP_ATTR
+ {
+ Text [en-US] = "Select the effect to apply.";
+ };
+ Image IMG_AXIAL
+ {
+ ImageBitmap = Bitmap{File = "symphony/axial.png";};
+ };
+ Image IMG_ELLI
+ {
+ ImageBitmap = Bitmap{File = "symphony/ellipsoid.png";};
+ };
+ Image IMG_QUAD
+ {
+ ImageBitmap = Bitmap{File = "symphony/Quadratic.png";};
+ };
+ Image IMG_RADIAL
+ {
+ ImageBitmap = Bitmap{File = "symphony/radial.png";};
+ };
+ Image IMG_SQUARE
+ {
+ ImageBitmap = Bitmap{File = "symphony/Square.png";};
+ };
+ Image IMG_LINEAR
+ {
+ ImageBitmap = Bitmap{File = "symphony/linear.png";};
+ };
+ Image IMG_COLOR
+ {
+ ImageBitmap = Bitmap{File = "symphony/fill_color.png";};
+ };
+
+ //=====================================================================================================================================
+ ListBox LB_TRGR_TYPES
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL ) ;
+ Size = MAP_APPFONT ( MBOX_WIDTH , LISTBOX_HEIGHT ) ;
+ QuickHelpText [ en-US ] = "Select the type of transparence to apply." ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ HelpID = HID_PPROPERTYPANEL_AREA_LB_TRGR_TYPES ;
+ StringList [ en-US ] =
+ {
+ < "None" ; Default ; > ;
+ < "Solid" ; Default ; > ;
+ < "Linear" ; Default ; > ;
+ < "Axial" ; Default ; > ;
+ < "Radial" ; Default ; > ;
+ < "Ellipsoid" ; Default ; > ;
+ < "Quadratic" ; Default ; > ;
+ < "Square" ; Default ; > ;
+ };
+ };
+
+ MetricField MTR_TRANSPARENT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL ) ;
+ Size = MAP_APPFONT ( MBOX_WIDTH + 1 ,MBOX_HEIGHT ) ;
+ HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRANSPARENT ;
+ QuickHelpText [ en-US ] = "Specify 0% for fully opaque through 100% for fully transparent." ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+
+ ToolBox BTN_GRADIENT
+ {
+ Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL ) ;
+ HelpID = HID_PPROPERTYPANEL_AREA_TBX_GRADIENT ;
+ SVLook = TRUE ;
+ Border = FALSE ;
+ TabStop = TRUE ;
+ Text = "Gradient";
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = TBI_BTX_GRADIENT ;
+ HelpID = HID_PPROPERTYPANEL_AREA_TBI_GRADIENT ;
+ ItemBitmap = Bitmap
+ {
+ File = "symphony/linear.png" ;
+ };
+ DropDown = TRUE;
+ Text = "Gradient" ;
+ };
+ };
+ };
+ String STR_HELP_GRADIENT
+ {
+ Text [ en-US ] = "Specify the variation of gradient transparency." ;
+ };
+};
+
+Control RID_POPUPPANEL_AREAPAGE_TRGR
+{
+ OutputSize = TRUE;
+ DialogControl = TRUE;
+ Border = FALSE;
+
+// Size = MAP_APPFONT( POP_WIDTH, POP_HEIGHT );
+
+ FixedText FT_TRGR_CENTER_X
+ {
+ Size = MAP_APPFONT ( CONTROL_WIDTH , FIXED_TEXT_HEIGHT ) ;
+ Text [ en-US ] = "Center ~X:";
+ };
+ MetricField MTR_TRGR_CENTER_X
+ {
+ Border = TRUE ;
+ Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ;
+ HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_X ;
+ QuickHelpText [ en-US ] = "Specify the horizontal offset percentage from the center for the gradient shading style. 50% is the horizontal center." ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_TRGR_CENTER_Y
+ {
+ Size = MAP_APPFONT ( CONTROL_WIDTH + POPUPPANEL_MARGIN_HORIZONTAL, FIXED_TEXT_HEIGHT ) ;//wj
+ Text [ en-US ] = "Center ~Y:";
+ };
+ MetricField MTR_TRGR_CENTER_Y
+ {
+ Border = TRUE ;
+ Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ;
+ HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_Y ;
+ QuickHelpText [ en-US ] = "Specify the vertical offset percentage from the center for the gradient shading style. 50% is the vertical center." ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_TRGR_ANGLE
+ {
+ Size = MAP_APPFONT ( CONTROL_WIDTH * 2 + POPUPPANEL_MARGIN_HORIZONTAL + CONTROL_SPACING_HORIZONTAL, FIXED_TEXT_HEIGHT ) ;//wj
+ Text [ en-US ] = "~Angle:";
+ };
+ MetricField MTR_TRGR_ANGLE
+ {
+ Border = TRUE ;
+ Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ;
+ HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_ANGLE ;
+ QuickHelpText [ en-US ] = "Specify the angle of rotation for the gradient shading style." ;
+ TabStop = FALSE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -9999 ;
+ Maximum = 9999 ;
+ Unit = FUNIT_CUSTOM ;
+ SpinSize = 1 ;
+ CustomUnitText [ en-US ] = " degrees";
+ };
+ FixedText FT_TRGR_START_VALUE
+ {
+ Size = MAP_APPFONT ( CONTROL_WIDTH , FIXED_TEXT_HEIGHT ) ;
+ Text [ en-US ] = "~Start value:";
+ };
+ MetricField MTR_TRGR_START_VALUE
+ {
+ Border = TRUE ;
+ Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ;
+ HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_SVALUE ;
+ QuickHelpText [ en-US ] = "Enter a transparency value for the beginning point of the gradient, where 0% is fully opaque and 100% is fully transparent." ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_TRGR_END_VALUE
+ {
+ Size = MAP_APPFONT (CONTROL_WIDTH + POPUPPANEL_MARGIN_HORIZONTAL, FIXED_TEXT_HEIGHT ) ; //wj
+ Text [ en-US ] = "~End value:";
+ };
+ MetricField MTR_TRGR_END_VALUE
+ {
+ Border = TRUE ;
+ Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ;
+ HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_EVALUE ;
+ QuickHelpText [ en-US ] = "Enter a transparency value for the endpoint of the gradient, where 0% is fully opaque and 100% is fully transparent." ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_TRGR_BORDER
+ {
+ Size = MAP_APPFONT ( CONTROL_WIDTH * 2 + POPUPPANEL_MARGIN_HORIZONTAL + CONTROL_SPACING_HORIZONTAL, FIXED_TEXT_HEIGHT ) ; //
+ Text [ en-US ] = "~Border:";
+ };
+ MetricField MTR_TRGR_BORDER
+ {
+ Border = TRUE ;
+ Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ;
+ HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_BORDER ;
+ QuickHelpText [ en-US ] = "Specify the border value of gradient transparence." ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ //=====================================================================================================================================
+
+ ToolBox BTN_LEFT_SECOND
+ {
+ Border = FALSE ;
+ HelpID = HID_PPROPERTYPANEL_AREA_BTN_LEFT_SECOND ;
+ SVLook = TRUE ;
+ Border = FALSE ;
+ TabStop = TRUE ;
+ Text = "Rotate Left";
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = TBI_LEFT ;
+ Text = "Rotate Left" ;
+ ItemBitmap = Bitmap
+ {
+ // File = "symphony/rotate_left.png" ;
+ };
+ };
+ };
+ };
+ ToolBox BTN_RIGHT_FIRST
+ {
+ Border = FALSE ;
+ HelpID = HID_PPROPERTYPANEL_AREA_BTN_RIGHT_FIRST ;
+ SVLook = TRUE ;
+ Border = FALSE ;
+ TabStop = TRUE ;
+ Text = "Rotate Right";
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = TBI_RIGHT ;
+ Text = "Rotate Right" ;
+ ItemBitmap = Bitmap
+ {
+ // File = "symphony/rotate_right.png" ;
+ };
+ };
+ };
+ };
+ String STR_HELP_LEFT
+ {
+ Text [ en-US ] = "Rotate counterclockwise by 45 degrees." ;
+ };
+ String STR_HELP_RIGHT
+ {
+ Text [ en-US ] = "Rotate clockwise by 45 degrees." ;
+ };
+ Image IMG_ROT_LEFT
+ {
+ ImageBitmap = Bitmap{File = "symphony/rotate_left.png";};
+ };
+ Image IMG_ROT_RIGHT
+ {
+ ImageBitmap = Bitmap{File = "symphony/rotate_right.png";};
+ };
+};
+Control RID_POPUPPANEL_AERAPAGE_COLOR
+{
+ OutputSize = TRUE;
+ DialogControl = TRUE;
+ Border = FALSE;
+ Size = MAP_APPFONT( POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT );
+
+ Control VS_COLOR
+ {
+ HelpID = HID_PPROPERTYPANEL_AREA_COLOR_VS;
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( OFFSET_X , OFFSET_Y );
+ Size = MAP_APPFONT ( POPUP_COLOR_PICKER_WIDTH - OFFSET_X * 2, POPUP_COLOR_PICKER_HEIGHT - OFFSET_Y * 2);
+ TabStop = TRUE ;
+ Text = "Color";
+ };
+};
+
+// eof
diff --git a/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx b/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx
new file mode 100644
index 000000000000..92ebdeeba927
--- /dev/null
+++ b/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx
@@ -0,0 +1,345 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include "AreaTransparencyGradientControl.hxx"
+#include "AreaPropertyPanel.hxx"
+#include "AreaPropertyPanel.hrc"
+
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <svx/xflftrit.hxx>
+#include <sfx2/sidebar/ResourceDefinitions.hrc>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+
+namespace svx { namespace sidebar {
+
+// positioning helpers
+#define APOS1_1 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL), MAP_APPFONT))
+#define APOS2_1 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL), MAP_APPFONT))
+#define APOS1_2 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL), MAP_APPFONT))
+#define APOS2_2 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL), MAP_APPFONT))
+#define APOS1_3 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MAP_APPFONT))
+#define APOS1_4 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MAP_APPFONT))
+#define APOS2_3 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MAP_APPFONT))
+#define APOS2_4 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MAP_APPFONT))
+#define APOS1_5 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT))
+#define APOS1_6 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+2*(MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT))
+#define APOS2_5 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT))
+#define APOS2_6 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+2*(MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT))
+#define APOS1_7 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT))
+#define APOS1_8 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 4*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+3*(MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT))
+#define APOS_Left_Right_1 Point(LogicToPixel(Point(LEFT_RIGHT_X1,LEFT_RIGHT_Y1), MAP_APPFONT))
+#define APOS_Left_Right_2 Point(LogicToPixel(Point(LEFT_RIGHT_X2,LEFT_RIGHT_Y1), MAP_APPFONT))
+#define APOS_Left_Right_3 Point(LogicToPixel(Point(LEFT_RIGHT_X1,LEFT_RIGHT_Y2), MAP_APPFONT))
+#define APOS_Left_Right_4 Point(LogicToPixel(Point(LEFT_RIGHT_X2,LEFT_RIGHT_Y2), MAP_APPFONT))
+
+
+
+
+AreaTransparencyGradientControl::AreaTransparencyGradientControl (
+ Window* pParent,
+ AreaPropertyPanel& rPanel)
+ : PopupControl( pParent,SVX_RES(RID_POPUPPANEL_AREAPAGE_TRGR)),
+ maFtTrgrCenterX(this, SVX_RES(FT_TRGR_CENTER_X)),
+ maMtrTrgrCenterX(this, SVX_RES(MTR_TRGR_CENTER_X)),
+ maFtTrgrCenterY(this, SVX_RES(FT_TRGR_CENTER_Y)),
+ maMtrTrgrCenterY(this, SVX_RES(MTR_TRGR_CENTER_Y)),
+ maFtTrgrAngle(this, SVX_RES(FT_TRGR_ANGLE)),
+ maMtrTrgrAngle(this, SVX_RES(MTR_TRGR_ANGLE)),
+ maBtnLeft45(this, SVX_RES(BTN_LEFT_SECOND)),
+ maBtnRight45(this, SVX_RES(BTN_RIGHT_FIRST)),
+ maFtTrgrStartValue(this, SVX_RES(FT_TRGR_START_VALUE)),
+ maMtrTrgrStartValue(this, SVX_RES(MTR_TRGR_START_VALUE)),
+ maFtTrgrEndValue(this, SVX_RES(FT_TRGR_END_VALUE)),
+ maMtrTrgrEndValue(this, SVX_RES(MTR_TRGR_END_VALUE)),
+ maFtTrgrBorder(this, SVX_RES(FT_TRGR_BORDER)),
+ maMtrTrgrBorder(this, SVX_RES(MTR_TRGR_BORDER)),
+ maRotLeft( SVX_RES(IMG_ROT_LEFT)),
+ maRotRight( SVX_RES(IMG_ROT_RIGHT)),
+ mrAreaPropertyPanel(rPanel),
+ mpBindings(NULL)
+{
+ Link aLink = LINK( this, AreaTransparencyGradientControl, ModifiedTrgrHdl_Impl);
+ maMtrTrgrCenterX.SetModifyHdl( aLink );
+ maMtrTrgrCenterY.SetModifyHdl( aLink );
+ maMtrTrgrAngle.SetModifyHdl( aLink );
+ maMtrTrgrBorder.SetModifyHdl( aLink );
+ maMtrTrgrStartValue.SetModifyHdl( aLink );
+ maMtrTrgrEndValue.SetModifyHdl( aLink );
+ aLink = LINK( this, AreaTransparencyGradientControl, Left_Click45_Impl);
+ maBtnLeft45.SetSelectHdl( aLink );
+ aLink = LINK( this, AreaTransparencyGradientControl, Right_Click45_Impl);
+ maBtnRight45.SetSelectHdl( aLink );
+ maBtnLeft45.SetItemImage(1,maRotLeft);
+ Size aTbxSize = maBtnLeft45.CalcWindowSizePixel();
+ maBtnLeft45.SetOutputSizePixel( aTbxSize );
+ maBtnLeft45.SetQuickHelpText(1, String(SVX_RES(STR_HELP_LEFT))); //acc wj
+
+ maBtnRight45.SetItemImage(1,maRotRight);
+ aTbxSize = maBtnRight45.CalcWindowSizePixel();
+ maBtnRight45.SetOutputSizePixel( aTbxSize );
+ maBtnRight45.SetQuickHelpText(1, String(SVX_RES(STR_HELP_RIGHT))); //acc wj
+
+ maBtnLeft45.SetBackground(Wallpaper());
+ maBtnLeft45.SetPaintTransparent(true);
+ maBtnRight45.SetBackground(Wallpaper());
+ maBtnRight45.SetPaintTransparent(true);
+
+ FreeResource();
+ mpBindings = mrAreaPropertyPanel.GetBindings();
+}
+
+
+
+
+AreaTransparencyGradientControl::~AreaTransparencyGradientControl (void)
+{
+}
+
+
+
+
+void AreaTransparencyGradientControl::ToGetFocus()
+{
+ if(maMtrTrgrCenterX.IsVisible())
+ maMtrTrgrCenterX.GrabFocus();
+ else
+ maMtrTrgrAngle.GrabFocus();
+}
+
+
+
+
+void AreaTransparencyGradientControl::Rearrange(XFillFloatTransparenceItem* pGradientItem)
+{
+ InitStatus(pGradientItem);
+ const XGradient& rGradient = pGradientItem->GetGradientValue();
+ XGradientStyle eXGS(rGradient.GetGradientStyle());
+ Size aSize(POP_WIDTH,POP_HEIGHT);
+ aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
+ Size aSize2(POP_WIDTH,POP_HEIGHT2);
+ aSize2 = LogicToPixel( aSize2, MapMode(MAP_APPFONT) );
+ long aPosY = 0;
+ Point aPointAngle;
+ Size aSizeAngle = maMtrTrgrAngle.GetSizePixel();
+ Size aTbxSize = maBtnLeft45.CalcWindowSizePixel();
+
+ switch(eXGS)
+ {
+ case XGRAD_LINEAR:
+ case XGRAD_AXIAL:
+ maFtTrgrCenterX.Hide();
+ maMtrTrgrCenterX.Hide();
+ maFtTrgrCenterY.Hide();
+ maMtrTrgrCenterY.Hide();
+ maFtTrgrAngle.Show();
+ maFtTrgrAngle.SetPosPixel(APOS1_1);
+ maMtrTrgrAngle.Show();
+ maMtrTrgrAngle.SetPosPixel(APOS2_1);
+ maFtTrgrStartValue.SetPosPixel(APOS1_3);
+ maMtrTrgrStartValue.SetPosPixel(APOS1_4);
+ maFtTrgrEndValue.SetPosPixel(APOS2_3);
+ maMtrTrgrEndValue.SetPosPixel(APOS2_4);
+ maFtTrgrBorder.SetPosPixel(APOS1_5);
+ maMtrTrgrBorder.SetPosPixel(APOS1_6);
+
+ maBtnLeft45.Show();
+ maBtnRight45.Show();
+
+ aPointAngle = maMtrTrgrAngle.GetPosPixel();
+ aPosY = aPointAngle.getY() + aSizeAngle.getHeight() - aTbxSize.getHeight();
+
+ maBtnLeft45.SetPosPixel(Point(APOS_Left_Right_1.getX(), aPosY));
+ maBtnRight45.SetPosPixel(Point(APOS_Left_Right_2.getX(), aPosY));
+
+ SetSizePixel(aSize2);
+ break;
+
+ case XGRAD_RADIAL:
+ maFtTrgrCenterX.Show();
+ maFtTrgrCenterX.SetPosPixel(APOS1_1);
+ maMtrTrgrCenterX.Show();
+ maMtrTrgrCenterX.SetPosPixel(APOS2_1);
+ maFtTrgrCenterY.Show();
+ maFtTrgrCenterY.SetPosPixel(APOS1_2);
+ maMtrTrgrCenterY.Show();
+ maMtrTrgrCenterY.SetPosPixel(APOS2_2);
+ maFtTrgrAngle.Hide();
+ maMtrTrgrAngle.Hide();
+ maFtTrgrStartValue.SetPosPixel(APOS1_3);
+ maMtrTrgrStartValue.SetPosPixel(APOS1_4);
+ maFtTrgrEndValue.SetPosPixel(APOS2_3);
+ maMtrTrgrEndValue.SetPosPixel(APOS2_4);
+ maFtTrgrBorder.SetPosPixel(APOS1_5);
+ maMtrTrgrBorder.SetPosPixel(APOS1_6);
+
+ maBtnLeft45.Hide();
+ maBtnRight45.Hide();
+
+ SetSizePixel(aSize2);
+
+ break;
+
+ case XGRAD_ELLIPTICAL:
+ case XGRAD_SQUARE:
+ case XGRAD_RECT:
+ maFtTrgrCenterX.Show();
+ maFtTrgrCenterX.SetPosPixel(APOS1_1);
+ maMtrTrgrCenterX.Show();
+ maMtrTrgrCenterX.SetPosPixel(APOS2_1);
+ maFtTrgrCenterY.Show();
+ maFtTrgrCenterY.SetPosPixel(APOS1_2);
+ maMtrTrgrCenterY.Show();
+ maMtrTrgrCenterY.SetPosPixel(APOS2_2);
+ maFtTrgrAngle.Show();
+ maFtTrgrAngle.SetPosPixel(APOS1_3);
+ maMtrTrgrAngle.Show();
+ maMtrTrgrAngle.SetPosPixel(APOS1_4);
+
+ maFtTrgrStartValue.SetPosPixel(APOS1_5);
+ maMtrTrgrStartValue.SetPosPixel(APOS1_6);
+ maFtTrgrEndValue.SetPosPixel(APOS2_5);
+ maMtrTrgrEndValue.SetPosPixel(APOS2_6);
+ maFtTrgrBorder.SetPosPixel(APOS1_7);
+ maMtrTrgrBorder.SetPosPixel(APOS1_8);
+
+ maBtnLeft45.Show();
+ maBtnRight45.Show();
+
+ aPointAngle = maMtrTrgrAngle.GetPosPixel();
+ aPosY = aPointAngle.getY() + aSizeAngle.getHeight() - aTbxSize.getHeight();
+
+ maBtnLeft45.SetPosPixel(Point(APOS_Left_Right_3.getX(), aPosY));
+ maBtnRight45.SetPosPixel(Point(APOS_Left_Right_4.getX(), aPosY));
+
+ SetSizePixel(aSize);
+
+ break;
+ }
+}
+
+
+
+
+void AreaTransparencyGradientControl::InitStatus(XFillFloatTransparenceItem* pGradientItem)
+{
+ const XGradient& rGradient = pGradientItem->GetGradientValue();
+
+ XGradient aGradient;
+
+ if (rGradient.GetXOffset() == AreaPropertyPanel::DEFAULT_CENTERX
+ && rGradient.GetYOffset() == AreaPropertyPanel::DEFAULT_CENTERY
+ && (rGradient.GetAngle() / 10) == AreaPropertyPanel::DEFAULT_ANGLE
+ && ((sal_uInt16)((((sal_uInt16)rGradient.GetStartColor().GetRed() + 1) * 100) / 255))
+ == AreaPropertyPanel::DEFAULT_STARTVALUE
+ && ((sal_uInt16)((((sal_uInt16)rGradient.GetEndColor().GetRed() + 1) * 100) / 255))
+ == AreaPropertyPanel::DEFAULT_ENDVALUE
+ && rGradient.GetBorder() == AreaPropertyPanel::DEFAULT_BORDER)
+ {
+ aGradient = mrAreaPropertyPanel.GetGradient(rGradient.GetGradientStyle());
+ }
+ else
+ {
+ aGradient = rGradient;
+ }
+ maMtrTrgrCenterX.SetValue(aGradient.GetXOffset());
+ maMtrTrgrCenterY.SetValue(aGradient.GetYOffset());
+ maMtrTrgrAngle.SetValue(aGradient.GetAngle() / 10);
+ maMtrTrgrStartValue.SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetStartColor().GetRed() + 1) * 100) / 255));
+ maMtrTrgrEndValue.SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetEndColor().GetRed() + 1) * 100) / 255));
+ maMtrTrgrBorder.SetValue(aGradient.GetBorder());
+}
+
+
+
+
+void AreaTransparencyGradientControl::ExecuteValueModify( sal_uInt8 nStartCol, sal_uInt8 nEndCol )
+{
+ //Added
+ sal_Int16 aMtrValue = (sal_Int16)maMtrTrgrAngle.GetValue();
+ while(aMtrValue<0)
+ aMtrValue += 360;
+ sal_uInt16 nVal = aMtrValue/360;
+ nVal = aMtrValue - nVal*360;
+ maMtrTrgrAngle.SetValue(nVal);
+ //End of new code
+ XGradient aTmpGradient(
+ Color(nStartCol, nStartCol, nStartCol),
+ Color(nEndCol, nEndCol, nEndCol),
+ (XGradientStyle)(mrAreaPropertyPanel.GetSelectedTransparencyTypeIndex()-2),
+ (sal_uInt16)maMtrTrgrAngle.GetValue() * 10,
+ (sal_uInt16)maMtrTrgrCenterX.GetValue(),
+ (sal_uInt16)maMtrTrgrCenterY.GetValue(),
+ (sal_uInt16)maMtrTrgrBorder.GetValue(),
+ 100, 100);
+
+ mrAreaPropertyPanel.SetGradient(aTmpGradient);
+
+ SfxItemPool* pPool = NULL;
+ bool bEnable = true;
+ XFillFloatTransparenceItem aGradientItem(pPool,aTmpGradient, bEnable );
+
+ mpBindings->GetDispatcher()->Execute( SID_ATTR_FILL_FLOATTRANSPARENCE, SFX_CALLMODE_RECORD, &aGradientItem, 0L );
+}
+
+
+
+
+IMPL_LINK_NOARG(AreaTransparencyGradientControl, ModifiedTrgrHdl_Impl)
+{
+ sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100);
+ sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100);
+ ExecuteValueModify( nStartCol, nEndCol );
+ return( 0L );
+}
+
+
+
+
+IMPL_LINK_NOARG(AreaTransparencyGradientControl, Left_Click45_Impl)
+{
+ sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100);
+ sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100);
+ sal_uInt16 aTemp = (sal_uInt16)maMtrTrgrAngle.GetValue();
+ if(aTemp>=315)
+ aTemp -= 360;
+ aTemp += 45;
+ maMtrTrgrAngle.SetValue(aTemp);
+ ExecuteValueModify( nStartCol, nEndCol );
+ return( 0L );
+}
+
+
+
+
+IMPL_LINK_NOARG(AreaTransparencyGradientControl, Right_Click45_Impl)
+{
+ sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100);
+ sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100);
+ sal_uInt16 aTemp = (sal_uInt16)maMtrTrgrAngle.GetValue();
+ if(aTemp<45)
+ aTemp += 360;
+ aTemp -= 45;
+ maMtrTrgrAngle.SetValue(aTemp);
+ ExecuteValueModify( nStartCol, nEndCol );
+ return( 0L );
+}
+
+} } // end of namespace svx::sidebar
+
+// eof
diff --git a/svx/source/sidebar/area/AreaTransparencyGradientControl.hxx b/svx/source/sidebar/area/AreaTransparencyGradientControl.hxx
new file mode 100644
index 000000000000..5d31d44d5b8b
--- /dev/null
+++ b/svx/source/sidebar/area/AreaTransparencyGradientControl.hxx
@@ -0,0 +1,74 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include "svx/sidebar/PopupControl.hxx"
+
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <vcl/toolbox.hxx>
+#include <svx/xenum.hxx>
+
+class XFillFloatTransparenceItem;
+class SfxBindings;
+
+namespace svx { namespace sidebar {
+
+class AreaPropertyPanel;
+
+class AreaTransparencyGradientControl : public PopupControl
+{
+public:
+ AreaTransparencyGradientControl (
+ Window* pParent,
+ AreaPropertyPanel& rPanel);
+ virtual ~AreaTransparencyGradientControl (void);
+
+ void ToGetFocus();
+ void Rearrange(XFillFloatTransparenceItem* pGradientItem);
+ void InitStatus(XFillFloatTransparenceItem* pGradientItem);
+ void ExecuteValueModify( sal_uInt8 nStartCol, sal_uInt8 nEndCol );
+ void SetControlState_Impl(XGradientStyle eXGS);
+
+private:
+ FixedText maFtTrgrCenterX;
+ MetricField maMtrTrgrCenterX;
+ FixedText maFtTrgrCenterY;
+ MetricField maMtrTrgrCenterY;
+ FixedText maFtTrgrAngle;
+ MetricField maMtrTrgrAngle;
+ ToolBox maBtnLeft45;
+ ToolBox maBtnRight45;
+ FixedText maFtTrgrStartValue;
+ MetricField maMtrTrgrStartValue;
+ FixedText maFtTrgrEndValue;
+ MetricField maMtrTrgrEndValue;
+ FixedText maFtTrgrBorder;
+ MetricField maMtrTrgrBorder;
+ Image maRotLeft;
+ Image maRotRight;
+
+ AreaPropertyPanel& mrAreaPropertyPanel;
+ SfxBindings* mpBindings;
+ DECL_LINK( ModifiedTrgrHdl_Impl, void* );
+ DECL_LINK( Left_Click45_Impl, void* );
+ DECL_LINK( Right_Click45_Impl, void* );
+};
+
+
+} } // end of namespace svx::sidebar
+
+// eof
diff --git a/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx b/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx
new file mode 100644
index 000000000000..4ae8c7edcaae
--- /dev/null
+++ b/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx
@@ -0,0 +1,56 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include "AreaTransparencyGradientPopup.hxx"
+#include "AreaTransparencyGradientControl.hxx"
+
+
+namespace svx { namespace sidebar {
+
+AreaTransparencyGradientPopup::AreaTransparencyGradientPopup (
+ Window* pParent,
+ const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator)
+ : Popup(
+ pParent,
+ rControlCreator,
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency and Gradient")))
+{
+}
+
+
+
+
+AreaTransparencyGradientPopup::~AreaTransparencyGradientPopup (void)
+{
+}
+
+
+
+
+void AreaTransparencyGradientPopup::Rearrange (XFillFloatTransparenceItem* pItem)
+{
+ ProvideContainerAndControl();
+
+ AreaTransparencyGradientControl* pControl = dynamic_cast<AreaTransparencyGradientControl*>(mpControl.get());
+ if (pControl != NULL)
+ pControl->Rearrange(pItem);
+}
+
+
+} } // end of namespace svx::sidebar
+
+// eof
diff --git a/svx/source/sidebar/area/AreaTransparencyGradientPopup.hxx b/svx/source/sidebar/area/AreaTransparencyGradientPopup.hxx
new file mode 100644
index 000000000000..7c11f6b535d6
--- /dev/null
+++ b/svx/source/sidebar/area/AreaTransparencyGradientPopup.hxx
@@ -0,0 +1,47 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_SIDEBAR_TRANSPARENCY_GRADIENT_POPUP_HXX_
+#define _SVX_SIDEBAR_TRANSPARENCY_GRADIENT_POPUP_HXX_
+
+#include "svx/sidebar/Popup.hxx"
+
+#include <boost/function.hpp>
+
+
+class XFillFloatTransparenceItem;
+
+
+namespace svx { namespace sidebar {
+
+class AreaTransparencyGradientPopup
+ : public Popup
+{
+public :
+ AreaTransparencyGradientPopup (
+ Window* pParent,
+ const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator);
+ ~AreaTransparencyGradientPopup (void);
+
+ void Rearrange (XFillFloatTransparenceItem* pItem);
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
+
+// eof