[Libreoffice-commits] core.git: 19 commits - chart2/source chart2/uiconfig embeddedobj/source sfx2/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Wed Jul 15 23:18:04 PDT 2015
chart2/source/controller/inc/ChartController.hxx | 688 +++++++++++++
chart2/source/controller/inc/CommandDispatchContainer.hxx | 149 ++
chart2/source/controller/inc/SelectionHelper.hxx | 123 ++
chart2/source/controller/main/ChartController.cxx | 37
chart2/source/controller/main/ChartController.hxx | 688 -------------
chart2/source/controller/main/CommandDispatchContainer.hxx | 149 --
chart2/source/controller/main/SelectionHelper.hxx | 123 --
chart2/source/controller/sidebar/Chart2PanelFactory.cxx | 37
chart2/source/controller/sidebar/ChartElementsPanel.cxx | 431 +++++++-
chart2/source/controller/sidebar/ChartElementsPanel.hxx | 39
chart2/uiconfig/ui/sidebarelements.ui | 125 --
embeddedobj/source/commonembedding/embedobj.cxx | 4
embeddedobj/source/general/docholder.cxx | 11
sfx2/source/sidebar/SidebarController.cxx | 1
14 files changed, 1481 insertions(+), 1124 deletions(-)
New commits:
commit b1663b86ae68e023df98e9b204234170eef33825
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Jul 16 02:42:01 2015 +0200
handle legend position combobox correctly
Change-Id: Ic19e8cd20d739761975db2b00cb92fd27f8ac4be
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 36afcc3..e26c65a 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -20,6 +20,9 @@
#include <sfx2/sidebar/ResourceDefinitions.hrc>
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/ControlFactory.hxx>
+#include <com/sun/star/chart2/LegendPosition.hpp>
+#include <com/sun/star/chart/ChartLegendExpansion.hpp>
+
#include "ChartElementsPanel.hxx"
#include "ChartController.hxx"
#include <sfx2/bindings.hxx>
@@ -242,6 +245,77 @@ void setAxisVisible(css::uno::Reference<css::frame::XModel> xModel, AxisType eTy
}
}
+sal_Int32 getLegendPos(css::uno::Reference<css::frame::XModel> xModel)
+{
+ ChartModel* pModel = getChartModel(xModel);
+ if (!pModel)
+ return 4;
+
+ Reference< beans::XPropertySet > xLegendProp( LegendHelper::getLegend(*pModel), uno::UNO_QUERY );
+ if (!xLegendProp.is())
+ return 4;
+
+ chart2::LegendPosition eLegendPos = chart2::LegendPosition_CUSTOM;
+ xLegendProp->getPropertyValue("AnchorPosition") >>= eLegendPos;
+ switch(eLegendPos)
+ {
+ case chart2::LegendPosition_LINE_START:
+ return 1;
+ case chart2::LegendPosition_LINE_END:
+ return 2;
+ case chart2::LegendPosition_PAGE_START:
+ return 3;
+ case chart2::LegendPosition_PAGE_END:
+ return 0;
+ default:
+ return 4;
+ }
+}
+
+void setLegendPos(css::uno::Reference<css::frame::XModel> xModel, sal_Int32 nPos)
+{
+ ChartModel* pModel = getChartModel(xModel);
+ if (!pModel)
+ return;
+
+ Reference< beans::XPropertySet > xLegendProp( LegendHelper::getLegend(*pModel), uno::UNO_QUERY );
+ if (!xLegendProp.is())
+ return;
+
+ chart2::LegendPosition eLegendPos = chart2::LegendPosition_CUSTOM;
+ css::chart::ChartLegendExpansion eExpansion = css::chart::ChartLegendExpansion_HIGH;
+ switch(nPos)
+ {
+ case 3:
+ eLegendPos = chart2::LegendPosition_PAGE_START;
+ eExpansion = css::chart::ChartLegendExpansion_WIDE;
+ break;
+ case 1:
+ eLegendPos = chart2::LegendPosition_LINE_START;
+ break;
+ case 2:
+ eLegendPos = chart2::LegendPosition_LINE_END;
+ break;
+ case 0:
+ eLegendPos = chart2::LegendPosition_PAGE_END;
+ eExpansion = css::chart::ChartLegendExpansion_WIDE;
+ break;
+ case 4:
+ eLegendPos = chart2::LegendPosition_CUSTOM;
+ break;
+ default:
+ assert(false);
+ }
+
+ xLegendProp->setPropertyValue("AnchorPosition", css::uno::makeAny(eLegendPos));
+ xLegendProp->setPropertyValue("Expansion", css::uno::makeAny(eExpansion));
+
+ if (eLegendPos != chart2::LegendPosition_CUSTOM)
+ {
+ xLegendProp->setPropertyValue("RelativePosition", uno::Any());
+ }
+}
+
}
ChartElementsPanel::ChartElementsPanel(
@@ -274,6 +348,8 @@ ChartElementsPanel::ChartElementsPanel(
get(mpCBGridVerticalMinor, "checkbutton_gridline_vertical_minor");
get(mpCBGridHorizontalMinor, "checkbutton_gridline_horizontal_minor");
+ get(mpLBLegendPosition, "comboboxtext_legend");
+
Initialize();
}
@@ -332,6 +408,8 @@ void ChartElementsPanel::Initialize()
mpCBGridHorizontalMajor->SetClickHdl(aLink);
mpCBGridVerticalMinor->SetClickHdl(aLink);
mpCBGridHorizontalMinor->SetClickHdl(aLink);
+
+ mpLBLegendPosition->SetSelectHdl(LINK(this, ChartElementsPanel, LegendPosHdl));
}
void ChartElementsPanel::updateData()
@@ -363,6 +441,8 @@ void ChartElementsPanel::updateData()
mpCBZAxis->Disable();
mpCBZAxisTitle->Disable();
}
+
+ mpLBLegendPosition->SelectEntryPos(getLegendPos(mxModel));
}
VclPtr<vcl::Window> ChartElementsPanel::Create (
@@ -454,6 +534,13 @@ IMPL_LINK(ChartElementsPanel, CheckBoxHdl, CheckBox*, pCheckBox)
return 0;
}
+IMPL_LINK_NOARG(ChartElementsPanel, LegendPosHdl)
+{
+ sal_Int32 nPos = mpLBLegendPosition->GetSelectEntryPos();
+ setLegendPos(mxModel, nPos);
+ return 0;
+}
+
}} // end of namespace ::chart::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
index 4aee729..6bf1642 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
@@ -90,6 +90,8 @@ private:
VclPtr<CheckBox> mpCBGridVerticalMinor;
VclPtr<CheckBox> mpCBGridHorizontalMinor;
+ VclPtr<ListBox> mpLBLegendPosition;
+
css::uno::Reference<css::frame::XFrame> mxFrame;
::sfx2::sidebar::EnumContext maContext;
SfxBindings* mpBindings;
@@ -100,6 +102,7 @@ private:
void Initialize();
DECL_LINK(CheckBoxHdl, CheckBox*);
+ DECL_LINK(LegendPosHdl, void*);
};
} } // end of namespace ::chart::sidebar
diff --git a/chart2/uiconfig/ui/sidebarelements.ui b/chart2/uiconfig/ui/sidebarelements.ui
index e22976a..d682300 100644
--- a/chart2/uiconfig/ui/sidebarelements.ui
+++ b/chart2/uiconfig/ui/sidebarelements.ui
@@ -309,11 +309,15 @@
</packing>
</child>
<child>
- <object class="GtkComboBoxText" id="comboboxtext1">
+ <object class="GtkComboBoxText" id="comboboxtext_legend">
<property name="visible">True</property>
<property name="can_focus">False</property>
<items>
- <item translatable="yes">bottom left</item>
+ <item translatable="yes">Bottom</item>
+ <item translatable="yes">Left</item>
+ <item translatable="yes">Right</item>
+ <item translatable="yes">Top</item>
+ <item translatable="yes">Manual</item>
</items>
</object>
<packing>
commit 9ce5cfff0af69bfff7512b806e0e5a39ab1566f8
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Jul 16 01:17:33 2015 +0200
enable the chart sidebar again
Change-Id: I0ad9d962436562aa1026c50e5ec16f844f889eef
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 8da9ebc..a7a92f1 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -348,22 +348,32 @@ uno::Sequence< OUString > ChartController::getSupportedServiceNames_Static()
return aSNS;
}
-/*
namespace {
uno::Reference<ui::XSidebar> getSidebarFromModel(uno::Reference<frame::XModel> xModel)
{
uno::Reference<container::XChild> xChild(xModel, uno::UNO_QUERY);
- uno::Reference<frame::XModel> xParent (xChild->getParent(), uno::UNO_QUERY_THROW);
+ if (!xChild.is())
+ return NULL;
+
+ uno::Reference<frame::XModel> xParent (xChild->getParent(), uno::UNO_QUERY);
+ if (!xParent.is())
+ return NULL;
+
uno::Reference<frame::XController2> xController(xParent->getCurrentController(), uno::UNO_QUERY);
+ if (!xController.is())
+ return NULL;
+
uno::Reference<ui::XSidebarProvider> xSidebarProvider (xController->getSidebar(), uno::UNO_QUERY);
+ if (!xSidebarProvider.is())
+ return NULL;
+
uno::Reference<ui::XSidebar> xSidebar(xSidebarProvider->getSidebar(), uno::UNO_QUERY);
return xSidebar;
}
}
-*/
// XController
@@ -378,11 +388,12 @@ void SAL_CALL ChartController::attachFrame(
mpSelectionChangeHandler->Connect();
- /*
uno::Reference<ui::XSidebar> xSidebar = getSidebarFromModel(getModel());
- sfx2::sidebar::SidebarController* pSidebar = dynamic_cast<sfx2::sidebar::SidebarController*>(xSidebar.get());
- sfx2::sidebar::SidebarController::registerSidebarForFrame(pSidebar, this);
- */
+ if (xSidebar.is())
+ {
+ sfx2::sidebar::SidebarController* pSidebar = dynamic_cast<sfx2::sidebar::SidebarController*>(xSidebar.get());
+ sfx2::sidebar::SidebarController::registerSidebarForFrame(pSidebar, this);
+ }
if(m_xFrame.is()) //what happens, if we do have a Frame already??
{
@@ -750,14 +761,15 @@ void SAL_CALL ChartController::dispose()
{
mpSelectionChangeHandler->Disconnect();
- /*
if (getModel().is())
{
uno::Reference<ui::XSidebar> xSidebar = getSidebarFromModel(getModel());
- sfx2::sidebar::SidebarController* pSidebar = dynamic_cast<sfx2::sidebar::SidebarController*>(xSidebar.get());
- sfx2::sidebar::SidebarController::unregisterSidebarForFrame(pSidebar, this);
+ if (xSidebar.is())
+ {
+ sfx2::sidebar::SidebarController* pSidebar = dynamic_cast<sfx2::sidebar::SidebarController*>(xSidebar.get());
+ sfx2::sidebar::SidebarController::unregisterSidebarForFrame(pSidebar, this);
+ }
}
- */
try
{
commit 4be80459e55f80816ecea2c7d8f24aea7660d0c9
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Jul 16 00:48:16 2015 +0200
adapt to UX discussion
Change-Id: I6a7ba1f13cddf20b2751f2ee113427db43978cfa
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 528bae3..36afcc3 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -269,8 +269,10 @@ ChartElementsPanel::ChartElementsPanel(
get(mpCB2ndYAxis, "checkbutton_2nd_y_axis");
get(mpCB2ndYAxisTitle, "checkbutton_2nd_y_axis_title");
get(mpCBLegend, "checkbutton_legend");
- get(mpCBGridVertical, "checkbutton_gridline_vertical");
- get(mpCBGridHorizontal, "checkbutton_gridline_horizontal");
+ get(mpCBGridVerticalMajor, "checkbutton_gridline_vertical_major");
+ get(mpCBGridHorizontalMajor, "checkbutton_gridline_horizontal_major");
+ get(mpCBGridVerticalMinor, "checkbutton_gridline_vertical_minor");
+ get(mpCBGridHorizontalMinor, "checkbutton_gridline_horizontal_minor");
Initialize();
}
@@ -298,8 +300,10 @@ void ChartElementsPanel::dispose()
mpCB2ndYAxis.clear();
mpCB2ndYAxisTitle.clear();
mpCBLegend.clear();
- mpCBGridVertical.clear();
- mpCBGridHorizontal.clear();
+ mpCBGridVerticalMajor.clear();
+ mpCBGridHorizontalMajor.clear();
+ mpCBGridVerticalMinor.clear();
+ mpCBGridHorizontalMinor.clear();
PanelLayout::dispose();
}
@@ -324,8 +328,10 @@ void ChartElementsPanel::Initialize()
mpCB2ndYAxis->SetClickHdl(aLink);
mpCB2ndYAxisTitle->SetClickHdl(aLink);
mpCBLegend->SetClickHdl(aLink);
- mpCBGridVertical->SetClickHdl(aLink);
- mpCBGridHorizontal->SetClickHdl(aLink);
+ mpCBGridVerticalMajor->SetClickHdl(aLink);
+ mpCBGridHorizontalMajor->SetClickHdl(aLink);
+ mpCBGridVerticalMinor->SetClickHdl(aLink);
+ mpCBGridHorizontalMinor->SetClickHdl(aLink);
}
void ChartElementsPanel::updateData()
@@ -342,8 +348,10 @@ void ChartElementsPanel::updateData()
mpCBZAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::Z_AXIS_TITLE));
mpCB2ndXAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::SECONDARY_X_AXIS_TITLE));
mpCB2ndYAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::SECONDARY_Y_AXIS_TITLE));
- mpCBGridVertical->Check(isGridVisible(mxModel, GridType::VERT_MAJOR));
- mpCBGridHorizontal->Check(isGridVisible(mxModel, GridType::HOR_MAJOR));
+ mpCBGridVerticalMajor->Check(isGridVisible(mxModel, GridType::VERT_MAJOR));
+ mpCBGridHorizontalMajor->Check(isGridVisible(mxModel, GridType::HOR_MAJOR));
+ mpCBGridVerticalMinor->Check(isGridVisible(mxModel, GridType::VERT_MINOR));
+ mpCBGridHorizontalMinor->Check(isGridVisible(mxModel, GridType::HOR_MINOR));
mpCBXAxis->Check(isAxisVisible(mxModel, AxisType::X_MAIN));
mpCBYAxis->Check(isAxisVisible(mxModel, AxisType::Y_MAIN));
mpCBZAxis->Check(isAxisVisible(mxModel, AxisType::Z_MAIN));
@@ -434,10 +442,14 @@ IMPL_LINK(ChartElementsPanel, CheckBoxHdl, CheckBox*, pCheckBox)
setTitleVisible(mxModel, TitleHelper::SECONDARY_Y_AXIS_TITLE, bChecked);
else if (pCheckBox == mpCBLegend.get())
setLegendVisible(mxModel, bChecked);
- else if (pCheckBox == mpCBGridVertical.get())
+ else if (pCheckBox == mpCBGridVerticalMajor.get())
setGridVisible(mxModel, GridType::VERT_MAJOR, bChecked);
- else if (pCheckBox == mpCBGridHorizontal.get())
+ else if (pCheckBox == mpCBGridHorizontalMajor.get())
setGridVisible(mxModel, GridType::HOR_MAJOR, bChecked);
+ else if (pCheckBox == mpCBGridVerticalMinor.get())
+ setGridVisible(mxModel, GridType::VERT_MINOR, bChecked);
+ else if (pCheckBox == mpCBGridHorizontalMinor.get())
+ setGridVisible(mxModel, GridType::HOR_MINOR, bChecked);
return 0;
}
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
index 316eb5d..4aee729 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
@@ -85,8 +85,10 @@ private:
VclPtr<CheckBox> mpCB2ndYAxis;
VclPtr<CheckBox> mpCB2ndYAxisTitle;
VclPtr<CheckBox> mpCBLegend;
- VclPtr<CheckBox> mpCBGridVertical;
- VclPtr<CheckBox> mpCBGridHorizontal;
+ VclPtr<CheckBox> mpCBGridVerticalMajor;
+ VclPtr<CheckBox> mpCBGridHorizontalMajor;
+ VclPtr<CheckBox> mpCBGridVerticalMinor;
+ VclPtr<CheckBox> mpCBGridHorizontalMinor;
css::uno::Reference<css::frame::XFrame> mxFrame;
::sfx2::sidebar::EnumContext maContext;
diff --git a/chart2/uiconfig/ui/sidebarelements.ui b/chart2/uiconfig/ui/sidebarelements.ui
index 2432c6e2..e22976a 100644
--- a/chart2/uiconfig/ui/sidebarelements.ui
+++ b/chart2/uiconfig/ui/sidebarelements.ui
@@ -333,8 +333,7 @@
<object class="GtkLabel" id="label_grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Gridlines
-</property>
+ <property name="label" translatable="yes">Gridlines</property>
</object>
<packing>
<property name="expand">False</property>
@@ -347,8 +346,8 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkCheckButton" id="checkbutton_gridline_vertical">
- <property name="label" translatable="yes">Vertical</property>
+ <object class="GtkCheckButton" id="checkbutton_gridline_vertical_major">
+ <property name="label" translatable="yes">Vertical Major</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -362,57 +361,17 @@
</packing>
</child>
<child>
- <object class="GtkComboBoxText" id="comboboxtext2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <items>
- <item translatable="yes">major</item>
- </items>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">12</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="box9">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkCheckButton" id="checkbutton_gridline_horizontal">
- <property name="label" translatable="yes">Horizontal</property>
+ <object class="GtkCheckButton" id="checkbutton_gridline_vertical_minor">
+ <property name="label" translatable="yes">Vertical minor</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
- <property name="yalign">0.56000000238418579</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBoxText" id="comboboxtext3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <items>
- <item translatable="yes">major</item>
- </items>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
@@ -420,32 +379,21 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">13</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_data">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Data</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">14</property>
+ <property name="position">12</property>
</packing>
</child>
<child>
- <object class="GtkBox" id="box10">
+ <object class="GtkBox" id="box9">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkCheckButton" id="checkbutton_label">
- <property name="label" translatable="yes">Show label</property>
+ <object class="GtkCheckButton" id="checkbutton_gridline_horizontal_major">
+ <property name="label" translatable="yes">Horizontal Major</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
+ <property name="yalign">0.56000000238418579</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -455,33 +403,8 @@
</packing>
</child>
<child>
- <object class="GtkComboBoxText" id="comboboxtext4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <items>
- <item translatable="yes">above</item>
- </items>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">15</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="box11">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkCheckButton" id="checkbutton_trendline">
- <property name="label" translatable="yes">Trendline</property>
+ <object class="GtkCheckButton" id="checkbutton_gridline_horizontal_minor">
+ <property name="label" translatable="yes">Horizontal major</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -491,20 +414,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBoxText" id="comboboxtext5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <items>
- <item translatable="yes">linear</item>
- </items>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
@@ -512,7 +421,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">16</property>
+ <property name="position">13</property>
</packing>
</child>
</object>
commit a40526eb9523e4c4286677bfc3458e8c3c6ef2de
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 15 21:28:07 2015 +0200
adapt code to last round of discussions
Change-Id: Id0d2bae2a232f80ebe46cb55602c15c57b074e87
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index e073e5f..528bae3 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -271,8 +271,8 @@ ChartElementsPanel::ChartElementsPanel(
get(mpCBLegend, "checkbutton_legend");
get(mpCBGridVertical, "checkbutton_gridline_vertical");
get(mpCBGridHorizontal, "checkbutton_gridline_horizontal");
- get(mpCBShowLabel, "checkbutton_label");
- get(mpCBTrendline, "checkbutton_trendline");
+
+ Initialize();
}
ChartElementsPanel::~ChartElementsPanel()
@@ -300,8 +300,6 @@ void ChartElementsPanel::dispose()
mpCBLegend.clear();
mpCBGridVertical.clear();
mpCBGridHorizontal.clear();
- mpCBShowLabel.clear();
- mpCBTrendline.clear();
PanelLayout::dispose();
}
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
index dd68f79..316eb5d 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
@@ -87,8 +87,6 @@ private:
VclPtr<CheckBox> mpCBLegend;
VclPtr<CheckBox> mpCBGridVertical;
VclPtr<CheckBox> mpCBGridHorizontal;
- VclPtr<CheckBox> mpCBShowLabel;
- VclPtr<CheckBox> mpCBTrendline;
css::uno::Reference<css::frame::XFrame> mxFrame;
::sfx2::sidebar::EnumContext maContext;
commit 6503c1c9c4fa0c0f07b1890668dab5799187053b
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 15 21:26:05 2015 +0200
handle change to grid line checkboxes
Change-Id: Ib39dc1669dfefe82eaefff1608de4fe1d4ef5832
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 8aa044b..e073e5f 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -183,6 +183,26 @@ bool isGridVisible(css::uno::Reference<css::frame::XModel> xModel, GridType eTyp
return false;
}
+void setGridVisible(css::uno::Reference<css::frame::XModel> xModel, GridType eType, bool bVisible)
+{
+ Reference< chart2::XDiagram > xDiagram(ChartModelHelper::findDiagram(xModel));
+ if(xDiagram.is())
+ {
+ sal_Int32 nDimensionIndex = 0;
+ if (eType == GridType::HOR_MAJOR || eType == GridType::HOR_MINOR)
+ nDimensionIndex = 1;
+ sal_Int32 nCooSysIndex = 0;
+
+ bool bMajor = (eType == GridType::HOR_MAJOR || eType == GridType::VERT_MAJOR);
+
+ if (bVisible)
+ AxisHelper::showGrid(nDimensionIndex, nCooSysIndex, bMajor,
+ xDiagram, comphelper::getProcessComponentContext());
+ else
+ AxisHelper::hideGrid(nDimensionIndex, nCooSysIndex, bMajor, xDiagram);
+ }
+}
+
bool isAxisVisible(css::uno::Reference<css::frame::XModel> xModel, AxisType eType)
{
Reference< chart2::XDiagram > xDiagram(ChartModelHelper::findDiagram(xModel));
@@ -416,6 +436,10 @@ IMPL_LINK(ChartElementsPanel, CheckBoxHdl, CheckBox*, pCheckBox)
setTitleVisible(mxModel, TitleHelper::SECONDARY_Y_AXIS_TITLE, bChecked);
else if (pCheckBox == mpCBLegend.get())
setLegendVisible(mxModel, bChecked);
+ else if (pCheckBox == mpCBGridVertical.get())
+ setGridVisible(mxModel, GridType::VERT_MAJOR, bChecked);
+ else if (pCheckBox == mpCBGridHorizontal.get())
+ setGridVisible(mxModel, GridType::HOR_MAJOR, bChecked);
return 0;
}
commit 374d3fbf89830a8ee8f4e2e3a802aa408b15afe4
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 15 21:15:15 2015 +0200
handle changes to legend checkbox
Change-Id: I3901ce4f7664eb7b8eca50014f5916fd6ccb0854
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 1c22c60..8aa044b 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -136,6 +136,18 @@ bool isLegendVisible(css::uno::Reference<css::frame::XModel> xModel)
return false;
}
+void setLegendVisible(css::uno::Reference<css::frame::XModel> xModel, bool bVisible)
+{
+ ChartModel* pModel = getChartModel(xModel);
+ if (!pModel)
+ return;
+
+ if (bVisible)
+ LegendHelper::showLegend(*pModel, comphelper::getProcessComponentContext());
+ else
+ LegendHelper::hideLegend(*pModel);
+}
+
bool isTitleVisisble(css::uno::Reference<css::frame::XModel> xModel, TitleHelper::eTitleType eTitle)
{
return TitleHelper::getTitle(eTitle, xModel).is();
@@ -402,6 +414,8 @@ IMPL_LINK(ChartElementsPanel, CheckBoxHdl, CheckBox*, pCheckBox)
setAxisVisible(mxModel, AxisType::Y_SECOND, bChecked);
else if (pCheckBox == mpCB2ndYAxisTitle.get())
setTitleVisible(mxModel, TitleHelper::SECONDARY_Y_AXIS_TITLE, bChecked);
+ else if (pCheckBox == mpCBLegend.get())
+ setLegendVisible(mxModel, bChecked);
return 0;
}
commit 234ac0e3e8a0c6e791f6fa2f9f947979bd6f7c6f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 15 18:34:37 2015 +0200
also react to title checkboxes
This needs to improved when tdf#92768 has been implemented. Also we need
to rethink the default strings.
Change-Id: I74b9bdf0caeaf314f103aa7b13dad3215e828423
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 3e3aed5..1c22c60 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -141,6 +141,18 @@ bool isTitleVisisble(css::uno::Reference<css::frame::XModel> xModel, TitleHelper
return TitleHelper::getTitle(eTitle, xModel).is();
}
+void setTitleVisible(css::uno::Reference<css::frame::XModel> xModel, TitleHelper::eTitleType eTitle, bool bVisible)
+{
+ if (bVisible)
+ {
+ TitleHelper::createTitle(eTitle, "Title", xModel, comphelper::getProcessComponentContext());
+ }
+ else
+ {
+ TitleHelper::removeTitle(eTitle, xModel);
+ }
+}
+
bool isGridVisible(css::uno::Reference<css::frame::XModel> xModel, GridType eType)
{
Reference< chart2::XDiagram > xDiagram(ChartModelHelper::findDiagram(xModel));
@@ -367,16 +379,29 @@ IMPL_LINK(ChartElementsPanel, CheckBoxHdl, CheckBox*, pCheckBox)
{
bool bChecked = pCheckBox->IsChecked();
if (pCheckBox == mpCBTitle.get())
- {
- }
+ setTitleVisible(mxModel, TitleHelper::MAIN_TITLE, bChecked);
+ else if (pCheckBox == mpCBSubtitle.get())
+ setTitleVisible(mxModel, TitleHelper::SUB_TITLE, bChecked);
else if (pCheckBox == mpCBXAxis.get())
setAxisVisible(mxModel, AxisType::X_MAIN, bChecked);
+ else if (pCheckBox == mpCBXAxisTitle.get())
+ setTitleVisible(mxModel, TitleHelper::X_AXIS_TITLE, bChecked);
else if (pCheckBox == mpCBYAxis.get())
setAxisVisible(mxModel, AxisType::Y_MAIN, bChecked);
+ else if (pCheckBox == mpCBYAxisTitle.get())
+ setTitleVisible(mxModel, TitleHelper::Y_AXIS_TITLE, bChecked);
+ else if (pCheckBox == mpCBZAxis.get())
+ setAxisVisible(mxModel, AxisType::Z_MAIN, bChecked);
+ else if (pCheckBox == mpCBZAxisTitle.get())
+ setTitleVisible(mxModel, TitleHelper::Z_AXIS_TITLE, bChecked);
else if (pCheckBox == mpCB2ndXAxis.get())
setAxisVisible(mxModel, AxisType::X_SECOND, bChecked);
+ else if (pCheckBox == mpCB2ndXAxisTitle.get())
+ setTitleVisible(mxModel, TitleHelper::SECONDARY_X_AXIS_TITLE, bChecked);
else if (pCheckBox == mpCB2ndYAxis.get())
setAxisVisible(mxModel, AxisType::Y_SECOND, bChecked);
+ else if (pCheckBox == mpCB2ndYAxisTitle.get())
+ setTitleVisible(mxModel, TitleHelper::SECONDARY_Y_AXIS_TITLE, bChecked);
return 0;
}
commit 209f0824338e7e1882373116d052d1a701fac6e6
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 15 18:07:52 2015 +0200
disable Z axis boxes for non-3D charts
Change-Id: I0a651dbed939be572e06e3389fa024cafc214854
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 4cfccf7..3e3aed5 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -37,6 +37,7 @@
#include "TitleHelper.hxx"
#include "ChartModelHelper.hxx"
#include "AxisHelper.hxx"
+#include "DiagramHelper.hxx"
#include "ChartModel.hxx"
@@ -287,6 +288,8 @@ void ChartElementsPanel::Initialize()
void ChartElementsPanel::updateData()
{
+ Reference< chart2::XDiagram > xDiagram(ChartModelHelper::findDiagram(mxModel));
+ sal_Int32 nDimension = DiagramHelper::getDimension(xDiagram);
SolarMutexGuard aGuard;
mpCBLegend->Check(isLegendVisible(mxModel));
@@ -304,6 +307,12 @@ void ChartElementsPanel::updateData()
mpCBZAxis->Check(isAxisVisible(mxModel, AxisType::Z_MAIN));
mpCB2ndXAxis->Check(isAxisVisible(mxModel, AxisType::X_SECOND));
mpCB2ndYAxis->Check(isAxisVisible(mxModel, AxisType::Y_SECOND));
+
+ if (nDimension != 3)
+ {
+ mpCBZAxis->Disable();
+ mpCBZAxisTitle->Disable();
+ }
}
VclPtr<vcl::Window> ChartElementsPanel::Create (
commit c296eec2927cb2eb5959f6de0ceee66cc4295e83
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 15 17:44:56 2015 +0200
react to changing the checkboxes: axis
Change-Id: Ic1296b9035dce00837b8e8d24cc63e1d9bda0b88
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 29c311b..4cfccf7 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -31,6 +31,7 @@
#include <vcl/toolbox.hxx>
#include <svl/intitem.hxx>
#include <svl/stritem.hxx>
+#include <comphelper/processfactory.hxx>
#include "LegendHelper.hxx"
#include "TitleHelper.hxx"
@@ -174,7 +175,26 @@ bool isAxisVisible(css::uno::Reference<css::frame::XModel> xModel, AxisType eTyp
return bHasAxis;
}
return false;
+}
+
+void setAxisVisible(css::uno::Reference<css::frame::XModel> xModel, AxisType eType, bool bVisible)
+{
+ Reference< chart2::XDiagram > xDiagram(ChartModelHelper::findDiagram(xModel));
+ if(xDiagram.is())
+ {
+ sal_Int32 nDimensionIndex = 0;
+ if (eType == AxisType::Y_MAIN || eType == AxisType::Y_SECOND)
+ nDimensionIndex = 1;
+ else if (eType == AxisType::Z_MAIN)
+ nDimensionIndex = 2;
+
+ bool bMajor = !(eType == AxisType::X_SECOND || eType == AxisType::Y_SECOND);
+ if (bVisible)
+ AxisHelper::showAxis(nDimensionIndex, bMajor, xDiagram, comphelper::getProcessComponentContext());
+ else
+ AxisHelper::hideAxis(nDimensionIndex, bMajor, xDiagram);
+ }
}
}
@@ -246,6 +266,23 @@ void ChartElementsPanel::Initialize()
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->addModifyListener(mxListener);
updateData();
+
+ Link<> aLink = LINK(this, ChartElementsPanel, CheckBoxHdl);
+ mpCBTitle->SetClickHdl(aLink);
+ mpCBSubtitle->SetClickHdl(aLink);
+ mpCBXAxis->SetClickHdl(aLink);
+ mpCBXAxisTitle->SetClickHdl(aLink);
+ mpCBYAxis->SetClickHdl(aLink);
+ mpCBYAxisTitle->SetClickHdl(aLink);
+ mpCBZAxis->SetClickHdl(aLink);
+ mpCBZAxisTitle->SetClickHdl(aLink);
+ mpCB2ndXAxis->SetClickHdl(aLink);
+ mpCB2ndXAxisTitle->SetClickHdl(aLink);
+ mpCB2ndYAxis->SetClickHdl(aLink);
+ mpCB2ndYAxisTitle->SetClickHdl(aLink);
+ mpCBLegend->SetClickHdl(aLink);
+ mpCBGridVertical->SetClickHdl(aLink);
+ mpCBGridHorizontal->SetClickHdl(aLink);
}
void ChartElementsPanel::updateData()
@@ -317,6 +354,24 @@ void ChartElementsPanel::modelInvalid()
}
+IMPL_LINK(ChartElementsPanel, CheckBoxHdl, CheckBox*, pCheckBox)
+{
+ bool bChecked = pCheckBox->IsChecked();
+ if (pCheckBox == mpCBTitle.get())
+ {
+ }
+ else if (pCheckBox == mpCBXAxis.get())
+ setAxisVisible(mxModel, AxisType::X_MAIN, bChecked);
+ else if (pCheckBox == mpCBYAxis.get())
+ setAxisVisible(mxModel, AxisType::Y_MAIN, bChecked);
+ else if (pCheckBox == mpCB2ndXAxis.get())
+ setAxisVisible(mxModel, AxisType::X_SECOND, bChecked);
+ else if (pCheckBox == mpCB2ndYAxis.get())
+ setAxisVisible(mxModel, AxisType::Y_SECOND, bChecked);
+
+ return 0;
+}
+
}} // end of namespace ::chart::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
index 297f157..dd68f79 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
@@ -98,6 +98,8 @@ private:
css::uno::Reference<css::util::XModifyListener> mxListener;
void Initialize();
+
+ DECL_LINK(CheckBoxHdl, CheckBox*);
};
} } // end of namespace ::chart::sidebar
commit d380dbbc2bad8d370550d7f985379502e84fd2e3
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 15 16:10:19 2015 +0200
wire axis visiblity
Change-Id: Ide5fe06f7ba6f477fd1bdf5f408915a023319675
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index afb72f1..29c311b 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -55,6 +55,15 @@ enum class GridType
HOR_MINOR
};
+enum class AxisType
+{
+ X_MAIN,
+ Y_MAIN,
+ Z_MAIN,
+ X_SECOND,
+ Y_SECOND
+};
+
class ChartSidebarModifyListener : public cppu::WeakImplHelper1<css::util::XModifyListener>
{
public:
@@ -148,6 +157,26 @@ bool isGridVisible(css::uno::Reference<css::frame::XModel> xModel, GridType eTyp
return false;
}
+bool isAxisVisible(css::uno::Reference<css::frame::XModel> xModel, AxisType eType)
+{
+ Reference< chart2::XDiagram > xDiagram(ChartModelHelper::findDiagram(xModel));
+ if(xDiagram.is())
+ {
+ sal_Int32 nDimensionIndex = 0;
+ if (eType == AxisType::Y_MAIN || eType == AxisType::Y_SECOND)
+ nDimensionIndex = 1;
+ else if (eType == AxisType::Z_MAIN)
+ nDimensionIndex = 2;
+
+ bool bMajor = !(eType == AxisType::X_SECOND || eType == AxisType::Y_SECOND);
+
+ bool bHasAxis = AxisHelper::isAxisShown(nDimensionIndex, bMajor, xDiagram);
+ return bHasAxis;
+ }
+ return false;
+
+}
+
}
ChartElementsPanel::ChartElementsPanel(
@@ -233,6 +262,11 @@ void ChartElementsPanel::updateData()
mpCB2ndYAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::SECONDARY_Y_AXIS_TITLE));
mpCBGridVertical->Check(isGridVisible(mxModel, GridType::VERT_MAJOR));
mpCBGridHorizontal->Check(isGridVisible(mxModel, GridType::HOR_MAJOR));
+ mpCBXAxis->Check(isAxisVisible(mxModel, AxisType::X_MAIN));
+ mpCBYAxis->Check(isAxisVisible(mxModel, AxisType::Y_MAIN));
+ mpCBZAxis->Check(isAxisVisible(mxModel, AxisType::Z_MAIN));
+ mpCB2ndXAxis->Check(isAxisVisible(mxModel, AxisType::X_SECOND));
+ mpCB2ndYAxis->Check(isAxisVisible(mxModel, AxisType::Y_SECOND));
}
VclPtr<vcl::Window> ChartElementsPanel::Create (
commit c03d781e35a015035bf73ff64620f36f27672e87
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 15 15:49:55 2015 +0200
sidebar needs to listen to chart modifications
Change-Id: I3dd0ae1c1c7fe14ee08571e96b1804d5d9972e2c
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index aeb0d81..afb72f1 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -55,6 +55,44 @@ enum class GridType
HOR_MINOR
};
+class ChartSidebarModifyListener : public cppu::WeakImplHelper1<css::util::XModifyListener>
+{
+public:
+
+ ChartSidebarModifyListener(ChartElementsPanel* pParent);
+ virtual ~ChartSidebarModifyListener();
+
+ virtual void SAL_CALL modified(const css::lang::EventObject& rEvent)
+ throw (::css::uno::RuntimeException, ::std::exception) SAL_OVERRIDE;
+
+ virtual void SAL_CALL disposing(const css::lang::EventObject& rEvent)
+ throw (::css::uno::RuntimeException, ::std::exception) SAL_OVERRIDE;
+
+private:
+ ChartElementsPanel* mpParent;
+};
+
+ChartSidebarModifyListener::ChartSidebarModifyListener(ChartElementsPanel* pParent):
+ mpParent(pParent)
+{
+}
+
+ChartSidebarModifyListener::~ChartSidebarModifyListener()
+{
+}
+
+void ChartSidebarModifyListener::modified(const css::lang::EventObject& /*rEvent*/)
+ throw (::css::uno::RuntimeException, ::std::exception)
+{
+ mpParent->updateData();
+}
+
+void ChartSidebarModifyListener::disposing(const css::lang::EventObject& /*rEvent*/)
+ throw (::css::uno::RuntimeException, ::std::exception)
+{
+ mpParent->modelInvalid();
+}
+
ChartModel* getChartModel(css::uno::Reference<css::frame::XModel> xModel)
{
ChartModel* pModel = dynamic_cast<ChartModel*>(xModel.get());
@@ -121,7 +159,8 @@ ChartElementsPanel::ChartElementsPanel(
mxFrame(rxFrame),
maContext(),
mpBindings(pBindings),
- mxModel(pController->getModel())
+ mxModel(pController->getModel()),
+ mxListener(new ChartSidebarModifyListener(this))
{
get(mpCBTitle, "checkbutton_title");
get(mpCBSubtitle, "checkbutton_subtitle");
@@ -149,6 +188,9 @@ ChartElementsPanel::~ChartElementsPanel()
void ChartElementsPanel::dispose()
{
+
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcaster->removeModifyListener(mxListener);
mpCBTitle.clear();
mpCBSubtitle.clear();
mpCBXAxis.clear();
@@ -172,11 +214,15 @@ void ChartElementsPanel::dispose()
void ChartElementsPanel::Initialize()
{
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcaster->addModifyListener(mxListener);
updateData();
}
void ChartElementsPanel::updateData()
{
+ SolarMutexGuard aGuard;
+
mpCBLegend->Check(isLegendVisible(mxModel));
mpCBTitle->Check(isTitleVisisble(mxModel, TitleHelper::MAIN_TITLE));
mpCBSubtitle->Check(isTitleVisisble(mxModel, TitleHelper::SUB_TITLE));
@@ -232,6 +278,11 @@ void ChartElementsPanel::NotifyItemUpdate(
{
}
+void ChartElementsPanel::modelInvalid()
+{
+
+}
+
}} // end of namespace ::chart::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
index 82a2665..297f157 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
@@ -22,7 +22,8 @@
#include <sfx2/sidebar/ControllerItem.hxx>
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
#include <svx/sidebar/PanelLayout.hxx>
-#include <boost/scoped_ptr.hpp>
+
+#include <com/sun/star/util/XModifyListener.hpp>
class FixedText;
class ListBox;
@@ -65,6 +66,10 @@ public:
SfxBindings* pBindings, ChartController* pController);
virtual ~ChartElementsPanel();
virtual void dispose() SAL_OVERRIDE;
+
+ void updateData();
+ void modelInvalid();
+
private:
//ui controls
VclPtr<CheckBox> mpCBTitle;
@@ -90,9 +95,9 @@ private:
SfxBindings* mpBindings;
css::uno::Reference<css::frame::XModel> mxModel;
+ css::uno::Reference<css::util::XModifyListener> mxListener;
void Initialize();
- void updateData();
};
} } // end of namespace ::chart::sidebar
commit 49d2400f8d315e0cb102915ef0375c0c6b6d3459
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 15 13:35:54 2015 +0200
remove my accidently committed debug messages
Change-Id: Ia890837520b57291ae119de30dc7586b65e30b81
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 26376b1..8da9ebc 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -424,7 +424,6 @@ void SAL_CALL ChartController::attachFrame(
m_apDropTargetHelper.reset();
}
{
- SAL_DEBUG("attached frame");
// calls to VCL
SolarMutexGuard aSolarGuard;
m_pChartWindow = VclPtr<ChartWindow>::Create(this,pParent,pParent?pParent->GetStyle():0);
@@ -821,7 +820,6 @@ void SAL_CALL ChartController::dispose()
m_xLayoutManagerEventBroadcaster.set( 0 );
}
- SAL_DEBUG("disposing");
m_xFrame.clear();
m_xUndoManager.clear();
@@ -940,7 +938,6 @@ void SAL_CALL ChartController::notifyClosing(
try
{
xFrameCloseable->close( sal_False /* DeliverOwnership */ );
- SAL_DEBUG("notifyClosing");
m_xFrame.clear();
}
catch( const util::CloseVetoException & )
commit 20f0c633c95c963ccf14be986390ef28137b608f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 15 13:35:08 2015 +0200
remove unused member variables
Change-Id: I2db9b587eea0569df5225171244cee545d6155df
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
index 399b0f9..82a2665 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
@@ -67,10 +67,6 @@ public:
virtual void dispose() SAL_OVERRIDE;
private:
//ui controls
- VclPtr<ListBox> mpLbCategory;
- VclPtr<ToolBox> mpTBCategory;
- VclPtr<NumericField> mpEdDecimals;
- VclPtr<NumericField> mpEdLeadZeroes;
VclPtr<CheckBox> mpCBTitle;
VclPtr<CheckBox> mpCBSubtitle;
VclPtr<CheckBox> mpCBXAxis;
commit 8630982a90c1e6d8de702534bc3d763ed8763f98
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 15 13:28:48 2015 +0200
wire gridlines in chart elements panel
Change-Id: Ibf1e863d6cc469f0fcc42e0a6077cfa104b16ba1
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 396416a..aeb0d81 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -34,6 +34,8 @@
#include "LegendHelper.hxx"
#include "TitleHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "AxisHelper.hxx"
#include "ChartModel.hxx"
@@ -45,6 +47,14 @@ namespace chart { namespace sidebar {
namespace {
+enum class GridType
+{
+ VERT_MAJOR,
+ VERT_MINOR,
+ HOR_MAJOR,
+ HOR_MINOR
+};
+
ChartModel* getChartModel(css::uno::Reference<css::frame::XModel> xModel)
{
ChartModel* pModel = dynamic_cast<ChartModel*>(xModel.get());
@@ -82,6 +92,24 @@ bool isTitleVisisble(css::uno::Reference<css::frame::XModel> xModel, TitleHelper
return TitleHelper::getTitle(eTitle, xModel).is();
}
+bool isGridVisible(css::uno::Reference<css::frame::XModel> xModel, GridType eType)
+{
+ Reference< chart2::XDiagram > xDiagram(ChartModelHelper::findDiagram(xModel));
+ if(xDiagram.is())
+ {
+ sal_Int32 nDimensionIndex = 0;
+ if (eType == GridType::HOR_MAJOR || eType == GridType::HOR_MINOR)
+ nDimensionIndex = 1;
+ sal_Int32 nCooSysIndex = 0;
+
+ bool bMajor = (eType == GridType::HOR_MAJOR || eType == GridType::VERT_MAJOR);
+
+ bool bHasGrid = AxisHelper::isGridShown(nDimensionIndex, nCooSysIndex, bMajor, xDiagram);
+ return bHasGrid;
+ }
+ return false;
+}
+
}
ChartElementsPanel::ChartElementsPanel(
@@ -157,6 +185,8 @@ void ChartElementsPanel::updateData()
mpCBZAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::Z_AXIS_TITLE));
mpCB2ndXAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::SECONDARY_X_AXIS_TITLE));
mpCB2ndYAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::SECONDARY_Y_AXIS_TITLE));
+ mpCBGridVertical->Check(isGridVisible(mxModel, GridType::VERT_MAJOR));
+ mpCBGridHorizontal->Check(isGridVisible(mxModel, GridType::HOR_MAJOR));
}
VclPtr<vcl::Window> ChartElementsPanel::Create (
commit 6dbb9564f92a2dce9f632b69834a534bd5f65bdf
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 15 13:03:02 2015 +0200
wire title and legend checkboxes
Change-Id: I4c6d5e213f44588cf2d53d9c12ed8033307fd863
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 658df2a..396416a 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -32,12 +32,58 @@
#include <svl/intitem.hxx>
#include <svl/stritem.hxx>
+#include "LegendHelper.hxx"
+#include "TitleHelper.hxx"
+
+#include "ChartModel.hxx"
+
using namespace css;
using namespace css::uno;
using ::sfx2::sidebar::Theme;
namespace chart { namespace sidebar {
+namespace {
+
+ChartModel* getChartModel(css::uno::Reference<css::frame::XModel> xModel)
+{
+ ChartModel* pModel = dynamic_cast<ChartModel*>(xModel.get());
+
+ return pModel;
+}
+
+bool isLegendVisible(css::uno::Reference<css::frame::XModel> xModel)
+{
+ ChartModel* pModel = getChartModel(xModel);
+ if (!pModel)
+ return false;
+
+ Reference< beans::XPropertySet > xLegendProp( LegendHelper::getLegend(*pModel), uno::UNO_QUERY );
+ if( xLegendProp.is())
+ {
+ try
+ {
+ bool bShow = false;
+ if( xLegendProp->getPropertyValue( "Show") >>= bShow )
+ {
+ return bShow;
+ }
+ }
+ catch(const uno::Exception &)
+ {
+ }
+ }
+
+ return false;
+}
+
+bool isTitleVisisble(css::uno::Reference<css::frame::XModel> xModel, TitleHelper::eTitleType eTitle)
+{
+ return TitleHelper::getTitle(eTitle, xModel).is();
+}
+
+}
+
ChartElementsPanel::ChartElementsPanel(
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
@@ -132,6 +178,7 @@ VclPtr<vcl::Window> ChartElementsPanel::Create (
void ChartElementsPanel::DataChanged(
const DataChangedEvent& )
{
+ updateData();
}
void ChartElementsPanel::HandleContextChange(
@@ -144,6 +191,7 @@ void ChartElementsPanel::HandleContextChange(
}
maContext = rContext;
+ updateData();
}
void ChartElementsPanel::NotifyItemUpdate(
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
index be53c75..399b0f9 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
@@ -96,6 +96,7 @@ private:
css::uno::Reference<css::frame::XModel> mxModel;
void Initialize();
+ void updateData();
};
} } // end of namespace ::chart::sidebar
commit 1d0696a34938cc331a3235e25be66066251239c8
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 15 13:01:40 2015 +0200
we need access to the chart model in the chart sidebar
Change-Id: I607b5ada047f84cd7a229640772a332702f93f1e
diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx
similarity index 100%
rename from chart2/source/controller/main/ChartController.hxx
rename to chart2/source/controller/inc/ChartController.hxx
diff --git a/chart2/source/controller/main/CommandDispatchContainer.hxx b/chart2/source/controller/inc/CommandDispatchContainer.hxx
similarity index 100%
rename from chart2/source/controller/main/CommandDispatchContainer.hxx
rename to chart2/source/controller/inc/CommandDispatchContainer.hxx
diff --git a/chart2/source/controller/main/SelectionHelper.hxx b/chart2/source/controller/inc/SelectionHelper.hxx
similarity index 100%
rename from chart2/source/controller/main/SelectionHelper.hxx
rename to chart2/source/controller/inc/SelectionHelper.hxx
diff --git a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
index 1222241..29ea916 100644
--- a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
+++ b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
@@ -30,8 +30,8 @@
#include <cppuhelper/supportsservice.hxx>
#include "ChartElementsPanel.hxx"
+#include "ChartController.hxx"
-using namespace css;
using namespace css::uno;
using ::rtl::OUString;
@@ -46,23 +46,24 @@ ChartPanelFactory::~ChartPanelFactory()
{
}
-Reference<ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement (
+Reference<css::ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement (
const ::rtl::OUString& rsResourceURL,
const ::css::uno::Sequence<css::beans::PropertyValue>& rArguments)
throw(
- container::NoSuchElementException,
- lang::IllegalArgumentException,
+ css::container::NoSuchElementException,
+ css::lang::IllegalArgumentException,
RuntimeException, std::exception)
{
- Reference<ui::XUIElement> xElement;
+ Reference<css::ui::XUIElement> xElement;
try
{
const ::comphelper::NamedValueCollection aArguments (rArguments);
- Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>()));
- Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>()));
+ Reference<css::frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<css::frame::XFrame>()));
+ Reference<css::awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<css::awt::XWindow>()));
const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0)));
SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);
+ Reference<css::frame::XController> xController (aArguments.getOrDefault("Controller", Reference<css::frame::XController>()));
vcl::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
if ( ! xParentWindow.is() || pParentWindow==NULL)
@@ -77,11 +78,21 @@ Reference<ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement (
throw RuntimeException(
"PanelFactory::createUIElement called without SfxBindings",
NULL);
+ if (!xController.is())
+ throw RuntimeException(
+ "ChartPanelFactory::createUIElement called without Controller",
+ NULL);
+
+ ChartController* pController = dynamic_cast<ChartController*>(xController.get());
+ if (!pController)
+ throw RuntimeException(
+ "ChartPanelFactory::createUIElement called without valid ChartController",
+ NULL);
sal_Int32 nMinimumSize = -1;
VclPtr<vcl::Window> pPanel;
if (rsResourceURL.endsWith("/ElementsPanel"))
- pPanel = ChartElementsPanel::Create( pParentWindow, xFrame, pBindings );
+ pPanel = ChartElementsPanel::Create( pParentWindow, xFrame, pBindings, pController );
/*
else if (rsResourceURL.endsWith("/CellAppearancePropertyPanel"))
pPanel = CellAppearancePropertyPanel::Create( pParentWindow, xFrame, pBindings );
@@ -104,17 +115,17 @@ Reference<ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement (
rsResourceURL,
xFrame,
pPanel,
- ui::LayoutSize(nMinimumSize,-1,-1));
+ css::ui::LayoutSize(nMinimumSize,-1,-1));
}
- catch (const uno::RuntimeException &)
+ catch (const css::uno::RuntimeException &)
{
throw;
}
- catch (const uno::Exception& e)
+ catch (const css::uno::Exception& e)
{
- throw lang::WrappedTargetRuntimeException(
+ throw css::lang::WrappedTargetRuntimeException(
OUString("ChartPanelFactory::createUIElement exception"),
- 0, uno::makeAny(e));
+ 0, css::uno::makeAny(e));
}
return xElement;
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 3434217..658df2a 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -21,6 +21,7 @@
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/ControlFactory.hxx>
#include "ChartElementsPanel.hxx"
+#include "ChartController.hxx"
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/imagemgr.hxx>
@@ -40,11 +41,13 @@ namespace chart { namespace sidebar {
ChartElementsPanel::ChartElementsPanel(
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
- SfxBindings* pBindings)
+ SfxBindings* pBindings,
+ ChartController* pController)
: PanelLayout(pParent, "ChartElementsPanel", "modules/schart/ui/sidebarelements.ui", rxFrame),
mxFrame(rxFrame),
maContext(),
- mpBindings(pBindings)
+ mpBindings(pBindings),
+ mxModel(pController->getModel())
{
get(mpCBTitle, "checkbutton_title");
get(mpCBSubtitle, "checkbutton_subtitle");
@@ -93,10 +96,27 @@ void ChartElementsPanel::dispose()
PanelLayout::dispose();
}
+void ChartElementsPanel::Initialize()
+{
+ updateData();
+}
+
+void ChartElementsPanel::updateData()
+{
+ mpCBLegend->Check(isLegendVisible(mxModel));
+ mpCBTitle->Check(isTitleVisisble(mxModel, TitleHelper::MAIN_TITLE));
+ mpCBSubtitle->Check(isTitleVisisble(mxModel, TitleHelper::SUB_TITLE));
+ mpCBXAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::X_AXIS_TITLE));
+ mpCBYAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::Y_AXIS_TITLE));
+ mpCBZAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::Z_AXIS_TITLE));
+ mpCB2ndXAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::SECONDARY_X_AXIS_TITLE));
+ mpCB2ndYAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::SECONDARY_Y_AXIS_TITLE));
+}
+
VclPtr<vcl::Window> ChartElementsPanel::Create (
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
- SfxBindings* pBindings)
+ SfxBindings* pBindings, ChartController* pController)
{
if (pParent == NULL)
throw lang::IllegalArgumentException("no parent Window given to ChartElementsPanel::Create", NULL, 0);
@@ -106,7 +126,7 @@ VclPtr<vcl::Window> ChartElementsPanel::Create (
throw lang::IllegalArgumentException("no SfxBindings given to ChartElementsPanel::Create", NULL, 2);
return VclPtr<ChartElementsPanel>::Create(
- pParent, rxFrame, pBindings);
+ pParent, rxFrame, pBindings, pController);
}
void ChartElementsPanel::DataChanged(
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
index f23fa1a..be53c75 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
@@ -28,7 +28,11 @@ class FixedText;
class ListBox;
class NumericField;
-namespace chart { namespace sidebar {
+namespace chart {
+
+class ChartController;
+
+namespace sidebar {
class ChartElementsPanel : public PanelLayout,
public ::sfx2::sidebar::IContextChangeReceiver,
@@ -38,7 +42,7 @@ public:
static VclPtr<vcl::Window> Create(
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
- SfxBindings* pBindings);
+ SfxBindings* pBindings, ChartController* pController);
virtual void DataChanged(
const DataChangedEvent& rEvent) SAL_OVERRIDE;
@@ -58,7 +62,7 @@ public:
ChartElementsPanel(
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
- SfxBindings* pBindings);
+ SfxBindings* pBindings, ChartController* pController);
virtual ~ChartElementsPanel();
virtual void dispose() SAL_OVERRIDE;
private:
@@ -88,6 +92,10 @@ private:
css::uno::Reference<css::frame::XFrame> mxFrame;
::sfx2::sidebar::EnumContext maContext;
SfxBindings* mpBindings;
+
+ css::uno::Reference<css::frame::XModel> mxModel;
+
+ void Initialize();
};
} } // end of namespace ::chart::sidebar
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index a87b653..2d86f65 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -802,6 +802,7 @@ Reference<ui::XUIElement> SidebarController::CreateUIElement (
{
aCreationArguments.put("Module", makeAny(aModule));
}
+ aCreationArguments.put("Controller", makeAny(mxCurrentController));
}
aCreationArguments.put("ApplicationName", makeAny(rContext.msApplication));
commit faed29cac93f8176bb937e6a8b437d6450b7a884
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Jul 14 15:07:29 2015 +0200
for now show chart sidebar
This is a hack that needs to be cleaned up later.
Change-Id: I2772fe6ff8a4792d746a29653635d3eca4088e68
diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx
index ca993ff..f8437c2 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -714,8 +714,9 @@ bool DocumentHolder::ShowUI( const uno::Reference< ::com::sun::star::frame::XLay
xContainerLM->setDockingAreaAcceptor( uno::Reference < ui::XDockingAreaAcceptor >() );
// prevent further changes at this LM
- xContainerLM->setVisible( sal_False );
- xContainerLM->lock();
+ // TODO: moggi: why is this necessary?
+ // xContainerLM->setVisible( sal_False );
+ // xContainerLM->lock();
bUnlock = true;
// by unlocking the LM each layout change will now resize the containers window; pending layouts will be processed now
commit 4ecd67b7ed9f69553ea3f4532ddea0e7828a55be
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Jul 14 15:07:10 2015 +0200
fix indentation
Change-Id: I4bceb79ed4adda085727dfcee1ba3573811e53b3
diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx
index 7fb23f8..ca993ff 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -684,8 +684,8 @@ bool DocumentHolder::ShowUI( const uno::Reference< ::com::sun::star::frame::XLay
if ( xContainerLM.is() )
{
// the LM of the embedded frame and its current DockingAreaAcceptor
- uno::Reference< ::com::sun::star::frame::XLayoutManager > xOwnLM;
- uno::Reference< ::com::sun::star::ui::XDockingAreaAcceptor > xDocAreaAcc;
+ uno::Reference< ::com::sun::star::frame::XLayoutManager > xOwnLM;
+ uno::Reference< ::com::sun::star::ui::XDockingAreaAcceptor > xDocAreaAcc;
try
{
@@ -727,7 +727,7 @@ bool DocumentHolder::ShowUI( const uno::Reference< ::com::sun::star::frame::XLay
xOwnLM->unlock();
bLock = true;
- bResult = true;
+ bResult = true;
// TODO/LATER: The following action should be done only if the window is not hidden
// otherwise the activation must fail, unfortunately currently it is not possible
commit f2b218468f93c7f46c4e878842cd67fd6f683f7e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Jul 14 14:22:03 2015 +0200
fix indentation
Change-Id: Ifda010d2a8f51c6981cac889bfaa1edaacd22df2
diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx
index 4be6cc9..74e1196 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -370,13 +370,13 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
bool bOk = false;
if ( xContainerLM.is() )
- bOk = m_pDocHolder->HideUI( xContainerLM );
+ bOk = m_pDocHolder->HideUI( xContainerLM );
if ( bOk )
{
m_nObjectState = nNextState;
m_pDocHolder->ResizeHatchWindow();
- xInplaceClient->deactivatedUI();
+ xInplaceClient->deactivatedUI();
}
else
throw embed::WrongStateException(); //TODO: can't activate UI
More information about the Libreoffice-commits
mailing list