Kaydet (Commit) 647b9681 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

cleanup sidebar: LinePropertyPanel

Change-Id: Ic8de5d12ee83713b04e947fbabfe1a1184f868ca
üst 6ce97778
......@@ -53,13 +53,15 @@
using namespace css;
using namespace css::uno;
using ::sfx2::sidebar::Theme;
using sfx2::sidebar::Theme;
const char UNO_SELECTWIDTH[] = ".uno:SelectWidth";
namespace {
void FillLineEndListBox(ListBox& rListBoxStart, ListBox& rListBoxEnd, const XLineEndList& rList)
{
namespace
{
void FillLineEndListBox(ListBox& rListBoxStart, ListBox& rListBoxEnd, const XLineEndList& rList)
{
const sal_uInt32 nCount(rList.Count());
const OUString sNone(SVX_RESSTR(RID_SVXSTR_NONE));
......@@ -82,7 +84,7 @@ namespace {
{
Bitmap aCopyStart(aBitmap);
Bitmap aCopyEnd(aBitmap);
// delete pBitmap;
const Size aBmpSize(aCopyStart.GetSizePixel());
const Rectangle aCropRectStart(Point(), Size(aBmpSize.Width() / 2, aBmpSize.Height()));
const Rectangle aCropRectEnd(Point(aBmpSize.Width() / 2, 0), Size(aBmpSize.Width() / 2, aBmpSize.Height()));
......@@ -106,10 +108,10 @@ namespace {
rListBoxStart.SetUpdateMode(true);
rListBoxEnd.SetUpdateMode(true);
}
}
void FillLineStyleListBox(ListBox& rListBox, const XDashList& rList)
{
void FillLineStyleListBox(ListBox& rListBox, const XDashList& rList)
{
const sal_uInt32 nCount(rList.Count());
rListBox.SetUpdateMode(false);
......@@ -129,10 +131,7 @@ namespace {
if(!aBitmap.IsEmpty())
{
rListBox.InsertEntry(
pEntry->GetName(),
Image(aBitmap));
// delete pBitmap;
rListBox.InsertEntry(pEntry->GetName(), Image(aBitmap));
}
else
{
......@@ -141,16 +140,15 @@ namespace {
}
rListBox.SetUpdateMode(true);
}
} // end of anonymous namespace
}
// namespace open
} // end of anonymous namespace
namespace svx { namespace sidebar {
LinePropertyPanel::LinePropertyPanel(
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
const uno::Reference<frame::XFrame>& rxFrame,
SfxBindings* pBindings)
: PanelLayout(pParent, "LinePropertyPanel", "svx/ui/sidebarline.ui", rxFrame),
maStyleControl(SID_ATTR_LINE_STYLE, *pBindings, *this),
......@@ -194,14 +192,10 @@ LinePropertyPanel::LinePropertyPanel(
Initialize();
}
LinePropertyPanel::~LinePropertyPanel()
{
}
void LinePropertyPanel::Initialize()
{
mpIMGWidthIcon.reset(new Image[8]);
......@@ -235,16 +229,16 @@ void LinePropertyPanel::Initialize()
SelectEndStyle(false);
aLink = LINK( this, LinePropertyPanel, ChangeStartHdl );
mpLBStart->SetSelectHdl( aLink );
mpLBStart->SetAccessibleName(OUString( "Beginning Style")); //wj acc
mpLBStart->SetAccessibleName(OUString("Beginning Style")); //wj acc
mpLBStart->AdaptDropDownLineCountToMaximum();
aLink = LINK( this, LinePropertyPanel, ChangeEndHdl );
mpLBEnd->SetSelectHdl( aLink );
mpLBEnd->SetAccessibleName(OUString( "Ending Style")); //wj acc
mpLBEnd->SetAccessibleName(OUString("Ending Style")); //wj acc
mpLBEnd->AdaptDropDownLineCountToMaximum();
aLink = LINK(this, LinePropertyPanel, ChangeTransparentHdl);
mpMFTransparent->SetModifyHdl(aLink);
mpMFTransparent->SetAccessibleName(OUString( "Transparency")); //wj acc
mpMFTransparent->SetAccessibleName(OUString("Transparency")); //wj acc
mpTBWidth->SetAccessibleRelationLabeledBy(mpFTWidth);
mpLBStyle->SetAccessibleRelationLabeledBy(mpFTStyle);
......@@ -254,15 +248,13 @@ void LinePropertyPanel::Initialize()
aLink = LINK( this, LinePropertyPanel, ChangeEdgeStyleHdl );
mpLBEdgeStyle->SetSelectHdl( aLink );
mpLBEdgeStyle->SetAccessibleName(OUString( "Corner Style"));
mpLBEdgeStyle->SetAccessibleName(OUString("Corner Style"));
aLink = LINK( this, LinePropertyPanel, ChangeCapStyleHdl );
mpLBCapStyle->SetSelectHdl( aLink );
mpLBCapStyle->SetAccessibleName(OUString( "Cap Style"));
mpLBCapStyle->SetAccessibleName(OUString("Cap Style"));
}
void LinePropertyPanel::SetupIcons(void)
{
if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons))
......@@ -275,11 +267,9 @@ void LinePropertyPanel::SetupIcons(void)
}
}
LinePropertyPanel* LinePropertyPanel::Create (
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
const uno::Reference<frame::XFrame>& rxFrame,
SfxBindings* pBindings)
{
if (pParent == NULL)
......@@ -289,33 +279,20 @@ LinePropertyPanel* LinePropertyPanel::Create (
if (pBindings == NULL)
throw lang::IllegalArgumentException("no SfxBindings given to LinePropertyPanel::Create", NULL, 2);
return new LinePropertyPanel(
pParent,
rxFrame,
pBindings);
return new LinePropertyPanel(pParent, rxFrame, pBindings);
}
void LinePropertyPanel::DataChanged(
const DataChangedEvent& rEvent)
void LinePropertyPanel::DataChanged(const DataChangedEvent& /*rEvent*/)
{
(void)rEvent;
SetupIcons();
}
void LinePropertyPanel::NotifyItemUpdate(
sal_uInt16 nSID,
SfxItemState eState,
const SfxPoolItem* pState,
const bool bIsEnabled)
const bool /*bIsEnabled*/)
{
(void)bIsEnabled;
const bool bDisabled(SfxItemState::DISABLED == eState);
switch(nSID)
......@@ -523,23 +500,23 @@ void LinePropertyPanel::NotifyItemUpdate(
switch(pItem->GetValue())
{
case com::sun::star::drawing::LineJoint_MIDDLE:
case com::sun::star::drawing::LineJoint_ROUND:
case drawing::LineJoint_MIDDLE:
case drawing::LineJoint_ROUND:
{
nEntryPos = 1;
break;
}
case com::sun::star::drawing::LineJoint_NONE:
case drawing::LineJoint_NONE:
{
nEntryPos = 2;
break;
}
case com::sun::star::drawing::LineJoint_MITER:
case drawing::LineJoint_MITER:
{
nEntryPos = 3;
break;
}
case com::sun::star::drawing::LineJoint_BEVEL:
case drawing::LineJoint_BEVEL:
{
nEntryPos = 4;
break;
......@@ -583,17 +560,17 @@ void LinePropertyPanel::NotifyItemUpdate(
switch(pItem->GetValue())
{
case com::sun::star::drawing::LineCap_BUTT:
case drawing::LineCap_BUTT:
{
nEntryPos = 1;
break;
}
case com::sun::star::drawing::LineCap_ROUND:
case drawing::LineCap_ROUND:
{
nEntryPos = 2;
break;
}
case com::sun::star::drawing::LineCap_SQUARE:
case drawing::LineCap_SQUARE:
{
nEntryPos = 3;
break;
......@@ -617,12 +594,6 @@ void LinePropertyPanel::NotifyItemUpdate(
}
}
IMPL_LINK_NOARG(LinePropertyPanel, ChangeLineStyleHdl)
{
const sal_Int32 nPos(mpLBStyle->GetSelectEntryPos());
......@@ -661,8 +632,6 @@ IMPL_LINK_NOARG(LinePropertyPanel, ChangeLineStyleHdl)
return 0;
}
IMPL_LINK(LinePropertyPanel, ChangeStartHdl, void*, EMPTYARG)
{
sal_Int32 nPos = mpLBStart->GetSelectEntryPos();
......@@ -678,9 +647,6 @@ IMPL_LINK(LinePropertyPanel, ChangeStartHdl, void*, EMPTYARG)
return 0;
}
IMPL_LINK(LinePropertyPanel, ChangeEndHdl, void*, EMPTYARG)
{
sal_Int32 nPos = mpLBEnd->GetSelectEntryPos();
......@@ -696,9 +662,6 @@ IMPL_LINK(LinePropertyPanel, ChangeEndHdl, void*, EMPTYARG)
return 0;
}
IMPL_LINK(LinePropertyPanel, ChangeEdgeStyleHdl, void*, EMPTYARG)
{
const sal_Int32 nPos(mpLBEdgeStyle->GetSelectEntryPos());
......@@ -711,22 +674,22 @@ IMPL_LINK(LinePropertyPanel, ChangeEdgeStyleHdl, void*, EMPTYARG)
{
case 0: // rounded
{
pItem.reset(new XLineJointItem(com::sun::star::drawing::LineJoint_ROUND));
pItem.reset(new XLineJointItem(drawing::LineJoint_ROUND));
break;
}
case 1: // none
{
pItem.reset(new XLineJointItem(com::sun::star::drawing::LineJoint_NONE));
pItem.reset(new XLineJointItem(drawing::LineJoint_NONE));
break;
}
case 2: // mitered
{
pItem.reset(new XLineJointItem(com::sun::star::drawing::LineJoint_MITER));
pItem.reset(new XLineJointItem(drawing::LineJoint_MITER));
break;
}
case 3: // beveled
{
pItem.reset(new XLineJointItem(com::sun::star::drawing::LineJoint_BEVEL));
pItem.reset(new XLineJointItem(drawing::LineJoint_BEVEL));
break;
}
}
......@@ -736,9 +699,6 @@ IMPL_LINK(LinePropertyPanel, ChangeEdgeStyleHdl, void*, EMPTYARG)
return 0;
}
IMPL_LINK(LinePropertyPanel, ChangeCapStyleHdl, void*, EMPTYARG)
{
const sal_Int32 nPos(mpLBCapStyle->GetSelectEntryPos());
......@@ -751,17 +711,17 @@ IMPL_LINK(LinePropertyPanel, ChangeCapStyleHdl, void*, EMPTYARG)
{
case 0: // flat
{
pItem.reset(new XLineCapItem(com::sun::star::drawing::LineCap_BUTT));
pItem.reset(new XLineCapItem(drawing::LineCap_BUTT));
break;
}
case 1: // round
{
pItem.reset(new XLineCapItem(com::sun::star::drawing::LineCap_ROUND));
pItem.reset(new XLineCapItem(drawing::LineCap_ROUND));
break;
}
case 2: // square
{
pItem.reset(new XLineCapItem(com::sun::star::drawing::LineCap_SQUARE));
pItem.reset(new XLineCapItem(drawing::LineCap_SQUARE));
break;
}
}
......@@ -771,9 +731,6 @@ IMPL_LINK(LinePropertyPanel, ChangeCapStyleHdl, void*, EMPTYARG)
return 0;
}
IMPL_LINK(LinePropertyPanel, ToolboxWidthSelectHdl,ToolBox*, pToolBox)
{
if (pToolBox->GetItemCommand(pToolBox->GetCurItemId()) == UNO_SELECTWIDTH)
......@@ -784,9 +741,6 @@ IMPL_LINK(LinePropertyPanel, ToolboxWidthSelectHdl,ToolBox*, pToolBox)
return 0;
}
IMPL_LINK( LinePropertyPanel, ChangeTransparentHdl, void *, EMPTYARG )
{
sal_uInt16 nVal = (sal_uInt16)mpMFTransparent->GetValue();
......@@ -796,36 +750,25 @@ IMPL_LINK( LinePropertyPanel, ChangeTransparentHdl, void *, EMPTYARG )
return 0L;
}
PopupControl* LinePropertyPanel::CreateLineWidthPopupControl (PopupContainer* pParent)
{
return new LineWidthControl(pParent, *this);
}
void LinePropertyPanel::EndLineWidthPopupMode (void)
{
maLineWidthPopup.Hide();
}
void LinePropertyPanel::SetWidthIcon(int n)
{
const sal_uInt16 nIdWidth = mpTBWidth->GetItemId(UNO_SELECTWIDTH);
if(n==0)
if (n == 0)
mpTBWidth->SetItemImage( nIdWidth, maIMGNone);
else
mpTBWidth->SetItemImage( nIdWidth, mpIMGWidthIcon[n-1]);
}
void LinePropertyPanel::SetWidthIcon()
{
if(!mbWidthValuable)
......@@ -857,16 +800,12 @@ void LinePropertyPanel::SetWidthIcon()
}
void LinePropertyPanel::SetWidth(long nWidth)
{
mnWidthCoreValue = nWidth;
mbWidthValuable = true;
}
void LinePropertyPanel::FillLineEndList()
{
SfxObjectShell* pSh = SfxObjectShell::Current();
......@@ -891,8 +830,6 @@ void LinePropertyPanel::FillLineEndList()
}
}
void LinePropertyPanel::FillLineStyleList()
{
SfxObjectShell* pSh = SfxObjectShell::Current();
......@@ -915,8 +852,6 @@ void LinePropertyPanel::FillLineStyleList()
}
}
void LinePropertyPanel::SelectLineStyle()
{
if( !mpStyleItem.get() || !mpDashItem.get() )
......@@ -1023,7 +958,6 @@ void LinePropertyPanel::SelectEndStyle(bool bStart)
}
}
} } // end of namespace svx::sidebar
}} // end of namespace svx::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -42,19 +42,23 @@ class ListBox;
class ToolBox;
class FloatingWindow;
namespace {
#define SIDEBAR_LINE_WIDTH_GLOBAL_VALUE "PopupPanel_LineWidth"
namespace
{
#define SIDEBAR_LINE_WIDTH_GLOBAL_VALUE "PopupPanel_LineWidth"
} //end of anonymous namespace
namespace svx { namespace sidebar {
namespace svx
{
namespace sidebar
{
class PopupContainer;
class LineWidthControl;
class LinePropertyPanel
: public PanelLayout,
public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
class LinePropertyPanel : public PanelLayout,
public sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
{
public:
static LinePropertyPanel* Create(
......@@ -96,26 +100,27 @@ private:
ListBox* mpLBCapStyle;
//ControllerItem
::sfx2::sidebar::ControllerItem maStyleControl;
::sfx2::sidebar::ControllerItem maDashControl;
::sfx2::sidebar::ControllerItem maWidthControl;
::sfx2::sidebar::ControllerItem maStartControl;
::sfx2::sidebar::ControllerItem maEndControl;
::sfx2::sidebar::ControllerItem maLineEndListControl;
::sfx2::sidebar::ControllerItem maLineStyleListControl;
::sfx2::sidebar::ControllerItem maTransControl;
::sfx2::sidebar::ControllerItem maEdgeStyle;
::sfx2::sidebar::ControllerItem maCapStyle;
::boost::scoped_ptr< XLineStyleItem > mpStyleItem;
::boost::scoped_ptr< XLineDashItem > mpDashItem;
sfx2::sidebar::ControllerItem maStyleControl;
sfx2::sidebar::ControllerItem maDashControl;
sfx2::sidebar::ControllerItem maWidthControl;
sfx2::sidebar::ControllerItem maStartControl;
sfx2::sidebar::ControllerItem maEndControl;
sfx2::sidebar::ControllerItem maLineEndListControl;
sfx2::sidebar::ControllerItem maLineStyleListControl;
sfx2::sidebar::ControllerItem maTransControl;
sfx2::sidebar::ControllerItem maEdgeStyle;
sfx2::sidebar::ControllerItem maCapStyle;
boost::scoped_ptr<XLineStyleItem> mpStyleItem;
boost::scoped_ptr<XLineDashItem> mpDashItem;
sal_uInt16 mnTrans;
SfxMapUnit meMapUnit;
sal_Int32 mnWidthCoreValue;
XLineEndListRef mxLineEndList;
XDashListRef mxLineStyleList;
::boost::scoped_ptr< XLineStartItem > mpStartItem;
::boost::scoped_ptr< XLineEndItem > mpEndItem;
boost::scoped_ptr<XLineStartItem> mpStartItem;
boost::scoped_ptr<XLineEndItem> mpEndItem;
//popup windows
LineWidthPopup maLineWidthPopup;
......@@ -124,9 +129,9 @@ private:
Image maIMGNone;
// multi-images
::boost::scoped_array<Image> mpIMGWidthIcon;
boost::scoped_array<Image> mpIMGWidthIcon;
css::uno::Reference< css::frame::XFrame > mxFrame;
css::uno::Reference<css::frame::XFrame> mxFrame;
SfxBindings* mpBindings;
/// bitfield
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment