LibreOffice Module sw (master) 1
unocrsrhelper.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 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19#ifndef INCLUDED_SW_INC_UNOCRSRHELPER_HXX
20#define INCLUDED_SW_INC_UNOCRSRHELPER_HXX
21
22#include "swtypes.hxx"
23#include "flyenum.hxx"
24#include "pam.hxx"
25
26#include <map>
27#include <string_view>
28
29class SfxItemSet;
32class SdrObject;
33class SwTextNode;
34class SwCursor;
35class SwUnoCursor;
37class SwFormatColl;
38struct SwSortOptions;
39class SwDoc;
40class SwRootFrame;
41
42namespace sw::mark { class IMark; }
43
44namespace com::sun::star{
45 namespace beans{
46 struct PropertyValue;
47 enum class PropertyState;
48 }
49 namespace text {
50 class XTextContent;
51 class XFlatParagraphIterator;
52 }
53}
54
56{
61};
62
63namespace SwUnoCursorHelper
64{
66 {
67 private:
68 // keep Any's mapped by (WhichId << 16 ) + (MemberId)
69 std::map<sal_uInt32, css::uno::Any> m_Map;
70
71 public:
72 void SetValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const css::uno::Any& rAny );
73 bool FillValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const css::uno::Any*& pAny );
74 };
75
76 css::uno::Reference< css::text::XTextContent >
77 GetNestedTextContent(SwTextNode const & rTextNode, sal_Int32 const nIndex,
78 bool const bParent);
79
81 , SwPaM& rPam
82 , css::uno::Any *pAny
83 , css::beans::PropertyState& eState
84 , const SwTextNode* pNode = nullptr );
85
86 void GetCurPageStyle(SwPaM const & rPaM, OUString &rString);
87
88 inline bool IsStartOfPara(SwPaM& rUnoCursor)
89 { return rUnoCursor.GetPoint()->GetContentIndex() == 0;}
90 inline bool IsEndOfPara(SwPaM& rUnoCursor)
91 { return rUnoCursor.GetPointContentNode() &&
92 rUnoCursor.GetPoint()->GetContentIndex() == rUnoCursor.GetPointContentNode()->Len();}
93
98 void InsertFile(SwUnoCursor* pUnoCursor,
99 const OUString& rURL,
100 const css::uno::Sequence< css::beans::PropertyValue >& rOptions);
101
103 SwPaM& rPam,
104 css::beans::PropertyState& eState,
105 css::uno::Any *pAny );
106
108 const css::uno::Any& rValue,
109 SwPaM& rPam);
110
111 sal_Int16 IsNodeNumStart(
112 SwPaM const & rPam,
113 css::beans::PropertyState& eState);
114
115 bool DocInsertStringSplitCR( SwDoc &rDoc,
116 const SwPaM &rNewCursor, std::u16string_view aText,
117 const bool bForceExpandHints );
120 void makeRedline( SwPaM const & rPaM, std::u16string_view RedlineType,
121 const css::uno::Sequence< css::beans::PropertyValue >& RedlineProperties );
122
125 void makeTableRowRedline( SwTableLine& rTableLine, std::u16string_view RedlineType,
126 const css::uno::Sequence< css::beans::PropertyValue >& RedlineProperties );
127
130 SW_DLLPUBLIC void makeTableCellRedline( SwTableBox& rTableBox, std::u16string_view RedlineType,
131 const css::uno::Sequence< css::beans::PropertyValue >& RedlineProperties );
132
134 void SetCursorAttr(SwPaM & rPam, const SfxItemSet & rSet,
135 const SetAttrMode nAttrMode,
136 const bool bTableMode = false);
137 void GetCursorAttr(SwPaM & rPam, SfxItemSet & rSet,
138 const bool bOnlyTextAttr = false,
139 const bool bGetFromChrFormat = true);
140 void GetTextFromPam(SwPaM & rPam, OUString & rBuffer, SwRootFrame const* pLayout = nullptr);
141 SwFormatColl * GetCurTextFormatColl(SwPaM & rPam, const bool bConditional);
142
143 void SelectPam(SwPaM & rPam, const bool bExpand);
144 void SetString(SwCursor & rCursor, std::u16string_view aString);
145
146 css::uno::Sequence< css::beans::PropertyValue >
147 CreateSortDescriptor(const bool bFromTable);
149 const css::uno::Sequence< css::beans::PropertyValue >& rDescriptor,
150 SwSortOptions & rSortOpt);
151
158 SwPaM& rPaM,
159 const SfxItemPropertySet & rPropSet,
160 const OUString & rPropertyName,
161 const css::uno::Any & rValue,
162 const SetAttrMode nAttrMode = SetAttrMode::DEFAULT);
169 SwPaM& rPaM,
170 const SfxItemPropertySet & rPropSet,
171 const css::uno::Sequence< css::beans::PropertyValue > &
172 rPropertyValues,
173 const SetAttrMode nAttrMode = SetAttrMode::DEFAULT);
175 SwPaM& rPaM,
176 const SfxItemPropertySet & rPropSet,
178 const SetAttrMode nAttrMode = SetAttrMode::DEFAULT);
182 css::uno::Any GetPropertyValue(
183 SwPaM& rPaM,
184 const SfxItemPropertySet & rPropSet,
185 std::u16string_view rPropertyName);
188 css::uno::Sequence< css::beans::PropertyState > GetPropertyStates(
189 SwPaM & rPaM,
190 const SfxItemPropertySet & rPropSet,
191 const css::uno::Sequence< OUString >&
192 rPropertyNames,
193 const SwGetPropertyStatesCaller eCaller =
197 css::beans::PropertyState GetPropertyState(
198 SwPaM & rPaM,
199 const SfxItemPropertySet & rPropSet,
200 const OUString & rPropertyName);
204 SwPaM & rPaM,
205 const SfxItemPropertySet & rPropSet,
206 std::u16string_view rPropertyName);
210 css::uno::Any GetPropertyDefault(
211 SwPaM const & rPaM,
212 const SfxItemPropertySet & rPropSet,
213 std::u16string_view rPropertyName);
214
216 const css::uno::Any& rValue,
217 SwDoc & rDoc, SfxItemSet & rSet);
220 void SetTextFormatColl(const css::uno::Any & rAny, SwPaM & rPaM);
225 SfxItemPropertyMapEntry const& rEntry,
226 css::uno::Any const& rValue,
227 SwPaM & rPam, SfxItemSet & rItemSet);
228
233 css::uno::Reference<css::uno::XInterface> const& xIfc,
234 SwDoc & rTargetDoc,
235 SwPaM *& o_rpPaM, std::pair<OUString, FlyCntType> & o_rFrame,
236 OUString & o_rTableName, SwUnoTableCursor const*& o_rpTableCursor,
237 ::sw::mark::IMark const*& o_rpMark,
238 std::vector<SdrObject *> & o_rSdrObjects);
239
240 css::uno::Reference<css::text::XFlatParagraphIterator>
241 CreateFlatParagraphIterator(SwDoc &, sal_Int32, bool);
242
243} // namespace SwUnoCursorHelper
244
245#endif
246
247/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual sal_Int32 Len() const
Definition: node.cxx:1256
Definition: doc.hxx:197
SwFormatColl is just an SwFormat subclass that defaults to m_bAutoFormat=false, expressing that this ...
Definition: fmtcol.hxx:38
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
SwContentNode * GetPointContentNode() const
Definition: pam.hxx:279
const SwPosition * GetPoint() const
Definition: pam.hxx:253
The root element of a Writer document layout.
Definition: rootfrm.hxx:85
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:443
SwTableLine is one table row in the document model.
Definition: swtable.hxx:376
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
bool FillValue(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const css::uno::Any *&pAny)
std::map< sal_uInt32, css::uno::Any > m_Map
void SetValue(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const css::uno::Any &rAny)
RedlineType
def text(shape, orig_st)
void makeTableCellRedline(SwTableBox &rTableBox, std::u16string_view rRedlineType, const uno::Sequence< beans::PropertyValue > &rRedlineProperties)
void GetCurPageStyle(SwPaM const &rPaM, OUString &rString)
void SetPropertyValue(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName, const css::uno::Any &rValue, const SetAttrMode nAttrMode=SetAttrMode::DEFAULT)
void SetPropertyValues(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const css::uno::Sequence< css::beans::PropertyValue > &rPropertyValues, const SetAttrMode nAttrMode=SetAttrMode::DEFAULT)
bool SetCursorPropertyValue(SfxItemPropertyMapEntry const &rEntry, css::uno::Any const &rValue, SwPaM &rPam, SfxItemSet &rItemSet)
sal_Int16 IsNodeNumStart(SwPaM const &rPam, PropertyState &eState)
SwFormatColl * GetCurTextFormatColl(SwPaM &rPam, const bool bConditional)
Definition: unoobj.cxx:634
void SetCursorAttr(SwPaM &rPam, const SfxItemSet &rSet, const SetAttrMode nAttrMode, const bool bTableMode=false)
Definition: unoobj2.cxx:250
void setNumberingProperty(const Any &rValue, SwPaM &rPam)
void getNumberingProperty(SwPaM &rPam, PropertyState &eState, Any *pAny)
css::beans::PropertyState GetPropertyState(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName)
Definition: unoobj.cxx:2114
uno::Reference< text::XTextContent > GetNestedTextContent(SwTextNode const &rTextNode, sal_Int32 const nIndex, bool const bParent)
void makeRedline(SwPaM const &rPaM, std::u16string_view rRedlineType, const uno::Sequence< beans::PropertyValue > &rRedlineProperties)
css::uno::Sequence< css::beans::PropertyValue > CreateSortDescriptor(const bool bFromTable)
Definition: unoobj.cxx:2722
void GetCursorAttr(SwPaM &rPam, SfxItemSet &rSet, const bool bOnlyTextAttr=false, const bool bGetFromChrFormat=true)
Definition: unoobj2.cxx:292
bool DocInsertStringSplitCR(SwDoc &rDoc, const SwPaM &rNewCursor, std::u16string_view rText, const bool bForceExpandHints)
void SetPropertyToDefault(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, std::u16string_view rPropertyName)
Definition: unoobj.cxx:2147
void SetTextFormatColl(const css::uno::Any &rAny, SwPaM &rPaM)
void makeTableRowRedline(SwTableLine &rTableLine, std::u16string_view rRedlineType, const uno::Sequence< beans::PropertyValue > &rRedlineProperties)
bool IsStartOfPara(SwPaM &rUnoCursor)
void SetString(SwCursor &rCursor, std::u16string_view aString)
Definition: unoobj2.cxx:1647
css::uno::Any GetPropertyValue(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, std::u16string_view rPropertyName)
Definition: unoobj.cxx:1853
bool getCursorPropertyValue(const SfxItemPropertyMapEntry &rEntry, SwPaM &rPam, Any *pAny, PropertyState &eState, const SwTextNode *pNode)
uno::Reference< text::XFlatParagraphIterator > CreateFlatParagraphIterator(SwDoc &rDoc, sal_Int32 const nTextMarkupType, bool const bAutomatic)
Definition: unoflatpara.cxx:60
void GetTextFromPam(SwPaM &rPam, OUString &rBuffer, SwRootFrame const *pLayout=nullptr)
Definition: unoobj.cxx:135
bool ConvertSortProperties(const css::uno::Sequence< css::beans::PropertyValue > &rDescriptor, SwSortOptions &rSortOpt)
bool IsEndOfPara(SwPaM &rUnoCursor)
void resetCursorPropertyValue(const SfxItemPropertyMapEntry &rEntry, SwPaM &rPam)
css::uno::Sequence< css::beans::PropertyState > GetPropertyStates(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const css::uno::Sequence< OUString > &rPropertyNames, const SwGetPropertyStatesCaller eCaller=SW_PROPERTY_STATE_CALLER_DEFAULT)
void SelectPam(SwPaM &rPam, const bool bExpand)
Definition: unoobj.cxx:120
void InsertFile(SwUnoCursor *pUnoCursor, const OUString &rURL, const uno::Sequence< beans::PropertyValue > &rOptions)
void GetSelectableFromAny(uno::Reference< uno::XInterface > const &xIfc, SwDoc &rTargetDoc, SwPaM *&o_rpPaM, std::pair< OUString, FlyCntType > &o_rFrame, OUString &o_rTableName, SwUnoTableCursor const *&o_rpTableCursor, ::sw::mark::IMark const *&o_rpMark, std::vector< SdrObject * > &o_rSdrObjects)
css::uno::Any GetPropertyDefault(SwPaM const &rPaM, const SfxItemPropertySet &rPropSet, std::u16string_view rPropertyName)
Definition: unoobj.cxx:2186
bool SetPageDesc(const css::uno::Any &rValue, SwDoc &rDoc, SfxItemSet &rSet)
sal_Int32 GetContentIndex() const
Definition: pam.hxx:85
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
SetAttrMode
Definition: swtypes.hxx:133
SwGetPropertyStatesCaller
@ SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT
@ SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION
@ SW_PROPERTY_STATE_CALLER_SINGLE_VALUE_ONLY
@ SW_PROPERTY_STATE_CALLER_DEFAULT