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 
29 class SfxItemSet;
30 class SfxItemPropertySet;
33 class SdrObject;
34 class SwTextNode;
35 class SwCursor;
36 class SwUnoCursor;
37 class SwUnoTableCursor;
38 class SwFormatColl;
39 struct SwSortOptions;
40 class SwDoc;
41 class SwRootFrame;
42 
43 namespace sw::mark { class IMark; }
44 
45 namespace com::sun::star{
46  namespace beans{
47  struct PropertyValue;
48  enum class PropertyState;
49  }
50  namespace text {
51  class XTextContent;
52  class XFlatParagraphIterator;
53  }
54 }
55 
57 {
62 };
63 
64 namespace SwUnoCursorHelper
65 {
67  {
68  private:
69  // keep Any's mapped by (WhichId << 16 ) + (MemberId)
70  std::map<sal_uInt32, css::uno::Any> m_Map;
71 
72  public:
73  void SetValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const css::uno::Any& rAny );
74  bool FillValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const css::uno::Any*& pAny );
75  };
76 
77  css::uno::Reference< css::text::XTextContent >
78  GetNestedTextContent(SwTextNode const & rTextNode, sal_Int32 const nIndex,
79  bool const bParent);
80 
82  , SwPaM& rPam
83  , css::uno::Any *pAny
84  , css::beans::PropertyState& eState
85  , const SwTextNode* pNode = nullptr );
86 
87  void GetCurPageStyle(SwPaM const & rPaM, OUString &rString);
88 
89  inline bool IsStartOfPara(SwPaM& rUnoCursor)
90  { return rUnoCursor.GetPoint()->nContent == 0;}
91  inline bool IsEndOfPara(SwPaM& rUnoCursor)
92  { return rUnoCursor.GetContentNode() &&
93  rUnoCursor.GetPoint()->nContent == rUnoCursor.GetContentNode()->Len();}
94 
95  void resetCursorPropertyValue(const SfxItemPropertyMapEntry& rEntry, SwPaM& rPam);
99  void InsertFile(SwUnoCursor* pUnoCursor,
100  const OUString& rURL,
101  const css::uno::Sequence< css::beans::PropertyValue >& rOptions);
102 
104  SwPaM& rPam,
105  css::beans::PropertyState& eState,
106  css::uno::Any *pAny );
107 
109  const css::uno::Any& rValue,
110  SwPaM& rPam);
111 
112  sal_Int16 IsNodeNumStart(
113  SwPaM const & rPam,
114  css::beans::PropertyState& eState);
115 
116  bool DocInsertStringSplitCR( SwDoc &rDoc,
117  const SwPaM &rNewCursor, const OUString &rText,
118  const bool bForceExpandHints );
121  void makeRedline( SwPaM const & rPaM, std::u16string_view RedlineType,
122  const css::uno::Sequence< css::beans::PropertyValue >& RedlineProperties );
123 
126  void makeTableRowRedline( SwTableLine& rTableLine, std::u16string_view RedlineType,
127  const css::uno::Sequence< css::beans::PropertyValue >& RedlineProperties );
128 
131  SW_DLLPUBLIC void makeTableCellRedline( SwTableBox& rTableBox, std::u16string_view RedlineType,
132  const css::uno::Sequence< css::beans::PropertyValue >& RedlineProperties );
133 
135  void SetCursorAttr(SwPaM & rPam, const SfxItemSet & rSet,
136  const SetAttrMode nAttrMode,
137  const bool bTableMode = false);
138  void GetCursorAttr(SwPaM & rPam, SfxItemSet & rSet,
139  const bool bOnlyTextAttr = false,
140  const bool bGetFromChrFormat = true);
141  void GetTextFromPam(SwPaM & rPam, OUString & rBuffer, SwRootFrame const* pLayout = nullptr);
142  SwFormatColl * GetCurTextFormatColl(SwPaM & rPam, const bool bConditional);
143 
144  void SelectPam(SwPaM & rPam, const bool bExpand);
145  void SetString(SwCursor & rCursor, const OUString & rString);
146 
147  css::uno::Sequence< css::beans::PropertyValue >
148  CreateSortDescriptor(const bool bFromTable);
150  const css::uno::Sequence< css::beans::PropertyValue >& rDescriptor,
151  SwSortOptions & rSortOpt);
152 
158  void SetPropertyValue(
159  SwPaM& rPaM,
160  const SfxItemPropertySet & rPropSet,
161  const OUString & rPropertyName,
162  const css::uno::Any & rValue,
163  const SetAttrMode nAttrMode = SetAttrMode::DEFAULT);
169  void SetPropertyValues(
170  SwPaM& rPaM,
171  const SfxItemPropertySet & rPropSet,
172  const css::uno::Sequence< css::beans::PropertyValue > &
173  rPropertyValues,
174  const SetAttrMode nAttrMode = SetAttrMode::DEFAULT);
178  css::uno::Any GetPropertyValue(
179  SwPaM& rPaM,
180  const SfxItemPropertySet & rPropSet,
181  std::u16string_view rPropertyName);
184  css::uno::Sequence< css::beans::PropertyState > GetPropertyStates(
185  SwPaM & rPaM,
186  const SfxItemPropertySet & rPropSet,
187  const css::uno::Sequence< OUString >&
188  rPropertyNames,
189  const SwGetPropertyStatesCaller eCaller =
193  css::beans::PropertyState GetPropertyState(
194  SwPaM & rPaM,
195  const SfxItemPropertySet & rPropSet,
196  const OUString & rPropertyName);
200  SwPaM & rPaM,
201  const SfxItemPropertySet & rPropSet,
202  std::u16string_view rPropertyName);
206  css::uno::Any GetPropertyDefault(
207  SwPaM const & rPaM,
208  const SfxItemPropertySet & rPropSet,
209  std::u16string_view rPropertyName);
210 
211  bool SetPageDesc(
212  const css::uno::Any& rValue,
213  SwDoc & rDoc, SfxItemSet & rSet);
216  void SetTextFormatColl(const css::uno::Any & rAny, SwPaM & rPaM);
221  SfxItemPropertyMapEntry const& rEntry,
222  css::uno::Any const& rValue,
223  SwPaM & rPam, SfxItemSet & rItemSet);
224 
229  css::uno::Reference<css::uno::XInterface> const& xIfc,
230  SwDoc & rTargetDoc,
231  SwPaM *& o_rpPaM, std::pair<OUString, FlyCntType> & o_rFrame,
232  OUString & o_rTableName, SwUnoTableCursor const*& o_rpTableCursor,
233  ::sw::mark::IMark const*& o_rpMark,
234  std::vector<SdrObject *> & o_rSdrObjects);
235 
236  css::uno::Reference<css::text::XFlatParagraphIterator>
237  CreateFlatParagraphIterator(SwDoc &, sal_Int32, bool);
238 
239 } // namespace SwUnoCursorHelper
240 
241 #endif
242 
243 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual sal_Int32 Len() const
Definition: node.cxx:1245
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:59
void getNumberingProperty(SwPaM &rPam, PropertyState &eState, Any *pAny)
Definition: doc.hxx:187
SwTableLine is one table row in the document model.
Definition: swtable.hxx:351
void SetPropertyValues(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const css::uno::Sequence< css::beans::PropertyValue > &rPropertyValues, const SetAttrMode nAttrMode=SetAttrMode::DEFAULT)
void resetCursorPropertyValue(const SfxItemPropertyMapEntry &rEntry, SwPaM &rPam)
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:2040
bool ConvertSortProperties(const css::uno::Sequence< css::beans::PropertyValue > &rDescriptor, SwSortOptions &rSortOpt)
void makeTableCellRedline(SwTableBox &rTableBox, std::u16string_view rRedlineType, const uno::Sequence< beans::PropertyValue > &rRedlineProperties)
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
void SetString(SwCursor &rCursor, const OUString &rString)
Definition: unoobj2.cxx:1642
SwContentNode * GetContentNode(bool bPoint=true) const
Definition: pam.hxx:229
void GetCursorAttr(SwPaM &rPam, SfxItemSet &rSet, const bool bOnlyTextAttr=false, const bool bGetFromChrFormat=true)
Definition: unoobj2.cxx:296
SwIndex nContent
Definition: pam.hxx:38
void SetValue(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const css::uno::Any &rAny)
void GetTextFromPam(SwPaM &rPam, OUString &rBuffer, SwRootFrame const *pLayout=nullptr)
Definition: unoobj.cxx:126
void SelectPam(SwPaM &rPam, const bool bExpand)
Definition: unoobj.cxx:111
void SetPropertyToDefault(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, std::u16string_view rPropertyName)
Definition: unoobj.cxx:2001
exports com.sun.star. text
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
bool IsEndOfPara(SwPaM &rUnoCursor)
const SwPosition * GetPoint() const
Definition: pam.hxx:207
SetAttrMode
Definition: swtypes.hxx:137
void SetTextFormatColl(const css::uno::Any &rAny, SwPaM &rPaM)
bool IsStartOfPara(SwPaM &rUnoCursor)
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
void InsertFile(SwUnoCursor *pUnoCursor, const OUString &rURL, const uno::Sequence< beans::PropertyValue > &rOptions)
bool FillValue(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const css::uno::Any *&pAny)
exports com.sun.star. beans
css::uno::Any GetPropertyValue(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, std::u16string_view rPropertyName)
Definition: unoobj.cxx:1720
std::map< sal_uInt32, css::uno::Any > m_Map
uno::Reference< text::XTextContent > GetNestedTextContent(SwTextNode const &rTextNode, sal_Int32 const nIndex, bool const bParent)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
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)
SwGetPropertyStatesCaller
void SetPropertyValue(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName, const css::uno::Any &rValue, const SetAttrMode nAttrMode=SetAttrMode::DEFAULT)
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:392
void makeRedline(SwPaM const &rPaM, std::u16string_view rRedlineType, const uno::Sequence< beans::PropertyValue > &rRedlineProperties)
void makeTableRowRedline(SwTableLine &rTableLine, std::u16string_view rRedlineType, const uno::Sequence< beans::PropertyValue > &rRedlineProperties)
SwFormatColl * GetCurTextFormatColl(SwPaM &rPam, const bool bConditional)
Definition: unoobj.cxx:616
void SetCursorAttr(SwPaM &rPam, const SfxItemSet &rSet, const SetAttrMode nAttrMode, const bool bTableMode=false)
Definition: unoobj2.cxx:254
void GetCurPageStyle(SwPaM const &rPaM, OUString &rString)
void setNumberingProperty(const Any &rValue, SwPaM &rPam)
bool SetPageDesc(const css::uno::Any &rValue, SwDoc &rDoc, SfxItemSet &rSet)
bool DocInsertStringSplitCR(SwDoc &rDoc, const SwPaM &rNewCursor, const OUString &rText, const bool bForceExpandHints)
RedlineType
css::beans::PropertyState GetPropertyState(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName)
Definition: unoobj.cxx:1968
bool SetCursorPropertyValue(SfxItemPropertyMapEntry const &rEntry, css::uno::Any const &rValue, SwPaM &rPam, SfxItemSet &rItemSet)
sal_Int16 IsNodeNumStart(SwPaM const &rPam, PropertyState &eState)
css::uno::Sequence< css::beans::PropertyValue > CreateSortDescriptor(const bool bFromTable)
Definition: unoobj.cxx:2508