41#include <osl/diagnose.h>
60#define ShellClass_SwGrfShell
82 pShell->GetDoc()->CreateUnoCursor(
83 *pShell->GetCurrentShellCursor().GetPoint()))
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:
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 );
318 aSet.Put( aFrameSize );
348 aSzItm.SetWhich( SID_ATTR_GRAF_FRMSIZE_PERCENT );
355 if( !sGrfNm.isEmpty() )
360 SID_ATTR_GRAF_GRAPHIC ));
369 SID_ATTR_GRAF_GRAPHIC ) );
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);
457 bool bApplyUsrPref =
false;
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 );
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 )
607 aGrfSet.Put( aMirror );
611 case SID_ATTR_GRAF_LUMINANCE:
617 case SID_ATTR_GRAF_CONTRAST:
623 case SID_ATTR_GRAF_RED:
629 case SID_ATTR_GRAF_GREEN:
635 case SID_ATTR_GRAF_BLUE:
641 case SID_ATTR_GRAF_GAMMA:
649 case SID_ATTR_GRAF_TRANSPARENCE:
655 case SID_ATTR_GRAF_INVERT:
661 case SID_ATTR_GRAF_MODE:
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:
constexpr auto convertTwipToMm100(N n)
tools::Rectangle GetScaledCropRectangle() const
Graphic GetCompressedGraphic()
static OUString ExportGraphic(weld::Window *pWin, const Graphic &rGraphic, const OUString &rGraphicName)
static short HasToSaveTransformedImage(weld::Widget *pWin)
MapMode GetPrefMapMode() const
const Graphic & GetGraphic() const
GraphicType GetType() const
Graphic GetTransformedGraphic(const Size &rDestSize, const MapMode &rDestMap, const GraphicAttr &rAttr) const
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
static OUString decode(std::u16string_view rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
bool IsRotateAllowed(bool b90Deg=false) const
XBitmapListRef GetBitmapList() const
XGradientListRef GetGradientList() const
XPatternListRef GetPatternList() const
XColorListRef GetColorList() const
XHatchListRef GetHatchList() const
void Invalidate(sal_uInt16 nId)
void SetValue(EnumT nTheValue)
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxItemSet * GetParent() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void DisableItem(sal_uInt16 nWhich)
const INetURLObject & GetURLObject() const
const OUString & GetName() const
SfxMedium * GetMedium() const
sal_uInt16 GetSlot() const
const SfxItemSet * GetArgs() const
void SetReturnValue(const SfxPoolItem &)
void Done(bool bRemove=false)
SfxItemPool & GetPool() const
void SetContextName(const OUString &rsContextName)
SfxViewFrame * GetFrame() const
virtual SfxObjectShell * GetObjectShell()
void SetName(const OUString &rName)
SfxBindings & GetBindings()
weld::Window * GetFrameWeld() const
SfxViewFrame & GetViewFrame() const
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
static SvxGraphicFilterResult ExecuteGrfFilterSlot(SfxRequest const &rReq, GraphicObject &rFilterObject)
void SetTop(sal_Int32 nVal)
void SetLeft(sal_Int32 nVal)
sal_Int32 GetRight() const
void SetBottom(sal_Int32 nVal)
void SetRight(sal_Int32 nVal)
sal_Int32 GetLeft() const
sal_Int32 GetBottom() const
void SetHeight(tools::Long n)
const Size & GetSize() const
void SetSize(const Size &rSize)
void SetWidth(tools::Long n)
virtual VclPtr< SfxAbstractTabDialog > CreateFrameTabDialog(const OUString &rDialogType, SfxViewFrame &rFrame, weld::Window *pParent, const SfxItemSet &rCoreSet, bool bNewFrame=true, const OUString &sDefPage={})=0
static SwAbstractDialogFactory * Create()
bool AddGrfUpdateSlot(sal_uInt16 nSlot)
void SetGetStateSet(SfxItemSet *p)
void Push()
store a copy of the current cursor on the cursor stack
virtual SwCursor & GetCurrentShellCursor() override
Return the current shell cursor.
bool CursorInsideInputField() const
SwDoc * GetDoc()
returns Doc. But be careful!
SfxObjectShell * GetPersist() const
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
sal_uInt16 GetCntType() const
Determine form of content. Return Type at CurrentCursor->SPoint.
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
void StartAllAction()
For all views of this document.
GraphicType GetGraphicType() const
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.
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
void SetAttrSet(const SfxItemSet &, SetAttrMode nFlags=SetAttrMode::DEFAULT, SwPaM *pCursor=nullptr, const bool bParagraphSetting=false)
bool IsLinkedGrfSwapOut() const
const GraphicAttr * GetGraphicAttr(GraphicAttr &rGA) const
const GraphicObject * GetGraphicObj() const
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
const Graphic * GetGraphic(bool bWait=true) const
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.
SwFlyFrame * GetSelectedFlyFrame() const
void SetObjDescription(const OUString &rDescription)
FlyProtectFlags IsSelObjProtected(FlyProtectFlags eType) const
Which Protection is set at selected object?
SdrDragMode GetDragMode() const
OUString GetFlyName() const
OUString GetObjTitle() const
void SetObjTitle(const OUString &rTitle)
bool IsFrameSelected() const
OUString GetObjDescription() const
bool IsRotationOfSwGrfNodePossible() const
SwFrameFormat * GetSelectedFrameFormat() const
If frame then frame style, else 0.
void SetDragMode(SdrDragMode eSdrDragMode)
Set DragMode (e.g. Rotate), but do nothing when frame is selected.
const SwRect & GetAnyCurRect(CurRectType eType, const Point *pPt=nullptr, const css::uno::Reference< css::embed::XEmbeddedObject > &=css::uno::Reference< css::embed::XEmbeddedObject >()) const
void SetRotation(Degree10 nOld, Degree10 nNew, const Size &rUnrotatedSize)
void SetAttrSet(const SfxItemSet &rSet)
const SfxItemSet & GetAttrSet() const
general base class for all free-flowing frames
const SwRect & getFrameArea() const
void Execute(SfxRequest &rRequest)
virtual ~SwGrfShell() override
SwGrfShell(SwView &rView)
void GetAttrStateForRotation(SfxItemSet &rRequest)
std::vector< std::unique_ptr< SwExternalToolEdit > > m_ExternalEdits
void GetAttrState(SfxItemSet &rRequest)
void ExecAttr(SfxRequest const &rRequest)
void ExecuteRotation(SfxRequest const &rRequest)
void SetGrfToggle(bool bNew)
const SwPosition * GetPoint() const
Of course Writer needs its own rectangles.
void Height(tools::Long nNew)
void Width(tools::Long nNew)
const Size & GetUnrotatedSize() const
Degree10 GetValue() const
void SetGrfKeepZoom(bool b)
void SetKeepRatio(bool b)
bool IsGrfKeepZoom() const
const SwViewOption * GetViewOptions() const
SdrView * GetDrawViewWithValidMarkList()
const SfxItemPool & GetAttrPool() const
void ExecuteScan(SfxRequest &rReq)
SwDocShell * GetDocShell()
SAL_DLLPRIVATE bool InsertGraphicDlg(SfxRequest &)
Used by the UI to modify the document model.
bool Pop(SwCursorShell::PopMode, ::std::optional< SwCallLink > &roLink)
const SwView & GetView() const
static const OUString & GetContextName(const Context eContext)
#define FN_SET_FRM_ALT_NAME
#define FN_GET_PRINT_AREA
#define FN_PARAM_GRF_CONNECT
#define FN_FORMAT_GRAFIC_DLG
#define FN_KEEP_ASPECT_RATIO
#define FN_GRAPHIC_MIRROR_ON_EVEN_PAGES
#define FN_UNO_DESCRIPTION
#define DBG_TESTSOLARMUTEX()
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
virtual SfxBindings & GetBindings() override
@ Page
Rect of current page.
@ FlyEmbedded
Rect of current FlyFrame.
@ PagePrt
Rect of current PrtArea of page.
@ Parent
Check only parents.
@ Variable
Frame is variable in Var-direction.
constexpr OUStringLiteral TOOLBOX_NAME
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
constexpr TypedWhichId< SwLuminanceGrf > RES_GRFATR_LUMINANCE(144)
constexpr TypedWhichId< SwTransparencyGrf > RES_GRFATR_TRANSPARENCY(151)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr sal_uInt16 RES_GRFATR_BEGIN(RES_FRMATR_END)
constexpr TypedWhichId< SwChannelRGrf > RES_GRFATR_CHANNELR(146)
constexpr TypedWhichId< SwContrastGrf > RES_GRFATR_CONTRAST(145)
constexpr TypedWhichId< SwDrawModeGrf > RES_GRFATR_DRAWMODE(152)
constexpr TypedWhichId< SwChannelBGrf > RES_GRFATR_CHANNELB(148)
constexpr TypedWhichId< SwInvertGrf > RES_GRFATR_INVERT(150)
constexpr TypedWhichId< SwMirrorGrf > RES_GRFATR_MIRRORGRF(RES_GRFATR_BEGIN)
constexpr TypedWhichId< SwChannelGGrf > RES_GRFATR_CHANNELG(147)
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(110)
constexpr TypedWhichId< SwRotationGrf > RES_GRFATR_ROTATION(143)
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(107)
constexpr TypedWhichId< SwCropGrf > RES_GRFATR_CROPGRF(142)
constexpr sal_uInt16 RES_GRFATR_END(156)
constexpr TypedWhichId< SwGammaGrf > RES_GRFATR_GAMMA(149)
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 >)
SVL_DLLPUBLIC Link< OUString *, bool > const & GetMaybeFileHdl()
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)
constexpr auto toTwips(N number, Length from)
#define SFX_OBJECTBAR_OBJECT
#define SFX_IMPL_INTERFACE(Class, SuperClass)
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLUSESLIDEBACKGROUND)