| 1 |
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 |
/* |
| 3 |
* This file is part of the LibreOffice project. |
| 4 |
* |
| 5 |
* This Source Code Form is subject to the terms of the Mozilla Public |
| 6 |
* License, v. 2.0. If a copy of the MPL was not distributed with this |
| 7 |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 8 |
* |
| 9 |
* This file incorporates work covered by the following license notice: |
| 10 |
* |
| 11 |
* Licensed to the Apache Software Foundation (ASF) under one or more |
| 12 |
* contributor license agreements. See the NOTICE file distributed |
| 13 |
* with this work for additional information regarding copyright |
| 14 |
* ownership. The ASF licenses this file to you under the Apache |
| 15 |
* License, Version 2.0 (the "License"); you may not use this file |
| 16 |
* except in compliance with the License. You may obtain a copy of |
| 17 |
* the License at http://www.apache.org/licenses/LICENSE-2.0 . |
| 18 |
*/ |
| 19 |
|
| 20 |
#include <ChartController.hxx> |
| 21 |
#include <ChartWindow.hxx> |
| 22 |
#include <ChartModel.hxx> |
| 23 |
#include <ChartType.hxx> |
| 24 |
#include <TitleHelper.hxx> |
| 25 |
#include <DataSeries.hxx> |
| 26 |
#include <DataSeriesHelper.hxx> |
| 27 |
#include "UndoGuard.hxx" |
| 28 |
#include <ControllerLockGuard.hxx> |
| 29 |
#include <ResId.hxx> |
| 30 |
#include <strings.hrc> |
| 31 |
#include <ObjectIdentifier.hxx> |
| 32 |
#include <ReferenceSizeProvider.hxx> |
| 33 |
#include <chartview/DrawModelWrapper.hxx> |
| 34 |
#include "ChartTransferable.hxx" |
| 35 |
#include <DrawViewWrapper.hxx> |
| 36 |
#include <Legend.hxx> |
| 37 |
#include <LegendHelper.hxx> |
| 38 |
#include <Axis.hxx> |
| 39 |
#include <AxisHelper.hxx> |
| 40 |
#include <RegressionCurveModel.hxx> |
| 41 |
#include <RegressionCurveHelper.hxx> |
| 42 |
#include "ShapeController.hxx" |
| 43 |
#include <DiagramHelper.hxx> |
| 44 |
#include <Diagram.hxx> |
| 45 |
#include <ObjectNameProvider.hxx> |
| 46 |
#include <unonames.hxx> |
| 47 |
|
| 48 |
#include <com/sun/star/awt/FontWeight.hpp> |
| 49 |
#include <com/sun/star/awt/Gradient.hpp> |
| 50 |
#include <com/sun/star/chart2/DataPointLabel.hpp> |
| 51 |
#include <com/sun/star/graphic/XGraphic.hpp> |
| 52 |
#include <com/sun/star/drawing/TextVerticalAdjust.hpp> |
| 53 |
#include <com/sun/star/drawing/TextHorizontalAdjust.hpp> |
| 54 |
#include <com/sun/star/chart/ErrorBarStyle.hpp> |
| 55 |
#include <com/sun/star/chart2/XRegressionCurveContainer.hpp> |
| 56 |
|
| 57 |
#include <docmodel/uno/UnoGradientTools.hxx> |
| 58 |
#include <editeng/editview.hxx> |
| 59 |
#include <editeng/outliner.hxx> |
| 60 |
#include <svx/ActionDescriptionProvider.hxx> |
| 61 |
#include <vcl/transfer.hxx> |
| 62 |
#include <sot/storage.hxx> |
| 63 |
#include <vcl/graph.hxx> |
| 64 |
#include <vcl/TypeSerializer.hxx> |
| 65 |
#include <svx/unomodel.hxx> |
| 66 |
#include <svx/svdmodel.hxx> |
| 67 |
#include <unotools/streamwrap.hxx> |
| 68 |
#include <vcl/svapp.hxx> |
| 69 |
#include <svx/dialmgr.hxx> |
| 70 |
#include <svx/strings.hrc> |
| 71 |
#include <svx/svditer.hxx> |
| 72 |
#include <svx/svdpage.hxx> |
| 73 |
#include <svx/svdundo.hxx> |
| 74 |
#include <svx/unoapi.hxx> |
| 75 |
#include <svx/unopage.hxx> |
| 76 |
#include <svx/unoshape.hxx> |
| 77 |
#include <PropertyHelper.hxx> |
| 78 |
|
| 79 |
#include <LibreOfficeKit/LibreOfficeKitEnums.h> |
| 80 |
#include <tools/debug.hxx> |
| 81 |
#include <comphelper/diagnose_ex.hxx> |
| 82 |
#include <tools/UnitConversion.hxx> |
| 83 |
|
| 84 |
#include <memory> |
| 85 |
|
| 86 |
using namespace ::com::sun::star; |
| 87 |
|
| 88 |
using ::com::sun::star::uno::Reference; |
| 89 |
using ::com::sun::star::uno::Sequence; |
| 90 |
|
| 91 |
namespace chart |
| 92 |
{ |
| 93 |
|
| 94 |
namespace |
| 95 |
{ |
| 96 |
|
| 97 |
bool lcl_deleteDataSeries( |
| 98 |
std::u16string_view rCID, |
| 99 |
const rtl::Reference<::chart::ChartModel> & xModel, |
| 100 |
const Reference< document::XUndoManager > & xUndoManager ) |
| 101 |
{ |
| 102 |
bool bResult = false; |
| 103 |
rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rCID, xModel ); |
| 104 |
if( xSeries.is() && xModel.is()) |
| 105 |
{ |
| 106 |
rtl::Reference< ::chart::ChartType > xChartType = |
| 107 |
DataSeriesHelper::getChartTypeOfSeries( xSeries, xModel->getFirstChartDiagram()); |
| 108 |
if( xChartType.is()) |
| 109 |
{ |
| 110 |
UndoGuard aUndoGuard( |
| 111 |
ActionDescriptionProvider::createDescription( |
| 112 |
ActionDescriptionProvider::ActionType::Delete, SchResId( STR_OBJECT_DATASERIES )), |
| 113 |
xUndoManager ); |
| 114 |
|
| 115 |
rtl::Reference< Diagram > xDiagram = xModel->getFirstChartDiagram(); |
| 116 |
rtl::Reference< Axis > xAxis = xDiagram->getAttachedAxis( xSeries ); |
| 117 |
|
| 118 |
xChartType->deleteSeries( xSeries ); |
| 119 |
|
| 120 |
AxisHelper::hideAxisIfNoDataIsAttached( xAxis, xDiagram ); |
| 121 |
|
| 122 |
bResult = true; |
| 123 |
aUndoGuard.commit(); |
| 124 |
} |
| 125 |
} |
| 126 |
return bResult; |
| 127 |
} |
| 128 |
|
| 129 |
bool lcl_deleteDataCurve( |
| 130 |
std::u16string_view rCID, |
| 131 |
const rtl::Reference<::chart::ChartModel> & xModel, |
| 132 |
const Reference< document::XUndoManager > & xUndoManager ) |
| 133 |
{ |
| 134 |
bool bResult = false; |
| 135 |
|
| 136 |
uno::Reference< beans::XPropertySet > xProperties( |
| 137 |
ObjectIdentifier::getObjectPropertySet( rCID, xModel)); |
| 138 |
|
| 139 |
uno::Reference< chart2::XRegressionCurve > xRegressionCurve( xProperties, uno::UNO_QUERY ); |
| 140 |
|
| 141 |
if( xRegressionCurve.is()) |
| 142 |
{ |
| 143 |
uno::Reference< chart2::XRegressionCurveContainer > xRegressionCurveContainer( |
| 144 |
ObjectIdentifier::getObjectPropertySet( |
| 145 |
ObjectIdentifier::getFullParentParticle( rCID ), xModel), uno::UNO_QUERY ); |
| 146 |
|
| 147 |
if( xRegressionCurveContainer.is()) |
| 148 |
{ |
| 149 |
UndoGuard aUndoGuard( |
| 150 |
ActionDescriptionProvider::createDescription( |
| 151 |
ActionDescriptionProvider::ActionType::Delete, SchResId( STR_OBJECT_CURVE )), |
| 152 |
xUndoManager ); |
| 153 |
|
| 154 |
xRegressionCurveContainer->removeRegressionCurve( xRegressionCurve ); |
| 155 |
|
| 156 |
bResult = true; |
| 157 |
aUndoGuard.commit(); |
| 158 |
} |
| 159 |
} |
| 160 |
return bResult; |
| 161 |
} |
| 162 |
|
| 163 |
bool lcl_arePropertiesSame(const std::vector<Reference<beans::XPropertySet>>& xProperties, |
| 164 |
OUString& aPropName) |
| 165 |
{ |
| 166 |
if (xProperties.size() == 1) |
| 167 |
return true; |
| 168 |
if (xProperties.size() < 1) |
| 169 |
return false; |
| 170 |
|
| 171 |
uno::Any aValue = xProperties[0]->getPropertyValue(aPropName); |
| 172 |
for (std::size_t i = 1; i < xProperties.size(); i++) |
| 173 |
{ |
| 174 |
if (aValue != xProperties[i]->getPropertyValue(aPropName)) |
| 175 |
return false; |
| 176 |
} |
| 177 |
return true; |
| 178 |
} |
| 179 |
|
| 180 |
// Cf. ChartColorWrapper::operator() |
| 181 |
std::pair<css::uno::Reference<css::beans::XPropertySet>, ObjectType> |
| 182 |
getSelectedGraphObject(const css::uno::Any& rSelection, const rtl::Reference<ChartModel>& pModel) |
| 183 |
{ |
| 184 |
if (OUString sCID; rSelection >>= sCID) |
| 185 |
{ |
| 186 |
auto xPropSet(ObjectIdentifier::getObjectPropertySet(sCID, pModel)); |
| 187 |
ObjectType eType = ObjectIdentifier::getObjectType(sCID); |
| 188 |
if (eType == ObjectType::OBJECTTYPE_DIAGRAM) |
| 189 |
{ |
| 190 |
if (auto xDiagram = xPropSet.query<css::chart2::XDiagram>()) |
| 191 |
{ |
| 192 |
xPropSet = xDiagram->getWall(); |
| 193 |
eType = ObjectType::OBJECTTYPE_DIAGRAM_WALL; |
| 194 |
} |
| 195 |
} |
| 196 |
|
| 197 |
return { xPropSet, eType }; |
| 198 |
} |
| 199 |
|
| 200 |
if (css::uno::Reference<css::beans::XPropertySet> xSelection; rSelection >>= xSelection) |
| 201 |
return { xSelection, ObjectType::OBJECTTYPE_SHAPE }; |
| 202 |
|
| 203 |
return {}; |
| 204 |
} |
| 205 |
|
| 206 |
css::uno::Reference<css::beans::XPropertySet> getSelectedGraphObject(ChartController& rController) |
| 207 |
{ |
| 208 |
return getSelectedGraphObject(rController.getSelection(), rController.getChartModel()).first; |
| 209 |
} |
| 210 |
|
| 211 |
} // anonymous namespace |
| 212 |
|
| 213 |
ReferenceSizeProvider ChartController::impl_createReferenceSizeProvider() |
| 214 |
{ |
| 215 |
rtl::Reference<::chart::ChartModel> xChartModel = getChartModel(); |
| 216 |
awt::Size aPageSize = xChartModel.is() ? xChartModel->getPageSize() : awt::Size(DEFAULT_PAGE_WIDTH, DEFAULT_PAGE_HEIGHT ); |
| 217 |
return ReferenceSizeProvider(aPageSize, xChartModel); |
| 218 |
} |
| 219 |
|
| 220 |
void ChartController::impl_adaptDataSeriesAutoResize() |
| 221 |
{ |
| 222 |
impl_createReferenceSizeProvider().setValuesAtAllDataSeries(); |
| 223 |
} |
| 224 |
|
| 225 |
void ChartController::executeDispatch_NewArrangement() |
| 226 |
{ |
| 227 |
// remove manual positions at titles, legend and the diagram, remove manual |
| 228 |
// size at the diagram |
| 229 |
|
| 230 |
try |
| 231 |
{ |
| 232 |
rtl::Reference<::chart::ChartModel> xModel( getChartModel() ); |
| 233 |
rtl::Reference< Diagram > xDiagram = xModel->getFirstChartDiagram(); |
| 234 |
if( xDiagram.is()) |
| 235 |
{ |
| 236 |
UndoGuard aUndoGuard( |
| 237 |
SchResId( STR_ACTION_REARRANGE_CHART ), |
| 238 |
m_xUndoManager ); |
| 239 |
ControllerLockGuardUNO aCtlLockGuard( xModel ); |
| 240 |
|
| 241 |
// diagram |
| 242 |
xDiagram->setPropertyToDefault( u"RelativeSize"_ustr); |
| 243 |
xDiagram->setPropertyToDefault( u"RelativePosition"_ustr); |
| 244 |
xDiagram->setPropertyToDefault( u"PosSizeExcludeAxes"_ustr); |
| 245 |
|
| 246 |
// 3d rotation |
| 247 |
xDiagram->set3DSettingsToDefault(); |
| 248 |
|
| 249 |
// legend |
| 250 |
rtl::Reference< Legend > xLegend = xDiagram->getLegend2(); |
| 251 |
if( xLegend.is()) |
| 252 |
{ |
| 253 |
xLegend->setPropertyToDefault( u"RelativePosition"_ustr); |
| 254 |
xLegend->setPropertyToDefault( u"RelativeSize"_ustr); |
| 255 |
xLegend->setPropertyToDefault( u"AnchorPosition"_ustr); |
| 256 |
} |
| 257 |
|
| 258 |
// titles |
| 259 |
for( sal_Int32 eType = TitleHelper::TITLE_BEGIN; |
| 260 |
eType < TitleHelper::NORMAL_TITLE_END; |
| 261 |
++eType ) |
| 262 |
{ |
| 263 |
rtl::Reference< Title > xTitleState = |
| 264 |
TitleHelper::getTitle( |
| 265 |
static_cast< TitleHelper::eTitleType >( eType ), xModel ); |
| 266 |
if( xTitleState.is()) |
| 267 |
xTitleState->setPropertyToDefault( u"RelativePosition"_ustr); |
| 268 |
} |
| 269 |
|
| 270 |
// regression curve equations |
| 271 |
std::vector< rtl::Reference< RegressionCurveModel > > aRegressionCurves = |
| 272 |
xDiagram->getAllRegressionCurvesNotMeanValueLine(); |
| 273 |
|
| 274 |
// reset equation position |
| 275 |
for( const auto& xCurve : aRegressionCurves ) |
| 276 |
RegressionCurveHelper::resetEquationPosition( xCurve ); |
| 277 |
|
| 278 |
aUndoGuard.commit(); |
| 279 |
} |
| 280 |
} |
| 281 |
catch( const uno::RuntimeException & ) |
| 282 |
{ |
| 283 |
DBG_UNHANDLED_EXCEPTION("chart2"); |
| 284 |
} |
| 285 |
} |
| 286 |
|
| 287 |
void ChartController::executeDispatch_ScaleText() |
| 288 |
{ |
| 289 |
SolarMutexGuard aSolarGuard; |
| 290 |
UndoGuard aUndoGuard( |
| 291 |
SchResId( STR_ACTION_SCALE_TEXT ), |
| 292 |
m_xUndoManager ); |
| 293 |
ControllerLockGuardUNO aCtlLockGuard( getChartModel() ); |
| 294 |
|
| 295 |
impl_createReferenceSizeProvider().toggleAutoResizeState(); |
| 296 |
|
| 297 |
aUndoGuard.commit(); |
| 298 |
} |
| 299 |
|
| 300 |
void ChartController::executeDispatch_FontBold( |
| 301 |
const std::vector<css::uno::Reference<css::beans::XPropertySet>>& xProperties) |
| 302 |
{ |
| 303 |
OUString aPropName = u"CharWeight"_ustr; |
| 304 |
float nFontWeight = awt::FontWeight::NORMAL; |
| 305 |
if (lcl_arePropertiesSame(xProperties, aPropName)) |
| 306 |
{ |
| 307 |
xProperties[0]->getPropertyValue(aPropName) >>= nFontWeight; |
| 308 |
} |
| 309 |
nFontWeight = (nFontWeight == awt::FontWeight::NORMAL) ? awt::FontWeight::BOLD |
| 310 |
: awt::FontWeight::NORMAL; |
| 311 |
for (const auto& xProperty : xProperties) |
| 312 |
xProperty->setPropertyValue(aPropName, uno::Any(nFontWeight)); |
| 313 |
} |
| 314 |
|
| 315 |
void ChartController::executeDispatch_FontName( |
| 316 |
const std::vector<css::uno::Reference<css::beans::XPropertySet>>& xProperties, |
| 317 |
const css::uno::Sequence<css::beans::PropertyValue>& rArgs) |
| 318 |
{ |
| 319 |
// the sent font may have a lot of properties that we could set. |
| 320 |
// but now we set only this |
| 321 |
awt::FontDescriptor aFont; |
| 322 |
rArgs[0].Value >>= aFont; |
| 323 |
|
| 324 |
for (const auto& xProperty : xProperties) |
| 325 |
xProperty->setPropertyValue(u"CharFontName"_ustr, css::uno::Any(aFont.Name)); |
| 326 |
} |
| 327 |
|
| 328 |
void ChartController::executeDispatch_FontHeight( |
| 329 |
const std::vector<css::uno::Reference<css::beans::XPropertySet>>& xProperties, |
| 330 |
const css::uno::Sequence<css::beans::PropertyValue>& rArgs) |
| 331 |
{ |
| 332 |
for (const auto& xProperty : xProperties) |
| 333 |
xProperty->setPropertyValue(u"CharHeight"_ustr, rArgs[0].Value); |
| 334 |
} |
| 335 |
|
| 336 |
void ChartController::executeDispatch_FontItalic( |
| 337 |
const std::vector<css::uno::Reference<css::beans::XPropertySet>>& xProperties) |
| 338 |
{ |
| 339 |
OUString aPropName = u"CharPosture"_ustr; |
| 340 |
awt::FontSlant nFontItalic = awt::FontSlant::FontSlant_NONE; |
| 341 |
if (lcl_arePropertiesSame(xProperties, aPropName)) |
| 342 |
{ |
| 343 |
xProperties[0]->getPropertyValue(aPropName) >>= nFontItalic; |
| 344 |
} |
| 345 |
nFontItalic = (nFontItalic == awt::FontSlant::FontSlant_NONE ? awt::FontSlant::FontSlant_ITALIC |
| 346 |
: awt::FontSlant::FontSlant_NONE); |
| 347 |
for (const auto& xProperty : xProperties) |
| 348 |
xProperty->setPropertyValue(aPropName, css::uno::Any(nFontItalic)); |
| 349 |
} |
| 350 |
|
| 351 |
void ChartController::executeDispatch_FontUnderline( |
| 352 |
const std::vector<css::uno::Reference<css::beans::XPropertySet>>& xProperties, |
| 353 |
const css::uno::Sequence<css::beans::PropertyValue>& rArgs) |
| 354 |
{ |
| 355 |
OUString aPropName = u"CharUnderline"_ustr; |
| 356 |
sal_Int16 nFontUnderline = 0; |
| 357 |
sal_Int32 nFontUnderline32 = 0; |
| 358 |
if (!(rArgs[0].Value >>= nFontUnderline) && (rArgs[0].Value >>= nFontUnderline32)) |
| 359 |
{ |
| 360 |
nFontUnderline = nFontUnderline32; |
| 361 |
} |
| 362 |
else |
| 363 |
{ |
| 364 |
if (lcl_arePropertiesSame(xProperties, aPropName)) |
| 365 |
{ |
| 366 |
xProperties[0]->getPropertyValue(aPropName) >>= nFontUnderline; |
| 367 |
} |
| 368 |
nFontUnderline = (nFontUnderline == 0 ? 1 : 0); |
| 369 |
} |
| 370 |
|
| 371 |
for (const auto& xProperty : xProperties) |
| 372 |
xProperty->setPropertyValue(aPropName, css::uno::Any(nFontUnderline)); |
| 373 |
} |
| 374 |
|
| 375 |
void ChartController::executeDispatch_FontStrikeout( |
| 376 |
const std::vector<css::uno::Reference<css::beans::XPropertySet>>& xProperties) |
| 377 |
{ |
| 378 |
OUString aPropName = u"CharStrikeout"_ustr; |
| 379 |
sal_Int16 nFontStrikeout = 0; |
| 380 |
if (lcl_arePropertiesSame(xProperties, aPropName)) |
| 381 |
{ |
| 382 |
xProperties[0]->getPropertyValue(aPropName) >>= nFontStrikeout; |
| 383 |
} |
| 384 |
nFontStrikeout = (nFontStrikeout == 0 ? 1 : 0); |
| 385 |
for (const auto& xProperty : xProperties) |
| 386 |
xProperty->setPropertyValue(aPropName, css::uno::Any(nFontStrikeout)); |
| 387 |
} |
| 388 |
|
| 389 |
void ChartController::executeDispatch_FontShadowed( |
| 390 |
const std::vector<css::uno::Reference<css::beans::XPropertySet>>& xProperties) |
| 391 |
{ |
| 392 |
OUString aPropName = u"CharShadowed"_ustr; |
| 393 |
bool bFontShadowed = false; |
| 394 |
if (lcl_arePropertiesSame(xProperties, aPropName)) |
| 395 |
{ |
| 396 |
xProperties[0]->getPropertyValue(aPropName) >>= bFontShadowed; |
| 397 |
} |
| 398 |
for (const auto& xProperty : xProperties) |
| 399 |
xProperty->setPropertyValue(u"CharShadowed"_ustr, css::uno::Any(!bFontShadowed)); |
| 400 |
} |
| 401 |
|
| 402 |
void ChartController::executeDispatch_FontColor( |
| 403 |
const std::vector<css::uno::Reference<css::beans::XPropertySet>>& xProperties, |
| 404 |
const css::uno::Sequence<css::beans::PropertyValue>& rArgs) |
| 405 |
{ |
| 406 |
for (const auto& xProperty : xProperties) |
| 407 |
xProperty->setPropertyValue(u"CharColor"_ustr, rArgs[0].Value); |
| 408 |
} |
| 409 |
|
| 410 |
void ChartController::executeDispatch_FontGrow( |
| 411 |
const std::vector<css::uno::Reference<css::beans::XPropertySet>>& xProperties) |
| 412 |
{ |
| 413 |
for (const auto& xProperty : xProperties) |
| 414 |
{ |
| 415 |
float nFontHeight = 0; |
| 416 |
xProperty->getPropertyValue(u"CharHeight"_ustr) >>= nFontHeight; |
| 417 |
if (nFontHeight > 0) |
| 418 |
{ |
| 419 |
nFontHeight = ceil(nFontHeight); //round |
| 420 |
nFontHeight += 1; |
| 421 |
if (nFontHeight > 999) |
| 422 |
nFontHeight = 999; |
| 423 |
xProperty->setPropertyValue(u"CharHeight"_ustr, css::uno::Any(nFontHeight)); |
| 424 |
} |
| 425 |
} |
| 426 |
} |
| 427 |
|
| 428 |
void ChartController::executeDispatch_FontShrink( |
| 429 |
const std::vector<css::uno::Reference<css::beans::XPropertySet>>& xProperties) |
| 430 |
{ |
| 431 |
for (const auto& xProperty : xProperties) |
| 432 |
{ |
| 433 |
float nFontHeight = 0; |
| 434 |
xProperty->getPropertyValue(u"CharHeight"_ustr) >>= nFontHeight; |
| 435 |
if (nFontHeight > 0) |
| 436 |
{ |
| 437 |
if (nFontHeight - ceil(nFontHeight) >= 0.4) |
| 438 |
nFontHeight = ceil(nFontHeight); //round |
| 439 |
else |
| 440 |
{ |
| 441 |
nFontHeight -= 1; |
| 442 |
if (nFontHeight < 2) |
| 443 |
nFontHeight = 2; |
| 444 |
} |
| 445 |
xProperty->setPropertyValue(u"CharHeight"_ustr, css::uno::Any(nFontHeight)); |
| 446 |
} |
| 447 |
} |
| 448 |
} |
| 449 |
|
| 450 |
void ChartController::executeDispatch_FontReset( |
| 451 |
const std::vector<css::uno::Reference<css::beans::XPropertySet>>& xProperties) |
| 452 |
{ |
| 453 |
for (const auto& xProperty: xProperties) |
| 454 |
{ |
| 455 |
xProperty->setPropertyValue(u"CharFontName"_ustr, |
| 456 |
css::uno::Any(OUString("Liberation Sans"))); |
| 457 |
xProperty->setPropertyValue(u"CharHeight"_ustr, css::uno::Any(float(13))); |
| 458 |
xProperty->setPropertyValue(u"CharWeight"_ustr, uno::Any(float(100))); |
| 459 |
xProperty->setPropertyValue(u"CharPosture"_ustr, |
| 460 |
css::uno::Any(awt::FontSlant::FontSlant_NONE)); |
| 461 |
xProperty->setPropertyValue(u"CharUnderline"_ustr, css::uno::Any(sal_Int16(0))); |
| 462 |
xProperty->setPropertyValue(u"CharStrikeout"_ustr, css::uno::Any(sal_Int16(0))); |
| 463 |
xProperty->setPropertyValue(u"CharShadowed"_ustr, css::uno::Any(false)); |
| 464 |
xProperty->setPropertyValue(u"CharColor"_ustr, css::uno::Any(Color(0))); |
| 465 |
|
| 466 |
xProperty->setPropertyValue(u"CharKerning"_ustr, css::uno::Any(sal_Int16(0))); |
| 467 |
xProperty->setPropertyValue(u"CharEscapement"_ustr, css::uno::Any(sal_Int16(0))); |
| 468 |
xProperty->setPropertyValue(u"CharEscapementHeight"_ustr, |
| 469 |
css::uno::Any(sal_Int8(100))); |
| 470 |
} |
| 471 |
} |
| 472 |
|
| 473 |
void ChartController::executeDispatch_FontSpacing( |
| 474 |
const std::vector<css::uno::Reference<css::beans::XPropertySet>>& xProperties, |
| 475 |
const css::uno::Sequence<css::beans::PropertyValue>& rArgs) |
| 476 |
{ |
| 477 |
sal_Int16 nKerning = 0; |
| 478 |
rArgs[0].Value >>= nKerning; |
| 479 |
for (const auto& xProperty: xProperties) |
| 480 |
xProperty->setPropertyValue(u"CharKerning"_ustr, css::uno::Any(nKerning)); |
| 481 |
} |
| 482 |
|
| 483 |
void ChartController::executeDispatch_FontSuperScript( |
| 484 |
const std::vector<css::uno::Reference<css::beans::XPropertySet>>& xProperties) |
| 485 |
{ |
| 486 |
sal_Int16 nCharEscapement = 0; |
| 487 |
xProperties[0]->getPropertyValue(u"CharEscapement"_ustr) >>= nCharEscapement; |
| 488 |
for (const auto& xProperty: xProperties) |
| 489 |
{ |
| 490 |
if (nCharEscapement > 0) |
| 491 |
{ |
| 492 |
xProperty->setPropertyValue(u"CharEscapement"_ustr, css::uno::Any(sal_Int16(0))); |
| 493 |
xProperty->setPropertyValue(u"CharEscapementHeight"_ustr, |
| 494 |
css::uno::Any(sal_Int8(100))); |
| 495 |
} |
| 496 |
else |
| 497 |
{ |
| 498 |
xProperty->setPropertyValue(u"CharEscapement"_ustr, |
| 499 |
css::uno::Any(sal_Int16(14000))); |
| 500 |
xProperty->setPropertyValue(u"CharEscapementHeight"_ustr, |
| 501 |
css::uno::Any(sal_Int8(58))); |
| 502 |
} |
| 503 |
} |
| 504 |
} |
| 505 |
|
| 506 |
void ChartController::executeDispatch_FontSubScript( |
| 507 |
const std::vector<css::uno::Reference<css::beans::XPropertySet>>& xProperties) |
| 508 |
{ |
| 509 |
sal_Int16 nCharEscapement = 0; |
| 510 |
xProperties[0]->getPropertyValue(u"CharEscapement"_ustr) >>= nCharEscapement; |
| 511 |
for (const auto& xProperty: xProperties) |
| 512 |
{ |
| 513 |
if (nCharEscapement < 0) |
| 514 |
{ |
| 515 |
xProperty->setPropertyValue(u"CharEscapement"_ustr, css::uno::Any(sal_Int16(0))); |
| 516 |
xProperty->setPropertyValue(u"CharEscapementHeight"_ustr, |
| 517 |
css::uno::Any(sal_Int8(100))); |
| 518 |
} |
| 519 |
else |
| 520 |
{ |
| 521 |
xProperty->setPropertyValue(u"CharEscapement"_ustr, |
| 522 |
css::uno::Any(sal_Int16(-14000))); |
| 523 |
xProperty->setPropertyValue(u"CharEscapementHeight"_ustr, |
| 524 |
css::uno::Any(sal_Int8(58))); |
| 525 |
} |
| 526 |
} |
| 527 |
} |
| 528 |
|
| 529 |
void ChartController::executeDispatch_Paste() |
| 530 |
{ |
| 531 |
SolarMutexGuard aGuard; |
| 532 |
auto pChartWindow(GetChartWindow()); |
| 533 |
if( !pChartWindow ) |
| 534 |
return; |
| 535 |
|
| 536 |
Graphic aGraphic; |
| 537 |
// paste location: center of window |
| 538 |
Point aPos = pChartWindow->PixelToLogic( tools::Rectangle(Point{}, pChartWindow->GetSizePixel()).Center()); |
| 539 |
|
| 540 |
// handle different formats |
| 541 |
TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pChartWindow )); |
| 542 |
if( aDataHelper.GetTransferable().is()) |
| 543 |
{ |
| 544 |
if ( aDataHelper.HasFormat( SotClipboardFormatId::DRAWING ) ) |
| 545 |
{ |
| 546 |
if (std::unique_ptr<SvStream> xStm = aDataHelper.GetSotStorageStream( SotClipboardFormatId::DRAWING) ) |
| 547 |
{ |
| 548 |
xStm->Seek( 0 ); |
| 549 |
Reference< io::XInputStream > xInputStream( new utl::OInputStreamWrapper( *xStm ) ); |
| 550 |
|
| 551 |
std::unique_ptr< SdrModel > spModel( |
| 552 |
new SdrModel()); |
| 553 |
|
| 554 |
if ( SvxDrawingLayerImport( spModel.get(), xInputStream ) ) |
| 555 |
{ |
| 556 |
impl_PasteShapes( spModel.get() ); |
| 557 |
} |
| 558 |
} |
| 559 |
} |
| 560 |
else if ( aDataHelper.HasFormat( SotClipboardFormatId::SVXB ) ) |
| 561 |
{ |
| 562 |
// graphic exchange format (graphic manager bitmap format?) |
| 563 |
if (std::unique_ptr<SvStream> xStm = aDataHelper.GetSotStorageStream( SotClipboardFormatId::SVXB )) |
| 564 |
{ |
| 565 |
TypeSerializer aSerializer(*xStm); |
| 566 |
aSerializer.readGraphic(aGraphic); |
| 567 |
} |
| 568 |
} |
| 569 |
else if( aDataHelper.HasFormat( SotClipboardFormatId::GDIMETAFILE )) |
| 570 |
{ |
| 571 |
// meta file |
| 572 |
GDIMetaFile aMetafile; |
| 573 |
if( aDataHelper.GetGDIMetaFile( SotClipboardFormatId::GDIMETAFILE, aMetafile )) |
| 574 |
aGraphic = Graphic( aMetafile ); |
| 575 |
} |
| 576 |
else if( aDataHelper.HasFormat( SotClipboardFormatId::BITMAP )) |
| 577 |
{ |
| 578 |
// bitmap (non-graphic-manager) |
| 579 |
Bitmap aBmp; |
| 580 |
if (aDataHelper.GetBitmap(SotClipboardFormatId::BITMAP, aBmp)) |
| 581 |
aGraphic = Graphic( aBmp ); |
| 582 |
} |
| 583 |
else if( aDataHelper.HasFormat( SotClipboardFormatId::STRING )) |
| 584 |
{ |
| 585 |
OUString aString; |
| 586 |
if( aDataHelper.GetString( SotClipboardFormatId::STRING, aString ) && m_pDrawModelWrapper ) |
| 587 |
{ |
| 588 |
if( m_pDrawViewWrapper ) |
| 589 |
{ |
| 590 |
OutlinerView* pOutlinerView = m_pDrawViewWrapper->GetTextEditOutlinerView(); |
| 591 |
if (pOutlinerView)//in case of edit mode insert the formatted string |
| 592 |
pOutlinerView->PasteSpecial(); |
| 593 |
else |
| 594 |
{ |
| 595 |
impl_PasteStringAsTextShape( aString, awt::Point( 0, 0 ) ); |
| 596 |
} |
| 597 |
} |
| 598 |
} |
| 599 |
} |
| 600 |
} |
| 601 |
|
| 602 |
if( aGraphic.GetType() != GraphicType::NONE ) |
| 603 |
{ |
| 604 |
Reference< graphic::XGraphic > xGraphic( aGraphic.GetXGraphic()); |
| 605 |
if( xGraphic.is()) |
| 606 |
impl_PasteGraphic( xGraphic, aPos ); |
| 607 |
} |
| 608 |
} |
| 609 |
|
| 610 |
// note: aPosition is ignored for now. The object is always pasted centered to |
| 611 |
// the page |
| 612 |
void ChartController::impl_PasteGraphic( |
| 613 |
uno::Reference< graphic::XGraphic > const & xGraphic, |
| 614 |
const ::Point & /* aPosition */ ) |
| 615 |
{ |
| 616 |
DBG_TESTSOLARMUTEX(); |
| 617 |
// note: the XPropertySet of the model is the old API. Also the property |
| 618 |
// "AdditionalShapes" that is used there. |
| 619 |
rtl::Reference< ChartModel > xModel = getChartModel(); |
| 620 |
DrawModelWrapper * pDrawModelWrapper( GetDrawModelWrapper()); |
| 621 |
if( ! (xGraphic.is() && xModel.is())) |
| 622 |
return; |
| 623 |
rtl::Reference<SvxGraphicObject> xGraphicShape = new SvxGraphicObject(nullptr); |
| 624 |
xGraphicShape->setShapeKind(SdrObjKind::Graphic); |
| 625 |
|
| 626 |
rtl::Reference< SvxDrawPage > xPage = pDrawModelWrapper->getMainDrawPage(); |
| 627 |
if( xPage.is()) |
| 628 |
{ |
| 629 |
xPage->add( xGraphicShape ); |
| 630 |
//need to change the model state manually |
| 631 |
xModel->setModified( true ); |
| 632 |
//select new shape |
| 633 |
m_aSelection.setSelection( xGraphicShape ); |
| 634 |
m_aSelection.applySelection( m_pDrawViewWrapper.get() ); |
| 635 |
} |
| 636 |
xGraphicShape->SvxShape::setPropertyValue( u"Graphic"_ustr, uno::Any( xGraphic )); |
| 637 |
|
| 638 |
awt::Size aGraphicSize( 1000, 1000 ); |
| 639 |
bool bGotGraphicSize = false; |
| 640 |
try |
| 641 |
{ |
| 642 |
bGotGraphicSize = xGraphicShape->SvxShape::getPropertyValue( u"Size100thMM"_ustr) >>= aGraphicSize; |
| 643 |
} |
| 644 |
catch (css::beans::UnknownPropertyException& ) |
| 645 |
{} |
| 646 |
auto pChartWindow(GetChartWindow()); |
| 647 |
// first try size in 100th mm, then pixel size |
| 648 |
if( !bGotGraphicSize ) |
| 649 |
{ |
| 650 |
bool bGotSizePixel = false; |
| 651 |
try |
| 652 |
{ |
| 653 |
bGotSizePixel = xGraphicShape->SvxShape::getPropertyValue( u"SizePixel"_ustr) >>= aGraphicSize; |
| 654 |
} |
| 655 |
catch (css::beans::UnknownPropertyException& ) |
| 656 |
{} |
| 657 |
if ( bGotSizePixel && pChartWindow ) |
| 658 |
{ |
| 659 |
::Size aVCLSize( pChartWindow->PixelToLogic( Size( aGraphicSize.Width, aGraphicSize.Height ))); |
| 660 |
aGraphicSize.Width = aVCLSize.getWidth(); |
| 661 |
aGraphicSize.Height = aVCLSize.getHeight(); |
| 662 |
} |
| 663 |
} |
| 664 |
xGraphicShape->setSize( aGraphicSize ); |
| 665 |
xGraphicShape->setPosition( awt::Point( 0, 0 ) ); |
| 666 |
} |
| 667 |
|
| 668 |
void ChartController::impl_PasteShapes( SdrModel* pModel ) |
| 669 |
{ |
| 670 |
DrawModelWrapper* pDrawModelWrapper( GetDrawModelWrapper() ); |
| 671 |
if ( !(pDrawModelWrapper && m_pDrawViewWrapper) ) |
| 672 |
return; |
| 673 |
|
| 674 |
rtl::Reference< SvxDrawPage > xDestPage( pDrawModelWrapper->getMainDrawPage() ); |
| 675 |
SdrPage* pDestPage = GetSdrPageFromXDrawPage( xDestPage ); |
| 676 |
if ( !pDestPage ) |
| 677 |
return; |
| 678 |
|
| 679 |
Reference< drawing::XShape > xSelShape; |
| 680 |
m_pDrawViewWrapper->BegUndo( SvxResId( RID_SVX_3D_UNDO_EXCHANGE_PASTE ) ); |
| 681 |
sal_uInt16 nCount = pModel->GetPageCount(); |
| 682 |
for ( sal_uInt16 i = 0; i < nCount; ++i ) |
| 683 |
{ |
| 684 |
const SdrPage* pPage = pModel->GetPage( i ); |
| 685 |
SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups ); |
| 686 |
while ( aIter.IsMore() ) |
| 687 |
{ |
| 688 |
SdrObject* pObj(aIter.Next()); |
| 689 |
// Clone to new SdrModel |
| 690 |
rtl::Reference<SdrObject> pNewObj; |
| 691 |
if (pObj) |
| 692 |
pNewObj = pObj->CloneSdrObject(pDrawModelWrapper->getSdrModel()); |
| 693 |
|
| 694 |
if ( pNewObj ) |
| 695 |
{ |
| 696 |
// set position |
| 697 |
Reference< drawing::XShape > xShape( pNewObj->getUnoShape(), uno::UNO_QUERY ); |
| 698 |
if ( xShape.is() ) |
| 699 |
{ |
| 700 |
xShape->setPosition( awt::Point( 0, 0 ) ); |
| 701 |
} |
| 702 |
|
| 703 |
pDestPage->InsertObject( pNewObj.get() ); |
| 704 |
m_pDrawViewWrapper->AddUndo( std::make_unique<SdrUndoInsertObj>( *pNewObj ) ); |
| 705 |
xSelShape = std::move(xShape); |
| 706 |
} |
| 707 |
} |
| 708 |
} |
| 709 |
|
| 710 |
rtl::Reference< ChartModel > xModifiable = getChartModel(); |
| 711 |
if ( xModifiable.is() ) |
| 712 |
{ |
| 713 |
xModifiable->setModified( true ); |
| 714 |
} |
| 715 |
|
| 716 |
// select last inserted shape |
| 717 |
m_aSelection.setSelection( xSelShape ); |
| 718 |
m_aSelection.applySelection( m_pDrawViewWrapper.get() ); |
| 719 |
|
| 720 |
m_pDrawViewWrapper->EndUndo(); |
| 721 |
|
| 722 |
impl_switchDiagramPositioningToExcludingPositioning(); |
| 723 |
} |
| 724 |
|
| 725 |
void ChartController::impl_PasteStringAsTextShape( const OUString& rString, const awt::Point& rPosition ) |
| 726 |
{ |
| 727 |
DrawModelWrapper* pDrawModelWrapper( GetDrawModelWrapper() ); |
| 728 |
if ( !(pDrawModelWrapper && m_pDrawViewWrapper) ) |
| 729 |
return; |
| 730 |
|
| 731 |
const rtl::Reference< SvxDrawPage > xDrawPage( pDrawModelWrapper->getMainDrawPage() ); |
| 732 |
OSL_ASSERT( xDrawPage.is() ); |
| 733 |
|
| 734 |
if ( !xDrawPage ) |
| 735 |
return; |
| 736 |
|
| 737 |
try |
| 738 |
{ |
| 739 |
rtl::Reference<SvxShapeText> xTextShape = new SvxShapeText(nullptr); |
| 740 |
xTextShape->setShapeKind(SdrObjKind::Text); |
| 741 |
xDrawPage->add( xTextShape ); |
| 742 |
|
| 743 |
xTextShape->setString( rString ); |
| 744 |
|
| 745 |
float fCharHeight = 10.0; |
| 746 |
xTextShape->SvxShape::setPropertyValue( u"TextAutoGrowHeight"_ustr, uno::Any( true ) ); |
| 747 |
xTextShape->SvxShape::setPropertyValue( u"TextAutoGrowWidth"_ustr, uno::Any( true ) ); |
| 748 |
xTextShape->SvxShape::setPropertyValue( u"CharHeight"_ustr, uno::Any( fCharHeight ) ); |
| 749 |
xTextShape->SvxShape::setPropertyValue( u"CharHeightAsian"_ustr, uno::Any( fCharHeight ) ); |
| 750 |
xTextShape->SvxShape::setPropertyValue( u"CharHeightComplex"_ustr, uno::Any( fCharHeight ) ); |
| 751 |
xTextShape->SvxShape::setPropertyValue( u"TextVerticalAdjust"_ustr, uno::Any( drawing::TextVerticalAdjust_CENTER ) ); |
| 752 |
xTextShape->SvxShape::setPropertyValue( u"TextHorizontalAdjust"_ustr, uno::Any( drawing::TextHorizontalAdjust_CENTER ) ); |
| 753 |
xTextShape->SvxShape::setPropertyValue( u"CharFontName"_ustr, uno::Any( u"Albany"_ustr ) ); |
| 754 |
|
| 755 |
xTextShape->setPosition( rPosition ); |
| 756 |
|
| 757 |
m_aSelection.setSelection( xTextShape ); |
| 758 |
m_aSelection.applySelection( m_pDrawViewWrapper.get() ); |
| 759 |
|
| 760 |
SdrObject* pObj = DrawViewWrapper::getSdrObject( xTextShape ); |
| 761 |
if ( pObj ) |
| 762 |
{ |
| 763 |
m_pDrawViewWrapper->BegUndo( SvxResId( RID_SVX_3D_UNDO_EXCHANGE_PASTE ) ); |
| 764 |
m_pDrawViewWrapper->AddUndo( std::make_unique<SdrUndoInsertObj>( *pObj ) ); |
| 765 |
m_pDrawViewWrapper->EndUndo(); |
| 766 |
|
| 767 |
impl_switchDiagramPositioningToExcludingPositioning(); |
| 768 |
} |
| 769 |
} |
| 770 |
catch ( const uno::Exception& ) |
| 771 |
{ |
| 772 |
DBG_UNHANDLED_EXCEPTION("chart2"); |
| 773 |
} |
| 774 |
} |
| 775 |
|
| 776 |
void ChartController::executeDispatch_Copy() |
| 777 |
{ |
| 778 |
SolarMutexGuard aSolarGuard; |
| 779 |
if (!m_pDrawViewWrapper) |
| 780 |
return; |
| 781 |
|
| 782 |
OutlinerView* pOutlinerView = m_pDrawViewWrapper->GetTextEditOutlinerView(); |
| 783 |
if (pOutlinerView) |
| 784 |
pOutlinerView->Copy(); |
| 785 |
else |
| 786 |
{ |
| 787 |
SdrObject* pSelectedObj = nullptr; |
| 788 |
ObjectIdentifier aSelOID(m_aSelection.getSelectedOID()); |
| 789 |
|
| 790 |
if (aSelOID.isAutoGeneratedObject()) |
| 791 |
pSelectedObj = m_pDrawModelWrapper->getNamedSdrObject( aSelOID.getObjectCID() ); |
| 792 |
else if (aSelOID.isAdditionalShape()) |
| 793 |
pSelectedObj = DrawViewWrapper::getSdrObject( aSelOID.getAdditionalShape() ); |
| 794 |
|
| 795 |
if (pSelectedObj) |
| 796 |
{ |
| 797 |
Reference<datatransfer::clipboard::XClipboard> xClipboard(GetChartWindow()->GetClipboard()); |
| 798 |
if (xClipboard.is()) |
| 799 |
{ |
| 800 |
Reference< datatransfer::XTransferable > xTransferable( |
| 801 |
new ChartTransferable(m_pDrawModelWrapper->getSdrModel(), |
| 802 |
pSelectedObj, aSelOID.isAdditionalShape())); |
| 803 |
xClipboard->setContents(xTransferable, Reference< datatransfer::clipboard::XClipboardOwner >()); |
| 804 |
} |
| 805 |
} |
| 806 |
} |
| 807 |
} |
| 808 |
|
| 809 |
void ChartController::executeDispatch_Cut() |
| 810 |
{ |
| 811 |
executeDispatch_Copy(); |
| 812 |
executeDispatch_Delete(); |
| 813 |
} |
| 814 |
|
| 815 |
bool ChartController::isObjectDeleteable( const uno::Any& rSelection ) |
| 816 |
{ |
| 817 |
ObjectIdentifier aSelOID( rSelection ); |
| 818 |
if ( aSelOID.isAutoGeneratedObject() ) |
| 819 |
{ |
| 820 |
const OUString& aSelObjCID( aSelOID.getObjectCID() ); |
| 821 |
ObjectType aObjectType(ObjectIdentifier::getObjectType( aSelObjCID )); |
| 822 |
|
| 823 |
switch(aObjectType) |
| 824 |
{ |
| 825 |
case OBJECTTYPE_TITLE: |
| 826 |
case OBJECTTYPE_LEGEND: |
| 827 |
case OBJECTTYPE_DATA_SERIES: |
| 828 |
case OBJECTTYPE_LEGEND_ENTRY: |
| 829 |
case OBJECTTYPE_DATA_CURVE_EQUATION: |
| 830 |
case OBJECTTYPE_DATA_CURVE: |
| 831 |
case OBJECTTYPE_DATA_AVERAGE_LINE: |
| 832 |
case OBJECTTYPE_DATA_ERRORS_X: |
| 833 |
case OBJECTTYPE_DATA_ERRORS_Y: |
| 834 |
case OBJECTTYPE_DATA_ERRORS_Z: |
| 835 |
case OBJECTTYPE_DATA_LABELS: |
| 836 |
case OBJECTTYPE_DATA_LABEL: |
| 837 |
case OBJECTTYPE_AXIS: |
| 838 |
case OBJECTTYPE_GRID: |
| 839 |
case OBJECTTYPE_SUBGRID: |
| 840 |
return true; |
| 841 |
default: |
| 842 |
break; |
| 843 |
} |
| 844 |
} |
| 845 |
else if ( aSelOID.isAdditionalShape() ) |
| 846 |
{ |
| 847 |
return true; |
| 848 |
} |
| 849 |
|
| 850 |
return false; |
| 851 |
} |
| 852 |
|
| 853 |
bool ChartController::isShapeContext() const |
| 854 |
{ |
| 855 |
return m_aSelection.isAdditionalShapeSelected() || |
| 856 |
( m_pDrawViewWrapper && m_pDrawViewWrapper->GetMarkedObjectList().GetMarkCount() != 0 && |
| 857 |
( m_pDrawViewWrapper->GetCurrentObjIdentifier() == SdrObjKind::Text ) ); |
| 858 |
} |
| 859 |
|
| 860 |
bool ChartController::IsTextEdit() const |
| 861 |
{ |
| 862 |
// only Title objects and additional shapes are editable textshapes in chart |
| 863 |
return m_pDrawViewWrapper && m_pDrawViewWrapper->IsTextEdit() && |
| 864 |
(m_aSelection.isTitleObjectSelected() || m_aSelection.isAdditionalShapeSelected()); |
| 865 |
} |
| 866 |
|
| 867 |
void ChartController::impl_ClearSelection() |
| 868 |
{ |
| 869 |
if( m_aSelection.hasSelection()) |
| 870 |
{ |
| 871 |
m_aSelection.clearSelection(); |
| 872 |
impl_notifySelectionChangeListeners(); |
| 873 |
} |
| 874 |
} |
| 875 |
|
| 876 |
bool ChartController::executeDispatch_Delete() |
| 877 |
{ |
| 878 |
bool bReturn = false; |
| 879 |
|
| 880 |
// remove the selected object |
| 881 |
OUString aCID( m_aSelection.getSelectedCID() ); |
| 882 |
if( !aCID.isEmpty() ) |
| 883 |
{ |
| 884 |
if( !isObjectDeleteable( uno::Any( aCID ) ) ) |
| 885 |
return false; |
| 886 |
|
| 887 |
//remove chart object |
| 888 |
rtl::Reference< ChartModel > xChartDoc = getChartModel(); |
| 889 |
if( !xChartDoc.is() ) |
| 890 |
return false; |
| 891 |
|
| 892 |
ObjectType aObjectType( ObjectIdentifier::getObjectType( aCID )); |
| 893 |
switch( aObjectType ) |
| 894 |
{ |
| 895 |
case OBJECTTYPE_TITLE: |
| 896 |
{ |
| 897 |
UndoGuard aUndoGuard( |
| 898 |
ActionDescriptionProvider::createDescription( |
| 899 |
ActionDescriptionProvider::ActionType::Delete, SchResId( STR_OBJECT_TITLE )), |
| 900 |
m_xUndoManager ); |
| 901 |
TitleHelper::removeTitle( |
| 902 |
ObjectIdentifier::getTitleTypeForCID( aCID ), getChartModel() ); |
| 903 |
bReturn = true; |
| 904 |
aUndoGuard.commit(); |
| 905 |
break; |
| 906 |
} |
| 907 |
case OBJECTTYPE_LEGEND: |
| 908 |
{ |
| 909 |
rtl::Reference< Diagram > xDiagram( xChartDoc->getFirstChartDiagram()); |
| 910 |
if( xDiagram.is()) |
| 911 |
{ |
| 912 |
rtl::Reference< Legend > xLegend( xDiagram->getLegend2() ); |
| 913 |
if( xLegend.is()) |
| 914 |
{ |
| 915 |
UndoGuard aUndoGuard( |
| 916 |
ActionDescriptionProvider::createDescription( |
| 917 |
ActionDescriptionProvider::ActionType::Delete, SchResId( STR_OBJECT_LEGEND )), |
| 918 |
m_xUndoManager ); |
| 919 |
xLegend->setPropertyValue( u"Show"_ustr, uno::Any( false )); |
| 920 |
bReturn = true; |
| 921 |
aUndoGuard.commit(); |
| 922 |
} |
| 923 |
} |
| 924 |
break; |
| 925 |
} |
| 926 |
|
| 927 |
case OBJECTTYPE_DATA_SERIES: |
| 928 |
bReturn = lcl_deleteDataSeries( aCID, getChartModel(), m_xUndoManager ); |
| 929 |
break; |
| 930 |
|
| 931 |
case OBJECTTYPE_LEGEND_ENTRY: |
| 932 |
{ |
| 933 |
ObjectType eParentObjectType = ObjectIdentifier::getObjectType( |
| 934 |
ObjectIdentifier::getFullParentParticle( aCID )); |
| 935 |
if( eParentObjectType == OBJECTTYPE_DATA_SERIES ) |
| 936 |
{ |
| 937 |
bReturn = lcl_deleteDataSeries( aCID, getChartModel(), m_xUndoManager ); |
| 938 |
} |
| 939 |
else if( eParentObjectType == OBJECTTYPE_DATA_CURVE ) |
| 940 |
{ |
| 941 |
sal_Int32 nEndPos = aCID.lastIndexOf(':'); |
| 942 |
OUString aParentCID = aCID.copy(0, nEndPos); |
| 943 |
|
| 944 |
bReturn = lcl_deleteDataCurve(aParentCID, getChartModel(), m_xUndoManager ); |
| 945 |
} |
| 946 |
else if( eParentObjectType == OBJECTTYPE_DATA_AVERAGE_LINE ) |
| 947 |
{ |
| 948 |
executeDispatch_DeleteMeanValue(); |
| 949 |
bReturn = true; |
| 950 |
} |
| 951 |
break; |
| 952 |
} |
| 953 |
|
| 954 |
case OBJECTTYPE_DATA_AVERAGE_LINE: |
| 955 |
{ |
| 956 |
uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt( |
| 957 |
ObjectIdentifier::getObjectPropertySet( |
| 958 |
ObjectIdentifier::getFullParentParticle( aCID ), getChartModel()), uno::UNO_QUERY ); |
| 959 |
if( xRegCurveCnt.is()) |
| 960 |
{ |
| 961 |
UndoGuard aUndoGuard( |
| 962 |
ActionDescriptionProvider::createDescription( |
| 963 |
ActionDescriptionProvider::ActionType::Delete, SchResId( STR_OBJECT_AVERAGE_LINE )), |
| 964 |
m_xUndoManager ); |
| 965 |
RegressionCurveHelper::removeMeanValueLine( xRegCurveCnt ); |
| 966 |
bReturn = true; |
| 967 |
aUndoGuard.commit(); |
| 968 |
} |
| 969 |
} |
| 970 |
break; |
| 971 |
|
| 972 |
case OBJECTTYPE_DATA_CURVE: |
| 973 |
{ |
| 974 |
bReturn = lcl_deleteDataCurve( aCID, getChartModel(), m_xUndoManager ); |
| 975 |
} |
| 976 |
break; |
| 977 |
|
| 978 |
case OBJECTTYPE_DATA_CURVE_EQUATION: |
| 979 |
{ |
| 980 |
uno::Reference< beans::XPropertySet > xEqProp( |
| 981 |
ObjectIdentifier::getObjectPropertySet( aCID, getChartModel())); |
| 982 |
|
| 983 |
if( xEqProp.is()) |
| 984 |
{ |
| 985 |
rtl::Reference<::chart::ChartModel> xModel( getChartModel() ); |
| 986 |
UndoGuard aUndoGuard( |
| 987 |
ActionDescriptionProvider::createDescription( |
| 988 |
ActionDescriptionProvider::ActionType::Delete, SchResId( STR_OBJECT_CURVE_EQUATION )), |
| 989 |
m_xUndoManager ); |
| 990 |
{ |
| 991 |
ControllerLockGuardUNO aCtlLockGuard( xModel ); |
| 992 |
xEqProp->setPropertyValue( u"ShowEquation"_ustr, uno::Any( false )); |
| 993 |
xEqProp->setPropertyValue( u"XName"_ustr, uno::Any( u"x"_ustr )); |
| 994 |
xEqProp->setPropertyValue( u"YName"_ustr, uno::Any( u"f(x)"_ustr )); |
| 995 |
xEqProp->setPropertyValue( u"ShowCorrelationCoefficient"_ustr, uno::Any( false )); |
| 996 |
} |
| 997 |
bReturn = true; |
| 998 |
aUndoGuard.commit(); |
| 999 |
} |
| 1000 |
} |
| 1001 |
break; |
| 1002 |
|
| 1003 |
case OBJECTTYPE_DATA_ERRORS_X: |
| 1004 |
case OBJECTTYPE_DATA_ERRORS_Y: |
| 1005 |
case OBJECTTYPE_DATA_ERRORS_Z: |
| 1006 |
{ |
| 1007 |
uno::Reference< beans::XPropertySet > xErrorBarProp( |
| 1008 |
ObjectIdentifier::getObjectPropertySet( aCID, getChartModel() )); |
| 1009 |
if( xErrorBarProp.is()) |
| 1010 |
{ |
| 1011 |
TranslateId pId; |
| 1012 |
|
| 1013 |
if ( aObjectType == OBJECTTYPE_DATA_ERRORS_X ) |
| 1014 |
pId = STR_OBJECT_ERROR_BARS_X; |
| 1015 |
else if ( aObjectType == OBJECTTYPE_DATA_ERRORS_Y ) |
| 1016 |
pId = STR_OBJECT_ERROR_BARS_Y; |
| 1017 |
else |
| 1018 |
pId = STR_OBJECT_ERROR_BARS_Z; |
| 1019 |
|
| 1020 |
rtl::Reference<::chart::ChartModel> xModel( getChartModel() ); |
| 1021 |
UndoGuard aUndoGuard( |
| 1022 |
ActionDescriptionProvider::createDescription( |
| 1023 |
ActionDescriptionProvider::ActionType::Delete, SchResId(pId)), |
| 1024 |
m_xUndoManager); |
| 1025 |
{ |
| 1026 |
ControllerLockGuardUNO aCtlLockGuard( xModel ); |
| 1027 |
xErrorBarProp->setPropertyValue( |
| 1028 |
u"ErrorBarStyle"_ustr, |
| 1029 |
uno::Any( css::chart::ErrorBarStyle::NONE )); |
| 1030 |
} |
| 1031 |
bReturn = true; |
| 1032 |
aUndoGuard.commit(); |
| 1033 |
} |
| 1034 |
break; |
| 1035 |
} |
| 1036 |
|
| 1037 |
case OBJECTTYPE_DATA_LABELS: |
| 1038 |
case OBJECTTYPE_DATA_LABEL: |
| 1039 |
{ |
| 1040 |
uno::Reference< beans::XPropertySet > xObjectProperties = |
| 1041 |
ObjectIdentifier::getObjectPropertySet( aCID, getChartModel() ); |
| 1042 |
if( xObjectProperties.is() ) |
| 1043 |
{ |
| 1044 |
UndoGuard aUndoGuard( |
| 1045 |
ActionDescriptionProvider::createDescription( |
| 1046 |
ActionDescriptionProvider::ActionType::Delete, |
| 1047 |
SchResId( aObjectType == OBJECTTYPE_DATA_LABEL ? STR_OBJECT_LABEL : STR_OBJECT_DATALABELS )), |
| 1048 |
m_xUndoManager ); |
| 1049 |
chart2::DataPointLabel aLabel; |
| 1050 |
xObjectProperties->getPropertyValue(CHART_UNONAME_LABEL) >>= aLabel; |
| 1051 |
aLabel.ShowNumber = false; |
| 1052 |
aLabel.ShowNumberInPercent = false; |
| 1053 |
aLabel.ShowCategoryName = false; |
| 1054 |
aLabel.ShowLegendSymbol = false; |
| 1055 |
aLabel.ShowCustomLabel = false; |
| 1056 |
aLabel.ShowSeriesName = false; |
| 1057 |
if( aObjectType == OBJECTTYPE_DATA_LABELS ) |
| 1058 |
{ |
| 1059 |
rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( aCID, getChartModel() ); |
| 1060 |
xSeries->setPropertyAlsoToAllAttributedDataPoints( CHART_UNONAME_LABEL, uno::Any(aLabel) ); |
| 1061 |
xSeries->setPropertyAlsoToAllAttributedDataPoints( CHART_UNONAME_CUSTOM_LABEL_FIELDS, uno::Any() ); |
| 1062 |
} |
| 1063 |
else |
| 1064 |
{ |
| 1065 |
xObjectProperties->setPropertyValue(CHART_UNONAME_LABEL, uno::Any(aLabel)); |
| 1066 |
xObjectProperties->setPropertyValue(CHART_UNONAME_CUSTOM_LABEL_FIELDS, uno::Any()); |
| 1067 |
} |
| 1068 |
bReturn = true; |
| 1069 |
aUndoGuard.commit(); |
| 1070 |
} |
| 1071 |
break; |
| 1072 |
} |
| 1073 |
case OBJECTTYPE_AXIS: |
| 1074 |
{ |
| 1075 |
executeDispatch_DeleteAxis(); |
| 1076 |
bReturn = true; |
| 1077 |
break; |
| 1078 |
} |
| 1079 |
case OBJECTTYPE_GRID: |
| 1080 |
{ |
| 1081 |
executeDispatch_DeleteMajorGrid(); |
| 1082 |
bReturn = true; |
| 1083 |
break; |
| 1084 |
} |
| 1085 |
case OBJECTTYPE_SUBGRID: |
| 1086 |
{ |
| 1087 |
executeDispatch_DeleteMinorGrid(); |
| 1088 |
bReturn = true; |
| 1089 |
break; |
| 1090 |
} |
| 1091 |
|
| 1092 |
default: |
| 1093 |
{ |
| 1094 |
break; |
| 1095 |
} |
| 1096 |
} |
| 1097 |
} |
| 1098 |
else |
| 1099 |
{ |
| 1100 |
//remove additional shape |
| 1101 |
impl_ClearSelection(); |
| 1102 |
{ |
| 1103 |
SolarMutexGuard aSolarGuard; |
| 1104 |
if ( m_pDrawViewWrapper ) |
| 1105 |
{ |
| 1106 |
m_pDrawViewWrapper->DeleteMarked(); |
| 1107 |
bReturn = true; |
| 1108 |
} |
| 1109 |
} |
| 1110 |
} |
| 1111 |
return bReturn; |
| 1112 |
} |
| 1113 |
|
| 1114 |
void ChartController::executeDispatch_ToggleLegend() |
| 1115 |
{ |
| 1116 |
rtl::Reference< ChartModel > xModel = getChartModel(); |
| 1117 |
UndoGuard aUndoGuard( |
| 1118 |
SchResId( STR_ACTION_TOGGLE_LEGEND ), m_xUndoManager ); |
| 1119 |
rtl::Reference< Legend > xLegendProp = LegendHelper::getLegend(*xModel); |
| 1120 |
bool bChanged = false; |
| 1121 |
if( xLegendProp.is()) |
| 1122 |
{ |
| 1123 |
try |
| 1124 |
{ |
| 1125 |
bool bShow = false; |
| 1126 |
if( xLegendProp->getPropertyValue( u"Show"_ustr) >>= bShow ) |
| 1127 |
{ |
| 1128 |
xLegendProp->setPropertyValue( u"Show"_ustr, uno::Any( ! bShow )); |
| 1129 |
bChanged = true; |
| 1130 |
} |
| 1131 |
} |
| 1132 |
catch( const uno::Exception & ) |
| 1133 |
{ |
| 1134 |
DBG_UNHANDLED_EXCEPTION("chart2"); |
| 1135 |
} |
| 1136 |
} |
| 1137 |
else |
| 1138 |
{ |
| 1139 |
xLegendProp = LegendHelper::getLegend(*xModel, m_xCC, true); |
| 1140 |
if( xLegendProp.is()) |
| 1141 |
bChanged = true; |
| 1142 |
} |
| 1143 |
|
| 1144 |
if( bChanged ) |
| 1145 |
aUndoGuard.commit(); |
| 1146 |
} |
| 1147 |
|
| 1148 |
void ChartController::executeDispatch_ToggleGridHorizontal() |
| 1149 |
{ |
| 1150 |
UndoGuard aUndoGuard( |
| 1151 |
SchResId( STR_ACTION_TOGGLE_GRID_HORZ ), m_xUndoManager ); |
| 1152 |
rtl::Reference< Diagram > xDiagram( getFirstDiagram() ); |
| 1153 |
if( !xDiagram.is()) |
| 1154 |
return; |
| 1155 |
|
| 1156 |
sal_Int32 nDimensionIndex = 1; |
| 1157 |
sal_Int32 nCooSysIndex = 0; |
| 1158 |
|
| 1159 |
bool bHasMajorYGrid = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, true, xDiagram ); |
| 1160 |
bool bHasMinorYGrid = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, false, xDiagram ); |
| 1161 |
|
| 1162 |
if( bHasMajorYGrid ) |
| 1163 |
{ |
| 1164 |
if ( bHasMinorYGrid ) |
| 1165 |
{ |
| 1166 |
AxisHelper::hideGrid( nDimensionIndex, nCooSysIndex, true, xDiagram ); |
| 1167 |
AxisHelper::hideGrid( nDimensionIndex, nCooSysIndex, false, xDiagram ); |
| 1168 |
} |
| 1169 |
else |
| 1170 |
{ |
| 1171 |
AxisHelper::showGrid( nDimensionIndex, nCooSysIndex, false, xDiagram ); |
| 1172 |
} |
| 1173 |
} |
| 1174 |
else |
| 1175 |
{ |
| 1176 |
AxisHelper::showGrid( nDimensionIndex, nCooSysIndex, true, xDiagram ); |
| 1177 |
} |
| 1178 |
aUndoGuard.commit(); |
| 1179 |
} |
| 1180 |
|
| 1181 |
void ChartController::executeDispatch_ToggleGridVertical() |
| 1182 |
{ |
| 1183 |
UndoGuard aUndoGuard( |
| 1184 |
SchResId( STR_ACTION_TOGGLE_GRID_VERTICAL ), m_xUndoManager ); |
| 1185 |
rtl::Reference< Diagram > xDiagram( getFirstDiagram() ); |
| 1186 |
if( !xDiagram.is()) |
| 1187 |
return; |
| 1188 |
|
| 1189 |
sal_Int32 nDimensionIndex = 0; |
| 1190 |
sal_Int32 nCooSysIndex = 0; |
| 1191 |
|
| 1192 |
bool bHasMajorXGrid = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, true, xDiagram ); |
| 1193 |
bool bHasMinorXGrid = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, false, xDiagram ); |
| 1194 |
if( bHasMajorXGrid ) |
| 1195 |
{ |
| 1196 |
if (bHasMinorXGrid) |
| 1197 |
{ |
| 1198 |
AxisHelper::hideGrid( nDimensionIndex, nCooSysIndex, true, xDiagram ); |
| 1199 |
AxisHelper::hideGrid( nDimensionIndex, nCooSysIndex, false, xDiagram ); |
| 1200 |
} |
| 1201 |
else |
| 1202 |
{ |
| 1203 |
AxisHelper::showGrid( nDimensionIndex, nCooSysIndex, false, xDiagram ); |
| 1204 |
} |
| 1205 |
} |
| 1206 |
else |
| 1207 |
{ |
| 1208 |
AxisHelper::showGrid( nDimensionIndex, nCooSysIndex, true, xDiagram ); |
| 1209 |
} |
| 1210 |
|
| 1211 |
aUndoGuard.commit(); |
| 1212 |
} |
| 1213 |
|
| 1214 |
void ChartController::executeDispatch_FillColor(const css::uno::Any& rColor) |
| 1215 |
{ |
| 1216 |
try |
| 1217 |
{ |
| 1218 |
rtl::Reference<::chart::ChartModel> xChartModel = getChartModel(); |
| 1219 |
if( xChartModel.is() ) |
| 1220 |
{ |
| 1221 |
const auto [xPointProperties, eType] |
| 1222 |
= getSelectedGraphObject(getSelection(), xChartModel); |
| 1223 |
if( xPointProperties.is() ) |
| 1224 |
xPointProperties->setPropertyValue(u"FillColor"_ustr, rColor); |
| 1225 |
|
| 1226 |
if (eType == OBJECTTYPE_DATA_SERIES || eType == OBJECTTYPE_DATA_POINT) |
| 1227 |
{ |
| 1228 |
xChartModel->clearColorPalette(); |
| 1229 |
} |
| 1230 |
} |
| 1231 |
} |
| 1232 |
catch( const uno::Exception& ) |
| 1233 |
{ |
| 1234 |
DBG_UNHANDLED_EXCEPTION( "chart2" ); |
| 1235 |
} |
| 1236 |
} |
| 1237 |
|
| 1238 |
void ChartController::executeDispatch_FillGradient(std::u16string_view sJSONGradient) |
| 1239 |
{ |
| 1240 |
basegfx::BGradient aBGradient = basegfx::BGradient::fromJSON(sJSONGradient); |
| 1241 |
css::awt::Gradient aGradient = model::gradient::createUnoGradient2(aBGradient); |
| 1242 |
|
| 1243 |
try |
| 1244 |
{ |
| 1245 |
OUString aCID( m_aSelection.getSelectedCID() ); |
| 1246 |
rtl::Reference<::chart::ChartModel> xChartModel = getChartModel(); |
| 1247 |
|
| 1248 |
if( xChartModel.is() ) |
| 1249 |
{ |
| 1250 |
Reference< beans::XPropertySet > xPropSet( |
| 1251 |
ObjectIdentifier::getObjectPropertySet( aCID, xChartModel ) ); |
| 1252 |
|
| 1253 |
if( xPropSet.is() ) |
| 1254 |
{ |
| 1255 |
OUString aPrefferedName = |
| 1256 |
OUString::number(static_cast<sal_Int32>(Color(aBGradient.GetColorStops().front().getStopColor()))) |
| 1257 |
+ OUString::number(static_cast<sal_Int32>(Color(aBGradient.GetColorStops().back().getStopColor()))) |
| 1258 |
+ OUString::number(static_cast<sal_Int32>(aBGradient.GetAngle().get())); |
| 1259 |
|
| 1260 |
OUString aNewName = PropertyHelper::addGradientUniqueNameToTable(css::uno::Any(aGradient), |
| 1261 |
xChartModel, |
| 1262 |
aPrefferedName); |
| 1263 |
|
| 1264 |
xPropSet->setPropertyValue(u"FillGradientName"_ustr, css::uno::Any(aNewName)); |
| 1265 |
} |
| 1266 |
} |
| 1267 |
} |
| 1268 |
catch( const uno::Exception & ) |
| 1269 |
{ |
| 1270 |
TOOLS_WARN_EXCEPTION("chart2", "" ); |
| 1271 |
} |
| 1272 |
} |
| 1273 |
|
| 1274 |
void ChartController::executeDispatch_LineColor(const css::uno::Any& rColor) |
| 1275 |
{ |
| 1276 |
try |
| 1277 |
{ |
| 1278 |
if (css::uno::Reference<css::beans::XPropertySet> xPropSet = getSelectedGraphObject(*this)) |
| 1279 |
xPropSet->setPropertyValue(u"LineColor"_ustr, rColor); |
| 1280 |
} |
| 1281 |
catch( const uno::Exception& ) |
| 1282 |
{ |
| 1283 |
DBG_UNHANDLED_EXCEPTION( "chart2" ); |
| 1284 |
} |
| 1285 |
} |
| 1286 |
|
| 1287 |
void ChartController::executeDispatch_LineWidth(const css::uno::Any& rWidth) |
| 1288 |
{ |
| 1289 |
try |
| 1290 |
{ |
| 1291 |
if (css::uno::Reference<css::beans::XPropertySet> xPropSet = getSelectedGraphObject(*this)) |
| 1292 |
xPropSet->setPropertyValue(u"LineWidth"_ustr, rWidth); |
| 1293 |
} |
| 1294 |
catch( const uno::Exception& ) |
| 1295 |
{ |
| 1296 |
DBG_UNHANDLED_EXCEPTION( "chart2" ); |
| 1297 |
} |
| 1298 |
} |
| 1299 |
|
| 1300 |
void ChartController::executeDispatch_LOKSetTextSelection(int nType, int nX, int nY) |
| 1301 |
{ |
| 1302 |
if (!m_pDrawViewWrapper) |
| 1303 |
return; |
| 1304 |
|
| 1305 |
if (!m_pDrawViewWrapper->IsTextEdit()) |
| 1306 |
return; |
| 1307 |
|
| 1308 |
OutlinerView* pOutlinerView = m_pDrawViewWrapper->GetTextEditOutlinerView(); |
| 1309 |
if (!pOutlinerView) |
| 1310 |
return; |
| 1311 |
|
| 1312 |
EditView& rEditView = pOutlinerView->GetEditView(); |
| 1313 |
Point aPoint(convertTwipToMm100(nX), convertTwipToMm100(nY)); |
| 1314 |
switch (nType) |
| 1315 |
{ |
| 1316 |
case LOK_SETTEXTSELECTION_START: |
| 1317 |
rEditView.SetCursorLogicPosition(aPoint, /*bPoint=*/false, /*bClearMark=*/false); |
| 1318 |
break; |
| 1319 |
case LOK_SETTEXTSELECTION_END: |
| 1320 |
rEditView.SetCursorLogicPosition(aPoint, /*bPoint=*/true, /*bClearMark=*/false); |
| 1321 |
break; |
| 1322 |
case LOK_SETTEXTSELECTION_RESET: |
| 1323 |
rEditView.SetCursorLogicPosition(aPoint, /*bPoint=*/true, /*bClearMark=*/true); |
| 1324 |
break; |
| 1325 |
default: |
| 1326 |
assert(false); |
| 1327 |
break; |
| 1328 |
} |
| 1329 |
} |
| 1330 |
|
| 1331 |
void ChartController::executeDispatch_LOKPieSegmentDragging( int nOffset ) |
| 1332 |
{ |
| 1333 |
try |
| 1334 |
{ |
| 1335 |
OUString aCID( m_aSelection.getSelectedCID() ); |
| 1336 |
rtl::Reference<::chart::ChartModel> xChartModel = getChartModel(); |
| 1337 |
if( xChartModel.is() ) |
| 1338 |
{ |
| 1339 |
Reference< beans::XPropertySet > xPointProperties( |
| 1340 |
ObjectIdentifier::getObjectPropertySet( aCID, xChartModel ) ); |
| 1341 |
if( xPointProperties.is() ) |
| 1342 |
xPointProperties->setPropertyValue( u"Offset"_ustr, uno::Any( nOffset / 100.0 ) ); |
| 1343 |
} |
| 1344 |
} |
| 1345 |
catch( const uno::Exception & ) |
| 1346 |
{ |
| 1347 |
TOOLS_WARN_EXCEPTION("chart2", "" ); |
| 1348 |
} |
| 1349 |
} |
| 1350 |
|
| 1351 |
void ChartController::impl_ShapeControllerDispatch( const util::URL& rURL, const Sequence< beans::PropertyValue >& rArgs ) |
| 1352 |
{ |
| 1353 |
Reference< frame::XDispatch > xDispatch( m_aDispatchContainer.getShapeController() ); |
| 1354 |
if ( xDispatch.is() ) |
| 1355 |
{ |
| 1356 |
xDispatch->dispatch( rURL, rArgs ); |
| 1357 |
} |
| 1358 |
} |
| 1359 |
|
| 1360 |
void ChartController::impl_switchDiagramPositioningToExcludingPositioning() |
| 1361 |
{ |
| 1362 |
UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( |
| 1363 |
ActionDescriptionProvider::ActionType::PosSize, |
| 1364 |
ObjectNameProvider::getName( OBJECTTYPE_DIAGRAM)), |
| 1365 |
m_xUndoManager ); |
| 1366 |
if (DiagramHelper::switchDiagramPositioningToExcludingPositioning(*getChartModel(), true, true)) |
| 1367 |
aUndoGuard.commit(); |
| 1368 |
} |
| 1369 |
|
| 1370 |
} // namespace chart |
| 1371 |
|
| 1372 |
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |