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, const OUString &rText,
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, const OUString & rString);
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);
177 css::uno::Any GetPropertyValue(
178 SwPaM& rPaM,
179 const SfxItemPropertySet & rPropSet,
180 std::u16string_view rPropertyName);
183 css::uno::Sequence< css::beans::PropertyState > GetPropertyStates(
184 SwPaM & rPaM,
185 const SfxItemPropertySet & rPropSet,
186 const css::uno::Sequence< OUString >&
187 rPropertyNames,
188 const SwGetPropertyStatesCaller eCaller =
192 css::beans::PropertyState GetPropertyState(
193 SwPaM & rPaM,
194 const SfxItemPropertySet & rPropSet,
195 const OUString & rPropertyName);
199 SwPaM & rPaM,
200 const SfxItemPropertySet & rPropSet,
201 std::u16string_view rPropertyName);
205 css::uno::Any GetPropertyDefault(
206 SwPaM const & rPaM,
207 const SfxItemPropertySet & rPropSet,
208 std::u16string_view rPropertyName);
209
211 const css::uno::Any& rValue,
212 SwDoc & rDoc, SfxItemSet & rSet);
215 void SetTextFormatColl(const css::uno::Any & rAny, SwPaM & rPaM);
220 SfxItemPropertyMapEntry const& rEntry,
221 css::uno::Any const& rValue,
222 SwPaM & rPam, SfxItemSet & rItemSet);
223
228 css::uno::Reference<css::uno::XInterface> const& xIfc,
229 SwDoc & rTargetDoc,
230 SwPaM *& o_rpPaM, std::pair<OUString, FlyCntType> & o_rFrame,
231 OUString & o_rTableName, SwUnoTableCursor const*& o_rpTableCursor,
232 ::sw::mark::IMark const*& o_rpMark,
233 std::vector<SdrObject *> & o_rSdrObjects);
234
235 css::uno::Reference<css::text::XFlatParagraphIterator>
236 CreateFlatParagraphIterator(SwDoc &, sal_Int32, bool);
237
238} // namespace SwUnoCursorHelper
239
240#endif
241
242/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual sal_Int32 Len() const
Definition: node.cxx:1257
Definition: doc.hxx:192
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
SwContentNode * GetPointContentNode() const
Definition: pam.hxx:287
const SwPosition * GetPoint() const
Definition: pam.hxx:261
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:419
SwTableLine is one table row in the document model.
Definition: swtable.hxx:358
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:89
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:614
void SetCursorAttr(SwPaM &rPam, const SfxItemSet &rSet, const SetAttrMode nAttrMode, const bool bTableMode=false)
Definition: unoobj2.cxx:253
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:2092
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)
bool DocInsertStringSplitCR(SwDoc &rDoc, const SwPaM &rNewCursor, const OUString &rText, const bool bForceExpandHints)
css::uno::Sequence< css::beans::PropertyValue > CreateSortDescriptor(const bool bFromTable)
Definition: unoobj.cxx:2641
void GetCursorAttr(SwPaM &rPam, SfxItemSet &rSet, const bool bOnlyTextAttr=false, const bool bGetFromChrFormat=true)
Definition: unoobj2.cxx:295
void SetPropertyToDefault(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, std::u16string_view rPropertyName)
Definition: unoobj.cxx:2125
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)
css::uno::Any GetPropertyValue(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, std::u16string_view rPropertyName)
Definition: unoobj.cxx:1847
void SetString(SwCursor &rCursor, const OUString &rString)
Definition: unoobj2.cxx:1652
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:130
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:115
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:2164
bool SetPageDesc(const css::uno::Any &rValue, SwDoc &rDoc, SfxItemSet &rSet)
sal_Int32 GetContentIndex() const
Definition: pam.hxx:84
#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