22 #include <string_view>
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);
85 mbInBaseLinkSwapIn(true),
87 mbLinkedInputStreamReady(
false ),
88 mbIsStreamReadOnly(
false )
101 std::u16string_view rGrfName,
102 const OUString& rFltName,
106 mbInBaseLinkSwapIn(true),
108 mbLinkedInputStreamReady(
false ),
109 mbIsStreamReadOnly(
false )
131 const OUString& rGrfName,
const OUString& rFltName,
135 bool bReadGrf =
false;
136 bool bSetTwipSize =
true;
139 OSL_ENSURE( pGraphic || !rGrfName.isEmpty(),
140 "GraphicNode without a name, Graphic or GraphicObject" );
148 if (sURLLink.isEmpty() && !rGrfName.isEmpty())
162 OSL_ENSURE( !
mbInSwapIn,
"ReRead: I am still in SwapIn" );
164 if( !sURLLink.isEmpty() )
167 OUString sCmd( sURLLink );
168 if( !rFltName.isEmpty() )
171 if( rFltName ==
"DDE" )
220 bSetTwipSize =
false;
223 else if( pGraphic && sURLLink.isEmpty() )
267 if( bReadGrf && bNewGrf )
286 OSL_ENSURE( !
mbInSwapIn,
"DTOR: I am still in SwapIn" );
324 if (rVectorGraphicDataPtr)
328 if(!aSequence.empty())
346 if(!aTitle.isEmpty())
350 else if (!aName.isEmpty())
391 if (rVectorGraphicDataPtr)
406 const OUString& rGrfName,
407 const OUString& rFltName,
412 OSL_ENSURE( pGrfColl,
"MakeGrfNode: Formatpointer is 0." );
417 rFltName, pGrfColl, pAutoAttr );
420 rFltName, pGraphic, pGrfColl, pAutoAttr );
428 OSL_ENSURE( pGrfColl,
"MakeGrfNode: Formatpointer is 0." );
429 return new SwGrfNode( rWhere, rGrfObj, pGrfColl,
nullptr );
461 if( pLink->
SwapIn( bWaitForData ) )
502 mxLink.
get(),
nullptr, pFileNm,
nullptr, pFilterNm );
530 OSL_ENSURE( !
mbInSwapIn,
"SavePersistentData: I am still in SwapIn" );
569 mxLink =
new SwBaseLink( SfxLinkUpdateMode::ONCALL, SotClipboardFormatId::GDIMETAFILE,
this );
576 if( rFltName ==
"DDE" )
581 const std::u16string_view sItem{ rGrfName.substr( nTmp ) };
586 const bool bSync = rFltName ==
"SYNCHRON";
592 (!bSync && !rFltName.isEmpty() ? &rFltName :
nullptr) );
602 const bool bHasOriginalData(aLocalGraphic.IsGfxLink());
607 pLink->
SwapIn(
true,
true );
613 aLocalGraphic.setOriginURL(
"");
657 if ( !
aURL.GetMap() )
674 OSL_ENSURE( nWidth>0,
"Do any 0 twip wide graphics exist!?" );
689 OSL_ENSURE( nHeight>0,
"Do any 0 twip high graphics exist!?" );
700 aURL.GetMap()->Scale( aScaleX, aScaleY );
712 OUString sFile, sFilter;
717 OUString sTmp1, sTmp2;
747 nMirror = BmpMirrorFlags::Horizontal;
750 nMirror = BmpMirrorFlags::NONE;
753 nMirror = BmpMirrorFlags::Horizontal|BmpMirrorFlags::Vertical;
756 nMirror = BmpMirrorFlags::Vertical;
764 nMirror = BmpMirrorFlags::Horizontal|BmpMirrorFlags::Vertical;
767 nMirror = BmpMirrorFlags::Horizontal;
770 nMirror = BmpMirrorFlags::Vertical;
790 nCropBottom = rCrop.
GetTop();
817 std::min( nTrans, sal_uInt16(100) ) * 2.55 )) );
832 OSL_FAIL(
"<SwGrfNode::TriggerAsyncLoad()> - Method is misused. Method call is only valid for graphic nodes, which refer a linked graphic file" );
845 if (sh !=
nullptr && sh->
HasName())
854 const css::uno::Reference<css::io::XInputStream>& xInputStream,
855 const bool bIsStreamReadOnly )
859 if ( xInputStream.is() )
896 if ( !sGrfNm.startsWith(
"vnd.sun.star.pkg:" ) )
BitmapEx GetBitmapEx(BitmapEx const &rBitmapEx, DrawModeFlags nDrawMode)
SwGrfNode(const SwNodeIndex &rWhere, const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic, SwGrfFormatColl *pGrfColl, SwAttrSet const *pAutoAttr)
Ctor for reading (SW/G) without graphics.
Graphic GetGraphic() const
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
void SetDescription(const OUString &rDescription)
const OUString & getTitle() const
void SetGamma(double fGamma)
Base class of the Writer layout elements.
void InsertLink(std::u16string_view rGrfName, const OUString &rFltName)
tools::Long GetWidth() const
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
std::shared_ptr< SwAsyncRetrieveInputStreamThreadConsumer > mpThreadConsumer
SVL_DLLPUBLIC bool IsDocument(const OUString &rURL)
const SwGammaGrf & GetGammaGrf(bool=true) const
void ApplyInputStream(const css::uno::Reference< css::io::XInputStream > &xInputStream, const bool bIsStreamReadOnly)
const double & GetValue() const
sal_Int32 GetLeft() const
bool HasEmbeddedStreamName() const
const tools::SvRef< sfx2::SvBaseLink > & GetLink() const
BmpMirrorFlags GetMirrorFlags() const
void clearStreamToLoadFrom()
bool HasAutomaticContour() const
virtual const SwRootFrame * GetCurrentLayout() const =0
tools::SvRef< sfx2::SvBaseLink > mxLink
If graphics only as link then pointer is set.
void SetContentType(SotClipboardFormatId nType)
void ScaleImageMap()
Scale an image-map: the image-map becomes zoomed in / out by factor between graphic-size and border-s...
void InsertFileLink(sfx2::SvBaseLink &, SvBaseLinkObjectType nFileType, std::u16string_view rFileNm, const OUString *pFilterNm=nullptr, const OUString *pRange=nullptr)
const OUString & GetName() const
void SetInvert(bool bInvert)
void SetTitle(const OUString &rTitle)
const sal_Unicode cTokenSeparator
constexpr TypedWhichId< SwMsgPoolItem > RES_LINKED_GRAPHIC_STREAM_ARRIVED(189)
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
void setStreamToLoadFrom(const css::uno::Reference< css::io::XInputStream > &xInputStream, bool bIsReadOnly)
void SetMirrorFlags(BmpMirrorFlags nMirrFlags)
void setOriginURL(OUString const &rOriginURL)
bool IsLinkedFile() const
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
const SwChannelRGrf & GetChannelRGrf(bool=true) const
void SetLinkSourceName(const OUString &rName)
bool mbScaleImageMap
Scale image map in SetTwipSize.
const GraphicObject * GetReplacementGrfObj() const
bool HasWriterListeners() const
void SetDrawMode(GraphicDrawMode eDrawMode)
const OUString & getName() const
virtual ~SwGrfNode() override
const tools::PolyPolygon * HasContour() const
constexpr auto convertTwipToMm100(N n)
constexpr tools::Long Width() const
const SwChannelBGrf & GetChannelBGrf(bool=true) const
bool IsAsyncRetrieveInputStreamPossible() const
const SwTransparencyGrf & GetTransparencyGrf(bool=true) const
void TriggerAsyncRetrieveInputStream()
GraphicAttr & GetGraphicAttr(GraphicAttr &, const SwFrame *pFrame) const
Returns the with our graphic attributes filled Graphic-Attr-Structure.
static SwGrfNode * MakeGrfNode(const SwNodeIndex &rWhere, const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic, SwGrfFormatColl *pColl, SwAttrSet const *pAutoAttr=nullptr)
in ndgrf.cxx
bool GetFileFilterNms(OUString *pFileNm, OUString *pFilterNm) const
const SwCropGrf & GetCropGrf(bool=true) const
const IDocumentLinksAdministration & getIDocumentLinksAdministration() const
Provides access to the document links administration interface.
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
SwGrfFormatColl * GetGrfColl() const
const SwAttrSet * GetpSwAttrSet() const
sal_Int16 GetValue() const
bool mbLinkedInputStreamReady
void SetAlpha(sal_uInt8 cAlpha)
virtual SwContentNode * MakeCopy(SwDoc &, const SwNodeIndex &, bool bNewFrames) const override
in ndcopy.cxx
void SetGraphic(const Graphic &rGraphic)
isolated only way to set GraphicObject to allow more actions when doing so
GraphicType GetType() const
css::uno::Reference< css::io::XInputStream > mxInputStream
void Remove(SvBaseLink const *pLink)
void SetContrast(short nContrastPercent)
tools::Long FRound(double fVal)
SwPageFrame * FindPageFrame()
virtual bool SavePersistentData() override
Communicate to graphic that node is in Undo-range.
void SetRotation(Degree10 nRotate10)
void DelFrames(SwRootFrame const *pLayout)
Method deletes all views of document for the node.
void SetChannelG(short nChannelGPercent)
void TriggerGraphicArrived()
void process(const primitive2d::Primitive2DContainer &rSource)
Layout frame for SwNoTextNode, i.e. graphics and OLE nodes (including charts).
Marks a node in the document model.
OUString getOriginURL() const
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Document links administration interface.
const SwRotationGrf & GetRotationGrf(bool=true) const
const SwContrastGrf & GetContrastGrf(bool=true) const
OUString GetDescription() const
void SetChannelR(short nChannelRPercent)
tools::Long GetHeight() const
bool ReRead(const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic=nullptr, bool bModify=true)
Re-read in case graphic was not OK.
void SetTwipSize(const Size &rSz)
constexpr TypedWhichId< SwMsgPoolItem > RES_GRAPHIC_PIECE_ARRIVED(177)
const GraphicObject & GetGrfObj(bool bWait=false) const
bool IsScaleImageMap() const
GraphicType GetType() const
virtual Size GetTwipSize() const override
void SetChannelB(short nChannelBPercent)
Degree10 GetValue() const
SwGrfFormatColl * CopyGrfColl(const SwGrfFormatColl &rColl)
copy the graphic nodes
const IDocumentLayoutAccess & getIDocumentLayoutAccess() const
Provides access to the document layout interface.
void MakeLnkName(OUString &rName, const OUString *pType, std::u16string_view rFile, std::u16string_view rLink, const OUString *pFilter)
sal_Int32 GetBottom() const
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
const SwMirrorGrf & GetMirrorGrf(bool=true) const
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 SetScaleImageMap(bool b)
const Graphic & GetGraphic() const
constexpr tools::Long Height() const
OUString GetTitle() const
void SetGraphic(const Graphic &rGraphic)
void SetLuminance(short nLuminancePercent)
INetProtocol GetProtocol() const
const OUString & getDesc() const
SfxObjectShell * GetPersist() const
void UpdateLinkWithInputStream()
std::unique_ptr< GraphicObject > mpReplacementGraphic
void onGraphicChanged()
allow reaction on change of content of GraphicObject, so always call when GraphicObject content chang...
const SwChannelGGrf & GetChannelGGrf(bool=true) const
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
virtual void CallSwClientNotify(const SfxHint &rHint) const override
sal_uInt16 CalcLineSpace(SvxBoxItemLine nLine, bool bEvenIfNoLine=false) const
sal_Int32 GetRight() const
virtual sfx2::LinkManager & GetLinkManager()=0
const SwDrawModeGrf & GetDrawModeGrf(bool=true) const
bool SwapIn(bool bWaitForData=false)
Loading of graphic immediately before displaying.
const SwInvertGrf & GetInvertGrf(bool=true) const
bool IsTransparent() const
void SetSynchron(bool bFlag)
void SetCrop(tools::Long nLeft_100TH_MM, tools::Long nTop_100TH_MM, tools::Long nRight_100TH_MM, tools::Long nBottom_100TH_MM)
sal_uInt8 GetValue() const
LinkManager * GetLinkManager()
const SwLuminanceGrf & GetLuminanceGrf(bool=true) const
const std::shared_ptr< VectorGraphicData > & getVectorGraphicData() const
virtual bool RestorePersistentData() override
Dummies for loading/saving of persistent data when working with graphics and OLE objects.
SvBaseLinkObjectType GetObjType() const
bool IsTransparent() const
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
const Graphic & GetGrf(bool bWait=false) const
void SetContour(const tools::PolyPolygon *pPoly, bool bAutomatic=false)
bool mbFrameInPaint
To avoid Start-/EndActions in Paint via SwapIn.
bool SwapIn(bool bWaitForData=false, bool bNativFormat=false)
bool m_bDetectedRangeSegmentation false
Size GetGraphicSizeTwip(const Graphic &rGraphic, vcl::RenderContext *pOutDev)
virtual bool IsVisibleLinks() const =0
Insert links in-/visibly into LinkManager (linked ranges).
void SetVisible(bool bFlag)
SfxMedium * GetMedium() const