41 #include <osl/diagnose.h>
42 #include <drawdoc.hxx>
60 #define ShellClass_SwGrfShell
63 #include <swslots.hxx>
82 pShell->GetDoc()->CreateUnoCursor(
83 *pShell->GetCurrentShellCursor().GetPoint()))
93 m_pShell->
ReRead(OUString(), OUString(), &rGraphic);
102 GetStaticInterface()->RegisterPopupMenu(
"graphic");
104 GetStaticInterface()->RegisterObjectBar(
SFX_OBJECTBAR_OBJECT, SfxVisibilityFlags::Invisible, ToolbarId::Grafik_Toolbox);
111 sal_uInt16 nSlot = rReq.
GetSlot();
114 case SID_OBJECT_ROTATE:
135 case SID_TWAIN_TRANSFER:
141 case SID_SAVE_GRAPHIC:
172 else if (nState ==
RET_NO)
175 if(
nullptr != pGraphic)
186 case SID_COMPRESS_GRAPHIC:
209 if (aDialog.run() ==
RET_OK)
221 rSh.
ReRead(OUString(), OUString(), const_cast<const Graphic*>(&aCompressedGraphic));
232 case SID_EXTERNAL_EDIT:
237 if(
nullptr != pGraphicObject)
245 case SID_CHANGE_PICTURE:
246 case SID_INSERT_GRAPHIC:
266 SID_DOCFRAME, SID_DOCFRAME,
267 SID_REFERER, SID_REFERER,
268 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
269 SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
271 SID_ATTR_TRANSFORM_ANGLE, SID_ATTR_TRANSFORM_ANGLE,
275 SID_COLOR_TABLE, SID_PATTERN_LIST,
276 SID_HTML_MODE, SID_HTML_MODE,
277 SID_ATTR_GRAF_KEEP_ZOOM, SID_ATTR_GRAF_KEEP_ZOOM,
278 SID_ATTR_GRAF_FRMSIZE, SID_ATTR_GRAF_GRAPHIC,
304 aSet.Put( aFrameSize );
315 aFrameSize.SetWidth( pRect->
Width() );
316 aFrameSize.SetHeight( pRect->
Height() );
318 aSet.Put( aFrameSize );
320 aSet.Put( aMgr.GetAttrSet() );
330 aSet.SetParent( aMgr.GetAttrSet().GetParent() );
347 aSzItm.SetSize( aSz );
348 aSzItm.SetWhich( SID_ATTR_GRAF_FRMSIZE_PERCENT );
355 if( !sGrfNm.isEmpty() )
360 SID_ATTR_GRAF_GRAPHIC ));
369 SID_ATTR_GRAF_GRAPHIC ) );
372 aSet.Put(
SfxBoolItem( FN_PARAM_GRF_CONNECT, !sGrfNm.isEmpty() ) );
388 if (sh !=
nullptr && sh->
HasName())
402 nCurrentRotation = rRotation.
GetValue();
404 aSet.Put(
SdrAngleItem(SID_ATTR_TRANSFORM_ANGLE, to<Degree100>(nCurrentRotation)));
413 pDlg->SetCurPageId(
"wrap");
415 if (pDlg->Execute() ==
RET_OK)
423 SID_ATTR_GRAF_FRMSIZE,
false ))
426 const Size& rSz = pSizeItem->GetSize();
430 pSizeItem = pSet->
GetItemIfSet( SID_ATTR_GRAF_FRMSIZE_PERCENT,
false );
433 const Size& rRelativeSize = pSizeItem->GetSize();
448 aShellSet.Put(*pSet);
449 aMgr.SetAttrSet(aShellSet);
453 aMgr.SetAttrSet(*pSet);
455 aMgr.UpdateFlyFrame();
457 bool bApplyUsrPref =
false;
459 FN_KEEP_ASPECT_RATIO ))
462 bApplyUsrPref =
true;
465 SID_ATTR_GRAF_KEEP_ZOOM ))
468 bApplyUsrPref =
true;
476 SID_ATTR_GRAF_GRAPHIC ))
478 if( !pGraphicBrushItem->GetGraphicLink().isEmpty() )
479 sGrfNm = pGraphicBrushItem->GetGraphicLink();
483 if( !pGraphicBrushItem->GetGraphicFilter().isEmpty() )
484 sFilterNm = pGraphicBrushItem->GetGraphicFilter();
488 if( !sGrfNm.isEmpty() )
491 SwWait aWait( *pDocSh,
true );
503 FN_SET_FRM_ALT_NAME ))
510 FN_UNO_DESCRIPTION ))
516 const Degree10 aNewRotation = to<Degree10>(pAngleItem->GetValue() % 36000_deg100);
519 aMgr.SetRotation(nCurrentRotation, aNewRotation, aUnrotatedSize);
523 aGrfSet.Put( *pSet );
524 if( aGrfSet.Count() )
543 case SID_OBJECT_CROP:
546 if (
nullptr != pGraphicObject && SdrDragMode::Crop != rSh.
GetDragMode()) {
553 OSL_ENSURE(
false,
"wrong dispatcher");
563 if (GraphicType::Bitmap == nGrfType ||
564 GraphicType::GdiMetafile == nGrfType)
569 sal_uInt16 nSlot = rReq.
GetSlot();
570 if( !pArgs || SfxItemState::SET != pArgs->
GetItemState( nSlot,
false, &pItem ))
575 case SID_FLIP_VERTICAL:
576 case SID_FLIP_HORIZONTAL:
581 if ( nSlot==SID_FLIP_HORIZONTAL )
605 aMirror.SetValue( nMirror );
607 aGrfSet.Put( aMirror );
611 case SID_ATTR_GRAF_LUMINANCE:
614 static_cast<const SfxInt16Item*>(pItem)->
GetValue() ));
617 case SID_ATTR_GRAF_CONTRAST:
620 static_cast<const SfxInt16Item*>(pItem)->
GetValue() ));
623 case SID_ATTR_GRAF_RED:
626 static_cast<const SfxInt16Item*>(pItem)->
GetValue() ));
629 case SID_ATTR_GRAF_GREEN:
632 static_cast<const SfxInt16Item*>(pItem)->
GetValue() ));
635 case SID_ATTR_GRAF_BLUE:
638 static_cast<const SfxInt16Item*>(pItem)->
GetValue() ));
641 case SID_ATTR_GRAF_GAMMA:
649 case SID_ATTR_GRAF_TRANSPARENCE:
652 static_cast< sal_Int8 >( static_cast<const SfxUInt16Item*>(pItem )->
GetValue() ) ) );
655 case SID_ATTR_GRAF_INVERT:
658 static_cast<const SfxBoolItem*>(pItem)->
GetValue() ));
661 case SID_ATTR_GRAF_MODE:
664 static_cast<GraphicDrawMode>(static_cast<const SfxUInt16Item*>(pItem)->
GetValue()) ));
667 case SID_COLOR_SETTINGS:
675 case SID_GRFFILTER_INVERT:
676 case SID_GRFFILTER_SMOOTH:
677 case SID_GRFFILTER_SHARPEN:
678 case SID_GRFFILTER_REMOVENOISE:
679 case SID_GRFFILTER_SOBEL:
680 case SID_GRFFILTER_MOSAIC:
681 case SID_GRFFILTER_EMBOSS:
682 case SID_GRFFILTER_POSTER:
683 case SID_GRFFILTER_POPART:
684 case SID_GRFFILTER_SEPIA:
685 case SID_GRFFILTER_SOLARIZE:
686 if( GraphicType::Bitmap == nGrfType )
693 if( SvxGraphicFilterResult::NONE ==
702 OSL_ENSURE(
false,
"wrong dispatcher");
705 if( aGrfSet.Count() )
725 bool bDisable = bParentCntProt;
728 case SID_OBJECT_ROTATE:
731 const bool bIsRotate(
GetView().IsDrawRotate());
745 case SID_INSERT_GRAPHIC:
747 case SID_TWAIN_TRANSFER:
748 if( bParentCntProt || !bIsGrfContent )
750 else if ( nWhich == SID_INSERT_GRAPHIC
757 case SID_SAVE_GRAPHIC:
758 case SID_EXTERNAL_EDIT:
763 case SID_COLOR_SETTINGS:
765 if ( bParentCntProt || !bIsGrfContent )
775 case SID_FLIP_HORIZONTAL:
776 if( !bParentCntProt )
786 case SID_FLIP_VERTICAL:
787 if( !bParentCntProt )
795 case SID_ATTR_GRAF_LUMINANCE:
796 if( !bParentCntProt )
801 case SID_ATTR_GRAF_CONTRAST:
802 if( !bParentCntProt )
807 case SID_ATTR_GRAF_RED:
808 if( !bParentCntProt )
813 case SID_ATTR_GRAF_GREEN:
814 if( !bParentCntProt )
819 case SID_ATTR_GRAF_BLUE:
820 if( !bParentCntProt )
825 case SID_ATTR_GRAF_GAMMA:
826 if( !bParentCntProt )
831 case SID_ATTR_GRAF_TRANSPARENCE:
832 if( !bParentCntProt )
839 GraphicType::GdiMetafile == pGrafObj->
GetType() )
848 case SID_ATTR_GRAF_INVERT:
849 if( !bParentCntProt )
854 case SID_ATTR_GRAF_MODE:
855 if( !bParentCntProt )
860 case SID_GRFFILTER_INVERT:
861 case SID_GRFFILTER_SMOOTH:
862 case SID_GRFFILTER_SHARPEN:
863 case SID_GRFFILTER_REMOVENOISE:
864 case SID_GRFFILTER_SOBEL:
865 case SID_GRFFILTER_MOSAIC:
866 case SID_GRFFILTER_EMBOSS:
867 case SID_GRFFILTER_POSTER:
868 case SID_GRFFILTER_POPART:
869 case SID_GRFFILTER_SEPIA:
870 case SID_GRFFILTER_SOLARIZE:
872 if( bParentCntProt || !bIsGrfContent )
878 if ( ( eGraphicType == GraphicType::NONE ||
879 eGraphicType == GraphicType::Default ) &&
888 bDisable = eGraphicType != GraphicType::Bitmap;
894 case SID_OBJECT_CROP:
918 if (rReq.
GetSlot() == SID_ROTATE_GRAPHIC_LEFT)
920 aRotation = 900_deg10;
922 else if (rReq.
GetSlot() == SID_ROTATE_GRAPHIC_RIGHT)
924 aRotation = 2700_deg10;
926 else if (rReq.
GetSlot() == SID_ROTATE_GRAPHIC_180)
928 aRotation = 1800_deg10;
931 if (rReq.
GetSlot() != SID_ROTATE_GRAPHIC_RESET && 0_deg10 == aRotation)
941 if (rReq.
GetSlot() == SID_ROTATE_GRAPHIC_RESET)
945 else if(0_deg10 != aRotation)
947 const Degree10 aNewRotation((aRotation + rRotation.
GetValue()) % 3600_deg10);
964 bool bDisable = bIsParentContentProtected;
967 case SID_ROTATE_GRAPHIC_LEFT:
968 case SID_ROTATE_GRAPHIC_RIGHT:
969 case SID_ROTATE_GRAPHIC_180:
977 case SID_ROTATE_GRAPHIC_RESET:
983 bDisable = (0_deg10 == rRotation.
GetValue());
986 case SID_ATTR_TRANSFORM_ANGLE:
SfxViewFrame * GetViewFrame() const
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(101)
static short HasToSaveTransformedImage(weld::Widget *pWin)
Rect of current FlyFrame.
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
#define SFX_IMPL_INTERFACE(Class, SuperClass)
bool IsRotationOfSwGrfNodePossible() const
void SetHeight(tools::Long n)
constexpr auto toTwips(N number, Length from)
SfxViewFrame * GetFrame() const
void setWidth(tools::Long nWidth)
void ReRead(const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic=nullptr)
Re-read if graphic is not ok. Current graphic is replaced by the new one.
virtual ~SwGrfShell() override
void SetGrfToggle(bool bNew)
#define FN_PARAM_GRF_CONNECT
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
const SwRect & GetAnyCurRect(CurRectType eType, const Point *pPt=nullptr, const css::uno::Reference< css::embed::XEmbeddedObject > &=css::uno::Reference< css::embed::XEmbeddedObject >()) const
constexpr TypedWhichId< SwTransparencyGrf > RES_GRFATR_TRANSPARENCY(143)
const OUString & GetName() const
void SetAttrSet(const SfxItemSet &, SetAttrMode nFlags=SetAttrMode::DEFAULT, SwPaM *pCursor=nullptr, const bool bParagraphSetting=false)
bool Pop(SwCursorShell::PopMode=SwCursorShell::PopMode::DeleteStack)
#define FN_SET_FRM_ALT_NAME
constexpr TypedWhichId< SwChannelRGrf > RES_GRFATR_CHANNELR(138)
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
void Execute(SfxRequest &rRequest)
static SvxGraphicFilterResult ExecuteGrfFilterSlot(SfxRequest const &rReq, GraphicObject &rFilterObject)
void Done(bool bRemove=false)
virtual SfxBindings & GetBindings() override
void GetAttrStateForRotation(SfxItemSet &rRequest)
constexpr TypedWhichId< SwContrastGrf > RES_GRFATR_CONTRAST(137)
const Size & GetUnrotatedSize() const
void ExecuteScan(SfxRequest &rReq)
static OUString decode(std::u16string_view rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
Of course Writer needs its own rectangles.
const SfxItemSet * GetArgs() const
void Invalidate(sal_uInt16 nId)
Graphic GetCompressedGraphic()
SwFlyFrame * GetSelectedFlyFrame() const
#define FN_FORMAT_GRAFIC_DLG
Graphic GetTransformedGraphic(const Size &rDestSize, const MapMode &rDestMap, const GraphicAttr &rAttr) const
constexpr TypedWhichId< SwLuminanceGrf > RES_GRFATR_LUMINANCE(136)
void SetGrfKeepZoom(bool b)
XPatternListRef GetPatternList() const
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
void SetKeepRatio(bool b)
constexpr auto convertTwipToMm100(N n)
Used by the UI to modify the document model.
constexpr tools::Long Width() const
const SwView & GetView() const
constexpr sal_uInt16 RES_GRFATR_END(150)
const SwRect & getFrameArea() const
void SetGetStateSet(SfxItemSet *p)
void Width(tools::Long nNew)
void GetGrfNms(OUString *pGrfName, OUString *pFltName, const SwFlyFrameFormat *=nullptr) const
Returns the name and the filter name of a graphic if the pointer is on a graphic. ...
bool IsRotateAllowed(bool b90Deg=false) const
virtual VclPtr< SfxAbstractTabDialog > CreateFrameTabDialog(const OUString &rDialogType, SfxViewFrame *pFrame, weld::Window *pParent, const SfxItemSet &rCoreSet, bool bNewFrame=true, const OString &sDefPage=OString())=0
SfxItemPool & GetPool() const
MapMode GetPrefMapMode() const
void ExecuteRotation(SfxRequest const &rRequest)
constexpr TypedWhichId< SwChannelBGrf > RES_GRFATR_CHANNELB(140)
OUString GetObjTitle() const
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
SwDoc * GetDoc()
returns Doc. But be careful!
void SetObjDescription(const OUString &rDescription)
#define FN_UNO_DESCRIPTION
constexpr TypedWhichId< SwRotationGrf > RES_GRFATR_ROTATION(135)
const SfxItemPool & GetAttrPool() const
Rect of current PrtArea of page.
tools::Rectangle GetScaledCropRectangle() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
GraphicType GetGraphicType() const
#define FN_KEEP_ASPECT_RATIO
const SwPosition * GetPoint() const
SVL_DLLPUBLIC Link< OUString *, bool > const & GetMaybeFileHdl()
void Push()
store a copy of the current cursor on the cursor stack
constexpr TypedWhichId< SwCropGrf > RES_GRFATR_CROPGRF(134)
SfxBindings & GetBindings()
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
const GraphicObject * GetGraphicObj() const
virtual SwCursor & GetCurrentShellCursor() override
Return the current shell cursor.
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
#define FN_GRAPHIC_MIRROR_ON_EVEN_PAGES
XGradientListRef GetGradientList() const
static SwAbstractDialogFactory * Create()
bool IsDrawRotate() const
SdrDragMode GetDragMode() const
void SetName(const OUString &rName)
const Graphic * GetGraphic(bool bWait=true) const
std::vector< std::unique_ptr< SwExternalToolEdit > > m_ExternalEdits
FlyProtectFlags IsSelObjProtected(FlyProtectFlags eType) const
Which Protection is set at selected object?
GraphicType GetType() const
SwDocShell * GetDocShell()
#define FN_GET_PRINT_AREA
#define SFX_OBJECTBAR_OBJECT
void SetWidth(tools::Long n)
Degree10 GetValue() const
SwFrameFormat * GetSelectedFrameFormat() const
If frame then frame style, else 0.
void SetReturnValue(const SfxPoolItem &)
bool isExportLocked() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
constexpr TypedWhichId< SwMirrorGrf > RES_GRFATR_MIRRORGRF(RES_GRFATR_BEGIN)
sal_uInt16 GetSlot() const
static const OUString & GetContextName(const Context eContext)
static OUString ExportGraphic(weld::Window *pWin, const Graphic &rGraphic, const OUString &rGraphicName)
XHatchListRef GetHatchList() const
void DisableItem(sal_uInt16 nWhich)
weld::Window * GetFrameWeld() const
general base class for all free-flowing frames
SwGrfShell(SwView &rView)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
const Graphic & GetGraphic() const
constexpr tools::Long Height() const
constexpr TypedWhichId< SwChannelGGrf > RES_GRFATR_CHANNELG(139)
const SwViewOption * GetViewOptions() const
constexpr TypedWhichId< SwInvertGrf > RES_GRFATR_INVERT(142)
WhichRangesContainer const aNoTextNodeSetRange(svl::Items< RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_GRFATR_BEGIN, RES_GRFATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1 >)
constexpr sal_uInt16 RES_GRFATR_BEGIN(RES_FRMATR_END)
sal_uInt16 GetCntType() const
Determine form of content. Return Type at CurrentCursor->SPoint.
SdrView * GetDrawViewWithValidMarkList()
bool IsGrfKeepZoom() const
constexpr TypedWhichId< SwDrawModeGrf > RES_GRFATR_DRAWMODE(144)
SfxObjectShell * GetPersist() const
const INetURLObject & GetURLObject() const
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
constexpr OUStringLiteral TOOLBOX_NAME
void SetDragMode(SdrDragMode eSdrDragMode)
Set DragMode (e.g. Rotate), but do nothing when frame is selected.
XBitmapListRef GetBitmapList() const
SAL_DLLPRIVATE bool InsertGraphicDlg(SfxRequest &)
bool AddGrfUpdateSlot(sal_uInt16 nSlot)
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLBACKGROUND)
void SetObjTitle(const OUString &rTitle)
#define DBG_TESTSOLARMUTEX()
XColorListRef GetColorList() const
const GraphicAttr * GetGraphicAttr(GraphicAttr &rGA) const
Frame is variable in Var-direction.
OUString GetObjDescription() const
void StartAllAction()
For all views of this document.
bool IsLinkedGrfSwapOut() const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
void Height(tools::Long nNew)
void SetContextName(const OUString &rsContextName)
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
OUString GetFlyName() const
bool IsFrameSelected() const
void ExecAttr(SfxRequest const &rRequest)
virtual SfxObjectShell * GetObjectShell()
void SetRotation(Degree10 nOld, Degree10 nNew, const Size &rUnrotatedSize)
const Size & GetSize() const
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(104)
void GetAttrState(SfxItemSet &rRequest)
SVL_DLLPUBLIC OUString SmartRel2Abs(INetURLObject const &rTheBaseURIRef, OUString const &rTheRelURIRef, Link< OUString *, bool > const &rMaybeFileHdl=Link< OUString *, bool >(), bool bCheckFileExists=true, bool bIgnoreFragment=false, INetURLObject::EncodeMechanism eEncodeMechanism=INetURLObject::EncodeMechanism::WasEncoded, INetURLObject::DecodeMechanism eDecodeMechanism=INetURLObject::DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
bool CursorInsideInputField() const
constexpr TypedWhichId< SwGammaGrf > RES_GRFATR_GAMMA(141)
SfxMedium * GetMedium() const