LibreOffice Module sw (master)  1
Public Types | Static Public Member Functions | List of all members
SwTextBoxHelper Class Reference

A TextBox is a TextFrame, that is tied to a drawinglayer shape. More...

#include <textboxhelper.hxx>

Public Types

using SavedLink = std::map< const SwFrameFormat *, const SwFrameFormat * >
 Maps a draw format to a fly format. More...
 
using SavedContent = std::map< const SwFrameFormat *, SwFormatContent >
 Maps a draw format to content. More...
 

Static Public Member Functions

static void create (SwFrameFormat *pShape)
 Create a TextBox for a shape. More...
 
static void destroy (SwFrameFormat *pShape)
 Destroy a TextBox for a shape. More...
 
static css::uno::Any queryInterface (const SwFrameFormat *pShape, const css::uno::Type &rType)
 Get interface of a shape's TextBox, if there is any. More...
 
static void syncProperty (SwFrameFormat *pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, const css::uno::Any &rValue)
 Sync property of TextBox with the one of the shape. More...
 
static void syncProperty (SwFrameFormat *pShape, const OUString &rPropertyName, const css::uno::Any &rValue)
 Does the same, but works on properties which lack an sw-specific WID / MemberID. More...
 
static void getProperty (SwFrameFormat const *pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, css::uno::Any &rValue)
 Get a property of the underlying TextFrame. More...
 
static void syncFlyFrameAttr (SwFrameFormat &rShape, SfxItemSet const &rSet)
 Similar to syncProperty(), but used by the internal API (e.g. for UI purposes). More...
 
static SwFrameFormatgetOtherTextBoxFormat (const SwFrameFormat *pFormat, sal_uInt16 nType)
 If we have an associated TextFrame, then return that. More...
 
static SwFrameFormatgetOtherTextBoxFormat (css::uno::Reference< css::drawing::XShape > const &xShape)
 If we have an associated TextFrame, then return that. More...
 
static tools::Rectangle getTextRectangle (SwFrameFormat *pShape, bool bAbsolute=true)
 Return the textbox rectangle of a draw shape (in twips). More...
 
static bool isTextBox (const SwFrameFormat *pFormat, sal_uInt16 nType)
 Is the frame format a text box? More...
 
static sal_Int32 getCount (const SwDoc *pDoc)
 Count number of shapes in the document, excluding TextBoxes. More...
 
static sal_Int32 getCount (SdrPage const *pPage)
 Count number of shapes on the page, excluding TextBoxes. More...
 
static css::uno::Any getByIndex (SdrPage const *pPage, sal_Int32 nIndex)
 Get a shape by index, excluding TextBoxes. More...
 
static sal_Int32 getOrdNum (const SdrObject *pObject)
 Get the order of the shape, excluding TextBoxes. More...
 
static void getShapeWrapThrough (const SwFrameFormat *pTextBox, bool &rWrapThrough)
 If pTextBox is a textbox, then set rWrapThrough to the surround of its shape. More...
 
static void saveLinks (const SwFrameFormats &rFormats, std::map< const SwFrameFormat *, const SwFrameFormat * > &rLinks)
 Saves the current shape -> textbox links in a map, so they can be restored later. More...
 
static void resetLink (SwFrameFormat *pShape, std::map< const SwFrameFormat *, SwFormatContent > &rOldContent)
 Reset the shape -> textbox link on the shape, and save it to the map, so it can be restored later. More...
 
static void restoreLinks (std::set< ZSortFly > &rOld, std::vector< SwFrameFormat * > &rNew, SavedLink &rSavedLinks, SavedContent &rResetContent)
 Undo the effect of saveLinks() + individual resetLink() calls. More...
 

Detailed Description

A TextBox is a TextFrame, that is tied to a drawinglayer shape.

This class provides helper methods to create, query and maintain such TextBoxes.

Definition at line 54 of file textboxhelper.hxx.

Member Typedef Documentation

Maps a draw format to content.

Definition at line 60 of file textboxhelper.hxx.

Maps a draw format to a fly format.

Definition at line 58 of file textboxhelper.hxx.

Member Function Documentation

void SwTextBoxHelper::create ( SwFrameFormat pShape)
static
void SwTextBoxHelper::destroy ( SwFrameFormat pShape)
static
uno::Any SwTextBoxHelper::getByIndex ( SdrPage const *  pPage,
sal_Int32  nIndex 
)
static

Get a shape by index, excluding TextBoxes.

Exceptions
css::lang::IndexOutOfBoundsException

Definition at line 190 of file textboxhelper.cxx.

References SdrObjList::GetObj(), SdrObjList::GetObjCount(), SdrObject::getUnoShape(), i, SdrObject::IsTextBox(), and com::sun::star::uno::makeAny().

Referenced by SwXDrawPage::getByIndex().

sal_Int32 SwTextBoxHelper::getCount ( const SwDoc pDoc)
static

Count number of shapes in the document, excluding TextBoxes.

Definition at line 178 of file textboxhelper.cxx.

References SwDoc::GetSpzFrameFormats(), and RES_FLYFRMFMT.

Referenced by SwXDrawPage::getCount().

sal_Int32 SwTextBoxHelper::getCount ( SdrPage const *  pPage)
static

Count number of shapes on the page, excluding TextBoxes.

Definition at line 165 of file textboxhelper.cxx.

References SdrObjList::GetObj(), SdrObjList::GetObjCount(), i, and SdrObject::IsTextBox().

sal_Int32 SwTextBoxHelper::getOrdNum ( const SdrObject pObject)
static

Get the order of the shape, excluding TextBoxes.

Definition at line 216 of file textboxhelper.cxx.

References SdrObject::GetOrdNum(), SdrObject::getSdrPageFromSdrObject(), i, SdrObject::IsTextBox(), and SAL_WARN.

Referenced by SwXShape::getPropertyValue().

SwFrameFormat * SwTextBoxHelper::getOtherTextBoxFormat ( const SwFrameFormat pFormat,
sal_uInt16  nType 
)
static
static SwFrameFormat* SwTextBoxHelper::getOtherTextBoxFormat ( css::uno::Reference< css::drawing::XShape > const &  xShape)
static

If we have an associated TextFrame, then return that.

void SwTextBoxHelper::getProperty ( SwFrameFormat const *  pShape,
sal_uInt16  nWID,
sal_uInt8  nMemberID,
css::uno::Any &  rValue 
)
static
void SwTextBoxHelper::getShapeWrapThrough ( const SwFrameFormat pTextBox,
bool &  rWrapThrough 
)
static
tools::Rectangle SwTextBoxHelper::getTextRectangle ( SwFrameFormat pShape,
bool  bAbsolute = true 
)
static
bool SwTextBoxHelper::isTextBox ( const SwFrameFormat pFormat,
sal_uInt16  nType 
)
static
uno::Any SwTextBoxHelper::queryInterface ( const SwFrameFormat pShape,
const css::uno::Type &  rType 
)
static

Get interface of a shape's TextBox, if there is any.

Definition at line 271 of file textboxhelper.cxx.

Referenced by SwXShape::queryInterface().

void SwTextBoxHelper::resetLink ( SwFrameFormat pShape,
std::map< const SwFrameFormat *, SwFormatContent > &  rOldContent 
)
static

Reset the shape -> textbox link on the shape, and save it to the map, so it can be restored later.

Definition at line 622 of file textboxhelper.cxx.

References SwFormat::GetContent(), SwFormatContent::GetContentIdx(), RES_CNTNT, RES_DRAWFRMFMT, SwFormat::ResetFormatAttr(), and SwFormat::Which().

Referenced by sw::DocumentContentOperationsManager::CopyFlyInFlyImpl().

void SwTextBoxHelper::restoreLinks ( std::set< ZSortFly > &  rOld,
std::vector< SwFrameFormat * > &  rNew,
SavedLink rSavedLinks,
SavedContent rResetContent 
)
static

Undo the effect of saveLinks() + individual resetLink() calls.

Definition at line 633 of file textboxhelper.cxx.

References i.

Referenced by sw::DocumentContentOperationsManager::CopyFlyInFlyImpl().

void SwTextBoxHelper::saveLinks ( const SwFrameFormats rFormats,
std::map< const SwFrameFormat *, const SwFrameFormat * > &  rLinks 
)
static

Saves the current shape -> textbox links in a map, so they can be restored later.

Definition at line 612 of file textboxhelper.cxx.

References RES_DRAWFRMFMT.

Referenced by sw::DocumentContentOperationsManager::CopyFlyInFlyImpl().

void SwTextBoxHelper::syncFlyFrameAttr ( SwFrameFormat rShape,
SfxItemSet const &  rSet 
)
static
void SwTextBoxHelper::syncProperty ( SwFrameFormat pShape,
sal_uInt16  nWID,
sal_uInt8  nMemberID,
const css::uno::Any &  rValue 
)
static

Sync property of TextBox with the one of the shape.

Definition at line 420 of file textboxhelper.cxx.

References BOTTOM_BORDER_DISTANCE, CONVERT_TWIPS, SwXTextFrame::CreateXTextFrame(), FN_TEXT_RANGE, SwFormat::GetAnchor(), SwFormat::GetDoc(), tools::Rectangle::getHeight(), tools::Rectangle::getWidth(), tools::Rectangle::getX(), tools::Rectangle::getY(), tools::Rectangle::IsEmpty(), LEFT_BORDER_DISTANCE, com::sun::star::uno::makeAny(), MID_ALLOW_OVERLAP, MID_ANCHOR_ANCHORTYPE, MID_CHAIN_NEXTNAME, MID_CHAIN_PREVNAME, MID_FRMSIZE_IS_AUTO_HEIGHT, MID_FRMSIZE_REL_HEIGHT_RELATION, MID_FRMSIZE_REL_WIDTH_RELATION, MID_HORIORIENT_ORIENT, MID_HORIORIENT_POSITION, MID_HORIORIENT_RELATION, MID_L_MARGIN, MID_R_MARGIN, MID_VERTORIENT_ORIENT, MID_VERTORIENT_POSITION, MID_VERTORIENT_RELATION, RES_ANCHOR, RES_BOX, RES_CHAIN, RES_DRAWFRMFMT, RES_FRAMEDIR, RES_FRM_SIZE, RES_HORI_ORIENT, RES_LR_SPACE, RES_OPAQUE, RES_TEXT_VERT_ADJUST, RES_VERT_ORIENT, RES_WRAP_INFLUENCE_ON_OBJPOS, RIGHT_BORDER_DISTANCE, SwFormatAnchor::SetAnchor(), SwFormat::SetFormatAttr(), TOP_BORDER_DISTANCE, TWIPS_TO_MM, UNO_NAME_ALLOW_OVERLAP, UNO_NAME_BOTTOM_BORDER_DISTANCE, UNO_NAME_CHAIN_NEXT_NAME, UNO_NAME_CHAIN_PREV_NAME, UNO_NAME_FRAME_ISAUTOMATIC_HEIGHT, UNO_NAME_HORI_ORIENT, UNO_NAME_HORI_ORIENT_POSITION, UNO_NAME_HORI_ORIENT_RELATION, UNO_NAME_LEFT_BORDER_DISTANCE, UNO_NAME_LEFT_MARGIN, UNO_NAME_OPAQUE, UNO_NAME_RELATIVE_HEIGHT_RELATION, UNO_NAME_RELATIVE_WIDTH_RELATION, UNO_NAME_RIGHT_BORDER_DISTANCE, UNO_NAME_RIGHT_MARGIN, UNO_NAME_SIZE, UNO_NAME_SURROUND, UNO_NAME_TEXT_VERT_ADJUST, UNO_NAME_TOP_BORDER_DISTANCE, UNO_NAME_VERT_ORIENT, UNO_NAME_VERT_ORIENT_POSITION, UNO_NAME_VERT_ORIENT_RELATION, UNO_NAME_WRITING_MODE, and sw::XTextRangeToSwPaM().

Referenced by SwAnchoredDrawObject::GetObjBoundRect(), SwXShape::setPropertyValue(), and SwXShape::setSize().

void SwTextBoxHelper::syncProperty ( SwFrameFormat pShape,
const OUString &  rPropertyName,
const css::uno::Any &  rValue 
)
static

The documentation for this class was generated from the following files: