/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
class SdrOutliner; class OutlinerView; class EditStatus; class EditFieldInfo; struct PasteOrDropInfos; class SdrUndoManager; class TextChainCursorManager;
namespace com::sun::star::uno { class Any;
}
namespace sdr { class SelectionController;
}
enumclass SdrEndTextEditKind
{
Unchanged, // textobject unchanged
Changed, // textobject changed
Deleted, // textobject implicitly deleted
ShouldBeDeleted // for writer: textobject should be deleted
};
// - general edit for objectspecific properties // - textedit for all drawobjects, inherited from SdrTextObj // - macromode
class SVXCORE_DLLPUBLIC SdrObjEditView : public SdrGlueEditView, public EditViewCallbacks
{ friendclass SdrPageView; friendclass ImpSdrEditPara;
// Now derived from EditViewCallbacks and overriding these callbacks to // allow own EditText visualization virtualvoid EditViewInvalidate(const tools::Rectangle& rRect) override; virtualvoid EditViewSelectionChange() override; virtual OutputDevice& EditViewOutputDevice() const override; virtual Point EditViewPointerPosPixel() const override; virtual css::uno::Reference<css::datatransfer::clipboard::XClipboard> GetClipboard() const override; virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> GetDropTarget() override; virtualvoid EditViewInputContext(const InputContext& rInputContext) override; virtualvoid EditViewCursorRect(const tools::Rectangle& rRect, int nExtTextInputWidth) override;
// The OverlayObjects used for visualizing active TextEdit (currently // using TextEditOverlayObject, but not limited to it)
sdr::overlay::OverlayObjectList maTEOverlayGroup;
Timer maTextEditUpdateTimer;
// IASS: allow reaction to active TextEdit changes
DECL_DLLPRIVATE_LINK(ImpModifyHdl, LinkParamNone*, void);
// IASS: timer-based reaction on TextEdit changes
DECL_DLLPRIVATE_LINK(TextEditUpdate, Timer*, void);
protected: // TextEdit
unotools::WeakReference<SdrTextObj> mxWeakTextEditObj; // current object in TextEdit
SdrPageView* mpTextEditPV;
std::unique_ptr<SdrOutliner> mpTextEditOutliner; // outliner for the TextEdit
OutlinerView* mpTextEditOutlinerView; // current view of the outliners
VclPtr<vcl::Window> mpTextEditWin; // matching window to pTextEditOutlinerView
vcl::Cursor* m_pTextEditCursorBuffer; // to restore the cursor in each window
SdrObject* m_pMacroObj;
SdrPageView* m_pMacroPV;
VclPtr<vcl::Window> m_pMacroWin;
tools::Rectangle m_aTextEditArea;
tools::Rectangle m_aMinTextEditArea;
Link<EditFieldInfo*,void> m_aOldCalcFieldValueLink; // for call the old handler
Point m_aMacroDownPos;
sal_uInt16 m_nMacroTol;
bool mbTextEditDontDelete : 1; // do not delete outliner and view of SdrEndTextEdit (f. spellchecking) bool mbTextEditOnlyOneView : 1; // a single OutlinerView (f. spellchecking) bool mbTextEditNewObj : 1; // current edited object was just recreated bool mbQuickTextEditMode : 1; // persistent(->CrtV). Default=TRUE bool mbMacroDown : 1; bool mbInteractiveSlideShow : 1; // IASS
// check/set if we are in IASS and need to refresh evtl. void setInteractiveSlideShow(bool bNew) { mbInteractiveSlideShow = bNew; } bool isInteractiveSlideShow() const { return mbInteractiveSlideShow; }
// Create a new OutlinerView at the heap and initialize all required parameters. // pTextEditObj, pTextEditPV and pTextEditOutliner have to be initialized
OutlinerView* ImpMakeOutlinerView(vcl::Window* pWin, OutlinerView* pGivenView, SfxViewShell* pViewShell = nullptr) const; void ImpPaintOutlinerView(OutlinerView& rOutlView, const tools::Rectangle& rRect, OutputDevice& rTargetDevice) const; void ImpInvalidateOutlinerView(OutlinerView const & rOutlView) const;
// Check if the whole text is selected. // Still returns sal_True if there is no text present. bool ImpIsTextEditAllSelected() const; void ImpMakeTextCursorAreaVisible();
// handler for AutoGrowing text with active Outliner
DECL_DLLPRIVATE_LINK(ImpOutlinerStatusEventHdl, EditStatus&, void);
DECL_DLLPRIVATE_LINK(ImpOutlinerCalcFieldValueHdl, EditFieldInfo*, void);
// link for EndTextEditHdl
DECL_DLLPRIVATE_LINK(EndTextEditHdl, SdrUndoManager*, void);
protected: // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
SdrObjEditView(
SdrModel& rSdrModel,
OutputDevice* pOut);
virtual ~SdrObjEditView() override;
public:
// used to call the old ImpPaintOutlinerView. Will be replaced when the // outliner will be displayed on the overlay in edit mode. void TextEditDrawing(SdrPaintWindow& rPaintWindow);
// QuickTextEditMode = edit the text straight after selection. Default=TRUE. Persistent. void SetQuickTextEditMode(bool bOn)
{
mbQuickTextEditMode = bOn;
} bool IsQuickTextEditMode() const
{ return mbQuickTextEditMode;
}
// Start the TextEditMode. If pWin==NULL, use the first window, which is logged at the View. // The cursor of the currently edited window is stored with SdrBeginTextEdit() // and restored with SdrEndTextEdit(). // The app has to ensure, that the BegEdit of the window logged cursor is still valid, // when SdrEndTextEdit is called. // With the parameter pEditOutliner, the app has the possibility to specify his own outliner, // which is used for editing. After the SdrBeginTextEdit call, the outliner belongs to // SdrObjEditView, and is also later destroyed by this via delete (if bDontDeleteOutliner=sal_False). // Afterwards the SdrObjEditView sets the modflag (EditEngine/Outliner) at this instance and also the // StatusEventHdl. // Similarly a specific OutlinerView can be specified.
virtualbool SdrBeginTextEdit(SdrObject* pObj, SdrPageView* pPV = nullptr, vcl::Window* pWin = nullptr, bool bIsNewObj = false,
SdrOutliner* pGivenOutliner = nullptr, OutlinerView* pGivenOutlinerView = nullptr, bool bDontDeleteOutliner = false, bool bOnlyOneView = false, bool bGrabFocus = true); // bDontDeleteReally is a special parameter for writer // If this flag is set, then a maybe empty textobject is not deleted. // Instead you get a return code SdrEndTextEditKind::ShouldBeDeleted // (in place of SDRENDTEXTEDIT_BEDELETED), which says, the obj should be // deleted. virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally = false); virtualbool IsTextEdit() const final override;
// This method returns sal_True, if the point rHit is inside the // objectspace or the OutlinerView. bool IsTextEditHit(const Point& rHit) const;
// This method returns sal_True, if the point rHit is inside the // handle-thick frame, which surrounds the OutlinerView at TextFrames. bool IsTextEditFrameHit(const Point& rHit) const;
// At active selection, between MouseButtonDown and // MouseButtonUp, this method always returns TRUE. bool IsTextEditInSelectionMode() const;
// If sb needs the object out of the TextEdit:
SdrTextObj* GetTextEditObject() const { return mxWeakTextEditObj.get().get(); }
// info about TextEditPageView. Default is 0L.
SdrPageView* GetTextEditPageView() const;
// Current window of the outliners. void SetTextEditWin(vcl::Window* pWin);
// Now at this outliner, events can be send, attributes can be set, // call Cut/Copy/Paste, call Undo/Redo, and so on... virtualconst SdrOutliner* GetTextEditOutliner() const
{ return mpTextEditOutliner.get();
} virtual SdrOutliner* GetTextEditOutliner()
{ return mpTextEditOutliner.get();
} virtualconst OutlinerView* GetTextEditOutlinerView() const
{ return mpTextEditOutlinerView;
} virtual OutlinerView* GetTextEditOutlinerView()
{ return mpTextEditOutlinerView;
}
/** fills the given any with a XTextCursor for the current text selection.
Leaves the any untouched if there currently is no text selected */ void getTextSelection( css::uno::Any& rSelection );
/** returns true if the shape identified by its inventor and identifier supports format paint brush operation */ staticbool SupportsFormatPaintbrush( SdrInventor nObjectInventor, SdrObjKind nObjectIdentifier );
/** fills a format paint brush set from the current selection and returns the numbering depth */
sal_Int32 TakeFormatPaintBrush( std::shared_ptr< SfxItemSet >& rFormatSet );
/** applies a format paint brush set from the current selection. if bNoCharacterFormats is true, no character attributes are changed. if bNoParagraphFormats is true, no paragraph attributes are changed.
*/ void ApplyFormatPaintBrush( SfxItemSet& rFormatSet, sal_Int16 nDepth, bool bNoCharacterFormats, bool bNoParagraphFormats );
/** helper function for selections with multiple SdrText for one SdrTextObj (f.e. tables ) */ staticvoid ApplyFormatPaintBrushToText( SfxItemSet const & rFormatSet, SdrTextObj& rTextObj, SdrText* pText, sal_Int16 nDepth, bool bNoCharacterFormats, bool bNoParagraphFormats );
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.