summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-01-30 14:44:01 +0900
committerTomaž Vajngerl <quikee@gmail.com>2023-01-31 05:47:27 +0000
commit743dd1d3c1142c1c99b0844cc26dd0be91a1de40 (patch)
tree96140d26268c3be0cb16e2b805558bd2ad8a9e29 /svx
parent326dec315c29028ad1c163020d518e1236f37b6b (diff)
SdrModel: we never set scale fraction to anything else than 1/1
This removes the scale fraction on SdrModel - SetScaleFraction and the m_aObjUnit instance variable, as it is never set to anything else than 1/1 (and don't see it usefult to set it to anything else than this). Change-Id: I990d20f110b3be00e6770b68e39df212f9c576be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146348 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/customshapes/EnhancedCustomShape3d.cxx2
-rw-r--r--svx/source/dialog/graphctl.cxx3
-rw-r--r--svx/source/svdraw/svdmodel.cxx31
-rw-r--r--svx/source/svdraw/svdograf.cxx8
-rw-r--r--svx/source/svdraw/svdotext.cxx4
-rw-r--r--svx/source/svdraw/svdxcgv.cxx14
-rw-r--r--svx/source/unodraw/UnoGraphicExporter.cxx17
7 files changed, 24 insertions, 55 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx
index baaf37a4162c..9a0ef6bebf92 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -238,7 +238,7 @@ rtl::Reference<SdrObject> EnhancedCustomShape3d::Create3DObject(
rtl::Reference<SdrObject> pRet;
const SdrCustomShapeGeometryItem& rGeometryItem(rSdrObjCustomShape.GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY));
double fMap(1.0), *pMap = nullptr;
- Fraction aFraction( rSdrObjCustomShape.getSdrModelFromSdrObject().GetScaleFraction() );
+ Fraction aFraction(1, 1);
if ( aFraction.GetNumerator() != 1 || aFraction.GetDenominator() != 1 )
{
diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx
index 136eae27b52c..12416b6beaa6 100644
--- a/svx/source/dialog/graphctl.cxx
+++ b/svx/source/dialog/graphctl.cxx
@@ -122,8 +122,7 @@ void GraphCtrl::InitSdrModel()
// Creating a Model
pModel.reset(new SdrModel(nullptr, nullptr, true));
pModel->GetItemPool().FreezeIdRanges();
- pModel->SetScaleUnit( aMap100.GetMapUnit() );
- pModel->SetScaleFraction( Fraction( 1, 1 ) );
+ pModel->SetScaleUnit(aMap100.GetMapUnit());
pModel->SetDefaultFontHeight( 500 );
pPage = new SdrPage( *pModel );
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 28ec1e556f23..73d99b29d5ad 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -96,8 +96,7 @@ struct SdrModelImpl
SdrModel::SdrModel(SfxItemPool* pPool, comphelper::IEmbeddedHelper* pEmbeddedHelper, bool bDisablePropertyFiles)
- : m_aObjUnit(SdrEngineDefaults::GetMapFraction())
- , m_eObjUnit(SdrEngineDefaults::GetMapUnit())
+ : m_eObjUnit(SdrEngineDefaults::GetMapUnit())
, m_eUIUnit(FieldUnit::MM)
, m_aUIScale(Fraction(1,1))
, m_nUIUnitDecimalMark(0)
@@ -582,7 +581,7 @@ void SdrModel::ClearModel(bool bCalledFromDestructor)
SdrModel* SdrModel::AllocModel() const
{
SdrModel* pModel=new SdrModel();
- pModel->SetScaleUnit(m_eObjUnit,m_aObjUnit);
+ pModel->SetScaleUnit(m_eObjUnit);
return pModel;
}
@@ -683,7 +682,7 @@ void SdrModel::ImpSetOutlinerDefaults( SdrOutliner* pOutliner, bool bInit )
if ( !GetRefDevice() )
{
- MapMode aMapMode(m_eObjUnit, Point(0,0), m_aObjUnit, m_aObjUnit);
+ MapMode aMapMode(m_eObjUnit, Point(0,0), Fraction(1,1), Fraction(1,1));
pOutliner->SetRefMapMode(aMapMode);
}
}
@@ -871,19 +870,6 @@ void SdrModel::ImpSetUIUnit()
m_aUIUnitStr = GetUnitString(m_eUIUnit);
}
-void SdrModel::SetScaleUnit(MapUnit eMap, const Fraction& rFrac)
-{
- if (m_eObjUnit!=eMap || m_aObjUnit!=rFrac) {
- m_eObjUnit=eMap;
- m_aObjUnit=rFrac;
- m_pItemPool->SetDefaultMetric(m_eObjUnit);
- ImpSetUIUnit();
- ImpSetOutlinerDefaults( m_pDrawOutliner.get() );
- ImpSetOutlinerDefaults( m_pHitTestOutliner.get() );
- ImpReformatAllTextObjects();
- }
-}
-
void SdrModel::SetScaleUnit(MapUnit eMap)
{
if (m_eObjUnit!=eMap) {
@@ -896,17 +882,6 @@ void SdrModel::SetScaleUnit(MapUnit eMap)
}
}
-void SdrModel::SetScaleFraction(const Fraction& rFrac)
-{
- if (m_aObjUnit!=rFrac) {
- m_aObjUnit=rFrac;
- ImpSetUIUnit();
- ImpSetOutlinerDefaults( m_pDrawOutliner.get() );
- ImpSetOutlinerDefaults( m_pHitTestOutliner.get() );
- ImpReformatAllTextObjects();
- }
-}
-
void SdrModel::SetUIUnit(FieldUnit eUnit)
{
if (m_eUIUnit!=eUnit) {
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 1c1be8a7a69a..9ac5536c5716 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -390,8 +390,8 @@ Graphic SdrGrafObj::GetTransformedGraphic( SdrGrafObjTransformsAttrs nTransformF
MapMode aDestMap(
getSdrModelFromSdrObject().GetScaleUnit(),
Point(),
- getSdrModelFromSdrObject().GetScaleFraction(),
- getSdrModelFromSdrObject().GetScaleFraction());
+ Fraction(1,1),
+ Fraction(1,1));
const Size aDestSize( GetLogicRect().GetSize() );
GraphicAttr aActAttr = GetGraphicAttr(nTransformFlags);
@@ -872,8 +872,8 @@ GDIMetaFile SdrGrafObj::getMetafileFromEmbeddedVectorGraphicData() const
const MapMode aMap(
getSdrModelFromSdrObject().GetScaleUnit(),
Point(),
- getSdrModelFromSdrObject().GetScaleFraction(),
- getSdrModelFromSdrObject().GetScaleFraction());
+ Fraction(1,1),
+ Fraction(1,1));
pOut->EnableOutput(false);
pOut->SetMapMode(aMap);
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 6e47273fe175..ad27f101c6cb 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1327,8 +1327,8 @@ void SdrTextObj::UpdateOutlinerFormatting( SdrOutliner& rOutl, tools::Rectangle&
const MapMode aMapMode(
getSdrModelFromSdrObject().GetScaleUnit(),
Point(0,0),
- getSdrModelFromSdrObject().GetScaleFraction(),
- getSdrModelFromSdrObject().GetScaleFraction());
+ Fraction(1,1),
+ Fraction(1,1));
rOutl.SetRefMapMode(aMapMode);
ImpSetupDrawOutlinerForPaint(
diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx
index f579a50911e4..3ae384d344d8 100644
--- a/svx/source/svdraw/svdxcgv.cxx
+++ b/svx/source/svdraw/svdxcgv.cxx
@@ -162,8 +162,8 @@ bool SdrExchangeView::Paste(const OUString& rStr, const Point& rPos, SdrObjList*
pObj->FitFrameToTextSize();
Size aSiz(pObj->GetLogicRect().GetSize());
- MapUnit eMap=mpModel->GetScaleUnit();
- Fraction aMap=mpModel->GetScaleFraction();
+ MapUnit eMap = mpModel->GetScaleUnit();
+ Fraction aMap(1,1);
ImpPasteObject(pObj.get(),*pLst,aPos,aSiz,MapMode(eMap,Point(0,0),aMap,aMap),nOptions);
return true;
}
@@ -203,7 +203,7 @@ bool SdrExchangeView::Paste(SvStream& rInput, EETextFormat eFormat, const Point&
pObj->FitFrameToTextSize();
Size aSiz(pObj->GetLogicRect().GetSize());
MapUnit eMap=mpModel->GetScaleUnit();
- Fraction aMap=mpModel->GetScaleFraction();
+ Fraction aMap(1,1);
ImpPasteObject(pObj.get(),*pLst,aPos,aSiz,MapMode(eMap,Point(0,0),aMap,aMap),nOptions);
// b4967543
@@ -401,7 +401,7 @@ void SdrExchangeView::ImpPasteObject(SdrObject* pObj, SdrObjList& rLst, const Po
MapUnit eSrcMU=rMap.GetMapUnit();
MapUnit eDstMU=mpModel->GetScaleUnit();
FrPair aMapFact(GetMapFactor(eSrcMU,eDstMU));
- Fraction aDstFr(mpModel->GetScaleFraction());
+ Fraction aDstFr(1,1);
nSizX *= double(aMapFact.X() * rMap.GetScaleX() * aDstFr);
nSizX *= aDstFr.GetDenominator();
nSizY *= double(aMapFact.Y() * rMap.GetScaleY());
@@ -530,7 +530,7 @@ GDIMetaFile SdrExchangeView::GetMarkedObjMetaFile(bool bNoVDevIfOneMtfMarked) co
{
tools::Rectangle aBound( GetMarkedObjBoundRect() );
Size aBoundSize( aBound.GetWidth(), aBound.GetHeight() );
- MapMode aMap( mpModel->GetScaleUnit(), Point(), mpModel->GetScaleFraction(), mpModel->GetScaleFraction() );
+ MapMode aMap(mpModel->GetScaleUnit(), Point(), Fraction(1,1), Fraction(1,1));
if( bNoVDevIfOneMtfMarked )
{
@@ -650,8 +650,8 @@ Graphic SdrExchangeView::GetObjGraphic(const SdrObject& rSdrObject)
const tools::Rectangle aBoundRect(rSdrObject.GetCurrentBoundRect());
const MapMode aMap(rSdrObject.getSdrModelFromSdrObject().GetScaleUnit(),
Point(),
- rSdrObject.getSdrModelFromSdrObject().GetScaleFraction(),
- rSdrObject.getSdrModelFromSdrObject().GetScaleFraction());
+ Fraction(1,1),
+ Fraction(1,1));
pOut->EnableOutput(false);
pOut->SetMapMode(aMap);
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index 66af82d6baac..6698dd0e34a8 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -112,24 +112,19 @@ namespace {
TriState meAntiAliasing = TRISTATE_INDET;
- explicit ExportSettings(const SdrModel* pSdrModel);
+ explicit ExportSettings();
};
- ExportSettings::ExportSettings(const SdrModel* pSdrModel)
+ ExportSettings::ExportSettings()
: mnWidth( 0 )
,mnHeight( 0 )
,mbExportOnlyBackground( false )
,mbScrollText( false )
,mbUseHighContrast( false )
,mbTranslucent( false )
- ,maScaleX( 1, 1 )
- ,maScaleY( 1, 1 )
+ ,maScaleX(1, 1)
+ ,maScaleY(1, 1)
{
- if (pSdrModel)
- {
- maScaleX = pSdrModel->GetScaleFraction();
- maScaleY = pSdrModel->GetScaleFraction();
- }
}
/** implements a component to export shapes or pages to external graphic formats.
@@ -1012,7 +1007,7 @@ sal_Bool SAL_CALL GraphicExporter::filter( const Sequence< PropertyValue >& aDes
GraphicFilter &rFilter = GraphicFilter::GetGraphicFilter();
// get the arguments from the descriptor
- ExportSettings aSettings(mpDoc);
+ ExportSettings aSettings;
ParseSettings(aDescriptor, aSettings);
const sal_uInt16 nFilter = !aSettings.maMediaType.isEmpty()
@@ -1300,7 +1295,7 @@ Graphic SvxGetGraphicForShape( SdrObject& rShape )
rtl::Reference< GraphicExporter > xExporter( new GraphicExporter() );
Reference< XComponent > xComp( rShape.getUnoShape(), UNO_QUERY_THROW );
xExporter->setSourceDocument( xComp );
- ExportSettings aSettings(&rShape.getSdrModelFromSdrObject());
+ ExportSettings aSettings;
xExporter->GetGraphic( aSettings, aGraphic, true/*bVector*/ );
}
catch( Exception& )