summaryrefslogtreecommitdiff
path: root/chart2/source
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source')
-rw-r--r--chart2/source/controller/inc/CommandDispatch.hxx (renamed from chart2/source/controller/main/CommandDispatch.hxx)0
-rw-r--r--chart2/source/controller/inc/CommandDispatchContainer.hxx11
-rw-r--r--chart2/source/controller/inc/ControllerCommandDispatch.hxx (renamed from chart2/source/controller/main/ControllerCommandDispatch.hxx)3
-rw-r--r--chart2/source/controller/main/ChartController.cxx95
-rw-r--r--chart2/source/controller/main/ChartController_Window.cxx4
-rw-r--r--chart2/source/controller/main/CommandDispatch.cxx4
-rw-r--r--chart2/source/controller/main/CommandDispatchContainer.cxx84
-rw-r--r--chart2/source/controller/main/ControllerCommandDispatch.cxx100
-rw-r--r--chart2/source/controller/main/FeatureCommandDispatchBase.hxx4
-rw-r--r--chart2/source/controller/main/StatusBarCommandDispatch.hxx4
-rw-r--r--chart2/source/controller/main/UndoCommandDispatch.hxx4
11 files changed, 99 insertions, 214 deletions
diff --git a/chart2/source/controller/main/CommandDispatch.hxx b/chart2/source/controller/inc/CommandDispatch.hxx
index feb1c2183af5..feb1c2183af5 100644
--- a/chart2/source/controller/main/CommandDispatch.hxx
+++ b/chart2/source/controller/inc/CommandDispatch.hxx
diff --git a/chart2/source/controller/inc/CommandDispatchContainer.hxx b/chart2/source/controller/inc/CommandDispatchContainer.hxx
index a7c6111a3f4c..e9f8ed072073 100644
--- a/chart2/source/controller/inc/CommandDispatchContainer.hxx
+++ b/chart2/source/controller/inc/CommandDispatchContainer.hxx
@@ -21,6 +21,8 @@
#include <unotools/weakref.hxx>
#include <o3tl/sorted_vector.hxx>
+#include "ControllerCommandDispatch.hxx"
+
#include <map>
#include <vector>
@@ -70,6 +72,7 @@ public:
// itself)
explicit CommandDispatchContainer(
const css::uno::Reference< css::uno::XComponentContext > & xContext );
+ ~CommandDispatchContainer();
void setModel(
const rtl::Reference<::chart::ChartModel> & xModel );
@@ -78,7 +81,7 @@ public:
rChartCommands
*/
void setChartDispatch(
- const css::uno::Reference< css::frame::XDispatch >& rChartDispatch,
+ const rtl::Reference< ControllerCommandDispatch >& rChartDispatch,
const o3tl::sorted_vector< std::u16string_view > & rChartCommands );
/** Returns the dispatch that is able to do the command given in rURL, if
@@ -101,7 +104,7 @@ public:
const css::uno::Reference< css::frame::XController > & xChartController,
const css::util::URL & rURL );
- const css::uno::Reference< css::frame::XDispatch > & getChartDispatcher() const { return m_xChartDispatcher; }
+ const ControllerCommandDispatch* getChartDispatcher() const { return m_xChartDispatcher.get(); }
void setDrawCommandDispatch( DrawCommandDispatch* pDispatch );
DrawCommandDispatch* getDrawCommandDispatch() { return m_pDrawCommandDispatch; }
@@ -123,8 +126,8 @@ private:
css::uno::Reference< css::uno::XComponentContext > m_xContext;
unotools::WeakReference< ::chart::ChartModel > m_xModel;
- css::uno::Reference< css::frame::XDispatch > m_xChartDispatcher;
- o3tl::sorted_vector< std::u16string_view > m_aChartCommands;
+ rtl::Reference<ControllerCommandDispatch> m_xChartDispatcher;
+ o3tl::sorted_vector<std::u16string_view> m_aAdditionalChartCommands;
DrawCommandDispatch* m_pDrawCommandDispatch;
ShapeController* m_pShapeController;
diff --git a/chart2/source/controller/main/ControllerCommandDispatch.hxx b/chart2/source/controller/inc/ControllerCommandDispatch.hxx
index 6a5e441e8e3c..f4ca42525ea8 100644
--- a/chart2/source/controller/main/ControllerCommandDispatch.hxx
+++ b/chart2/source/controller/inc/ControllerCommandDispatch.hxx
@@ -64,7 +64,8 @@ public:
// late initialisation, especially for adding as listener
virtual void initialize() override;
- bool commandAvailable( const OUString & rCommand );
+ bool commandAvailable(const OUString& rCommand) const;
+ bool commandHandled(const OUString& rCommand) const;
protected:
// ____ XDispatch ____
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index d49f49497f9f..bdee1f41486b 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -28,7 +28,7 @@
#include <dlg_DataSource.hxx>
#include <ChartModel.hxx>
#include <ChartType.hxx>
-#include "ControllerCommandDispatch.hxx"
+#include <ControllerCommandDispatch.hxx>
#include <DataSeries.hxx>
#include <Diagram.hxx>
#include <strings.hrc>
@@ -544,8 +544,8 @@ sal_Bool SAL_CALL ChartController::attachModel( const uno::Reference< frame::XMo
pDispatch->initialize();
// the dispatch container will return "this" for all commands returned by
- // impl_getAvailableCommands(). That means, for those commands dispatch()
- // is called here at the ChartController.
+ // impl_getAvailableCommands(), and also for which ControllerCommandDispatch::commandHandled()
+ // gives true. That means, for those commands dispatch() is called here at the ChartController.
m_aDispatchContainer.setChartDispatch( pDispatch, impl_getAvailableCommands() );
rtl::Reference<DrawCommandDispatch> pDrawDispatch = new DrawCommandDispatch( m_xCC, this );
@@ -1028,7 +1028,7 @@ uno::Reference<frame::XDispatch> SAL_CALL
if ( !m_aLifeTimeManager.impl_isDisposed() && getModel().is() )
{
- if (rTargetFrameName == "_self")
+ if (rTargetFrameName.isEmpty() || rTargetFrameName == "_self")
return m_aDispatchContainer.getDispatchForURL( rURL );
}
return uno::Reference< frame::XDispatch > ();
@@ -1400,31 +1400,6 @@ void SAL_CALL ChartController::dispatch(
}
}
- else if( aCommand == "StatusBarVisible" )
- {
- // workaround: this should not be necessary.
- uno::Reference< beans::XPropertySet > xPropSet( m_xFrame, uno::UNO_QUERY );
- if( xPropSet.is() )
- {
- uno::Reference< css::frame::XLayoutManager > xLayoutManager;
- xPropSet->getPropertyValue( u"LayoutManager"_ustr ) >>= xLayoutManager;
- if ( xLayoutManager.is() )
- {
- bool bIsVisible( xLayoutManager->isElementVisible( u"private:resource/statusbar/statusbar"_ustr ));
- if( bIsVisible )
- {
- xLayoutManager->hideElement( u"private:resource/statusbar/statusbar"_ustr );
- xLayoutManager->destroyElement( u"private:resource/statusbar/statusbar"_ustr );
- }
- else
- {
- xLayoutManager->createElement( u"private:resource/statusbar/statusbar"_ustr );
- xLayoutManager->showElement( u"private:resource/statusbar/statusbar"_ustr );
- }
- // @todo: update menu state (checkmark next to "Statusbar").
- }
- }
- }
else if( aCommand == "ChangeTheme" )
comphelper::dispatchCommand(u".uno:ChangeTheme"_ustr, getFrame(), rArgs);
}
@@ -1704,70 +1679,8 @@ const o3tl::sorted_vector< std::u16string_view >& ChartController::impl_getAvail
u"Save", u"SaveAs", u"SendMail",
u"EditDoc", u"ExportDirectToPDF", u"PrintDefault",
- // own commands
- u"Cut", u"Copy", u"Paste",
- u"DataRanges", u"DiagramData",
- // insert objects
- u"InsertMenuTitles", u"InsertTitles",
- u"InsertMenuLegend", u"InsertLegend", u"DeleteLegend",
- u"InsertMenuDataLabels",
- u"InsertMenuAxes", u"InsertRemoveAxes", u"InsertMenuGrids",
- u"InsertSymbol",
- u"InsertTrendlineEquation", u"InsertTrendlineEquationAndR2",
- u"InsertR2Value", u"DeleteR2Value",
- u"InsertMenuTrendlines", u"InsertTrendline",
- u"InsertMenuMeanValues", u"InsertMeanValue",
- u"InsertMenuXErrorBars", u"InsertXErrorBars",
- u"InsertMenuYErrorBars", u"InsertYErrorBars",
- u"InsertDataLabels", u"InsertDataLabel",
- u"DeleteTrendline", u"DeleteMeanValue", u"DeleteTrendlineEquation",
- u"DeleteXErrorBars", u"DeleteYErrorBars",
- u"DeleteDataLabels", u"DeleteDataLabel",
- u"InsertMenuDataTable",
- u"InsertDataTable", u"DeleteDataTable",
- //format objects
- u"FormatSelection", u"FontDialog", u"TransformDialog",
- u"DiagramType", u"View3D",
- u"Forward", u"Backward",
- u"MainTitle", u"SubTitle",
- u"XTitle", u"YTitle", u"ZTitle",
- u"SecondaryXTitle", u"SecondaryYTitle",
- u"AllTitles", u"Legend",
- u"DiagramAxisX", u"DiagramAxisY", u"DiagramAxisZ",
- u"DiagramAxisA", u"DiagramAxisB", u"DiagramAxisAll",
- u"DiagramGridXMain", u"DiagramGridYMain", u"DiagramGridZMain",
- u"DiagramGridXHelp", u"DiagramGridYHelp", u"DiagramGridZHelp",
- u"DiagramGridAll",
- u"DiagramWall", u"DiagramFloor", u"DiagramArea",
-
- //context menu - format objects entries
- u"FormatWall", u"FormatFloor", u"FormatChartArea",
- u"FormatLegend",
-
- u"FormatAxis", u"FormatTitle",
- u"FormatDataSeries", u"FormatDataPoint",
- u"ResetAllDataPoints", u"ResetDataPoint",
- u"FormatDataLabels", u"FormatDataLabel",
- u"FormatMeanValue", u"FormatTrendline", u"FormatTrendlineEquation",
- u"FormatXErrorBars", u"FormatYErrorBars",
- u"FormatStockLoss", u"FormatStockGain",
-
- u"FormatMajorGrid", u"InsertMajorGrid", u"DeleteMajorGrid",
- u"FormatMinorGrid", u"InsertMinorGrid", u"DeleteMinorGrid",
- u"InsertAxis", u"DeleteAxis", u"InsertAxisTitle",
-
// toolbar commands
- u"ToggleGridHorizontal", u"ToggleGridVertical", u"ToggleLegend", u"ScaleText",
- u"NewArrangement", u"Update",
- u"DefaultColors", u"BarWidth", u"NumberOfLines",
- u"ArrangeRow",
- u"StatusBarVisible",
u"ChartElementSelector",
-
- // sidebar commands
- u"CharFontName" , u"FontHeight" , u"Italic", u"Underline",
- u"Bold", u"Strikeout",u"Shadowed", u"Color", u"FontColor", u"ResetAttributes",
- u"Grow", u"Shrink", u"Spacing", u"SuperScript", u"SubScript"
};
return s_AvailableCommands;
}
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index cd57689af263..a7c315ba3231 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -53,7 +53,7 @@
#include <servicenames_charttypes.hxx>
#include "DrawCommandDispatch.hxx"
#include <PopupRequest.hxx>
-#include "ControllerCommandDispatch.hxx"
+#include <ControllerCommandDispatch.hxx>
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/chart2/RelativeSize.hpp>
@@ -1223,7 +1223,7 @@ void ChartController::execute_Command( const CommandEvent& rCEvt )
{
if (SfxViewShell* pViewShell = SfxViewShell::Current())
{
- ControllerCommandDispatch* pCommandDispatch = dynamic_cast<ControllerCommandDispatch*>(m_aDispatchContainer.getChartDispatcher().get());
+ const ControllerCommandDispatch* pCommandDispatch = m_aDispatchContainer.getChartDispatcher();
if (pCommandDispatch)
{
for (int nPos = 0, nCount = xPopupMenu->getItemCount(); nPos < nCount; ++nPos)
diff --git a/chart2/source/controller/main/CommandDispatch.cxx b/chart2/source/controller/main/CommandDispatch.cxx
index 2cb25f68d5bf..e4f8b1acebcf 100644
--- a/chart2/source/controller/main/CommandDispatch.cxx
+++ b/chart2/source/controller/main/CommandDispatch.cxx
@@ -17,7 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "CommandDispatch.hxx"
+#include <sal/config.h>
+
+#include <CommandDispatch.hxx>
#include <com/sun/star/util/URLTransformer.hpp>
using namespace ::com::sun::star;
diff --git a/chart2/source/controller/main/CommandDispatchContainer.cxx b/chart2/source/controller/main/CommandDispatchContainer.cxx
index 7304c8e48e4e..1dc98f1f88b6 100644
--- a/chart2/source/controller/main/CommandDispatchContainer.cxx
+++ b/chart2/source/controller/main/CommandDispatchContainer.cxx
@@ -18,6 +18,7 @@
*/
#include <CommandDispatchContainer.hxx>
+#include <ControllerCommandDispatch.hxx>
#include "UndoCommandDispatch.hxx"
#include "StatusBarCommandDispatch.hxx"
#include <DisposeHelper.hxx>
@@ -48,6 +49,8 @@ CommandDispatchContainer::CommandDispatchContainer(
{
}
+CommandDispatchContainer::~CommandDispatchContainer() = default;
+
void CommandDispatchContainer::setModel(
const rtl::Reference<::chart::ChartModel> & xModel )
{
@@ -59,12 +62,12 @@ void CommandDispatchContainer::setModel(
}
void CommandDispatchContainer::setChartDispatch(
- const Reference< frame::XDispatch >& rChartDispatch,
+ const rtl::Reference< ControllerCommandDispatch >& rChartDispatch,
const o3tl::sorted_vector< std::u16string_view > & rChartCommands )
{
OSL_ENSURE(rChartDispatch.is(),"Invalid fall back dispatcher!");
- m_xChartDispatcher.set( rChartDispatch );
- m_aChartCommands = rChartCommands;
+ m_xChartDispatcher = rChartDispatch;
+ m_aAdditionalChartCommands = rChartCommands;
m_aToBeDisposedDispatches.push_back( m_xChartDispatcher );
}
@@ -76,65 +79,62 @@ Reference< frame::XDispatch > CommandDispatchContainer::getDispatchForURL(
u"Save", u"SaveAs", u"SendMail",
u"EditDoc", u"ExportDirectToPDF", u"PrintDefault"};
- Reference< frame::XDispatch > xResult;
- tDispatchMap::const_iterator aIt( m_aCachedDispatches.find( rURL.Complete ));
- if( aIt != m_aCachedDispatches.end())
+ if (auto aIt = m_aCachedDispatches.find(rURL.Complete); aIt != m_aCachedDispatches.end())
+ return aIt->second;
+
+ auto cacheIt = [this, url = rURL.Complete](const Reference<frame::XDispatch>& val)
{
- xResult.set( (*aIt).second );
- }
- else if (rtl::Reference<::chart::ChartModel> xModel{ m_xModel })
+ m_aCachedDispatches[url].set(val);
+ return val;
+ };
+
+ if (rtl::Reference<::chart::ChartModel> xModel{ m_xModel })
{
if (rURL.Path == "Undo" || rURL.Path == "Redo" ||
rURL.Path == "GetUndoStrings" || rURL.Path == "GetRedoStrings")
{
rtl::Reference<CommandDispatch> pDispatch = new UndoCommandDispatch( m_xContext, xModel );
- xResult.set( pDispatch );
pDispatch->initialize();
- m_aCachedDispatches[ u".uno:Undo"_ustr ].set( xResult );
- m_aCachedDispatches[ u".uno:Redo"_ustr ].set( xResult );
- m_aCachedDispatches[ u".uno:GetUndoStrings"_ustr ].set( xResult );
- m_aCachedDispatches[ u".uno:GetRedoStrings"_ustr ].set( xResult );
- m_aToBeDisposedDispatches.push_back( xResult );
+ m_aCachedDispatches[u".uno:Undo"_ustr].set(pDispatch);
+ m_aCachedDispatches[u".uno:Redo"_ustr].set(pDispatch);
+ m_aCachedDispatches[u".uno:GetUndoStrings"_ustr].set(pDispatch);
+ m_aCachedDispatches[u".uno:GetRedoStrings"_ustr].set(pDispatch);
+ m_aToBeDisposedDispatches.push_back(pDispatch);
+ return pDispatch;
}
- else if (rURL.Path == "Context" || rURL.Path == "ModifiedStatus")
+ if (rURL.Path == "Context" || rURL.Path == "ModifiedStatus")
{
Reference< view::XSelectionSupplier > xSelSupp( xModel->getCurrentController(), uno::UNO_QUERY );
rtl::Reference<CommandDispatch> pDispatch = new StatusBarCommandDispatch( m_xContext, xModel, xSelSupp );
- xResult.set( pDispatch );
pDispatch->initialize();
- m_aCachedDispatches[ u".uno:Context"_ustr ].set( xResult );
- m_aCachedDispatches[ u".uno:ModifiedStatus"_ustr ].set( xResult );
- m_aToBeDisposedDispatches.push_back( xResult );
+ m_aCachedDispatches[u".uno:Context"_ustr].set(pDispatch);
+ m_aCachedDispatches[u".uno:ModifiedStatus"_ustr].set(pDispatch);
+ m_aToBeDisposedDispatches.push_back(pDispatch);
+ return pDispatch;
}
- else if (s_aContainerDocumentCommands.find( std::u16string_view(rURL.Path) ) != s_aContainerDocumentCommands.end())
+ if (s_aContainerDocumentCommands.count(rURL.Path) > 0)
{
- xResult.set( getContainerDispatchForURL( xModel->getCurrentController(), rURL ));
// ToDo: can those dispatches be cached?
- m_aCachedDispatches[ rURL.Complete ].set( xResult );
+ return cacheIt(getContainerDispatchForURL(xModel->getCurrentController(), rURL));
}
}
- else if (m_xChartDispatcher.is()
- && (m_aChartCommands.find(rURL.Path) != m_aChartCommands.end()))
- {
- xResult.set( m_xChartDispatcher );
- m_aCachedDispatches[ rURL.Complete ].set( xResult );
- }
+
+ if (m_xChartDispatcher.is()
+ && (m_xChartDispatcher->commandHandled(rURL.Complete)
+ || m_aAdditionalChartCommands.count(rURL.Path) > 0))
+ return cacheIt(m_xChartDispatcher);
+
// #i12587# support for shapes in chart
// Note, that the chart dispatcher must be queried first, because
// the chart dispatcher is the default dispatcher for all context
// sensitive commands.
- else if ( m_pDrawCommandDispatch && m_pDrawCommandDispatch->isFeatureSupported( rURL.Complete ) )
- {
- xResult.set( m_pDrawCommandDispatch );
- m_aCachedDispatches[ rURL.Complete ].set( xResult );
- }
- else if ( m_pShapeController && m_pShapeController->isFeatureSupported( rURL.Complete ) )
- {
- xResult.set( m_pShapeController );
- m_aCachedDispatches[ rURL.Complete ].set( xResult );
- }
+ if (m_pDrawCommandDispatch && m_pDrawCommandDispatch->isFeatureSupported(rURL.Complete))
+ return cacheIt(m_pDrawCommandDispatch);
- return xResult;
+ if (m_pShapeController && m_pShapeController->isFeatureSupported(rURL.Complete))
+ return cacheIt(m_pShapeController);
+
+ return {};
}
Sequence< Reference< frame::XDispatch > > CommandDispatchContainer::getDispatchesForURLs(
@@ -146,7 +146,7 @@ Sequence< Reference< frame::XDispatch > > CommandDispatchContainer::getDispatche
for( sal_Int32 nPos = 0; nPos < nCount; ++nPos )
{
- if ( aDescriptors[ nPos ].FrameName == "_self" )
+ if (aDescriptors[nPos].FrameName.isEmpty() || aDescriptors[nPos].FrameName == "_self")
aRetRange[ nPos ] = getDispatchForURL( aDescriptors[ nPos ].FeatureURL );
}
return aRet;
@@ -158,7 +158,7 @@ void CommandDispatchContainer::DisposeAndClear()
DisposeHelper::DisposeAllElements( m_aToBeDisposedDispatches );
m_aToBeDisposedDispatches.clear();
m_xChartDispatcher.clear();
- m_aChartCommands.clear();
+ m_aAdditionalChartCommands.clear();
m_pDrawCommandDispatch = nullptr;
m_pShapeController = nullptr;
}
diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx
index e6abe080a655..517fb3c6d4ad 100644
--- a/chart2/source/controller/main/ControllerCommandDispatch.cxx
+++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx
@@ -17,7 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "ControllerCommandDispatch.hxx"
+#include <sal/config.h>
+
+#include <ControllerCommandDispatch.hxx>
#include <ChartModel.hxx>
#include <Diagram.hxx>
#include <Axis.hxx>
@@ -58,43 +60,22 @@ using ::com::sun::star::uno::Sequence;
namespace
{
-bool lcl_isStatusBarVisible( const Reference< frame::XController > & xController )
-{
- bool bIsStatusBarVisible = false;
- // Status-Bar visible, workaround: this should not be necessary. @todo:
- // remove when Issue #i68864# is fixed
- if( xController.is())
- {
- Reference< beans::XPropertySet > xPropSet( xController->getFrame(), uno::UNO_QUERY );
- if( xPropSet.is() )
- {
- uno::Reference< css::frame::XLayoutManager > xLayoutManager;
- xPropSet->getPropertyValue( u"LayoutManager"_ustr ) >>= xLayoutManager;
- if ( xLayoutManager.is() )
- bIsStatusBarVisible = xLayoutManager->isElementVisible( u"private:resource/statusbar/statusbar"_ustr );
- }
- }
- return bIsStatusBarVisible;
-}
-
-bool lcl_arePropertiesSame(std::vector<Reference<beans::XPropertySet>>& xProperties,
+uno::Any getPropertyIfSame(std::vector<Reference<beans::XPropertySet>>& xProperties,
const OUString& aPropName)
{
- if (xProperties.size() == 1)
- return true;
if (xProperties.size() < 1)
- return false;
+ return {};
if (!xProperties[0])
- return false;
+ return {};
uno::Any aValue = xProperties[0]->getPropertyValue(aPropName);
for (std::size_t i = 1; i < xProperties.size(); i++)
{
if (xProperties[i] && aValue != xProperties[i]->getPropertyValue(aPropName))
- return false;
+ return {};
}
- return true;
+ return aValue;
}
} // anonymous namespace
@@ -761,64 +742,49 @@ void ControllerCommandDispatch::updateCommandAvailability()
if (!aFont.Name.isEmpty())
{
- OUString aPropName = u"CharFontName"_ustr;
- if (lcl_arePropertiesSame(xProperties, aPropName))
+ if (getPropertyIfSame(xProperties, u"CharFontName"_ustr).hasValue())
{
m_aCommandArguments[u".uno:CharFontName"_ustr] <<= aFont;
}
}
}
- OUString aPropName = u"CharHeight"_ustr;
- if (lcl_arePropertiesSame(xProperties, aPropName))
+ if (frame::status::FontHeight aFontHeight;
+ getPropertyIfSame(xProperties, u"CharHeight"_ustr) >>= aFontHeight.Height)
{
- uno::Any aAny = xProperties[0]->getPropertyValue(aPropName);
- frame::status::FontHeight aFontHeight;
- aAny >>= aFontHeight.Height;
// another type is needed here, so
m_aCommandArguments[u".uno:FontHeight"_ustr] <<= aFontHeight;
}
- aPropName = u"CharWeight"_ustr;
- if (lcl_arePropertiesSame(xProperties, aPropName))
+ if (float nFontWeight;
+ getPropertyIfSame(xProperties, u"CharWeight"_ustr) >>= nFontWeight)
{
- float nFontWeight(0.0);
- xProperties[0]->getPropertyValue(aPropName) >>= nFontWeight;
bool bFontWeight = (nFontWeight > 100.0);
m_aCommandArguments[u".uno:Bold"_ustr] <<= bFontWeight;
}
- aPropName = u"CharPosture"_ustr;
- if (lcl_arePropertiesSame(xProperties, aPropName))
+ if (awt::FontSlant nFontItalic;
+ getPropertyIfSame(xProperties, u"CharPosture"_ustr) >>= nFontItalic)
{
- awt::FontSlant nFontItalic;
- xProperties[0]->getPropertyValue(aPropName) >>= nFontItalic;
bool bItalic = (nFontItalic == awt::FontSlant_ITALIC);
m_aCommandArguments[u".uno:Italic"_ustr] <<= bItalic;
}
- aPropName = u"CharStrikeout"_ustr;
- if (lcl_arePropertiesSame(xProperties, aPropName))
+ if (sal_Int16 nFontStrikeout;
+ getPropertyIfSame(xProperties, u"CharStrikeout"_ustr) >>= nFontStrikeout)
{
- sal_Int16 nFontStrikeout(0);
- xProperties[0]->getPropertyValue(aPropName) >>= nFontStrikeout;
bool bFontStrikeout = (nFontStrikeout > 0);
m_aCommandArguments[u".uno:Strikeout"_ustr] <<= bFontStrikeout;
}
- aPropName = u"CharUnderline"_ustr;
- if (lcl_arePropertiesSame(xProperties, aPropName))
+ if (sal_Int16 nFontUnderline;
+ getPropertyIfSame(xProperties, u"CharUnderline"_ustr) >>= nFontUnderline)
{
- sal_Int16 nFontUnderline(0);
- xProperties[0]->getPropertyValue(aPropName) >>= nFontUnderline;
bool bFontUnderline = (nFontUnderline > 0);
m_aCommandArguments[u".uno:Underline"_ustr] <<= bFontUnderline;
}
- aPropName = u"CharShadowed"_ustr;
- if (lcl_arePropertiesSame(xProperties, aPropName))
+ if (bool bShadowed; getPropertyIfSame(xProperties, u"CharShadowed"_ustr) >>= bShadowed)
{
- bool bShadowed = false;
- xProperties[0]->getPropertyValue(aPropName) >>= bShadowed;
m_aCommandArguments[u".uno:Shadowed"_ustr] <<= bShadowed;
}
@@ -826,11 +792,9 @@ void ControllerCommandDispatch::updateCommandAvailability()
m_aCommandArguments[u".uno:Color"_ustr] <<= false;
m_aCommandArguments[u".uno:FontColor"_ustr] <<= false;
- aPropName = u"CharEscapement"_ustr;
- if (lcl_arePropertiesSame(xProperties, aPropName))
+ if (sal_Int32 nCharEscapement;
+ getPropertyIfSame(xProperties, u"CharEscapement"_ustr) >>= nCharEscapement)
{
- sal_Int32 nCharEscapement = 0;
- xProperties[0]->getPropertyValue(aPropName) >>= nCharEscapement;
m_aCommandArguments[u".uno:SuperScript"_ustr] <<= (nCharEscapement > 0);
m_aCommandArguments[u".uno:SubScript"_ustr] <<= (nCharEscapement < 0);
}
@@ -908,7 +872,7 @@ void ControllerCommandDispatch::updateCommandAvailability()
m_aCommandAvailability[ u".uno:DeleteDataTable"_ustr ] = bIsWritable && bModelStateIsValid && m_apModelState->bDataTable;
}
-bool ControllerCommandDispatch::commandAvailable( const OUString & rCommand )
+bool ControllerCommandDispatch::commandAvailable(const OUString& rCommand) const
{
std::map< OUString, bool >::const_iterator aIt( m_aCommandAvailability.find( rCommand ));
if( aIt != m_aCommandAvailability.end())
@@ -917,6 +881,11 @@ bool ControllerCommandDispatch::commandAvailable( const OUString & rCommand )
return false;
}
+bool ControllerCommandDispatch::commandHandled(const OUString& rCommand) const
+{
+ return m_aCommandAvailability.contains(rCommand);
+}
+
bool ControllerCommandDispatch::isShapeControllerCommandAvailable( const OUString& rCommand )
{
ShapeController* pShapeController(nullptr);
@@ -937,8 +906,7 @@ void ControllerCommandDispatch::fireStatusEvent(
const OUString & rURL,
const Reference< frame::XStatusListener > & xSingleListener /* = 0 */ )
{
- bool bIsChartSelectorURL = rURL == ".uno:ChartElementSelector";
- if( rURL.isEmpty() || bIsChartSelectorURL )
+ if (rURL.isEmpty() || rURL == ".uno:ChartElementSelector")
{
uno::Any aArg;
aArg <<= Reference< frame::XController >(m_xChartController);
@@ -950,16 +918,8 @@ void ControllerCommandDispatch::fireStatusEvent(
for (auto const& elem : m_aCommandAvailability)
fireStatusEventForURLImpl( elem.first, xSingleListener );
}
- else if( !bIsChartSelectorURL )
+ else if (m_aCommandAvailability.contains(rURL))
fireStatusEventForURLImpl( rURL, xSingleListener );
-
- // statusbar. Should be handled by base implementation
- // @todo: remove if Issue 68864 is fixed
- if( rURL.isEmpty() || rURL == ".uno:StatusBarVisible" )
- {
- bool bIsStatusBarVisible( lcl_isStatusBarVisible( m_xChartController ));
- fireStatusEventForURL( u".uno:StatusBarVisible"_ustr, uno::Any( bIsStatusBarVisible ), true, xSingleListener );
- }
}
// ____ XDispatch ____
diff --git a/chart2/source/controller/main/FeatureCommandDispatchBase.hxx b/chart2/source/controller/main/FeatureCommandDispatchBase.hxx
index 271a3c6cd282..ef8b968287bf 100644
--- a/chart2/source/controller/main/FeatureCommandDispatchBase.hxx
+++ b/chart2/source/controller/main/FeatureCommandDispatchBase.hxx
@@ -18,7 +18,9 @@
*/
#pragma once
-#include "CommandDispatch.hxx"
+#include <sal/config.h>
+
+#include <CommandDispatch.hxx>
#include <com/sun/star/frame/DispatchInformation.hpp>
diff --git a/chart2/source/controller/main/StatusBarCommandDispatch.hxx b/chart2/source/controller/main/StatusBarCommandDispatch.hxx
index 438952631206..2fc3a4c9fa25 100644
--- a/chart2/source/controller/main/StatusBarCommandDispatch.hxx
+++ b/chart2/source/controller/main/StatusBarCommandDispatch.hxx
@@ -18,7 +18,9 @@
*/
#pragma once
-#include "CommandDispatch.hxx"
+#include <sal/config.h>
+
+#include <CommandDispatch.hxx>
#include <ObjectIdentifier.hxx>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/view/XSelectionChangeListener.hpp>
diff --git a/chart2/source/controller/main/UndoCommandDispatch.hxx b/chart2/source/controller/main/UndoCommandDispatch.hxx
index f09554103844..4d3903bc8b62 100644
--- a/chart2/source/controller/main/UndoCommandDispatch.hxx
+++ b/chart2/source/controller/main/UndoCommandDispatch.hxx
@@ -18,7 +18,9 @@
*/
#pragma once
-#include "CommandDispatch.hxx"
+#include <sal/config.h>
+
+#include <CommandDispatch.hxx>
#include <rtl/ref.hxx>
namespace com::sun::star::document { class XUndoManager; }