[Libreoffice-commits] core.git: 9 commits - chart2/Library_chartcontroller.mk chart2/source include/sfx2 include/svx sfx2/source svx/Library_svx.mk svx/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Wed Jul 29 20:51:08 PDT 2015
chart2/Library_chartcontroller.mk | 1
chart2/source/controller/main/ChartController.cxx | 2
chart2/source/controller/sidebar/Chart2PanelFactory.cxx | 3
chart2/source/controller/sidebar/ChartLinePanel.cxx | 295 +++++
chart2/source/controller/sidebar/ChartLinePanel.hxx | 104 +
chart2/source/model/main/DataPointProperties.cxx | 20
chart2/source/view/axes/VCartesianAxis.cxx | 2
chart2/source/view/axes/VPolarAngleAxis.cxx | 2
chart2/source/view/inc/PropertyMapper.hxx | 3
chart2/source/view/main/PropertyMapper.cxx | 5
include/sfx2/sidebar/EnumContext.hxx | 1
include/svx/drawitem.hxx | 26
include/svx/sidebar/LinePropertyPanelBase.hxx | 175 +++
include/svx/sidebar/LineWidthPopup.hxx | 50
include/svx/xtable.hxx | 52
sfx2/source/sidebar/EnumContext.cxx | 1
svx/Library_svx.mk | 1
svx/source/sidebar/line/LinePropertyPanel.cxx | 841 --------------
svx/source/sidebar/line/LinePropertyPanel.hxx | 80 -
svx/source/sidebar/line/LinePropertyPanelBase.cxx | 933 ++++++++++++++++
svx/source/sidebar/line/LineWidthControl.cxx | 12
svx/source/sidebar/line/LineWidthControl.hxx | 7
svx/source/sidebar/line/LineWidthPopup.cxx | 5
svx/source/sidebar/line/LineWidthPopup.hxx | 50
24 files changed, 1656 insertions(+), 1015 deletions(-)
New commits:
commit 902255645328efde34ddf62227c8278e8dd61ff0
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Jul 30 00:03:58 2015 +0200
small fix to reduce UnknownPropertyException in chart2
accidently introduced with f1531cdaaebe706d909dc6ddde439ccb5f4ad36d
Change-Id: I292097c5f61ecb32a28a90e9f5be48fcfd6bcd7b
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 66a7b29..6f316e3 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -321,6 +321,8 @@ OUString ChartController::GetContextName()
return OUString("ErrorBar");
case OBJECTTYPE_AXIS:
return OUString("Axis");
+ case OBJECTTYPE_GRID:
+ return OUString("Grid");
default:
break;
}
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index fd48b5c..ba2c452 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -404,7 +404,7 @@ void getAxisLabelProperties(
Reference<beans::XPropertySet> xProps(rAxisProp.m_xAxisModel, uno::UNO_QUERY);
PropertyMapper::getTextLabelMultiPropertyLists(
- xProps, rPropNames, rPropValues, false, nLimitedSpaceForText, bLimitedHeight);
+ xProps, rPropNames, rPropValues, false, nLimitedSpaceForText, bLimitedHeight, false);
LabelPositionHelper::doDynamicFontResize(
rPropValues, rPropNames, xProps, rAxisLabelProp.m_aFontReferenceSize);
diff --git a/chart2/source/view/axes/VPolarAngleAxis.cxx b/chart2/source/view/axes/VPolarAngleAxis.cxx
index adbf8e6..d720868 100644
--- a/chart2/source/view/axes/VPolarAngleAxis.cxx
+++ b/chart2/source/view/axes/VPolarAngleAxis.cxx
@@ -66,7 +66,7 @@ bool VPolarAngleAxis::createTextShapes_ForAngleAxis(
tAnySequence aPropValues;
uno::Reference< beans::XPropertySet > xProps( m_aAxisProperties.m_xAxisModel, uno::UNO_QUERY );
- PropertyMapper::getTextLabelMultiPropertyLists( xProps, aPropNames, aPropValues, false );
+ PropertyMapper::getTextLabelMultiPropertyLists( xProps, aPropNames, aPropValues, false, -1, false, false );
LabelPositionHelper::doDynamicFontResize( aPropValues, aPropNames, xProps
, rAxisLabelProperties.m_aFontReferenceSize );
diff --git a/chart2/source/view/inc/PropertyMapper.hxx b/chart2/source/view/inc/PropertyMapper.hxx
index c1c29b7..171e302 100644
--- a/chart2/source/view/inc/PropertyMapper.hxx
+++ b/chart2/source/view/inc/PropertyMapper.hxx
@@ -123,7 +123,8 @@ public:
, tNameSequence& rPropNames, tAnySequence& rPropValues
, bool bName=true
, sal_Int32 nLimitedSpace=-1
- , bool bLimitedHeight=false );
+ , bool bLimitedHeight=false
+ , bool bSupportsLabelBorder = true);
/** adds line-, fill- and character properties and sets some suitable
defaults for auto-grow properties
diff --git a/chart2/source/view/main/PropertyMapper.cxx b/chart2/source/view/main/PropertyMapper.cxx
index c373f38..313c237 100644
--- a/chart2/source/view/main/PropertyMapper.cxx
+++ b/chart2/source/view/main/PropertyMapper.cxx
@@ -435,11 +435,12 @@ void PropertyMapper::getTextLabelMultiPropertyLists(
, tNameSequence& rPropNames, tAnySequence& rPropValues
, bool bName
, sal_Int32 nLimitedSpace
- , bool bLimitedHeight )
+ , bool bLimitedHeight
+ , bool bSupportsLabelBorder)
{
//fill character properties into the ValueMap
tPropertyNameValueMap aValueMap;
- tMakePropertyNameMap aNameMap = PropertyMapper::getPropertyNameMapForTextLabelProperties();
+ tMakePropertyNameMap aNameMap = bSupportsLabelBorder ? PropertyMapper::getPropertyNameMapForTextLabelProperties() : getPropertyNameMapForCharacterProperties();
PropertyMapper::getValueMap(aValueMap, aNameMap, xSourceProp);
diff --git a/include/sfx2/sidebar/EnumContext.hxx b/include/sfx2/sidebar/EnumContext.hxx
index 785e6eff..d9dbe80 100644
--- a/include/sfx2/sidebar/EnumContext.hxx
+++ b/include/sfx2/sidebar/EnumContext.hxx
@@ -78,6 +78,7 @@ public:
Context_Form,
Context_Frame,
Context_Graphic,
+ Context_Grid,
Context_HandoutPage,
Context_MasterPage,
Context_Media,
diff --git a/sfx2/source/sidebar/EnumContext.cxx b/sfx2/source/sidebar/EnumContext.cxx
index e84ce1c..d72c5fa 100644
--- a/sfx2/source/sidebar/EnumContext.cxx
+++ b/sfx2/source/sidebar/EnumContext.cxx
@@ -188,6 +188,7 @@ void EnumContext::ProvideContextContainers()
AddContext(Form);
AddContext(Frame);
AddContext(Graphic);
+ AddContext(Grid);
AddContext(HandoutPage);
AddContext(MasterPage);
AddContext(Media);
commit bead8d010987d53b313e30b65e56d04ee80469ef
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 29 23:18:44 2015 +0200
also handle line width correctly
Change-Id: Ia564d3c9b821a09586a0bcb32ee3f827e71f43de
diff --git a/chart2/source/controller/sidebar/ChartLinePanel.cxx b/chart2/source/controller/sidebar/ChartLinePanel.cxx
index a4ad08f..d677e20 100644
--- a/chart2/source/controller/sidebar/ChartLinePanel.cxx
+++ b/chart2/source/controller/sidebar/ChartLinePanel.cxx
@@ -154,6 +154,7 @@ void ChartLinePanel::Initialize()
if (xSelectionSupplier.is())
xSelectionSupplier->addSelectionChangeListener(mxSelectionListener.get());
+ setMapUnit(SFX_MAPUNIT_100TH_MM);
updateData();
}
diff --git a/include/svx/sidebar/LinePropertyPanelBase.hxx b/include/svx/sidebar/LinePropertyPanelBase.hxx
index 6133061..ef41457 100644
--- a/include/svx/sidebar/LinePropertyPanelBase.hxx
+++ b/include/svx/sidebar/LinePropertyPanelBase.hxx
@@ -110,6 +110,8 @@ protected:
void SelectLineStyle();
void ActivateControls();
+ void setMapUnit(SfxMapUnit eMapUnit);
+
private:
//ui controls
VclPtr<FixedText> mpFTWidth;
diff --git a/svx/source/sidebar/line/LinePropertyPanel.cxx b/svx/source/sidebar/line/LinePropertyPanel.cxx
index c025c86..616cf5a 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanel.cxx
@@ -100,6 +100,7 @@ void LinePropertyPanel::dispose()
void LinePropertyPanel::Initialize()
{
+ setMapUnit(maWidthControl.GetCoreMetric());
}
VclPtr<vcl::Window> LinePropertyPanel::Create (
diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.cxx b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
index c04fa3f..9656466 100644
--- a/svx/source/sidebar/line/LinePropertyPanelBase.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
@@ -220,8 +220,6 @@ void LinePropertyPanelBase::Initialize()
mpIMGWidthIcon[6] = Image(SVX_RES(IMG_WIDTH7_ICON));
mpIMGWidthIcon[7] = Image(SVX_RES(IMG_WIDTH8_ICON));
- // meMapUnit = maWidthControl.GetCoreMetric();
-
FillLineStyleList();
SelectLineStyle();
Link<> aLink = LINK( this, LinePropertyPanelBase, ChangeLineStyleHdl );
@@ -925,6 +923,11 @@ void LinePropertyPanelBase::ActivateControls()
mpBoxArrowProps->Enable( bLineStyle );
}
+void LinePropertyPanelBase::setMapUnit(SfxMapUnit eMapUnit)
+{
+ meMapUnit = eMapUnit;
+}
+
}} // end of namespace svx::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 3dc00a8de9f9f1b1ad0c60134391638544cdd143
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 29 15:33:57 2015 +0200
handle line dash in chart line panel
Change-Id: Ia3d466c269eef62f8fa419d15869f44213a6e001
diff --git a/chart2/source/controller/sidebar/ChartLinePanel.cxx b/chart2/source/controller/sidebar/ChartLinePanel.cxx
index b78e0c5..a4ad08f 100644
--- a/chart2/source/controller/sidebar/ChartLinePanel.cxx
+++ b/chart2/source/controller/sidebar/ChartLinePanel.cxx
@@ -16,6 +16,7 @@
#include <svx/xlinjoit.hxx>
#include <svx/xlndsit.hxx>
#include <svx/xlntrit.hxx>
+#include <svx/unomid.hxx>
#include <com/sun/star/view/XSelectionSupplier.hpp>
@@ -61,6 +62,24 @@ css::uno::Reference<css::beans::XPropertySet> getPropSet(
return xPropSet;
}
+css::uno::Any getLineDash(
+ css::uno::Reference<css::frame::XModel> xModel, const OUString& rDashName)
+{
+ css::uno::Reference<css::lang::XMultiServiceFactory> xFact(xModel, css::uno::UNO_QUERY);
+ css::uno::Reference<css::container::XNameAccess> xNameAccess(
+ xFact->createInstance("com.sun.star.drawing.DashTable"),
+ css::uno::UNO_QUERY );
+ if(xNameAccess.is())
+ {
+ if (!xNameAccess->hasByName(rDashName))
+ return css::uno::Any();
+
+ return xNameAccess->getByName(rDashName);
+ }
+
+ return css::uno::Any();
+}
+
class PreventUpdate
{
public:
@@ -147,6 +166,23 @@ void ChartLinePanel::updateData()
if (!xPropSet.is())
return;
+ sal_uInt16 nLineTransparence = 0;
+ xPropSet->getPropertyValue("LineTransparence") >>= nLineTransparence;
+ XLineTransparenceItem aLineTransparenceItem(nLineTransparence);
+ updateLineTransparence(false, true, &aLineTransparenceItem);
+
+ css::drawing::LineStyle eStyle = css::drawing::LineStyle_SOLID;
+ xPropSet->getPropertyValue("LineStyle") >>= eStyle;
+ XLineStyleItem aStyleItem(eStyle);
+ updateLineStyle(false, true, &aStyleItem);
+
+ css::uno::Any aLineDashName = xPropSet->getPropertyValue("LineDashName");
+ OUString aDashName;
+ aLineDashName >>= aDashName;
+ css::uno::Any aLineDash = getLineDash(mxModel, aDashName);
+ XLineDashItem aDashItem;
+ aDashItem.PutValue(aLineDash, MID_LINEDASH);
+ updateLineDash(false, true, &aDashItem);
}
void ChartLinePanel::modelInvalid()
@@ -198,7 +234,13 @@ void ChartLinePanel::setLineDash(const XLineDashItem& rItem)
if (!xPropSet.is())
return;
- xPropSet->setPropertyValue("LineDash", css::uno::makeAny(rItem.GetValue()));
+ css::uno::Any aAny;
+ rItem.QueryValue(aAny, MID_LINEDASH);
+ OUString aDashName = PropertyHelper::addLineDashUniqueNameToTable(aAny,
+ css::uno::Reference<css::lang::XMultiServiceFactory>(mxModel, css::uno::UNO_QUERY),
+ "");
+ xPropSet->setPropertyValue("LineDash", aAny);
+ xPropSet->setPropertyValue("LineDashName", css::uno::makeAny(aDashName));
}
void ChartLinePanel::setLineEndStyle(const XLineEndItem* /*pItem*/)
commit 84254268bf5902d2405815970218e1893a7a673e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 29 15:33:18 2015 +0200
it is insane to not map line and border properties to the same id
Change-Id: I6f4eb2509dc731cb281350b2bb0cce94b66a8ad6
diff --git a/chart2/source/model/main/DataPointProperties.cxx b/chart2/source/model/main/DataPointProperties.cxx
index ed35733..f09cf47 100644
--- a/chart2/source/model/main/DataPointProperties.cxx
+++ b/chart2/source/model/main/DataPointProperties.cxx
@@ -177,21 +177,21 @@ void DataPointProperties::AddPropertiesToVector(
rOutProperties.push_back(
Property( "BorderStyle",
- PROP_DATAPOINT_BORDER_STYLE,
+ LinePropertiesHelper::PROP_LINE_STYLE,
cppu::UnoType<drawing::LineStyle>::get(),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
rOutProperties.push_back(
Property( "BorderWidth",
- PROP_DATAPOINT_BORDER_WIDTH,
+ LinePropertiesHelper::PROP_LINE_WIDTH,
cppu::UnoType<sal_Int32>::get(),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
rOutProperties.push_back(
Property( "BorderDashName",
- PROP_DATAPOINT_BORDER_DASH_NAME,
+ LinePropertiesHelper::PROP_LINE_DASH_NAME,
cppu::UnoType<OUString>::get(),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEVOID ));
commit e517948e71daf8861aca46f77fe900a538654887
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 29 03:16:13 2015 +0200
set some properties from chart line panel
Change-Id: Idbe26d7ea554512391b22299ac6dccaeaa71d584
diff --git a/chart2/source/controller/sidebar/ChartLinePanel.cxx b/chart2/source/controller/sidebar/ChartLinePanel.cxx
index 26736d3..b78e0c5 100644
--- a/chart2/source/controller/sidebar/ChartLinePanel.cxx
+++ b/chart2/source/controller/sidebar/ChartLinePanel.cxx
@@ -12,6 +12,11 @@
#include "PropertyHelper.hxx"
#include "ChartController.hxx"
+#include <svx/xlnwtit.hxx>
+#include <svx/xlinjoit.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xlntrit.hxx>
+
#include <com/sun/star/view/XSelectionSupplier.hpp>
namespace chart { namespace sidebar {
@@ -174,12 +179,26 @@ void ChartLinePanel::updateModel(
xSelectionSupplier->addSelectionChangeListener(mxSelectionListener.get());
}
-void ChartLinePanel::setLineStyle(const XLineStyleItem& /*rItem*/)
+void ChartLinePanel::setLineStyle(const XLineStyleItem& rItem)
{
+ css::uno::Reference<css::beans::XPropertySet> xPropSet =
+ getPropSet(mxModel);
+
+ if (!xPropSet.is())
+ return;
+
+ xPropSet->setPropertyValue("LineStyle", css::uno::makeAny(rItem.GetValue()));
}
-void ChartLinePanel::setLineDash(const XLineDashItem& /*rItem*/)
+void ChartLinePanel::setLineDash(const XLineDashItem& rItem)
{
+ css::uno::Reference<css::beans::XPropertySet> xPropSet =
+ getPropSet(mxModel);
+
+ if (!xPropSet.is())
+ return;
+
+ xPropSet->setPropertyValue("LineDash", css::uno::makeAny(rItem.GetValue()));
}
void ChartLinePanel::setLineEndStyle(const XLineEndItem* /*pItem*/)
@@ -190,20 +209,42 @@ void ChartLinePanel::setLineStartStyle(const XLineStartItem* /*pItem*/)
{
}
-void ChartLinePanel::setLineJoint(const XLineJointItem* /*pItem*/)
+void ChartLinePanel::setLineJoint(const XLineJointItem* pItem)
{
+ css::uno::Reference<css::beans::XPropertySet> xPropSet =
+ getPropSet(mxModel);
+
+ if (!xPropSet.is())
+ return;
+
+ if (pItem)
+ xPropSet->setPropertyValue("LineJoint", css::uno::makeAny(pItem->GetValue()));
}
void ChartLinePanel::setLineCap(const XLineCapItem* /*pItem*/)
{
}
-void ChartLinePanel::setLineTransparency(const XLineTransparenceItem& /*rItem*/)
+void ChartLinePanel::setLineTransparency(const XLineTransparenceItem& rItem)
{
+ css::uno::Reference<css::beans::XPropertySet> xPropSet =
+ getPropSet(mxModel);
+
+ if (!xPropSet.is())
+ return;
+
+ xPropSet->setPropertyValue("LineTransparence", css::uno::makeAny(rItem.GetValue()));
}
-void ChartLinePanel::setLineWidth(const XLineWidthItem& /*rItem*/)
+void ChartLinePanel::setLineWidth(const XLineWidthItem& rItem)
{
+ css::uno::Reference<css::beans::XPropertySet> xPropSet =
+ getPropSet(mxModel);
+
+ if (!xPropSet.is())
+ return;
+
+ xPropSet->setPropertyValue("LineWidth", css::uno::makeAny(rItem.GetValue()));
}
} }
commit 9bb03b4961492491d69dafb2db46c2840c19fec3
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 29 03:15:40 2015 +0200
provide also LineTransparence for DataPointProperties
Change-Id: I9c3e547831d3d876c228c8b9b566f17a4d95ce5b
diff --git a/chart2/source/model/main/DataPointProperties.cxx b/chart2/source/model/main/DataPointProperties.cxx
index 064261d..ed35733 100644
--- a/chart2/source/model/main/DataPointProperties.cxx
+++ b/chart2/source/model/main/DataPointProperties.cxx
@@ -174,24 +174,28 @@ void DataPointProperties::AddPropertiesToVector(
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEVOID // "maybe auto"
| beans::PropertyAttribute::MAYBEDEFAULT ));
+
rOutProperties.push_back(
Property( "BorderStyle",
PROP_DATAPOINT_BORDER_STYLE,
cppu::UnoType<drawing::LineStyle>::get(),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
+
rOutProperties.push_back(
Property( "BorderWidth",
PROP_DATAPOINT_BORDER_WIDTH,
cppu::UnoType<sal_Int32>::get(),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
+
rOutProperties.push_back(
Property( "BorderDashName",
PROP_DATAPOINT_BORDER_DASH_NAME,
cppu::UnoType<OUString>::get(),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEVOID ));
+
rOutProperties.push_back(
Property( "BorderTransparency",
PROP_DATAPOINT_BORDER_TRANSPARENCY,
@@ -206,18 +210,21 @@ void DataPointProperties::AddPropertiesToVector(
cppu::UnoType<drawing::LineStyle>::get(),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
+
rOutProperties.push_back(
Property( "LineWidth",
LinePropertiesHelper::PROP_LINE_WIDTH,
cppu::UnoType<sal_Int32>::get(),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
+
rOutProperties.push_back(
Property( "LineDash",
LinePropertiesHelper::PROP_LINE_DASH,
cppu::UnoType<drawing::LineDash>::get(),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEVOID ));
+
rOutProperties.push_back(
Property( "LineDashName",
LinePropertiesHelper::PROP_LINE_DASH_NAME,
@@ -225,6 +232,13 @@ void DataPointProperties::AddPropertiesToVector(
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( "LineTransparence",
+ PROP_DATAPOINT_BORDER_TRANSPARENCY,
+ cppu::UnoType<sal_Int16>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
// FillProperties
// bitmap properties
rOutProperties.push_back(
commit 57dcf78e6b17777f499fd7e7c2ee8d129bf0f79b
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 29 02:46:50 2015 +0200
provide structure for chart line panel
Change-Id: I75204a012e4bc59f40a06db814bb9057a1cf8598
diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk
index 2e03a7e..1dbb89a 100644
--- a/chart2/Library_chartcontroller.mk
+++ b/chart2/Library_chartcontroller.mk
@@ -192,6 +192,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\
chart2/source/controller/sidebar/ChartAxisPanel \
chart2/source/controller/sidebar/ChartElementsPanel \
chart2/source/controller/sidebar/ChartErrorBarPanel \
+ chart2/source/controller/sidebar/ChartLinePanel \
chart2/source/controller/sidebar/ChartSeriesPanel \
chart2/source/controller/sidebar/ChartSidebarModifyListener \
chart2/source/controller/sidebar/ChartSidebarSelectionListener \
diff --git a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
index d45ad84..97a96db 100644
--- a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
+++ b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
@@ -35,6 +35,7 @@
#include "ChartAxisPanel.hxx"
#include "ChartErrorBarPanel.hxx"
#include "ChartAreaPanel.hxx"
+#include "ChartLinePanel.hxx"
using namespace css::uno;
using ::rtl::OUString;
@@ -99,6 +100,8 @@ Reference<css::ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement (
pPanel = ChartErrorBarPanel::Create(pParentWindow, xFrame, pController);
else if (rsResourceURL.endsWith("/AreaPanel"))
pPanel = ChartAreaPanel::Create(pParentWindow, xFrame, pController);
+ else if (rsResourceURL.endsWith("/LinePanel"))
+ pPanel = ChartLinePanel::Create(pParentWindow, xFrame, pController);
if (pPanel)
xElement = sfx2::sidebar::SidebarPanelBase::Create(
diff --git a/chart2/source/controller/sidebar/ChartLinePanel.cxx b/chart2/source/controller/sidebar/ChartLinePanel.cxx
new file mode 100644
index 0000000..26736d3
--- /dev/null
+++ b/chart2/source/controller/sidebar/ChartLinePanel.cxx
@@ -0,0 +1,211 @@
+/* -*- 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/.
+ */
+
+#include "ChartLinePanel.hxx"
+
+#include "PropertyHelper.hxx"
+#include "ChartController.hxx"
+
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+
+namespace chart { namespace sidebar {
+
+namespace {
+
+OUString getCID(css::uno::Reference<css::frame::XModel> xModel)
+{
+ css::uno::Reference<css::frame::XController> xController(xModel->getCurrentController());
+ css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
+ if (!xSelectionSupplier.is())
+ return OUString();
+
+ css::uno::Any aAny = xSelectionSupplier->getSelection();
+ if (!aAny.hasValue())
+ return OUString();
+
+ OUString aCID;
+ aAny >>= aCID;
+
+ return aCID;
+}
+
+css::uno::Reference<css::beans::XPropertySet> getPropSet(
+ css::uno::Reference<css::frame::XModel> xModel)
+{
+ OUString aCID = getCID(xModel);
+ css::uno::Reference<css::beans::XPropertySet> xPropSet =
+ ObjectIdentifier::getObjectPropertySet(aCID, xModel);
+
+ ObjectType eType = ObjectIdentifier::getObjectType(aCID);
+ if (eType == OBJECTTYPE_DIAGRAM)
+ {
+ css::uno::Reference<css::chart2::XDiagram> xDiagram(
+ xPropSet, css::uno::UNO_QUERY);
+ if (!xDiagram.is())
+ return xPropSet;
+
+ xPropSet.set(xDiagram->getWall());
+ }
+
+ return xPropSet;
+}
+
+class PreventUpdate
+{
+public:
+ PreventUpdate(bool& bUpdate):
+ mbUpdate(bUpdate)
+ {
+ mbUpdate = false;
+ }
+
+ ~PreventUpdate()
+ {
+ mbUpdate = true;
+ }
+
+private:
+ bool& mbUpdate;
+};
+
+}
+
+VclPtr<vcl::Window> ChartLinePanel::Create(
+ vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ ChartController* pController)
+{
+ if (pParent == NULL)
+ throw css::lang::IllegalArgumentException("no parent Window given to ChartAxisPanel::Create", NULL, 0);
+ if (!rxFrame.is())
+ throw css::lang::IllegalArgumentException("no XFrame given to ChartAxisPanel::Create", NULL, 1);
+
+ return VclPtr<ChartLinePanel>::Create(
+ pParent, rxFrame, pController);
+}
+
+ChartLinePanel::ChartLinePanel(vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ ChartController* pController):
+ svx::sidebar::LinePropertyPanelBase(pParent, rxFrame),
+ mxModel(pController->getModel()),
+ mxListener(new ChartSidebarModifyListener(this)),
+ mxSelectionListener(new ChartSidebarSelectionListener(this)),
+ mbUpdate(true)
+{
+ std::vector<ObjectType> aAcceptedTypes { OBJECTTYPE_PAGE, OBJECTTYPE_DIAGRAM, OBJECTTYPE_DATA_SERIES, OBJECTTYPE_TITLE, OBJECTTYPE_LEGEND};
+ mxSelectionListener->setAcceptedTypes(aAcceptedTypes);
+ Initialize();
+}
+
+ChartLinePanel::~ChartLinePanel()
+{
+ disposeOnce();
+}
+
+void ChartLinePanel::dispose()
+{
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcaster->removeModifyListener(mxListener);
+
+ css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
+ if (xSelectionSupplier.is())
+ xSelectionSupplier->removeSelectionChangeListener(mxSelectionListener.get());
+
+ LinePropertyPanelBase::dispose();
+}
+
+void ChartLinePanel::Initialize()
+{
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcaster->addModifyListener(mxListener);
+
+ css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
+ if (xSelectionSupplier.is())
+ xSelectionSupplier->addSelectionChangeListener(mxSelectionListener.get());
+
+ updateData();
+}
+
+void ChartLinePanel::updateData()
+{
+ if (!mbUpdate)
+ return;
+
+ css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
+ if (!xPropSet.is())
+ return;
+
+}
+
+void ChartLinePanel::modelInvalid()
+{
+}
+
+void ChartLinePanel::selectionChanged(bool bCorrectType)
+{
+ if (bCorrectType)
+ updateData();
+}
+
+void ChartLinePanel::SelectionInvalid()
+{
+}
+
+void ChartLinePanel::updateModel(
+ css::uno::Reference<css::frame::XModel> xModel)
+{
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcaster->removeModifyListener(mxListener);
+
+ mxModel = xModel;
+
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcasterNew->addModifyListener(mxListener);
+
+ css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
+ if (xSelectionSupplier.is())
+ xSelectionSupplier->addSelectionChangeListener(mxSelectionListener.get());
+}
+
+void ChartLinePanel::setLineStyle(const XLineStyleItem& /*rItem*/)
+{
+}
+
+void ChartLinePanel::setLineDash(const XLineDashItem& /*rItem*/)
+{
+}
+
+void ChartLinePanel::setLineEndStyle(const XLineEndItem* /*pItem*/)
+{
+}
+
+void ChartLinePanel::setLineStartStyle(const XLineStartItem* /*pItem*/)
+{
+}
+
+void ChartLinePanel::setLineJoint(const XLineJointItem* /*pItem*/)
+{
+}
+
+void ChartLinePanel::setLineCap(const XLineCapItem* /*pItem*/)
+{
+}
+
+void ChartLinePanel::setLineTransparency(const XLineTransparenceItem& /*rItem*/)
+{
+}
+
+void ChartLinePanel::setLineWidth(const XLineWidthItem& /*rItem*/)
+{
+}
+
+} }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartLinePanel.hxx b/chart2/source/controller/sidebar/ChartLinePanel.hxx
new file mode 100644
index 0000000..a2b2ea5
--- /dev/null
+++ b/chart2/source/controller/sidebar/ChartLinePanel.hxx
@@ -0,0 +1,104 @@
+/* -*- 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/.
+ */
+
+#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTLINEPANEL_HXX
+#define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTLINEPANEL_HXX
+
+#include <vcl/ctrl.hxx>
+#include <sfx2/sidebar/ControllerItem.hxx>
+#include <sfx2/sidebar/SidebarModelUpdate.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 <svx/sidebar/PanelLayout.hxx>
+#include <svl/intitem.hxx>
+#include <com/sun/star/ui/XUIElement.hpp>
+#include <boost/scoped_ptr.hpp>
+
+#include <svx/sidebar/LinePropertyPanelBase.hxx>
+
+#include "ChartSidebarModifyListener.hxx"
+#include "ChartSidebarSelectionListener.hxx"
+
+class XFillFloatTransparenceItem;
+class XFillTransparenceItem;
+class XFillStyleItem;
+class XFillGradientItem;
+class XFillColorItem;
+class XFillHatchItem;
+class XFillBitmapItem;
+
+namespace chart {
+
+class ChartController;
+
+namespace sidebar {
+
+class ChartLinePanel : public svx::sidebar::LinePropertyPanelBase,
+ public sfx2::sidebar::SidebarModelUpdate,
+ public ChartSidebarModifyListenerParent,
+ public ChartSidebarSelectionListenerParent
+{
+public:
+ static VclPtr<vcl::Window> Create(
+ vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ ChartController* pController);
+
+ // constructor/destuctor
+ ChartLinePanel(
+ vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ ChartController* pController);
+
+ virtual ~ChartLinePanel();
+
+ virtual void updateData() SAL_OVERRIDE;
+ virtual void modelInvalid() SAL_OVERRIDE;
+
+ virtual void selectionChanged(bool bCorrectType) SAL_OVERRIDE;
+ virtual void SelectionInvalid() SAL_OVERRIDE;
+
+ virtual void dispose() SAL_OVERRIDE;
+
+ virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) SAL_OVERRIDE;
+
+ 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:
+
+ css::uno::Reference<css::frame::XModel> mxModel;
+ css::uno::Reference<css::util::XModifyListener> mxListener;
+ rtl::Reference<ChartSidebarSelectionListener> mxSelectionListener;
+
+ void Initialize();
+
+ bool mbUpdate;
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.hxx b/include/svx/sidebar/LinePropertyPanelBase.hxx
similarity index 98%
rename from svx/source/sidebar/line/LinePropertyPanelBase.hxx
rename to include/svx/sidebar/LinePropertyPanelBase.hxx
index e5dd0d9..6133061 100644
--- a/svx/source/sidebar/line/LinePropertyPanelBase.hxx
+++ b/include/svx/sidebar/LinePropertyPanelBase.hxx
@@ -30,6 +30,7 @@
#include <svx/sidebar/PanelLayout.hxx>
#include <svx/xtable.hxx>
#include "LineWidthPopup.hxx"
+#include <svx/svxdllapi.h>
class XLineStyleItem;
@@ -61,7 +62,7 @@ namespace sidebar
class PopupContainer;
class LineWidthControl;
-class LinePropertyPanelBase : public PanelLayout
+class SVX_DLLPUBLIC LinePropertyPanelBase : public PanelLayout
{
public:
virtual ~LinePropertyPanelBase();
diff --git a/svx/source/sidebar/line/LineWidthPopup.hxx b/include/svx/sidebar/LineWidthPopup.hxx
similarity index 100%
rename from svx/source/sidebar/line/LineWidthPopup.hxx
rename to include/svx/sidebar/LineWidthPopup.hxx
diff --git a/svx/source/sidebar/line/LinePropertyPanel.hxx b/svx/source/sidebar/line/LinePropertyPanel.hxx
index 6a94423..45f90f9 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.hxx
+++ b/svx/source/sidebar/line/LinePropertyPanel.hxx
@@ -29,8 +29,7 @@
#include <memory>
#include <svx/sidebar/PanelLayout.hxx>
#include <svx/xtable.hxx>
-#include "LineWidthPopup.hxx"
-#include "LinePropertyPanelBase.hxx"
+#include <svx/sidebar/LinePropertyPanelBase.hxx>
class XLineStyleItem;
diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.cxx b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
index 14ad854..c04fa3f 100644
--- a/svx/source/sidebar/line/LinePropertyPanelBase.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
@@ -19,7 +19,7 @@
#include <sfx2/sidebar/ResourceDefinitions.hrc>
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/ControlFactory.hxx>
-#include <LinePropertyPanelBase.hxx>
+#include <svx/sidebar/LinePropertyPanelBase.hxx>
#include <LinePropertyPanel.hrc>
#include <svx/dialogs.hrc>
#include <svx/dialmgr.hxx>
diff --git a/svx/source/sidebar/line/LineWidthControl.cxx b/svx/source/sidebar/line/LineWidthControl.cxx
index 2bee185..4053c49 100644
--- a/svx/source/sidebar/line/LineWidthControl.cxx
+++ b/svx/source/sidebar/line/LineWidthControl.cxx
@@ -18,7 +18,7 @@
*/
#include "LineWidthControl.hxx"
#include "LinePropertyPanel.hrc"
-#include "LinePropertyPanelBase.hxx"
+#include <svx/sidebar/LinePropertyPanelBase.hxx>
#include <svx/dialogs.hrc>
#include <svx/dialmgr.hxx>
diff --git a/svx/source/sidebar/line/LineWidthPopup.cxx b/svx/source/sidebar/line/LineWidthPopup.cxx
index 968a58d..351d12d 100644
--- a/svx/source/sidebar/line/LineWidthPopup.cxx
+++ b/svx/source/sidebar/line/LineWidthPopup.cxx
@@ -16,9 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "LineWidthPopup.hxx"
+#include <svx/sidebar/LineWidthPopup.hxx>
#include "LineWidthControl.hxx"
-#include "LinePropertyPanel.hxx"
+
+#include <svx/sidebar/LinePropertyPanelBase.hxx>
#include <unotools/viewoptions.hxx>
commit fee180f13d48c1fa97a3ecde4b2067e5b0f13fc2
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Jul 28 18:52:30 2015 +0200
split the line width panel into two pieces
The new LinePropertyPanelBase has no reference to SfxBindings anymore.
Change-Id: I7d1d1bb351066dca8bfeedc559048f8337e47f67
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk
index 339b502..6fcce69 100644
--- a/svx/Library_svx.mk
+++ b/svx/Library_svx.mk
@@ -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 \
diff --git a/svx/source/sidebar/line/LinePropertyPanel.cxx b/svx/source/sidebar/line/LinePropertyPanel.cxx
index 59c56da..c025c86 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanel.cxx
@@ -55,102 +55,13 @@ using namespace css;
using namespace css::uno;
using sfx2::sidebar::Theme;
-const char UNO_SELECTWIDTH[] = ".uno:SelectWidth";
-
-namespace
-{
-
-void FillLineEndListBox(ListBox& rListBoxStart, ListBox& rListBoxEnd, const XLineEndList& rList)
-{
- const sal_uInt32 nCount(rList.Count());
- const OUString sNone(SVX_RESSTR(RID_SVXSTR_NONE));
-
- rListBoxStart.SetUpdateMode(false);
- rListBoxEnd.SetUpdateMode(false);
-
- rListBoxStart.Clear();
- rListBoxEnd.Clear();
-
- // add 'none' entries
- rListBoxStart.InsertEntry(sNone);
- rListBoxEnd.InsertEntry(sNone);
-
- for(sal_uInt32 i(0); i < nCount; i++)
- {
- XLineEndEntry* pEntry = rList.GetLineEnd(i);
- const Bitmap aBitmap = const_cast< XLineEndList& >(rList).GetUiBitmap(i);
-
- if(!aBitmap.IsEmpty())
- {
- Bitmap aCopyStart(aBitmap);
- Bitmap aCopyEnd(aBitmap);
-
- 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()));
-
- aCopyStart.Crop(aCropRectStart);
- rListBoxStart.InsertEntry(
- pEntry->GetName(),
- Image(aCopyStart));
-
- aCopyEnd.Crop(aCropRectEnd);
- rListBoxEnd.InsertEntry(
- pEntry->GetName(),
- Image(aCopyEnd));
- }
- else
- {
- rListBoxStart.InsertEntry(pEntry->GetName());
- rListBoxEnd.InsertEntry(pEntry->GetName());
- }
- }
-
- rListBoxStart.SetUpdateMode(true);
- rListBoxEnd.SetUpdateMode(true);
-}
-
-void FillLineStyleListBox(ListBox& rListBox, const XDashList& rList)
-{
- const sal_uInt32 nCount(rList.Count());
- rListBox.SetUpdateMode(false);
-
- rListBox.Clear();
-
- // entry for 'none'
- rListBox.InsertEntry(rList.GetStringForUiNoLine());
-
- // entry for solid line
- rListBox.InsertEntry(rList.GetStringForUiSolidLine(),
- Image( rList.GetBitmapForUISolidLine()));
-
- for(sal_uInt32 i(0); i < nCount; i++)
- {
- XDashEntry* pEntry = rList.GetDash(i);
- const Bitmap aBitmap = const_cast< XDashList& >(rList).GetUiBitmap(i);
-
- if(!aBitmap.IsEmpty())
- {
- rListBox.InsertEntry(pEntry->GetName(), Image(aBitmap));
- }
- else
- {
- rListBox.InsertEntry(pEntry->GetName());
- }
- }
-
- rListBox.SetUpdateMode(true);
-}
-
-} // end of anonymous namespace
-
namespace svx { namespace sidebar {
LinePropertyPanel::LinePropertyPanel(
vcl::Window* pParent,
const uno::Reference<frame::XFrame>& rxFrame,
SfxBindings* pBindings)
-: PanelLayout(pParent, "LinePropertyPanel", "svx/ui/sidebarline.ui", rxFrame),
+: LinePropertyPanelBase(pParent, rxFrame),
maStyleControl(SID_ATTR_LINE_STYLE, *pBindings, *this),
maDashControl (SID_ATTR_LINE_DASH, *pBindings, *this),
maWidthControl(SID_ATTR_LINE_WIDTH, *pBindings, *this),
@@ -161,36 +72,8 @@ LinePropertyPanel::LinePropertyPanel(
maTransControl(SID_ATTR_LINE_TRANSPARENCE, *pBindings, *this),
maEdgeStyle(SID_ATTR_LINE_JOINT, *pBindings, *this),
maCapStyle(SID_ATTR_LINE_CAP, *pBindings, *this),
- mpStyleItem(),
- mpDashItem(),
- mnTrans(0),
- meMapUnit(SFX_MAPUNIT_MM),
- mnWidthCoreValue(0),
- mpStartItem(),
- mpEndItem(),
- maLineWidthPopup(this, ::boost::bind(&LinePropertyPanel::CreateLineWidthPopupControl, this, _1)),
- maIMGNone(SVX_RES(IMG_NONE_ICON)),
- mpIMGWidthIcon(),
- mxFrame(rxFrame),
- mpBindings(pBindings),
- mbWidthValuable(true)
+ mpBindings(pBindings)
{
- get(mpFTWidth, "widthlabel");
- get(mpTBWidth, "width");
- get(mpFTStyle, "stylelabel");
- get(mpLBStyle, "linestyle");
- get(mpFTTransparency, "translabel");
- get(mpMFTransparent, "linetransparency");
- get(mpFTArrow, "arrowlabel");
- get(mpLBStart, "beginarrowstyle");
- get(mpLBEnd, "endarrowstyle");
- get(mpFTEdgeStyle, "cornerlabel");
- get(mpLBEdgeStyle, "edgestyle");
- get(mpFTCapStyle, "caplabel");
- get(mpLBCapStyle, "linecapstyle");
- get(mpGridLineProps, "lineproperties");
- get(mpBoxArrowProps, "arrowproperties");
-
Initialize();
}
@@ -201,24 +84,6 @@ LinePropertyPanel::~LinePropertyPanel()
void LinePropertyPanel::dispose()
{
- mpFTWidth.clear();
- mpTBWidth.clear();
- mpFTStyle.clear();
- mpLBStyle.clear();
- mpFTTransparency.clear();
- mpMFTransparent.clear();
- mpFTArrow.clear();
- mpLBStart.clear();
- mpLBEnd.clear();
- mpFTEdgeStyle.clear();
- mpLBEdgeStyle.clear();
- mpFTCapStyle.clear();
- mpLBCapStyle.clear();
- mpGridLineProps.clear();
- mpBoxArrowProps.clear();
-
-
- maLineWidthPopup.dispose();
maStyleControl.dispose();
maDashControl.dispose();
maWidthControl.dispose();
@@ -230,68 +95,11 @@ void LinePropertyPanel::dispose()
maEdgeStyle.dispose();
maCapStyle.dispose();
- PanelLayout::dispose();
+ LinePropertyPanelBase::dispose();
}
void LinePropertyPanel::Initialize()
{
- mpIMGWidthIcon.reset(new Image[8]);
- mpIMGWidthIcon[0] = Image(SVX_RES(IMG_WIDTH1_ICON));
- mpIMGWidthIcon[1] = Image(SVX_RES(IMG_WIDTH2_ICON));
- mpIMGWidthIcon[2] = Image(SVX_RES(IMG_WIDTH3_ICON));
- mpIMGWidthIcon[3] = Image(SVX_RES(IMG_WIDTH4_ICON));
- mpIMGWidthIcon[4] = Image(SVX_RES(IMG_WIDTH5_ICON));
- mpIMGWidthIcon[5] = Image(SVX_RES(IMG_WIDTH6_ICON));
- mpIMGWidthIcon[6] = Image(SVX_RES(IMG_WIDTH7_ICON));
- mpIMGWidthIcon[7] = Image(SVX_RES(IMG_WIDTH8_ICON));
-
- meMapUnit = maWidthControl.GetCoreMetric();
-
- FillLineStyleList();
- SelectLineStyle();
- Link<> aLink = LINK( this, LinePropertyPanel, ChangeLineStyleHdl );
- mpLBStyle->SetSelectHdl( aLink );
- mpLBStyle->SetAccessibleName(OUString( "Style"));
- mpLBStyle->AdaptDropDownLineCountToMaximum();
-
- const sal_uInt16 nIdWidth = mpTBWidth->GetItemId(UNO_SELECTWIDTH);
- mpTBWidth->SetItemImage(nIdWidth, mpIMGWidthIcon[0]);
- mpTBWidth->SetItemBits( nIdWidth, mpTBWidth->GetItemBits( nIdWidth ) | ToolBoxItemBits::DROPDOWNONLY );
- Link<ToolBox *, void> aLink2 = LINK(this, LinePropertyPanel, ToolboxWidthSelectHdl);
- mpTBWidth->SetDropdownClickHdl ( aLink2 );
- mpTBWidth->SetSelectHdl ( aLink2 );
-
- FillLineEndList();
- SelectEndStyle(true);
- SelectEndStyle(false);
- aLink = LINK( this, LinePropertyPanel, ChangeStartHdl );
- mpLBStart->SetSelectHdl( aLink );
- 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->AdaptDropDownLineCountToMaximum();
-
- aLink = LINK(this, LinePropertyPanel, ChangeTransparentHdl);
- mpMFTransparent->SetModifyHdl(aLink);
- mpMFTransparent->SetAccessibleName(OUString("Transparency")); //wj acc
-
- mpTBWidth->SetAccessibleRelationLabeledBy(mpFTWidth);
- mpLBStyle->SetAccessibleRelationLabeledBy(mpFTStyle);
- mpMFTransparent->SetAccessibleRelationLabeledBy(mpFTTransparency);
- mpLBStart->SetAccessibleRelationLabeledBy(mpFTArrow);
- mpLBEnd->SetAccessibleRelationLabeledBy(mpLBEnd);
-
- aLink = LINK( this, LinePropertyPanel, ChangeEdgeStyleHdl );
- mpLBEdgeStyle->SetSelectHdl( aLink );
- mpLBEdgeStyle->SetAccessibleName(OUString("Corner Style"));
-
- aLink = LINK( this, LinePropertyPanel, ChangeCapStyleHdl );
- mpLBCapStyle->SetSelectHdl( aLink );
- mpLBCapStyle->SetAccessibleName(OUString("Cap Style"));
-
- ActivateControls();
}
VclPtr<vcl::Window> LinePropertyPanel::Create (
@@ -309,10 +117,6 @@ VclPtr<vcl::Window> LinePropertyPanel::Create (
return VclPtr<LinePropertyPanel>::Create(pParent, rxFrame, pBindings);
}
-void LinePropertyPanel::DataChanged(const DataChangedEvent& /*rEvent*/)
-{
-}
-
void LinePropertyPanel::NotifyItemUpdate(
sal_uInt16 nSID,
SfxItemState eState,
@@ -320,174 +124,44 @@ void LinePropertyPanel::NotifyItemUpdate(
const bool /*bIsEnabled*/)
{
const bool bDisabled(SfxItemState::DISABLED == eState);
+ const bool bSetOrDefault = eState >= SfxItemState::DEFAULT;
switch(nSID)
{
case SID_ATTR_LINE_DASH:
+ {
+ const XLineDashItem* pItem = dynamic_cast<const XLineDashItem*>(pState);
+ updateLineDash(bDisabled, bSetOrDefault, pItem);
+ }
+ break;
case SID_ATTR_LINE_STYLE:
{
- if(bDisabled)
- {
- mpFTStyle->Disable();
- mpLBStyle->Disable();
- }
- else
- {
- mpFTStyle->Enable();
- mpLBStyle->Enable();
- }
-
- if(eState >= SfxItemState::DEFAULT)
- {
- if(nSID == SID_ATTR_LINE_STYLE)
- {
- const XLineStyleItem* pItem = dynamic_cast< const XLineStyleItem* >(pState);
-
- if(pItem)
- {
- mpStyleItem.reset(pState ? static_cast<XLineStyleItem*>(pItem->Clone()) : 0);
- }
- }
- else // if(nSID == SID_ATTR_LINE_DASH)
- {
- const XLineDashItem* pItem = dynamic_cast< const XLineDashItem* >(pState);
-
- if(pItem)
- {
- mpDashItem.reset(pState ? static_cast<XLineDashItem*>(pItem->Clone()) : 0);
- }
- }
- }
- else
- {
- if(nSID == SID_ATTR_LINE_STYLE)
- {
- mpStyleItem.reset(0);
- }
- else
- {
- mpDashItem.reset(0);
- }
- }
-
- SelectLineStyle();
- break;
+ const XLineStyleItem* pItem = dynamic_cast<const XLineStyleItem*>(pState);
+ updateLineStyle(bDisabled, bSetOrDefault, pItem);
}
+ break;
case SID_ATTR_LINE_TRANSPARENCE:
{
- if(bDisabled)
- {
- mpFTTransparency->Disable();
- mpMFTransparent->Disable();
- }
- else
- {
- mpFTTransparency->Enable();
- mpMFTransparent->Enable();
- }
-
- if(eState >= SfxItemState::DEFAULT)
- {
- const XLineTransparenceItem* pItem = dynamic_cast< const XLineTransparenceItem* >(pState);
-
- if(pItem)
- {
- mnTrans = pItem->GetValue();
- mpMFTransparent->SetValue(mnTrans);
- break;
- }
- }
-
- mpMFTransparent->SetValue(0);//add
- mpMFTransparent->SetText(OUString());
+ const XLineTransparenceItem* pItem = dynamic_cast<const XLineTransparenceItem*>(pState);
+ updateLineTransparence(bDisabled, bSetOrDefault, pItem);
break;
}
case SID_ATTR_LINE_WIDTH:
{
- if(bDisabled)
- {
- mpTBWidth->Disable();
- mpFTWidth->Disable();
- }
- else
- {
- mpTBWidth->Enable();
- mpFTWidth->Enable();
- }
-
- if(eState >= SfxItemState::DEFAULT)
- {
- const XLineWidthItem* pItem = dynamic_cast< const XLineWidthItem* >(pState);
-
- if(pItem)
- {
- mnWidthCoreValue = pItem->GetValue();
- mbWidthValuable = true;
- SetWidthIcon();
- break;
- }
- }
-
- mbWidthValuable = false;
- SetWidthIcon();
+ const XLineWidthItem* pItem = dynamic_cast<const XLineWidthItem*>(pState);
+ updateLineWidth(bDisabled, bSetOrDefault, pItem);
break;
}
case SID_ATTR_LINE_START:
{
- if(bDisabled)
- {
- mpFTArrow->Disable();
- mpLBStart->Disable();
- }
- else
- {
- mpFTArrow->Enable();
- mpLBStart->Enable();
- }
-
- if(eState >= SfxItemState::DEFAULT)
- {
- const XLineStartItem* pItem = dynamic_cast< const XLineStartItem* >(pState);
-
- if(pItem)
- {
- mpStartItem.reset(static_cast<XLineStartItem*>(pItem->Clone()));
- SelectEndStyle(true);
- break;
- }
- }
-
- mpStartItem.reset(0);
- SelectEndStyle(true);
+ const XLineStartItem* pItem = dynamic_cast<const XLineStartItem*>(pState);
+ updateLineStart(bDisabled, bSetOrDefault, pItem);
break;
}
case SID_ATTR_LINE_END:
{
- if(bDisabled)
- {
- mpFTArrow->Disable();
- mpLBEnd->Disable();
- }
- else
- {
- mpFTArrow->Enable();
- mpLBEnd->Enable();
- }
-
- if(eState >= SfxItemState::DEFAULT)
- {
- const XLineEndItem* pItem = dynamic_cast< const XLineEndItem* >(pState);
-
- if(pItem)
- {
- mpEndItem.reset(static_cast<XLineEndItem*>(pItem->Clone()));
- SelectEndStyle(false);
- break;
- }
- }
-
- mpEndItem.reset(0);
- SelectEndStyle(false);
+ const XLineEndItem* pItem = dynamic_cast<const XLineEndItem*>(pState);
+ updateLineEnd(bDisabled, bSetOrDefault, pItem);
break;
}
case SID_LINEEND_LIST:
@@ -505,492 +179,58 @@ void LinePropertyPanel::NotifyItemUpdate(
}
case SID_ATTR_LINE_JOINT:
{
- if(bDisabled)
- {
- mpLBEdgeStyle->Disable();
- mpFTEdgeStyle->Disable();
- }
- else
- {
- mpLBEdgeStyle->Enable();
- mpFTEdgeStyle->Enable();
- }
-
- if(eState >= SfxItemState::DEFAULT)
- {
- const XLineJointItem* pItem = dynamic_cast< const XLineJointItem* >(pState);
-
- if(pItem)
- {
- sal_Int32 nEntryPos(0);
-
- switch(pItem->GetValue())
- {
- case drawing::LineJoint_MIDDLE:
- case drawing::LineJoint_ROUND:
- {
- nEntryPos = 1;
- break;
- }
- case drawing::LineJoint_NONE:
- {
- nEntryPos = 2;
- break;
- }
- case drawing::LineJoint_MITER:
- {
- nEntryPos = 3;
- break;
- }
- case drawing::LineJoint_BEVEL:
- {
- nEntryPos = 4;
- break;
- }
-
- default:
- break;
- }
-
- if(nEntryPos)
- {
- mpLBEdgeStyle->SelectEntryPos(nEntryPos - 1);
- break;
- }
- }
- }
-
- mpLBEdgeStyle->SetNoSelection();
+ const XLineJointItem* pItem = dynamic_cast<const XLineJointItem*>(pState);
+ updateLineJoint(bDisabled, bSetOrDefault, pItem);
break;
}
case SID_ATTR_LINE_CAP:
{
- if(bDisabled)
- {
- mpLBCapStyle->Disable();
- mpFTCapStyle->Disable();
- }
- else
- {
- mpLBCapStyle->Enable();
- mpLBCapStyle->Enable();
- }
-
- if(eState >= SfxItemState::DEFAULT)
- {
- const XLineCapItem* pItem = dynamic_cast< const XLineCapItem* >(pState);
-
- if(pItem)
- {
- sal_Int32 nEntryPos(0);
-
- switch(pItem->GetValue())
- {
- case drawing::LineCap_BUTT:
- {
- nEntryPos = 1;
- break;
- }
- case drawing::LineCap_ROUND:
- {
- nEntryPos = 2;
- break;
- }
- case drawing::LineCap_SQUARE:
- {
- nEntryPos = 3;
- break;
- }
-
- default:
- break;
- }
-
- if(nEntryPos)
- {
- mpLBCapStyle->SelectEntryPos(nEntryPos - 1);
- break;
- }
- }
- }
-
- mpLBCapStyle->SetNoSelection();
+ const XLineCapItem* pItem = dynamic_cast<const XLineCapItem*>(pState);
+ updateLineCap(bDisabled, bSetOrDefault, pItem);
break;
}
}
ActivateControls();
}
-IMPL_LINK_NOARG(LinePropertyPanel, ChangeLineStyleHdl)
+void LinePropertyPanel::setLineStyle(const XLineStyleItem& rItem)
{
- const sal_Int32 nPos(mpLBStyle->GetSelectEntryPos());
-
- if(LISTBOX_ENTRY_NOTFOUND != nPos && mpLBStyle->IsValueChangedFromSaved())
- {
- if(0 == nPos)
- {
- // drawing::LineStyle_NONE
- const XLineStyleItem aItem(drawing::LineStyle_NONE);
-
- GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SfxCallMode::RECORD, &aItem, 0L);
- }
- else if(1 == nPos)
- {
- // drawing::LineStyle_SOLID
- const XLineStyleItem aItem(drawing::LineStyle_SOLID);
-
- GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SfxCallMode::RECORD, &aItem, 0L);
- }
- else if (mxLineStyleList.is() && mxLineStyleList->Count() > (long)(nPos - 2))
- {
- // drawing::LineStyle_DASH
- const XLineStyleItem aItemA(drawing::LineStyle_DASH);
- const XDashEntry* pDashEntry = mxLineStyleList->GetDash(nPos - 2);
- OSL_ENSURE(pDashEntry, "OOps, got empty XDash from XDashList (!)");
- const XLineDashItem aItemB(
- pDashEntry ? pDashEntry->GetName() : OUString(),
- pDashEntry ? pDashEntry->GetDash() : XDash());
-
- GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SfxCallMode::RECORD, &aItemA, 0L);
- GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_DASH, SfxCallMode::RECORD, &aItemB, 0L);
- }
- }
- ActivateControls();
- return 0;
+ GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SfxCallMode::RECORD, &rItem, 0L);
}
-IMPL_LINK_NOARG(LinePropertyPanel, ChangeStartHdl)
+void LinePropertyPanel::setLineDash(const XLineDashItem& rItem)
{
- sal_Int32 nPos = mpLBStart->GetSelectEntryPos();
- if( nPos != LISTBOX_ENTRY_NOTFOUND && mpLBStart->IsValueChangedFromSaved() )
- {
- std::unique_ptr<XLineStartItem> pItem;
- if( nPos == 0 )
- pItem.reset(new XLineStartItem());
- else if( mxLineEndList.is() && mxLineEndList->Count() > (long) ( nPos - 1 ) )
- pItem.reset(new XLineStartItem( mpLBStart->GetSelectEntry(),mxLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ));
- GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINEEND_STYLE, SfxCallMode::RECORD, pItem.get(), 0L);
- }
- return 0;
-}
-
-IMPL_LINK_NOARG(LinePropertyPanel, ChangeEndHdl)
-{
- sal_Int32 nPos = mpLBEnd->GetSelectEntryPos();
- if( nPos != LISTBOX_ENTRY_NOTFOUND && mpLBEnd->IsValueChangedFromSaved() )
- {
- std::unique_ptr<XLineEndItem> pItem;
- if( nPos == 0 )
- pItem.reset(new XLineEndItem());
- else if( mxLineEndList.is() && mxLineEndList->Count() > (long) ( nPos - 1 ) )
- pItem.reset(new XLineEndItem( mpLBEnd->GetSelectEntry(), mxLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ));
- GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINEEND_STYLE, SfxCallMode::RECORD, pItem.get(), 0L);
- }
- return 0;
-}
-
-IMPL_LINK_NOARG(LinePropertyPanel, ChangeEdgeStyleHdl)
-{
- const sal_Int32 nPos(mpLBEdgeStyle->GetSelectEntryPos());
-
- if(LISTBOX_ENTRY_NOTFOUND != nPos && mpLBEdgeStyle->IsValueChangedFromSaved())
- {
- std::unique_ptr<XLineJointItem> pItem;
-
- switch(nPos)
- {
- case 0: // rounded
- {
- pItem.reset(new XLineJointItem(drawing::LineJoint_ROUND));
- break;
- }
- case 1: // none
- {
- pItem.reset(new XLineJointItem(drawing::LineJoint_NONE));
- break;
- }
- case 2: // mitered
- {
- pItem.reset(new XLineJointItem(drawing::LineJoint_MITER));
- break;
- }
- case 3: // beveled
- {
- pItem.reset(new XLineJointItem(drawing::LineJoint_BEVEL));
- break;
- }
- }
-
- GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_JOINT, SfxCallMode::RECORD, pItem.get(), 0L);
- }
- return 0;
-}
-
-IMPL_LINK_NOARG(LinePropertyPanel, ChangeCapStyleHdl)
-{
- const sal_Int32 nPos(mpLBCapStyle->GetSelectEntryPos());
-
- if(LISTBOX_ENTRY_NOTFOUND != nPos && mpLBCapStyle->IsValueChangedFromSaved())
- {
- std::unique_ptr<XLineCapItem> pItem;
-
- switch(nPos)
- {
- case 0: // flat
- {
- pItem.reset(new XLineCapItem(drawing::LineCap_BUTT));
- break;
- }
- case 1: // round
- {
- pItem.reset(new XLineCapItem(drawing::LineCap_ROUND));
- break;
- }
- case 2: // square
- {
- pItem.reset(new XLineCapItem(drawing::LineCap_SQUARE));
- break;
- }
- }
-
- GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_CAP, SfxCallMode::RECORD, pItem.get(), 0L);
- }
- return 0;
-}
-
-IMPL_LINK_TYPED(LinePropertyPanel, ToolboxWidthSelectHdl,ToolBox*, pToolBox, void)
-{
- if (pToolBox->GetItemCommand(pToolBox->GetCurItemId()) == UNO_SELECTWIDTH)
- {
- maLineWidthPopup.SetWidthSelect(mnWidthCoreValue, mbWidthValuable, meMapUnit);
- maLineWidthPopup.Show(*pToolBox);
- }
-}
-
-IMPL_LINK_NOARG( LinePropertyPanel, ChangeTransparentHdl )
-{
- sal_uInt16 nVal = (sal_uInt16)mpMFTransparent->GetValue();
- XLineTransparenceItem aItem( nVal );
-
- GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SfxCallMode::RECORD, &aItem, 0L);
- return 0L;
-}
-
-VclPtr<PopupControl> LinePropertyPanel::CreateLineWidthPopupControl (PopupContainer* pParent)
-{
- return VclPtrInstance<LineWidthControl>(pParent, *this);
+ GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_DASH, SfxCallMode::RECORD, &rItem, 0L);
}
-void LinePropertyPanel::ActivateControls()
+void LinePropertyPanel::setLineEndStyle(const XLineEndItem* pItem)
{
- const sal_Int32 nPos(mpLBStyle->GetSelectEntryPos());
- bool bLineStyle( nPos != 0 );
-
- mpGridLineProps->Enable( bLineStyle );
- mpBoxArrowProps->Enable( bLineStyle );
-}
-
-void LinePropertyPanel::EndLineWidthPopupMode()
-{
- maLineWidthPopup.Hide();
-}
-
-void LinePropertyPanel::SetWidthIcon(int n)
-{
- const sal_uInt16 nIdWidth = mpTBWidth->GetItemId(UNO_SELECTWIDTH);
- if (n == 0)
- mpTBWidth->SetItemImage( nIdWidth, maIMGNone);
- else
- mpTBWidth->SetItemImage( nIdWidth, mpIMGWidthIcon[n-1]);
-}
-
-void LinePropertyPanel::SetWidthIcon()
-{
- if(!mbWidthValuable)
- {
- const sal_uInt16 nIdWidth = mpTBWidth->GetItemId(UNO_SELECTWIDTH);
- mpTBWidth->SetItemImage(nIdWidth, maIMGNone);
- return;
- }
-
- long nVal = LogicToLogic(mnWidthCoreValue * 10,(MapUnit)meMapUnit , MAP_POINT);
- const sal_uInt16 nIdWidth = mpTBWidth->GetItemId(UNO_SELECTWIDTH);
-
- if(nVal <= 6)
- mpTBWidth->SetItemImage( nIdWidth, mpIMGWidthIcon[0]);
- else if(nVal > 6 && nVal <= 9)
- mpTBWidth->SetItemImage( nIdWidth, mpIMGWidthIcon[1]);
- else if(nVal > 9 && nVal <= 12)
- mpTBWidth->SetItemImage( nIdWidth, mpIMGWidthIcon[2]);
- else if(nVal > 12 && nVal <= 19)
- mpTBWidth->SetItemImage( nIdWidth, mpIMGWidthIcon[3]);
- else if(nVal > 19 && nVal <= 26)
- mpTBWidth->SetItemImage( nIdWidth, mpIMGWidthIcon[4]);
- else if(nVal > 26 && nVal <= 37)
- mpTBWidth->SetItemImage( nIdWidth, mpIMGWidthIcon[5]);
- else if(nVal > 37 && nVal <=52)
- mpTBWidth->SetItemImage( nIdWidth, mpIMGWidthIcon[6]);
- else if(nVal > 52)
- mpTBWidth->SetItemImage( nIdWidth, mpIMGWidthIcon[7]);
-
+ GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINEEND_STYLE, SfxCallMode::RECORD, pItem, 0L);
}
-void LinePropertyPanel::SetWidth(long nWidth)
+void LinePropertyPanel::setLineStartStyle(const XLineStartItem* pItem)
{
- mnWidthCoreValue = nWidth;
- mbWidthValuable = true;
+ GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINEEND_STYLE, SfxCallMode::RECORD, pItem, 0L);
}
-void LinePropertyPanel::FillLineEndList()
+void LinePropertyPanel::setLineJoint(const XLineJointItem* pItem)
{
- SfxObjectShell* pSh = SfxObjectShell::Current();
- if ( pSh && pSh->GetItem( SID_LINEEND_LIST ) )
- {
- mpLBStart->Enable();
- SvxLineEndListItem aItem( *static_cast<const SvxLineEndListItem*>(pSh->GetItem( SID_LINEEND_LIST ) ) );
- mxLineEndList = aItem.GetLineEndList();
-
- if (mxLineEndList.is())
- {
- FillLineEndListBox(*mpLBStart, *mpLBEnd, *mxLineEndList);
- }
-
- mpLBStart->SelectEntryPos(0);
- mpLBEnd->SelectEntryPos(0);
- }
- else
- {
- mpLBStart->Disable();
- mpLBEnd->Disable();
- }
+ GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_JOINT, SfxCallMode::RECORD, pItem, 0L);
}
-void LinePropertyPanel::FillLineStyleList()
+void LinePropertyPanel::setLineCap(const XLineCapItem* pItem)
{
- SfxObjectShell* pSh = SfxObjectShell::Current();
- if ( pSh && pSh->GetItem( SID_DASH_LIST ) )
- {
- mpLBStyle->Enable();
- SvxDashListItem aItem( *static_cast<const SvxDashListItem*>(pSh->GetItem( SID_DASH_LIST ) ) );
- mxLineStyleList = aItem.GetDashList();
-
- if (mxLineStyleList.is())
- {
- FillLineStyleListBox(*mpLBStyle, *mxLineStyleList);
- }
-
- mpLBStyle->SelectEntryPos(0);
- }
- else
- {
- mpLBStyle->Disable();
- }
+ GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_CAP, SfxCallMode::RECORD, pItem, 0L);
}
-void LinePropertyPanel::SelectLineStyle()
+void LinePropertyPanel::setLineTransparency(const XLineTransparenceItem& rItem)
{
- if( !mpStyleItem.get() || !mpDashItem.get() )
- {
- mpLBStyle->SetNoSelection();
- mpLBStyle->Disable();
- return;
- }
-
- const drawing::LineStyle eXLS(mpStyleItem ? (drawing::LineStyle)mpStyleItem->GetValue() : drawing::LineStyle_NONE);
- bool bSelected(false);
-
- switch(eXLS)
- {
- case drawing::LineStyle_NONE:
- break;
- case drawing::LineStyle_SOLID:
- mpLBStyle->SelectEntryPos(1);
- bSelected = true;
- break;
- default:
- if(mpDashItem && mxLineStyleList.is())
- {
- const XDash& rDash = mpDashItem->GetDashValue();
- for(sal_Int32 a(0);!bSelected && a < mxLineStyleList->Count(); a++)
- {
- XDashEntry* pEntry = mxLineStyleList->GetDash(a);
- const XDash& rEntry = pEntry->GetDash();
- if(rDash == rEntry)
- {
- mpLBStyle->SelectEntryPos(a + 2);
- bSelected = true;
- }
- }
- }
- break;
- }
-
- if(!bSelected)
- mpLBStyle->SelectEntryPos( 0 );
+ GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SfxCallMode::RECORD, &rItem, 0L);
}
-void LinePropertyPanel::SelectEndStyle(bool bStart)
+void LinePropertyPanel::setLineWidth(const XLineWidthItem& rItem)
{
- bool bSelected(false);
-
- if(bStart)
- {
- if( !mpStartItem.get() )
- {
- mpLBStart->SetNoSelection();
- mpLBStart->Disable();
- return;
- }
-
- if (mpStartItem && mxLineEndList.is())
- {
- const basegfx::B2DPolyPolygon& rItemPolygon = mpStartItem->GetLineStartValue();
- for(sal_Int32 a(0);!bSelected && a < mxLineEndList->Count(); a++)
- {
- XLineEndEntry* pEntry = mxLineEndList->GetLineEnd(a);
- const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
- if(rItemPolygon == rEntryPolygon)
- {
- mpLBStart->SelectEntryPos(a + 1);
- bSelected = true;
- }
- }
- }
-
- if(!bSelected)
- {
- mpLBStart->SelectEntryPos( 0 );
- }
- }
- else
- {
- if( !mpEndItem.get() )
- {
- mpLBEnd->SetNoSelection();
- mpLBEnd->Disable();
- return;
- }
-
- if (mpEndItem && mxLineEndList.is())
- {
- const basegfx::B2DPolyPolygon& rItemPolygon = mpEndItem->GetLineEndValue();
- for(sal_Int32 a(0);!bSelected && a < mxLineEndList->Count(); a++)
- {
- XLineEndEntry* pEntry = mxLineEndList->GetLineEnd(a);
- const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
- if(rItemPolygon == rEntryPolygon)
- {
- mpLBEnd->SelectEntryPos(a + 1);
- bSelected = true;
- }
- }
- }
-
- if(!bSelected)
- {
- mpLBEnd->SelectEntryPos( 0 );
- }
- }
+ GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_WIDTH, SfxCallMode::RECORD, &rItem, 0L);
}
}} // end of namespace svx::sidebar
diff --git a/svx/source/sidebar/line/LinePropertyPanel.hxx b/svx/source/sidebar/line/LinePropertyPanel.hxx
index cfbcd4a..6a94423 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.hxx
+++ b/svx/source/sidebar/line/LinePropertyPanel.hxx
@@ -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
diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.cxx b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
new file mode 100644
index 0000000..14ad854
--- /dev/null
+++ b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
@@ -0,0 +1,930 @@
+/* -*- 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 .
+ */
+#include <sfx2/sidebar/ResourceDefinitions.hrc>
+#include <sfx2/sidebar/Theme.hxx>
+#include <sfx2/sidebar/ControlFactory.hxx>
+#include <LinePropertyPanelBase.hxx>
+#include <LinePropertyPanel.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/xtable.hxx>
+#include <svx/xdash.hxx>
+#include <svx/drawitem.hxx>
+#include <svx/svxitems.hrc>
+#include <svtools/valueset.hxx>
+#include <unotools/pathoptions.hxx>
+#include <unotools/viewoptions.hxx>
+#include <comphelper/processfactory.hxx>
+#include <i18nlangtag/mslangid.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xlndsit.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/xlnwtit.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/toolbox.hxx>
+#include <svx/xlntrit.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xlncapit.hxx>
+#include <svx/xlinjoit.hxx>
+#include "svx/sidebar/PopupContainer.hxx"
+#include "svx/sidebar/PopupControl.hxx"
+#include "LineWidthControl.hxx"
+#include <boost/bind.hpp>
+
+using namespace css;
+using namespace css::uno;
+using sfx2::sidebar::Theme;
+
+const char UNO_SELECTWIDTH[] = ".uno:SelectWidth";
+
+namespace
+{
+
+void FillLineEndListBox(ListBox& rListBoxStart, ListBox& rListBoxEnd, const XLineEndList& rList)
+{
+ const sal_uInt32 nCount(rList.Count());
+ const OUString sNone(SVX_RESSTR(RID_SVXSTR_NONE));
+
+ rListBoxStart.SetUpdateMode(false);
+ rListBoxEnd.SetUpdateMode(false);
+
+ rListBoxStart.Clear();
+ rListBoxEnd.Clear();
+
+ // add 'none' entries
+ rListBoxStart.InsertEntry(sNone);
+ rListBoxEnd.InsertEntry(sNone);
+
+ for(sal_uInt32 i(0); i < nCount; i++)
+ {
+ XLineEndEntry* pEntry = rList.GetLineEnd(i);
+ const Bitmap aBitmap = const_cast< XLineEndList& >(rList).GetUiBitmap(i);
+
+ if(!aBitmap.IsEmpty())
+ {
+ Bitmap aCopyStart(aBitmap);
+ Bitmap aCopyEnd(aBitmap);
+
+ 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()));
+
+ aCopyStart.Crop(aCropRectStart);
+ rListBoxStart.InsertEntry(
+ pEntry->GetName(),
+ Image(aCopyStart));
+
+ aCopyEnd.Crop(aCropRectEnd);
+ rListBoxEnd.InsertEntry(
+ pEntry->GetName(),
+ Image(aCopyEnd));
+ }
+ else
+ {
+ rListBoxStart.InsertEntry(pEntry->GetName());
+ rListBoxEnd.InsertEntry(pEntry->GetName());
+ }
+ }
+
+ rListBoxStart.SetUpdateMode(true);
+ rListBoxEnd.SetUpdateMode(true);
+}
+
+void FillLineStyleListBox(ListBox& rListBox, const XDashList& rList)
+{
+ const sal_uInt32 nCount(rList.Count());
+ rListBox.SetUpdateMode(false);
+
+ rListBox.Clear();
+
+ // entry for 'none'
+ rListBox.InsertEntry(rList.GetStringForUiNoLine());
+
+ // entry for solid line
+ rListBox.InsertEntry(rList.GetStringForUiSolidLine(),
+ Image( rList.GetBitmapForUISolidLine()));
+
+ for(sal_uInt32 i(0); i < nCount; i++)
+ {
+ XDashEntry* pEntry = rList.GetDash(i);
+ const Bitmap aBitmap = const_cast< XDashList& >(rList).GetUiBitmap(i);
+
+ if(!aBitmap.IsEmpty())
+ {
+ rListBox.InsertEntry(pEntry->GetName(), Image(aBitmap));
+ }
+ else
+ {
+ rListBox.InsertEntry(pEntry->GetName());
+ }
+ }
+
+ rListBox.SetUpdateMode(true);
+}
+
+} // end of anonymous namespace
+
+namespace svx { namespace sidebar {
+
+LinePropertyPanelBase::LinePropertyPanelBase(
+ vcl::Window* pParent,
+ const uno::Reference<frame::XFrame>& rxFrame)
+: PanelLayout(pParent, "LinePropertyPanelBase", "svx/ui/sidebarline.ui", rxFrame),
+ mpStyleItem(),
+ mpDashItem(),
+ mnTrans(0),
+ meMapUnit(SFX_MAPUNIT_MM),
+ mnWidthCoreValue(0),
+ mpStartItem(),
+ mpEndItem(),
+ maLineWidthPopup(this, ::boost::bind(&LinePropertyPanelBase::CreateLineWidthPopupControl, this, _1)),
+ maIMGNone(SVX_RES(IMG_NONE_ICON)),
+ mpIMGWidthIcon(),
+ mxFrame(rxFrame),
+ mbWidthValuable(true)
+{
+ get(mpFTWidth, "widthlabel");
+ get(mpTBWidth, "width");
+ get(mpFTStyle, "stylelabel");
+ get(mpLBStyle, "linestyle");
+ get(mpFTTransparency, "translabel");
+ get(mpMFTransparent, "linetransparency");
+ get(mpFTArrow, "arrowlabel");
+ get(mpLBStart, "beginarrowstyle");
+ get(mpLBEnd, "endarrowstyle");
+ get(mpFTEdgeStyle, "cornerlabel");
+ get(mpLBEdgeStyle, "edgestyle");
+ get(mpFTCapStyle, "caplabel");
+ get(mpLBCapStyle, "linecapstyle");
+ get(mpGridLineProps, "lineproperties");
+ get(mpBoxArrowProps, "arrowproperties");
+
+ Initialize();
+}
+
+LinePropertyPanelBase::~LinePropertyPanelBase()
+{
+ disposeOnce();
+}
+
+void LinePropertyPanelBase::dispose()
+{
+ mpFTWidth.clear();
+ mpTBWidth.clear();
+ mpFTStyle.clear();
+ mpLBStyle.clear();
+ mpFTTransparency.clear();
+ mpMFTransparent.clear();
+ mpFTArrow.clear();
+ mpLBStart.clear();
+ mpLBEnd.clear();
+ mpFTEdgeStyle.clear();
+ mpLBEdgeStyle.clear();
+ mpFTCapStyle.clear();
+ mpLBCapStyle.clear();
+ mpGridLineProps.clear();
+ mpBoxArrowProps.clear();
+
+ PanelLayout::dispose();
+}
+
+void LinePropertyPanelBase::Initialize()
+{
+ mpIMGWidthIcon.reset(new Image[8]);
+ mpIMGWidthIcon[0] = Image(SVX_RES(IMG_WIDTH1_ICON));
+ mpIMGWidthIcon[1] = Image(SVX_RES(IMG_WIDTH2_ICON));
+ mpIMGWidthIcon[2] = Image(SVX_RES(IMG_WIDTH3_ICON));
+ mpIMGWidthIcon[3] = Image(SVX_RES(IMG_WIDTH4_ICON));
+ mpIMGWidthIcon[4] = Image(SVX_RES(IMG_WIDTH5_ICON));
+ mpIMGWidthIcon[5] = Image(SVX_RES(IMG_WIDTH6_ICON));
+ mpIMGWidthIcon[6] = Image(SVX_RES(IMG_WIDTH7_ICON));
+ mpIMGWidthIcon[7] = Image(SVX_RES(IMG_WIDTH8_ICON));
+
+ // meMapUnit = maWidthControl.GetCoreMetric();
+
+ FillLineStyleList();
+ SelectLineStyle();
+ Link<> aLink = LINK( this, LinePropertyPanelBase, ChangeLineStyleHdl );
+ mpLBStyle->SetSelectHdl( aLink );
+ mpLBStyle->SetAccessibleName(OUString( "Style"));
+ mpLBStyle->AdaptDropDownLineCountToMaximum();
+
+ const sal_uInt16 nIdWidth = mpTBWidth->GetItemId(UNO_SELECTWIDTH);
+ mpTBWidth->SetItemImage(nIdWidth, mpIMGWidthIcon[0]);
+ mpTBWidth->SetItemBits( nIdWidth, mpTBWidth->GetItemBits( nIdWidth ) | ToolBoxItemBits::DROPDOWNONLY );
+ Link<ToolBox *, void> aLink2 = LINK(this, LinePropertyPanelBase, ToolboxWidthSelectHdl);
+ mpTBWidth->SetDropdownClickHdl ( aLink2 );
+ mpTBWidth->SetSelectHdl ( aLink2 );
+
+ FillLineEndList();
+ SelectEndStyle(true);
+ SelectEndStyle(false);
+ aLink = LINK( this, LinePropertyPanelBase, ChangeStartHdl );
+ mpLBStart->SetSelectHdl( aLink );
+ mpLBStart->SetAccessibleName(OUString("Beginning Style")); //wj acc
+ mpLBStart->AdaptDropDownLineCountToMaximum();
+ aLink = LINK( this, LinePropertyPanelBase, ChangeEndHdl );
+ mpLBEnd->SetSelectHdl( aLink );
+ mpLBEnd->SetAccessibleName(OUString("Ending Style")); //wj acc
+ mpLBEnd->AdaptDropDownLineCountToMaximum();
+
+ aLink = LINK(this, LinePropertyPanelBase, ChangeTransparentHdl);
+ mpMFTransparent->SetModifyHdl(aLink);
+ mpMFTransparent->SetAccessibleName(OUString("Transparency")); //wj acc
+
+ mpTBWidth->SetAccessibleRelationLabeledBy(mpFTWidth);
+ mpLBStyle->SetAccessibleRelationLabeledBy(mpFTStyle);
+ mpMFTransparent->SetAccessibleRelationLabeledBy(mpFTTransparency);
+ mpLBStart->SetAccessibleRelationLabeledBy(mpFTArrow);
+ mpLBEnd->SetAccessibleRelationLabeledBy(mpLBEnd);
+
+ aLink = LINK( this, LinePropertyPanelBase, ChangeEdgeStyleHdl );
+ mpLBEdgeStyle->SetSelectHdl( aLink );
+ mpLBEdgeStyle->SetAccessibleName(OUString("Corner Style"));
+
+ aLink = LINK( this, LinePropertyPanelBase, ChangeCapStyleHdl );
+ mpLBCapStyle->SetSelectHdl( aLink );
+ mpLBCapStyle->SetAccessibleName(OUString("Cap Style"));
+}
+
+void LinePropertyPanelBase::DataChanged(const DataChangedEvent& /*rEvent*/)
+{
+}
+
+void LinePropertyPanelBase::updateLineStyle(bool bDisabled, bool bSetOrDefault, const XLineStyleItem* pItem)
+{
+ if(bDisabled)
+ {
+ mpFTStyle->Disable();
+ mpLBStyle->Disable();
+ }
+ else
+ {
+ mpFTStyle->Enable();
+ mpLBStyle->Enable();
+ }
+
+ if(bSetOrDefault)
+ {
+ if(pItem)
+ {
+ mpStyleItem.reset(static_cast<XLineStyleItem*>(pItem->Clone()));
+ }
+ }
+ else
+ {
+ mpStyleItem.reset(0);
+ }
+
+ SelectLineStyle();
+}
+
+void LinePropertyPanelBase::updateLineDash(bool bDisabled, bool bSetOrDefault, const XLineDashItem* pItem)
+{
+ if(bDisabled)
+ {
+ mpFTStyle->Disable();
+ mpLBStyle->Disable();
+ }
+ else
+ {
+ mpFTStyle->Enable();
+ mpLBStyle->Enable();
+ }
+
+ if(bSetOrDefault)
+ {
+ if(pItem)
+ {
+ mpDashItem.reset(static_cast<XLineDashItem*>(pItem->Clone()));
+ }
+ }
+ else
+ {
+ mpDashItem.reset();
+ }
+
+ SelectLineStyle();
+}
+
+void LinePropertyPanelBase::updateLineTransparence(bool bDisabled, bool bSetOrDefault,
+ const XLineTransparenceItem* pItem)
+{
+ if(bDisabled)
+ {
+ mpFTTransparency->Disable();
+ mpMFTransparent->Disable();
+ }
+ else
+ {
+ mpFTTransparency->Enable();
+ mpMFTransparent->Enable();
+ }
+
+ if(bSetOrDefault)
+ {
+ if(pItem)
+ {
+ mnTrans = pItem->GetValue();
+ mpMFTransparent->SetValue(mnTrans);
+ return;
+ }
+ }
+
+ mpMFTransparent->SetValue(0);//add
+ mpMFTransparent->SetText(OUString());
+}
+
+void LinePropertyPanelBase::updateLineWidth(bool bDisabled, bool bSetOrDefault,
+ const XLineWidthItem* pItem)
+{
+ if(bDisabled)
+ {
+ mpTBWidth->Disable();
+ mpFTWidth->Disable();
+ }
+ else
+ {
+ mpTBWidth->Enable();
+ mpFTWidth->Enable();
+ }
+
+ if(bSetOrDefault)
+ {
+ if(pItem)
+ {
+ mnWidthCoreValue = pItem->GetValue();
+ mbWidthValuable = true;
+ SetWidthIcon();
+ return;
+ }
+ }
+
+ mbWidthValuable = false;
+ SetWidthIcon();
+}
+
+void LinePropertyPanelBase::updateLineStart(bool bDisabled, bool bSetOrDefault,
+ const XLineStartItem* pItem)
+{
+ if(bDisabled)
+ {
+ mpFTArrow->Disable();
+ mpLBStart->Disable();
+ }
+ else
+ {
+ mpFTArrow->Enable();
+ mpLBStart->Enable();
+ }
+
+ if(bSetOrDefault)
+ {
+ if(pItem)
+ {
+ mpStartItem.reset(static_cast<XLineStartItem*>(pItem->Clone()));
+ SelectEndStyle(true);
+ return;
+ }
+ }
+
+ mpStartItem.reset(0);
+ SelectEndStyle(true);
+}
+
+void LinePropertyPanelBase::updateLineEnd(bool bDisabled, bool bSetOrDefault,
+ const XLineEndItem* pItem)
+{
+ if(bDisabled)
+ {
+ mpFTArrow->Disable();
+ mpLBEnd->Disable();
+ }
+ else
+ {
+ mpFTArrow->Enable();
+ mpLBEnd->Enable();
+ }
+
+ if(bSetOrDefault)
+ {
+ if(pItem)
+ {
+ mpEndItem.reset(static_cast<XLineEndItem*>(pItem->Clone()));
+ SelectEndStyle(false);
+ return;
+ }
+ }
+
+ mpEndItem.reset(0);
+ SelectEndStyle(false);
+}
+
+void LinePropertyPanelBase::updateLineJoint(bool bDisabled, bool bSetOrDefault,
+ const XLineJointItem* pItem)
+{
+ if(bDisabled)
+ {
+ mpLBEdgeStyle->Disable();
+ mpFTEdgeStyle->Disable();
+ }
+ else
+ {
+ mpLBEdgeStyle->Enable();
+ mpFTEdgeStyle->Enable();
+ }
+
+ if(bSetOrDefault)
+ {
+ if(pItem)
+ {
+ sal_Int32 nEntryPos(0);
+
+ switch(pItem->GetValue())
+ {
+ case drawing::LineJoint_MIDDLE:
+ case drawing::LineJoint_ROUND:
+ {
+ nEntryPos = 1;
+ break;
+ }
+ case drawing::LineJoint_NONE:
+ {
+ nEntryPos = 2;
+ break;
+ }
+ case drawing::LineJoint_MITER:
+ {
+ nEntryPos = 3;
+ break;
+ }
+ case drawing::LineJoint_BEVEL:
+ {
+ nEntryPos = 4;
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ if(nEntryPos)
+ {
+ mpLBEdgeStyle->SelectEntryPos(nEntryPos - 1);
+ return;
+ }
+ }
+ }
+
+ mpLBEdgeStyle->SetNoSelection();
+}
+
+void LinePropertyPanelBase::updateLineCap(bool bDisabled, bool bSetOrDefault,
+ const XLineCapItem* pItem)
+{
+ if(bDisabled)
+ {
+ mpLBCapStyle->Disable();
+ mpFTCapStyle->Disable();
+ }
+ else
+ {
+ mpLBCapStyle->Enable();
+ mpLBCapStyle->Enable();
+ }
+
+ if(bSetOrDefault)
+ {
+ if(pItem)
+ {
+ sal_Int32 nEntryPos(0);
+
+ switch(pItem->GetValue())
+ {
+ case drawing::LineCap_BUTT:
+ {
+ nEntryPos = 1;
+ break;
+ }
+ case drawing::LineCap_ROUND:
+ {
+ nEntryPos = 2;
+ break;
+ }
+ case drawing::LineCap_SQUARE:
+ {
+ nEntryPos = 3;
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ if(nEntryPos)
+ {
+ mpLBCapStyle->SelectEntryPos(nEntryPos - 1);
+ return;
+ }
+ }
+ }
+
+ mpLBCapStyle->SetNoSelection();
+}
+
+IMPL_LINK_NOARG(LinePropertyPanelBase, ChangeLineStyleHdl)
+{
+ const sal_Int32 nPos(mpLBStyle->GetSelectEntryPos());
+
+ if(LISTBOX_ENTRY_NOTFOUND != nPos && mpLBStyle->IsValueChangedFromSaved())
+ {
+ if(0 == nPos)
+ {
+ // drawing::LineStyle_NONE
+ const XLineStyleItem aItem(drawing::LineStyle_NONE);
+
+ setLineStyle(aItem);
+ }
+ else if(1 == nPos)
+ {
+ // drawing::LineStyle_SOLID
+ const XLineStyleItem aItem(drawing::LineStyle_SOLID);
+
+ setLineStyle(aItem);
+ }
+ else if (mxLineStyleList.is() && mxLineStyleList->Count() > (long)(nPos - 2))
+ {
+ // drawing::LineStyle_DASH
+ const XLineStyleItem aItemA(drawing::LineStyle_DASH);
+ const XDashEntry* pDashEntry = mxLineStyleList->GetDash(nPos - 2);
+ OSL_ENSURE(pDashEntry, "OOps, got empty XDash from XDashList (!)");
+ const XLineDashItem aItemB(
+ pDashEntry ? pDashEntry->GetName() : OUString(),
+ pDashEntry ? pDashEntry->GetDash() : XDash());
+
+ setLineStyle(aItemA);
+ setLineDash(aItemB);
+ }
+ }
+
+ ActivateControls();
+ return 0;
+}
+
+IMPL_LINK_NOARG(LinePropertyPanelBase, ChangeStartHdl)
+{
+ sal_Int32 nPos = mpLBStart->GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND && mpLBStart->IsValueChangedFromSaved() )
+ {
+ std::unique_ptr<XLineStartItem> pItem;
+ if( nPos == 0 )
+ pItem.reset(new XLineStartItem());
+ else if( mxLineEndList.is() && mxLineEndList->Count() > (long) ( nPos - 1 ) )
+ pItem.reset(new XLineStartItem( mpLBStart->GetSelectEntry(),mxLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ));
+ setLineStartStyle(pItem.get());
+ }
+ return 0;
+}
+
+IMPL_LINK_NOARG(LinePropertyPanelBase, ChangeEndHdl)
+{
+ sal_Int32 nPos = mpLBEnd->GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND && mpLBEnd->IsValueChangedFromSaved() )
+ {
+ std::unique_ptr<XLineEndItem> pItem;
+ if( nPos == 0 )
+ pItem.reset(new XLineEndItem());
+ else if( mxLineEndList.is() && mxLineEndList->Count() > (long) ( nPos - 1 ) )
+ pItem.reset(new XLineEndItem( mpLBEnd->GetSelectEntry(), mxLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ));
+ setLineEndStyle(pItem.get());
+ }
+ return 0;
+}
+
+IMPL_LINK_NOARG(LinePropertyPanelBase, ChangeEdgeStyleHdl)
+{
+ const sal_Int32 nPos(mpLBEdgeStyle->GetSelectEntryPos());
+
+ if(LISTBOX_ENTRY_NOTFOUND != nPos && mpLBEdgeStyle->IsValueChangedFromSaved())
+ {
+ std::unique_ptr<XLineJointItem> pItem;
+
+ switch(nPos)
+ {
+ case 0: // rounded
+ {
+ pItem.reset(new XLineJointItem(drawing::LineJoint_ROUND));
+ break;
+ }
+ case 1: // none
+ {
+ pItem.reset(new XLineJointItem(drawing::LineJoint_NONE));
+ break;
+ }
+ case 2: // mitered
+ {
+ pItem.reset(new XLineJointItem(drawing::LineJoint_MITER));
+ break;
+ }
+ case 3: // beveled
+ {
+ pItem.reset(new XLineJointItem(drawing::LineJoint_BEVEL));
+ break;
+ }
+ }
+
+ setLineJoint(pItem.get());
+ }
+ return 0;
+}
+
+IMPL_LINK_NOARG(LinePropertyPanelBase, ChangeCapStyleHdl)
+{
+ const sal_Int32 nPos(mpLBCapStyle->GetSelectEntryPos());
+
+ if(LISTBOX_ENTRY_NOTFOUND != nPos && mpLBCapStyle->IsValueChangedFromSaved())
+ {
+ std::unique_ptr<XLineCapItem> pItem;
+
+ switch(nPos)
+ {
+ case 0: // flat
+ {
+ pItem.reset(new XLineCapItem(drawing::LineCap_BUTT));
+ break;
+ }
+ case 1: // round
+ {
+ pItem.reset(new XLineCapItem(drawing::LineCap_ROUND));
+ break;
+ }
+ case 2: // square
+ {
+ pItem.reset(new XLineCapItem(drawing::LineCap_SQUARE));
+ break;
+ }
+ }
+
+ setLineCap(pItem.get());
+ }
+ return 0;
+}
+
+IMPL_LINK_TYPED(LinePropertyPanelBase, ToolboxWidthSelectHdl,ToolBox*, pToolBox, void)
+{
+ if (pToolBox->GetItemCommand(pToolBox->GetCurItemId()) == UNO_SELECTWIDTH)
+ {
+ maLineWidthPopup.SetWidthSelect(mnWidthCoreValue, mbWidthValuable, meMapUnit);
+ maLineWidthPopup.Show(*pToolBox);
+ }
+}
+
+IMPL_LINK_NOARG( LinePropertyPanelBase, ChangeTransparentHdl )
+{
+ sal_uInt16 nVal = (sal_uInt16)mpMFTransparent->GetValue();
+ XLineTransparenceItem aItem( nVal );
+
+ setLineTransparency(aItem);
+ return 0L;
+}
+
+VclPtr<PopupControl> LinePropertyPanelBase::CreateLineWidthPopupControl (PopupContainer* pParent)
+{
+ return VclPtrInstance<LineWidthControl>(pParent, *this);
+}
+
+void LinePropertyPanelBase::EndLineWidthPopupMode()
+{
+ maLineWidthPopup.Hide();
+}
+
+void LinePropertyPanelBase::SetWidthIcon(int n)
+{
+ const sal_uInt16 nIdWidth = mpTBWidth->GetItemId(UNO_SELECTWIDTH);
+ if (n == 0)
+ mpTBWidth->SetItemImage( nIdWidth, maIMGNone);
+ else
+ mpTBWidth->SetItemImage( nIdWidth, mpIMGWidthIcon[n-1]);
+}
+
+void LinePropertyPanelBase::SetWidthIcon()
+{
+ if(!mbWidthValuable)
+ {
+ const sal_uInt16 nIdWidth = mpTBWidth->GetItemId(UNO_SELECTWIDTH);
+ mpTBWidth->SetItemImage(nIdWidth, maIMGNone);
+ return;
+ }
+
+ long nVal = LogicToLogic(mnWidthCoreValue * 10,(MapUnit)meMapUnit , MAP_POINT);
+ const sal_uInt16 nIdWidth = mpTBWidth->GetItemId(UNO_SELECTWIDTH);
+
+ if(nVal <= 6)
+ mpTBWidth->SetItemImage( nIdWidth, mpIMGWidthIcon[0]);
+ else if(nVal > 6 && nVal <= 9)
+ mpTBWidth->SetItemImage( nIdWidth, mpIMGWidthIcon[1]);
+ else if(nVal > 9 && nVal <= 12)
+ mpTBWidth->SetItemImage( nIdWidth, mpIMGWidthIcon[2]);
+ else if(nVal > 12 && nVal <= 19)
+ mpTBWidth->SetItemImage( nIdWidth, mpIMGWidthIcon[3]);
+ else if(nVal > 19 && nVal <= 26)
+ mpTBWidth->SetItemImage( nIdWidth, mpIMGWidthIcon[4]);
+ else if(nVal > 26 && nVal <= 37)
+ mpTBWidth->SetItemImage( nIdWidth, mpIMGWidthIcon[5]);
+ else if(nVal > 37 && nVal <=52)
+ mpTBWidth->SetItemImage( nIdWidth, mpIMGWidthIcon[6]);
+ else if(nVal > 52)
+ mpTBWidth->SetItemImage( nIdWidth, mpIMGWidthIcon[7]);
+
+}
+
+void LinePropertyPanelBase::SetWidth(long nWidth)
+{
+ mnWidthCoreValue = nWidth;
+ mbWidthValuable = true;
+}
+
+void LinePropertyPanelBase::FillLineEndList()
+{
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+ if ( pSh && pSh->GetItem( SID_LINEEND_LIST ) )
+ {
+ mpLBStart->Enable();
+ SvxLineEndListItem aItem( *static_cast<const SvxLineEndListItem*>(pSh->GetItem( SID_LINEEND_LIST ) ) );
+ mxLineEndList = aItem.GetLineEndList();
+
+ if (mxLineEndList.is())
+ {
+ FillLineEndListBox(*mpLBStart, *mpLBEnd, *mxLineEndList);
+ }
+
+ mpLBStart->SelectEntryPos(0);
+ mpLBEnd->SelectEntryPos(0);
+ }
+ else
+ {
+ mpLBStart->Disable();
+ mpLBEnd->Disable();
+ }
+}
+
+void LinePropertyPanelBase::FillLineStyleList()
+{
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+ if ( pSh && pSh->GetItem( SID_DASH_LIST ) )
+ {
+ mpLBStyle->Enable();
+ SvxDashListItem aItem( *static_cast<const SvxDashListItem*>(pSh->GetItem( SID_DASH_LIST ) ) );
+ mxLineStyleList = aItem.GetDashList();
+
+ if (mxLineStyleList.is())
+ {
+ FillLineStyleListBox(*mpLBStyle, *mxLineStyleList);
+ }
+
+ mpLBStyle->SelectEntryPos(0);
+ }
+ else
+ {
+ mpLBStyle->Disable();
+ }
+}
+
+void LinePropertyPanelBase::SelectLineStyle()
+{
+ if( !mpStyleItem.get() || !mpDashItem.get() )
+ {
+ mpLBStyle->SetNoSelection();
+ mpLBStyle->Disable();
+ return;
+ }
+
+ const drawing::LineStyle eXLS(mpStyleItem ? (drawing::LineStyle)mpStyleItem->GetValue() : drawing::LineStyle_NONE);
+ bool bSelected(false);
+
+ switch(eXLS)
+ {
+ case drawing::LineStyle_NONE:
+ break;
+ case drawing::LineStyle_SOLID:
+ mpLBStyle->SelectEntryPos(1);
+ bSelected = true;
+ break;
+ default:
+ if(mpDashItem && mxLineStyleList.is())
+ {
+ const XDash& rDash = mpDashItem->GetDashValue();
+ for(sal_Int32 a(0);!bSelected && a < mxLineStyleList->Count(); a++)
+ {
+ XDashEntry* pEntry = mxLineStyleList->GetDash(a);
+ const XDash& rEntry = pEntry->GetDash();
+ if(rDash == rEntry)
+ {
+ mpLBStyle->SelectEntryPos(a + 2);
+ bSelected = true;
+ }
+ }
+ }
+ break;
+ }
+
+ if(!bSelected)
+ mpLBStyle->SelectEntryPos( 0 );
+}
+
+void LinePropertyPanelBase::SelectEndStyle(bool bStart)
+{
+ bool bSelected(false);
+
+ if(bStart)
+ {
+ if( !mpStartItem.get() )
+ {
+ mpLBStart->SetNoSelection();
+ mpLBStart->Disable();
+ return;
+ }
+
+ if (mpStartItem && mxLineEndList.is())
+ {
+ const basegfx::B2DPolyPolygon& rItemPolygon = mpStartItem->GetLineStartValue();
+ for(sal_Int32 a(0);!bSelected && a < mxLineEndList->Count(); a++)
+ {
+ XLineEndEntry* pEntry = mxLineEndList->GetLineEnd(a);
+ const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
+ if(rItemPolygon == rEntryPolygon)
+ {
+ mpLBStart->SelectEntryPos(a + 1);
+ bSelected = true;
+ }
+ }
+ }
+
+ if(!bSelected)
+ {
+ mpLBStart->SelectEntryPos( 0 );
+ }
+ }
+ else
+ {
+ if( !mpEndItem.get() )
+ {
+ mpLBEnd->SetNoSelection();
+ mpLBEnd->Disable();
+ return;
+ }
+
+ if (mpEndItem && mxLineEndList.is())
+ {
+ const basegfx::B2DPolyPolygon& rItemPolygon = mpEndItem->GetLineEndValue();
+ for(sal_Int32 a(0);!bSelected && a < mxLineEndList->Count(); a++)
+ {
+ XLineEndEntry* pEntry = mxLineEndList->GetLineEnd(a);
+ const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
+ if(rItemPolygon == rEntryPolygon)
+ {
+ mpLBEnd->SelectEntryPos(a + 1);
+ bSelected = true;
+ }
+ }
+ }
+
+ if(!bSelected)
+ {
+ mpLBEnd->SelectEntryPos( 0 );
+ }
+ }
+}
+
+void LinePropertyPanelBase::ActivateControls()
+{
+ const sal_Int32 nPos(mpLBStyle->GetSelectEntryPos());
+ bool bLineStyle( nPos != 0 );
+
+ mpGridLineProps->Enable( bLineStyle );
+ mpBoxArrowProps->Enable( bLineStyle );
+}
+
+}} // end of namespace svx::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.hxx b/svx/source/sidebar/line/LinePropertyPanelBase.hxx
new file mode 100644
index 0000000..e5dd0d9
--- /dev/null
+++ b/svx/source/sidebar/line/LinePropertyPanelBase.hxx
@@ -0,0 +1,172 @@
+/* -*- 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:
+
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list