1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
20 #include "scitems.hxx"
21 #include <editeng/eeitem.hxx>
22 #include <svx/svdpool.hxx>
24 #include <svx/algitem.hxx>
25 #include <editeng/boxitem.hxx>
26 #include <editeng/brushitem.hxx>
27 #include <editeng/editeng.hxx>
28 #include <editeng/flditem.hxx>
29 #include <editeng/justifyitem.hxx>
30 #include "editeng/editobj.hxx"
31 #include <svx/fmdpage.hxx>
32 #include <editeng/langitem.hxx>
33 #include <sfx2/linkmgr.hxx>
34 #include <svl/srchitem.hxx>
35 #include <svx/unomid.hxx>
36 #include <editeng/unoprnms.hxx>
37 #include <editeng/unotext.hxx>
38 #include <svx/svdpage.hxx>
39 #include <sfx2/bindings.hxx>
40 #include <svl/zforlist.hxx>
41 #include <svl/zformat.hxx>
42 #include <comphelper/servicehelper.hxx>
43 #include <float.h> // DBL_MIN
45 #include <com/sun/star/awt/XBitmap.hpp>
46 #include <com/sun/star/util/CellProtection.hpp>
47 #include <com/sun/star/table/CellHoriJustify.hpp>
48 #include <com/sun/star/table/CellOrientation.hpp>
49 #include <com/sun/star/table/CellVertJustify2.hpp>
50 #include <com/sun/star/table/ShadowFormat.hpp>
51 #include <com/sun/star/table/TableBorder.hpp>
52 #include <com/sun/star/table/BorderLineStyle.hpp>
53 #include <com/sun/star/sheet/CellFlags.hpp>
54 #include <com/sun/star/sheet/FormulaResult.hpp>
55 #include <com/sun/star/beans/PropertyAttribute.hpp>
56 #include <com/sun/star/lang/Locale.hpp>
57 #include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
58 #include <com/sun/star/beans/SetPropertyTolerantFailed.hpp>
59 #include <com/sun/star/text/WritingMode2.hpp>
60 #include <com/sun/star/text/textfield/Type.hpp>
62 #include "autoform.hxx"
63 #include "cellmergeoption.hxx"
64 #include "cellsuno.hxx"
65 #include "cursuno.hxx"
66 #include "textuno.hxx"
67 #include "editsrc.hxx"
68 #include "notesuno.hxx"
69 #include "fielduno.hxx"
70 #include "docuno.hxx" // ScTableColumnsObj etc
71 #include "datauno.hxx"
72 #include "dapiuno.hxx"
73 #include "chartuno.hxx"
75 #include "miscuno.hxx"
76 #include "convuno.hxx"
77 #include "srchuno.hxx"
78 #include "nameuno.hxx"
79 #include "targuno.hxx"
80 #include "tokenuno.hxx"
81 #include "eventuno.hxx"
83 #include "markdata.hxx"
84 #include "patattr.hxx"
85 #include "docpool.hxx"
86 #include "docfunc.hxx"
87 #include "dbdocfun.hxx"
88 #include "olinefun.hxx"
90 #include "formulacell.hxx"
91 #include "undocell.hxx"
92 #include "undotab.hxx"
93 #include "undoblk.hxx" // fuer lcl_ApplyBorder - nach docfunc verschieben!
94 #include "stlsheet.hxx"
97 #include "chartarr.hxx"
98 #include "chartlis.hxx"
99 #include "drwlayer.hxx"
100 #include "printfun.hxx"
101 #include "prnsave.hxx"
102 #include "tablink.hxx"
103 #include "dociter.hxx"
104 #include "rangeutl.hxx"
105 #include "conditio.hxx"
106 #include "validat.hxx"
108 #include "brdcst.hxx"
109 #include "cellform.hxx"
110 #include "globstr.hrc"
111 #include "unonames.hxx"
112 #include "styleuno.hxx"
113 #include "rangeseq.hxx"
114 #include "unowids.hxx"
115 #include "paramisc.hxx"
116 #include "queryentry.hxx"
117 #include "formula/errorcodes.hxx"
118 #include "unoreflist.hxx"
119 #include "formula/grammar.hxx"
120 #include "editeng/escapementitem.hxx"
121 #include "stringutil.hxx"
122 #include "formulaiter.hxx"
123 #include "tokenarray.hxx"
124 #include "stylehelper.hxx"
125 #include "dputil.hxx"
128 #include <boost/scoped_ptr.hpp>
130 using namespace com::sun::star
;
132 //------------------------------------------------------------------------
140 ScNamedEntry(const String
& rN
, const ScRange
& rR
) :
141 aName(rN
), aRange(rR
) {}
143 const String
& GetName() const { return aName
; }
144 const ScRange
& GetRange() const { return aRange
; }
147 //------------------------------------------------------------------------
149 // The names in the maps must be sorted according to strcmp!
150 //! Instead of Which-ID 0 use special IDs and do not compare via names!
152 // Left/Right/Top/BottomBorder are mapped directly to the core items,
153 // not collected/applied to the borders of a range -> ATTR_BORDER can be used directly
155 static const SfxItemPropertySet
* lcl_GetCellsPropertySet()
157 static SfxItemPropertyMapEntry aCellsPropertyMap_Impl
[] =
159 {MAP_CHAR_LEN(SC_UNONAME_ABSNAME
), SC_WID_UNO_ABSNAME
, &getCppuType((OUString
*)0), 0 | beans::PropertyAttribute::READONLY
, 0 },
160 {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT
),ATTR_VERTICAL_ASIAN
,&getBooleanCppuType(), 0, 0 },
161 {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
162 {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
163 {MAP_CHAR_LEN(SC_UNONAME_CELLBACK
), ATTR_BACKGROUND
, &getCppuType((sal_Int32
*)0), 0, MID_BACK_COLOR
},
164 {MAP_CHAR_LEN(SC_UNONAME_CELLPRO
), ATTR_PROTECTION
, &getCppuType((util::CellProtection
*)0), 0, 0 },
165 {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL
), SC_WID_UNO_CELLSTYL
,&getCppuType((OUString
*)0), 0, 0 },
166 {MAP_CHAR_LEN(SC_UNONAME_CCOLOR
), ATTR_FONT_COLOR
, &getCppuType((sal_Int32
*)0), 0, 0 },
167 {MAP_CHAR_LEN(SC_UNONAME_COUTL
), ATTR_FONT_CONTOUR
, &getBooleanCppuType(), 0, 0 },
168 {MAP_CHAR_LEN(SC_UNONAME_CCROSS
), ATTR_FONT_CROSSEDOUT
,&getBooleanCppuType(), 0, MID_CROSSED_OUT
},
169 {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS
), ATTR_FONT_EMPHASISMARK
,&getCppuType((sal_Int16
*)0), 0, MID_EMPHASIS
},
170 {MAP_CHAR_LEN(SC_UNONAME_CFONT
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
171 {MAP_CHAR_LEN(SC_UNONAME_CFCHARS
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_CHAR_SET
},
172 {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS
), ATTR_CJK_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_CHAR_SET
},
173 {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS
), ATTR_CTL_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_CHAR_SET
},
174 {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
175 {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL
), ATTR_CJK_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
176 {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL
), ATTR_CTL_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
177 {MAP_CHAR_LEN(SC_UNONAME_CFNAME
), ATTR_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_FAMILY_NAME
},
178 {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME
), ATTR_CJK_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_FAMILY_NAME
},
179 {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME
), ATTR_CTL_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_FAMILY_NAME
},
180 {MAP_CHAR_LEN(SC_UNONAME_CFPITCH
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_PITCH
},
181 {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH
), ATTR_CJK_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_PITCH
},
182 {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH
), ATTR_CTL_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_PITCH
},
183 {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE
), ATTR_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_STYLE_NAME
},
184 {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE
), ATTR_CJK_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_STYLE_NAME
},
185 {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE
), ATTR_CTL_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_STYLE_NAME
},
186 {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT
), ATTR_FONT_HEIGHT
, &getCppuType((float*)0), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
187 {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT
), ATTR_CJK_FONT_HEIGHT
,&getCppuType((float*)0), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
188 {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT
), ATTR_CTL_FONT_HEIGHT
,&getCppuType((float*)0), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
189 {MAP_CHAR_LEN(SC_UNONAME_CLOCAL
), ATTR_FONT_LANGUAGE
, &getCppuType((lang::Locale
*)0), 0, MID_LANG_LOCALE
},
190 {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL
), ATTR_CJK_FONT_LANGUAGE
,&getCppuType((lang::Locale
*)0), 0, MID_LANG_LOCALE
},
191 {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL
), ATTR_CTL_FONT_LANGUAGE
,&getCppuType((lang::Locale
*)0), 0, MID_LANG_LOCALE
},
192 {MAP_CHAR_LEN(SC_UNONAME_COVER
), ATTR_FONT_OVERLINE
, &getCppuType((sal_Int16
*)0), 0, MID_TL_STYLE
},
193 {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL
), ATTR_FONT_OVERLINE
, &getCppuType((sal_Int32
*)0), 0, MID_TL_COLOR
},
194 {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS
), ATTR_FONT_OVERLINE
, &getBooleanCppuType(), 0, MID_TL_HASCOLOR
},
195 {MAP_CHAR_LEN(SC_UNONAME_CPOST
), ATTR_FONT_POSTURE
, &getCppuType((awt::FontSlant
*)0), 0, MID_POSTURE
},
196 {MAP_CHAR_LEN(SC_UNO_CJK_CPOST
), ATTR_CJK_FONT_POSTURE
,&getCppuType((awt::FontSlant
*)0), 0, MID_POSTURE
},
197 {MAP_CHAR_LEN(SC_UNO_CTL_CPOST
), ATTR_CTL_FONT_POSTURE
,&getCppuType((awt::FontSlant
*)0), 0, MID_POSTURE
},
198 {MAP_CHAR_LEN(SC_UNONAME_CRELIEF
), ATTR_FONT_RELIEF
, &getCppuType((sal_Int16
*)0), 0, MID_RELIEF
},
199 {MAP_CHAR_LEN(SC_UNONAME_CSHADD
), ATTR_FONT_SHADOWED
, &getBooleanCppuType(), 0, 0 },
200 {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE
), ATTR_FONT_CROSSEDOUT
,&getCppuType((sal_Int16
*)0), 0, MID_CROSS_OUT
},
201 {MAP_CHAR_LEN(SC_UNONAME_CUNDER
), ATTR_FONT_UNDERLINE
,&getCppuType((sal_Int16
*)0), 0, MID_TL_STYLE
},
202 {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL
), ATTR_FONT_UNDERLINE
,&getCppuType((sal_Int32
*)0), 0, MID_TL_COLOR
},
203 {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS
), ATTR_FONT_UNDERLINE
,&getBooleanCppuType(), 0, MID_TL_HASCOLOR
},
204 {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT
), ATTR_FONT_WEIGHT
, &getCppuType((float*)0), 0, MID_WEIGHT
},
205 {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT
), ATTR_CJK_FONT_WEIGHT
,&getCppuType((float*)0), 0, MID_WEIGHT
},
206 {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT
), ATTR_CTL_FONT_WEIGHT
,&getCppuType((float*)0), 0, MID_WEIGHT
},
207 {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD
), ATTR_FONT_WORDLINE
, &getBooleanCppuType(), 0, 0 },
208 {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR
), SC_WID_UNO_CHCOLHDR
,&getBooleanCppuType(), 0, 0 },
209 {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR
), SC_WID_UNO_CHROWHDR
,&getBooleanCppuType(), 0, 0 },
210 {MAP_CHAR_LEN(SC_UNONAME_CONDFMT
), SC_WID_UNO_CONDFMT
, &getCppuType((uno::Reference
<sheet::XSheetConditionalEntries
>*)0), 0, 0 },
211 {MAP_CHAR_LEN(SC_UNONAME_CONDLOC
), SC_WID_UNO_CONDLOC
, &getCppuType((uno::Reference
<sheet::XSheetConditionalEntries
>*)0), 0, 0 },
212 {MAP_CHAR_LEN(SC_UNONAME_CONDXML
), SC_WID_UNO_CONDXML
, &getCppuType((uno::Reference
<sheet::XSheetConditionalEntries
>*)0), 0, 0 },
213 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR
), ATTR_BORDER_BLTR
, &::getCppuType((const table::BorderLine
*)0), 0, 0 | CONVERT_TWIPS
},
214 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR2
), ATTR_BORDER_BLTR
, &::getCppuType((const table::BorderLine2
*)0), 0, 0 | CONVERT_TWIPS
},
215 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR
), ATTR_BORDER_TLBR
, &::getCppuType((const table::BorderLine
*)0), 0, 0 | CONVERT_TWIPS
},
216 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR2
), ATTR_BORDER_TLBR
, &::getCppuType((const table::BorderLine2
*)0), 0, 0 | CONVERT_TWIPS
},
217 {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS
), ATTR_HOR_JUSTIFY
, &getCppuType((table::CellHoriJustify
*)0), 0, MID_HORJUST_HORJUST
},
218 {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD
), ATTR_HOR_JUSTIFY_METHOD
, &::getCppuType((const sal_Int32
*)0), 0, 0 },
219 {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN
), ATTR_BACKGROUND
, &getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT
},
220 {MAP_CHAR_LEN(SC_UNONAME_WRAP
), ATTR_LINEBREAK
, &getBooleanCppuType(), 0, 0 },
221 {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, LEFT_BORDER
| CONVERT_TWIPS
},
222 {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, LEFT_BORDER
| CONVERT_TWIPS
},
223 {MAP_CHAR_LEN(SC_UNONAME_NUMFMT
), ATTR_VALUE_FORMAT
, &getCppuType((sal_Int32
*)0), 0, 0 },
224 {MAP_CHAR_LEN(SC_UNONAME_NUMRULES
), SC_WID_UNO_NUMRULES
,&getCppuType((const uno::Reference
<container::XIndexReplace
>*)0), 0, 0 },
225 {MAP_CHAR_LEN(SC_UNONAME_CELLORI
), ATTR_STACKED
, &getCppuType((table::CellOrientation
*)0), 0, 0 },
226 {MAP_CHAR_LEN(SC_UNONAME_PADJUST
), ATTR_HOR_JUSTIFY
, &::getCppuType((const sal_Int16
*)0), 0, MID_HORJUST_ADJUST
},
227 {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_LO_MARGIN
| CONVERT_TWIPS
},
228 {MAP_CHAR_LEN(SC_UNONAME_PINDENT
), ATTR_INDENT
, &getCppuType((sal_Int16
*)0), 0, 0 }, //! CONVERT_TWIPS
229 {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST
),ATTR_SCRIPTSPACE
, &getBooleanCppuType(), 0, 0 },
230 {MAP_CHAR_LEN(SC_UNONAME_PISFORBID
),ATTR_FORBIDDEN_RULES
,&getBooleanCppuType(), 0, 0 },
231 {MAP_CHAR_LEN(SC_UNONAME_PISHANG
), ATTR_HANGPUNCTUATION
,&getBooleanCppuType(), 0, 0 },
232 {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN
),ATTR_HYPHENATE
, &getBooleanCppuType(), 0, 0 },
233 {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ
), ATTR_HOR_JUSTIFY
, &::getCppuType((const sal_Int16
*)0), 0, MID_HORJUST_ADJUST
},
234 {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_L_MARGIN
| CONVERT_TWIPS
},
235 {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_R_MARGIN
| CONVERT_TWIPS
},
236 {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_UP_MARGIN
| CONVERT_TWIPS
},
237 {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
238 {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
239 {MAP_CHAR_LEN(SC_UNONAME_ROTANG
), ATTR_ROTATE_VALUE
, &getCppuType((sal_Int32
*)0), 0, 0 },
240 {MAP_CHAR_LEN(SC_UNONAME_ROTREF
), ATTR_ROTATE_MODE
, &getCppuType((sal_Int32
*)0), 0, 0 },
241 {MAP_CHAR_LEN(SC_UNONAME_SHADOW
), ATTR_SHADOW
, &getCppuType((table::ShadowFormat
*)0), 0, 0 | CONVERT_TWIPS
},
242 {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT
), ATTR_SHRINKTOFIT
, &getBooleanCppuType(), 0, 0 },
243 {MAP_CHAR_LEN(SC_UNONAME_TBLBORD
), SC_WID_UNO_TBLBORD
, &getCppuType((table::TableBorder
*)0), 0, 0 | CONVERT_TWIPS
},
244 {MAP_CHAR_LEN(SC_UNONAME_TBLBORD2
), SC_WID_UNO_TBLBORD2
, &getCppuType((table::TableBorder2
*)0), 0, 0 | CONVERT_TWIPS
},
245 {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, TOP_BORDER
| CONVERT_TWIPS
},
246 {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, TOP_BORDER
| CONVERT_TWIPS
},
247 {MAP_CHAR_LEN(SC_UNONAME_USERDEF
), ATTR_USERDEF
, &getCppuType((uno::Reference
<container::XNameContainer
>*)0), 0, 0 },
248 {MAP_CHAR_LEN(SC_UNONAME_VALIDAT
), SC_WID_UNO_VALIDAT
, &getCppuType((uno::Reference
<beans::XPropertySet
>*)0), 0, 0 },
249 {MAP_CHAR_LEN(SC_UNONAME_VALILOC
), SC_WID_UNO_VALILOC
, &getCppuType((uno::Reference
<beans::XPropertySet
>*)0), 0, 0 },
250 {MAP_CHAR_LEN(SC_UNONAME_VALIXML
), SC_WID_UNO_VALIXML
, &getCppuType((uno::Reference
<beans::XPropertySet
>*)0), 0, 0 },
251 {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS
), ATTR_VER_JUSTIFY
, &getCppuType((sal_Int32
*)0), 0, 0 },
252 {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD
), ATTR_VER_JUSTIFY_METHOD
, &::getCppuType((const sal_Int32
*)0), 0, 0 },
253 {MAP_CHAR_LEN(SC_UNONAME_WRITING
), ATTR_WRITINGDIR
, &getCppuType((sal_Int16
*)0), 0, 0 },
254 {MAP_CHAR_LEN(SC_UNONAME_HYPERLINK
), ATTR_HYPERLINK
, &getCppuType((OUString
*)0), 0, 0 },
257 static SfxItemPropertySet
aCellsPropertySet( aCellsPropertyMap_Impl
);
258 return &aCellsPropertySet
;
261 // CellRange enthaelt alle Eintraege von Cells, zusaetzlich eigene Eintraege
262 // mit Which-ID 0 (werden nur fuer getPropertySetInfo benoetigt).
264 static const SfxItemPropertySet
* lcl_GetRangePropertySet()
266 static SfxItemPropertyMapEntry aRangePropertyMap_Impl
[] =
268 {MAP_CHAR_LEN(SC_UNONAME_ABSNAME
), SC_WID_UNO_ABSNAME
, &getCppuType((OUString
*)0), 0 | beans::PropertyAttribute::READONLY
, 0 },
269 {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT
),ATTR_VERTICAL_ASIAN
,&getBooleanCppuType(), 0, 0 },
270 {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
271 {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
272 {MAP_CHAR_LEN(SC_UNONAME_CELLBACK
), ATTR_BACKGROUND
, &getCppuType((sal_Int32
*)0), 0, MID_BACK_COLOR
},
273 {MAP_CHAR_LEN(SC_UNONAME_CELLPRO
), ATTR_PROTECTION
, &getCppuType((util::CellProtection
*)0), 0, 0 },
274 {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL
), SC_WID_UNO_CELLSTYL
,&getCppuType((OUString
*)0), 0, 0 },
275 {MAP_CHAR_LEN(SC_UNONAME_CCOLOR
), ATTR_FONT_COLOR
, &getCppuType((sal_Int32
*)0), 0, 0 },
276 {MAP_CHAR_LEN(SC_UNONAME_COUTL
), ATTR_FONT_CONTOUR
, &getBooleanCppuType(), 0, 0 },
277 {MAP_CHAR_LEN(SC_UNONAME_CCROSS
), ATTR_FONT_CROSSEDOUT
,&getBooleanCppuType(), 0, MID_CROSSED_OUT
},
278 {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS
), ATTR_FONT_EMPHASISMARK
,&getCppuType((sal_Int16
*)0), 0, MID_EMPHASIS
},
279 {MAP_CHAR_LEN(SC_UNONAME_CFONT
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
280 {MAP_CHAR_LEN(SC_UNONAME_CFCHARS
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_CHAR_SET
},
281 {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS
), ATTR_CJK_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_CHAR_SET
},
282 {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS
), ATTR_CTL_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_CHAR_SET
},
283 {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
284 {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL
), ATTR_CJK_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
285 {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL
), ATTR_CTL_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
286 {MAP_CHAR_LEN(SC_UNONAME_CFNAME
), ATTR_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_FAMILY_NAME
},
287 {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME
), ATTR_CJK_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_FAMILY_NAME
},
288 {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME
), ATTR_CTL_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_FAMILY_NAME
},
289 {MAP_CHAR_LEN(SC_UNONAME_CFPITCH
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_PITCH
},
290 {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH
), ATTR_CJK_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_PITCH
},
291 {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH
), ATTR_CTL_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_PITCH
},
292 {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE
), ATTR_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_STYLE_NAME
},
293 {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE
), ATTR_CJK_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_STYLE_NAME
},
294 {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE
), ATTR_CTL_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_STYLE_NAME
},
295 {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT
), ATTR_FONT_HEIGHT
, &getCppuType((float*)0), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
296 {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT
), ATTR_CJK_FONT_HEIGHT
,&getCppuType((float*)0), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
297 {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT
), ATTR_CTL_FONT_HEIGHT
,&getCppuType((float*)0), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
298 {MAP_CHAR_LEN(SC_UNONAME_CLOCAL
), ATTR_FONT_LANGUAGE
, &getCppuType((lang::Locale
*)0), 0, MID_LANG_LOCALE
},
299 {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL
), ATTR_CJK_FONT_LANGUAGE
,&getCppuType((lang::Locale
*)0), 0, MID_LANG_LOCALE
},
300 {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL
), ATTR_CTL_FONT_LANGUAGE
,&getCppuType((lang::Locale
*)0), 0, MID_LANG_LOCALE
},
301 {MAP_CHAR_LEN(SC_UNONAME_COVER
), ATTR_FONT_OVERLINE
, &getCppuType((sal_Int16
*)0), 0, MID_TL_STYLE
},
302 {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL
), ATTR_FONT_OVERLINE
, &getCppuType((sal_Int32
*)0), 0, MID_TL_COLOR
},
303 {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS
), ATTR_FONT_OVERLINE
, &getBooleanCppuType(), 0, MID_TL_HASCOLOR
},
304 {MAP_CHAR_LEN(SC_UNONAME_CPOST
), ATTR_FONT_POSTURE
, &getCppuType((awt::FontSlant
*)0), 0, MID_POSTURE
},
305 {MAP_CHAR_LEN(SC_UNO_CJK_CPOST
), ATTR_CJK_FONT_POSTURE
,&getCppuType((awt::FontSlant
*)0), 0, MID_POSTURE
},
306 {MAP_CHAR_LEN(SC_UNO_CTL_CPOST
), ATTR_CTL_FONT_POSTURE
,&getCppuType((awt::FontSlant
*)0), 0, MID_POSTURE
},
307 {MAP_CHAR_LEN(SC_UNONAME_CRELIEF
), ATTR_FONT_RELIEF
, &getCppuType((sal_Int16
*)0), 0, MID_RELIEF
},
308 {MAP_CHAR_LEN(SC_UNONAME_CSHADD
), ATTR_FONT_SHADOWED
, &getBooleanCppuType(), 0, 0 },
309 {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE
), ATTR_FONT_CROSSEDOUT
,&getCppuType((sal_Int16
*)0), 0, MID_CROSS_OUT
},
310 {MAP_CHAR_LEN(SC_UNONAME_CUNDER
), ATTR_FONT_UNDERLINE
,&getCppuType((sal_Int16
*)0), 0, MID_TL_STYLE
},
311 {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL
), ATTR_FONT_UNDERLINE
,&getCppuType((sal_Int32
*)0), 0, MID_TL_COLOR
},
312 {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS
), ATTR_FONT_UNDERLINE
,&getBooleanCppuType(), 0, MID_TL_HASCOLOR
},
313 {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT
), ATTR_FONT_WEIGHT
, &getCppuType((float*)0), 0, MID_WEIGHT
},
314 {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT
), ATTR_CJK_FONT_WEIGHT
,&getCppuType((float*)0), 0, MID_WEIGHT
},
315 {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT
), ATTR_CTL_FONT_WEIGHT
,&getCppuType((float*)0), 0, MID_WEIGHT
},
316 {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD
), ATTR_FONT_WORDLINE
, &getBooleanCppuType(), 0, 0 },
317 {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR
), SC_WID_UNO_CHCOLHDR
,&getBooleanCppuType(), 0, 0 },
318 {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR
), SC_WID_UNO_CHROWHDR
,&getBooleanCppuType(), 0, 0 },
319 {MAP_CHAR_LEN(SC_UNONAME_CONDFMT
), SC_WID_UNO_CONDFMT
, &getCppuType((uno::Reference
<sheet::XSheetConditionalEntries
>*)0), 0, 0 },
320 {MAP_CHAR_LEN(SC_UNONAME_CONDLOC
), SC_WID_UNO_CONDLOC
, &getCppuType((uno::Reference
<sheet::XSheetConditionalEntries
>*)0), 0, 0 },
321 {MAP_CHAR_LEN(SC_UNONAME_CONDXML
), SC_WID_UNO_CONDXML
, &getCppuType((uno::Reference
<sheet::XSheetConditionalEntries
>*)0), 0, 0 },
322 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR
), ATTR_BORDER_BLTR
, &::getCppuType((const table::BorderLine
*)0), 0, 0 | CONVERT_TWIPS
},
323 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR2
), ATTR_BORDER_BLTR
, &::getCppuType((const table::BorderLine2
*)0), 0, 0 | CONVERT_TWIPS
},
324 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR
), ATTR_BORDER_TLBR
, &::getCppuType((const table::BorderLine
*)0), 0, 0 | CONVERT_TWIPS
},
325 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR2
), ATTR_BORDER_TLBR
, &::getCppuType((const table::BorderLine2
*)0), 0, 0 | CONVERT_TWIPS
},
326 {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS
), ATTR_HOR_JUSTIFY
, &getCppuType((table::CellHoriJustify
*)0), 0, MID_HORJUST_HORJUST
},
327 {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD
), ATTR_HOR_JUSTIFY_METHOD
, &::getCppuType((const sal_Int32
*)0), 0, 0 },
328 {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN
), ATTR_BACKGROUND
, &getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT
},
329 {MAP_CHAR_LEN(SC_UNONAME_WRAP
), ATTR_LINEBREAK
, &getBooleanCppuType(), 0, 0 },
330 {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, LEFT_BORDER
| CONVERT_TWIPS
},
331 {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, LEFT_BORDER
| CONVERT_TWIPS
},
332 {MAP_CHAR_LEN(SC_UNONAME_NUMFMT
), ATTR_VALUE_FORMAT
, &getCppuType((sal_Int32
*)0), 0, 0 },
333 {MAP_CHAR_LEN(SC_UNONAME_NUMRULES
), SC_WID_UNO_NUMRULES
,&getCppuType((const uno::Reference
<container::XIndexReplace
>*)0), 0, 0 },
334 {MAP_CHAR_LEN(SC_UNONAME_CELLORI
), ATTR_STACKED
, &getCppuType((table::CellOrientation
*)0), 0, 0 },
335 {MAP_CHAR_LEN(SC_UNONAME_PADJUST
), ATTR_HOR_JUSTIFY
, &::getCppuType((const sal_Int16
*)0), 0, MID_HORJUST_ADJUST
},
336 {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_LO_MARGIN
| CONVERT_TWIPS
},
337 {MAP_CHAR_LEN(SC_UNONAME_PINDENT
), ATTR_INDENT
, &getCppuType((sal_Int16
*)0), 0, 0 }, //! CONVERT_TWIPS
338 {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST
),ATTR_SCRIPTSPACE
, &getBooleanCppuType(), 0, 0 },
339 {MAP_CHAR_LEN(SC_UNONAME_PISFORBID
),ATTR_FORBIDDEN_RULES
,&getBooleanCppuType(), 0, 0 },
340 {MAP_CHAR_LEN(SC_UNONAME_PISHANG
), ATTR_HANGPUNCTUATION
,&getBooleanCppuType(), 0, 0 },
341 {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN
),ATTR_HYPHENATE
, &getBooleanCppuType(), 0, 0 },
342 {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ
), ATTR_HOR_JUSTIFY
, &::getCppuType((const sal_Int16
*)0), 0, MID_HORJUST_ADJUST
},
343 {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_L_MARGIN
| CONVERT_TWIPS
},
344 {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_R_MARGIN
| CONVERT_TWIPS
},
345 {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_UP_MARGIN
| CONVERT_TWIPS
},
346 {MAP_CHAR_LEN(SC_UNONAME_POS
), SC_WID_UNO_POS
, &getCppuType((awt::Point
*)0), 0 | beans::PropertyAttribute::READONLY
, 0 },
347 {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
348 {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
349 {MAP_CHAR_LEN(SC_UNONAME_ROTANG
), ATTR_ROTATE_VALUE
, &getCppuType((sal_Int32
*)0), 0, 0 },
350 {MAP_CHAR_LEN(SC_UNONAME_ROTREF
), ATTR_ROTATE_MODE
, &getCppuType((sal_Int32
*)0), 0, 0 },
351 {MAP_CHAR_LEN(SC_UNONAME_SHADOW
), ATTR_SHADOW
, &getCppuType((table::ShadowFormat
*)0), 0, 0 | CONVERT_TWIPS
},
352 {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT
), ATTR_SHRINKTOFIT
, &getBooleanCppuType(), 0, 0 },
353 {MAP_CHAR_LEN(SC_UNONAME_SIZE
), SC_WID_UNO_SIZE
, &getCppuType((awt::Size
*)0), 0 | beans::PropertyAttribute::READONLY
, 0 },
354 {MAP_CHAR_LEN(SC_UNONAME_TBLBORD
), SC_WID_UNO_TBLBORD
, &getCppuType((table::TableBorder
*)0), 0, 0 | CONVERT_TWIPS
},
355 {MAP_CHAR_LEN(SC_UNONAME_TBLBORD2
), SC_WID_UNO_TBLBORD2
, &getCppuType((table::TableBorder2
*)0), 0, 0 | CONVERT_TWIPS
},
356 {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, TOP_BORDER
| CONVERT_TWIPS
},
357 {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, TOP_BORDER
| CONVERT_TWIPS
},
358 {MAP_CHAR_LEN(SC_UNONAME_USERDEF
), ATTR_USERDEF
, &getCppuType((uno::Reference
<container::XNameContainer
>*)0), 0, 0 },
359 {MAP_CHAR_LEN(SC_UNONAME_VALIDAT
), SC_WID_UNO_VALIDAT
, &getCppuType((uno::Reference
<beans::XPropertySet
>*)0), 0, 0 },
360 {MAP_CHAR_LEN(SC_UNONAME_VALILOC
), SC_WID_UNO_VALILOC
, &getCppuType((uno::Reference
<beans::XPropertySet
>*)0), 0, 0 },
361 {MAP_CHAR_LEN(SC_UNONAME_VALIXML
), SC_WID_UNO_VALIXML
, &getCppuType((uno::Reference
<beans::XPropertySet
>*)0), 0, 0 },
362 {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS
), ATTR_VER_JUSTIFY
, &getCppuType((sal_Int32
*)0), 0, 0 },
363 {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD
), ATTR_VER_JUSTIFY_METHOD
, &::getCppuType((const sal_Int32
*)0), 0, 0 },
364 {MAP_CHAR_LEN(SC_UNONAME_WRITING
), ATTR_WRITINGDIR
, &getCppuType((sal_Int16
*)0), 0, 0 },
367 static SfxItemPropertySet
aRangePropertySet( aRangePropertyMap_Impl
);
368 return &aRangePropertySet
;
371 // Cell enthaelt alle Eintraege von CellRange, zusaetzlich eigene Eintraege
372 // mit Which-ID 0 (werden nur fuer getPropertySetInfo benoetigt).
374 static const SfxItemPropertySet
* lcl_GetCellPropertySet()
376 static SfxItemPropertyMapEntry aCellPropertyMap_Impl
[] =
378 {MAP_CHAR_LEN(SC_UNONAME_ABSNAME
), SC_WID_UNO_ABSNAME
, &getCppuType((OUString
*)0), 0 | beans::PropertyAttribute::READONLY
, 0 },
379 {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT
),ATTR_VERTICAL_ASIAN
,&getBooleanCppuType(), 0, 0 },
380 {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
381 {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
382 {MAP_CHAR_LEN(SC_UNONAME_CELLBACK
), ATTR_BACKGROUND
, &getCppuType((sal_Int32
*)0), 0, MID_BACK_COLOR
},
383 {MAP_CHAR_LEN(SC_UNONAME_CELLPRO
), ATTR_PROTECTION
, &getCppuType((util::CellProtection
*)0), 0, 0 },
384 {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL
), SC_WID_UNO_CELLSTYL
,&getCppuType((OUString
*)0), 0, 0 },
385 {MAP_CHAR_LEN(SC_UNONAME_CCOLOR
), ATTR_FONT_COLOR
, &getCppuType((sal_Int32
*)0), 0, 0 },
386 {MAP_CHAR_LEN(SC_UNONAME_COUTL
), ATTR_FONT_CONTOUR
, &getBooleanCppuType(), 0, 0 },
387 {MAP_CHAR_LEN(SC_UNONAME_CCROSS
), ATTR_FONT_CROSSEDOUT
,&getBooleanCppuType(), 0, MID_CROSSED_OUT
},
388 {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS
), ATTR_FONT_EMPHASISMARK
,&getCppuType((sal_Int16
*)0), 0, MID_EMPHASIS
},
389 {MAP_CHAR_LEN(SC_UNONAME_CFONT
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
390 {MAP_CHAR_LEN(SC_UNONAME_CFCHARS
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_CHAR_SET
},
391 {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS
), ATTR_CJK_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_CHAR_SET
},
392 {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS
), ATTR_CTL_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_CHAR_SET
},
393 {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
394 {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL
), ATTR_CJK_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
395 {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL
), ATTR_CTL_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
396 {MAP_CHAR_LEN(SC_UNONAME_CFNAME
), ATTR_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_FAMILY_NAME
},
397 {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME
), ATTR_CJK_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_FAMILY_NAME
},
398 {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME
), ATTR_CTL_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_FAMILY_NAME
},
399 {MAP_CHAR_LEN(SC_UNONAME_CFPITCH
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_PITCH
},
400 {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH
), ATTR_CJK_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_PITCH
},
401 {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH
), ATTR_CTL_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_PITCH
},
402 {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE
), ATTR_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_STYLE_NAME
},
403 {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE
), ATTR_CJK_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_STYLE_NAME
},
404 {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE
), ATTR_CTL_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_STYLE_NAME
},
405 {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT
), ATTR_FONT_HEIGHT
, &getCppuType((float*)0), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
406 {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT
), ATTR_CJK_FONT_HEIGHT
,&getCppuType((float*)0), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
407 {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT
), ATTR_CTL_FONT_HEIGHT
,&getCppuType((float*)0), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
408 {MAP_CHAR_LEN(SC_UNONAME_CLOCAL
), ATTR_FONT_LANGUAGE
, &getCppuType((lang::Locale
*)0), 0, MID_LANG_LOCALE
},
409 {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL
), ATTR_CJK_FONT_LANGUAGE
,&getCppuType((lang::Locale
*)0), 0, MID_LANG_LOCALE
},
410 {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL
), ATTR_CTL_FONT_LANGUAGE
,&getCppuType((lang::Locale
*)0), 0, MID_LANG_LOCALE
},
411 {MAP_CHAR_LEN(SC_UNONAME_COVER
), ATTR_FONT_OVERLINE
, &getCppuType((sal_Int16
*)0), 0, MID_TL_STYLE
},
412 {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL
), ATTR_FONT_OVERLINE
, &getCppuType((sal_Int32
*)0), 0, MID_TL_COLOR
},
413 {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS
), ATTR_FONT_OVERLINE
, &getBooleanCppuType(), 0, MID_TL_HASCOLOR
},
414 {MAP_CHAR_LEN(SC_UNONAME_CPOST
), ATTR_FONT_POSTURE
, &getCppuType((awt::FontSlant
*)0), 0, MID_POSTURE
},
415 {MAP_CHAR_LEN(SC_UNO_CJK_CPOST
), ATTR_CJK_FONT_POSTURE
,&getCppuType((awt::FontSlant
*)0), 0, MID_POSTURE
},
416 {MAP_CHAR_LEN(SC_UNO_CTL_CPOST
), ATTR_CTL_FONT_POSTURE
,&getCppuType((awt::FontSlant
*)0), 0, MID_POSTURE
},
417 {MAP_CHAR_LEN(SC_UNONAME_CRELIEF
), ATTR_FONT_RELIEF
, &getCppuType((sal_Int16
*)0), 0, MID_RELIEF
},
418 {MAP_CHAR_LEN(SC_UNONAME_CSHADD
), ATTR_FONT_SHADOWED
, &getBooleanCppuType(), 0, 0 },
419 {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE
), ATTR_FONT_CROSSEDOUT
,&getCppuType((sal_Int16
*)0), 0, MID_CROSS_OUT
},
420 {MAP_CHAR_LEN(SC_UNONAME_CUNDER
), ATTR_FONT_UNDERLINE
,&getCppuType((sal_Int16
*)0), 0, MID_TL_STYLE
},
421 {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL
), ATTR_FONT_UNDERLINE
,&getCppuType((sal_Int32
*)0), 0, MID_TL_COLOR
},
422 {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS
), ATTR_FONT_UNDERLINE
,&getBooleanCppuType(), 0, MID_TL_HASCOLOR
},
423 {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT
), ATTR_FONT_WEIGHT
, &getCppuType((float*)0), 0, MID_WEIGHT
},
424 {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT
), ATTR_CJK_FONT_WEIGHT
,&getCppuType((float*)0), 0, MID_WEIGHT
},
425 {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT
), ATTR_CTL_FONT_WEIGHT
,&getCppuType((float*)0), 0, MID_WEIGHT
},
426 {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD
), ATTR_FONT_WORDLINE
, &getBooleanCppuType(), 0, 0 },
427 {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR
), SC_WID_UNO_CHCOLHDR
,&getBooleanCppuType(), 0, 0 },
428 {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR
), SC_WID_UNO_CHROWHDR
,&getBooleanCppuType(), 0, 0 },
429 {MAP_CHAR_LEN(SC_UNONAME_CONDFMT
), SC_WID_UNO_CONDFMT
, &getCppuType((uno::Reference
<sheet::XSheetConditionalEntries
>*)0), 0, 0 },
430 {MAP_CHAR_LEN(SC_UNONAME_CONDLOC
), SC_WID_UNO_CONDLOC
, &getCppuType((uno::Reference
<sheet::XSheetConditionalEntries
>*)0), 0, 0 },
431 {MAP_CHAR_LEN(SC_UNONAME_CONDXML
), SC_WID_UNO_CONDXML
, &getCppuType((uno::Reference
<sheet::XSheetConditionalEntries
>*)0), 0, 0 },
432 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR
), ATTR_BORDER_BLTR
, &::getCppuType((const table::BorderLine
*)0), 0, 0 | CONVERT_TWIPS
},
433 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR2
), ATTR_BORDER_BLTR
, &::getCppuType((const table::BorderLine2
*)0), 0, 0 | CONVERT_TWIPS
},
434 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR
), ATTR_BORDER_TLBR
, &::getCppuType((const table::BorderLine
*)0), 0, 0 | CONVERT_TWIPS
},
435 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR2
), ATTR_BORDER_TLBR
, &::getCppuType((const table::BorderLine2
*)0), 0, 0 | CONVERT_TWIPS
},
436 {MAP_CHAR_LEN(SC_UNONAME_FORMLOC
), SC_WID_UNO_FORMLOC
, &getCppuType((OUString
*)0), 0, 0 },
437 {MAP_CHAR_LEN(SC_UNONAME_FORMRT
), SC_WID_UNO_FORMRT
, &getCppuType((table::CellContentType
*)0), 0 | beans::PropertyAttribute::READONLY
, 0 },
438 {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS
), ATTR_HOR_JUSTIFY
, &getCppuType((table::CellHoriJustify
*)0), 0, MID_HORJUST_HORJUST
},
439 {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD
), ATTR_HOR_JUSTIFY_METHOD
, &::getCppuType((const sal_Int32
*)0), 0, 0 },
440 {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN
), ATTR_BACKGROUND
, &getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT
},
441 {MAP_CHAR_LEN(SC_UNONAME_WRAP
), ATTR_LINEBREAK
, &getBooleanCppuType(), 0, 0 },
442 {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, LEFT_BORDER
| CONVERT_TWIPS
},
443 {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, LEFT_BORDER
| CONVERT_TWIPS
},
444 {MAP_CHAR_LEN(SC_UNONAME_NUMFMT
), ATTR_VALUE_FORMAT
, &getCppuType((sal_Int32
*)0), 0, 0 },
445 {MAP_CHAR_LEN(SC_UNONAME_NUMRULES
), SC_WID_UNO_NUMRULES
,&getCppuType((const uno::Reference
<container::XIndexReplace
>*)0), 0, 0 },
446 {MAP_CHAR_LEN(SC_UNONAME_CELLORI
), ATTR_STACKED
, &getCppuType((table::CellOrientation
*)0), 0, 0 },
447 {MAP_CHAR_LEN(SC_UNONAME_PADJUST
), ATTR_HOR_JUSTIFY
, &::getCppuType((const sal_Int16
*)0), 0, MID_HORJUST_ADJUST
},
448 {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_LO_MARGIN
| CONVERT_TWIPS
},
449 {MAP_CHAR_LEN(SC_UNONAME_PINDENT
), ATTR_INDENT
, &getCppuType((sal_Int16
*)0), 0, 0 }, //! CONVERT_TWIPS
450 {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST
),ATTR_SCRIPTSPACE
, &getBooleanCppuType(), 0, 0 },
451 {MAP_CHAR_LEN(SC_UNONAME_PISFORBID
),ATTR_FORBIDDEN_RULES
,&getBooleanCppuType(), 0, 0 },
452 {MAP_CHAR_LEN(SC_UNONAME_PISHANG
), ATTR_HANGPUNCTUATION
,&getBooleanCppuType(), 0, 0 },
453 {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN
),ATTR_HYPHENATE
, &getBooleanCppuType(), 0, 0 },
454 {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ
), ATTR_HOR_JUSTIFY
, &::getCppuType((const sal_Int16
*)0), 0, MID_HORJUST_ADJUST
},
455 {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_L_MARGIN
| CONVERT_TWIPS
},
456 {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_R_MARGIN
| CONVERT_TWIPS
},
457 {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_UP_MARGIN
| CONVERT_TWIPS
},
458 {MAP_CHAR_LEN(SC_UNONAME_POS
), SC_WID_UNO_POS
, &getCppuType((awt::Point
*)0), 0 | beans::PropertyAttribute::READONLY
, 0 },
459 {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
460 {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
461 {MAP_CHAR_LEN(SC_UNONAME_ROTANG
), ATTR_ROTATE_VALUE
, &getCppuType((sal_Int32
*)0), 0, 0 },
462 {MAP_CHAR_LEN(SC_UNONAME_ROTREF
), ATTR_ROTATE_MODE
, &getCppuType((sal_Int32
*)0), 0, 0 },
463 {MAP_CHAR_LEN(SC_UNONAME_SHADOW
), ATTR_SHADOW
, &getCppuType((table::ShadowFormat
*)0), 0, 0 | CONVERT_TWIPS
},
464 {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT
), ATTR_SHRINKTOFIT
, &getBooleanCppuType(), 0, 0 },
465 {MAP_CHAR_LEN(SC_UNONAME_SIZE
), SC_WID_UNO_SIZE
, &getCppuType((awt::Size
*)0), 0 | beans::PropertyAttribute::READONLY
, 0 },
466 {MAP_CHAR_LEN(SC_UNONAME_TBLBORD
), SC_WID_UNO_TBLBORD
, &getCppuType((table::TableBorder
*)0), 0, 0 | CONVERT_TWIPS
},
467 {MAP_CHAR_LEN(SC_UNONAME_TBLBORD2
), SC_WID_UNO_TBLBORD2
, &getCppuType((table::TableBorder2
*)0), 0, 0 | CONVERT_TWIPS
},
468 {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, TOP_BORDER
| CONVERT_TWIPS
},
469 {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, TOP_BORDER
| CONVERT_TWIPS
},
470 {MAP_CHAR_LEN(SC_UNONAME_USERDEF
), ATTR_USERDEF
, &getCppuType((uno::Reference
<container::XNameContainer
>*)0), 0, 0 },
471 {MAP_CHAR_LEN(SC_UNONAME_VALIDAT
), SC_WID_UNO_VALIDAT
, &getCppuType((uno::Reference
<beans::XPropertySet
>*)0), 0, 0 },
472 {MAP_CHAR_LEN(SC_UNONAME_VALILOC
), SC_WID_UNO_VALILOC
, &getCppuType((uno::Reference
<beans::XPropertySet
>*)0), 0, 0 },
473 {MAP_CHAR_LEN(SC_UNONAME_VALIXML
), SC_WID_UNO_VALIXML
, &getCppuType((uno::Reference
<beans::XPropertySet
>*)0), 0, 0 },
474 {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS
), ATTR_VER_JUSTIFY
, &getCppuType((sal_Int32
*)0), 0, 0 },
475 {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD
), ATTR_VER_JUSTIFY_METHOD
, &::getCppuType((const sal_Int32
*)0), 0, 0 },
476 {MAP_CHAR_LEN(SC_UNONAME_WRITING
), ATTR_WRITINGDIR
, &getCppuType((sal_Int16
*)0), 0, 0 },
477 {MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_ESCAPEMENT
), EE_CHAR_ESCAPEMENT
, &getCppuType((sal_Int32
*)0), 0, 0 },
478 {MAP_CHAR_LEN(SC_UNONAME_HYPERLINK
), ATTR_HYPERLINK
, &getCppuType((OUString
*)0), 0, 0 },
481 static SfxItemPropertySet
aCellPropertySet( aCellPropertyMap_Impl
);
482 return &aCellPropertySet
;
485 // Column und Row enthalten alle Eintraege von CellRange, zusaetzlich eigene Eintraege
486 // mit Which-ID 0 (werden nur fuer getPropertySetInfo benoetigt).
488 static const SfxItemPropertySet
* lcl_GetColumnPropertySet()
490 static SfxItemPropertyMapEntry aColumnPropertyMap_Impl
[] =
492 {MAP_CHAR_LEN(SC_UNONAME_ABSNAME
), SC_WID_UNO_ABSNAME
, &getCppuType((OUString
*)0), 0 | beans::PropertyAttribute::READONLY
, 0 },
493 {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT
),ATTR_VERTICAL_ASIAN
,&getBooleanCppuType(), 0, 0 },
494 {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
495 {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
496 {MAP_CHAR_LEN(SC_UNONAME_CELLBACK
), ATTR_BACKGROUND
, &getCppuType((sal_Int32
*)0), 0, MID_BACK_COLOR
},
497 {MAP_CHAR_LEN(SC_UNONAME_CELLPRO
), ATTR_PROTECTION
, &getCppuType((util::CellProtection
*)0), 0, 0 },
498 {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL
), SC_WID_UNO_CELLSTYL
,&getCppuType((OUString
*)0), 0, 0 },
499 {MAP_CHAR_LEN(SC_UNONAME_CCOLOR
), ATTR_FONT_COLOR
, &getCppuType((sal_Int32
*)0), 0, 0 },
500 {MAP_CHAR_LEN(SC_UNONAME_COUTL
), ATTR_FONT_CONTOUR
, &getBooleanCppuType(), 0, 0 },
501 {MAP_CHAR_LEN(SC_UNONAME_CCROSS
), ATTR_FONT_CROSSEDOUT
,&getBooleanCppuType(), 0, MID_CROSSED_OUT
},
502 {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS
), ATTR_FONT_EMPHASISMARK
,&getCppuType((sal_Int16
*)0), 0, MID_EMPHASIS
},
503 {MAP_CHAR_LEN(SC_UNONAME_CFONT
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
504 {MAP_CHAR_LEN(SC_UNONAME_CFCHARS
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_CHAR_SET
},
505 {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS
), ATTR_CJK_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_CHAR_SET
},
506 {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS
), ATTR_CTL_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_CHAR_SET
},
507 {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
508 {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL
), ATTR_CJK_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
509 {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL
), ATTR_CTL_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
510 {MAP_CHAR_LEN(SC_UNONAME_CFNAME
), ATTR_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_FAMILY_NAME
},
511 {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME
), ATTR_CJK_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_FAMILY_NAME
},
512 {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME
), ATTR_CTL_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_FAMILY_NAME
},
513 {MAP_CHAR_LEN(SC_UNONAME_CFPITCH
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_PITCH
},
514 {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH
), ATTR_CJK_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_PITCH
},
515 {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH
), ATTR_CTL_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_PITCH
},
516 {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE
), ATTR_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_STYLE_NAME
},
517 {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE
), ATTR_CJK_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_STYLE_NAME
},
518 {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE
), ATTR_CTL_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_STYLE_NAME
},
519 {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT
), ATTR_FONT_HEIGHT
, &getCppuType((float*)0), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
520 {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT
), ATTR_CJK_FONT_HEIGHT
,&getCppuType((float*)0), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
521 {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT
), ATTR_CTL_FONT_HEIGHT
,&getCppuType((float*)0), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
522 {MAP_CHAR_LEN(SC_UNONAME_CLOCAL
), ATTR_FONT_LANGUAGE
, &getCppuType((lang::Locale
*)0), 0, MID_LANG_LOCALE
},
523 {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL
), ATTR_CJK_FONT_LANGUAGE
,&getCppuType((lang::Locale
*)0), 0, MID_LANG_LOCALE
},
524 {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL
), ATTR_CTL_FONT_LANGUAGE
,&getCppuType((lang::Locale
*)0), 0, MID_LANG_LOCALE
},
525 {MAP_CHAR_LEN(SC_UNONAME_COVER
), ATTR_FONT_OVERLINE
, &getCppuType((sal_Int16
*)0), 0, MID_TL_STYLE
},
526 {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL
), ATTR_FONT_OVERLINE
, &getCppuType((sal_Int32
*)0), 0, MID_TL_COLOR
},
527 {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS
), ATTR_FONT_OVERLINE
, &getBooleanCppuType(), 0, MID_TL_HASCOLOR
},
528 {MAP_CHAR_LEN(SC_UNONAME_CPOST
), ATTR_FONT_POSTURE
, &getCppuType((awt::FontSlant
*)0), 0, MID_POSTURE
},
529 {MAP_CHAR_LEN(SC_UNO_CJK_CPOST
), ATTR_CJK_FONT_POSTURE
,&getCppuType((awt::FontSlant
*)0), 0, MID_POSTURE
},
530 {MAP_CHAR_LEN(SC_UNO_CTL_CPOST
), ATTR_CTL_FONT_POSTURE
,&getCppuType((awt::FontSlant
*)0), 0, MID_POSTURE
},
531 {MAP_CHAR_LEN(SC_UNONAME_CRELIEF
), ATTR_FONT_RELIEF
, &getCppuType((sal_Int16
*)0), 0, MID_RELIEF
},
532 {MAP_CHAR_LEN(SC_UNONAME_CSHADD
), ATTR_FONT_SHADOWED
, &getBooleanCppuType(), 0, 0 },
533 {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE
), ATTR_FONT_CROSSEDOUT
,&getCppuType((sal_Int16
*)0), 0, MID_CROSS_OUT
},
534 {MAP_CHAR_LEN(SC_UNONAME_CUNDER
), ATTR_FONT_UNDERLINE
,&getCppuType((sal_Int16
*)0), 0, MID_TL_STYLE
},
535 {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL
), ATTR_FONT_UNDERLINE
,&getCppuType((sal_Int32
*)0), 0, MID_TL_COLOR
},
536 {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS
), ATTR_FONT_UNDERLINE
,&getBooleanCppuType(), 0, MID_TL_HASCOLOR
},
537 {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT
), ATTR_FONT_WEIGHT
, &getCppuType((float*)0), 0, MID_WEIGHT
},
538 {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT
), ATTR_CJK_FONT_WEIGHT
,&getCppuType((float*)0), 0, MID_WEIGHT
},
539 {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT
), ATTR_CTL_FONT_WEIGHT
,&getCppuType((float*)0), 0, MID_WEIGHT
},
540 {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD
), ATTR_FONT_WORDLINE
, &getBooleanCppuType(), 0, 0 },
541 {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR
), SC_WID_UNO_CHCOLHDR
,&getBooleanCppuType(), 0, 0 },
542 {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR
), SC_WID_UNO_CHROWHDR
,&getBooleanCppuType(), 0, 0 },
543 {MAP_CHAR_LEN(SC_UNONAME_CONDFMT
), SC_WID_UNO_CONDFMT
, &getCppuType((uno::Reference
<sheet::XSheetConditionalEntries
>*)0), 0, 0 },
544 {MAP_CHAR_LEN(SC_UNONAME_CONDLOC
), SC_WID_UNO_CONDLOC
, &getCppuType((uno::Reference
<sheet::XSheetConditionalEntries
>*)0), 0, 0 },
545 {MAP_CHAR_LEN(SC_UNONAME_CONDXML
), SC_WID_UNO_CONDXML
, &getCppuType((uno::Reference
<sheet::XSheetConditionalEntries
>*)0), 0, 0 },
546 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR
), ATTR_BORDER_BLTR
, &::getCppuType((const table::BorderLine
*)0), 0, 0 | CONVERT_TWIPS
},
547 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR2
), ATTR_BORDER_BLTR
, &::getCppuType((const table::BorderLine2
*)0), 0, 0 | CONVERT_TWIPS
},
548 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR
), ATTR_BORDER_TLBR
, &::getCppuType((const table::BorderLine
*)0), 0, 0 | CONVERT_TWIPS
},
549 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR2
), ATTR_BORDER_TLBR
, &::getCppuType((const table::BorderLine2
*)0), 0, 0 | CONVERT_TWIPS
},
550 {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS
), ATTR_HOR_JUSTIFY
, &getCppuType((table::CellHoriJustify
*)0), 0, MID_HORJUST_HORJUST
},
551 {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD
), ATTR_HOR_JUSTIFY_METHOD
, &::getCppuType((const sal_Int32
*)0), 0, 0 },
552 {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN
), ATTR_BACKGROUND
, &getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT
},
553 {MAP_CHAR_LEN(SC_UNONAME_MANPAGE
), SC_WID_UNO_MANPAGE
, &getBooleanCppuType(), 0, 0 },
554 {MAP_CHAR_LEN(SC_UNONAME_NEWPAGE
), SC_WID_UNO_NEWPAGE
, &getBooleanCppuType(), 0, 0 },
555 {MAP_CHAR_LEN(SC_UNONAME_WRAP
), ATTR_LINEBREAK
, &getBooleanCppuType(), 0, 0 },
556 {MAP_CHAR_LEN(SC_UNONAME_CELLVIS
), SC_WID_UNO_CELLVIS
, &getBooleanCppuType(), 0, 0 },
557 {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, LEFT_BORDER
| CONVERT_TWIPS
},
558 {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, LEFT_BORDER
| CONVERT_TWIPS
},
559 {MAP_CHAR_LEN(SC_UNONAME_NUMFMT
), ATTR_VALUE_FORMAT
, &getCppuType((sal_Int32
*)0), 0, 0 },
560 {MAP_CHAR_LEN(SC_UNONAME_NUMRULES
), SC_WID_UNO_NUMRULES
,&getCppuType((const uno::Reference
<container::XIndexReplace
>*)0), 0, 0 },
561 {MAP_CHAR_LEN(SC_UNONAME_OWIDTH
), SC_WID_UNO_OWIDTH
, &getBooleanCppuType(), 0, 0 },
562 {MAP_CHAR_LEN(SC_UNONAME_CELLORI
), ATTR_STACKED
, &getCppuType((table::CellOrientation
*)0), 0, 0 },
563 {MAP_CHAR_LEN(SC_UNONAME_PADJUST
), ATTR_HOR_JUSTIFY
, &::getCppuType((const sal_Int16
*)0), 0, MID_HORJUST_ADJUST
},
564 {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_LO_MARGIN
| CONVERT_TWIPS
},
565 {MAP_CHAR_LEN(SC_UNONAME_PINDENT
), ATTR_INDENT
, &getCppuType((sal_Int16
*)0), 0, 0 }, //! CONVERT_TWIPS
566 {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST
),ATTR_SCRIPTSPACE
, &getBooleanCppuType(), 0, 0 },
567 {MAP_CHAR_LEN(SC_UNONAME_PISFORBID
),ATTR_FORBIDDEN_RULES
,&getBooleanCppuType(), 0, 0 },
568 {MAP_CHAR_LEN(SC_UNONAME_PISHANG
), ATTR_HANGPUNCTUATION
,&getBooleanCppuType(), 0, 0 },
569 {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN
),ATTR_HYPHENATE
, &getBooleanCppuType(), 0, 0 },
570 {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ
), ATTR_HOR_JUSTIFY
, &::getCppuType((const sal_Int16
*)0), 0, MID_HORJUST_ADJUST
},
571 {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_L_MARGIN
| CONVERT_TWIPS
},
572 {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_R_MARGIN
| CONVERT_TWIPS
},
573 {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_UP_MARGIN
| CONVERT_TWIPS
},
574 {MAP_CHAR_LEN(SC_UNONAME_POS
), SC_WID_UNO_POS
, &getCppuType((awt::Point
*)0), 0 | beans::PropertyAttribute::READONLY
, 0 },
575 {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
576 {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
577 {MAP_CHAR_LEN(SC_UNONAME_ROTANG
), ATTR_ROTATE_VALUE
, &getCppuType((sal_Int32
*)0), 0, 0 },
578 {MAP_CHAR_LEN(SC_UNONAME_ROTREF
), ATTR_ROTATE_MODE
, &getCppuType((sal_Int32
*)0), 0, 0 },
579 {MAP_CHAR_LEN(SC_UNONAME_SHADOW
), ATTR_SHADOW
, &getCppuType((table::ShadowFormat
*)0), 0, 0 | CONVERT_TWIPS
},
580 {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT
), ATTR_SHRINKTOFIT
, &getBooleanCppuType(), 0, 0 },
581 {MAP_CHAR_LEN(SC_UNONAME_SIZE
), SC_WID_UNO_SIZE
, &getCppuType((awt::Size
*)0), 0 | beans::PropertyAttribute::READONLY
, 0 },
582 {MAP_CHAR_LEN(SC_UNONAME_TBLBORD
), SC_WID_UNO_TBLBORD
, &getCppuType((table::TableBorder
*)0), 0, 0 | CONVERT_TWIPS
},
583 {MAP_CHAR_LEN(SC_UNONAME_TBLBORD2
), SC_WID_UNO_TBLBORD2
, &getCppuType((table::TableBorder2
*)0), 0, 0 | CONVERT_TWIPS
},
584 {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, TOP_BORDER
| CONVERT_TWIPS
},
585 {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, TOP_BORDER
| CONVERT_TWIPS
},
586 {MAP_CHAR_LEN(SC_UNONAME_USERDEF
), ATTR_USERDEF
, &getCppuType((uno::Reference
<container::XNameContainer
>*)0), 0, 0 },
587 {MAP_CHAR_LEN(SC_UNONAME_VALIDAT
), SC_WID_UNO_VALIDAT
, &getCppuType((uno::Reference
<beans::XPropertySet
>*)0), 0, 0 },
588 {MAP_CHAR_LEN(SC_UNONAME_VALILOC
), SC_WID_UNO_VALILOC
, &getCppuType((uno::Reference
<beans::XPropertySet
>*)0), 0, 0 },
589 {MAP_CHAR_LEN(SC_UNONAME_VALIXML
), SC_WID_UNO_VALIXML
, &getCppuType((uno::Reference
<beans::XPropertySet
>*)0), 0, 0 },
590 {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS
), ATTR_VER_JUSTIFY
, &getCppuType((sal_Int32
*)0), 0, 0 },
591 {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD
), ATTR_VER_JUSTIFY_METHOD
, &::getCppuType((const sal_Int32
*)0), 0, 0 },
592 {MAP_CHAR_LEN(SC_UNONAME_CELLWID
), SC_WID_UNO_CELLWID
, &getCppuType((sal_Int32
*)0), 0, 0 },
593 {MAP_CHAR_LEN(SC_UNONAME_WRITING
), ATTR_WRITINGDIR
, &getCppuType((sal_Int16
*)0), 0, 0 },
596 static SfxItemPropertySet
aColumnPropertySet( aColumnPropertyMap_Impl
);
597 return &aColumnPropertySet
;
600 static const SfxItemPropertySet
* lcl_GetRowPropertySet()
602 static SfxItemPropertyMapEntry aRowPropertyMap_Impl
[] =
604 {MAP_CHAR_LEN(SC_UNONAME_ABSNAME
), SC_WID_UNO_ABSNAME
, &getCppuType((OUString
*)0), 0 | beans::PropertyAttribute::READONLY
, 0 },
605 {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT
),ATTR_VERTICAL_ASIAN
,&getBooleanCppuType(), 0, 0 },
606 {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
607 {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
608 {MAP_CHAR_LEN(SC_UNONAME_CELLBACK
), ATTR_BACKGROUND
, &getCppuType((sal_Int32
*)0), 0, MID_BACK_COLOR
},
609 {MAP_CHAR_LEN(SC_UNONAME_CELLPRO
), ATTR_PROTECTION
, &getCppuType((util::CellProtection
*)0), 0, 0 },
610 {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL
), SC_WID_UNO_CELLSTYL
,&getCppuType((OUString
*)0), 0, 0 },
611 {MAP_CHAR_LEN(SC_UNONAME_CCOLOR
), ATTR_FONT_COLOR
, &getCppuType((sal_Int32
*)0), 0, 0 },
612 {MAP_CHAR_LEN(SC_UNONAME_COUTL
), ATTR_FONT_CONTOUR
, &getBooleanCppuType(), 0, 0 },
613 {MAP_CHAR_LEN(SC_UNONAME_CCROSS
), ATTR_FONT_CROSSEDOUT
,&getBooleanCppuType(), 0, MID_CROSSED_OUT
},
614 {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS
), ATTR_FONT_EMPHASISMARK
,&getCppuType((sal_Int16
*)0), 0, MID_EMPHASIS
},
615 {MAP_CHAR_LEN(SC_UNONAME_CFONT
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
616 {MAP_CHAR_LEN(SC_UNONAME_CFCHARS
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_CHAR_SET
},
617 {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS
), ATTR_CJK_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_CHAR_SET
},
618 {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS
), ATTR_CTL_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_CHAR_SET
},
619 {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
620 {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL
), ATTR_CJK_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
621 {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL
), ATTR_CTL_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
622 {MAP_CHAR_LEN(SC_UNONAME_CFNAME
), ATTR_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_FAMILY_NAME
},
623 {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME
), ATTR_CJK_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_FAMILY_NAME
},
624 {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME
), ATTR_CTL_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_FAMILY_NAME
},
625 {MAP_CHAR_LEN(SC_UNONAME_CFPITCH
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_PITCH
},
626 {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH
), ATTR_CJK_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_PITCH
},
627 {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH
), ATTR_CTL_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_PITCH
},
628 {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE
), ATTR_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_STYLE_NAME
},
629 {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE
), ATTR_CJK_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_STYLE_NAME
},
630 {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE
), ATTR_CTL_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_STYLE_NAME
},
631 {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT
), ATTR_FONT_HEIGHT
, &getCppuType((float*)0), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
632 {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT
), ATTR_CJK_FONT_HEIGHT
,&getCppuType((float*)0), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
633 {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT
), ATTR_CTL_FONT_HEIGHT
,&getCppuType((float*)0), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
634 {MAP_CHAR_LEN(SC_UNONAME_CLOCAL
), ATTR_FONT_LANGUAGE
, &getCppuType((lang::Locale
*)0), 0, MID_LANG_LOCALE
},
635 {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL
), ATTR_CJK_FONT_LANGUAGE
,&getCppuType((lang::Locale
*)0), 0, MID_LANG_LOCALE
},
636 {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL
), ATTR_CTL_FONT_LANGUAGE
,&getCppuType((lang::Locale
*)0), 0, MID_LANG_LOCALE
},
637 {MAP_CHAR_LEN(SC_UNONAME_COVER
), ATTR_FONT_OVERLINE
, &getCppuType((sal_Int16
*)0), 0, MID_TL_STYLE
},
638 {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL
), ATTR_FONT_OVERLINE
, &getCppuType((sal_Int32
*)0), 0, MID_TL_COLOR
},
639 {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS
), ATTR_FONT_OVERLINE
, &getBooleanCppuType(), 0, MID_TL_HASCOLOR
},
640 {MAP_CHAR_LEN(SC_UNONAME_CPOST
), ATTR_FONT_POSTURE
, &getCppuType((awt::FontSlant
*)0), 0, MID_POSTURE
},
641 {MAP_CHAR_LEN(SC_UNO_CJK_CPOST
), ATTR_CJK_FONT_POSTURE
,&getCppuType((awt::FontSlant
*)0), 0, MID_POSTURE
},
642 {MAP_CHAR_LEN(SC_UNO_CTL_CPOST
), ATTR_CTL_FONT_POSTURE
,&getCppuType((awt::FontSlant
*)0), 0, MID_POSTURE
},
643 {MAP_CHAR_LEN(SC_UNONAME_CRELIEF
), ATTR_FONT_RELIEF
, &getCppuType((sal_Int16
*)0), 0, MID_RELIEF
},
644 {MAP_CHAR_LEN(SC_UNONAME_CSHADD
), ATTR_FONT_SHADOWED
, &getBooleanCppuType(), 0, 0 },
645 {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE
), ATTR_FONT_CROSSEDOUT
,&getCppuType((sal_Int16
*)0), 0, MID_CROSS_OUT
},
646 {MAP_CHAR_LEN(SC_UNONAME_CUNDER
), ATTR_FONT_UNDERLINE
,&getCppuType((sal_Int16
*)0), 0, MID_TL_STYLE
},
647 {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL
), ATTR_FONT_UNDERLINE
,&getCppuType((sal_Int32
*)0), 0, MID_TL_COLOR
},
648 {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS
), ATTR_FONT_UNDERLINE
,&getBooleanCppuType(), 0, MID_TL_HASCOLOR
},
649 {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT
), ATTR_FONT_WEIGHT
, &getCppuType((float*)0), 0, MID_WEIGHT
},
650 {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT
), ATTR_CJK_FONT_WEIGHT
,&getCppuType((float*)0), 0, MID_WEIGHT
},
651 {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT
), ATTR_CTL_FONT_WEIGHT
,&getCppuType((float*)0), 0, MID_WEIGHT
},
652 {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD
), ATTR_FONT_WORDLINE
, &getBooleanCppuType(), 0, 0 },
653 {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR
), SC_WID_UNO_CHCOLHDR
,&getBooleanCppuType(), 0, 0 },
654 {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR
), SC_WID_UNO_CHROWHDR
,&getBooleanCppuType(), 0, 0 },
655 {MAP_CHAR_LEN(SC_UNONAME_CONDFMT
), SC_WID_UNO_CONDFMT
, &getCppuType((uno::Reference
<sheet::XSheetConditionalEntries
>*)0), 0, 0 },
656 {MAP_CHAR_LEN(SC_UNONAME_CONDLOC
), SC_WID_UNO_CONDLOC
, &getCppuType((uno::Reference
<sheet::XSheetConditionalEntries
>*)0), 0, 0 },
657 {MAP_CHAR_LEN(SC_UNONAME_CONDXML
), SC_WID_UNO_CONDXML
, &getCppuType((uno::Reference
<sheet::XSheetConditionalEntries
>*)0), 0, 0 },
658 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR
), ATTR_BORDER_BLTR
, &::getCppuType((const table::BorderLine
*)0), 0, 0 | CONVERT_TWIPS
},
659 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR2
), ATTR_BORDER_BLTR
, &::getCppuType((const table::BorderLine2
*)0), 0, 0 | CONVERT_TWIPS
},
660 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR
), ATTR_BORDER_TLBR
, &::getCppuType((const table::BorderLine
*)0), 0, 0 | CONVERT_TWIPS
},
661 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR2
), ATTR_BORDER_TLBR
, &::getCppuType((const table::BorderLine2
*)0), 0, 0 | CONVERT_TWIPS
},
662 {MAP_CHAR_LEN(SC_UNONAME_CELLHGT
), SC_WID_UNO_CELLHGT
, &getCppuType((sal_Int32
*)0), 0, 0 },
663 {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS
), ATTR_HOR_JUSTIFY
, &getCppuType((table::CellHoriJustify
*)0), 0, MID_HORJUST_HORJUST
},
664 {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD
), ATTR_HOR_JUSTIFY_METHOD
, &::getCppuType((const sal_Int32
*)0), 0, 0 },
665 {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN
), ATTR_BACKGROUND
, &getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT
},
666 {MAP_CHAR_LEN(SC_UNONAME_CELLFILT
), SC_WID_UNO_CELLFILT
,&getBooleanCppuType(), 0, 0 },
667 {MAP_CHAR_LEN(SC_UNONAME_MANPAGE
), SC_WID_UNO_MANPAGE
, &getBooleanCppuType(), 0, 0 },
668 {MAP_CHAR_LEN(SC_UNONAME_NEWPAGE
), SC_WID_UNO_NEWPAGE
, &getBooleanCppuType(), 0, 0 },
669 {MAP_CHAR_LEN(SC_UNONAME_WRAP
), ATTR_LINEBREAK
, &getBooleanCppuType(), 0, 0 },
670 {MAP_CHAR_LEN(SC_UNONAME_CELLVIS
), SC_WID_UNO_CELLVIS
, &getBooleanCppuType(), 0, 0 },
671 {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, LEFT_BORDER
| CONVERT_TWIPS
},
672 {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, LEFT_BORDER
| CONVERT_TWIPS
},
673 {MAP_CHAR_LEN(SC_UNONAME_NUMFMT
), ATTR_VALUE_FORMAT
, &getCppuType((sal_Int32
*)0), 0, 0 },
674 {MAP_CHAR_LEN(SC_UNONAME_NUMRULES
), SC_WID_UNO_NUMRULES
,&getCppuType((const uno::Reference
<container::XIndexReplace
>*)0), 0, 0 },
675 {MAP_CHAR_LEN(SC_UNONAME_OHEIGHT
), SC_WID_UNO_OHEIGHT
, &getBooleanCppuType(), 0, 0 },
676 {MAP_CHAR_LEN(SC_UNONAME_CELLORI
), ATTR_STACKED
, &getCppuType((table::CellOrientation
*)0), 0, 0 },
677 {MAP_CHAR_LEN(SC_UNONAME_PADJUST
), ATTR_HOR_JUSTIFY
, &::getCppuType((const sal_Int16
*)0), 0, MID_HORJUST_ADJUST
},
678 {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_LO_MARGIN
| CONVERT_TWIPS
},
679 {MAP_CHAR_LEN(SC_UNONAME_PINDENT
), ATTR_INDENT
, &getCppuType((sal_Int16
*)0), 0, 0 }, //! CONVERT_TWIPS
680 {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST
),ATTR_SCRIPTSPACE
, &getBooleanCppuType(), 0, 0 },
681 {MAP_CHAR_LEN(SC_UNONAME_PISFORBID
),ATTR_FORBIDDEN_RULES
,&getBooleanCppuType(), 0, 0 },
682 {MAP_CHAR_LEN(SC_UNONAME_PISHANG
), ATTR_HANGPUNCTUATION
,&getBooleanCppuType(), 0, 0 },
683 {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN
),ATTR_HYPHENATE
, &getBooleanCppuType(), 0, 0 },
684 {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ
), ATTR_HOR_JUSTIFY
, &::getCppuType((const sal_Int16
*)0), 0, MID_HORJUST_ADJUST
},
685 {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_L_MARGIN
| CONVERT_TWIPS
},
686 {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_R_MARGIN
| CONVERT_TWIPS
},
687 {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_UP_MARGIN
| CONVERT_TWIPS
},
688 {MAP_CHAR_LEN(SC_UNONAME_POS
), SC_WID_UNO_POS
, &getCppuType((awt::Point
*)0), 0 | beans::PropertyAttribute::READONLY
, 0 },
689 {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
690 {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
691 {MAP_CHAR_LEN(SC_UNONAME_ROTANG
), ATTR_ROTATE_VALUE
, &getCppuType((sal_Int32
*)0), 0, 0 },
692 {MAP_CHAR_LEN(SC_UNONAME_ROTREF
), ATTR_ROTATE_MODE
, &getCppuType((sal_Int32
*)0), 0, 0 },
693 {MAP_CHAR_LEN(SC_UNONAME_SHADOW
), ATTR_SHADOW
, &getCppuType((table::ShadowFormat
*)0), 0, 0 | CONVERT_TWIPS
},
694 {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT
), ATTR_SHRINKTOFIT
, &getBooleanCppuType(), 0, 0 },
695 {MAP_CHAR_LEN(SC_UNONAME_SIZE
), SC_WID_UNO_SIZE
, &getCppuType((awt::Size
*)0), 0 | beans::PropertyAttribute::READONLY
, 0 },
696 {MAP_CHAR_LEN(SC_UNONAME_TBLBORD
), SC_WID_UNO_TBLBORD
, &getCppuType((table::TableBorder
*)0), 0, 0 | CONVERT_TWIPS
},
697 {MAP_CHAR_LEN(SC_UNONAME_TBLBORD2
), SC_WID_UNO_TBLBORD2
, &getCppuType((table::TableBorder2
*)0), 0, 0 | CONVERT_TWIPS
},
698 {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, TOP_BORDER
| CONVERT_TWIPS
},
699 {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, TOP_BORDER
| CONVERT_TWIPS
},
700 {MAP_CHAR_LEN(SC_UNONAME_USERDEF
), ATTR_USERDEF
, &getCppuType((uno::Reference
<container::XNameContainer
>*)0), 0, 0 },
701 {MAP_CHAR_LEN(SC_UNONAME_VALIDAT
), SC_WID_UNO_VALIDAT
, &getCppuType((uno::Reference
<beans::XPropertySet
>*)0), 0, 0 },
702 {MAP_CHAR_LEN(SC_UNONAME_VALILOC
), SC_WID_UNO_VALILOC
, &getCppuType((uno::Reference
<beans::XPropertySet
>*)0), 0, 0 },
703 {MAP_CHAR_LEN(SC_UNONAME_VALIXML
), SC_WID_UNO_VALIXML
, &getCppuType((uno::Reference
<beans::XPropertySet
>*)0), 0, 0 },
704 {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS
), ATTR_VER_JUSTIFY
, &getCppuType((sal_Int32
*)0), 0, 0 },
705 {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD
), ATTR_VER_JUSTIFY_METHOD
, &::getCppuType((const sal_Int32
*)0), 0, 0 },
706 {MAP_CHAR_LEN(SC_UNONAME_WRITING
), ATTR_WRITINGDIR
, &getCppuType((sal_Int16
*)0), 0, 0 },
709 static SfxItemPropertySet
aRowPropertySet( aRowPropertyMap_Impl
);
710 return &aRowPropertySet
;
713 static const SfxItemPropertySet
* lcl_GetSheetPropertySet()
715 static SfxItemPropertyMapEntry aSheetPropertyMap_Impl
[] =
717 {MAP_CHAR_LEN(SC_UNONAME_ABSNAME
), SC_WID_UNO_ABSNAME
, &getCppuType((OUString
*)0), 0 | beans::PropertyAttribute::READONLY
, 0 },
718 {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT
),ATTR_VERTICAL_ASIAN
,&getBooleanCppuType(), 0, 0 },
719 {MAP_CHAR_LEN(SC_UNONAME_AUTOPRINT
),SC_WID_UNO_AUTOPRINT
,&getBooleanCppuType(), 0, 0 },
720 {MAP_CHAR_LEN(SC_UNONAME_BORDCOL
), SC_WID_UNO_BORDCOL
, &getCppuType((sal_Int32
*)0), 0, 0 },
721 {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
722 {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
723 {MAP_CHAR_LEN(SC_UNONAME_CELLBACK
), ATTR_BACKGROUND
, &getCppuType((sal_Int32
*)0), 0, MID_BACK_COLOR
},
724 {MAP_CHAR_LEN(SC_UNONAME_CELLPRO
), ATTR_PROTECTION
, &getCppuType((util::CellProtection
*)0), 0, 0 },
725 {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL
), SC_WID_UNO_CELLSTYL
,&getCppuType((OUString
*)0), 0, 0 },
726 {MAP_CHAR_LEN(SC_UNONAME_CCOLOR
), ATTR_FONT_COLOR
, &getCppuType((sal_Int32
*)0), 0, 0 },
727 {MAP_CHAR_LEN(SC_UNONAME_COUTL
), ATTR_FONT_CONTOUR
, &getBooleanCppuType(), 0, 0 },
728 {MAP_CHAR_LEN(SC_UNONAME_CCROSS
), ATTR_FONT_CROSSEDOUT
,&getBooleanCppuType(), 0, MID_CROSSED_OUT
},
729 {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS
), ATTR_FONT_EMPHASISMARK
,&getCppuType((sal_Int16
*)0), 0, MID_EMPHASIS
},
730 {MAP_CHAR_LEN(SC_UNONAME_CFONT
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
731 {MAP_CHAR_LEN(SC_UNONAME_CFCHARS
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_CHAR_SET
},
732 {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS
), ATTR_CJK_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_CHAR_SET
},
733 {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS
), ATTR_CTL_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_CHAR_SET
},
734 {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
735 {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL
), ATTR_CJK_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
736 {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL
), ATTR_CTL_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
737 {MAP_CHAR_LEN(SC_UNONAME_CFNAME
), ATTR_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_FAMILY_NAME
},
738 {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME
), ATTR_CJK_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_FAMILY_NAME
},
739 {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME
), ATTR_CTL_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_FAMILY_NAME
},
740 {MAP_CHAR_LEN(SC_UNONAME_CFPITCH
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_PITCH
},
741 {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH
), ATTR_CJK_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_PITCH
},
742 {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH
), ATTR_CTL_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_PITCH
},
743 {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE
), ATTR_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_STYLE_NAME
},
744 {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE
), ATTR_CJK_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_STYLE_NAME
},
745 {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE
), ATTR_CTL_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_STYLE_NAME
},
746 {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT
), ATTR_FONT_HEIGHT
, &getCppuType((float*)0), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
747 {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT
), ATTR_CJK_FONT_HEIGHT
,&getCppuType((float*)0), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
748 {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT
), ATTR_CTL_FONT_HEIGHT
,&getCppuType((float*)0), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
749 {MAP_CHAR_LEN(SC_UNONAME_CLOCAL
), ATTR_FONT_LANGUAGE
, &getCppuType((lang::Locale
*)0), 0, MID_LANG_LOCALE
},
750 {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL
), ATTR_CJK_FONT_LANGUAGE
,&getCppuType((lang::Locale
*)0), 0, MID_LANG_LOCALE
},
751 {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL
), ATTR_CTL_FONT_LANGUAGE
,&getCppuType((lang::Locale
*)0), 0, MID_LANG_LOCALE
},
752 {MAP_CHAR_LEN(SC_UNONAME_COVER
), ATTR_FONT_OVERLINE
, &getCppuType((sal_Int16
*)0), 0, MID_TL_STYLE
},
753 {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL
), ATTR_FONT_OVERLINE
, &getCppuType((sal_Int32
*)0), 0, MID_TL_COLOR
},
754 {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS
), ATTR_FONT_OVERLINE
, &getBooleanCppuType(), 0, MID_TL_HASCOLOR
},
755 {MAP_CHAR_LEN(SC_UNONAME_CPOST
), ATTR_FONT_POSTURE
, &getCppuType((awt::FontSlant
*)0), 0, MID_POSTURE
},
756 {MAP_CHAR_LEN(SC_UNO_CJK_CPOST
), ATTR_CJK_FONT_POSTURE
,&getCppuType((awt::FontSlant
*)0), 0, MID_POSTURE
},
757 {MAP_CHAR_LEN(SC_UNO_CTL_CPOST
), ATTR_CTL_FONT_POSTURE
,&getCppuType((awt::FontSlant
*)0), 0, MID_POSTURE
},
758 {MAP_CHAR_LEN(SC_UNONAME_CRELIEF
), ATTR_FONT_RELIEF
, &getCppuType((sal_Int16
*)0), 0, MID_RELIEF
},
759 {MAP_CHAR_LEN(SC_UNONAME_CSHADD
), ATTR_FONT_SHADOWED
, &getBooleanCppuType(), 0, 0 },
760 {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE
), ATTR_FONT_CROSSEDOUT
,&getCppuType((sal_Int16
*)0), 0, MID_CROSS_OUT
},
761 {MAP_CHAR_LEN(SC_UNONAME_CUNDER
), ATTR_FONT_UNDERLINE
,&getCppuType((sal_Int16
*)0), 0, MID_TL_STYLE
},
762 {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL
), ATTR_FONT_UNDERLINE
,&getCppuType((sal_Int32
*)0), 0, MID_TL_COLOR
},
763 {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS
), ATTR_FONT_UNDERLINE
,&getBooleanCppuType(), 0, MID_TL_HASCOLOR
},
764 {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT
), ATTR_FONT_WEIGHT
, &getCppuType((float*)0), 0, MID_WEIGHT
},
765 {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT
), ATTR_CJK_FONT_WEIGHT
,&getCppuType((float*)0), 0, MID_WEIGHT
},
766 {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT
), ATTR_CTL_FONT_WEIGHT
,&getCppuType((float*)0), 0, MID_WEIGHT
},
767 {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD
), ATTR_FONT_WORDLINE
, &getBooleanCppuType(), 0, 0 },
768 {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR
), SC_WID_UNO_CHCOLHDR
,&getBooleanCppuType(), 0, 0 },
769 {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR
), SC_WID_UNO_CHROWHDR
,&getBooleanCppuType(), 0, 0 },
770 {MAP_CHAR_LEN(SC_UNONAME_CONDFMT
), SC_WID_UNO_CONDFMT
, &getCppuType((uno::Reference
<sheet::XSheetConditionalEntries
>*)0), 0, 0 },
771 {MAP_CHAR_LEN(SC_UNONAME_CONDLOC
), SC_WID_UNO_CONDLOC
, &getCppuType((uno::Reference
<sheet::XSheetConditionalEntries
>*)0), 0, 0 },
772 {MAP_CHAR_LEN(SC_UNONAME_CONDXML
), SC_WID_UNO_CONDXML
, &getCppuType((uno::Reference
<sheet::XSheetConditionalEntries
>*)0), 0, 0 },
773 {MAP_CHAR_LEN(SC_UNONAME_COPYBACK
), SC_WID_UNO_COPYBACK
,&getBooleanCppuType(), 0, 0 },
774 {MAP_CHAR_LEN(SC_UNONAME_COPYFORM
), SC_WID_UNO_COPYFORM
,&getBooleanCppuType(), 0, 0 },
775 {MAP_CHAR_LEN(SC_UNONAME_COPYSTYL
), SC_WID_UNO_COPYSTYL
,&getBooleanCppuType(), 0, 0 },
776 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR
), ATTR_BORDER_BLTR
, &::getCppuType((const table::BorderLine
*)0), 0, 0 | CONVERT_TWIPS
},
777 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR2
), ATTR_BORDER_BLTR
, &::getCppuType((const table::BorderLine2
*)0), 0, 0 | CONVERT_TWIPS
},
778 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR
), ATTR_BORDER_TLBR
, &::getCppuType((const table::BorderLine
*)0), 0, 0 | CONVERT_TWIPS
},
779 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR2
), ATTR_BORDER_TLBR
, &::getCppuType((const table::BorderLine2
*)0), 0, 0 | CONVERT_TWIPS
},
780 {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS
), ATTR_HOR_JUSTIFY
, &getCppuType((table::CellHoriJustify
*)0), 0, MID_HORJUST_HORJUST
},
781 {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD
), ATTR_HOR_JUSTIFY_METHOD
, &::getCppuType((const sal_Int32
*)0), 0, 0 },
782 {MAP_CHAR_LEN(SC_UNONAME_ISACTIVE
), SC_WID_UNO_ISACTIVE
,&getBooleanCppuType(), 0, 0 },
783 {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN
), ATTR_BACKGROUND
, &getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT
},
784 {MAP_CHAR_LEN(SC_UNONAME_WRAP
), ATTR_LINEBREAK
, &getBooleanCppuType(), 0, 0 },
785 {MAP_CHAR_LEN(SC_UNONAME_CELLVIS
), SC_WID_UNO_CELLVIS
, &getBooleanCppuType(), 0, 0 },
786 {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, LEFT_BORDER
| CONVERT_TWIPS
},
787 {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, LEFT_BORDER
| CONVERT_TWIPS
},
788 {MAP_CHAR_LEN(SC_UNO_LINKDISPBIT
), SC_WID_UNO_LINKDISPBIT
,&getCppuType((uno::Reference
<awt::XBitmap
>*)0), 0 | beans::PropertyAttribute::READONLY
, 0 },
789 {MAP_CHAR_LEN(SC_UNO_LINKDISPNAME
), SC_WID_UNO_LINKDISPNAME
,&getCppuType((OUString
*)0), 0 | beans::PropertyAttribute::READONLY
, 0 },
790 {MAP_CHAR_LEN(SC_UNONAME_NUMFMT
), ATTR_VALUE_FORMAT
, &getCppuType((sal_Int32
*)0), 0, 0 },
791 {MAP_CHAR_LEN(SC_UNONAME_NUMRULES
), SC_WID_UNO_NUMRULES
,&getCppuType((const uno::Reference
<container::XIndexReplace
>*)0), 0, 0 },
792 {MAP_CHAR_LEN(SC_UNONAME_CELLORI
), ATTR_STACKED
, &getCppuType((table::CellOrientation
*)0), 0, 0 },
793 {MAP_CHAR_LEN(SC_UNONAME_PAGESTL
), SC_WID_UNO_PAGESTL
, &getCppuType((OUString
*)0), 0, 0 },
794 {MAP_CHAR_LEN(SC_UNONAME_PADJUST
), ATTR_HOR_JUSTIFY
, &::getCppuType((const sal_Int16
*)0), 0, MID_HORJUST_ADJUST
},
795 {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_LO_MARGIN
| CONVERT_TWIPS
},
796 {MAP_CHAR_LEN(SC_UNONAME_PINDENT
), ATTR_INDENT
, &getCppuType((sal_Int16
*)0), 0, 0 }, //! CONVERT_TWIPS
797 {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST
),ATTR_SCRIPTSPACE
, &getBooleanCppuType(), 0, 0 },
798 {MAP_CHAR_LEN(SC_UNONAME_PISFORBID
),ATTR_FORBIDDEN_RULES
,&getBooleanCppuType(), 0, 0 },
799 {MAP_CHAR_LEN(SC_UNONAME_PISHANG
), ATTR_HANGPUNCTUATION
,&getBooleanCppuType(), 0, 0 },
800 {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN
),ATTR_HYPHENATE
, &getBooleanCppuType(), 0, 0 },
801 {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ
), ATTR_HOR_JUSTIFY
, &::getCppuType((const sal_Int16
*)0), 0, MID_HORJUST_ADJUST
},
802 {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_L_MARGIN
| CONVERT_TWIPS
},
803 {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_R_MARGIN
| CONVERT_TWIPS
},
804 {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN
), ATTR_MARGIN
, &getCppuType((sal_Int32
*)0), 0, MID_MARGIN_UP_MARGIN
| CONVERT_TWIPS
},
805 {MAP_CHAR_LEN(SC_UNONAME_POS
), SC_WID_UNO_POS
, &getCppuType((awt::Point
*)0), 0 | beans::PropertyAttribute::READONLY
, 0 },
806 {MAP_CHAR_LEN(SC_UNONAME_PRINTBORD
),SC_WID_UNO_PRINTBORD
,&getBooleanCppuType(), 0, 0 },
807 {MAP_CHAR_LEN(SC_UNONAME_PROTECT
), SC_WID_UNO_PROTECT
, &getBooleanCppuType(), 0, 0 },
808 {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
809 {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
810 {MAP_CHAR_LEN(SC_UNONAME_ROTANG
), ATTR_ROTATE_VALUE
, &getCppuType((sal_Int32
*)0), 0, 0 },
811 {MAP_CHAR_LEN(SC_UNONAME_ROTREF
), ATTR_ROTATE_MODE
, &getCppuType((sal_Int32
*)0), 0, 0 },
812 {MAP_CHAR_LEN(SC_UNONAME_SHADOW
), ATTR_SHADOW
, &getCppuType((table::ShadowFormat
*)0), 0, 0 | CONVERT_TWIPS
},
813 {MAP_CHAR_LEN(SC_UNONAME_SHOWBORD
), SC_WID_UNO_SHOWBORD
,&getBooleanCppuType(), 0, 0 },
814 {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT
), ATTR_SHRINKTOFIT
, &getBooleanCppuType(), 0, 0 },
815 {MAP_CHAR_LEN(SC_UNONAME_SIZE
), SC_WID_UNO_SIZE
, &getCppuType((awt::Size
*)0), 0 | beans::PropertyAttribute::READONLY
, 0 },
816 {MAP_CHAR_LEN(SC_UNONAME_TBLBORD
), SC_WID_UNO_TBLBORD
, &getCppuType((table::TableBorder
*)0), 0, 0 | CONVERT_TWIPS
},
817 {MAP_CHAR_LEN(SC_UNONAME_TBLBORD2
), SC_WID_UNO_TBLBORD2
, &getCppuType((table::TableBorder2
*)0), 0, 0 | CONVERT_TWIPS
},
818 {MAP_CHAR_LEN(SC_UNONAME_TABLAYOUT
),SC_WID_UNO_TABLAYOUT
,&getCppuType((sal_Int16
*)0), 0, 0 },
819 {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, TOP_BORDER
| CONVERT_TWIPS
},
820 {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, TOP_BORDER
| CONVERT_TWIPS
},
821 {MAP_CHAR_LEN(SC_UNONAME_USERDEF
), ATTR_USERDEF
, &getCppuType((uno::Reference
<container::XNameContainer
>*)0), 0, 0 },
822 {MAP_CHAR_LEN(SC_UNONAME_VALIDAT
), SC_WID_UNO_VALIDAT
, &getCppuType((uno::Reference
<beans::XPropertySet
>*)0), 0, 0 },
823 {MAP_CHAR_LEN(SC_UNONAME_VALILOC
), SC_WID_UNO_VALILOC
, &getCppuType((uno::Reference
<beans::XPropertySet
>*)0), 0, 0 },
824 {MAP_CHAR_LEN(SC_UNONAME_VALIXML
), SC_WID_UNO_VALIXML
, &getCppuType((uno::Reference
<beans::XPropertySet
>*)0), 0, 0 },
825 {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS
), ATTR_VER_JUSTIFY
, &getCppuType((sal_Int32
*)0), 0, 0 },
826 {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD
), ATTR_VER_JUSTIFY_METHOD
, &::getCppuType((const sal_Int32
*)0), 0, 0 },
827 {MAP_CHAR_LEN(SC_UNONAME_WRITING
), ATTR_WRITINGDIR
, &getCppuType((sal_Int16
*)0), 0, 0 },
828 {MAP_CHAR_LEN(SC_UNONAME_TABCOLOR
), SC_WID_UNO_TABCOLOR
, &getCppuType((sal_Int32
*)0), 0, 0 },
829 {MAP_CHAR_LEN(SC_UNO_CODENAME
), SC_WID_UNO_CODENAME
, &getCppuType(static_cast< const OUString
* >(0)), 0, 0},
830 {MAP_CHAR_LEN(SC_UNO_NAMEDRANGES
), SC_WID_UNO_NAMES
, &getCppuType((uno::Reference
<sheet::XNamedRanges
>*)0), 0, 0 },
833 static SfxItemPropertySet
aSheetPropertySet( aSheetPropertyMap_Impl
);
834 return &aSheetPropertySet
;
837 static const SfxItemPropertyMapEntry
* lcl_GetEditPropertyMap()
839 static SfxItemPropertyMapEntry aEditPropertyMap_Impl
[] =
841 SVX_UNOEDIT_CHAR_PROPERTIES
,
842 SVX_UNOEDIT_FONT_PROPERTIES
,
843 SVX_UNOEDIT_PARA_PROPERTIES
,
844 SVX_UNOEDIT_NUMBERING_PROPERTIE
, // for completeness of service ParagraphProperties
845 {MAP_CHAR_LEN(SC_UNONAME_TEXTUSER
), EE_CHAR_XMLATTRIBS
, &getCppuType((const uno::Reference
< container::XNameContainer
>*)0), 0, 0},
846 {MAP_CHAR_LEN(SC_UNONAME_USERDEF
), EE_PARA_XMLATTRIBS
, &getCppuType((const uno::Reference
< container::XNameContainer
>*)0), 0, 0},
849 return aEditPropertyMap_Impl
;
851 static const SvxItemPropertySet
* lcl_GetEditPropertySet()
853 static SvxItemPropertySet
aEditPropertySet( lcl_GetEditPropertyMap(), SdrObject::GetGlobalDrawObjectItemPool() );
854 return &aEditPropertySet
;
857 //------------------------------------------------------------------------
859 using sc::HMMToTwips
;
860 using sc::TwipsToHMM
;
862 //------------------------------------------------------------------------
864 #define SCCHARPROPERTIES_SERVICE "com.sun.star.style.CharacterProperties"
865 #define SCPARAPROPERTIES_SERVICE "com.sun.star.style.ParagraphProperties"
866 #define SCCELLPROPERTIES_SERVICE "com.sun.star.table.CellProperties"
867 #define SCCELLRANGE_SERVICE "com.sun.star.table.CellRange"
868 #define SCCELL_SERVICE "com.sun.star.table.Cell"
869 #define SCSHEETCELLRANGES_SERVICE "com.sun.star.sheet.SheetCellRanges"
870 #define SCSHEETCELLRANGE_SERVICE "com.sun.star.sheet.SheetCellRange"
871 #define SCSPREADSHEET_SERVICE "com.sun.star.sheet.Spreadsheet"
872 #define SCSHEETCELL_SERVICE "com.sun.star.sheet.SheetCell"
874 SC_SIMPLE_SERVICE_INFO( ScCellFormatsEnumeration
, "ScCellFormatsEnumeration", "com.sun.star.sheet.CellFormatRangesEnumeration" )
875 SC_SIMPLE_SERVICE_INFO( ScCellFormatsObj
, "ScCellFormatsObj", "com.sun.star.sheet.CellFormatRanges" )
876 SC_SIMPLE_SERVICE_INFO( ScUniqueCellFormatsEnumeration
, "ScUniqueCellFormatsEnumeration", "com.sun.star.sheet.UniqueCellFormatRangesEnumeration" )
877 SC_SIMPLE_SERVICE_INFO( ScUniqueCellFormatsObj
, "ScUniqueCellFormatsObj", "com.sun.star.sheet.UniqueCellFormatRanges" )
878 SC_SIMPLE_SERVICE_INFO( ScCellRangesBase
, "ScCellRangesBase", "stardiv.unknown" )
879 SC_SIMPLE_SERVICE_INFO( ScCellsEnumeration
, "ScCellsEnumeration", "com.sun.star.sheet.CellsEnumeration" )
880 SC_SIMPLE_SERVICE_INFO( ScCellsObj
, "ScCellsObj", "com.sun.star.sheet.Cells" )
881 SC_SIMPLE_SERVICE_INFO( ScTableColumnObj
, "ScTableColumnObj", "com.sun.star.table.TableColumn" )
882 SC_SIMPLE_SERVICE_INFO( ScTableRowObj
, "ScTableRowObj", "com.sun.star.table.TableRow" )
884 //------------------------------------------------------------------------
886 //! ScLinkListener in anderes File verschieben !!!
888 ScLinkListener::~ScLinkListener()
892 void ScLinkListener::Notify( SvtBroadcaster
&, const SfxHint
& rHint
)
894 aLink
.Call( (SfxHint
*)&rHint
);
897 //------------------------------------------------------------------------
899 static void lcl_CopyProperties( beans::XPropertySet
& rDest
, beans::XPropertySet
& rSource
)
901 uno::Reference
<beans::XPropertySetInfo
> xInfo(rSource
.getPropertySetInfo());
904 uno::Sequence
<beans::Property
> aSeq(xInfo
->getProperties());
905 const beans::Property
* pAry
= aSeq
.getConstArray();
906 sal_uLong nCount
= aSeq
.getLength();
907 for (sal_uLong i
=0; i
<nCount
; i
++)
909 OUString
aName(pAry
[i
].Name
);
910 rDest
.setPropertyValue( aName
, rSource
.getPropertyValue( aName
) );
915 static SCTAB
lcl_FirstTab( const ScRangeList
& rRanges
)
917 OSL_ENSURE(rRanges
.size() >= 1, "was fuer Ranges ?!?!");
918 const ScRange
* pFirst
= rRanges
[ 0 ];
920 return pFirst
->aStart
.Tab();
922 return 0; // soll nicht sein
925 static sal_Bool
lcl_WholeSheet( const ScRangeList
& rRanges
)
927 if ( rRanges
.size() == 1 )
929 const ScRange
* pRange
= rRanges
[0];
930 if ( pRange
&& pRange
->aStart
.Col() == 0 && pRange
->aEnd
.Col() == MAXCOL
&&
931 pRange
->aStart
.Row() == 0 && pRange
->aEnd
.Row() == MAXROW
)
938 template<typename BorderLineType
>
939 const ::editeng::SvxBorderLine
* lcl_getBorderLine(
940 ::editeng::SvxBorderLine
& rLine
, const BorderLineType
& rStruct
)
942 // Convert from 1/100mm to Twips.
943 if (!SvxBoxItem::LineToSvxLine( rStruct
, rLine
, true))
946 if ( rLine
.GetOutWidth() || rLine
.GetInWidth() || rLine
.GetDistance() )
953 const ::editeng::SvxBorderLine
* ScHelperFunctions::GetBorderLine(
954 ::editeng::SvxBorderLine
& rLine
, const table::BorderLine
& rStruct
)
956 return lcl_getBorderLine( rLine
, rStruct
);
959 const ::editeng::SvxBorderLine
* ScHelperFunctions::GetBorderLine(
960 ::editeng::SvxBorderLine
& rLine
, const table::BorderLine2
& rStruct
)
962 return lcl_getBorderLine( rLine
, rStruct
);
967 template<typename TableBorderType
>
968 void lcl_fillBoxItems( SvxBoxItem
& rOuter
, SvxBoxInfoItem
& rInner
, const TableBorderType
& rBorder
)
970 ::editeng::SvxBorderLine aLine
;
971 rOuter
.SetDistance( (sal_uInt16
)HMMToTwips( rBorder
.Distance
) );
972 rOuter
.SetLine( ScHelperFunctions::GetBorderLine( aLine
, rBorder
.TopLine
), BOX_LINE_TOP
);
973 rOuter
.SetLine( ScHelperFunctions::GetBorderLine( aLine
, rBorder
.BottomLine
), BOX_LINE_BOTTOM
);
974 rOuter
.SetLine( ScHelperFunctions::GetBorderLine( aLine
, rBorder
.LeftLine
), BOX_LINE_LEFT
);
975 rOuter
.SetLine( ScHelperFunctions::GetBorderLine( aLine
, rBorder
.RightLine
), BOX_LINE_RIGHT
);
976 rInner
.SetLine( ScHelperFunctions::GetBorderLine( aLine
, rBorder
.HorizontalLine
), BOXINFO_LINE_HORI
);
977 rInner
.SetLine( ScHelperFunctions::GetBorderLine( aLine
, rBorder
.VerticalLine
), BOXINFO_LINE_VERT
);
978 rInner
.SetValid( VALID_TOP
, rBorder
.IsTopLineValid
);
979 rInner
.SetValid( VALID_BOTTOM
, rBorder
.IsBottomLineValid
);
980 rInner
.SetValid( VALID_LEFT
, rBorder
.IsLeftLineValid
);
981 rInner
.SetValid( VALID_RIGHT
, rBorder
.IsRightLineValid
);
982 rInner
.SetValid( VALID_HORI
, rBorder
.IsHorizontalLineValid
);
983 rInner
.SetValid( VALID_VERT
, rBorder
.IsVerticalLineValid
);
984 rInner
.SetValid( VALID_DISTANCE
, rBorder
.IsDistanceValid
);
985 rInner
.SetTable( sal_True
);
989 void ScHelperFunctions::FillBoxItems( SvxBoxItem
& rOuter
, SvxBoxInfoItem
& rInner
, const table::TableBorder
& rBorder
)
991 lcl_fillBoxItems( rOuter
, rInner
, rBorder
);
994 void ScHelperFunctions::FillBoxItems( SvxBoxItem
& rOuter
, SvxBoxInfoItem
& rInner
, const table::TableBorder2
& rBorder
)
996 lcl_fillBoxItems( rOuter
, rInner
, rBorder
);
1000 void ScHelperFunctions::FillBorderLine( table::BorderLine
& rStruct
, const ::editeng::SvxBorderLine
* pLine
)
1002 // Convert from Twips to 1/100mm.
1003 table::BorderLine2
aStruct( SvxBoxItem::SvxLineToLine( pLine
, true));
1007 void ScHelperFunctions::FillBorderLine( table::BorderLine2
& rStruct
, const ::editeng::SvxBorderLine
* pLine
)
1009 rStruct
= SvxBoxItem::SvxLineToLine( pLine
, true);
1014 template<typename TableBorderItem
>
1015 void lcl_fillTableBorder( TableBorderItem
& rBorder
, const SvxBoxItem
& rOuter
, const SvxBoxInfoItem
& rInner
,
1016 bool bInvalidateHorVerDist
)
1018 ScHelperFunctions::FillBorderLine( rBorder
.TopLine
, rOuter
.GetTop() );
1019 ScHelperFunctions::FillBorderLine( rBorder
.BottomLine
, rOuter
.GetBottom() );
1020 ScHelperFunctions::FillBorderLine( rBorder
.LeftLine
, rOuter
.GetLeft() );
1021 ScHelperFunctions::FillBorderLine( rBorder
.RightLine
, rOuter
.GetRight() );
1022 ScHelperFunctions::FillBorderLine( rBorder
.HorizontalLine
, rInner
.GetHori() );
1023 ScHelperFunctions::FillBorderLine( rBorder
.VerticalLine
, rInner
.GetVert() );
1025 rBorder
.Distance
= rOuter
.GetDistance();
1026 rBorder
.IsTopLineValid
= rInner
.IsValid(VALID_TOP
);
1027 rBorder
.IsBottomLineValid
= rInner
.IsValid(VALID_BOTTOM
);
1028 rBorder
.IsLeftLineValid
= rInner
.IsValid(VALID_LEFT
);
1029 rBorder
.IsRightLineValid
= rInner
.IsValid(VALID_RIGHT
);
1030 rBorder
.IsHorizontalLineValid
= !bInvalidateHorVerDist
&& rInner
.IsValid(VALID_HORI
);
1031 rBorder
.IsVerticalLineValid
= !bInvalidateHorVerDist
&& rInner
.IsValid(VALID_VERT
);
1032 rBorder
.IsDistanceValid
= !bInvalidateHorVerDist
&& rInner
.IsValid(VALID_DISTANCE
);
1036 void ScHelperFunctions::AssignTableBorderToAny( uno::Any
& rAny
,
1037 const SvxBoxItem
& rOuter
, const SvxBoxInfoItem
& rInner
, bool bInvalidateHorVerDist
)
1039 table::TableBorder aBorder
;
1040 lcl_fillTableBorder( aBorder
, rOuter
, rInner
, bInvalidateHorVerDist
);
1044 void ScHelperFunctions::AssignTableBorder2ToAny( uno::Any
& rAny
,
1045 const SvxBoxItem
& rOuter
, const SvxBoxInfoItem
& rInner
, bool bInvalidateHorVerDist
)
1047 table::TableBorder2 aBorder
;
1048 lcl_fillTableBorder( aBorder
, rOuter
, rInner
, bInvalidateHorVerDist
);
1052 //------------------------------------------------------------------------
1054 //! lcl_ApplyBorder nach docfunc verschieben!
1056 void ScHelperFunctions::ApplyBorder( ScDocShell
* pDocShell
, const ScRangeList
& rRanges
,
1057 const SvxBoxItem
& rOuter
, const SvxBoxInfoItem
& rInner
)
1059 ScDocument
* pDoc
= pDocShell
->GetDocument();
1060 sal_Bool
bUndo(pDoc
->IsUndoEnabled());
1061 ScDocument
* pUndoDoc
= NULL
;
1063 pUndoDoc
= new ScDocument( SCDOCMODE_UNDO
);
1064 size_t nCount
= rRanges
.size();
1065 for (size_t i
= 0; i
< nCount
; ++i
)
1067 ScRange
aRange( *rRanges
[ i
] );
1068 SCTAB nTab
= aRange
.aStart
.Tab();
1073 pUndoDoc
->InitUndo( pDoc
, nTab
, nTab
);
1075 pUndoDoc
->AddUndoTab( nTab
, nTab
);
1076 pDoc
->CopyToDocument( aRange
, IDF_ATTRIB
, false, pUndoDoc
);
1080 aMark
.SetMarkArea( aRange
);
1081 aMark
.SelectTable( nTab
, sal_True
);
1083 pDoc
->ApplySelectionFrame( aMark
, &rOuter
, &rInner
);
1084 // RowHeight bei Umrandung alleine nicht noetig
1089 pDocShell
->GetUndoManager()->AddUndoAction(
1090 new ScUndoBorder( pDocShell
, rRanges
, pUndoDoc
, rOuter
, rInner
) );
1093 for (size_t i
= 0; i
< nCount
; ++i
)
1094 pDocShell
->PostPaint( *rRanges
[ i
], PAINT_GRID
, SC_PF_LINES
| SC_PF_TESTMERGE
);
1096 pDocShell
->SetDocumentModified();
1099 //! move lcl_PutDataArray to docfunc?
1100 //! merge loop with ScFunctionAccess::callFunction
1102 static sal_Bool
lcl_PutDataArray( ScDocShell
& rDocShell
, const ScRange
& rRange
,
1103 const uno::Sequence
< uno::Sequence
<uno::Any
> >& aData
)
1105 ScDocument
* pDoc
= rDocShell
.GetDocument();
1106 SCTAB nTab
= rRange
.aStart
.Tab();
1107 SCCOL nStartCol
= rRange
.aStart
.Col();
1108 SCROW nStartRow
= rRange
.aStart
.Row();
1109 SCCOL nEndCol
= rRange
.aEnd
.Col();
1110 SCROW nEndRow
= rRange
.aEnd
.Row();
1111 sal_Bool
bUndo(pDoc
->IsUndoEnabled());
1113 if ( !pDoc
->IsBlockEditable( nTab
, nStartCol
,nStartRow
, nEndCol
,nEndRow
) )
1120 long nRows
= aData
.getLength();
1121 const uno::Sequence
<uno::Any
>* pArray
= aData
.getConstArray();
1123 nCols
= pArray
[0].getLength();
1125 if ( nCols
!= nEndCol
-nStartCol
+1 || nRows
!= nEndRow
-nStartRow
+1 )
1131 ScDocument
* pUndoDoc
= NULL
;
1134 pUndoDoc
= new ScDocument( SCDOCMODE_UNDO
);
1135 pUndoDoc
->InitUndo( pDoc
, nTab
, nTab
);
1136 pDoc
->CopyToDocument( rRange
, IDF_CONTENTS
|IDF_NOCAPTIONS
, false, pUndoDoc
);
1139 pDoc
->DeleteAreaTab( nStartCol
, nStartRow
, nEndCol
, nEndRow
, nTab
, IDF_CONTENTS
);
1141 sal_Bool bError
= false;
1142 SCROW nDocRow
= nStartRow
;
1143 for (long nRow
=0; nRow
<nRows
; nRow
++)
1145 const uno::Sequence
<uno::Any
>& rColSeq
= pArray
[nRow
];
1146 if ( rColSeq
.getLength() == nCols
)
1148 SCCOL nDocCol
= nStartCol
;
1149 const uno::Any
* pColArr
= rColSeq
.getConstArray();
1150 for (long nCol
=0; nCol
<nCols
; nCol
++)
1152 ScAddress
aPos(nDocCol
, nDocRow
, nTab
);
1154 const uno::Any
& rElement
= pColArr
[nCol
];
1155 switch( rElement
.getValueTypeClass() )
1157 case uno::TypeClass_VOID
:
1159 // void = "no value"
1160 pDoc
->SetError( nDocCol
, nDocRow
, nTab
, NOTAVAILABLE
);
1164 // #87871# accept integer types because Basic passes a floating point
1165 // variable as byte, short or long if it's an integer number.
1166 case uno::TypeClass_BYTE
:
1167 case uno::TypeClass_SHORT
:
1168 case uno::TypeClass_UNSIGNED_SHORT
:
1169 case uno::TypeClass_LONG
:
1170 case uno::TypeClass_UNSIGNED_LONG
:
1171 case uno::TypeClass_FLOAT
:
1172 case uno::TypeClass_DOUBLE
:
1176 pDoc
->SetValue(aPos
, fVal
);
1180 case uno::TypeClass_STRING
:
1184 if ( !aUStr
.isEmpty() )
1186 ScSetStringParam aParam
;
1187 aParam
.setTextInput();
1188 pDoc
->SetString(aPos
, aUStr
, &aParam
);
1193 // accept Sequence<FormulaToken> for formula cells
1194 case uno::TypeClass_SEQUENCE
:
1196 uno::Sequence
< sheet::FormulaToken
> aTokens
;
1197 if ( rElement
>>= aTokens
)
1199 ScTokenArray aTokenArray
;
1200 ScTokenConversion::ConvertToTokenArray( *pDoc
, aTokenArray
, aTokens
);
1201 pDoc
->SetFormula(aPos
, aTokenArray
);
1209 bError
= true; // invalid type
1215 bError
= sal_True
; // wrong size
1220 sal_Bool bHeight
= rDocShell
.AdjustRowHeight( nStartRow
, nEndRow
, nTab
);
1224 ScMarkData aDestMark
;
1225 aDestMark
.SelectOneTable( nTab
);
1226 rDocShell
.GetUndoManager()->AddUndoAction(
1228 &rDocShell
, ScRange(nStartCol
, nStartRow
, nTab
, nEndCol
, nEndRow
, nTab
),
1229 aDestMark
, pUndoDoc
, NULL
, IDF_CONTENTS
, NULL
, false));
1233 rDocShell
.PostPaint( rRange
, PAINT_GRID
); // AdjustRowHeight may have painted already
1235 rDocShell
.SetDocumentModified();
1240 static sal_Bool
lcl_PutFormulaArray( ScDocShell
& rDocShell
, const ScRange
& rRange
,
1241 const uno::Sequence
< uno::Sequence
<OUString
> >& aData
,
1242 const formula::FormulaGrammar::Grammar eGrammar
)
1244 ScDocument
* pDoc
= rDocShell
.GetDocument();
1245 SCTAB nTab
= rRange
.aStart
.Tab();
1246 SCCOL nStartCol
= rRange
.aStart
.Col();
1247 SCROW nStartRow
= rRange
.aStart
.Row();
1248 SCCOL nEndCol
= rRange
.aEnd
.Col();
1249 SCROW nEndRow
= rRange
.aEnd
.Row();
1250 sal_Bool
bUndo(pDoc
->IsUndoEnabled());
1252 if ( !pDoc
->IsBlockEditable( nTab
, nStartCol
,nStartRow
, nEndCol
,nEndRow
) )
1259 long nRows
= aData
.getLength();
1260 const uno::Sequence
<OUString
>* pArray
= aData
.getConstArray();
1262 nCols
= pArray
[0].getLength();
1264 if ( nCols
!= nEndCol
-nStartCol
+1 || nRows
!= nEndRow
-nStartRow
+1 )
1270 ScDocument
* pUndoDoc
= NULL
;
1273 pUndoDoc
= new ScDocument( SCDOCMODE_UNDO
);
1274 pUndoDoc
->InitUndo( pDoc
, nTab
, nTab
);
1275 pDoc
->CopyToDocument( rRange
, IDF_CONTENTS
, false, pUndoDoc
);
1278 pDoc
->DeleteAreaTab( nStartCol
, nStartRow
, nEndCol
, nEndRow
, nTab
, IDF_CONTENTS
);
1280 bool bError
= false;
1281 SCROW nDocRow
= nStartRow
;
1282 for (long nRow
=0; nRow
<nRows
; nRow
++)
1284 const uno::Sequence
<OUString
>& rColSeq
= pArray
[nRow
];
1285 if ( rColSeq
.getLength() == nCols
)
1287 SCCOL nDocCol
= nStartCol
;
1288 const OUString
* pColArr
= rColSeq
.getConstArray();
1289 for (long nCol
=0; nCol
<nCols
; nCol
++)
1291 String
aText(pColArr
[nCol
]);
1292 ScAddress
aPos( nDocCol
, nDocRow
, nTab
);
1294 ScInputStringType aRes
=
1295 ScStringUtil::parseInputString(
1296 *pDoc
->GetFormatTable(), aText
, LANGUAGE_ENGLISH_US
);
1297 switch (aRes
.meType
)
1299 case ScInputStringType::Formula
:
1300 pDoc
->SetFormula(aPos
, aRes
.maText
, eGrammar
);
1302 case ScInputStringType::Number
:
1303 pDoc
->SetValue(aPos
, aRes
.mfValue
);
1305 case ScInputStringType::Text
:
1306 pDoc
->SetTextCell(aPos
, aRes
.maText
);
1316 bError
= true; // wrong size
1321 sal_Bool bHeight
= rDocShell
.AdjustRowHeight( nStartRow
, nEndRow
, nTab
);
1325 ScMarkData aDestMark
;
1326 aDestMark
.SelectOneTable( nTab
);
1327 rDocShell
.GetUndoManager()->AddUndoAction(
1328 new ScUndoPaste( &rDocShell
,
1329 ScRange(nStartCol
, nStartRow
, nTab
, nEndCol
, nEndRow
, nTab
), aDestMark
,
1330 pUndoDoc
, NULL
, IDF_CONTENTS
, NULL
, false));
1334 rDocShell
.PostPaint( rRange
, PAINT_GRID
); // AdjustRowHeight may have painted already
1336 rDocShell
.SetDocumentModified();
1341 // used in ScCellRangeObj::getFormulaArray and ScCellObj::GetInputString_Impl
1342 static OUString
lcl_GetInputString( ScDocument
* pDoc
, const ScAddress
& rPos
, sal_Bool bEnglish
)
1345 return EMPTY_OUSTRING
;
1347 ScRefCellValue aCell
;
1348 aCell
.assign(*pDoc
, rPos
);
1349 if (aCell
.isEmpty())
1350 return EMPTY_OUSTRING
;
1354 CellType eType
= aCell
.meType
;
1355 if (eType
== CELLTYPE_FORMULA
)
1357 ScFormulaCell
* pForm
= aCell
.mpFormula
;
1358 pForm
->GetFormula( aVal
, formula::FormulaGrammar::mapAPItoGrammar( bEnglish
, false));
1362 SvNumberFormatter
* pFormatter
= bEnglish
? ScGlobal::GetEnglishFormatter() :
1363 pDoc
->GetFormatTable();
1364 // Since the English formatter was constructed with
1365 // LANGUAGE_ENGLISH_US the "General" format has index key 0,
1366 // we don't have to query.
1367 sal_uInt32 nNumFmt
= bEnglish
? 0 : pDoc
->GetNumberFormat(rPos
);
1369 if (eType
== CELLTYPE_EDIT
)
1371 // GetString an der EditCell macht Leerzeichen aus Umbruechen,
1372 // hier werden die Umbrueche aber gebraucht
1373 const EditTextObject
* pData
= aCell
.mpEditText
;
1376 EditEngine
& rEngine
= pDoc
->GetEditEngine();
1377 rEngine
.SetText(*pData
);
1378 aVal
= rEngine
.GetText(LINEEND_LF
);
1382 ScCellFormat::GetInputString(aCell
, nNumFmt
, aVal
, *pFormatter
, pDoc
);
1384 // ggf. ein ' davorhaengen wie in ScTabViewShell::UpdateInputHandler
1385 if ( eType
== CELLTYPE_STRING
|| eType
== CELLTYPE_EDIT
)
1388 String aTempString
= aVal
;
1389 sal_Bool
bIsNumberFormat(pFormatter
->IsNumberFormat(aTempString
, nNumFmt
, fDummy
));
1390 if ( bIsNumberFormat
)
1391 aTempString
.Insert('\'',0);
1392 else if ( aTempString
.Len() && aTempString
.GetChar(0) == '\'' )
1394 // if the string starts with a "'", add another one because setFormula
1395 // strips one (like text input, except for "text" number formats)
1396 if ( bEnglish
|| ( pFormatter
->GetType(nNumFmt
) != NUMBERFORMAT_TEXT
) )
1397 aTempString
.Insert('\'',0);
1404 //------------------------------------------------------------------------
1406 ScCellRangesBase::ScCellRangesBase(ScDocShell
* pDocSh
, const ScRange
& rR
) :
1407 pPropSet(lcl_GetCellsPropertySet()),
1408 pDocShell( pDocSh
),
1409 pValueListener( NULL
),
1410 pCurrentFlat( NULL
),
1411 pCurrentDeep( NULL
),
1412 pCurrentDataSet( NULL
),
1413 pNoDfltCurrentDataSet( NULL
),
1416 bChartColAsHdr( false ),
1417 bChartRowAsHdr( false ),
1418 bCursorOnly( false ),
1419 bGotDataChangedHint( false ),
1420 aValueListeners( 0 )
1422 ScRange
aCellRange(rR
);
1423 aCellRange
.Justify();
1424 aRanges
.Append( aCellRange
);
1426 if (pDocShell
) // Null if created with createInstance
1428 ScDocument
* pDoc
= pDocShell
->GetDocument();
1429 pDoc
->AddUnoObject(*this);
1430 nObjectId
= pDoc
->GetNewUnoId();
1434 ScCellRangesBase::ScCellRangesBase(ScDocShell
* pDocSh
, const ScRangeList
& rR
) :
1435 pPropSet(lcl_GetCellsPropertySet()),
1436 pDocShell( pDocSh
),
1437 pValueListener( NULL
),
1438 pCurrentFlat( NULL
),
1439 pCurrentDeep( NULL
),
1440 pCurrentDataSet( NULL
),
1441 pNoDfltCurrentDataSet( NULL
),
1445 bChartColAsHdr( false ),
1446 bChartRowAsHdr( false ),
1447 bCursorOnly( false ),
1448 bGotDataChangedHint( false ),
1449 aValueListeners( 0 )
1451 if (pDocShell
) // Null if created with createInstance
1453 ScDocument
* pDoc
= pDocShell
->GetDocument();
1454 pDoc
->AddUnoObject(*this);
1455 nObjectId
= pDoc
->GetNewUnoId();
1459 ScCellRangesBase::~ScCellRangesBase()
1461 // call RemoveUnoObject first, so no notification can happen
1462 // during ForgetCurrentAttrs
1465 pDocShell
->GetDocument()->RemoveUnoObject(*this);
1467 ForgetCurrentAttrs();
1470 delete pValueListener
;
1472 //! XChartDataChangeEventListener abmelden ??
1473 //! (ChartCollection haelt dann auch dieses Objekt fest!)
1476 void ScCellRangesBase::ForgetCurrentAttrs()
1478 delete pCurrentFlat
;
1479 delete pCurrentDeep
;
1480 delete pCurrentDataSet
;
1481 delete pNoDfltCurrentDataSet
;
1482 pCurrentFlat
= NULL
;
1483 pCurrentDeep
= NULL
;
1484 pCurrentDataSet
= NULL
;
1485 pNoDfltCurrentDataSet
= NULL
;
1487 // #i62483# pMarkData can remain unchanged, is deleted only if the range changes (RefChanged)
1490 void ScCellRangesBase::ForgetMarkData()
1496 const ScPatternAttr
* ScCellRangesBase::GetCurrentAttrsFlat()
1498 // get and cache direct cell attributes for this object's range
1500 if ( !pCurrentFlat
&& pDocShell
)
1502 ScDocument
* pDoc
= pDocShell
->GetDocument();
1503 pCurrentFlat
= pDoc
->CreateSelectionPattern( *GetMarkData(), false );
1505 return pCurrentFlat
;
1508 const ScPatternAttr
* ScCellRangesBase::GetCurrentAttrsDeep()
1510 // get and cache cell attributes (incl. styles) for this object's range
1512 if ( !pCurrentDeep
&& pDocShell
)
1514 ScDocument
* pDoc
= pDocShell
->GetDocument();
1515 pCurrentDeep
= pDoc
->CreateSelectionPattern( *GetMarkData(), sal_True
);
1517 return pCurrentDeep
;
1520 SfxItemSet
* ScCellRangesBase::GetCurrentDataSet(bool bNoDflt
)
1522 if(!pCurrentDataSet
)
1524 const ScPatternAttr
* pPattern
= GetCurrentAttrsDeep();
1527 // Dontcare durch Default ersetzen, damit man immer eine Reflection hat
1528 pCurrentDataSet
= new SfxItemSet( pPattern
->GetItemSet() );
1529 pNoDfltCurrentDataSet
= new SfxItemSet( pPattern
->GetItemSet() );
1530 pCurrentDataSet
->ClearInvalidItems();
1533 return bNoDflt
? pNoDfltCurrentDataSet
: pCurrentDataSet
;
1536 const ScMarkData
* ScCellRangesBase::GetMarkData()
1540 pMarkData
= new ScMarkData();
1541 pMarkData
->MarkFromRangeList( aRanges
, false );
1546 void ScCellRangesBase::Notify( SfxBroadcaster
&, const SfxHint
& rHint
)
1548 if ( rHint
.ISA( ScUpdateRefHint
) )
1550 const ScUpdateRefHint
& rRef
= (const ScUpdateRefHint
&)rHint
;
1552 ScDocument
* pDoc
= pDocShell
->GetDocument();
1553 ScRangeList
* pUndoRanges
= NULL
;
1554 if ( pDoc
->HasUnoRefUndo() )
1555 pUndoRanges
= new ScRangeList( aRanges
);
1557 if ( aRanges
.UpdateReference( rRef
.GetMode(), pDoc
, rRef
.GetRange(),
1558 rRef
.GetDx(), rRef
.GetDy(), rRef
.GetDz() ) )
1560 // i#90076; the object "this" was destroyed after calling ScTableSheetObj::getImplementation
1561 // this hack make sure that the object lives a bit longer
1562 uno::Reference
<uno::XInterface
> xInterface((cppu::OWeakObject
*)this, uno::UNO_QUERY
);
1563 if ( rRef
.GetMode() == URM_INSDEL
1564 && aRanges
.size() == 1
1565 && ScTableSheetObj::getImplementation( xInterface
)
1568 // #101755#; the range size of a sheet does not change
1569 ScRange
* pR
= aRanges
.front();
1572 pR
->aStart
.SetCol(0);
1573 pR
->aStart
.SetRow(0);
1574 pR
->aEnd
.SetCol(MAXCOL
);
1575 pR
->aEnd
.SetRow(MAXROW
);
1580 // any change of the range address is broadcast to value (modify) listeners
1581 if ( !aValueListeners
.empty() )
1582 bGotDataChangedHint
= sal_True
;
1585 pDoc
->AddUnoRefChange( nObjectId
, *pUndoRanges
);
1590 else if ( rHint
.ISA( SfxSimpleHint
) )
1592 sal_uLong nId
= ((const SfxSimpleHint
&)rHint
).GetId();
1593 if ( nId
== SFX_HINT_DYING
)
1595 ForgetCurrentAttrs();
1596 pDocShell
= NULL
; // invalid
1598 if ( !aValueListeners
.empty() )
1600 // dispose listeners
1602 lang::EventObject aEvent
;
1603 aEvent
.Source
.set(static_cast<cppu::OWeakObject
*>(this));
1604 for ( sal_uInt16 n
=0; n
<aValueListeners
.size(); n
++ )
1605 aValueListeners
[n
]->disposing( aEvent
);
1607 aValueListeners
.clear();
1609 // The listeners can't have the last ref to this, as it's still held
1613 else if ( nId
== SFX_HINT_DATACHANGED
)
1615 // document content changed -> forget cached attributes
1616 ForgetCurrentAttrs();
1618 if ( bGotDataChangedHint
&& pDocShell
)
1620 // This object was notified of content changes, so one call
1621 // for each listener is generated now.
1622 // The calls can't be executed directly because the document's
1623 // UNO broadcaster list must not be modified.
1624 // Instead, add to the document's list of listener calls,
1625 // which will be executed directly after the broadcast of
1626 // SFX_HINT_DATACHANGED.
1628 lang::EventObject aEvent
;
1629 aEvent
.Source
.set((cppu::OWeakObject
*)this);
1631 // the EventObject holds a Ref to this object until after the listener calls
1633 ScDocument
* pDoc
= pDocShell
->GetDocument();
1634 for ( sal_uInt16 n
=0; n
<aValueListeners
.size(); n
++ )
1635 pDoc
->AddUnoListenerCall( aValueListeners
[n
], aEvent
);
1637 bGotDataChangedHint
= false;
1640 else if ( nId
== SC_HINT_CALCALL
)
1642 // broadcast from DoHardRecalc - set bGotDataChangedHint
1643 // (SFX_HINT_DATACHANGED follows separately)
1645 if ( !aValueListeners
.empty() )
1646 bGotDataChangedHint
= sal_True
;
1649 else if ( rHint
.ISA( ScUnoRefUndoHint
) )
1651 const ScUnoRefUndoHint
& rUndoHint
= static_cast<const ScUnoRefUndoHint
&>(rHint
);
1652 if ( rUndoHint
.GetObjectId() == nObjectId
)
1654 // restore ranges from hint
1656 aRanges
= rUndoHint
.GetRanges();
1659 if ( !aValueListeners
.empty() )
1660 bGotDataChangedHint
= sal_True
; // need to broadcast the undo, too
1665 void ScCellRangesBase::RefChanged()
1667 //! adjust XChartDataChangeEventListener
1669 if ( pValueListener
&& !aValueListeners
.empty() )
1671 pValueListener
->EndListeningAll();
1673 ScDocument
* pDoc
= pDocShell
->GetDocument();
1674 for ( size_t i
= 0, nCount
= aRanges
.size(); i
< nCount
; ++i
)
1675 pDoc
->StartListeningArea( *aRanges
[ i
], pValueListener
);
1678 ForgetCurrentAttrs();
1682 ScDocument
* ScCellRangesBase::GetDocument() const
1685 return pDocShell
->GetDocument();
1690 void ScCellRangesBase::InitInsertRange(ScDocShell
* pDocSh
, const ScRange
& rR
)
1692 if ( !pDocShell
&& pDocSh
)
1696 ScRange
aCellRange(rR
);
1697 aCellRange
.Justify();
1698 aRanges
.RemoveAll();
1699 aRanges
.Append( aCellRange
);
1701 pDocShell
->GetDocument()->AddUnoObject(*this);
1703 RefChanged(); // Range im Range-Objekt anpassen
1707 void ScCellRangesBase::AddRange(const ScRange
& rRange
, const sal_Bool bMergeRanges
)
1710 aRanges
.Join(rRange
);
1712 aRanges
.Append(rRange
);
1716 void ScCellRangesBase::SetNewRange(const ScRange
& rNew
)
1718 ScRange
aCellRange(rNew
);
1719 aCellRange
.Justify();
1721 aRanges
.RemoveAll();
1722 aRanges
.Append( aCellRange
);
1726 void ScCellRangesBase::SetNewRanges(const ScRangeList
& rNew
)
1732 void ScCellRangesBase::SetCursorOnly( sal_Bool bSet
)
1734 // set for a selection object that is created from the cursor position
1735 // without anything selected (may contain several sheets)
1740 uno::Any SAL_CALL
ScCellRangesBase::queryInterface( const uno::Type
& rType
)
1741 throw(uno::RuntimeException
)
1743 SC_QUERYINTERFACE( beans::XPropertySet
)
1744 SC_QUERYINTERFACE( beans::XMultiPropertySet
)
1745 SC_QUERYINTERFACE( beans::XTolerantMultiPropertySet
)
1746 SC_QUERYINTERFACE( beans::XPropertyState
)
1747 SC_QUERYINTERFACE( sheet::XSheetOperation
)
1748 SC_QUERYINTERFACE( chart::XChartDataArray
)
1749 SC_QUERYINTERFACE( chart::XChartData
)
1750 SC_QUERYINTERFACE( util::XIndent
)
1751 SC_QUERYINTERFACE( sheet::XCellRangesQuery
)
1752 SC_QUERYINTERFACE( sheet::XFormulaQuery
)
1753 SC_QUERYINTERFACE( util::XReplaceable
)
1754 SC_QUERYINTERFACE( util::XSearchable
)
1755 SC_QUERYINTERFACE( util::XModifyBroadcaster
)
1756 SC_QUERYINTERFACE( lang::XServiceInfo
)
1757 SC_QUERYINTERFACE( lang::XUnoTunnel
)
1758 SC_QUERYINTERFACE( lang::XTypeProvider
)
1760 return OWeakObject::queryInterface( rType
);
1763 void SAL_CALL
ScCellRangesBase::acquire() throw()
1765 OWeakObject::acquire();
1768 void SAL_CALL
ScCellRangesBase::release() throw()
1770 OWeakObject::release();
1773 uno::Sequence
<uno::Type
> SAL_CALL
ScCellRangesBase::getTypes() throw(uno::RuntimeException
)
1775 static uno::Sequence
<uno::Type
> aTypes
;
1776 if ( aTypes
.getLength() == 0 )
1779 uno::Type
* pPtr
= aTypes
.getArray();
1780 pPtr
[0] = getCppuType((const uno::Reference
<beans::XPropertySet
>*)0);
1781 pPtr
[1] = getCppuType((const uno::Reference
<beans::XMultiPropertySet
>*)0);
1782 pPtr
[2] = getCppuType((const uno::Reference
<beans::XPropertyState
>*)0);
1783 pPtr
[3] = getCppuType((const uno::Reference
<sheet::XSheetOperation
>*)0);
1784 pPtr
[4] = getCppuType((const uno::Reference
<chart::XChartDataArray
>*)0);
1785 pPtr
[5] = getCppuType((const uno::Reference
<util::XIndent
>*)0);
1786 pPtr
[6] = getCppuType((const uno::Reference
<sheet::XCellRangesQuery
>*)0);
1787 pPtr
[7] = getCppuType((const uno::Reference
<sheet::XFormulaQuery
>*)0);
1788 pPtr
[8] = getCppuType((const uno::Reference
<util::XReplaceable
>*)0);
1789 pPtr
[9] = getCppuType((const uno::Reference
<util::XModifyBroadcaster
>*)0);
1790 pPtr
[10]= getCppuType((const uno::Reference
<lang::XServiceInfo
>*)0);
1791 pPtr
[11]= getCppuType((const uno::Reference
<lang::XUnoTunnel
>*)0);
1792 pPtr
[12]= getCppuType((const uno::Reference
<lang::XTypeProvider
>*)0);
1799 class theScCellRangesBaseImplementationId
: public rtl::Static
< UnoTunnelIdInit
, theScCellRangesBaseImplementationId
> {};
1802 uno::Sequence
<sal_Int8
> SAL_CALL
ScCellRangesBase::getImplementationId()
1803 throw(uno::RuntimeException
)
1805 return theScCellRangesBaseImplementationId::get().getSeq();
1810 void ScCellRangesBase::PaintRanges_Impl( sal_uInt16 nPart
)
1812 for (size_t i
= 0, nCount
= aRanges
.size(); i
< nCount
; ++i
)
1813 pDocShell
->PostPaint( *aRanges
[ i
], nPart
);
1818 double SAL_CALL
ScCellRangesBase::computeFunction( sheet::GeneralFunction nFunction
)
1819 throw(uno::Exception
, uno::RuntimeException
)
1821 SolarMutexGuard aGuard
;
1822 ScMarkData
aMark(*GetMarkData());
1823 aMark
.MarkToSimple();
1824 if (!aMark
.IsMarked())
1825 aMark
.SetMarkNegative(sal_True
); // um Dummy Position angeben zu koennen
1827 ScAddress aDummy
; // wenn nicht Marked, ignoriert wegen Negative
1829 ScSubTotalFunc eFunc
= ScDPUtil::toSubTotalFunc(nFunction
);
1830 ScDocument
* pDoc
= pDocShell
->GetDocument();
1831 if ( !pDoc
->GetSelectionFunction( eFunc
, aDummy
, aMark
, fVal
) )
1833 throw uno::RuntimeException(); //! own exception?
1839 void SAL_CALL
ScCellRangesBase::clearContents( sal_Int32 nContentFlags
) throw(uno::RuntimeException
)
1841 SolarMutexGuard aGuard
;
1842 if ( !aRanges
.empty() )
1844 // only for clearContents: EDITATTR is only used if no contents are deleted
1845 sal_uInt16 nDelFlags
= static_cast< sal_uInt16
>( nContentFlags
& IDF_ALL
);
1846 if ( ( nContentFlags
& IDF_EDITATTR
) && ( nContentFlags
& IDF_CONTENTS
) == 0 )
1847 nDelFlags
|= IDF_EDITATTR
;
1849 pDocShell
->GetDocFunc().DeleteContents( *GetMarkData(), nDelFlags
, sal_True
, sal_True
);
1851 // sonst ist nichts zu tun
1856 const SfxItemPropertyMap
& ScCellRangesBase::GetItemPropertyMap()
1858 return pPropSet
->getPropertyMap();
1861 static void lcl_GetPropertyWhich( const SfxItemPropertySimpleEntry
* pEntry
,
1862 sal_uInt16
& rItemWhich
)
1864 // Which-ID des betroffenen Items, auch wenn das Item die Property
1865 // nicht alleine behandeln kann
1868 if ( IsScItemWid( pEntry
->nWID
) )
1869 rItemWhich
= pEntry
->nWID
;
1871 switch ( pEntry
->nWID
)
1873 case SC_WID_UNO_TBLBORD
:
1874 case SC_WID_UNO_TBLBORD2
:
1875 rItemWhich
= ATTR_BORDER
;
1877 case SC_WID_UNO_CONDFMT
:
1878 case SC_WID_UNO_CONDLOC
:
1879 case SC_WID_UNO_CONDXML
:
1880 rItemWhich
= ATTR_CONDITIONAL
;
1882 case SC_WID_UNO_VALIDAT
:
1883 case SC_WID_UNO_VALILOC
:
1884 case SC_WID_UNO_VALIXML
:
1885 rItemWhich
= ATTR_VALIDDATA
;
1892 beans::PropertyState
ScCellRangesBase::GetOnePropertyState( sal_uInt16 nItemWhich
, const SfxItemPropertySimpleEntry
* pEntry
)
1894 beans::PropertyState eRet
= beans::PropertyState_DIRECT_VALUE
;
1895 if ( nItemWhich
) // item wid (from map or special case)
1897 // For items that contain several properties (like background),
1898 // "ambiguous" is returned too often here
1900 // for PropertyState, don't look at styles
1901 const ScPatternAttr
* pPattern
= GetCurrentAttrsFlat();
1904 SfxItemState eState
= pPattern
->GetItemSet().GetItemState( nItemWhich
, false );
1906 if ( nItemWhich
== ATTR_VALUE_FORMAT
&& eState
== SFX_ITEM_DEFAULT
)
1907 eState
= pPattern
->GetItemSet().GetItemState( ATTR_LANGUAGE_FORMAT
, false );
1909 if ( eState
== SFX_ITEM_SET
)
1910 eRet
= beans::PropertyState_DIRECT_VALUE
;
1911 else if ( eState
== SFX_ITEM_DEFAULT
)
1912 eRet
= beans::PropertyState_DEFAULT_VALUE
;
1913 else if ( eState
== SFX_ITEM_DONTCARE
)
1914 eRet
= beans::PropertyState_AMBIGUOUS_VALUE
;
1917 OSL_FAIL("unbekannter ItemState");
1923 if ( pEntry
->nWID
== SC_WID_UNO_CHCOLHDR
|| pEntry
->nWID
== SC_WID_UNO_CHROWHDR
|| pEntry
->nWID
== SC_WID_UNO_ABSNAME
)
1924 eRet
= beans::PropertyState_DIRECT_VALUE
;
1925 else if ( pEntry
->nWID
== SC_WID_UNO_CELLSTYL
)
1927 // a style is always set, there's no default state
1928 const ScStyleSheet
* pStyle
= pDocShell
->GetDocument()->GetSelectionStyle(*GetMarkData());
1930 eRet
= beans::PropertyState_DIRECT_VALUE
;
1932 eRet
= beans::PropertyState_AMBIGUOUS_VALUE
;
1934 else if ( pEntry
->nWID
== SC_WID_UNO_NUMRULES
)
1935 eRet
= beans::PropertyState_DEFAULT_VALUE
; // numbering rules are always default
1940 beans::PropertyState SAL_CALL
ScCellRangesBase::getPropertyState( const OUString
& aPropertyName
)
1941 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
1943 SolarMutexGuard aGuard
;
1944 if ( aRanges
.empty() )
1945 throw uno::RuntimeException();
1947 const SfxItemPropertyMap
& rMap
= GetItemPropertyMap(); // from derived class
1948 sal_uInt16 nItemWhich
= 0;
1949 const SfxItemPropertySimpleEntry
* pEntry
= rMap
.getByName( aPropertyName
);
1950 lcl_GetPropertyWhich( pEntry
, nItemWhich
);
1951 return GetOnePropertyState( nItemWhich
, pEntry
);
1954 uno::Sequence
<beans::PropertyState
> SAL_CALL
ScCellRangesBase::getPropertyStates(
1955 const uno::Sequence
<OUString
>& aPropertyNames
)
1956 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
1958 SolarMutexGuard aGuard
;
1960 const SfxItemPropertyMap
& rPropertyMap
= GetItemPropertyMap(); // from derived class
1962 uno::Sequence
<beans::PropertyState
> aRet(aPropertyNames
.getLength());
1963 beans::PropertyState
* pStates
= aRet
.getArray();
1964 for(sal_Int32 i
= 0; i
< aPropertyNames
.getLength(); i
++)
1966 sal_uInt16 nItemWhich
= 0;
1967 const SfxItemPropertySimpleEntry
* pEntry
= rPropertyMap
.getByName( aPropertyNames
[i
] );
1968 lcl_GetPropertyWhich( pEntry
, nItemWhich
);
1969 pStates
[i
] = GetOnePropertyState(nItemWhich
, pEntry
);
1974 void SAL_CALL
ScCellRangesBase::setPropertyToDefault( const OUString
& aPropertyName
)
1975 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
1977 SolarMutexGuard aGuard
;
1980 const SfxItemPropertyMap
& rPropertyMap
= GetItemPropertyMap(); // from derived class
1981 sal_uInt16 nItemWhich
= 0;
1982 const SfxItemPropertySimpleEntry
* pEntry
= rPropertyMap
.getByName( aPropertyName
);
1983 lcl_GetPropertyWhich( pEntry
, nItemWhich
);
1984 if ( nItemWhich
) // item wid (from map or special case)
1986 if ( !aRanges
.empty() ) // leer = nichts zu tun
1988 //! Bei Items, die mehrere Properties enthalten (z.B. Hintergrund)
1989 //! wird hier zuviel zurueckgesetzt
1990 //! for ATTR_ROTATE_VALUE, also reset ATTR_ORIENTATION?
1992 sal_uInt16 aWIDs
[3];
1993 aWIDs
[0] = nItemWhich
;
1994 if ( nItemWhich
== ATTR_VALUE_FORMAT
)
1996 aWIDs
[1] = ATTR_LANGUAGE_FORMAT
; // language for number formats
2001 pDocShell
->GetDocFunc().ClearItems( *GetMarkData(), aWIDs
, sal_True
);
2006 if ( pEntry
->nWID
== SC_WID_UNO_CHCOLHDR
)
2007 bChartColAsHdr
= false;
2008 else if ( pEntry
->nWID
== SC_WID_UNO_CHROWHDR
)
2009 bChartRowAsHdr
= false;
2010 else if ( pEntry
->nWID
== SC_WID_UNO_CELLSTYL
)
2012 String
aStyleName( ScGlobal::GetRscString( STR_STYLENAME_STANDARD
) );
2013 pDocShell
->GetDocFunc().ApplyStyle( *GetMarkData(), aStyleName
, sal_True
, sal_True
);
2019 uno::Any SAL_CALL
ScCellRangesBase::getPropertyDefault( const OUString
& aPropertyName
)
2020 throw(beans::UnknownPropertyException
, lang::WrappedTargetException
,
2021 uno::RuntimeException
)
2023 //! mit getPropertyValue zusammenfassen
2025 SolarMutexGuard aGuard
;
2030 ScDocument
* pDoc
= pDocShell
->GetDocument();
2031 const SfxItemPropertyMap
& rPropertyMap
= GetItemPropertyMap(); // from derived class
2032 const SfxItemPropertySimpleEntry
* pEntry
= rPropertyMap
.getByName( aPropertyName
);
2035 if ( IsScItemWid( pEntry
->nWID
) )
2037 const ScPatternAttr
* pPattern
= pDoc
->GetDefPattern();
2040 const SfxItemSet
& rSet
= pPattern
->GetItemSet();
2042 switch ( pEntry
->nWID
) // fuer Item-Spezial-Behandlungen
2044 case ATTR_VALUE_FORMAT
:
2045 // default has no language set
2046 aAny
<<= (sal_Int32
)( ((const SfxUInt32Item
&)rSet
.Get(pEntry
->nWID
)).GetValue() );
2049 aAny
<<= (sal_Int16
)( TwipsToHMM(((const SfxUInt16Item
&)
2050 rSet
.Get(pEntry
->nWID
)).GetValue()) );
2053 pPropSet
->getPropertyValue(aPropertyName
, rSet
, aAny
);
2058 switch ( pEntry
->nWID
)
2060 case SC_WID_UNO_CHCOLHDR
:
2061 case SC_WID_UNO_CHROWHDR
:
2062 ScUnoHelpFunctions::SetBoolInAny( aAny
, false );
2064 case SC_WID_UNO_CELLSTYL
:
2065 aAny
<<= OUString( ScStyleNameConversion::DisplayToProgrammaticName(
2066 ScGlobal::GetRscString(STR_STYLENAME_STANDARD
), SFX_STYLE_FAMILY_PARA
) );
2068 case SC_WID_UNO_TBLBORD
:
2069 case SC_WID_UNO_TBLBORD2
:
2071 const ScPatternAttr
* pPattern
= pDoc
->GetDefPattern();
2074 if (pEntry
->nWID
== SC_WID_UNO_TBLBORD2
)
2075 ScHelperFunctions::AssignTableBorder2ToAny( aAny
,
2076 (const SvxBoxItem
&)pPattern
->GetItem(ATTR_BORDER
),
2077 (const SvxBoxInfoItem
&)pPattern
->GetItem(ATTR_BORDER_INNER
) );
2079 ScHelperFunctions::AssignTableBorderToAny( aAny
,
2080 (const SvxBoxItem
&)pPattern
->GetItem(ATTR_BORDER
),
2081 (const SvxBoxInfoItem
&)pPattern
->GetItem(ATTR_BORDER_INNER
) );
2085 case SC_WID_UNO_CONDFMT
:
2086 case SC_WID_UNO_CONDLOC
:
2087 case SC_WID_UNO_CONDXML
:
2089 sal_Bool bEnglish
= ( pEntry
->nWID
!= SC_WID_UNO_CONDLOC
);
2090 sal_Bool bXML
= ( pEntry
->nWID
== SC_WID_UNO_CONDXML
);
2091 formula::FormulaGrammar::Grammar eGrammar
= (bXML
?
2092 pDoc
->GetStorageGrammar() :
2093 formula::FormulaGrammar::mapAPItoGrammar( bEnglish
, bXML
));
2095 aAny
<<= uno::Reference
<sheet::XSheetConditionalEntries
>(
2096 new ScTableConditionalFormat( pDoc
, 0, aRanges
[0]->aStart
.Tab(), eGrammar
));
2099 case SC_WID_UNO_VALIDAT
:
2100 case SC_WID_UNO_VALILOC
:
2101 case SC_WID_UNO_VALIXML
:
2103 sal_Bool bEnglish
= ( pEntry
->nWID
!= SC_WID_UNO_VALILOC
);
2104 sal_Bool bXML
= ( pEntry
->nWID
== SC_WID_UNO_VALIXML
);
2105 formula::FormulaGrammar::Grammar eGrammar
= (bXML
?
2106 pDoc
->GetStorageGrammar() :
2107 formula::FormulaGrammar::mapAPItoGrammar( bEnglish
, bXML
));
2109 aAny
<<= uno::Reference
<beans::XPropertySet
>(
2110 new ScTableValidationObj( pDoc
, 0, eGrammar
));
2113 case SC_WID_UNO_NUMRULES
:
2115 aAny
<<= uno::Reference
<container::XIndexReplace
>(ScStyleObj::CreateEmptyNumberingRules());
2127 uno::Reference
<beans::XPropertySetInfo
> SAL_CALL
ScCellRangesBase::getPropertySetInfo()
2128 throw(uno::RuntimeException
)
2130 SolarMutexGuard aGuard
;
2131 static uno::Reference
<beans::XPropertySetInfo
> aRef(
2132 new SfxItemPropertySetInfo( pPropSet
->getPropertyMap() ));
2136 static void lcl_SetCellProperty( const SfxItemPropertySimpleEntry
& rEntry
, const uno::Any
& rValue
,
2137 ScPatternAttr
& rPattern
, ScDocument
* pDoc
,
2138 sal_uInt16
& rFirstItemId
, sal_uInt16
& rSecondItemId
)
2140 rFirstItemId
= rEntry
.nWID
;
2143 SfxItemSet
& rSet
= rPattern
.GetItemSet();
2144 switch ( rEntry
.nWID
)
2146 case ATTR_VALUE_FORMAT
:
2148 // language for number formats
2149 SvNumberFormatter
* pFormatter
= pDoc
->GetFormatTable();
2150 sal_uLong nOldFormat
= ((const SfxUInt32Item
&)rSet
.Get( ATTR_VALUE_FORMAT
)).GetValue();
2151 LanguageType eOldLang
= ((const SvxLanguageItem
&)rSet
.Get( ATTR_LANGUAGE_FORMAT
)).GetLanguage();
2152 nOldFormat
= pFormatter
->GetFormatForLanguageIfBuiltIn( nOldFormat
, eOldLang
);
2154 sal_Int32 nIntVal
= 0;
2155 if ( rValue
>>= nIntVal
)
2157 sal_uLong nNewFormat
= (sal_uLong
)nIntVal
;
2158 rSet
.Put( SfxUInt32Item( ATTR_VALUE_FORMAT
, nNewFormat
) );
2160 const SvNumberformat
* pNewEntry
= pFormatter
->GetEntry( nNewFormat
);
2161 LanguageType eNewLang
=
2162 pNewEntry
? pNewEntry
->GetLanguage() : LANGUAGE_DONTKNOW
;
2163 if ( eNewLang
!= eOldLang
&& eNewLang
!= LANGUAGE_DONTKNOW
)
2165 rSet
.Put( SvxLanguageItem( eNewLang
, ATTR_LANGUAGE_FORMAT
) );
2167 // if only language is changed,
2168 // don't touch number format attribute
2169 sal_uLong nNewMod
= nNewFormat
% SV_COUNTRY_LANGUAGE_OFFSET
;
2170 if ( nNewMod
== ( nOldFormat
% SV_COUNTRY_LANGUAGE_OFFSET
) &&
2171 nNewMod
<= SV_MAX_ANZ_STANDARD_FORMATE
)
2173 rFirstItemId
= 0; // don't use ATTR_VALUE_FORMAT value
2176 rSecondItemId
= ATTR_LANGUAGE_FORMAT
;
2180 throw lang::IllegalArgumentException();
2185 sal_Int16 nIntVal
= 0;
2186 if ( rValue
>>= nIntVal
)
2187 rSet
.Put( SfxUInt16Item( rEntry
.nWID
, (sal_uInt16
)HMMToTwips(nIntVal
) ) );
2189 throw lang::IllegalArgumentException();
2192 case ATTR_ROTATE_VALUE
:
2194 sal_Int32 nRotVal
= 0;
2195 if ( rValue
>>= nRotVal
)
2197 // stored value is always between 0 and 360 deg.
2202 rSet
.Put( SfxInt32Item( ATTR_ROTATE_VALUE
, nRotVal
) );
2205 throw lang::IllegalArgumentException();
2210 table::CellOrientation eOrient
;
2211 if( rValue
>>= eOrient
)
2215 case table::CellOrientation_STANDARD
:
2216 rSet
.Put( SfxBoolItem( ATTR_STACKED
, false ) );
2218 case table::CellOrientation_TOPBOTTOM
:
2219 rSet
.Put( SfxBoolItem( ATTR_STACKED
, false ) );
2220 rSet
.Put( SfxInt32Item( ATTR_ROTATE_VALUE
, 27000 ) );
2221 rSecondItemId
= ATTR_ROTATE_VALUE
;
2223 case table::CellOrientation_BOTTOMTOP
:
2224 rSet
.Put( SfxBoolItem( ATTR_STACKED
, false ) );
2225 rSet
.Put( SfxInt32Item( ATTR_ROTATE_VALUE
, 9000 ) );
2226 rSecondItemId
= ATTR_ROTATE_VALUE
;
2228 case table::CellOrientation_STACKED
:
2229 rSet
.Put( SfxBoolItem( ATTR_STACKED
, sal_True
) );
2233 // added to avoid warnings
2241 lcl_GetCellsPropertySet()->setPropertyValue(rEntry
, rValue
, rSet
);
2246 void SAL_CALL
ScCellRangesBase::setPropertyValue(
2247 const OUString
& aPropertyName
, const uno::Any
& aValue
)
2248 throw(beans::UnknownPropertyException
, beans::PropertyVetoException
,
2249 lang::IllegalArgumentException
, lang::WrappedTargetException
,
2250 uno::RuntimeException
)
2252 SolarMutexGuard aGuard
;
2254 if ( !pDocShell
|| aRanges
.empty() )
2255 throw uno::RuntimeException();
2257 const SfxItemPropertyMap
& rPropertyMap
= GetItemPropertyMap(); // from derived class
2258 const SfxItemPropertySimpleEntry
* pEntry
= rPropertyMap
.getByName( aPropertyName
);
2260 throw beans::UnknownPropertyException();
2262 SetOnePropertyValue( pEntry
, aValue
);
2265 void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry
* pEntry
, const uno::Any
& aValue
)
2266 throw(lang::IllegalArgumentException
, uno::RuntimeException
)
2270 if ( IsScItemWid( pEntry
->nWID
) )
2272 if ( !aRanges
.empty() ) // leer = nichts zu tun
2274 ScDocument
* pDoc
= pDocShell
->GetDocument();
2276 // Fuer Teile von zusammengesetzten Items mit mehreren Properties (z.B. Hintergrund)
2277 // muss vorher das alte Item aus dem Dokument geholt werden
2278 //! Das kann hier aber nicht erkannt werden
2279 //! -> eigenes Flag im PropertyMap-Eintrag, oder was ???
2280 //! Item direkt von einzelner Position im Bereich holen?
2281 // ClearInvalidItems, damit auf jeden Fall ein Item vom richtigen Typ da ist
2283 ScPatternAttr
aPattern( *GetCurrentAttrsDeep() );
2284 SfxItemSet
& rSet
= aPattern
.GetItemSet();
2285 rSet
.ClearInvalidItems();
2287 sal_uInt16 nFirstItem
, nSecondItem
;
2288 lcl_SetCellProperty( *pEntry
, aValue
, aPattern
, pDoc
, nFirstItem
, nSecondItem
);
2290 for (sal_uInt16 nWhich
= ATTR_PATTERN_START
; nWhich
<= ATTR_PATTERN_END
; nWhich
++)
2291 if ( nWhich
!= nFirstItem
&& nWhich
!= nSecondItem
)
2292 rSet
.ClearItem(nWhich
);
2294 pDocShell
->GetDocFunc().ApplyAttributes( *GetMarkData(), aPattern
, sal_True
, sal_True
);
2297 else // implemented here
2298 switch ( pEntry
->nWID
)
2300 case EE_CHAR_ESCAPEMENT
: // Specifically for xlsx import
2302 sal_Int32 nValue
= 0;
2306 for (size_t i
= 0, n
= aRanges
.size(); i
< n
; ++i
)
2308 ScRange aRange
= *aRanges
[i
];
2310 /* TODO: Iterate through the range */
2311 ScAddress aAddr
= aRange
.aStart
;
2312 ScDocument
*pDoc
= pDocShell
->GetDocument();
2313 ScRefCellValue aCell
;
2314 aCell
.assign(*pDoc
, aAddr
);
2316 OUString aStr
= aCell
.getString(pDoc
);
2317 EditEngine
aEngine( pDoc
->GetEnginePool() );
2318 aEngine
.SetEditTextObjectPool(pDoc
->GetEditPool());
2320 /* EE_CHAR_ESCAPEMENT seems to be set on the cell _only_ when
2321 * there are no other attribs for the cell.
2322 * So, it is safe to overwrite the complete attribute set.
2323 * If there is a need - getting CellType and processing
2324 * the attributes could be considered.
2326 SfxItemSet aAttr
= aEngine
.GetEmptyItemSet();
2327 aEngine
.SetText(aStr
);
2328 if( nValue
< 0 ) // Subscript
2329 aAttr
.Put( SvxEscapementItem( SVX_ESCAPEMENT_SUBSCRIPT
, EE_CHAR_ESCAPEMENT
) );
2331 aAttr
.Put( SvxEscapementItem( SVX_ESCAPEMENT_SUPERSCRIPT
, EE_CHAR_ESCAPEMENT
) );
2332 aEngine
.QuickSetAttribs(aAttr
, ESelection(0, 0, 0, aStr
.getLength()));
2334 // The cell will own the text object instance.
2335 pDoc
->SetEditText(aRanges
[0]->aStart
, aEngine
.CreateTextObject());
2340 case SC_WID_UNO_CHCOLHDR
:
2341 // chart header flags are set for this object, not stored with document
2342 bChartColAsHdr
= ScUnoHelpFunctions::GetBoolFromAny( aValue
);
2344 case SC_WID_UNO_CHROWHDR
:
2345 bChartRowAsHdr
= ScUnoHelpFunctions::GetBoolFromAny( aValue
);
2347 case SC_WID_UNO_CELLSTYL
:
2351 String
aString(ScStyleNameConversion::ProgrammaticToDisplayName(
2352 aStrVal
, SFX_STYLE_FAMILY_PARA
));
2353 pDocShell
->GetDocFunc().ApplyStyle( *GetMarkData(), aString
, sal_True
, sal_True
);
2356 case SC_WID_UNO_TBLBORD
:
2358 table::TableBorder aBorder
;
2359 if ( !aRanges
.empty() && ( aValue
>>= aBorder
) ) // empty = nothing to do
2361 SvxBoxItem
aOuter(ATTR_BORDER
);
2362 SvxBoxInfoItem
aInner(ATTR_BORDER_INNER
);
2363 ScHelperFunctions::FillBoxItems( aOuter
, aInner
, aBorder
);
2365 ScHelperFunctions::ApplyBorder( pDocShell
, aRanges
, aOuter
, aInner
); //! docfunc
2369 case SC_WID_UNO_TBLBORD2
:
2371 table::TableBorder2 aBorder2
;
2372 if ( !aRanges
.empty() && ( aValue
>>= aBorder2
) ) // empty = nothing to do
2374 SvxBoxItem
aOuter(ATTR_BORDER
);
2375 SvxBoxInfoItem
aInner(ATTR_BORDER_INNER
);
2376 ScHelperFunctions::FillBoxItems( aOuter
, aInner
, aBorder2
);
2378 ScHelperFunctions::ApplyBorder( pDocShell
, aRanges
, aOuter
, aInner
); //! docfunc
2382 case SC_WID_UNO_CONDFMT
:
2383 case SC_WID_UNO_CONDLOC
:
2384 case SC_WID_UNO_CONDXML
:
2386 uno::Reference
<sheet::XSheetConditionalEntries
> xInterface(aValue
, uno::UNO_QUERY
);
2387 if ( !aRanges
.empty() && xInterface
.is() ) // leer = nichts zu tun
2389 ScTableConditionalFormat
* pFormat
=
2390 ScTableConditionalFormat::getImplementation( xInterface
);
2393 ScDocument
* pDoc
= pDocShell
->GetDocument();
2394 sal_Bool bEnglish
= ( pEntry
->nWID
!= SC_WID_UNO_CONDLOC
);
2395 sal_Bool bXML
= ( pEntry
->nWID
== SC_WID_UNO_CONDXML
);
2396 formula::FormulaGrammar::Grammar eGrammar
= (bXML
?
2397 formula::FormulaGrammar::GRAM_UNSPECIFIED
:
2398 formula::FormulaGrammar::mapAPItoGrammar( bEnglish
, bXML
));
2400 ScConditionalFormat
* pNew
= new ScConditionalFormat( 0, pDoc
); // Index wird beim Einfuegen gesetzt
2401 pFormat
->FillFormat( *pNew
, pDoc
, eGrammar
);
2402 pNew
->AddRange( aRanges
);
2403 SCTAB nTab
= aRanges
.front()->aStart
.Tab();
2404 pDocShell
->GetDocFunc().ReplaceConditionalFormat( 0, pNew
, nTab
, aRanges
);
2409 case SC_WID_UNO_VALIDAT
:
2410 case SC_WID_UNO_VALILOC
:
2411 case SC_WID_UNO_VALIXML
:
2413 uno::Reference
<beans::XPropertySet
> xInterface(aValue
, uno::UNO_QUERY
);
2414 if ( !aRanges
.empty() && xInterface
.is() ) // leer = nichts zu tun
2416 ScTableValidationObj
* pValidObj
=
2417 ScTableValidationObj::getImplementation( xInterface
);
2420 ScDocument
* pDoc
= pDocShell
->GetDocument();
2421 sal_Bool bEnglish
= ( pEntry
->nWID
!= SC_WID_UNO_VALILOC
);
2422 sal_Bool bXML
= ( pEntry
->nWID
== SC_WID_UNO_VALIXML
);
2423 formula::FormulaGrammar::Grammar eGrammar
= (bXML
?
2424 formula::FormulaGrammar::GRAM_UNSPECIFIED
:
2425 formula::FormulaGrammar::mapAPItoGrammar( bEnglish
, bXML
));
2427 ScValidationData
* pNewData
=
2428 pValidObj
->CreateValidationData( pDoc
, eGrammar
);
2429 sal_uLong nIndex
= pDoc
->AddValidationEntry( *pNewData
);
2432 ScPatternAttr
aPattern( pDoc
->GetPool() );
2433 aPattern
.GetItemSet().Put( SfxUInt32Item( ATTR_VALIDDATA
, nIndex
) );
2434 pDocShell
->GetDocFunc().ApplyAttributes( *GetMarkData(), aPattern
, sal_True
, sal_True
);
2439 // SC_WID_UNO_NUMRULES is ignored...
2444 uno::Any SAL_CALL
ScCellRangesBase::getPropertyValue( const OUString
& aPropertyName
)
2445 throw(beans::UnknownPropertyException
, lang::WrappedTargetException
,
2446 uno::RuntimeException
)
2448 SolarMutexGuard aGuard
;
2450 if ( !pDocShell
|| aRanges
.empty() )
2451 throw uno::RuntimeException();
2453 const SfxItemPropertyMap
& rPropertyMap
= GetItemPropertyMap(); // from derived class
2454 const SfxItemPropertySimpleEntry
* pEntry
= rPropertyMap
.getByName( aPropertyName
);
2456 throw beans::UnknownPropertyException();
2459 GetOnePropertyValue( pEntry
, aAny
);
2463 void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry
* pEntry
,
2465 throw(uno::RuntimeException
)
2469 if ( IsScItemWid( pEntry
->nWID
) )
2471 SfxItemSet
* pDataSet
= GetCurrentDataSet();
2474 switch ( pEntry
->nWID
) // fuer Item-Spezial-Behandlungen
2476 case ATTR_VALUE_FORMAT
:
2478 ScDocument
* pDoc
= pDocShell
->GetDocument();
2480 sal_uLong nOldFormat
= ((const SfxUInt32Item
&)
2481 pDataSet
->Get( ATTR_VALUE_FORMAT
)).GetValue();
2482 LanguageType eOldLang
= ((const SvxLanguageItem
&)
2483 pDataSet
->Get( ATTR_LANGUAGE_FORMAT
)).GetLanguage();
2484 nOldFormat
= pDoc
->GetFormatTable()->
2485 GetFormatForLanguageIfBuiltIn( nOldFormat
, eOldLang
);
2486 rAny
<<= (sal_Int32
)( nOldFormat
);
2490 rAny
<<= (sal_Int16
)( TwipsToHMM(((const SfxUInt16Item
&)
2491 pDataSet
->Get(pEntry
->nWID
)).GetValue()) );
2495 sal_Int32 nRot
= ((const SfxInt32Item
&)pDataSet
->Get(ATTR_ROTATE_VALUE
)).GetValue();
2496 sal_Bool bStacked
= ((const SfxBoolItem
&)pDataSet
->Get(pEntry
->nWID
)).GetValue();
2497 SvxOrientationItem( nRot
, bStacked
, 0 ).QueryValue( rAny
);
2501 pPropSet
->getPropertyValue(*pEntry
, *pDataSet
, rAny
);
2505 else // implemented here
2506 switch ( pEntry
->nWID
)
2508 case SC_WID_UNO_CHCOLHDR
:
2509 ScUnoHelpFunctions::SetBoolInAny( rAny
, bChartColAsHdr
);
2511 case SC_WID_UNO_CHROWHDR
:
2512 ScUnoHelpFunctions::SetBoolInAny( rAny
, bChartRowAsHdr
);
2514 case SC_WID_UNO_CELLSTYL
:
2517 const ScStyleSheet
* pStyle
= pDocShell
->GetDocument()->GetSelectionStyle(*GetMarkData());
2519 aStyleName
= pStyle
->GetName();
2520 rAny
<<= OUString( ScStyleNameConversion::DisplayToProgrammaticName(
2521 aStyleName
, SFX_STYLE_FAMILY_PARA
) );
2524 case SC_WID_UNO_TBLBORD
:
2525 case SC_WID_UNO_TBLBORD2
:
2527 //! loop throgh all ranges
2528 if ( !aRanges
.empty() )
2530 const ScRange
* pFirst
= aRanges
[ 0 ];
2531 SvxBoxItem
aOuter(ATTR_BORDER
);
2532 SvxBoxInfoItem
aInner(ATTR_BORDER_INNER
);
2534 ScDocument
* pDoc
= pDocShell
->GetDocument();
2536 aMark
.SetMarkArea( *pFirst
);
2537 aMark
.SelectTable( pFirst
->aStart
.Tab(), sal_True
);
2538 pDoc
->GetSelectionFrame( aMark
, aOuter
, aInner
);
2540 if (pEntry
->nWID
== SC_WID_UNO_TBLBORD2
)
2541 ScHelperFunctions::AssignTableBorder2ToAny( rAny
, aOuter
, aInner
);
2543 ScHelperFunctions::AssignTableBorderToAny( rAny
, aOuter
, aInner
);
2547 case SC_WID_UNO_CONDFMT
:
2548 case SC_WID_UNO_CONDLOC
:
2549 case SC_WID_UNO_CONDXML
:
2551 const ScPatternAttr
* pPattern
= GetCurrentAttrsDeep();
2554 ScDocument
* pDoc
= pDocShell
->GetDocument();
2555 sal_Bool bEnglish
= ( pEntry
->nWID
!= SC_WID_UNO_CONDLOC
);
2556 sal_Bool bXML
= ( pEntry
->nWID
== SC_WID_UNO_CONDXML
);
2557 formula::FormulaGrammar::Grammar eGrammar
= (bXML
?
2558 pDoc
->GetStorageGrammar() :
2559 formula::FormulaGrammar::mapAPItoGrammar( bEnglish
, bXML
));
2560 const std::vector
<sal_uInt32
>& rIndex
= ((const ScCondFormatItem
&)
2561 pPattern
->GetItem(ATTR_CONDITIONAL
)).GetCondFormatData();
2562 sal_uLong nIndex
= 0;
2565 rAny
<<= uno::Reference
<sheet::XSheetConditionalEntries
>(
2566 new ScTableConditionalFormat( pDoc
, nIndex
, aRanges
.front()->aStart
.Tab(), eGrammar
));
2570 case SC_WID_UNO_VALIDAT
:
2571 case SC_WID_UNO_VALILOC
:
2572 case SC_WID_UNO_VALIXML
:
2574 const ScPatternAttr
* pPattern
= GetCurrentAttrsDeep();
2577 ScDocument
* pDoc
= pDocShell
->GetDocument();
2578 sal_Bool bEnglish
= ( pEntry
->nWID
!= SC_WID_UNO_VALILOC
);
2579 sal_Bool bXML
= ( pEntry
->nWID
== SC_WID_UNO_VALIXML
);
2580 formula::FormulaGrammar::Grammar eGrammar
= (bXML
?
2581 pDoc
->GetStorageGrammar() :
2582 formula::FormulaGrammar::mapAPItoGrammar( bEnglish
, bXML
));
2583 sal_uLong nIndex
= ((const SfxUInt32Item
&)
2584 pPattern
->GetItem(ATTR_VALIDDATA
)).GetValue();
2585 rAny
<<= uno::Reference
<beans::XPropertySet
>(
2586 new ScTableValidationObj( pDoc
, nIndex
, eGrammar
));
2590 case SC_WID_UNO_NUMRULES
:
2592 // always return empty numbering rules object
2593 rAny
<<= uno::Reference
<container::XIndexReplace
>(ScStyleObj::CreateEmptyNumberingRules());
2596 case SC_WID_UNO_ABSNAME
:
2599 aRanges
.Format(sRet
, SCR_ABS_3D
, pDocShell
->GetDocument());
2600 rAny
<<= OUString(sRet
);
2606 void SAL_CALL
ScCellRangesBase::addPropertyChangeListener( const OUString
& /* aPropertyName */,
2607 const uno::Reference
<beans::XPropertyChangeListener
>& /* aListener */)
2608 throw(beans::UnknownPropertyException
,
2609 lang::WrappedTargetException
, uno::RuntimeException
)
2611 SolarMutexGuard aGuard
;
2612 if ( aRanges
.empty() )
2613 throw uno::RuntimeException();
2615 OSL_FAIL("not implemented");
2618 void SAL_CALL
ScCellRangesBase::removePropertyChangeListener( const OUString
& /* aPropertyName */,
2619 const uno::Reference
<beans::XPropertyChangeListener
>& /* aListener */)
2620 throw(beans::UnknownPropertyException
,
2621 lang::WrappedTargetException
, uno::RuntimeException
)
2623 SolarMutexGuard aGuard
;
2624 if ( aRanges
.empty() )
2625 throw uno::RuntimeException();
2627 OSL_FAIL("not implemented");
2630 void SAL_CALL
ScCellRangesBase::addVetoableChangeListener( const OUString
&,
2631 const uno::Reference
<beans::XVetoableChangeListener
>&)
2632 throw(beans::UnknownPropertyException
,
2633 lang::WrappedTargetException
, uno::RuntimeException
)
2635 OSL_FAIL("not implemented");
2638 void SAL_CALL
ScCellRangesBase::removeVetoableChangeListener( const OUString
&,
2639 const uno::Reference
<beans::XVetoableChangeListener
>&)
2640 throw(beans::UnknownPropertyException
,
2641 lang::WrappedTargetException
, uno::RuntimeException
)
2643 OSL_FAIL("not implemented");
2646 // XMultiPropertySet
2648 void SAL_CALL
ScCellRangesBase::setPropertyValues( const uno::Sequence
< OUString
>& aPropertyNames
,
2649 const uno::Sequence
< uno::Any
>& aValues
)
2650 throw (beans::PropertyVetoException
,
2651 lang::IllegalArgumentException
,
2652 lang::WrappedTargetException
,
2653 uno::RuntimeException
)
2655 SolarMutexGuard aGuard
;
2657 sal_Int32
nCount(aPropertyNames
.getLength());
2658 sal_Int32
nValues(aValues
.getLength());
2659 if (nCount
!= nValues
)
2660 throw lang::IllegalArgumentException();
2662 if ( pDocShell
&& nCount
)
2664 const SfxItemPropertyMap
& rPropertyMap
= GetItemPropertyMap(); // from derived class
2665 const OUString
* pNames
= aPropertyNames
.getConstArray();
2666 const uno::Any
* pValues
= aValues
.getConstArray();
2668 const SfxItemPropertySimpleEntry
** pEntryArray
= new const SfxItemPropertySimpleEntry
*[nCount
];
2671 for(i
= 0; i
< nCount
; i
++)
2673 // first loop: find all properties in map, but handle only CellStyle
2674 // (CellStyle must be set before any other cell properties)
2676 const SfxItemPropertySimpleEntry
* pEntry
= rPropertyMap
.getByName( pNames
[i
] );
2677 pEntryArray
[i
] = pEntry
;
2680 if ( pEntry
->nWID
== SC_WID_UNO_CELLSTYL
)
2684 SetOnePropertyValue( pEntry
, pValues
[i
] );
2686 catch ( lang::IllegalArgumentException
& )
2688 OSL_FAIL("exception when setting cell style"); // not supposed to happen
2694 ScDocument
* pDoc
= pDocShell
->GetDocument();
2695 ScPatternAttr
* pOldPattern
= NULL
;
2696 ScPatternAttr
* pNewPattern
= NULL
;
2698 for(i
= 0; i
< nCount
; i
++)
2700 // second loop: handle other properties
2702 const SfxItemPropertySimpleEntry
* pEntry
= pEntryArray
[i
];
2705 if ( IsScItemWid( pEntry
->nWID
) ) // can be handled by SfxItemPropertySet
2709 pOldPattern
= new ScPatternAttr( *GetCurrentAttrsDeep() );
2710 pOldPattern
->GetItemSet().ClearInvalidItems();
2711 pNewPattern
= new ScPatternAttr( pDoc
->GetPool() );
2714 // collect items in pNewPattern, apply with one call after the loop
2716 sal_uInt16 nFirstItem
, nSecondItem
;
2717 lcl_SetCellProperty( *pEntry
, pValues
[i
], *pOldPattern
, pDoc
, nFirstItem
, nSecondItem
);
2719 // put only affected items into new set
2721 pNewPattern
->GetItemSet().Put( pOldPattern
->GetItemSet().Get( nFirstItem
) );
2723 pNewPattern
->GetItemSet().Put( pOldPattern
->GetItemSet().Get( nSecondItem
) );
2725 else if ( pEntry
->nWID
!= SC_WID_UNO_CELLSTYL
) // CellStyle is handled above
2727 // call virtual method to set a single property
2728 SetOnePropertyValue( pEntry
, pValues
[i
] );
2733 if ( pNewPattern
&& !aRanges
.empty() )
2734 pDocShell
->GetDocFunc().ApplyAttributes( *GetMarkData(), *pNewPattern
, sal_True
, sal_True
);
2738 delete[] pEntryArray
;
2742 uno::Sequence
<uno::Any
> SAL_CALL
ScCellRangesBase::getPropertyValues(
2743 const uno::Sequence
< OUString
>& aPropertyNames
)
2744 throw (uno::RuntimeException
)
2746 SolarMutexGuard aGuard
;
2748 const SfxItemPropertyMap
& rPropertyMap
= GetItemPropertyMap(); // from derived class
2750 uno::Sequence
<uno::Any
> aRet(aPropertyNames
.getLength());
2751 uno::Any
* pProperties
= aRet
.getArray();
2752 for(sal_Int32 i
= 0; i
< aPropertyNames
.getLength(); i
++)
2754 const SfxItemPropertySimpleEntry
* pEntry
= rPropertyMap
.getByName( aPropertyNames
[i
] );
2755 GetOnePropertyValue( pEntry
, pProperties
[i
] );
2760 void SAL_CALL
ScCellRangesBase::addPropertiesChangeListener( const uno::Sequence
< OUString
>& /* aPropertyNames */,
2761 const uno::Reference
< beans::XPropertiesChangeListener
>& /* xListener */ )
2762 throw (uno::RuntimeException
)
2764 OSL_FAIL("not implemented");
2767 void SAL_CALL
ScCellRangesBase::removePropertiesChangeListener( const uno::Reference
< beans::XPropertiesChangeListener
>& /* xListener */ )
2768 throw (uno::RuntimeException
)
2770 OSL_FAIL("not implemented");
2773 void SAL_CALL
ScCellRangesBase::firePropertiesChangeEvent( const uno::Sequence
< OUString
>& /* aPropertyNames */,
2774 const uno::Reference
< beans::XPropertiesChangeListener
>& /* xListener */ )
2775 throw (uno::RuntimeException
)
2777 OSL_FAIL("not implemented");
2780 IMPL_LINK( ScCellRangesBase
, ValueListenerHdl
, SfxHint
*, pHint
)
2782 if ( pDocShell
&& pHint
&& pHint
->ISA( SfxSimpleHint
) &&
2783 (((const SfxSimpleHint
*)pHint
)->GetId() & SC_HINT_DATACHANGED
))
2785 // This may be called several times for a single change, if several formulas
2786 // in the range are notified. So only a flag is set that is checked when
2787 // SFX_HINT_DATACHANGED is received.
2789 bGotDataChangedHint
= sal_True
;
2794 // XTolerantMultiPropertySet
2795 uno::Sequence
< beans::SetPropertyTolerantFailed
> SAL_CALL
ScCellRangesBase::setPropertyValuesTolerant( const uno::Sequence
< OUString
>& aPropertyNames
,
2796 const uno::Sequence
< uno::Any
>& aValues
)
2797 throw (lang::IllegalArgumentException
, uno::RuntimeException
)
2799 SolarMutexGuard aGuard
;
2801 sal_Int32
nCount(aPropertyNames
.getLength());
2802 sal_Int32
nValues(aValues
.getLength());
2803 if (nCount
!= nValues
)
2804 throw lang::IllegalArgumentException();
2806 if ( pDocShell
&& nCount
)
2808 uno::Sequence
< beans::SetPropertyTolerantFailed
> aReturns(nCount
);
2809 beans::SetPropertyTolerantFailed
* pReturns
= aReturns
.getArray();
2811 const SfxItemPropertyMap
& rPropertyMap
= GetItemPropertyMap(); // from derived class
2812 const OUString
* pNames
= aPropertyNames
.getConstArray();
2813 const uno::Any
* pValues
= aValues
.getConstArray();
2815 const SfxItemPropertySimpleEntry
** pMapArray
= new const SfxItemPropertySimpleEntry
*[nCount
];
2818 for(i
= 0; i
< nCount
; i
++)
2820 // first loop: find all properties in map, but handle only CellStyle
2821 // (CellStyle must be set before any other cell properties)
2823 const SfxItemPropertySimpleEntry
* pEntry
= rPropertyMap
.getByName( pNames
[i
] );
2824 pMapArray
[i
] = pEntry
;
2827 if ( pEntry
->nWID
== SC_WID_UNO_CELLSTYL
)
2831 SetOnePropertyValue( pEntry
, pValues
[i
] );
2833 catch ( lang::IllegalArgumentException
& )
2835 OSL_FAIL("exception when setting cell style"); // not supposed to happen
2841 ScDocument
* pDoc
= pDocShell
->GetDocument();
2842 ScPatternAttr
* pOldPattern
= NULL
;
2843 ScPatternAttr
* pNewPattern
= NULL
;
2845 sal_Int32
nFailed(0);
2846 for(i
= 0; i
< nCount
; i
++)
2848 // second loop: handle other properties
2850 const SfxItemPropertySimpleEntry
* pEntry
= pMapArray
[i
];
2851 if ( pEntry
&& ((pEntry
->nFlags
& beans::PropertyAttribute::READONLY
) == 0))
2853 if ( IsScItemWid( pEntry
->nWID
) ) // can be handled by SfxItemPropertySet
2857 pOldPattern
= new ScPatternAttr( *GetCurrentAttrsDeep() );
2858 pOldPattern
->GetItemSet().ClearInvalidItems();
2859 pNewPattern
= new ScPatternAttr( pDoc
->GetPool() );
2862 // collect items in pNewPattern, apply with one call after the loop
2864 sal_uInt16 nFirstItem
, nSecondItem
;
2867 lcl_SetCellProperty( *pEntry
, pValues
[i
], *pOldPattern
, pDoc
, nFirstItem
, nSecondItem
);
2869 // put only affected items into new set
2871 pNewPattern
->GetItemSet().Put( pOldPattern
->GetItemSet().Get( nFirstItem
) );
2873 pNewPattern
->GetItemSet().Put( pOldPattern
->GetItemSet().Get( nSecondItem
) );
2875 catch ( lang::IllegalArgumentException
& )
2877 pReturns
[nFailed
].Name
= pNames
[i
];
2878 pReturns
[nFailed
++].Result
= beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT
;
2881 else if ( pEntry
->nWID
!= SC_WID_UNO_CELLSTYL
) // CellStyle is handled above
2883 // call virtual method to set a single property
2886 SetOnePropertyValue( pEntry
, pValues
[i
] );
2888 catch ( lang::IllegalArgumentException
& )
2890 pReturns
[nFailed
].Name
= pNames
[i
];
2891 pReturns
[nFailed
++].Result
= beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT
;
2897 pReturns
[nFailed
].Name
= pNames
[i
];
2899 pReturns
[nFailed
++].Result
= beans::TolerantPropertySetResultType::PROPERTY_VETO
;
2901 pReturns
[nFailed
++].Result
= beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY
;
2905 if ( pNewPattern
&& !aRanges
.empty() )
2906 pDocShell
->GetDocFunc().ApplyAttributes( *GetMarkData(), *pNewPattern
, sal_True
, sal_True
);
2912 aReturns
.realloc(nFailed
);
2916 return uno::Sequence
< beans::SetPropertyTolerantFailed
>();
2919 uno::Sequence
< beans::GetPropertyTolerantResult
> SAL_CALL
ScCellRangesBase::getPropertyValuesTolerant( const uno::Sequence
< OUString
>& aPropertyNames
)
2920 throw (uno::RuntimeException
)
2922 SolarMutexGuard aGuard
;
2924 sal_Int32
nCount(aPropertyNames
.getLength());
2925 uno::Sequence
< beans::GetPropertyTolerantResult
> aReturns(nCount
);
2926 beans::GetPropertyTolerantResult
* pReturns
= aReturns
.getArray();
2928 const SfxItemPropertyMap
& rPropertyMap
= GetItemPropertyMap(); // from derived class
2930 for(sal_Int32 i
= 0; i
< nCount
; i
++)
2932 const SfxItemPropertySimpleEntry
* pEntry
= rPropertyMap
.getByName( aPropertyNames
[i
] );
2935 pReturns
[i
].Result
= beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY
;
2939 sal_uInt16 nItemWhich
= 0;
2940 lcl_GetPropertyWhich( pEntry
, nItemWhich
);
2941 pReturns
[i
].State
= GetOnePropertyState( nItemWhich
, pEntry
);
2942 GetOnePropertyValue( pEntry
, pReturns
[i
].Value
);
2943 pReturns
[i
].Result
= beans::TolerantPropertySetResultType::SUCCESS
;
2949 uno::Sequence
< beans::GetDirectPropertyTolerantResult
> SAL_CALL
ScCellRangesBase::getDirectPropertyValuesTolerant( const uno::Sequence
< OUString
>& aPropertyNames
)
2950 throw (uno::RuntimeException
)
2952 SolarMutexGuard aGuard
;
2954 sal_Int32
nCount(aPropertyNames
.getLength());
2955 uno::Sequence
< beans::GetDirectPropertyTolerantResult
> aReturns(nCount
);
2956 beans::GetDirectPropertyTolerantResult
* pReturns
= aReturns
.getArray();
2958 const SfxItemPropertyMap
& rPropertyMap
= GetItemPropertyMap(); // from derived class
2961 for(sal_Int32 i
= 0; i
< nCount
; i
++)
2963 const SfxItemPropertySimpleEntry
* pEntry
= rPropertyMap
.getByName( aPropertyNames
[i
] );
2966 pReturns
[i
].Result
= beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY
;
2970 sal_uInt16 nItemWhich
= 0;
2971 lcl_GetPropertyWhich( pEntry
, nItemWhich
);
2972 pReturns
[j
].State
= GetOnePropertyState( nItemWhich
, pEntry
);
2973 if (pReturns
[j
].State
== beans::PropertyState_DIRECT_VALUE
)
2975 GetOnePropertyValue( pEntry
, pReturns
[j
].Value
);
2976 pReturns
[j
].Result
= beans::TolerantPropertySetResultType::SUCCESS
;
2977 pReturns
[j
].Name
= aPropertyNames
[i
];
2983 aReturns
.realloc(j
);
2989 void SAL_CALL
ScCellRangesBase::decrementIndent() throw(::com::sun::star::uno::RuntimeException
)
2991 SolarMutexGuard aGuard
;
2992 if ( pDocShell
&& !aRanges
.empty() ) // leer = nichts zu tun
2994 //#97041#; put only MultiMarked ScMarkData in ChangeIndent
2995 ScMarkData
aMarkData(*GetMarkData());
2996 aMarkData
.MarkToMulti();
2997 pDocShell
->GetDocFunc().ChangeIndent( aMarkData
, false, sal_True
);
3001 void SAL_CALL
ScCellRangesBase::incrementIndent() throw(::com::sun::star::uno::RuntimeException
)
3003 SolarMutexGuard aGuard
;
3004 if ( pDocShell
&& !aRanges
.empty() ) // leer = nichts zu tun
3006 //#97041#; put only MultiMarked ScMarkData in ChangeIndent
3007 ScMarkData
aMarkData(*GetMarkData());
3008 aMarkData
.MarkToMulti();
3009 pDocShell
->GetDocFunc().ChangeIndent( aMarkData
, sal_True
, sal_True
);
3015 ScMemChart
* ScCellRangesBase::CreateMemChart_Impl() const
3017 if ( pDocShell
&& !aRanges
.empty() )
3019 ScRangeListRef xChartRanges
;
3020 if ( aRanges
.size() == 1 )
3022 // ganze Tabelle sinnvoll begrenzen (auf belegten Datenbereich)
3023 // (nur hier, Listener werden auf den ganzen Bereich angemeldet)
3024 //! direkt testen, ob es ein ScTableSheetObj ist?
3026 const ScRange
* pRange
= aRanges
[0];
3027 if ( pRange
->aStart
.Col() == 0 && pRange
->aEnd
.Col() == MAXCOL
&&
3028 pRange
->aStart
.Row() == 0 && pRange
->aEnd
.Row() == MAXROW
)
3030 SCTAB nTab
= pRange
->aStart
.Tab();
3033 SCROW nStartY
; // Anfang holen
3034 if (!pDocShell
->GetDocument()->GetDataStart( nTab
, nStartX
, nStartY
))
3041 SCROW nEndY
; // Ende holen
3042 if (!pDocShell
->GetDocument()->GetTableArea( nTab
, nEndX
, nEndY
))
3048 xChartRanges
= new ScRangeList
;
3049 xChartRanges
->Append( ScRange( nStartX
, nStartY
, nTab
, nEndX
, nEndY
, nTab
) );
3052 if (!xChartRanges
.Is()) // sonst Ranges direkt uebernehmen
3053 xChartRanges
= new ScRangeList(aRanges
);
3054 ScChartArray
aArr( pDocShell
->GetDocument(), xChartRanges
, String() );
3056 // RowAsHdr = ColHeaders und umgekehrt
3057 aArr
.SetHeaders( bChartRowAsHdr
, bChartColAsHdr
);
3059 return aArr
.CreateMemChart();
3064 uno::Sequence
< uno::Sequence
<double> > SAL_CALL
ScCellRangesBase::getData()
3065 throw(uno::RuntimeException
)
3067 SolarMutexGuard aGuard
;
3068 ScMemChart
* pMemChart
= CreateMemChart_Impl();
3071 sal_Int32 nColCount
= pMemChart
->GetColCount();
3072 sal_Int32 nRowCount
= static_cast<sal_Int32
>(pMemChart
->GetRowCount());
3074 uno::Sequence
< uno::Sequence
<double> > aRowSeq( nRowCount
);
3075 uno::Sequence
<double>* pRowAry
= aRowSeq
.getArray();
3076 for (sal_Int32 nRow
= 0; nRow
< nRowCount
; nRow
++)
3078 uno::Sequence
<double> aColSeq( nColCount
);
3079 double* pColAry
= aColSeq
.getArray();
3080 for (sal_Int32 nCol
= 0; nCol
< nColCount
; nCol
++)
3081 pColAry
[nCol
] = pMemChart
->GetData( static_cast<short>(nCol
), static_cast<short>(nRow
) );
3083 pRowAry
[nRow
] = aColSeq
;
3090 return uno::Sequence
< uno::Sequence
<double> >(0);
3093 ScRangeListRef
ScCellRangesBase::GetLimitedChartRanges_Impl( long nDataColumns
, long nDataRows
) const
3095 if ( aRanges
.size() == 1 )
3097 const ScRange
* pRange
= aRanges
[0];
3098 if ( pRange
->aStart
.Col() == 0 && pRange
->aEnd
.Col() == MAXCOL
&&
3099 pRange
->aStart
.Row() == 0 && pRange
->aEnd
.Row() == MAXROW
)
3101 // if aRanges is a complete sheet, limit to given size
3103 SCTAB nTab
= pRange
->aStart
.Tab();
3105 long nEndColumn
= nDataColumns
- 1 + ( bChartColAsHdr
? 1 : 0 );
3106 if ( nEndColumn
< 0 )
3108 if ( nEndColumn
> MAXCOL
)
3109 nEndColumn
= MAXCOL
;
3111 long nEndRow
= nDataRows
- 1 + ( bChartRowAsHdr
? 1 : 0 );
3114 if ( nEndRow
> MAXROW
)
3117 ScRangeListRef xChartRanges
= new ScRangeList
;
3118 xChartRanges
->Append( ScRange( 0, 0, nTab
, (SCCOL
)nEndColumn
, (SCROW
)nEndRow
, nTab
) );
3119 return xChartRanges
;
3123 return new ScRangeList(aRanges
); // as-is
3126 void SAL_CALL
ScCellRangesBase::setData( const uno::Sequence
< uno::Sequence
<double> >& aData
)
3127 throw(uno::RuntimeException
)
3129 SolarMutexGuard aGuard
;
3130 sal_Bool bDone
= false;
3131 long nRowCount
= aData
.getLength();
3132 long nColCount
= nRowCount
? aData
[0].getLength() : 0;
3133 ScRangeListRef xChartRanges
= GetLimitedChartRanges_Impl( nColCount
, nRowCount
);
3134 if ( pDocShell
&& xChartRanges
.Is() )
3136 ScDocument
* pDoc
= pDocShell
->GetDocument();
3137 ScChartArray
aArr( pDoc
, xChartRanges
, String() );
3138 aArr
.SetHeaders( bChartRowAsHdr
, bChartColAsHdr
); // RowAsHdr = ColHeaders
3139 const ScChartPositionMap
* pPosMap
= aArr
.GetPositionMap();
3142 if ( pPosMap
->GetColCount() == static_cast<SCCOL
>(nColCount
) &&
3143 pPosMap
->GetRowCount() == static_cast<SCROW
>(nRowCount
) )
3145 for (long nRow
=0; nRow
<nRowCount
; nRow
++)
3147 const uno::Sequence
<double>& rRowSeq
= aData
[nRow
];
3148 const double* pArray
= rRowSeq
.getConstArray();
3149 nColCount
= rRowSeq
.getLength();
3150 for (long nCol
=0; nCol
<nColCount
; nCol
++)
3152 const ScAddress
* pPos
= pPosMap
->GetPosition(
3153 sal::static_int_cast
<SCCOL
>(nCol
),
3154 sal::static_int_cast
<SCROW
>(nRow
) );
3157 double fVal
= pArray
[nCol
];
3158 if ( fVal
== DBL_MIN
)
3159 pDoc
->SetEmptyCell(*pPos
);
3161 pDoc
->SetValue(*pPos
, pArray
[nCol
]);
3167 PaintRanges_Impl( PAINT_GRID
);
3168 pDocShell
->SetDocumentModified();
3169 ForceChartListener_Impl(); // call listeners for this object synchronously
3176 throw uno::RuntimeException();
3179 uno::Sequence
<OUString
> SAL_CALL
ScCellRangesBase::getRowDescriptions()
3180 throw(uno::RuntimeException
)
3182 SolarMutexGuard aGuard
;
3183 ScMemChart
* pMemChart
= CreateMemChart_Impl();
3186 sal_Int32 nRowCount
= static_cast<sal_Int32
>(pMemChart
->GetRowCount());
3187 uno::Sequence
<OUString
> aSeq( nRowCount
);
3188 OUString
* pAry
= aSeq
.getArray();
3189 for (sal_Int32 nRow
= 0; nRow
< nRowCount
; nRow
++)
3190 pAry
[nRow
] = pMemChart
->GetRowText(static_cast<short>(nRow
));
3195 return uno::Sequence
<OUString
>(0);
3198 void SAL_CALL
ScCellRangesBase::setRowDescriptions(
3199 const uno::Sequence
<OUString
>& aRowDescriptions
)
3200 throw(uno::RuntimeException
)
3202 SolarMutexGuard aGuard
;
3203 sal_Bool bDone
= false;
3204 if ( bChartColAsHdr
)
3206 long nRowCount
= aRowDescriptions
.getLength();
3207 ScRangeListRef xChartRanges
= GetLimitedChartRanges_Impl( 1, nRowCount
);
3208 if ( pDocShell
&& xChartRanges
.Is() )
3210 ScDocument
* pDoc
= pDocShell
->GetDocument();
3211 ScChartArray
aArr( pDoc
, xChartRanges
, String() );
3212 aArr
.SetHeaders( bChartRowAsHdr
, bChartColAsHdr
); // RowAsHdr = ColHeaders
3213 const ScChartPositionMap
* pPosMap
= aArr
.GetPositionMap();
3216 if ( pPosMap
->GetRowCount() == static_cast<SCROW
>(nRowCount
) )
3218 const OUString
* pArray
= aRowDescriptions
.getConstArray();
3219 for (long nRow
=0; nRow
<nRowCount
; nRow
++)
3221 const ScAddress
* pPos
= pPosMap
->GetRowHeaderPosition(
3222 static_cast<SCSIZE
>(nRow
) );
3225 const OUString
& aStr
= pArray
[nRow
];
3227 pDoc
->SetEmptyCell(*pPos
);
3230 ScSetStringParam aParam
;
3231 aParam
.setTextInput();
3232 pDoc
->SetString(*pPos
, aStr
, &aParam
);
3238 PaintRanges_Impl( PAINT_GRID
);
3239 pDocShell
->SetDocumentModified();
3240 ForceChartListener_Impl(); // call listeners for this object synchronously
3248 throw uno::RuntimeException();
3251 uno::Sequence
<OUString
> SAL_CALL
ScCellRangesBase::getColumnDescriptions()
3252 throw(uno::RuntimeException
)
3254 SolarMutexGuard aGuard
;
3255 ScMemChart
* pMemChart
= CreateMemChart_Impl();
3258 sal_Int32 nColCount
= pMemChart
->GetColCount();
3259 uno::Sequence
<OUString
> aSeq( nColCount
);
3260 OUString
* pAry
= aSeq
.getArray();
3261 for (sal_Int32 nCol
= 0; nCol
< nColCount
; nCol
++)
3262 pAry
[nCol
] = pMemChart
->GetColText(static_cast<short>(nCol
));
3267 return uno::Sequence
<OUString
>(0);
3270 void SAL_CALL
ScCellRangesBase::setColumnDescriptions(
3271 const uno::Sequence
<OUString
>& aColumnDescriptions
)
3272 throw(uno::RuntimeException
)
3274 SolarMutexGuard aGuard
;
3275 sal_Bool bDone
= false;
3276 if ( bChartRowAsHdr
)
3278 long nColCount
= aColumnDescriptions
.getLength();
3279 ScRangeListRef xChartRanges
= GetLimitedChartRanges_Impl( nColCount
, 1 );
3280 if ( pDocShell
&& xChartRanges
.Is() )
3282 ScDocument
* pDoc
= pDocShell
->GetDocument();
3283 ScChartArray
aArr( pDoc
, xChartRanges
, String() );
3284 aArr
.SetHeaders( bChartRowAsHdr
, bChartColAsHdr
); // RowAsHdr = ColHeaders
3285 const ScChartPositionMap
* pPosMap
= aArr
.GetPositionMap();
3288 if ( pPosMap
->GetColCount() == static_cast<SCCOL
>(nColCount
) )
3290 const OUString
* pArray
= aColumnDescriptions
.getConstArray();
3291 for (long nCol
=0; nCol
<nColCount
; nCol
++)
3293 const ScAddress
* pPos
= pPosMap
->GetColHeaderPosition(
3294 sal::static_int_cast
<SCCOL
>(nCol
) );
3297 const OUString
& aStr
= pArray
[nCol
];
3299 pDoc
->SetEmptyCell(*pPos
);
3302 ScSetStringParam aParam
;
3303 aParam
.setTextInput();
3304 pDoc
->SetString(*pPos
, aStr
, &aParam
);
3310 PaintRanges_Impl( PAINT_GRID
);
3311 pDocShell
->SetDocumentModified();
3312 ForceChartListener_Impl(); // call listeners for this object synchronously
3320 throw uno::RuntimeException();
3323 void ScCellRangesBase::ForceChartListener_Impl()
3325 // call Update immediately so the caller to setData etc. can
3326 // regognize the listener call
3331 ScChartListenerCollection
* pColl
= pDocShell
->GetDocument()->GetChartListenerCollection();
3335 ScChartListenerCollection::ListenersType
& rListeners
= pColl
->getListeners();
3336 ScChartListenerCollection::ListenersType::iterator it
= rListeners
.begin(), itEnd
= rListeners
.end();
3337 for (; it
!= itEnd
; ++it
)
3339 ScChartListener
* p
= it
->second
;
3341 if (p
->GetUnoSource() == static_cast<chart::XChartData
*>(this) && p
->IsDirty())
3346 void SAL_CALL
ScCellRangesBase::addChartDataChangeEventListener( const uno::Reference
<
3347 chart::XChartDataChangeEventListener
>& aListener
)
3348 throw(uno::RuntimeException
)
3350 SolarMutexGuard aGuard
;
3351 if ( pDocShell
&& !aRanges
.empty() )
3353 //! auf doppelte testen?
3355 ScDocument
* pDoc
= pDocShell
->GetDocument();
3356 ScRangeListRef
aRangesRef( new ScRangeList(aRanges
) );
3357 ScChartListenerCollection
* pColl
= pDoc
->GetChartListenerCollection();
3358 OUString aName
= pColl
->getUniqueName(OUString("__Uno"));
3359 if (aName
.isEmpty())
3360 // failed to create unique name.
3363 ScChartListener
* pListener
= new ScChartListener( aName
, pDoc
, aRangesRef
);
3364 pListener
->SetUno( aListener
, this );
3365 pColl
->insert( pListener
);
3366 pListener
->StartListeningTo();
3370 void SAL_CALL
ScCellRangesBase::removeChartDataChangeEventListener( const uno::Reference
<
3371 chart::XChartDataChangeEventListener
>& aListener
)
3372 throw(uno::RuntimeException
)
3374 SolarMutexGuard aGuard
;
3375 if ( pDocShell
&& !aRanges
.empty() )
3377 ScDocument
* pDoc
= pDocShell
->GetDocument();
3378 ScChartListenerCollection
* pColl
= pDoc
->GetChartListenerCollection();
3379 pColl
->FreeUno( aListener
, this );
3383 double SAL_CALL
ScCellRangesBase::getNotANumber() throw(::com::sun::star::uno::RuntimeException
)
3385 // im ScChartArray wird DBL_MIN verwendet, weil das Chart es so will
3389 sal_Bool SAL_CALL
ScCellRangesBase::isNotANumber( double nNumber
) throw(uno::RuntimeException
)
3391 // im ScChartArray wird DBL_MIN verwendet, weil das Chart es so will
3392 return (nNumber
== DBL_MIN
);
3395 // XModifyBroadcaster
3397 void SAL_CALL
ScCellRangesBase::addModifyListener( const uno::Reference
<util::XModifyListener
>& aListener
)
3398 throw(uno::RuntimeException
)
3400 SolarMutexGuard aGuard
;
3401 if ( aRanges
.empty() )
3402 throw uno::RuntimeException();
3404 uno::Reference
<util::XModifyListener
> *pObj
=
3405 new uno::Reference
<util::XModifyListener
>( aListener
);
3406 aValueListeners
.push_back( pObj
);
3408 if ( aValueListeners
.size() == 1 )
3410 if (!pValueListener
)
3411 pValueListener
= new ScLinkListener( LINK( this, ScCellRangesBase
, ValueListenerHdl
) );
3413 ScDocument
* pDoc
= pDocShell
->GetDocument();
3414 for ( size_t i
= 0, nCount
= aRanges
.size(); i
< nCount
; i
++)
3415 pDoc
->StartListeningArea( *aRanges
[ i
], pValueListener
);
3417 acquire(); // don't lose this object (one ref for all listeners)
3421 void SAL_CALL
ScCellRangesBase::removeModifyListener( const uno::Reference
<util::XModifyListener
>& aListener
)
3422 throw(uno::RuntimeException
)
3425 SolarMutexGuard aGuard
;
3426 if ( aRanges
.empty() )
3427 throw uno::RuntimeException();
3429 acquire(); // in case the listeners have the last ref - released below
3431 sal_uInt16 nCount
= aValueListeners
.size();
3432 for ( sal_uInt16 n
=nCount
; n
--; )
3434 uno::Reference
<util::XModifyListener
>& rObj
= aValueListeners
[n
];
3435 if ( rObj
== aListener
)
3437 aValueListeners
.erase( aValueListeners
.begin() + n
);
3439 if ( aValueListeners
.empty() )
3442 pValueListener
->EndListeningAll();
3444 release(); // release the ref for the listeners
3451 release(); // might delete this object
3456 uno::Reference
<sheet::XSheetCellRanges
> SAL_CALL
ScCellRangesBase::queryVisibleCells()
3457 throw(uno::RuntimeException
)
3459 SolarMutexGuard aGuard
;
3462 //! fuer alle Tabellen getrennt, wenn Markierungen pro Tabelle getrennt sind!
3463 SCTAB nTab
= lcl_FirstTab(aRanges
);
3465 ScMarkData
aMarkData(*GetMarkData());
3467 ScDocument
* pDoc
= pDocShell
->GetDocument();
3468 SCCOL nCol
= 0, nLastCol
;
3469 while (nCol
<= MAXCOL
)
3471 if (pDoc
->ColHidden(nCol
, nTab
, NULL
, &nLastCol
))
3472 // hidden columns. Unselect them.
3473 aMarkData
.SetMultiMarkArea(ScRange(nCol
, 0, nTab
, nLastCol
, MAXROW
, nTab
), false);
3475 nCol
= nLastCol
+ 1;
3478 SCROW nRow
= 0, nLastRow
;
3479 while (nRow
<= MAXROW
)
3481 if (pDoc
->RowHidden(nRow
, nTab
, NULL
, &nLastRow
))
3482 // These rows are hidden. Unselect them.
3483 aMarkData
.SetMultiMarkArea(ScRange(0, nRow
, nTab
, MAXCOL
, nLastRow
, nTab
), false);
3485 nRow
= nLastRow
+ 1;
3488 ScRangeList aNewRanges
;
3489 aMarkData
.FillRangeListWithMarks( &aNewRanges
, false );
3490 return new ScCellRangesObj( pDocShell
, aNewRanges
);
3496 uno::Reference
<sheet::XSheetCellRanges
> SAL_CALL
ScCellRangesBase::queryEmptyCells()
3497 throw(uno::RuntimeException
)
3499 SolarMutexGuard aGuard
;
3502 ScDocument
* pDoc
= pDocShell
->GetDocument();
3504 ScMarkData
aMarkData(*GetMarkData());
3506 // belegte Zellen wegmarkieren
3507 for (size_t i
= 0, nCount
= aRanges
.size(); i
< nCount
; ++i
)
3509 ScRange aRange
= *aRanges
[ i
];
3511 ScCellIterator
aIter( pDoc
, aRange
);
3512 for (bool bHasCell
= aIter
.first(); bHasCell
; bHasCell
= aIter
.next())
3514 // Notizen zaehlen als nicht-leer
3515 if (!aIter
.isEmpty())
3516 aMarkData
.SetMultiMarkArea(aIter
.GetPos(), false);
3520 ScRangeList aNewRanges
;
3521 // IsMultiMarked reicht hier nicht (wird beim deselektieren nicht zurueckgesetzt)
3522 //if (aMarkData.HasAnyMultiMarks()) // #i20044# should be set for all empty range
3523 aMarkData
.FillRangeListWithMarks( &aNewRanges
, false );
3525 return new ScCellRangesObj( pDocShell
, aNewRanges
); // aNewRanges kann leer sein
3531 uno::Reference
<sheet::XSheetCellRanges
> SAL_CALL
ScCellRangesBase::queryContentCells(
3532 sal_Int16 nContentFlags
)
3533 throw(uno::RuntimeException
)
3535 SolarMutexGuard aGuard
;
3538 ScDocument
* pDoc
= pDocShell
->GetDocument();
3540 ScMarkData aMarkData
;
3542 // passende Zellen selektieren
3543 for ( size_t i
= 0, nCount
= aRanges
.size(); i
< nCount
; ++i
)
3545 ScRange aRange
= *aRanges
[ i
];
3547 ScCellIterator
aIter( pDoc
, aRange
);
3548 for (bool bHasCell
= aIter
.first(); bHasCell
; bHasCell
= aIter
.next())
3551 switch (aIter
.getType())
3553 case CELLTYPE_STRING
:
3554 if ( nContentFlags
& sheet::CellFlags::STRING
)
3558 if ( (nContentFlags
& sheet::CellFlags::STRING
) || (nContentFlags
& sheet::CellFlags::FORMATTED
) )
3561 case CELLTYPE_FORMULA
:
3562 if ( nContentFlags
& sheet::CellFlags::FORMULA
)
3565 case CELLTYPE_VALUE
:
3566 if ( (nContentFlags
& (sheet::CellFlags::VALUE
|sheet::CellFlags::DATETIME
))
3567 == (sheet::CellFlags::VALUE
|sheet::CellFlags::DATETIME
) )
3571 // Date/Time Erkennung
3573 sal_uLong nIndex
= (sal_uLong
)((SfxUInt32Item
*)pDoc
->GetAttr(
3574 aIter
.GetPos(), ATTR_VALUE_FORMAT
))->GetValue();
3575 short nTyp
= pDoc
->GetFormatTable()->GetType(nIndex
);
3576 if ((nTyp
== NUMBERFORMAT_DATE
) || (nTyp
== NUMBERFORMAT_TIME
) ||
3577 (nTyp
== NUMBERFORMAT_DATETIME
))
3579 if ( nContentFlags
& sheet::CellFlags::DATETIME
)
3584 if ( nContentFlags
& sheet::CellFlags::VALUE
)
3591 // added to avoid warnings
3596 aMarkData
.SetMultiMarkArea(aIter
.GetPos(), true);
3601 ScRangeList aNewRanges
;
3602 if (aMarkData
.IsMultiMarked())
3603 aMarkData
.FillRangeListWithMarks( &aNewRanges
, false );
3605 return new ScCellRangesObj( pDocShell
, aNewRanges
); // aNewRanges kann leer sein
3611 uno::Reference
<sheet::XSheetCellRanges
> SAL_CALL
ScCellRangesBase::queryFormulaCells(
3612 sal_Int32 nResultFlags
)
3613 throw(uno::RuntimeException
)
3615 SolarMutexGuard aGuard
;
3618 ScDocument
* pDoc
= pDocShell
->GetDocument();
3620 ScMarkData aMarkData
;
3622 // passende Zellen selektieren
3623 for ( size_t i
= 0, nCount
= aRanges
.size(); i
< nCount
; ++i
)
3625 ScRange aRange
= *aRanges
[ i
];
3627 ScCellIterator
aIter( pDoc
, aRange
);
3628 for (bool bHasCell
= aIter
.first(); bHasCell
; bHasCell
= aIter
.next())
3630 if (aIter
.getType() == CELLTYPE_FORMULA
)
3632 ScFormulaCell
* pFCell
= aIter
.getFormulaCell();
3634 if (pFCell
->GetErrCode())
3636 if ( nResultFlags
& sheet::FormulaResult::ERROR
)
3639 else if (pFCell
->IsValue())
3641 if ( nResultFlags
& sheet::FormulaResult::VALUE
)
3646 if ( nResultFlags
& sheet::FormulaResult::STRING
)
3651 aMarkData
.SetMultiMarkArea(aIter
.GetPos(), true);
3656 ScRangeList aNewRanges
;
3657 if (aMarkData
.IsMultiMarked())
3658 aMarkData
.FillRangeListWithMarks( &aNewRanges
, false );
3660 return new ScCellRangesObj( pDocShell
, aNewRanges
); // aNewRanges kann leer sein
3666 uno::Reference
<sheet::XSheetCellRanges
> ScCellRangesBase::QueryDifferences_Impl(
3667 const table::CellAddress
& aCompare
, sal_Bool bColumnDiff
)
3671 size_t nRangeCount
= aRanges
.size();
3673 ScDocument
* pDoc
= pDocShell
->GetDocument();
3674 ScMarkData aMarkData
;
3676 SCCOLROW nCmpPos
= bColumnDiff
? (SCCOLROW
)aCompare
.Row
: (SCCOLROW
)aCompare
.Column
;
3678 // zuerst alles selektieren, wo ueberhaupt etwas in der Vergleichsspalte steht
3679 // (fuer gleiche Zellen wird die Selektion im zweiten Schritt aufgehoben)
3681 SCTAB nTab
= lcl_FirstTab(aRanges
); //! fuer alle Tabellen, wenn Markierungen pro Tabelle!
3682 ScRange aCmpRange
, aCellRange
;
3684 aCmpRange
= ScRange( 0,nCmpPos
,nTab
, MAXCOL
,nCmpPos
,nTab
);
3686 aCmpRange
= ScRange( static_cast<SCCOL
>(nCmpPos
),0,nTab
, static_cast<SCCOL
>(nCmpPos
),MAXROW
,nTab
);
3687 ScCellIterator
aCmpIter( pDoc
, aCmpRange
);
3688 for (bool bHasCell
= aCmpIter
.first(); bHasCell
; bHasCell
= aCmpIter
.next())
3690 SCCOLROW nCellPos
= bColumnDiff
? static_cast<SCCOLROW
>(aCmpIter
.GetPos().Col()) : static_cast<SCCOLROW
>(aCmpIter
.GetPos().Row());
3692 aCellRange
= ScRange( static_cast<SCCOL
>(nCellPos
),0,nTab
,
3693 static_cast<SCCOL
>(nCellPos
),MAXROW
,nTab
);
3695 aCellRange
= ScRange( 0,nCellPos
,nTab
, MAXCOL
,nCellPos
,nTab
);
3697 for (i
=0; i
<nRangeCount
; i
++)
3699 ScRange
aRange( *aRanges
[ i
] );
3700 if ( aRange
.Intersects( aCellRange
) )
3704 aRange
.aStart
.SetCol(static_cast<SCCOL
>(nCellPos
));
3705 aRange
.aEnd
.SetCol(static_cast<SCCOL
>(nCellPos
));
3709 aRange
.aStart
.SetRow(nCellPos
);
3710 aRange
.aEnd
.SetRow(nCellPos
);
3712 aMarkData
.SetMultiMarkArea( aRange
);
3717 // alle nichtleeren Zellen mit der Vergleichsspalte vergleichen und entsprechend
3718 // selektieren oder aufheben
3721 for (i
=0; i
<nRangeCount
; i
++)
3723 ScRange
aRange( *aRanges
[ i
] );
3725 ScCellIterator
aIter( pDoc
, aRange
);
3726 for (bool bHasCell
= aIter
.first(); bHasCell
; bHasCell
= aIter
.next())
3729 aCmpAddr
= ScAddress( aIter
.GetPos().Col(), nCmpPos
, aIter
.GetPos().Tab() );
3731 aCmpAddr
= ScAddress( static_cast<SCCOL
>(nCmpPos
), aIter
.GetPos().Row(), aIter
.GetPos().Tab() );
3733 ScRange
aOneRange(aIter
.GetPos());
3734 if (!aIter
.equalsWithoutFormat(aCmpAddr
))
3735 aMarkData
.SetMultiMarkArea( aOneRange
);
3737 aMarkData
.SetMultiMarkArea( aOneRange
, false ); // deselect
3741 ScRangeList aNewRanges
;
3742 if (aMarkData
.IsMultiMarked())
3743 aMarkData
.FillRangeListWithMarks( &aNewRanges
, false );
3745 return new ScCellRangesObj( pDocShell
, aNewRanges
); // aNewRanges kann leer sein
3750 uno::Reference
<sheet::XSheetCellRanges
> SAL_CALL
ScCellRangesBase::queryColumnDifferences(
3751 const table::CellAddress
& aCompare
) throw(uno::RuntimeException
)
3753 SolarMutexGuard aGuard
;
3754 return QueryDifferences_Impl( aCompare
, true );
3757 uno::Reference
<sheet::XSheetCellRanges
> SAL_CALL
ScCellRangesBase::queryRowDifferences(
3758 const table::CellAddress
& aCompare
) throw(uno::RuntimeException
)
3760 SolarMutexGuard aGuard
;
3761 return QueryDifferences_Impl( aCompare
, false );
3764 uno::Reference
<sheet::XSheetCellRanges
> SAL_CALL
ScCellRangesBase::queryIntersection(
3765 const table::CellRangeAddress
& aRange
) throw(uno::RuntimeException
)
3767 SolarMutexGuard aGuard
;
3768 ScRange
aMask( (SCCOL
)aRange
.StartColumn
, (SCROW
)aRange
.StartRow
, aRange
.Sheet
,
3769 (SCCOL
)aRange
.EndColumn
, (SCROW
)aRange
.EndRow
, aRange
.Sheet
);
3772 for ( size_t i
= 0, nCount
= aRanges
.size(); i
< nCount
; ++i
)
3774 ScRange
aTemp( *aRanges
[ i
] );
3775 if ( aTemp
.Intersects( aMask
) )
3776 aNew
.Join( ScRange( std::max( aTemp
.aStart
.Col(), aMask
.aStart
.Col() ),
3777 std::max( aTemp
.aStart
.Row(), aMask
.aStart
.Row() ),
3778 std::max( aTemp
.aStart
.Tab(), aMask
.aStart
.Tab() ),
3779 std::min( aTemp
.aEnd
.Col(), aMask
.aEnd
.Col() ),
3780 std::min( aTemp
.aEnd
.Row(), aMask
.aEnd
.Row() ),
3781 std::min( aTemp
.aEnd
.Tab(), aMask
.aEnd
.Tab() ) ) );
3784 return new ScCellRangesObj( pDocShell
, aNew
); // kann leer sein
3789 uno::Reference
<sheet::XSheetCellRanges
> SAL_CALL
ScCellRangesBase::queryPrecedents(
3790 sal_Bool bRecursive
) throw(uno::RuntimeException
)
3792 SolarMutexGuard aGuard
;
3795 ScDocument
* pDoc
= pDocShell
->GetDocument();
3797 ScRangeList
aNewRanges(aRanges
);
3803 // aMarkData uses aNewRanges, not aRanges, so GetMarkData can't be used
3804 ScMarkData aMarkData
;
3805 aMarkData
.MarkFromRangeList( aNewRanges
, false );
3806 aMarkData
.MarkToMulti(); // needed for IsAllMarked
3808 for (size_t nR
= 0, nCount
= aNewRanges
.size(); nR
<nCount
; ++nR
)
3810 ScRange
aRange( *aNewRanges
[ nR
] );
3811 ScCellIterator
aIter( pDoc
, aRange
);
3812 for (bool bHasCell
= aIter
.first(); bHasCell
; bHasCell
= aIter
.next())
3814 if (aIter
.getType() != CELLTYPE_FORMULA
)
3817 ScDetectiveRefIter
aRefIter(aIter
.getFormulaCell());
3819 while ( aRefIter
.GetNextRef( aRefRange
) )
3821 if ( bRecursive
&& !bFound
&& !aMarkData
.IsAllMarked( aRefRange
) )
3823 aMarkData
.SetMultiMarkArea(aRefRange
, true);
3828 aMarkData
.FillRangeListWithMarks( &aNewRanges
, sal_True
);
3830 while ( bRecursive
&& bFound
);
3832 return new ScCellRangesObj( pDocShell
, aNewRanges
);
3838 uno::Reference
<sheet::XSheetCellRanges
> SAL_CALL
ScCellRangesBase::queryDependents(
3839 sal_Bool bRecursive
) throw(uno::RuntimeException
)
3841 SolarMutexGuard aGuard
;
3844 ScDocument
* pDoc
= pDocShell
->GetDocument();
3846 ScRangeList
aNewRanges(aRanges
);
3852 // aMarkData uses aNewRanges, not aRanges, so GetMarkData can't be used
3853 ScMarkData aMarkData
;
3854 aMarkData
.MarkFromRangeList( aNewRanges
, false );
3855 aMarkData
.MarkToMulti(); // needed for IsAllMarked
3857 SCTAB nTab
= lcl_FirstTab(aNewRanges
); //! alle Tabellen
3859 ScCellIterator
aCellIter( pDoc
, ScRange(0, 0, nTab
, MAXCOL
, MAXROW
, nTab
) );
3860 for (bool bHasCell
= aCellIter
.first(); bHasCell
; bHasCell
= aCellIter
.next())
3862 if (aCellIter
.getType() != CELLTYPE_FORMULA
)
3866 ScDetectiveRefIter
aIter(aCellIter
.getFormulaCell());
3868 while ( aIter
.GetNextRef( aRefRange
) )
3870 size_t nRangesCount
= aNewRanges
.size();
3871 for (size_t nR
= 0; nR
< nRangesCount
; ++nR
)
3873 ScRange
aRange( *aNewRanges
[ nR
] );
3874 if (aRange
.Intersects(aRefRange
))
3875 bMark
= sal_True
; // von Teil des Ranges abhaengig
3880 ScRange
aCellRange(aCellIter
.GetPos());
3881 if ( bRecursive
&& !bFound
&& !aMarkData
.IsAllMarked( aCellRange
) )
3883 aMarkData
.SetMultiMarkArea(aCellRange
, true);
3887 aMarkData
.FillRangeListWithMarks( &aNewRanges
, sal_True
);
3889 while ( bRecursive
&& bFound
);
3891 return new ScCellRangesObj( pDocShell
, aNewRanges
);
3899 uno::Reference
<util::XSearchDescriptor
> SAL_CALL
ScCellRangesBase::createSearchDescriptor()
3900 throw(uno::RuntimeException
)
3902 SolarMutexGuard aGuard
;
3903 return new ScCellSearchObj
;
3906 uno::Reference
<container::XIndexAccess
> SAL_CALL
ScCellRangesBase::findAll(
3907 const uno::Reference
<util::XSearchDescriptor
>& xDesc
)
3908 throw(uno::RuntimeException
)
3910 SolarMutexGuard aGuard
;
3911 // Wenn nichts gefunden wird, soll Null zurueckgegeben werden (?)
3912 uno::Reference
<container::XIndexAccess
> xRet
;
3913 if ( pDocShell
&& xDesc
.is() )
3915 ScCellSearchObj
* pSearch
= ScCellSearchObj::getImplementation( xDesc
);
3918 SvxSearchItem
* pSearchItem
= pSearch
->GetSearchItem();
3921 ScDocument
* pDoc
= pDocShell
->GetDocument();
3922 pSearchItem
->SetCommand( SVX_SEARCHCMD_FIND_ALL
);
3923 // immer nur innerhalb dieses Objekts
3924 pSearchItem
->SetSelection( !lcl_WholeSheet(aRanges
) );
3926 ScMarkData
aMark(*GetMarkData());
3928 OUString aDummyUndo
;
3929 ScRangeList aMatchedRanges
;
3933 bool bFound
= pDoc
->SearchAndReplace(
3934 *pSearchItem
, nCol
, nRow
, nTab
, aMark
, aMatchedRanges
, aDummyUndo
, NULL
);
3937 // bei findAll immer CellRanges, egal wieviel gefunden wurde
3938 xRet
.set(new ScCellRangesObj( pDocShell
, aMatchedRanges
));
3946 uno::Reference
<uno::XInterface
> ScCellRangesBase::Find_Impl(
3947 const uno::Reference
<util::XSearchDescriptor
>& xDesc
,
3948 const ScAddress
* pLastPos
)
3950 uno::Reference
<uno::XInterface
> xRet
;
3951 if ( pDocShell
&& xDesc
.is() )
3953 ScCellSearchObj
* pSearch
= ScCellSearchObj::getImplementation( xDesc
);
3956 SvxSearchItem
* pSearchItem
= pSearch
->GetSearchItem();
3959 ScDocument
* pDoc
= pDocShell
->GetDocument();
3960 pSearchItem
->SetCommand( SVX_SEARCHCMD_FIND
);
3961 // immer nur innerhalb dieses Objekts
3962 pSearchItem
->SetSelection( !lcl_WholeSheet(aRanges
) );
3964 ScMarkData
aMark(*GetMarkData());
3970 pLastPos
->GetVars( nCol
, nRow
, nTab
);
3973 nTab
= lcl_FirstTab(aRanges
); //! mehrere Tabellen?
3974 ScDocument::GetSearchAndReplaceStart( *pSearchItem
, nCol
, nRow
);
3977 OUString aDummyUndo
;
3978 ScRangeList aMatchedRanges
;
3979 bool bFound
= pDoc
->SearchAndReplace(
3980 *pSearchItem
, nCol
, nRow
, nTab
, aMark
, aMatchedRanges
, aDummyUndo
, NULL
);
3983 ScAddress
aFoundPos( nCol
, nRow
, nTab
);
3984 xRet
.set((cppu::OWeakObject
*) new ScCellObj( pDocShell
, aFoundPos
));
3992 uno::Reference
<uno::XInterface
> SAL_CALL
ScCellRangesBase::findFirst(
3993 const uno::Reference
<util::XSearchDescriptor
>& xDesc
)
3994 throw(uno::RuntimeException
)
3996 SolarMutexGuard aGuard
;
3997 return Find_Impl( xDesc
, NULL
);
4000 uno::Reference
<uno::XInterface
> SAL_CALL
ScCellRangesBase::findNext(
4001 const uno::Reference
<uno::XInterface
>& xStartAt
,
4002 const uno::Reference
<util::XSearchDescriptor
>& xDesc
)
4003 throw(uno::RuntimeException
)
4005 SolarMutexGuard aGuard
;
4006 if ( xStartAt
.is() )
4008 ScCellRangesBase
* pRangesImp
= ScCellRangesBase::getImplementation( xStartAt
);
4009 if ( pRangesImp
&& pRangesImp
->GetDocShell() == pDocShell
)
4011 const ScRangeList
& rStartRanges
= pRangesImp
->GetRangeList();
4012 if ( rStartRanges
.size() == 1 )
4014 ScAddress aStartPos
= rStartRanges
[ 0 ]->aStart
;
4015 return Find_Impl( xDesc
, &aStartPos
);
4024 uno::Reference
<util::XReplaceDescriptor
> SAL_CALL
ScCellRangesBase::createReplaceDescriptor()
4025 throw(uno::RuntimeException
)
4027 SolarMutexGuard aGuard
;
4028 return new ScCellSearchObj
;
4031 sal_Int32 SAL_CALL
ScCellRangesBase::replaceAll( const uno::Reference
<util::XSearchDescriptor
>& xDesc
)
4032 throw(uno::RuntimeException
)
4034 SolarMutexGuard aGuard
;
4035 sal_Int32 nReplaced
= 0;
4036 if ( pDocShell
&& xDesc
.is() )
4038 ScCellSearchObj
* pSearch
= ScCellSearchObj::getImplementation( xDesc
);
4041 SvxSearchItem
* pSearchItem
= pSearch
->GetSearchItem();
4044 ScDocument
* pDoc
= pDocShell
->GetDocument();
4045 sal_Bool
bUndo(pDoc
->IsUndoEnabled());
4046 pSearchItem
->SetCommand( SVX_SEARCHCMD_REPLACE_ALL
);
4047 // immer nur innerhalb dieses Objekts
4048 pSearchItem
->SetSelection( !lcl_WholeSheet(aRanges
) );
4050 ScMarkData
aMark(*GetMarkData());
4052 SCTAB nTabCount
= pDoc
->GetTableCount();
4053 bool bProtected
= !pDocShell
->IsEditable();
4054 ScMarkData::iterator itr
= aMark
.begin(), itrEnd
= aMark
.end();
4055 for (; itr
!= itrEnd
&& *itr
< nTabCount
; ++itr
)
4056 if ( pDoc
->IsTabProtected(*itr
) )
4060 //! Exception, oder was?
4064 SCTAB nTab
= aMark
.GetFirstSelected(); // bei SearchAndReplace nicht benutzt
4069 ScDocument
* pUndoDoc
= NULL
;
4072 pUndoDoc
= new ScDocument( SCDOCMODE_UNDO
);
4073 pUndoDoc
->InitUndo( pDoc
, nTab
, nTab
);
4075 itr
= aMark
.begin();
4076 for (; itr
!= itrEnd
&& *itr
< nTabCount
; ++itr
)
4077 if ( *itr
!= nTab
&& bUndo
)
4078 pUndoDoc
->AddUndoTab( *itr
, *itr
);
4079 boost::scoped_ptr
<ScMarkData
> pUndoMark
;
4081 pUndoMark
.reset(new ScMarkData(aMark
));
4083 bool bFound
= false;
4086 ScRangeList aMatchedRanges
;
4087 bFound
= pDoc
->SearchAndReplace(
4088 *pSearchItem
, nCol
, nRow
, nTab
, aMark
, aMatchedRanges
, aUndoStr
, pUndoDoc
);
4092 nReplaced
= pUndoDoc
->GetCellCount();
4094 pDocShell
->GetUndoManager()->AddUndoAction(
4095 new ScUndoReplace( pDocShell
, *pUndoMark
, nCol
, nRow
, nTab
,
4096 aUndoStr
, pUndoDoc
, pSearchItem
) );
4098 pDocShell
->PostPaintGridAll();
4099 pDocShell
->SetDocumentModified();
4104 // nReplaced bleibt 0
4115 sal_Int64 SAL_CALL
ScCellRangesBase::getSomething(
4116 const uno::Sequence
<sal_Int8
>& rId
) throw(uno::RuntimeException
)
4118 if ( rId
.getLength() == 16 &&
4119 0 == memcmp( getUnoTunnelId().getConstArray(),
4120 rId
.getConstArray(), 16 ) )
4122 return sal::static_int_cast
<sal_Int64
>(reinterpret_cast<sal_IntPtr
>(this));
4129 class theScCellRangesBaseUnoTunnelId
: public rtl::Static
< UnoTunnelIdInit
, theScCellRangesBaseUnoTunnelId
> {};
4132 const uno::Sequence
<sal_Int8
>& ScCellRangesBase::getUnoTunnelId()
4134 return theScCellRangesBaseUnoTunnelId::get().getSeq();
4137 ScCellRangesBase
* ScCellRangesBase::getImplementation( const uno::Reference
<uno::XInterface
> xObj
)
4139 ScCellRangesBase
* pRet
= NULL
;
4140 uno::Reference
<lang::XUnoTunnel
> xUT( xObj
, uno::UNO_QUERY
);
4142 pRet
= reinterpret_cast<ScCellRangesBase
*>(sal::static_int_cast
<sal_IntPtr
>(xUT
->getSomething(getUnoTunnelId())));
4146 //------------------------------------------------------------------------
4148 typedef boost::ptr_vector
<ScNamedEntry
> ScNamedEntryArr_Impl
;
4150 struct ScCellRangesObj::Impl
4152 ScNamedEntryArr_Impl m_aNamedEntries
;
4155 ScCellRangesObj::ScCellRangesObj(ScDocShell
* pDocSh
, const ScRangeList
& rR
)
4156 : ScCellRangesBase(pDocSh
, rR
)
4161 ScCellRangesObj::~ScCellRangesObj()
4165 void ScCellRangesObj::RefChanged()
4167 ScCellRangesBase::RefChanged();
4172 uno::Any SAL_CALL
ScCellRangesObj::queryInterface( const uno::Type
& rType
)
4173 throw(uno::RuntimeException
)
4175 SC_QUERYINTERFACE( sheet::XSheetCellRangeContainer
)
4176 SC_QUERYINTERFACE( sheet::XSheetCellRanges
)
4177 SC_QUERYINTERFACE( container::XIndexAccess
)
4178 SC_QUERY_MULTIPLE( container::XElementAccess
, container::XIndexAccess
)
4179 SC_QUERYINTERFACE( container::XEnumerationAccess
)
4180 SC_QUERYINTERFACE( container::XNameContainer
)
4181 SC_QUERYINTERFACE( container::XNameReplace
)
4182 SC_QUERYINTERFACE( container::XNameAccess
)
4184 return ScCellRangesBase::queryInterface( rType
);
4187 void SAL_CALL
ScCellRangesObj::acquire() throw()
4189 ScCellRangesBase::acquire();
4192 void SAL_CALL
ScCellRangesObj::release() throw()
4194 ScCellRangesBase::release();
4197 uno::Sequence
<uno::Type
> SAL_CALL
ScCellRangesObj::getTypes() throw(uno::RuntimeException
)
4199 static uno::Sequence
<uno::Type
> aTypes
;
4200 if ( aTypes
.getLength() == 0 )
4202 uno::Sequence
<uno::Type
> aParentTypes(ScCellRangesBase::getTypes());
4203 long nParentLen
= aParentTypes
.getLength();
4204 const uno::Type
* pParentPtr
= aParentTypes
.getConstArray();
4206 aTypes
.realloc( nParentLen
+ 3 );
4207 uno::Type
* pPtr
= aTypes
.getArray();
4208 pPtr
[nParentLen
+ 0] = getCppuType((const uno::Reference
<sheet::XSheetCellRangeContainer
>*)0);
4209 pPtr
[nParentLen
+ 1] = getCppuType((const uno::Reference
<container::XNameContainer
>*)0);
4210 pPtr
[nParentLen
+ 2] = getCppuType((const uno::Reference
<container::XEnumerationAccess
>*)0);
4212 for (long i
=0; i
<nParentLen
; i
++)
4213 pPtr
[i
] = pParentPtr
[i
]; // parent types first
4220 class theScCellRangesObjImplementationId
: public rtl::Static
< UnoTunnelIdInit
, theScCellRangesObjImplementationId
> {};
4223 uno::Sequence
<sal_Int8
> SAL_CALL
ScCellRangesObj::getImplementationId()
4224 throw(uno::RuntimeException
)
4226 return theScCellRangesObjImplementationId::get().getSeq();
4231 ScCellRangeObj
* ScCellRangesObj::GetObjectByIndex_Impl(sal_Int32 nIndex
) const
4233 ScDocShell
* pDocSh
= GetDocShell();
4234 const ScRangeList
& rRanges
= GetRangeList();
4235 if ( pDocSh
&& nIndex
>= 0 && nIndex
< sal::static_int_cast
<sal_Int32
>(rRanges
.size()) )
4237 ScRange
aRange( *rRanges
[ nIndex
] );
4238 if ( aRange
.aStart
== aRange
.aEnd
)
4239 return new ScCellObj( pDocSh
, aRange
.aStart
);
4241 return new ScCellRangeObj( pDocSh
, aRange
);
4244 return NULL
; // keine DocShell oder falscher Index
4247 uno::Sequence
<table::CellRangeAddress
> SAL_CALL
ScCellRangesObj::getRangeAddresses()
4248 throw(uno::RuntimeException
)
4250 SolarMutexGuard aGuard
;
4251 ScDocShell
* pDocSh
= GetDocShell();
4252 const ScRangeList
& rRanges
= GetRangeList();
4253 size_t nCount
= rRanges
.size();
4254 if ( pDocSh
&& nCount
)
4256 table::CellRangeAddress aRangeAddress
;
4257 uno::Sequence
<table::CellRangeAddress
> aSeq(nCount
);
4258 table::CellRangeAddress
* pAry
= aSeq
.getArray();
4259 for ( size_t i
=0; i
< nCount
; i
++)
4261 ScUnoConversion::FillApiRange( aRangeAddress
, *rRanges
[ i
] );
4262 pAry
[i
] = aRangeAddress
;
4267 return uno::Sequence
<table::CellRangeAddress
>(0); // leer ist moeglich
4270 uno::Reference
<container::XEnumerationAccess
> SAL_CALL
ScCellRangesObj::getCells()
4271 throw(uno::RuntimeException
)
4273 SolarMutexGuard aGuard
;
4275 // getCells with empty range list is possible (no exception),
4276 // the resulting enumeration just has no elements
4277 // (same behaviour as a valid range with no cells)
4278 // This is handled in ScCellsEnumeration ctor.
4280 const ScRangeList
& rRanges
= GetRangeList();
4281 ScDocShell
* pDocSh
= GetDocShell();
4283 return new ScCellsObj( pDocSh
, rRanges
);
4287 OUString SAL_CALL
ScCellRangesObj::getRangeAddressesAsString()
4288 throw(uno::RuntimeException
)
4290 SolarMutexGuard aGuard
;
4292 ScDocShell
* pDocSh
= GetDocShell();
4293 const ScRangeList
& rRanges
= GetRangeList();
4295 rRanges
.Format( aString
, SCA_VALID
| SCA_TAB_3D
, pDocSh
->GetDocument() );
4299 // XSheetCellRangeContainer
4301 void SAL_CALL
ScCellRangesObj::addRangeAddress( const table::CellRangeAddress
& rRange
,
4302 sal_Bool bMergeRanges
)
4303 throw(::com::sun::star::uno::RuntimeException
)
4305 SolarMutexGuard aGuard
;
4306 ScRange
aRange(static_cast<SCCOL
>(rRange
.StartColumn
),
4307 static_cast<SCROW
>(rRange
.StartRow
),
4308 static_cast<SCTAB
>(rRange
.Sheet
),
4309 static_cast<SCCOL
>(rRange
.EndColumn
),
4310 static_cast<SCROW
>(rRange
.EndRow
),
4311 static_cast<SCTAB
>(rRange
.Sheet
));
4312 AddRange(aRange
, bMergeRanges
);
4315 static void lcl_RemoveNamedEntry( ScNamedEntryArr_Impl
& rNamedEntries
, const ScRange
& rRange
)
4317 sal_uInt16 nCount
= rNamedEntries
.size();
4318 for ( sal_uInt16 n
=nCount
; n
--; )
4319 if ( rNamedEntries
[n
].GetRange() == rRange
)
4320 rNamedEntries
.erase( rNamedEntries
.begin() + n
);
4323 void SAL_CALL
ScCellRangesObj::removeRangeAddress( const table::CellRangeAddress
& rRange
)
4324 throw(::com::sun::star::container::NoSuchElementException
,
4325 ::com::sun::star::uno::RuntimeException
)
4327 SolarMutexGuard aGuard
;
4328 const ScRangeList
& rRanges
= GetRangeList();
4330 ScRangeList aSheetRanges
;
4331 ScRangeList aNotSheetRanges
;
4332 for (size_t i
= 0; i
< rRanges
.size(); ++i
)
4334 if (rRanges
[ i
]->aStart
.Tab() == rRange
.Sheet
)
4336 aSheetRanges
.Append( *rRanges
[ i
] );
4340 aNotSheetRanges
.Append( *rRanges
[ i
] );
4343 ScMarkData aMarkData
;
4344 aMarkData
.MarkFromRangeList( aSheetRanges
, false );
4345 ScRange
aRange(static_cast<SCCOL
>(rRange
.StartColumn
),
4346 static_cast<SCROW
>(rRange
.StartRow
),
4347 static_cast<SCTAB
>(rRange
.Sheet
),
4348 static_cast<SCCOL
>(rRange
.EndColumn
),
4349 static_cast<SCROW
>(rRange
.EndRow
),
4350 static_cast<SCTAB
>(rRange
.Sheet
));
4351 if (aMarkData
.GetTableSelect( aRange
.aStart
.Tab() ))
4353 aMarkData
.MarkToMulti();
4354 if (aMarkData
.IsAllMarked( aRange
) )
4356 aMarkData
.SetMultiMarkArea( aRange
, false );
4357 lcl_RemoveNamedEntry(m_pImpl
->m_aNamedEntries
, aRange
);
4360 throw container::NoSuchElementException();
4362 SetNewRanges(aNotSheetRanges
);
4364 aMarkData
.FillRangeListWithMarks( &aNew
, false );
4365 for ( size_t j
= 0; j
< aNew
.size(); ++j
)
4367 AddRange(*aNew
[ j
], false);
4371 void SAL_CALL
ScCellRangesObj::addRangeAddresses( const uno::Sequence
<table::CellRangeAddress
>& rRanges
,
4372 sal_Bool bMergeRanges
)
4373 throw(::com::sun::star::uno::RuntimeException
)
4375 SolarMutexGuard aGuard
;
4376 sal_Int32
nCount(rRanges
.getLength());
4379 const table::CellRangeAddress
* pRanges
= rRanges
.getConstArray();
4380 for (sal_Int32 i
= 0; i
< rRanges
.getLength(); i
++, pRanges
++)
4382 ScRange
aRange(static_cast<SCCOL
>(pRanges
->StartColumn
),
4383 static_cast<SCROW
>(pRanges
->StartRow
),
4384 static_cast<SCTAB
>(pRanges
->Sheet
),
4385 static_cast<SCCOL
>(pRanges
->EndColumn
),
4386 static_cast<SCROW
>(pRanges
->EndRow
),
4387 static_cast<SCTAB
>(pRanges
->Sheet
));
4388 AddRange(aRange
, bMergeRanges
);
4393 void SAL_CALL
ScCellRangesObj::removeRangeAddresses( const uno::Sequence
<table::CellRangeAddress
>& rRangeSeq
)
4394 throw(::com::sun::star::container::NoSuchElementException
,
4395 ::com::sun::star::uno::RuntimeException
)
4397 // use sometimes a better/faster implementation
4398 sal_uInt32
nCount(rRangeSeq
.getLength());
4401 const table::CellRangeAddress
* pRanges
= rRangeSeq
.getConstArray();
4402 for (sal_uInt32 i
=0; i
< nCount
; ++i
, ++pRanges
)
4404 removeRangeAddress(*pRanges
);
4411 static void lcl_RemoveNamedEntry( ScNamedEntryArr_Impl
& rNamedEntries
, const String
& rName
)
4413 sal_uInt16 nCount
= rNamedEntries
.size();
4414 for ( sal_uInt16 n
=nCount
; n
--; )
4415 if ( rNamedEntries
[n
].GetName() == rName
)
4416 rNamedEntries
.erase( rNamedEntries
.begin() + n
);
4419 void SAL_CALL
ScCellRangesObj::insertByName( const OUString
& aName
, const uno::Any
& aElement
)
4420 throw(lang::IllegalArgumentException
, container::ElementExistException
,
4421 lang::WrappedTargetException
, uno::RuntimeException
)
4423 SolarMutexGuard aGuard
;
4424 ScDocShell
* pDocSh
= GetDocShell();
4425 sal_Bool bDone
= false;
4427 //! Type of aElement can be some specific interface instead of XInterface
4429 uno::Reference
<uno::XInterface
> xInterface(aElement
, uno::UNO_QUERY
);
4430 if ( pDocSh
&& xInterface
.is() )
4432 ScCellRangesBase
* pRangesImp
= ScCellRangesBase::getImplementation( xInterface
);
4433 if ( pRangesImp
&& pRangesImp
->GetDocShell() == pDocSh
)
4435 // if explicit name is given and already existing, throw exception
4437 String
aNamStr(aName
);
4438 if ( aNamStr
.Len() )
4440 size_t nNamedCount
= m_pImpl
->m_aNamedEntries
.size();
4441 for (size_t n
= 0; n
< nNamedCount
; n
++)
4443 if (m_pImpl
->m_aNamedEntries
[n
].GetName() == aNamStr
)
4444 throw container::ElementExistException();
4448 ScRangeList
aNew(GetRangeList());
4449 const ScRangeList
& rAddRanges
= pRangesImp
->GetRangeList();
4450 size_t nAddCount
= rAddRanges
.size();
4451 for ( size_t i
= 0; i
< nAddCount
; i
++ )
4452 aNew
.Join( *rAddRanges
[ i
] );
4456 if ( !aName
.isEmpty() && nAddCount
== 1 )
4458 // if a name is given, also insert into list of named entries
4459 // (only possible for a single range)
4460 // name is not in m_pImpl->m_aNamedEntries (tested above)
4462 ScNamedEntry
* pEntry
= new ScNamedEntry( aNamStr
, *rAddRanges
[ 0 ] );
4463 m_pImpl
->m_aNamedEntries
.push_back(pEntry
);
4470 // invalid element - double names are handled above
4471 throw lang::IllegalArgumentException();
4475 static sal_Bool
lcl_FindRangeByName( const ScRangeList
& rRanges
, ScDocShell
* pDocSh
,
4476 const String
& rName
, size_t& rIndex
)
4481 ScDocument
* pDoc
= pDocSh
->GetDocument();
4482 for ( size_t i
= 0, nCount
= rRanges
.size(); i
< nCount
; i
++ )
4484 rRanges
[ i
]->Format( aRangeStr
, SCA_VALID
| SCA_TAB_3D
, pDoc
);
4485 if ( aRangeStr
== rName
)
4492 return false; // nicht gefunden
4495 static sal_Bool
lcl_FindRangeOrEntry( const ScNamedEntryArr_Impl
& rNamedEntries
,
4496 const ScRangeList
& rRanges
, ScDocShell
* pDocSh
,
4497 const String
& rName
, ScRange
& rFound
)
4499 // exact range in list?
4502 if ( lcl_FindRangeByName( rRanges
, pDocSh
, rName
, nIndex
) )
4504 rFound
= *rRanges
[ nIndex
];
4508 // range contained in selection? (sheet must be specified)
4511 sal_uInt16 nParse
= aCellRange
.ParseAny( rName
, pDocSh
->GetDocument() );
4512 if ( ( nParse
& ( SCA_VALID
| SCA_TAB_3D
) ) == ( SCA_VALID
| SCA_TAB_3D
) )
4514 ScMarkData aMarkData
;
4515 aMarkData
.MarkFromRangeList( rRanges
, false );
4516 aMarkData
.MarkToMulti(); // needed for IsAllMarked
4517 if ( aMarkData
.IsAllMarked( aCellRange
) )
4519 rFound
= aCellRange
;
4524 // named entry in this object?
4526 if ( !rNamedEntries
.empty() )
4528 for ( sal_uInt16 n
=0; n
<rNamedEntries
.size(); n
++ )
4529 if ( rNamedEntries
[n
].GetName() == rName
)
4531 // test if named entry is contained in rRanges
4533 const ScRange
& rComp
= rNamedEntries
[n
].GetRange();
4534 ScMarkData aMarkData
;
4535 aMarkData
.MarkFromRangeList( rRanges
, false );
4536 aMarkData
.MarkToMulti(); // needed for IsAllMarked
4537 if ( aMarkData
.IsAllMarked( rComp
) )
4545 return false; // not found
4548 void SAL_CALL
ScCellRangesObj::removeByName( const OUString
& aName
)
4549 throw(container::NoSuchElementException
,
4550 lang::WrappedTargetException
, uno::RuntimeException
)
4552 SolarMutexGuard aGuard
;
4553 sal_Bool bDone
= false;
4554 String
aNameStr(aName
);
4555 ScDocShell
* pDocSh
= GetDocShell();
4556 const ScRangeList
& rRanges
= GetRangeList();
4558 if ( lcl_FindRangeByName( rRanges
, pDocSh
, aNameStr
, nIndex
) )
4560 // einzelnen Range weglassen
4562 for ( size_t i
= 0, nCount
= rRanges
.size(); i
< nCount
; i
++ )
4564 aNew
.Append( *rRanges
[ i
] );
4570 // deselect any ranges (parsed or named entry)
4572 sal_Bool bValid
= ( aDiff
.Parse( aNameStr
, pDocSh
->GetDocument() ) & SCA_VALID
) != 0;
4573 if (!bValid
&& !m_pImpl
->m_aNamedEntries
.empty())
4575 sal_uInt16 nCount
= m_pImpl
->m_aNamedEntries
.size();
4576 for (sal_uInt16 n
=0; n
<nCount
&& !bValid
; n
++)
4577 if (m_pImpl
->m_aNamedEntries
[n
].GetName() == aNameStr
)
4580 aDiff
.Append(m_pImpl
->m_aNamedEntries
[n
].GetRange());
4586 ScMarkData aMarkData
;
4587 aMarkData
.MarkFromRangeList( rRanges
, false );
4589 for ( size_t i
= 0, nDiffCount
= aDiff
.size(); i
< nDiffCount
; i
++ )
4591 ScRange
* pDiffRange
= aDiff
[ i
];
4592 if (aMarkData
.GetTableSelect( pDiffRange
->aStart
.Tab() ))
4593 aMarkData
.SetMultiMarkArea( *pDiffRange
, false );
4597 aMarkData
.FillRangeListWithMarks( &aNew
, false );
4600 bDone
= sal_True
; //! error if range was not selected before?
4604 if (!m_pImpl
->m_aNamedEntries
.empty())
4605 lcl_RemoveNamedEntry(m_pImpl
->m_aNamedEntries
, aNameStr
);
4608 throw container::NoSuchElementException(); // not found
4613 void SAL_CALL
ScCellRangesObj::replaceByName( const OUString
& aName
, const uno::Any
& aElement
)
4614 throw(lang::IllegalArgumentException
, container::NoSuchElementException
,
4615 lang::WrappedTargetException
, uno::RuntimeException
)
4617 SolarMutexGuard aGuard
;
4619 removeByName( aName
);
4620 insertByName( aName
, aElement
);
4625 uno::Any SAL_CALL
ScCellRangesObj::getByName( const OUString
& aName
)
4626 throw(container::NoSuchElementException
,
4627 lang::WrappedTargetException
, uno::RuntimeException
)
4629 SolarMutexGuard aGuard
;
4632 String
aNameStr(aName
);
4633 ScDocShell
* pDocSh
= GetDocShell();
4634 const ScRangeList
& rRanges
= GetRangeList();
4636 if (lcl_FindRangeOrEntry(m_pImpl
->m_aNamedEntries
, rRanges
,
4637 pDocSh
, aNameStr
, aRange
))
4639 uno::Reference
<table::XCellRange
> xRange
;
4640 if ( aRange
.aStart
== aRange
.aEnd
)
4641 xRange
.set(new ScCellObj( pDocSh
, aRange
.aStart
));
4643 xRange
.set(new ScCellRangeObj( pDocSh
, aRange
));
4647 throw container::NoSuchElementException();
4651 static sal_Bool
lcl_FindEntryName( const ScNamedEntryArr_Impl
& rNamedEntries
,
4652 const ScRange
& rRange
, String
& rName
)
4654 sal_uInt16 nCount
= rNamedEntries
.size();
4655 for (sal_uInt16 i
=0; i
<nCount
; i
++)
4656 if (rNamedEntries
[i
].GetRange() == rRange
)
4658 rName
= rNamedEntries
[i
].GetName();
4664 uno::Sequence
<OUString
> SAL_CALL
ScCellRangesObj::getElementNames()
4665 throw(uno::RuntimeException
)
4667 SolarMutexGuard aGuard
;
4669 ScDocShell
* pDocSh
= GetDocShell();
4670 const ScRangeList
& rRanges
= GetRangeList();
4674 ScDocument
* pDoc
= pDocSh
->GetDocument();
4675 size_t nCount
= rRanges
.size();
4677 uno::Sequence
<OUString
> aSeq(nCount
);
4678 OUString
* pAry
= aSeq
.getArray();
4679 for (size_t i
=0; i
< nCount
; i
++)
4681 // use given name if for exactly this range, otherwise just format
4682 ScRange aRange
= *rRanges
[ i
];
4683 if (m_pImpl
->m_aNamedEntries
.empty() ||
4684 !lcl_FindEntryName(m_pImpl
->m_aNamedEntries
, aRange
, aRangeStr
))
4686 aRange
.Format( aRangeStr
, SCA_VALID
| SCA_TAB_3D
, pDoc
);
4688 pAry
[i
] = aRangeStr
;
4692 return uno::Sequence
<OUString
>(0);
4695 sal_Bool SAL_CALL
ScCellRangesObj::hasByName( const OUString
& aName
)
4696 throw(uno::RuntimeException
)
4698 SolarMutexGuard aGuard
;
4699 String
aNameStr(aName
);
4700 ScDocShell
* pDocSh
= GetDocShell();
4701 const ScRangeList
& rRanges
= GetRangeList();
4703 return lcl_FindRangeOrEntry(m_pImpl
->m_aNamedEntries
, rRanges
, pDocSh
,
4707 // XEnumerationAccess
4709 uno::Reference
<container::XEnumeration
> SAL_CALL
ScCellRangesObj::createEnumeration()
4710 throw(uno::RuntimeException
)
4712 SolarMutexGuard aGuard
;
4713 return new ScIndexEnumeration(this, OUString("com.sun.star.sheet.SheetCellRangesEnumeration"));
4718 sal_Int32 SAL_CALL
ScCellRangesObj::getCount() throw(uno::RuntimeException
)
4720 SolarMutexGuard aGuard
;
4721 const ScRangeList
& rRanges
= GetRangeList();
4722 return rRanges
.size();
4725 uno::Any SAL_CALL
ScCellRangesObj::getByIndex( sal_Int32 nIndex
)
4726 throw(lang::IndexOutOfBoundsException
,
4727 lang::WrappedTargetException
, uno::RuntimeException
)
4729 SolarMutexGuard aGuard
;
4730 uno::Reference
<table::XCellRange
> xRange(GetObjectByIndex_Impl(nIndex
));
4732 return uno::makeAny(xRange
);
4734 throw lang::IndexOutOfBoundsException();
4737 uno::Type SAL_CALL
ScCellRangesObj::getElementType() throw(uno::RuntimeException
)
4739 SolarMutexGuard aGuard
;
4740 return getCppuType((uno::Reference
<table::XCellRange
>*)0);
4743 sal_Bool SAL_CALL
ScCellRangesObj::hasElements() throw(uno::RuntimeException
)
4745 SolarMutexGuard aGuard
;
4746 const ScRangeList
& rRanges
= GetRangeList();
4747 return !rRanges
.empty();
4752 OUString SAL_CALL
ScCellRangesObj::getImplementationName() throw(uno::RuntimeException
)
4754 return OUString( "ScCellRangesObj" );
4757 sal_Bool SAL_CALL
ScCellRangesObj::supportsService( const OUString
& rServiceName
)
4758 throw(uno::RuntimeException
)
4760 String
aServiceStr(rServiceName
);
4761 return aServiceStr
.EqualsAscii( SCSHEETCELLRANGES_SERVICE
) ||
4762 aServiceStr
.EqualsAscii( SCCELLPROPERTIES_SERVICE
) ||
4763 aServiceStr
.EqualsAscii( SCCHARPROPERTIES_SERVICE
) ||
4764 aServiceStr
.EqualsAscii( SCPARAPROPERTIES_SERVICE
);
4767 uno::Sequence
<OUString
> SAL_CALL
ScCellRangesObj::getSupportedServiceNames()
4768 throw(uno::RuntimeException
)
4770 uno::Sequence
<OUString
> aRet(4);
4771 OUString
* pArray
= aRet
.getArray();
4772 pArray
[0] = OUString( SCSHEETCELLRANGES_SERVICE
);
4773 pArray
[1] = OUString( SCCELLPROPERTIES_SERVICE
);
4774 pArray
[2] = OUString( SCCHARPROPERTIES_SERVICE
);
4775 pArray
[3] = OUString( SCPARAPROPERTIES_SERVICE
);
4779 //------------------------------------------------------------------------
4781 uno::Reference
<table::XCellRange
> ScCellRangeObj::CreateRangeFromDoc( ScDocument
* pDoc
, const ScRange
& rR
)
4783 SfxObjectShell
* pObjSh
= pDoc
->GetDocumentShell();
4784 if ( pObjSh
&& pObjSh
->ISA(ScDocShell
) )
4785 return new ScCellRangeObj( (ScDocShell
*) pObjSh
, rR
);
4789 //------------------------------------------------------------------------
4791 ScCellRangeObj::ScCellRangeObj(ScDocShell
* pDocSh
, const ScRange
& rR
) :
4792 ScCellRangesBase( pDocSh
, rR
),
4793 pRangePropSet( lcl_GetRangePropertySet() ),
4796 aRange
.Justify(); // Anfang / Ende richtig
4799 ScCellRangeObj::~ScCellRangeObj()
4803 void ScCellRangeObj::RefChanged()
4805 ScCellRangesBase::RefChanged();
4807 const ScRangeList
& rRanges
= GetRangeList();
4808 OSL_ENSURE(rRanges
.size() == 1, "was fuer Ranges ?!?!");
4809 if ( !rRanges
.empty() )
4811 const ScRange
* pFirst
= rRanges
[0];
4812 aRange
= ScRange(*pFirst
);
4817 uno::Any SAL_CALL
ScCellRangeObj::queryInterface( const uno::Type
& rType
)
4818 throw(uno::RuntimeException
)
4820 SC_QUERYINTERFACE( sheet::XCellRangeAddressable
)
4821 SC_QUERYINTERFACE( table::XCellRange
)
4822 SC_QUERYINTERFACE( sheet::XSheetCellRange
)
4823 SC_QUERYINTERFACE( sheet::XArrayFormulaRange
)
4824 SC_QUERYINTERFACE( sheet::XArrayFormulaTokens
)
4825 SC_QUERYINTERFACE( sheet::XCellRangeData
)
4826 SC_QUERYINTERFACE( sheet::XCellRangeFormula
)
4827 SC_QUERYINTERFACE( sheet::XMultipleOperation
)
4828 SC_QUERYINTERFACE( util::XMergeable
)
4829 SC_QUERYINTERFACE( sheet::XCellSeries
)
4830 SC_QUERYINTERFACE( table::XAutoFormattable
)
4831 SC_QUERYINTERFACE( util::XSortable
)
4832 SC_QUERYINTERFACE( sheet::XSheetFilterableEx
)
4833 SC_QUERYINTERFACE( sheet::XSheetFilterable
)
4834 SC_QUERYINTERFACE( sheet::XSubTotalCalculatable
)
4835 SC_QUERYINTERFACE( table::XColumnRowRange
)
4836 SC_QUERYINTERFACE( util::XImportable
)
4837 SC_QUERYINTERFACE( sheet::XCellFormatRangesSupplier
)
4838 SC_QUERYINTERFACE( sheet::XUniqueCellFormatRangesSupplier
)
4840 return ScCellRangesBase::queryInterface( rType
);
4843 void SAL_CALL
ScCellRangeObj::acquire() throw()
4845 ScCellRangesBase::acquire();
4848 void SAL_CALL
ScCellRangeObj::release() throw()
4850 ScCellRangesBase::release();
4853 uno::Sequence
<uno::Type
> SAL_CALL
ScCellRangeObj::getTypes() throw(uno::RuntimeException
)
4855 static uno::Sequence
<uno::Type
> aTypes
;
4856 if ( aTypes
.getLength() == 0 )
4858 uno::Sequence
<uno::Type
> aParentTypes(ScCellRangesBase::getTypes());
4859 long nParentLen
= aParentTypes
.getLength();
4860 const uno::Type
* pParentPtr
= aParentTypes
.getConstArray();
4862 aTypes
.realloc( nParentLen
+ 17 );
4863 uno::Type
* pPtr
= aTypes
.getArray();
4864 pPtr
[nParentLen
+ 0] = getCppuType((const uno::Reference
<sheet::XCellRangeAddressable
>*)0);
4865 pPtr
[nParentLen
+ 1] = getCppuType((const uno::Reference
<sheet::XSheetCellRange
>*)0);
4866 pPtr
[nParentLen
+ 2] = getCppuType((const uno::Reference
<sheet::XArrayFormulaRange
>*)0);
4867 pPtr
[nParentLen
+ 3] = getCppuType((const uno::Reference
<sheet::XArrayFormulaTokens
>*)0);
4868 pPtr
[nParentLen
+ 4] = getCppuType((const uno::Reference
<sheet::XCellRangeData
>*)0);
4869 pPtr
[nParentLen
+ 5] = getCppuType((const uno::Reference
<sheet::XCellRangeFormula
>*)0);
4870 pPtr
[nParentLen
+ 6] = getCppuType((const uno::Reference
<sheet::XMultipleOperation
>*)0);
4871 pPtr
[nParentLen
+ 7] = getCppuType((const uno::Reference
<util::XMergeable
>*)0);
4872 pPtr
[nParentLen
+ 8] = getCppuType((const uno::Reference
<sheet::XCellSeries
>*)0);
4873 pPtr
[nParentLen
+ 9] = getCppuType((const uno::Reference
<table::XAutoFormattable
>*)0);
4874 pPtr
[nParentLen
+10] = getCppuType((const uno::Reference
<util::XSortable
>*)0);
4875 pPtr
[nParentLen
+11] = getCppuType((const uno::Reference
<sheet::XSheetFilterableEx
>*)0);
4876 pPtr
[nParentLen
+12] = getCppuType((const uno::Reference
<sheet::XSubTotalCalculatable
>*)0);
4877 pPtr
[nParentLen
+13] = getCppuType((const uno::Reference
<table::XColumnRowRange
>*)0);
4878 pPtr
[nParentLen
+14] = getCppuType((const uno::Reference
<util::XImportable
>*)0);
4879 pPtr
[nParentLen
+15] = getCppuType((const uno::Reference
<sheet::XCellFormatRangesSupplier
>*)0);
4880 pPtr
[nParentLen
+16] = getCppuType((const uno::Reference
<sheet::XUniqueCellFormatRangesSupplier
>*)0);
4882 for (long i
=0; i
<nParentLen
; i
++)
4883 pPtr
[i
] = pParentPtr
[i
]; // parent types first
4890 class theScCellRangeObjImplementationId
: public rtl::Static
< UnoTunnelIdInit
, theScCellRangeObjImplementationId
> {};
4893 uno::Sequence
<sal_Int8
> SAL_CALL
ScCellRangeObj::getImplementationId()
4894 throw(uno::RuntimeException
)
4896 return theScCellRangeObjImplementationId::get().getSeq();
4901 // ColumnCount / RowCount sind weggefallen
4902 //! werden im Writer fuer Tabellen noch gebraucht ???
4904 uno::Reference
<table::XCell
> ScCellRangeObj::GetCellByPosition_Impl(
4905 sal_Int32 nColumn
, sal_Int32 nRow
)
4906 throw(lang::IndexOutOfBoundsException
, uno::RuntimeException
)
4908 ScDocShell
* pDocSh
= GetDocShell();
4910 throw uno::RuntimeException();
4912 if ( nColumn
>= 0 && nRow
>= 0 )
4914 sal_Int32 nPosX
= aRange
.aStart
.Col() + nColumn
;
4915 sal_Int32 nPosY
= aRange
.aStart
.Row() + nRow
;
4917 if ( nPosX
<= aRange
.aEnd
.Col() && nPosY
<= aRange
.aEnd
.Row() )
4919 ScAddress
aNew( (SCCOL
)nPosX
, (SCROW
)nPosY
, aRange
.aStart
.Tab() );
4920 return new ScCellObj( pDocSh
, aNew
);
4924 throw lang::IndexOutOfBoundsException();
4927 uno::Reference
<table::XCell
> SAL_CALL
ScCellRangeObj::getCellByPosition(
4928 sal_Int32 nColumn
, sal_Int32 nRow
)
4929 throw(lang::IndexOutOfBoundsException
, uno::RuntimeException
)
4931 SolarMutexGuard aGuard
;
4933 return GetCellByPosition_Impl(nColumn
, nRow
);
4936 uno::Reference
<table::XCellRange
> SAL_CALL
ScCellRangeObj::getCellRangeByPosition(
4937 sal_Int32 nLeft
, sal_Int32 nTop
, sal_Int32 nRight
, sal_Int32 nBottom
)
4938 throw(lang::IndexOutOfBoundsException
, uno::RuntimeException
)
4940 SolarMutexGuard aGuard
;
4942 ScDocShell
* pDocSh
= GetDocShell();
4944 throw uno::RuntimeException();
4946 if ( nLeft
>= 0 && nTop
>= 0 && nRight
>= 0 && nBottom
>= 0 )
4948 sal_Int32 nStartX
= aRange
.aStart
.Col() + nLeft
;
4949 sal_Int32 nStartY
= aRange
.aStart
.Row() + nTop
;
4950 sal_Int32 nEndX
= aRange
.aStart
.Col() + nRight
;
4951 sal_Int32 nEndY
= aRange
.aStart
.Row() + nBottom
;
4953 if ( nStartX
<= nEndX
&& nEndX
<= aRange
.aEnd
.Col() &&
4954 nStartY
<= nEndY
&& nEndY
<= aRange
.aEnd
.Row() )
4956 ScRange
aNew( (SCCOL
)nStartX
, (SCROW
)nStartY
, aRange
.aStart
.Tab(),
4957 (SCCOL
)nEndX
, (SCROW
)nEndY
, aRange
.aEnd
.Tab() );
4958 return new ScCellRangeObj( pDocSh
, aNew
);
4962 throw lang::IndexOutOfBoundsException();
4965 uno::Reference
<table::XCellRange
> SAL_CALL
ScCellRangeObj::getCellRangeByName(
4966 const OUString
& aName
) throw(uno::RuntimeException
)
4968 return getCellRangeByName( aName
, ScAddress::detailsOOOa1
);
4971 uno::Reference
<table::XCellRange
> ScCellRangeObj::getCellRangeByName(
4972 const OUString
& aName
, const ScAddress::Details
& rDetails
) throw(uno::RuntimeException
)
4974 // name refers to the whole document (with the range's table as default),
4975 // valid only if the range is within this range
4977 SolarMutexGuard aGuard
;
4978 ScDocShell
* pDocSh
= GetDocShell();
4981 ScDocument
* pDoc
= pDocSh
->GetDocument();
4982 SCTAB nTab
= aRange
.aStart
.Tab();
4985 sal_Bool bFound
= false;
4986 String
aString(aName
);
4987 sal_uInt16 nParse
= aCellRange
.ParseAny( aString
, pDoc
, rDetails
);
4988 if ( nParse
& SCA_VALID
)
4990 if ( !(nParse
& SCA_TAB_3D
) ) // keine Tabelle angegeben -> auf dieser Tabelle
4992 aCellRange
.aStart
.SetTab(nTab
);
4993 aCellRange
.aEnd
.SetTab(nTab
);
4999 ScRangeUtil aRangeUtil
;
5000 if ( aRangeUtil
.MakeRangeFromName( aString
, pDoc
, nTab
, aCellRange
, RUTL_NAMES
) ||
5001 aRangeUtil
.MakeRangeFromName( aString
, pDoc
, nTab
, aCellRange
, RUTL_DBASE
) )
5005 if (bFound
) // valid only if within this object's range
5007 if (!aRange
.In(aCellRange
))
5013 if ( aCellRange
.aStart
== aCellRange
.aEnd
)
5014 return new ScCellObj( pDocSh
, aCellRange
.aStart
);
5016 return new ScCellRangeObj( pDocSh
, aCellRange
);
5020 throw uno::RuntimeException();
5025 uno::Reference
<table::XTableColumns
> SAL_CALL
ScCellRangeObj::getColumns() throw(uno::RuntimeException
)
5027 SolarMutexGuard aGuard
;
5028 ScDocShell
* pDocSh
= GetDocShell();
5030 return new ScTableColumnsObj( pDocSh
, aRange
.aStart
.Tab(),
5031 aRange
.aStart
.Col(), aRange
.aEnd
.Col() );
5033 OSL_FAIL("Dokument ungueltig");
5037 uno::Reference
<table::XTableRows
> SAL_CALL
ScCellRangeObj::getRows() throw(uno::RuntimeException
)
5039 SolarMutexGuard aGuard
;
5040 ScDocShell
* pDocSh
= GetDocShell();
5042 return new ScTableRowsObj( pDocSh
, aRange
.aStart
.Tab(),
5043 aRange
.aStart
.Row(), aRange
.aEnd
.Row() );
5045 OSL_FAIL("Dokument ungueltig");
5049 // XAddressableCellRange
5051 table::CellRangeAddress SAL_CALL
ScCellRangeObj::getRangeAddress() throw(uno::RuntimeException
)
5053 SolarMutexGuard aGuard
;
5054 table::CellRangeAddress aRet
;
5055 ScUnoConversion::FillApiRange( aRet
, aRange
);
5061 uno::Reference
<sheet::XSpreadsheet
> SAL_CALL
ScCellRangeObj::getSpreadsheet()
5062 throw(uno::RuntimeException
)
5064 SolarMutexGuard aGuard
;
5065 ScDocShell
* pDocSh
= GetDocShell();
5067 return new ScTableSheetObj( pDocSh
, aRange
.aStart
.Tab() );
5069 OSL_FAIL("Dokument ungueltig");
5073 // XArrayFormulaRange
5075 OUString SAL_CALL
ScCellRangeObj::getArrayFormula() throw(uno::RuntimeException
)
5077 SolarMutexGuard aGuard
;
5079 // Matrix-Formel, wenn eindeutig Teil einer Matrix,
5080 // also wenn Anfang und Ende des Blocks zur selben Matrix gehoeren.
5081 // Sonst Leerstring.
5083 ScDocShell
* pDocSh
= GetDocShell();
5085 return EMPTY_OUSTRING
;
5089 ScDocument
* pDoc
= pDocSh
->GetDocument();
5090 ScRefCellValue aCell1
;
5091 ScRefCellValue aCell2
;
5092 aCell1
.assign(*pDoc
, aRange
.aStart
);
5093 aCell2
.assign(*pDoc
, aRange
.aEnd
);
5094 if (aCell1
.meType
== CELLTYPE_FORMULA
&& aCell2
.meType
== CELLTYPE_FORMULA
)
5096 const ScFormulaCell
* pFCell1
= aCell1
.mpFormula
;
5097 const ScFormulaCell
* pFCell2
= aCell2
.mpFormula
;
5100 if (pFCell1
->GetMatrixOrigin(aStart1
) && pFCell2
->GetMatrixOrigin(aStart2
))
5102 if (aStart1
== aStart2
) // beides dieselbe Matrix
5103 pFCell1
->GetFormula(aFormula
); // egal, von welcher Zelle
5109 void ScCellRangeObj::SetArrayFormula_Impl( const OUString
& rFormula
,
5110 const OUString
& rFormulaNmsp
, const formula::FormulaGrammar::Grammar eGrammar
) throw(uno::RuntimeException
)
5112 ScDocShell
* pDocSh
= GetDocShell();
5115 if ( !rFormula
.isEmpty() )
5117 if ( ScTableSheetObj::getImplementation( (cppu::OWeakObject
*)this ) )
5119 // don't set array formula for sheet object
5120 throw uno::RuntimeException();
5123 pDocSh
->GetDocFunc().EnterMatrix( aRange
, NULL
, NULL
, rFormula
, sal_True
, sal_True
, rFormulaNmsp
, eGrammar
);
5127 // empty string -> erase array formula
5129 aMark
.SetMarkArea( aRange
);
5130 aMark
.SelectTable( aRange
.aStart
.Tab(), sal_True
);
5131 pDocSh
->GetDocFunc().DeleteContents( aMark
, IDF_CONTENTS
, sal_True
, sal_True
);
5136 void SAL_CALL
ScCellRangeObj::setArrayFormula( const OUString
& aFormula
)
5137 throw(uno::RuntimeException
)
5139 SolarMutexGuard aGuard
;
5140 // GRAM_PODF_A1 for API compatibility.
5141 SetArrayFormula_Impl( aFormula
, OUString(), formula::FormulaGrammar::GRAM_PODF_A1
);
5144 void ScCellRangeObj::SetArrayFormulaWithGrammar( const OUString
& rFormula
,
5145 const OUString
& rFormulaNmsp
, const formula::FormulaGrammar::Grammar eGrammar
) throw(uno::RuntimeException
)
5147 SolarMutexGuard aGuard
;
5148 SetArrayFormula_Impl( rFormula
, rFormulaNmsp
, eGrammar
);
5151 // XArrayFormulaTokens
5153 uno::Sequence
<sheet::FormulaToken
> SAL_CALL
ScCellRangeObj::getArrayTokens() throw(uno::RuntimeException
)
5155 SolarMutexGuard aGuard
;
5157 // same cell logic as in getArrayFormula
5159 uno::Sequence
<sheet::FormulaToken
> aSequence
;
5160 ScDocShell
* pDocSh
= GetDocShell();
5164 ScDocument
* pDoc
= pDocSh
->GetDocument();
5165 ScRefCellValue aCell1
;
5166 ScRefCellValue aCell2
;
5167 aCell1
.assign(*pDoc
, aRange
.aStart
);
5168 aCell2
.assign(*pDoc
, aRange
.aEnd
);
5169 if (aCell1
.meType
== CELLTYPE_FORMULA
&& aCell2
.meType
== CELLTYPE_FORMULA
)
5171 const ScFormulaCell
* pFCell1
= aCell1
.mpFormula
;
5172 const ScFormulaCell
* pFCell2
= aCell2
.mpFormula
;
5175 if (pFCell1
->GetMatrixOrigin(aStart1
) && pFCell2
->GetMatrixOrigin(aStart2
))
5177 if (aStart1
== aStart2
)
5179 ScTokenArray
* pTokenArray
= pFCell1
->GetCode();
5181 (void)ScTokenConversion::ConvertToTokenSequence(*pDoc
, aSequence
, *pTokenArray
);
5189 void SAL_CALL
ScCellRangeObj::setArrayTokens( const uno::Sequence
<sheet::FormulaToken
>& rTokens
) throw(uno::RuntimeException
)
5191 SolarMutexGuard aGuard
;
5192 ScDocShell
* pDocSh
= GetDocShell();
5195 if ( rTokens
.getLength() )
5197 if ( ScTableSheetObj::getImplementation( (cppu::OWeakObject
*)this ) )
5199 throw uno::RuntimeException();
5202 ScDocument
* pDoc
= pDocSh
->GetDocument();
5203 ScTokenArray aTokenArray
;
5204 (void)ScTokenConversion::ConvertToTokenArray( *pDoc
, aTokenArray
, rTokens
);
5206 // Actually GRAM_PODF_A1 is a don't-care here because of the token
5207 // array being set, it fits with other API compatibility grammars
5209 pDocSh
->GetDocFunc().EnterMatrix( aRange
, NULL
, &aTokenArray
, EMPTY_STRING
, sal_True
, sal_True
, EMPTY_STRING
, formula::FormulaGrammar::GRAM_PODF_A1
);
5213 // empty sequence -> erase array formula
5215 aMark
.SetMarkArea( aRange
);
5216 aMark
.SelectTable( aRange
.aStart
.Tab(), sal_True
);
5217 pDocSh
->GetDocFunc().DeleteContents( aMark
, IDF_CONTENTS
, sal_True
, sal_True
);
5224 uno::Sequence
< uno::Sequence
<uno::Any
> > SAL_CALL
ScCellRangeObj::getDataArray()
5225 throw(uno::RuntimeException
)
5227 SolarMutexGuard aGuard
;
5229 if ( ScTableSheetObj::getImplementation( (cppu::OWeakObject
*)this ) )
5231 // don't create a data array for the sheet
5232 throw uno::RuntimeException();
5235 ScDocShell
* pDocSh
= GetDocShell();
5239 // bAllowNV = TRUE: errors as void
5240 if ( ScRangeToSequence::FillMixedArray( aAny
, pDocSh
->GetDocument(), aRange
, sal_True
) )
5242 uno::Sequence
< uno::Sequence
<uno::Any
> > aSeq
;
5243 if ( aAny
>>= aSeq
)
5244 return aSeq
; // success
5248 throw uno::RuntimeException(); // no other exceptions specified
5251 void SAL_CALL
ScCellRangeObj::setDataArray(
5252 const uno::Sequence
< uno::Sequence
<uno::Any
> >& aArray
)
5253 throw(uno::RuntimeException
)
5255 SolarMutexGuard aGuard
;
5257 sal_Bool bDone
= false;
5258 ScDocShell
* pDocSh
= GetDocShell();
5261 //! move lcl_PutDataArray to docfunc?
5262 bDone
= lcl_PutDataArray( *pDocSh
, aRange
, aArray
);
5266 throw uno::RuntimeException(); // no other exceptions specified
5269 // XCellRangeFormula
5271 uno::Sequence
< uno::Sequence
<OUString
> > SAL_CALL
ScCellRangeObj::getFormulaArray()
5272 throw(uno::RuntimeException
)
5274 SolarMutexGuard aGuard
;
5276 if ( ScTableSheetObj::getImplementation( (cppu::OWeakObject
*)this ) )
5278 // don't create a data array for the sheet
5279 throw uno::RuntimeException();
5282 ScDocShell
* pDocSh
= GetDocShell();
5285 SCCOL nStartCol
= aRange
.aStart
.Col();
5286 SCROW nStartRow
= aRange
.aStart
.Row();
5287 SCCOL nEndCol
= aRange
.aEnd
.Col();
5288 SCROW nEndRow
= aRange
.aEnd
.Row();
5289 SCCOL nColCount
= nEndCol
+ 1 - nStartCol
;
5290 SCROW nRowCount
= nEndRow
+ 1 - nStartRow
;
5291 SCTAB nTab
= aRange
.aStart
.Tab();
5293 uno::Sequence
< uno::Sequence
<OUString
> > aRowSeq( nRowCount
);
5294 uno::Sequence
<OUString
>* pRowAry
= aRowSeq
.getArray();
5295 for (SCROW nRowIndex
= 0; nRowIndex
< nRowCount
; nRowIndex
++)
5297 uno::Sequence
<OUString
> aColSeq( nColCount
);
5298 OUString
* pColAry
= aColSeq
.getArray();
5299 for (SCCOL nColIndex
= 0; nColIndex
< nColCount
; nColIndex
++)
5300 pColAry
[nColIndex
] = lcl_GetInputString( pDocSh
->GetDocument(),
5301 ScAddress( nStartCol
+nColIndex
, nStartRow
+nRowIndex
, nTab
), sal_True
);
5303 pRowAry
[nRowIndex
] = aColSeq
;
5309 throw uno::RuntimeException(); // no other exceptions specified
5312 void SAL_CALL
ScCellRangeObj::setFormulaArray(
5313 const uno::Sequence
< uno::Sequence
<OUString
> >& aArray
)
5314 throw(uno::RuntimeException
)
5316 SolarMutexGuard aGuard
;
5318 sal_Bool bDone
= false;
5319 ScDocShell
* pDocSh
= GetDocShell();
5322 ScExternalRefManager::ApiGuard
aExtRefGuard(pDocSh
->GetDocument());
5324 // GRAM_PODF_A1 for API compatibility.
5325 bDone
= lcl_PutFormulaArray( *pDocSh
, aRange
, aArray
, formula::FormulaGrammar::GRAM_PODF_A1
);
5329 throw uno::RuntimeException(); // no other exceptions specified
5332 // XMultipleOperation
5334 void SAL_CALL
ScCellRangeObj::setTableOperation( const table::CellRangeAddress
& aFormulaRange
,
5335 sheet::TableOperationMode nMode
,
5336 const table::CellAddress
& aColumnCell
,
5337 const table::CellAddress
& aRowCell
)
5338 throw(uno::RuntimeException
)
5340 SolarMutexGuard aGuard
;
5341 ScDocShell
* pDocSh
= GetDocShell();
5344 sal_Bool bError
= false;
5345 ScTabOpParam aParam
;
5346 aParam
.aRefFormulaCell
= ScRefAddress( (SCCOL
)aFormulaRange
.StartColumn
,
5347 (SCROW
)aFormulaRange
.StartRow
, aFormulaRange
.Sheet
,
5348 false, false, false );
5349 aParam
.aRefFormulaEnd
= ScRefAddress( (SCCOL
)aFormulaRange
.EndColumn
,
5350 (SCROW
)aFormulaRange
.EndRow
, aFormulaRange
.Sheet
,
5351 false, false, false );
5352 aParam
.aRefRowCell
= ScRefAddress( (SCCOL
)aRowCell
.Column
,
5353 (SCROW
)aRowCell
.Row
, aRowCell
.Sheet
,
5354 false, false, false );
5355 aParam
.aRefColCell
= ScRefAddress( (SCCOL
)aColumnCell
.Column
,
5356 (SCROW
)aColumnCell
.Row
, aColumnCell
.Sheet
,
5357 false, false, false );
5360 case sheet::TableOperationMode_COLUMN
:
5363 case sheet::TableOperationMode_ROW
:
5366 case sheet::TableOperationMode_BOTH
:
5374 pDocSh
->GetDocFunc().TabOp( aRange
, NULL
, aParam
, sal_True
, sal_True
);
5380 void SAL_CALL
ScCellRangeObj::merge( sal_Bool bMerge
) throw(uno::RuntimeException
)
5382 SolarMutexGuard aGuard
;
5383 ScDocShell
* pDocSh
= GetDocShell();
5386 ScCellMergeOption
aMergeOption(
5387 aRange
.aStart
.Col(), aRange
.aStart
.Row(),
5388 aRange
.aEnd
.Col(), aRange
.aEnd
.Row(), false);
5389 aMergeOption
.maTabs
.insert(aRange
.aStart
.Tab());
5391 pDocSh
->GetDocFunc().MergeCells( aMergeOption
, false, true, true );
5393 pDocSh
->GetDocFunc().UnmergeCells( aMergeOption
, true );
5395 //! Fehler abfangen?
5399 sal_Bool SAL_CALL
ScCellRangeObj::getIsMerged() throw(uno::RuntimeException
)
5401 SolarMutexGuard aGuard
;
5402 ScDocShell
* pDocSh
= GetDocShell();
5403 return pDocSh
&& pDocSh
->GetDocument()->HasAttrib( aRange
, HASATTR_MERGED
);
5408 void SAL_CALL
ScCellRangeObj::fillSeries( sheet::FillDirection nFillDirection
,
5409 sheet::FillMode nFillMode
, sheet::FillDateMode nFillDateMode
,
5410 double fStep
, double fEndValue
) throw(uno::RuntimeException
)
5412 SolarMutexGuard aGuard
;
5413 ScDocShell
* pDocSh
= GetDocShell();
5416 sal_Bool bError
= false;
5418 FillDir eDir
= FILL_TO_BOTTOM
;
5419 switch (nFillDirection
)
5421 case sheet::FillDirection_TO_BOTTOM
:
5422 eDir
= FILL_TO_BOTTOM
;
5424 case sheet::FillDirection_TO_RIGHT
:
5425 eDir
= FILL_TO_RIGHT
;
5427 case sheet::FillDirection_TO_TOP
:
5430 case sheet::FillDirection_TO_LEFT
:
5431 eDir
= FILL_TO_LEFT
;
5437 FillCmd eCmd
= FILL_SIMPLE
;
5438 switch ( nFillMode
)
5440 case sheet::FillMode_SIMPLE
:
5443 case sheet::FillMode_LINEAR
:
5446 case sheet::FillMode_GROWTH
:
5449 case sheet::FillMode_DATE
:
5452 case sheet::FillMode_AUTO
:
5459 FillDateCmd eDateCmd
= FILL_DAY
;
5460 switch ( nFillDateMode
)
5462 case sheet::FillDateMode_FILL_DATE_DAY
:
5463 eDateCmd
= FILL_DAY
;
5465 case sheet::FillDateMode_FILL_DATE_WEEKDAY
:
5466 eDateCmd
= FILL_WEEKDAY
;
5468 case sheet::FillDateMode_FILL_DATE_MONTH
:
5469 eDateCmd
= FILL_MONTH
;
5471 case sheet::FillDateMode_FILL_DATE_YEAR
:
5472 eDateCmd
= FILL_YEAR
;
5479 pDocSh
->GetDocFunc().FillSeries( aRange
, NULL
, eDir
, eCmd
, eDateCmd
,
5480 MAXDOUBLE
, fStep
, fEndValue
, sal_True
, sal_True
);
5484 void SAL_CALL
ScCellRangeObj::fillAuto( sheet::FillDirection nFillDirection
,
5485 sal_Int32 nSourceCount
) throw(uno::RuntimeException
)
5487 SolarMutexGuard aGuard
;
5488 ScDocShell
* pDocSh
= GetDocShell();
5489 if ( pDocSh
&& nSourceCount
)
5491 ScRange
aSourceRange(aRange
);
5492 SCsCOLROW nCount
= 0; // "Dest-Count"
5493 FillDir eDir
= FILL_TO_BOTTOM
;
5494 sal_Bool bError
= false;
5495 switch (nFillDirection
)
5497 case sheet::FillDirection_TO_BOTTOM
:
5498 aSourceRange
.aEnd
.SetRow( static_cast<SCROW
>( aSourceRange
.aStart
.Row() + nSourceCount
- 1 ) );
5499 nCount
= aRange
.aEnd
.Row() - aSourceRange
.aEnd
.Row();
5500 eDir
= FILL_TO_BOTTOM
;
5502 case sheet::FillDirection_TO_RIGHT
:
5503 aSourceRange
.aEnd
.SetCol( static_cast<SCCOL
>( aSourceRange
.aStart
.Col() + nSourceCount
- 1 ) );
5504 nCount
= aRange
.aEnd
.Col() - aSourceRange
.aEnd
.Col();
5505 eDir
= FILL_TO_RIGHT
;
5507 case sheet::FillDirection_TO_TOP
:
5508 aSourceRange
.aStart
.SetRow( static_cast<SCROW
>( aSourceRange
.aEnd
.Row() - nSourceCount
+ 1 ) );
5509 nCount
= aSourceRange
.aStart
.Row() - aRange
.aStart
.Row();
5512 case sheet::FillDirection_TO_LEFT
:
5513 aSourceRange
.aStart
.SetCol( static_cast<SCCOL
>( aSourceRange
.aEnd
.Col() - nSourceCount
+ 1 ) );
5514 nCount
= aSourceRange
.aStart
.Col() - aRange
.aStart
.Col();
5515 eDir
= FILL_TO_LEFT
;
5520 if (nCount
< 0 || nCount
> MAXROW
) // overflow
5524 pDocSh
->GetDocFunc().FillAuto( aSourceRange
, NULL
, eDir
, nCount
, sal_True
, sal_True
);
5530 void SAL_CALL
ScCellRangeObj::autoFormat( const OUString
& aName
)
5531 throw(lang::IllegalArgumentException
, uno::RuntimeException
)
5533 SolarMutexGuard aGuard
;
5534 ScDocShell
* pDocSh
= GetDocShell();
5537 ScAutoFormat
* pAutoFormat
= ScGlobal::GetOrCreateAutoFormat();
5538 ScAutoFormat::const_iterator it
= pAutoFormat
->find(aName
);
5539 if (it
!= pAutoFormat
->end())
5541 ScAutoFormat::const_iterator itBeg
= pAutoFormat
->begin();
5542 size_t nIndex
= std::distance(itBeg
, it
);
5543 pDocSh
->GetDocFunc().AutoFormat(aRange
, NULL
, nIndex
, true, true);
5546 throw lang::IllegalArgumentException();
5552 uno::Sequence
<beans::PropertyValue
> SAL_CALL
ScCellRangeObj::createSortDescriptor()
5553 throw(uno::RuntimeException
)
5555 SolarMutexGuard aGuard
;
5557 ScDocShell
* pDocSh
= GetDocShell();
5560 // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich
5561 ScDBData
* pData
= pDocSh
->GetDBData( aRange
, SC_DB_OLD
, SC_DBSEL_FORCE_MARK
);
5564 pData
->GetSortParam(aParam
);
5566 // im SortDescriptor sind die Fields innerhalb des Bereichs gezaehlt
5568 pData
->GetArea(aDBRange
);
5569 SCCOLROW nFieldStart
= aParam
.bByRow
?
5570 static_cast<SCCOLROW
>(aDBRange
.aStart
.Col()) :
5571 static_cast<SCCOLROW
>(aDBRange
.aStart
.Row());
5572 for (sal_uInt16 i
=0; i
<aParam
.GetSortKeyCount(); i
++)
5573 if ( aParam
.maKeyState
[i
].bDoSort
&& aParam
.maKeyState
[i
].nField
>= nFieldStart
)
5574 aParam
.maKeyState
[i
].nField
-= nFieldStart
;
5578 uno::Sequence
<beans::PropertyValue
> aSeq( ScSortDescriptor::GetPropertyCount() );
5579 ScSortDescriptor::FillProperties( aSeq
, aParam
);
5583 void SAL_CALL
ScCellRangeObj::sort( const uno::Sequence
<beans::PropertyValue
>& aDescriptor
)
5584 throw(uno::RuntimeException
)
5586 SolarMutexGuard aGuard
;
5587 ScDocShell
* pDocSh
= GetDocShell();
5592 ScDBData
* pData
= pDocSh
->GetDBData( aRange
, SC_DB_MAKE
, SC_DBSEL_FORCE_MARK
); // ggf. Bereich anlegen
5595 // alten Einstellungen holen, falls nicht alles neu gesetzt wird
5596 pData
->GetSortParam(aParam
);
5597 SCCOLROW nOldStart
= aParam
.bByRow
?
5598 static_cast<SCCOLROW
>(aRange
.aStart
.Col()) :
5599 static_cast<SCCOLROW
>(aRange
.aStart
.Row());
5600 for (i
=0; i
<aParam
.GetSortKeyCount(); i
++)
5601 if ( aParam
.maKeyState
[i
].bDoSort
&& aParam
.maKeyState
[i
].nField
>= nOldStart
)
5602 aParam
.maKeyState
[i
].nField
-= nOldStart
;
5605 ScSortDescriptor::FillSortParam( aParam
, aDescriptor
);
5607 // im SortDescriptor sind die Fields innerhalb des Bereichs gezaehlt
5608 // ByRow kann bei FillSortParam umgesetzt worden sein
5609 SCCOLROW nFieldStart
= aParam
.bByRow
?
5610 static_cast<SCCOLROW
>(aRange
.aStart
.Col()) :
5611 static_cast<SCCOLROW
>(aRange
.aStart
.Row());
5612 for (i
=0; i
<aParam
.GetSortKeyCount(); i
++)
5613 aParam
.maKeyState
[i
].nField
+= nFieldStart
;
5615 SCTAB nTab
= aRange
.aStart
.Tab();
5616 aParam
.nCol1
= aRange
.aStart
.Col();
5617 aParam
.nRow1
= aRange
.aStart
.Row();
5618 aParam
.nCol2
= aRange
.aEnd
.Col();
5619 aParam
.nRow2
= aRange
.aEnd
.Row();
5621 pDocSh
->GetDBData( aRange
, SC_DB_MAKE
, SC_DBSEL_FORCE_MARK
); // ggf. Bereich anlegen
5623 ScDBDocFunc
aFunc(*pDocSh
); // Bereich muss angelegt sein
5624 aFunc
.Sort( nTab
, aParam
, sal_True
, sal_True
, sal_True
);
5630 uno::Reference
<sheet::XSheetFilterDescriptor
> SAL_CALL
ScCellRangeObj::createFilterDescriptor(
5631 sal_Bool bEmpty
) throw(uno::RuntimeException
)
5633 SolarMutexGuard aGuard
;
5634 ScDocShell
* pDocSh
= GetDocShell();
5635 ScFilterDescriptor
* pNew
= new ScFilterDescriptor(pDocSh
);
5636 if ( !bEmpty
&& pDocSh
)
5638 // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich
5639 ScDBData
* pData
= pDocSh
->GetDBData( aRange
, SC_DB_OLD
, SC_DBSEL_FORCE_MARK
);
5642 ScQueryParam aParam
;
5643 pData
->GetQueryParam(aParam
);
5644 // im FilterDescriptor sind die Fields innerhalb des Bereichs gezaehlt
5646 pData
->GetArea(aDBRange
);
5647 SCCOLROW nFieldStart
= aParam
.bByRow
?
5648 static_cast<SCCOLROW
>(aDBRange
.aStart
.Col()) :
5649 static_cast<SCCOLROW
>(aDBRange
.aStart
.Row());
5650 SCSIZE nCount
= aParam
.GetEntryCount();
5651 for (SCSIZE i
=0; i
<nCount
; i
++)
5653 ScQueryEntry
& rEntry
= aParam
.GetEntry(i
);
5654 if (rEntry
.bDoQuery
&& rEntry
.nField
>= nFieldStart
)
5655 rEntry
.nField
-= nFieldStart
;
5657 pNew
->SetParam(aParam
);
5663 void SAL_CALL
ScCellRangeObj::filter( const uno::Reference
<sheet::XSheetFilterDescriptor
>& xDescriptor
)
5664 throw(uno::RuntimeException
)
5666 SolarMutexGuard aGuard
;
5668 // das koennte theoretisch ein fremdes Objekt sein, also nur das
5669 // oeffentliche XSheetFilterDescriptor Interface benutzen, um
5670 // die Daten in ein ScFilterDescriptor Objekt zu kopieren:
5671 //! wenn es schon ein ScFilterDescriptor ist, direkt per getImplementation?
5673 ScDocShell
* pDocSh
= GetDocShell();
5674 ScFilterDescriptor
aImpl(pDocSh
);
5675 uno::Reference
< sheet::XSheetFilterDescriptor2
> xDescriptor2( xDescriptor
, uno::UNO_QUERY
);
5676 if ( xDescriptor2
.is() )
5678 aImpl
.setFilterFields2( xDescriptor2
->getFilterFields2() );
5682 aImpl
.setFilterFields( xDescriptor
->getFilterFields() );
5684 // Rest sind jetzt Properties...
5686 uno::Reference
<beans::XPropertySet
> xPropSet( xDescriptor
, uno::UNO_QUERY
);
5688 lcl_CopyProperties( aImpl
, *(beans::XPropertySet
*)xPropSet
.get() );
5696 ScQueryParam aParam
= aImpl
.GetParam();
5697 // im FilterDescriptor sind die Fields innerhalb des Bereichs gezaehlt
5698 SCCOLROW nFieldStart
= aParam
.bByRow
?
5699 static_cast<SCCOLROW
>(aRange
.aStart
.Col()) :
5700 static_cast<SCCOLROW
>(aRange
.aStart
.Row());
5701 SCSIZE nCount
= aParam
.GetEntryCount();
5702 for (SCSIZE i
=0; i
<nCount
; i
++)
5704 ScQueryEntry
& rEntry
= aParam
.GetEntry(i
);
5705 if (rEntry
.bDoQuery
)
5707 rEntry
.nField
+= nFieldStart
;
5708 // Im Dialog wird immer der String angezeigt -> muss zum Wert passen
5709 ScQueryEntry::QueryItemsType
& rItems
= rEntry
.GetQueryItems();
5711 ScQueryEntry::Item
& rItem
= rItems
.front();
5712 if (rItem
.meType
!= ScQueryEntry::ByString
)
5714 pDocSh
->GetDocument()->GetFormatTable()->
5715 GetInputLineString(rItem
.mfVal
, 0, rItem
.maString
);
5720 SCTAB nTab
= aRange
.aStart
.Tab();
5721 aParam
.nCol1
= aRange
.aStart
.Col();
5722 aParam
.nRow1
= aRange
.aStart
.Row();
5723 aParam
.nCol2
= aRange
.aEnd
.Col();
5724 aParam
.nRow2
= aRange
.aEnd
.Row();
5726 pDocSh
->GetDBData( aRange
, SC_DB_MAKE
, SC_DBSEL_FORCE_MARK
); // ggf. Bereich anlegen
5728 //! keep source range in filter descriptor
5729 //! if created by createFilterDescriptorByObject ???
5731 ScDBDocFunc
aFunc(*pDocSh
);
5732 aFunc
.Query( nTab
, aParam
, NULL
, sal_True
, sal_True
); // Bereich muss angelegt sein
5736 //! get/setAutoFilter als Properties!!!
5738 // XAdvancedFilterSource
5740 uno::Reference
<sheet::XSheetFilterDescriptor
> SAL_CALL
ScCellRangeObj::createFilterDescriptorByObject(
5741 const uno::Reference
<sheet::XSheetFilterable
>& xObject
)
5742 throw(uno::RuntimeException
)
5744 SolarMutexGuard aGuard
;
5746 // this ist hier nicht der Bereich, der gefiltert wird, sondern der
5747 // Bereich mit der Abfrage...
5749 uno::Reference
<sheet::XCellRangeAddressable
> xAddr( xObject
, uno::UNO_QUERY
);
5751 ScDocShell
* pDocSh
= GetDocShell();
5752 if ( pDocSh
&& xAddr
.is() )
5754 //! Test, ob xObject im selben Dokument ist
5756 ScFilterDescriptor
* pNew
= new ScFilterDescriptor(pDocSh
); //! stattdessen vom Objekt?
5758 ScQueryParam aParam
= pNew
->GetParam();
5759 aParam
.bHasHeader
= sal_True
;
5761 table::CellRangeAddress
aDataAddress(xAddr
->getRangeAddress());
5762 aParam
.nCol1
= (SCCOL
)aDataAddress
.StartColumn
;
5763 aParam
.nRow1
= (SCROW
)aDataAddress
.StartRow
;
5764 aParam
.nCol2
= (SCCOL
)aDataAddress
.EndColumn
;
5765 aParam
.nRow2
= (SCROW
)aDataAddress
.EndRow
;
5766 aParam
.nTab
= aDataAddress
.Sheet
;
5768 ScDocument
* pDoc
= pDocSh
->GetDocument();
5769 sal_Bool bOk
= pDoc
->CreateQueryParam(
5770 aRange
.aStart
.Col(), aRange
.aStart
.Row(),
5771 aRange
.aEnd
.Col(), aRange
.aEnd
.Row(),
5772 aRange
.aStart
.Tab(), aParam
);
5775 // im FilterDescriptor sind die Fields innerhalb des Bereichs gezaehlt
5776 SCCOLROW nFieldStart
= aParam
.bByRow
?
5777 static_cast<SCCOLROW
>(aDataAddress
.StartColumn
) :
5778 static_cast<SCCOLROW
>(aDataAddress
.StartRow
);
5779 SCSIZE nCount
= aParam
.GetEntryCount();
5780 for (SCSIZE i
=0; i
<nCount
; i
++)
5782 ScQueryEntry
& rEntry
= aParam
.GetEntry(i
);
5783 if (rEntry
.bDoQuery
&& rEntry
.nField
>= nFieldStart
)
5784 rEntry
.nField
-= nFieldStart
;
5787 pNew
->SetParam( aParam
);
5793 return NULL
; // ungueltig -> null
5797 OSL_FAIL("kein Dokument oder kein Bereich");
5803 uno::Reference
<sheet::XSubTotalDescriptor
> SAL_CALL
ScCellRangeObj::createSubTotalDescriptor(
5804 sal_Bool bEmpty
) throw(uno::RuntimeException
)
5806 SolarMutexGuard aGuard
;
5807 ScSubTotalDescriptor
* pNew
= new ScSubTotalDescriptor
;
5808 ScDocShell
* pDocSh
= GetDocShell();
5809 if ( !bEmpty
&& pDocSh
)
5811 // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich
5812 ScDBData
* pData
= pDocSh
->GetDBData( aRange
, SC_DB_OLD
, SC_DBSEL_FORCE_MARK
);
5815 ScSubTotalParam aParam
;
5816 pData
->GetSubTotalParam(aParam
);
5817 // im SubTotalDescriptor sind die Fields innerhalb des Bereichs gezaehlt
5819 pData
->GetArea(aDBRange
);
5820 SCCOL nFieldStart
= aDBRange
.aStart
.Col();
5821 for (sal_uInt16 i
=0; i
<MAXSUBTOTAL
; i
++)
5823 if ( aParam
.bGroupActive
[i
] )
5825 if ( aParam
.nField
[i
] >= nFieldStart
)
5826 aParam
.nField
[i
] = sal::static_int_cast
<SCCOL
>( aParam
.nField
[i
] - nFieldStart
);
5827 for (SCCOL j
=0; j
<aParam
.nSubTotals
[i
]; j
++)
5828 if ( aParam
.pSubTotals
[i
][j
] >= nFieldStart
)
5829 aParam
.pSubTotals
[i
][j
] = sal::static_int_cast
<SCCOL
>( aParam
.pSubTotals
[i
][j
] - nFieldStart
);
5832 pNew
->SetParam(aParam
);
5838 void SAL_CALL
ScCellRangeObj::applySubTotals(
5839 const uno::Reference
<sheet::XSubTotalDescriptor
>& xDescriptor
,
5840 sal_Bool bReplace
) throw(uno::RuntimeException
)
5842 SolarMutexGuard aGuard
;
5844 if (!xDescriptor
.is()) return;
5846 ScDocShell
* pDocSh
= GetDocShell();
5847 ScSubTotalDescriptorBase
* pImp
=
5848 ScSubTotalDescriptorBase::getImplementation( xDescriptor
);
5852 ScSubTotalParam aParam
;
5853 pImp
->GetData(aParam
); // virtuelle Methode der Basisklasse
5855 // im SubTotalDescriptor sind die Fields innerhalb des Bereichs gezaehlt
5856 SCCOL nFieldStart
= aRange
.aStart
.Col();
5857 for (sal_uInt16 i
=0; i
<MAXSUBTOTAL
; i
++)
5859 if ( aParam
.bGroupActive
[i
] )
5861 aParam
.nField
[i
] = sal::static_int_cast
<SCCOL
>( aParam
.nField
[i
] + nFieldStart
);
5862 for (SCCOL j
=0; j
<aParam
.nSubTotals
[i
]; j
++)
5863 aParam
.pSubTotals
[i
][j
] = sal::static_int_cast
<SCCOL
>( aParam
.pSubTotals
[i
][j
] + nFieldStart
);
5867 aParam
.bReplace
= bReplace
;
5869 SCTAB nTab
= aRange
.aStart
.Tab();
5870 aParam
.nCol1
= aRange
.aStart
.Col();
5871 aParam
.nRow1
= aRange
.aStart
.Row();
5872 aParam
.nCol2
= aRange
.aEnd
.Col();
5873 aParam
.nRow2
= aRange
.aEnd
.Row();
5875 pDocSh
->GetDBData( aRange
, SC_DB_MAKE
, SC_DBSEL_FORCE_MARK
); // ggf. Bereich anlegen
5877 ScDBDocFunc
aFunc(*pDocSh
);
5878 aFunc
.DoSubTotals( nTab
, aParam
, NULL
, sal_True
, sal_True
); // Bereich muss angelegt sein
5882 void SAL_CALL
ScCellRangeObj::removeSubTotals() throw(uno::RuntimeException
)
5884 SolarMutexGuard aGuard
;
5886 ScDocShell
* pDocSh
= GetDocShell();
5889 ScSubTotalParam aParam
;
5890 ScDBData
* pData
= pDocSh
->GetDBData( aRange
, SC_DB_OLD
, SC_DBSEL_FORCE_MARK
);
5892 pData
->GetSubTotalParam(aParam
); // auch bei Remove die Feld-Eintraege behalten
5894 aParam
.bRemoveOnly
= sal_True
;
5896 SCTAB nTab
= aRange
.aStart
.Tab();
5897 aParam
.nCol1
= aRange
.aStart
.Col();
5898 aParam
.nRow1
= aRange
.aStart
.Row();
5899 aParam
.nCol2
= aRange
.aEnd
.Col();
5900 aParam
.nRow2
= aRange
.aEnd
.Row();
5902 pDocSh
->GetDBData( aRange
, SC_DB_MAKE
, SC_DBSEL_FORCE_MARK
); // ggf. Bereich anlegen
5904 ScDBDocFunc
aFunc(*pDocSh
);
5905 aFunc
.DoSubTotals( nTab
, aParam
, NULL
, sal_True
, sal_True
); // Bereich muss angelegt sein
5909 uno::Sequence
<beans::PropertyValue
> SAL_CALL
ScCellRangeObj::createImportDescriptor( sal_Bool bEmpty
)
5910 throw(uno::RuntimeException
)
5912 SolarMutexGuard aGuard
;
5913 ScImportParam aParam
;
5914 ScDocShell
* pDocSh
= GetDocShell();
5915 if ( !bEmpty
&& pDocSh
)
5917 // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich
5918 ScDBData
* pData
= pDocSh
->GetDBData( aRange
, SC_DB_OLD
, SC_DBSEL_FORCE_MARK
);
5920 pData
->GetImportParam(aParam
);
5923 uno::Sequence
<beans::PropertyValue
> aSeq( ScImportDescriptor::GetPropertyCount() );
5924 ScImportDescriptor::FillProperties( aSeq
, aParam
);
5928 void SAL_CALL
ScCellRangeObj::doImport( const uno::Sequence
<beans::PropertyValue
>& aDescriptor
)
5929 throw(uno::RuntimeException
)
5931 SolarMutexGuard aGuard
;
5932 ScDocShell
* pDocSh
= GetDocShell();
5935 ScImportParam aParam
;
5936 ScImportDescriptor::FillImportParam( aParam
, aDescriptor
);
5938 SCTAB nTab
= aRange
.aStart
.Tab();
5939 aParam
.nCol1
= aRange
.aStart
.Col();
5940 aParam
.nRow1
= aRange
.aStart
.Row();
5941 aParam
.nCol2
= aRange
.aEnd
.Col();
5942 aParam
.nRow2
= aRange
.aEnd
.Row();
5944 //! TODO: could we get passed a valid result set by any means?
5946 pDocSh
->GetDBData( aRange
, SC_DB_MAKE
, SC_DBSEL_FORCE_MARK
); // ggf. Bereich anlegen
5948 ScDBDocFunc
aFunc(*pDocSh
); // Bereich muss angelegt sein
5949 aFunc
.DoImport( nTab
, aParam
, NULL
, true ); //! Api-Flag as parameter
5953 // XCellFormatRangesSupplier
5955 uno::Reference
<container::XIndexAccess
> SAL_CALL
ScCellRangeObj::getCellFormatRanges()
5956 throw(uno::RuntimeException
)
5958 SolarMutexGuard aGuard
;
5959 ScDocShell
* pDocSh
= GetDocShell();
5961 return new ScCellFormatsObj( pDocSh
, aRange
);
5965 // XUniqueCellFormatRangesSupplier
5967 uno::Reference
<container::XIndexAccess
> SAL_CALL
ScCellRangeObj::getUniqueCellFormatRanges()
5968 throw(uno::RuntimeException
)
5970 SolarMutexGuard aGuard
;
5971 ScDocShell
* pDocSh
= GetDocShell();
5973 return new ScUniqueCellFormatsObj( pDocSh
, aRange
);
5977 // XPropertySet erweitert fuer Range-Properties
5979 uno::Reference
<beans::XPropertySetInfo
> SAL_CALL
ScCellRangeObj::getPropertySetInfo()
5980 throw(uno::RuntimeException
)
5982 SolarMutexGuard aGuard
;
5983 static uno::Reference
<beans::XPropertySetInfo
> aRef(
5984 new SfxItemPropertySetInfo( pRangePropSet
->getPropertyMap() ));
5988 void ScCellRangeObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry
* pEntry
, const uno::Any
& aValue
)
5989 throw(lang::IllegalArgumentException
, uno::RuntimeException
)
5991 // Range has only Position and Size in addition to ScCellRangesBase, both are ReadOnly
5992 // -> nothing to do here
5994 ScCellRangesBase::SetOnePropertyValue( pEntry
, aValue
);
5997 void ScCellRangeObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry
* pEntry
,
5999 throw(uno::RuntimeException
)
6003 if ( pEntry
->nWID
== SC_WID_UNO_POS
)
6005 ScDocShell
* pDocSh
= GetDocShell();
6008 // GetMMRect converts using HMM_PER_TWIPS, like the DrawingLayer
6009 Rectangle
aMMRect(pDocSh
->GetDocument()->GetMMRect(
6010 aRange
.aStart
.Col(), aRange
.aStart
.Row(),
6011 aRange
.aEnd
.Col(), aRange
.aEnd
.Row(), aRange
.aStart
.Tab() ));
6012 awt::Point
aPos( aMMRect
.Left(), aMMRect
.Top() );
6016 else if ( pEntry
->nWID
== SC_WID_UNO_SIZE
)
6018 ScDocShell
* pDocSh
= GetDocShell();
6021 // GetMMRect converts using HMM_PER_TWIPS, like the DrawingLayer
6022 Rectangle aMMRect
= pDocSh
->GetDocument()->GetMMRect(
6023 aRange
.aStart
.Col(), aRange
.aStart
.Row(),
6024 aRange
.aEnd
.Col(), aRange
.aEnd
.Row(), aRange
.aStart
.Tab() );
6025 Size
aSize(aMMRect
.GetSize());
6026 awt::Size
aAwtSize( aSize
.Width(), aSize
.Height() );
6031 ScCellRangesBase::GetOnePropertyValue( pEntry
, rAny
);
6036 const SfxItemPropertyMap
& ScCellRangeObj::GetItemPropertyMap()
6038 return pRangePropSet
->getPropertyMap();
6043 OUString SAL_CALL
ScCellRangeObj::getImplementationName() throw(uno::RuntimeException
)
6045 return OUString( "ScCellRangeObj" );
6048 sal_Bool SAL_CALL
ScCellRangeObj::supportsService( const OUString
& rServiceName
)
6049 throw(uno::RuntimeException
)
6051 String
aServiceStr( rServiceName
);
6052 return aServiceStr
.EqualsAscii( SCSHEETCELLRANGE_SERVICE
) ||
6053 aServiceStr
.EqualsAscii( SCCELLRANGE_SERVICE
) ||
6054 aServiceStr
.EqualsAscii( SCCELLPROPERTIES_SERVICE
) ||
6055 aServiceStr
.EqualsAscii( SCCHARPROPERTIES_SERVICE
) ||
6056 aServiceStr
.EqualsAscii( SCPARAPROPERTIES_SERVICE
);
6059 uno::Sequence
<OUString
> SAL_CALL
ScCellRangeObj::getSupportedServiceNames()
6060 throw(uno::RuntimeException
)
6062 uno::Sequence
<OUString
> aRet(5);
6063 OUString
* pArray
= aRet
.getArray();
6064 pArray
[0] = OUString( SCSHEETCELLRANGE_SERVICE
);
6065 pArray
[1] = OUString( SCCELLRANGE_SERVICE
);
6066 pArray
[2] = OUString( SCCELLPROPERTIES_SERVICE
);
6067 pArray
[3] = OUString( SCCHARPROPERTIES_SERVICE
);
6068 pArray
[4] = OUString( SCPARAPROPERTIES_SERVICE
);
6072 //------------------------------------------------------------------------
6074 const SvxItemPropertySet
* ScCellObj::GetEditPropertySet()
6076 return lcl_GetEditPropertySet();
6079 const SfxItemPropertyMap
& ScCellObj::GetCellPropertyMap()
6081 return lcl_GetCellPropertySet()->getPropertyMap();
6084 ScCellObj::ScCellObj(ScDocShell
* pDocSh
, const ScAddress
& rP
) :
6085 ScCellRangeObj( pDocSh
, ScRange(rP
,rP
) ),
6086 pCellPropSet( lcl_GetCellPropertySet() ),
6088 nActionLockCount( 0 )
6090 // pUnoText is allocated on demand (GetUnoText)
6091 // can't be aggregated because getString/setString is handled here
6094 SvxUnoText
& ScCellObj::GetUnoText()
6096 if (!mxUnoText
.is())
6098 mxUnoText
.set(new ScCellTextObj(GetDocShell(), aCellPos
));
6099 if (nActionLockCount
)
6101 ScCellEditSource
* pEditSource
=
6102 static_cast<ScCellEditSource
*> (mxUnoText
->GetEditSource());
6104 pEditSource
->SetDoUpdateData(false);
6110 ScCellObj::~ScCellObj()
6114 void ScCellObj::RefChanged()
6116 ScCellRangeObj::RefChanged();
6118 const ScRangeList
& rRanges
= GetRangeList();
6119 OSL_ENSURE(rRanges
.size() == 1, "was fuer Ranges ?!?!");
6120 if ( !rRanges
.empty() )
6122 const ScRange
* pFirst
= rRanges
[ 0 ];
6123 aCellPos
= pFirst
->aStart
;
6127 uno::Any SAL_CALL
ScCellObj::queryInterface( const uno::Type
& rType
) throw(uno::RuntimeException
)
6129 SC_QUERYINTERFACE( table::XCell
)
6130 SC_QUERYINTERFACE( table::XCell2
)
6131 SC_QUERYINTERFACE( sheet::XFormulaTokens
)
6132 SC_QUERYINTERFACE( sheet::XCellAddressable
)
6133 SC_QUERYINTERFACE( text::XText
)
6134 SC_QUERYINTERFACE( text::XSimpleText
)
6135 SC_QUERYINTERFACE( text::XTextRange
)
6136 SC_QUERYINTERFACE( container::XEnumerationAccess
)
6137 SC_QUERYINTERFACE( container::XElementAccess
)
6138 SC_QUERYINTERFACE( sheet::XSheetAnnotationAnchor
)
6139 SC_QUERYINTERFACE( text::XTextFieldsSupplier
)
6140 SC_QUERYINTERFACE( document::XActionLockable
)
6142 return ScCellRangeObj::queryInterface( rType
);
6145 void SAL_CALL
ScCellObj::acquire() throw()
6147 ScCellRangeObj::acquire();
6150 void SAL_CALL
ScCellObj::release() throw()
6152 ScCellRangeObj::release();
6155 uno::Sequence
<uno::Type
> SAL_CALL
ScCellObj::getTypes() throw(uno::RuntimeException
)
6157 static uno::Sequence
<uno::Type
> aTypes
;
6158 if ( aTypes
.getLength() == 0 )
6160 uno::Sequence
<uno::Type
> aParentTypes(ScCellRangeObj::getTypes());
6161 long nParentLen
= aParentTypes
.getLength();
6162 const uno::Type
* pParentPtr
= aParentTypes
.getConstArray();
6164 aTypes
.realloc( nParentLen
+ 9 );
6165 uno::Type
* pPtr
= aTypes
.getArray();
6166 pPtr
[nParentLen
+ 0] = getCppuType((const uno::Reference
<table::XCell
>*)0);
6167 pPtr
[nParentLen
+ 1] = getCppuType((const uno::Reference
<sheet::XCellAddressable
>*)0);
6168 pPtr
[nParentLen
+ 2] = getCppuType((const uno::Reference
<text::XText
>*)0);
6169 pPtr
[nParentLen
+ 3] = getCppuType((const uno::Reference
<container::XEnumerationAccess
>*)0);
6170 pPtr
[nParentLen
+ 4] = getCppuType((const uno::Reference
<sheet::XSheetAnnotationAnchor
>*)0);
6171 pPtr
[nParentLen
+ 5] = getCppuType((const uno::Reference
<text::XTextFieldsSupplier
>*)0);
6172 pPtr
[nParentLen
+ 6] = getCppuType((const uno::Reference
<document::XActionLockable
>*)0);
6173 pPtr
[nParentLen
+ 7] = getCppuType((const uno::Reference
<sheet::XFormulaTokens
>*)0);
6174 pPtr
[nParentLen
+ 8] = getCppuType((const uno::Reference
<table::XCell2
>*)0);
6176 for (long i
=0; i
<nParentLen
; i
++)
6177 pPtr
[i
] = pParentPtr
[i
]; // parent types first
6184 class theScCellObjImplementationId
: public rtl::Static
< UnoTunnelIdInit
, theScCellObjImplementationId
> {};
6187 uno::Sequence
<sal_Int8
> SAL_CALL
ScCellObj::getImplementationId() throw(uno::RuntimeException
)
6189 return theScCellObjImplementationId::get().getSeq();
6194 OUString
ScCellObj::GetInputString_Impl(bool bEnglish
) const // fuer getFormula / FormulaLocal
6197 return lcl_GetInputString( GetDocShell()->GetDocument(), aCellPos
, bEnglish
);
6201 OUString
ScCellObj::GetOutputString_Impl(ScDocument
* pDoc
, const ScAddress
& aCellPos
)
6204 return EMPTY_OUSTRING
;
6206 ScRefCellValue aCell
;
6207 aCell
.assign(*pDoc
, aCellPos
);
6209 if (aCell
.isEmpty())
6210 return EMPTY_OUSTRING
;
6214 if (aCell
.meType
== CELLTYPE_EDIT
)
6216 // GetString an der EditCell macht Leerzeichen aus Umbruechen,
6217 // hier werden die Umbrueche aber gebraucht
6218 const EditTextObject
* pData
= aCell
.mpEditText
;
6221 EditEngine
& rEngine
= pDoc
->GetEditEngine();
6222 rEngine
.SetText(*pData
);
6223 aVal
= rEngine
.GetText(LINEEND_LF
);
6225 // Edit-Zellen auch nicht per NumberFormatter formatieren
6226 // (passend zur Ausgabe)
6230 // wie in GetString am Dokument (column)
6232 sal_uLong nNumFmt
= pDoc
->GetNumberFormat( aCellPos
);
6233 aVal
= ScCellFormat::GetString(*pDoc
, aCellPos
, nNumFmt
, &pColor
, *pDoc
->GetFormatTable());
6238 OUString
ScCellObj::GetOutputString_Impl() const
6240 ScDocShell
* pDocSh
= GetDocShell();
6243 aVal
= GetOutputString_Impl(pDocSh
->GetDocument(), aCellPos
);
6247 void ScCellObj::SetString_Impl(const String
& rString
, sal_Bool bInterpret
, sal_Bool bEnglish
)
6249 ScDocShell
* pDocSh
= GetDocShell();
6252 // GRAM_PODF_A1 for API compatibility.
6253 (void)pDocSh
->GetDocFunc().SetCellText(
6254 aCellPos
, rString
, bInterpret
, bEnglish
, true, formula::FormulaGrammar::GRAM_PODF_A1
);
6258 double ScCellObj::GetValue_Impl() const
6260 ScDocShell
* pDocSh
= GetDocShell();
6262 return pDocSh
->GetDocument()->GetValue( aCellPos
);
6267 void ScCellObj::SetValue_Impl(double fValue
)
6269 ScDocShell
* pDocSh
= GetDocShell();
6271 pDocSh
->GetDocFunc().SetValueCell(aCellPos
, fValue
, false);
6274 // only for XML import
6276 void ScCellObj::InputEnglishString( const OUString
& rText
)
6278 // This is like a mixture of setFormula and property FormulaLocal:
6279 // The cell's number format is checked for "text", a new cell format may be set,
6280 // but all parsing is in English.
6282 ScDocShell
* pDocSh
= GetDocShell();
6286 String
aString(rText
);
6287 ScDocument
* pDoc
= pDocSh
->GetDocument();
6288 SvNumberFormatter
* pFormatter
= pDoc
->GetFormatTable();
6289 sal_uInt32 nOldFormat
= pDoc
->GetNumberFormat( aCellPos
);
6290 if (pFormatter
->GetType(nOldFormat
) == NUMBERFORMAT_TEXT
)
6292 SetString_Impl(aString
, false, false); // text cell
6296 ScDocFunc
&rFunc
= pDocSh
->GetDocFunc();
6298 ScInputStringType aRes
=
6299 ScStringUtil::parseInputString(*pFormatter
, aString
, LANGUAGE_ENGLISH_US
);
6301 if (aRes
.meType
!= ScInputStringType::Unknown
)
6303 if ((nOldFormat
% SV_COUNTRY_LANGUAGE_OFFSET
) == 0 && aRes
.mnFormatType
)
6305 // apply a format for the recognized type and the old format's language
6306 sal_uInt32 nNewFormat
= ScGlobal::GetStandardFormat(*pFormatter
, nOldFormat
, aRes
.mnFormatType
);
6307 if (nNewFormat
!= nOldFormat
)
6309 ScPatternAttr
aPattern( pDoc
->GetPool() );
6310 aPattern
.GetItemSet().Put( SfxUInt32Item( ATTR_VALUE_FORMAT
, nNewFormat
) );
6311 // ATTR_LANGUAGE_FORMAT remains unchanged
6312 rFunc
.ApplyAttributes( *GetMarkData(), aPattern
, true, true );
6316 switch (aRes
.meType
)
6318 case ScInputStringType::Formula
:
6319 rFunc
.SetFormulaCell(
6321 new ScFormulaCell(pDoc
, aCellPos
, aRes
.maText
, formula::FormulaGrammar::GRAM_PODF_A1
),
6324 case ScInputStringType::Number
:
6325 rFunc
.SetValueCell(aCellPos
, aRes
.mfValue
, false);
6327 case ScInputStringType::Text
:
6328 rFunc
.SetStringOrEditCell(aCellPos
, aRes
.maText
, false);
6331 SetString_Impl(aString
, false, false); // probably empty string
6337 uno::Reference
<text::XTextCursor
> SAL_CALL
ScCellObj::createTextCursor()
6338 throw(uno::RuntimeException
)
6340 SolarMutexGuard aGuard
;
6341 return new ScCellTextCursor( *this );
6344 uno::Reference
<text::XTextCursor
> SAL_CALL
ScCellObj::createTextCursorByRange(
6345 const uno::Reference
<text::XTextRange
>& aTextPosition
)
6346 throw(uno::RuntimeException
)
6348 SolarMutexGuard aGuard
;
6349 SvxUnoTextCursor
* pCursor
= new ScCellTextCursor( *this );
6350 uno::Reference
<text::XTextCursor
> xCursor(pCursor
);
6352 SvxUnoTextRangeBase
* pRange
= SvxUnoTextRangeBase::getImplementation( aTextPosition
);
6354 pCursor
->SetSelection( pRange
->GetSelection() );
6357 ScCellTextCursor
* pOther
= ScCellTextCursor::getImplementation( aTextPosition
);
6359 pCursor
->SetSelection( pOther
->GetSelection() );
6361 throw uno::RuntimeException();
6367 OUString SAL_CALL
ScCellObj::getString() throw(uno::RuntimeException
)
6369 SolarMutexGuard aGuard
;
6370 return GetOutputString_Impl();
6373 void SAL_CALL
ScCellObj::setString( const OUString
& aText
) throw(uno::RuntimeException
)
6375 SolarMutexGuard aGuard
;
6376 String
aString(aText
);
6377 SetString_Impl(aString
, false, false); // immer Text
6379 // don't create pUnoText here if not there
6381 mxUnoText
->SetSelection(ESelection( 0,0, 0,aString
.Len() ));
6384 void SAL_CALL
ScCellObj::insertString( const uno::Reference
<text::XTextRange
>& xRange
,
6385 const OUString
& aString
, sal_Bool bAbsorb
)
6386 throw(uno::RuntimeException
)
6388 // special handling for ScCellTextCursor is no longer needed,
6389 // SvxUnoText::insertString checks for SvxUnoTextRangeBase instead of SvxUnoTextRange
6391 SolarMutexGuard aGuard
;
6392 GetUnoText().insertString(xRange
, aString
, bAbsorb
);
6395 void SAL_CALL
ScCellObj::insertControlCharacter( const uno::Reference
<text::XTextRange
>& xRange
,
6396 sal_Int16 nControlCharacter
, sal_Bool bAbsorb
)
6397 throw(lang::IllegalArgumentException
, uno::RuntimeException
)
6399 SolarMutexGuard aGuard
;
6400 GetUnoText().insertControlCharacter(xRange
, nControlCharacter
, bAbsorb
);
6403 void SAL_CALL
ScCellObj::insertTextContent( const uno::Reference
<text::XTextRange
>& xRange
,
6404 const uno::Reference
<text::XTextContent
>& xContent
,
6406 throw(lang::IllegalArgumentException
, uno::RuntimeException
)
6408 SolarMutexGuard aGuard
;
6409 ScDocShell
* pDocSh
= GetDocShell();
6410 if ( pDocSh
&& xContent
.is() )
6412 ScEditFieldObj
* pCellField
= ScEditFieldObj::getImplementation(xContent
);
6413 SvxUnoTextRangeBase
* pTextRange
= ScCellTextCursor::getImplementation( xRange
);
6415 if ( pCellField
&& !pCellField
->IsInserted() && pTextRange
)
6417 SvxEditSource
* pEditSource
= pTextRange
->GetEditSource();
6418 ESelection
aSelection(pTextRange
->GetSelection());
6422 // nicht ersetzen -> hinten anhaengen
6423 aSelection
.Adjust();
6424 aSelection
.nStartPara
= aSelection
.nEndPara
;
6425 aSelection
.nStartPos
= aSelection
.nEndPos
;
6428 if (pCellField
->GetFieldType() == text::textfield::Type::TABLE
)
6429 pCellField
->setPropertyValue(SC_UNONAME_TABLEPOS
, uno::makeAny
<sal_Int32
>(aCellPos
.Tab()));
6431 SvxFieldItem aItem
= pCellField
->CreateFieldItem();
6432 SvxTextForwarder
* pForwarder
= pEditSource
->GetTextForwarder();
6433 pForwarder
->QuickInsertField( aItem
, aSelection
);
6434 pEditSource
->UpdateData();
6436 // neue Selektion: ein Zeichen
6437 aSelection
.Adjust();
6438 aSelection
.nEndPara
= aSelection
.nStartPara
;
6439 aSelection
.nEndPos
= aSelection
.nStartPos
+ 1;
6440 uno::Reference
<text::XTextRange
> xParent(this);
6441 pCellField
->InitDoc(
6442 xParent
, new ScCellEditSource(pDocSh
, aCellPos
), aSelection
);
6444 // for bAbsorb=FALSE, the new selection must be behind the inserted content
6445 // (the xml filter relies on this)
6447 aSelection
.nStartPos
= aSelection
.nEndPos
;
6449 pTextRange
->SetSelection( aSelection
);
6454 GetUnoText().insertTextContent(xRange
, xContent
, bAbsorb
);
6457 void SAL_CALL
ScCellObj::removeTextContent( const uno::Reference
<text::XTextContent
>& xContent
)
6458 throw(container::NoSuchElementException
, uno::RuntimeException
)
6460 SolarMutexGuard aGuard
;
6461 if ( xContent
.is() )
6463 ScEditFieldObj
* pCellField
= ScEditFieldObj::getImplementation(xContent
);
6464 if ( pCellField
&& pCellField
->IsInserted() )
6466 //! Testen, ob das Feld in dieser Zelle ist
6467 pCellField
->DeleteField();
6471 GetUnoText().removeTextContent(xContent
);
6474 uno::Reference
<text::XText
> SAL_CALL
ScCellObj::getText() throw(uno::RuntimeException
)
6476 SolarMutexGuard aGuard
;
6480 uno::Reference
<text::XTextRange
> SAL_CALL
ScCellObj::getStart() throw(uno::RuntimeException
)
6482 SolarMutexGuard aGuard
;
6483 return GetUnoText().getStart();
6486 uno::Reference
<text::XTextRange
> SAL_CALL
ScCellObj::getEnd() throw(uno::RuntimeException
)
6488 SolarMutexGuard aGuard
;
6489 return GetUnoText().getEnd();
6492 uno::Reference
<container::XEnumeration
> SAL_CALL
ScCellObj::createEnumeration()
6493 throw(uno::RuntimeException
)
6495 SolarMutexGuard aGuard
;
6496 return GetUnoText().createEnumeration();
6499 uno::Type SAL_CALL
ScCellObj::getElementType() throw(uno::RuntimeException
)
6501 SolarMutexGuard aGuard
;
6502 return GetUnoText().getElementType();
6505 sal_Bool SAL_CALL
ScCellObj::hasElements() throw(uno::RuntimeException
)
6507 SolarMutexGuard aGuard
;
6508 return GetUnoText().hasElements();
6513 OUString SAL_CALL
ScCellObj::getFormula() throw(uno::RuntimeException
)
6515 SolarMutexGuard aGuard
;
6516 return GetInputString_Impl( true /* English */ );
6519 void SAL_CALL
ScCellObj::setFormula( const OUString
& aFormula
) throw(uno::RuntimeException
)
6521 SolarMutexGuard aGuard
;
6522 String
aString(aFormula
);
6523 SetString_Impl(aString
, sal_True
, sal_True
); // Interpret as English
6526 double SAL_CALL
ScCellObj::getValue() throw(uno::RuntimeException
)
6528 SolarMutexGuard aGuard
;
6529 return GetValue_Impl();
6532 void SAL_CALL
ScCellObj::setValue( double nValue
) throw(uno::RuntimeException
)
6534 SolarMutexGuard aGuard
;
6535 SetValue_Impl(nValue
);
6538 void SAL_CALL
ScCellObj::setFormulaString( const OUString
& aFormula
) throw(uno::RuntimeException
)
6540 SolarMutexGuard aGuard
;
6541 ScDocShell
*pDocSh
= GetDocShell();
6544 ScFormulaCell
* pCell
= new ScFormulaCell( pDocSh
->GetDocument(), aCellPos
);
6545 pCell
->SetHybridFormula( aFormula
, formula::FormulaGrammar::GRAM_NATIVE
);
6546 pDocSh
->GetDocFunc().SetFormulaCell(aCellPos
, pCell
, false);
6549 void SAL_CALL
ScCellObj::setFormulaResult( double nValue
) throw(uno::RuntimeException
)
6551 SolarMutexGuard aGuard
;
6552 ScDocShell
* pDocSh
= GetDocShell();
6553 if ( pDocSh
&& pDocSh
->GetDocument()->GetCellType( aCellPos
) == CELLTYPE_FORMULA
)
6555 ScFormulaCell
* pCell
= pDocSh
->GetDocument()->GetFormulaCell(aCellPos
);
6556 pCell
->SetHybridDouble( nValue
);
6557 pCell
->ResetDirty();
6558 pCell
->SetChanged(false);
6562 table::CellContentType SAL_CALL
ScCellObj::getType() throw(uno::RuntimeException
)
6564 SolarMutexGuard aGuard
;
6565 table::CellContentType eRet
= table::CellContentType_EMPTY
;
6566 ScDocShell
* pDocSh
= GetDocShell();
6569 CellType eCalcType
= pDocSh
->GetDocument()->GetCellType( aCellPos
);
6572 case CELLTYPE_VALUE
:
6573 eRet
= table::CellContentType_VALUE
;
6575 case CELLTYPE_STRING
:
6577 eRet
= table::CellContentType_TEXT
;
6579 case CELLTYPE_FORMULA
:
6580 eRet
= table::CellContentType_FORMULA
;
6583 eRet
= table::CellContentType_EMPTY
;
6588 OSL_FAIL("keine DocShell"); //! Exception oder so?
6594 table::CellContentType
ScCellObj::GetResultType_Impl()
6596 ScDocShell
* pDocSh
= GetDocShell();
6599 ScRefCellValue aCell
;
6600 aCell
.assign(*pDocSh
->GetDocument(), aCellPos
);
6601 if (aCell
.meType
== CELLTYPE_FORMULA
)
6603 bool bValue
= aCell
.mpFormula
->IsValue();
6604 return bValue
? table::CellContentType_VALUE
: table::CellContentType_TEXT
;
6607 return getType(); // wenn keine Formel
6610 sal_Int32 SAL_CALL
ScCellObj::getError() throw(uno::RuntimeException
)
6612 SolarMutexGuard aGuard
;
6613 ScDocShell
* pDocSh
= GetDocShell();
6616 OSL_FAIL("keine DocShell"); //! Exception oder so?
6620 sal_uInt16 nError
= 0;
6621 ScRefCellValue aCell
;
6622 aCell
.assign(*pDocSh
->GetDocument(), aCellPos
);
6623 if (aCell
.meType
== CELLTYPE_FORMULA
)
6624 nError
= aCell
.mpFormula
->GetErrCode();
6631 uno::Sequence
<sheet::FormulaToken
> SAL_CALL
ScCellObj::getTokens() throw(uno::RuntimeException
)
6633 SolarMutexGuard aGuard
;
6634 uno::Sequence
<sheet::FormulaToken
> aSequence
;
6635 ScDocShell
* pDocSh
= GetDocShell();
6639 ScDocument
* pDoc
= pDocSh
->GetDocument();
6640 ScRefCellValue aCell
;
6641 aCell
.assign(*pDoc
, aCellPos
);
6642 if (aCell
.meType
== CELLTYPE_FORMULA
)
6644 ScTokenArray
* pTokenArray
= aCell
.mpFormula
->GetCode();
6646 ScTokenConversion::ConvertToTokenSequence(*pDoc
, aSequence
, *pTokenArray
);
6651 void SAL_CALL
ScCellObj::setTokens( const uno::Sequence
<sheet::FormulaToken
>& rTokens
) throw(uno::RuntimeException
)
6653 SolarMutexGuard aGuard
;
6654 ScDocShell
* pDocSh
= GetDocShell();
6657 ScDocument
* pDoc
= pDocSh
->GetDocument();
6658 ScTokenArray aTokenArray
;
6659 (void)ScTokenConversion::ConvertToTokenArray( *pDoc
, aTokenArray
, rTokens
);
6661 ScFormulaCell
* pNewCell
= new ScFormulaCell( pDoc
, aCellPos
, &aTokenArray
);
6662 (void)pDocSh
->GetDocFunc().SetFormulaCell(aCellPos
, pNewCell
, false);
6668 table::CellAddress SAL_CALL
ScCellObj::getCellAddress() throw(uno::RuntimeException
)
6670 SolarMutexGuard aGuard
;
6671 table::CellAddress aAdr
;
6672 aAdr
.Sheet
= aCellPos
.Tab();
6673 aAdr
.Column
= aCellPos
.Col();
6674 aAdr
.Row
= aCellPos
.Row();
6678 // XSheetAnnotationAnchor
6680 uno::Reference
<sheet::XSheetAnnotation
> SAL_CALL
ScCellObj::getAnnotation()
6681 throw(uno::RuntimeException
)
6683 SolarMutexGuard aGuard
;
6684 ScDocShell
* pDocSh
= GetDocShell();
6686 return new ScAnnotationObj( pDocSh
, aCellPos
);
6688 OSL_FAIL("getAnnotation ohne DocShell");
6692 // XFieldTypesSupplier
6694 uno::Reference
<container::XEnumerationAccess
> SAL_CALL
ScCellObj::getTextFields()
6695 throw(uno::RuntimeException
)
6697 SolarMutexGuard aGuard
;
6698 ScDocShell
* pDocSh
= GetDocShell();
6701 uno::Reference
<text::XTextRange
> xContent(this);
6702 return new ScCellFieldsObj(xContent
, pDocSh
, aCellPos
);
6708 uno::Reference
<container::XNameAccess
> SAL_CALL
ScCellObj::getTextFieldMasters()
6709 throw(uno::RuntimeException
)
6711 // sowas gibts nicht im Calc (?)
6715 // XPropertySet erweitert fuer Zell-Properties
6717 uno::Reference
<beans::XPropertySetInfo
> SAL_CALL
ScCellObj::getPropertySetInfo()
6718 throw(uno::RuntimeException
)
6720 SolarMutexGuard aGuard
;
6721 static uno::Reference
<beans::XPropertySetInfo
> aRef(
6722 new SfxItemPropertySetInfo( pCellPropSet
->getPropertyMap() ));
6726 void ScCellObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry
* pEntry
, const uno::Any
& aValue
)
6727 throw(lang::IllegalArgumentException
, uno::RuntimeException
)
6731 if ( pEntry
->nWID
== SC_WID_UNO_FORMLOC
)
6735 String
aString(aStrVal
);
6736 SetString_Impl(aString
, sal_True
, false); // lokal interpretieren
6738 else if ( pEntry
->nWID
== SC_WID_UNO_FORMRT
)
6741 //! Exception oder so...
6744 ScCellRangeObj::SetOnePropertyValue( pEntry
, aValue
);
6748 void ScCellObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry
* pEntry
,
6750 throw(uno::RuntimeException
)
6754 if ( pEntry
->nWID
== SC_WID_UNO_FORMLOC
)
6756 // sal_False = lokal
6757 rAny
<<= OUString( GetInputString_Impl(false) );
6759 else if ( pEntry
->nWID
== SC_WID_UNO_FORMRT
)
6761 table::CellContentType eType
= GetResultType_Impl();
6765 ScCellRangeObj::GetOnePropertyValue(pEntry
, rAny
);
6769 const SfxItemPropertyMap
& ScCellObj::GetItemPropertyMap()
6771 return pCellPropSet
->getPropertyMap();
6776 OUString SAL_CALL
ScCellObj::getImplementationName() throw(uno::RuntimeException
)
6778 return OUString( "ScCellObj" );
6781 sal_Bool SAL_CALL
ScCellObj::supportsService( const OUString
& rServiceName
)
6782 throw(uno::RuntimeException
)
6784 // CellRange/SheetCellRange are not in SheetCell service description,
6785 // but ScCellObj is used instead of ScCellRangeObj in CellRanges collections,
6786 // so it must support them
6788 String
aServiceStr(rServiceName
);
6789 return aServiceStr
.EqualsAscii( SCSHEETCELL_SERVICE
) ||
6790 aServiceStr
.EqualsAscii( SCCELL_SERVICE
) ||
6791 aServiceStr
.EqualsAscii( SCCELLPROPERTIES_SERVICE
) ||
6792 aServiceStr
.EqualsAscii( SCCHARPROPERTIES_SERVICE
) ||
6793 aServiceStr
.EqualsAscii( SCPARAPROPERTIES_SERVICE
) ||
6794 aServiceStr
.EqualsAscii( SCSHEETCELLRANGE_SERVICE
) ||
6795 aServiceStr
.EqualsAscii( SCCELLRANGE_SERVICE
);
6798 uno::Sequence
<OUString
> SAL_CALL
ScCellObj::getSupportedServiceNames()
6799 throw(uno::RuntimeException
)
6801 uno::Sequence
<OUString
> aRet(7);
6802 OUString
* pArray
= aRet
.getArray();
6803 pArray
[0] = OUString( SCSHEETCELL_SERVICE
);
6804 pArray
[1] = OUString( SCCELL_SERVICE
);
6805 pArray
[2] = OUString( SCCELLPROPERTIES_SERVICE
);
6806 pArray
[3] = OUString( SCCHARPROPERTIES_SERVICE
);
6807 pArray
[4] = OUString( SCPARAPROPERTIES_SERVICE
);
6808 pArray
[5] = OUString( SCSHEETCELLRANGE_SERVICE
);
6809 pArray
[6] = OUString( SCCELLRANGE_SERVICE
);
6815 sal_Bool SAL_CALL
ScCellObj::isActionLocked() throw(uno::RuntimeException
)
6817 SolarMutexGuard aGuard
;
6818 return nActionLockCount
!= 0;
6821 void SAL_CALL
ScCellObj::addActionLock() throw(uno::RuntimeException
)
6823 SolarMutexGuard aGuard
;
6824 if (!nActionLockCount
)
6828 ScCellEditSource
* pEditSource
=
6829 static_cast<ScCellEditSource
*> (mxUnoText
->GetEditSource());
6831 pEditSource
->SetDoUpdateData(false);
6837 void SAL_CALL
ScCellObj::removeActionLock() throw(uno::RuntimeException
)
6839 SolarMutexGuard aGuard
;
6840 if (nActionLockCount
> 0)
6843 if (!nActionLockCount
)
6847 ScCellEditSource
* pEditSource
=
6848 static_cast<ScCellEditSource
*> (mxUnoText
->GetEditSource());
6851 pEditSource
->SetDoUpdateData(sal_True
);
6852 if (pEditSource
->IsDirty())
6853 pEditSource
->UpdateData();
6860 void SAL_CALL
ScCellObj::setActionLocks( sal_Int16 nLock
) throw(uno::RuntimeException
)
6862 SolarMutexGuard aGuard
;
6865 ScCellEditSource
* pEditSource
=
6866 static_cast<ScCellEditSource
*> (mxUnoText
->GetEditSource());
6869 pEditSource
->SetDoUpdateData(nLock
== 0);
6870 if ((nActionLockCount
> 0) && (nLock
== 0) && pEditSource
->IsDirty())
6871 pEditSource
->UpdateData();
6874 nActionLockCount
= nLock
;
6877 sal_Int16 SAL_CALL
ScCellObj::resetActionLocks() throw(uno::RuntimeException
)
6879 SolarMutexGuard aGuard
;
6880 sal_uInt16
nRet(nActionLockCount
);
6883 ScCellEditSource
* pEditSource
=
6884 static_cast<ScCellEditSource
*> (mxUnoText
->GetEditSource());
6887 pEditSource
->SetDoUpdateData(sal_True
);
6888 if (pEditSource
->IsDirty())
6889 pEditSource
->UpdateData();
6892 nActionLockCount
= 0;
6896 //------------------------------------------------------------------------
6898 ScTableSheetObj::ScTableSheetObj( ScDocShell
* pDocSh
, SCTAB nTab
) :
6899 ScCellRangeObj( pDocSh
, ScRange(0,0,nTab
, MAXCOL
,MAXROW
,nTab
) ),
6900 pSheetPropSet(lcl_GetSheetPropertySet())
6904 ScTableSheetObj::~ScTableSheetObj()
6908 void ScTableSheetObj::RefChanged()
6910 // skip calling immediate base
6911 // class ScCellRangeObj::RefChanged as
6912 // it changes the Sheets range ( which shouldn't
6913 // happen ) - hmm maybe we don't even need to
6914 // call ScCellRangesBase::RefChanged() :/
6916 ScCellRangesBase::RefChanged();
6919 void ScTableSheetObj::InitInsertSheet(ScDocShell
* pDocSh
, SCTAB nTab
)
6921 InitInsertRange( pDocSh
, ScRange(0,0,nTab
, MAXCOL
,MAXROW
,nTab
) );
6924 uno::Any SAL_CALL
ScTableSheetObj::queryInterface( const uno::Type
& rType
) throw(uno::RuntimeException
)
6926 SC_QUERYINTERFACE( sheet::XSpreadsheet
)
6927 SC_QUERYINTERFACE( container::XNamed
)
6928 SC_QUERYINTERFACE( sheet::XSheetPageBreak
)
6929 SC_QUERYINTERFACE( sheet::XCellRangeMovement
)
6930 SC_QUERYINTERFACE( table::XTableChartsSupplier
)
6931 SC_QUERYINTERFACE( sheet::XDataPilotTablesSupplier
)
6932 SC_QUERYINTERFACE( sheet::XScenariosSupplier
)
6933 SC_QUERYINTERFACE( sheet::XSheetAnnotationsSupplier
)
6934 SC_QUERYINTERFACE( drawing::XDrawPageSupplier
)
6935 SC_QUERYINTERFACE( sheet::XPrintAreas
)
6936 SC_QUERYINTERFACE( sheet::XSheetAuditing
)
6937 SC_QUERYINTERFACE( sheet::XSheetOutline
)
6938 SC_QUERYINTERFACE( util::XProtectable
)
6939 SC_QUERYINTERFACE( sheet::XScenario
)
6940 SC_QUERYINTERFACE( sheet::XScenarioEnhanced
)
6941 SC_QUERYINTERFACE( sheet::XSheetLinkable
)
6942 SC_QUERYINTERFACE( sheet::XExternalSheetName
)
6943 SC_QUERYINTERFACE( document::XEventsSupplier
)
6945 return ScCellRangeObj::queryInterface( rType
);
6948 void SAL_CALL
ScTableSheetObj::acquire() throw()
6950 ScCellRangeObj::acquire();
6953 void SAL_CALL
ScTableSheetObj::release() throw()
6955 ScCellRangeObj::release();
6958 uno::Sequence
<uno::Type
> SAL_CALL
ScTableSheetObj::getTypes() throw(uno::RuntimeException
)
6960 static uno::Sequence
<uno::Type
> aTypes
;
6961 if ( aTypes
.getLength() == 0 )
6963 uno::Sequence
<uno::Type
> aParentTypes
= ScCellRangeObj::getTypes();
6964 long nParentLen
= aParentTypes
.getLength();
6965 const uno::Type
* pParentPtr
= aParentTypes
.getConstArray();
6967 aTypes
.realloc( nParentLen
+ 18 );
6968 uno::Type
* pPtr
= aTypes
.getArray();
6969 pPtr
[nParentLen
+ 0] = getCppuType((const uno::Reference
<sheet::XSpreadsheet
>*)0);
6970 pPtr
[nParentLen
+ 1] = getCppuType((const uno::Reference
<container::XNamed
>*)0);
6971 pPtr
[nParentLen
+ 2] = getCppuType((const uno::Reference
<sheet::XSheetPageBreak
>*)0);
6972 pPtr
[nParentLen
+ 3] = getCppuType((const uno::Reference
<sheet::XCellRangeMovement
>*)0);
6973 pPtr
[nParentLen
+ 4] = getCppuType((const uno::Reference
<table::XTableChartsSupplier
>*)0);
6974 pPtr
[nParentLen
+ 5] = getCppuType((const uno::Reference
<sheet::XDataPilotTablesSupplier
>*)0);
6975 pPtr
[nParentLen
+ 6] = getCppuType((const uno::Reference
<sheet::XScenariosSupplier
>*)0);
6976 pPtr
[nParentLen
+ 7] = getCppuType((const uno::Reference
<sheet::XSheetAnnotationsSupplier
>*)0);
6977 pPtr
[nParentLen
+ 8] = getCppuType((const uno::Reference
<drawing::XDrawPageSupplier
>*)0);
6978 pPtr
[nParentLen
+ 9] = getCppuType((const uno::Reference
<sheet::XPrintAreas
>*)0);
6979 pPtr
[nParentLen
+10] = getCppuType((const uno::Reference
<sheet::XSheetAuditing
>*)0);
6980 pPtr
[nParentLen
+11] = getCppuType((const uno::Reference
<sheet::XSheetOutline
>*)0);
6981 pPtr
[nParentLen
+12] = getCppuType((const uno::Reference
<util::XProtectable
>*)0);
6982 pPtr
[nParentLen
+13] = getCppuType((const uno::Reference
<sheet::XScenario
>*)0);
6983 pPtr
[nParentLen
+14] = getCppuType((const uno::Reference
<sheet::XScenarioEnhanced
>*)0);
6984 pPtr
[nParentLen
+15] = getCppuType((const uno::Reference
<sheet::XSheetLinkable
>*)0);
6985 pPtr
[nParentLen
+16] = getCppuType((const uno::Reference
<sheet::XExternalSheetName
>*)0);
6986 pPtr
[nParentLen
+17] = getCppuType((const uno::Reference
<document::XEventsSupplier
>*)0);
6988 for (long i
=0; i
<nParentLen
; i
++)
6989 pPtr
[i
] = pParentPtr
[i
]; // parent types first
6996 class theScTableSheetObjImplementationId
: public rtl::Static
< UnoTunnelIdInit
, theScTableSheetObjImplementationId
> {};
6999 uno::Sequence
<sal_Int8
> SAL_CALL
ScTableSheetObj::getImplementationId() throw(uno::RuntimeException
)
7001 return theScTableSheetObjImplementationId::get().getSeq();
7006 SCTAB
ScTableSheetObj::GetTab_Impl() const
7008 const ScRangeList
& rRanges
= GetRangeList();
7009 OSL_ENSURE(rRanges
.size() == 1, "was fuer Ranges ?!?!");
7010 if ( !rRanges
.empty() )
7012 const ScRange
* pFirst
= rRanges
[ 0 ];
7013 return pFirst
->aStart
.Tab();
7015 return 0; // soll nicht sein
7020 uno::Reference
<table::XTableCharts
> SAL_CALL
ScTableSheetObj::getCharts() throw(uno::RuntimeException
)
7022 SolarMutexGuard aGuard
;
7023 ScDocShell
* pDocSh
= GetDocShell();
7025 return new ScChartsObj( pDocSh
, GetTab_Impl() );
7027 OSL_FAIL("kein Dokument");
7031 uno::Reference
<sheet::XDataPilotTables
> SAL_CALL
ScTableSheetObj::getDataPilotTables()
7032 throw(uno::RuntimeException
)
7034 SolarMutexGuard aGuard
;
7035 ScDocShell
* pDocSh
= GetDocShell();
7037 return new ScDataPilotTablesObj( pDocSh
, GetTab_Impl() );
7039 OSL_FAIL("kein Dokument");
7043 uno::Reference
<sheet::XScenarios
> SAL_CALL
ScTableSheetObj::getScenarios() throw(uno::RuntimeException
)
7045 SolarMutexGuard aGuard
;
7046 ScDocShell
* pDocSh
= GetDocShell();
7049 return new ScScenariosObj( pDocSh
, GetTab_Impl() );
7051 OSL_FAIL("kein Dokument");
7055 uno::Reference
<sheet::XSheetAnnotations
> SAL_CALL
ScTableSheetObj::getAnnotations()
7056 throw(uno::RuntimeException
)
7058 SolarMutexGuard aGuard
;
7059 ScDocShell
* pDocSh
= GetDocShell();
7062 return new ScAnnotationsObj( pDocSh
, GetTab_Impl() );
7064 OSL_FAIL("kein Dokument");
7068 uno::Reference
<table::XCellRange
> SAL_CALL
ScTableSheetObj::getCellRangeByName(
7069 const OUString
& rRange
) throw(uno::RuntimeException
)
7071 SolarMutexGuard aGuard
;
7072 return ScCellRangeObj::getCellRangeByName( rRange
);
7075 uno::Reference
<sheet::XSheetCellCursor
> SAL_CALL
ScTableSheetObj::createCursor()
7076 throw(uno::RuntimeException
)
7078 SolarMutexGuard aGuard
;
7079 ScDocShell
* pDocSh
= GetDocShell();
7082 //! einzelne Zelle oder ganze Tabelle???????
7083 SCTAB nTab
= GetTab_Impl();
7084 return new ScCellCursorObj( pDocSh
, ScRange( 0,0,nTab
, MAXCOL
,MAXROW
,nTab
) );
7089 uno::Reference
<sheet::XSheetCellCursor
> SAL_CALL
ScTableSheetObj::createCursorByRange(
7090 const uno::Reference
<sheet::XSheetCellRange
>& xCellRange
)
7091 throw(uno::RuntimeException
)
7093 SolarMutexGuard aGuard
;
7094 ScDocShell
* pDocSh
= GetDocShell();
7095 if ( pDocSh
&& xCellRange
.is() )
7097 ScCellRangesBase
* pRangesImp
= ScCellRangesBase::getImplementation( xCellRange
);
7100 const ScRangeList
& rRanges
= pRangesImp
->GetRangeList();
7101 OSL_ENSURE( rRanges
.size() == 1, "Range? Ranges?" );
7102 return new ScCellCursorObj( pDocSh
, *rRanges
[ 0 ] );
7110 uno::Reference
<sheet::XSpreadsheet
> SAL_CALL
ScTableSheetObj::getSpreadsheet()
7111 throw(uno::RuntimeException
)
7113 SolarMutexGuard aGuard
;
7119 uno::Reference
<table::XCell
> SAL_CALL
ScTableSheetObj::getCellByPosition(
7120 sal_Int32 nColumn
, sal_Int32 nRow
)
7121 throw(lang::IndexOutOfBoundsException
, uno::RuntimeException
)
7123 SolarMutexGuard aGuard
;
7124 return ScCellRangeObj::GetCellByPosition_Impl(nColumn
, nRow
);
7127 uno::Reference
<table::XCellRange
> SAL_CALL
ScTableSheetObj::getCellRangeByPosition(
7128 sal_Int32 nLeft
, sal_Int32 nTop
, sal_Int32 nRight
, sal_Int32 nBottom
)
7129 throw(lang::IndexOutOfBoundsException
, uno::RuntimeException
)
7131 SolarMutexGuard aGuard
;
7132 return ScCellRangeObj::getCellRangeByPosition(nLeft
,nTop
,nRight
,nBottom
);
7135 uno::Sequence
<sheet::TablePageBreakData
> SAL_CALL
ScTableSheetObj::getColumnPageBreaks()
7136 throw(uno::RuntimeException
)
7138 SolarMutexGuard aGuard
;
7139 ScDocShell
* pDocSh
= GetDocShell();
7142 ScDocument
* pDoc
= pDocSh
->GetDocument();
7143 SCTAB nTab
= GetTab_Impl();
7145 Size
aSize(pDoc
->GetPageSize( nTab
));
7146 if (aSize
.Width() && aSize
.Height()) // effektive Groesse schon gesetzt?
7147 pDoc
->UpdatePageBreaks( nTab
);
7150 // Umbrueche updaten wie in ScDocShell::PageStyleModified:
7151 ScPrintFunc
aPrintFunc( pDocSh
, pDocSh
->GetPrinter(), nTab
);
7152 aPrintFunc
.UpdatePages();
7157 for (nCol
=0; nCol
<=MAXCOL
; nCol
++)
7158 if (pDoc
->HasColBreak(nCol
, nTab
))
7161 sheet::TablePageBreakData aData
;
7162 uno::Sequence
<sheet::TablePageBreakData
> aSeq(nCount
);
7163 sheet::TablePageBreakData
* pAry
= aSeq
.getArray();
7164 sal_uInt16 nPos
= 0;
7165 for (nCol
=0; nCol
<=MAXCOL
; nCol
++)
7167 ScBreakType nBreak
= pDoc
->HasColBreak(nCol
, nTab
);
7170 aData
.Position
= nCol
;
7171 aData
.ManualBreak
= (nBreak
& BREAK_MANUAL
);
7178 return uno::Sequence
<sheet::TablePageBreakData
>(0);
7181 uno::Sequence
<sheet::TablePageBreakData
> SAL_CALL
ScTableSheetObj::getRowPageBreaks()
7182 throw(uno::RuntimeException
)
7184 SolarMutexGuard aGuard
;
7185 ScDocShell
* pDocSh
= GetDocShell();
7188 ScDocument
* pDoc
= pDocSh
->GetDocument();
7189 SCTAB nTab
= GetTab_Impl();
7191 Size
aSize(pDoc
->GetPageSize( nTab
));
7192 if (aSize
.Width() && aSize
.Height()) // effektive Groesse schon gesetzt?
7193 pDoc
->UpdatePageBreaks( nTab
);
7196 // Umbrueche updaten wie in ScDocShell::PageStyleModified:
7197 ScPrintFunc
aPrintFunc( pDocSh
, pDocSh
->GetPrinter(), nTab
);
7198 aPrintFunc
.UpdatePages();
7200 return pDoc
->GetRowBreakData(nTab
);
7202 return uno::Sequence
<sheet::TablePageBreakData
>(0);
7205 void SAL_CALL
ScTableSheetObj::removeAllManualPageBreaks() throw(uno::RuntimeException
)
7207 SolarMutexGuard aGuard
;
7208 ScDocShell
* pDocSh
= GetDocShell();
7211 //! docfunc Funktion, auch fuer ScViewFunc::RemoveManualBreaks
7213 ScDocument
* pDoc
= pDocSh
->GetDocument();
7214 sal_Bool
bUndo (pDoc
->IsUndoEnabled());
7215 SCTAB nTab
= GetTab_Impl();
7219 ScDocument
* pUndoDoc
= new ScDocument( SCDOCMODE_UNDO
);
7220 pUndoDoc
->InitUndo( pDoc
, nTab
, nTab
, sal_True
, sal_True
);
7221 pDoc
->CopyToDocument( 0,0,nTab
, MAXCOL
,MAXROW
,nTab
, IDF_NONE
, false, pUndoDoc
);
7222 pDocSh
->GetUndoManager()->AddUndoAction(
7223 new ScUndoRemoveBreaks( pDocSh
, nTab
, pUndoDoc
) );
7226 pDoc
->RemoveManualBreaks(nTab
);
7227 pDoc
->UpdatePageBreaks(nTab
);
7229 //? UpdatePageBreakData( sal_True );
7230 pDocSh
->SetDocumentModified();
7231 pDocSh
->PostPaint(ScRange(0, 0, nTab
, MAXCOL
, MAXROW
, nTab
), PAINT_GRID
);
7237 OUString SAL_CALL
ScTableSheetObj::getName() throw(uno::RuntimeException
)
7239 SolarMutexGuard aGuard
;
7241 ScDocShell
* pDocSh
= GetDocShell();
7243 pDocSh
->GetDocument()->GetName( GetTab_Impl(), aName
);
7247 void SAL_CALL
ScTableSheetObj::setName( const OUString
& aNewName
)
7248 throw(uno::RuntimeException
)
7250 SolarMutexGuard aGuard
;
7251 ScDocShell
* pDocSh
= GetDocShell();
7254 String
aString(aNewName
);
7255 pDocSh
->GetDocFunc().RenameTable( GetTab_Impl(), aString
, sal_True
, sal_True
);
7259 // XDrawPageSupplier
7261 uno::Reference
<drawing::XDrawPage
> SAL_CALL
ScTableSheetObj::getDrawPage()
7262 throw(uno::RuntimeException
)
7264 SolarMutexGuard aGuard
;
7265 ScDocShell
* pDocSh
= GetDocShell();
7268 ScDrawLayer
* pDrawLayer
= pDocSh
->MakeDrawLayer();
7269 OSL_ENSURE(pDrawLayer
,"kann Draw-Layer nicht anlegen");
7271 SCTAB nTab
= GetTab_Impl();
7272 SdrPage
* pPage
= pDrawLayer
->GetPage(static_cast<sal_uInt16
>(nTab
));
7273 OSL_ENSURE(pPage
,"Draw-Page nicht gefunden");
7275 return uno::Reference
<drawing::XDrawPage
> (pPage
->getUnoPage(), uno::UNO_QUERY
);
7277 // Das DrawPage-Objekt meldet sich als Listener am SdrModel an
7278 // und sollte von dort alle Aktionen mitbekommen
7285 void SAL_CALL
ScTableSheetObj::insertCells( const table::CellRangeAddress
& rRangeAddress
,
7286 sheet::CellInsertMode nMode
) throw(uno::RuntimeException
)
7288 SolarMutexGuard aGuard
;
7289 ScDocShell
* pDocSh
= GetDocShell();
7292 sal_Bool bDo
= sal_True
;
7293 InsCellCmd eCmd
= INS_NONE
;
7296 case sheet::CellInsertMode_NONE
: bDo
= false; break;
7297 case sheet::CellInsertMode_DOWN
: eCmd
= INS_CELLSDOWN
; break;
7298 case sheet::CellInsertMode_RIGHT
: eCmd
= INS_CELLSRIGHT
; break;
7299 case sheet::CellInsertMode_ROWS
: eCmd
= INS_INSROWS
; break;
7300 case sheet::CellInsertMode_COLUMNS
: eCmd
= INS_INSCOLS
; break;
7302 OSL_FAIL("insertCells: falscher Mode");
7308 OSL_ENSURE( rRangeAddress
.Sheet
== GetTab_Impl(), "falsche Tabelle in CellRangeAddress" );
7310 ScUnoConversion::FillScRange( aScRange
, rRangeAddress
);
7311 pDocSh
->GetDocFunc().InsertCells( aScRange
, NULL
, eCmd
, sal_True
, sal_True
);
7316 void SAL_CALL
ScTableSheetObj::removeRange( const table::CellRangeAddress
& rRangeAddress
,
7317 sheet::CellDeleteMode nMode
) throw(uno::RuntimeException
)
7319 SolarMutexGuard aGuard
;
7320 ScDocShell
* pDocSh
= GetDocShell();
7323 sal_Bool bDo
= sal_True
;
7324 DelCellCmd eCmd
= DEL_NONE
;
7327 case sheet::CellDeleteMode_NONE
: bDo
= false; break;
7328 case sheet::CellDeleteMode_UP
: eCmd
= DEL_CELLSUP
; break;
7329 case sheet::CellDeleteMode_LEFT
: eCmd
= DEL_CELLSLEFT
; break;
7330 case sheet::CellDeleteMode_ROWS
: eCmd
= DEL_DELROWS
; break;
7331 case sheet::CellDeleteMode_COLUMNS
: eCmd
= DEL_DELCOLS
; break;
7333 OSL_FAIL("deleteCells: falscher Mode");
7339 OSL_ENSURE( rRangeAddress
.Sheet
== GetTab_Impl(), "falsche Tabelle in CellRangeAddress" );
7341 ScUnoConversion::FillScRange( aScRange
, rRangeAddress
);
7342 pDocSh
->GetDocFunc().DeleteCells( aScRange
, NULL
, eCmd
, sal_True
, sal_True
);
7347 void SAL_CALL
ScTableSheetObj::moveRange( const table::CellAddress
& aDestination
,
7348 const table::CellRangeAddress
& aSource
)
7349 throw(uno::RuntimeException
)
7351 SolarMutexGuard aGuard
;
7352 ScDocShell
* pDocSh
= GetDocShell();
7355 OSL_ENSURE( aSource
.Sheet
== GetTab_Impl(), "falsche Tabelle in CellRangeAddress" );
7356 ScRange aSourceRange
;
7357 ScUnoConversion::FillScRange( aSourceRange
, aSource
);
7358 ScAddress
aDestPos( (SCCOL
)aDestination
.Column
, (SCROW
)aDestination
.Row
, aDestination
.Sheet
);
7359 pDocSh
->GetDocFunc().MoveBlock( aSourceRange
, aDestPos
, sal_True
, sal_True
, sal_True
, sal_True
);
7363 void SAL_CALL
ScTableSheetObj::copyRange( const table::CellAddress
& aDestination
,
7364 const table::CellRangeAddress
& aSource
)
7365 throw(uno::RuntimeException
)
7367 SolarMutexGuard aGuard
;
7368 ScDocShell
* pDocSh
= GetDocShell();
7371 OSL_ENSURE( aSource
.Sheet
== GetTab_Impl(), "falsche Tabelle in CellRangeAddress" );
7372 ScRange aSourceRange
;
7373 ScUnoConversion::FillScRange( aSourceRange
, aSource
);
7374 ScAddress
aDestPos( (SCCOL
)aDestination
.Column
, (SCROW
)aDestination
.Row
, aDestination
.Sheet
);
7375 pDocSh
->GetDocFunc().MoveBlock( aSourceRange
, aDestPos
, false, sal_True
, sal_True
, sal_True
);
7381 void ScTableSheetObj::PrintAreaUndo_Impl( ScPrintRangeSaver
* pOldRanges
)
7383 // Umbrueche und Undo
7384 ScDocShell
* pDocSh
= GetDocShell();
7385 ScDocument
* pDoc
= pDocSh
? pDocSh
->GetDocument() : 0;
7389 const bool bUndo(pDoc
->IsUndoEnabled());
7390 const SCTAB
nTab(GetTab_Impl());
7394 pDocSh
->GetUndoManager()->AddUndoAction(
7395 new ScUndoPrintRange(
7399 pDoc
->CreatePrintRangeSaver())); // create new ranges
7401 // #i120105# ownership of old ranges has changed, mark as consumed
7405 ScPrintFunc(pDocSh
, pDocSh
->GetPrinter(), nTab
).UpdatePages();
7406 SfxBindings
* pBindings
= pDocSh
->GetViewBindings();
7410 pBindings
->Invalidate(SID_DELETE_PRINTAREA
);
7413 pDocSh
->SetDocumentModified();
7416 // #i120105# pOldRanges not used, need to cleanup
7420 uno::Sequence
<table::CellRangeAddress
> SAL_CALL
ScTableSheetObj::getPrintAreas()
7421 throw(uno::RuntimeException
)
7423 SolarMutexGuard aGuard
;
7424 ScDocShell
* pDocSh
= GetDocShell();
7427 ScDocument
* pDoc
= pDocSh
->GetDocument();
7428 SCTAB nTab
= GetTab_Impl();
7429 sal_uInt16 nCount
= pDoc
->GetPrintRangeCount( nTab
);
7431 table::CellRangeAddress aRangeAddress
;
7432 uno::Sequence
<table::CellRangeAddress
> aSeq(nCount
);
7433 table::CellRangeAddress
* pAry
= aSeq
.getArray();
7434 for (sal_uInt16 i
=0; i
<nCount
; i
++)
7436 const ScRange
* pRange
= pDoc
->GetPrintRange( nTab
, i
);
7437 OSL_ENSURE(pRange
,"wo ist der Druckbereich");
7440 ScUnoConversion::FillApiRange( aRangeAddress
, *pRange
);
7441 aRangeAddress
.Sheet
= nTab
; // core does not care about sheet index
7442 pAry
[i
] = aRangeAddress
;
7447 return uno::Sequence
<table::CellRangeAddress
>();
7450 void SAL_CALL
ScTableSheetObj::setPrintAreas(
7451 const uno::Sequence
<table::CellRangeAddress
>& aPrintAreas
)
7452 throw(uno::RuntimeException
)
7454 SolarMutexGuard aGuard
;
7455 ScPrintRangeSaver
* pOldRanges
= NULL
;
7456 ScDocShell
* pDocSh
= GetDocShell();
7459 ScDocument
* pDoc
= pDocSh
->GetDocument();
7460 SCTAB nTab
= GetTab_Impl();
7462 if ( pDoc
->IsUndoEnabled() )
7463 pOldRanges
= pDoc
->CreatePrintRangeSaver();
7465 sal_uInt16 nCount
= (sal_uInt16
) aPrintAreas
.getLength();
7466 pDoc
->ClearPrintRanges( nTab
);
7469 ScRange aPrintRange
;
7470 const table::CellRangeAddress
* pAry
= aPrintAreas
.getConstArray();
7471 for (sal_uInt16 i
=0; i
<nCount
; i
++)
7473 ScUnoConversion::FillScRange( aPrintRange
, pAry
[i
] );
7474 pDoc
->AddPrintRange( nTab
, aPrintRange
);
7478 if ( pDoc
->IsUndoEnabled() )
7479 PrintAreaUndo_Impl( pOldRanges
); // Undo, Umbrueche, Modified etc.
7483 sal_Bool SAL_CALL
ScTableSheetObj::getPrintTitleColumns() throw(uno::RuntimeException
)
7485 SolarMutexGuard aGuard
;
7486 ScDocShell
* pDocSh
= GetDocShell();
7489 ScDocument
* pDoc
= pDocSh
->GetDocument();
7490 SCTAB nTab
= GetTab_Impl();
7491 return ( pDoc
->GetRepeatColRange(nTab
) != NULL
);
7496 void SAL_CALL
ScTableSheetObj::setPrintTitleColumns( sal_Bool bPrintTitleColumns
)
7497 throw(uno::RuntimeException
)
7499 SolarMutexGuard aGuard
;
7500 ScDocShell
* pDocSh
= GetDocShell();
7503 ScDocument
* pDoc
= pDocSh
->GetDocument();
7504 SCTAB nTab
= GetTab_Impl();
7506 ScPrintRangeSaver
* pOldRanges
= pDoc
->CreatePrintRangeSaver();
7508 if ( bPrintTitleColumns
)
7510 if ( !pDoc
->GetRepeatColRange( nTab
) ) // keinen bestehenden Bereich veraendern
7512 ScRange
aNew( 0, 0, nTab
, 0, 0, nTab
); // Default
7513 pDoc
->SetRepeatColRange( nTab
, &aNew
); // einschalten
7517 pDoc
->SetRepeatColRange( nTab
, NULL
); // abschalten
7519 PrintAreaUndo_Impl( pOldRanges
); // Undo, Umbrueche, Modified etc.
7521 //! zuletzt gesetzten Bereich beim Abschalten merken und beim Einschalten wiederherstellen ???
7525 table::CellRangeAddress SAL_CALL
ScTableSheetObj::getTitleColumns() throw(uno::RuntimeException
)
7527 SolarMutexGuard aGuard
;
7528 table::CellRangeAddress aRet
;
7529 ScDocShell
* pDocSh
= GetDocShell();
7532 ScDocument
* pDoc
= pDocSh
->GetDocument();
7533 SCTAB nTab
= GetTab_Impl();
7534 const ScRange
* pRange
= pDoc
->GetRepeatColRange(nTab
);
7537 ScUnoConversion::FillApiRange( aRet
, *pRange
);
7538 aRet
.Sheet
= nTab
; // core does not care about sheet index
7544 void SAL_CALL
ScTableSheetObj::setTitleColumns( const table::CellRangeAddress
& aTitleColumns
)
7545 throw(uno::RuntimeException
)
7547 SolarMutexGuard aGuard
;
7548 ScDocShell
* pDocSh
= GetDocShell();
7551 ScDocument
* pDoc
= pDocSh
->GetDocument();
7552 SCTAB nTab
= GetTab_Impl();
7554 ScPrintRangeSaver
* pOldRanges
= pDoc
->CreatePrintRangeSaver();
7557 ScUnoConversion::FillScRange( aNew
, aTitleColumns
);
7558 pDoc
->SetRepeatColRange( nTab
, &aNew
); // immer auch einschalten
7560 PrintAreaUndo_Impl( pOldRanges
); // Undo, Umbrueche, Modified etc.
7564 sal_Bool SAL_CALL
ScTableSheetObj::getPrintTitleRows() throw(uno::RuntimeException
)
7566 SolarMutexGuard aGuard
;
7567 ScDocShell
* pDocSh
= GetDocShell();
7570 ScDocument
* pDoc
= pDocSh
->GetDocument();
7571 SCTAB nTab
= GetTab_Impl();
7572 return ( pDoc
->GetRepeatRowRange(nTab
) != NULL
);
7577 void SAL_CALL
ScTableSheetObj::setPrintTitleRows( sal_Bool bPrintTitleRows
)
7578 throw(uno::RuntimeException
)
7580 SolarMutexGuard aGuard
;
7581 ScDocShell
* pDocSh
= GetDocShell();
7584 ScDocument
* pDoc
= pDocSh
->GetDocument();
7585 SCTAB nTab
= GetTab_Impl();
7587 ScPrintRangeSaver
* pOldRanges
= pDoc
->CreatePrintRangeSaver();
7589 if ( bPrintTitleRows
)
7591 if ( !pDoc
->GetRepeatRowRange( nTab
) ) // keinen bestehenden Bereich veraendern
7593 ScRange
aNew( 0, 0, nTab
, 0, 0, nTab
); // Default
7594 pDoc
->SetRepeatRowRange( nTab
, &aNew
); // einschalten
7598 pDoc
->SetRepeatRowRange( nTab
, NULL
); // abschalten
7600 PrintAreaUndo_Impl( pOldRanges
); // Undo, Umbrueche, Modified etc.
7602 //! zuletzt gesetzten Bereich beim Abschalten merken und beim Einschalten wiederherstellen ???
7606 table::CellRangeAddress SAL_CALL
ScTableSheetObj::getTitleRows() throw(uno::RuntimeException
)
7608 SolarMutexGuard aGuard
;
7609 table::CellRangeAddress aRet
;
7610 ScDocShell
* pDocSh
= GetDocShell();
7613 ScDocument
* pDoc
= pDocSh
->GetDocument();
7614 SCTAB nTab
= GetTab_Impl();
7615 const ScRange
* pRange
= pDoc
->GetRepeatRowRange(nTab
);
7618 ScUnoConversion::FillApiRange( aRet
, *pRange
);
7619 aRet
.Sheet
= nTab
; // core does not care about sheet index
7625 void SAL_CALL
ScTableSheetObj::setTitleRows( const table::CellRangeAddress
& aTitleRows
)
7626 throw(uno::RuntimeException
)
7628 SolarMutexGuard aGuard
;
7629 ScDocShell
* pDocSh
= GetDocShell();
7632 ScDocument
* pDoc
= pDocSh
->GetDocument();
7633 SCTAB nTab
= GetTab_Impl();
7635 ScPrintRangeSaver
* pOldRanges
= pDoc
->CreatePrintRangeSaver();
7638 ScUnoConversion::FillScRange( aNew
, aTitleRows
);
7639 pDoc
->SetRepeatRowRange( nTab
, &aNew
); // immer auch einschalten
7641 PrintAreaUndo_Impl( pOldRanges
); // Undo, Umbrueche, Modified etc.
7647 sheet::SheetLinkMode SAL_CALL
ScTableSheetObj::getLinkMode() throw(uno::RuntimeException
)
7649 SolarMutexGuard aGuard
;
7650 sheet::SheetLinkMode eRet
= sheet::SheetLinkMode_NONE
;
7651 ScDocShell
* pDocSh
= GetDocShell();
7654 sal_uInt8 nMode
= pDocSh
->GetDocument()->GetLinkMode( GetTab_Impl() );
7655 if ( nMode
== SC_LINK_NORMAL
)
7656 eRet
= sheet::SheetLinkMode_NORMAL
;
7657 else if ( nMode
== SC_LINK_VALUE
)
7658 eRet
= sheet::SheetLinkMode_VALUE
;
7663 void SAL_CALL
ScTableSheetObj::setLinkMode( sheet::SheetLinkMode nLinkMode
)
7664 throw(uno::RuntimeException
)
7666 SolarMutexGuard aGuard
;
7668 //! Filter und Options aus altem Link suchen
7670 OUString
aUrl(getLinkUrl());
7671 OUString
aSheet(getLinkSheetName());
7674 link( aUrl
, aSheet
, aEmpty
, aEmpty
, nLinkMode
);
7677 OUString SAL_CALL
ScTableSheetObj::getLinkUrl() throw(uno::RuntimeException
)
7679 SolarMutexGuard aGuard
;
7681 ScDocShell
* pDocSh
= GetDocShell();
7683 aFile
= pDocSh
->GetDocument()->GetLinkDoc( GetTab_Impl() );
7687 void SAL_CALL
ScTableSheetObj::setLinkUrl( const OUString
& aLinkUrl
)
7688 throw(uno::RuntimeException
)
7690 SolarMutexGuard aGuard
;
7692 //! Filter und Options aus altem Link suchen
7694 sheet::SheetLinkMode eMode
= getLinkMode();
7695 OUString
aSheet(getLinkSheetName());
7698 link( aLinkUrl
, aSheet
, aEmpty
, aEmpty
, eMode
);
7701 OUString SAL_CALL
ScTableSheetObj::getLinkSheetName() throw(uno::RuntimeException
)
7703 SolarMutexGuard aGuard
;
7705 ScDocShell
* pDocSh
= GetDocShell();
7707 aSheet
= pDocSh
->GetDocument()->GetLinkTab( GetTab_Impl() );
7711 void SAL_CALL
ScTableSheetObj::setLinkSheetName( const OUString
& aLinkSheetName
)
7712 throw(uno::RuntimeException
)
7714 SolarMutexGuard aGuard
;
7716 //! Filter und Options aus altem Link suchen
7718 sheet::SheetLinkMode eMode
= getLinkMode();
7719 OUString
aUrl(getLinkUrl());
7722 link( aUrl
, aLinkSheetName
, aEmpty
, aEmpty
, eMode
);
7725 void SAL_CALL
ScTableSheetObj::link( const OUString
& aUrl
, const OUString
& aSheetName
,
7726 const OUString
& aFilterName
, const OUString
& aFilterOptions
,
7727 sheet::SheetLinkMode nMode
) throw(uno::RuntimeException
)
7729 SolarMutexGuard aGuard
;
7730 ScDocShell
* pDocSh
= GetDocShell();
7733 ScDocument
* pDoc
= pDocSh
->GetDocument();
7734 SCTAB nTab
= GetTab_Impl();
7736 OUString aFileString
= aUrl
;
7737 OUString aFilterString
= aFilterName
;
7738 OUString aOptString
= aFilterOptions
;
7739 OUString aSheetString
= aSheetName
;
7741 aFileString
= ScGlobal::GetAbsDocName( aFileString
, pDocSh
);
7742 if (aFilterString
.isEmpty())
7743 ScDocumentLoader::GetFilterName( aFileString
, aFilterString
, aOptString
, true, false );
7745 // remove application prefix from filter name here, so the filter options
7746 // aren't reset when the filter name is changed in ScTableLink::DataChanged
7747 ScDocumentLoader::RemoveAppPrefix( aFilterString
);
7749 sal_uInt8 nLinkMode
= SC_LINK_NONE
;
7750 if ( nMode
== sheet::SheetLinkMode_NORMAL
)
7751 nLinkMode
= SC_LINK_NORMAL
;
7752 else if ( nMode
== sheet::SheetLinkMode_VALUE
)
7753 nLinkMode
= SC_LINK_VALUE
;
7755 sal_uLong nRefresh
= 0;
7756 pDoc
->SetLink( nTab
, nLinkMode
, aFileString
, aFilterString
, aOptString
, aSheetString
, nRefresh
);
7758 pDocSh
->UpdateLinks(); // ggf. Link eintragen oder loeschen
7759 SfxBindings
* pBindings
= pDocSh
->GetViewBindings();
7761 pBindings
->Invalidate(SID_LINKS
);
7763 //! Undo fuer Link-Daten an der Table
7765 if ( nLinkMode
!= SC_LINK_NONE
&& pDoc
->IsExecuteLinkEnabled() ) // Link updaten
7767 // Update immer, auch wenn der Link schon da war
7768 //! Update nur fuer die betroffene Tabelle???
7770 sfx2::LinkManager
* pLinkManager
= pDoc
->GetLinkManager();
7771 sal_uInt16 nCount
= pLinkManager
->GetLinks().size();
7772 for ( sal_uInt16 i
=0; i
<nCount
; i
++ )
7774 ::sfx2::SvBaseLink
* pBase
= *pLinkManager
->GetLinks()[i
];
7775 if (pBase
->ISA(ScTableLink
))
7777 ScTableLink
* pTabLink
= (ScTableLink
*)pBase
;
7778 if ( aFileString
.equals(pTabLink
->GetFileName()) )
7779 pTabLink
->Update(); // inkl. Paint&Undo
7781 //! Der Dateiname sollte nur einmal vorkommen (?)
7786 //! Notify fuer ScSheetLinkObj Objekte!!!
7792 sal_Bool SAL_CALL
ScTableSheetObj::hideDependents( const table::CellAddress
& aPosition
)
7793 throw(uno::RuntimeException
)
7795 SolarMutexGuard aGuard
;
7796 ScDocShell
* pDocSh
= GetDocShell();
7799 SCTAB nTab
= GetTab_Impl();
7800 OSL_ENSURE( aPosition
.Sheet
== nTab
, "falsche Tabelle in CellAddress" );
7801 ScAddress
aPos( (SCCOL
)aPosition
.Column
, (SCROW
)aPosition
.Row
, nTab
);
7802 return pDocSh
->GetDocFunc().DetectiveDelSucc( aPos
);
7807 sal_Bool SAL_CALL
ScTableSheetObj::hidePrecedents( const table::CellAddress
& aPosition
)
7808 throw(uno::RuntimeException
)
7810 SolarMutexGuard aGuard
;
7811 ScDocShell
* pDocSh
= GetDocShell();
7814 SCTAB nTab
= GetTab_Impl();
7815 OSL_ENSURE( aPosition
.Sheet
== nTab
, "falsche Tabelle in CellAddress" );
7816 ScAddress
aPos( (SCCOL
)aPosition
.Column
, (SCROW
)aPosition
.Row
, nTab
);
7817 return pDocSh
->GetDocFunc().DetectiveDelPred( aPos
);
7822 sal_Bool SAL_CALL
ScTableSheetObj::showDependents( const table::CellAddress
& aPosition
)
7823 throw(uno::RuntimeException
)
7825 SolarMutexGuard aGuard
;
7826 ScDocShell
* pDocSh
= GetDocShell();
7829 SCTAB nTab
= GetTab_Impl();
7830 OSL_ENSURE( aPosition
.Sheet
== nTab
, "falsche Tabelle in CellAddress" );
7831 ScAddress
aPos( (SCCOL
)aPosition
.Column
, (SCROW
)aPosition
.Row
, nTab
);
7832 return pDocSh
->GetDocFunc().DetectiveAddSucc( aPos
);
7837 sal_Bool SAL_CALL
ScTableSheetObj::showPrecedents( const table::CellAddress
& aPosition
)
7838 throw(uno::RuntimeException
)
7840 SolarMutexGuard aGuard
;
7841 ScDocShell
* pDocSh
= GetDocShell();
7844 SCTAB nTab
= GetTab_Impl();
7845 OSL_ENSURE( aPosition
.Sheet
== nTab
, "falsche Tabelle in CellAddress" );
7846 ScAddress
aPos( (SCCOL
)aPosition
.Column
, (SCROW
)aPosition
.Row
, nTab
);
7847 return pDocSh
->GetDocFunc().DetectiveAddPred( aPos
);
7852 sal_Bool SAL_CALL
ScTableSheetObj::showErrors( const table::CellAddress
& aPosition
)
7853 throw(uno::RuntimeException
)
7855 SolarMutexGuard aGuard
;
7856 ScDocShell
* pDocSh
= GetDocShell();
7859 SCTAB nTab
= GetTab_Impl();
7860 OSL_ENSURE( aPosition
.Sheet
== nTab
, "falsche Tabelle in CellAddress" );
7861 ScAddress
aPos( (SCCOL
)aPosition
.Column
, (SCROW
)aPosition
.Row
, nTab
);
7862 return pDocSh
->GetDocFunc().DetectiveAddError( aPos
);
7867 sal_Bool SAL_CALL
ScTableSheetObj::showInvalid() throw(uno::RuntimeException
)
7869 SolarMutexGuard aGuard
;
7870 ScDocShell
* pDocSh
= GetDocShell();
7872 return pDocSh
->GetDocFunc().DetectiveMarkInvalid( GetTab_Impl() );
7876 void SAL_CALL
ScTableSheetObj::clearArrows() throw(uno::RuntimeException
)
7878 SolarMutexGuard aGuard
;
7879 ScDocShell
* pDocSh
= GetDocShell();
7881 pDocSh
->GetDocFunc().DetectiveDelAll( GetTab_Impl() );
7886 void SAL_CALL
ScTableSheetObj::group( const table::CellRangeAddress
& rGroupRange
,
7887 table::TableOrientation nOrientation
)
7888 throw(uno::RuntimeException
)
7890 SolarMutexGuard aGuard
;
7891 ScDocShell
* pDocSh
= GetDocShell();
7894 sal_Bool bColumns
= ( nOrientation
== table::TableOrientation_COLUMNS
);
7895 ScRange aGroupRange
;
7896 ScUnoConversion::FillScRange( aGroupRange
, rGroupRange
);
7897 ScOutlineDocFunc
aFunc(*pDocSh
);
7898 aFunc
.MakeOutline( aGroupRange
, bColumns
, sal_True
, sal_True
);
7902 void SAL_CALL
ScTableSheetObj::ungroup( const table::CellRangeAddress
& rGroupRange
,
7903 table::TableOrientation nOrientation
)
7904 throw(uno::RuntimeException
)
7906 SolarMutexGuard aGuard
;
7907 ScDocShell
* pDocSh
= GetDocShell();
7910 sal_Bool bColumns
= ( nOrientation
== table::TableOrientation_COLUMNS
);
7911 ScRange aGroupRange
;
7912 ScUnoConversion::FillScRange( aGroupRange
, rGroupRange
);
7913 ScOutlineDocFunc
aFunc(*pDocSh
);
7914 aFunc
.RemoveOutline( aGroupRange
, bColumns
, sal_True
, sal_True
);
7918 void SAL_CALL
ScTableSheetObj::autoOutline( const table::CellRangeAddress
& rCellRange
)
7919 throw(uno::RuntimeException
)
7921 SolarMutexGuard aGuard
;
7922 ScDocShell
* pDocSh
= GetDocShell();
7925 ScRange aFormulaRange
;
7926 ScUnoConversion::FillScRange( aFormulaRange
, rCellRange
);
7927 ScOutlineDocFunc
aFunc(*pDocSh
);
7928 aFunc
.AutoOutline( aFormulaRange
, sal_True
, sal_True
);
7932 void SAL_CALL
ScTableSheetObj::clearOutline() throw(uno::RuntimeException
)
7934 SolarMutexGuard aGuard
;
7935 ScDocShell
* pDocSh
= GetDocShell();
7938 SCTAB nTab
= GetTab_Impl();
7939 ScOutlineDocFunc
aFunc(*pDocSh
);
7940 aFunc
.RemoveAllOutlines( nTab
, sal_True
, sal_True
);
7944 void SAL_CALL
ScTableSheetObj::hideDetail( const table::CellRangeAddress
& rCellRange
)
7945 throw(uno::RuntimeException
)
7947 SolarMutexGuard aGuard
;
7948 ScDocShell
* pDocSh
= GetDocShell();
7952 ScUnoConversion::FillScRange( aMarkRange
, rCellRange
);
7953 ScOutlineDocFunc
aFunc(*pDocSh
);
7954 aFunc
.HideMarkedOutlines( aMarkRange
, sal_True
, sal_True
);
7958 void SAL_CALL
ScTableSheetObj::showDetail( const table::CellRangeAddress
& rCellRange
)
7959 throw(uno::RuntimeException
)
7961 SolarMutexGuard aGuard
;
7962 ScDocShell
* pDocSh
= GetDocShell();
7966 ScUnoConversion::FillScRange( aMarkRange
, rCellRange
);
7967 ScOutlineDocFunc
aFunc(*pDocSh
);
7968 aFunc
.ShowMarkedOutlines( aMarkRange
, sal_True
);
7972 void SAL_CALL
ScTableSheetObj::showLevel( sal_Int16 nLevel
, table::TableOrientation nOrientation
)
7973 throw(uno::RuntimeException
)
7975 SolarMutexGuard aGuard
;
7976 ScDocShell
* pDocSh
= GetDocShell();
7979 sal_Bool bColumns
= ( nOrientation
== table::TableOrientation_COLUMNS
);
7980 SCTAB nTab
= GetTab_Impl();
7981 ScOutlineDocFunc
aFunc(*pDocSh
);
7982 aFunc
.SelectLevel( nTab
, bColumns
, nLevel
, sal_True
, sal_True
, sal_True
);
7988 void SAL_CALL
ScTableSheetObj::protect( const OUString
& aPassword
)
7989 throw(uno::RuntimeException
)
7991 SolarMutexGuard aGuard
;
7992 ScDocShell
* pDocSh
= GetDocShell();
7993 // #i108245# if already protected, don't change anything
7994 if ( pDocSh
&& !pDocSh
->GetDocument()->IsTabProtected( GetTab_Impl() ) )
7996 String
aString(aPassword
);
7997 pDocSh
->GetDocFunc().Protect( GetTab_Impl(), aString
, sal_True
);
8001 void SAL_CALL
ScTableSheetObj::unprotect( const OUString
& aPassword
)
8002 throw(lang::IllegalArgumentException
, uno::RuntimeException
)
8004 SolarMutexGuard aGuard
;
8005 ScDocShell
* pDocSh
= GetDocShell();
8008 String
aString(aPassword
);
8009 sal_Bool bDone
= pDocSh
->GetDocFunc().Unprotect( GetTab_Impl(), aString
, sal_True
);
8011 throw lang::IllegalArgumentException();
8015 sal_Bool SAL_CALL
ScTableSheetObj::isProtected() throw(uno::RuntimeException
)
8017 SolarMutexGuard aGuard
;
8018 ScDocShell
* pDocSh
= GetDocShell();
8020 return pDocSh
->GetDocument()->IsTabProtected( GetTab_Impl() );
8022 OSL_FAIL("keine DocShell"); //! Exception oder so?
8028 sal_Bool SAL_CALL
ScTableSheetObj::getIsScenario() throw(uno::RuntimeException
)
8030 SolarMutexGuard aGuard
;
8031 ScDocShell
* pDocSh
= GetDocShell();
8033 return pDocSh
->GetDocument()->IsScenario( GetTab_Impl() );
8038 OUString SAL_CALL
ScTableSheetObj::getScenarioComment() throw(uno::RuntimeException
)
8040 SolarMutexGuard aGuard
;
8041 ScDocShell
* pDocSh
= GetDocShell();
8047 pDocSh
->GetDocument()->GetScenarioData( GetTab_Impl(), aComment
, aColor
, nFlags
);
8053 void SAL_CALL
ScTableSheetObj::setScenarioComment( const OUString
& aScenarioComment
)
8054 throw(uno::RuntimeException
)
8056 SolarMutexGuard aGuard
;
8057 ScDocShell
* pDocSh
= GetDocShell();
8060 ScDocument
* pDoc
= pDocSh
->GetDocument();
8061 SCTAB nTab
= GetTab_Impl();
8067 pDoc
->GetName( nTab
, aName
);
8068 pDoc
->GetScenarioData( nTab
, aComment
, aColor
, nFlags
);
8070 aComment
= String( aScenarioComment
);
8072 pDocSh
->ModifyScenario( nTab
, aName
, aComment
, aColor
, nFlags
);
8076 void SAL_CALL
ScTableSheetObj::addRanges( const uno::Sequence
<table::CellRangeAddress
>& rScenRanges
)
8077 throw(uno::RuntimeException
)
8079 SolarMutexGuard aGuard
;
8080 ScDocShell
* pDocSh
= GetDocShell();
8083 ScDocument
* pDoc
= pDocSh
->GetDocument();
8084 SCTAB nTab
= GetTab_Impl();
8086 if (pDoc
->IsScenario(nTab
))
8088 ScMarkData aMarkData
;
8089 aMarkData
.SelectTable( nTab
, sal_True
);
8091 sal_uInt16 nRangeCount
= (sal_uInt16
)rScenRanges
.getLength();
8094 const table::CellRangeAddress
* pAry
= rScenRanges
.getConstArray();
8095 for (sal_uInt16 i
=0; i
<nRangeCount
; i
++)
8097 OSL_ENSURE( pAry
[i
].Sheet
== nTab
, "addRanges mit falscher Tab" );
8098 ScRange
aOneRange( (SCCOL
)pAry
[i
].StartColumn
, (SCROW
)pAry
[i
].StartRow
, nTab
,
8099 (SCCOL
)pAry
[i
].EndColumn
, (SCROW
)pAry
[i
].EndRow
, nTab
);
8101 aMarkData
.SetMultiMarkArea( aOneRange
);
8105 // Szenario-Ranges sind durch Attribut gekennzeichnet
8106 ScPatternAttr
aPattern( pDoc
->GetPool() );
8107 aPattern
.GetItemSet().Put( ScMergeFlagAttr( SC_MF_SCENARIO
) );
8108 aPattern
.GetItemSet().Put( ScProtectionAttr( sal_True
) );
8109 pDocSh
->GetDocFunc().ApplyAttributes( aMarkData
, aPattern
, sal_True
, sal_True
);
8114 void SAL_CALL
ScTableSheetObj::apply() throw(uno::RuntimeException
)
8116 SolarMutexGuard aGuard
;
8117 ScDocShell
* pDocSh
= GetDocShell();
8120 ScDocument
* pDoc
= pDocSh
->GetDocument();
8121 SCTAB nTab
= GetTab_Impl();
8123 pDoc
->GetName( nTab
, aName
); // Name dieses Szenarios
8125 SCTAB nDestTab
= nTab
;
8126 while ( nDestTab
> 0 && pDoc
->IsScenario(nDestTab
) )
8129 if ( !pDoc
->IsScenario(nDestTab
) )
8130 pDocSh
->UseScenario( nDestTab
, aName
);
8132 //! sonst Fehler oder so
8136 // XScenarioEnhanced
8138 uno::Sequence
< table::CellRangeAddress
> SAL_CALL
ScTableSheetObj::getRanges( )
8139 throw(uno::RuntimeException
)
8141 SolarMutexGuard aGuard
;
8142 ScDocShell
* pDocSh
= GetDocShell();
8145 ScDocument
* pDoc
= pDocSh
->GetDocument();
8146 SCTAB nTab
= GetTab_Impl();
8147 const ScRangeList
* pRangeList
= pDoc
->GetScenarioRanges(nTab
);
8150 size_t nCount
= pRangeList
->size();
8151 uno::Sequence
< table::CellRangeAddress
> aRetRanges( nCount
);
8152 table::CellRangeAddress
* pAry
= aRetRanges
.getArray();
8153 for( size_t nIndex
= 0; nIndex
< nCount
; nIndex
++ )
8155 const ScRange
* pRange
= (*pRangeList
)[nIndex
];
8156 pAry
->StartColumn
= pRange
->aStart
.Col();
8157 pAry
->StartRow
= pRange
->aStart
.Row();
8158 pAry
->EndColumn
= pRange
->aEnd
.Col();
8159 pAry
->EndRow
= pRange
->aEnd
.Row();
8160 pAry
->Sheet
= pRange
->aStart
.Tab();
8166 return uno::Sequence
< table::CellRangeAddress
> ();
8169 // XExternalSheetName
8171 void ScTableSheetObj::setExternalName( const OUString
& aUrl
, const OUString
& aSheetName
)
8172 throw (container::ElementExistException
, uno::RuntimeException
)
8174 SolarMutexGuard aGuard
;
8175 ScDocShell
* pDocSh
= GetDocShell();
8178 ScDocument
* pDoc
= pDocSh
->GetDocument();
8181 const SCTAB nTab
= GetTab_Impl();
8182 const String
aAbsDocName( ScGlobal::GetAbsDocName( aUrl
, pDocSh
) );
8183 const String
aDocTabName( ScGlobal::GetDocTabName( aAbsDocName
, aSheetName
) );
8184 if ( !pDoc
->RenameTab( nTab
, aDocTabName
, false /*bUpdateRef*/, sal_True
/*bExternalDocument*/ ) )
8186 throw container::ElementExistException( OUString(), *this );
8194 uno::Reference
<container::XNameReplace
> SAL_CALL
ScTableSheetObj::getEvents() throw (uno::RuntimeException
)
8196 SolarMutexGuard aGuard
;
8197 ScDocShell
* pDocSh
= GetDocShell();
8199 return new ScSheetEventsObj( pDocSh
, GetTab_Impl() );
8204 // XPropertySet erweitert fuer Sheet-Properties
8206 uno::Reference
<beans::XPropertySetInfo
> SAL_CALL
ScTableSheetObj::getPropertySetInfo()
8207 throw(uno::RuntimeException
)
8209 SolarMutexGuard aGuard
;
8210 static uno::Reference
<beans::XPropertySetInfo
> aRef(
8211 new SfxItemPropertySetInfo( pSheetPropSet
->getPropertyMap() ));
8215 void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry
* pEntry
, const uno::Any
& aValue
)
8216 throw(lang::IllegalArgumentException
, uno::RuntimeException
)
8220 if ( IsScItemWid( pEntry
->nWID
) )
8222 // for Item WIDs, call ScCellRangesBase directly
8223 ScCellRangesBase::SetOnePropertyValue(pEntry
, aValue
);
8229 ScDocShell
* pDocSh
= GetDocShell();
8231 return; //! Exception oder so?
8232 ScDocument
* pDoc
= pDocSh
->GetDocument();
8233 SCTAB nTab
= GetTab_Impl();
8234 ScDocFunc
&rFunc
= pDocSh
->GetDocFunc();
8236 if ( pEntry
->nWID
== SC_WID_UNO_PAGESTL
)
8240 OUString
aNewStr(ScStyleNameConversion::ProgrammaticToDisplayName(
8241 aStrVal
, SFX_STYLE_FAMILY_PAGE
));
8243 //! Undo? (auch bei SID_STYLE_APPLY an der View)
8245 if ( pDoc
->GetPageStyle( nTab
) != aNewStr
)
8247 pDoc
->SetPageStyle( nTab
, aNewStr
);
8248 if (!pDoc
->IsImportingXML())
8250 ScPrintFunc( pDocSh
, pDocSh
->GetPrinter(), nTab
).UpdatePages();
8252 SfxBindings
* pBindings
= pDocSh
->GetViewBindings();
8255 pBindings
->Invalidate( SID_STYLE_FAMILY4
);
8256 pBindings
->Invalidate( SID_STATUS_PAGESTYLE
);
8257 pBindings
->Invalidate( FID_RESET_PRINTZOOM
);
8258 pBindings
->Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT
);
8259 pBindings
->Invalidate( SID_ATTR_PARA_RIGHT_TO_LEFT
);
8262 pDocSh
->SetDocumentModified();
8265 else if ( pEntry
->nWID
== SC_WID_UNO_CELLVIS
)
8267 sal_Bool bVis
= ScUnoHelpFunctions::GetBoolFromAny( aValue
);
8268 rFunc
.SetTableVisible( nTab
, bVis
, sal_True
);
8270 else if ( pEntry
->nWID
== SC_WID_UNO_ISACTIVE
)
8272 if (pDoc
->IsScenario(nTab
))
8273 pDoc
->SetActiveScenario( nTab
, ScUnoHelpFunctions::GetBoolFromAny( aValue
) );
8275 else if ( pEntry
->nWID
== SC_WID_UNO_BORDCOL
)
8277 if (pDoc
->IsScenario(nTab
))
8279 sal_Int32 nNewColor
= 0;
8280 if (aValue
>>= nNewColor
)
8286 pDoc
->GetName( nTab
, aName
);
8287 pDoc
->GetScenarioData( nTab
, aComment
, aColor
, nFlags
);
8289 aColor
= Color(static_cast<sal_uInt32
>(nNewColor
));
8291 pDocSh
->ModifyScenario( nTab
, aName
, aComment
, aColor
, nFlags
);
8295 else if ( pEntry
->nWID
== SC_WID_UNO_PROTECT
)
8297 if (pDoc
->IsScenario(nTab
))
8303 pDoc
->GetName( nTab
, aName
);
8304 pDoc
->GetScenarioData( nTab
, aComment
, aColor
, nFlags
);
8305 sal_Bool
bModify(false);
8307 if (ScUnoHelpFunctions::GetBoolFromAny( aValue
))
8309 if (!(nFlags
& SC_SCENARIO_PROTECT
))
8311 nFlags
|= SC_SCENARIO_PROTECT
;
8317 if (nFlags
& SC_SCENARIO_PROTECT
)
8319 nFlags
-= SC_SCENARIO_PROTECT
;
8325 pDocSh
->ModifyScenario( nTab
, aName
, aComment
, aColor
, nFlags
);
8328 else if ( pEntry
->nWID
== SC_WID_UNO_SHOWBORD
)
8330 if (pDoc
->IsScenario(nTab
))
8336 pDoc
->GetName( nTab
, aName
);
8337 pDoc
->GetScenarioData( nTab
, aComment
, aColor
, nFlags
);
8338 sal_Bool
bModify(false);
8340 if (ScUnoHelpFunctions::GetBoolFromAny( aValue
))
8342 if (!(nFlags
& SC_SCENARIO_SHOWFRAME
))
8344 nFlags
|= SC_SCENARIO_SHOWFRAME
;
8350 if (nFlags
& SC_SCENARIO_SHOWFRAME
)
8352 nFlags
-= SC_SCENARIO_SHOWFRAME
;
8358 pDocSh
->ModifyScenario( nTab
, aName
, aComment
, aColor
, nFlags
);
8361 else if ( pEntry
->nWID
== SC_WID_UNO_PRINTBORD
)
8363 if (pDoc
->IsScenario(nTab
))
8369 pDoc
->GetName( nTab
, aName
);
8370 pDoc
->GetScenarioData( nTab
, aComment
, aColor
, nFlags
);
8371 sal_Bool
bModify(false);
8373 if (ScUnoHelpFunctions::GetBoolFromAny( aValue
))
8375 if (!(nFlags
& SC_SCENARIO_PRINTFRAME
))
8377 nFlags
|= SC_SCENARIO_PRINTFRAME
;
8383 if (nFlags
& SC_SCENARIO_PRINTFRAME
)
8385 nFlags
-= SC_SCENARIO_PRINTFRAME
;
8391 pDocSh
->ModifyScenario( nTab
, aName
, aComment
, aColor
, nFlags
);
8394 else if ( pEntry
->nWID
== SC_WID_UNO_COPYBACK
)
8396 if (pDoc
->IsScenario(nTab
))
8402 pDoc
->GetName( nTab
, aName
);
8403 pDoc
->GetScenarioData( nTab
, aComment
, aColor
, nFlags
);
8404 sal_Bool
bModify(false);
8406 if (ScUnoHelpFunctions::GetBoolFromAny( aValue
))
8408 if (!(nFlags
& SC_SCENARIO_TWOWAY
))
8410 nFlags
|= SC_SCENARIO_TWOWAY
;
8416 if (nFlags
& SC_SCENARIO_TWOWAY
)
8418 nFlags
-= SC_SCENARIO_TWOWAY
;
8424 pDocSh
->ModifyScenario( nTab
, aName
, aComment
, aColor
, nFlags
);
8427 else if ( pEntry
->nWID
== SC_WID_UNO_COPYSTYL
)
8429 if (pDoc
->IsScenario(nTab
))
8435 pDoc
->GetName( nTab
, aName
);
8436 pDoc
->GetScenarioData( nTab
, aComment
, aColor
, nFlags
);
8437 sal_Bool
bModify(false);
8439 if (ScUnoHelpFunctions::GetBoolFromAny( aValue
))
8441 if (!(nFlags
& SC_SCENARIO_ATTRIB
))
8443 nFlags
|= SC_SCENARIO_ATTRIB
;
8449 if (nFlags
& SC_SCENARIO_ATTRIB
)
8451 nFlags
-= SC_SCENARIO_ATTRIB
;
8457 pDocSh
->ModifyScenario( nTab
, aName
, aComment
, aColor
, nFlags
);
8460 else if ( pEntry
->nWID
== SC_WID_UNO_COPYFORM
)
8462 if (pDoc
->IsScenario(nTab
))
8468 pDoc
->GetName( nTab
, aName
);
8469 pDoc
->GetScenarioData( nTab
, aComment
, aColor
, nFlags
);
8470 sal_Bool
bModify(false);
8472 if (ScUnoHelpFunctions::GetBoolFromAny( aValue
))
8474 if (nFlags
& SC_SCENARIO_VALUE
)
8476 nFlags
-= SC_SCENARIO_VALUE
;
8482 if (!(nFlags
& SC_SCENARIO_VALUE
))
8484 nFlags
|= SC_SCENARIO_VALUE
;
8490 pDocSh
->ModifyScenario( nTab
, aName
, aComment
, aColor
, nFlags
);
8493 else if ( pEntry
->nWID
== SC_WID_UNO_TABLAYOUT
)
8495 sal_Int16 nValue
= 0;
8496 if (aValue
>>= nValue
)
8498 if (nValue
== com::sun::star::text::WritingMode2::RL_TB
)
8499 rFunc
.SetLayoutRTL(nTab
, sal_True
, sal_True
);
8501 rFunc
.SetLayoutRTL(nTab
, false, sal_True
);
8504 else if ( pEntry
->nWID
== SC_WID_UNO_AUTOPRINT
)
8506 sal_Bool bAutoPrint
= ScUnoHelpFunctions::GetBoolFromAny( aValue
);
8508 pDoc
->SetPrintEntireSheet( nTab
); // clears all print ranges
8511 if (pDoc
->IsPrintEntireSheet( nTab
))
8512 pDoc
->ClearPrintRanges( nTab
); // if this flag is true, there are no PrintRanges, so Clear clears only the flag.
8515 else if ( pEntry
->nWID
== SC_WID_UNO_TABCOLOR
)
8517 sal_Int32 nColor
= COL_AUTO
;
8518 if ( aValue
>>= nColor
)
8520 const Color
aColor( static_cast< ColorData
>( nColor
) );
8521 if ( pDoc
->GetTabBgColor( nTab
) != aColor
)
8522 rFunc
.SetTabBgColor( nTab
, aColor
, true, true );
8525 else if ( pEntry
->nWID
== SC_WID_UNO_CODENAME
)
8528 if ( pDocSh
&& ( aValue
>>= aCodeName
) )
8530 pDocSh
->GetDocument()->SetCodeName( GetTab_Impl(), aCodeName
);
8534 ScCellRangeObj::SetOnePropertyValue(pEntry
, aValue
); // base class, no Item WID
8538 void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry
* pEntry
,
8540 throw(uno::RuntimeException
)
8544 ScDocShell
* pDocSh
= GetDocShell();
8546 throw uno::RuntimeException();
8547 ScDocument
* pDoc
= pDocSh
->GetDocument();
8548 SCTAB nTab
= GetTab_Impl();
8550 if ( pEntry
->nWID
== SC_WID_UNO_NAMES
)
8552 rAny
<<= uno::Reference
<sheet::XNamedRanges
>(new ScLocalNamedRangesObj(pDocSh
, this));
8554 else if ( pEntry
->nWID
== SC_WID_UNO_PAGESTL
)
8556 rAny
<<= OUString( ScStyleNameConversion::DisplayToProgrammaticName(
8557 pDoc
->GetPageStyle( nTab
), SFX_STYLE_FAMILY_PAGE
) );
8559 else if ( pEntry
->nWID
== SC_WID_UNO_CELLVIS
)
8561 sal_Bool bVis
= pDoc
->IsVisible( nTab
);
8562 ScUnoHelpFunctions::SetBoolInAny( rAny
, bVis
);
8564 else if ( pEntry
->nWID
== SC_WID_UNO_LINKDISPBIT
)
8566 // no target bitmaps for individual entries (would be all equal)
8567 // ScLinkTargetTypeObj::SetLinkTargetBitmap( aAny, SC_LINKTARGETTYPE_SHEET );
8569 else if ( pEntry
->nWID
== SC_WID_UNO_LINKDISPNAME
)
8571 // LinkDisplayName for hyperlink dialog
8572 rAny
<<= getName(); // sheet name
8574 else if ( pEntry
->nWID
== SC_WID_UNO_ISACTIVE
)
8576 if (pDoc
->IsScenario(nTab
))
8577 ScUnoHelpFunctions::SetBoolInAny( rAny
, pDoc
->IsActiveScenario( nTab
));
8579 else if ( pEntry
->nWID
== SC_WID_UNO_BORDCOL
)
8581 if (pDoc
->IsScenario(nTab
))
8586 pDoc
->GetScenarioData( nTab
, aComment
, aColor
, nFlags
);
8588 rAny
<<= static_cast<sal_Int32
>(aColor
.GetColor());
8591 else if ( pEntry
->nWID
== SC_WID_UNO_PROTECT
)
8593 if (pDoc
->IsScenario(nTab
))
8598 pDoc
->GetScenarioData( nTab
, aComment
, aColor
, nFlags
);
8600 ScUnoHelpFunctions::SetBoolInAny( rAny
, (nFlags
& SC_SCENARIO_PROTECT
) != 0 );
8603 else if ( pEntry
->nWID
== SC_WID_UNO_SHOWBORD
)
8605 if (pDoc
->IsScenario(nTab
))
8610 pDoc
->GetScenarioData( nTab
, aComment
, aColor
, nFlags
);
8612 ScUnoHelpFunctions::SetBoolInAny( rAny
, (nFlags
& SC_SCENARIO_SHOWFRAME
) != 0 );
8615 else if ( pEntry
->nWID
== SC_WID_UNO_PRINTBORD
)
8617 if (pDoc
->IsScenario(nTab
))
8622 pDoc
->GetScenarioData( nTab
, aComment
, aColor
, nFlags
);
8624 ScUnoHelpFunctions::SetBoolInAny( rAny
, (nFlags
& SC_SCENARIO_PRINTFRAME
) != 0 );
8627 else if ( pEntry
->nWID
== SC_WID_UNO_COPYBACK
)
8629 if (pDoc
->IsScenario(nTab
))
8634 pDoc
->GetScenarioData( nTab
, aComment
, aColor
, nFlags
);
8636 ScUnoHelpFunctions::SetBoolInAny( rAny
, (nFlags
& SC_SCENARIO_TWOWAY
) != 0 );
8639 else if ( pEntry
->nWID
== SC_WID_UNO_COPYSTYL
)
8641 if (pDoc
->IsScenario(nTab
))
8646 pDoc
->GetScenarioData( nTab
, aComment
, aColor
, nFlags
);
8648 ScUnoHelpFunctions::SetBoolInAny( rAny
, (nFlags
& SC_SCENARIO_ATTRIB
) != 0 );
8651 else if ( pEntry
->nWID
== SC_WID_UNO_COPYFORM
)
8653 if (pDoc
->IsScenario(nTab
))
8658 pDoc
->GetScenarioData( nTab
, aComment
, aColor
, nFlags
);
8660 ScUnoHelpFunctions::SetBoolInAny( rAny
, !(nFlags
& SC_SCENARIO_VALUE
));
8663 else if ( pEntry
->nWID
== SC_WID_UNO_TABLAYOUT
)
8665 if (pDoc
->IsLayoutRTL(nTab
))
8666 rAny
<<= sal_Int16(com::sun::star::text::WritingMode2::RL_TB
);
8668 rAny
<<= sal_Int16(com::sun::star::text::WritingMode2::LR_TB
);
8670 else if ( pEntry
->nWID
== SC_WID_UNO_AUTOPRINT
)
8672 sal_Bool bAutoPrint
= pDoc
->IsPrintEntireSheet( nTab
);
8673 ScUnoHelpFunctions::SetBoolInAny( rAny
, bAutoPrint
);
8675 else if ( pEntry
->nWID
== SC_WID_UNO_TABCOLOR
)
8677 rAny
<<= sal_Int32(pDoc
->GetTabBgColor(nTab
).GetColor());
8679 else if ( pEntry
->nWID
== SC_WID_UNO_CODENAME
)
8683 pDocSh
->GetDocument()->GetCodeName( GetTab_Impl(), aCodeName
);
8684 rAny
<<= OUString( aCodeName
);
8687 ScCellRangeObj::GetOnePropertyValue(pEntry
, rAny
);
8691 const SfxItemPropertyMap
& ScTableSheetObj::GetItemPropertyMap()
8693 return pSheetPropSet
->getPropertyMap();
8698 OUString SAL_CALL
ScTableSheetObj::getImplementationName() throw(uno::RuntimeException
)
8700 return OUString( "ScTableSheetObj" );
8703 sal_Bool SAL_CALL
ScTableSheetObj::supportsService( const OUString
& rServiceName
)
8704 throw(uno::RuntimeException
)
8706 String
aServiceStr( rServiceName
);
8707 return aServiceStr
.EqualsAscii( SCSPREADSHEET_SERVICE
) ||
8708 aServiceStr
.EqualsAscii( SCSHEETCELLRANGE_SERVICE
) ||
8709 aServiceStr
.EqualsAscii( SCCELLRANGE_SERVICE
) ||
8710 aServiceStr
.EqualsAscii( SCCELLPROPERTIES_SERVICE
) ||
8711 aServiceStr
.EqualsAscii( SCCHARPROPERTIES_SERVICE
) ||
8712 aServiceStr
.EqualsAscii( SCPARAPROPERTIES_SERVICE
) ||
8713 aServiceStr
.EqualsAscii( SCLINKTARGET_SERVICE
);
8716 uno::Sequence
<OUString
> SAL_CALL
ScTableSheetObj::getSupportedServiceNames()
8717 throw(uno::RuntimeException
)
8719 uno::Sequence
<OUString
> aRet(7);
8720 OUString
* pArray
= aRet
.getArray();
8721 pArray
[0] = OUString( SCSPREADSHEET_SERVICE
);
8722 pArray
[1] = OUString( SCSHEETCELLRANGE_SERVICE
);
8723 pArray
[2] = OUString( SCCELLRANGE_SERVICE
);
8724 pArray
[3] = OUString( SCCELLPROPERTIES_SERVICE
);
8725 pArray
[4] = OUString( SCCHARPROPERTIES_SERVICE
);
8726 pArray
[5] = OUString( SCPARAPROPERTIES_SERVICE
);
8727 pArray
[6] = OUString( SCLINKTARGET_SERVICE
);
8733 sal_Int64 SAL_CALL
ScTableSheetObj::getSomething(
8734 const uno::Sequence
<sal_Int8
>& rId
) throw(uno::RuntimeException
)
8736 if ( rId
.getLength() == 16 &&
8737 0 == memcmp( getUnoTunnelId().getConstArray(),
8738 rId
.getConstArray(), 16 ) )
8740 return sal::static_int_cast
<sal_Int64
>(reinterpret_cast<sal_IntPtr
>(this));
8743 return ScCellRangeObj::getSomething( rId
);
8748 class theScTableSheetObjUnoTunnelId
: public rtl::Static
< UnoTunnelIdInit
, theScTableSheetObjUnoTunnelId
> {};
8751 const uno::Sequence
<sal_Int8
>& ScTableSheetObj::getUnoTunnelId()
8753 return theScTableSheetObjUnoTunnelId::get().getSeq();
8756 ScTableSheetObj
* ScTableSheetObj::getImplementation( const uno::Reference
<uno::XInterface
> xObj
)
8758 ScTableSheetObj
* pRet
= NULL
;
8759 uno::Reference
<lang::XUnoTunnel
> xUT( xObj
, uno::UNO_QUERY
);
8761 pRet
= reinterpret_cast<ScTableSheetObj
*>(sal::static_int_cast
<sal_IntPtr
>(xUT
->getSomething(getUnoTunnelId())));
8765 //------------------------------------------------------------------------
8767 ScTableColumnObj::ScTableColumnObj( ScDocShell
* pDocSh
, SCCOL nCol
, SCTAB nTab
) :
8768 ScCellRangeObj( pDocSh
, ScRange(nCol
,0,nTab
, nCol
,MAXROW
,nTab
) ),
8769 pColPropSet(lcl_GetColumnPropertySet())
8773 ScTableColumnObj::~ScTableColumnObj()
8777 uno::Any SAL_CALL
ScTableColumnObj::queryInterface( const uno::Type
& rType
) throw(uno::RuntimeException
)
8779 SC_QUERYINTERFACE( container::XNamed
)
8781 return ScCellRangeObj::queryInterface( rType
);
8784 void SAL_CALL
ScTableColumnObj::acquire() throw()
8786 ScCellRangeObj::acquire();
8789 void SAL_CALL
ScTableColumnObj::release() throw()
8791 ScCellRangeObj::release();
8794 uno::Sequence
<uno::Type
> SAL_CALL
ScTableColumnObj::getTypes() throw(uno::RuntimeException
)
8796 static uno::Sequence
<uno::Type
> aTypes
;
8797 if ( aTypes
.getLength() == 0 )
8799 uno::Sequence
<uno::Type
> aParentTypes(ScCellRangeObj::getTypes());
8800 long nParentLen
= aParentTypes
.getLength();
8801 const uno::Type
* pParentPtr
= aParentTypes
.getConstArray();
8803 aTypes
.realloc( nParentLen
+ 1 );
8804 uno::Type
* pPtr
= aTypes
.getArray();
8805 pPtr
[nParentLen
+ 0] = getCppuType((const uno::Reference
<container::XNamed
>*)0);
8807 for (long i
=0; i
<nParentLen
; i
++)
8808 pPtr
[i
] = pParentPtr
[i
]; // parent types first
8815 class theScTableColumnObjImplementationId
: public rtl::Static
< UnoTunnelIdInit
, theScTableColumnObjImplementationId
> {};
8818 uno::Sequence
<sal_Int8
> SAL_CALL
ScTableColumnObj::getImplementationId() throw(uno::RuntimeException
)
8820 return theScTableColumnObjImplementationId::get().getSeq();
8825 OUString SAL_CALL
ScTableColumnObj::getName() throw(uno::RuntimeException
)
8827 SolarMutexGuard aGuard
;
8829 const ScRange
& rRange
= GetRange();
8830 OSL_ENSURE(rRange
.aStart
.Col() == rRange
.aEnd
.Col(), "too many columns");
8831 SCCOL nCol
= rRange
.aStart
.Col();
8833 return ScColToAlpha( nCol
); // from global.hxx
8836 void SAL_CALL
ScTableColumnObj::setName( const OUString
& /* aNewName */ )
8837 throw(uno::RuntimeException
)
8839 SolarMutexGuard aGuard
;
8840 throw uno::RuntimeException(); // read-only
8843 // XPropertySet erweitert fuer Spalten-Properties
8845 uno::Reference
<beans::XPropertySetInfo
> SAL_CALL
ScTableColumnObj::getPropertySetInfo()
8846 throw(uno::RuntimeException
)
8848 SolarMutexGuard aGuard
;
8849 static uno::Reference
<beans::XPropertySetInfo
> aRef(
8850 new SfxItemPropertySetInfo( pColPropSet
->getPropertyMap() ));
8854 void ScTableColumnObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry
* pEntry
, const uno::Any
& aValue
)
8855 throw(lang::IllegalArgumentException
, uno::RuntimeException
)
8859 if ( IsScItemWid( pEntry
->nWID
) )
8861 // for Item WIDs, call ScCellRangesBase directly
8862 ScCellRangesBase::SetOnePropertyValue(pEntry
, aValue
);
8868 ScDocShell
* pDocSh
= GetDocShell();
8870 return; //! Exception oder so?
8871 const ScRange
& rRange
= GetRange();
8872 OSL_ENSURE(rRange
.aStart
.Col() == rRange
.aEnd
.Col(), "zuviele Spalten");
8873 SCCOL nCol
= rRange
.aStart
.Col();
8874 SCTAB nTab
= rRange
.aStart
.Tab();
8875 ScDocFunc
&rFunc
= pDocSh
->GetDocFunc();
8877 SCCOLROW nColArr
[2];
8878 nColArr
[0] = nColArr
[1] = nCol
;
8880 if ( pEntry
->nWID
== SC_WID_UNO_CELLWID
)
8882 sal_Int32 nNewWidth
= 0;
8883 if ( aValue
>>= nNewWidth
)
8885 // property is 1/100mm, column width is twips
8886 nNewWidth
= HMMToTwips(nNewWidth
);
8887 rFunc
.SetWidthOrHeight( sal_True
, 1, nColArr
, nTab
, SC_SIZE_ORIGINAL
,
8888 (sal_uInt16
)nNewWidth
, sal_True
, sal_True
);
8891 else if ( pEntry
->nWID
== SC_WID_UNO_CELLVIS
)
8893 sal_Bool bVis
= ScUnoHelpFunctions::GetBoolFromAny( aValue
);
8894 ScSizeMode eMode
= bVis
? SC_SIZE_SHOW
: SC_SIZE_DIRECT
;
8895 rFunc
.SetWidthOrHeight( sal_True
, 1, nColArr
, nTab
, eMode
, 0, sal_True
, sal_True
);
8896 // SC_SIZE_DIRECT mit Groesse 0 blendet aus
8898 else if ( pEntry
->nWID
== SC_WID_UNO_OWIDTH
)
8900 sal_Bool bOpt
= ScUnoHelpFunctions::GetBoolFromAny( aValue
);
8902 rFunc
.SetWidthOrHeight( sal_True
, 1, nColArr
, nTab
,
8903 SC_SIZE_OPTIMAL
, STD_EXTRA_WIDTH
, sal_True
, sal_True
);
8904 // sal_False bei Spalten momentan ohne Auswirkung
8906 else if ( pEntry
->nWID
== SC_WID_UNO_NEWPAGE
|| pEntry
->nWID
== SC_WID_UNO_MANPAGE
)
8908 sal_Bool bSet
= ScUnoHelpFunctions::GetBoolFromAny( aValue
);
8910 rFunc
.InsertPageBreak( sal_True
, rRange
.aStart
, sal_True
, sal_True
, sal_True
);
8912 rFunc
.RemovePageBreak( sal_True
, rRange
.aStart
, sal_True
, sal_True
, sal_True
);
8915 ScCellRangeObj::SetOnePropertyValue(pEntry
, aValue
); // base class, no Item WID
8919 void ScTableColumnObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry
* pEntry
,
8921 throw(uno::RuntimeException
)
8925 ScDocShell
* pDocSh
= GetDocShell();
8927 throw uno::RuntimeException();
8929 ScDocument
* pDoc
= pDocSh
->GetDocument();
8930 const ScRange
& rRange
= GetRange();
8931 OSL_ENSURE(rRange
.aStart
.Col() == rRange
.aEnd
.Col(), "zuviele Spalten");
8932 SCCOL nCol
= rRange
.aStart
.Col();
8933 SCTAB nTab
= rRange
.aStart
.Tab();
8935 if ( pEntry
->nWID
== SC_WID_UNO_CELLWID
)
8937 // for hidden column, return original height
8938 sal_uInt16 nWidth
= pDoc
->GetOriginalWidth( nCol
, nTab
);
8939 // property is 1/100mm, column width is twips
8940 nWidth
= (sal_uInt16
) TwipsToHMM(nWidth
);
8941 rAny
<<= (sal_Int32
)( nWidth
);
8943 else if ( pEntry
->nWID
== SC_WID_UNO_CELLVIS
)
8945 bool bHidden
= pDoc
->ColHidden(nCol
, nTab
);
8946 ScUnoHelpFunctions::SetBoolInAny( rAny
, !bHidden
);
8948 else if ( pEntry
->nWID
== SC_WID_UNO_OWIDTH
)
8950 //! momentan immer gesetzt ??!?!
8951 sal_Bool bOpt
= !(pDoc
->GetColFlags( nCol
, nTab
) & CR_MANUALSIZE
);
8952 ScUnoHelpFunctions::SetBoolInAny( rAny
, bOpt
);
8954 else if ( pEntry
->nWID
== SC_WID_UNO_NEWPAGE
)
8956 ScBreakType nBreak
= pDoc
->HasColBreak(nCol
, nTab
);
8957 ScUnoHelpFunctions::SetBoolInAny( rAny
, nBreak
);
8959 else if ( pEntry
->nWID
== SC_WID_UNO_MANPAGE
)
8961 ScBreakType nBreak
= pDoc
->HasColBreak(nCol
, nTab
);
8962 ScUnoHelpFunctions::SetBoolInAny(rAny
, (nBreak
& BREAK_MANUAL
));
8965 ScCellRangeObj::GetOnePropertyValue(pEntry
, rAny
);
8969 const SfxItemPropertyMap
& ScTableColumnObj::GetItemPropertyMap()
8971 return pColPropSet
->getPropertyMap();
8974 //------------------------------------------------------------------------
8976 ScTableRowObj::ScTableRowObj(ScDocShell
* pDocSh
, SCROW nRow
, SCTAB nTab
) :
8977 ScCellRangeObj( pDocSh
, ScRange(0,nRow
,nTab
, MAXCOL
,nRow
,nTab
) ),
8978 pRowPropSet(lcl_GetRowPropertySet())
8982 ScTableRowObj::~ScTableRowObj()
8986 // XPropertySet erweitert fuer Zeilen-Properties
8988 uno::Reference
<beans::XPropertySetInfo
> SAL_CALL
ScTableRowObj::getPropertySetInfo()
8989 throw(uno::RuntimeException
)
8991 SolarMutexGuard aGuard
;
8992 static uno::Reference
<beans::XPropertySetInfo
> aRef(
8993 new SfxItemPropertySetInfo( pRowPropSet
->getPropertyMap() ));
8997 void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry
* pEntry
, const uno::Any
& aValue
)
8998 throw(lang::IllegalArgumentException
, uno::RuntimeException
)
9002 if ( IsScItemWid( pEntry
->nWID
) )
9004 // for Item WIDs, call ScCellRangesBase directly
9005 ScCellRangesBase::SetOnePropertyValue(pEntry
, aValue
);
9011 ScDocShell
* pDocSh
= GetDocShell();
9013 return; //! Exception oder so?
9014 ScDocument
* pDoc
= pDocSh
->GetDocument();
9015 const ScRange
& rRange
= GetRange();
9016 OSL_ENSURE(rRange
.aStart
.Row() == rRange
.aEnd
.Row(), "zuviele Zeilen");
9017 SCROW nRow
= rRange
.aStart
.Row();
9018 SCTAB nTab
= rRange
.aStart
.Tab();
9019 ScDocFunc
&rFunc
= pDocSh
->GetDocFunc();
9021 SCCOLROW nRowArr
[2];
9022 nRowArr
[0] = nRowArr
[1] = nRow
;
9024 if ( pEntry
->nWID
== SC_WID_UNO_CELLHGT
)
9026 sal_Int32 nNewHeight
= 0;
9027 if ( aValue
>>= nNewHeight
)
9029 // property is 1/100mm, row height is twips
9030 nNewHeight
= HMMToTwips(nNewHeight
);
9031 rFunc
.SetWidthOrHeight( false, 1, nRowArr
, nTab
, SC_SIZE_ORIGINAL
,
9032 (sal_uInt16
)nNewHeight
, sal_True
, sal_True
);
9035 else if ( pEntry
->nWID
== SC_WID_UNO_CELLVIS
)
9037 sal_Bool bVis
= ScUnoHelpFunctions::GetBoolFromAny( aValue
);
9038 ScSizeMode eMode
= bVis
? SC_SIZE_SHOW
: SC_SIZE_DIRECT
;
9039 rFunc
.SetWidthOrHeight( false, 1, nRowArr
, nTab
, eMode
, 0, sal_True
, sal_True
);
9040 // SC_SIZE_DIRECT mit Groesse 0 blendet aus
9042 else if ( pEntry
->nWID
== SC_WID_UNO_CELLFILT
)
9044 sal_Bool bFil
= ScUnoHelpFunctions::GetBoolFromAny( aValue
);
9045 // SC_SIZE_DIRECT mit Groesse 0 blendet aus
9046 pDoc
->SetRowFiltered(nRow
, nRow
, nTab
, bFil
);
9048 else if ( pEntry
->nWID
== SC_WID_UNO_OHEIGHT
)
9050 sal_Bool bOpt
= ScUnoHelpFunctions::GetBoolFromAny( aValue
);
9052 rFunc
.SetWidthOrHeight( false, 1, nRowArr
, nTab
, SC_SIZE_OPTIMAL
, 0, sal_True
, sal_True
);
9055 // set current height again manually
9056 sal_uInt16 nHeight
= pDoc
->GetOriginalHeight( nRow
, nTab
);
9057 rFunc
.SetWidthOrHeight( false, 1, nRowArr
, nTab
, SC_SIZE_ORIGINAL
, nHeight
, sal_True
, sal_True
);
9060 else if ( pEntry
->nWID
== SC_WID_UNO_NEWPAGE
|| pEntry
->nWID
== SC_WID_UNO_MANPAGE
)
9062 sal_Bool bSet
= ScUnoHelpFunctions::GetBoolFromAny( aValue
);
9064 rFunc
.InsertPageBreak( false, rRange
.aStart
, sal_True
, sal_True
, sal_True
);
9066 rFunc
.RemovePageBreak( false, rRange
.aStart
, sal_True
, sal_True
, sal_True
);
9069 ScCellRangeObj::SetOnePropertyValue(pEntry
, aValue
); // base class, no Item WID
9073 void ScTableRowObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry
* pEntry
,
9075 throw(uno::RuntimeException
)
9079 ScDocShell
* pDocSh
= GetDocShell();
9081 throw uno::RuntimeException();
9082 ScDocument
* pDoc
= pDocSh
->GetDocument();
9083 const ScRange
& rRange
= GetRange();
9084 OSL_ENSURE(rRange
.aStart
.Row() == rRange
.aEnd
.Row(), "zuviele Zeilen");
9085 SCROW nRow
= rRange
.aStart
.Row();
9086 SCTAB nTab
= rRange
.aStart
.Tab();
9088 if ( pEntry
->nWID
== SC_WID_UNO_CELLHGT
)
9090 // for hidden row, return original height
9091 sal_uInt16 nHeight
= pDoc
->GetOriginalHeight( nRow
, nTab
);
9092 // property is 1/100mm, row height is twips
9093 nHeight
= (sal_uInt16
) TwipsToHMM(nHeight
);
9094 rAny
<<= (sal_Int32
)( nHeight
);
9096 else if ( pEntry
->nWID
== SC_WID_UNO_CELLVIS
)
9098 bool bHidden
= pDoc
->RowHidden(nRow
, nTab
);
9099 ScUnoHelpFunctions::SetBoolInAny( rAny
, !bHidden
);
9101 else if ( pEntry
->nWID
== SC_WID_UNO_CELLFILT
)
9103 bool bVis
= pDoc
->RowFiltered(nRow
, nTab
);
9104 ScUnoHelpFunctions::SetBoolInAny( rAny
, bVis
);
9106 else if ( pEntry
->nWID
== SC_WID_UNO_OHEIGHT
)
9108 sal_Bool bOpt
= !(pDoc
->GetRowFlags( nRow
, nTab
) & CR_MANUALSIZE
);
9109 ScUnoHelpFunctions::SetBoolInAny( rAny
, bOpt
);
9111 else if ( pEntry
->nWID
== SC_WID_UNO_NEWPAGE
)
9113 ScBreakType nBreak
= pDoc
->HasRowBreak(nRow
, nTab
);
9114 ScUnoHelpFunctions::SetBoolInAny( rAny
, nBreak
);
9116 else if ( pEntry
->nWID
== SC_WID_UNO_MANPAGE
)
9118 ScBreakType nBreak
= (pDoc
->HasRowBreak(nRow
, nTab
) & BREAK_MANUAL
);
9119 ScUnoHelpFunctions::SetBoolInAny( rAny
, nBreak
);
9122 ScCellRangeObj::GetOnePropertyValue(pEntry
, rAny
);
9126 const SfxItemPropertyMap
& ScTableRowObj::GetItemPropertyMap()
9128 return pRowPropSet
->getPropertyMap();
9131 //------------------------------------------------------------------------
9133 ScCellsObj::ScCellsObj(ScDocShell
* pDocSh
, const ScRangeList
& rR
) :
9134 pDocShell( pDocSh
),
9137 pDocShell
->GetDocument()->AddUnoObject(*this);
9140 ScCellsObj::~ScCellsObj()
9143 pDocShell
->GetDocument()->RemoveUnoObject(*this);
9146 void ScCellsObj::Notify( SfxBroadcaster
&, const SfxHint
& rHint
)
9148 if ( rHint
.ISA( ScUpdateRefHint
) )
9150 const ScUpdateRefHint
& rRef
= (const ScUpdateRefHint
&)rHint
;
9151 aRanges
.UpdateReference( rRef
.GetMode(), pDocShell
->GetDocument(), rRef
.GetRange(),
9152 rRef
.GetDx(), rRef
.GetDy(), rRef
.GetDz() );
9154 else if ( rHint
.ISA( SfxSimpleHint
) &&
9155 ((const SfxSimpleHint
&)rHint
).GetId() == SFX_HINT_DYING
)
9157 pDocShell
= NULL
; // ungueltig geworden
9161 // XEnumerationAccess
9163 uno::Reference
<container::XEnumeration
> SAL_CALL
ScCellsObj::createEnumeration()
9164 throw(uno::RuntimeException
)
9166 SolarMutexGuard aGuard
;
9168 return new ScCellsEnumeration( pDocShell
, aRanges
);
9172 uno::Type SAL_CALL
ScCellsObj::getElementType() throw(uno::RuntimeException
)
9174 SolarMutexGuard aGuard
;
9175 return getCppuType((uno::Reference
<table::XCell
>*)0);
9178 sal_Bool SAL_CALL
ScCellsObj::hasElements() throw(uno::RuntimeException
)
9180 SolarMutexGuard aGuard
;
9181 sal_Bool bHas
= false;
9184 //! schneller selber testen?
9186 uno::Reference
<container::XEnumeration
> xEnum(new ScCellsEnumeration( pDocShell
, aRanges
));
9187 bHas
= xEnum
->hasMoreElements();
9192 //------------------------------------------------------------------------
9194 ScCellsEnumeration::ScCellsEnumeration(ScDocShell
* pDocSh
, const ScRangeList
& rR
) :
9195 pDocShell( pDocSh
),
9200 ScDocument
* pDoc
= pDocShell
->GetDocument();
9201 pDoc
->AddUnoObject(*this);
9203 if ( aRanges
.empty() )
9208 const ScRange
* pFirst
= aRanges
[ 0 ];
9210 nTab
= pFirst
->aStart
.Tab();
9211 aPos
= ScAddress(0,0,nTab
);
9212 CheckPos_Impl(); // aPos auf erste passende Zelle setzen
9216 void ScCellsEnumeration::CheckPos_Impl()
9221 bool bFound
= false;
9222 ScDocument
* pDoc
= pDocShell
->GetDocument();
9223 ScRefCellValue aCell
;
9224 aCell
.assign(*pDoc
, aPos
);
9225 if (!aCell
.isEmpty())
9229 pMark
= new ScMarkData
;
9230 pMark
->MarkFromRangeList(aRanges
, false);
9231 pMark
->MarkToMulti(); // needed for GetNextMarkedCell
9233 bFound
= pMark
->IsCellMarked(aPos
.Col(), aPos
.Row());
9239 ScCellsEnumeration::~ScCellsEnumeration()
9242 pDocShell
->GetDocument()->RemoveUnoObject(*this);
9246 void ScCellsEnumeration::Advance_Impl()
9248 OSL_ENSURE(!bAtEnd
,"zuviel Advance_Impl");
9251 pMark
= new ScMarkData
;
9252 pMark
->MarkFromRangeList( aRanges
, false );
9253 pMark
->MarkToMulti(); // needed for GetNextMarkedCell
9256 SCCOL nCol
= aPos
.Col();
9257 SCROW nRow
= aPos
.Row();
9258 SCTAB nTab
= aPos
.Tab();
9259 sal_Bool bFound
= pDocShell
->GetDocument()->GetNextMarkedCell( nCol
, nRow
, nTab
, *pMark
);
9261 aPos
.Set( nCol
, nRow
, nTab
);
9263 bAtEnd
= sal_True
; // kommt nix mehr
9266 void ScCellsEnumeration::Notify( SfxBroadcaster
&, const SfxHint
& rHint
)
9268 if ( rHint
.ISA( ScUpdateRefHint
) )
9272 const ScUpdateRefHint
& rRef
= (const ScUpdateRefHint
&)rHint
;
9273 aRanges
.UpdateReference( rRef
.GetMode(), pDocShell
->GetDocument(), rRef
.GetRange(),
9274 rRef
.GetDx(), rRef
.GetDy(), rRef
.GetDz() );
9276 delete pMark
; // aus verschobenen Bereichen neu erzeugen
9279 if (!bAtEnd
) // aPos anpassen
9282 aNew
.Append(ScRange(aPos
));
9283 aNew
.UpdateReference( rRef
.GetMode(), pDocShell
->GetDocument(), rRef
.GetRange(),
9284 rRef
.GetDx(), rRef
.GetDy(), rRef
.GetDz() );
9287 aPos
= aNew
[ 0 ]->aStart
;
9293 else if ( rHint
.ISA( SfxSimpleHint
) &&
9294 ((const SfxSimpleHint
&)rHint
).GetId() == SFX_HINT_DYING
)
9296 pDocShell
= NULL
; // ungueltig geworden
9302 sal_Bool SAL_CALL
ScCellsEnumeration::hasMoreElements() throw(uno::RuntimeException
)
9304 SolarMutexGuard aGuard
;
9308 uno::Any SAL_CALL
ScCellsEnumeration::nextElement() throw(container::NoSuchElementException
,
9309 lang::WrappedTargetException
, uno::RuntimeException
)
9311 SolarMutexGuard aGuard
;
9312 if (pDocShell
&& !bAtEnd
)
9314 // Interface-Typ muss zu ScCellsObj::getElementType passen
9316 ScAddress
aTempPos(aPos
);
9318 return uno::makeAny(uno::Reference
<table::XCell
>(new ScCellObj( pDocShell
, aTempPos
)));
9321 throw container::NoSuchElementException(); // no more elements
9324 //------------------------------------------------------------------------
9326 ScCellFormatsObj::ScCellFormatsObj(ScDocShell
* pDocSh
, const ScRange
& rRange
) :
9327 pDocShell( pDocSh
),
9328 aTotalRange( rRange
)
9330 ScDocument
* pDoc
= pDocShell
->GetDocument();
9331 pDoc
->AddUnoObject(*this);
9333 OSL_ENSURE( aTotalRange
.aStart
.Tab() == aTotalRange
.aEnd
.Tab(), "unterschiedliche Tabellen" );
9336 ScCellFormatsObj::~ScCellFormatsObj()
9339 pDocShell
->GetDocument()->RemoveUnoObject(*this);
9342 void ScCellFormatsObj::Notify( SfxBroadcaster
&, const SfxHint
& rHint
)
9344 if ( rHint
.ISA( ScUpdateRefHint
) )
9348 else if ( rHint
.ISA( SfxSimpleHint
) &&
9349 ((const SfxSimpleHint
&)rHint
).GetId() == SFX_HINT_DYING
)
9351 pDocShell
= NULL
; // ungueltig geworden
9355 ScCellRangeObj
* ScCellFormatsObj::GetObjectByIndex_Impl(long nIndex
) const
9357 //! direkt auf die AttrArrays zugreifen !!!!
9359 ScCellRangeObj
* pRet
= NULL
;
9362 ScDocument
* pDoc
= pDocShell
->GetDocument();
9364 ScAttrRectIterator
aIter( pDoc
, aTotalRange
.aStart
.Tab(),
9365 aTotalRange
.aStart
.Col(), aTotalRange
.aStart
.Row(),
9366 aTotalRange
.aEnd
.Col(), aTotalRange
.aEnd
.Row() );
9369 while ( aIter
.GetNext( nCol1
, nCol2
, nRow1
, nRow2
) )
9371 if ( nPos
== nIndex
)
9373 SCTAB nTab
= aTotalRange
.aStart
.Tab();
9374 ScRange
aNext( nCol1
, nRow1
, nTab
, nCol2
, nRow2
, nTab
);
9376 if ( aNext
.aStart
== aNext
.aEnd
)
9377 pRet
= new ScCellObj( pDocShell
, aNext
.aStart
);
9379 pRet
= new ScCellRangeObj( pDocShell
, aNext
);
9389 sal_Int32 SAL_CALL
ScCellFormatsObj::getCount() throw(uno::RuntimeException
)
9391 SolarMutexGuard aGuard
;
9393 //! direkt auf die AttrArrays zugreifen !!!!
9398 ScDocument
* pDoc
= pDocShell
->GetDocument();
9399 ScAttrRectIterator
aIter( pDoc
, aTotalRange
.aStart
.Tab(),
9400 aTotalRange
.aStart
.Col(), aTotalRange
.aStart
.Row(),
9401 aTotalRange
.aEnd
.Col(), aTotalRange
.aEnd
.Row() );
9404 while ( aIter
.GetNext( nCol1
, nCol2
, nRow1
, nRow2
) )
9410 uno::Any SAL_CALL
ScCellFormatsObj::getByIndex( sal_Int32 nIndex
)
9411 throw(lang::IndexOutOfBoundsException
,
9412 lang::WrappedTargetException
, uno::RuntimeException
)
9414 SolarMutexGuard aGuard
;
9416 uno::Reference
<table::XCellRange
> xRange(GetObjectByIndex_Impl(nIndex
));
9418 return uno::makeAny(xRange
);
9420 throw lang::IndexOutOfBoundsException();
9423 uno::Type SAL_CALL
ScCellFormatsObj::getElementType() throw(uno::RuntimeException
)
9425 SolarMutexGuard aGuard
;
9426 return getCppuType((uno::Reference
<table::XCellRange
>*)0);
9429 sal_Bool SAL_CALL
ScCellFormatsObj::hasElements() throw(uno::RuntimeException
)
9431 SolarMutexGuard aGuard
;
9432 return ( getCount() != 0 ); //! immer groesser 0 ??
9435 // XEnumerationAccess
9437 uno::Reference
<container::XEnumeration
> SAL_CALL
ScCellFormatsObj::createEnumeration()
9438 throw(uno::RuntimeException
)
9440 SolarMutexGuard aGuard
;
9442 return new ScCellFormatsEnumeration( pDocShell
, aTotalRange
);
9446 //------------------------------------------------------------------------
9448 ScCellFormatsEnumeration::ScCellFormatsEnumeration(ScDocShell
* pDocSh
, const ScRange
& rRange
) :
9449 pDocShell( pDocSh
),
9450 nTab( rRange
.aStart
.Tab() ),
9455 ScDocument
* pDoc
= pDocShell
->GetDocument();
9456 pDoc
->AddUnoObject(*this);
9458 OSL_ENSURE( rRange
.aStart
.Tab() == rRange
.aEnd
.Tab(),
9459 "CellFormatsEnumeration: unterschiedliche Tabellen" );
9461 pIter
= new ScAttrRectIterator( pDoc
, nTab
,
9462 rRange
.aStart
.Col(), rRange
.aStart
.Row(),
9463 rRange
.aEnd
.Col(), rRange
.aEnd
.Row() );
9467 ScCellFormatsEnumeration::~ScCellFormatsEnumeration()
9470 pDocShell
->GetDocument()->RemoveUnoObject(*this);
9474 void ScCellFormatsEnumeration::Advance_Impl()
9476 OSL_ENSURE(!bAtEnd
,"zuviel Advance_Impl");
9482 pIter
->DataChanged(); // AttrArray-Index neu suchen
9488 if ( pIter
->GetNext( nCol1
, nCol2
, nRow1
, nRow2
) )
9489 aNext
= ScRange( nCol1
, nRow1
, nTab
, nCol2
, nRow2
, nTab
);
9491 bAtEnd
= sal_True
; // kommt nix mehr
9494 bAtEnd
= sal_True
; // Dok weggekommen oder so
9497 ScCellRangeObj
* ScCellFormatsEnumeration::NextObject_Impl()
9499 ScCellRangeObj
* pRet
= NULL
;
9500 if (pDocShell
&& !bAtEnd
)
9502 if ( aNext
.aStart
== aNext
.aEnd
)
9503 pRet
= new ScCellObj( pDocShell
, aNext
.aStart
);
9505 pRet
= new ScCellRangeObj( pDocShell
, aNext
);
9511 void ScCellFormatsEnumeration::Notify( SfxBroadcaster
&, const SfxHint
& rHint
)
9513 if ( rHint
.ISA( ScUpdateRefHint
) )
9517 else if ( rHint
.ISA( SfxSimpleHint
) )
9519 sal_uLong nId
= ((const SfxSimpleHint
&)rHint
).GetId();
9520 if ( nId
== SFX_HINT_DYING
)
9522 pDocShell
= NULL
; // ungueltig geworden
9526 else if ( nId
== SFX_HINT_DATACHANGED
)
9528 bDirty
= sal_True
; // AttrArray-Index evtl. ungueltig geworden
9535 sal_Bool SAL_CALL
ScCellFormatsEnumeration::hasMoreElements() throw(uno::RuntimeException
)
9537 SolarMutexGuard aGuard
;
9541 uno::Any SAL_CALL
ScCellFormatsEnumeration::nextElement() throw(container::NoSuchElementException
,
9542 lang::WrappedTargetException
, uno::RuntimeException
)
9544 SolarMutexGuard aGuard
;
9546 if ( bAtEnd
|| !pDocShell
)
9547 throw container::NoSuchElementException(); // no more elements
9549 // Interface-Typ muss zu ScCellFormatsObj::getElementType passen
9551 return uno::makeAny(uno::Reference
<table::XCellRange
> (NextObject_Impl()));
9554 //------------------------------------------------------------------------
9556 ScUniqueCellFormatsObj::ScUniqueCellFormatsObj(ScDocShell
* pDocSh
, const ScRange
& rRange
) :
9557 pDocShell( pDocSh
),
9558 aTotalRange( rRange
),
9561 pDocShell
->GetDocument()->AddUnoObject(*this);
9563 OSL_ENSURE( aTotalRange
.aStart
.Tab() == aTotalRange
.aEnd
.Tab(), "unterschiedliche Tabellen" );
9568 ScUniqueCellFormatsObj::~ScUniqueCellFormatsObj()
9571 pDocShell
->GetDocument()->RemoveUnoObject(*this);
9574 void ScUniqueCellFormatsObj::Notify( SfxBroadcaster
&, const SfxHint
& rHint
)
9576 if ( rHint
.ISA( ScUpdateRefHint
) )
9580 else if ( rHint
.ISA( SfxSimpleHint
) )
9582 sal_uLong nId
= ((const SfxSimpleHint
&)rHint
).GetId();
9583 if ( nId
== SFX_HINT_DYING
)
9584 pDocShell
= NULL
; // ungueltig geworden
9589 // Fill the list of formats from the document
9592 // hash code to access the range lists by ScPatternAttr pointer
9593 struct ScPatternHashCode
9595 size_t operator()( const ScPatternAttr
* pPattern
) const
9597 return reinterpret_cast<size_t>(pPattern
);
9601 // Hash map to find a range by its start row
9602 typedef ::boost::unordered_map
< SCROW
, ScRange
> ScRowRangeHashMap
;
9604 typedef ::std::vector
<ScRange
> ScRangeVector
;
9607 // The Join method depends on the column-wise order of ScAttrRectIterator
9608 class ScUniqueFormatsEntry
9610 enum EntryState
{ STATE_EMPTY
, STATE_SINGLE
, STATE_COMPLEX
};
9613 ScRange aSingleRange
;
9614 ScRowRangeHashMap aJoinedRanges
; // "active" ranges to be merged
9615 ScRangeVector aCompletedRanges
; // ranges that will no longer be touched
9616 ScRangeListRef aReturnRanges
; // result as ScRangeList for further use
9619 ScUniqueFormatsEntry() : eState( STATE_EMPTY
) {}
9620 ScUniqueFormatsEntry( const ScUniqueFormatsEntry
& r
) :
9622 aSingleRange( r
.aSingleRange
),
9623 aJoinedRanges( r
.aJoinedRanges
),
9624 aCompletedRanges( r
.aCompletedRanges
),
9625 aReturnRanges( r
.aReturnRanges
) {}
9626 ~ScUniqueFormatsEntry() {}
9628 void Join( const ScRange
& rNewRange
);
9629 const ScRangeList
& GetRanges();
9630 void Clear() { aReturnRanges
.Clear(); } // aJoinedRanges and aCompletedRanges are cleared in GetRanges
9633 void ScUniqueFormatsEntry::Join( const ScRange
& rNewRange
)
9635 // Special-case handling for single range
9637 if ( eState
== STATE_EMPTY
)
9639 aSingleRange
= rNewRange
;
9640 eState
= STATE_SINGLE
;
9643 if ( eState
== STATE_SINGLE
)
9645 if ( aSingleRange
.aStart
.Row() == rNewRange
.aStart
.Row() &&
9646 aSingleRange
.aEnd
.Row() == rNewRange
.aEnd
.Row() &&
9647 aSingleRange
.aEnd
.Col() + 1 == rNewRange
.aStart
.Col() )
9649 aSingleRange
.aEnd
.SetCol( rNewRange
.aEnd
.Col() );
9650 return; // still a single range
9653 SCROW nSingleRow
= aSingleRange
.aStart
.Row();
9654 aJoinedRanges
.insert( ScRowRangeHashMap::value_type( nSingleRow
, aSingleRange
) );
9655 eState
= STATE_COMPLEX
;
9656 // continue normally
9659 // This is called in the order of ScAttrRectIterator results.
9660 // rNewRange can only be joined with an existing entry if it's the same rows, starting in the next column.
9661 // If the old entry for the start row extends to a different end row, or ends in a different column, it
9662 // can be moved to aCompletedRanges because it can't be joined with following iterator results.
9663 // Everything happens within one sheet, so Tab can be ignored.
9665 SCROW nStartRow
= rNewRange
.aStart
.Row();
9666 ScRowRangeHashMap::iterator
aIter( aJoinedRanges
.find( nStartRow
) ); // find the active entry for the start row
9667 if ( aIter
!= aJoinedRanges
.end() )
9669 ScRange
& rOldRange
= aIter
->second
;
9670 if ( rOldRange
.aEnd
.Row() == rNewRange
.aEnd
.Row() &&
9671 rOldRange
.aEnd
.Col() + 1 == rNewRange
.aStart
.Col() )
9673 // extend existing range
9674 rOldRange
.aEnd
.SetCol( rNewRange
.aEnd
.Col() );
9678 // move old range to aCompletedRanges, keep rNewRange for joining
9679 aCompletedRanges
.push_back( rOldRange
);
9680 rOldRange
= rNewRange
; // replace in hash map
9685 // keep rNewRange for joining
9686 aJoinedRanges
.insert( ScRowRangeHashMap::value_type( nStartRow
, rNewRange
) );
9690 const ScRangeList
& ScUniqueFormatsEntry::GetRanges()
9692 if ( eState
== STATE_SINGLE
)
9694 aReturnRanges
= new ScRangeList
;
9695 aReturnRanges
->Append( aSingleRange
);
9696 return *aReturnRanges
;
9699 // move remaining entries from aJoinedRanges to aCompletedRanges
9701 ScRowRangeHashMap::const_iterator aJoinedEnd
= aJoinedRanges
.end();
9702 for ( ScRowRangeHashMap::const_iterator aJoinedIter
= aJoinedRanges
.begin(); aJoinedIter
!= aJoinedEnd
; ++aJoinedIter
)
9703 aCompletedRanges
.push_back( aJoinedIter
->second
);
9704 aJoinedRanges
.clear();
9706 // sort all ranges for a predictable API result
9708 std::sort( aCompletedRanges
.begin(), aCompletedRanges
.end() );
9710 // fill and return ScRangeList
9712 aReturnRanges
= new ScRangeList
;
9713 ScRangeVector::const_iterator
aCompEnd( aCompletedRanges
.end() );
9714 for ( ScRangeVector::const_iterator
aCompIter( aCompletedRanges
.begin() ); aCompIter
!= aCompEnd
; ++aCompIter
)
9715 aReturnRanges
->Append( *aCompIter
);
9716 aCompletedRanges
.clear();
9718 return *aReturnRanges
;
9721 typedef ::boost::unordered_map
< const ScPatternAttr
*, ScUniqueFormatsEntry
, ScPatternHashCode
> ScUniqueFormatsHashMap
;
9723 // function object to sort the range lists by start of first range
9724 struct ScUniqueFormatsOrder
9726 bool operator()( const ScRangeList
& rList1
, const ScRangeList
& rList2
) const
9728 // all range lists have at least one entry
9729 OSL_ENSURE( rList1
.size() > 0 && rList2
.size() > 0, "ScUniqueFormatsOrder: empty list" );
9731 // compare start positions using ScAddress comparison operator
9732 return ( rList1
[ 0 ]->aStart
< rList2
[ 0 ]->aStart
);
9736 void ScUniqueCellFormatsObj::GetObjects_Impl()
9740 ScDocument
* pDoc
= pDocShell
->GetDocument();
9741 SCTAB nTab
= aTotalRange
.aStart
.Tab();
9742 ScAttrRectIterator
aIter( pDoc
, nTab
,
9743 aTotalRange
.aStart
.Col(), aTotalRange
.aStart
.Row(),
9744 aTotalRange
.aEnd
.Col(), aTotalRange
.aEnd
.Row() );
9748 // Collect the ranges for each format in a hash map, to avoid nested loops
9750 ScUniqueFormatsHashMap aHashMap
;
9751 while (aIter
.GetNext( nCol1
, nCol2
, nRow1
, nRow2
) )
9753 ScRange
aRange( nCol1
, nRow1
, nTab
, nCol2
, nRow2
, nTab
);
9754 const ScPatternAttr
* pPattern
= pDoc
->GetPattern(nCol1
, nRow1
, nTab
);
9755 aHashMap
[pPattern
].Join( aRange
);
9758 // Fill the vector aRangeLists with the range lists from the hash map
9760 aRangeLists
.reserve( aHashMap
.size() );
9761 ScUniqueFormatsHashMap::iterator
aMapIter( aHashMap
.begin() );
9762 ScUniqueFormatsHashMap::iterator
aMapEnd( aHashMap
.end() );
9763 while ( aMapIter
!= aMapEnd
)
9765 ScUniqueFormatsEntry
& rEntry
= aMapIter
->second
;
9766 const ScRangeList
& rRanges
= rEntry
.GetRanges();
9767 aRangeLists
.push_back( rRanges
); // copy ScRangeList
9768 rEntry
.Clear(); // free memory, don't hold both copies of all ranges
9772 // Sort the vector by first range's start position, to avoid random shuffling
9773 // due to using the ScPatterAttr pointers
9775 ScUniqueFormatsOrder aComp
;
9776 ::std::sort( aRangeLists
.begin(), aRangeLists
.end(), aComp
);
9782 sal_Int32 SAL_CALL
ScUniqueCellFormatsObj::getCount() throw(uno::RuntimeException
)
9784 SolarMutexGuard aGuard
;
9786 return aRangeLists
.size();
9789 uno::Any SAL_CALL
ScUniqueCellFormatsObj::getByIndex( sal_Int32 nIndex
)
9790 throw(lang::IndexOutOfBoundsException
,
9791 lang::WrappedTargetException
, uno::RuntimeException
)
9793 SolarMutexGuard aGuard
;
9795 if(static_cast<sal_uInt32
>(nIndex
) < aRangeLists
.size())
9796 return uno::makeAny(uno::Reference
<sheet::XSheetCellRangeContainer
>(new ScCellRangesObj(pDocShell
, aRangeLists
[nIndex
])));
9798 throw lang::IndexOutOfBoundsException();
9801 uno::Type SAL_CALL
ScUniqueCellFormatsObj::getElementType() throw(uno::RuntimeException
)
9803 SolarMutexGuard aGuard
;
9804 return getCppuType((uno::Reference
<sheet::XSheetCellRangeContainer
>*)0);
9807 sal_Bool SAL_CALL
ScUniqueCellFormatsObj::hasElements() throw(uno::RuntimeException
)
9809 SolarMutexGuard aGuard
;
9810 return ( aRangeLists
.size() != 0 );
9813 // XEnumerationAccess
9815 uno::Reference
<container::XEnumeration
> SAL_CALL
ScUniqueCellFormatsObj::createEnumeration()
9816 throw(uno::RuntimeException
)
9818 SolarMutexGuard aGuard
;
9820 return new ScUniqueCellFormatsEnumeration( pDocShell
, aRangeLists
);
9824 //------------------------------------------------------------------------
9826 ScUniqueCellFormatsEnumeration::ScUniqueCellFormatsEnumeration(ScDocShell
* pDocSh
, const ScMyRangeLists
& rRangeLists
) :
9827 aRangeLists(rRangeLists
),
9828 pDocShell( pDocSh
),
9831 pDocShell
->GetDocument()->AddUnoObject(*this);
9834 ScUniqueCellFormatsEnumeration::~ScUniqueCellFormatsEnumeration()
9837 pDocShell
->GetDocument()->RemoveUnoObject(*this);
9840 void ScUniqueCellFormatsEnumeration::Notify( SfxBroadcaster
&, const SfxHint
& rHint
)
9842 if ( rHint
.ISA( ScUpdateRefHint
) )
9846 else if ( rHint
.ISA( SfxSimpleHint
) )
9848 sal_uLong nId
= ((const SfxSimpleHint
&)rHint
).GetId();
9849 if ( nId
== SFX_HINT_DYING
)
9850 pDocShell
= NULL
; // ungueltig geworden
9856 sal_Bool SAL_CALL
ScUniqueCellFormatsEnumeration::hasMoreElements() throw(uno::RuntimeException
)
9858 SolarMutexGuard aGuard
;
9859 return static_cast<sal_uInt32
>(nCurrentPosition
) < aRangeLists
.size();
9862 uno::Any SAL_CALL
ScUniqueCellFormatsEnumeration::nextElement() throw(container::NoSuchElementException
,
9863 lang::WrappedTargetException
, uno::RuntimeException
)
9865 SolarMutexGuard aGuard
;
9867 if ( !hasMoreElements() || !pDocShell
)
9868 throw container::NoSuchElementException(); // no more elements
9870 // Interface-Typ muss zu ScCellFormatsObj::getElementType passen
9872 return uno::makeAny(uno::Reference
<sheet::XSheetCellRangeContainer
>(new ScCellRangesObj(pDocShell
, aRangeLists
[nCurrentPosition
++])));
9875 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */