summaryrefslogtreecommitdiffstats
path: root/oox/source
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 09:27:54 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 09:27:54 +0000
commitadb203bc05e3e36173cbd46b9951f79821a81799 (patch)
tree6e6739df9b3f0a567330a0dd7ee0e03ae70876a3 /oox/source
parentAdding debian version 4:24.2.0-3. (diff)
downloadlibreoffice-adb203bc05e3e36173cbd46b9951f79821a81799.tar.xz
libreoffice-adb203bc05e3e36173cbd46b9951f79821a81799.zip
Merging upstream version 4:24.2.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'oox/source')
-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
9 files changed, 90 insertions, 38 deletions
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;