diff options
Diffstat (limited to 'oox/source/drawingml')
-rw-r--r-- | oox/source/drawingml/chart/chartspaceconverter.cxx | 15 | ||||
-rw-r--r-- | oox/source/drawingml/chart/plotareaconverter.cxx | 10 | ||||
-rw-r--r-- | oox/source/drawingml/chart/typegroupconverter.cxx | 9 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 37 | ||||
-rw-r--r-- | oox/source/drawingml/table/predefined-table-styles.cxx | 20 | ||||
-rw-r--r-- | oox/source/drawingml/table/tablecell.cxx | 12 |
6 files changed, 67 insertions, 36 deletions
diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx index c83ed37e9c..9280d42ff2 100644 --- a/oox/source/drawingml/chart/chartspaceconverter.cxx +++ b/oox/source/drawingml/chart/chartspaceconverter.cxx @@ -38,6 +38,7 @@ #include <drawingml/chart/titleconverter.hxx> #include <ooxresid.hxx> #include <strings.hrc> +#include <drawingml/textbody.hxx> using namespace ::com::sun::star; using ::com::sun::star::uno::Reference; @@ -183,7 +184,19 @@ void ChartSpaceConverter::convertFromModel( const Reference< XShapes >& rxExtern OUString aAutoTitle = aPlotAreaConv.getAutomaticTitle(); if( mrModel.mxTitle.is() || !aAutoTitle.isEmpty() ) { - if( aAutoTitle.isEmpty() ) + // tdf#146487 In some cases, we need to show the empty title + bool bShowEmptyTitle = aAutoTitle.isEmpty() && !mrModel.mbAutoTitleDel + && aPlotAreaConv.isSingleSeriesTitle() + && mrModel.mxTitle->mxShapeProp.is() + && mrModel.mxTitle->mxTextProp.is() + && mrModel.mxTitle->mxTextProp->isEmpty(); + // Also for tdf#146487 + bool bEmptyRichText = mrModel.mxTitle + && mrModel.mxTitle->mxText.is() + && mrModel.mxTitle->mxText->mxTextBody.is() + && mrModel.mxTitle->mxText->mxTextBody->isEmpty(); + + if (aAutoTitle.isEmpty() && !bShowEmptyTitle && !bEmptyRichText) aAutoTitle = OoxResId(STR_DIAGRAM_TITLE); Reference< XTitled > xTitled( getChartDocument(), UNO_QUERY_THROW ); TitleConverter aTitleConv( *this, mrModel.mxTitle.getOrCreate() ); diff --git a/oox/source/drawingml/chart/plotareaconverter.cxx b/oox/source/drawingml/chart/plotareaconverter.cxx index 96e51c577d..32e4de7d1e 100644 --- a/oox/source/drawingml/chart/plotareaconverter.cxx +++ b/oox/source/drawingml/chart/plotareaconverter.cxx @@ -76,6 +76,8 @@ public: /** Returns the automatic chart title if the axes set contains only one series. */ const OUString& getAutomaticTitle() const { return maAutoTitle; } + /** Returns true, if the chart contains only one series and have title textbox (even empty). */ + bool isSingleSeriesTitle() const { return mbSingleSeriesTitle; } /** Returns true, if the chart is three-dimensional. */ bool is3dChart() const { return mb3dChart; } /** Returns true, if chart type supports wall and floor format in 3D mode. */ @@ -88,13 +90,15 @@ private: bool mb3dChart; bool mbWall3dChart; bool mbPieChart; + bool mbSingleSeriesTitle; }; AxesSetConverter::AxesSetConverter( const ConverterRoot& rParent, AxesSetModel& rModel ) : ConverterBase< AxesSetModel >( rParent, rModel ), mb3dChart( false ), mbWall3dChart( false ), - mbPieChart( false ) + mbPieChart( false ), + mbSingleSeriesTitle( false ) { } @@ -127,7 +131,10 @@ void AxesSetConverter::convertFromModel( const Reference< XDiagram >& rxDiagram, // get automatic chart title, if there is only one type group if( aTypeGroups.size() == 1 ) + { maAutoTitle = rFirstTypeGroup.getSingleSeriesTitle(); + mbSingleSeriesTitle = rFirstTypeGroup.isSingleSeriesTitle(); + } /* Create a coordinate system. For now, all type groups from all axes sets have to be inserted into one coordinate system. Later, chart2 should @@ -422,6 +429,7 @@ void PlotAreaConverter::convertFromModel( View3DModel& rView3DModel ) if(nAxesSetIdx == nStartAxesSetIdx) { maAutoTitle = aAxesSetConv.getAutomaticTitle(); + mbSingleSeriesTitle = aAxesSetConv.isSingleSeriesTitle(); mb3dChart = aAxesSetConv.is3dChart(); mbWall3dChart = aAxesSetConv.isWall3dChart(); mbPieChart = aAxesSetConv.isPieChart(); diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx b/oox/source/drawingml/chart/typegroupconverter.cxx index e8d8bb47bc..327a855f70 100644 --- a/oox/source/drawingml/chart/typegroupconverter.cxx +++ b/oox/source/drawingml/chart/typegroupconverter.cxx @@ -234,6 +234,15 @@ OUString TypeGroupConverter::getSingleSeriesTitle() const return aSeriesTitle; } +bool TypeGroupConverter::isSingleSeriesTitle() const +{ + if (!mrModel.maSeries.empty() && (maTypeInfo.mbSingleSeriesVis || (mrModel.maSeries.size() == 1)) && + mrModel.maSeries.front()->mxText.is()) + return true; + + return false; +} + Reference< XCoordinateSystem > TypeGroupConverter::createCoordinateSystem() { // create the coordinate system object diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index c42a9f7820..22cc551ed6 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -95,7 +95,6 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <com/sun/star/document/XActionLockable.hpp> #include <com/sun/star/chart2/data/XDataReceiver.hpp> -#include <com/sun/star/text/GraphicCrop.hpp> #include <svx/svdobj.hxx> #include <svx/svdotable.hxx> #include <svx/svdtrans.hxx> @@ -1539,35 +1538,6 @@ Reference< XShape > const & Shape::createAndInsert( propertySet->setPropertyValue("InteropGrabBag",uno::Any(aGrabBag)); } - // If the shape is a picture placeholder. - if (aServiceName == "com.sun.star.presentation.GraphicObjectShape" && !bClearText) - { - // Placeholder text should be in center of the shape. - aShapeProps.setProperty(PROP_TextContourFrame, false); - - /* Placeholder icon should be at the center of the parent shape. - * We use negative graphic crop property because of that we don't - * have padding support. - */ - uno::Reference<beans::XPropertySet> xGraphic(xSet->getPropertyValue("Graphic"), uno::UNO_QUERY); - if (xGraphic.is()) - { - awt::Size aBitmapSize; - xGraphic->getPropertyValue("Size100thMM") >>= aBitmapSize; - sal_Int32 nXMargin = (aShapeRectHmm.Width - aBitmapSize.Width) / 2; - sal_Int32 nYMargin = (aShapeRectHmm.Height - aBitmapSize.Height) / 2; - if (nXMargin > 0 && nYMargin > 0) - { - text::GraphicCrop aGraphicCrop; - aGraphicCrop.Top = nYMargin * -1; - aGraphicCrop.Bottom = nYMargin * -1; - aGraphicCrop.Left = nXMargin * -1; - aGraphicCrop.Right = nXMargin * -1; - aShapeProps.setProperty(PROP_GraphicCrop, aGraphicCrop); - } - } - } - PropertySet( xSet ).setProperties( aShapeProps ); if (mpTablePropertiesPtr && aServiceName == "com.sun.star.drawing.TableShape") @@ -1873,6 +1843,13 @@ Reference< XShape > const & Shape::createAndInsert( aPropertySet.setAnyProperty( PROP_VertOrientPosition, Any( maPosition.Y ) ); } + // Make sure to not set text to placeholders. Doing it here would eventually call + // SvxTextEditSourceImpl::UpdateData, SdrObject::SetEmptyPresObj(false), and that + // would make the object behave like a standard outline object. + // TODO/FIXME: support custom prompt text in placeholders. + if (rServiceName == "com.sun.star.presentation.GraphicObjectShape") + mpTextBody.reset(); + // in some cases, we don't have any text body. if( mpTextBody && ( !bDoNotInsertEmptyTextBody || !mpTextBody->isEmpty() ) ) { diff --git a/oox/source/drawingml/table/predefined-table-styles.cxx b/oox/source/drawingml/table/predefined-table-styles.cxx index 4517590368..90fb22e48d 100644 --- a/oox/source/drawingml/table/predefined-table-styles.cxx +++ b/oox/source/drawingml/table/predefined-table-styles.cxx @@ -231,6 +231,12 @@ std::unique_ptr<TableStyle> CreateTableStyle(const OUString& styleId) std::unique_ptr<TableStyle> pTableStyle; pTableStyle.reset(new TableStyle()); + // Text Style definitions for table parts + + bool bFirstRowTextBoldStyle = false; + bool bFirstColTextBoldStyle = false; + bool bLastColTextBoldStyle = false; + // Text Color definitions for table parts ::oox::drawingml::Color wholeTblTextColor; @@ -410,6 +416,7 @@ std::unique_ptr<TableStyle> CreateTableStyle(const OUString& styleId) pWholeTblBottomBorder->moLineWidth = 12700; pWholeTblInsideHBorder->moLineWidth = 12700; pWholeTblInsideVBorder->moLineWidth = 12700; + pFirstRowBottomBorder->moLineWidth = 12700; pWholeTblLeftBorder->moPresetDash = XML_solid; pWholeTblRightBorder->moPresetDash = XML_solid; @@ -417,6 +424,7 @@ std::unique_ptr<TableStyle> CreateTableStyle(const OUString& styleId) pWholeTblBottomBorder->moPresetDash = XML_solid; pWholeTblInsideHBorder->moPresetDash = XML_solid; pWholeTblInsideVBorder->moPresetDash = XML_solid; + pFirstRowBottomBorder->moPresetDash = XML_solid; // Start to handle all style groups. @@ -557,7 +565,13 @@ std::unique_ptr<TableStyle> CreateTableStyle(const OUString& styleId) setBorderLineType(pFirstRowBottomBorder, XML_solidFill); setBorderLineType(pLastRowTopBorder, XML_solidFill); + bFirstRowTextBoldStyle = true; + bFirstColTextBoldStyle = true; + bLastColTextBoldStyle = true; + wholeTblTextColor.setSchemeClr(XML_tx1); + firstRowTextColor.setSchemeClr(XML_tx1); + lastColTextColor.setSchemeClr(XML_tx1); sal_Int32 accent_val; @@ -571,8 +585,6 @@ std::unique_ptr<TableStyle> CreateTableStyle(const OUString& styleId) pFirstRowBottomBorder->maLineFill.maFillColor.setSchemeClr(accent_val); pLastRowTopBorder->maLineFill.maFillColor.setSchemeClr(accent_val); - firstRowTextColor.setSchemeClr(accent_val); - pBand1HFillProperties->maFillColor.setSchemeClr(accent_val); pBand1VFillProperties->maFillColor.setSchemeClr(accent_val); @@ -895,6 +907,10 @@ std::unique_ptr<TableStyle> CreateTableStyle(const OUString& styleId) pTableStyle->getStyleId() = styleId; pTableStyle->getStyleName() = style_name; + pTableStyle->getFirstRow().getTextBoldStyle() = bFirstRowTextBoldStyle; + pTableStyle->getFirstCol().getTextBoldStyle() = bFirstColTextBoldStyle; + pTableStyle->getLastCol().getTextBoldStyle() = bLastColTextBoldStyle; + pTableStyle->getWholeTbl().getTextColor() = wholeTblTextColor; pTableStyle->getFirstRow().getTextColor() = firstRowTextColor; pTableStyle->getFirstCol().getTextColor() = firstColTextColor; diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx index 687c987fe2..78ec4f61fe 100644 --- a/oox/source/drawingml/table/tablecell.cxx +++ b/oox/source/drawingml/table/tablecell.cxx @@ -358,10 +358,18 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons } if ( rProperties.isBandRow() ) { + bool bHasFirstColFillColor + = (rProperties.isFirstCol() && rTable.getFirstCol().getFillProperties() + && rTable.getFirstCol().getFillProperties()->maFillColor.isUsed()); + + bool bHasLastColFillColor + = (rProperties.isLastCol() && rTable.getLastCol().getFillProperties() + && rTable.getLastCol().getFillProperties()->maFillColor.isUsed()); + if ( ( !rProperties.isFirstRow() || ( nRow != 0 ) ) && ( !rProperties.isLastRow() || ( nRow != nMaxRow ) ) && - ( !rProperties.isFirstCol() || ( nColumn != 0 ) ) && - ( !rProperties.isLastCol() || ( nColumn != nMaxColumn ) ) ) + ( !rProperties.isFirstCol() || ( nColumn != 0 ) || !bHasFirstColFillColor ) && + ( !rProperties.isLastCol() || ( nColumn != nMaxColumn ) || !bHasLastColFillColor ) ) { sal_Int32 nBand = nRow; if ( rProperties.isFirstRow() ) |