Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _UNOCRSRHELPER_HXX
29 : : #define _UNOCRSRHELPER_HXX
30 : :
31 : : #include <map>
32 : :
33 : : #include <com/sun/star/beans/XPropertyState.hpp>
34 : : #include <com/sun/star/beans/XPropertySet.hpp>
35 : :
36 : : #include <swtypes.hxx>
37 : : #include <pam.hxx>
38 : :
39 : :
40 : : class String;
41 : : class SfxItemSet;
42 : : class SfxItemPropertySet;
43 : : struct SfxItemPropertySimpleEntry;
44 : : class SwTxtNode;
45 : : class SwPaM;
46 : : class SwCursor;
47 : : class SwUnoCrsr;
48 : : class SwFmtColl;
49 : : struct SwSortOptions;
50 : : class SwDoc;
51 : :
52 : : namespace com{ namespace sun{ namespace star{
53 : : namespace uno{
54 : : class Any;
55 : : }
56 : : namespace beans{
57 : : struct PropertyValue;
58 : : }
59 : : namespace text {
60 : : class XTextContent;
61 : : }
62 : : }}}
63 : :
64 : : enum SwGetPropertyStatesCaller
65 : : {
66 : : SW_PROPERTY_STATE_CALLER_DEFAULT,
67 : : SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION,
68 : : SW_PROPERTY_STATE_CALLER_SINGLE_VALUE_ONLY,
69 : : SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT
70 : : };
71 : :
72 : : namespace SwUnoCursorHelper
73 : : {
74 : : // keep Any's mapped by (WhichId << 16 ) + (MemberId)
75 : : typedef std::map< sal_uInt32, com::sun::star::uno::Any *> AnyMapHelper_t;
76 : 695 : class SwAnyMapHelper : public AnyMapHelper_t
77 : : {
78 : : public:
79 : : ~SwAnyMapHelper();
80 : :
81 : : void SetValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const com::sun::star::uno::Any& rAny );
82 : : bool FillValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const com::sun::star::uno::Any*& pAny );
83 : : };
84 : :
85 : : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >
86 : : GetNestedTextContent(SwTxtNode & rTextNode, xub_StrLen const nIndex,
87 : : bool const bParent);
88 : :
89 : : sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
90 : : , SwPaM& rPam
91 : : , com::sun::star::uno::Any *pAny
92 : : , com::sun::star::beans::PropertyState& eState
93 : : , const SwTxtNode* pNode = 0 );
94 : :
95 : : void GetCurPageStyle(SwPaM& rPaM, String &rString);
96 : :
97 : 412 : inline sal_Bool IsStartOfPara(SwPaM& rUnoCrsr)
98 : 412 : { return rUnoCrsr.GetPoint()->nContent == 0;}
99 : 556 : inline sal_Bool IsEndOfPara(SwPaM& rUnoCrsr)
100 : 556 : { return rUnoCrsr.GetCntntNode() &&
101 [ + + ][ + - ]: 556 : rUnoCrsr.GetPoint()->nContent == rUnoCrsr.GetCntntNode()->Len();}
102 : :
103 : : void resetCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry, SwPaM& rPam);
104 : : void InsertFile(SwUnoCrsr* pUnoCrsr,
105 : : const String& rURL,
106 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rOptions
107 : : ) throw( com::sun::star::lang::IllegalArgumentException, com::sun::star::io::IOException, com::sun::star::uno::RuntimeException );
108 : :
109 : : void getNumberingProperty(
110 : : SwPaM& rPam,
111 : : com::sun::star::beans::PropertyState& eState,
112 : : com::sun::star::uno::Any *pAny );
113 : :
114 : : void setNumberingProperty(
115 : : const com::sun::star::uno::Any& rValue,
116 : : SwPaM& rPam);
117 : :
118 : : sal_Int16 IsNodeNumStart(
119 : : SwPaM& rPam,
120 : : com::sun::star::beans::PropertyState& eState);
121 : :
122 : : sal_Bool DocInsertStringSplitCR( SwDoc &rDoc,
123 : : const SwPaM &rNewCursor, const String &rText,
124 : : const bool bForceExpandHints );
125 : : void makeRedline( SwPaM& rPaM, const ::rtl::OUString& RedlineType,
126 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& RedlineProperties )
127 : : throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
128 : :
129 : :
130 : : /// @param bTableMode: attributes should be applied to a table selection
131 : : void SetCrsrAttr(SwPaM & rPam, const SfxItemSet & rSet,
132 : : const SetAttrMode nAttrMode,
133 : : const bool bTableMode = false);
134 : : void GetCrsrAttr(SwPaM & rPam, SfxItemSet & rSet,
135 : : const bool bOnlyTxtAttr = false,
136 : : const bool bGetFromChrFmt = true);
137 : : void GetTextFromPam(SwPaM & rPam, ::rtl::OUString & rBuffer);
138 : : SwFmtColl * GetCurTxtFmtColl(SwPaM & rPam, const bool bConditional);
139 : :
140 : : void SelectPam(SwPaM & rPam, const bool bExpand);
141 : : void SetString(SwCursor & rCursor, const ::rtl::OUString & rString);
142 : :
143 : : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
144 : : CreateSortDescriptor(const bool bFromTable);
145 : : sal_Bool ConvertSortProperties(
146 : : const ::com::sun::star::uno::Sequence<
147 : : ::com::sun::star::beans::PropertyValue >& rDescriptor,
148 : : SwSortOptions & rSortOpt);
149 : :
150 : : /// @param bTableMode: attributes should be applied to a table selection
151 : : void SetPropertyValue(
152 : : SwPaM& rPaM,
153 : : const SfxItemPropertySet & rPropSet,
154 : : const ::rtl::OUString & rPropertyName,
155 : : const ::com::sun::star::uno::Any & rValue,
156 : : const SetAttrMode nAttrMode = nsSetAttrMode::SETATTR_DEFAULT,
157 : : const bool bTableMode = false)
158 : : throw (::com::sun::star::beans::UnknownPropertyException,
159 : : ::com::sun::star::beans::PropertyVetoException,
160 : : ::com::sun::star::lang::IllegalArgumentException,
161 : : ::com::sun::star::lang::WrappedTargetException,
162 : : ::com::sun::star::uno::RuntimeException);
163 : : ::com::sun::star::uno::Any GetPropertyValue(
164 : : SwPaM& rPaM,
165 : : const SfxItemPropertySet & rPropSet,
166 : : const ::rtl::OUString & rPropertyName)
167 : : throw (::com::sun::star::beans::UnknownPropertyException,
168 : : ::com::sun::star::lang::WrappedTargetException,
169 : : ::com::sun::star::uno::RuntimeException);
170 : : ::com::sun::star::uno::Sequence<
171 : : ::com::sun::star::beans::PropertyState > GetPropertyStates(
172 : : SwPaM & rPaM,
173 : : const SfxItemPropertySet & rPropSet,
174 : : const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
175 : : rPropertyNames,
176 : : const SwGetPropertyStatesCaller eCaller =
177 : : SW_PROPERTY_STATE_CALLER_DEFAULT)
178 : : throw (::com::sun::star::beans::UnknownPropertyException,
179 : : ::com::sun::star::uno::RuntimeException);
180 : : ::com::sun::star::beans::PropertyState GetPropertyState(
181 : : SwPaM & rPaM,
182 : : const SfxItemPropertySet & rPropSet,
183 : : const ::rtl::OUString & rPropertyName)
184 : : throw (::com::sun::star::beans::UnknownPropertyException,
185 : : ::com::sun::star::uno::RuntimeException);
186 : : void SetPropertyToDefault(
187 : : SwPaM & rPaM,
188 : : const SfxItemPropertySet & rPropSet,
189 : : const ::rtl::OUString & rPropertyName)
190 : : throw (::com::sun::star::beans::UnknownPropertyException,
191 : : ::com::sun::star::uno::RuntimeException);
192 : : ::com::sun::star::uno::Any GetPropertyDefault(
193 : : SwPaM & rPaM,
194 : : const SfxItemPropertySet & rPropSet,
195 : : const ::rtl::OUString & rPropertyName)
196 : : throw (::com::sun::star::beans::UnknownPropertyException,
197 : : ::com::sun::star::lang::WrappedTargetException,
198 : : ::com::sun::star::uno::RuntimeException);
199 : :
200 : : bool SetPageDesc(
201 : : const ::com::sun::star::uno::Any& rValue,
202 : : SwDoc & rDoc, SfxItemSet & rSet);
203 : : void SetTxtFmtColl(const ::com::sun::star::uno::Any & rAny, SwPaM & rPaM)
204 : : throw (::com::sun::star::lang::IllegalArgumentException);
205 : : bool SetCursorPropertyValue(
206 : : SfxItemPropertySimpleEntry const& rEntry,
207 : : ::com::sun::star::uno::Any const& rValue,
208 : : SwPaM & rPam, SfxItemSet & rItemSet)
209 : : throw (::com::sun::star::lang::IllegalArgumentException);
210 : :
211 : : } // namespace SwUnoCursorHelper
212 : :
213 : : #endif
214 : :
215 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|