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 
20 #include "swdllapi.h"
21 
22 class SdrPage;
23 class SdrObject;
24 class SfxItemSet;
25 class SwFrameFormat;
26 class SwFrameFormats;
27 class SwFormatContent;
28 class SwDoc;
29 namespace tools
30 {
31 class Rectangle;
32 }
33 class ZSortFly;
35 {
36 class XShape;
37 }
38 
46 {
47 public:
49  using SavedLink = std::map<const SwFrameFormat*, const SwFrameFormat*>;
51  using SavedContent = std::map<const SwFrameFormat*, SwFormatContent>;
53  static void create(SwFrameFormat* pShape);
55  static void destroy(SwFrameFormat* pShape);
57  static css::uno::Any queryInterface(const SwFrameFormat* pShape, const css::uno::Type& rType);
58 
60  static void syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID,
61  const css::uno::Any& rValue);
63  static void syncProperty(SwFrameFormat* pShape, const OUString& rPropertyName,
64  const css::uno::Any& rValue);
66  static void getProperty(SwFrameFormat const* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID,
67  css::uno::Any& rValue);
68 
70  static void syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet const& rSet);
71 
73  static void updateTextBoxMargin(SdrObject* pObj);
74 
83  static SwFrameFormat* getOtherTextBoxFormat(const SwFrameFormat* pFormat, sal_uInt16 nType);
85  static SwFrameFormat*
86  getOtherTextBoxFormat(css::uno::Reference<css::drawing::XShape> const& xShape);
88  static tools::Rectangle getTextRectangle(SwFrameFormat* pShape, bool bAbsolute = true);
89 
99  static bool isTextBox(const SwFrameFormat* pFormat, sal_uInt16 nType);
100 
102  static bool hasTextFrame(const SdrObject* pObj);
103 
105  static sal_Int32 getCount(const SwDoc& rDoc);
107  static sal_Int32 getCount(SdrPage const* pPage);
111  static css::uno::Any getByIndex(SdrPage const* pPage, sal_Int32 nIndex);
113  static sal_Int32 getOrdNum(const SdrObject* pObject);
115  static void getShapeWrapThrough(const SwFrameFormat* pTextBox, bool& rWrapThrough);
116 
118  static void saveLinks(const SwFrameFormats& rFormats,
119  std::map<const SwFrameFormat*, const SwFrameFormat*>& rLinks);
121  static void restoreLinks(std::set<ZSortFly>& rOld, std::vector<SwFrameFormat*>& rNew,
122  SavedLink& rSavedLinks);
123 };
124 
125 #endif // INCLUDED_SW_INC_TEXTBOXHELPER_HXX
126 
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: doc.hxx:184
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:57
#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
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)