Kaydet (Commit) fee180f1 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

split the line width panel into two pieces

The new LinePropertyPanelBase has no reference to SfxBindings anymore.

Change-Id: I7d1d1bb351066dca8bfeedc559048f8337e47f67
üst ddca8df5
......@@ -192,6 +192,7 @@ $(eval $(call gb_Library_add_exception_objects,svx,\
svx/source/sidebar/shadow/ShadowPropertyPanel \
svx/source/sidebar/graphic/GraphicPropertyPanel \
svx/source/sidebar/line/LinePropertyPanel \
svx/source/sidebar/line/LinePropertyPanelBase \
svx/source/sidebar/line/LineWidthControl \
svx/source/sidebar/line/LineWidthValueSet \
svx/source/sidebar/line/LineWidthPopup \
......
......@@ -30,6 +30,7 @@
#include <svx/sidebar/PanelLayout.hxx>
#include <svx/xtable.hxx>
#include "LineWidthPopup.hxx"
#include "LinePropertyPanelBase.hxx"
class XLineStyleItem;
......@@ -57,7 +58,7 @@ namespace sidebar
class PopupContainer;
class LineWidthControl;
class LinePropertyPanel : public PanelLayout,
class LinePropertyPanel : public LinePropertyPanelBase,
public sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
{
public:
......@@ -69,9 +70,6 @@ public:
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings);
virtual void DataChanged(
const DataChangedEvent& rEvent) SAL_OVERRIDE;
virtual void NotifyItemUpdate(
const sal_uInt16 nSId,
const SfxItemState eState,
......@@ -80,36 +78,25 @@ public:
SfxBindings* GetBindings() { return mpBindings;}
void SetWidth(long nWidth);
void SetWidthIcon(int n);
void SetWidthIcon();
void EndLineWidthPopupMode();
// constructor/destuctor
LinePropertyPanel(
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings);
private:
//ui controls
VclPtr<FixedText> mpFTWidth;
VclPtr<ToolBox> mpTBWidth;
VclPtr<FixedText> mpFTStyle;
VclPtr<ListBox> mpLBStyle;
VclPtr<FixedText> mpFTTransparency;
VclPtr<MetricField> mpMFTransparent;
VclPtr<FixedText> mpFTArrow;
VclPtr<ListBox> mpLBStart;
VclPtr<ListBox> mpLBEnd;
VclPtr<FixedText> mpFTEdgeStyle;
VclPtr<ListBox> mpLBEdgeStyle;
VclPtr<FixedText> mpFTCapStyle;
VclPtr<ListBox> mpLBCapStyle;
VclPtr<VclGrid> mpGridLineProps;
VclPtr<VclVBox> mpBoxArrowProps;
virtual void setLineWidth(const XLineWidthItem& rItem) SAL_OVERRIDE;
protected:
virtual void setLineStyle(const XLineStyleItem& rItem) SAL_OVERRIDE;
virtual void setLineDash(const XLineDashItem& rItem) SAL_OVERRIDE;
virtual void setLineEndStyle(const XLineEndItem* pItem) SAL_OVERRIDE;
virtual void setLineStartStyle(const XLineStartItem* pItem) SAL_OVERRIDE;
virtual void setLineTransparency(const XLineTransparenceItem& rItem) SAL_OVERRIDE;
virtual void setLineJoint(const XLineJointItem* pItem) SAL_OVERRIDE;
virtual void setLineCap(const XLineCapItem* pItem) SAL_OVERRIDE;
private:
//ControllerItem
sfx2::sidebar::ControllerItem maStyleControl;
sfx2::sidebar::ControllerItem maDashControl;
......@@ -122,48 +109,10 @@ private:
sfx2::sidebar::ControllerItem maEdgeStyle;
sfx2::sidebar::ControllerItem maCapStyle;
std::unique_ptr<XLineStyleItem> mpStyleItem;
std::unique_ptr<XLineDashItem> mpDashItem;
sal_uInt16 mnTrans;
SfxMapUnit meMapUnit;
sal_Int32 mnWidthCoreValue;
XLineEndListRef mxLineEndList;
XDashListRef mxLineStyleList;
std::unique_ptr<XLineStartItem> mpStartItem;
std::unique_ptr<XLineEndItem> mpEndItem;
//popup windows
LineWidthPopup maLineWidthPopup;
// images from resource
Image maIMGNone;
// multi-images
std::unique_ptr<Image[]> mpIMGWidthIcon;
css::uno::Reference<css::frame::XFrame> mxFrame;
SfxBindings* mpBindings;
/// bitfield
bool mbWidthValuable : 1;
void Initialize();
void FillLineEndList();
void FillLineStyleList();
void SelectEndStyle(bool bStart);
void SelectLineStyle();
void ActivateControls();
DECL_LINK(ChangeLineStyleHdl, void*);
DECL_LINK_TYPED(ToolboxWidthSelectHdl, ToolBox*, void);
DECL_LINK(ChangeTransparentHdl , void *);
DECL_LINK(ChangeStartHdl, void *);
DECL_LINK(ChangeEndHdl, void *);
DECL_LINK(ChangeEdgeStyleHdl, void *);
DECL_LINK(ChangeCapStyleHdl, void *);
VclPtr<PopupControl> CreateLineWidthPopupControl (PopupContainer* pParent);
};
} } // end of namespace svx::sidebar
......
This diff is collapsed.
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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 INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEPROPERTYPANELBASE_HXX
#define INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEPROPERTYPANELBASE_HXX
#include <svx/xdash.hxx>
#include <vcl/ctrl.hxx>
#include <sfx2/sidebar/SidebarPanelBase.hxx>
#include <sfx2/sidebar/ControllerItem.hxx>
#include <vcl/fixed.hxx>
#include <vcl/field.hxx>
#include <vcl/layout.hxx>
#include <memory>
#include <svx/sidebar/PanelLayout.hxx>
#include <svx/xtable.hxx>
#include "LineWidthPopup.hxx"
class XLineStyleItem;
class XLineDashItem;
class XLineStartItem;
class XLineWidthItem;
class XLineEndItem;
class XLineEndList;
class XLineJointItem;
class XLineCapItem;
class XLineTransparenceItem;
class XDashList;
class ListBox;
class ToolBox;
class FloatingWindow;
namespace
{
#define SIDEBAR_LINE_WIDTH_GLOBAL_VALUE "PopupPanel_LineWidth"
} //end of anonymous namespace
namespace svx
{
namespace sidebar
{
class PopupContainer;
class LineWidthControl;
class LinePropertyPanelBase : public PanelLayout
{
public:
virtual ~LinePropertyPanelBase();
virtual void dispose() SAL_OVERRIDE;
virtual void DataChanged(
const DataChangedEvent& rEvent) SAL_OVERRIDE;
void SetWidth(long nWidth);
void SetWidthIcon(int n);
void SetWidthIcon();
void EndLineWidthPopupMode();
// constructor/destuctor
LinePropertyPanelBase(
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
virtual void setLineWidth(const XLineWidthItem& rItem) = 0;
protected:
virtual void setLineStyle(const XLineStyleItem& rItem) = 0;
virtual void setLineDash(const XLineDashItem& rItem) = 0;
virtual void setLineEndStyle(const XLineEndItem* pItem) = 0;
virtual void setLineStartStyle(const XLineStartItem* pItem) = 0;
virtual void setLineTransparency(const XLineTransparenceItem& rItem) = 0;
virtual void setLineJoint(const XLineJointItem* pItem) = 0;
virtual void setLineCap(const XLineCapItem* pItem) = 0;
void updateLineStyle(bool bDisabled, bool bSetOrDefault, const XLineStyleItem* pItem);
void updateLineDash(bool bDisabled, bool bSetOrDefault, const XLineDashItem* pItem);
void updateLineTransparence(bool bDisabled, bool bSetOrDefault, const XLineTransparenceItem* pItem);
void updateLineWidth(bool bDisabled, bool bSetOrDefault, const XLineWidthItem* pItem);
void updateLineStart(bool bDisabled, bool bSetOrDefault, const XLineStartItem* pItem);
void updateLineEnd(bool bDisabled, bool bSetOrDefault, const XLineEndItem* pItem);
void updateLineJoint(bool bDisabled, bool bSetOrDefault, const XLineJointItem* pItem);
void updateLineCap(bool bDisabled, bool bSetOrDefault, const XLineCapItem* pItem);
void FillLineEndList();
void FillLineStyleList();
void SelectEndStyle(bool bStart);
void SelectLineStyle();
void ActivateControls();
private:
//ui controls
VclPtr<FixedText> mpFTWidth;
VclPtr<ToolBox> mpTBWidth;
VclPtr<FixedText> mpFTStyle;
VclPtr<ListBox> mpLBStyle;
VclPtr<FixedText> mpFTTransparency;
VclPtr<MetricField> mpMFTransparent;
VclPtr<FixedText> mpFTArrow;
VclPtr<ListBox> mpLBStart;
VclPtr<ListBox> mpLBEnd;
VclPtr<FixedText> mpFTEdgeStyle;
VclPtr<ListBox> mpLBEdgeStyle;
VclPtr<FixedText> mpFTCapStyle;
VclPtr<ListBox> mpLBCapStyle;
VclPtr<VclGrid> mpGridLineProps;
VclPtr<VclVBox> mpBoxArrowProps;
std::unique_ptr<XLineStyleItem> mpStyleItem;
std::unique_ptr<XLineDashItem> mpDashItem;
sal_uInt16 mnTrans;
SfxMapUnit meMapUnit;
sal_Int32 mnWidthCoreValue;
XLineEndListRef mxLineEndList;
XDashListRef mxLineStyleList;
std::unique_ptr<XLineStartItem> mpStartItem;
std::unique_ptr<XLineEndItem> mpEndItem;
//popup windows
LineWidthPopup maLineWidthPopup;
// images from resource
Image maIMGNone;
// multi-images
std::unique_ptr<Image[]> mpIMGWidthIcon;
css::uno::Reference<css::frame::XFrame> mxFrame;
/// bitfield
bool mbWidthValuable : 1;
void Initialize();
DECL_LINK(ChangeLineStyleHdl, void*);
DECL_LINK_TYPED(ToolboxWidthSelectHdl, ToolBox*, void);
DECL_LINK(ChangeTransparentHdl , void *);
DECL_LINK(ChangeStartHdl, void *);
DECL_LINK(ChangeEndHdl, void *);
DECL_LINK(ChangeEdgeStyleHdl, void *);
DECL_LINK(ChangeCapStyleHdl, void *);
VclPtr<PopupControl> CreateLineWidthPopupControl (PopupContainer* pParent);
};
} } // end of namespace svx::sidebar
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -18,7 +18,7 @@
*/
#include "LineWidthControl.hxx"
#include "LinePropertyPanel.hrc"
#include "LinePropertyPanel.hxx"
#include "LinePropertyPanelBase.hxx"
#include <svx/dialogs.hrc>
#include <svx/dialmgr.hxx>
......@@ -36,10 +36,9 @@ namespace svx { namespace sidebar {
LineWidthControl::LineWidthControl (
vcl::Window* pParent,
LinePropertyPanel& rPanel)
LinePropertyPanelBase& rPanel)
: svx::sidebar::PopupControl(pParent,SVX_RES(RID_POPUPPANEL_LINEPAGE_WIDTH)),
mrLinePropertyPanel(rPanel),
mpBindings(NULL),
maVSWidth(VclPtr<LineWidthValueSet>::Create(this, SVX_RES(VS_WIDTH))),
maFTCus( VclPtr<FixedText>::Create(this, SVX_RES(FT_CUSTOME))),
maFTWidth( VclPtr<FixedText>::Create(this, SVX_RES(FT_LINE_WIDTH))),
......@@ -57,7 +56,6 @@ LineWidthControl::LineWidthControl (
{
Initialize();
FreeResource();
mpBindings = mrLinePropertyPanel.GetBindings();
}
LineWidthControl::~LineWidthControl()
......@@ -268,7 +266,7 @@ IMPL_LINK(LineWidthControl, VSSelectHdl, void *, pControl)
sal_IntPtr nVal = LogicToLogic(reinterpret_cast<sal_IntPtr>(maVSWidth->GetItemData( iPos )), MAP_POINT, (MapUnit)meMapUnit);
nVal = maMFWidth->Denormalize(nVal);
XLineWidthItem aWidthItem( nVal );
mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_WIDTH, SfxCallMode::RECORD, &aWidthItem, 0L);
mrLinePropertyPanel.setLineWidth(aWidthItem);
mrLinePropertyPanel.SetWidthIcon(iPos);
mrLinePropertyPanel.SetWidth(nVal);
mbCloseByEdit = false;
......@@ -282,7 +280,7 @@ IMPL_LINK(LineWidthControl, VSSelectHdl, void *, pControl)
long nVal = LogicToLogic(mnCustomWidth , MAP_POINT, (MapUnit)meMapUnit);
nVal = maMFWidth->Denormalize(nVal);
XLineWidthItem aWidthItem( nVal );
mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_WIDTH, SfxCallMode::RECORD, &aWidthItem, 0L);
mrLinePropertyPanel.setLineWidth(aWidthItem);
mrLinePropertyPanel.SetWidth(nVal);
mbCloseByEdit = false;
mnTmpCustomWidth = 0;
......@@ -319,7 +317,7 @@ IMPL_LINK(LineWidthControl, MFModifyHdl, void *, pControl)
long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)meMapUnit );
sal_Int32 nNewWidth = (short)maMFWidth->Denormalize( nVal );
XLineWidthItem aWidthItem(nNewWidth);
mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_WIDTH, SfxCallMode::RECORD, &aWidthItem, 0L);
mrLinePropertyPanel.setLineWidth(aWidthItem);
mbCloseByEdit = true;
mnTmpCustomWidth = nTmp;
......
......@@ -30,12 +30,12 @@ class SfxBindings;
namespace svx { namespace sidebar {
class LinePropertyPanel;
class LinePropertyPanelBase;
class LineWidthControl : public svx::sidebar::PopupControl
{
public:
LineWidthControl (vcl::Window* pParent, LinePropertyPanel& rPanel);
LineWidthControl (vcl::Window* pParent, LinePropertyPanelBase& rPanel);
virtual ~LineWidthControl();
virtual void dispose() SAL_OVERRIDE;
......@@ -53,8 +53,7 @@ public:
}
private:
LinePropertyPanel& mrLinePropertyPanel;
SfxBindings* mpBindings;
LinePropertyPanelBase& mrLinePropertyPanel;
VclPtr<LineWidthValueSet> maVSWidth;
VclPtr<FixedText> maFTCus;
VclPtr<FixedText> maFTWidth;
......
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