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;
32 class SdrObject;
33 class SwTextNode;
34 class SwCursor;
35 class SwUnoCursor;
36 class SwUnoTableCursor;
37 class SwFormatColl;
38 struct SwSortOptions;
39 class SwDoc;
40 class SwRootFrame;
41 
42 namespace sw::mark { class IMark; }
43 
44 namespace 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 
63 namespace 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()->nContent == 0;}
90  inline bool IsEndOfPara(SwPaM& rUnoCursor)
91  { return rUnoCursor.GetContentNode() &&
92  rUnoCursor.GetPoint()->nContent == rUnoCursor.GetContentNode()->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 
157  void SetPropertyValue(
158  SwPaM& rPaM,
159  const SfxItemPropertySet & rPropSet,
160  const OUString & rPropertyName,
161  const css::uno::Any & rValue,
162  const SetAttrMode nAttrMode = SetAttrMode::DEFAULT);
168  void SetPropertyValues(
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 
210  bool SetPageDesc(
211  const css::uno::Any& rValue,
212  SwDoc & rDoc, SfxItemSet & rSet);
215  void SetTextFormatColl(const css::uno::Any & rAny, SwPaM & rPaM);
220  SfxItemPropertySimpleEntry 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:1241
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:186
void resetCursorPropertyValue(const SfxItemPropertySimpleEntry &rEntry, SwPaM &rPam)
bool getCursorPropertyValue(const SfxItemPropertySimpleEntry &rEntry, SwPaM &rPam, Any *pAny, PropertyState &eState, const SwTextNode *pNode)
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 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:2044
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:1648
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
bool SetCursorPropertyValue(SfxItemPropertySimpleEntry const &rEntry, css::uno::Any const &rValue, SwPaM &rPam, SfxItemSet &rItemSet)
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:2005
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:135
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:1724
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:80
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:1972
sal_Int16 IsNodeNumStart(SwPaM const &rPam, PropertyState &eState)
css::uno::Sequence< css::beans::PropertyValue > CreateSortDescriptor(const bool bFromTable)
Definition: unoobj.cxx:2512