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 
28 class SfxItemSet;
29 class SfxItemPropertySet;
31 class SdrObject;
32 class SwTextNode;
33 class SwCursor;
34 class SwUnoCursor;
35 class SwUnoTableCursor;
36 class SwFormatColl;
37 struct SwSortOptions;
38 class SwDoc;
39 class SwRootFrame;
40 
41 namespace sw { namespace mark { class IMark; } }
42 
43 namespace com{ namespace sun{ namespace star{
44  namespace beans{
45  struct PropertyValue;
46  enum class PropertyState;
47  }
48  namespace text {
49  class XTextContent;
50  class XFlatParagraphIterator;
51  }
52 }}}
53 
55 {
60 };
61 
62 namespace SwUnoCursorHelper
63 {
65  {
66  private:
67  // keep Any's mapped by (WhichId << 16 ) + (MemberId)
68  std::map<sal_uInt32, css::uno::Any> m_Map;
69 
70  public:
71  void SetValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const css::uno::Any& rAny );
72  bool FillValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const css::uno::Any*& pAny );
73  };
74 
75  css::uno::Reference< css::text::XTextContent >
76  GetNestedTextContent(SwTextNode const & rTextNode, sal_Int32 const nIndex,
77  bool const bParent);
78 
80  , SwPaM& rPam
81  , css::uno::Any *pAny
82  , css::beans::PropertyState& eState
83  , const SwTextNode* pNode = nullptr );
84 
85  void GetCurPageStyle(SwPaM const & rPaM, OUString &rString);
86 
87  inline bool IsStartOfPara(SwPaM& rUnoCursor)
88  { return rUnoCursor.GetPoint()->nContent == 0;}
89  inline bool IsEndOfPara(SwPaM& rUnoCursor)
90  { return rUnoCursor.GetContentNode() &&
91  rUnoCursor.GetPoint()->nContent == rUnoCursor.GetContentNode()->Len();}
92 
97  void InsertFile(SwUnoCursor* pUnoCursor,
98  const OUString& rURL,
99  const css::uno::Sequence< css::beans::PropertyValue >& rOptions);
100 
102  SwPaM& rPam,
103  css::beans::PropertyState& eState,
104  css::uno::Any *pAny );
105 
107  const css::uno::Any& rValue,
108  SwPaM& rPam);
109 
110  sal_Int16 IsNodeNumStart(
111  SwPaM const & rPam,
112  css::beans::PropertyState& eState);
113 
114  bool DocInsertStringSplitCR( SwDoc &rDoc,
115  const SwPaM &rNewCursor, const OUString &rText,
116  const bool bForceExpandHints );
119  void makeRedline( SwPaM const & rPaM, const OUString& RedlineType,
120  const css::uno::Sequence< css::beans::PropertyValue >& RedlineProperties );
121 
124  void makeTableRowRedline( SwTableLine& rTableLine, const OUString& RedlineType,
125  const css::uno::Sequence< css::beans::PropertyValue >& RedlineProperties );
126 
129  SW_DLLPUBLIC void makeTableCellRedline( SwTableBox& rTableBox, const OUString& RedlineType,
130  const css::uno::Sequence< css::beans::PropertyValue >& RedlineProperties );
131 
133  void SetCursorAttr(SwPaM & rPam, const SfxItemSet & rSet,
134  const SetAttrMode nAttrMode,
135  const bool bTableMode = false);
136  void GetCursorAttr(SwPaM & rPam, SfxItemSet & rSet,
137  const bool bOnlyTextAttr = false,
138  const bool bGetFromChrFormat = true);
139  void GetTextFromPam(SwPaM & rPam, OUString & rBuffer, SwRootFrame const* pLayout = nullptr);
140  SwFormatColl * GetCurTextFormatColl(SwPaM & rPam, const bool bConditional);
141 
142  void SelectPam(SwPaM & rPam, const bool bExpand);
143  void SetString(SwCursor & rCursor, const OUString & rString);
144 
145  css::uno::Sequence< css::beans::PropertyValue >
146  CreateSortDescriptor(const bool bFromTable);
148  const css::uno::Sequence< css::beans::PropertyValue >& rDescriptor,
149  SwSortOptions & rSortOpt);
150 
156  void SetPropertyValue(
157  SwPaM& rPaM,
158  const SfxItemPropertySet & rPropSet,
159  const OUString & rPropertyName,
160  const css::uno::Any & rValue,
161  const SetAttrMode nAttrMode = SetAttrMode::DEFAULT);
167  void SetPropertyValues(
168  SwPaM& rPaM,
169  const SfxItemPropertySet & rPropSet,
170  const css::uno::Sequence< css::beans::PropertyValue > &
171  rPropertyValues,
172  const SetAttrMode nAttrMode = SetAttrMode::DEFAULT);
176  css::uno::Any GetPropertyValue(
177  SwPaM& rPaM,
178  const SfxItemPropertySet & rPropSet,
179  const OUString & rPropertyName);
182  css::uno::Sequence< css::beans::PropertyState > GetPropertyStates(
183  SwPaM & rPaM,
184  const SfxItemPropertySet & rPropSet,
185  const css::uno::Sequence< OUString >&
186  rPropertyNames,
187  const SwGetPropertyStatesCaller eCaller =
191  css::beans::PropertyState GetPropertyState(
192  SwPaM & rPaM,
193  const SfxItemPropertySet & rPropSet,
194  const OUString & rPropertyName);
198  SwPaM & rPaM,
199  const SfxItemPropertySet & rPropSet,
200  const OUString & rPropertyName);
204  css::uno::Any GetPropertyDefault(
205  SwPaM const & rPaM,
206  const SfxItemPropertySet & rPropSet,
207  const OUString & rPropertyName);
208 
209  bool SetPageDesc(
210  const css::uno::Any& rValue,
211  SwDoc & rDoc, SfxItemSet & rSet);
214  void SetTextFormatColl(const css::uno::Any & rAny, SwPaM & rPaM);
219  SfxItemPropertySimpleEntry const& rEntry,
220  css::uno::Any const& rValue,
221  SwPaM & rPam, SfxItemSet & rItemSet);
222 
227  css::uno::Reference<css::uno::XInterface> const& xIfc,
228  SwDoc & rTargetDoc,
229  SwPaM *& o_rpPaM, std::pair<OUString, FlyCntType> & o_rFrame,
230  OUString & o_rTableName, SwUnoTableCursor const*& o_rpTableCursor,
231  ::sw::mark::IMark const*& o_rpMark,
232  std::vector<SdrObject *> & o_rSdrObjects);
233 
234  css::uno::Reference<css::text::XFlatParagraphIterator>
235  CreateFlatParagraphIterator(SwDoc &, sal_Int32, bool);
236 
237 } // namespace SwUnoCursorHelper
238 
239 #endif
240 
241 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual sal_Int32 Len() const
Definition: node.cxx:1180
void makeRedline(SwPaM const &rPaM, const OUString &rRedlineType, const uno::Sequence< beans::PropertyValue > &rRedlineProperties)
uno::Reference< text::XFlatParagraphIterator > CreateFlatParagraphIterator(SwDoc &rDoc, sal_Int32 const nTextMarkupType, bool const bAutomatic)
Definition: unoflatpara.cxx:61
void getNumberingProperty(SwPaM &rPam, PropertyState &eState, Any *pAny)
Definition: doc.hxx:185
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:344
void SetPropertyValues(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const css::uno::Sequence< css::beans::PropertyValue > &rPropertyValues, const SetAttrMode nAttrMode=SetAttrMode::DEFAULT)
Dialog to specify the properties of date form field.
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)
bool ConvertSortProperties(const css::uno::Sequence< css::beans::PropertyValue > &rDescriptor, SwSortOptions &rSortOpt)
The root element of a Writer document layout.
Definition: rootfrm.hxx:79
void SetString(SwCursor &rCursor, const OUString &rString)
Definition: unoobj2.cxx:1522
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:338
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:166
css::uno::Any GetPropertyDefault(SwPaM const &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName)
Definition: unoobj.cxx:2072
bool SetCursorPropertyValue(SfxItemPropertySimpleEntry const &rEntry, css::uno::Any const &rValue, SwPaM &rPam, SfxItemSet &rItemSet)
void SelectPam(SwPaM &rPam, const bool bExpand)
Definition: unoobj.cxx:151
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:143
void SetTextFormatColl(const css::uno::Any &rAny, SwPaM &rPaM)
bool IsStartOfPara(SwPaM &rUnoCursor)
void makeTableCellRedline(SwTableBox &rTableBox, const OUString &rRedlineType, const uno::Sequence< beans::PropertyValue > &rRedlineProperties)
#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)
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
void SetPropertyToDefault(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName)
Definition: unoobj.cxx:2032
css::uno::Any GetPropertyValue(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName)
Definition: unoobj.cxx:1751
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:386
SwFormatColl * GetCurTextFormatColl(SwPaM &rPam, const bool bConditional)
Definition: unoobj.cxx:647
void SetCursorAttr(SwPaM &rPam, const SfxItemSet &rSet, const SetAttrMode nAttrMode, const bool bTableMode=false)
Definition: unoobj2.cxx:296
void GetCurPageStyle(SwPaM const &rPaM, OUString &rString)
void setNumberingProperty(const Any &rValue, SwPaM &rPam)
def text(shape, st)
bool SetPageDesc(const css::uno::Any &rValue, SwDoc &rDoc, SfxItemSet &rSet)
bool DocInsertStringSplitCR(SwDoc &rDoc, const SwPaM &rNewCursor, const OUString &rText, const bool bForceExpandHints)
css::beans::PropertyState GetPropertyState(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName)
Definition: unoobj.cxx:1999
void makeTableRowRedline(SwTableLine &rTableLine, const OUString &rRedlineType, const uno::Sequence< beans::PropertyValue > &rRedlineProperties)
sal_Int16 IsNodeNumStart(SwPaM const &rPam, PropertyState &eState)
css::uno::Sequence< css::beans::PropertyValue > CreateSortDescriptor(const bool bFromTable)
Definition: unoobj.cxx:2539