LibreOffice Module sw (master)  1
textboxhelper.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  */
9 
10 #ifndef INCLUDED_SW_INC_TEXTBOXHELPER_HXX
11 #define INCLUDED_SW_INC_TEXTBOXHELPER_HXX
12 
13 #include <map>
14 #include <set>
15 #include <vector>
16 
17 #include <com/sun/star/uno/Any.h>
18 #include <com/sun/star/uno/Type.h>
19 #include <com/sun/star/text/TextContentAnchorType.hpp>
20 #include <svx/swframetypes.hxx>
21 
22 #include "swdllapi.h"
23 
24 class SdrPage;
25 class SdrObject;
26 class SfxItemSet;
27 class SwFrameFormat;
28 class SwFrameFormats;
29 class SwFormatContent;
30 class SwDoc;
31 namespace tools
32 {
33 class Rectangle;
34 }
35 class ZSortFly;
37 {
38 class XShape;
39 }
40 namespace com::sun::star::text
41 {
42 class XTextFrame;
43 }
44 
52 {
53 public:
55  using SavedLink = std::map<const SwFrameFormat*, const SwFrameFormat*>;
57  using SavedContent = std::map<const SwFrameFormat*, SwFormatContent>;
60  static void create(SwFrameFormat* pShape, bool bCopyText = false);
62  static void destroy(SwFrameFormat* pShape);
64  static css::uno::Any queryInterface(const SwFrameFormat* pShape, const css::uno::Type& rType);
65 
67  static void syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID,
68  const css::uno::Any& rValue);
70  static void syncProperty(SwFrameFormat* pShape, std::u16string_view rPropertyName,
71  const css::uno::Any& rValue);
73  static void getProperty(SwFrameFormat const* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID,
74  css::uno::Any& rValue);
76  static css::uno::Any getProperty(SwFrameFormat const* pShape, OUString sPropName);
77 
79  static css::text::TextContentAnchorType mapAnchorType(const RndStdIds& rAnchorID);
80 
82  static void syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet const& rSet);
83 
85  static void updateTextBoxMargin(SdrObject* pObj);
86 
95  static SwFrameFormat* getOtherTextBoxFormat(const SwFrameFormat* pFormat, sal_uInt16 nType);
97  static SwFrameFormat*
98  getOtherTextBoxFormat(css::uno::Reference<css::drawing::XShape> const& xShape);
100  static css::uno::Reference<css::text::XTextFrame>
101  getUnoTextFrame(css::uno::Reference<css::drawing::XShape> const& xShape);
103  static tools::Rectangle getTextRectangle(SwFrameFormat* pShape, bool bAbsolute = true);
104 
114  static bool isTextBox(const SwFrameFormat* pFormat, sal_uInt16 nType);
115 
117  static bool hasTextFrame(const SdrObject* pObj);
118 
120  static sal_Int32 getCount(const SwDoc& rDoc);
122  static sal_Int32 getCount(SdrPage const* pPage);
126  static css::uno::Any getByIndex(SdrPage const* pPage, sal_Int32 nIndex);
128  static sal_Int32 getOrdNum(const SdrObject* pObject);
130  static void getShapeWrapThrough(const SwFrameFormat* pTextBox, bool& rWrapThrough);
131 
133  static void saveLinks(const SwFrameFormats& rFormats,
134  std::map<const SwFrameFormat*, const SwFrameFormat*>& rLinks);
136  static void restoreLinks(std::set<ZSortFly>& rOld, std::vector<SwFrameFormat*>& rNew,
137  SavedLink& rSavedLinks);
138 };
139 
140 #endif // INCLUDED_SW_INC_TEXTBOXHELPER_HXX
141 
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: doc.hxx:187
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
A TextBox is a TextFrame, that is tied to a drawinglayer shape.
std::map< const SwFrameFormat *, const SwFrameFormat * > SavedLink
Maps a draw format to a fly format.
Reference< deployment::XPackageRegistry > create(Reference< deployment::XPackageRegistry > const &xRootRegistry, OUString const &context, OUString const &cachePath, Reference< XComponentContext > const &xComponentContext)
OUString getProperty(uno::Reference< beans::XPropertyContainer > const &rxPropertyContainer, OUString const &rName)
Specific frame formats (frames, DrawObjects).
Style of a layout element.
Definition: frmfmt.hxx:58
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
Helper to copy paragraph-bound Flys.
Definition: mvsave.hxx:161
std::map< const SwFrameFormat *, SwFormatContent > SavedContent
Maps a draw format to content.
unsigned char sal_uInt8
RndStdIds
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)