50#include <rtl/ustring.hxx>
53#include <osl/diagnose.h>
62 const OUString& rGrfName,
63 const OUString& rFltName,
68 mbInBaseLinkSwapIn(true),
70 mbLinkedInputStreamReady( false ),
71 mbIsStreamReadOnly( false )
76 ReRead(rGrfName, rFltName, pGraphic,
false);
86 std::u16string_view rGrfName,
87 const OUString& rFltName,
91 mbInBaseLinkSwapIn(true),
93 mbLinkedInputStreamReady( false ),
94 mbIsStreamReadOnly( false )
116 const OUString& rGrfName,
const OUString& rFltName,
120 bool bReadGrf =
false;
121 bool bSetTwipSize =
true;
124 OSL_ENSURE( pGraphic || !rGrfName.isEmpty(),
125 "GraphicNode without a name, Graphic or GraphicObject" );
133 if (sURLLink.isEmpty() && !rGrfName.isEmpty())
147 OSL_ENSURE( !
mbInSwapIn,
"ReRead: I am still in SwapIn" );
149 if( !sURLLink.isEmpty() )
152 OUString sCmd( sURLLink );
153 if( !rFltName.isEmpty() )
156 if( rFltName ==
"DDE" )
164 if( nNewType !=
mxLink->GetObjType() )
171 mxLink->SetLinkSourceName( sCmd );
205 bSetTwipSize =
false;
208 else if( pGraphic && sURLLink.isEmpty() )
252 if( bReadGrf && bNewGrf )
271 OSL_ENSURE( !
mbInSwapIn,
"DTOR: I am still in SwapIn" );
288 if( HasWriterListeners() )
309 if (rVectorGraphicDataPtr)
313 if(!aSequence.empty())
331 if(!aTitle.isEmpty())
335 else if (!
aName.isEmpty())
376 if (rVectorGraphicDataPtr)
391 const OUString& rGrfName,
392 const OUString& rFltName,
397 OSL_ENSURE( pGrfColl,
"MakeGrfNode: Formatpointer is 0." );
402 rFltName, pGrfColl, pAutoAttr );
405 rFltName, pGraphic, pGrfColl, pAutoAttr );
438 if(
pLink->SwapIn( bWaitForData ) )
478 mxLink.
get(),
nullptr, pFileNm,
nullptr, pFilterNm );
506 OSL_ENSURE( !
mbInSwapIn,
"SavePersistentData: I am still in SwapIn" );
545 mxLink =
new SwBaseLink( SfxLinkUpdateMode::ONCALL, SotClipboardFormatId::GDIMETAFILE,
this );
552 if( rFltName ==
"DDE" )
557 const std::u16string_view sItem{ rGrfName.substr( nTmp ) };
562 const bool bSync = rFltName ==
"SYNCHRON";
563 mxLink->SetSynchron( bSync );
564 mxLink->SetContentType( SotClipboardFormatId::SVXB );
568 (!bSync && !rFltName.isEmpty() ? &rFltName :
nullptr) );
578 const bool bHasOriginalData(aLocalGraphic.
IsGfxLink());
583 pLink->SwapIn(
true,
true );
633 if ( !
aURL.GetMap() )
650 OSL_ENSURE( nWidth>0,
"Do any 0 twip wide graphics exist!?" );
665 OSL_ENSURE( nHeight>0,
"Do any 0 twip high graphics exist!?" );
676 aURL.GetMap()->Scale( aScaleX, aScaleY );
688 OUString sFile, sFilter;
693 OUString sTmp1, sTmp2;
723 nMirror = BmpMirrorFlags::Horizontal;
726 nMirror = BmpMirrorFlags::NONE;
729 nMirror = BmpMirrorFlags::Horizontal|BmpMirrorFlags::Vertical;
732 nMirror = BmpMirrorFlags::Vertical;
740 nMirror = BmpMirrorFlags::Horizontal|BmpMirrorFlags::Vertical;
743 nMirror = BmpMirrorFlags::Horizontal;
746 nMirror = BmpMirrorFlags::Vertical;
766 nCropBottom = rCrop.
GetTop();
791 const sal_uInt16 nTrans =
rSet.GetTransparencyGrf().GetValue();
793 std::min( nTrans, sal_uInt16(100) ) * 2.55 )) );
808 OSL_FAIL(
"<SwGrfNode::TriggerAsyncLoad()> - Method is misused. Method call is only valid for graphic nodes, which refer a linked graphic file" );
821 if (sh !=
nullptr && sh->
HasName())
830 const css::uno::Reference<css::io::XInputStream>& xInputStream,
831 const bool bIsStreamReadOnly )
835 if ( xInputStream.is() )
857 GetLink()->clearStreamToLoadFrom();
871 if ( !sGrfNm.startsWith(
"vnd.sun.star.pkg:" ) )
constexpr auto convertTwipToMm100(N n)
sal_uInt8 GetValue() const
void SetGamma(double fGamma)
void SetRotation(Degree10 nRotate10)
void SetChannelR(short nChannelRPercent)
void SetMirrorFlags(BmpMirrorFlags nMirrFlags)
void SetContrast(short nContrastPercent)
BmpMirrorFlags GetMirrorFlags() const
void SetChannelB(short nChannelBPercent)
void SetCrop(tools::Long nLeft_100TH_MM, tools::Long nTop_100TH_MM, tools::Long nRight_100TH_MM, tools::Long nBottom_100TH_MM)
void SetInvert(bool bInvert)
void SetDrawMode(GraphicDrawMode eDrawMode)
void SetLuminance(short nLuminancePercent)
void SetAlpha(sal_uInt8 cAlpha)
void SetChannelG(short nChannelGPercent)
void SetGraphic(const Graphic &rGraphic)
const Graphic & GetGraphic() const
GraphicType GetType() const
bool IsTransparent() const
OUString getOriginURL() const
GraphicType GetType() const
BitmapEx GetBitmapEx(const GraphicConversionParameters &rParameters=GraphicConversionParameters()) const
const std::shared_ptr< VectorGraphicData > & getVectorGraphicData() const
void setOriginURL(OUString const &rOriginURL)
Document links administration interface.
virtual sfx2::LinkManager & GetLinkManager()=0
virtual bool IsVisibleLinks() const =0
Insert links in-/visibly into LinkManager (linked ranges).
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
INetProtocol GetProtocol() const
const OUString & GetName() const
SfxMedium * GetMedium() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
sal_Int16 CalcLineSpace(SvxBoxItemLine nLine, bool bEvenIfNoLine=false, bool bAllowNegative=false) const
sal_Int32 GetRight() const
sal_Int32 GetLeft() const
sal_Int32 GetBottom() const
tools::Long GetHeight() const
tools::Long GetWidth() const
const SwTransparencyGrf & GetTransparencyGrf(bool=true) const
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
void DelFrames(SwRootFrame const *pLayout)
Method deletes all views of document for the node.
const SwAttrSet * GetpSwAttrSet() const
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
SwGrfFormatColl * CopyGrfColl(const SwGrfFormatColl &rColl)
copy the graphic nodes
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
SfxObjectShell * GetPersist() const
Base class of the Writer layout elements.
SwPageFrame * FindPageFrame()
void ScaleImageMap()
Scale an image-map: the image-map becomes zoomed in / out by factor between graphic-size and border-s...
void onGraphicChanged()
allow reaction on change of content of GraphicObject, so always call when GraphicObject content chang...
std::shared_ptr< SwAsyncRetrieveInputStreamThreadConsumer > mpThreadConsumer
virtual Size GetTwipSize() const override
bool IsLinkedFile() const
bool HasEmbeddedStreamName() const
void SetGraphic(const Graphic &rGraphic)
isolated only way to set GraphicObject to allow more actions when doing so
void SetTwipSize(const Size &rSz)
const tools::SvRef< sfx2::SvBaseLink > & GetLink() const
void SetScaleImageMap(bool b)
bool mbLinkedInputStreamReady
GraphicAttr & GetGraphicAttr(GraphicAttr &, const SwFrame *pFrame) const
Returns the with our graphic attributes filled Graphic-Attr-Structure.
void UpdateLinkWithInputStream()
bool IsScaleImageMap() const
const GraphicObject & GetGrfObj(bool bWait=false) const
const Graphic & GetGrf(bool bWait=false) const
virtual SwContentNode * MakeCopy(SwDoc &, SwNode &, bool bNewFrames) const override
in ndcopy.cxx
virtual bool SavePersistentData() override
Communicate to graphic that node is in Undo-range.
bool GetFileFilterNms(OUString *pFileNm, OUString *pFilterNm) const
void InsertLink(std::u16string_view rGrfName, const OUString &rFltName)
const GraphicObject * GetReplacementGrfObj() const
void ApplyInputStream(const css::uno::Reference< css::io::XInputStream > &xInputStream, const bool bIsStreamReadOnly)
SwGrfNode(SwNode &rWhere, const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic, SwGrfFormatColl *pGrfColl, SwAttrSet const *pAutoAttr)
Ctor for reading (SW/G) without graphics.
css::uno::Reference< css::io::XInputStream > mxInputStream
bool mbScaleImageMap
Scale image map in SetTwipSize.
virtual ~SwGrfNode() override
void TriggerAsyncRetrieveInputStream()
bool SwapIn(bool bWaitForData=false)
Loading of graphic immediately before displaying.
void TriggerGraphicArrived()
bool ReRead(const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic=nullptr, bool bModify=true)
Re-read in case graphic was not OK.
std::unique_ptr< GraphicObject > mpReplacementGraphic
bool mbFrameInPaint
To avoid Start-/EndActions in Paint via SwapIn.
bool IsTransparent() const
virtual bool RestorePersistentData() override
Dummies for loading/saving of persistent data when working with graphics and OLE objects.
tools::SvRef< sfx2::SvBaseLink > mxLink
If graphics only as link then pointer is set.
bool IsAsyncRetrieveInputStreamPossible() const
Layout frame for SwNoTextNode, i.e. graphics and OLE nodes (including charts).
SwGrfFormatColl * GetGrfColl() const
void SetContour(const tools::PolyPolygon *pPoly, bool bAutomatic=false)
OUString GetDescription() const
bool HasAutomaticContour() const
OUString GetTitle() const
const tools::PolyPolygon * HasContour() const
void SetTitle(const OUString &rTitle)
void SetDescription(const OUString &rDescription)
Base class of the Writer document model elements.
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
SwNodes & GetNodes()
Node is in which nodes-array/doc?
const IDocumentLinksAdministration & getIDocumentLinksAdministration() const
Provides access to the document links administration interface.
const IDocumentLayoutAccess & getIDocumentLayoutAccess() const
Provides access to the document layout interface.
static SwGrfNode * MakeGrfNode(SwNode &rWhere, const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic, SwGrfFormatColl *pColl, SwAttrSet const *pAutoAttr=nullptr)
in ndgrf.cxx
Degree10 GetValue() const
const OUString & getDesc() const
const OUString & getTitle() const
const OUString & getName() const
void process(const primitive2d::Primitive2DContainer &rSource)
void InsertFileLink(sfx2::SvBaseLink &, SvBaseLinkObjectType nFileType, std::u16string_view rFileNm, const OUString *pFilterNm=nullptr, const OUString *pRange=nullptr)
static bool GetDisplayNames(const SvBaseLink *, OUString *pType, OUString *pFile=nullptr, OUString *pLink=nullptr, OUString *pFilter=nullptr)
void InsertDDELink(SvBaseLink *, const OUString &rServer, std::u16string_view rTopic, std::u16string_view rItem)
void Remove(SvBaseLink const *pLink)
tools::Long FRound(double fVal)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(99)
SVL_DLLPUBLIC bool IsDocument(const OUString &rURL)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
const sal_Unicode cTokenSeparator
void MakeLnkName(OUString &rName, const OUString *pType, std::u16string_view rFile, std::u16string_view rLink, const OUString *pFilter)
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Size GetGraphicSizeTwip(const Graphic &rGraphic, vcl::RenderContext *pOutDev)