diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-10-30 15:52:31 +0100 |
---|---|---|
committer | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-11-07 10:45:14 +0100 |
commit | 5e52aa124b444a34edbef823a91c63ccd58dc17c (patch) | |
tree | 6339deb45f262dc7175f67398d294f64d9843d62 | |
parent | ed69a99eff3723f63aaa5f701bb458609399d0bc (diff) |
Make GetTwipSize() call SwapIn() by itself in case of invalid size
Change-Id: I5bc6cf097e61d65007dde531af4a213b19e8ca5b
-rw-r--r-- | sw/source/core/graphic/ndgrf.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unoframe.cxx | 17 | ||||
-rw-r--r-- | sw/source/filter/inc/msfilter.hxx | 21 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/writerhelper.cxx | 22 |
5 files changed, 9 insertions, 59 deletions
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index ecbc5a05d7f0..6a3e587fa522 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -459,6 +459,10 @@ SwGrfNode * SwNodes::MakeGrfNode( const SwNodeIndex & rWhere, Size SwGrfNode::GetTwipSize() const { + if( !nGrfSize.Width() && !nGrfSize.Height() ) + { + const_cast<SwGrfNode*>(this)->SwapIn(true); + } return nGrfSize; } diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index c8067904eddb..db5cb5b39392 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -2130,22 +2130,7 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) if(pIdx) { SwNodeIndex aIdx(*pIdx, 1); - // --> OD #i85105# - Size aActSize; - { - SwGrfNode* pGrfNode = dynamic_cast<SwGrfNode*>(aIdx.GetNode().GetNoTxtNode()); - if ( pGrfNode ) - { - aActSize = pGrfNode->GetTwipSize(); - if ( aActSize.Width() == 0 && aActSize.Height() == 0 && - pGrfNode->IsLinkedFile() ) - { - pGrfNode->SwapIn( true ); - aActSize = pGrfNode->GetTwipSize(); - } - } - } - // <-- + Size aActSize = aIdx.GetNode().GetNoTxtNode()->GetTwipSize(); awt::Size aTmp; aTmp.Width = convertTwipToMm100(aActSize.Width()); aTmp.Height = convertTwipToMm100(aActSize.Height()); diff --git a/sw/source/filter/inc/msfilter.hxx b/sw/source/filter/inc/msfilter.hxx index 8ff19a023317..4b9e916b415b 100644 --- a/sw/source/filter/inc/msfilter.hxx +++ b/sw/source/filter/inc/msfilter.hxx @@ -415,27 +415,6 @@ namespace sw virtual void Write(Writer &rWrt) = 0; }; - /** Given a SwNoTxtNode (ole/graphic) get original size - - Get the uncropped and unscaled size of the underlying graphic or - ole object associated with a given SwNoTxtNode. - - This function will swap in the graphic if it is swapped out from - the graphic or object cache, but will swap it out if that was the - case, i.e. rNd is logically unchanged before and after - GetSwappedInSize, though not physically const - - @param rNd - the SwNoTxtNode whose objects original size we want - - @return - the uncropped unscaled size of the SwNoTxtNode - - @author - <a href="mailto:cmc@openoffice.org">Caolán McNamara</a> - */ - Size GetSwappedInSize(const SwNoTxtNode& rNd); - struct CharRunEntry { sal_Int32 mnEndPos; diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index b989b2579d8e..cee683b74844 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -3560,7 +3560,7 @@ static OString ExportPICT(const SwFlyFrmFmt* pFlyFrmFmt, const Size& rOrig, cons void RtfAttributeOutput::FlyFrameOLEReplacement(const SwFlyFrmFmt* pFlyFrmFmt, SwOLENode& rOLENode, const Size& rSize) { m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPPICT); - Size aSize(sw::util::GetSwappedInSize(rOLENode)); + Size aSize(rOLENode.GetTwipSize()); Size aRendered(aSize); aRendered.Width() = rSize.Width(); aRendered.Height() = rSize.Height(); @@ -3697,7 +3697,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrmFmt* pFlyFrmFmt, const Sw const SwCropGrf& rCr = (const SwCropGrf&)pGrfNode->GetAttr(RES_GRFATR_CROPGRF); //Get original size in twips - Size aSize(sw::util::GetSwappedInSize(*pGrfNode)); + Size aSize(pGrfNode->GetTwipSize()); Size aRendered(aSize); const SwFmtFrmSize& rS = pFlyFrmFmt->GetFrmSize(); diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx index ad68371f945b..3d52fecd4e87 100644 --- a/sw/source/filter/ww8/writerhelper.cxx +++ b/sw/source/filter/ww8/writerhelper.cxx @@ -205,7 +205,6 @@ namespace sw { SwNodeIndex aIdx(*pIdx, 1); const SwNode &rNd = aIdx.GetNode(); - using sw::util::GetSwappedInSize; // #i43447# - determine layout size { SwRect aLayRect( rFmt.FindLayoutRect() ); @@ -222,11 +221,11 @@ namespace sw { case ND_GRFNODE: meWriterType = eGraphic; - maSize = GetSwappedInSize(*rNd.GetNoTxtNode()); + maSize = rNd.GetNoTxtNode()->GetTwipSize(); break; case ND_OLENODE: meWriterType = eOle; - maSize = GetSwappedInSize(*rNd.GetNoTxtNode()); + maSize = rNd.GetNoTxtNode()->GetTwipSize(); break; default: meWriterType = eTxtBox; @@ -692,23 +691,6 @@ namespace sw return aPoly; } - Size GetSwappedInSize(const SwNoTxtNode& rNd) - { - Size aGrTwipSz(rNd.GetTwipSize()); - if ((!aGrTwipSz.Width() || !aGrTwipSz.Height())) - { - SwGrfNode *pGrfNode = const_cast<SwGrfNode*>(rNd.GetGrfNode()); - if (pGrfNode && (GRAPHIC_NONE != pGrfNode->GetGrf().GetType())) - { - pGrfNode->SwapIn(); - aGrTwipSz = pGrfNode->GetTwipSize(); - } - } - - OSL_ENSURE(aGrTwipSz.Width() && aGrTwipSz.Height(), "0 x 0 graphic ?"); - return aGrTwipSz; - } - void RedlineStack::open(const SwPosition& rPos, const SfxPoolItem& rAttr) { OSL_ENSURE(rAttr.Which() == RES_FLTR_REDLINE, "not a redline"); |