summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx18
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeGeometry.cxx12
-rw-r--r--svx/source/dialog/charmap.cxx4
-rw-r--r--svx/source/dialog/srchdlg.cxx24
-rw-r--r--svx/source/dialog/svxruler.cxx4
-rw-r--r--svx/source/form/formcontroller.cxx2
-rw-r--r--svx/source/form/formcontrolling.cxx1
-rw-r--r--svx/source/sidebar/paragraph/ParaSpacingWindow.cxx10
-rw-r--r--svx/source/styles/CommonStylePreviewRenderer.cxx5
-rw-r--r--svx/source/svdraw/sdrhittesthelper.cxx7
-rw-r--r--svx/source/svdraw/svdedtv.cxx7
-rw-r--r--svx/source/svdraw/svdedxv.cxx2
-rw-r--r--svx/source/svdraw/svdomedia.cxx4
-rw-r--r--svx/source/svdraw/svdoole2.cxx6
-rw-r--r--svx/source/table/tablecontroller.cxx7
-rw-r--r--svx/source/tbxctrls/grafctrl.cxx10
-rw-r--r--svx/source/unodraw/SvxXTextColumns.cxx4
-rw-r--r--svx/source/unodraw/UnoGraphicExporter.cxx92
-rw-r--r--svx/source/unodraw/unoshap2.cxx3
-rw-r--r--svx/source/unodraw/unoshape.cxx9
-rw-r--r--svx/source/unodraw/unoshtxt.cxx5
-rw-r--r--svx/source/xml/xmlgrhlp.cxx7
-rw-r--r--svx/source/xml/xmlxtimp.cxx2
23 files changed, 134 insertions, 111 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 1f05a3782a7c..14f054ddce73 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -777,8 +777,19 @@ EnhancedCustomShape2d::EnhancedCustomShape2d(SdrObjCustomShape& rSdrObjCustomSha
case mso_sptSmileyFace : nColorData = 0x20e00000; break;
case mso_sptNil :
{
- if( sShapeType.getLength() > 4 &&
- sShapeType.match( "col-" ))
+ // Because calculation method has changed in #i102797 original color encoding for
+ // Octagon Bevel and Diamond Bevel can no longer be used. We keep the color coding
+ // only for self-created shapes, as authors may have already considered the change.
+ // We use ColorData compatible to OOXML.
+ if (sShapeType == "col-60da8460") // Octagon Bevel
+ {
+ nColorData = 0x60ecc240;
+ }
+ else if (sShapeType == "col-502ad400") // Diamond Bevel
+ {
+ nColorData = 0x502ce400;
+ }
+ else if (sShapeType.getLength() > 4 && sShapeType.match( "col-" ))
{
nColorData = sShapeType.copy( 4 ).toUInt32( 16 );
}
@@ -2755,6 +2766,9 @@ void EnhancedCustomShape2d::AdaptObjColor(
return;
const drawing::FillStyle eFillStyle = rObj.GetMergedItem(XATTR_FILLSTYLE).GetValue();
+ if (eFillStyle == drawing::FillStyle_NONE)
+ return;
+
switch( eFillStyle )
{
default:
diff --git a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
index 7539bfd8015e..0f999ed42209 100644
--- a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
@@ -1199,7 +1199,8 @@ const SvxMSDffVertPair mso_sptCurvedRightVert[] =
};
const sal_uInt16 mso_sptCurvedRightSegm[] =
{
- 0xa408,
+ 0xa404,
+ 0xa304,
0x0003,
0xa508,
0x6000,
@@ -1309,7 +1310,8 @@ const SvxMSDffVertPair mso_sptCurvedDownVert[] =
};
const sal_uInt16 mso_sptCurvedDownSegm[] =
{
- 0xa608,
+ 0xa604,
+ 0xa504,
0x0003,
0xa308,
0x6000,
@@ -1364,7 +1366,8 @@ const SvxMSDffVertPair mso_sptCurvedUpVert[] =
};
const sal_uInt16 mso_sptCurvedUpSegm[] =
{
- 0xa408,
+ 0xa404,
+ 0xa304,
0x0003,
0xa508,
0x6000,
@@ -1470,7 +1473,8 @@ const SvxMSDffVertPair mso_sptCurvedLeftVert[] =
};
const sal_uInt16 mso_sptCurvedLeftSegm[] =
{
- 0xa608,
+ 0xa604,
+ 0xa504,
0x0003,
0xa308,
0x6000,
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index 5736ea26ce73..5b1abbc5730c 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -375,7 +375,9 @@ Point SvxShowCharSet::MapIndexToPixel( int nIndex ) const
int SvxShowCharSet::PixelToMapIndex( const Point& point) const
{
int nBase = FirstInView();
- return (nBase + ((point.X() - m_nXGap)/nX) + ((point.Y() - m_nYGap)/nY) * COLUMN_COUNT);
+ int x = nX == 0 ? 0 : (point.X() - m_nXGap)/nX;
+ int y = nY == 0 ? 0 : (point.Y() - m_nYGap)/nY;
+ return (nBase + x + y * COLUMN_COUNT);
}
bool SvxShowCharSet::KeyInput(const KeyEvent& rKEvt)
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index ba5def14777e..1f77456477d4 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -2342,16 +2342,12 @@ SfxChildWinInfo SvxSearchDialogWrapper::GetInfo() const
return aInfo;
}
-static void lcl_SetSearchLabelWindow(const OUString& rStr)
+static void lcl_SetSearchLabelWindow(const OUString& rStr, SfxViewFrame& rViewFrame)
{
- SfxViewFrame* pViewFrame = SfxViewFrame::Current();
- if (!pViewFrame)
- return;
-
bool bNotFound = rStr == SvxResId(RID_SVXSTR_SEARCH_NOT_FOUND);
css::uno::Reference< css::beans::XPropertySet > xPropSet(
- pViewFrame->GetFrame().GetFrameInterface(), css::uno::UNO_QUERY_THROW);
+ rViewFrame.GetFrame().GetFrameInterface(), css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
xPropSet->getPropertyValue("LayoutManager") >>= xLayoutManager;
css::uno::Reference< css::ui::XUIElement > xUIElement =
@@ -2422,6 +2418,10 @@ OUString SvxSearchDialogWrapper::GetSearchLabel()
void SvxSearchDialogWrapper::SetSearchLabel(const SearchLabel& rSL)
{
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ if (!pViewFrame)
+ return;
+
OUString sStr;
if (rSL == SearchLabel::End)
sStr = SvxResId(RID_SVXSTR_SEARCH_END);
@@ -2442,17 +2442,21 @@ void SvxSearchDialogWrapper::SetSearchLabel(const SearchLabel& rSL)
else if (rSL == SearchLabel::ReminderStartWrapped)
sStr = SvxResId(RID_SVXSTR_SEARCH_REMINDER_START_WRAPPED);
- lcl_SetSearchLabelWindow(sStr);
- if (SvxSearchDialogWrapper *pWrp = static_cast<SvxSearchDialogWrapper*>( SfxViewFrame::Current()->
+ lcl_SetSearchLabelWindow(sStr, *pViewFrame);
+
+ if (SvxSearchDialogWrapper *pWrp = static_cast<SvxSearchDialogWrapper*>( pViewFrame->
GetChildWindow( SvxSearchDialogWrapper::GetChildWindowId() )))
pWrp->getDialog()->SetSearchLabel(sStr);
}
void SvxSearchDialogWrapper::SetSearchLabel(const OUString& sStr)
{
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ if (!pViewFrame)
+ return;
- lcl_SetSearchLabelWindow(sStr);
- if (SvxSearchDialogWrapper *pWrp = static_cast<SvxSearchDialogWrapper*>( SfxViewFrame::Current()->
+ lcl_SetSearchLabelWindow(sStr, *pViewFrame);
+ if (SvxSearchDialogWrapper *pWrp = static_cast<SvxSearchDialogWrapper*>( pViewFrame->
GetChildWindow( SvxSearchDialogWrapper::GetChildWindowId() )))
pWrp->getDialog()->SetSearchLabel(sStr);
}
diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx
index 43000ea7279c..6e960a18433d 100644
--- a/svx/source/dialog/svxruler.cxx
+++ b/svx/source/dialog/svxruler.cxx
@@ -3257,7 +3257,7 @@ void SvxRuler::MenuSelect(std::string_view ident)
if (ident.empty())
return;
/* Handler of the context menus for switching the unit of measurement */
- SetUnit(vcl::StringToMetric(OUString::fromUtf8(ident)));
+ SetUnit(vcl::EnglishStringToMetric(OUString::fromUtf8(ident)));
}
void SvxRuler::TabMenuSelect(const OString& rIdent)
@@ -3338,7 +3338,7 @@ void SvxRuler::Command( const CommandEvent& rCommandEvent )
for ( sal_uInt16 i = nCount; i; --i )
{
OString sIdent = xMenu->get_id(i - 1);
- FieldUnit eMenuUnit = vcl::StringToMetric(OUString::fromUtf8(sIdent));
+ FieldUnit eMenuUnit = vcl::EnglishStringToMetric(OUString::fromUtf8(sIdent));
xMenu->set_active(sIdent, eMenuUnit == eUnit);
if( bReduceMetric )
{
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index 50e0d4f592d9..d5687a15ba03 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -3647,7 +3647,7 @@ sal_Bool SAL_CALL FormController::approveRowChange(const RowChangeEvent& _rEvent
}
// TODO: in case of binary fields, this "getString" below is extremely expensive
- if ( !rColInfo.xColumn->wasNull() || !rColInfo.xColumn->getString().isEmpty() )
+ if ( !rColInfo.xColumn->getString().isEmpty() || !rColInfo.xColumn->wasNull() )
continue;
OUString sMessage( SvxResId( RID_ERR_FIELDREQUIRED ) );
diff --git a/svx/source/form/formcontrolling.cxx b/svx/source/form/formcontrolling.cxx
index 456e5a88ffbf..221ae3584f21 100644
--- a/svx/source/form/formcontrolling.cxx
+++ b/svx/source/form/formcontrolling.cxx
@@ -425,6 +425,7 @@ namespace svx
SID_FM_VIEW_AS_GRID
};
sal_Int32 nFeatureCount = SAL_N_ELEMENTS( pSupportedFeatures );
+ aSupportedFeatures.reserve(nFeatureCount); // work around GCC12 spurious -Werror=stringop-overflow=
aSupportedFeatures.insert( aSupportedFeatures.begin(), pSupportedFeatures, pSupportedFeatures + nFeatureCount );
m_pInvalidationCallback->invalidateFeatures( aSupportedFeatures );
diff --git a/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx b/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx
index fdfbf6fd0b1f..e149b12b0439 100644
--- a/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx
+++ b/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx
@@ -94,7 +94,10 @@ void ParaULSpacingWindow::SetValue(const SvxULSpaceItem* pItem)
IMPL_LINK_NOARG(ParaULSpacingWindow, ModifySpacingHdl, weld::MetricSpinButton&, void)
{
- SfxDispatcher* pDisp = SfxViewFrame::Current()->GetBindings().GetDispatcher();
+ SfxViewFrame* pFrame = SfxViewFrame::Current();
+ if (!pFrame)
+ return;
+ SfxDispatcher* pDisp = pFrame->GetBindings().GetDispatcher();
if(pDisp)
{
SvxULSpaceItem aMargin(SID_ATTR_PARA_ULSPACE);
@@ -283,7 +286,10 @@ void ParaLRSpacingWindow::SetUnit(FieldUnit eUnit)
IMPL_LINK_NOARG(ParaLRSpacingWindow, ModifySpacingHdl, weld::MetricSpinButton&, void)
{
- SfxDispatcher* pDisp = SfxViewFrame::Current()->GetBindings().GetDispatcher();
+ SfxViewFrame* pFrame = SfxViewFrame::Current();
+ if (!pFrame)
+ return;
+ SfxDispatcher* pDisp = pFrame->GetBindings().GetDispatcher();
if(pDisp)
{
SvxLRSpaceItem aMargin(SID_ATTR_PARA_LRSPACE);
diff --git a/svx/source/styles/CommonStylePreviewRenderer.cxx b/svx/source/styles/CommonStylePreviewRenderer.cxx
index 79f8376b0ae8..7ad9c8697dd1 100644
--- a/svx/source/styles/CommonStylePreviewRenderer.cxx
+++ b/svx/source/styles/CommonStylePreviewRenderer.cxx
@@ -218,7 +218,10 @@ bool CommonStylePreviewRenderer::render(const tools::Rectangle& aRectangle, Rend
aFontDrawPosition.AdjustY((aRectangle.GetHeight() - aPixelSize.Height()) / 2 );
}
- mrOutputDev.DrawText(aFontDrawPosition, rText);
+ if (m_pFont)
+ m_pFont->QuickDrawText( &mrOutputDev, aFontDrawPosition, rText, 0, rText.getLength(), {} );
+ else
+ mrOutputDev.DrawText(aFontDrawPosition, rText);
mrOutputDev.Pop();
diff --git a/svx/source/svdraw/sdrhittesthelper.cxx b/svx/source/svdraw/sdrhittesthelper.cxx
index 2a93dc372555..eb5116e584a7 100644
--- a/svx/source/svdraw/sdrhittesthelper.cxx
+++ b/svx/source/svdraw/sdrhittesthelper.cxx
@@ -136,9 +136,10 @@ bool ViewObjectContactPrimitiveHit(
{
// get primitive sequence
sdr::contact::DisplayInfo aDisplayInfo;
- const drawinglayer::primitive2d::Primitive2DContainer& rSequence(rVOC.getPrimitive2DSequence(aDisplayInfo));
+ // have to make a copy of this container here, because it might be changed underneath us
+ const drawinglayer::primitive2d::Primitive2DContainer aSequence(rVOC.getPrimitive2DSequence(aDisplayInfo));
- if(!rSequence.empty())
+ if(!aSequence.empty())
{
// create a HitTest processor
const drawinglayer::geometry::ViewInformation2D& rViewInformation2D = rVOC.GetObjectContact().getViewInformation2D();
@@ -152,7 +153,7 @@ bool ViewObjectContactPrimitiveHit(
aHitTestProcessor2D.collectHitStack(true);
// feed it with the primitives
- aHitTestProcessor2D.process(rSequence);
+ aHitTestProcessor2D.process(aSequence);
// deliver result
if (aHitTestProcessor2D.getHit())
diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx
index 47f5c971e543..420f024f2064 100644
--- a/svx/source/svdraw/svdedtv.cxx
+++ b/svx/source/svdraw/svdedtv.cxx
@@ -1000,7 +1000,8 @@ bool SdrEditView::InsertObjectAtView(SdrObject* pObj, SdrPageView& rPV, SdrInser
}
if( IsUndoEnabled())
{
- EndTextEditCurrentView();
+ bool bDontDeleteReally = true;
+ EndTextEditCurrentView(bDontDeleteReally);
AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pObj));
}
@@ -1080,13 +1081,13 @@ void SdrEditView::EndTextEditAllViews() const
}
}
-void SdrEditView::EndTextEditCurrentView()
+void SdrEditView::EndTextEditCurrentView(bool bDontDeleteReally)
{
if (IsTextEdit())
{
SdrView* pSdrView = dynamic_cast<SdrView*>(this);
if (pSdrView)
- pSdrView->SdrEndTextEdit();
+ pSdrView->SdrEndTextEdit(bDontDeleteReally);
}
}
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index f046fb185057..cac845ae46ae 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -2711,7 +2711,7 @@ static SfxItemSet CreatePaintSet(const WhichRangesContainer& pRanges, SfxItemPoo
if (bNoParagraphFormats && (nWhich == EE_PARA_START))
continue;
- for (; nWhich < nLastWhich; nWhich++)
+ for (; nWhich <= nLastWhich; nWhich++)
{
const SfxPoolItem* pSourceItem = rSourceSet.GetItem(nWhich);
const SfxPoolItem* pTargetItem = rTargetSet.GetItem(nWhich);
diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx
index 515bdff11b42..bc030c7d6d3f 100644
--- a/svx/source/svdraw/svdomedia.cxx
+++ b/svx/source/svdraw/svdomedia.cxx
@@ -146,7 +146,9 @@ uno::Reference< graphic::XGraphic > const & SdrMediaObj::getSnapshot() const
OUString aRealURL = m_xImpl->m_MediaProperties.getTempURL();
if( aRealURL.isEmpty() )
aRealURL = m_xImpl->m_MediaProperties.getURL();
- m_xImpl->m_xCachedSnapshot = avmedia::MediaWindow::grabFrame( aRealURL, m_xImpl->m_MediaProperties.getReferer(), m_xImpl->m_MediaProperties.getMimeType());
+ uno::Reference<graphic::XGraphic> xGraphic
+ = m_xImpl->m_MediaProperties.getGraphic().GetXGraphic();
+ m_xImpl->m_xCachedSnapshot = avmedia::MediaWindow::grabFrame( aRealURL, m_xImpl->m_MediaProperties.getReferer(), m_xImpl->m_MediaProperties.getMimeType(), xGraphic);
}
#endif
return m_xImpl->m_xCachedSnapshot;
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index bc7df6b37513..158824b327a0 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -1470,8 +1470,10 @@ void SdrOle2Obj::ImpSetVisAreaSize()
// objects' visual area. The scaling will not change, but it might exist already and must
// be used in calculations
MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( mpImpl->mxObjRef->getMapUnit( GetAspect() ) );
- Size aVisSize( static_cast<tools::Long>( Fraction( maRect.GetWidth() ) / aScaleWidth ),
- static_cast<tools::Long>( Fraction( maRect.GetHeight() ) / aScaleHeight ) );
+ Size aVisSize;
+ if (sal_Int32(aScaleWidth) != 0 && sal_Int32(aScaleHeight) != 0) // avoid div by zero
+ aVisSize = Size( static_cast<tools::Long>( Fraction( maRect.GetWidth() ) / aScaleWidth ),
+ static_cast<tools::Long>( Fraction( maRect.GetHeight() ) / aScaleHeight ) );
aVisSize = OutputDevice::LogicToLogic(
aVisSize,
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index d11b22988148..42712b09296f 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -2752,6 +2752,13 @@ void SvxTableController::SetAttrToSelectedShape(const SfxItemSet& rAttr)
SfxItemSetFixed<SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST> aSet(*rAttr.GetPool());
aSet.Put(rAttr);
+ if (!aSet.Count())
+ {
+ // If there are no items to be applied on the shape, then don't set anything, it would
+ // terminate text edit without a good reason, which affects undo/redo.
+ return;
+ }
+
// Set shadow items on the marked shape.
mrView.SetAttrToMarked(aSet, /*bReplaceAll=*/false);
}
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index 02fb3d540ba8..a88ececfa7dd 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -71,7 +71,6 @@ namespace {
class ImplGrafControl final : public InterimItemWindow
{
private:
- Idle maIdle;
OUString maCommand;
Reference<XFrame> mxFrame;
std::unique_ptr<weld::Image> mxImage;
@@ -79,7 +78,7 @@ private:
DECL_LINK(ValueChangedHdl, weld::MetricSpinButton&, void);
DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
- DECL_LINK(ImplModifyHdl, Timer*, void);
+ void ImplModify();
public:
ImplGrafControl( vcl::Window* pParent, const OUString& rCmd, const Reference< XFrame >& rFrame );
@@ -100,10 +99,10 @@ public:
IMPL_LINK_NOARG(ImplGrafControl, ValueChangedHdl, weld::MetricSpinButton&, void)
{
- maIdle.Start();
+ ImplModify();
}
-IMPL_LINK_NOARG(ImplGrafControl, ImplModifyHdl, Timer*, void)
+void ImplGrafControl::ImplModify()
{
const sal_Int64 nVal = mxField->get_value(FieldUnit::NONE);
@@ -196,7 +195,6 @@ ImplGrafControl::ImplGrafControl(
const OUString& rCmd,
const Reference< XFrame >& rFrame)
: InterimItemWindow(pParent, "svx/ui/grafctrlbox.ui", "GrafCtrlBox")
- , maIdle("svx ImplGrafControl maIdle")
, maCommand(rCmd)
, mxFrame(rFrame)
, mxImage(m_xBuilder->weld_image("image"))
@@ -232,8 +230,6 @@ ImplGrafControl::ImplGrafControl(
mxField->set_increments(1, 10, FieldUnit::PERCENT);
}
- maIdle.SetInvokeHandler( LINK( this, ImplGrafControl, ImplModifyHdl ) );
-
SetSizePixel(m_xContainer->get_preferred_size());
}
diff --git a/svx/source/unodraw/SvxXTextColumns.cxx b/svx/source/unodraw/SvxXTextColumns.cxx
index 00971bc7bc87..a0e399bd4cbb 100644
--- a/svx/source/unodraw/SvxXTextColumns.cxx
+++ b/svx/source/unodraw/SvxXTextColumns.cxx
@@ -210,7 +210,7 @@ void SvxXTextColumns::setPropertyValue(const OUString& rPropertyName, const css:
sal_Int32 nTmp;
if (!(aValue >>= nTmp) || nTmp < 0)
throw css::lang::IllegalArgumentException();
- m_nSepLineWidth = o3tl::toTwips(nTmp, o3tl::Length::mm100);
+ m_nSepLineWidth = nTmp;
break;
}
case WID_TXTCOL_LINE_COLOR:
@@ -271,7 +271,7 @@ css::uno::Any SvxXTextColumns::getPropertyValue(const OUString& rPropertyName)
switch (pEntry->nWID)
{
case WID_TXTCOL_LINE_WIDTH:
- aRet <<= o3tl::narrowing<sal_Int32>(convertTwipToMm100(m_nSepLineWidth));
+ aRet <<= m_nSepLineWidth;
break;
case WID_TXTCOL_LINE_COLOR:
aRet <<= m_nSepLineColor;
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index 73d77cb54ea8..b807154f9d67 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -178,7 +178,7 @@ namespace {
/** creates a bitmap that is optionally transparent from a metafile
*/
- BitmapEx GetBitmapFromMetaFile( const GDIMetaFile& rMtf,bool bIsSelection, const Size* pSize )
+ BitmapEx GetBitmapFromMetaFile( const GDIMetaFile& rMtf, const Size* pSize )
{
// use new primitive conversion tooling
basegfx::B2DRange aRange(basegfx::B2DPoint(0.0, 0.0));
@@ -204,51 +204,7 @@ namespace {
aRange.expand(basegfx::B2DPoint(aSize100th.Width(), aSize100th.Height()));
}
- // get hairline and full bound rect to evtl. correct logic size by the
- // equivalent of one pixel to make those visible at right and bottom
- tools::Rectangle aHairlineRect;
- const tools::Rectangle aRect(rMtf.GetBoundRect(*Application::GetDefaultDevice(), &aHairlineRect));
-
- if(!aRect.IsEmpty())
- {
- GDIMetaFile aMtf(rMtf);
-
- if (bIsSelection)
- {
- // tdf#105998 Correct the Metafile using information from it's real sizes measured
- // using rMtf.GetBoundRect above and a copy
- const Size aOnePixelInMtf(
- Application::GetDefaultDevice()->PixelToLogic(
- Size(1, 1),
- rMtf.GetPrefMapMode()));
- const Size aHalfPixelInMtf(
- (aOnePixelInMtf.getWidth() + 1) / 2,
- (aOnePixelInMtf.getHeight() + 1) / 2);
- const bool bHairlineBR(
- !aHairlineRect.IsEmpty() && (aRect.Right() == aHairlineRect.Right() || aRect.Bottom() == aHairlineRect.Bottom()));
-
- // Move the content to (0,0), usually TopLeft ist slightly
- // negative. For better visualization, add a half pixel, too
- aMtf.Move(
- aHalfPixelInMtf.getWidth() - aRect.Left(),
- aHalfPixelInMtf.getHeight() - aRect.Top());
-
- // Do not Scale, but set the PrefSize. Some levels deeper the
- // MetafilePrimitive will add a mapping to the decomposition
- // (and possibly a clipping) to map the graphic content to
- // a unit coordinate system.
- // Size is the measured size plus one pixel if needed (bHairlineBR)
- // and the moved half pixwel from above
- aMtf.SetPrefSize(
- Size(
- aRect.getWidth() + (bHairlineBR ? aOnePixelInMtf.getWidth() : 0) + aHalfPixelInMtf.getWidth(),
- aRect.getHeight() + (bHairlineBR ? aOnePixelInMtf.getHeight() : 0) + aHalfPixelInMtf.getHeight()));
- }
-
- return convertMetafileToBitmapEx(aMtf, aRange, nMaximumQuadraticPixels);
- }
-
- return BitmapEx();
+ return convertMetafileToBitmapEx(rMtf, aRange, nMaximumQuadraticPixels);
}
Size* CalcSize( sal_Int32 nWidth, sal_Int32 nHeight, const Size& aBoundSize, Size& aOutSize )
@@ -775,7 +731,7 @@ bool GraphicExporter::GetGraphic( ExportSettings const & rSettings, Graphic& aGr
if( rSettings.mbTranslucent )
{
Size aOutSize;
- aGraphic = GetBitmapFromMetaFile( aGraphic.GetGDIMetaFile(), false, CalcSize( rSettings.mnWidth, rSettings.mnHeight, aNewSize, aOutSize ) );
+ aGraphic = GetBitmapFromMetaFile( aGraphic.GetGDIMetaFile(), CalcSize( rSettings.mnWidth, rSettings.mnHeight, aNewSize, aOutSize ) );
}
}
}
@@ -899,16 +855,22 @@ bool GraphicExporter::GetGraphic( ExportSettings const & rSettings, Graphic& aGr
ScopedVclPtrInstance< VirtualDevice > aOut;
// calculate bound rect for all shapes
- tools::Rectangle aBound;
+ // tdf#126319 I did not convert all rendering to primities,
+ // that would be to much for this fix. But I did so for the
+ // range calculation to get a valid high quality range.
+ // Based on that the conversion is reliable. With the BoundRect
+ // fetched from the Metafile it was just not possible to get the
+ // examples from the task handled in a way to fit all cases -
+ // due to bad-quality range data from it.
+ basegfx::B2DRange aBound;
+ const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
{
for( SdrObject* pObj : aShapes )
{
- tools::Rectangle aR1(pObj->GetCurrentBoundRect());
- if (aBound.IsEmpty())
- aBound=aR1;
- else
- aBound.Union(aR1);
+ drawinglayer::primitive2d::Primitive2DContainer aSequence;
+ aSequence = pObj->GetViewContact().getViewIndependentPrimitive2DContainer();
+ aBound.expand(aSequence.getB2DRange(aViewInformation2D));
}
}
@@ -922,7 +884,20 @@ bool GraphicExporter::GetGraphic( ExportSettings const & rSettings, Graphic& aGr
aMtf.Record( aOut );
MapMode aOutMap( aMap );
- aOutMap.SetOrigin( Point( -aBound.Left(), -aBound.Top() ) );
+ const Size aOnePixelInMtf(
+ Application::GetDefaultDevice()->PixelToLogic(
+ Size(1, 1),
+ aMap));
+ const Size aHalfPixelInMtf(
+ (aOnePixelInMtf.getWidth() + 1) / 2,
+ (aOnePixelInMtf.getHeight() + 1) / 2);
+
+ // tdf#126319 Immediately add needed offset to create metafile,
+ // that avoids to do it later by Metafile::Move what would be expensive
+ aOutMap.SetOrigin(
+ Point(
+ basegfx::fround(-aBound.getMinX() - aHalfPixelInMtf.getWidth()),
+ basegfx::fround(-aBound.getMinY() - aHalfPixelInMtf.getHeight()) ) );
aOut->SetRelativeMapMode( aOutMap );
sdr::contact::DisplayInfo aDisplayInfo;
@@ -951,9 +926,10 @@ bool GraphicExporter::GetGraphic( ExportSettings const & rSettings, Graphic& aGr
aMtf.Stop();
aMtf.WindStart();
- const Size aExtSize( aOut->PixelToLogic( Size( 0, 0 ) ) );
- Size aBoundSize( aBound.GetWidth() + ( aExtSize.Width() ),
- aBound.GetHeight() + ( aExtSize.Height() ) );
+ // tdf#126319 Immediately add needed size to target's PrefSize
+ const Size aBoundSize(
+ basegfx::fround(aBound.getWidth() + aHalfPixelInMtf.getWidth()),
+ basegfx::fround(aBound.getHeight() + aHalfPixelInMtf.getHeight()));
aMtf.SetPrefMapMode( aMap );
aMtf.SetPrefSize( aBoundSize );
@@ -961,7 +937,7 @@ bool GraphicExporter::GetGraphic( ExportSettings const & rSettings, Graphic& aGr
if( !bVectorType )
{
Size aOutSize;
- aGraphic = GetBitmapFromMetaFile( aMtf, true, CalcSize( rSettings.mnWidth, rSettings.mnHeight, aBoundSize, aOutSize ) );
+ aGraphic = GetBitmapFromMetaFile( aMtf, CalcSize( rSettings.mnWidth, rSettings.mnHeight, aBoundSize, aOutSize ) );
}
else
{
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index 415ddf95eeb9..839094c6d556 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -1461,7 +1461,8 @@ bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxIte
Reference<graphic::XGraphic> xGraphic;
auto pSdrGraphicObject = static_cast<SdrGrafObj*>(GetSdrObject());
- if (pSdrGraphicObject->GetGraphicObject().GetType() != GraphicType::NONE)
+ if (pSdrGraphicObject
+ && pSdrGraphicObject->GetGraphicObject().GetType() != GraphicType::NONE)
xGraphic = pSdrGraphicObject->GetGraphic().GetXGraphic();
rValue <<= xGraphic;
break;
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 98a104c49fc8..ee3e58dd0190 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -1286,10 +1286,6 @@ void SAL_CALL SvxShape::dispose()
if ( pObject->IsInserted() && pObject->getSdrPageFromSdrObject() )
{
- OSL_ENSURE( HasSdrObjectOwnership(), "SvxShape::dispose: is the below code correct?" );
- // normally, we are allowed to free the SdrObject only if we have its ownership.
- // Why isn't this checked here?
-
SdrPage* pPage = pObject->getSdrPageFromSdrObject();
// delete the SdrObject from the page
const size_t nCount = pPage->GetObjCount();
@@ -1298,7 +1294,10 @@ void SAL_CALL SvxShape::dispose()
if ( pPage->GetObj( nNum ) == pObject )
{
OSL_VERIFY( pPage->RemoveObject( nNum ) == pObject );
- bFreeSdrObject = true;
+ if (HasSdrObjectOwnership())
+ {
+ bFreeSdrObject = true;
+ }
break;
}
}
diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
index cfb01211c129..8ccf0e8e47b8 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -661,8 +661,9 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetTextForwarder()
{
// tdf#123470 if the text edit mode of the shape is active, then we
// cannot trust a previously cached TextForwarder state as the text may
- // be out of date, so force a refetch in that case.
- if (IsEditMode())
+ // be out of date, so force a refetch in that case, unless locked against
+ // changes
+ if (IsEditMode() && mpTextForwarder && !mbIsLocked)
{
assert(!mbForwarderIsEditMode); // because without a view there is no other option except !mbForwarderIsEditMode
bool bTextEditActive = false;
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index 522e6c076d19..03cf7a846a9b 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -400,7 +400,7 @@ bool SvXMLGraphicHelper::ImplGetStreamNames( const OUString& rURLStr,
if( !aURLStr.isEmpty() && aURLStr.indexOf('/')<0 ) // just one token?
{
- rPictureStorageName = XML_GRAPHICSTORAGE_NAME;
+ rPictureStorageName = OUString();
rPictureStreamName = aURLStr;
}
else
@@ -449,7 +449,10 @@ SvxGraphicHelperStream_Impl SvXMLGraphicHelper::ImplGetGraphicStream( const OUSt
const OUString& rPictureStreamName )
{
SvxGraphicHelperStream_Impl aRet;
- aRet.xStorage = ImplGetGraphicStorage( rPictureStorageName );
+ if (!rPictureStorageName.isEmpty())
+ aRet.xStorage = ImplGetGraphicStorage(rPictureStorageName);
+ else
+ aRet.xStorage = mxRootStorage;
sal_Int32 nMode = embed::ElementModes::READ;
if (SvXMLGraphicHelperMode::Write == meCreateMode)
diff --git a/svx/source/xml/xmlxtimp.cxx b/svx/source/xml/xmlxtimp.cxx
index 9bf7b6996b43..f1a4a0989c84 100644
--- a/svx/source/xml/xmlxtimp.cxx
+++ b/svx/source/xml/xmlxtimp.cxx
@@ -114,7 +114,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler >
if( aIter.first == XML_ELEMENT(XLINK, XML_HREF) &&
SvxXMLTableImportContextEnum::Bitmap == meContext )
{
- OString rValue = aIter.second;
+ OString& rValue = aIter.second;
if( !rValue.isEmpty() && '#' == rValue[0] )
rValue = rValue.copy( 1 );
}