tdf#158198 sw: prevent xBookmark.getAnchor().setString("") from deleting
[LibreOffice.git] / oox / source / drawingml / chart / datatableconverter.cxx
blob5118ae22bb16a77e3432da9679c66792765ecf04
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <drawingml/chart/datatableconverter.hxx>
22 #include <com/sun/star/chart2/XDiagram.hpp>
23 #include <com/sun/star/chart2/XDataTable.hpp>
24 #include <drawingml/chart/plotareamodel.hxx>
25 #include <oox/token/properties.hxx>
27 using namespace css;
29 namespace oox::drawingml::chart
31 DataTableConverter::DataTableConverter(const ConverterRoot& rParent, DataTableModel& rModel)
32 : ConverterBase<DataTableModel>(rParent, rModel)
36 DataTableConverter::~DataTableConverter() = default;
38 void DataTableConverter::convertFromModel(uno::Reference<chart2::XDiagram> const& rxDiagram)
40 if (!rxDiagram.is())
41 return;
43 try
45 uno::Reference<chart2::XDataTable> xDataTable(
46 createInstance(u"com.sun.star.chart2.DataTable"_ustr), uno::UNO_QUERY_THROW);
47 rxDiagram->setDataTable(xDataTable);
49 PropertySet aPropSet(xDataTable);
50 if (mrModel.mbShowHBorder)
51 aPropSet.setProperty(PROP_HBorder, mrModel.mbShowHBorder);
52 if (mrModel.mbShowVBorder)
53 aPropSet.setProperty(PROP_VBorder, mrModel.mbShowVBorder);
54 if (mrModel.mbShowOutline)
55 aPropSet.setProperty(PROP_Outline, mrModel.mbShowOutline);
56 if (mrModel.mbShowKeys)
57 aPropSet.setProperty(PROP_Keys, mrModel.mbShowKeys);
59 getFormatter().convertFormatting(aPropSet, mrModel.mxShapeProp, mrModel.mxTextProp,
60 OBJECTTYPE_DATATABLE);
62 catch (uno::Exception&)
67 } // namespace oox
69 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */