update credits
[LibreOffice.git] / sw / inc / unocrsrhelper.hxx
blobb882582bf2afd0ccac601f95d0e8cdbc5ae212e5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef SW_UNOCRSRHELPER_HXX
20 #define SW_UNOCRSRHELPER_HXX
22 #include <map>
24 #include <com/sun/star/beans/XPropertyState.hpp>
25 #include <com/sun/star/beans/XPropertySet.hpp>
27 #include <swtypes.hxx>
28 #include <flyenum.hxx>
29 #include <pam.hxx>
32 class String;
33 class SfxItemSet;
34 class SfxItemPropertySet;
35 struct SfxItemPropertySimpleEntry;
36 class SdrObject;
37 class SwTxtNode;
38 class SwPaM;
39 class SwCursor;
40 class SwUnoCrsr;
41 class SwUnoTableCrsr;
42 class SwFmtColl;
43 struct SwSortOptions;
44 class SwDoc;
46 namespace sw { namespace mark { class IMark; } }
48 namespace com{ namespace sun{ namespace star{
49 namespace uno{
50 class Any;
52 namespace beans{
53 struct PropertyValue;
55 namespace text {
56 class XTextContent;
57 class XFlatParagraphIterator;
59 }}}
61 enum SwGetPropertyStatesCaller
63 SW_PROPERTY_STATE_CALLER_DEFAULT,
64 SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION,
65 SW_PROPERTY_STATE_CALLER_SINGLE_VALUE_ONLY,
66 SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT
69 namespace SwUnoCursorHelper
71 // keep Any's mapped by (WhichId << 16 ) + (MemberId)
72 typedef std::map< sal_uInt32, com::sun::star::uno::Any *> AnyMapHelper_t;
73 class SwAnyMapHelper : public AnyMapHelper_t
75 public:
76 ~SwAnyMapHelper();
78 void SetValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const com::sun::star::uno::Any& rAny );
79 bool FillValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const com::sun::star::uno::Any*& pAny );
82 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >
83 GetNestedTextContent(SwTxtNode & rTextNode, xub_StrLen const nIndex,
84 bool const bParent);
86 bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
87 , SwPaM& rPam
88 , com::sun::star::uno::Any *pAny
89 , com::sun::star::beans::PropertyState& eState
90 , const SwTxtNode* pNode = 0 );
92 void GetCurPageStyle(SwPaM& rPaM, String &rString);
94 inline sal_Bool IsStartOfPara(SwPaM& rUnoCrsr)
95 { return rUnoCrsr.GetPoint()->nContent == 0;}
96 inline sal_Bool IsEndOfPara(SwPaM& rUnoCrsr)
97 { return rUnoCrsr.GetCntntNode() &&
98 rUnoCrsr.GetPoint()->nContent == rUnoCrsr.GetCntntNode()->Len();}
100 void resetCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry, SwPaM& rPam);
101 void InsertFile(SwUnoCrsr* pUnoCrsr,
102 const String& rURL,
103 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rOptions
104 ) throw( com::sun::star::lang::IllegalArgumentException, com::sun::star::io::IOException, com::sun::star::uno::RuntimeException );
106 void getNumberingProperty(
107 SwPaM& rPam,
108 com::sun::star::beans::PropertyState& eState,
109 com::sun::star::uno::Any *pAny );
111 void setNumberingProperty(
112 const com::sun::star::uno::Any& rValue,
113 SwPaM& rPam);
115 sal_Int16 IsNodeNumStart(
116 SwPaM& rPam,
117 com::sun::star::beans::PropertyState& eState);
119 bool DocInsertStringSplitCR( SwDoc &rDoc,
120 const SwPaM &rNewCursor, const String &rText,
121 const bool bForceExpandHints );
122 void makeRedline( SwPaM& rPaM, const OUString& RedlineType,
123 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& RedlineProperties )
124 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
127 /// @param bTableMode: attributes should be applied to a table selection
128 void SetCrsrAttr(SwPaM & rPam, const SfxItemSet & rSet,
129 const SetAttrMode nAttrMode,
130 const bool bTableMode = false);
131 void GetCrsrAttr(SwPaM & rPam, SfxItemSet & rSet,
132 const bool bOnlyTxtAttr = false,
133 const bool bGetFromChrFmt = true);
134 void GetTextFromPam(SwPaM & rPam, OUString & rBuffer);
135 SwFmtColl * GetCurTxtFmtColl(SwPaM & rPam, const bool bConditional);
137 void SelectPam(SwPaM & rPam, const bool bExpand);
138 void SetString(SwCursor & rCursor, const OUString & rString);
140 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
141 CreateSortDescriptor(const bool bFromTable);
142 sal_Bool ConvertSortProperties(
143 const ::com::sun::star::uno::Sequence<
144 ::com::sun::star::beans::PropertyValue >& rDescriptor,
145 SwSortOptions & rSortOpt);
147 /// @param bTableMode: attributes should be applied to a table selection
148 void SetPropertyValue(
149 SwPaM& rPaM,
150 const SfxItemPropertySet & rPropSet,
151 const OUString & rPropertyName,
152 const ::com::sun::star::uno::Any & rValue,
153 const SetAttrMode nAttrMode = nsSetAttrMode::SETATTR_DEFAULT,
154 const bool bTableMode = false)
155 throw (::com::sun::star::beans::UnknownPropertyException,
156 ::com::sun::star::beans::PropertyVetoException,
157 ::com::sun::star::lang::IllegalArgumentException,
158 ::com::sun::star::lang::WrappedTargetException,
159 ::com::sun::star::uno::RuntimeException);
160 /// @param bTableMode: attributes should be applied to a table selection
161 void SetPropertyValues(
162 SwPaM& rPaM,
163 const SfxItemPropertySet & rPropSet,
164 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > &
165 rPropertyValues,
166 const SetAttrMode nAttrMode = nsSetAttrMode::SETATTR_DEFAULT,
167 const bool bTableMode = false)
168 throw (::com::sun::star::beans::UnknownPropertyException,
169 ::com::sun::star::beans::PropertyVetoException,
170 ::com::sun::star::lang::IllegalArgumentException,
171 ::com::sun::star::lang::WrappedTargetException,
172 ::com::sun::star::uno::RuntimeException);
173 ::com::sun::star::uno::Any GetPropertyValue(
174 SwPaM& rPaM,
175 const SfxItemPropertySet & rPropSet,
176 const OUString & rPropertyName)
177 throw (::com::sun::star::beans::UnknownPropertyException,
178 ::com::sun::star::lang::WrappedTargetException,
179 ::com::sun::star::uno::RuntimeException);
180 ::com::sun::star::uno::Sequence<
181 ::com::sun::star::beans::PropertyState > GetPropertyStates(
182 SwPaM & rPaM,
183 const SfxItemPropertySet & rPropSet,
184 const ::com::sun::star::uno::Sequence< OUString >&
185 rPropertyNames,
186 const SwGetPropertyStatesCaller eCaller =
187 SW_PROPERTY_STATE_CALLER_DEFAULT)
188 throw (::com::sun::star::beans::UnknownPropertyException,
189 ::com::sun::star::uno::RuntimeException);
190 ::com::sun::star::beans::PropertyState GetPropertyState(
191 SwPaM & rPaM,
192 const SfxItemPropertySet & rPropSet,
193 const OUString & rPropertyName)
194 throw (::com::sun::star::beans::UnknownPropertyException,
195 ::com::sun::star::uno::RuntimeException);
196 void SetPropertyToDefault(
197 SwPaM & rPaM,
198 const SfxItemPropertySet & rPropSet,
199 const OUString & rPropertyName)
200 throw (::com::sun::star::beans::UnknownPropertyException,
201 ::com::sun::star::uno::RuntimeException);
202 ::com::sun::star::uno::Any GetPropertyDefault(
203 SwPaM & rPaM,
204 const SfxItemPropertySet & rPropSet,
205 const OUString & rPropertyName)
206 throw (::com::sun::star::beans::UnknownPropertyException,
207 ::com::sun::star::lang::WrappedTargetException,
208 ::com::sun::star::uno::RuntimeException);
210 bool SetPageDesc(
211 const ::com::sun::star::uno::Any& rValue,
212 SwDoc & rDoc, SfxItemSet & rSet);
213 void SetTxtFmtColl(const ::com::sun::star::uno::Any & rAny, SwPaM & rPaM)
214 throw (::com::sun::star::lang::IllegalArgumentException);
215 bool SetCursorPropertyValue(
216 SfxItemPropertySimpleEntry const& rEntry,
217 ::com::sun::star::uno::Any const& rValue,
218 SwPaM & rPam, SfxItemSet & rItemSet)
219 throw (::com::sun::star::lang::IllegalArgumentException);
221 /// try to get something that can be selected out of the XInterface
222 /// at most one of the out parameters gets assigned a non-null value
223 /// o_rpPaM is newly allocated and must be deleted; other parameters not
224 SW_DLLPUBLIC void GetSelectableFromAny(
225 ::com::sun::star::uno::Reference<
226 ::com::sun::star::uno::XInterface> const& xIfc,
227 SwDoc & rTargetDoc,
228 SwPaM *& o_rpPaM, std::pair<OUString, FlyCntType> & o_rFrame,
229 OUString & o_rTableName, SwUnoTableCrsr const*& o_rpTableCursor,
230 ::sw::mark::IMark const*& o_rpMark,
231 std::vector<SdrObject *> & o_rSdrObjects);
233 ::com::sun::star::uno::Reference<
234 ::com::sun::star::text::XFlatParagraphIterator>
235 CreateFlatParagraphIterator(SwDoc &, sal_Int32, bool);
237 } // namespace SwUnoCursorHelper
239 #endif
241 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */