summaryrefslogtreecommitdiffstats
path: root/oox
diff options
context:
space:
mode:
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/drawingml/chart/plotareaconverter.hxx3
-rw-r--r--oox/inc/drawingml/chart/typegroupconverter.hxx3
-rw-r--r--oox/qa/unit/data/tdf134401_ExportAutoGrowToTextWordWrap.odpbin0 -> 18925 bytes
-rw-r--r--oox/qa/unit/export.cxx17
-rw-r--r--oox/source/core/xmlfilterbase.cxx4
-rw-r--r--oox/source/crypto/Standard2007Engine.cxx5
-rw-r--r--oox/source/drawingml/chart/chartspaceconverter.cxx15
-rw-r--r--oox/source/drawingml/chart/plotareaconverter.cxx10
-rw-r--r--oox/source/drawingml/chart/typegroupconverter.cxx9
-rw-r--r--oox/source/drawingml/shape.cxx37
-rw-r--r--oox/source/drawingml/table/predefined-table-styles.cxx20
-rw-r--r--oox/source/drawingml/table/tablecell.cxx12
-rw-r--r--oox/source/export/drawingml.cxx16
13 files changed, 113 insertions, 38 deletions
diff --git a/oox/inc/drawingml/chart/plotareaconverter.hxx b/oox/inc/drawingml/chart/plotareaconverter.hxx
index b520c6b481..988405b324 100644
--- a/oox/inc/drawingml/chart/plotareaconverter.hxx
+++ b/oox/inc/drawingml/chart/plotareaconverter.hxx
@@ -74,6 +74,8 @@ public:
/** Returns the automatic chart title if the chart 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 chart type supports wall and floor format in 3D mode. */
bool isWall3dChart() const { return mbWall3dChart; }
@@ -82,6 +84,7 @@ private:
bool mb3dChart;
bool mbWall3dChart;
bool mbPieChart;
+ bool mbSingleSeriesTitle;;
};
diff --git a/oox/inc/drawingml/chart/typegroupconverter.hxx b/oox/inc/drawingml/chart/typegroupconverter.hxx
index 2e3aae5a2a..6b780dd0ae 100644
--- a/oox/inc/drawingml/chart/typegroupconverter.hxx
+++ b/oox/inc/drawingml/chart/typegroupconverter.hxx
@@ -133,6 +133,9 @@ public:
/** Returns series title, if the chart type group contains only one single series. */
OUString getSingleSeriesTitle() const;
+ /** Returns true, if the chart contains only one series and have title textbox (even empty). */
+ bool isSingleSeriesTitle() const;
+
/** Creates a coordinate system according to the contained chart type. */
css::uno::Reference< css::chart2::XCoordinateSystem >
createCoordinateSystem();
diff --git a/oox/qa/unit/data/tdf134401_ExportAutoGrowToTextWordWrap.odp b/oox/qa/unit/data/tdf134401_ExportAutoGrowToTextWordWrap.odp
new file mode 100644
index 0000000000..9fcebfe0f4
--- /dev/null
+++ b/oox/qa/unit/data/tdf134401_ExportAutoGrowToTextWordWrap.odp
Binary files differ
diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx
index 415c5fe8d0..aa9690efdb 100644
--- a/oox/qa/unit/export.cxx
+++ b/oox/qa/unit/export.cxx
@@ -1345,6 +1345,23 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf157289CircularArrowExport)
assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo[1]"_ostr, "wR"_ostr, "6750");
assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo[1]"_ostr, "hR"_ostr, "6750");
}
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf134401_ExportAutoGrowToTextWordWrap)
+{
+ // pptx doesn't have autoGrowWidth and autoGrowHeight, but it does have TextWordWrap
+ // which is similar. If autoGrowWidth and autoGrowHeight are set in the document,
+ // then they are exported to pptx as TextWordWrap = "none".
+ loadFromFile(u"tdf134401_ExportAutoGrowToTextWordWrap.odp");
+ save("Impress Office Open XML");
+
+ // There are 2 shapes in the test file.
+ // The 1. shape is without autoGrowWidth/Height.
+ // The 2. shape is with autoGrowWidth/Height.
+ // Check if wrap="none" is exported for shape 2, but no wrap is exported for shape 1.
+ xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
+ assertXPathNoAttribute(pXmlDoc, "//p:sp[1]/p:txBody/a:bodyPr"_ostr, "wrap"_ostr);
+ assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:bodyPr"_ostr, "wrap"_ostr, "none");
+}
}
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 2c0cfa9732..55e43cc089 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -287,8 +287,10 @@ void XmlFilterBase::importDocumentProperties()
rtl::Reference< ::oox::core::FilterDetect > xDetector( new ::oox::core::FilterDetect( xContext ) );
xInputStream = xDetector->extractUnencryptedPackage( aMediaDesc );
Reference< XComponent > xModel = getModel();
+ const bool repairPackage = aMediaDesc.getUnpackedValueOrDefault("RepairPackage", false);
Reference< XStorage > xDocumentStorage (
- ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream( OFOPXML_STORAGE_FORMAT_STRING, xInputStream ) );
+ ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream(
+ OFOPXML_STORAGE_FORMAT_STRING, xInputStream, {}, repairPackage));
Reference< XInterface > xTemp = xContext->getServiceManager()->createInstanceWithContext(
"com.sun.star.document.OOXMLDocumentPropertiesImporter",
xContext);
diff --git a/oox/source/crypto/Standard2007Engine.cxx b/oox/source/crypto/Standard2007Engine.cxx
index b588fc5c8f..9fe18ad17e 100644
--- a/oox/source/crypto/Standard2007Engine.cxx
+++ b/oox/source/crypto/Standard2007Engine.cxx
@@ -28,7 +28,10 @@ namespace
void lclRandomGenerateValues(sal_uInt8* aArray, sal_uInt32 aSize)
{
rtlRandomPool aRandomPool = rtl_random_createPool();
- rtl_random_getBytes(aRandomPool, aArray, aSize);
+ if (rtl_random_getBytes(aRandomPool, aArray, aSize) != rtl_Random_E_None)
+ {
+ throw css::uno::RuntimeException("rtl_random_getBytes failed");
+ }
rtl_random_destroyPool(aRandomPool);
}
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() )
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 05c96c9ad7..a3e5356c05 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -4061,6 +4061,22 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo
bHasWrap = true;
}
+ // tdf#134401: If AUTOGROWWIDTH and AUTOGROWHEIGHT are set, then export it as TextWordWrap
+ if (SvxShapeText* pShpTxt = dynamic_cast<SvxShapeText*>(rXIface.get()))
+ {
+ const sdr::properties::BaseProperties& rProperties
+ = pShpTxt->GetSdrObject()->GetProperties();
+
+ const SdrOnOffItem& rSdrTextFitWidth = rProperties.GetItem(SDRATTR_TEXT_AUTOGROWWIDTH);
+ const SdrOnOffItem& rSdrTextFitHeight = rProperties.GetItem(SDRATTR_TEXT_AUTOGROWHEIGHT);
+
+ if (rSdrTextFitWidth.GetValue() == true && rSdrTextFitHeight.GetValue() == true)
+ {
+ bHasWrap = true;
+ bWrap = false;
+ }
+ }
+
if (bBodyPr)
{
const char* pWrap = (bHasWrap && !bWrap) || bIsFontworkShape ? "none" : nullptr;