35#include <svx/svxids.hrc>
43#include <bitmaps.hlst>
62const sal_uInt16
gButtonSlots[] = { SID_INSERT_TABLE, SID_INSERT_DIAGRAM, SID_INSERT_GRAPHIC, SID_INSERT_AVMEDIA };
67 BMP_PLACEHOLDER_TABLE_SMALL,
68 BMP_PLACEHOLDER_CHART_SMALL,
69 BMP_PLACEHOLDER_IMAGE_SMALL,
70 BMP_PLACEHOLDER_MOVIE_SMALL,
71 BMP_PLACEHOLDER_TABLE_SMALL_HOVER,
72 BMP_PLACEHOLDER_CHART_SMALL_HOVER,
73 BMP_PLACEHOLDER_IMAGE_SMALL_HOVER,
74 BMP_PLACEHOLDER_MOVIE_SMALL_HOVER
79 BMP_PLACEHOLDER_TABLE_LARGE,
80 BMP_PLACEHOLDER_CHART_LARGE,
81 BMP_PLACEHOLDER_IMAGE_LARGE,
82 BMP_PLACEHOLDER_MOVIE_LARGE,
83 BMP_PLACEHOLDER_TABLE_LARGE_HOVER,
84 BMP_PLACEHOLDER_CHART_LARGE_HOVER,
85 BMP_PLACEHOLDER_IMAGE_LARGE_HOVER,
86 BMP_PLACEHOLDER_MOVIE_LARGE_HOVER
96 if( !gSmallButtonImages[0].
get() )
107 return gLargeButtonImages[
index].
get();
111 return gSmallButtonImages[
index].
get();
119class ChangePlaceholderTag :
public SmartTag
121 friend class ImageButtonHdl;
131 BitmapEx createOverlayImage(
int nHighlight );
134 virtual void addCustomHandles(
SdrHdlList& rHandlerList )
override;
140class ImageButtonHdl :
public SmartHdl
144 virtual ~ImageButtonHdl()
override;
145 virtual void CreateB2dIAObject()
override;
146 virtual bool IsFocusHdl()
const override;
149 virtual void onMouseEnter(
const MouseEvent& rMEvt)
override;
150 virtual void onHelpRequest()
override;
151 virtual void onMouseLeave()
override;
153 int getHighlightId()
const {
return mnHighlightId; }
156 static void HideTip();
169, mxChangePlaceholderTag( dynamic_cast< ChangePlaceholderTag* >( xTag.
get() ) )
171, maImageSize( 42, 42 )
175ImageButtonHdl::~ImageButtonHdl()
180void ImageButtonHdl::HideTip()
185void ImageButtonHdl::ShowTip()
187 if (!pHdlList || !pHdlList->GetView() || mnHighlightId == -1)
190 OutputDevice* pDev = pHdlList->GetView()->GetFirstOutputDevice();
191 if( pDev ==
nullptr )
196 if (mnHighlightId == 1)
197 aHelpPos.Move(maImageSize.Width(), 0);
198 else if (mnHighlightId == 2)
199 aHelpPos.Move(0, maImageSize.Height());
200 else if (mnHighlightId == 3)
201 aHelpPos.Move(maImageSize.Width(), maImageSize.Height());
203 vcl::Window* pWindow = pHdlList->GetView()->GetFirstOutputDevice()->GetOwnerWindow();
209void ImageButtonHdl::onHelpRequest()
214void ImageButtonHdl::onMouseEnter(
const MouseEvent& rMEvt)
216 if( !(pHdlList && pHdlList->GetView()))
219 int nHighlightId = 0;
220 OutputDevice* pDev = pHdlList->GetView()->GetFirstOutputDevice();
221 if( pDev ==
nullptr )
227 nHighlightId += aMDPos.
X() > maImageSize.Width() ? 1 : 0;
228 nHighlightId += aMDPos.Y() > maImageSize.Height() ? 2 : 0;
230 if( mnHighlightId != nHighlightId )
234 mnHighlightId = nHighlightId;
242void ImageButtonHdl::onMouseLeave()
249void ImageButtonHdl::CreateB2dIAObject()
254 const Point aTagPos( GetPos() );
257 BitmapEx aBitmapEx( mxChangePlaceholderTag->createOverlayImage( mnHighlightId ) );
258 maImageSize = aBitmapEx.GetSizePixel();
259 maImageSize.setWidth( maImageSize.Width() >> 1 );
260 maImageSize.setHeight( maImageSize.Height() >> 1 );
283 std::unique_ptr<sdr::overlay::OverlayObject> pOverlayObject(
287 insertNewlyCreatedOverlayObjectForSdrHdl(
288 std::move(pOverlayObject),
295bool ImageButtonHdl::IsFocusHdl()
const
302 return PointerStyle::Arrow;
307, mxPlaceholderObj( &rPlaceholderObj )
312bool ChangePlaceholderTag::MouseButtonDown(
const MouseEvent& , SmartHdl& rHdl )
314 int nHighlightId =
static_cast< ImageButtonHdl&
>(rHdl).getHighlightId();
315 if( nHighlightId >= 0 )
319 if(
auto pPlaceholder = mxPlaceholderObj.get() )
322 if( !
mrView.IsObjMarked( pPlaceholder.get() ) || (
mrView.GetMarkedObjectList().GetMarkCount() != 1) )
325 mrView.UnmarkAllObj(pPV );
326 mrView.MarkObj(pPlaceholder.get(), pPV);
330 mrView.GetViewShell()->GetViewFrame()->GetDispatcher()->Execute( nSID, SfxCallMode::ASYNCHRON);
336bool ChangePlaceholderTag::KeyInput(
const KeyEvent& rKEvt )
354BitmapEx ChangePlaceholderTag::createOverlayImage(
int nHighlight )
357 if(
auto pPlaceholder = mxPlaceholderObj.get() )
360 const ::tools::Rectangle& rSnapRect = pPlaceholder->GetSnapRect();
363 if( pDev ==
nullptr )
369 bool bLarge = nShapeSizePix > 250;
373 aRet.
Scale(
Size(aSize.Width() << 1, aSize.Height() << 1));
375 const ::tools::Rectangle aRectSrc(
Point( 0, 0 ), aSize );
378 aRet.
Expand( aSize.Width(), aSize.Height(), true );
388void ChangePlaceholderTag::addCustomHandles(
SdrHdlList& rHandlerList )
395 const ::tools::Rectangle& rSnapRect = pPlaceholder->GetSnapRect();
399 if( pDev ==
nullptr )
404 if( 50 > nShapeSizePix )
407 bool bLarge = nShapeSizePix > 250;
411 const int nColumns = 2;
417 Point aPos( rSnapRect.Center() );
418 aPos.AdjustX( -(all_width >> 1) );
419 aPos.AdjustY( -(all_height >> 1) );
421 std::unique_ptr<ImageButtonHdl> pHdl(
new ImageButtonHdl( xThis, aPoint ));
423 pHdl->SetPageView(
mrView.GetSdrPageView() );
425 pHdl->SetPos( aPos );
427 rHandlerList.
AddHdl( std::move(pHdl) );
431: mrBase( rViewShellBase )
432, mnUpdateTagsEvent( nullptr )
456 if (rHint.
GetId() == SfxHintId::DocChanged)
478 mnUpdateTagsEvent =
nullptr;
479 bool bChanges = DisposeTags();
480 bChanges |= CreateTags();
482 if( bChanges && mrBase.GetDrawView() )
483 static_cast< ::
sd::View*
>( mrBase.GetDrawView() )->updateHandles();
488 bool bChanges =
false;
492 SdPage* pPage = aMainShell ? aMainShell->getCurrentPage() :
nullptr;
519 for (
auto& rxViewTag : vec)
520 rxViewTag->Dispose();
530 switch (rEvent.meEventId)
@ BeginTextEdit
Text editing in one of the shapes in the MainViewShell has started.
@ ViewAdded
A new ViewShell is being displayed in one of the panes.
@ EndTextEdit
Text editing in one of the shapes in the MainViewShell has ended.
@ MainViewAdded
A new ViewShell has been made the MainViewShell.
@ CurrentPageChanged
The current page has changed.
static OutputDevice * GetDefaultDevice()
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
bool Scale(const Size &rNewSize, BmpScaleFlag nScaleFlag=BmpScaleFlag::Default)
void Expand(sal_Int32 nDX, sal_Int32 nDY, bool bExpandTransparent=false)
bool CopyPixel(const tools::Rectangle &rRectDst, const tools::Rectangle &rRectSrc, const BitmapEx *pBmpExSrc)
static void HideBalloonAndQuickHelp()
static void ShowQuickHelp(vcl::Window *pParent, const tools::Rectangle &rScreenRect, const OUString &rHelpText, QuickHelpFlags nStyle=QuickHelpFlags::NONE)
const vcl::KeyCode & GetKeyCode() const
const Point & GetPosPixel() const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
constexpr tools::Long X() const
PageKind GetPageKind() const
sd::ShapeList & GetPresentationShapeList()
void AddHdl(std::unique_ptr< SdrHdl > pHdl)
bool areMarkHandlesHidden() const
SdrTextObj * GetTextEditObject() const
sal_uInt32 PageWindowCount() const
SdrPageWindow * GetPageWindow(sal_uInt32 nIndex) const
rtl::Reference< sdr::overlay::OverlayManager > const & GetOverlayManager() const
SdrPaintWindow & GetPaintWindow() const
const sdr::contact::ObjectContact & GetObjectContact() const
bool IsMasterPage() const
SdrPageView * GetSdrPageView() const
bool OutputToWindow() const
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const std::list< SdrObject * > & getList() const
virtual ~ViewOverlayManager() override
ImplSVEvent * mnUpdateTagsEvent
ViewTagVector maTagVector
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
SfxViewShell descendant that the stacked Draw/Impress shells are based on.
std::shared_ptr< ViewShell > GetMainViewShell() const
Return the main view shell stacked on the called ViewShellBase object.
std::shared_ptr< tools::EventMultiplexer > const & GetEventMultiplexer() const
Return an event multiplexer.
DrawDocShell * GetDocShell() const
virtual SdrView * GetDrawView() const override
std::optional< T > set(Args &&... args)
sal_uInt16 GetCode() const
Point OutputToScreenPixel(const Point &rPos) const
constexpr sal_uInt16 KEY_RETURN
constexpr sal_uInt16 KEY_ESCAPE
constexpr sal_uInt16 KEY_LEFT
constexpr sal_uInt16 KEY_TAB
constexpr sal_uInt16 KEY_UP
constexpr sal_uInt16 KEY_RIGHT
constexpr sal_uInt16 KEY_DOWN
constexpr sal_uInt16 KEY_SPACE
#define LINK(Instance, Class, Member)
#define SAL_N_ELEMENTS(arr)
IMPL_LINK_NOARG(MainSequence, onTimerHdl, Timer *, void)
static BitmapEx * getButtonImage(int index, bool large)
const TranslateId gButtonToolTips[]
const sal_uInt16 gButtonSlots[]
constexpr rtl::OUStringConstExpr aBigPlaceHolders[]
rtl::Reference< SmartTag > SmartTagReference
std::vector< rtl::Reference< SmartTag > > ViewTagVector
IMPL_LINK(SdCharHeightPropertyBox, implMenuSelectHdl, const OUString &, rIdent, void)
constexpr rtl::OUStringConstExpr aSmallPlaceHolders[]
const sal_uInt32 SMART_TAG_HDL_NUM
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
OUString SdResId(TranslateId aId)