Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "scitems.hxx"
21 : #include <editeng/eeitem.hxx>
22 : #include <svx/svdpool.hxx>
23 :
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
44 :
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>
61 :
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"
74 : #include "fmtuno.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"
82 : #include "docsh.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"
89 : #include "hints.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"
95 : #include "dbdata.hxx"
96 : #include "attrib.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"
107 : #include "sc.hrc"
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 :
126 : #include <list>
127 : #include <boost/scoped_ptr.hpp>
128 :
129 : using namespace com::sun::star;
130 :
131 : //------------------------------------------------------------------------
132 :
133 35 : class ScNamedEntry
134 : {
135 : String aName;
136 : ScRange aRange;
137 :
138 : public:
139 35 : ScNamedEntry(const String& rN, const ScRange& rR) :
140 35 : aName(rN), aRange(rR) {}
141 :
142 144 : const String& GetName() const { return aName; }
143 79 : const ScRange& GetRange() const { return aRange; }
144 : };
145 :
146 : //------------------------------------------------------------------------
147 :
148 : // The names in the maps must be sorted according to strcmp!
149 : //! Instead of Which-ID 0 use special IDs and do not compare via names!
150 :
151 : // Left/Right/Top/BottomBorder are mapped directly to the core items,
152 : // not collected/applied to the borders of a range -> ATTR_BORDER can be used directly
153 :
154 23063 : static const SfxItemPropertySet* lcl_GetCellsPropertySet()
155 : {
156 : static SfxItemPropertyMapEntry aCellsPropertyMap_Impl[] =
157 : {
158 26 : {MAP_CHAR_LEN(SC_UNONAME_ABSNAME), SC_WID_UNO_ABSNAME, &getCppuType((OUString*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
159 26 : {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(), 0, 0 },
160 26 : {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
161 26 : {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
162 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND, &getCppuType((sal_Int32*)0), 0, MID_BACK_COLOR },
163 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLPRO), ATTR_PROTECTION, &getCppuType((util::CellProtection*)0), 0, 0 },
164 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL), SC_WID_UNO_CELLSTYL,&getCppuType((OUString*)0), 0, 0 },
165 26 : {MAP_CHAR_LEN(SC_UNONAME_CCOLOR), ATTR_FONT_COLOR, &getCppuType((sal_Int32*)0), 0, 0 },
166 26 : {MAP_CHAR_LEN(SC_UNONAME_COUTL), ATTR_FONT_CONTOUR, &getBooleanCppuType(), 0, 0 },
167 26 : {MAP_CHAR_LEN(SC_UNONAME_CCROSS), ATTR_FONT_CROSSEDOUT,&getBooleanCppuType(), 0, MID_CROSSED_OUT },
168 26 : {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS), ATTR_FONT_EMPHASISMARK,&getCppuType((sal_Int16*)0), 0, MID_EMPHASIS },
169 26 : {MAP_CHAR_LEN(SC_UNONAME_CFONT), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
170 26 : {MAP_CHAR_LEN(SC_UNONAME_CFCHARS), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
171 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
172 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
173 26 : {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
174 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
175 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
176 26 : {MAP_CHAR_LEN(SC_UNONAME_CFNAME), ATTR_FONT, &getCppuType((OUString*)0), 0, MID_FONT_FAMILY_NAME },
177 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME), ATTR_CJK_FONT, &getCppuType((OUString*)0), 0, MID_FONT_FAMILY_NAME },
178 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME), ATTR_CTL_FONT, &getCppuType((OUString*)0), 0, MID_FONT_FAMILY_NAME },
179 26 : {MAP_CHAR_LEN(SC_UNONAME_CFPITCH), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
180 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
181 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
182 26 : {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE), ATTR_FONT, &getCppuType((OUString*)0), 0, MID_FONT_STYLE_NAME },
183 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE), ATTR_CJK_FONT, &getCppuType((OUString*)0), 0, MID_FONT_STYLE_NAME },
184 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE), ATTR_CTL_FONT, &getCppuType((OUString*)0), 0, MID_FONT_STYLE_NAME },
185 26 : {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT), ATTR_FONT_HEIGHT, &getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
186 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT), ATTR_CJK_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
187 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT), ATTR_CTL_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
188 26 : {MAP_CHAR_LEN(SC_UNONAME_CLOCAL), ATTR_FONT_LANGUAGE, &getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
189 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL), ATTR_CJK_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
190 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL), ATTR_CTL_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
191 26 : {MAP_CHAR_LEN(SC_UNONAME_COVER), ATTR_FONT_OVERLINE, &getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
192 26 : {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL), ATTR_FONT_OVERLINE, &getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
193 26 : {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS), ATTR_FONT_OVERLINE, &getBooleanCppuType(), 0, MID_TL_HASCOLOR },
194 26 : {MAP_CHAR_LEN(SC_UNONAME_CPOST), ATTR_FONT_POSTURE, &getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
195 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CPOST), ATTR_CJK_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
196 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CPOST), ATTR_CTL_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
197 26 : {MAP_CHAR_LEN(SC_UNONAME_CRELIEF), ATTR_FONT_RELIEF, &getCppuType((sal_Int16*)0), 0, MID_RELIEF },
198 26 : {MAP_CHAR_LEN(SC_UNONAME_CSHADD), ATTR_FONT_SHADOWED, &getBooleanCppuType(), 0, 0 },
199 26 : {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE), ATTR_FONT_CROSSEDOUT,&getCppuType((sal_Int16*)0), 0, MID_CROSS_OUT },
200 26 : {MAP_CHAR_LEN(SC_UNONAME_CUNDER), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
201 26 : {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
202 26 : {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS), ATTR_FONT_UNDERLINE,&getBooleanCppuType(), 0, MID_TL_HASCOLOR },
203 26 : {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT), ATTR_FONT_WEIGHT, &getCppuType((float*)0), 0, MID_WEIGHT },
204 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT), ATTR_CJK_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
205 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT), ATTR_CTL_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
206 26 : {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD), ATTR_FONT_WORDLINE, &getBooleanCppuType(), 0, 0 },
207 26 : {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR), SC_WID_UNO_CHCOLHDR,&getBooleanCppuType(), 0, 0 },
208 26 : {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR), SC_WID_UNO_CHROWHDR,&getBooleanCppuType(), 0, 0 },
209 26 : {MAP_CHAR_LEN(SC_UNONAME_CONDFMT), SC_WID_UNO_CONDFMT, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
210 26 : {MAP_CHAR_LEN(SC_UNONAME_CONDLOC), SC_WID_UNO_CONDLOC, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
211 26 : {MAP_CHAR_LEN(SC_UNONAME_CONDXML), SC_WID_UNO_CONDXML, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
212 26 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
213 26 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR2), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
214 26 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
215 26 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR2), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
216 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS), ATTR_HOR_JUSTIFY, &getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
217 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD), ATTR_HOR_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0), 0, 0 },
218 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND, &getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
219 26 : {MAP_CHAR_LEN(SC_UNONAME_WRAP), ATTR_LINEBREAK, &getBooleanCppuType(), 0, 0 },
220 26 : {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
221 26 : {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
222 26 : {MAP_CHAR_LEN(SC_UNONAME_NUMFMT), ATTR_VALUE_FORMAT, &getCppuType((sal_Int32*)0), 0, 0 },
223 26 : {MAP_CHAR_LEN(SC_UNONAME_NUMRULES), SC_WID_UNO_NUMRULES,&getCppuType((const uno::Reference<container::XIndexReplace>*)0), 0, 0 },
224 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLORI), ATTR_STACKED, &getCppuType((table::CellOrientation*)0), 0, 0 },
225 26 : {MAP_CHAR_LEN(SC_UNONAME_PADJUST), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
226 26 : {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
227 26 : {MAP_CHAR_LEN(SC_UNONAME_PINDENT), ATTR_INDENT, &getCppuType((sal_Int16*)0), 0, 0 }, //! CONVERT_TWIPS
228 26 : {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST),ATTR_SCRIPTSPACE, &getBooleanCppuType(), 0, 0 },
229 26 : {MAP_CHAR_LEN(SC_UNONAME_PISFORBID),ATTR_FORBIDDEN_RULES,&getBooleanCppuType(), 0, 0 },
230 26 : {MAP_CHAR_LEN(SC_UNONAME_PISHANG), ATTR_HANGPUNCTUATION,&getBooleanCppuType(), 0, 0 },
231 26 : {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN),ATTR_HYPHENATE, &getBooleanCppuType(), 0, 0 },
232 26 : {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
233 26 : {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_L_MARGIN | CONVERT_TWIPS },
234 26 : {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_R_MARGIN | CONVERT_TWIPS },
235 26 : {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
236 26 : {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
237 26 : {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
238 26 : {MAP_CHAR_LEN(SC_UNONAME_ROTANG), ATTR_ROTATE_VALUE, &getCppuType((sal_Int32*)0), 0, 0 },
239 26 : {MAP_CHAR_LEN(SC_UNONAME_ROTREF), ATTR_ROTATE_MODE, &getCppuType((sal_Int32*)0), 0, 0 },
240 26 : {MAP_CHAR_LEN(SC_UNONAME_SHADOW), ATTR_SHADOW, &getCppuType((table::ShadowFormat*)0), 0, 0 | CONVERT_TWIPS },
241 26 : {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(), 0, 0 },
242 26 : {MAP_CHAR_LEN(SC_UNONAME_TBLBORD), SC_WID_UNO_TBLBORD, &getCppuType((table::TableBorder*)0), 0, 0 | CONVERT_TWIPS },
243 26 : {MAP_CHAR_LEN(SC_UNONAME_TBLBORD2), SC_WID_UNO_TBLBORD2, &getCppuType((table::TableBorder2*)0), 0, 0 | CONVERT_TWIPS },
244 26 : {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
245 26 : {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, TOP_BORDER | CONVERT_TWIPS },
246 26 : {MAP_CHAR_LEN(SC_UNONAME_USERDEF), ATTR_USERDEF, &getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
247 26 : {MAP_CHAR_LEN(SC_UNONAME_VALIDAT), SC_WID_UNO_VALIDAT, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
248 26 : {MAP_CHAR_LEN(SC_UNONAME_VALILOC), SC_WID_UNO_VALILOC, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
249 26 : {MAP_CHAR_LEN(SC_UNONAME_VALIXML), SC_WID_UNO_VALIXML, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
250 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY, &getCppuType((sal_Int32*)0), 0, 0 },
251 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0), 0, 0 },
252 26 : {MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
253 26 : {MAP_CHAR_LEN(SC_UNONAME_HYPERLINK), ATTR_HYPERLINK, &getCppuType((OUString*)0), 0, 0 },
254 : {0,0,0,0,0,0}
255 25559 : };
256 23063 : static SfxItemPropertySet aCellsPropertySet( aCellsPropertyMap_Impl );
257 23063 : return &aCellsPropertySet;
258 : }
259 :
260 : // CellRange enthaelt alle Eintraege von Cells, zusaetzlich eigene Eintraege
261 : // mit Which-ID 0 (werden nur fuer getPropertySetInfo benoetigt).
262 :
263 21171 : static const SfxItemPropertySet* lcl_GetRangePropertySet()
264 : {
265 : static SfxItemPropertyMapEntry aRangePropertyMap_Impl[] =
266 : {
267 26 : {MAP_CHAR_LEN(SC_UNONAME_ABSNAME), SC_WID_UNO_ABSNAME, &getCppuType((OUString*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
268 26 : {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(), 0, 0 },
269 26 : {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
270 26 : {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
271 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND, &getCppuType((sal_Int32*)0), 0, MID_BACK_COLOR },
272 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLPRO), ATTR_PROTECTION, &getCppuType((util::CellProtection*)0), 0, 0 },
273 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL), SC_WID_UNO_CELLSTYL,&getCppuType((OUString*)0), 0, 0 },
274 26 : {MAP_CHAR_LEN(SC_UNONAME_CCOLOR), ATTR_FONT_COLOR, &getCppuType((sal_Int32*)0), 0, 0 },
275 26 : {MAP_CHAR_LEN(SC_UNONAME_COUTL), ATTR_FONT_CONTOUR, &getBooleanCppuType(), 0, 0 },
276 26 : {MAP_CHAR_LEN(SC_UNONAME_CCROSS), ATTR_FONT_CROSSEDOUT,&getBooleanCppuType(), 0, MID_CROSSED_OUT },
277 26 : {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS), ATTR_FONT_EMPHASISMARK,&getCppuType((sal_Int16*)0), 0, MID_EMPHASIS },
278 26 : {MAP_CHAR_LEN(SC_UNONAME_CFONT), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
279 26 : {MAP_CHAR_LEN(SC_UNONAME_CFCHARS), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
280 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
281 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
282 26 : {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
283 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
284 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
285 26 : {MAP_CHAR_LEN(SC_UNONAME_CFNAME), ATTR_FONT, &getCppuType((OUString*)0), 0, MID_FONT_FAMILY_NAME },
286 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME), ATTR_CJK_FONT, &getCppuType((OUString*)0), 0, MID_FONT_FAMILY_NAME },
287 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME), ATTR_CTL_FONT, &getCppuType((OUString*)0), 0, MID_FONT_FAMILY_NAME },
288 26 : {MAP_CHAR_LEN(SC_UNONAME_CFPITCH), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
289 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
290 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
291 26 : {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE), ATTR_FONT, &getCppuType((OUString*)0), 0, MID_FONT_STYLE_NAME },
292 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE), ATTR_CJK_FONT, &getCppuType((OUString*)0), 0, MID_FONT_STYLE_NAME },
293 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE), ATTR_CTL_FONT, &getCppuType((OUString*)0), 0, MID_FONT_STYLE_NAME },
294 26 : {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT), ATTR_FONT_HEIGHT, &getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
295 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT), ATTR_CJK_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
296 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT), ATTR_CTL_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
297 26 : {MAP_CHAR_LEN(SC_UNONAME_CLOCAL), ATTR_FONT_LANGUAGE, &getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
298 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL), ATTR_CJK_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
299 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL), ATTR_CTL_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
300 26 : {MAP_CHAR_LEN(SC_UNONAME_COVER), ATTR_FONT_OVERLINE, &getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
301 26 : {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL), ATTR_FONT_OVERLINE, &getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
302 26 : {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS), ATTR_FONT_OVERLINE, &getBooleanCppuType(), 0, MID_TL_HASCOLOR },
303 26 : {MAP_CHAR_LEN(SC_UNONAME_CPOST), ATTR_FONT_POSTURE, &getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
304 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CPOST), ATTR_CJK_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
305 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CPOST), ATTR_CTL_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
306 26 : {MAP_CHAR_LEN(SC_UNONAME_CRELIEF), ATTR_FONT_RELIEF, &getCppuType((sal_Int16*)0), 0, MID_RELIEF },
307 26 : {MAP_CHAR_LEN(SC_UNONAME_CSHADD), ATTR_FONT_SHADOWED, &getBooleanCppuType(), 0, 0 },
308 26 : {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE), ATTR_FONT_CROSSEDOUT,&getCppuType((sal_Int16*)0), 0, MID_CROSS_OUT },
309 26 : {MAP_CHAR_LEN(SC_UNONAME_CUNDER), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
310 26 : {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
311 26 : {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS), ATTR_FONT_UNDERLINE,&getBooleanCppuType(), 0, MID_TL_HASCOLOR },
312 26 : {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT), ATTR_FONT_WEIGHT, &getCppuType((float*)0), 0, MID_WEIGHT },
313 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT), ATTR_CJK_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
314 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT), ATTR_CTL_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
315 26 : {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD), ATTR_FONT_WORDLINE, &getBooleanCppuType(), 0, 0 },
316 26 : {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR), SC_WID_UNO_CHCOLHDR,&getBooleanCppuType(), 0, 0 },
317 26 : {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR), SC_WID_UNO_CHROWHDR,&getBooleanCppuType(), 0, 0 },
318 26 : {MAP_CHAR_LEN(SC_UNONAME_CONDFMT), SC_WID_UNO_CONDFMT, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
319 26 : {MAP_CHAR_LEN(SC_UNONAME_CONDLOC), SC_WID_UNO_CONDLOC, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
320 26 : {MAP_CHAR_LEN(SC_UNONAME_CONDXML), SC_WID_UNO_CONDXML, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
321 26 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
322 26 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR2), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
323 26 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
324 26 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR2), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
325 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS), ATTR_HOR_JUSTIFY, &getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
326 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD), ATTR_HOR_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0), 0, 0 },
327 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND, &getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
328 26 : {MAP_CHAR_LEN(SC_UNONAME_WRAP), ATTR_LINEBREAK, &getBooleanCppuType(), 0, 0 },
329 26 : {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
330 26 : {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
331 26 : {MAP_CHAR_LEN(SC_UNONAME_NUMFMT), ATTR_VALUE_FORMAT, &getCppuType((sal_Int32*)0), 0, 0 },
332 26 : {MAP_CHAR_LEN(SC_UNONAME_NUMRULES), SC_WID_UNO_NUMRULES,&getCppuType((const uno::Reference<container::XIndexReplace>*)0), 0, 0 },
333 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLORI), ATTR_STACKED, &getCppuType((table::CellOrientation*)0), 0, 0 },
334 26 : {MAP_CHAR_LEN(SC_UNONAME_PADJUST), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
335 26 : {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
336 26 : {MAP_CHAR_LEN(SC_UNONAME_PINDENT), ATTR_INDENT, &getCppuType((sal_Int16*)0), 0, 0 }, //! CONVERT_TWIPS
337 26 : {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST),ATTR_SCRIPTSPACE, &getBooleanCppuType(), 0, 0 },
338 26 : {MAP_CHAR_LEN(SC_UNONAME_PISFORBID),ATTR_FORBIDDEN_RULES,&getBooleanCppuType(), 0, 0 },
339 26 : {MAP_CHAR_LEN(SC_UNONAME_PISHANG), ATTR_HANGPUNCTUATION,&getBooleanCppuType(), 0, 0 },
340 26 : {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN),ATTR_HYPHENATE, &getBooleanCppuType(), 0, 0 },
341 26 : {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
342 26 : {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_L_MARGIN | CONVERT_TWIPS },
343 26 : {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_R_MARGIN | CONVERT_TWIPS },
344 26 : {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
345 26 : {MAP_CHAR_LEN(SC_UNONAME_POS), SC_WID_UNO_POS, &getCppuType((awt::Point*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
346 26 : {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
347 26 : {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
348 26 : {MAP_CHAR_LEN(SC_UNONAME_ROTANG), ATTR_ROTATE_VALUE, &getCppuType((sal_Int32*)0), 0, 0 },
349 26 : {MAP_CHAR_LEN(SC_UNONAME_ROTREF), ATTR_ROTATE_MODE, &getCppuType((sal_Int32*)0), 0, 0 },
350 26 : {MAP_CHAR_LEN(SC_UNONAME_SHADOW), ATTR_SHADOW, &getCppuType((table::ShadowFormat*)0), 0, 0 | CONVERT_TWIPS },
351 26 : {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(), 0, 0 },
352 26 : {MAP_CHAR_LEN(SC_UNONAME_SIZE), SC_WID_UNO_SIZE, &getCppuType((awt::Size*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
353 26 : {MAP_CHAR_LEN(SC_UNONAME_TBLBORD), SC_WID_UNO_TBLBORD, &getCppuType((table::TableBorder*)0), 0, 0 | CONVERT_TWIPS },
354 26 : {MAP_CHAR_LEN(SC_UNONAME_TBLBORD2), SC_WID_UNO_TBLBORD2, &getCppuType((table::TableBorder2*)0), 0, 0 | CONVERT_TWIPS },
355 26 : {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
356 26 : {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, TOP_BORDER | CONVERT_TWIPS },
357 26 : {MAP_CHAR_LEN(SC_UNONAME_USERDEF), ATTR_USERDEF, &getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
358 26 : {MAP_CHAR_LEN(SC_UNONAME_VALIDAT), SC_WID_UNO_VALIDAT, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
359 26 : {MAP_CHAR_LEN(SC_UNONAME_VALILOC), SC_WID_UNO_VALILOC, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
360 26 : {MAP_CHAR_LEN(SC_UNONAME_VALIXML), SC_WID_UNO_VALIXML, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
361 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY, &getCppuType((sal_Int32*)0), 0, 0 },
362 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0), 0, 0 },
363 26 : {MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
364 : {0,0,0,0,0,0}
365 23693 : };
366 21171 : static SfxItemPropertySet aRangePropertySet( aRangePropertyMap_Impl );
367 21171 : return &aRangePropertySet;
368 : }
369 :
370 : // Cell enthaelt alle Eintraege von CellRange, zusaetzlich eigene Eintraege
371 : // mit Which-ID 0 (werden nur fuer getPropertySetInfo benoetigt).
372 :
373 12450 : static const SfxItemPropertySet* lcl_GetCellPropertySet()
374 : {
375 : static SfxItemPropertyMapEntry aCellPropertyMap_Impl[] =
376 : {
377 18 : {MAP_CHAR_LEN(SC_UNONAME_ABSNAME), SC_WID_UNO_ABSNAME, &getCppuType((OUString*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
378 18 : {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(), 0, 0 },
379 18 : {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
380 18 : {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
381 18 : {MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND, &getCppuType((sal_Int32*)0), 0, MID_BACK_COLOR },
382 18 : {MAP_CHAR_LEN(SC_UNONAME_CELLPRO), ATTR_PROTECTION, &getCppuType((util::CellProtection*)0), 0, 0 },
383 18 : {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL), SC_WID_UNO_CELLSTYL,&getCppuType((OUString*)0), 0, 0 },
384 18 : {MAP_CHAR_LEN(SC_UNONAME_CCOLOR), ATTR_FONT_COLOR, &getCppuType((sal_Int32*)0), 0, 0 },
385 18 : {MAP_CHAR_LEN(SC_UNONAME_COUTL), ATTR_FONT_CONTOUR, &getBooleanCppuType(), 0, 0 },
386 18 : {MAP_CHAR_LEN(SC_UNONAME_CCROSS), ATTR_FONT_CROSSEDOUT,&getBooleanCppuType(), 0, MID_CROSSED_OUT },
387 18 : {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS), ATTR_FONT_EMPHASISMARK,&getCppuType((sal_Int16*)0), 0, MID_EMPHASIS },
388 18 : {MAP_CHAR_LEN(SC_UNONAME_CFONT), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
389 18 : {MAP_CHAR_LEN(SC_UNONAME_CFCHARS), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
390 18 : {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
391 18 : {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
392 18 : {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
393 18 : {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
394 18 : {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
395 18 : {MAP_CHAR_LEN(SC_UNONAME_CFNAME), ATTR_FONT, &getCppuType((OUString*)0), 0, MID_FONT_FAMILY_NAME },
396 18 : {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME), ATTR_CJK_FONT, &getCppuType((OUString*)0), 0, MID_FONT_FAMILY_NAME },
397 18 : {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME), ATTR_CTL_FONT, &getCppuType((OUString*)0), 0, MID_FONT_FAMILY_NAME },
398 18 : {MAP_CHAR_LEN(SC_UNONAME_CFPITCH), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
399 18 : {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
400 18 : {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
401 18 : {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE), ATTR_FONT, &getCppuType((OUString*)0), 0, MID_FONT_STYLE_NAME },
402 18 : {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE), ATTR_CJK_FONT, &getCppuType((OUString*)0), 0, MID_FONT_STYLE_NAME },
403 18 : {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE), ATTR_CTL_FONT, &getCppuType((OUString*)0), 0, MID_FONT_STYLE_NAME },
404 18 : {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT), ATTR_FONT_HEIGHT, &getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
405 18 : {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT), ATTR_CJK_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
406 18 : {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT), ATTR_CTL_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
407 18 : {MAP_CHAR_LEN(SC_UNONAME_CLOCAL), ATTR_FONT_LANGUAGE, &getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
408 18 : {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL), ATTR_CJK_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
409 18 : {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL), ATTR_CTL_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
410 18 : {MAP_CHAR_LEN(SC_UNONAME_COVER), ATTR_FONT_OVERLINE, &getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
411 18 : {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL), ATTR_FONT_OVERLINE, &getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
412 18 : {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS), ATTR_FONT_OVERLINE, &getBooleanCppuType(), 0, MID_TL_HASCOLOR },
413 18 : {MAP_CHAR_LEN(SC_UNONAME_CPOST), ATTR_FONT_POSTURE, &getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
414 18 : {MAP_CHAR_LEN(SC_UNO_CJK_CPOST), ATTR_CJK_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
415 18 : {MAP_CHAR_LEN(SC_UNO_CTL_CPOST), ATTR_CTL_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
416 18 : {MAP_CHAR_LEN(SC_UNONAME_CRELIEF), ATTR_FONT_RELIEF, &getCppuType((sal_Int16*)0), 0, MID_RELIEF },
417 18 : {MAP_CHAR_LEN(SC_UNONAME_CSHADD), ATTR_FONT_SHADOWED, &getBooleanCppuType(), 0, 0 },
418 18 : {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE), ATTR_FONT_CROSSEDOUT,&getCppuType((sal_Int16*)0), 0, MID_CROSS_OUT },
419 18 : {MAP_CHAR_LEN(SC_UNONAME_CUNDER), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
420 18 : {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
421 18 : {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS), ATTR_FONT_UNDERLINE,&getBooleanCppuType(), 0, MID_TL_HASCOLOR },
422 18 : {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT), ATTR_FONT_WEIGHT, &getCppuType((float*)0), 0, MID_WEIGHT },
423 18 : {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT), ATTR_CJK_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
424 18 : {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT), ATTR_CTL_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
425 18 : {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD), ATTR_FONT_WORDLINE, &getBooleanCppuType(), 0, 0 },
426 18 : {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR), SC_WID_UNO_CHCOLHDR,&getBooleanCppuType(), 0, 0 },
427 18 : {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR), SC_WID_UNO_CHROWHDR,&getBooleanCppuType(), 0, 0 },
428 18 : {MAP_CHAR_LEN(SC_UNONAME_CONDFMT), SC_WID_UNO_CONDFMT, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
429 18 : {MAP_CHAR_LEN(SC_UNONAME_CONDLOC), SC_WID_UNO_CONDLOC, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
430 18 : {MAP_CHAR_LEN(SC_UNONAME_CONDXML), SC_WID_UNO_CONDXML, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
431 18 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
432 18 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR2), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
433 18 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
434 18 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR2), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
435 18 : {MAP_CHAR_LEN(SC_UNONAME_FORMLOC), SC_WID_UNO_FORMLOC, &getCppuType((OUString*)0), 0, 0 },
436 18 : {MAP_CHAR_LEN(SC_UNONAME_FORMRT), SC_WID_UNO_FORMRT, &getCppuType((table::CellContentType*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
437 18 : {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS), ATTR_HOR_JUSTIFY, &getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
438 18 : {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD), ATTR_HOR_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0), 0, 0 },
439 18 : {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND, &getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
440 18 : {MAP_CHAR_LEN(SC_UNONAME_WRAP), ATTR_LINEBREAK, &getBooleanCppuType(), 0, 0 },
441 18 : {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
442 18 : {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
443 18 : {MAP_CHAR_LEN(SC_UNONAME_NUMFMT), ATTR_VALUE_FORMAT, &getCppuType((sal_Int32*)0), 0, 0 },
444 18 : {MAP_CHAR_LEN(SC_UNONAME_NUMRULES), SC_WID_UNO_NUMRULES,&getCppuType((const uno::Reference<container::XIndexReplace>*)0), 0, 0 },
445 18 : {MAP_CHAR_LEN(SC_UNONAME_CELLORI), ATTR_STACKED, &getCppuType((table::CellOrientation*)0), 0, 0 },
446 18 : {MAP_CHAR_LEN(SC_UNONAME_PADJUST), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
447 18 : {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
448 18 : {MAP_CHAR_LEN(SC_UNONAME_PINDENT), ATTR_INDENT, &getCppuType((sal_Int16*)0), 0, 0 }, //! CONVERT_TWIPS
449 18 : {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST),ATTR_SCRIPTSPACE, &getBooleanCppuType(), 0, 0 },
450 18 : {MAP_CHAR_LEN(SC_UNONAME_PISFORBID),ATTR_FORBIDDEN_RULES,&getBooleanCppuType(), 0, 0 },
451 18 : {MAP_CHAR_LEN(SC_UNONAME_PISHANG), ATTR_HANGPUNCTUATION,&getBooleanCppuType(), 0, 0 },
452 18 : {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN),ATTR_HYPHENATE, &getBooleanCppuType(), 0, 0 },
453 18 : {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
454 18 : {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_L_MARGIN | CONVERT_TWIPS },
455 18 : {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_R_MARGIN | CONVERT_TWIPS },
456 18 : {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
457 18 : {MAP_CHAR_LEN(SC_UNONAME_POS), SC_WID_UNO_POS, &getCppuType((awt::Point*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
458 18 : {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
459 18 : {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
460 18 : {MAP_CHAR_LEN(SC_UNONAME_ROTANG), ATTR_ROTATE_VALUE, &getCppuType((sal_Int32*)0), 0, 0 },
461 18 : {MAP_CHAR_LEN(SC_UNONAME_ROTREF), ATTR_ROTATE_MODE, &getCppuType((sal_Int32*)0), 0, 0 },
462 18 : {MAP_CHAR_LEN(SC_UNONAME_SHADOW), ATTR_SHADOW, &getCppuType((table::ShadowFormat*)0), 0, 0 | CONVERT_TWIPS },
463 18 : {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(), 0, 0 },
464 18 : {MAP_CHAR_LEN(SC_UNONAME_SIZE), SC_WID_UNO_SIZE, &getCppuType((awt::Size*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
465 18 : {MAP_CHAR_LEN(SC_UNONAME_TBLBORD), SC_WID_UNO_TBLBORD, &getCppuType((table::TableBorder*)0), 0, 0 | CONVERT_TWIPS },
466 18 : {MAP_CHAR_LEN(SC_UNONAME_TBLBORD2), SC_WID_UNO_TBLBORD2, &getCppuType((table::TableBorder2*)0), 0, 0 | CONVERT_TWIPS },
467 18 : {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
468 18 : {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, TOP_BORDER | CONVERT_TWIPS },
469 18 : {MAP_CHAR_LEN(SC_UNONAME_USERDEF), ATTR_USERDEF, &getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
470 18 : {MAP_CHAR_LEN(SC_UNONAME_VALIDAT), SC_WID_UNO_VALIDAT, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
471 18 : {MAP_CHAR_LEN(SC_UNONAME_VALILOC), SC_WID_UNO_VALILOC, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
472 18 : {MAP_CHAR_LEN(SC_UNONAME_VALIXML), SC_WID_UNO_VALIXML, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
473 18 : {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY, &getCppuType((sal_Int32*)0), 0, 0 },
474 18 : {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0), 0, 0 },
475 18 : {MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
476 18 : {MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_ESCAPEMENT), EE_CHAR_ESCAPEMENT, &getCppuType((sal_Int32*)0), 0, 0 },
477 18 : {MAP_CHAR_LEN(SC_UNONAME_HYPERLINK), ATTR_HYPERLINK, &getCppuType((OUString*)0), 0, 0 },
478 : {0,0,0,0,0,0}
479 14268 : };
480 12450 : static SfxItemPropertySet aCellPropertySet( aCellPropertyMap_Impl );
481 12450 : return &aCellPropertySet;
482 : }
483 :
484 : // Column und Row enthalten alle Eintraege von CellRange, zusaetzlich eigene Eintraege
485 : // mit Which-ID 0 (werden nur fuer getPropertySetInfo benoetigt).
486 :
487 1069 : static const SfxItemPropertySet* lcl_GetColumnPropertySet()
488 : {
489 : static SfxItemPropertyMapEntry aColumnPropertyMap_Impl[] =
490 : {
491 5 : {MAP_CHAR_LEN(SC_UNONAME_ABSNAME), SC_WID_UNO_ABSNAME, &getCppuType((OUString*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
492 5 : {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(), 0, 0 },
493 5 : {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
494 5 : {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
495 5 : {MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND, &getCppuType((sal_Int32*)0), 0, MID_BACK_COLOR },
496 5 : {MAP_CHAR_LEN(SC_UNONAME_CELLPRO), ATTR_PROTECTION, &getCppuType((util::CellProtection*)0), 0, 0 },
497 5 : {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL), SC_WID_UNO_CELLSTYL,&getCppuType((OUString*)0), 0, 0 },
498 5 : {MAP_CHAR_LEN(SC_UNONAME_CCOLOR), ATTR_FONT_COLOR, &getCppuType((sal_Int32*)0), 0, 0 },
499 5 : {MAP_CHAR_LEN(SC_UNONAME_COUTL), ATTR_FONT_CONTOUR, &getBooleanCppuType(), 0, 0 },
500 5 : {MAP_CHAR_LEN(SC_UNONAME_CCROSS), ATTR_FONT_CROSSEDOUT,&getBooleanCppuType(), 0, MID_CROSSED_OUT },
501 5 : {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS), ATTR_FONT_EMPHASISMARK,&getCppuType((sal_Int16*)0), 0, MID_EMPHASIS },
502 5 : {MAP_CHAR_LEN(SC_UNONAME_CFONT), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
503 5 : {MAP_CHAR_LEN(SC_UNONAME_CFCHARS), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
504 5 : {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
505 5 : {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
506 5 : {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
507 5 : {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
508 5 : {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
509 5 : {MAP_CHAR_LEN(SC_UNONAME_CFNAME), ATTR_FONT, &getCppuType((OUString*)0), 0, MID_FONT_FAMILY_NAME },
510 5 : {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME), ATTR_CJK_FONT, &getCppuType((OUString*)0), 0, MID_FONT_FAMILY_NAME },
511 5 : {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME), ATTR_CTL_FONT, &getCppuType((OUString*)0), 0, MID_FONT_FAMILY_NAME },
512 5 : {MAP_CHAR_LEN(SC_UNONAME_CFPITCH), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
513 5 : {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
514 5 : {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
515 5 : {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE), ATTR_FONT, &getCppuType((OUString*)0), 0, MID_FONT_STYLE_NAME },
516 5 : {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE), ATTR_CJK_FONT, &getCppuType((OUString*)0), 0, MID_FONT_STYLE_NAME },
517 5 : {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE), ATTR_CTL_FONT, &getCppuType((OUString*)0), 0, MID_FONT_STYLE_NAME },
518 5 : {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT), ATTR_FONT_HEIGHT, &getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
519 5 : {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT), ATTR_CJK_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
520 5 : {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT), ATTR_CTL_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
521 5 : {MAP_CHAR_LEN(SC_UNONAME_CLOCAL), ATTR_FONT_LANGUAGE, &getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
522 5 : {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL), ATTR_CJK_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
523 5 : {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL), ATTR_CTL_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
524 5 : {MAP_CHAR_LEN(SC_UNONAME_COVER), ATTR_FONT_OVERLINE, &getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
525 5 : {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL), ATTR_FONT_OVERLINE, &getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
526 5 : {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS), ATTR_FONT_OVERLINE, &getBooleanCppuType(), 0, MID_TL_HASCOLOR },
527 5 : {MAP_CHAR_LEN(SC_UNONAME_CPOST), ATTR_FONT_POSTURE, &getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
528 5 : {MAP_CHAR_LEN(SC_UNO_CJK_CPOST), ATTR_CJK_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
529 5 : {MAP_CHAR_LEN(SC_UNO_CTL_CPOST), ATTR_CTL_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
530 5 : {MAP_CHAR_LEN(SC_UNONAME_CRELIEF), ATTR_FONT_RELIEF, &getCppuType((sal_Int16*)0), 0, MID_RELIEF },
531 5 : {MAP_CHAR_LEN(SC_UNONAME_CSHADD), ATTR_FONT_SHADOWED, &getBooleanCppuType(), 0, 0 },
532 5 : {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE), ATTR_FONT_CROSSEDOUT,&getCppuType((sal_Int16*)0), 0, MID_CROSS_OUT },
533 5 : {MAP_CHAR_LEN(SC_UNONAME_CUNDER), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
534 5 : {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
535 5 : {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS), ATTR_FONT_UNDERLINE,&getBooleanCppuType(), 0, MID_TL_HASCOLOR },
536 5 : {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT), ATTR_FONT_WEIGHT, &getCppuType((float*)0), 0, MID_WEIGHT },
537 5 : {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT), ATTR_CJK_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
538 5 : {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT), ATTR_CTL_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
539 5 : {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD), ATTR_FONT_WORDLINE, &getBooleanCppuType(), 0, 0 },
540 5 : {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR), SC_WID_UNO_CHCOLHDR,&getBooleanCppuType(), 0, 0 },
541 5 : {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR), SC_WID_UNO_CHROWHDR,&getBooleanCppuType(), 0, 0 },
542 5 : {MAP_CHAR_LEN(SC_UNONAME_CONDFMT), SC_WID_UNO_CONDFMT, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
543 5 : {MAP_CHAR_LEN(SC_UNONAME_CONDLOC), SC_WID_UNO_CONDLOC, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
544 5 : {MAP_CHAR_LEN(SC_UNONAME_CONDXML), SC_WID_UNO_CONDXML, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
545 5 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
546 5 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR2), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
547 5 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
548 5 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR2), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
549 5 : {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS), ATTR_HOR_JUSTIFY, &getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
550 5 : {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD), ATTR_HOR_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0), 0, 0 },
551 5 : {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND, &getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
552 5 : {MAP_CHAR_LEN(SC_UNONAME_MANPAGE), SC_WID_UNO_MANPAGE, &getBooleanCppuType(), 0, 0 },
553 5 : {MAP_CHAR_LEN(SC_UNONAME_NEWPAGE), SC_WID_UNO_NEWPAGE, &getBooleanCppuType(), 0, 0 },
554 5 : {MAP_CHAR_LEN(SC_UNONAME_WRAP), ATTR_LINEBREAK, &getBooleanCppuType(), 0, 0 },
555 5 : {MAP_CHAR_LEN(SC_UNONAME_CELLVIS), SC_WID_UNO_CELLVIS, &getBooleanCppuType(), 0, 0 },
556 5 : {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
557 5 : {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
558 5 : {MAP_CHAR_LEN(SC_UNONAME_NUMFMT), ATTR_VALUE_FORMAT, &getCppuType((sal_Int32*)0), 0, 0 },
559 5 : {MAP_CHAR_LEN(SC_UNONAME_NUMRULES), SC_WID_UNO_NUMRULES,&getCppuType((const uno::Reference<container::XIndexReplace>*)0), 0, 0 },
560 5 : {MAP_CHAR_LEN(SC_UNONAME_OWIDTH), SC_WID_UNO_OWIDTH, &getBooleanCppuType(), 0, 0 },
561 5 : {MAP_CHAR_LEN(SC_UNONAME_CELLORI), ATTR_STACKED, &getCppuType((table::CellOrientation*)0), 0, 0 },
562 5 : {MAP_CHAR_LEN(SC_UNONAME_PADJUST), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
563 5 : {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
564 5 : {MAP_CHAR_LEN(SC_UNONAME_PINDENT), ATTR_INDENT, &getCppuType((sal_Int16*)0), 0, 0 }, //! CONVERT_TWIPS
565 5 : {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST),ATTR_SCRIPTSPACE, &getBooleanCppuType(), 0, 0 },
566 5 : {MAP_CHAR_LEN(SC_UNONAME_PISFORBID),ATTR_FORBIDDEN_RULES,&getBooleanCppuType(), 0, 0 },
567 5 : {MAP_CHAR_LEN(SC_UNONAME_PISHANG), ATTR_HANGPUNCTUATION,&getBooleanCppuType(), 0, 0 },
568 5 : {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN),ATTR_HYPHENATE, &getBooleanCppuType(), 0, 0 },
569 5 : {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
570 5 : {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_L_MARGIN | CONVERT_TWIPS },
571 5 : {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_R_MARGIN | CONVERT_TWIPS },
572 5 : {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
573 5 : {MAP_CHAR_LEN(SC_UNONAME_POS), SC_WID_UNO_POS, &getCppuType((awt::Point*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
574 5 : {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
575 5 : {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
576 5 : {MAP_CHAR_LEN(SC_UNONAME_ROTANG), ATTR_ROTATE_VALUE, &getCppuType((sal_Int32*)0), 0, 0 },
577 5 : {MAP_CHAR_LEN(SC_UNONAME_ROTREF), ATTR_ROTATE_MODE, &getCppuType((sal_Int32*)0), 0, 0 },
578 5 : {MAP_CHAR_LEN(SC_UNONAME_SHADOW), ATTR_SHADOW, &getCppuType((table::ShadowFormat*)0), 0, 0 | CONVERT_TWIPS },
579 5 : {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(), 0, 0 },
580 5 : {MAP_CHAR_LEN(SC_UNONAME_SIZE), SC_WID_UNO_SIZE, &getCppuType((awt::Size*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
581 5 : {MAP_CHAR_LEN(SC_UNONAME_TBLBORD), SC_WID_UNO_TBLBORD, &getCppuType((table::TableBorder*)0), 0, 0 | CONVERT_TWIPS },
582 5 : {MAP_CHAR_LEN(SC_UNONAME_TBLBORD2), SC_WID_UNO_TBLBORD2, &getCppuType((table::TableBorder2*)0), 0, 0 | CONVERT_TWIPS },
583 5 : {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
584 5 : {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, TOP_BORDER | CONVERT_TWIPS },
585 5 : {MAP_CHAR_LEN(SC_UNONAME_USERDEF), ATTR_USERDEF, &getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
586 5 : {MAP_CHAR_LEN(SC_UNONAME_VALIDAT), SC_WID_UNO_VALIDAT, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
587 5 : {MAP_CHAR_LEN(SC_UNONAME_VALILOC), SC_WID_UNO_VALILOC, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
588 5 : {MAP_CHAR_LEN(SC_UNONAME_VALIXML), SC_WID_UNO_VALIXML, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
589 5 : {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY, &getCppuType((sal_Int32*)0), 0, 0 },
590 5 : {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0), 0, 0 },
591 5 : {MAP_CHAR_LEN(SC_UNONAME_CELLWID), SC_WID_UNO_CELLWID, &getCppuType((sal_Int32*)0), 0, 0 },
592 5 : {MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
593 : {0,0,0,0,0,0}
594 1579 : };
595 1069 : static SfxItemPropertySet aColumnPropertySet( aColumnPropertyMap_Impl );
596 1069 : return &aColumnPropertySet;
597 : }
598 :
599 71 : static const SfxItemPropertySet* lcl_GetRowPropertySet()
600 : {
601 : static SfxItemPropertyMapEntry aRowPropertyMap_Impl[] =
602 : {
603 6 : {MAP_CHAR_LEN(SC_UNONAME_ABSNAME), SC_WID_UNO_ABSNAME, &getCppuType((OUString*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
604 6 : {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(), 0, 0 },
605 6 : {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
606 6 : {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
607 6 : {MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND, &getCppuType((sal_Int32*)0), 0, MID_BACK_COLOR },
608 6 : {MAP_CHAR_LEN(SC_UNONAME_CELLPRO), ATTR_PROTECTION, &getCppuType((util::CellProtection*)0), 0, 0 },
609 6 : {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL), SC_WID_UNO_CELLSTYL,&getCppuType((OUString*)0), 0, 0 },
610 6 : {MAP_CHAR_LEN(SC_UNONAME_CCOLOR), ATTR_FONT_COLOR, &getCppuType((sal_Int32*)0), 0, 0 },
611 6 : {MAP_CHAR_LEN(SC_UNONAME_COUTL), ATTR_FONT_CONTOUR, &getBooleanCppuType(), 0, 0 },
612 6 : {MAP_CHAR_LEN(SC_UNONAME_CCROSS), ATTR_FONT_CROSSEDOUT,&getBooleanCppuType(), 0, MID_CROSSED_OUT },
613 6 : {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS), ATTR_FONT_EMPHASISMARK,&getCppuType((sal_Int16*)0), 0, MID_EMPHASIS },
614 6 : {MAP_CHAR_LEN(SC_UNONAME_CFONT), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
615 6 : {MAP_CHAR_LEN(SC_UNONAME_CFCHARS), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
616 6 : {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
617 6 : {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
618 6 : {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
619 6 : {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
620 6 : {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
621 6 : {MAP_CHAR_LEN(SC_UNONAME_CFNAME), ATTR_FONT, &getCppuType((OUString*)0), 0, MID_FONT_FAMILY_NAME },
622 6 : {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME), ATTR_CJK_FONT, &getCppuType((OUString*)0), 0, MID_FONT_FAMILY_NAME },
623 6 : {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME), ATTR_CTL_FONT, &getCppuType((OUString*)0), 0, MID_FONT_FAMILY_NAME },
624 6 : {MAP_CHAR_LEN(SC_UNONAME_CFPITCH), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
625 6 : {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
626 6 : {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
627 6 : {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE), ATTR_FONT, &getCppuType((OUString*)0), 0, MID_FONT_STYLE_NAME },
628 6 : {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE), ATTR_CJK_FONT, &getCppuType((OUString*)0), 0, MID_FONT_STYLE_NAME },
629 6 : {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE), ATTR_CTL_FONT, &getCppuType((OUString*)0), 0, MID_FONT_STYLE_NAME },
630 6 : {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT), ATTR_FONT_HEIGHT, &getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
631 6 : {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT), ATTR_CJK_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
632 6 : {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT), ATTR_CTL_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
633 6 : {MAP_CHAR_LEN(SC_UNONAME_CLOCAL), ATTR_FONT_LANGUAGE, &getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
634 6 : {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL), ATTR_CJK_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
635 6 : {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL), ATTR_CTL_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
636 6 : {MAP_CHAR_LEN(SC_UNONAME_COVER), ATTR_FONT_OVERLINE, &getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
637 6 : {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL), ATTR_FONT_OVERLINE, &getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
638 6 : {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS), ATTR_FONT_OVERLINE, &getBooleanCppuType(), 0, MID_TL_HASCOLOR },
639 6 : {MAP_CHAR_LEN(SC_UNONAME_CPOST), ATTR_FONT_POSTURE, &getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
640 6 : {MAP_CHAR_LEN(SC_UNO_CJK_CPOST), ATTR_CJK_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
641 6 : {MAP_CHAR_LEN(SC_UNO_CTL_CPOST), ATTR_CTL_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
642 6 : {MAP_CHAR_LEN(SC_UNONAME_CRELIEF), ATTR_FONT_RELIEF, &getCppuType((sal_Int16*)0), 0, MID_RELIEF },
643 6 : {MAP_CHAR_LEN(SC_UNONAME_CSHADD), ATTR_FONT_SHADOWED, &getBooleanCppuType(), 0, 0 },
644 6 : {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE), ATTR_FONT_CROSSEDOUT,&getCppuType((sal_Int16*)0), 0, MID_CROSS_OUT },
645 6 : {MAP_CHAR_LEN(SC_UNONAME_CUNDER), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
646 6 : {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
647 6 : {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS), ATTR_FONT_UNDERLINE,&getBooleanCppuType(), 0, MID_TL_HASCOLOR },
648 6 : {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT), ATTR_FONT_WEIGHT, &getCppuType((float*)0), 0, MID_WEIGHT },
649 6 : {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT), ATTR_CJK_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
650 6 : {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT), ATTR_CTL_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
651 6 : {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD), ATTR_FONT_WORDLINE, &getBooleanCppuType(), 0, 0 },
652 6 : {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR), SC_WID_UNO_CHCOLHDR,&getBooleanCppuType(), 0, 0 },
653 6 : {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR), SC_WID_UNO_CHROWHDR,&getBooleanCppuType(), 0, 0 },
654 6 : {MAP_CHAR_LEN(SC_UNONAME_CONDFMT), SC_WID_UNO_CONDFMT, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
655 6 : {MAP_CHAR_LEN(SC_UNONAME_CONDLOC), SC_WID_UNO_CONDLOC, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
656 6 : {MAP_CHAR_LEN(SC_UNONAME_CONDXML), SC_WID_UNO_CONDXML, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
657 6 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
658 6 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR2), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
659 6 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
660 6 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR2), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
661 6 : {MAP_CHAR_LEN(SC_UNONAME_CELLHGT), SC_WID_UNO_CELLHGT, &getCppuType((sal_Int32*)0), 0, 0 },
662 6 : {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS), ATTR_HOR_JUSTIFY, &getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
663 6 : {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD), ATTR_HOR_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0), 0, 0 },
664 6 : {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND, &getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
665 6 : {MAP_CHAR_LEN(SC_UNONAME_CELLFILT), SC_WID_UNO_CELLFILT,&getBooleanCppuType(), 0, 0 },
666 6 : {MAP_CHAR_LEN(SC_UNONAME_MANPAGE), SC_WID_UNO_MANPAGE, &getBooleanCppuType(), 0, 0 },
667 6 : {MAP_CHAR_LEN(SC_UNONAME_NEWPAGE), SC_WID_UNO_NEWPAGE, &getBooleanCppuType(), 0, 0 },
668 6 : {MAP_CHAR_LEN(SC_UNONAME_WRAP), ATTR_LINEBREAK, &getBooleanCppuType(), 0, 0 },
669 6 : {MAP_CHAR_LEN(SC_UNONAME_CELLVIS), SC_WID_UNO_CELLVIS, &getBooleanCppuType(), 0, 0 },
670 6 : {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
671 6 : {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
672 6 : {MAP_CHAR_LEN(SC_UNONAME_NUMFMT), ATTR_VALUE_FORMAT, &getCppuType((sal_Int32*)0), 0, 0 },
673 6 : {MAP_CHAR_LEN(SC_UNONAME_NUMRULES), SC_WID_UNO_NUMRULES,&getCppuType((const uno::Reference<container::XIndexReplace>*)0), 0, 0 },
674 6 : {MAP_CHAR_LEN(SC_UNONAME_OHEIGHT), SC_WID_UNO_OHEIGHT, &getBooleanCppuType(), 0, 0 },
675 6 : {MAP_CHAR_LEN(SC_UNONAME_CELLORI), ATTR_STACKED, &getCppuType((table::CellOrientation*)0), 0, 0 },
676 6 : {MAP_CHAR_LEN(SC_UNONAME_PADJUST), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
677 6 : {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
678 6 : {MAP_CHAR_LEN(SC_UNONAME_PINDENT), ATTR_INDENT, &getCppuType((sal_Int16*)0), 0, 0 }, //! CONVERT_TWIPS
679 6 : {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST),ATTR_SCRIPTSPACE, &getBooleanCppuType(), 0, 0 },
680 6 : {MAP_CHAR_LEN(SC_UNONAME_PISFORBID),ATTR_FORBIDDEN_RULES,&getBooleanCppuType(), 0, 0 },
681 6 : {MAP_CHAR_LEN(SC_UNONAME_PISHANG), ATTR_HANGPUNCTUATION,&getBooleanCppuType(), 0, 0 },
682 6 : {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN),ATTR_HYPHENATE, &getBooleanCppuType(), 0, 0 },
683 6 : {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
684 6 : {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_L_MARGIN | CONVERT_TWIPS },
685 6 : {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_R_MARGIN | CONVERT_TWIPS },
686 6 : {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
687 6 : {MAP_CHAR_LEN(SC_UNONAME_POS), SC_WID_UNO_POS, &getCppuType((awt::Point*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
688 6 : {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
689 6 : {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
690 6 : {MAP_CHAR_LEN(SC_UNONAME_ROTANG), ATTR_ROTATE_VALUE, &getCppuType((sal_Int32*)0), 0, 0 },
691 6 : {MAP_CHAR_LEN(SC_UNONAME_ROTREF), ATTR_ROTATE_MODE, &getCppuType((sal_Int32*)0), 0, 0 },
692 6 : {MAP_CHAR_LEN(SC_UNONAME_SHADOW), ATTR_SHADOW, &getCppuType((table::ShadowFormat*)0), 0, 0 | CONVERT_TWIPS },
693 6 : {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(), 0, 0 },
694 6 : {MAP_CHAR_LEN(SC_UNONAME_SIZE), SC_WID_UNO_SIZE, &getCppuType((awt::Size*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
695 6 : {MAP_CHAR_LEN(SC_UNONAME_TBLBORD), SC_WID_UNO_TBLBORD, &getCppuType((table::TableBorder*)0), 0, 0 | CONVERT_TWIPS },
696 6 : {MAP_CHAR_LEN(SC_UNONAME_TBLBORD2), SC_WID_UNO_TBLBORD2, &getCppuType((table::TableBorder2*)0), 0, 0 | CONVERT_TWIPS },
697 6 : {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
698 6 : {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, TOP_BORDER | CONVERT_TWIPS },
699 6 : {MAP_CHAR_LEN(SC_UNONAME_USERDEF), ATTR_USERDEF, &getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
700 6 : {MAP_CHAR_LEN(SC_UNONAME_VALIDAT), SC_WID_UNO_VALIDAT, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
701 6 : {MAP_CHAR_LEN(SC_UNONAME_VALILOC), SC_WID_UNO_VALILOC, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
702 6 : {MAP_CHAR_LEN(SC_UNONAME_VALIXML), SC_WID_UNO_VALIXML, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
703 6 : {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY, &getCppuType((sal_Int32*)0), 0, 0 },
704 6 : {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0), 0, 0 },
705 6 : {MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
706 : {0,0,0,0,0,0}
707 689 : };
708 71 : static SfxItemPropertySet aRowPropertySet( aRowPropertyMap_Impl );
709 71 : return &aRowPropertySet;
710 : }
711 :
712 2679 : static const SfxItemPropertySet* lcl_GetSheetPropertySet()
713 : {
714 : static SfxItemPropertyMapEntry aSheetPropertyMap_Impl[] =
715 : {
716 26 : {MAP_CHAR_LEN(SC_UNONAME_ABSNAME), SC_WID_UNO_ABSNAME, &getCppuType((OUString*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
717 26 : {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(), 0, 0 },
718 26 : {MAP_CHAR_LEN(SC_UNONAME_AUTOPRINT),SC_WID_UNO_AUTOPRINT,&getBooleanCppuType(), 0, 0 },
719 26 : {MAP_CHAR_LEN(SC_UNONAME_BORDCOL), SC_WID_UNO_BORDCOL, &getCppuType((sal_Int32*)0), 0, 0 },
720 26 : {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
721 26 : {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
722 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND, &getCppuType((sal_Int32*)0), 0, MID_BACK_COLOR },
723 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLPRO), ATTR_PROTECTION, &getCppuType((util::CellProtection*)0), 0, 0 },
724 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL), SC_WID_UNO_CELLSTYL,&getCppuType((OUString*)0), 0, 0 },
725 26 : {MAP_CHAR_LEN(SC_UNONAME_CCOLOR), ATTR_FONT_COLOR, &getCppuType((sal_Int32*)0), 0, 0 },
726 26 : {MAP_CHAR_LEN(SC_UNONAME_COUTL), ATTR_FONT_CONTOUR, &getBooleanCppuType(), 0, 0 },
727 26 : {MAP_CHAR_LEN(SC_UNONAME_CCROSS), ATTR_FONT_CROSSEDOUT,&getBooleanCppuType(), 0, MID_CROSSED_OUT },
728 26 : {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS), ATTR_FONT_EMPHASISMARK,&getCppuType((sal_Int16*)0), 0, MID_EMPHASIS },
729 26 : {MAP_CHAR_LEN(SC_UNONAME_CFONT), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
730 26 : {MAP_CHAR_LEN(SC_UNONAME_CFCHARS), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
731 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
732 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
733 26 : {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
734 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
735 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
736 26 : {MAP_CHAR_LEN(SC_UNONAME_CFNAME), ATTR_FONT, &getCppuType((OUString*)0), 0, MID_FONT_FAMILY_NAME },
737 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME), ATTR_CJK_FONT, &getCppuType((OUString*)0), 0, MID_FONT_FAMILY_NAME },
738 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME), ATTR_CTL_FONT, &getCppuType((OUString*)0), 0, MID_FONT_FAMILY_NAME },
739 26 : {MAP_CHAR_LEN(SC_UNONAME_CFPITCH), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
740 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
741 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
742 26 : {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE), ATTR_FONT, &getCppuType((OUString*)0), 0, MID_FONT_STYLE_NAME },
743 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE), ATTR_CJK_FONT, &getCppuType((OUString*)0), 0, MID_FONT_STYLE_NAME },
744 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE), ATTR_CTL_FONT, &getCppuType((OUString*)0), 0, MID_FONT_STYLE_NAME },
745 26 : {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT), ATTR_FONT_HEIGHT, &getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
746 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT), ATTR_CJK_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
747 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT), ATTR_CTL_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
748 26 : {MAP_CHAR_LEN(SC_UNONAME_CLOCAL), ATTR_FONT_LANGUAGE, &getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
749 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL), ATTR_CJK_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
750 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL), ATTR_CTL_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
751 26 : {MAP_CHAR_LEN(SC_UNONAME_COVER), ATTR_FONT_OVERLINE, &getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
752 26 : {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL), ATTR_FONT_OVERLINE, &getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
753 26 : {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS), ATTR_FONT_OVERLINE, &getBooleanCppuType(), 0, MID_TL_HASCOLOR },
754 26 : {MAP_CHAR_LEN(SC_UNONAME_CPOST), ATTR_FONT_POSTURE, &getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
755 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CPOST), ATTR_CJK_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
756 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CPOST), ATTR_CTL_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
757 26 : {MAP_CHAR_LEN(SC_UNONAME_CRELIEF), ATTR_FONT_RELIEF, &getCppuType((sal_Int16*)0), 0, MID_RELIEF },
758 26 : {MAP_CHAR_LEN(SC_UNONAME_CSHADD), ATTR_FONT_SHADOWED, &getBooleanCppuType(), 0, 0 },
759 26 : {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE), ATTR_FONT_CROSSEDOUT,&getCppuType((sal_Int16*)0), 0, MID_CROSS_OUT },
760 26 : {MAP_CHAR_LEN(SC_UNONAME_CUNDER), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
761 26 : {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
762 26 : {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS), ATTR_FONT_UNDERLINE,&getBooleanCppuType(), 0, MID_TL_HASCOLOR },
763 26 : {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT), ATTR_FONT_WEIGHT, &getCppuType((float*)0), 0, MID_WEIGHT },
764 26 : {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT), ATTR_CJK_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
765 26 : {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT), ATTR_CTL_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
766 26 : {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD), ATTR_FONT_WORDLINE, &getBooleanCppuType(), 0, 0 },
767 26 : {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR), SC_WID_UNO_CHCOLHDR,&getBooleanCppuType(), 0, 0 },
768 26 : {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR), SC_WID_UNO_CHROWHDR,&getBooleanCppuType(), 0, 0 },
769 26 : {MAP_CHAR_LEN(SC_UNONAME_CONDFMT), SC_WID_UNO_CONDFMT, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
770 26 : {MAP_CHAR_LEN(SC_UNONAME_CONDLOC), SC_WID_UNO_CONDLOC, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
771 26 : {MAP_CHAR_LEN(SC_UNONAME_CONDXML), SC_WID_UNO_CONDXML, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
772 26 : {MAP_CHAR_LEN(SC_UNONAME_COPYBACK), SC_WID_UNO_COPYBACK,&getBooleanCppuType(), 0, 0 },
773 26 : {MAP_CHAR_LEN(SC_UNONAME_COPYFORM), SC_WID_UNO_COPYFORM,&getBooleanCppuType(), 0, 0 },
774 26 : {MAP_CHAR_LEN(SC_UNONAME_COPYSTYL), SC_WID_UNO_COPYSTYL,&getBooleanCppuType(), 0, 0 },
775 26 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
776 26 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR2), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
777 26 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
778 26 : {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR2), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
779 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS), ATTR_HOR_JUSTIFY, &getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
780 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD), ATTR_HOR_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0), 0, 0 },
781 26 : {MAP_CHAR_LEN(SC_UNONAME_ISACTIVE), SC_WID_UNO_ISACTIVE,&getBooleanCppuType(), 0, 0 },
782 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND, &getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
783 26 : {MAP_CHAR_LEN(SC_UNONAME_WRAP), ATTR_LINEBREAK, &getBooleanCppuType(), 0, 0 },
784 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLVIS), SC_WID_UNO_CELLVIS, &getBooleanCppuType(), 0, 0 },
785 26 : {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
786 26 : {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
787 26 : {MAP_CHAR_LEN(SC_UNO_LINKDISPBIT), SC_WID_UNO_LINKDISPBIT,&getCppuType((uno::Reference<awt::XBitmap>*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
788 26 : {MAP_CHAR_LEN(SC_UNO_LINKDISPNAME), SC_WID_UNO_LINKDISPNAME,&getCppuType((OUString*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
789 26 : {MAP_CHAR_LEN(SC_UNONAME_NUMFMT), ATTR_VALUE_FORMAT, &getCppuType((sal_Int32*)0), 0, 0 },
790 26 : {MAP_CHAR_LEN(SC_UNONAME_NUMRULES), SC_WID_UNO_NUMRULES,&getCppuType((const uno::Reference<container::XIndexReplace>*)0), 0, 0 },
791 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLORI), ATTR_STACKED, &getCppuType((table::CellOrientation*)0), 0, 0 },
792 26 : {MAP_CHAR_LEN(SC_UNONAME_PAGESTL), SC_WID_UNO_PAGESTL, &getCppuType((OUString*)0), 0, 0 },
793 26 : {MAP_CHAR_LEN(SC_UNONAME_PADJUST), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
794 26 : {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
795 26 : {MAP_CHAR_LEN(SC_UNONAME_PINDENT), ATTR_INDENT, &getCppuType((sal_Int16*)0), 0, 0 }, //! CONVERT_TWIPS
796 26 : {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST),ATTR_SCRIPTSPACE, &getBooleanCppuType(), 0, 0 },
797 26 : {MAP_CHAR_LEN(SC_UNONAME_PISFORBID),ATTR_FORBIDDEN_RULES,&getBooleanCppuType(), 0, 0 },
798 26 : {MAP_CHAR_LEN(SC_UNONAME_PISHANG), ATTR_HANGPUNCTUATION,&getBooleanCppuType(), 0, 0 },
799 26 : {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN),ATTR_HYPHENATE, &getBooleanCppuType(), 0, 0 },
800 26 : {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
801 26 : {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_L_MARGIN | CONVERT_TWIPS },
802 26 : {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_R_MARGIN | CONVERT_TWIPS },
803 26 : {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
804 26 : {MAP_CHAR_LEN(SC_UNONAME_POS), SC_WID_UNO_POS, &getCppuType((awt::Point*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
805 26 : {MAP_CHAR_LEN(SC_UNONAME_PRINTBORD),SC_WID_UNO_PRINTBORD,&getBooleanCppuType(), 0, 0 },
806 26 : {MAP_CHAR_LEN(SC_UNONAME_PROTECT), SC_WID_UNO_PROTECT, &getBooleanCppuType(), 0, 0 },
807 26 : {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
808 26 : {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
809 26 : {MAP_CHAR_LEN(SC_UNONAME_ROTANG), ATTR_ROTATE_VALUE, &getCppuType((sal_Int32*)0), 0, 0 },
810 26 : {MAP_CHAR_LEN(SC_UNONAME_ROTREF), ATTR_ROTATE_MODE, &getCppuType((sal_Int32*)0), 0, 0 },
811 26 : {MAP_CHAR_LEN(SC_UNONAME_SHADOW), ATTR_SHADOW, &getCppuType((table::ShadowFormat*)0), 0, 0 | CONVERT_TWIPS },
812 26 : {MAP_CHAR_LEN(SC_UNONAME_SHOWBORD), SC_WID_UNO_SHOWBORD,&getBooleanCppuType(), 0, 0 },
813 26 : {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(), 0, 0 },
814 26 : {MAP_CHAR_LEN(SC_UNONAME_SIZE), SC_WID_UNO_SIZE, &getCppuType((awt::Size*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
815 26 : {MAP_CHAR_LEN(SC_UNONAME_TBLBORD), SC_WID_UNO_TBLBORD, &getCppuType((table::TableBorder*)0), 0, 0 | CONVERT_TWIPS },
816 26 : {MAP_CHAR_LEN(SC_UNONAME_TBLBORD2), SC_WID_UNO_TBLBORD2, &getCppuType((table::TableBorder2*)0), 0, 0 | CONVERT_TWIPS },
817 26 : {MAP_CHAR_LEN(SC_UNONAME_TABLAYOUT),SC_WID_UNO_TABLAYOUT,&getCppuType((sal_Int16*)0), 0, 0 },
818 26 : {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
819 26 : {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER2),ATTR_BORDER, &::getCppuType((const table::BorderLine2*)0), 0, TOP_BORDER | CONVERT_TWIPS },
820 26 : {MAP_CHAR_LEN(SC_UNONAME_USERDEF), ATTR_USERDEF, &getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
821 26 : {MAP_CHAR_LEN(SC_UNONAME_VALIDAT), SC_WID_UNO_VALIDAT, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
822 26 : {MAP_CHAR_LEN(SC_UNONAME_VALILOC), SC_WID_UNO_VALILOC, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
823 26 : {MAP_CHAR_LEN(SC_UNONAME_VALIXML), SC_WID_UNO_VALIXML, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
824 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY, &getCppuType((sal_Int32*)0), 0, 0 },
825 26 : {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0), 0, 0 },
826 26 : {MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
827 26 : {MAP_CHAR_LEN(SC_UNONAME_TABCOLOR), SC_WID_UNO_TABCOLOR, &getCppuType((sal_Int32*)0), 0, 0 },
828 26 : {MAP_CHAR_LEN(SC_UNO_CODENAME), SC_WID_UNO_CODENAME, &getCppuType(static_cast< const OUString * >(0)), 0, 0},
829 26 : {MAP_CHAR_LEN(SC_UNO_NAMEDRANGES), SC_WID_UNO_NAMES, &getCppuType((uno::Reference<sheet::XNamedRanges>*)0), 0, 0 },
830 : {0,0,0,0,0,0}
831 5643 : };
832 2679 : static SfxItemPropertySet aSheetPropertySet( aSheetPropertyMap_Impl );
833 2679 : return &aSheetPropertySet;
834 : }
835 :
836 2 : static const SfxItemPropertyMapEntry* lcl_GetEditPropertyMap()
837 : {
838 : static SfxItemPropertyMapEntry aEditPropertyMap_Impl[] =
839 : {
840 92 : SVX_UNOEDIT_CHAR_PROPERTIES,
841 2 : SVX_UNOEDIT_FONT_PROPERTIES,
842 28 : SVX_UNOEDIT_PARA_PROPERTIES,
843 4 : SVX_UNOEDIT_NUMBERING_PROPERTIE, // for completeness of service ParagraphProperties
844 2 : {MAP_CHAR_LEN(SC_UNONAME_TEXTUSER), EE_CHAR_XMLATTRIBS, &getCppuType((const uno::Reference< container::XNameContainer >*)0), 0, 0},
845 2 : {MAP_CHAR_LEN(SC_UNONAME_USERDEF), EE_PARA_XMLATTRIBS, &getCppuType((const uno::Reference< container::XNameContainer >*)0), 0, 0},
846 : {0,0,0,0,0,0}
847 132 : };
848 2 : return aEditPropertyMap_Impl;
849 : }
850 10 : static const SvxItemPropertySet* lcl_GetEditPropertySet()
851 : {
852 10 : static SvxItemPropertySet aEditPropertySet( lcl_GetEditPropertyMap(), SdrObject::GetGlobalDrawObjectItemPool() );
853 10 : return &aEditPropertySet;
854 : }
855 :
856 : //------------------------------------------------------------------------
857 :
858 : using sc::HMMToTwips;
859 : using sc::TwipsToHMM;
860 :
861 : //------------------------------------------------------------------------
862 :
863 : #define SCCHARPROPERTIES_SERVICE "com.sun.star.style.CharacterProperties"
864 : #define SCPARAPROPERTIES_SERVICE "com.sun.star.style.ParagraphProperties"
865 : #define SCCELLPROPERTIES_SERVICE "com.sun.star.table.CellProperties"
866 : #define SCCELLRANGE_SERVICE "com.sun.star.table.CellRange"
867 : #define SCCELL_SERVICE "com.sun.star.table.Cell"
868 : #define SCSHEETCELLRANGES_SERVICE "com.sun.star.sheet.SheetCellRanges"
869 : #define SCSHEETCELLRANGE_SERVICE "com.sun.star.sheet.SheetCellRange"
870 : #define SCSPREADSHEET_SERVICE "com.sun.star.sheet.Spreadsheet"
871 : #define SCSHEETCELL_SERVICE "com.sun.star.sheet.SheetCell"
872 :
873 0 : SC_SIMPLE_SERVICE_INFO( ScCellFormatsEnumeration, "ScCellFormatsEnumeration", "com.sun.star.sheet.CellFormatRangesEnumeration" )
874 0 : SC_SIMPLE_SERVICE_INFO( ScCellFormatsObj, "ScCellFormatsObj", "com.sun.star.sheet.CellFormatRanges" )
875 1 : SC_SIMPLE_SERVICE_INFO( ScUniqueCellFormatsEnumeration, "ScUniqueCellFormatsEnumeration", "com.sun.star.sheet.UniqueCellFormatRangesEnumeration" )
876 1 : SC_SIMPLE_SERVICE_INFO( ScUniqueCellFormatsObj, "ScUniqueCellFormatsObj", "com.sun.star.sheet.UniqueCellFormatRanges" )
877 0 : SC_SIMPLE_SERVICE_INFO( ScCellRangesBase, "ScCellRangesBase", "stardiv.unknown" )
878 0 : SC_SIMPLE_SERVICE_INFO( ScCellsEnumeration, "ScCellsEnumeration", "com.sun.star.sheet.CellsEnumeration" )
879 0 : SC_SIMPLE_SERVICE_INFO( ScCellsObj, "ScCellsObj", "com.sun.star.sheet.Cells" )
880 0 : SC_SIMPLE_SERVICE_INFO( ScTableColumnObj, "ScTableColumnObj", "com.sun.star.table.TableColumn" )
881 0 : SC_SIMPLE_SERVICE_INFO( ScTableRowObj, "ScTableRowObj", "com.sun.star.table.TableRow" )
882 :
883 : //------------------------------------------------------------------------
884 :
885 : //! ScLinkListener in anderes File verschieben !!!
886 :
887 6008 : ScLinkListener::~ScLinkListener()
888 : {
889 6008 : }
890 :
891 255 : void ScLinkListener::Notify( SvtBroadcaster&, const SfxHint& rHint )
892 : {
893 255 : aLink.Call( (SfxHint*)&rHint );
894 255 : }
895 :
896 : //------------------------------------------------------------------------
897 :
898 1 : static void lcl_CopyProperties( beans::XPropertySet& rDest, beans::XPropertySet& rSource )
899 : {
900 1 : uno::Reference<beans::XPropertySetInfo> xInfo(rSource.getPropertySetInfo());
901 1 : if (xInfo.is())
902 : {
903 1 : uno::Sequence<beans::Property> aSeq(xInfo->getProperties());
904 1 : const beans::Property* pAry = aSeq.getConstArray();
905 1 : sal_uLong nCount = aSeq.getLength();
906 10 : for (sal_uLong i=0; i<nCount; i++)
907 : {
908 9 : OUString aName(pAry[i].Name);
909 9 : rDest.setPropertyValue( aName, rSource.getPropertyValue( aName ) );
910 10 : }
911 1 : }
912 1 : }
913 :
914 57 : static SCTAB lcl_FirstTab( const ScRangeList& rRanges )
915 : {
916 : OSL_ENSURE(rRanges.size() >= 1, "was fuer Ranges ?!?!");
917 57 : const ScRange* pFirst = rRanges[ 0 ];
918 57 : if (pFirst)
919 57 : return pFirst->aStart.Tab();
920 :
921 0 : return 0; // soll nicht sein
922 : }
923 :
924 71 : static sal_Bool lcl_WholeSheet( const ScRangeList& rRanges )
925 : {
926 71 : if ( rRanges.size() == 1 )
927 : {
928 64 : const ScRange* pRange = rRanges[0];
929 140 : if ( pRange && pRange->aStart.Col() == 0 && pRange->aEnd.Col() == MAXCOL &&
930 88 : pRange->aStart.Row() == 0 && pRange->aEnd.Row() == MAXROW )
931 12 : return sal_True;
932 : }
933 59 : return false;
934 : }
935 :
936 : //------------------------------------------------------------------------
937 :
938 4 : static ScSubTotalFunc lcl_SummaryToSubTotal( sheet::GeneralFunction eSummary )
939 : {
940 : ScSubTotalFunc eSubTotal;
941 4 : switch (eSummary)
942 : {
943 : case sheet::GeneralFunction_SUM:
944 2 : eSubTotal = SUBTOTAL_FUNC_SUM;
945 2 : break;
946 : case sheet::GeneralFunction_COUNT:
947 2 : eSubTotal = SUBTOTAL_FUNC_CNT2;
948 2 : break;
949 : case sheet::GeneralFunction_AVERAGE:
950 0 : eSubTotal = SUBTOTAL_FUNC_AVE;
951 0 : break;
952 : case sheet::GeneralFunction_MAX:
953 0 : eSubTotal = SUBTOTAL_FUNC_MAX;
954 0 : break;
955 : case sheet::GeneralFunction_MIN:
956 0 : eSubTotal = SUBTOTAL_FUNC_MIN;
957 0 : break;
958 : case sheet::GeneralFunction_PRODUCT:
959 0 : eSubTotal = SUBTOTAL_FUNC_PROD;
960 0 : break;
961 : case sheet::GeneralFunction_COUNTNUMS:
962 0 : eSubTotal = SUBTOTAL_FUNC_CNT;
963 0 : break;
964 : case sheet::GeneralFunction_STDEV:
965 0 : eSubTotal = SUBTOTAL_FUNC_STD;
966 0 : break;
967 : case sheet::GeneralFunction_STDEVP:
968 0 : eSubTotal = SUBTOTAL_FUNC_STDP;
969 0 : break;
970 : case sheet::GeneralFunction_VAR:
971 0 : eSubTotal = SUBTOTAL_FUNC_VAR;
972 0 : break;
973 : case sheet::GeneralFunction_VARP:
974 0 : eSubTotal = SUBTOTAL_FUNC_VARP;
975 0 : break;
976 :
977 : case sheet::GeneralFunction_NONE:
978 : case sheet::GeneralFunction_AUTO:
979 : default:
980 0 : eSubTotal = SUBTOTAL_FUNC_NONE;
981 0 : break;
982 : }
983 4 : return eSubTotal;
984 : }
985 :
986 : //------------------------------------------------------------------------
987 :
988 : namespace {
989 : template<typename BorderLineType>
990 36 : const ::editeng::SvxBorderLine* lcl_getBorderLine(
991 : ::editeng::SvxBorderLine& rLine, const BorderLineType& rStruct )
992 : {
993 : // Convert from 1/100mm to Twips.
994 36 : if (!SvxBoxItem::LineToSvxLine( rStruct, rLine, true))
995 36 : return NULL;
996 :
997 0 : if ( rLine.GetOutWidth() || rLine.GetInWidth() || rLine.GetDistance() )
998 0 : return &rLine;
999 : else
1000 0 : return NULL;
1001 : }
1002 : }
1003 :
1004 36 : const ::editeng::SvxBorderLine* ScHelperFunctions::GetBorderLine(
1005 : ::editeng::SvxBorderLine& rLine, const table::BorderLine& rStruct )
1006 : {
1007 36 : return lcl_getBorderLine( rLine, rStruct);
1008 : }
1009 :
1010 0 : const ::editeng::SvxBorderLine* ScHelperFunctions::GetBorderLine(
1011 : ::editeng::SvxBorderLine& rLine, const table::BorderLine2& rStruct )
1012 : {
1013 0 : return lcl_getBorderLine( rLine, rStruct);
1014 : }
1015 :
1016 :
1017 : namespace {
1018 : template<typename TableBorderType>
1019 6 : void lcl_fillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const TableBorderType& rBorder )
1020 : {
1021 6 : ::editeng::SvxBorderLine aLine;
1022 6 : rOuter.SetDistance( (sal_uInt16)HMMToTwips( rBorder.Distance ) );
1023 6 : rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.TopLine ), BOX_LINE_TOP );
1024 6 : rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.BottomLine ), BOX_LINE_BOTTOM );
1025 6 : rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.LeftLine ), BOX_LINE_LEFT );
1026 6 : rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.RightLine ), BOX_LINE_RIGHT );
1027 6 : rInner.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.HorizontalLine ), BOXINFO_LINE_HORI );
1028 6 : rInner.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.VerticalLine ), BOXINFO_LINE_VERT );
1029 6 : rInner.SetValid( VALID_TOP, rBorder.IsTopLineValid );
1030 6 : rInner.SetValid( VALID_BOTTOM, rBorder.IsBottomLineValid );
1031 6 : rInner.SetValid( VALID_LEFT, rBorder.IsLeftLineValid );
1032 6 : rInner.SetValid( VALID_RIGHT, rBorder.IsRightLineValid );
1033 6 : rInner.SetValid( VALID_HORI, rBorder.IsHorizontalLineValid );
1034 6 : rInner.SetValid( VALID_VERT, rBorder.IsVerticalLineValid );
1035 6 : rInner.SetValid( VALID_DISTANCE, rBorder.IsDistanceValid );
1036 6 : rInner.SetTable( sal_True );
1037 6 : }
1038 : }
1039 :
1040 6 : void ScHelperFunctions::FillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const table::TableBorder& rBorder )
1041 : {
1042 6 : lcl_fillBoxItems( rOuter, rInner, rBorder);
1043 6 : }
1044 :
1045 0 : void ScHelperFunctions::FillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const table::TableBorder2& rBorder )
1046 : {
1047 0 : lcl_fillBoxItems( rOuter, rInner, rBorder);
1048 0 : }
1049 :
1050 :
1051 186 : void ScHelperFunctions::FillBorderLine( table::BorderLine& rStruct, const ::editeng::SvxBorderLine* pLine )
1052 : {
1053 : // Convert from Twips to 1/100mm.
1054 186 : table::BorderLine2 aStruct( SvxBoxItem::SvxLineToLine( pLine, true));
1055 186 : rStruct = aStruct;
1056 186 : }
1057 :
1058 90 : void ScHelperFunctions::FillBorderLine( table::BorderLine2& rStruct, const ::editeng::SvxBorderLine* pLine )
1059 : {
1060 90 : rStruct = SvxBoxItem::SvxLineToLine( pLine, true);
1061 90 : }
1062 :
1063 :
1064 : namespace {
1065 : template<typename TableBorderItem>
1066 46 : void lcl_fillTableBorder( TableBorderItem& rBorder, const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner,
1067 : bool bInvalidateHorVerDist )
1068 : {
1069 46 : ScHelperFunctions::FillBorderLine( rBorder.TopLine, rOuter.GetTop() );
1070 46 : ScHelperFunctions::FillBorderLine( rBorder.BottomLine, rOuter.GetBottom() );
1071 46 : ScHelperFunctions::FillBorderLine( rBorder.LeftLine, rOuter.GetLeft() );
1072 46 : ScHelperFunctions::FillBorderLine( rBorder.RightLine, rOuter.GetRight() );
1073 46 : ScHelperFunctions::FillBorderLine( rBorder.HorizontalLine, rInner.GetHori() );
1074 46 : ScHelperFunctions::FillBorderLine( rBorder.VerticalLine, rInner.GetVert() );
1075 :
1076 46 : rBorder.Distance = rOuter.GetDistance();
1077 46 : rBorder.IsTopLineValid = rInner.IsValid(VALID_TOP);
1078 46 : rBorder.IsBottomLineValid = rInner.IsValid(VALID_BOTTOM);
1079 46 : rBorder.IsLeftLineValid = rInner.IsValid(VALID_LEFT);
1080 46 : rBorder.IsRightLineValid = rInner.IsValid(VALID_RIGHT);
1081 46 : rBorder.IsHorizontalLineValid = !bInvalidateHorVerDist && rInner.IsValid(VALID_HORI);
1082 46 : rBorder.IsVerticalLineValid = !bInvalidateHorVerDist && rInner.IsValid(VALID_VERT);
1083 46 : rBorder.IsDistanceValid = !bInvalidateHorVerDist && rInner.IsValid(VALID_DISTANCE);
1084 46 : }
1085 : }
1086 :
1087 31 : void ScHelperFunctions::AssignTableBorderToAny( uno::Any& rAny,
1088 : const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner, bool bInvalidateHorVerDist )
1089 : {
1090 31 : table::TableBorder aBorder;
1091 31 : lcl_fillTableBorder( aBorder, rOuter, rInner, bInvalidateHorVerDist);
1092 31 : rAny <<= aBorder;
1093 31 : }
1094 :
1095 15 : void ScHelperFunctions::AssignTableBorder2ToAny( uno::Any& rAny,
1096 : const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner, bool bInvalidateHorVerDist )
1097 : {
1098 15 : table::TableBorder2 aBorder;
1099 15 : lcl_fillTableBorder( aBorder, rOuter, rInner, bInvalidateHorVerDist);
1100 15 : rAny <<= aBorder;
1101 15 : }
1102 :
1103 : //------------------------------------------------------------------------
1104 :
1105 : //! lcl_ApplyBorder nach docfunc verschieben!
1106 :
1107 4 : void ScHelperFunctions::ApplyBorder( ScDocShell* pDocShell, const ScRangeList& rRanges,
1108 : const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner )
1109 : {
1110 4 : ScDocument* pDoc = pDocShell->GetDocument();
1111 4 : sal_Bool bUndo(pDoc->IsUndoEnabled());
1112 4 : ScDocument* pUndoDoc = NULL;
1113 4 : if (bUndo)
1114 4 : pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
1115 4 : size_t nCount = rRanges.size();
1116 8 : for (size_t i = 0; i < nCount; ++i)
1117 : {
1118 4 : ScRange aRange( *rRanges[ i ] );
1119 4 : SCTAB nTab = aRange.aStart.Tab();
1120 :
1121 4 : if (bUndo)
1122 : {
1123 4 : if ( i==0 )
1124 4 : pUndoDoc->InitUndo( pDoc, nTab, nTab );
1125 : else
1126 0 : pUndoDoc->AddUndoTab( nTab, nTab );
1127 4 : pDoc->CopyToDocument( aRange, IDF_ATTRIB, false, pUndoDoc );
1128 : }
1129 :
1130 4 : ScMarkData aMark;
1131 4 : aMark.SetMarkArea( aRange );
1132 4 : aMark.SelectTable( nTab, sal_True );
1133 :
1134 4 : pDoc->ApplySelectionFrame( aMark, &rOuter, &rInner );
1135 : // RowHeight bei Umrandung alleine nicht noetig
1136 4 : }
1137 :
1138 4 : if (bUndo)
1139 : {
1140 4 : pDocShell->GetUndoManager()->AddUndoAction(
1141 4 : new ScUndoBorder( pDocShell, rRanges, pUndoDoc, rOuter, rInner ) );
1142 : }
1143 :
1144 8 : for (size_t i = 0; i < nCount; ++i )
1145 4 : pDocShell->PostPaint( *rRanges[ i ], PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
1146 :
1147 4 : pDocShell->SetDocumentModified();
1148 4 : }
1149 :
1150 : //! move lcl_PutDataArray to docfunc?
1151 : //! merge loop with ScFunctionAccess::callFunction
1152 :
1153 8 : static sal_Bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
1154 : const uno::Sequence< uno::Sequence<uno::Any> >& aData )
1155 : {
1156 8 : ScDocument* pDoc = rDocShell.GetDocument();
1157 8 : SCTAB nTab = rRange.aStart.Tab();
1158 8 : SCCOL nStartCol = rRange.aStart.Col();
1159 8 : SCROW nStartRow = rRange.aStart.Row();
1160 8 : SCCOL nEndCol = rRange.aEnd.Col();
1161 8 : SCROW nEndRow = rRange.aEnd.Row();
1162 8 : sal_Bool bUndo(pDoc->IsUndoEnabled());
1163 :
1164 8 : if ( !pDoc->IsBlockEditable( nTab, nStartCol,nStartRow, nEndCol,nEndRow ) )
1165 : {
1166 : //! error message
1167 0 : return false;
1168 : }
1169 :
1170 8 : long nCols = 0;
1171 8 : long nRows = aData.getLength();
1172 8 : const uno::Sequence<uno::Any>* pArray = aData.getConstArray();
1173 8 : if ( nRows )
1174 8 : nCols = pArray[0].getLength();
1175 :
1176 8 : if ( nCols != nEndCol-nStartCol+1 || nRows != nEndRow-nStartRow+1 )
1177 : {
1178 : //! error message?
1179 0 : return false;
1180 : }
1181 :
1182 8 : ScDocument* pUndoDoc = NULL;
1183 8 : if ( bUndo )
1184 : {
1185 8 : pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
1186 8 : pUndoDoc->InitUndo( pDoc, nTab, nTab );
1187 8 : pDoc->CopyToDocument( rRange, IDF_CONTENTS|IDF_NOCAPTIONS, false, pUndoDoc );
1188 : }
1189 :
1190 8 : pDoc->DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS );
1191 :
1192 8 : sal_Bool bError = false;
1193 8 : SCROW nDocRow = nStartRow;
1194 416 : for (long nRow=0; nRow<nRows; nRow++)
1195 : {
1196 408 : const uno::Sequence<uno::Any>& rColSeq = pArray[nRow];
1197 408 : if ( rColSeq.getLength() == nCols )
1198 : {
1199 408 : SCCOL nDocCol = nStartCol;
1200 408 : const uno::Any* pColArr = rColSeq.getConstArray();
1201 20440 : for (long nCol=0; nCol<nCols; nCol++)
1202 : {
1203 20032 : ScAddress aPos(nDocCol, nDocRow, nTab);
1204 :
1205 20032 : const uno::Any& rElement = pColArr[nCol];
1206 20032 : switch( rElement.getValueTypeClass() )
1207 : {
1208 : case uno::TypeClass_VOID:
1209 : {
1210 : // void = "no value"
1211 0 : pDoc->SetError( nDocCol, nDocRow, nTab, NOTAVAILABLE );
1212 : }
1213 0 : break;
1214 :
1215 : // #87871# accept integer types because Basic passes a floating point
1216 : // variable as byte, short or long if it's an integer number.
1217 : case uno::TypeClass_BYTE:
1218 : case uno::TypeClass_SHORT:
1219 : case uno::TypeClass_UNSIGNED_SHORT:
1220 : case uno::TypeClass_LONG:
1221 : case uno::TypeClass_UNSIGNED_LONG:
1222 : case uno::TypeClass_FLOAT:
1223 : case uno::TypeClass_DOUBLE:
1224 : {
1225 20032 : double fVal(0.0);
1226 20032 : rElement >>= fVal;
1227 20032 : pDoc->SetValue(aPos, fVal);
1228 : }
1229 20032 : break;
1230 :
1231 : case uno::TypeClass_STRING:
1232 : {
1233 0 : OUString aUStr;
1234 0 : rElement >>= aUStr;
1235 0 : if ( !aUStr.isEmpty() )
1236 : {
1237 0 : ScSetStringParam aParam;
1238 0 : aParam.setTextInput();
1239 0 : pDoc->SetString(aPos, aUStr, &aParam);
1240 0 : }
1241 : }
1242 0 : break;
1243 :
1244 : // accept Sequence<FormulaToken> for formula cells
1245 : case uno::TypeClass_SEQUENCE:
1246 : {
1247 0 : uno::Sequence< sheet::FormulaToken > aTokens;
1248 0 : if ( rElement >>= aTokens )
1249 : {
1250 0 : ScTokenArray aTokenArray;
1251 0 : ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, aTokens );
1252 0 : pDoc->SetFormula(aPos, aTokenArray);
1253 : }
1254 : else
1255 0 : bError = true;
1256 : }
1257 0 : break;
1258 :
1259 : default:
1260 0 : bError = true; // invalid type
1261 : }
1262 20032 : ++nDocCol;
1263 : }
1264 : }
1265 : else
1266 0 : bError = sal_True; // wrong size
1267 :
1268 408 : ++nDocRow;
1269 : }
1270 :
1271 8 : sal_Bool bHeight = rDocShell.AdjustRowHeight( nStartRow, nEndRow, nTab );
1272 :
1273 8 : if ( pUndoDoc )
1274 : {
1275 8 : ScMarkData aDestMark;
1276 8 : aDestMark.SelectOneTable( nTab );
1277 8 : rDocShell.GetUndoManager()->AddUndoAction(
1278 : new ScUndoPaste(
1279 : &rDocShell, ScRange(nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab),
1280 8 : aDestMark, pUndoDoc, NULL, IDF_CONTENTS, NULL, false));
1281 : }
1282 :
1283 8 : if (!bHeight)
1284 1 : rDocShell.PostPaint( rRange, PAINT_GRID ); // AdjustRowHeight may have painted already
1285 :
1286 8 : rDocShell.SetDocumentModified();
1287 :
1288 8 : return !bError;
1289 : }
1290 :
1291 2 : static sal_Bool lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange,
1292 : const uno::Sequence< uno::Sequence<OUString> >& aData,
1293 : const formula::FormulaGrammar::Grammar eGrammar )
1294 : {
1295 2 : ScDocument* pDoc = rDocShell.GetDocument();
1296 2 : SCTAB nTab = rRange.aStart.Tab();
1297 2 : SCCOL nStartCol = rRange.aStart.Col();
1298 2 : SCROW nStartRow = rRange.aStart.Row();
1299 2 : SCCOL nEndCol = rRange.aEnd.Col();
1300 2 : SCROW nEndRow = rRange.aEnd.Row();
1301 2 : sal_Bool bUndo(pDoc->IsUndoEnabled());
1302 :
1303 2 : if ( !pDoc->IsBlockEditable( nTab, nStartCol,nStartRow, nEndCol,nEndRow ) )
1304 : {
1305 : //! error message
1306 0 : return false;
1307 : }
1308 :
1309 2 : long nCols = 0;
1310 2 : long nRows = aData.getLength();
1311 2 : const uno::Sequence<OUString>* pArray = aData.getConstArray();
1312 2 : if ( nRows )
1313 2 : nCols = pArray[0].getLength();
1314 :
1315 2 : if ( nCols != nEndCol-nStartCol+1 || nRows != nEndRow-nStartRow+1 )
1316 : {
1317 : //! error message?
1318 0 : return false;
1319 : }
1320 :
1321 2 : ScDocument* pUndoDoc = NULL;
1322 2 : if ( bUndo )
1323 : {
1324 2 : pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
1325 2 : pUndoDoc->InitUndo( pDoc, nTab, nTab );
1326 2 : pDoc->CopyToDocument( rRange, IDF_CONTENTS, false, pUndoDoc );
1327 : }
1328 :
1329 2 : pDoc->DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS );
1330 :
1331 2 : bool bError = false;
1332 2 : SCROW nDocRow = nStartRow;
1333 12 : for (long nRow=0; nRow<nRows; nRow++)
1334 : {
1335 10 : const uno::Sequence<OUString>& rColSeq = pArray[nRow];
1336 10 : if ( rColSeq.getLength() == nCols )
1337 : {
1338 10 : SCCOL nDocCol = nStartCol;
1339 10 : const OUString* pColArr = rColSeq.getConstArray();
1340 50 : for (long nCol=0; nCol<nCols; nCol++)
1341 : {
1342 40 : String aText(pColArr[nCol]);
1343 40 : ScAddress aPos( nDocCol, nDocRow, nTab );
1344 :
1345 : ScInputStringType aRes =
1346 : ScStringUtil::parseInputString(
1347 80 : *pDoc->GetFormatTable(), aText, LANGUAGE_ENGLISH_US);
1348 40 : switch (aRes.meType)
1349 : {
1350 : case ScInputStringType::Formula:
1351 0 : pDoc->SetFormula(aPos, aRes.maText, eGrammar);
1352 0 : break;
1353 : case ScInputStringType::Number:
1354 0 : pDoc->SetValue(aPos, aRes.mfValue);
1355 0 : break;
1356 : case ScInputStringType::Text:
1357 1 : pDoc->SetTextCell(aPos, aRes.maText);
1358 1 : break;
1359 : default:
1360 : ;
1361 : }
1362 :
1363 40 : ++nDocCol;
1364 40 : }
1365 : }
1366 : else
1367 0 : bError = true; // wrong size
1368 :
1369 10 : ++nDocRow;
1370 : }
1371 :
1372 2 : sal_Bool bHeight = rDocShell.AdjustRowHeight( nStartRow, nEndRow, nTab );
1373 :
1374 2 : if ( pUndoDoc )
1375 : {
1376 2 : ScMarkData aDestMark;
1377 2 : aDestMark.SelectOneTable( nTab );
1378 2 : rDocShell.GetUndoManager()->AddUndoAction(
1379 : new ScUndoPaste( &rDocShell,
1380 : ScRange(nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab), aDestMark,
1381 2 : pUndoDoc, NULL, IDF_CONTENTS, NULL, false));
1382 : }
1383 :
1384 2 : if (!bHeight)
1385 1 : rDocShell.PostPaint( rRange, PAINT_GRID ); // AdjustRowHeight may have painted already
1386 :
1387 2 : rDocShell.SetDocumentModified();
1388 :
1389 2 : return !bError;
1390 : }
1391 :
1392 : // used in ScCellRangeObj::getFormulaArray and ScCellObj::GetInputString_Impl
1393 226 : static OUString lcl_GetInputString( ScDocument* pDoc, const ScAddress& rPos, sal_Bool bEnglish )
1394 : {
1395 226 : if (!pDoc)
1396 0 : return EMPTY_OUSTRING;
1397 :
1398 226 : ScRefCellValue aCell;
1399 226 : aCell.assign(*pDoc, rPos);
1400 226 : if (aCell.isEmpty())
1401 111 : return EMPTY_OUSTRING;
1402 :
1403 230 : OUString aVal;
1404 :
1405 115 : CellType eType = aCell.meType;
1406 115 : if (eType == CELLTYPE_FORMULA)
1407 : {
1408 61 : ScFormulaCell* pForm = aCell.mpFormula;
1409 61 : pForm->GetFormula( aVal, formula::FormulaGrammar::mapAPItoGrammar( bEnglish, false));
1410 61 : return aVal;
1411 : }
1412 :
1413 : SvNumberFormatter* pFormatter = bEnglish ? ScGlobal::GetEnglishFormatter() :
1414 54 : pDoc->GetFormatTable();
1415 : // Since the English formatter was constructed with
1416 : // LANGUAGE_ENGLISH_US the "General" format has index key 0,
1417 : // we don't have to query.
1418 54 : sal_uInt32 nNumFmt = bEnglish ? 0 : pDoc->GetNumberFormat(rPos);
1419 :
1420 54 : if (eType == CELLTYPE_EDIT)
1421 : {
1422 : // GetString an der EditCell macht Leerzeichen aus Umbruechen,
1423 : // hier werden die Umbrueche aber gebraucht
1424 9 : const EditTextObject* pData = aCell.mpEditText;
1425 9 : if (pData)
1426 : {
1427 9 : EditEngine& rEngine = pDoc->GetEditEngine();
1428 9 : rEngine.SetText(*pData);
1429 9 : aVal = rEngine.GetText(LINEEND_LF);
1430 : }
1431 : }
1432 : else
1433 45 : ScCellFormat::GetInputString(aCell, nNumFmt, aVal, *pFormatter);
1434 :
1435 : // ggf. ein ' davorhaengen wie in ScTabViewShell::UpdateInputHandler
1436 54 : if ( eType == CELLTYPE_STRING || eType == CELLTYPE_EDIT )
1437 : {
1438 : double fDummy;
1439 24 : String aTempString = aVal;
1440 24 : sal_Bool bIsNumberFormat(pFormatter->IsNumberFormat(aTempString, nNumFmt, fDummy));
1441 24 : if ( bIsNumberFormat )
1442 0 : aTempString.Insert('\'',0);
1443 24 : else if ( aTempString.Len() && aTempString.GetChar(0) == '\'' )
1444 : {
1445 : // if the string starts with a "'", add another one because setFormula
1446 : // strips one (like text input, except for "text" number formats)
1447 0 : if ( bEnglish || ( pFormatter->GetType(nNumFmt) != NUMBERFORMAT_TEXT ) )
1448 0 : aTempString.Insert('\'',0);
1449 : }
1450 24 : aVal = aTempString;
1451 : }
1452 280 : return aVal;
1453 : }
1454 :
1455 : //------------------------------------------------------------------------
1456 :
1457 21171 : ScCellRangesBase::ScCellRangesBase(ScDocShell* pDocSh, const ScRange& rR) :
1458 21171 : pPropSet(lcl_GetCellsPropertySet()),
1459 : pDocShell( pDocSh ),
1460 : pValueListener( NULL ),
1461 : pCurrentFlat( NULL ),
1462 : pCurrentDeep( NULL ),
1463 : pCurrentDataSet( NULL ),
1464 : pNoDfltCurrentDataSet( NULL ),
1465 : pMarkData( NULL ),
1466 : nObjectId( 0 ),
1467 : bChartColAsHdr( false ),
1468 : bChartRowAsHdr( false ),
1469 : bCursorOnly( false ),
1470 : bGotDataChangedHint( false ),
1471 42342 : aValueListeners( 0 )
1472 : {
1473 21171 : ScRange aCellRange(rR);
1474 21171 : aCellRange.Justify();
1475 21171 : aRanges.Append( aCellRange );
1476 :
1477 21171 : if (pDocShell) // Null if created with createInstance
1478 : {
1479 21170 : ScDocument* pDoc = pDocShell->GetDocument();
1480 21170 : pDoc->AddUnoObject(*this);
1481 21170 : nObjectId = pDoc->GetNewUnoId();
1482 : }
1483 21171 : }
1484 :
1485 743 : ScCellRangesBase::ScCellRangesBase(ScDocShell* pDocSh, const ScRangeList& rR) :
1486 743 : pPropSet(lcl_GetCellsPropertySet()),
1487 : pDocShell( pDocSh ),
1488 : pValueListener( NULL ),
1489 : pCurrentFlat( NULL ),
1490 : pCurrentDeep( NULL ),
1491 : pCurrentDataSet( NULL ),
1492 : pNoDfltCurrentDataSet( NULL ),
1493 : pMarkData( NULL ),
1494 : aRanges( rR ),
1495 : nObjectId( 0 ),
1496 : bChartColAsHdr( false ),
1497 : bChartRowAsHdr( false ),
1498 : bCursorOnly( false ),
1499 : bGotDataChangedHint( false ),
1500 1486 : aValueListeners( 0 )
1501 : {
1502 743 : if (pDocShell) // Null if created with createInstance
1503 : {
1504 743 : ScDocument* pDoc = pDocShell->GetDocument();
1505 743 : pDoc->AddUnoObject(*this);
1506 743 : nObjectId = pDoc->GetNewUnoId();
1507 : }
1508 743 : }
1509 :
1510 43596 : ScCellRangesBase::~ScCellRangesBase()
1511 : {
1512 : // call RemoveUnoObject first, so no notification can happen
1513 : // during ForgetCurrentAttrs
1514 :
1515 21798 : if (pDocShell)
1516 18106 : pDocShell->GetDocument()->RemoveUnoObject(*this);
1517 :
1518 21798 : ForgetCurrentAttrs();
1519 21798 : ForgetMarkData();
1520 :
1521 21798 : delete pValueListener;
1522 :
1523 : //! XChartDataChangeEventListener abmelden ??
1524 : //! (ChartCollection haelt dann auch dieses Objekt fest!)
1525 21798 : }
1526 :
1527 205731 : void ScCellRangesBase::ForgetCurrentAttrs()
1528 : {
1529 205731 : delete pCurrentFlat;
1530 205731 : delete pCurrentDeep;
1531 205731 : delete pCurrentDataSet;
1532 205731 : delete pNoDfltCurrentDataSet;
1533 205731 : pCurrentFlat = NULL;
1534 205731 : pCurrentDeep = NULL;
1535 205731 : pCurrentDataSet = NULL;
1536 205731 : pNoDfltCurrentDataSet = NULL;
1537 :
1538 : // #i62483# pMarkData can remain unchanged, is deleted only if the range changes (RefChanged)
1539 205731 : }
1540 :
1541 26394 : void ScCellRangesBase::ForgetMarkData()
1542 : {
1543 26394 : delete pMarkData;
1544 26394 : pMarkData = NULL;
1545 26394 : }
1546 :
1547 3275 : const ScPatternAttr* ScCellRangesBase::GetCurrentAttrsFlat()
1548 : {
1549 : // get and cache direct cell attributes for this object's range
1550 :
1551 3275 : if ( !pCurrentFlat && pDocShell )
1552 : {
1553 111 : ScDocument* pDoc = pDocShell->GetDocument();
1554 111 : pCurrentFlat = pDoc->CreateSelectionPattern( *GetMarkData(), false );
1555 : }
1556 3275 : return pCurrentFlat;
1557 : }
1558 :
1559 5965 : const ScPatternAttr* ScCellRangesBase::GetCurrentAttrsDeep()
1560 : {
1561 : // get and cache cell attributes (incl. styles) for this object's range
1562 :
1563 5965 : if ( !pCurrentDeep && pDocShell )
1564 : {
1565 5512 : ScDocument* pDoc = pDocShell->GetDocument();
1566 5512 : pCurrentDeep = pDoc->CreateSelectionPattern( *GetMarkData(), sal_True );
1567 : }
1568 5965 : return pCurrentDeep;
1569 : }
1570 :
1571 9204 : SfxItemSet* ScCellRangesBase::GetCurrentDataSet(bool bNoDflt)
1572 : {
1573 9204 : if(!pCurrentDataSet)
1574 : {
1575 5248 : const ScPatternAttr* pPattern = GetCurrentAttrsDeep();
1576 5248 : if ( pPattern )
1577 : {
1578 : // Dontcare durch Default ersetzen, damit man immer eine Reflection hat
1579 5248 : pCurrentDataSet = new SfxItemSet( pPattern->GetItemSet() );
1580 5248 : pNoDfltCurrentDataSet = new SfxItemSet( pPattern->GetItemSet() );
1581 5248 : pCurrentDataSet->ClearInvalidItems();
1582 : }
1583 : }
1584 9204 : return bNoDflt ? pNoDfltCurrentDataSet : pCurrentDataSet;
1585 : }
1586 :
1587 7026 : const ScMarkData* ScCellRangesBase::GetMarkData()
1588 : {
1589 7026 : if (!pMarkData)
1590 : {
1591 5503 : pMarkData = new ScMarkData();
1592 5503 : pMarkData->MarkFromRangeList( aRanges, false );
1593 : }
1594 7026 : return pMarkData;
1595 : }
1596 :
1597 184436 : void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint )
1598 : {
1599 184436 : if ( rHint.ISA( ScUpdateRefHint ) )
1600 : {
1601 3043 : const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint;
1602 :
1603 3043 : ScDocument* pDoc = pDocShell->GetDocument();
1604 3043 : ScRangeList* pUndoRanges = NULL;
1605 3043 : if ( pDoc->HasUnoRefUndo() )
1606 1765 : pUndoRanges = new ScRangeList( aRanges );
1607 :
1608 6086 : if ( aRanges.UpdateReference( rRef.GetMode(), pDoc, rRef.GetRange(),
1609 6086 : rRef.GetDx(), rRef.GetDy(), rRef.GetDz() ) )
1610 : {
1611 : // i#90076; the object "this" was destroyed after calling ScTableSheetObj::getImplementation
1612 : // this hack make sure that the object lives a bit longer
1613 2862 : uno::Reference<uno::XInterface> xInterface((cppu::OWeakObject*)this, uno::UNO_QUERY);
1614 8621 : if ( rRef.GetMode() == URM_INSDEL
1615 2861 : && aRanges.size() == 1
1616 14240 : && ScTableSheetObj::getImplementation( xInterface )
1617 : )
1618 : {
1619 : // #101755#; the range size of a sheet does not change
1620 315 : ScRange* pR = aRanges.front();
1621 315 : if (pR)
1622 : {
1623 315 : pR->aStart.SetCol(0);
1624 315 : pR->aStart.SetRow(0);
1625 315 : pR->aEnd.SetCol(MAXCOL);
1626 315 : pR->aEnd.SetRow(MAXROW);
1627 : }
1628 : }
1629 2862 : RefChanged();
1630 :
1631 : // any change of the range address is broadcast to value (modify) listeners
1632 2862 : if ( !aValueListeners.empty() )
1633 0 : bGotDataChangedHint = sal_True;
1634 :
1635 2862 : if ( pUndoRanges )
1636 1638 : pDoc->AddUnoRefChange( nObjectId, *pUndoRanges );
1637 : }
1638 :
1639 3043 : delete pUndoRanges;
1640 : }
1641 181393 : else if ( rHint.ISA( SfxSimpleHint ) )
1642 : {
1643 179700 : sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId();
1644 179700 : if ( nId == SFX_HINT_DYING )
1645 : {
1646 3807 : ForgetCurrentAttrs();
1647 3807 : pDocShell = NULL; // invalid
1648 :
1649 3807 : if ( !aValueListeners.empty() )
1650 : {
1651 : // dispose listeners
1652 :
1653 4 : lang::EventObject aEvent;
1654 4 : aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
1655 8 : for ( sal_uInt16 n=0; n<aValueListeners.size(); n++ )
1656 4 : aValueListeners[n]->disposing( aEvent );
1657 :
1658 4 : aValueListeners.clear();
1659 :
1660 : // The listeners can't have the last ref to this, as it's still held
1661 : // by the DocShell.
1662 : }
1663 : }
1664 175893 : else if ( nId == SFX_HINT_DATACHANGED )
1665 : {
1666 : // document content changed -> forget cached attributes
1667 175530 : ForgetCurrentAttrs();
1668 :
1669 175530 : if ( bGotDataChangedHint && pDocShell )
1670 : {
1671 : // This object was notified of content changes, so one call
1672 : // for each listener is generated now.
1673 : // The calls can't be executed directly because the document's
1674 : // UNO broadcaster list must not be modified.
1675 : // Instead, add to the document's list of listener calls,
1676 : // which will be executed directly after the broadcast of
1677 : // SFX_HINT_DATACHANGED.
1678 :
1679 0 : lang::EventObject aEvent;
1680 0 : aEvent.Source.set((cppu::OWeakObject*)this);
1681 :
1682 : // the EventObject holds a Ref to this object until after the listener calls
1683 :
1684 0 : ScDocument* pDoc = pDocShell->GetDocument();
1685 0 : for ( sal_uInt16 n=0; n<aValueListeners.size(); n++ )
1686 0 : pDoc->AddUnoListenerCall( aValueListeners[n], aEvent );
1687 :
1688 0 : bGotDataChangedHint = false;
1689 : }
1690 : }
1691 363 : else if ( nId == SC_HINT_CALCALL )
1692 : {
1693 : // broadcast from DoHardRecalc - set bGotDataChangedHint
1694 : // (SFX_HINT_DATACHANGED follows separately)
1695 :
1696 363 : if ( !aValueListeners.empty() )
1697 0 : bGotDataChangedHint = sal_True;
1698 : }
1699 : }
1700 1693 : else if ( rHint.ISA( ScUnoRefUndoHint ) )
1701 : {
1702 0 : const ScUnoRefUndoHint& rUndoHint = static_cast<const ScUnoRefUndoHint&>(rHint);
1703 0 : if ( rUndoHint.GetObjectId() == nObjectId )
1704 : {
1705 : // restore ranges from hint
1706 :
1707 0 : aRanges = rUndoHint.GetRanges();
1708 :
1709 0 : RefChanged();
1710 0 : if ( !aValueListeners.empty() )
1711 0 : bGotDataChangedHint = sal_True; // need to broadcast the undo, too
1712 : }
1713 : }
1714 184436 : }
1715 :
1716 4596 : void ScCellRangesBase::RefChanged()
1717 : {
1718 : //! adjust XChartDataChangeEventListener
1719 :
1720 4596 : if ( pValueListener && !aValueListeners.empty() )
1721 : {
1722 0 : pValueListener->EndListeningAll();
1723 :
1724 0 : ScDocument* pDoc = pDocShell->GetDocument();
1725 0 : for ( size_t i = 0, nCount = aRanges.size(); i < nCount; ++i )
1726 0 : pDoc->StartListeningArea( *aRanges[ i ], pValueListener );
1727 : }
1728 :
1729 4596 : ForgetCurrentAttrs();
1730 4596 : ForgetMarkData();
1731 4596 : }
1732 :
1733 0 : ScDocument* ScCellRangesBase::GetDocument() const
1734 : {
1735 0 : if (pDocShell)
1736 0 : return pDocShell->GetDocument();
1737 : else
1738 0 : return NULL;
1739 : }
1740 :
1741 0 : void ScCellRangesBase::InitInsertRange(ScDocShell* pDocSh, const ScRange& rR)
1742 : {
1743 0 : if ( !pDocShell && pDocSh )
1744 : {
1745 0 : pDocShell = pDocSh;
1746 :
1747 0 : ScRange aCellRange(rR);
1748 0 : aCellRange.Justify();
1749 0 : aRanges.RemoveAll();
1750 0 : aRanges.Append( aCellRange );
1751 :
1752 0 : pDocShell->GetDocument()->AddUnoObject(*this);
1753 :
1754 0 : RefChanged(); // Range im Range-Objekt anpassen
1755 : }
1756 0 : }
1757 :
1758 1464 : void ScCellRangesBase::AddRange(const ScRange& rRange, const sal_Bool bMergeRanges)
1759 : {
1760 1464 : if (bMergeRanges)
1761 0 : aRanges.Join(rRange);
1762 : else
1763 1464 : aRanges.Append(rRange);
1764 1464 : RefChanged();
1765 1464 : }
1766 :
1767 224 : void ScCellRangesBase::SetNewRange(const ScRange& rNew)
1768 : {
1769 224 : ScRange aCellRange(rNew);
1770 224 : aCellRange.Justify();
1771 :
1772 224 : aRanges.RemoveAll();
1773 224 : aRanges.Append( aCellRange );
1774 224 : RefChanged();
1775 224 : }
1776 :
1777 46 : void ScCellRangesBase::SetNewRanges(const ScRangeList& rNew)
1778 : {
1779 46 : aRanges = rNew;
1780 46 : RefChanged();
1781 46 : }
1782 :
1783 288 : void ScCellRangesBase::SetCursorOnly( sal_Bool bSet )
1784 : {
1785 : // set for a selection object that is created from the cursor position
1786 : // without anything selected (may contain several sheets)
1787 :
1788 288 : bCursorOnly = bSet;
1789 288 : }
1790 :
1791 34642 : uno::Any SAL_CALL ScCellRangesBase::queryInterface( const uno::Type& rType )
1792 : throw(uno::RuntimeException)
1793 : {
1794 34642 : SC_QUERYINTERFACE( beans::XPropertySet )
1795 24250 : SC_QUERYINTERFACE( beans::XMultiPropertySet )
1796 23942 : SC_QUERYINTERFACE( beans::XTolerantMultiPropertySet )
1797 23500 : SC_QUERYINTERFACE( beans::XPropertyState )
1798 23424 : SC_QUERYINTERFACE( sheet::XSheetOperation )
1799 23351 : SC_QUERYINTERFACE( chart::XChartDataArray )
1800 23348 : SC_QUERYINTERFACE( chart::XChartData )
1801 23347 : SC_QUERYINTERFACE( util::XIndent )
1802 23344 : SC_QUERYINTERFACE( sheet::XCellRangesQuery )
1803 23303 : SC_QUERYINTERFACE( sheet::XFormulaQuery )
1804 23300 : SC_QUERYINTERFACE( util::XReplaceable )
1805 23276 : SC_QUERYINTERFACE( util::XSearchable )
1806 23268 : SC_QUERYINTERFACE( util::XModifyBroadcaster )
1807 23262 : SC_QUERYINTERFACE( lang::XServiceInfo )
1808 23230 : SC_QUERYINTERFACE( lang::XUnoTunnel )
1809 8285 : SC_QUERYINTERFACE( lang::XTypeProvider )
1810 :
1811 8222 : return OWeakObject::queryInterface( rType );
1812 : }
1813 :
1814 201777 : void SAL_CALL ScCellRangesBase::acquire() throw()
1815 : {
1816 201777 : OWeakObject::acquire();
1817 201777 : }
1818 :
1819 201636 : void SAL_CALL ScCellRangesBase::release() throw()
1820 : {
1821 201636 : OWeakObject::release();
1822 201636 : }
1823 :
1824 2 : uno::Sequence<uno::Type> SAL_CALL ScCellRangesBase::getTypes() throw(uno::RuntimeException)
1825 : {
1826 2 : static uno::Sequence<uno::Type> aTypes;
1827 2 : if ( aTypes.getLength() == 0 )
1828 : {
1829 2 : aTypes.realloc(13);
1830 2 : uno::Type* pPtr = aTypes.getArray();
1831 2 : pPtr[0] = getCppuType((const uno::Reference<beans::XPropertySet>*)0);
1832 2 : pPtr[1] = getCppuType((const uno::Reference<beans::XMultiPropertySet>*)0);
1833 2 : pPtr[2] = getCppuType((const uno::Reference<beans::XPropertyState>*)0);
1834 2 : pPtr[3] = getCppuType((const uno::Reference<sheet::XSheetOperation>*)0);
1835 2 : pPtr[4] = getCppuType((const uno::Reference<chart::XChartDataArray>*)0);
1836 2 : pPtr[5] = getCppuType((const uno::Reference<util::XIndent>*)0);
1837 2 : pPtr[6] = getCppuType((const uno::Reference<sheet::XCellRangesQuery>*)0);
1838 2 : pPtr[7] = getCppuType((const uno::Reference<sheet::XFormulaQuery>*)0);
1839 2 : pPtr[8] = getCppuType((const uno::Reference<util::XReplaceable>*)0);
1840 2 : pPtr[9] = getCppuType((const uno::Reference<util::XModifyBroadcaster>*)0);
1841 2 : pPtr[10]= getCppuType((const uno::Reference<lang::XServiceInfo>*)0);
1842 2 : pPtr[11]= getCppuType((const uno::Reference<lang::XUnoTunnel>*)0);
1843 2 : pPtr[12]= getCppuType((const uno::Reference<lang::XTypeProvider>*)0);
1844 : }
1845 2 : return aTypes;
1846 : }
1847 :
1848 : namespace
1849 : {
1850 : class theScCellRangesBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theScCellRangesBaseImplementationId > {};
1851 : }
1852 :
1853 0 : uno::Sequence<sal_Int8> SAL_CALL ScCellRangesBase::getImplementationId()
1854 : throw(uno::RuntimeException)
1855 : {
1856 0 : return theScCellRangesBaseImplementationId::get().getSeq();
1857 : }
1858 :
1859 : // ---
1860 :
1861 8 : void ScCellRangesBase::PaintRanges_Impl( sal_uInt16 nPart )
1862 : {
1863 31 : for (size_t i = 0, nCount = aRanges.size(); i < nCount; ++i)
1864 23 : pDocShell->PostPaint( *aRanges[ i ], nPart );
1865 8 : }
1866 :
1867 : // XSheetOperation
1868 :
1869 4 : double SAL_CALL ScCellRangesBase::computeFunction( sheet::GeneralFunction nFunction )
1870 : throw(uno::Exception, uno::RuntimeException)
1871 : {
1872 4 : SolarMutexGuard aGuard;
1873 8 : ScMarkData aMark(*GetMarkData());
1874 4 : aMark.MarkToSimple();
1875 4 : if (!aMark.IsMarked())
1876 2 : aMark.SetMarkNegative(sal_True); // um Dummy Position angeben zu koennen
1877 :
1878 4 : ScAddress aDummy; // wenn nicht Marked, ignoriert wegen Negative
1879 : double fVal;
1880 4 : ScSubTotalFunc eFunc = lcl_SummaryToSubTotal( nFunction );
1881 4 : ScDocument* pDoc = pDocShell->GetDocument();
1882 4 : if ( !pDoc->GetSelectionFunction( eFunc, aDummy, aMark, fVal ) )
1883 : {
1884 0 : throw uno::RuntimeException(); //! own exception?
1885 : }
1886 :
1887 8 : return fVal;
1888 : }
1889 :
1890 73 : void SAL_CALL ScCellRangesBase::clearContents( sal_Int32 nContentFlags ) throw(uno::RuntimeException)
1891 : {
1892 73 : SolarMutexGuard aGuard;
1893 73 : if ( !aRanges.empty() )
1894 : {
1895 : // only for clearContents: EDITATTR is only used if no contents are deleted
1896 73 : sal_uInt16 nDelFlags = static_cast< sal_uInt16 >( nContentFlags & IDF_ALL );
1897 73 : if ( ( nContentFlags & IDF_EDITATTR ) && ( nContentFlags & IDF_CONTENTS ) == 0 )
1898 2 : nDelFlags |= IDF_EDITATTR;
1899 :
1900 73 : pDocShell->GetDocFunc().DeleteContents( *GetMarkData(), nDelFlags, sal_True, sal_True );
1901 73 : }
1902 : // sonst ist nichts zu tun
1903 73 : }
1904 :
1905 : // XPropertyState
1906 :
1907 863 : const SfxItemPropertyMap& ScCellRangesBase::GetItemPropertyMap()
1908 : {
1909 863 : return pPropSet->getPropertyMap();
1910 : }
1911 :
1912 3532 : static void lcl_GetPropertyWhich( const SfxItemPropertySimpleEntry* pEntry,
1913 : sal_uInt16& rItemWhich )
1914 : {
1915 : // Which-ID des betroffenen Items, auch wenn das Item die Property
1916 : // nicht alleine behandeln kann
1917 3532 : if ( pEntry )
1918 : {
1919 3532 : if ( IsScItemWid( pEntry->nWID ) )
1920 3109 : rItemWhich = pEntry->nWID;
1921 : else
1922 423 : switch ( pEntry->nWID )
1923 : {
1924 : case SC_WID_UNO_TBLBORD:
1925 : case SC_WID_UNO_TBLBORD2:
1926 30 : rItemWhich = ATTR_BORDER;
1927 30 : break;
1928 : case SC_WID_UNO_CONDFMT:
1929 : case SC_WID_UNO_CONDLOC:
1930 : case SC_WID_UNO_CONDXML:
1931 68 : rItemWhich = ATTR_CONDITIONAL;
1932 68 : break;
1933 : case SC_WID_UNO_VALIDAT:
1934 : case SC_WID_UNO_VALILOC:
1935 : case SC_WID_UNO_VALIXML:
1936 68 : rItemWhich = ATTR_VALIDDATA;
1937 68 : break;
1938 : }
1939 : }
1940 :
1941 3532 : }
1942 :
1943 3532 : beans::PropertyState ScCellRangesBase::GetOnePropertyState( sal_uInt16 nItemWhich, const SfxItemPropertySimpleEntry* pEntry )
1944 : {
1945 3532 : beans::PropertyState eRet = beans::PropertyState_DIRECT_VALUE;
1946 3532 : if ( nItemWhich ) // item wid (from map or special case)
1947 : {
1948 : // For items that contain several properties (like background),
1949 : // "ambiguous" is returned too often here
1950 :
1951 : // for PropertyState, don't look at styles
1952 3275 : const ScPatternAttr* pPattern = GetCurrentAttrsFlat();
1953 3275 : if ( pPattern )
1954 : {
1955 3275 : SfxItemState eState = pPattern->GetItemSet().GetItemState( nItemWhich, false );
1956 :
1957 3275 : if ( nItemWhich == ATTR_VALUE_FORMAT && eState == SFX_ITEM_DEFAULT )
1958 29 : eState = pPattern->GetItemSet().GetItemState( ATTR_LANGUAGE_FORMAT, false );
1959 :
1960 3275 : if ( eState == SFX_ITEM_SET )
1961 974 : eRet = beans::PropertyState_DIRECT_VALUE;
1962 2301 : else if ( eState == SFX_ITEM_DEFAULT )
1963 2299 : eRet = beans::PropertyState_DEFAULT_VALUE;
1964 2 : else if ( eState == SFX_ITEM_DONTCARE )
1965 2 : eRet = beans::PropertyState_AMBIGUOUS_VALUE;
1966 : else
1967 : {
1968 : OSL_FAIL("unbekannter ItemState");
1969 : }
1970 : }
1971 : }
1972 257 : else if ( pEntry )
1973 : {
1974 257 : if ( pEntry->nWID == SC_WID_UNO_CHCOLHDR || pEntry->nWID == SC_WID_UNO_CHROWHDR || pEntry->nWID == SC_WID_UNO_ABSNAME )
1975 45 : eRet = beans::PropertyState_DIRECT_VALUE;
1976 212 : else if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
1977 : {
1978 : // a style is always set, there's no default state
1979 38 : const ScStyleSheet* pStyle = pDocShell->GetDocument()->GetSelectionStyle(*GetMarkData());
1980 38 : if (pStyle)
1981 38 : eRet = beans::PropertyState_DIRECT_VALUE;
1982 : else
1983 0 : eRet = beans::PropertyState_AMBIGUOUS_VALUE;
1984 : }
1985 174 : else if ( pEntry->nWID == SC_WID_UNO_NUMRULES )
1986 15 : eRet = beans::PropertyState_DEFAULT_VALUE; // numbering rules are always default
1987 : }
1988 3532 : return eRet;
1989 : }
1990 :
1991 344 : beans::PropertyState SAL_CALL ScCellRangesBase::getPropertyState( const OUString& aPropertyName )
1992 : throw(beans::UnknownPropertyException, uno::RuntimeException)
1993 : {
1994 344 : SolarMutexGuard aGuard;
1995 344 : if ( aRanges.empty() )
1996 0 : throw uno::RuntimeException();
1997 :
1998 344 : const SfxItemPropertyMap& rMap = GetItemPropertyMap(); // from derived class
1999 344 : sal_uInt16 nItemWhich = 0;
2000 344 : const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( aPropertyName );
2001 344 : lcl_GetPropertyWhich( pEntry, nItemWhich );
2002 344 : return GetOnePropertyState( nItemWhich, pEntry );
2003 : }
2004 :
2005 0 : uno::Sequence<beans::PropertyState> SAL_CALL ScCellRangesBase::getPropertyStates(
2006 : const uno::Sequence<OUString>& aPropertyNames )
2007 : throw(beans::UnknownPropertyException, uno::RuntimeException)
2008 : {
2009 0 : SolarMutexGuard aGuard;
2010 :
2011 0 : const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
2012 :
2013 0 : uno::Sequence<beans::PropertyState> aRet(aPropertyNames.getLength());
2014 0 : beans::PropertyState* pStates = aRet.getArray();
2015 0 : for(sal_Int32 i = 0; i < aPropertyNames.getLength(); i++)
2016 : {
2017 0 : sal_uInt16 nItemWhich = 0;
2018 0 : const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyNames[i] );
2019 0 : lcl_GetPropertyWhich( pEntry, nItemWhich );
2020 0 : pStates[i] = GetOnePropertyState(nItemWhich, pEntry);
2021 : }
2022 0 : return aRet;
2023 : }
2024 :
2025 0 : void SAL_CALL ScCellRangesBase::setPropertyToDefault( const OUString& aPropertyName )
2026 : throw(beans::UnknownPropertyException, uno::RuntimeException)
2027 : {
2028 0 : SolarMutexGuard aGuard;
2029 0 : if ( pDocShell )
2030 : {
2031 0 : const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
2032 0 : sal_uInt16 nItemWhich = 0;
2033 0 : const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName );
2034 0 : lcl_GetPropertyWhich( pEntry, nItemWhich );
2035 0 : if ( nItemWhich ) // item wid (from map or special case)
2036 : {
2037 0 : if ( !aRanges.empty() ) // leer = nichts zu tun
2038 : {
2039 : //! Bei Items, die mehrere Properties enthalten (z.B. Hintergrund)
2040 : //! wird hier zuviel zurueckgesetzt
2041 : //! for ATTR_ROTATE_VALUE, also reset ATTR_ORIENTATION?
2042 :
2043 : sal_uInt16 aWIDs[3];
2044 0 : aWIDs[0] = nItemWhich;
2045 0 : if ( nItemWhich == ATTR_VALUE_FORMAT )
2046 : {
2047 0 : aWIDs[1] = ATTR_LANGUAGE_FORMAT; // language for number formats
2048 0 : aWIDs[2] = 0;
2049 : }
2050 : else
2051 0 : aWIDs[1] = 0;
2052 0 : pDocShell->GetDocFunc().ClearItems( *GetMarkData(), aWIDs, sal_True );
2053 : }
2054 : }
2055 0 : else if ( pEntry )
2056 : {
2057 0 : if ( pEntry->nWID == SC_WID_UNO_CHCOLHDR )
2058 0 : bChartColAsHdr = false;
2059 0 : else if ( pEntry->nWID == SC_WID_UNO_CHROWHDR )
2060 0 : bChartRowAsHdr = false;
2061 0 : else if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
2062 : {
2063 0 : String aStyleName( ScGlobal::GetRscString( STR_STYLENAME_STANDARD ) );
2064 0 : pDocShell->GetDocFunc().ApplyStyle( *GetMarkData(), aStyleName, sal_True, sal_True );
2065 : }
2066 : }
2067 0 : }
2068 0 : }
2069 :
2070 0 : uno::Any SAL_CALL ScCellRangesBase::getPropertyDefault( const OUString& aPropertyName )
2071 : throw(beans::UnknownPropertyException, lang::WrappedTargetException,
2072 : uno::RuntimeException)
2073 : {
2074 : //! mit getPropertyValue zusammenfassen
2075 :
2076 0 : SolarMutexGuard aGuard;
2077 0 : uno::Any aAny;
2078 :
2079 0 : if ( pDocShell )
2080 : {
2081 0 : ScDocument* pDoc = pDocShell->GetDocument();
2082 0 : const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
2083 0 : const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName );
2084 0 : if ( pEntry )
2085 : {
2086 0 : if ( IsScItemWid( pEntry->nWID ) )
2087 : {
2088 0 : const ScPatternAttr* pPattern = pDoc->GetDefPattern();
2089 0 : if ( pPattern )
2090 : {
2091 0 : const SfxItemSet& rSet = pPattern->GetItemSet();
2092 :
2093 0 : switch ( pEntry->nWID ) // fuer Item-Spezial-Behandlungen
2094 : {
2095 : case ATTR_VALUE_FORMAT:
2096 : // default has no language set
2097 0 : aAny <<= (sal_Int32)( ((const SfxUInt32Item&)rSet.Get(pEntry->nWID)).GetValue() );
2098 0 : break;
2099 : case ATTR_INDENT:
2100 0 : aAny <<= (sal_Int16)( TwipsToHMM(((const SfxUInt16Item&)
2101 0 : rSet.Get(pEntry->nWID)).GetValue()) );
2102 0 : break;
2103 : default:
2104 0 : pPropSet->getPropertyValue(aPropertyName, rSet, aAny);
2105 : }
2106 : }
2107 : }
2108 : else
2109 0 : switch ( pEntry->nWID )
2110 : {
2111 : case SC_WID_UNO_CHCOLHDR:
2112 : case SC_WID_UNO_CHROWHDR:
2113 0 : ScUnoHelpFunctions::SetBoolInAny( aAny, false );
2114 0 : break;
2115 : case SC_WID_UNO_CELLSTYL:
2116 0 : aAny <<= OUString( ScStyleNameConversion::DisplayToProgrammaticName(
2117 0 : ScGlobal::GetRscString(STR_STYLENAME_STANDARD), SFX_STYLE_FAMILY_PARA ) );
2118 0 : break;
2119 : case SC_WID_UNO_TBLBORD:
2120 : case SC_WID_UNO_TBLBORD2:
2121 : {
2122 0 : const ScPatternAttr* pPattern = pDoc->GetDefPattern();
2123 0 : if ( pPattern )
2124 : {
2125 0 : if (pEntry->nWID == SC_WID_UNO_TBLBORD2)
2126 : ScHelperFunctions::AssignTableBorder2ToAny( aAny,
2127 0 : (const SvxBoxItem&)pPattern->GetItem(ATTR_BORDER),
2128 0 : (const SvxBoxInfoItem&)pPattern->GetItem(ATTR_BORDER_INNER) );
2129 : else
2130 : ScHelperFunctions::AssignTableBorderToAny( aAny,
2131 0 : (const SvxBoxItem&)pPattern->GetItem(ATTR_BORDER),
2132 0 : (const SvxBoxInfoItem&)pPattern->GetItem(ATTR_BORDER_INNER) );
2133 : }
2134 : }
2135 0 : break;
2136 : case SC_WID_UNO_CONDFMT:
2137 : case SC_WID_UNO_CONDLOC:
2138 : case SC_WID_UNO_CONDXML:
2139 : {
2140 0 : sal_Bool bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
2141 0 : sal_Bool bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
2142 : formula::FormulaGrammar::Grammar eGrammar = (bXML ?
2143 : pDoc->GetStorageGrammar() :
2144 0 : formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
2145 :
2146 0 : aAny <<= uno::Reference<sheet::XSheetConditionalEntries>(
2147 0 : new ScTableConditionalFormat( pDoc, 0, aRanges[0]->aStart.Tab(), eGrammar ));
2148 : }
2149 0 : break;
2150 : case SC_WID_UNO_VALIDAT:
2151 : case SC_WID_UNO_VALILOC:
2152 : case SC_WID_UNO_VALIXML:
2153 : {
2154 0 : sal_Bool bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
2155 0 : sal_Bool bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
2156 : formula::FormulaGrammar::Grammar eGrammar = (bXML ?
2157 : pDoc->GetStorageGrammar() :
2158 0 : formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
2159 :
2160 0 : aAny <<= uno::Reference<beans::XPropertySet>(
2161 0 : new ScTableValidationObj( pDoc, 0, eGrammar ));
2162 : }
2163 0 : break;
2164 : case SC_WID_UNO_NUMRULES:
2165 : {
2166 0 : aAny <<= uno::Reference<container::XIndexReplace>(ScStyleObj::CreateEmptyNumberingRules());
2167 : }
2168 0 : break;
2169 : }
2170 : }
2171 : }
2172 :
2173 0 : return aAny;
2174 : }
2175 :
2176 : // XPropertySet
2177 :
2178 163 : uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCellRangesBase::getPropertySetInfo()
2179 : throw(uno::RuntimeException)
2180 : {
2181 163 : SolarMutexGuard aGuard;
2182 : static uno::Reference<beans::XPropertySetInfo> aRef(
2183 163 : new SfxItemPropertySetInfo( pPropSet->getPropertyMap() ));
2184 163 : return aRef;
2185 : }
2186 :
2187 1228 : static void lcl_SetCellProperty( const SfxItemPropertySimpleEntry& rEntry, const uno::Any& rValue,
2188 : ScPatternAttr& rPattern, ScDocument* pDoc,
2189 : sal_uInt16& rFirstItemId, sal_uInt16& rSecondItemId )
2190 : {
2191 1228 : rFirstItemId = rEntry.nWID;
2192 1228 : rSecondItemId = 0;
2193 :
2194 1228 : SfxItemSet& rSet = rPattern.GetItemSet();
2195 1228 : switch ( rEntry.nWID )
2196 : {
2197 : case ATTR_VALUE_FORMAT:
2198 : {
2199 : // language for number formats
2200 52 : SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
2201 52 : sal_uLong nOldFormat = ((const SfxUInt32Item&)rSet.Get( ATTR_VALUE_FORMAT )).GetValue();
2202 52 : LanguageType eOldLang = ((const SvxLanguageItem&)rSet.Get( ATTR_LANGUAGE_FORMAT )).GetLanguage();
2203 52 : nOldFormat = pFormatter->GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang );
2204 :
2205 52 : sal_Int32 nIntVal = 0;
2206 52 : if ( rValue >>= nIntVal )
2207 : {
2208 52 : sal_uLong nNewFormat = (sal_uLong)nIntVal;
2209 52 : rSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
2210 :
2211 52 : const SvNumberformat* pNewEntry = pFormatter->GetEntry( nNewFormat );
2212 : LanguageType eNewLang =
2213 52 : pNewEntry ? pNewEntry->GetLanguage() : LANGUAGE_DONTKNOW;
2214 52 : if ( eNewLang != eOldLang && eNewLang != LANGUAGE_DONTKNOW )
2215 : {
2216 14 : rSet.Put( SvxLanguageItem( eNewLang, ATTR_LANGUAGE_FORMAT ) );
2217 :
2218 : // if only language is changed,
2219 : // don't touch number format attribute
2220 14 : sal_uLong nNewMod = nNewFormat % SV_COUNTRY_LANGUAGE_OFFSET;
2221 14 : if ( nNewMod == ( nOldFormat % SV_COUNTRY_LANGUAGE_OFFSET ) &&
2222 : nNewMod <= SV_MAX_ANZ_STANDARD_FORMATE )
2223 : {
2224 0 : rFirstItemId = 0; // don't use ATTR_VALUE_FORMAT value
2225 : }
2226 :
2227 14 : rSecondItemId = ATTR_LANGUAGE_FORMAT;
2228 : }
2229 : }
2230 : else
2231 0 : throw lang::IllegalArgumentException();
2232 : }
2233 52 : break;
2234 : case ATTR_INDENT:
2235 : {
2236 14 : sal_Int16 nIntVal = 0;
2237 14 : if ( rValue >>= nIntVal )
2238 14 : rSet.Put( SfxUInt16Item( rEntry.nWID, (sal_uInt16)HMMToTwips(nIntVal) ) );
2239 : else
2240 0 : throw lang::IllegalArgumentException();
2241 : }
2242 14 : break;
2243 : case ATTR_ROTATE_VALUE:
2244 : {
2245 5 : sal_Int32 nRotVal = 0;
2246 5 : if ( rValue >>= nRotVal )
2247 : {
2248 : // stored value is always between 0 and 360 deg.
2249 5 : nRotVal %= 36000;
2250 5 : if ( nRotVal < 0 )
2251 0 : nRotVal += 36000;
2252 :
2253 5 : rSet.Put( SfxInt32Item( ATTR_ROTATE_VALUE, nRotVal ) );
2254 : }
2255 : else
2256 0 : throw lang::IllegalArgumentException();
2257 : }
2258 5 : break;
2259 : case ATTR_STACKED:
2260 : {
2261 : table::CellOrientation eOrient;
2262 8 : if( rValue >>= eOrient )
2263 : {
2264 8 : switch( eOrient )
2265 : {
2266 : case table::CellOrientation_STANDARD:
2267 1 : rSet.Put( SfxBoolItem( ATTR_STACKED, false ) );
2268 1 : break;
2269 : case table::CellOrientation_TOPBOTTOM:
2270 5 : rSet.Put( SfxBoolItem( ATTR_STACKED, false ) );
2271 5 : rSet.Put( SfxInt32Item( ATTR_ROTATE_VALUE, 27000 ) );
2272 5 : rSecondItemId = ATTR_ROTATE_VALUE;
2273 5 : break;
2274 : case table::CellOrientation_BOTTOMTOP:
2275 1 : rSet.Put( SfxBoolItem( ATTR_STACKED, false ) );
2276 1 : rSet.Put( SfxInt32Item( ATTR_ROTATE_VALUE, 9000 ) );
2277 1 : rSecondItemId = ATTR_ROTATE_VALUE;
2278 1 : break;
2279 : case table::CellOrientation_STACKED:
2280 1 : rSet.Put( SfxBoolItem( ATTR_STACKED, sal_True ) );
2281 1 : break;
2282 : default:
2283 : {
2284 : // added to avoid warnings
2285 : }
2286 : }
2287 : }
2288 : }
2289 8 : break;
2290 : default:
2291 : {
2292 1149 : lcl_GetCellsPropertySet()->setPropertyValue(rEntry, rValue, rSet);
2293 : }
2294 : }
2295 1225 : }
2296 :
2297 837 : void SAL_CALL ScCellRangesBase::setPropertyValue(
2298 : const OUString& aPropertyName, const uno::Any& aValue )
2299 : throw(beans::UnknownPropertyException, beans::PropertyVetoException,
2300 : lang::IllegalArgumentException, lang::WrappedTargetException,
2301 : uno::RuntimeException)
2302 : {
2303 837 : SolarMutexGuard aGuard;
2304 :
2305 837 : if ( !pDocShell || aRanges.empty() )
2306 0 : throw uno::RuntimeException();
2307 :
2308 837 : const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
2309 837 : const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName );
2310 837 : if ( !pEntry )
2311 0 : throw beans::UnknownPropertyException();
2312 :
2313 838 : SetOnePropertyValue( pEntry, aValue );
2314 836 : }
2315 :
2316 964 : void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
2317 : throw(lang::IllegalArgumentException, uno::RuntimeException)
2318 : {
2319 964 : if ( pEntry )
2320 : {
2321 964 : if ( IsScItemWid( pEntry->nWID ) )
2322 : {
2323 347 : if ( !aRanges.empty() ) // leer = nichts zu tun
2324 : {
2325 347 : ScDocument* pDoc = pDocShell->GetDocument();
2326 :
2327 : // Fuer Teile von zusammengesetzten Items mit mehreren Properties (z.B. Hintergrund)
2328 : // muss vorher das alte Item aus dem Dokument geholt werden
2329 : //! Das kann hier aber nicht erkannt werden
2330 : //! -> eigenes Flag im PropertyMap-Eintrag, oder was ???
2331 : //! Item direkt von einzelner Position im Bereich holen?
2332 : // ClearInvalidItems, damit auf jeden Fall ein Item vom richtigen Typ da ist
2333 :
2334 347 : ScPatternAttr aPattern( *GetCurrentAttrsDeep() );
2335 347 : SfxItemSet& rSet = aPattern.GetItemSet();
2336 347 : rSet.ClearInvalidItems();
2337 :
2338 : sal_uInt16 nFirstItem, nSecondItem;
2339 347 : lcl_SetCellProperty( *pEntry, aValue, aPattern, pDoc, nFirstItem, nSecondItem );
2340 :
2341 19722 : for (sal_uInt16 nWhich = ATTR_PATTERN_START; nWhich <= ATTR_PATTERN_END; nWhich++)
2342 19376 : if ( nWhich != nFirstItem && nWhich != nSecondItem )
2343 19015 : rSet.ClearItem(nWhich);
2344 :
2345 347 : pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), aPattern, sal_True, sal_True );
2346 : }
2347 : }
2348 : else // implemented here
2349 617 : switch ( pEntry->nWID )
2350 : {
2351 : case EE_CHAR_ESCAPEMENT: // Specifically for xlsx import
2352 : {
2353 1 : sal_Int32 nValue = 0;
2354 1 : aValue >>= nValue;
2355 1 : if (nValue)
2356 : {
2357 0 : for (size_t i = 0, n = aRanges.size(); i < n; ++i)
2358 : {
2359 0 : ScRange aRange = *aRanges[i];
2360 :
2361 : /* TODO: Iterate through the range */
2362 0 : ScAddress aAddr = aRange.aStart;
2363 0 : ScDocument *pDoc = pDocShell->GetDocument();
2364 0 : ScRefCellValue aCell;
2365 0 : aCell.assign(*pDoc, aAddr);
2366 :
2367 0 : OUString aStr = aCell.getString();
2368 0 : EditEngine aEngine( pDoc->GetEnginePool() );
2369 0 : aEngine.SetEditTextObjectPool(pDoc->GetEditPool());
2370 :
2371 : /* EE_CHAR_ESCAPEMENT seems to be set on the cell _only_ when
2372 : * there are no other attribs for the cell.
2373 : * So, it is safe to overwrite the complete attribute set.
2374 : * If there is a need - getting CellType and processing
2375 : * the attributes could be considered.
2376 : */
2377 0 : SfxItemSet aAttr = aEngine.GetEmptyItemSet();
2378 0 : aEngine.SetText(aStr);
2379 0 : if( nValue < 0 ) // Subscript
2380 0 : aAttr.Put( SvxEscapementItem( SVX_ESCAPEMENT_SUBSCRIPT, EE_CHAR_ESCAPEMENT ) );
2381 : else // Superscript
2382 0 : aAttr.Put( SvxEscapementItem( SVX_ESCAPEMENT_SUPERSCRIPT, EE_CHAR_ESCAPEMENT ) );
2383 0 : aEngine.QuickSetAttribs(aAttr, ESelection(0, 0, 0, aStr.getLength()));
2384 :
2385 : // The cell will own the text object instance.
2386 0 : pDoc->SetEditText(aRanges[0]->aStart, aEngine.CreateTextObject());
2387 0 : }
2388 : }
2389 : }
2390 1 : break;
2391 : case SC_WID_UNO_CHCOLHDR:
2392 : // chart header flags are set for this object, not stored with document
2393 6 : bChartColAsHdr = ScUnoHelpFunctions::GetBoolFromAny( aValue );
2394 6 : break;
2395 : case SC_WID_UNO_CHROWHDR:
2396 6 : bChartRowAsHdr = ScUnoHelpFunctions::GetBoolFromAny( aValue );
2397 6 : break;
2398 : case SC_WID_UNO_CELLSTYL:
2399 : {
2400 556 : OUString aStrVal;
2401 556 : aValue >>= aStrVal;
2402 : String aString(ScStyleNameConversion::ProgrammaticToDisplayName(
2403 1112 : aStrVal, SFX_STYLE_FAMILY_PARA ));
2404 1112 : pDocShell->GetDocFunc().ApplyStyle( *GetMarkData(), aString, sal_True, sal_True );
2405 : }
2406 556 : break;
2407 : case SC_WID_UNO_TBLBORD:
2408 : {
2409 4 : table::TableBorder aBorder;
2410 4 : if ( !aRanges.empty() && ( aValue >>= aBorder ) ) // empty = nothing to do
2411 : {
2412 4 : SvxBoxItem aOuter(ATTR_BORDER);
2413 8 : SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
2414 4 : ScHelperFunctions::FillBoxItems( aOuter, aInner, aBorder );
2415 :
2416 8 : ScHelperFunctions::ApplyBorder( pDocShell, aRanges, aOuter, aInner ); //! docfunc
2417 : }
2418 : }
2419 4 : break;
2420 : case SC_WID_UNO_TBLBORD2:
2421 : {
2422 2 : table::TableBorder2 aBorder2;
2423 2 : if ( !aRanges.empty() && ( aValue >>= aBorder2 ) ) // empty = nothing to do
2424 : {
2425 0 : SvxBoxItem aOuter(ATTR_BORDER);
2426 0 : SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
2427 0 : ScHelperFunctions::FillBoxItems( aOuter, aInner, aBorder2 );
2428 :
2429 0 : ScHelperFunctions::ApplyBorder( pDocShell, aRanges, aOuter, aInner ); //! docfunc
2430 : }
2431 : }
2432 2 : break;
2433 : case SC_WID_UNO_CONDFMT:
2434 : case SC_WID_UNO_CONDLOC:
2435 : case SC_WID_UNO_CONDXML:
2436 : {
2437 14 : uno::Reference<sheet::XSheetConditionalEntries> xInterface(aValue, uno::UNO_QUERY);
2438 14 : if ( !aRanges.empty() && xInterface.is() ) // leer = nichts zu tun
2439 : {
2440 : ScTableConditionalFormat* pFormat =
2441 8 : ScTableConditionalFormat::getImplementation( xInterface );
2442 8 : if (pFormat)
2443 : {
2444 8 : ScDocument* pDoc = pDocShell->GetDocument();
2445 8 : sal_Bool bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
2446 8 : sal_Bool bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
2447 : formula::FormulaGrammar::Grammar eGrammar = (bXML ?
2448 : formula::FormulaGrammar::GRAM_UNSPECIFIED :
2449 8 : formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
2450 :
2451 8 : ScConditionalFormat* pNew = new ScConditionalFormat( 0, pDoc ); // Index wird beim Einfuegen gesetzt
2452 8 : pFormat->FillFormat( *pNew, pDoc, eGrammar );
2453 8 : pNew->AddRange( aRanges );
2454 8 : SCTAB nTab = aRanges.front()->aStart.Tab();
2455 8 : pDocShell->GetDocFunc().ReplaceConditionalFormat( 0, pNew, nTab, aRanges );
2456 : }
2457 14 : }
2458 : }
2459 14 : break;
2460 : case SC_WID_UNO_VALIDAT:
2461 : case SC_WID_UNO_VALILOC:
2462 : case SC_WID_UNO_VALIXML:
2463 : {
2464 22 : uno::Reference<beans::XPropertySet> xInterface(aValue, uno::UNO_QUERY);
2465 22 : if ( !aRanges.empty() && xInterface.is() ) // leer = nichts zu tun
2466 : {
2467 : ScTableValidationObj* pValidObj =
2468 16 : ScTableValidationObj::getImplementation( xInterface );
2469 16 : if (pValidObj)
2470 : {
2471 16 : ScDocument* pDoc = pDocShell->GetDocument();
2472 16 : sal_Bool bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
2473 16 : sal_Bool bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
2474 : formula::FormulaGrammar::Grammar eGrammar = (bXML ?
2475 : formula::FormulaGrammar::GRAM_UNSPECIFIED :
2476 16 : formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
2477 :
2478 : ScValidationData* pNewData =
2479 16 : pValidObj->CreateValidationData( pDoc, eGrammar );
2480 16 : sal_uLong nIndex = pDoc->AddValidationEntry( *pNewData );
2481 16 : delete pNewData;
2482 :
2483 16 : ScPatternAttr aPattern( pDoc->GetPool() );
2484 16 : aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALIDDATA, nIndex ) );
2485 16 : pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), aPattern, sal_True, sal_True );
2486 : }
2487 22 : }
2488 : }
2489 22 : break;
2490 : // SC_WID_UNO_NUMRULES is ignored...
2491 : }
2492 : }
2493 963 : }
2494 :
2495 10274 : uno::Any SAL_CALL ScCellRangesBase::getPropertyValue( const OUString& aPropertyName )
2496 : throw(beans::UnknownPropertyException, lang::WrappedTargetException,
2497 : uno::RuntimeException)
2498 : {
2499 10274 : SolarMutexGuard aGuard;
2500 :
2501 10274 : if ( !pDocShell || aRanges.empty() )
2502 0 : throw uno::RuntimeException();
2503 :
2504 10274 : const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
2505 10274 : const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName );
2506 10274 : if ( !pEntry )
2507 4 : throw beans::UnknownPropertyException();
2508 :
2509 10270 : uno::Any aAny;
2510 10270 : GetOnePropertyValue( pEntry, aAny );
2511 10274 : return aAny;
2512 : }
2513 :
2514 9442 : void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
2515 : uno::Any& rAny )
2516 : throw(uno::RuntimeException)
2517 : {
2518 9442 : if ( pEntry )
2519 : {
2520 9442 : if ( IsScItemWid( pEntry->nWID ) )
2521 : {
2522 9132 : SfxItemSet* pDataSet = GetCurrentDataSet();
2523 9132 : if ( pDataSet )
2524 : {
2525 9132 : switch ( pEntry->nWID ) // fuer Item-Spezial-Behandlungen
2526 : {
2527 : case ATTR_VALUE_FORMAT:
2528 : {
2529 7226 : ScDocument* pDoc = pDocShell->GetDocument();
2530 :
2531 : sal_uLong nOldFormat = ((const SfxUInt32Item&)
2532 7226 : pDataSet->Get( ATTR_VALUE_FORMAT )).GetValue();
2533 : LanguageType eOldLang = ((const SvxLanguageItem&)
2534 7226 : pDataSet->Get( ATTR_LANGUAGE_FORMAT )).GetLanguage();
2535 : nOldFormat = pDoc->GetFormatTable()->
2536 7226 : GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang );
2537 7226 : rAny <<= (sal_Int32)( nOldFormat );
2538 : }
2539 7226 : break;
2540 : case ATTR_INDENT:
2541 92 : rAny <<= (sal_Int16)( TwipsToHMM(((const SfxUInt16Item&)
2542 92 : pDataSet->Get(pEntry->nWID)).GetValue()) );
2543 46 : break;
2544 : case ATTR_STACKED:
2545 : {
2546 58 : sal_Int32 nRot = ((const SfxInt32Item&)pDataSet->Get(ATTR_ROTATE_VALUE)).GetValue();
2547 58 : sal_Bool bStacked = ((const SfxBoolItem&)pDataSet->Get(pEntry->nWID)).GetValue();
2548 58 : SvxOrientationItem( nRot, bStacked, 0 ).QueryValue( rAny );
2549 : }
2550 58 : break;
2551 : default:
2552 1802 : pPropSet->getPropertyValue(*pEntry, *pDataSet, rAny);
2553 : }
2554 : }
2555 : }
2556 : else // implemented here
2557 310 : switch ( pEntry->nWID )
2558 : {
2559 : case SC_WID_UNO_CHCOLHDR:
2560 22 : ScUnoHelpFunctions::SetBoolInAny( rAny, bChartColAsHdr );
2561 22 : break;
2562 : case SC_WID_UNO_CHROWHDR:
2563 22 : ScUnoHelpFunctions::SetBoolInAny( rAny, bChartRowAsHdr );
2564 22 : break;
2565 : case SC_WID_UNO_CELLSTYL:
2566 : {
2567 42 : String aStyleName;
2568 42 : const ScStyleSheet* pStyle = pDocShell->GetDocument()->GetSelectionStyle(*GetMarkData());
2569 42 : if (pStyle)
2570 42 : aStyleName = pStyle->GetName();
2571 84 : rAny <<= OUString( ScStyleNameConversion::DisplayToProgrammaticName(
2572 84 : aStyleName, SFX_STYLE_FAMILY_PARA ) );
2573 : }
2574 42 : break;
2575 : case SC_WID_UNO_TBLBORD:
2576 : case SC_WID_UNO_TBLBORD2:
2577 : {
2578 : //! loop throgh all ranges
2579 40 : if ( !aRanges.empty() )
2580 : {
2581 40 : const ScRange* pFirst = aRanges[ 0 ];
2582 40 : SvxBoxItem aOuter(ATTR_BORDER);
2583 80 : SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
2584 :
2585 40 : ScDocument* pDoc = pDocShell->GetDocument();
2586 80 : ScMarkData aMark;
2587 40 : aMark.SetMarkArea( *pFirst );
2588 40 : aMark.SelectTable( pFirst->aStart.Tab(), sal_True );
2589 40 : pDoc->GetSelectionFrame( aMark, aOuter, aInner );
2590 :
2591 40 : if (pEntry->nWID == SC_WID_UNO_TBLBORD2)
2592 14 : ScHelperFunctions::AssignTableBorder2ToAny( rAny, aOuter, aInner);
2593 : else
2594 66 : ScHelperFunctions::AssignTableBorderToAny( rAny, aOuter, aInner);
2595 : }
2596 : }
2597 40 : break;
2598 : case SC_WID_UNO_CONDFMT:
2599 : case SC_WID_UNO_CONDLOC:
2600 : case SC_WID_UNO_CONDXML:
2601 : {
2602 72 : const ScPatternAttr* pPattern = GetCurrentAttrsDeep();
2603 72 : if ( pPattern )
2604 : {
2605 72 : ScDocument* pDoc = pDocShell->GetDocument();
2606 72 : sal_Bool bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
2607 72 : sal_Bool bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
2608 : formula::FormulaGrammar::Grammar eGrammar = (bXML ?
2609 : pDoc->GetStorageGrammar() :
2610 72 : formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
2611 : const std::vector<sal_uInt32>& rIndex = ((const ScCondFormatItem&)
2612 72 : pPattern->GetItem(ATTR_CONDITIONAL)).GetCondFormatData();
2613 72 : sal_uLong nIndex = 0;
2614 72 : if(!rIndex.empty())
2615 44 : nIndex = rIndex[0];
2616 144 : rAny <<= uno::Reference<sheet::XSheetConditionalEntries>(
2617 144 : new ScTableConditionalFormat( pDoc, nIndex, aRanges.front()->aStart.Tab(), eGrammar ));
2618 : }
2619 : }
2620 72 : break;
2621 : case SC_WID_UNO_VALIDAT:
2622 : case SC_WID_UNO_VALILOC:
2623 : case SC_WID_UNO_VALIXML:
2624 : {
2625 75 : const ScPatternAttr* pPattern = GetCurrentAttrsDeep();
2626 75 : if ( pPattern )
2627 : {
2628 75 : ScDocument* pDoc = pDocShell->GetDocument();
2629 75 : sal_Bool bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
2630 75 : sal_Bool bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
2631 : formula::FormulaGrammar::Grammar eGrammar = (bXML ?
2632 : pDoc->GetStorageGrammar() :
2633 75 : formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
2634 : sal_uLong nIndex = ((const SfxUInt32Item&)
2635 75 : pPattern->GetItem(ATTR_VALIDDATA)).GetValue();
2636 150 : rAny <<= uno::Reference<beans::XPropertySet>(
2637 150 : new ScTableValidationObj( pDoc, nIndex, eGrammar ));
2638 : }
2639 : }
2640 75 : break;
2641 : case SC_WID_UNO_NUMRULES:
2642 : {
2643 : // always return empty numbering rules object
2644 14 : rAny <<= uno::Reference<container::XIndexReplace>(ScStyleObj::CreateEmptyNumberingRules());
2645 : }
2646 14 : break;
2647 : case SC_WID_UNO_ABSNAME:
2648 : {
2649 15 : String sRet;
2650 15 : aRanges.Format(sRet, SCR_ABS_3D, pDocShell->GetDocument());
2651 15 : rAny <<= OUString(sRet);
2652 : }
2653 : }
2654 : }
2655 9442 : }
2656 :
2657 0 : void SAL_CALL ScCellRangesBase::addPropertyChangeListener( const OUString& /* aPropertyName */,
2658 : const uno::Reference<beans::XPropertyChangeListener>& /* aListener */)
2659 : throw(beans::UnknownPropertyException,
2660 : lang::WrappedTargetException, uno::RuntimeException)
2661 : {
2662 0 : SolarMutexGuard aGuard;
2663 0 : if ( aRanges.empty() )
2664 0 : throw uno::RuntimeException();
2665 :
2666 0 : OSL_FAIL("not implemented");
2667 0 : }
2668 :
2669 0 : void SAL_CALL ScCellRangesBase::removePropertyChangeListener( const OUString& /* aPropertyName */,
2670 : const uno::Reference<beans::XPropertyChangeListener>& /* aListener */)
2671 : throw(beans::UnknownPropertyException,
2672 : lang::WrappedTargetException, uno::RuntimeException)
2673 : {
2674 0 : SolarMutexGuard aGuard;
2675 0 : if ( aRanges.empty() )
2676 0 : throw uno::RuntimeException();
2677 :
2678 0 : OSL_FAIL("not implemented");
2679 0 : }
2680 :
2681 0 : void SAL_CALL ScCellRangesBase::addVetoableChangeListener( const OUString&,
2682 : const uno::Reference<beans::XVetoableChangeListener>&)
2683 : throw(beans::UnknownPropertyException,
2684 : lang::WrappedTargetException, uno::RuntimeException)
2685 : {
2686 : OSL_FAIL("not implemented");
2687 0 : }
2688 :
2689 0 : void SAL_CALL ScCellRangesBase::removeVetoableChangeListener( const OUString&,
2690 : const uno::Reference<beans::XVetoableChangeListener>&)
2691 : throw(beans::UnknownPropertyException,
2692 : lang::WrappedTargetException, uno::RuntimeException)
2693 : {
2694 : OSL_FAIL("not implemented");
2695 0 : }
2696 :
2697 : // XMultiPropertySet
2698 :
2699 53 : void SAL_CALL ScCellRangesBase::setPropertyValues( const uno::Sequence< OUString >& aPropertyNames,
2700 : const uno::Sequence< uno::Any >& aValues )
2701 : throw (beans::PropertyVetoException,
2702 : lang::IllegalArgumentException,
2703 : lang::WrappedTargetException,
2704 : uno::RuntimeException)
2705 : {
2706 53 : SolarMutexGuard aGuard;
2707 :
2708 53 : sal_Int32 nCount(aPropertyNames.getLength());
2709 53 : sal_Int32 nValues(aValues.getLength());
2710 53 : if (nCount != nValues)
2711 0 : throw lang::IllegalArgumentException();
2712 :
2713 53 : if ( pDocShell && nCount )
2714 : {
2715 53 : const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
2716 53 : const OUString* pNames = aPropertyNames.getConstArray();
2717 53 : const uno::Any* pValues = aValues.getConstArray();
2718 :
2719 53 : const SfxItemPropertySimpleEntry** pEntryArray = new const SfxItemPropertySimpleEntry*[nCount];
2720 :
2721 : sal_Int32 i;
2722 173 : for(i = 0; i < nCount; i++)
2723 : {
2724 : // first loop: find all properties in map, but handle only CellStyle
2725 : // (CellStyle must be set before any other cell properties)
2726 :
2727 120 : const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( pNames[i] );
2728 120 : pEntryArray[i] = pEntry;
2729 120 : if (pEntry)
2730 : {
2731 120 : if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
2732 : {
2733 : try
2734 : {
2735 53 : SetOnePropertyValue( pEntry, pValues[i] );
2736 : }
2737 0 : catch ( lang::IllegalArgumentException& )
2738 : {
2739 : OSL_FAIL("exception when setting cell style"); // not supposed to happen
2740 : }
2741 : }
2742 : }
2743 : }
2744 :
2745 53 : ScDocument* pDoc = pDocShell->GetDocument();
2746 53 : ScPatternAttr* pOldPattern = NULL;
2747 53 : ScPatternAttr* pNewPattern = NULL;
2748 :
2749 173 : for(i = 0; i < nCount; i++)
2750 : {
2751 : // second loop: handle other properties
2752 :
2753 120 : const SfxItemPropertySimpleEntry* pEntry = pEntryArray[i];
2754 120 : if ( pEntry )
2755 : {
2756 120 : if ( IsScItemWid( pEntry->nWID ) ) // can be handled by SfxItemPropertySet
2757 : {
2758 67 : if ( !pOldPattern )
2759 : {
2760 53 : pOldPattern = new ScPatternAttr( *GetCurrentAttrsDeep() );
2761 53 : pOldPattern->GetItemSet().ClearInvalidItems();
2762 53 : pNewPattern = new ScPatternAttr( pDoc->GetPool() );
2763 : }
2764 :
2765 : // collect items in pNewPattern, apply with one call after the loop
2766 :
2767 : sal_uInt16 nFirstItem, nSecondItem;
2768 67 : lcl_SetCellProperty( *pEntry, pValues[i], *pOldPattern, pDoc, nFirstItem, nSecondItem );
2769 :
2770 : // put only affected items into new set
2771 67 : if ( nFirstItem )
2772 67 : pNewPattern->GetItemSet().Put( pOldPattern->GetItemSet().Get( nFirstItem ) );
2773 67 : if ( nSecondItem )
2774 0 : pNewPattern->GetItemSet().Put( pOldPattern->GetItemSet().Get( nSecondItem ) );
2775 : }
2776 53 : else if ( pEntry->nWID != SC_WID_UNO_CELLSTYL ) // CellStyle is handled above
2777 : {
2778 : // call virtual method to set a single property
2779 0 : SetOnePropertyValue( pEntry, pValues[i] );
2780 : }
2781 : }
2782 : }
2783 :
2784 53 : if ( pNewPattern && !aRanges.empty() )
2785 53 : pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), *pNewPattern, sal_True, sal_True );
2786 :
2787 53 : delete pNewPattern;
2788 53 : delete pOldPattern;
2789 53 : delete[] pEntryArray;
2790 53 : }
2791 53 : }
2792 :
2793 0 : uno::Sequence<uno::Any> SAL_CALL ScCellRangesBase::getPropertyValues(
2794 : const uno::Sequence< OUString >& aPropertyNames )
2795 : throw (uno::RuntimeException)
2796 : {
2797 0 : SolarMutexGuard aGuard;
2798 :
2799 0 : const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
2800 :
2801 0 : uno::Sequence<uno::Any> aRet(aPropertyNames.getLength());
2802 0 : uno::Any* pProperties = aRet.getArray();
2803 0 : for(sal_Int32 i = 0; i < aPropertyNames.getLength(); i++)
2804 : {
2805 0 : const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyNames[i] );
2806 0 : GetOnePropertyValue( pEntry, pProperties[i] );
2807 : }
2808 0 : return aRet;
2809 : }
2810 :
2811 0 : void SAL_CALL ScCellRangesBase::addPropertiesChangeListener( const uno::Sequence< OUString >& /* aPropertyNames */,
2812 : const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
2813 : throw (uno::RuntimeException)
2814 : {
2815 : OSL_FAIL("not implemented");
2816 0 : }
2817 :
2818 0 : void SAL_CALL ScCellRangesBase::removePropertiesChangeListener( const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
2819 : throw (uno::RuntimeException)
2820 : {
2821 : OSL_FAIL("not implemented");
2822 0 : }
2823 :
2824 0 : void SAL_CALL ScCellRangesBase::firePropertiesChangeEvent( const uno::Sequence< OUString >& /* aPropertyNames */,
2825 : const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
2826 : throw (uno::RuntimeException)
2827 : {
2828 : OSL_FAIL("not implemented");
2829 0 : }
2830 :
2831 8 : IMPL_LINK( ScCellRangesBase, ValueListenerHdl, SfxHint*, pHint )
2832 : {
2833 8 : if ( pDocShell && pHint && pHint->ISA( SfxSimpleHint ) &&
2834 4 : (((const SfxSimpleHint*)pHint)->GetId() & SC_HINT_DATACHANGED))
2835 : {
2836 : // This may be called several times for a single change, if several formulas
2837 : // in the range are notified. So only a flag is set that is checked when
2838 : // SFX_HINT_DATACHANGED is received.
2839 :
2840 0 : bGotDataChangedHint = sal_True;
2841 : }
2842 4 : return 0;
2843 : }
2844 :
2845 : // XTolerantMultiPropertySet
2846 387 : uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL ScCellRangesBase::setPropertyValuesTolerant( const uno::Sequence< OUString >& aPropertyNames,
2847 : const uno::Sequence< uno::Any >& aValues )
2848 : throw (lang::IllegalArgumentException, uno::RuntimeException)
2849 : {
2850 387 : SolarMutexGuard aGuard;
2851 :
2852 387 : sal_Int32 nCount(aPropertyNames.getLength());
2853 387 : sal_Int32 nValues(aValues.getLength());
2854 387 : if (nCount != nValues)
2855 0 : throw lang::IllegalArgumentException();
2856 :
2857 387 : if ( pDocShell && nCount )
2858 : {
2859 387 : uno::Sequence < beans::SetPropertyTolerantFailed > aReturns(nCount);
2860 387 : beans::SetPropertyTolerantFailed* pReturns = aReturns.getArray();
2861 :
2862 387 : const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
2863 387 : const OUString* pNames = aPropertyNames.getConstArray();
2864 387 : const uno::Any* pValues = aValues.getConstArray();
2865 :
2866 387 : const SfxItemPropertySimpleEntry** pMapArray = new const SfxItemPropertySimpleEntry*[nCount];
2867 :
2868 : sal_Int32 i;
2869 1982 : for(i = 0; i < nCount; i++)
2870 : {
2871 : // first loop: find all properties in map, but handle only CellStyle
2872 : // (CellStyle must be set before any other cell properties)
2873 :
2874 1595 : const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( pNames[i] );
2875 1595 : pMapArray[i] = pEntry;
2876 1595 : if (pEntry)
2877 : {
2878 1553 : if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
2879 : {
2880 : try
2881 : {
2882 219 : SetOnePropertyValue( pEntry, pValues[i] );
2883 : }
2884 0 : catch ( lang::IllegalArgumentException& )
2885 : {
2886 : OSL_FAIL("exception when setting cell style"); // not supposed to happen
2887 : }
2888 : }
2889 : }
2890 : }
2891 :
2892 387 : ScDocument* pDoc = pDocShell->GetDocument();
2893 387 : ScPatternAttr* pOldPattern = NULL;
2894 387 : ScPatternAttr* pNewPattern = NULL;
2895 :
2896 387 : sal_Int32 nFailed(0);
2897 1982 : for(i = 0; i < nCount; i++)
2898 : {
2899 : // second loop: handle other properties
2900 :
2901 1595 : const SfxItemPropertySimpleEntry* pEntry = pMapArray[i];
2902 1595 : if ( pEntry && ((pEntry->nFlags & beans::PropertyAttribute::READONLY) == 0))
2903 : {
2904 1546 : if ( IsScItemWid( pEntry->nWID ) ) // can be handled by SfxItemPropertySet
2905 : {
2906 814 : if ( !pOldPattern )
2907 : {
2908 170 : pOldPattern = new ScPatternAttr( *GetCurrentAttrsDeep() );
2909 170 : pOldPattern->GetItemSet().ClearInvalidItems();
2910 170 : pNewPattern = new ScPatternAttr( pDoc->GetPool() );
2911 : }
2912 :
2913 : // collect items in pNewPattern, apply with one call after the loop
2914 :
2915 : sal_uInt16 nFirstItem, nSecondItem;
2916 : try
2917 : {
2918 814 : lcl_SetCellProperty( *pEntry, pValues[i], *pOldPattern, pDoc, nFirstItem, nSecondItem );
2919 :
2920 : // put only affected items into new set
2921 812 : if ( nFirstItem )
2922 812 : pNewPattern->GetItemSet().Put( pOldPattern->GetItemSet().Get( nFirstItem ) );
2923 812 : if ( nSecondItem )
2924 5 : pNewPattern->GetItemSet().Put( pOldPattern->GetItemSet().Get( nSecondItem ) );
2925 : }
2926 4 : catch ( lang::IllegalArgumentException& )
2927 : {
2928 2 : pReturns[nFailed].Name = pNames[i];
2929 2 : pReturns[nFailed++].Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT;
2930 : }
2931 : }
2932 732 : else if ( pEntry->nWID != SC_WID_UNO_CELLSTYL ) // CellStyle is handled above
2933 : {
2934 : // call virtual method to set a single property
2935 : try
2936 : {
2937 513 : SetOnePropertyValue( pEntry, pValues[i] );
2938 : }
2939 0 : catch ( lang::IllegalArgumentException& )
2940 : {
2941 0 : pReturns[nFailed].Name = pNames[i];
2942 0 : pReturns[nFailed++].Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT;
2943 : }
2944 1546 : }
2945 : }
2946 : else
2947 : {
2948 49 : pReturns[nFailed].Name = pNames[i];
2949 49 : if (pEntry)
2950 7 : pReturns[nFailed++].Result = beans::TolerantPropertySetResultType::PROPERTY_VETO;
2951 : else
2952 42 : pReturns[nFailed++].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
2953 : }
2954 : }
2955 :
2956 387 : if ( pNewPattern && !aRanges.empty() )
2957 170 : pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), *pNewPattern, sal_True, sal_True );
2958 :
2959 387 : delete pNewPattern;
2960 387 : delete pOldPattern;
2961 387 : delete[] pMapArray;
2962 :
2963 387 : aReturns.realloc(nFailed);
2964 :
2965 387 : return aReturns;
2966 : }
2967 0 : return uno::Sequence < beans::SetPropertyTolerantFailed >();
2968 : }
2969 :
2970 11 : uno::Sequence< beans::GetPropertyTolerantResult > SAL_CALL ScCellRangesBase::getPropertyValuesTolerant( const uno::Sequence< OUString >& aPropertyNames )
2971 : throw (uno::RuntimeException)
2972 : {
2973 11 : SolarMutexGuard aGuard;
2974 :
2975 11 : sal_Int32 nCount(aPropertyNames.getLength());
2976 11 : uno::Sequence < beans::GetPropertyTolerantResult > aReturns(nCount);
2977 11 : beans::GetPropertyTolerantResult* pReturns = aReturns.getArray();
2978 :
2979 11 : const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
2980 :
2981 1102 : for(sal_Int32 i = 0; i < nCount; i++)
2982 : {
2983 1091 : const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyNames[i] );
2984 1091 : if (!pEntry)
2985 : {
2986 0 : pReturns[i].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
2987 : }
2988 : else
2989 : {
2990 1091 : sal_uInt16 nItemWhich = 0;
2991 1091 : lcl_GetPropertyWhich( pEntry, nItemWhich );
2992 1091 : pReturns[i].State = GetOnePropertyState( nItemWhich, pEntry );
2993 1091 : GetOnePropertyValue( pEntry, pReturns[i].Value );
2994 1091 : pReturns[i].Result = beans::TolerantPropertySetResultType::SUCCESS;
2995 : }
2996 : }
2997 11 : return aReturns;
2998 : }
2999 :
3000 57 : uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL ScCellRangesBase::getDirectPropertyValuesTolerant( const uno::Sequence< OUString >& aPropertyNames )
3001 : throw (uno::RuntimeException)
3002 : {
3003 57 : SolarMutexGuard aGuard;
3004 :
3005 57 : sal_Int32 nCount(aPropertyNames.getLength());
3006 57 : uno::Sequence < beans::GetDirectPropertyTolerantResult > aReturns(nCount);
3007 57 : beans::GetDirectPropertyTolerantResult* pReturns = aReturns.getArray();
3008 :
3009 57 : const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
3010 :
3011 57 : sal_Int32 j = 0;
3012 2154 : for(sal_Int32 i = 0; i < nCount; i++)
3013 : {
3014 2097 : const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyNames[i] );
3015 2097 : if (!pEntry)
3016 : {
3017 0 : pReturns[i].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
3018 : }
3019 : else
3020 : {
3021 2097 : sal_uInt16 nItemWhich = 0;
3022 2097 : lcl_GetPropertyWhich( pEntry, nItemWhich );
3023 2097 : pReturns[j].State = GetOnePropertyState( nItemWhich, pEntry );
3024 2097 : if (pReturns[j].State == beans::PropertyState_DIRECT_VALUE)
3025 : {
3026 161 : GetOnePropertyValue( pEntry, pReturns[j].Value );
3027 161 : pReturns[j].Result = beans::TolerantPropertySetResultType::SUCCESS;
3028 161 : pReturns[j].Name = aPropertyNames[i];
3029 161 : ++j;
3030 : }
3031 : }
3032 : }
3033 57 : if (j < nCount)
3034 25 : aReturns.realloc(j);
3035 57 : return aReturns;
3036 : }
3037 :
3038 : // XIndent
3039 :
3040 3 : void SAL_CALL ScCellRangesBase::decrementIndent() throw(::com::sun::star::uno::RuntimeException)
3041 : {
3042 3 : SolarMutexGuard aGuard;
3043 3 : if ( pDocShell && !aRanges.empty() ) // leer = nichts zu tun
3044 : {
3045 : //#97041#; put only MultiMarked ScMarkData in ChangeIndent
3046 3 : ScMarkData aMarkData(*GetMarkData());
3047 3 : aMarkData.MarkToMulti();
3048 3 : pDocShell->GetDocFunc().ChangeIndent( aMarkData, false, sal_True );
3049 3 : }
3050 3 : }
3051 :
3052 3 : void SAL_CALL ScCellRangesBase::incrementIndent() throw(::com::sun::star::uno::RuntimeException)
3053 : {
3054 3 : SolarMutexGuard aGuard;
3055 3 : if ( pDocShell && !aRanges.empty() ) // leer = nichts zu tun
3056 : {
3057 : //#97041#; put only MultiMarked ScMarkData in ChangeIndent
3058 3 : ScMarkData aMarkData(*GetMarkData());
3059 3 : aMarkData.MarkToMulti();
3060 3 : pDocShell->GetDocFunc().ChangeIndent( aMarkData, sal_True, sal_True );
3061 3 : }
3062 3 : }
3063 :
3064 : // XChartData
3065 :
3066 18 : ScMemChart* ScCellRangesBase::CreateMemChart_Impl() const
3067 : {
3068 18 : if ( pDocShell && !aRanges.empty() )
3069 : {
3070 18 : ScRangeListRef xChartRanges;
3071 18 : if ( aRanges.size() == 1 )
3072 : {
3073 : // ganze Tabelle sinnvoll begrenzen (auf belegten Datenbereich)
3074 : // (nur hier, Listener werden auf den ganzen Bereich angemeldet)
3075 : //! direkt testen, ob es ein ScTableSheetObj ist?
3076 :
3077 8 : const ScRange* pRange = aRanges[0];
3078 24 : if ( pRange->aStart.Col() == 0 && pRange->aEnd.Col() == MAXCOL &&
3079 8 : pRange->aStart.Row() == 0 && pRange->aEnd.Row() == MAXROW )
3080 : {
3081 0 : SCTAB nTab = pRange->aStart.Tab();
3082 :
3083 : SCCOL nStartX;
3084 : SCROW nStartY; // Anfang holen
3085 0 : if (!pDocShell->GetDocument()->GetDataStart( nTab, nStartX, nStartY ))
3086 : {
3087 0 : nStartX = 0;
3088 0 : nStartY = 0;
3089 : }
3090 :
3091 : SCCOL nEndX;
3092 : SCROW nEndY; // Ende holen
3093 0 : if (!pDocShell->GetDocument()->GetTableArea( nTab, nEndX, nEndY ))
3094 : {
3095 0 : nEndX = 0;
3096 0 : nEndY = 0;
3097 : }
3098 :
3099 0 : xChartRanges = new ScRangeList;
3100 0 : xChartRanges->Append( ScRange( nStartX, nStartY, nTab, nEndX, nEndY, nTab ) );
3101 : }
3102 : }
3103 18 : if (!xChartRanges.Is()) // sonst Ranges direkt uebernehmen
3104 18 : xChartRanges = new ScRangeList(aRanges);
3105 36 : ScChartArray aArr( pDocShell->GetDocument(), xChartRanges, String() );
3106 :
3107 : // RowAsHdr = ColHeaders und umgekehrt
3108 18 : aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr );
3109 :
3110 36 : return aArr.CreateMemChart();
3111 : }
3112 0 : return NULL;
3113 : }
3114 :
3115 6 : uno::Sequence< uno::Sequence<double> > SAL_CALL ScCellRangesBase::getData()
3116 : throw(uno::RuntimeException)
3117 : {
3118 6 : SolarMutexGuard aGuard;
3119 6 : ScMemChart* pMemChart = CreateMemChart_Impl();
3120 6 : if ( pMemChart )
3121 : {
3122 6 : sal_Int32 nColCount = pMemChart->GetColCount();
3123 6 : sal_Int32 nRowCount = static_cast<sal_Int32>(pMemChart->GetRowCount());
3124 :
3125 6 : uno::Sequence< uno::Sequence<double> > aRowSeq( nRowCount );
3126 6 : uno::Sequence<double>* pRowAry = aRowSeq.getArray();
3127 60 : for (sal_Int32 nRow = 0; nRow < nRowCount; nRow++)
3128 : {
3129 54 : uno::Sequence<double> aColSeq( nColCount );
3130 54 : double* pColAry = aColSeq.getArray();
3131 148 : for (sal_Int32 nCol = 0; nCol < nColCount; nCol++)
3132 94 : pColAry[nCol] = pMemChart->GetData( static_cast<short>(nCol), static_cast<short>(nRow) );
3133 :
3134 54 : pRowAry[nRow] = aColSeq;
3135 54 : }
3136 :
3137 6 : delete pMemChart;
3138 6 : return aRowSeq;
3139 : }
3140 :
3141 0 : return uno::Sequence< uno::Sequence<double> >(0);
3142 : }
3143 :
3144 8 : ScRangeListRef ScCellRangesBase::GetLimitedChartRanges_Impl( long nDataColumns, long nDataRows ) const
3145 : {
3146 8 : if ( aRanges.size() == 1 )
3147 : {
3148 3 : const ScRange* pRange = aRanges[0];
3149 9 : if ( pRange->aStart.Col() == 0 && pRange->aEnd.Col() == MAXCOL &&
3150 3 : pRange->aStart.Row() == 0 && pRange->aEnd.Row() == MAXROW )
3151 : {
3152 : // if aRanges is a complete sheet, limit to given size
3153 :
3154 0 : SCTAB nTab = pRange->aStart.Tab();
3155 :
3156 0 : long nEndColumn = nDataColumns - 1 + ( bChartColAsHdr ? 1 : 0 );
3157 0 : if ( nEndColumn < 0 )
3158 0 : nEndColumn = 0;
3159 0 : if ( nEndColumn > MAXCOL )
3160 0 : nEndColumn = MAXCOL;
3161 :
3162 0 : long nEndRow = nDataRows - 1 + ( bChartRowAsHdr ? 1 : 0 );
3163 0 : if ( nEndRow < 0 )
3164 0 : nEndRow = 0;
3165 0 : if ( nEndRow > MAXROW )
3166 0 : nEndRow = MAXROW;
3167 :
3168 0 : ScRangeListRef xChartRanges = new ScRangeList;
3169 0 : xChartRanges->Append( ScRange( 0, 0, nTab, (SCCOL)nEndColumn, (SCROW)nEndRow, nTab ) );
3170 0 : return xChartRanges;
3171 : }
3172 : }
3173 :
3174 8 : return new ScRangeList(aRanges); // as-is
3175 : }
3176 :
3177 4 : void SAL_CALL ScCellRangesBase::setData( const uno::Sequence< uno::Sequence<double> >& aData )
3178 : throw(uno::RuntimeException)
3179 : {
3180 4 : SolarMutexGuard aGuard;
3181 4 : sal_Bool bDone = false;
3182 4 : long nRowCount = aData.getLength();
3183 4 : long nColCount = nRowCount ? aData[0].getLength() : 0;
3184 8 : ScRangeListRef xChartRanges = GetLimitedChartRanges_Impl( nColCount, nRowCount );
3185 4 : if ( pDocShell && xChartRanges.Is() )
3186 : {
3187 4 : ScDocument* pDoc = pDocShell->GetDocument();
3188 4 : ScChartArray aArr( pDoc, xChartRanges, String() );
3189 4 : aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr ); // RowAsHdr = ColHeaders
3190 4 : const ScChartPositionMap* pPosMap = aArr.GetPositionMap();
3191 4 : if (pPosMap)
3192 : {
3193 8 : if ( pPosMap->GetColCount() == static_cast<SCCOL>(nColCount) &&
3194 4 : pPosMap->GetRowCount() == static_cast<SCROW>(nRowCount) )
3195 : {
3196 43 : for (long nRow=0; nRow<nRowCount; nRow++)
3197 : {
3198 39 : const uno::Sequence<double>& rRowSeq = aData[nRow];
3199 39 : const double* pArray = rRowSeq.getConstArray();
3200 39 : nColCount = rRowSeq.getLength();
3201 110 : for (long nCol=0; nCol<nColCount; nCol++)
3202 : {
3203 : const ScAddress* pPos = pPosMap->GetPosition(
3204 71 : sal::static_int_cast<SCCOL>(nCol),
3205 142 : sal::static_int_cast<SCROW>(nRow) );
3206 71 : if (pPos)
3207 : {
3208 71 : double fVal = pArray[nCol];
3209 71 : if ( fVal == DBL_MIN )
3210 38 : pDoc->SetEmptyCell(*pPos);
3211 : else
3212 33 : pDoc->SetValue(*pPos, pArray[nCol]);
3213 : }
3214 : }
3215 : }
3216 :
3217 : //! undo
3218 4 : PaintRanges_Impl( PAINT_GRID );
3219 4 : pDocShell->SetDocumentModified();
3220 4 : ForceChartListener_Impl(); // call listeners for this object synchronously
3221 4 : bDone = sal_True;
3222 : }
3223 4 : }
3224 : }
3225 :
3226 4 : if (!bDone)
3227 4 : throw uno::RuntimeException();
3228 4 : }
3229 :
3230 6 : uno::Sequence<OUString> SAL_CALL ScCellRangesBase::getRowDescriptions()
3231 : throw(uno::RuntimeException)
3232 : {
3233 6 : SolarMutexGuard aGuard;
3234 6 : ScMemChart* pMemChart = CreateMemChart_Impl();
3235 6 : if ( pMemChart )
3236 : {
3237 6 : sal_Int32 nRowCount = static_cast<sal_Int32>(pMemChart->GetRowCount());
3238 6 : uno::Sequence<OUString> aSeq( nRowCount );
3239 6 : OUString* pAry = aSeq.getArray();
3240 51 : for (sal_Int32 nRow = 0; nRow < nRowCount; nRow++)
3241 45 : pAry[nRow] = pMemChart->GetRowText(static_cast<short>(nRow));
3242 :
3243 6 : delete pMemChart;
3244 6 : return aSeq;
3245 : }
3246 0 : return uno::Sequence<OUString>(0);
3247 : }
3248 :
3249 2 : void SAL_CALL ScCellRangesBase::setRowDescriptions(
3250 : const uno::Sequence<OUString>& aRowDescriptions )
3251 : throw(uno::RuntimeException)
3252 : {
3253 2 : SolarMutexGuard aGuard;
3254 2 : sal_Bool bDone = false;
3255 2 : if ( bChartColAsHdr )
3256 : {
3257 2 : long nRowCount = aRowDescriptions.getLength();
3258 2 : ScRangeListRef xChartRanges = GetLimitedChartRanges_Impl( 1, nRowCount );
3259 2 : if ( pDocShell && xChartRanges.Is() )
3260 : {
3261 2 : ScDocument* pDoc = pDocShell->GetDocument();
3262 2 : ScChartArray aArr( pDoc, xChartRanges, String() );
3263 2 : aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr ); // RowAsHdr = ColHeaders
3264 2 : const ScChartPositionMap* pPosMap = aArr.GetPositionMap();
3265 2 : if (pPosMap)
3266 : {
3267 2 : if ( pPosMap->GetRowCount() == static_cast<SCROW>(nRowCount) )
3268 : {
3269 2 : const OUString* pArray = aRowDescriptions.getConstArray();
3270 17 : for (long nRow=0; nRow<nRowCount; nRow++)
3271 : {
3272 : const ScAddress* pPos = pPosMap->GetRowHeaderPosition(
3273 15 : static_cast<SCSIZE>(nRow) );
3274 15 : if (pPos)
3275 : {
3276 15 : const OUString& aStr = pArray[nRow];
3277 15 : if (aStr.isEmpty())
3278 0 : pDoc->SetEmptyCell(*pPos);
3279 : else
3280 : {
3281 15 : ScSetStringParam aParam;
3282 15 : aParam.setTextInput();
3283 15 : pDoc->SetString(*pPos, aStr, &aParam);
3284 : }
3285 : }
3286 : }
3287 :
3288 : //! undo
3289 2 : PaintRanges_Impl( PAINT_GRID );
3290 2 : pDocShell->SetDocumentModified();
3291 2 : ForceChartListener_Impl(); // call listeners for this object synchronously
3292 2 : bDone = sal_True;
3293 : }
3294 2 : }
3295 2 : }
3296 : }
3297 :
3298 2 : if (!bDone)
3299 0 : throw uno::RuntimeException();
3300 2 : }
3301 :
3302 6 : uno::Sequence<OUString> SAL_CALL ScCellRangesBase::getColumnDescriptions()
3303 : throw(uno::RuntimeException)
3304 : {
3305 6 : SolarMutexGuard aGuard;
3306 6 : ScMemChart* pMemChart = CreateMemChart_Impl();
3307 6 : if ( pMemChart )
3308 : {
3309 6 : sal_Int32 nColCount = pMemChart->GetColCount();
3310 6 : uno::Sequence<OUString> aSeq( nColCount );
3311 6 : OUString* pAry = aSeq.getArray();
3312 18 : for (sal_Int32 nCol = 0; nCol < nColCount; nCol++)
3313 12 : pAry[nCol] = pMemChart->GetColText(static_cast<short>(nCol));
3314 :
3315 6 : delete pMemChart;
3316 6 : return aSeq;
3317 : }
3318 0 : return uno::Sequence<OUString>(0);
3319 : }
3320 :
3321 2 : void SAL_CALL ScCellRangesBase::setColumnDescriptions(
3322 : const uno::Sequence<OUString>& aColumnDescriptions )
3323 : throw(uno::RuntimeException)
3324 : {
3325 2 : SolarMutexGuard aGuard;
3326 2 : sal_Bool bDone = false;
3327 2 : if ( bChartRowAsHdr )
3328 : {
3329 2 : long nColCount = aColumnDescriptions.getLength();
3330 2 : ScRangeListRef xChartRanges = GetLimitedChartRanges_Impl( nColCount, 1 );
3331 2 : if ( pDocShell && xChartRanges.Is() )
3332 : {
3333 2 : ScDocument* pDoc = pDocShell->GetDocument();
3334 2 : ScChartArray aArr( pDoc, xChartRanges, String() );
3335 2 : aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr ); // RowAsHdr = ColHeaders
3336 2 : const ScChartPositionMap* pPosMap = aArr.GetPositionMap();
3337 2 : if (pPosMap)
3338 : {
3339 2 : if ( pPosMap->GetColCount() == static_cast<SCCOL>(nColCount) )
3340 : {
3341 2 : const OUString* pArray = aColumnDescriptions.getConstArray();
3342 6 : for (long nCol=0; nCol<nColCount; nCol++)
3343 : {
3344 : const ScAddress* pPos = pPosMap->GetColHeaderPosition(
3345 4 : sal::static_int_cast<SCCOL>(nCol) );
3346 4 : if (pPos)
3347 : {
3348 4 : const OUString& aStr = pArray[nCol];
3349 4 : if (aStr.isEmpty())
3350 0 : pDoc->SetEmptyCell(*pPos);
3351 : else
3352 : {
3353 4 : ScSetStringParam aParam;
3354 4 : aParam.setTextInput();
3355 4 : pDoc->SetString(*pPos, aStr, &aParam);
3356 : }
3357 : }
3358 : }
3359 :
3360 : //! undo
3361 2 : PaintRanges_Impl( PAINT_GRID );
3362 2 : pDocShell->SetDocumentModified();
3363 2 : ForceChartListener_Impl(); // call listeners for this object synchronously
3364 2 : bDone = sal_True;
3365 : }
3366 2 : }
3367 2 : }
3368 : }
3369 :
3370 2 : if (!bDone)
3371 0 : throw uno::RuntimeException();
3372 2 : }
3373 :
3374 8 : void ScCellRangesBase::ForceChartListener_Impl()
3375 : {
3376 : // call Update immediately so the caller to setData etc. can
3377 : // regognize the listener call
3378 :
3379 8 : if (!pDocShell)
3380 0 : return;
3381 :
3382 8 : ScChartListenerCollection* pColl = pDocShell->GetDocument()->GetChartListenerCollection();
3383 8 : if (!pColl)
3384 0 : return;
3385 :
3386 8 : ScChartListenerCollection::ListenersType& rListeners = pColl->getListeners();
3387 8 : ScChartListenerCollection::ListenersType::iterator it = rListeners.begin(), itEnd = rListeners.end();
3388 11 : for (; it != itEnd; ++it)
3389 : {
3390 3 : ScChartListener* p = it->second;
3391 : OSL_ASSERT(p);
3392 3 : if (p->GetUnoSource() == static_cast<chart::XChartData*>(this) && p->IsDirty())
3393 3 : p->Update();
3394 : }
3395 : }
3396 :
3397 2 : void SAL_CALL ScCellRangesBase::addChartDataChangeEventListener( const uno::Reference<
3398 : chart::XChartDataChangeEventListener >& aListener )
3399 : throw(uno::RuntimeException)
3400 : {
3401 2 : SolarMutexGuard aGuard;
3402 2 : if ( pDocShell && !aRanges.empty() )
3403 : {
3404 : //! auf doppelte testen?
3405 :
3406 2 : ScDocument* pDoc = pDocShell->GetDocument();
3407 2 : ScRangeListRef aRangesRef( new ScRangeList(aRanges) );
3408 2 : ScChartListenerCollection* pColl = pDoc->GetChartListenerCollection();
3409 4 : OUString aName = pColl->getUniqueName(OUString("__Uno"));
3410 2 : if (aName.isEmpty())
3411 : // failed to create unique name.
3412 2 : return;
3413 :
3414 2 : ScChartListener* pListener = new ScChartListener( aName, pDoc, aRangesRef );
3415 2 : pListener->SetUno( aListener, this );
3416 2 : pColl->insert( pListener );
3417 4 : pListener->StartListeningTo();
3418 2 : }
3419 : }
3420 :
3421 2 : void SAL_CALL ScCellRangesBase::removeChartDataChangeEventListener( const uno::Reference<
3422 : chart::XChartDataChangeEventListener >& aListener )
3423 : throw(uno::RuntimeException)
3424 : {
3425 2 : SolarMutexGuard aGuard;
3426 2 : if ( pDocShell && !aRanges.empty() )
3427 : {
3428 2 : ScDocument* pDoc = pDocShell->GetDocument();
3429 2 : ScChartListenerCollection* pColl = pDoc->GetChartListenerCollection();
3430 2 : pColl->FreeUno( aListener, this );
3431 2 : }
3432 2 : }
3433 :
3434 1 : double SAL_CALL ScCellRangesBase::getNotANumber() throw(::com::sun::star::uno::RuntimeException)
3435 : {
3436 : // im ScChartArray wird DBL_MIN verwendet, weil das Chart es so will
3437 1 : return DBL_MIN;
3438 : }
3439 :
3440 2 : sal_Bool SAL_CALL ScCellRangesBase::isNotANumber( double nNumber ) throw(uno::RuntimeException)
3441 : {
3442 : // im ScChartArray wird DBL_MIN verwendet, weil das Chart es so will
3443 2 : return (nNumber == DBL_MIN);
3444 : }
3445 :
3446 : // XModifyBroadcaster
3447 :
3448 6 : void SAL_CALL ScCellRangesBase::addModifyListener( const uno::Reference<util::XModifyListener>& aListener )
3449 : throw(uno::RuntimeException)
3450 : {
3451 6 : SolarMutexGuard aGuard;
3452 6 : if ( aRanges.empty() )
3453 0 : throw uno::RuntimeException();
3454 :
3455 : uno::Reference<util::XModifyListener> *pObj =
3456 6 : new uno::Reference<util::XModifyListener>( aListener );
3457 6 : aValueListeners.push_back( pObj );
3458 :
3459 6 : if ( aValueListeners.size() == 1 )
3460 : {
3461 6 : if (!pValueListener)
3462 6 : pValueListener = new ScLinkListener( LINK( this, ScCellRangesBase, ValueListenerHdl ) );
3463 :
3464 6 : ScDocument* pDoc = pDocShell->GetDocument();
3465 12 : for ( size_t i = 0, nCount = aRanges.size(); i < nCount; i++)
3466 6 : pDoc->StartListeningArea( *aRanges[ i ], pValueListener );
3467 :
3468 6 : acquire(); // don't lose this object (one ref for all listeners)
3469 6 : }
3470 6 : }
3471 :
3472 2 : void SAL_CALL ScCellRangesBase::removeModifyListener( const uno::Reference<util::XModifyListener>& aListener )
3473 : throw(uno::RuntimeException)
3474 : {
3475 :
3476 2 : SolarMutexGuard aGuard;
3477 2 : if ( aRanges.empty() )
3478 0 : throw uno::RuntimeException();
3479 :
3480 2 : acquire(); // in case the listeners have the last ref - released below
3481 :
3482 2 : sal_uInt16 nCount = aValueListeners.size();
3483 4 : for ( sal_uInt16 n=nCount; n--; )
3484 : {
3485 2 : uno::Reference<util::XModifyListener>& rObj = aValueListeners[n];
3486 2 : if ( rObj == aListener )
3487 : {
3488 2 : aValueListeners.erase( aValueListeners.begin() + n );
3489 :
3490 2 : if ( aValueListeners.empty() )
3491 : {
3492 2 : if (pValueListener)
3493 2 : pValueListener->EndListeningAll();
3494 :
3495 2 : release(); // release the ref for the listeners
3496 : }
3497 :
3498 2 : break;
3499 : }
3500 : }
3501 :
3502 2 : release(); // might delete this object
3503 2 : }
3504 :
3505 : // XCellRangesQuery
3506 :
3507 25 : uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryVisibleCells()
3508 : throw(uno::RuntimeException)
3509 : {
3510 25 : SolarMutexGuard aGuard;
3511 25 : if (pDocShell)
3512 : {
3513 : //! fuer alle Tabellen getrennt, wenn Markierungen pro Tabelle getrennt sind!
3514 25 : SCTAB nTab = lcl_FirstTab(aRanges);
3515 :
3516 25 : ScMarkData aMarkData(*GetMarkData());
3517 :
3518 25 : ScDocument* pDoc = pDocShell->GetDocument();
3519 25 : SCCOL nCol = 0, nLastCol;
3520 107 : while (nCol <= MAXCOL)
3521 : {
3522 57 : if (pDoc->ColHidden(nCol, nTab, NULL, &nLastCol))
3523 : // hidden columns. Unselect them.
3524 18 : aMarkData.SetMultiMarkArea(ScRange(nCol, 0, nTab, nLastCol, MAXROW, nTab), false);
3525 :
3526 57 : nCol = nLastCol + 1;
3527 : }
3528 :
3529 25 : SCROW nRow = 0, nLastRow;
3530 104 : while (nRow <= MAXROW)
3531 : {
3532 54 : if (pDoc->RowHidden(nRow, nTab, NULL, &nLastRow))
3533 : // These rows are hidden. Unselect them.
3534 15 : aMarkData.SetMultiMarkArea(ScRange(0, nRow, nTab, MAXCOL, nLastRow, nTab), false);
3535 :
3536 54 : nRow = nLastRow + 1;
3537 : }
3538 :
3539 50 : ScRangeList aNewRanges;
3540 25 : aMarkData.FillRangeListWithMarks( &aNewRanges, false );
3541 50 : return new ScCellRangesObj( pDocShell, aNewRanges );
3542 : }
3543 :
3544 0 : return NULL;
3545 : }
3546 :
3547 3 : uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryEmptyCells()
3548 : throw(uno::RuntimeException)
3549 : {
3550 3 : SolarMutexGuard aGuard;
3551 3 : if (pDocShell)
3552 : {
3553 3 : ScDocument* pDoc = pDocShell->GetDocument();
3554 :
3555 3 : ScMarkData aMarkData(*GetMarkData());
3556 :
3557 : // belegte Zellen wegmarkieren
3558 9 : for (size_t i = 0, nCount = aRanges.size(); i < nCount; ++i)
3559 : {
3560 6 : ScRange aRange = *aRanges[ i ];
3561 :
3562 6 : ScCellIterator aIter( pDoc, aRange );
3563 35 : for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next())
3564 : {
3565 : // Notizen zaehlen als nicht-leer
3566 29 : if (!aIter.isEmpty())
3567 29 : aMarkData.SetMultiMarkArea(aIter.GetPos(), false);
3568 : }
3569 6 : }
3570 :
3571 6 : ScRangeList aNewRanges;
3572 : // IsMultiMarked reicht hier nicht (wird beim deselektieren nicht zurueckgesetzt)
3573 : //if (aMarkData.HasAnyMultiMarks()) // #i20044# should be set for all empty range
3574 3 : aMarkData.FillRangeListWithMarks( &aNewRanges, false );
3575 :
3576 6 : return new ScCellRangesObj( pDocShell, aNewRanges ); // aNewRanges kann leer sein
3577 : }
3578 :
3579 0 : return NULL;
3580 : }
3581 :
3582 11 : uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryContentCells(
3583 : sal_Int16 nContentFlags )
3584 : throw(uno::RuntimeException)
3585 : {
3586 11 : SolarMutexGuard aGuard;
3587 11 : if (pDocShell)
3588 : {
3589 11 : ScDocument* pDoc = pDocShell->GetDocument();
3590 :
3591 11 : ScMarkData aMarkData;
3592 :
3593 : // passende Zellen selektieren
3594 25 : for ( size_t i = 0, nCount = aRanges.size(); i < nCount; ++i )
3595 : {
3596 14 : ScRange aRange = *aRanges[ i ];
3597 :
3598 14 : ScCellIterator aIter( pDoc, aRange );
3599 252 : for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next())
3600 : {
3601 238 : bool bAdd = false;
3602 238 : switch (aIter.getType())
3603 : {
3604 : case CELLTYPE_STRING:
3605 28 : if ( nContentFlags & sheet::CellFlags::STRING )
3606 0 : bAdd = true;
3607 28 : break;
3608 : case CELLTYPE_EDIT:
3609 0 : if ( (nContentFlags & sheet::CellFlags::STRING) || (nContentFlags & sheet::CellFlags::FORMATTED) )
3610 0 : bAdd = true;
3611 0 : break;
3612 : case CELLTYPE_FORMULA:
3613 2 : if ( nContentFlags & sheet::CellFlags::FORMULA )
3614 0 : bAdd = true;
3615 2 : break;
3616 : case CELLTYPE_VALUE:
3617 208 : if ( (nContentFlags & (sheet::CellFlags::VALUE|sheet::CellFlags::DATETIME))
3618 : == (sheet::CellFlags::VALUE|sheet::CellFlags::DATETIME) )
3619 0 : bAdd = true;
3620 : else
3621 : {
3622 : // Date/Time Erkennung
3623 :
3624 : sal_uLong nIndex = (sal_uLong)((SfxUInt32Item*)pDoc->GetAttr(
3625 208 : aIter.GetPos(), ATTR_VALUE_FORMAT))->GetValue();
3626 208 : short nTyp = pDoc->GetFormatTable()->GetType(nIndex);
3627 208 : if ((nTyp == NUMBERFORMAT_DATE) || (nTyp == NUMBERFORMAT_TIME) ||
3628 : (nTyp == NUMBERFORMAT_DATETIME))
3629 : {
3630 0 : if ( nContentFlags & sheet::CellFlags::DATETIME )
3631 0 : bAdd = true;
3632 : }
3633 : else
3634 : {
3635 208 : if ( nContentFlags & sheet::CellFlags::VALUE )
3636 6 : bAdd = true;
3637 : }
3638 : }
3639 208 : break;
3640 : default:
3641 : {
3642 : // added to avoid warnings
3643 : }
3644 : }
3645 :
3646 238 : if (bAdd)
3647 6 : aMarkData.SetMultiMarkArea(aIter.GetPos(), true);
3648 : }
3649 :
3650 14 : }
3651 :
3652 11 : ScRangeList aNewRanges;
3653 11 : if (aMarkData.IsMultiMarked())
3654 2 : aMarkData.FillRangeListWithMarks( &aNewRanges, false );
3655 :
3656 11 : return new ScCellRangesObj( pDocShell, aNewRanges ); // aNewRanges kann leer sein
3657 : }
3658 :
3659 0 : return NULL;
3660 : }
3661 :
3662 25 : uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryFormulaCells(
3663 : sal_Int32 nResultFlags )
3664 : throw(uno::RuntimeException)
3665 : {
3666 25 : SolarMutexGuard aGuard;
3667 25 : if (pDocShell)
3668 : {
3669 25 : ScDocument* pDoc = pDocShell->GetDocument();
3670 :
3671 25 : ScMarkData aMarkData;
3672 :
3673 : // passende Zellen selektieren
3674 53 : for ( size_t i = 0, nCount = aRanges.size(); i < nCount; ++i )
3675 : {
3676 28 : ScRange aRange = *aRanges[ i ];
3677 :
3678 28 : ScCellIterator aIter( pDoc, aRange );
3679 444 : for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next())
3680 : {
3681 416 : if (aIter.getType() == CELLTYPE_FORMULA)
3682 : {
3683 180 : ScFormulaCell* pFCell = aIter.getFormulaCell();
3684 180 : bool bAdd = false;
3685 180 : if (pFCell->GetErrCode())
3686 : {
3687 0 : if ( nResultFlags & sheet::FormulaResult::ERROR )
3688 0 : bAdd = true;
3689 : }
3690 180 : else if (pFCell->IsValue())
3691 : {
3692 180 : if ( nResultFlags & sheet::FormulaResult::VALUE )
3693 180 : bAdd = true;
3694 : }
3695 : else // String
3696 : {
3697 0 : if ( nResultFlags & sheet::FormulaResult::STRING )
3698 0 : bAdd = true;
3699 : }
3700 :
3701 180 : if (bAdd)
3702 180 : aMarkData.SetMultiMarkArea(aIter.GetPos(), true);
3703 : }
3704 : }
3705 28 : }
3706 :
3707 50 : ScRangeList aNewRanges;
3708 25 : if (aMarkData.IsMultiMarked())
3709 10 : aMarkData.FillRangeListWithMarks( &aNewRanges, false );
3710 :
3711 50 : return new ScCellRangesObj( pDocShell, aNewRanges ); // aNewRanges kann leer sein
3712 : }
3713 :
3714 0 : return NULL;
3715 : }
3716 :
3717 8 : uno::Reference<sheet::XSheetCellRanges> ScCellRangesBase::QueryDifferences_Impl(
3718 : const table::CellAddress& aCompare, sal_Bool bColumnDiff)
3719 : {
3720 8 : if (pDocShell)
3721 : {
3722 8 : size_t nRangeCount = aRanges.size();
3723 : size_t i;
3724 8 : ScDocument* pDoc = pDocShell->GetDocument();
3725 8 : ScMarkData aMarkData;
3726 :
3727 8 : SCCOLROW nCmpPos = bColumnDiff ? (SCCOLROW)aCompare.Row : (SCCOLROW)aCompare.Column;
3728 :
3729 : // zuerst alles selektieren, wo ueberhaupt etwas in der Vergleichsspalte steht
3730 : // (fuer gleiche Zellen wird die Selektion im zweiten Schritt aufgehoben)
3731 :
3732 8 : SCTAB nTab = lcl_FirstTab(aRanges); //! fuer alle Tabellen, wenn Markierungen pro Tabelle!
3733 8 : ScRange aCmpRange, aCellRange;
3734 8 : if (bColumnDiff)
3735 4 : aCmpRange = ScRange( 0,nCmpPos,nTab, MAXCOL,nCmpPos,nTab );
3736 : else
3737 4 : aCmpRange = ScRange( static_cast<SCCOL>(nCmpPos),0,nTab, static_cast<SCCOL>(nCmpPos),MAXROW,nTab );
3738 16 : ScCellIterator aCmpIter( pDoc, aCmpRange );
3739 41 : for (bool bHasCell = aCmpIter.first(); bHasCell; bHasCell = aCmpIter.next())
3740 : {
3741 33 : SCCOLROW nCellPos = bColumnDiff ? static_cast<SCCOLROW>(aCmpIter.GetPos().Col()) : static_cast<SCCOLROW>(aCmpIter.GetPos().Row());
3742 33 : if (bColumnDiff)
3743 32 : aCellRange = ScRange( static_cast<SCCOL>(nCellPos),0,nTab,
3744 16 : static_cast<SCCOL>(nCellPos),MAXROW,nTab );
3745 : else
3746 17 : aCellRange = ScRange( 0,nCellPos,nTab, MAXCOL,nCellPos,nTab );
3747 :
3748 126 : for (i=0; i<nRangeCount; i++)
3749 : {
3750 93 : ScRange aRange( *aRanges[ i ] );
3751 93 : if ( aRange.Intersects( aCellRange ) )
3752 : {
3753 29 : if (bColumnDiff)
3754 : {
3755 12 : aRange.aStart.SetCol(static_cast<SCCOL>(nCellPos));
3756 12 : aRange.aEnd.SetCol(static_cast<SCCOL>(nCellPos));
3757 : }
3758 : else
3759 : {
3760 17 : aRange.aStart.SetRow(nCellPos);
3761 17 : aRange.aEnd.SetRow(nCellPos);
3762 : }
3763 29 : aMarkData.SetMultiMarkArea( aRange );
3764 : }
3765 : }
3766 : }
3767 :
3768 : // alle nichtleeren Zellen mit der Vergleichsspalte vergleichen und entsprechend
3769 : // selektieren oder aufheben
3770 :
3771 8 : ScAddress aCmpAddr;
3772 22 : for (i=0; i<nRangeCount; i++)
3773 : {
3774 14 : ScRange aRange( *aRanges[ i ] );
3775 :
3776 14 : ScCellIterator aIter( pDoc, aRange );
3777 72 : for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next())
3778 : {
3779 58 : if (bColumnDiff)
3780 29 : aCmpAddr = ScAddress( aIter.GetPos().Col(), nCmpPos, aIter.GetPos().Tab() );
3781 : else
3782 29 : aCmpAddr = ScAddress( static_cast<SCCOL>(nCmpPos), aIter.GetPos().Row(), aIter.GetPos().Tab() );
3783 :
3784 58 : ScRange aOneRange(aIter.GetPos());
3785 58 : if (!aIter.equalsWithoutFormat(aCmpAddr))
3786 13 : aMarkData.SetMultiMarkArea( aOneRange );
3787 : else
3788 45 : aMarkData.SetMultiMarkArea( aOneRange, false ); // deselect
3789 : }
3790 14 : }
3791 :
3792 16 : ScRangeList aNewRanges;
3793 8 : if (aMarkData.IsMultiMarked())
3794 8 : aMarkData.FillRangeListWithMarks( &aNewRanges, false );
3795 :
3796 16 : return new ScCellRangesObj( pDocShell, aNewRanges ); // aNewRanges kann leer sein
3797 : }
3798 0 : return NULL;
3799 : }
3800 :
3801 4 : uno::Reference<sheet::XSheetCellRanges > SAL_CALL ScCellRangesBase::queryColumnDifferences(
3802 : const table::CellAddress& aCompare ) throw(uno::RuntimeException)
3803 : {
3804 4 : SolarMutexGuard aGuard;
3805 4 : return QueryDifferences_Impl( aCompare, true );
3806 : }
3807 :
3808 4 : uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryRowDifferences(
3809 : const table::CellAddress& aCompare ) throw(uno::RuntimeException)
3810 : {
3811 4 : SolarMutexGuard aGuard;
3812 4 : return QueryDifferences_Impl( aCompare, false );
3813 : }
3814 :
3815 2 : uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryIntersection(
3816 : const table::CellRangeAddress& aRange ) throw(uno::RuntimeException)
3817 : {
3818 2 : SolarMutexGuard aGuard;
3819 : ScRange aMask( (SCCOL)aRange.StartColumn, (SCROW)aRange.StartRow, aRange.Sheet,
3820 2 : (SCCOL)aRange.EndColumn, (SCROW)aRange.EndRow, aRange.Sheet );
3821 :
3822 4 : ScRangeList aNew;
3823 7 : for ( size_t i = 0, nCount = aRanges.size(); i < nCount; ++i )
3824 : {
3825 5 : ScRange aTemp( *aRanges[ i ] );
3826 5 : if ( aTemp.Intersects( aMask ) )
3827 6 : aNew.Join( ScRange( std::max( aTemp.aStart.Col(), aMask.aStart.Col() ),
3828 6 : std::max( aTemp.aStart.Row(), aMask.aStart.Row() ),
3829 6 : std::max( aTemp.aStart.Tab(), aMask.aStart.Tab() ),
3830 6 : std::min( aTemp.aEnd.Col(), aMask.aEnd.Col() ),
3831 6 : std::min( aTemp.aEnd.Row(), aMask.aEnd.Row() ),
3832 21 : std::min( aTemp.aEnd.Tab(), aMask.aEnd.Tab() ) ) );
3833 : }
3834 :
3835 4 : return new ScCellRangesObj( pDocShell, aNew ); // kann leer sein
3836 : }
3837 :
3838 : // XFormulaQuery
3839 :
3840 3 : uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryPrecedents(
3841 : sal_Bool bRecursive ) throw(uno::RuntimeException)
3842 : {
3843 3 : SolarMutexGuard aGuard;
3844 3 : if ( pDocShell )
3845 : {
3846 3 : ScDocument* pDoc = pDocShell->GetDocument();
3847 :
3848 3 : ScRangeList aNewRanges(aRanges);
3849 : sal_Bool bFound;
3850 3 : do
3851 : {
3852 3 : bFound = false;
3853 :
3854 : // aMarkData uses aNewRanges, not aRanges, so GetMarkData can't be used
3855 3 : ScMarkData aMarkData;
3856 3 : aMarkData.MarkFromRangeList( aNewRanges, false );
3857 3 : aMarkData.MarkToMulti(); // needed for IsAllMarked
3858 :
3859 9 : for (size_t nR = 0, nCount = aNewRanges.size(); nR<nCount; ++nR)
3860 : {
3861 6 : ScRange aRange( *aNewRanges[ nR] );
3862 6 : ScCellIterator aIter( pDoc, aRange );
3863 36 : for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next())
3864 : {
3865 30 : if (aIter.getType() != CELLTYPE_FORMULA)
3866 28 : continue;
3867 :
3868 2 : ScDetectiveRefIter aRefIter(aIter.getFormulaCell());
3869 2 : ScRange aRefRange;
3870 6 : while ( aRefIter.GetNextRef( aRefRange) )
3871 : {
3872 2 : if ( bRecursive && !bFound && !aMarkData.IsAllMarked( aRefRange ) )
3873 0 : bFound = true;
3874 2 : aMarkData.SetMultiMarkArea(aRefRange, true);
3875 : }
3876 : }
3877 6 : }
3878 :
3879 3 : aMarkData.FillRangeListWithMarks( &aNewRanges, sal_True );
3880 : }
3881 0 : while ( bRecursive && bFound );
3882 :
3883 3 : return new ScCellRangesObj( pDocShell, aNewRanges );
3884 : }
3885 :
3886 0 : return NULL;
3887 : }
3888 :
3889 3 : uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryDependents(
3890 : sal_Bool bRecursive ) throw(uno::RuntimeException)
3891 : {
3892 3 : SolarMutexGuard aGuard;
3893 3 : if ( pDocShell )
3894 : {
3895 3 : ScDocument* pDoc = pDocShell->GetDocument();
3896 :
3897 3 : ScRangeList aNewRanges(aRanges);
3898 : sal_Bool bFound;
3899 3 : do
3900 : {
3901 3 : bFound = false;
3902 :
3903 : // aMarkData uses aNewRanges, not aRanges, so GetMarkData can't be used
3904 3 : ScMarkData aMarkData;
3905 3 : aMarkData.MarkFromRangeList( aNewRanges, false );
3906 3 : aMarkData.MarkToMulti(); // needed for IsAllMarked
3907 :
3908 3 : SCTAB nTab = lcl_FirstTab(aNewRanges); //! alle Tabellen
3909 :
3910 6 : ScCellIterator aCellIter( pDoc, ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab) );
3911 114 : for (bool bHasCell = aCellIter.first(); bHasCell; bHasCell = aCellIter.next())
3912 : {
3913 111 : if (aCellIter.getType() != CELLTYPE_FORMULA)
3914 108 : continue;
3915 :
3916 3 : bool bMark = false;
3917 3 : ScDetectiveRefIter aIter(aCellIter.getFormulaCell());
3918 3 : ScRange aRefRange;
3919 9 : while ( aIter.GetNextRef( aRefRange) )
3920 : {
3921 3 : size_t nRangesCount = aNewRanges.size();
3922 9 : for (size_t nR = 0; nR < nRangesCount; ++nR)
3923 : {
3924 6 : ScRange aRange( *aNewRanges[ nR ] );
3925 6 : if (aRange.Intersects(aRefRange))
3926 2 : bMark = sal_True; // von Teil des Ranges abhaengig
3927 : }
3928 : }
3929 3 : if (bMark)
3930 : {
3931 2 : ScRange aCellRange(aCellIter.GetPos());
3932 2 : if ( bRecursive && !bFound && !aMarkData.IsAllMarked( aCellRange ) )
3933 0 : bFound = true;
3934 2 : aMarkData.SetMultiMarkArea(aCellRange, true);
3935 : }
3936 : }
3937 :
3938 6 : aMarkData.FillRangeListWithMarks( &aNewRanges, sal_True );
3939 : }
3940 0 : while ( bRecursive && bFound );
3941 :
3942 3 : return new ScCellRangesObj( pDocShell, aNewRanges );
3943 : }
3944 :
3945 0 : return NULL;
3946 : }
3947 :
3948 : // XSearchable
3949 :
3950 12 : uno::Reference<util::XSearchDescriptor> SAL_CALL ScCellRangesBase::createSearchDescriptor()
3951 : throw(uno::RuntimeException)
3952 : {
3953 12 : SolarMutexGuard aGuard;
3954 12 : return new ScCellSearchObj;
3955 : }
3956 :
3957 22 : uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangesBase::findAll(
3958 : const uno::Reference<util::XSearchDescriptor>& xDesc )
3959 : throw(uno::RuntimeException)
3960 : {
3961 22 : SolarMutexGuard aGuard;
3962 : // Wenn nichts gefunden wird, soll Null zurueckgegeben werden (?)
3963 22 : uno::Reference<container::XIndexAccess> xRet;
3964 22 : if ( pDocShell && xDesc.is() )
3965 : {
3966 22 : ScCellSearchObj* pSearch = ScCellSearchObj::getImplementation( xDesc );
3967 22 : if (pSearch)
3968 : {
3969 22 : SvxSearchItem* pSearchItem = pSearch->GetSearchItem();
3970 22 : if (pSearchItem)
3971 : {
3972 22 : ScDocument* pDoc = pDocShell->GetDocument();
3973 22 : pSearchItem->SetCommand( SVX_SEARCHCMD_FIND_ALL );
3974 : // immer nur innerhalb dieses Objekts
3975 22 : pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) );
3976 :
3977 22 : ScMarkData aMark(*GetMarkData());
3978 :
3979 44 : OUString aDummyUndo;
3980 44 : ScRangeList aMatchedRanges;
3981 22 : SCCOL nCol = 0;
3982 22 : SCROW nRow = 0;
3983 22 : SCTAB nTab = 0;
3984 : bool bFound = pDoc->SearchAndReplace(
3985 22 : *pSearchItem, nCol, nRow, nTab, aMark, aMatchedRanges, aDummyUndo, NULL);
3986 22 : if (bFound)
3987 : {
3988 : // bei findAll immer CellRanges, egal wieviel gefunden wurde
3989 18 : xRet.set(new ScCellRangesObj( pDocShell, aMatchedRanges ));
3990 22 : }
3991 : }
3992 : }
3993 : }
3994 22 : return xRet;
3995 : }
3996 :
3997 23 : uno::Reference<uno::XInterface> ScCellRangesBase::Find_Impl(
3998 : const uno::Reference<util::XSearchDescriptor>& xDesc,
3999 : const ScAddress* pLastPos )
4000 : {
4001 23 : uno::Reference<uno::XInterface> xRet;
4002 23 : if ( pDocShell && xDesc.is() )
4003 : {
4004 23 : ScCellSearchObj* pSearch = ScCellSearchObj::getImplementation( xDesc );
4005 23 : if (pSearch)
4006 : {
4007 23 : SvxSearchItem* pSearchItem = pSearch->GetSearchItem();
4008 23 : if (pSearchItem)
4009 : {
4010 23 : ScDocument* pDoc = pDocShell->GetDocument();
4011 23 : pSearchItem->SetCommand( SVX_SEARCHCMD_FIND );
4012 : // immer nur innerhalb dieses Objekts
4013 23 : pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) );
4014 :
4015 23 : ScMarkData aMark(*GetMarkData());
4016 :
4017 : SCCOL nCol;
4018 : SCROW nRow;
4019 : SCTAB nTab;
4020 23 : if (pLastPos)
4021 2 : pLastPos->GetVars( nCol, nRow, nTab );
4022 : else
4023 : {
4024 21 : nTab = lcl_FirstTab(aRanges); //! mehrere Tabellen?
4025 21 : ScDocument::GetSearchAndReplaceStart( *pSearchItem, nCol, nRow );
4026 : }
4027 :
4028 46 : OUString aDummyUndo;
4029 46 : ScRangeList aMatchedRanges;
4030 : bool bFound = pDoc->SearchAndReplace(
4031 23 : *pSearchItem, nCol, nRow, nTab, aMark, aMatchedRanges, aDummyUndo, NULL);
4032 23 : if (bFound)
4033 : {
4034 15 : ScAddress aFoundPos( nCol, nRow, nTab );
4035 15 : xRet.set((cppu::OWeakObject*) new ScCellObj( pDocShell, aFoundPos ));
4036 23 : }
4037 : }
4038 : }
4039 : }
4040 23 : return xRet;
4041 : }
4042 :
4043 21 : uno::Reference<uno::XInterface> SAL_CALL ScCellRangesBase::findFirst(
4044 : const uno::Reference<util::XSearchDescriptor>& xDesc )
4045 : throw(uno::RuntimeException)
4046 : {
4047 21 : SolarMutexGuard aGuard;
4048 21 : return Find_Impl( xDesc, NULL );
4049 : }
4050 :
4051 2 : uno::Reference<uno::XInterface> SAL_CALL ScCellRangesBase::findNext(
4052 : const uno::Reference<uno::XInterface>& xStartAt,
4053 : const uno::Reference<util::XSearchDescriptor >& xDesc )
4054 : throw(uno::RuntimeException)
4055 : {
4056 2 : SolarMutexGuard aGuard;
4057 2 : if ( xStartAt.is() )
4058 : {
4059 2 : ScCellRangesBase* pRangesImp = ScCellRangesBase::getImplementation( xStartAt );
4060 2 : if ( pRangesImp && pRangesImp->GetDocShell() == pDocShell )
4061 : {
4062 2 : const ScRangeList& rStartRanges = pRangesImp->GetRangeList();
4063 2 : if ( rStartRanges.size() == 1 )
4064 : {
4065 2 : ScAddress aStartPos = rStartRanges[ 0 ]->aStart;
4066 2 : return Find_Impl( xDesc, &aStartPos );
4067 : }
4068 : }
4069 : }
4070 0 : return NULL;
4071 : }
4072 :
4073 : // XReplaceable
4074 :
4075 24 : uno::Reference<util::XReplaceDescriptor> SAL_CALL ScCellRangesBase::createReplaceDescriptor()
4076 : throw(uno::RuntimeException)
4077 : {
4078 24 : SolarMutexGuard aGuard;
4079 24 : return new ScCellSearchObj;
4080 : }
4081 :
4082 26 : sal_Int32 SAL_CALL ScCellRangesBase::replaceAll( const uno::Reference<util::XSearchDescriptor>& xDesc )
4083 : throw(uno::RuntimeException)
4084 : {
4085 26 : SolarMutexGuard aGuard;
4086 26 : sal_Int32 nReplaced = 0;
4087 26 : if ( pDocShell && xDesc.is() )
4088 : {
4089 26 : ScCellSearchObj* pSearch = ScCellSearchObj::getImplementation( xDesc );
4090 26 : if (pSearch)
4091 : {
4092 26 : SvxSearchItem* pSearchItem = pSearch->GetSearchItem();
4093 26 : if (pSearchItem)
4094 : {
4095 26 : ScDocument* pDoc = pDocShell->GetDocument();
4096 26 : sal_Bool bUndo(pDoc->IsUndoEnabled());
4097 26 : pSearchItem->SetCommand( SVX_SEARCHCMD_REPLACE_ALL );
4098 : // immer nur innerhalb dieses Objekts
4099 26 : pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) );
4100 :
4101 26 : ScMarkData aMark(*GetMarkData());
4102 :
4103 26 : SCTAB nTabCount = pDoc->GetTableCount();
4104 26 : bool bProtected = !pDocShell->IsEditable();
4105 26 : ScMarkData::iterator itr = aMark.begin(), itrEnd = aMark.end();
4106 52 : for (; itr != itrEnd && *itr < nTabCount; ++itr)
4107 26 : if ( pDoc->IsTabProtected(*itr) )
4108 0 : bProtected = true;
4109 26 : if (bProtected)
4110 : {
4111 : //! Exception, oder was?
4112 : }
4113 : else
4114 : {
4115 26 : SCTAB nTab = aMark.GetFirstSelected(); // bei SearchAndReplace nicht benutzt
4116 26 : SCCOL nCol = 0;
4117 26 : SCROW nRow = 0;
4118 :
4119 26 : OUString aUndoStr;
4120 26 : ScDocument* pUndoDoc = NULL;
4121 26 : if (bUndo)
4122 : {
4123 26 : pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
4124 26 : pUndoDoc->InitUndo( pDoc, nTab, nTab );
4125 : }
4126 26 : itr = aMark.begin();
4127 52 : for (; itr != itrEnd && *itr < nTabCount; ++itr)
4128 26 : if ( *itr != nTab && bUndo)
4129 0 : pUndoDoc->AddUndoTab( *itr, *itr );
4130 52 : boost::scoped_ptr<ScMarkData> pUndoMark;
4131 26 : if (bUndo)
4132 26 : pUndoMark.reset(new ScMarkData(aMark));
4133 :
4134 26 : bool bFound = false;
4135 26 : if (bUndo)
4136 : {
4137 26 : ScRangeList aMatchedRanges;
4138 : bFound = pDoc->SearchAndReplace(
4139 26 : *pSearchItem, nCol, nRow, nTab, aMark, aMatchedRanges, aUndoStr, pUndoDoc );
4140 : }
4141 26 : if (bFound)
4142 : {
4143 22 : nReplaced = pUndoDoc->GetCellCount();
4144 :
4145 22 : pDocShell->GetUndoManager()->AddUndoAction(
4146 : new ScUndoReplace( pDocShell, *pUndoMark, nCol, nRow, nTab,
4147 22 : aUndoStr, pUndoDoc, pSearchItem ) );
4148 :
4149 22 : pDocShell->PostPaintGridAll();
4150 22 : pDocShell->SetDocumentModified();
4151 : }
4152 : else
4153 : {
4154 4 : delete pUndoDoc;
4155 : // nReplaced bleibt 0
4156 26 : }
4157 26 : }
4158 : }
4159 : }
4160 : }
4161 26 : return nReplaced;
4162 : }
4163 :
4164 : // XUnoTunnel
4165 :
4166 14630 : sal_Int64 SAL_CALL ScCellRangesBase::getSomething(
4167 : const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException)
4168 : {
4169 29260 : if ( rId.getLength() == 16 &&
4170 14630 : 0 == memcmp( getUnoTunnelId().getConstArray(),
4171 29260 : rId.getConstArray(), 16 ) )
4172 : {
4173 12095 : return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
4174 : }
4175 2535 : return 0;
4176 : }
4177 :
4178 : namespace
4179 : {
4180 : class theScCellRangesBaseUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScCellRangesBaseUnoTunnelId> {};
4181 : }
4182 :
4183 26727 : const uno::Sequence<sal_Int8>& ScCellRangesBase::getUnoTunnelId()
4184 : {
4185 26727 : return theScCellRangesBaseUnoTunnelId::get().getSeq();
4186 : }
4187 :
4188 12113 : ScCellRangesBase* ScCellRangesBase::getImplementation( const uno::Reference<uno::XInterface> xObj )
4189 : {
4190 12113 : ScCellRangesBase* pRet = NULL;
4191 12113 : uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
4192 12113 : if (xUT.is())
4193 12097 : pRet = reinterpret_cast<ScCellRangesBase*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
4194 12113 : return pRet;
4195 : }
4196 :
4197 : //------------------------------------------------------------------------
4198 :
4199 : typedef boost::ptr_vector<ScNamedEntry> ScNamedEntryArr_Impl;
4200 :
4201 1480 : struct ScCellRangesObj::Impl
4202 : {
4203 : ScNamedEntryArr_Impl m_aNamedEntries;
4204 : };
4205 :
4206 743 : ScCellRangesObj::ScCellRangesObj(ScDocShell* pDocSh, const ScRangeList& rR)
4207 : : ScCellRangesBase(pDocSh, rR)
4208 743 : , m_pImpl(new Impl)
4209 : {
4210 743 : }
4211 :
4212 1474 : ScCellRangesObj::~ScCellRangesObj()
4213 : {
4214 1474 : }
4215 :
4216 1512 : void ScCellRangesObj::RefChanged()
4217 : {
4218 1512 : ScCellRangesBase::RefChanged();
4219 :
4220 : // nix weiter...
4221 1512 : }
4222 :
4223 2054 : uno::Any SAL_CALL ScCellRangesObj::queryInterface( const uno::Type& rType )
4224 : throw(uno::RuntimeException)
4225 : {
4226 2054 : SC_QUERYINTERFACE( sheet::XSheetCellRangeContainer )
4227 1510 : SC_QUERYINTERFACE( sheet::XSheetCellRanges )
4228 1463 : SC_QUERYINTERFACE( container::XIndexAccess )
4229 1363 : SC_QUERY_MULTIPLE( container::XElementAccess, container::XIndexAccess )
4230 1363 : SC_QUERYINTERFACE( container::XEnumerationAccess )
4231 1311 : SC_QUERYINTERFACE( container::XNameContainer )
4232 1303 : SC_QUERYINTERFACE( container::XNameReplace )
4233 1303 : SC_QUERYINTERFACE( container::XNameAccess )
4234 :
4235 1223 : return ScCellRangesBase::queryInterface( rType );
4236 : }
4237 :
4238 6771 : void SAL_CALL ScCellRangesObj::acquire() throw()
4239 : {
4240 6771 : ScCellRangesBase::acquire();
4241 6771 : }
4242 :
4243 6749 : void SAL_CALL ScCellRangesObj::release() throw()
4244 : {
4245 6749 : ScCellRangesBase::release();
4246 6749 : }
4247 :
4248 0 : uno::Sequence<uno::Type> SAL_CALL ScCellRangesObj::getTypes() throw(uno::RuntimeException)
4249 : {
4250 0 : static uno::Sequence<uno::Type> aTypes;
4251 0 : if ( aTypes.getLength() == 0 )
4252 : {
4253 0 : uno::Sequence<uno::Type> aParentTypes(ScCellRangesBase::getTypes());
4254 0 : long nParentLen = aParentTypes.getLength();
4255 0 : const uno::Type* pParentPtr = aParentTypes.getConstArray();
4256 :
4257 0 : aTypes.realloc( nParentLen + 3 );
4258 0 : uno::Type* pPtr = aTypes.getArray();
4259 0 : pPtr[nParentLen + 0] = getCppuType((const uno::Reference<sheet::XSheetCellRangeContainer>*)0);
4260 0 : pPtr[nParentLen + 1] = getCppuType((const uno::Reference<container::XNameContainer>*)0);
4261 0 : pPtr[nParentLen + 2] = getCppuType((const uno::Reference<container::XEnumerationAccess>*)0);
4262 :
4263 0 : for (long i=0; i<nParentLen; i++)
4264 0 : pPtr[i] = pParentPtr[i]; // parent types first
4265 : }
4266 0 : return aTypes;
4267 : }
4268 :
4269 : namespace
4270 : {
4271 : class theScCellRangesObjImplementationId : public rtl::Static< UnoTunnelIdInit, theScCellRangesObjImplementationId > {};
4272 : }
4273 :
4274 23 : uno::Sequence<sal_Int8> SAL_CALL ScCellRangesObj::getImplementationId()
4275 : throw(uno::RuntimeException)
4276 : {
4277 23 : return theScCellRangesObjImplementationId::get().getSeq();
4278 : }
4279 :
4280 : // XCellRanges
4281 :
4282 479 : ScCellRangeObj* ScCellRangesObj::GetObjectByIndex_Impl(sal_Int32 nIndex) const
4283 : {
4284 479 : ScDocShell* pDocSh = GetDocShell();
4285 479 : const ScRangeList& rRanges = GetRangeList();
4286 479 : if ( pDocSh && nIndex >= 0 && nIndex < sal::static_int_cast<sal_Int32>(rRanges.size()) )
4287 : {
4288 477 : ScRange aRange( *rRanges[ nIndex ] );
4289 477 : if ( aRange.aStart == aRange.aEnd )
4290 10 : return new ScCellObj( pDocSh, aRange.aStart );
4291 : else
4292 467 : return new ScCellRangeObj( pDocSh, aRange );
4293 : }
4294 :
4295 2 : return NULL; // keine DocShell oder falscher Index
4296 : }
4297 :
4298 273 : uno::Sequence<table::CellRangeAddress> SAL_CALL ScCellRangesObj::getRangeAddresses()
4299 : throw(uno::RuntimeException)
4300 : {
4301 273 : SolarMutexGuard aGuard;
4302 273 : ScDocShell* pDocSh = GetDocShell();
4303 273 : const ScRangeList& rRanges = GetRangeList();
4304 273 : size_t nCount = rRanges.size();
4305 273 : if ( pDocSh && nCount )
4306 : {
4307 261 : table::CellRangeAddress aRangeAddress;
4308 261 : uno::Sequence<table::CellRangeAddress> aSeq(nCount);
4309 261 : table::CellRangeAddress* pAry = aSeq.getArray();
4310 613 : for ( size_t i=0; i < nCount; i++)
4311 : {
4312 352 : ScUnoConversion::FillApiRange( aRangeAddress, *rRanges[ i ] );
4313 352 : pAry[i] = aRangeAddress;
4314 : }
4315 261 : return aSeq;
4316 : }
4317 :
4318 12 : return uno::Sequence<table::CellRangeAddress>(0); // leer ist moeglich
4319 : }
4320 :
4321 13 : uno::Reference<container::XEnumerationAccess> SAL_CALL ScCellRangesObj::getCells()
4322 : throw(uno::RuntimeException)
4323 : {
4324 13 : SolarMutexGuard aGuard;
4325 :
4326 : // getCells with empty range list is possible (no exception),
4327 : // the resulting enumeration just has no elements
4328 : // (same behaviour as a valid range with no cells)
4329 : // This is handled in ScCellsEnumeration ctor.
4330 :
4331 13 : const ScRangeList& rRanges = GetRangeList();
4332 13 : ScDocShell* pDocSh = GetDocShell();
4333 13 : if (pDocSh)
4334 13 : return new ScCellsObj( pDocSh, rRanges );
4335 0 : return NULL;
4336 : }
4337 :
4338 33 : OUString SAL_CALL ScCellRangesObj::getRangeAddressesAsString()
4339 : throw(uno::RuntimeException)
4340 : {
4341 33 : SolarMutexGuard aGuard;
4342 66 : String aString;
4343 33 : ScDocShell* pDocSh = GetDocShell();
4344 33 : const ScRangeList& rRanges = GetRangeList();
4345 33 : if (pDocSh)
4346 33 : rRanges.Format( aString, SCA_VALID | SCA_TAB_3D, pDocSh->GetDocument() );
4347 66 : return aString;
4348 : }
4349 :
4350 : // XSheetCellRangeContainer
4351 :
4352 1455 : void SAL_CALL ScCellRangesObj::addRangeAddress( const table::CellRangeAddress& rRange,
4353 : sal_Bool bMergeRanges )
4354 : throw(::com::sun::star::uno::RuntimeException)
4355 : {
4356 1455 : SolarMutexGuard aGuard;
4357 : ScRange aRange(static_cast<SCCOL>(rRange.StartColumn),
4358 : static_cast<SCROW>(rRange.StartRow),
4359 : static_cast<SCTAB>(rRange.Sheet),
4360 : static_cast<SCCOL>(rRange.EndColumn),
4361 : static_cast<SCROW>(rRange.EndRow),
4362 1455 : static_cast<SCTAB>(rRange.Sheet));
4363 1455 : AddRange(aRange, bMergeRanges);
4364 1455 : }
4365 :
4366 8 : static void lcl_RemoveNamedEntry( ScNamedEntryArr_Impl& rNamedEntries, const ScRange& rRange )
4367 : {
4368 8 : sal_uInt16 nCount = rNamedEntries.size();
4369 26 : for ( sal_uInt16 n=nCount; n--; )
4370 10 : if ( rNamedEntries[n].GetRange() == rRange )
4371 4 : rNamedEntries.erase( rNamedEntries.begin() + n );
4372 8 : }
4373 :
4374 8 : void SAL_CALL ScCellRangesObj::removeRangeAddress( const table::CellRangeAddress& rRange )
4375 : throw(::com::sun::star::container::NoSuchElementException,
4376 : ::com::sun::star::uno::RuntimeException)
4377 : {
4378 8 : SolarMutexGuard aGuard;
4379 8 : const ScRangeList& rRanges = GetRangeList();
4380 :
4381 16 : ScRangeList aSheetRanges;
4382 16 : ScRangeList aNotSheetRanges;
4383 25 : for (size_t i = 0; i < rRanges.size(); ++i)
4384 : {
4385 17 : if (rRanges[ i]->aStart.Tab() == rRange.Sheet)
4386 : {
4387 14 : aSheetRanges.Append( *rRanges[ i ] );
4388 : }
4389 : else
4390 : {
4391 3 : aNotSheetRanges.Append( *rRanges[ i ] );
4392 : }
4393 : }
4394 16 : ScMarkData aMarkData;
4395 8 : aMarkData.MarkFromRangeList( aSheetRanges, false );
4396 : ScRange aRange(static_cast<SCCOL>(rRange.StartColumn),
4397 : static_cast<SCROW>(rRange.StartRow),
4398 : static_cast<SCTAB>(rRange.Sheet),
4399 : static_cast<SCCOL>(rRange.EndColumn),
4400 : static_cast<SCROW>(rRange.EndRow),
4401 8 : static_cast<SCTAB>(rRange.Sheet));
4402 8 : if (aMarkData.GetTableSelect( aRange.aStart.Tab() ))
4403 : {
4404 8 : aMarkData.MarkToMulti();
4405 8 : if (aMarkData.IsAllMarked( aRange ) )
4406 : {
4407 8 : aMarkData.SetMultiMarkArea( aRange, false );
4408 8 : lcl_RemoveNamedEntry(m_pImpl->m_aNamedEntries, aRange);
4409 : }
4410 : else
4411 0 : throw container::NoSuchElementException();
4412 : }
4413 8 : SetNewRanges(aNotSheetRanges);
4414 16 : ScRangeList aNew;
4415 8 : aMarkData.FillRangeListWithMarks( &aNew, false );
4416 14 : for ( size_t j = 0; j < aNew.size(); ++j)
4417 : {
4418 6 : AddRange(*aNew[ j ], false);
4419 8 : }
4420 8 : }
4421 :
4422 1 : void SAL_CALL ScCellRangesObj::addRangeAddresses( const uno::Sequence<table::CellRangeAddress >& rRanges,
4423 : sal_Bool bMergeRanges )
4424 : throw(::com::sun::star::uno::RuntimeException)
4425 : {
4426 1 : SolarMutexGuard aGuard;
4427 1 : sal_Int32 nCount(rRanges.getLength());
4428 1 : if (nCount)
4429 : {
4430 1 : const table::CellRangeAddress* pRanges = rRanges.getConstArray();
4431 4 : for (sal_Int32 i = 0; i < rRanges.getLength(); i++, pRanges++)
4432 : {
4433 : ScRange aRange(static_cast<SCCOL>(pRanges->StartColumn),
4434 : static_cast<SCROW>(pRanges->StartRow),
4435 : static_cast<SCTAB>(pRanges->Sheet),
4436 : static_cast<SCCOL>(pRanges->EndColumn),
4437 : static_cast<SCROW>(pRanges->EndRow),
4438 3 : static_cast<SCTAB>(pRanges->Sheet));
4439 3 : AddRange(aRange, bMergeRanges);
4440 : }
4441 1 : }
4442 1 : }
4443 :
4444 4 : void SAL_CALL ScCellRangesObj::removeRangeAddresses( const uno::Sequence<table::CellRangeAddress >& rRangeSeq )
4445 : throw(::com::sun::star::container::NoSuchElementException,
4446 : ::com::sun::star::uno::RuntimeException)
4447 : {
4448 : // use sometimes a better/faster implementation
4449 4 : sal_uInt32 nCount(rRangeSeq.getLength());
4450 4 : if (nCount)
4451 : {
4452 2 : const table::CellRangeAddress* pRanges = rRangeSeq.getConstArray();
4453 9 : for (sal_uInt32 i=0; i < nCount; ++i, ++pRanges)
4454 : {
4455 7 : removeRangeAddress(*pRanges);
4456 : }
4457 : }
4458 4 : }
4459 :
4460 : // XNameContainer
4461 :
4462 4 : static void lcl_RemoveNamedEntry( ScNamedEntryArr_Impl& rNamedEntries, const String& rName )
4463 : {
4464 4 : sal_uInt16 nCount = rNamedEntries.size();
4465 25 : for ( sal_uInt16 n=nCount; n--; )
4466 17 : if ( rNamedEntries[n].GetName() == rName )
4467 3 : rNamedEntries.erase( rNamedEntries.begin() + n );
4468 4 : }
4469 :
4470 37 : void SAL_CALL ScCellRangesObj::insertByName( const OUString& aName, const uno::Any& aElement )
4471 : throw(lang::IllegalArgumentException, container::ElementExistException,
4472 : lang::WrappedTargetException, uno::RuntimeException)
4473 : {
4474 37 : SolarMutexGuard aGuard;
4475 37 : ScDocShell* pDocSh = GetDocShell();
4476 37 : sal_Bool bDone = false;
4477 :
4478 : //! Type of aElement can be some specific interface instead of XInterface
4479 :
4480 74 : uno::Reference<uno::XInterface> xInterface(aElement, uno::UNO_QUERY);
4481 37 : if ( pDocSh && xInterface.is() )
4482 : {
4483 36 : ScCellRangesBase* pRangesImp = ScCellRangesBase::getImplementation( xInterface );
4484 36 : if ( pRangesImp && pRangesImp->GetDocShell() == pDocSh )
4485 : {
4486 : // if explicit name is given and already existing, throw exception
4487 :
4488 36 : String aNamStr(aName);
4489 36 : if ( aNamStr.Len() )
4490 : {
4491 36 : size_t nNamedCount = m_pImpl->m_aNamedEntries.size();
4492 98 : for (size_t n = 0; n < nNamedCount; n++)
4493 : {
4494 63 : if (m_pImpl->m_aNamedEntries[n].GetName() == aNamStr)
4495 1 : throw container::ElementExistException();
4496 : }
4497 : }
4498 :
4499 70 : ScRangeList aNew(GetRangeList());
4500 35 : const ScRangeList& rAddRanges = pRangesImp->GetRangeList();
4501 35 : size_t nAddCount = rAddRanges.size();
4502 70 : for ( size_t i = 0; i < nAddCount; i++ )
4503 35 : aNew.Join( *rAddRanges[ i ] );
4504 35 : SetNewRanges(aNew);
4505 35 : bDone = sal_True;
4506 :
4507 35 : if ( !aName.isEmpty() && nAddCount == 1 )
4508 : {
4509 : // if a name is given, also insert into list of named entries
4510 : // (only possible for a single range)
4511 : // name is not in m_pImpl->m_aNamedEntries (tested above)
4512 :
4513 35 : ScNamedEntry* pEntry = new ScNamedEntry( aNamStr, *rAddRanges[ 0 ] );
4514 35 : m_pImpl->m_aNamedEntries.push_back(pEntry);
4515 36 : }
4516 : }
4517 : }
4518 :
4519 36 : if (!bDone)
4520 : {
4521 : // invalid element - double names are handled above
4522 1 : throw lang::IllegalArgumentException();
4523 37 : }
4524 35 : }
4525 :
4526 13 : static sal_Bool lcl_FindRangeByName( const ScRangeList& rRanges, ScDocShell* pDocSh,
4527 : const String& rName, size_t& rIndex )
4528 : {
4529 13 : if (pDocSh)
4530 : {
4531 13 : String aRangeStr;
4532 13 : ScDocument* pDoc = pDocSh->GetDocument();
4533 67 : for ( size_t i = 0, nCount = rRanges.size(); i < nCount; i++ )
4534 : {
4535 54 : rRanges[ i ]->Format( aRangeStr, SCA_VALID | SCA_TAB_3D, pDoc );
4536 54 : if ( aRangeStr == rName )
4537 : {
4538 0 : rIndex = i;
4539 0 : return sal_True;
4540 : }
4541 13 : }
4542 : }
4543 13 : return false; // nicht gefunden
4544 : }
4545 :
4546 9 : static sal_Bool lcl_FindRangeOrEntry( const ScNamedEntryArr_Impl& rNamedEntries,
4547 : const ScRangeList& rRanges, ScDocShell* pDocSh,
4548 : const String& rName, ScRange& rFound )
4549 : {
4550 : // exact range in list?
4551 :
4552 9 : size_t nIndex = 0;
4553 9 : if ( lcl_FindRangeByName( rRanges, pDocSh, rName, nIndex ) )
4554 : {
4555 0 : rFound = *rRanges[ nIndex ];
4556 0 : return true;
4557 : }
4558 :
4559 : // range contained in selection? (sheet must be specified)
4560 :
4561 9 : ScRange aCellRange;
4562 9 : sal_uInt16 nParse = aCellRange.ParseAny( rName, pDocSh->GetDocument() );
4563 9 : if ( ( nParse & ( SCA_VALID | SCA_TAB_3D ) ) == ( SCA_VALID | SCA_TAB_3D ) )
4564 : {
4565 0 : ScMarkData aMarkData;
4566 0 : aMarkData.MarkFromRangeList( rRanges, false );
4567 0 : aMarkData.MarkToMulti(); // needed for IsAllMarked
4568 0 : if ( aMarkData.IsAllMarked( aCellRange ) )
4569 : {
4570 0 : rFound = aCellRange;
4571 0 : return sal_True;
4572 0 : }
4573 : }
4574 :
4575 : // named entry in this object?
4576 :
4577 9 : if ( !rNamedEntries.empty() )
4578 : {
4579 31 : for ( sal_uInt16 n=0; n<rNamedEntries.size(); n++ )
4580 28 : if ( rNamedEntries[n].GetName() == rName )
4581 : {
4582 : // test if named entry is contained in rRanges
4583 :
4584 6 : const ScRange& rComp = rNamedEntries[n].GetRange();
4585 6 : ScMarkData aMarkData;
4586 6 : aMarkData.MarkFromRangeList( rRanges, false );
4587 6 : aMarkData.MarkToMulti(); // needed for IsAllMarked
4588 6 : if ( aMarkData.IsAllMarked( rComp ) )
4589 : {
4590 6 : rFound = rComp;
4591 6 : return sal_True;
4592 0 : }
4593 : }
4594 : }
4595 :
4596 3 : return false; // not found
4597 : }
4598 :
4599 4 : void SAL_CALL ScCellRangesObj::removeByName( const OUString& aName )
4600 : throw(container::NoSuchElementException,
4601 : lang::WrappedTargetException, uno::RuntimeException)
4602 : {
4603 4 : SolarMutexGuard aGuard;
4604 4 : sal_Bool bDone = false;
4605 8 : String aNameStr(aName);
4606 4 : ScDocShell* pDocSh = GetDocShell();
4607 4 : const ScRangeList& rRanges = GetRangeList();
4608 4 : size_t nIndex = 0;
4609 4 : if ( lcl_FindRangeByName( rRanges, pDocSh, aNameStr, nIndex ) )
4610 : {
4611 : // einzelnen Range weglassen
4612 0 : ScRangeList aNew;
4613 0 : for ( size_t i = 0, nCount = rRanges.size(); i < nCount; i++ )
4614 0 : if (i != nIndex)
4615 0 : aNew.Append( *rRanges[ i ] );
4616 0 : SetNewRanges(aNew);
4617 0 : bDone = sal_True;
4618 : }
4619 4 : else if (pDocSh)
4620 : {
4621 : // deselect any ranges (parsed or named entry)
4622 4 : ScRangeList aDiff;
4623 4 : sal_Bool bValid = ( aDiff.Parse( aNameStr, pDocSh->GetDocument() ) & SCA_VALID ) != 0;
4624 4 : if (!bValid && !m_pImpl->m_aNamedEntries.empty())
4625 : {
4626 4 : sal_uInt16 nCount = m_pImpl->m_aNamedEntries.size();
4627 18 : for (sal_uInt16 n=0; n<nCount && !bValid; n++)
4628 14 : if (m_pImpl->m_aNamedEntries[n].GetName() == aNameStr)
4629 : {
4630 3 : aDiff.RemoveAll();
4631 3 : aDiff.Append(m_pImpl->m_aNamedEntries[n].GetRange());
4632 3 : bValid = sal_True;
4633 : }
4634 : }
4635 4 : if ( bValid )
4636 : {
4637 3 : ScMarkData aMarkData;
4638 3 : aMarkData.MarkFromRangeList( rRanges, false );
4639 :
4640 6 : for ( size_t i = 0, nDiffCount = aDiff.size(); i < nDiffCount; i++ )
4641 : {
4642 3 : ScRange* pDiffRange = aDiff[ i ];
4643 3 : if (aMarkData.GetTableSelect( pDiffRange->aStart.Tab() ))
4644 3 : aMarkData.SetMultiMarkArea( *pDiffRange, false );
4645 : }
4646 :
4647 6 : ScRangeList aNew;
4648 3 : aMarkData.FillRangeListWithMarks( &aNew, false );
4649 3 : SetNewRanges(aNew);
4650 :
4651 6 : bDone = sal_True; //! error if range was not selected before?
4652 4 : }
4653 : }
4654 :
4655 4 : if (!m_pImpl->m_aNamedEntries.empty())
4656 4 : lcl_RemoveNamedEntry(m_pImpl->m_aNamedEntries, aNameStr);
4657 :
4658 4 : if (!bDone)
4659 5 : throw container::NoSuchElementException(); // not found
4660 3 : }
4661 :
4662 : // XNameReplace
4663 :
4664 2 : void SAL_CALL ScCellRangesObj::replaceByName( const OUString& aName, const uno::Any& aElement )
4665 : throw(lang::IllegalArgumentException, container::NoSuchElementException,
4666 : lang::WrappedTargetException, uno::RuntimeException)
4667 : {
4668 2 : SolarMutexGuard aGuard;
4669 : //! zusammenfassen?
4670 2 : removeByName( aName );
4671 2 : insertByName( aName, aElement );
4672 2 : }
4673 :
4674 : // XNameAccess
4675 :
4676 5 : uno::Any SAL_CALL ScCellRangesObj::getByName( const OUString& aName )
4677 : throw(container::NoSuchElementException,
4678 : lang::WrappedTargetException, uno::RuntimeException)
4679 : {
4680 5 : SolarMutexGuard aGuard;
4681 5 : uno::Any aRet;
4682 :
4683 10 : String aNameStr(aName);
4684 5 : ScDocShell* pDocSh = GetDocShell();
4685 5 : const ScRangeList& rRanges = GetRangeList();
4686 5 : ScRange aRange;
4687 10 : if (lcl_FindRangeOrEntry(m_pImpl->m_aNamedEntries, rRanges,
4688 5 : pDocSh, aNameStr, aRange))
4689 : {
4690 4 : uno::Reference<table::XCellRange> xRange;
4691 4 : if ( aRange.aStart == aRange.aEnd )
4692 0 : xRange.set(new ScCellObj( pDocSh, aRange.aStart ));
4693 : else
4694 4 : xRange.set(new ScCellRangeObj( pDocSh, aRange ));
4695 4 : aRet <<= xRange;
4696 : }
4697 : else
4698 1 : throw container::NoSuchElementException();
4699 9 : return aRet;
4700 : }
4701 :
4702 22 : static sal_Bool lcl_FindEntryName( const ScNamedEntryArr_Impl& rNamedEntries,
4703 : const ScRange& rRange, String& rName )
4704 : {
4705 22 : sal_uInt16 nCount = rNamedEntries.size();
4706 60 : for (sal_uInt16 i=0; i<nCount; i++)
4707 60 : if (rNamedEntries[i].GetRange() == rRange)
4708 : {
4709 22 : rName = rNamedEntries[i].GetName();
4710 22 : return sal_True;
4711 : }
4712 0 : return false;
4713 : }
4714 :
4715 5 : uno::Sequence<OUString> SAL_CALL ScCellRangesObj::getElementNames()
4716 : throw(uno::RuntimeException)
4717 : {
4718 5 : SolarMutexGuard aGuard;
4719 :
4720 5 : ScDocShell* pDocSh = GetDocShell();
4721 5 : const ScRangeList& rRanges = GetRangeList();
4722 5 : if (pDocSh)
4723 : {
4724 5 : String aRangeStr;
4725 5 : ScDocument* pDoc = pDocSh->GetDocument();
4726 5 : size_t nCount = rRanges.size();
4727 :
4728 10 : uno::Sequence<OUString> aSeq(nCount);
4729 5 : OUString* pAry = aSeq.getArray();
4730 27 : for (size_t i=0; i < nCount; i++)
4731 : {
4732 : // use given name if for exactly this range, otherwise just format
4733 22 : ScRange aRange = *rRanges[ i ];
4734 44 : if (m_pImpl->m_aNamedEntries.empty() ||
4735 22 : !lcl_FindEntryName(m_pImpl->m_aNamedEntries, aRange, aRangeStr))
4736 : {
4737 0 : aRange.Format( aRangeStr, SCA_VALID | SCA_TAB_3D, pDoc );
4738 : }
4739 22 : pAry[i] = aRangeStr;
4740 : }
4741 10 : return aSeq;
4742 : }
4743 0 : return uno::Sequence<OUString>(0);
4744 : }
4745 :
4746 4 : sal_Bool SAL_CALL ScCellRangesObj::hasByName( const OUString& aName )
4747 : throw(uno::RuntimeException)
4748 : {
4749 4 : SolarMutexGuard aGuard;
4750 8 : String aNameStr(aName);
4751 4 : ScDocShell* pDocSh = GetDocShell();
4752 4 : const ScRangeList& rRanges = GetRangeList();
4753 4 : ScRange aRange;
4754 4 : return lcl_FindRangeOrEntry(m_pImpl->m_aNamedEntries, rRanges, pDocSh,
4755 8 : aNameStr, aRange);
4756 : }
4757 :
4758 : // XEnumerationAccess
4759 :
4760 52 : uno::Reference<container::XEnumeration> SAL_CALL ScCellRangesObj::createEnumeration()
4761 : throw(uno::RuntimeException)
4762 : {
4763 52 : SolarMutexGuard aGuard;
4764 52 : return new ScIndexEnumeration(this, OUString("com.sun.star.sheet.SheetCellRangesEnumeration"));
4765 : }
4766 :
4767 : // XIndexAccess
4768 :
4769 517 : sal_Int32 SAL_CALL ScCellRangesObj::getCount() throw(uno::RuntimeException)
4770 : {
4771 517 : SolarMutexGuard aGuard;
4772 517 : const ScRangeList& rRanges = GetRangeList();
4773 517 : return rRanges.size();
4774 : }
4775 :
4776 479 : uno::Any SAL_CALL ScCellRangesObj::getByIndex( sal_Int32 nIndex )
4777 : throw(lang::IndexOutOfBoundsException,
4778 : lang::WrappedTargetException, uno::RuntimeException)
4779 : {
4780 479 : SolarMutexGuard aGuard;
4781 958 : uno::Reference<table::XCellRange> xRange(GetObjectByIndex_Impl(nIndex));
4782 479 : if (xRange.is())
4783 954 : return uno::makeAny(xRange);
4784 : else
4785 481 : throw lang::IndexOutOfBoundsException();
4786 : }
4787 :
4788 1 : uno::Type SAL_CALL ScCellRangesObj::getElementType() throw(uno::RuntimeException)
4789 : {
4790 1 : SolarMutexGuard aGuard;
4791 1 : return getCppuType((uno::Reference<table::XCellRange>*)0);
4792 : }
4793 :
4794 1 : sal_Bool SAL_CALL ScCellRangesObj::hasElements() throw(uno::RuntimeException)
4795 : {
4796 1 : SolarMutexGuard aGuard;
4797 1 : const ScRangeList& rRanges = GetRangeList();
4798 1 : return !rRanges.empty();
4799 : }
4800 :
4801 : // XServiceInfo
4802 :
4803 4 : OUString SAL_CALL ScCellRangesObj::getImplementationName() throw(uno::RuntimeException)
4804 : {
4805 4 : return OUString( "ScCellRangesObj" );
4806 : }
4807 :
4808 12 : sal_Bool SAL_CALL ScCellRangesObj::supportsService( const OUString& rServiceName )
4809 : throw(uno::RuntimeException)
4810 : {
4811 12 : String aServiceStr(rServiceName);
4812 19 : return aServiceStr.EqualsAscii( SCSHEETCELLRANGES_SERVICE ) ||
4813 14 : aServiceStr.EqualsAscii( SCCELLPROPERTIES_SERVICE ) ||
4814 25 : aServiceStr.EqualsAscii( SCCHARPROPERTIES_SERVICE ) ||
4815 18 : aServiceStr.EqualsAscii( SCPARAPROPERTIES_SERVICE );
4816 : }
4817 :
4818 0 : uno::Sequence<OUString> SAL_CALL ScCellRangesObj::getSupportedServiceNames()
4819 : throw(uno::RuntimeException)
4820 : {
4821 0 : uno::Sequence<OUString> aRet(4);
4822 0 : OUString* pArray = aRet.getArray();
4823 0 : pArray[0] = OUString( SCSHEETCELLRANGES_SERVICE );
4824 0 : pArray[1] = OUString( SCCELLPROPERTIES_SERVICE );
4825 0 : pArray[2] = OUString( SCCHARPROPERTIES_SERVICE );
4826 0 : pArray[3] = OUString( SCPARAPROPERTIES_SERVICE );
4827 0 : return aRet;
4828 : }
4829 :
4830 : //------------------------------------------------------------------------
4831 :
4832 0 : uno::Reference<table::XCellRange> ScCellRangeObj::CreateRangeFromDoc( ScDocument* pDoc, const ScRange& rR )
4833 : {
4834 0 : SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
4835 0 : if ( pObjSh && pObjSh->ISA(ScDocShell) )
4836 0 : return new ScCellRangeObj( (ScDocShell*) pObjSh, rR );
4837 0 : return NULL;
4838 : }
4839 :
4840 : //------------------------------------------------------------------------
4841 :
4842 21171 : ScCellRangeObj::ScCellRangeObj(ScDocShell* pDocSh, const ScRange& rR) :
4843 : ScCellRangesBase( pDocSh, rR ),
4844 21171 : pRangePropSet( lcl_GetRangePropertySet() ),
4845 42342 : aRange( rR )
4846 : {
4847 21171 : aRange.Justify(); // Anfang / Ende richtig
4848 21171 : }
4849 :
4850 25755 : ScCellRangeObj::~ScCellRangeObj()
4851 : {
4852 25755 : }
4853 :
4854 2765 : void ScCellRangeObj::RefChanged()
4855 : {
4856 2765 : ScCellRangesBase::RefChanged();
4857 :
4858 2765 : const ScRangeList& rRanges = GetRangeList();
4859 : OSL_ENSURE(rRanges.size() == 1, "was fuer Ranges ?!?!");
4860 2765 : if ( !rRanges.empty() )
4861 : {
4862 2739 : const ScRange* pFirst = rRanges[0];
4863 2739 : aRange = ScRange(*pFirst);
4864 2739 : aRange.Justify();
4865 : }
4866 2765 : }
4867 :
4868 51787 : uno::Any SAL_CALL ScCellRangeObj::queryInterface( const uno::Type& rType )
4869 : throw(uno::RuntimeException)
4870 : {
4871 51787 : SC_QUERYINTERFACE( sheet::XCellRangeAddressable )
4872 46933 : SC_QUERYINTERFACE( table::XCellRange )
4873 38953 : SC_QUERYINTERFACE( sheet::XSheetCellRange )
4874 36437 : SC_QUERYINTERFACE( sheet::XArrayFormulaRange )
4875 36436 : SC_QUERYINTERFACE( sheet::XArrayFormulaTokens )
4876 36436 : SC_QUERYINTERFACE( sheet::XCellRangeData )
4877 36412 : SC_QUERYINTERFACE( sheet::XCellRangeFormula )
4878 36410 : SC_QUERYINTERFACE( sheet::XMultipleOperation )
4879 36409 : SC_QUERYINTERFACE( util::XMergeable )
4880 36401 : SC_QUERYINTERFACE( sheet::XCellSeries )
4881 36391 : SC_QUERYINTERFACE( table::XAutoFormattable )
4882 36391 : SC_QUERYINTERFACE( util::XSortable )
4883 36390 : SC_QUERYINTERFACE( sheet::XSheetFilterableEx )
4884 36389 : SC_QUERYINTERFACE( sheet::XSheetFilterable )
4885 36387 : SC_QUERYINTERFACE( sheet::XSubTotalCalculatable )
4886 36381 : SC_QUERYINTERFACE( table::XColumnRowRange )
4887 33437 : SC_QUERYINTERFACE( util::XImportable )
4888 33434 : SC_QUERYINTERFACE( sheet::XCellFormatRangesSupplier )
4889 33431 : SC_QUERYINTERFACE( sheet::XUniqueCellFormatRangesSupplier )
4890 :
4891 33419 : return ScCellRangesBase::queryInterface( rType );
4892 : }
4893 :
4894 195006 : void SAL_CALL ScCellRangeObj::acquire() throw()
4895 : {
4896 195006 : ScCellRangesBase::acquire();
4897 195006 : }
4898 :
4899 194887 : void SAL_CALL ScCellRangeObj::release() throw()
4900 : {
4901 194887 : ScCellRangesBase::release();
4902 194887 : }
4903 :
4904 4 : uno::Sequence<uno::Type> SAL_CALL ScCellRangeObj::getTypes() throw(uno::RuntimeException)
4905 : {
4906 4 : static uno::Sequence<uno::Type> aTypes;
4907 4 : if ( aTypes.getLength() == 0 )
4908 : {
4909 2 : uno::Sequence<uno::Type> aParentTypes(ScCellRangesBase::getTypes());
4910 2 : long nParentLen = aParentTypes.getLength();
4911 2 : const uno::Type* pParentPtr = aParentTypes.getConstArray();
4912 :
4913 2 : aTypes.realloc( nParentLen + 17 );
4914 2 : uno::Type* pPtr = aTypes.getArray();
4915 2 : pPtr[nParentLen + 0] = getCppuType((const uno::Reference<sheet::XCellRangeAddressable>*)0);
4916 2 : pPtr[nParentLen + 1] = getCppuType((const uno::Reference<sheet::XSheetCellRange>*)0);
4917 2 : pPtr[nParentLen + 2] = getCppuType((const uno::Reference<sheet::XArrayFormulaRange>*)0);
4918 2 : pPtr[nParentLen + 3] = getCppuType((const uno::Reference<sheet::XArrayFormulaTokens>*)0);
4919 2 : pPtr[nParentLen + 4] = getCppuType((const uno::Reference<sheet::XCellRangeData>*)0);
4920 2 : pPtr[nParentLen + 5] = getCppuType((const uno::Reference<sheet::XCellRangeFormula>*)0);
4921 2 : pPtr[nParentLen + 6] = getCppuType((const uno::Reference<sheet::XMultipleOperation>*)0);
4922 2 : pPtr[nParentLen + 7] = getCppuType((const uno::Reference<util::XMergeable>*)0);
4923 2 : pPtr[nParentLen + 8] = getCppuType((const uno::Reference<sheet::XCellSeries>*)0);
4924 2 : pPtr[nParentLen + 9] = getCppuType((const uno::Reference<table::XAutoFormattable>*)0);
4925 2 : pPtr[nParentLen +10] = getCppuType((const uno::Reference<util::XSortable>*)0);
4926 2 : pPtr[nParentLen +11] = getCppuType((const uno::Reference<sheet::XSheetFilterableEx>*)0);
4927 2 : pPtr[nParentLen +12] = getCppuType((const uno::Reference<sheet::XSubTotalCalculatable>*)0);
4928 2 : pPtr[nParentLen +13] = getCppuType((const uno::Reference<table::XColumnRowRange>*)0);
4929 2 : pPtr[nParentLen +14] = getCppuType((const uno::Reference<util::XImportable>*)0);
4930 2 : pPtr[nParentLen +15] = getCppuType((const uno::Reference<sheet::XCellFormatRangesSupplier>*)0);
4931 2 : pPtr[nParentLen +16] = getCppuType((const uno::Reference<sheet::XUniqueCellFormatRangesSupplier>*)0);
4932 :
4933 28 : for (long i=0; i<nParentLen; i++)
4934 28 : pPtr[i] = pParentPtr[i]; // parent types first
4935 : }
4936 4 : return aTypes;
4937 : }
4938 :
4939 : namespace
4940 : {
4941 : class theScCellRangeObjImplementationId : public rtl::Static< UnoTunnelIdInit, theScCellRangeObjImplementationId > {};
4942 : }
4943 :
4944 14 : uno::Sequence<sal_Int8> SAL_CALL ScCellRangeObj::getImplementationId()
4945 : throw(uno::RuntimeException)
4946 : {
4947 14 : return theScCellRangeObjImplementationId::get().getSeq();
4948 : }
4949 :
4950 : // XCellRange
4951 :
4952 : // ColumnCount / RowCount sind weggefallen
4953 : //! werden im Writer fuer Tabellen noch gebraucht ???
4954 :
4955 11893 : uno::Reference<table::XCell> ScCellRangeObj::GetCellByPosition_Impl(
4956 : sal_Int32 nColumn, sal_Int32 nRow )
4957 : throw(lang::IndexOutOfBoundsException, uno::RuntimeException)
4958 : {
4959 11893 : ScDocShell* pDocSh = GetDocShell();
4960 11893 : if (!pDocSh)
4961 0 : throw uno::RuntimeException();
4962 :
4963 11893 : if ( nColumn >= 0 && nRow >= 0 )
4964 : {
4965 11892 : sal_Int32 nPosX = aRange.aStart.Col() + nColumn;
4966 11892 : sal_Int32 nPosY = aRange.aStart.Row() + nRow;
4967 :
4968 11892 : if ( nPosX <= aRange.aEnd.Col() && nPosY <= aRange.aEnd.Row() )
4969 : {
4970 11892 : ScAddress aNew( (SCCOL)nPosX, (SCROW)nPosY, aRange.aStart.Tab() );
4971 23784 : return new ScCellObj( pDocSh, aNew );
4972 : }
4973 : }
4974 :
4975 1 : throw lang::IndexOutOfBoundsException();
4976 : }
4977 :
4978 8219 : uno::Reference<table::XCell> SAL_CALL ScCellRangeObj::getCellByPosition(
4979 : sal_Int32 nColumn, sal_Int32 nRow )
4980 : throw(lang::IndexOutOfBoundsException, uno::RuntimeException)
4981 : {
4982 8219 : SolarMutexGuard aGuard;
4983 :
4984 8219 : return GetCellByPosition_Impl(nColumn, nRow);
4985 : }
4986 :
4987 3258 : uno::Reference<table::XCellRange> SAL_CALL ScCellRangeObj::getCellRangeByPosition(
4988 : sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom )
4989 : throw(lang::IndexOutOfBoundsException, uno::RuntimeException)
4990 : {
4991 3258 : SolarMutexGuard aGuard;
4992 :
4993 3258 : ScDocShell* pDocSh = GetDocShell();
4994 3258 : if (!pDocSh)
4995 0 : throw uno::RuntimeException();
4996 :
4997 3258 : if ( nLeft >= 0 && nTop >= 0 && nRight >= 0 && nBottom >= 0 )
4998 : {
4999 3257 : sal_Int32 nStartX = aRange.aStart.Col() + nLeft;
5000 3257 : sal_Int32 nStartY = aRange.aStart.Row() + nTop;
5001 3257 : sal_Int32 nEndX = aRange.aStart.Col() + nRight;
5002 3257 : sal_Int32 nEndY = aRange.aStart.Row() + nBottom;
5003 :
5004 6514 : if ( nStartX <= nEndX && nEndX <= aRange.aEnd.Col() &&
5005 6514 : nStartY <= nEndY && nEndY <= aRange.aEnd.Row() )
5006 : {
5007 3257 : ScRange aNew( (SCCOL)nStartX, (SCROW)nStartY, aRange.aStart.Tab(),
5008 6514 : (SCCOL)nEndX, (SCROW)nEndY, aRange.aEnd.Tab() );
5009 6514 : return new ScCellRangeObj( pDocSh, aNew );
5010 : }
5011 : }
5012 :
5013 3257 : throw lang::IndexOutOfBoundsException();
5014 : }
5015 :
5016 94 : uno::Reference<table::XCellRange> SAL_CALL ScCellRangeObj::getCellRangeByName(
5017 : const OUString& aName ) throw(uno::RuntimeException)
5018 : {
5019 94 : return getCellRangeByName( aName, ScAddress::detailsOOOa1 );
5020 : }
5021 :
5022 94 : uno::Reference<table::XCellRange> ScCellRangeObj::getCellRangeByName(
5023 : const OUString& aName, const ScAddress::Details& rDetails ) throw(uno::RuntimeException)
5024 : {
5025 : // name refers to the whole document (with the range's table as default),
5026 : // valid only if the range is within this range
5027 :
5028 94 : SolarMutexGuard aGuard;
5029 94 : ScDocShell* pDocSh = GetDocShell();
5030 94 : if ( pDocSh )
5031 : {
5032 94 : ScDocument* pDoc = pDocSh->GetDocument();
5033 94 : SCTAB nTab = aRange.aStart.Tab();
5034 :
5035 94 : ScRange aCellRange;
5036 94 : sal_Bool bFound = false;
5037 94 : String aString(aName);
5038 94 : sal_uInt16 nParse = aCellRange.ParseAny( aString, pDoc, rDetails );
5039 94 : if ( nParse & SCA_VALID )
5040 : {
5041 94 : if ( !(nParse & SCA_TAB_3D) ) // keine Tabelle angegeben -> auf dieser Tabelle
5042 : {
5043 61 : aCellRange.aStart.SetTab(nTab);
5044 61 : aCellRange.aEnd.SetTab(nTab);
5045 : }
5046 94 : bFound = sal_True;
5047 : }
5048 : else
5049 : {
5050 0 : ScRangeUtil aRangeUtil;
5051 0 : if ( aRangeUtil.MakeRangeFromName( aString, pDoc, nTab, aCellRange, RUTL_NAMES ) ||
5052 0 : aRangeUtil.MakeRangeFromName( aString, pDoc, nTab, aCellRange, RUTL_DBASE ) )
5053 0 : bFound = sal_True;
5054 : }
5055 :
5056 94 : if (bFound) // valid only if within this object's range
5057 : {
5058 94 : if (!aRange.In(aCellRange))
5059 0 : bFound = false;
5060 : }
5061 :
5062 94 : if (bFound)
5063 : {
5064 94 : if ( aCellRange.aStart == aCellRange.aEnd )
5065 4 : return new ScCellObj( pDocSh, aCellRange.aStart );
5066 : else
5067 90 : return new ScCellRangeObj( pDocSh, aCellRange );
5068 0 : }
5069 : }
5070 :
5071 94 : throw uno::RuntimeException();
5072 : }
5073 :
5074 : // XColumnRowRange
5075 :
5076 429 : uno::Reference<table::XTableColumns> SAL_CALL ScCellRangeObj::getColumns() throw(uno::RuntimeException)
5077 : {
5078 429 : SolarMutexGuard aGuard;
5079 429 : ScDocShell* pDocSh = GetDocShell();
5080 429 : if (pDocSh)
5081 429 : return new ScTableColumnsObj( pDocSh, aRange.aStart.Tab(),
5082 429 : aRange.aStart.Col(), aRange.aEnd.Col() );
5083 :
5084 : OSL_FAIL("Dokument ungueltig");
5085 0 : return NULL;
5086 : }
5087 :
5088 2180 : uno::Reference<table::XTableRows> SAL_CALL ScCellRangeObj::getRows() throw(uno::RuntimeException)
5089 : {
5090 2180 : SolarMutexGuard aGuard;
5091 2180 : ScDocShell* pDocSh = GetDocShell();
5092 2180 : if (pDocSh)
5093 2180 : return new ScTableRowsObj( pDocSh, aRange.aStart.Tab(),
5094 2180 : aRange.aStart.Row(), aRange.aEnd.Row() );
5095 :
5096 : OSL_FAIL("Dokument ungueltig");
5097 0 : return NULL;
5098 : }
5099 :
5100 : // XAddressableCellRange
5101 :
5102 5602 : table::CellRangeAddress SAL_CALL ScCellRangeObj::getRangeAddress() throw(uno::RuntimeException)
5103 : {
5104 5602 : SolarMutexGuard aGuard;
5105 5602 : table::CellRangeAddress aRet;
5106 5602 : ScUnoConversion::FillApiRange( aRet, aRange );
5107 5602 : return aRet;
5108 : }
5109 :
5110 : // XSheetCellRange
5111 :
5112 1064 : uno::Reference<sheet::XSpreadsheet> SAL_CALL ScCellRangeObj::getSpreadsheet()
5113 : throw(uno::RuntimeException)
5114 : {
5115 1064 : SolarMutexGuard aGuard;
5116 1064 : ScDocShell* pDocSh = GetDocShell();
5117 1064 : if (pDocSh)
5118 1064 : return new ScTableSheetObj( pDocSh, aRange.aStart.Tab() );
5119 :
5120 : OSL_FAIL("Dokument ungueltig");
5121 0 : return NULL;
5122 : }
5123 :
5124 : // XArrayFormulaRange
5125 :
5126 1 : OUString SAL_CALL ScCellRangeObj::getArrayFormula() throw(uno::RuntimeException)
5127 : {
5128 1 : SolarMutexGuard aGuard;
5129 :
5130 : // Matrix-Formel, wenn eindeutig Teil einer Matrix,
5131 : // also wenn Anfang und Ende des Blocks zur selben Matrix gehoeren.
5132 : // Sonst Leerstring.
5133 :
5134 1 : ScDocShell* pDocSh = GetDocShell();
5135 1 : if (!pDocSh)
5136 0 : return EMPTY_OUSTRING;
5137 :
5138 2 : OUString aFormula;
5139 :
5140 1 : ScDocument* pDoc = pDocSh->GetDocument();
5141 2 : ScRefCellValue aCell1;
5142 2 : ScRefCellValue aCell2;
5143 1 : aCell1.assign(*pDoc, aRange.aStart);
5144 1 : aCell2.assign(*pDoc, aRange.aEnd);
5145 1 : if (aCell1.meType == CELLTYPE_FORMULA && aCell2.meType == CELLTYPE_FORMULA)
5146 : {
5147 1 : const ScFormulaCell* pFCell1 = aCell1.mpFormula;
5148 1 : const ScFormulaCell* pFCell2 = aCell2.mpFormula;
5149 1 : ScAddress aStart1;
5150 1 : ScAddress aStart2;
5151 1 : if (pFCell1->GetMatrixOrigin(aStart1) && pFCell2->GetMatrixOrigin(aStart2))
5152 : {
5153 1 : if (aStart1 == aStart2) // beides dieselbe Matrix
5154 1 : pFCell1->GetFormula(aFormula); // egal, von welcher Zelle
5155 : }
5156 : }
5157 2 : return aFormula;
5158 : }
5159 :
5160 1 : void ScCellRangeObj::SetArrayFormula_Impl( const OUString& rFormula,
5161 : const OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar ) throw(uno::RuntimeException)
5162 : {
5163 1 : ScDocShell* pDocSh = GetDocShell();
5164 1 : if (pDocSh)
5165 : {
5166 1 : if ( !rFormula.isEmpty() )
5167 : {
5168 1 : if ( ScTableSheetObj::getImplementation( (cppu::OWeakObject*)this ) )
5169 : {
5170 : // don't set array formula for sheet object
5171 0 : throw uno::RuntimeException();
5172 : }
5173 :
5174 1 : pDocSh->GetDocFunc().EnterMatrix( aRange, NULL, NULL, rFormula, sal_True, sal_True, rFormulaNmsp, eGrammar );
5175 : }
5176 : else
5177 : {
5178 : // empty string -> erase array formula
5179 0 : ScMarkData aMark;
5180 0 : aMark.SetMarkArea( aRange );
5181 0 : aMark.SelectTable( aRange.aStart.Tab(), sal_True );
5182 0 : pDocSh->GetDocFunc().DeleteContents( aMark, IDF_CONTENTS, sal_True, sal_True );
5183 : }
5184 : }
5185 1 : }
5186 :
5187 1 : void SAL_CALL ScCellRangeObj::setArrayFormula( const OUString& aFormula )
5188 : throw(uno::RuntimeException)
5189 : {
5190 1 : SolarMutexGuard aGuard;
5191 : // GRAM_PODF_A1 for API compatibility.
5192 1 : SetArrayFormula_Impl( aFormula, OUString(), formula::FormulaGrammar::GRAM_PODF_A1);
5193 1 : }
5194 :
5195 0 : void ScCellRangeObj::SetArrayFormulaWithGrammar( const OUString& rFormula,
5196 : const OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar ) throw(uno::RuntimeException)
5197 : {
5198 0 : SolarMutexGuard aGuard;
5199 0 : SetArrayFormula_Impl( rFormula, rFormulaNmsp, eGrammar);
5200 0 : }
5201 :
5202 : // XArrayFormulaTokens
5203 :
5204 0 : uno::Sequence<sheet::FormulaToken> SAL_CALL ScCellRangeObj::getArrayTokens() throw(uno::RuntimeException)
5205 : {
5206 0 : SolarMutexGuard aGuard;
5207 :
5208 : // same cell logic as in getArrayFormula
5209 :
5210 0 : uno::Sequence<sheet::FormulaToken> aSequence;
5211 0 : ScDocShell* pDocSh = GetDocShell();
5212 0 : if (!pDocSh)
5213 0 : return aSequence;
5214 :
5215 0 : ScDocument* pDoc = pDocSh->GetDocument();
5216 0 : ScRefCellValue aCell1;
5217 0 : ScRefCellValue aCell2;
5218 0 : aCell1.assign(*pDoc, aRange.aStart);
5219 0 : aCell2.assign(*pDoc, aRange.aEnd);
5220 0 : if (aCell1.meType == CELLTYPE_FORMULA && aCell2.meType == CELLTYPE_FORMULA)
5221 : {
5222 0 : const ScFormulaCell* pFCell1 = aCell1.mpFormula;
5223 0 : const ScFormulaCell* pFCell2 = aCell2.mpFormula;
5224 0 : ScAddress aStart1;
5225 0 : ScAddress aStart2;
5226 0 : if (pFCell1->GetMatrixOrigin(aStart1) && pFCell2->GetMatrixOrigin(aStart2))
5227 : {
5228 0 : if (aStart1 == aStart2)
5229 : {
5230 0 : ScTokenArray* pTokenArray = pFCell1->GetCode();
5231 0 : if (pTokenArray)
5232 0 : (void)ScTokenConversion::ConvertToTokenSequence(*pDoc, aSequence, *pTokenArray);
5233 : }
5234 : }
5235 : }
5236 :
5237 0 : return aSequence;
5238 : }
5239 :
5240 0 : void SAL_CALL ScCellRangeObj::setArrayTokens( const uno::Sequence<sheet::FormulaToken>& rTokens ) throw(uno::RuntimeException)
5241 : {
5242 0 : SolarMutexGuard aGuard;
5243 0 : ScDocShell* pDocSh = GetDocShell();
5244 0 : if ( pDocSh )
5245 : {
5246 0 : if ( rTokens.getLength() )
5247 : {
5248 0 : if ( ScTableSheetObj::getImplementation( (cppu::OWeakObject*)this ) )
5249 : {
5250 0 : throw uno::RuntimeException();
5251 : }
5252 :
5253 0 : ScDocument* pDoc = pDocSh->GetDocument();
5254 0 : ScTokenArray aTokenArray;
5255 0 : (void)ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, rTokens );
5256 :
5257 : // Actually GRAM_PODF_A1 is a don't-care here because of the token
5258 : // array being set, it fits with other API compatibility grammars
5259 : // though.
5260 0 : pDocSh->GetDocFunc().EnterMatrix( aRange, NULL, &aTokenArray, EMPTY_STRING, sal_True, sal_True, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
5261 : }
5262 : else
5263 : {
5264 : // empty sequence -> erase array formula
5265 0 : ScMarkData aMark;
5266 0 : aMark.SetMarkArea( aRange );
5267 0 : aMark.SelectTable( aRange.aStart.Tab(), sal_True );
5268 0 : pDocSh->GetDocFunc().DeleteContents( aMark, IDF_CONTENTS, sal_True, sal_True );
5269 : }
5270 0 : }
5271 0 : }
5272 :
5273 : // XCellRangeData
5274 :
5275 17 : uno::Sequence< uno::Sequence<uno::Any> > SAL_CALL ScCellRangeObj::getDataArray()
5276 : throw(uno::RuntimeException)
5277 : {
5278 17 : SolarMutexGuard aGuard;
5279 :
5280 17 : if ( ScTableSheetObj::getImplementation( (cppu::OWeakObject*)this ) )
5281 : {
5282 : // don't create a data array for the sheet
5283 0 : throw uno::RuntimeException();
5284 : }
5285 :
5286 17 : ScDocShell* pDocSh = GetDocShell();
5287 17 : if (pDocSh)
5288 : {
5289 17 : uno::Any aAny;
5290 : // bAllowNV = TRUE: errors as void
5291 17 : if ( ScRangeToSequence::FillMixedArray( aAny, pDocSh->GetDocument(), aRange, sal_True ) )
5292 : {
5293 17 : uno::Sequence< uno::Sequence<uno::Any> > aSeq;
5294 17 : if ( aAny >>= aSeq )
5295 34 : return aSeq; // success
5296 0 : }
5297 : }
5298 :
5299 17 : throw uno::RuntimeException(); // no other exceptions specified
5300 : }
5301 :
5302 8 : void SAL_CALL ScCellRangeObj::setDataArray(
5303 : const uno::Sequence< uno::Sequence<uno::Any> >& aArray )
5304 : throw(uno::RuntimeException)
5305 : {
5306 8 : SolarMutexGuard aGuard;
5307 :
5308 8 : sal_Bool bDone = false;
5309 8 : ScDocShell* pDocSh = GetDocShell();
5310 8 : if (pDocSh)
5311 : {
5312 : //! move lcl_PutDataArray to docfunc?
5313 8 : bDone = lcl_PutDataArray( *pDocSh, aRange, aArray );
5314 : }
5315 :
5316 8 : if (!bDone)
5317 0 : throw uno::RuntimeException(); // no other exceptions specified
5318 8 : }
5319 :
5320 : // XCellRangeFormula
5321 :
5322 5 : uno::Sequence< uno::Sequence<OUString> > SAL_CALL ScCellRangeObj::getFormulaArray()
5323 : throw(uno::RuntimeException)
5324 : {
5325 5 : SolarMutexGuard aGuard;
5326 :
5327 5 : if ( ScTableSheetObj::getImplementation( (cppu::OWeakObject*)this ) )
5328 : {
5329 : // don't create a data array for the sheet
5330 0 : throw uno::RuntimeException();
5331 : }
5332 :
5333 5 : ScDocShell* pDocSh = GetDocShell();
5334 5 : if (pDocSh)
5335 : {
5336 5 : SCCOL nStartCol = aRange.aStart.Col();
5337 5 : SCROW nStartRow = aRange.aStart.Row();
5338 5 : SCCOL nEndCol = aRange.aEnd.Col();
5339 5 : SCROW nEndRow = aRange.aEnd.Row();
5340 5 : SCCOL nColCount = nEndCol + 1 - nStartCol;
5341 5 : SCROW nRowCount = nEndRow + 1 - nStartRow;
5342 5 : SCTAB nTab = aRange.aStart.Tab();
5343 :
5344 5 : uno::Sequence< uno::Sequence<OUString> > aRowSeq( nRowCount );
5345 5 : uno::Sequence<OUString>* pRowAry = aRowSeq.getArray();
5346 30 : for (SCROW nRowIndex = 0; nRowIndex < nRowCount; nRowIndex++)
5347 : {
5348 25 : uno::Sequence<OUString> aColSeq( nColCount );
5349 25 : OUString* pColAry = aColSeq.getArray();
5350 120 : for (SCCOL nColIndex = 0; nColIndex < nColCount; nColIndex++)
5351 190 : pColAry[nColIndex] = lcl_GetInputString( pDocSh->GetDocument(),
5352 95 : ScAddress( nStartCol+nColIndex, nStartRow+nRowIndex, nTab ), sal_True );
5353 :
5354 25 : pRowAry[nRowIndex] = aColSeq;
5355 25 : }
5356 :
5357 10 : return aRowSeq;
5358 : }
5359 :
5360 5 : throw uno::RuntimeException(); // no other exceptions specified
5361 : }
5362 :
5363 2 : void SAL_CALL ScCellRangeObj::setFormulaArray(
5364 : const uno::Sequence< uno::Sequence<OUString> >& aArray )
5365 : throw(uno::RuntimeException)
5366 : {
5367 2 : SolarMutexGuard aGuard;
5368 :
5369 2 : sal_Bool bDone = false;
5370 2 : ScDocShell* pDocSh = GetDocShell();
5371 2 : if (pDocSh)
5372 : {
5373 2 : ScExternalRefManager::ApiGuard aExtRefGuard(pDocSh->GetDocument());
5374 :
5375 : // GRAM_PODF_A1 for API compatibility.
5376 2 : bDone = lcl_PutFormulaArray( *pDocSh, aRange, aArray, formula::FormulaGrammar::GRAM_PODF_A1 );
5377 : }
5378 :
5379 2 : if (!bDone)
5380 0 : throw uno::RuntimeException(); // no other exceptions specified
5381 2 : }
5382 :
5383 : // XMultipleOperation
5384 :
5385 3 : void SAL_CALL ScCellRangeObj::setTableOperation( const table::CellRangeAddress& aFormulaRange,
5386 : sheet::TableOperationMode nMode,
5387 : const table::CellAddress& aColumnCell,
5388 : const table::CellAddress& aRowCell )
5389 : throw(uno::RuntimeException)
5390 : {
5391 3 : SolarMutexGuard aGuard;
5392 3 : ScDocShell* pDocSh = GetDocShell();
5393 3 : if (pDocSh)
5394 : {
5395 3 : sal_Bool bError = false;
5396 3 : ScTabOpParam aParam;
5397 6 : aParam.aRefFormulaCell = ScRefAddress( (SCCOL)aFormulaRange.StartColumn,
5398 : (SCROW)aFormulaRange.StartRow, aFormulaRange.Sheet,
5399 3 : false, false, false );
5400 6 : aParam.aRefFormulaEnd = ScRefAddress( (SCCOL)aFormulaRange.EndColumn,
5401 : (SCROW)aFormulaRange.EndRow, aFormulaRange.Sheet,
5402 3 : false, false, false );
5403 6 : aParam.aRefRowCell = ScRefAddress( (SCCOL)aRowCell.Column,
5404 : (SCROW)aRowCell.Row, aRowCell.Sheet,
5405 3 : false, false, false );
5406 6 : aParam.aRefColCell = ScRefAddress( (SCCOL)aColumnCell.Column,
5407 : (SCROW)aColumnCell.Row, aColumnCell.Sheet,
5408 3 : false, false, false );
5409 3 : switch (nMode)
5410 : {
5411 : case sheet::TableOperationMode_COLUMN:
5412 1 : aParam.nMode = 0;
5413 1 : break;
5414 : case sheet::TableOperationMode_ROW:
5415 1 : aParam.nMode = 1;
5416 1 : break;
5417 : case sheet::TableOperationMode_BOTH:
5418 1 : aParam.nMode = 2;
5419 1 : break;
5420 : default:
5421 0 : bError = sal_True;
5422 : }
5423 :
5424 3 : if (!bError)
5425 3 : pDocSh->GetDocFunc().TabOp( aRange, NULL, aParam, sal_True, sal_True );
5426 3 : }
5427 3 : }
5428 :
5429 : // XMergeable
5430 :
5431 10 : void SAL_CALL ScCellRangeObj::merge( sal_Bool bMerge ) throw(uno::RuntimeException)
5432 : {
5433 10 : SolarMutexGuard aGuard;
5434 10 : ScDocShell* pDocSh = GetDocShell();
5435 10 : if ( pDocSh )
5436 : {
5437 : ScCellMergeOption aMergeOption(
5438 10 : aRange.aStart.Col(), aRange.aStart.Row(),
5439 20 : aRange.aEnd.Col(), aRange.aEnd.Row(), false);
5440 10 : aMergeOption.maTabs.insert(aRange.aStart.Tab());
5441 10 : if ( bMerge )
5442 5 : pDocSh->GetDocFunc().MergeCells( aMergeOption, false, true, true );
5443 : else
5444 5 : pDocSh->GetDocFunc().UnmergeCells( aMergeOption, true );
5445 :
5446 : //! Fehler abfangen?
5447 10 : }
5448 10 : }
5449 :
5450 4 : sal_Bool SAL_CALL ScCellRangeObj::getIsMerged() throw(uno::RuntimeException)
5451 : {
5452 4 : SolarMutexGuard aGuard;
5453 4 : ScDocShell* pDocSh = GetDocShell();
5454 4 : return pDocSh && pDocSh->GetDocument()->HasAttrib( aRange, HASATTR_MERGED );
5455 : }
5456 :
5457 : // XCellSeries
5458 :
5459 13 : void SAL_CALL ScCellRangeObj::fillSeries( sheet::FillDirection nFillDirection,
5460 : sheet::FillMode nFillMode, sheet::FillDateMode nFillDateMode,
5461 : double fStep, double fEndValue ) throw(uno::RuntimeException)
5462 : {
5463 13 : SolarMutexGuard aGuard;
5464 13 : ScDocShell* pDocSh = GetDocShell();
5465 13 : if ( pDocSh )
5466 : {
5467 13 : sal_Bool bError = false;
5468 :
5469 13 : FillDir eDir = FILL_TO_BOTTOM;
5470 13 : switch (nFillDirection)
5471 : {
5472 : case sheet::FillDirection_TO_BOTTOM:
5473 4 : eDir = FILL_TO_BOTTOM;
5474 4 : break;
5475 : case sheet::FillDirection_TO_RIGHT:
5476 5 : eDir = FILL_TO_RIGHT;
5477 5 : break;
5478 : case sheet::FillDirection_TO_TOP:
5479 2 : eDir = FILL_TO_TOP;
5480 2 : break;
5481 : case sheet::FillDirection_TO_LEFT:
5482 2 : eDir = FILL_TO_LEFT;
5483 2 : break;
5484 : default:
5485 0 : bError = sal_True;
5486 : }
5487 :
5488 13 : FillCmd eCmd = FILL_SIMPLE;
5489 13 : switch ( nFillMode )
5490 : {
5491 : case sheet::FillMode_SIMPLE:
5492 9 : eCmd = FILL_SIMPLE;
5493 9 : break;
5494 : case sheet::FillMode_LINEAR:
5495 2 : eCmd = FILL_LINEAR;
5496 2 : break;
5497 : case sheet::FillMode_GROWTH:
5498 2 : eCmd = FILL_GROWTH;
5499 2 : break;
5500 : case sheet::FillMode_DATE:
5501 0 : eCmd = FILL_DATE;
5502 0 : break;
5503 : case sheet::FillMode_AUTO:
5504 0 : eCmd = FILL_AUTO;
5505 0 : break;
5506 : default:
5507 0 : bError = sal_True;
5508 : }
5509 :
5510 13 : FillDateCmd eDateCmd = FILL_DAY;
5511 13 : switch ( nFillDateMode )
5512 : {
5513 : case sheet::FillDateMode_FILL_DATE_DAY:
5514 13 : eDateCmd = FILL_DAY;
5515 13 : break;
5516 : case sheet::FillDateMode_FILL_DATE_WEEKDAY:
5517 0 : eDateCmd = FILL_WEEKDAY;
5518 0 : break;
5519 : case sheet::FillDateMode_FILL_DATE_MONTH:
5520 0 : eDateCmd = FILL_MONTH;
5521 0 : break;
5522 : case sheet::FillDateMode_FILL_DATE_YEAR:
5523 0 : eDateCmd = FILL_YEAR;
5524 0 : break;
5525 : default:
5526 0 : bError = sal_True;
5527 : }
5528 :
5529 13 : if (!bError)
5530 13 : pDocSh->GetDocFunc().FillSeries( aRange, NULL, eDir, eCmd, eDateCmd,
5531 13 : MAXDOUBLE, fStep, fEndValue, sal_True, sal_True );
5532 13 : }
5533 13 : }
5534 :
5535 2 : void SAL_CALL ScCellRangeObj::fillAuto( sheet::FillDirection nFillDirection,
5536 : sal_Int32 nSourceCount ) throw(uno::RuntimeException)
5537 : {
5538 2 : SolarMutexGuard aGuard;
5539 2 : ScDocShell* pDocSh = GetDocShell();
5540 2 : if ( pDocSh && nSourceCount )
5541 : {
5542 2 : ScRange aSourceRange(aRange);
5543 2 : SCsCOLROW nCount = 0; // "Dest-Count"
5544 2 : FillDir eDir = FILL_TO_BOTTOM;
5545 2 : sal_Bool bError = false;
5546 2 : switch (nFillDirection)
5547 : {
5548 : case sheet::FillDirection_TO_BOTTOM:
5549 1 : aSourceRange.aEnd.SetRow( static_cast<SCROW>( aSourceRange.aStart.Row() + nSourceCount - 1 ) );
5550 1 : nCount = aRange.aEnd.Row() - aSourceRange.aEnd.Row();
5551 1 : eDir = FILL_TO_BOTTOM;
5552 1 : break;
5553 : case sheet::FillDirection_TO_RIGHT:
5554 1 : aSourceRange.aEnd.SetCol( static_cast<SCCOL>( aSourceRange.aStart.Col() + nSourceCount - 1 ) );
5555 1 : nCount = aRange.aEnd.Col() - aSourceRange.aEnd.Col();
5556 1 : eDir = FILL_TO_RIGHT;
5557 1 : break;
5558 : case sheet::FillDirection_TO_TOP:
5559 0 : aSourceRange.aStart.SetRow( static_cast<SCROW>( aSourceRange.aEnd.Row() - nSourceCount + 1 ) );
5560 0 : nCount = aSourceRange.aStart.Row() - aRange.aStart.Row();
5561 0 : eDir = FILL_TO_TOP;
5562 0 : break;
5563 : case sheet::FillDirection_TO_LEFT:
5564 0 : aSourceRange.aStart.SetCol( static_cast<SCCOL>( aSourceRange.aEnd.Col() - nSourceCount + 1 ) );
5565 0 : nCount = aSourceRange.aStart.Col() - aRange.aStart.Col();
5566 0 : eDir = FILL_TO_LEFT;
5567 0 : break;
5568 : default:
5569 0 : bError = sal_True;
5570 : }
5571 2 : if (nCount < 0 || nCount > MAXROW) // overflow
5572 0 : bError = sal_True;
5573 :
5574 2 : if (!bError)
5575 2 : pDocSh->GetDocFunc().FillAuto( aSourceRange, NULL, eDir, nCount, sal_True, sal_True );
5576 2 : }
5577 2 : }
5578 :
5579 : // XAutoFormattable
5580 :
5581 0 : void SAL_CALL ScCellRangeObj::autoFormat( const OUString& aName )
5582 : throw(lang::IllegalArgumentException, uno::RuntimeException)
5583 : {
5584 0 : SolarMutexGuard aGuard;
5585 0 : ScDocShell* pDocSh = GetDocShell();
5586 0 : if ( pDocSh )
5587 : {
5588 0 : ScAutoFormat* pAutoFormat = ScGlobal::GetOrCreateAutoFormat();
5589 0 : ScAutoFormat::const_iterator it = pAutoFormat->find(aName);
5590 0 : if (it != pAutoFormat->end())
5591 : {
5592 0 : ScAutoFormat::const_iterator itBeg = pAutoFormat->begin();
5593 0 : size_t nIndex = std::distance(itBeg, it);
5594 0 : pDocSh->GetDocFunc().AutoFormat(aRange, NULL, nIndex, true, true);
5595 : }
5596 : else
5597 0 : throw lang::IllegalArgumentException();
5598 0 : }
5599 0 : }
5600 :
5601 : // XSortable
5602 :
5603 1 : uno::Sequence<beans::PropertyValue> SAL_CALL ScCellRangeObj::createSortDescriptor()
5604 : throw(uno::RuntimeException)
5605 : {
5606 1 : SolarMutexGuard aGuard;
5607 2 : ScSortParam aParam;
5608 1 : ScDocShell* pDocSh = GetDocShell();
5609 1 : if ( pDocSh )
5610 : {
5611 : // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich
5612 1 : ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK );
5613 1 : if (pData)
5614 : {
5615 0 : pData->GetSortParam(aParam);
5616 :
5617 : // im SortDescriptor sind die Fields innerhalb des Bereichs gezaehlt
5618 0 : ScRange aDBRange;
5619 0 : pData->GetArea(aDBRange);
5620 : SCCOLROW nFieldStart = aParam.bByRow ?
5621 0 : static_cast<SCCOLROW>(aDBRange.aStart.Col()) :
5622 0 : static_cast<SCCOLROW>(aDBRange.aStart.Row());
5623 0 : for (sal_uInt16 i=0; i<aParam.GetSortKeyCount(); i++)
5624 0 : if ( aParam.maKeyState[i].bDoSort && aParam.maKeyState[i].nField >= nFieldStart )
5625 0 : aParam.maKeyState[i].nField -= nFieldStart;
5626 : }
5627 : }
5628 :
5629 1 : uno::Sequence<beans::PropertyValue> aSeq( ScSortDescriptor::GetPropertyCount() );
5630 1 : ScSortDescriptor::FillProperties( aSeq, aParam );
5631 2 : return aSeq;
5632 : }
5633 :
5634 4 : void SAL_CALL ScCellRangeObj::sort( const uno::Sequence<beans::PropertyValue>& aDescriptor )
5635 : throw(uno::RuntimeException)
5636 : {
5637 4 : SolarMutexGuard aGuard;
5638 4 : ScDocShell* pDocSh = GetDocShell();
5639 4 : if (pDocSh)
5640 : {
5641 : sal_uInt16 i;
5642 4 : ScSortParam aParam;
5643 4 : ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen
5644 4 : if (pData)
5645 : {
5646 : // alten Einstellungen holen, falls nicht alles neu gesetzt wird
5647 4 : pData->GetSortParam(aParam);
5648 : SCCOLROW nOldStart = aParam.bByRow ?
5649 4 : static_cast<SCCOLROW>(aRange.aStart.Col()) :
5650 8 : static_cast<SCCOLROW>(aRange.aStart.Row());
5651 16 : for (i=0; i<aParam.GetSortKeyCount(); i++)
5652 12 : if ( aParam.maKeyState[i].bDoSort && aParam.maKeyState[i].nField >= nOldStart )
5653 3 : aParam.maKeyState[i].nField -= nOldStart;
5654 : }
5655 :
5656 4 : ScSortDescriptor::FillSortParam( aParam, aDescriptor );
5657 :
5658 : // im SortDescriptor sind die Fields innerhalb des Bereichs gezaehlt
5659 : // ByRow kann bei FillSortParam umgesetzt worden sein
5660 : SCCOLROW nFieldStart = aParam.bByRow ?
5661 4 : static_cast<SCCOLROW>(aRange.aStart.Col()) :
5662 8 : static_cast<SCCOLROW>(aRange.aStart.Row());
5663 16 : for (i=0; i<aParam.GetSortKeyCount(); i++)
5664 12 : aParam.maKeyState[i].nField += nFieldStart;
5665 :
5666 4 : SCTAB nTab = aRange.aStart.Tab();
5667 4 : aParam.nCol1 = aRange.aStart.Col();
5668 4 : aParam.nRow1 = aRange.aStart.Row();
5669 4 : aParam.nCol2 = aRange.aEnd.Col();
5670 4 : aParam.nRow2 = aRange.aEnd.Row();
5671 :
5672 4 : pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen
5673 :
5674 8 : ScDBDocFunc aFunc(*pDocSh); // Bereich muss angelegt sein
5675 8 : aFunc.Sort( nTab, aParam, sal_True, sal_True, sal_True );
5676 4 : }
5677 4 : }
5678 :
5679 : // XFilterable
5680 :
5681 2 : uno::Reference<sheet::XSheetFilterDescriptor> SAL_CALL ScCellRangeObj::createFilterDescriptor(
5682 : sal_Bool bEmpty ) throw(uno::RuntimeException)
5683 : {
5684 2 : SolarMutexGuard aGuard;
5685 2 : ScDocShell* pDocSh = GetDocShell();
5686 2 : ScFilterDescriptor* pNew = new ScFilterDescriptor(pDocSh);
5687 2 : if ( !bEmpty && pDocSh )
5688 : {
5689 : // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich
5690 0 : ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK );
5691 0 : if (pData)
5692 : {
5693 0 : ScQueryParam aParam;
5694 0 : pData->GetQueryParam(aParam);
5695 : // im FilterDescriptor sind die Fields innerhalb des Bereichs gezaehlt
5696 0 : ScRange aDBRange;
5697 0 : pData->GetArea(aDBRange);
5698 : SCCOLROW nFieldStart = aParam.bByRow ?
5699 0 : static_cast<SCCOLROW>(aDBRange.aStart.Col()) :
5700 0 : static_cast<SCCOLROW>(aDBRange.aStart.Row());
5701 0 : SCSIZE nCount = aParam.GetEntryCount();
5702 0 : for (SCSIZE i=0; i<nCount; i++)
5703 : {
5704 0 : ScQueryEntry& rEntry = aParam.GetEntry(i);
5705 0 : if (rEntry.bDoQuery && rEntry.nField >= nFieldStart)
5706 0 : rEntry.nField -= nFieldStart;
5707 : }
5708 0 : pNew->SetParam(aParam);
5709 : }
5710 : }
5711 2 : return pNew;
5712 : }
5713 :
5714 1 : void SAL_CALL ScCellRangeObj::filter( const uno::Reference<sheet::XSheetFilterDescriptor>& xDescriptor )
5715 : throw(uno::RuntimeException)
5716 : {
5717 1 : SolarMutexGuard aGuard;
5718 :
5719 : // das koennte theoretisch ein fremdes Objekt sein, also nur das
5720 : // oeffentliche XSheetFilterDescriptor Interface benutzen, um
5721 : // die Daten in ein ScFilterDescriptor Objekt zu kopieren:
5722 : //! wenn es schon ein ScFilterDescriptor ist, direkt per getImplementation?
5723 :
5724 1 : ScDocShell* pDocSh = GetDocShell();
5725 2 : ScFilterDescriptor aImpl(pDocSh);
5726 2 : uno::Reference< sheet::XSheetFilterDescriptor2 > xDescriptor2( xDescriptor, uno::UNO_QUERY );
5727 1 : if ( xDescriptor2.is() )
5728 : {
5729 1 : aImpl.setFilterFields2( xDescriptor2->getFilterFields2() );
5730 : }
5731 : else
5732 : {
5733 0 : aImpl.setFilterFields( xDescriptor->getFilterFields() );
5734 : }
5735 : // Rest sind jetzt Properties...
5736 :
5737 2 : uno::Reference<beans::XPropertySet> xPropSet( xDescriptor, uno::UNO_QUERY );
5738 1 : if (xPropSet.is())
5739 1 : lcl_CopyProperties( aImpl, *(beans::XPropertySet*)xPropSet.get() );
5740 :
5741 : //
5742 : // ausfuehren...
5743 : //
5744 :
5745 1 : if (pDocSh)
5746 : {
5747 1 : ScQueryParam aParam = aImpl.GetParam();
5748 : // im FilterDescriptor sind die Fields innerhalb des Bereichs gezaehlt
5749 : SCCOLROW nFieldStart = aParam.bByRow ?
5750 1 : static_cast<SCCOLROW>(aRange.aStart.Col()) :
5751 2 : static_cast<SCCOLROW>(aRange.aStart.Row());
5752 1 : SCSIZE nCount = aParam.GetEntryCount();
5753 9 : for (SCSIZE i=0; i<nCount; i++)
5754 : {
5755 8 : ScQueryEntry& rEntry = aParam.GetEntry(i);
5756 8 : if (rEntry.bDoQuery)
5757 : {
5758 2 : rEntry.nField += nFieldStart;
5759 : // Im Dialog wird immer der String angezeigt -> muss zum Wert passen
5760 2 : ScQueryEntry::QueryItemsType& rItems = rEntry.GetQueryItems();
5761 2 : rItems.resize(1);
5762 2 : ScQueryEntry::Item& rItem = rItems.front();
5763 2 : if (rItem.meType != ScQueryEntry::ByString)
5764 : {
5765 : pDocSh->GetDocument()->GetFormatTable()->
5766 1 : GetInputLineString(rItem.mfVal, 0, rItem.maString);
5767 : }
5768 : }
5769 : }
5770 :
5771 1 : SCTAB nTab = aRange.aStart.Tab();
5772 1 : aParam.nCol1 = aRange.aStart.Col();
5773 1 : aParam.nRow1 = aRange.aStart.Row();
5774 1 : aParam.nCol2 = aRange.aEnd.Col();
5775 1 : aParam.nRow2 = aRange.aEnd.Row();
5776 :
5777 1 : pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen
5778 :
5779 : //! keep source range in filter descriptor
5780 : //! if created by createFilterDescriptorByObject ???
5781 :
5782 2 : ScDBDocFunc aFunc(*pDocSh);
5783 2 : aFunc.Query( nTab, aParam, NULL, sal_True, sal_True ); // Bereich muss angelegt sein
5784 1 : }
5785 1 : }
5786 :
5787 : //! get/setAutoFilter als Properties!!!
5788 :
5789 : // XAdvancedFilterSource
5790 :
5791 1 : uno::Reference<sheet::XSheetFilterDescriptor> SAL_CALL ScCellRangeObj::createFilterDescriptorByObject(
5792 : const uno::Reference<sheet::XSheetFilterable>& xObject )
5793 : throw(uno::RuntimeException)
5794 : {
5795 1 : SolarMutexGuard aGuard;
5796 :
5797 : // this ist hier nicht der Bereich, der gefiltert wird, sondern der
5798 : // Bereich mit der Abfrage...
5799 :
5800 2 : uno::Reference<sheet::XCellRangeAddressable> xAddr( xObject, uno::UNO_QUERY );
5801 :
5802 1 : ScDocShell* pDocSh = GetDocShell();
5803 1 : if ( pDocSh && xAddr.is() )
5804 : {
5805 : //! Test, ob xObject im selben Dokument ist
5806 :
5807 1 : ScFilterDescriptor* pNew = new ScFilterDescriptor(pDocSh); //! stattdessen vom Objekt?
5808 :
5809 1 : ScQueryParam aParam = pNew->GetParam();
5810 1 : aParam.bHasHeader = sal_True;
5811 :
5812 1 : table::CellRangeAddress aDataAddress(xAddr->getRangeAddress());
5813 1 : aParam.nCol1 = (SCCOL)aDataAddress.StartColumn;
5814 1 : aParam.nRow1 = (SCROW)aDataAddress.StartRow;
5815 1 : aParam.nCol2 = (SCCOL)aDataAddress.EndColumn;
5816 1 : aParam.nRow2 = (SCROW)aDataAddress.EndRow;
5817 1 : aParam.nTab = aDataAddress.Sheet;
5818 :
5819 1 : ScDocument* pDoc = pDocSh->GetDocument();
5820 : sal_Bool bOk = pDoc->CreateQueryParam(
5821 1 : aRange.aStart.Col(), aRange.aStart.Row(),
5822 1 : aRange.aEnd.Col(), aRange.aEnd.Row(),
5823 3 : aRange.aStart.Tab(), aParam );
5824 1 : if ( bOk )
5825 : {
5826 : // im FilterDescriptor sind die Fields innerhalb des Bereichs gezaehlt
5827 : SCCOLROW nFieldStart = aParam.bByRow ?
5828 : static_cast<SCCOLROW>(aDataAddress.StartColumn) :
5829 1 : static_cast<SCCOLROW>(aDataAddress.StartRow);
5830 1 : SCSIZE nCount = aParam.GetEntryCount();
5831 9 : for (SCSIZE i=0; i<nCount; i++)
5832 : {
5833 8 : ScQueryEntry& rEntry = aParam.GetEntry(i);
5834 8 : if (rEntry.bDoQuery && rEntry.nField >= nFieldStart)
5835 1 : rEntry.nField -= nFieldStart;
5836 : }
5837 :
5838 1 : pNew->SetParam( aParam );
5839 1 : return pNew;
5840 : }
5841 : else
5842 : {
5843 0 : delete pNew;
5844 0 : return NULL; // ungueltig -> null
5845 1 : }
5846 : }
5847 :
5848 : OSL_FAIL("kein Dokument oder kein Bereich");
5849 1 : return NULL;
5850 : }
5851 :
5852 : // XSubTotalSource
5853 :
5854 6 : uno::Reference<sheet::XSubTotalDescriptor> SAL_CALL ScCellRangeObj::createSubTotalDescriptor(
5855 : sal_Bool bEmpty ) throw(uno::RuntimeException)
5856 : {
5857 6 : SolarMutexGuard aGuard;
5858 6 : ScSubTotalDescriptor* pNew = new ScSubTotalDescriptor;
5859 6 : ScDocShell* pDocSh = GetDocShell();
5860 6 : if ( !bEmpty && pDocSh )
5861 : {
5862 : // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich
5863 0 : ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK );
5864 0 : if (pData)
5865 : {
5866 0 : ScSubTotalParam aParam;
5867 0 : pData->GetSubTotalParam(aParam);
5868 : // im SubTotalDescriptor sind die Fields innerhalb des Bereichs gezaehlt
5869 0 : ScRange aDBRange;
5870 0 : pData->GetArea(aDBRange);
5871 0 : SCCOL nFieldStart = aDBRange.aStart.Col();
5872 0 : for (sal_uInt16 i=0; i<MAXSUBTOTAL; i++)
5873 : {
5874 0 : if ( aParam.bGroupActive[i] )
5875 : {
5876 0 : if ( aParam.nField[i] >= nFieldStart )
5877 0 : aParam.nField[i] = sal::static_int_cast<SCCOL>( aParam.nField[i] - nFieldStart );
5878 0 : for (SCCOL j=0; j<aParam.nSubTotals[i]; j++)
5879 0 : if ( aParam.pSubTotals[i][j] >= nFieldStart )
5880 0 : aParam.pSubTotals[i][j] = sal::static_int_cast<SCCOL>( aParam.pSubTotals[i][j] - nFieldStart );
5881 : }
5882 : }
5883 0 : pNew->SetParam(aParam);
5884 : }
5885 : }
5886 6 : return pNew;
5887 : }
5888 :
5889 1 : void SAL_CALL ScCellRangeObj::applySubTotals(
5890 : const uno::Reference<sheet::XSubTotalDescriptor>& xDescriptor,
5891 : sal_Bool bReplace ) throw(uno::RuntimeException)
5892 : {
5893 1 : SolarMutexGuard aGuard;
5894 :
5895 2 : if (!xDescriptor.is()) return;
5896 :
5897 1 : ScDocShell* pDocSh = GetDocShell();
5898 : ScSubTotalDescriptorBase* pImp =
5899 1 : ScSubTotalDescriptorBase::getImplementation( xDescriptor );
5900 :
5901 1 : if (pDocSh && pImp)
5902 : {
5903 1 : ScSubTotalParam aParam;
5904 1 : pImp->GetData(aParam); // virtuelle Methode der Basisklasse
5905 :
5906 : // im SubTotalDescriptor sind die Fields innerhalb des Bereichs gezaehlt
5907 1 : SCCOL nFieldStart = aRange.aStart.Col();
5908 4 : for (sal_uInt16 i=0; i<MAXSUBTOTAL; i++)
5909 : {
5910 3 : if ( aParam.bGroupActive[i] )
5911 : {
5912 1 : aParam.nField[i] = sal::static_int_cast<SCCOL>( aParam.nField[i] + nFieldStart );
5913 2 : for (SCCOL j=0; j<aParam.nSubTotals[i]; j++)
5914 1 : aParam.pSubTotals[i][j] = sal::static_int_cast<SCCOL>( aParam.pSubTotals[i][j] + nFieldStart );
5915 : }
5916 : }
5917 :
5918 1 : aParam.bReplace = bReplace;
5919 :
5920 1 : SCTAB nTab = aRange.aStart.Tab();
5921 1 : aParam.nCol1 = aRange.aStart.Col();
5922 1 : aParam.nRow1 = aRange.aStart.Row();
5923 1 : aParam.nCol2 = aRange.aEnd.Col();
5924 1 : aParam.nRow2 = aRange.aEnd.Row();
5925 :
5926 1 : pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen
5927 :
5928 1 : ScDBDocFunc aFunc(*pDocSh);
5929 1 : aFunc.DoSubTotals( nTab, aParam, NULL, sal_True, sal_True ); // Bereich muss angelegt sein
5930 1 : }
5931 : }
5932 :
5933 1 : void SAL_CALL ScCellRangeObj::removeSubTotals() throw(uno::RuntimeException)
5934 : {
5935 1 : SolarMutexGuard aGuard;
5936 :
5937 1 : ScDocShell* pDocSh = GetDocShell();
5938 1 : if (pDocSh)
5939 : {
5940 1 : ScSubTotalParam aParam;
5941 1 : ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK );
5942 1 : if (pData)
5943 0 : pData->GetSubTotalParam(aParam); // auch bei Remove die Feld-Eintraege behalten
5944 :
5945 1 : aParam.bRemoveOnly = sal_True;
5946 :
5947 1 : SCTAB nTab = aRange.aStart.Tab();
5948 1 : aParam.nCol1 = aRange.aStart.Col();
5949 1 : aParam.nRow1 = aRange.aStart.Row();
5950 1 : aParam.nCol2 = aRange.aEnd.Col();
5951 1 : aParam.nRow2 = aRange.aEnd.Row();
5952 :
5953 1 : pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen
5954 :
5955 1 : ScDBDocFunc aFunc(*pDocSh);
5956 1 : aFunc.DoSubTotals( nTab, aParam, NULL, sal_True, sal_True ); // Bereich muss angelegt sein
5957 1 : }
5958 1 : }
5959 :
5960 4 : uno::Sequence<beans::PropertyValue> SAL_CALL ScCellRangeObj::createImportDescriptor( sal_Bool bEmpty )
5961 : throw(uno::RuntimeException)
5962 : {
5963 4 : SolarMutexGuard aGuard;
5964 8 : ScImportParam aParam;
5965 4 : ScDocShell* pDocSh = GetDocShell();
5966 4 : if ( !bEmpty && pDocSh )
5967 : {
5968 : // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich
5969 3 : ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK );
5970 3 : if (pData)
5971 0 : pData->GetImportParam(aParam);
5972 : }
5973 :
5974 4 : uno::Sequence<beans::PropertyValue> aSeq( ScImportDescriptor::GetPropertyCount() );
5975 4 : ScImportDescriptor::FillProperties( aSeq, aParam );
5976 8 : return aSeq;
5977 : }
5978 :
5979 4 : void SAL_CALL ScCellRangeObj::doImport( const uno::Sequence<beans::PropertyValue>& aDescriptor )
5980 : throw(uno::RuntimeException)
5981 : {
5982 4 : SolarMutexGuard aGuard;
5983 4 : ScDocShell* pDocSh = GetDocShell();
5984 4 : if (pDocSh)
5985 : {
5986 4 : ScImportParam aParam;
5987 4 : ScImportDescriptor::FillImportParam( aParam, aDescriptor );
5988 :
5989 4 : SCTAB nTab = aRange.aStart.Tab();
5990 4 : aParam.nCol1 = aRange.aStart.Col();
5991 4 : aParam.nRow1 = aRange.aStart.Row();
5992 4 : aParam.nCol2 = aRange.aEnd.Col();
5993 4 : aParam.nRow2 = aRange.aEnd.Row();
5994 :
5995 : //! TODO: could we get passed a valid result set by any means?
5996 :
5997 4 : pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen
5998 :
5999 8 : ScDBDocFunc aFunc(*pDocSh); // Bereich muss angelegt sein
6000 8 : aFunc.DoImport( nTab, aParam, NULL, true ); //! Api-Flag as parameter
6001 4 : }
6002 4 : }
6003 :
6004 : // XCellFormatRangesSupplier
6005 :
6006 3 : uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangeObj::getCellFormatRanges()
6007 : throw(uno::RuntimeException)
6008 : {
6009 3 : SolarMutexGuard aGuard;
6010 3 : ScDocShell* pDocSh = GetDocShell();
6011 3 : if ( pDocSh )
6012 3 : return new ScCellFormatsObj( pDocSh, aRange );
6013 0 : return NULL;
6014 : }
6015 :
6016 : // XUniqueCellFormatRangesSupplier
6017 :
6018 12 : uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangeObj::getUniqueCellFormatRanges()
6019 : throw(uno::RuntimeException)
6020 : {
6021 12 : SolarMutexGuard aGuard;
6022 12 : ScDocShell* pDocSh = GetDocShell();
6023 12 : if ( pDocSh )
6024 12 : return new ScUniqueCellFormatsObj( pDocSh, aRange );
6025 0 : return NULL;
6026 : }
6027 :
6028 : // XPropertySet erweitert fuer Range-Properties
6029 :
6030 228 : uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCellRangeObj::getPropertySetInfo()
6031 : throw(uno::RuntimeException)
6032 : {
6033 228 : SolarMutexGuard aGuard;
6034 : static uno::Reference<beans::XPropertySetInfo> aRef(
6035 228 : new SfxItemPropertySetInfo( pRangePropSet->getPropertyMap() ));
6036 228 : return aRef;
6037 : }
6038 :
6039 422 : void ScCellRangeObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
6040 : throw(lang::IllegalArgumentException, uno::RuntimeException)
6041 : {
6042 : // Range has only Position and Size in addition to ScCellRangesBase, both are ReadOnly
6043 : // -> nothing to do here
6044 :
6045 422 : ScCellRangesBase::SetOnePropertyValue( pEntry, aValue );
6046 421 : }
6047 :
6048 9292 : void ScCellRangeObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
6049 : uno::Any& rAny )
6050 : throw(uno::RuntimeException)
6051 : {
6052 9292 : if ( pEntry )
6053 : {
6054 9292 : if ( pEntry->nWID == SC_WID_UNO_POS )
6055 : {
6056 81 : ScDocShell* pDocSh = GetDocShell();
6057 81 : if (pDocSh)
6058 : {
6059 : // GetMMRect converts using HMM_PER_TWIPS, like the DrawingLayer
6060 : Rectangle aMMRect(pDocSh->GetDocument()->GetMMRect(
6061 81 : aRange.aStart.Col(), aRange.aStart.Row(),
6062 162 : aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab() ));
6063 81 : awt::Point aPos( aMMRect.Left(), aMMRect.Top() );
6064 81 : rAny <<= aPos;
6065 : }
6066 : }
6067 9211 : else if ( pEntry->nWID == SC_WID_UNO_SIZE )
6068 : {
6069 83 : ScDocShell* pDocSh = GetDocShell();
6070 83 : if (pDocSh)
6071 : {
6072 : // GetMMRect converts using HMM_PER_TWIPS, like the DrawingLayer
6073 : Rectangle aMMRect = pDocSh->GetDocument()->GetMMRect(
6074 83 : aRange.aStart.Col(), aRange.aStart.Row(),
6075 166 : aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab() );
6076 83 : Size aSize(aMMRect.GetSize());
6077 83 : awt::Size aAwtSize( aSize.Width(), aSize.Height() );
6078 83 : rAny <<= aAwtSize;
6079 : }
6080 : }
6081 : else
6082 9128 : ScCellRangesBase::GetOnePropertyValue( pEntry, rAny );
6083 :
6084 : }
6085 9292 : }
6086 :
6087 1498 : const SfxItemPropertyMap& ScCellRangeObj::GetItemPropertyMap()
6088 : {
6089 1498 : return pRangePropSet->getPropertyMap();
6090 : }
6091 :
6092 : // XServiceInfo
6093 :
6094 6 : OUString SAL_CALL ScCellRangeObj::getImplementationName() throw(uno::RuntimeException)
6095 : {
6096 6 : return OUString( "ScCellRangeObj" );
6097 : }
6098 :
6099 10 : sal_Bool SAL_CALL ScCellRangeObj::supportsService( const OUString& rServiceName )
6100 : throw(uno::RuntimeException)
6101 : {
6102 10 : String aServiceStr( rServiceName );
6103 13 : return aServiceStr.EqualsAscii( SCSHEETCELLRANGE_SERVICE ) ||
6104 6 : aServiceStr.EqualsAscii( SCCELLRANGE_SERVICE ) ||
6105 6 : aServiceStr.EqualsAscii( SCCELLPROPERTIES_SERVICE ) ||
6106 15 : aServiceStr.EqualsAscii( SCCHARPROPERTIES_SERVICE ) ||
6107 12 : aServiceStr.EqualsAscii( SCPARAPROPERTIES_SERVICE );
6108 : }
6109 :
6110 0 : uno::Sequence<OUString> SAL_CALL ScCellRangeObj::getSupportedServiceNames()
6111 : throw(uno::RuntimeException)
6112 : {
6113 0 : uno::Sequence<OUString> aRet(5);
6114 0 : OUString* pArray = aRet.getArray();
6115 0 : pArray[0] = OUString( SCSHEETCELLRANGE_SERVICE );
6116 0 : pArray[1] = OUString( SCCELLRANGE_SERVICE );
6117 0 : pArray[2] = OUString( SCCELLPROPERTIES_SERVICE );
6118 0 : pArray[3] = OUString( SCCHARPROPERTIES_SERVICE );
6119 0 : pArray[4] = OUString( SCPARAPROPERTIES_SERVICE );
6120 0 : return aRet;
6121 : }
6122 :
6123 : //------------------------------------------------------------------------
6124 :
6125 10 : const SvxItemPropertySet* ScCellObj::GetEditPropertySet()
6126 : {
6127 10 : return lcl_GetEditPropertySet();
6128 : }
6129 :
6130 0 : const SfxItemPropertyMap& ScCellObj::GetCellPropertyMap()
6131 : {
6132 0 : return lcl_GetCellPropertySet()->getPropertyMap();
6133 : }
6134 :
6135 12450 : ScCellObj::ScCellObj(ScDocShell* pDocSh, const ScAddress& rP) :
6136 : ScCellRangeObj( pDocSh, ScRange(rP,rP) ),
6137 12450 : pCellPropSet( lcl_GetCellPropertySet() ),
6138 : aCellPos( rP ),
6139 24900 : nActionLockCount( 0 )
6140 : {
6141 : // pUnoText is allocated on demand (GetUnoText)
6142 : // can't be aggregated because getString/setString is handled here
6143 12450 : }
6144 :
6145 23 : SvxUnoText& ScCellObj::GetUnoText()
6146 : {
6147 23 : if (!mxUnoText.is())
6148 : {
6149 10 : mxUnoText.set(new ScCellTextObj(GetDocShell(), aCellPos));
6150 10 : if (nActionLockCount)
6151 : {
6152 : ScCellEditSource* pEditSource =
6153 0 : static_cast<ScCellEditSource*> (mxUnoText->GetEditSource());
6154 0 : if (pEditSource)
6155 0 : pEditSource->SetDoUpdateData(false);
6156 : }
6157 : }
6158 23 : return *mxUnoText;
6159 : }
6160 :
6161 24852 : ScCellObj::~ScCellObj()
6162 : {
6163 24852 : }
6164 :
6165 1730 : void ScCellObj::RefChanged()
6166 : {
6167 1730 : ScCellRangeObj::RefChanged();
6168 :
6169 1730 : const ScRangeList& rRanges = GetRangeList();
6170 : OSL_ENSURE(rRanges.size() == 1, "was fuer Ranges ?!?!");
6171 1730 : if ( !rRanges.empty() )
6172 : {
6173 1708 : const ScRange* pFirst = rRanges[ 0 ];
6174 1708 : aCellPos = pFirst->aStart;
6175 : }
6176 1730 : }
6177 :
6178 32945 : uno::Any SAL_CALL ScCellObj::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException)
6179 : {
6180 32945 : SC_QUERYINTERFACE( table::XCell )
6181 25178 : SC_QUERYINTERFACE( table::XCell2 )
6182 25178 : SC_QUERYINTERFACE( sheet::XFormulaTokens )
6183 25178 : SC_QUERYINTERFACE( sheet::XCellAddressable )
6184 23722 : SC_QUERYINTERFACE( text::XText )
6185 23713 : SC_QUERYINTERFACE( text::XSimpleText )
6186 23622 : SC_QUERYINTERFACE( text::XTextRange )
6187 23454 : SC_QUERYINTERFACE( container::XEnumerationAccess )
6188 23452 : SC_QUERYINTERFACE( container::XElementAccess )
6189 23450 : SC_QUERYINTERFACE( sheet::XSheetAnnotationAnchor )
6190 23443 : SC_QUERYINTERFACE( text::XTextFieldsSupplier )
6191 23440 : SC_QUERYINTERFACE( document::XActionLockable )
6192 :
6193 23439 : return ScCellRangeObj::queryInterface( rType );
6194 : }
6195 :
6196 93823 : void SAL_CALL ScCellObj::acquire() throw()
6197 : {
6198 93823 : ScCellRangeObj::acquire();
6199 93823 : }
6200 :
6201 93799 : void SAL_CALL ScCellObj::release() throw()
6202 : {
6203 93799 : ScCellRangeObj::release();
6204 93799 : }
6205 :
6206 1 : uno::Sequence<uno::Type> SAL_CALL ScCellObj::getTypes() throw(uno::RuntimeException)
6207 : {
6208 1 : static uno::Sequence<uno::Type> aTypes;
6209 1 : if ( aTypes.getLength() == 0 )
6210 : {
6211 1 : uno::Sequence<uno::Type> aParentTypes(ScCellRangeObj::getTypes());
6212 1 : long nParentLen = aParentTypes.getLength();
6213 1 : const uno::Type* pParentPtr = aParentTypes.getConstArray();
6214 :
6215 1 : aTypes.realloc( nParentLen + 9 );
6216 1 : uno::Type* pPtr = aTypes.getArray();
6217 1 : pPtr[nParentLen + 0] = getCppuType((const uno::Reference<table::XCell>*)0);
6218 1 : pPtr[nParentLen + 1] = getCppuType((const uno::Reference<sheet::XCellAddressable>*)0);
6219 1 : pPtr[nParentLen + 2] = getCppuType((const uno::Reference<text::XText>*)0);
6220 1 : pPtr[nParentLen + 3] = getCppuType((const uno::Reference<container::XEnumerationAccess>*)0);
6221 1 : pPtr[nParentLen + 4] = getCppuType((const uno::Reference<sheet::XSheetAnnotationAnchor>*)0);
6222 1 : pPtr[nParentLen + 5] = getCppuType((const uno::Reference<text::XTextFieldsSupplier>*)0);
6223 1 : pPtr[nParentLen + 6] = getCppuType((const uno::Reference<document::XActionLockable>*)0);
6224 1 : pPtr[nParentLen + 7] = getCppuType((const uno::Reference<sheet::XFormulaTokens>*)0);
6225 1 : pPtr[nParentLen + 8] = getCppuType((const uno::Reference<table::XCell2>*)0);
6226 :
6227 31 : for (long i=0; i<nParentLen; i++)
6228 31 : pPtr[i] = pParentPtr[i]; // parent types first
6229 : }
6230 1 : return aTypes;
6231 : }
6232 :
6233 : namespace
6234 : {
6235 : class theScCellObjImplementationId : public rtl::Static< UnoTunnelIdInit, theScCellObjImplementationId > {};
6236 : }
6237 :
6238 1 : uno::Sequence<sal_Int8> SAL_CALL ScCellObj::getImplementationId() throw(uno::RuntimeException)
6239 : {
6240 1 : return theScCellObjImplementationId::get().getSeq();
6241 : }
6242 :
6243 : // Hilfsfunktionen
6244 :
6245 131 : OUString ScCellObj::GetInputString_Impl(bool bEnglish) const // fuer getFormula / FormulaLocal
6246 : {
6247 131 : if (GetDocShell())
6248 131 : return lcl_GetInputString( GetDocShell()->GetDocument(), aCellPos, bEnglish );
6249 0 : return String();
6250 : }
6251 :
6252 453 : OUString ScCellObj::GetOutputString_Impl(ScDocument* pDoc, const ScAddress& aCellPos)
6253 : {
6254 453 : if (!pDoc)
6255 0 : return EMPTY_OUSTRING;
6256 :
6257 453 : ScRefCellValue aCell;
6258 453 : aCell.assign(*pDoc, aCellPos);
6259 :
6260 453 : if (aCell.isEmpty())
6261 39 : return EMPTY_OUSTRING;
6262 :
6263 828 : OUString aVal;
6264 :
6265 414 : if (aCell.meType == CELLTYPE_EDIT)
6266 : {
6267 : // GetString an der EditCell macht Leerzeichen aus Umbruechen,
6268 : // hier werden die Umbrueche aber gebraucht
6269 1 : const EditTextObject* pData = aCell.mpEditText;
6270 1 : if (pData)
6271 : {
6272 1 : EditEngine& rEngine = pDoc->GetEditEngine();
6273 1 : rEngine.SetText(*pData);
6274 1 : aVal = rEngine.GetText(LINEEND_LF);
6275 : }
6276 : // Edit-Zellen auch nicht per NumberFormatter formatieren
6277 : // (passend zur Ausgabe)
6278 : }
6279 : else
6280 : {
6281 : // wie in GetString am Dokument (column)
6282 : Color* pColor;
6283 413 : sal_uLong nNumFmt = pDoc->GetNumberFormat( aCellPos );
6284 413 : aVal = ScCellFormat::GetString(*pDoc, aCellPos, nNumFmt, &pColor, *pDoc->GetFormatTable());
6285 : }
6286 867 : return aVal;
6287 : }
6288 :
6289 243 : OUString ScCellObj::GetOutputString_Impl() const
6290 : {
6291 243 : ScDocShell* pDocSh = GetDocShell();
6292 243 : OUString aVal;
6293 243 : if ( pDocSh )
6294 243 : aVal = GetOutputString_Impl(pDocSh->GetDocument(), aCellPos);
6295 243 : return aVal;
6296 : }
6297 :
6298 2061 : void ScCellObj::SetString_Impl(const String& rString, sal_Bool bInterpret, sal_Bool bEnglish)
6299 : {
6300 2061 : ScDocShell* pDocSh = GetDocShell();
6301 2061 : if ( pDocSh )
6302 : {
6303 : // GRAM_PODF_A1 for API compatibility.
6304 2061 : (void)pDocSh->GetDocFunc().SetCellText(
6305 2061 : aCellPos, rString, bInterpret, bEnglish, true, formula::FormulaGrammar::GRAM_PODF_A1 );
6306 : }
6307 2061 : }
6308 :
6309 2465 : double ScCellObj::GetValue_Impl() const
6310 : {
6311 2465 : ScDocShell* pDocSh = GetDocShell();
6312 2465 : if ( pDocSh )
6313 2465 : return pDocSh->GetDocument()->GetValue( aCellPos );
6314 :
6315 0 : return 0.0;
6316 : }
6317 :
6318 3547 : void ScCellObj::SetValue_Impl(double fValue)
6319 : {
6320 3547 : ScDocShell* pDocSh = GetDocShell();
6321 3547 : if ( pDocSh )
6322 3547 : pDocSh->GetDocFunc().SetValueCell(aCellPos, fValue, false);
6323 3547 : }
6324 :
6325 : // only for XML import
6326 :
6327 1529 : void ScCellObj::InputEnglishString( const OUString& rText )
6328 : {
6329 : // This is like a mixture of setFormula and property FormulaLocal:
6330 : // The cell's number format is checked for "text", a new cell format may be set,
6331 : // but all parsing is in English.
6332 :
6333 1529 : ScDocShell* pDocSh = GetDocShell();
6334 1529 : if (!pDocSh)
6335 0 : return;
6336 :
6337 1529 : String aString(rText);
6338 1529 : ScDocument* pDoc = pDocSh->GetDocument();
6339 1529 : SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
6340 1529 : sal_uInt32 nOldFormat = pDoc->GetNumberFormat( aCellPos );
6341 1529 : if (pFormatter->GetType(nOldFormat) == NUMBERFORMAT_TEXT)
6342 : {
6343 0 : SetString_Impl(aString, false, false); // text cell
6344 0 : return;
6345 : }
6346 :
6347 1529 : ScDocFunc &rFunc = pDocSh->GetDocFunc();
6348 :
6349 : ScInputStringType aRes =
6350 3058 : ScStringUtil::parseInputString(*pFormatter, aString, LANGUAGE_ENGLISH_US);
6351 :
6352 1529 : if (aRes.meType != ScInputStringType::Unknown)
6353 : {
6354 385 : if ((nOldFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0 && aRes.mnFormatType)
6355 : {
6356 : // apply a format for the recognized type and the old format's language
6357 1 : sal_uInt32 nNewFormat = ScGlobal::GetStandardFormat(*pFormatter, nOldFormat, aRes.mnFormatType);
6358 1 : if (nNewFormat != nOldFormat)
6359 : {
6360 0 : ScPatternAttr aPattern( pDoc->GetPool() );
6361 0 : aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
6362 : // ATTR_LANGUAGE_FORMAT remains unchanged
6363 0 : rFunc.ApplyAttributes( *GetMarkData(), aPattern, true, true );
6364 : }
6365 : }
6366 : }
6367 1529 : switch (aRes.meType)
6368 : {
6369 : case ScInputStringType::Formula:
6370 : rFunc.SetFormulaCell(
6371 : aCellPos,
6372 1 : new ScFormulaCell(pDoc, aCellPos, aRes.maText, formula::FormulaGrammar::GRAM_PODF_A1),
6373 2 : false);
6374 1 : break;
6375 : case ScInputStringType::Number:
6376 1 : rFunc.SetValueCell(aCellPos, aRes.mfValue, false);
6377 1 : break;
6378 : case ScInputStringType::Text:
6379 383 : rFunc.SetStringOrEditCell(aCellPos, aRes.maText, false);
6380 383 : break;
6381 : default:
6382 1144 : SetString_Impl(aString, false, false); // probably empty string
6383 1529 : }
6384 : }
6385 :
6386 : // XText
6387 :
6388 12 : uno::Reference<text::XTextCursor> SAL_CALL ScCellObj::createTextCursor()
6389 : throw(uno::RuntimeException)
6390 : {
6391 12 : SolarMutexGuard aGuard;
6392 12 : return new ScCellTextCursor( *this );
6393 : }
6394 :
6395 1 : uno::Reference<text::XTextCursor> SAL_CALL ScCellObj::createTextCursorByRange(
6396 : const uno::Reference<text::XTextRange>& aTextPosition )
6397 : throw(uno::RuntimeException)
6398 : {
6399 1 : SolarMutexGuard aGuard;
6400 1 : SvxUnoTextCursor* pCursor = new ScCellTextCursor( *this );
6401 1 : uno::Reference<text::XTextCursor> xCursor(pCursor);
6402 :
6403 1 : SvxUnoTextRangeBase* pRange = SvxUnoTextRangeBase::getImplementation( aTextPosition );
6404 1 : if(pRange)
6405 1 : pCursor->SetSelection( pRange->GetSelection() );
6406 : else
6407 : {
6408 0 : ScCellTextCursor* pOther = ScCellTextCursor::getImplementation( aTextPosition );
6409 0 : if(pOther)
6410 0 : pCursor->SetSelection( pOther->GetSelection() );
6411 : else
6412 0 : throw uno::RuntimeException();
6413 : }
6414 :
6415 1 : return xCursor;
6416 : }
6417 :
6418 243 : OUString SAL_CALL ScCellObj::getString() throw(uno::RuntimeException)
6419 : {
6420 243 : SolarMutexGuard aGuard;
6421 243 : return GetOutputString_Impl();
6422 : }
6423 :
6424 34 : void SAL_CALL ScCellObj::setString( const OUString& aText ) throw(uno::RuntimeException)
6425 : {
6426 34 : SolarMutexGuard aGuard;
6427 68 : String aString(aText);
6428 34 : SetString_Impl(aString, false, false); // immer Text
6429 :
6430 : // don't create pUnoText here if not there
6431 34 : if (mxUnoText.is())
6432 40 : mxUnoText->SetSelection(ESelection( 0,0, 0,aString.Len() ));
6433 34 : }
6434 :
6435 2 : void SAL_CALL ScCellObj::insertString( const uno::Reference<text::XTextRange>& xRange,
6436 : const OUString& aString, sal_Bool bAbsorb )
6437 : throw(uno::RuntimeException)
6438 : {
6439 : // special handling for ScCellTextCursor is no longer needed,
6440 : // SvxUnoText::insertString checks for SvxUnoTextRangeBase instead of SvxUnoTextRange
6441 :
6442 2 : SolarMutexGuard aGuard;
6443 2 : GetUnoText().insertString(xRange, aString, bAbsorb);
6444 2 : }
6445 :
6446 2 : void SAL_CALL ScCellObj::insertControlCharacter( const uno::Reference<text::XTextRange>& xRange,
6447 : sal_Int16 nControlCharacter, sal_Bool bAbsorb )
6448 : throw(lang::IllegalArgumentException, uno::RuntimeException)
6449 : {
6450 2 : SolarMutexGuard aGuard;
6451 2 : GetUnoText().insertControlCharacter(xRange, nControlCharacter, bAbsorb);
6452 2 : }
6453 :
6454 7 : void SAL_CALL ScCellObj::insertTextContent( const uno::Reference<text::XTextRange >& xRange,
6455 : const uno::Reference<text::XTextContent >& xContent,
6456 : sal_Bool bAbsorb )
6457 : throw(lang::IllegalArgumentException, uno::RuntimeException)
6458 : {
6459 7 : SolarMutexGuard aGuard;
6460 7 : ScDocShell* pDocSh = GetDocShell();
6461 7 : if ( pDocSh && xContent.is() )
6462 : {
6463 6 : ScEditFieldObj* pCellField = ScEditFieldObj::getImplementation(xContent);
6464 6 : SvxUnoTextRangeBase* pTextRange = ScCellTextCursor::getImplementation( xRange );
6465 :
6466 6 : if ( pCellField && !pCellField->IsInserted() && pTextRange )
6467 : {
6468 6 : SvxEditSource* pEditSource = pTextRange->GetEditSource();
6469 6 : ESelection aSelection(pTextRange->GetSelection());
6470 :
6471 6 : if (!bAbsorb)
6472 : {
6473 : // nicht ersetzen -> hinten anhaengen
6474 2 : aSelection.Adjust();
6475 2 : aSelection.nStartPara = aSelection.nEndPara;
6476 2 : aSelection.nStartPos = aSelection.nEndPos;
6477 : }
6478 :
6479 6 : if (pCellField->GetFieldType() == text::textfield::Type::TABLE)
6480 0 : pCellField->setPropertyValue(SC_UNONAME_TABLEPOS, uno::makeAny<sal_Int32>(aCellPos.Tab()));
6481 :
6482 6 : SvxFieldItem aItem = pCellField->CreateFieldItem();
6483 6 : SvxTextForwarder* pForwarder = pEditSource->GetTextForwarder();
6484 6 : pForwarder->QuickInsertField( aItem, aSelection );
6485 6 : pEditSource->UpdateData();
6486 :
6487 : // neue Selektion: ein Zeichen
6488 6 : aSelection.Adjust();
6489 6 : aSelection.nEndPara = aSelection.nStartPara;
6490 6 : aSelection.nEndPos = aSelection.nStartPos + 1;
6491 12 : uno::Reference<text::XTextRange> xParent(this);
6492 : pCellField->InitDoc(
6493 6 : xParent, new ScCellEditSource(pDocSh, aCellPos), aSelection);
6494 :
6495 : // for bAbsorb=FALSE, the new selection must be behind the inserted content
6496 : // (the xml filter relies on this)
6497 6 : if (!bAbsorb)
6498 2 : aSelection.nStartPos = aSelection.nEndPos;
6499 :
6500 6 : pTextRange->SetSelection( aSelection );
6501 :
6502 18 : return;
6503 : }
6504 : }
6505 2 : GetUnoText().insertTextContent(xRange, xContent, bAbsorb);
6506 : }
6507 :
6508 1 : void SAL_CALL ScCellObj::removeTextContent( const uno::Reference<text::XTextContent>& xContent )
6509 : throw(container::NoSuchElementException, uno::RuntimeException)
6510 : {
6511 1 : SolarMutexGuard aGuard;
6512 1 : if ( xContent.is() )
6513 : {
6514 1 : ScEditFieldObj* pCellField = ScEditFieldObj::getImplementation(xContent);
6515 1 : if ( pCellField && pCellField->IsInserted() )
6516 : {
6517 : //! Testen, ob das Feld in dieser Zelle ist
6518 1 : pCellField->DeleteField();
6519 2 : return;
6520 : }
6521 : }
6522 0 : GetUnoText().removeTextContent(xContent);
6523 : }
6524 :
6525 4 : uno::Reference<text::XText> SAL_CALL ScCellObj::getText() throw(uno::RuntimeException)
6526 : {
6527 4 : SolarMutexGuard aGuard;
6528 4 : return this;
6529 : }
6530 :
6531 1 : uno::Reference<text::XTextRange> SAL_CALL ScCellObj::getStart() throw(uno::RuntimeException)
6532 : {
6533 1 : SolarMutexGuard aGuard;
6534 1 : return GetUnoText().getStart();
6535 : }
6536 :
6537 1 : uno::Reference<text::XTextRange> SAL_CALL ScCellObj::getEnd() throw(uno::RuntimeException)
6538 : {
6539 1 : SolarMutexGuard aGuard;
6540 1 : return GetUnoText().getEnd();
6541 : }
6542 :
6543 1 : uno::Reference<container::XEnumeration> SAL_CALL ScCellObj::createEnumeration()
6544 : throw(uno::RuntimeException)
6545 : {
6546 1 : SolarMutexGuard aGuard;
6547 1 : return GetUnoText().createEnumeration();
6548 : }
6549 :
6550 1 : uno::Type SAL_CALL ScCellObj::getElementType() throw(uno::RuntimeException)
6551 : {
6552 1 : SolarMutexGuard aGuard;
6553 1 : return GetUnoText().getElementType();
6554 : }
6555 :
6556 1 : sal_Bool SAL_CALL ScCellObj::hasElements() throw(uno::RuntimeException)
6557 : {
6558 1 : SolarMutexGuard aGuard;
6559 1 : return GetUnoText().hasElements();
6560 : }
6561 :
6562 : // XCell
6563 :
6564 121 : OUString SAL_CALL ScCellObj::getFormula() throw(uno::RuntimeException)
6565 : {
6566 121 : SolarMutexGuard aGuard;
6567 121 : return GetInputString_Impl( true /* English */ );
6568 : }
6569 :
6570 881 : void SAL_CALL ScCellObj::setFormula( const OUString& aFormula ) throw(uno::RuntimeException)
6571 : {
6572 881 : SolarMutexGuard aGuard;
6573 1762 : String aString(aFormula);
6574 1762 : SetString_Impl(aString, sal_True, sal_True); // Interpret as English
6575 881 : }
6576 :
6577 2465 : double SAL_CALL ScCellObj::getValue() throw(uno::RuntimeException)
6578 : {
6579 2465 : SolarMutexGuard aGuard;
6580 2465 : return GetValue_Impl();
6581 : }
6582 :
6583 3547 : void SAL_CALL ScCellObj::setValue( double nValue ) throw(uno::RuntimeException)
6584 : {
6585 3547 : SolarMutexGuard aGuard;
6586 3547 : SetValue_Impl(nValue);
6587 3547 : }
6588 :
6589 0 : void SAL_CALL ScCellObj::setFormulaString( const OUString& aFormula) throw(uno::RuntimeException)
6590 : {
6591 0 : SolarMutexGuard aGuard;
6592 0 : ScDocShell *pDocSh = GetDocShell();
6593 0 : if( pDocSh )
6594 : {
6595 0 : ScFormulaCell* pCell = new ScFormulaCell( pDocSh->GetDocument(), aCellPos );
6596 0 : pCell->SetHybridFormula( aFormula, formula::FormulaGrammar::GRAM_NATIVE );
6597 0 : pDocSh->GetDocFunc().SetFormulaCell(aCellPos, pCell, false);
6598 0 : }
6599 0 : }
6600 0 : void SAL_CALL ScCellObj::setFormulaResult( double nValue ) throw(uno::RuntimeException)
6601 : {
6602 0 : SolarMutexGuard aGuard;
6603 0 : ScDocShell* pDocSh = GetDocShell();
6604 0 : if ( pDocSh && pDocSh->GetDocument()->GetCellType( aCellPos ) == CELLTYPE_FORMULA )
6605 : {
6606 0 : ScFormulaCell* pCell = pDocSh->GetDocument()->GetFormulaCell(aCellPos);
6607 0 : pCell->SetHybridDouble( nValue );
6608 0 : pCell->ResetDirty();
6609 0 : pCell->SetChanged(false);
6610 0 : }
6611 0 : }
6612 :
6613 3866 : table::CellContentType SAL_CALL ScCellObj::getType() throw(uno::RuntimeException)
6614 : {
6615 3866 : SolarMutexGuard aGuard;
6616 3866 : table::CellContentType eRet = table::CellContentType_EMPTY;
6617 3866 : ScDocShell* pDocSh = GetDocShell();
6618 3866 : if (pDocSh)
6619 : {
6620 3866 : CellType eCalcType = pDocSh->GetDocument()->GetCellType( aCellPos );
6621 3866 : switch (eCalcType)
6622 : {
6623 : case CELLTYPE_VALUE:
6624 2399 : eRet = table::CellContentType_VALUE;
6625 2399 : break;
6626 : case CELLTYPE_STRING:
6627 : case CELLTYPE_EDIT:
6628 116 : eRet = table::CellContentType_TEXT;
6629 116 : break;
6630 : case CELLTYPE_FORMULA:
6631 54 : eRet = table::CellContentType_FORMULA;
6632 54 : break;
6633 : default:
6634 1297 : eRet = table::CellContentType_EMPTY;
6635 : }
6636 : }
6637 : else
6638 : {
6639 : OSL_FAIL("keine DocShell"); //! Exception oder so?
6640 : }
6641 :
6642 3866 : return eRet;
6643 : }
6644 :
6645 39 : table::CellContentType ScCellObj::GetResultType_Impl()
6646 : {
6647 39 : ScDocShell* pDocSh = GetDocShell();
6648 39 : if ( pDocSh )
6649 : {
6650 39 : ScRefCellValue aCell;
6651 39 : aCell.assign(*pDocSh->GetDocument(), aCellPos);
6652 39 : if (aCell.meType == CELLTYPE_FORMULA)
6653 : {
6654 29 : bool bValue = aCell.mpFormula->IsValue();
6655 29 : return bValue ? table::CellContentType_VALUE : table::CellContentType_TEXT;
6656 10 : }
6657 : }
6658 10 : return getType(); // wenn keine Formel
6659 : }
6660 :
6661 2 : sal_Int32 SAL_CALL ScCellObj::getError() throw(uno::RuntimeException)
6662 : {
6663 2 : SolarMutexGuard aGuard;
6664 2 : ScDocShell* pDocSh = GetDocShell();
6665 2 : if (!pDocSh)
6666 : {
6667 : OSL_FAIL("keine DocShell"); //! Exception oder so?
6668 0 : return 0;
6669 : }
6670 :
6671 2 : sal_uInt16 nError = 0;
6672 4 : ScRefCellValue aCell;
6673 2 : aCell.assign(*pDocSh->GetDocument(), aCellPos);
6674 2 : if (aCell.meType == CELLTYPE_FORMULA)
6675 1 : nError = aCell.mpFormula->GetErrCode();
6676 :
6677 4 : return nError;
6678 : }
6679 :
6680 : // XFormulaTokens
6681 :
6682 0 : uno::Sequence<sheet::FormulaToken> SAL_CALL ScCellObj::getTokens() throw(uno::RuntimeException)
6683 : {
6684 0 : SolarMutexGuard aGuard;
6685 0 : uno::Sequence<sheet::FormulaToken> aSequence;
6686 0 : ScDocShell* pDocSh = GetDocShell();
6687 0 : if (!pDocSh)
6688 0 : return aSequence;
6689 :
6690 0 : ScDocument* pDoc = pDocSh->GetDocument();
6691 0 : ScRefCellValue aCell;
6692 0 : aCell.assign(*pDoc, aCellPos);
6693 0 : if (aCell.meType == CELLTYPE_FORMULA)
6694 : {
6695 0 : ScTokenArray* pTokenArray = aCell.mpFormula->GetCode();
6696 0 : if (pTokenArray)
6697 0 : ScTokenConversion::ConvertToTokenSequence(*pDoc, aSequence, *pTokenArray);
6698 : }
6699 0 : return aSequence;
6700 : }
6701 :
6702 0 : void SAL_CALL ScCellObj::setTokens( const uno::Sequence<sheet::FormulaToken>& rTokens ) throw(uno::RuntimeException)
6703 : {
6704 0 : SolarMutexGuard aGuard;
6705 0 : ScDocShell* pDocSh = GetDocShell();
6706 0 : if ( pDocSh )
6707 : {
6708 0 : ScDocument* pDoc = pDocSh->GetDocument();
6709 0 : ScTokenArray aTokenArray;
6710 0 : (void)ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, rTokens );
6711 :
6712 0 : ScFormulaCell* pNewCell = new ScFormulaCell( pDoc, aCellPos, &aTokenArray );
6713 0 : (void)pDocSh->GetDocFunc().SetFormulaCell(aCellPos, pNewCell, false);
6714 0 : }
6715 0 : }
6716 :
6717 : // XCellAddressable
6718 :
6719 1459 : table::CellAddress SAL_CALL ScCellObj::getCellAddress() throw(uno::RuntimeException)
6720 : {
6721 1459 : SolarMutexGuard aGuard;
6722 1459 : table::CellAddress aAdr;
6723 1459 : aAdr.Sheet = aCellPos.Tab();
6724 1459 : aAdr.Column = aCellPos.Col();
6725 1459 : aAdr.Row = aCellPos.Row();
6726 1459 : return aAdr;
6727 : }
6728 :
6729 : // XSheetAnnotationAnchor
6730 :
6731 7 : uno::Reference<sheet::XSheetAnnotation> SAL_CALL ScCellObj::getAnnotation()
6732 : throw(uno::RuntimeException)
6733 : {
6734 7 : SolarMutexGuard aGuard;
6735 7 : ScDocShell* pDocSh = GetDocShell();
6736 7 : if ( pDocSh )
6737 7 : return new ScAnnotationObj( pDocSh, aCellPos );
6738 :
6739 : OSL_FAIL("getAnnotation ohne DocShell");
6740 0 : return NULL;
6741 : }
6742 :
6743 : // XFieldTypesSupplier
6744 :
6745 4 : uno::Reference<container::XEnumerationAccess> SAL_CALL ScCellObj::getTextFields()
6746 : throw(uno::RuntimeException)
6747 : {
6748 4 : SolarMutexGuard aGuard;
6749 4 : ScDocShell* pDocSh = GetDocShell();
6750 4 : if ( pDocSh )
6751 : {
6752 4 : uno::Reference<text::XTextRange> xContent(this);
6753 4 : return new ScCellFieldsObj(xContent, pDocSh, aCellPos);
6754 : }
6755 :
6756 0 : return NULL;
6757 : }
6758 :
6759 0 : uno::Reference<container::XNameAccess> SAL_CALL ScCellObj::getTextFieldMasters()
6760 : throw(uno::RuntimeException)
6761 : {
6762 : // sowas gibts nicht im Calc (?)
6763 0 : return NULL;
6764 : }
6765 :
6766 : // XPropertySet erweitert fuer Zell-Properties
6767 :
6768 97 : uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCellObj::getPropertySetInfo()
6769 : throw(uno::RuntimeException)
6770 : {
6771 97 : SolarMutexGuard aGuard;
6772 : static uno::Reference<beans::XPropertySetInfo> aRef(
6773 97 : new SfxItemPropertySetInfo( pCellPropSet->getPropertyMap() ));
6774 97 : return aRef;
6775 : }
6776 :
6777 48 : void ScCellObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
6778 : throw(lang::IllegalArgumentException, uno::RuntimeException)
6779 : {
6780 48 : if ( pEntry )
6781 : {
6782 48 : if ( pEntry->nWID == SC_WID_UNO_FORMLOC )
6783 : {
6784 2 : OUString aStrVal;
6785 2 : aValue >>= aStrVal;
6786 4 : String aString(aStrVal);
6787 4 : SetString_Impl(aString, sal_True, false); // lokal interpretieren
6788 : }
6789 46 : else if ( pEntry->nWID == SC_WID_UNO_FORMRT )
6790 : {
6791 : // Read-Only
6792 : //! Exception oder so...
6793 : }
6794 : else
6795 45 : ScCellRangeObj::SetOnePropertyValue( pEntry, aValue );
6796 : }
6797 48 : }
6798 :
6799 7900 : void ScCellObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
6800 : uno::Any& rAny )
6801 : throw(uno::RuntimeException)
6802 : {
6803 7900 : if ( pEntry )
6804 : {
6805 7900 : if ( pEntry->nWID == SC_WID_UNO_FORMLOC )
6806 : {
6807 : // sal_False = lokal
6808 10 : rAny <<= OUString( GetInputString_Impl(false) );
6809 : }
6810 7890 : else if ( pEntry->nWID == SC_WID_UNO_FORMRT )
6811 : {
6812 39 : table::CellContentType eType = GetResultType_Impl();
6813 39 : rAny <<= eType;
6814 : }
6815 : else
6816 7851 : ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
6817 : }
6818 7900 : }
6819 :
6820 7424 : const SfxItemPropertyMap& ScCellObj::GetItemPropertyMap()
6821 : {
6822 7424 : return pCellPropSet->getPropertyMap();
6823 : }
6824 :
6825 : // XServiceInfo
6826 :
6827 13 : OUString SAL_CALL ScCellObj::getImplementationName() throw(uno::RuntimeException)
6828 : {
6829 13 : return OUString( "ScCellObj" );
6830 : }
6831 :
6832 17 : sal_Bool SAL_CALL ScCellObj::supportsService( const OUString& rServiceName )
6833 : throw(uno::RuntimeException)
6834 : {
6835 : // CellRange/SheetCellRange are not in SheetCell service description,
6836 : // but ScCellObj is used instead of ScCellRangeObj in CellRanges collections,
6837 : // so it must support them
6838 :
6839 17 : String aServiceStr(rServiceName);
6840 33 : return aServiceStr.EqualsAscii( SCSHEETCELL_SERVICE ) ||
6841 32 : aServiceStr.EqualsAscii( SCCELL_SERVICE ) ||
6842 32 : aServiceStr.EqualsAscii( SCCELLPROPERTIES_SERVICE ) ||
6843 32 : aServiceStr.EqualsAscii( SCCHARPROPERTIES_SERVICE ) ||
6844 32 : aServiceStr.EqualsAscii( SCPARAPROPERTIES_SERVICE ) ||
6845 36 : aServiceStr.EqualsAscii( SCSHEETCELLRANGE_SERVICE ) ||
6846 20 : aServiceStr.EqualsAscii( SCCELLRANGE_SERVICE );
6847 : }
6848 :
6849 0 : uno::Sequence<OUString> SAL_CALL ScCellObj::getSupportedServiceNames()
6850 : throw(uno::RuntimeException)
6851 : {
6852 0 : uno::Sequence<OUString> aRet(7);
6853 0 : OUString* pArray = aRet.getArray();
6854 0 : pArray[0] = OUString( SCSHEETCELL_SERVICE );
6855 0 : pArray[1] = OUString( SCCELL_SERVICE );
6856 0 : pArray[2] = OUString( SCCELLPROPERTIES_SERVICE );
6857 0 : pArray[3] = OUString( SCCHARPROPERTIES_SERVICE );
6858 0 : pArray[4] = OUString( SCPARAPROPERTIES_SERVICE );
6859 0 : pArray[5] = OUString( SCSHEETCELLRANGE_SERVICE );
6860 0 : pArray[6] = OUString( SCCELLRANGE_SERVICE );
6861 0 : return aRet;
6862 : }
6863 :
6864 : // XActionLockable
6865 :
6866 3 : sal_Bool SAL_CALL ScCellObj::isActionLocked() throw(uno::RuntimeException)
6867 : {
6868 3 : SolarMutexGuard aGuard;
6869 3 : return nActionLockCount != 0;
6870 : }
6871 :
6872 2 : void SAL_CALL ScCellObj::addActionLock() throw(uno::RuntimeException)
6873 : {
6874 2 : SolarMutexGuard aGuard;
6875 2 : if (!nActionLockCount)
6876 : {
6877 2 : if (mxUnoText.is())
6878 : {
6879 : ScCellEditSource* pEditSource =
6880 0 : static_cast<ScCellEditSource*> (mxUnoText->GetEditSource());
6881 0 : if (pEditSource)
6882 0 : pEditSource->SetDoUpdateData(false);
6883 : }
6884 : }
6885 2 : nActionLockCount++;
6886 2 : }
6887 :
6888 1 : void SAL_CALL ScCellObj::removeActionLock() throw(uno::RuntimeException)
6889 : {
6890 1 : SolarMutexGuard aGuard;
6891 1 : if (nActionLockCount > 0)
6892 : {
6893 1 : nActionLockCount--;
6894 1 : if (!nActionLockCount)
6895 : {
6896 1 : if (mxUnoText.is())
6897 : {
6898 : ScCellEditSource* pEditSource =
6899 0 : static_cast<ScCellEditSource*> (mxUnoText->GetEditSource());
6900 0 : if (pEditSource)
6901 : {
6902 0 : pEditSource->SetDoUpdateData(sal_True);
6903 0 : if (pEditSource->IsDirty())
6904 0 : pEditSource->UpdateData();
6905 : }
6906 : }
6907 : }
6908 1 : }
6909 1 : }
6910 :
6911 1 : void SAL_CALL ScCellObj::setActionLocks( sal_Int16 nLock ) throw(uno::RuntimeException)
6912 : {
6913 1 : SolarMutexGuard aGuard;
6914 1 : if (mxUnoText.is())
6915 : {
6916 : ScCellEditSource* pEditSource =
6917 0 : static_cast<ScCellEditSource*> (mxUnoText->GetEditSource());
6918 0 : if (pEditSource)
6919 : {
6920 0 : pEditSource->SetDoUpdateData(nLock == 0);
6921 0 : if ((nActionLockCount > 0) && (nLock == 0) && pEditSource->IsDirty())
6922 0 : pEditSource->UpdateData();
6923 : }
6924 : }
6925 1 : nActionLockCount = nLock;
6926 1 : }
6927 :
6928 1 : sal_Int16 SAL_CALL ScCellObj::resetActionLocks() throw(uno::RuntimeException)
6929 : {
6930 1 : SolarMutexGuard aGuard;
6931 1 : sal_uInt16 nRet(nActionLockCount);
6932 1 : if (mxUnoText.is())
6933 : {
6934 : ScCellEditSource* pEditSource =
6935 0 : static_cast<ScCellEditSource*> (mxUnoText->GetEditSource());
6936 0 : if (pEditSource)
6937 : {
6938 0 : pEditSource->SetDoUpdateData(sal_True);
6939 0 : if (pEditSource->IsDirty())
6940 0 : pEditSource->UpdateData();
6941 : }
6942 : }
6943 1 : nActionLockCount = 0;
6944 1 : return nRet;
6945 : }
6946 :
6947 : //------------------------------------------------------------------------
6948 :
6949 2679 : ScTableSheetObj::ScTableSheetObj( ScDocShell* pDocSh, SCTAB nTab ) :
6950 : ScCellRangeObj( pDocSh, ScRange(0,0,nTab, MAXCOL,MAXROW,nTab) ),
6951 2679 : pSheetPropSet(lcl_GetSheetPropertySet())
6952 : {
6953 2679 : }
6954 :
6955 5202 : ScTableSheetObj::~ScTableSheetObj()
6956 : {
6957 5202 : }
6958 :
6959 319 : void ScTableSheetObj::RefChanged()
6960 : {
6961 : // skip calling immediate base
6962 : // class ScCellRangeObj::RefChanged as
6963 : // it changes the Sheets range ( which shouldn't
6964 : // happen ) - hmm maybe we don't even need to
6965 : // call ScCellRangesBase::RefChanged() :/
6966 :
6967 319 : ScCellRangesBase::RefChanged();
6968 319 : }
6969 :
6970 0 : void ScTableSheetObj::InitInsertSheet(ScDocShell* pDocSh, SCTAB nTab)
6971 : {
6972 0 : InitInsertRange( pDocSh, ScRange(0,0,nTab, MAXCOL,MAXROW,nTab) );
6973 0 : }
6974 :
6975 12801 : uno::Any SAL_CALL ScTableSheetObj::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException)
6976 : {
6977 12801 : SC_QUERYINTERFACE( sheet::XSpreadsheet )
6978 12064 : SC_QUERYINTERFACE( container::XNamed )
6979 11938 : SC_QUERYINTERFACE( sheet::XSheetPageBreak )
6980 11935 : SC_QUERYINTERFACE( sheet::XCellRangeMovement )
6981 11929 : SC_QUERYINTERFACE( table::XTableChartsSupplier )
6982 11905 : SC_QUERYINTERFACE( sheet::XDataPilotTablesSupplier )
6983 11868 : SC_QUERYINTERFACE( sheet::XScenariosSupplier )
6984 11867 : SC_QUERYINTERFACE( sheet::XSheetAnnotationsSupplier )
6985 11853 : SC_QUERYINTERFACE( drawing::XDrawPageSupplier )
6986 11639 : SC_QUERYINTERFACE( sheet::XPrintAreas )
6987 11626 : SC_QUERYINTERFACE( sheet::XSheetAuditing )
6988 11625 : SC_QUERYINTERFACE( sheet::XSheetOutline )
6989 11604 : SC_QUERYINTERFACE( util::XProtectable )
6990 11595 : SC_QUERYINTERFACE( sheet::XScenario )
6991 11595 : SC_QUERYINTERFACE( sheet::XScenarioEnhanced )
6992 11595 : SC_QUERYINTERFACE( sheet::XSheetLinkable )
6993 11584 : SC_QUERYINTERFACE( sheet::XExternalSheetName )
6994 11584 : SC_QUERYINTERFACE( document::XEventsSupplier )
6995 :
6996 11584 : return ScCellRangeObj::queryInterface( rType );
6997 : }
6998 :
6999 44367 : void SAL_CALL ScTableSheetObj::acquire() throw()
7000 : {
7001 44367 : ScCellRangeObj::acquire();
7002 44367 : }
7003 :
7004 44289 : void SAL_CALL ScTableSheetObj::release() throw()
7005 : {
7006 44289 : ScCellRangeObj::release();
7007 44289 : }
7008 :
7009 2 : uno::Sequence<uno::Type> SAL_CALL ScTableSheetObj::getTypes() throw(uno::RuntimeException)
7010 : {
7011 2 : static uno::Sequence<uno::Type> aTypes;
7012 2 : if ( aTypes.getLength() == 0 )
7013 : {
7014 2 : uno::Sequence<uno::Type> aParentTypes = ScCellRangeObj::getTypes();
7015 2 : long nParentLen = aParentTypes.getLength();
7016 2 : const uno::Type* pParentPtr = aParentTypes.getConstArray();
7017 :
7018 2 : aTypes.realloc( nParentLen + 18 );
7019 2 : uno::Type* pPtr = aTypes.getArray();
7020 2 : pPtr[nParentLen + 0] = getCppuType((const uno::Reference<sheet::XSpreadsheet>*)0);
7021 2 : pPtr[nParentLen + 1] = getCppuType((const uno::Reference<container::XNamed>*)0);
7022 2 : pPtr[nParentLen + 2] = getCppuType((const uno::Reference<sheet::XSheetPageBreak>*)0);
7023 2 : pPtr[nParentLen + 3] = getCppuType((const uno::Reference<sheet::XCellRangeMovement>*)0);
7024 2 : pPtr[nParentLen + 4] = getCppuType((const uno::Reference<table::XTableChartsSupplier>*)0);
7025 2 : pPtr[nParentLen + 5] = getCppuType((const uno::Reference<sheet::XDataPilotTablesSupplier>*)0);
7026 2 : pPtr[nParentLen + 6] = getCppuType((const uno::Reference<sheet::XScenariosSupplier>*)0);
7027 2 : pPtr[nParentLen + 7] = getCppuType((const uno::Reference<sheet::XSheetAnnotationsSupplier>*)0);
7028 2 : pPtr[nParentLen + 8] = getCppuType((const uno::Reference<drawing::XDrawPageSupplier>*)0);
7029 2 : pPtr[nParentLen + 9] = getCppuType((const uno::Reference<sheet::XPrintAreas>*)0);
7030 2 : pPtr[nParentLen +10] = getCppuType((const uno::Reference<sheet::XSheetAuditing>*)0);
7031 2 : pPtr[nParentLen +11] = getCppuType((const uno::Reference<sheet::XSheetOutline>*)0);
7032 2 : pPtr[nParentLen +12] = getCppuType((const uno::Reference<util::XProtectable>*)0);
7033 2 : pPtr[nParentLen +13] = getCppuType((const uno::Reference<sheet::XScenario>*)0);
7034 2 : pPtr[nParentLen +14] = getCppuType((const uno::Reference<sheet::XScenarioEnhanced>*)0);
7035 2 : pPtr[nParentLen +15] = getCppuType((const uno::Reference<sheet::XSheetLinkable>*)0);
7036 2 : pPtr[nParentLen +16] = getCppuType((const uno::Reference<sheet::XExternalSheetName>*)0);
7037 2 : pPtr[nParentLen +17] = getCppuType((const uno::Reference<document::XEventsSupplier>*)0);
7038 :
7039 62 : for (long i=0; i<nParentLen; i++)
7040 62 : pPtr[i] = pParentPtr[i]; // parent types first
7041 : }
7042 2 : return aTypes;
7043 : }
7044 :
7045 : namespace
7046 : {
7047 : class theScTableSheetObjImplementationId : public rtl::Static< UnoTunnelIdInit, theScTableSheetObjImplementationId > {};
7048 : }
7049 :
7050 11 : uno::Sequence<sal_Int8> SAL_CALL ScTableSheetObj::getImplementationId() throw(uno::RuntimeException)
7051 : {
7052 11 : return theScTableSheetObjImplementationId::get().getSeq();
7053 : }
7054 :
7055 : // Hilfsfunktionen
7056 :
7057 4747 : SCTAB ScTableSheetObj::GetTab_Impl() const
7058 : {
7059 4747 : const ScRangeList& rRanges = GetRangeList();
7060 : OSL_ENSURE(rRanges.size() == 1, "was fuer Ranges ?!?!");
7061 4747 : if ( !rRanges.empty() )
7062 : {
7063 4747 : const ScRange* pFirst = rRanges[ 0 ];
7064 4747 : return pFirst->aStart.Tab();
7065 : }
7066 0 : return 0; // soll nicht sein
7067 : }
7068 :
7069 : // former XSheet
7070 :
7071 24 : uno::Reference<table::XTableCharts> SAL_CALL ScTableSheetObj::getCharts() throw(uno::RuntimeException)
7072 : {
7073 24 : SolarMutexGuard aGuard;
7074 24 : ScDocShell* pDocSh = GetDocShell();
7075 24 : if ( pDocSh )
7076 24 : return new ScChartsObj( pDocSh, GetTab_Impl() );
7077 :
7078 : OSL_FAIL("kein Dokument");
7079 0 : return NULL;
7080 : }
7081 :
7082 44 : uno::Reference<sheet::XDataPilotTables> SAL_CALL ScTableSheetObj::getDataPilotTables()
7083 : throw(uno::RuntimeException)
7084 : {
7085 44 : SolarMutexGuard aGuard;
7086 44 : ScDocShell* pDocSh = GetDocShell();
7087 44 : if ( pDocSh )
7088 44 : return new ScDataPilotTablesObj( pDocSh, GetTab_Impl() );
7089 :
7090 : OSL_FAIL("kein Dokument");
7091 0 : return NULL;
7092 : }
7093 :
7094 2 : uno::Reference<sheet::XScenarios> SAL_CALL ScTableSheetObj::getScenarios() throw(uno::RuntimeException)
7095 : {
7096 2 : SolarMutexGuard aGuard;
7097 2 : ScDocShell* pDocSh = GetDocShell();
7098 :
7099 2 : if ( pDocSh )
7100 2 : return new ScScenariosObj( pDocSh, GetTab_Impl() );
7101 :
7102 : OSL_FAIL("kein Dokument");
7103 0 : return NULL;
7104 : }
7105 :
7106 14 : uno::Reference<sheet::XSheetAnnotations> SAL_CALL ScTableSheetObj::getAnnotations()
7107 : throw(uno::RuntimeException)
7108 : {
7109 14 : SolarMutexGuard aGuard;
7110 14 : ScDocShell* pDocSh = GetDocShell();
7111 :
7112 14 : if ( pDocSh )
7113 14 : return new ScAnnotationsObj( pDocSh, GetTab_Impl() );
7114 :
7115 : OSL_FAIL("kein Dokument");
7116 0 : return NULL;
7117 : }
7118 :
7119 93 : uno::Reference<table::XCellRange> SAL_CALL ScTableSheetObj::getCellRangeByName(
7120 : const OUString& rRange ) throw(uno::RuntimeException)
7121 : {
7122 93 : SolarMutexGuard aGuard;
7123 93 : return ScCellRangeObj::getCellRangeByName( rRange );
7124 : }
7125 :
7126 18 : uno::Reference<sheet::XSheetCellCursor> SAL_CALL ScTableSheetObj::createCursor()
7127 : throw(uno::RuntimeException)
7128 : {
7129 18 : SolarMutexGuard aGuard;
7130 18 : ScDocShell* pDocSh = GetDocShell();
7131 18 : if ( pDocSh )
7132 : {
7133 : //! einzelne Zelle oder ganze Tabelle???????
7134 18 : SCTAB nTab = GetTab_Impl();
7135 18 : return new ScCellCursorObj( pDocSh, ScRange( 0,0,nTab, MAXCOL,MAXROW,nTab ) );
7136 : }
7137 0 : return NULL;
7138 : }
7139 :
7140 184 : uno::Reference<sheet::XSheetCellCursor> SAL_CALL ScTableSheetObj::createCursorByRange(
7141 : const uno::Reference<sheet::XSheetCellRange>& xCellRange )
7142 : throw(uno::RuntimeException)
7143 : {
7144 184 : SolarMutexGuard aGuard;
7145 184 : ScDocShell* pDocSh = GetDocShell();
7146 184 : if ( pDocSh && xCellRange.is() )
7147 : {
7148 184 : ScCellRangesBase* pRangesImp = ScCellRangesBase::getImplementation( xCellRange );
7149 184 : if (pRangesImp)
7150 : {
7151 184 : const ScRangeList& rRanges = pRangesImp->GetRangeList();
7152 : OSL_ENSURE( rRanges.size() == 1, "Range? Ranges?" );
7153 184 : return new ScCellCursorObj( pDocSh, *rRanges[ 0 ] );
7154 : }
7155 : }
7156 0 : return NULL;
7157 : }
7158 :
7159 : // XSheetCellRange
7160 :
7161 1272 : uno::Reference<sheet::XSpreadsheet> SAL_CALL ScTableSheetObj::getSpreadsheet()
7162 : throw(uno::RuntimeException)
7163 : {
7164 1272 : SolarMutexGuard aGuard;
7165 1272 : return this; //!???
7166 : }
7167 :
7168 : // XCellRange
7169 :
7170 3674 : uno::Reference<table::XCell> SAL_CALL ScTableSheetObj::getCellByPosition(
7171 : sal_Int32 nColumn, sal_Int32 nRow )
7172 : throw(lang::IndexOutOfBoundsException, uno::RuntimeException)
7173 : {
7174 3674 : SolarMutexGuard aGuard;
7175 3674 : return ScCellRangeObj::GetCellByPosition_Impl(nColumn, nRow);
7176 : }
7177 :
7178 3208 : uno::Reference<table::XCellRange> SAL_CALL ScTableSheetObj::getCellRangeByPosition(
7179 : sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom )
7180 : throw(lang::IndexOutOfBoundsException, uno::RuntimeException)
7181 : {
7182 3208 : SolarMutexGuard aGuard;
7183 3208 : return ScCellRangeObj::getCellRangeByPosition(nLeft,nTop,nRight,nBottom);
7184 : }
7185 :
7186 6 : uno::Sequence<sheet::TablePageBreakData> SAL_CALL ScTableSheetObj::getColumnPageBreaks()
7187 : throw(uno::RuntimeException)
7188 : {
7189 6 : SolarMutexGuard aGuard;
7190 6 : ScDocShell* pDocSh = GetDocShell();
7191 6 : if ( pDocSh )
7192 : {
7193 6 : ScDocument* pDoc = pDocSh->GetDocument();
7194 6 : SCTAB nTab = GetTab_Impl();
7195 :
7196 6 : Size aSize(pDoc->GetPageSize( nTab ));
7197 6 : if (aSize.Width() && aSize.Height()) // effektive Groesse schon gesetzt?
7198 6 : pDoc->UpdatePageBreaks( nTab );
7199 : else
7200 : {
7201 : // Umbrueche updaten wie in ScDocShell::PageStyleModified:
7202 0 : ScPrintFunc aPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab );
7203 0 : aPrintFunc.UpdatePages();
7204 : }
7205 :
7206 6 : SCCOL nCount = 0;
7207 : SCCOL nCol;
7208 6150 : for (nCol=0; nCol<=MAXCOL; nCol++)
7209 6144 : if (pDoc->HasColBreak(nCol, nTab))
7210 16 : ++nCount;
7211 :
7212 6 : sheet::TablePageBreakData aData;
7213 6 : uno::Sequence<sheet::TablePageBreakData> aSeq(nCount);
7214 6 : sheet::TablePageBreakData* pAry = aSeq.getArray();
7215 6 : sal_uInt16 nPos = 0;
7216 6150 : for (nCol=0; nCol<=MAXCOL; nCol++)
7217 : {
7218 6144 : ScBreakType nBreak = pDoc->HasColBreak(nCol, nTab);
7219 6144 : if (nBreak)
7220 : {
7221 16 : aData.Position = nCol;
7222 16 : aData.ManualBreak = (nBreak & BREAK_MANUAL);
7223 16 : pAry[nPos] = aData;
7224 16 : ++nPos;
7225 : }
7226 : }
7227 6 : return aSeq;
7228 : }
7229 0 : return uno::Sequence<sheet::TablePageBreakData>(0);
7230 : }
7231 :
7232 6 : uno::Sequence<sheet::TablePageBreakData> SAL_CALL ScTableSheetObj::getRowPageBreaks()
7233 : throw(uno::RuntimeException)
7234 : {
7235 6 : SolarMutexGuard aGuard;
7236 6 : ScDocShell* pDocSh = GetDocShell();
7237 6 : if ( pDocSh )
7238 : {
7239 6 : ScDocument* pDoc = pDocSh->GetDocument();
7240 6 : SCTAB nTab = GetTab_Impl();
7241 :
7242 6 : Size aSize(pDoc->GetPageSize( nTab ));
7243 6 : if (aSize.Width() && aSize.Height()) // effektive Groesse schon gesetzt?
7244 5 : pDoc->UpdatePageBreaks( nTab );
7245 : else
7246 : {
7247 : // Umbrueche updaten wie in ScDocShell::PageStyleModified:
7248 1 : ScPrintFunc aPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab );
7249 1 : aPrintFunc.UpdatePages();
7250 : }
7251 6 : return pDoc->GetRowBreakData(nTab);
7252 : }
7253 0 : return uno::Sequence<sheet::TablePageBreakData>(0);
7254 : }
7255 :
7256 0 : void SAL_CALL ScTableSheetObj::removeAllManualPageBreaks() throw(uno::RuntimeException)
7257 : {
7258 0 : SolarMutexGuard aGuard;
7259 0 : ScDocShell* pDocSh = GetDocShell();
7260 0 : if ( pDocSh )
7261 : {
7262 : //! docfunc Funktion, auch fuer ScViewFunc::RemoveManualBreaks
7263 :
7264 0 : ScDocument* pDoc = pDocSh->GetDocument();
7265 0 : sal_Bool bUndo (pDoc->IsUndoEnabled());
7266 0 : SCTAB nTab = GetTab_Impl();
7267 :
7268 0 : if (bUndo)
7269 : {
7270 0 : ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
7271 0 : pUndoDoc->InitUndo( pDoc, nTab, nTab, sal_True, sal_True );
7272 0 : pDoc->CopyToDocument( 0,0,nTab, MAXCOL,MAXROW,nTab, IDF_NONE, false, pUndoDoc );
7273 0 : pDocSh->GetUndoManager()->AddUndoAction(
7274 0 : new ScUndoRemoveBreaks( pDocSh, nTab, pUndoDoc ) );
7275 : }
7276 :
7277 0 : pDoc->RemoveManualBreaks(nTab);
7278 0 : pDoc->UpdatePageBreaks(nTab);
7279 :
7280 : //? UpdatePageBreakData( sal_True );
7281 0 : pDocSh->SetDocumentModified();
7282 0 : pDocSh->PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PAINT_GRID);
7283 0 : }
7284 0 : }
7285 :
7286 : // XNamed
7287 :
7288 124 : OUString SAL_CALL ScTableSheetObj::getName() throw(uno::RuntimeException)
7289 : {
7290 124 : SolarMutexGuard aGuard;
7291 124 : OUString aName;
7292 124 : ScDocShell* pDocSh = GetDocShell();
7293 124 : if ( pDocSh )
7294 124 : pDocSh->GetDocument()->GetName( GetTab_Impl(), aName );
7295 124 : return aName;
7296 : }
7297 :
7298 3 : void SAL_CALL ScTableSheetObj::setName( const OUString& aNewName )
7299 : throw(uno::RuntimeException)
7300 : {
7301 3 : SolarMutexGuard aGuard;
7302 3 : ScDocShell* pDocSh = GetDocShell();
7303 3 : if ( pDocSh )
7304 : {
7305 3 : String aString(aNewName);
7306 3 : pDocSh->GetDocFunc().RenameTable( GetTab_Impl(), aString, sal_True, sal_True );
7307 3 : }
7308 3 : }
7309 :
7310 : // XDrawPageSupplier
7311 :
7312 214 : uno::Reference<drawing::XDrawPage> SAL_CALL ScTableSheetObj::getDrawPage()
7313 : throw(uno::RuntimeException)
7314 : {
7315 214 : SolarMutexGuard aGuard;
7316 214 : ScDocShell* pDocSh = GetDocShell();
7317 214 : if ( pDocSh )
7318 : {
7319 214 : ScDrawLayer* pDrawLayer = pDocSh->MakeDrawLayer();
7320 : OSL_ENSURE(pDrawLayer,"kann Draw-Layer nicht anlegen");
7321 :
7322 214 : SCTAB nTab = GetTab_Impl();
7323 214 : SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
7324 : OSL_ENSURE(pPage,"Draw-Page nicht gefunden");
7325 214 : if (pPage)
7326 214 : return uno::Reference<drawing::XDrawPage> (pPage->getUnoPage(), uno::UNO_QUERY);
7327 :
7328 : // Das DrawPage-Objekt meldet sich als Listener am SdrModel an
7329 : // und sollte von dort alle Aktionen mitbekommen
7330 : }
7331 0 : return NULL;
7332 : }
7333 :
7334 : // XCellMovement
7335 :
7336 1 : void SAL_CALL ScTableSheetObj::insertCells( const table::CellRangeAddress& rRangeAddress,
7337 : sheet::CellInsertMode nMode ) throw(uno::RuntimeException)
7338 : {
7339 1 : SolarMutexGuard aGuard;
7340 1 : ScDocShell* pDocSh = GetDocShell();
7341 1 : if ( pDocSh )
7342 : {
7343 1 : sal_Bool bDo = sal_True;
7344 1 : InsCellCmd eCmd = INS_NONE;
7345 1 : switch (nMode)
7346 : {
7347 0 : case sheet::CellInsertMode_NONE: bDo = false; break;
7348 0 : case sheet::CellInsertMode_DOWN: eCmd = INS_CELLSDOWN; break;
7349 1 : case sheet::CellInsertMode_RIGHT: eCmd = INS_CELLSRIGHT; break;
7350 0 : case sheet::CellInsertMode_ROWS: eCmd = INS_INSROWS; break;
7351 0 : case sheet::CellInsertMode_COLUMNS: eCmd = INS_INSCOLS; break;
7352 : default:
7353 : OSL_FAIL("insertCells: falscher Mode");
7354 0 : bDo = false;
7355 : }
7356 :
7357 1 : if (bDo)
7358 : {
7359 : OSL_ENSURE( rRangeAddress.Sheet == GetTab_Impl(), "falsche Tabelle in CellRangeAddress" );
7360 1 : ScRange aScRange;
7361 1 : ScUnoConversion::FillScRange( aScRange, rRangeAddress );
7362 1 : pDocSh->GetDocFunc().InsertCells( aScRange, NULL, eCmd, sal_True, sal_True );
7363 : }
7364 1 : }
7365 1 : }
7366 :
7367 3 : void SAL_CALL ScTableSheetObj::removeRange( const table::CellRangeAddress& rRangeAddress,
7368 : sheet::CellDeleteMode nMode ) throw(uno::RuntimeException)
7369 : {
7370 3 : SolarMutexGuard aGuard;
7371 3 : ScDocShell* pDocSh = GetDocShell();
7372 3 : if ( pDocSh )
7373 : {
7374 3 : sal_Bool bDo = sal_True;
7375 3 : DelCellCmd eCmd = DEL_NONE;
7376 3 : switch (nMode)
7377 : {
7378 0 : case sheet::CellDeleteMode_NONE: bDo = false; break;
7379 1 : case sheet::CellDeleteMode_UP: eCmd = DEL_CELLSUP; break;
7380 2 : case sheet::CellDeleteMode_LEFT: eCmd = DEL_CELLSLEFT; break;
7381 0 : case sheet::CellDeleteMode_ROWS: eCmd = DEL_DELROWS; break;
7382 0 : case sheet::CellDeleteMode_COLUMNS: eCmd = DEL_DELCOLS; break;
7383 : default:
7384 : OSL_FAIL("deleteCells: falscher Mode");
7385 0 : bDo = false;
7386 : }
7387 :
7388 3 : if (bDo)
7389 : {
7390 : OSL_ENSURE( rRangeAddress.Sheet == GetTab_Impl(), "falsche Tabelle in CellRangeAddress" );
7391 3 : ScRange aScRange;
7392 3 : ScUnoConversion::FillScRange( aScRange, rRangeAddress );
7393 3 : pDocSh->GetDocFunc().DeleteCells( aScRange, NULL, eCmd, sal_True, sal_True );
7394 : }
7395 3 : }
7396 3 : }
7397 :
7398 1 : void SAL_CALL ScTableSheetObj::moveRange( const table::CellAddress& aDestination,
7399 : const table::CellRangeAddress& aSource )
7400 : throw(uno::RuntimeException)
7401 : {
7402 1 : SolarMutexGuard aGuard;
7403 1 : ScDocShell* pDocSh = GetDocShell();
7404 1 : if ( pDocSh )
7405 : {
7406 : OSL_ENSURE( aSource.Sheet == GetTab_Impl(), "falsche Tabelle in CellRangeAddress" );
7407 1 : ScRange aSourceRange;
7408 1 : ScUnoConversion::FillScRange( aSourceRange, aSource );
7409 1 : ScAddress aDestPos( (SCCOL)aDestination.Column, (SCROW)aDestination.Row, aDestination.Sheet );
7410 1 : pDocSh->GetDocFunc().MoveBlock( aSourceRange, aDestPos, sal_True, sal_True, sal_True, sal_True );
7411 1 : }
7412 1 : }
7413 :
7414 1 : void SAL_CALL ScTableSheetObj::copyRange( const table::CellAddress& aDestination,
7415 : const table::CellRangeAddress& aSource )
7416 : throw(uno::RuntimeException)
7417 : {
7418 1 : SolarMutexGuard aGuard;
7419 1 : ScDocShell* pDocSh = GetDocShell();
7420 1 : if ( pDocSh )
7421 : {
7422 : OSL_ENSURE( aSource.Sheet == GetTab_Impl(), "falsche Tabelle in CellRangeAddress" );
7423 1 : ScRange aSourceRange;
7424 1 : ScUnoConversion::FillScRange( aSourceRange, aSource );
7425 1 : ScAddress aDestPos( (SCCOL)aDestination.Column, (SCROW)aDestination.Row, aDestination.Sheet );
7426 1 : pDocSh->GetDocFunc().MoveBlock( aSourceRange, aDestPos, false, sal_True, sal_True, sal_True );
7427 1 : }
7428 1 : }
7429 :
7430 : // XPrintAreas
7431 :
7432 6 : void ScTableSheetObj::PrintAreaUndo_Impl( ScPrintRangeSaver* pOldRanges )
7433 : {
7434 : // Umbrueche und Undo
7435 6 : ScDocShell* pDocSh = GetDocShell();
7436 6 : ScDocument* pDoc = pDocSh ? pDocSh->GetDocument() : 0;
7437 :
7438 6 : if(pDocSh && pDoc)
7439 : {
7440 6 : const bool bUndo(pDoc->IsUndoEnabled());
7441 6 : const SCTAB nTab(GetTab_Impl());
7442 :
7443 6 : if(bUndo)
7444 : {
7445 2 : pDocSh->GetUndoManager()->AddUndoAction(
7446 : new ScUndoPrintRange(
7447 : pDocSh,
7448 : nTab,
7449 : pOldRanges,
7450 2 : pDoc->CreatePrintRangeSaver())); // create new ranges
7451 :
7452 : // #i120105# ownership of old ranges has changed, mark as consumed
7453 2 : pOldRanges = 0;
7454 : }
7455 :
7456 6 : ScPrintFunc(pDocSh, pDocSh->GetPrinter(), nTab).UpdatePages();
7457 6 : SfxBindings* pBindings = pDocSh->GetViewBindings();
7458 :
7459 6 : if(pBindings)
7460 : {
7461 2 : pBindings->Invalidate(SID_DELETE_PRINTAREA);
7462 : }
7463 :
7464 6 : pDocSh->SetDocumentModified();
7465 : }
7466 :
7467 : // #i120105# pOldRanges not used, need to cleanup
7468 6 : delete pOldRanges;
7469 6 : }
7470 :
7471 9 : uno::Sequence<table::CellRangeAddress> SAL_CALL ScTableSheetObj::getPrintAreas()
7472 : throw(uno::RuntimeException)
7473 : {
7474 9 : SolarMutexGuard aGuard;
7475 9 : ScDocShell* pDocSh = GetDocShell();
7476 9 : if ( pDocSh )
7477 : {
7478 9 : ScDocument* pDoc = pDocSh->GetDocument();
7479 9 : SCTAB nTab = GetTab_Impl();
7480 9 : sal_uInt16 nCount = pDoc->GetPrintRangeCount( nTab );
7481 :
7482 9 : table::CellRangeAddress aRangeAddress;
7483 9 : uno::Sequence<table::CellRangeAddress> aSeq(nCount);
7484 9 : table::CellRangeAddress* pAry = aSeq.getArray();
7485 9 : for (sal_uInt16 i=0; i<nCount; i++)
7486 : {
7487 0 : const ScRange* pRange = pDoc->GetPrintRange( nTab, i );
7488 : OSL_ENSURE(pRange,"wo ist der Druckbereich");
7489 0 : if (pRange)
7490 : {
7491 0 : ScUnoConversion::FillApiRange( aRangeAddress, *pRange );
7492 0 : aRangeAddress.Sheet = nTab; // core does not care about sheet index
7493 0 : pAry[i] = aRangeAddress;
7494 : }
7495 : }
7496 9 : return aSeq;
7497 : }
7498 0 : return uno::Sequence<table::CellRangeAddress>();
7499 : }
7500 :
7501 0 : void SAL_CALL ScTableSheetObj::setPrintAreas(
7502 : const uno::Sequence<table::CellRangeAddress>& aPrintAreas )
7503 : throw(uno::RuntimeException)
7504 : {
7505 0 : SolarMutexGuard aGuard;
7506 0 : ScPrintRangeSaver* pOldRanges = NULL;
7507 0 : ScDocShell* pDocSh = GetDocShell();
7508 0 : if ( pDocSh )
7509 : {
7510 0 : ScDocument* pDoc = pDocSh->GetDocument();
7511 0 : SCTAB nTab = GetTab_Impl();
7512 :
7513 0 : if ( pDoc->IsUndoEnabled() )
7514 0 : pOldRanges = pDoc->CreatePrintRangeSaver();
7515 :
7516 0 : sal_uInt16 nCount = (sal_uInt16) aPrintAreas.getLength();
7517 0 : pDoc->ClearPrintRanges( nTab );
7518 0 : if (nCount)
7519 : {
7520 0 : ScRange aPrintRange;
7521 0 : const table::CellRangeAddress* pAry = aPrintAreas.getConstArray();
7522 0 : for (sal_uInt16 i=0; i<nCount; i++)
7523 : {
7524 0 : ScUnoConversion::FillScRange( aPrintRange, pAry[i] );
7525 0 : pDoc->AddPrintRange( nTab, aPrintRange );
7526 : }
7527 : }
7528 :
7529 0 : if ( pDoc->IsUndoEnabled() )
7530 0 : PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc.
7531 0 : }
7532 0 : }
7533 :
7534 10 : sal_Bool SAL_CALL ScTableSheetObj::getPrintTitleColumns() throw(uno::RuntimeException)
7535 : {
7536 10 : SolarMutexGuard aGuard;
7537 10 : ScDocShell* pDocSh = GetDocShell();
7538 10 : if ( pDocSh )
7539 : {
7540 10 : ScDocument* pDoc = pDocSh->GetDocument();
7541 10 : SCTAB nTab = GetTab_Impl();
7542 10 : return ( pDoc->GetRepeatColRange(nTab) != NULL );
7543 : }
7544 0 : return false;
7545 : }
7546 :
7547 1 : void SAL_CALL ScTableSheetObj::setPrintTitleColumns( sal_Bool bPrintTitleColumns )
7548 : throw(uno::RuntimeException)
7549 : {
7550 1 : SolarMutexGuard aGuard;
7551 1 : ScDocShell* pDocSh = GetDocShell();
7552 1 : if ( pDocSh )
7553 : {
7554 1 : ScDocument* pDoc = pDocSh->GetDocument();
7555 1 : SCTAB nTab = GetTab_Impl();
7556 :
7557 1 : ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver();
7558 :
7559 1 : if ( bPrintTitleColumns )
7560 : {
7561 1 : if ( !pDoc->GetRepeatColRange( nTab ) ) // keinen bestehenden Bereich veraendern
7562 : {
7563 1 : ScRange aNew( 0, 0, nTab, 0, 0, nTab ); // Default
7564 1 : pDoc->SetRepeatColRange( nTab, &aNew ); // einschalten
7565 : }
7566 : }
7567 : else
7568 0 : pDoc->SetRepeatColRange( nTab, NULL ); // abschalten
7569 :
7570 1 : PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc.
7571 :
7572 : //! zuletzt gesetzten Bereich beim Abschalten merken und beim Einschalten wiederherstellen ???
7573 1 : }
7574 1 : }
7575 :
7576 9 : table::CellRangeAddress SAL_CALL ScTableSheetObj::getTitleColumns() throw(uno::RuntimeException)
7577 : {
7578 9 : SolarMutexGuard aGuard;
7579 9 : table::CellRangeAddress aRet;
7580 9 : ScDocShell* pDocSh = GetDocShell();
7581 9 : if ( pDocSh )
7582 : {
7583 9 : ScDocument* pDoc = pDocSh->GetDocument();
7584 9 : SCTAB nTab = GetTab_Impl();
7585 9 : const ScRange* pRange = pDoc->GetRepeatColRange(nTab);
7586 9 : if (pRange)
7587 : {
7588 0 : ScUnoConversion::FillApiRange( aRet, *pRange );
7589 0 : aRet.Sheet = nTab; // core does not care about sheet index
7590 : }
7591 : }
7592 9 : return aRet;
7593 : }
7594 :
7595 0 : void SAL_CALL ScTableSheetObj::setTitleColumns( const table::CellRangeAddress& aTitleColumns )
7596 : throw(uno::RuntimeException)
7597 : {
7598 0 : SolarMutexGuard aGuard;
7599 0 : ScDocShell* pDocSh = GetDocShell();
7600 0 : if ( pDocSh )
7601 : {
7602 0 : ScDocument* pDoc = pDocSh->GetDocument();
7603 0 : SCTAB nTab = GetTab_Impl();
7604 :
7605 0 : ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver();
7606 :
7607 0 : ScRange aNew;
7608 0 : ScUnoConversion::FillScRange( aNew, aTitleColumns );
7609 0 : pDoc->SetRepeatColRange( nTab, &aNew ); // immer auch einschalten
7610 :
7611 0 : PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc.
7612 0 : }
7613 0 : }
7614 :
7615 12 : sal_Bool SAL_CALL ScTableSheetObj::getPrintTitleRows() throw(uno::RuntimeException)
7616 : {
7617 12 : SolarMutexGuard aGuard;
7618 12 : ScDocShell* pDocSh = GetDocShell();
7619 12 : if ( pDocSh )
7620 : {
7621 12 : ScDocument* pDoc = pDocSh->GetDocument();
7622 12 : SCTAB nTab = GetTab_Impl();
7623 12 : return ( pDoc->GetRepeatRowRange(nTab) != NULL );
7624 : }
7625 0 : return false;
7626 : }
7627 :
7628 3 : void SAL_CALL ScTableSheetObj::setPrintTitleRows( sal_Bool bPrintTitleRows )
7629 : throw(uno::RuntimeException)
7630 : {
7631 3 : SolarMutexGuard aGuard;
7632 3 : ScDocShell* pDocSh = GetDocShell();
7633 3 : if ( pDocSh )
7634 : {
7635 3 : ScDocument* pDoc = pDocSh->GetDocument();
7636 3 : SCTAB nTab = GetTab_Impl();
7637 :
7638 3 : ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver();
7639 :
7640 3 : if ( bPrintTitleRows )
7641 : {
7642 3 : if ( !pDoc->GetRepeatRowRange( nTab ) ) // keinen bestehenden Bereich veraendern
7643 : {
7644 3 : ScRange aNew( 0, 0, nTab, 0, 0, nTab ); // Default
7645 3 : pDoc->SetRepeatRowRange( nTab, &aNew ); // einschalten
7646 : }
7647 : }
7648 : else
7649 0 : pDoc->SetRepeatRowRange( nTab, NULL ); // abschalten
7650 :
7651 3 : PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc.
7652 :
7653 : //! zuletzt gesetzten Bereich beim Abschalten merken und beim Einschalten wiederherstellen ???
7654 3 : }
7655 3 : }
7656 :
7657 9 : table::CellRangeAddress SAL_CALL ScTableSheetObj::getTitleRows() throw(uno::RuntimeException)
7658 : {
7659 9 : SolarMutexGuard aGuard;
7660 9 : table::CellRangeAddress aRet;
7661 9 : ScDocShell* pDocSh = GetDocShell();
7662 9 : if ( pDocSh )
7663 : {
7664 9 : ScDocument* pDoc = pDocSh->GetDocument();
7665 9 : SCTAB nTab = GetTab_Impl();
7666 9 : const ScRange* pRange = pDoc->GetRepeatRowRange(nTab);
7667 9 : if (pRange)
7668 : {
7669 0 : ScUnoConversion::FillApiRange( aRet, *pRange );
7670 0 : aRet.Sheet = nTab; // core does not care about sheet index
7671 : }
7672 : }
7673 9 : return aRet;
7674 : }
7675 :
7676 2 : void SAL_CALL ScTableSheetObj::setTitleRows( const table::CellRangeAddress& aTitleRows )
7677 : throw(uno::RuntimeException)
7678 : {
7679 2 : SolarMutexGuard aGuard;
7680 2 : ScDocShell* pDocSh = GetDocShell();
7681 2 : if ( pDocSh )
7682 : {
7683 2 : ScDocument* pDoc = pDocSh->GetDocument();
7684 2 : SCTAB nTab = GetTab_Impl();
7685 :
7686 2 : ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver();
7687 :
7688 2 : ScRange aNew;
7689 2 : ScUnoConversion::FillScRange( aNew, aTitleRows );
7690 2 : pDoc->SetRepeatRowRange( nTab, &aNew ); // immer auch einschalten
7691 :
7692 2 : PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc.
7693 2 : }
7694 2 : }
7695 :
7696 : // XSheetLinkable
7697 :
7698 9 : sheet::SheetLinkMode SAL_CALL ScTableSheetObj::getLinkMode() throw(uno::RuntimeException)
7699 : {
7700 9 : SolarMutexGuard aGuard;
7701 9 : sheet::SheetLinkMode eRet = sheet::SheetLinkMode_NONE;
7702 9 : ScDocShell* pDocSh = GetDocShell();
7703 9 : if ( pDocSh )
7704 : {
7705 9 : sal_uInt8 nMode = pDocSh->GetDocument()->GetLinkMode( GetTab_Impl() );
7706 9 : if ( nMode == SC_LINK_NORMAL )
7707 0 : eRet = sheet::SheetLinkMode_NORMAL;
7708 9 : else if ( nMode == SC_LINK_VALUE )
7709 0 : eRet = sheet::SheetLinkMode_VALUE;
7710 : }
7711 9 : return eRet;
7712 : }
7713 :
7714 0 : void SAL_CALL ScTableSheetObj::setLinkMode( sheet::SheetLinkMode nLinkMode )
7715 : throw(uno::RuntimeException)
7716 : {
7717 0 : SolarMutexGuard aGuard;
7718 :
7719 : //! Filter und Options aus altem Link suchen
7720 :
7721 0 : OUString aUrl(getLinkUrl());
7722 0 : OUString aSheet(getLinkSheetName());
7723 :
7724 0 : OUString aEmpty;
7725 0 : link( aUrl, aSheet, aEmpty, aEmpty, nLinkMode );
7726 0 : }
7727 :
7728 0 : OUString SAL_CALL ScTableSheetObj::getLinkUrl() throw(uno::RuntimeException)
7729 : {
7730 0 : SolarMutexGuard aGuard;
7731 0 : String aFile;
7732 0 : ScDocShell* pDocSh = GetDocShell();
7733 0 : if ( pDocSh )
7734 0 : aFile = pDocSh->GetDocument()->GetLinkDoc( GetTab_Impl() );
7735 0 : return aFile;
7736 : }
7737 :
7738 0 : void SAL_CALL ScTableSheetObj::setLinkUrl( const OUString& aLinkUrl )
7739 : throw(uno::RuntimeException)
7740 : {
7741 0 : SolarMutexGuard aGuard;
7742 :
7743 : //! Filter und Options aus altem Link suchen
7744 :
7745 0 : sheet::SheetLinkMode eMode = getLinkMode();
7746 0 : OUString aSheet(getLinkSheetName());
7747 :
7748 0 : OUString aEmpty;
7749 0 : link( aLinkUrl, aSheet, aEmpty, aEmpty, eMode );
7750 0 : }
7751 :
7752 0 : OUString SAL_CALL ScTableSheetObj::getLinkSheetName() throw(uno::RuntimeException)
7753 : {
7754 0 : SolarMutexGuard aGuard;
7755 0 : String aSheet;
7756 0 : ScDocShell* pDocSh = GetDocShell();
7757 0 : if ( pDocSh )
7758 0 : aSheet = pDocSh->GetDocument()->GetLinkTab( GetTab_Impl() );
7759 0 : return aSheet;
7760 : }
7761 :
7762 0 : void SAL_CALL ScTableSheetObj::setLinkSheetName( const OUString& aLinkSheetName )
7763 : throw(uno::RuntimeException)
7764 : {
7765 0 : SolarMutexGuard aGuard;
7766 :
7767 : //! Filter und Options aus altem Link suchen
7768 :
7769 0 : sheet::SheetLinkMode eMode = getLinkMode();
7770 0 : OUString aUrl(getLinkUrl());
7771 :
7772 0 : OUString aEmpty;
7773 0 : link( aUrl, aLinkSheetName, aEmpty, aEmpty, eMode );
7774 0 : }
7775 :
7776 2 : void SAL_CALL ScTableSheetObj::link( const OUString& aUrl, const OUString& aSheetName,
7777 : const OUString& aFilterName, const OUString& aFilterOptions,
7778 : sheet::SheetLinkMode nMode ) throw(uno::RuntimeException)
7779 : {
7780 2 : SolarMutexGuard aGuard;
7781 2 : ScDocShell* pDocSh = GetDocShell();
7782 2 : if ( pDocSh )
7783 : {
7784 2 : ScDocument* pDoc = pDocSh->GetDocument();
7785 2 : SCTAB nTab = GetTab_Impl();
7786 :
7787 2 : OUString aFileString = aUrl;
7788 4 : OUString aFilterString = aFilterName;
7789 4 : OUString aOptString = aFilterOptions;
7790 4 : OUString aSheetString = aSheetName;
7791 :
7792 2 : aFileString = ScGlobal::GetAbsDocName( aFileString, pDocSh );
7793 2 : if (aFilterString.isEmpty())
7794 2 : ScDocumentLoader::GetFilterName( aFileString, aFilterString, aOptString, true, false );
7795 :
7796 : // remove application prefix from filter name here, so the filter options
7797 : // aren't reset when the filter name is changed in ScTableLink::DataChanged
7798 2 : ScDocumentLoader::RemoveAppPrefix( aFilterString );
7799 :
7800 2 : sal_uInt8 nLinkMode = SC_LINK_NONE;
7801 2 : if ( nMode == sheet::SheetLinkMode_NORMAL )
7802 0 : nLinkMode = SC_LINK_NORMAL;
7803 2 : else if ( nMode == sheet::SheetLinkMode_VALUE )
7804 2 : nLinkMode = SC_LINK_VALUE;
7805 :
7806 2 : sal_uLong nRefresh = 0;
7807 2 : pDoc->SetLink( nTab, nLinkMode, aFileString, aFilterString, aOptString, aSheetString, nRefresh );
7808 :
7809 2 : pDocSh->UpdateLinks(); // ggf. Link eintragen oder loeschen
7810 2 : SfxBindings* pBindings = pDocSh->GetViewBindings();
7811 2 : if (pBindings)
7812 2 : pBindings->Invalidate(SID_LINKS);
7813 :
7814 : //! Undo fuer Link-Daten an der Table
7815 :
7816 2 : if ( nLinkMode != SC_LINK_NONE && pDoc->IsExecuteLinkEnabled() ) // Link updaten
7817 : {
7818 : // Update immer, auch wenn der Link schon da war
7819 : //! Update nur fuer die betroffene Tabelle???
7820 :
7821 2 : sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
7822 2 : sal_uInt16 nCount = pLinkManager->GetLinks().size();
7823 4 : for ( sal_uInt16 i=0; i<nCount; i++ )
7824 : {
7825 2 : ::sfx2::SvBaseLink* pBase = *pLinkManager->GetLinks()[i];
7826 2 : if (pBase->ISA(ScTableLink))
7827 : {
7828 2 : ScTableLink* pTabLink = (ScTableLink*)pBase;
7829 2 : if ( aFileString.equals(pTabLink->GetFileName()) )
7830 2 : pTabLink->Update(); // inkl. Paint&Undo
7831 :
7832 : //! Der Dateiname sollte nur einmal vorkommen (?)
7833 : }
7834 : }
7835 2 : }
7836 :
7837 : //! Notify fuer ScSheetLinkObj Objekte!!!
7838 2 : }
7839 2 : }
7840 :
7841 : // XSheetAuditing
7842 :
7843 0 : sal_Bool SAL_CALL ScTableSheetObj::hideDependents( const table::CellAddress& aPosition )
7844 : throw(uno::RuntimeException)
7845 : {
7846 0 : SolarMutexGuard aGuard;
7847 0 : ScDocShell* pDocSh = GetDocShell();
7848 0 : if ( pDocSh )
7849 : {
7850 0 : SCTAB nTab = GetTab_Impl();
7851 : OSL_ENSURE( aPosition.Sheet == nTab, "falsche Tabelle in CellAddress" );
7852 0 : ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
7853 0 : return pDocSh->GetDocFunc().DetectiveDelSucc( aPos );
7854 : }
7855 0 : return false;
7856 : }
7857 :
7858 0 : sal_Bool SAL_CALL ScTableSheetObj::hidePrecedents( const table::CellAddress& aPosition )
7859 : throw(uno::RuntimeException)
7860 : {
7861 0 : SolarMutexGuard aGuard;
7862 0 : ScDocShell* pDocSh = GetDocShell();
7863 0 : if ( pDocSh )
7864 : {
7865 0 : SCTAB nTab = GetTab_Impl();
7866 : OSL_ENSURE( aPosition.Sheet == nTab, "falsche Tabelle in CellAddress" );
7867 0 : ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
7868 0 : return pDocSh->GetDocFunc().DetectiveDelPred( aPos );
7869 : }
7870 0 : return false;
7871 : }
7872 :
7873 0 : sal_Bool SAL_CALL ScTableSheetObj::showDependents( const table::CellAddress& aPosition )
7874 : throw(uno::RuntimeException)
7875 : {
7876 0 : SolarMutexGuard aGuard;
7877 0 : ScDocShell* pDocSh = GetDocShell();
7878 0 : if ( pDocSh )
7879 : {
7880 0 : SCTAB nTab = GetTab_Impl();
7881 : OSL_ENSURE( aPosition.Sheet == nTab, "falsche Tabelle in CellAddress" );
7882 0 : ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
7883 0 : return pDocSh->GetDocFunc().DetectiveAddSucc( aPos );
7884 : }
7885 0 : return false;
7886 : }
7887 :
7888 1 : sal_Bool SAL_CALL ScTableSheetObj::showPrecedents( const table::CellAddress& aPosition )
7889 : throw(uno::RuntimeException)
7890 : {
7891 1 : SolarMutexGuard aGuard;
7892 1 : ScDocShell* pDocSh = GetDocShell();
7893 1 : if ( pDocSh )
7894 : {
7895 1 : SCTAB nTab = GetTab_Impl();
7896 : OSL_ENSURE( aPosition.Sheet == nTab, "falsche Tabelle in CellAddress" );
7897 1 : ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
7898 1 : return pDocSh->GetDocFunc().DetectiveAddPred( aPos );
7899 : }
7900 0 : return false;
7901 : }
7902 :
7903 0 : sal_Bool SAL_CALL ScTableSheetObj::showErrors( const table::CellAddress& aPosition )
7904 : throw(uno::RuntimeException)
7905 : {
7906 0 : SolarMutexGuard aGuard;
7907 0 : ScDocShell* pDocSh = GetDocShell();
7908 0 : if ( pDocSh )
7909 : {
7910 0 : SCTAB nTab = GetTab_Impl();
7911 : OSL_ENSURE( aPosition.Sheet == nTab, "falsche Tabelle in CellAddress" );
7912 0 : ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
7913 0 : return pDocSh->GetDocFunc().DetectiveAddError( aPos );
7914 : }
7915 0 : return false;
7916 : }
7917 :
7918 0 : sal_Bool SAL_CALL ScTableSheetObj::showInvalid() throw(uno::RuntimeException)
7919 : {
7920 0 : SolarMutexGuard aGuard;
7921 0 : ScDocShell* pDocSh = GetDocShell();
7922 0 : if ( pDocSh )
7923 0 : return pDocSh->GetDocFunc().DetectiveMarkInvalid( GetTab_Impl() );
7924 0 : return false;
7925 : }
7926 :
7927 0 : void SAL_CALL ScTableSheetObj::clearArrows() throw(uno::RuntimeException)
7928 : {
7929 0 : SolarMutexGuard aGuard;
7930 0 : ScDocShell* pDocSh = GetDocShell();
7931 0 : if ( pDocSh )
7932 0 : pDocSh->GetDocFunc().DetectiveDelAll( GetTab_Impl() );
7933 0 : }
7934 :
7935 : // XSheetOutline
7936 :
7937 8 : void SAL_CALL ScTableSheetObj::group( const table::CellRangeAddress& rGroupRange,
7938 : table::TableOrientation nOrientation )
7939 : throw(uno::RuntimeException)
7940 : {
7941 8 : SolarMutexGuard aGuard;
7942 8 : ScDocShell* pDocSh = GetDocShell();
7943 8 : if ( pDocSh )
7944 : {
7945 8 : sal_Bool bColumns = ( nOrientation == table::TableOrientation_COLUMNS );
7946 8 : ScRange aGroupRange;
7947 8 : ScUnoConversion::FillScRange( aGroupRange, rGroupRange );
7948 8 : ScOutlineDocFunc aFunc(*pDocSh);
7949 8 : aFunc.MakeOutline( aGroupRange, bColumns, sal_True, sal_True );
7950 8 : }
7951 8 : }
7952 :
7953 4 : void SAL_CALL ScTableSheetObj::ungroup( const table::CellRangeAddress& rGroupRange,
7954 : table::TableOrientation nOrientation )
7955 : throw(uno::RuntimeException)
7956 : {
7957 4 : SolarMutexGuard aGuard;
7958 4 : ScDocShell* pDocSh = GetDocShell();
7959 4 : if ( pDocSh )
7960 : {
7961 4 : sal_Bool bColumns = ( nOrientation == table::TableOrientation_COLUMNS );
7962 4 : ScRange aGroupRange;
7963 4 : ScUnoConversion::FillScRange( aGroupRange, rGroupRange );
7964 4 : ScOutlineDocFunc aFunc(*pDocSh);
7965 4 : aFunc.RemoveOutline( aGroupRange, bColumns, sal_True, sal_True );
7966 4 : }
7967 4 : }
7968 :
7969 1 : void SAL_CALL ScTableSheetObj::autoOutline( const table::CellRangeAddress& rCellRange )
7970 : throw(uno::RuntimeException)
7971 : {
7972 1 : SolarMutexGuard aGuard;
7973 1 : ScDocShell* pDocSh = GetDocShell();
7974 1 : if ( pDocSh )
7975 : {
7976 1 : ScRange aFormulaRange;
7977 1 : ScUnoConversion::FillScRange( aFormulaRange, rCellRange );
7978 1 : ScOutlineDocFunc aFunc(*pDocSh);
7979 1 : aFunc.AutoOutline( aFormulaRange, sal_True, sal_True );
7980 1 : }
7981 1 : }
7982 :
7983 7 : void SAL_CALL ScTableSheetObj::clearOutline() throw(uno::RuntimeException)
7984 : {
7985 7 : SolarMutexGuard aGuard;
7986 7 : ScDocShell* pDocSh = GetDocShell();
7987 7 : if ( pDocSh )
7988 : {
7989 7 : SCTAB nTab = GetTab_Impl();
7990 7 : ScOutlineDocFunc aFunc(*pDocSh);
7991 7 : aFunc.RemoveAllOutlines( nTab, sal_True, sal_True );
7992 7 : }
7993 7 : }
7994 :
7995 13 : void SAL_CALL ScTableSheetObj::hideDetail( const table::CellRangeAddress& rCellRange )
7996 : throw(uno::RuntimeException)
7997 : {
7998 13 : SolarMutexGuard aGuard;
7999 13 : ScDocShell* pDocSh = GetDocShell();
8000 13 : if ( pDocSh )
8001 : {
8002 13 : ScRange aMarkRange;
8003 13 : ScUnoConversion::FillScRange( aMarkRange, rCellRange );
8004 13 : ScOutlineDocFunc aFunc(*pDocSh);
8005 13 : aFunc.HideMarkedOutlines( aMarkRange, sal_True, sal_True );
8006 13 : }
8007 13 : }
8008 :
8009 10 : void SAL_CALL ScTableSheetObj::showDetail( const table::CellRangeAddress& rCellRange )
8010 : throw(uno::RuntimeException)
8011 : {
8012 10 : SolarMutexGuard aGuard;
8013 10 : ScDocShell* pDocSh = GetDocShell();
8014 10 : if ( pDocSh )
8015 : {
8016 10 : ScRange aMarkRange;
8017 10 : ScUnoConversion::FillScRange( aMarkRange, rCellRange );
8018 10 : ScOutlineDocFunc aFunc(*pDocSh);
8019 10 : aFunc.ShowMarkedOutlines( aMarkRange, sal_True );
8020 10 : }
8021 10 : }
8022 :
8023 1 : void SAL_CALL ScTableSheetObj::showLevel( sal_Int16 nLevel, table::TableOrientation nOrientation )
8024 : throw(uno::RuntimeException)
8025 : {
8026 1 : SolarMutexGuard aGuard;
8027 1 : ScDocShell* pDocSh = GetDocShell();
8028 1 : if ( pDocSh )
8029 : {
8030 1 : sal_Bool bColumns = ( nOrientation == table::TableOrientation_COLUMNS );
8031 1 : SCTAB nTab = GetTab_Impl();
8032 1 : ScOutlineDocFunc aFunc(*pDocSh);
8033 1 : aFunc.SelectLevel( nTab, bColumns, nLevel, sal_True, sal_True, sal_True );
8034 1 : }
8035 1 : }
8036 :
8037 : // XProtectable
8038 :
8039 0 : void SAL_CALL ScTableSheetObj::protect( const OUString& aPassword )
8040 : throw(uno::RuntimeException)
8041 : {
8042 0 : SolarMutexGuard aGuard;
8043 0 : ScDocShell* pDocSh = GetDocShell();
8044 : // #i108245# if already protected, don't change anything
8045 0 : if ( pDocSh && !pDocSh->GetDocument()->IsTabProtected( GetTab_Impl() ) )
8046 : {
8047 0 : String aString(aPassword);
8048 0 : pDocSh->GetDocFunc().Protect( GetTab_Impl(), aString, sal_True );
8049 0 : }
8050 0 : }
8051 :
8052 0 : void SAL_CALL ScTableSheetObj::unprotect( const OUString& aPassword )
8053 : throw(lang::IllegalArgumentException, uno::RuntimeException)
8054 : {
8055 0 : SolarMutexGuard aGuard;
8056 0 : ScDocShell* pDocSh = GetDocShell();
8057 0 : if ( pDocSh )
8058 : {
8059 0 : String aString(aPassword);
8060 0 : sal_Bool bDone = pDocSh->GetDocFunc().Unprotect( GetTab_Impl(), aString, sal_True );
8061 0 : if (!bDone)
8062 0 : throw lang::IllegalArgumentException();
8063 0 : }
8064 0 : }
8065 :
8066 9 : sal_Bool SAL_CALL ScTableSheetObj::isProtected() throw(uno::RuntimeException)
8067 : {
8068 9 : SolarMutexGuard aGuard;
8069 9 : ScDocShell* pDocSh = GetDocShell();
8070 9 : if ( pDocSh )
8071 9 : return pDocSh->GetDocument()->IsTabProtected( GetTab_Impl() );
8072 :
8073 : OSL_FAIL("keine DocShell"); //! Exception oder so?
8074 0 : return false;
8075 : }
8076 :
8077 : // XScenario
8078 :
8079 0 : sal_Bool SAL_CALL ScTableSheetObj::getIsScenario() throw(uno::RuntimeException)
8080 : {
8081 0 : SolarMutexGuard aGuard;
8082 0 : ScDocShell* pDocSh = GetDocShell();
8083 0 : if ( pDocSh )
8084 0 : return pDocSh->GetDocument()->IsScenario( GetTab_Impl() );
8085 :
8086 0 : return false;
8087 : }
8088 :
8089 0 : OUString SAL_CALL ScTableSheetObj::getScenarioComment() throw(uno::RuntimeException)
8090 : {
8091 0 : SolarMutexGuard aGuard;
8092 0 : ScDocShell* pDocSh = GetDocShell();
8093 0 : if ( pDocSh )
8094 : {
8095 0 : OUString aComment;
8096 0 : Color aColor;
8097 : sal_uInt16 nFlags;
8098 0 : pDocSh->GetDocument()->GetScenarioData( GetTab_Impl(), aComment, aColor, nFlags );
8099 0 : return aComment;
8100 : }
8101 0 : return OUString();
8102 : }
8103 :
8104 0 : void SAL_CALL ScTableSheetObj::setScenarioComment( const OUString& aScenarioComment )
8105 : throw(uno::RuntimeException)
8106 : {
8107 0 : SolarMutexGuard aGuard;
8108 0 : ScDocShell* pDocSh = GetDocShell();
8109 0 : if ( pDocSh )
8110 : {
8111 0 : ScDocument* pDoc = pDocSh->GetDocument();
8112 0 : SCTAB nTab = GetTab_Impl();
8113 :
8114 0 : OUString aName;
8115 0 : OUString aComment;
8116 0 : Color aColor;
8117 : sal_uInt16 nFlags;
8118 0 : pDoc->GetName( nTab, aName );
8119 0 : pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8120 :
8121 0 : aComment = String( aScenarioComment );
8122 :
8123 0 : pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
8124 0 : }
8125 0 : }
8126 :
8127 0 : void SAL_CALL ScTableSheetObj::addRanges( const uno::Sequence<table::CellRangeAddress>& rScenRanges )
8128 : throw(uno::RuntimeException)
8129 : {
8130 0 : SolarMutexGuard aGuard;
8131 0 : ScDocShell* pDocSh = GetDocShell();
8132 0 : if ( pDocSh )
8133 : {
8134 0 : ScDocument* pDoc = pDocSh->GetDocument();
8135 0 : SCTAB nTab = GetTab_Impl();
8136 :
8137 0 : if (pDoc->IsScenario(nTab))
8138 : {
8139 0 : ScMarkData aMarkData;
8140 0 : aMarkData.SelectTable( nTab, sal_True );
8141 :
8142 0 : sal_uInt16 nRangeCount = (sal_uInt16)rScenRanges.getLength();
8143 0 : if (nRangeCount)
8144 : {
8145 0 : const table::CellRangeAddress* pAry = rScenRanges.getConstArray();
8146 0 : for (sal_uInt16 i=0; i<nRangeCount; i++)
8147 : {
8148 : OSL_ENSURE( pAry[i].Sheet == nTab, "addRanges mit falscher Tab" );
8149 0 : ScRange aOneRange( (SCCOL)pAry[i].StartColumn, (SCROW)pAry[i].StartRow, nTab,
8150 0 : (SCCOL)pAry[i].EndColumn, (SCROW)pAry[i].EndRow, nTab );
8151 :
8152 0 : aMarkData.SetMultiMarkArea( aOneRange );
8153 : }
8154 : }
8155 :
8156 : // Szenario-Ranges sind durch Attribut gekennzeichnet
8157 0 : ScPatternAttr aPattern( pDoc->GetPool() );
8158 0 : aPattern.GetItemSet().Put( ScMergeFlagAttr( SC_MF_SCENARIO ) );
8159 0 : aPattern.GetItemSet().Put( ScProtectionAttr( sal_True ) );
8160 0 : pDocSh->GetDocFunc().ApplyAttributes( aMarkData, aPattern, sal_True, sal_True );
8161 : }
8162 0 : }
8163 0 : }
8164 :
8165 0 : void SAL_CALL ScTableSheetObj::apply() throw(uno::RuntimeException)
8166 : {
8167 0 : SolarMutexGuard aGuard;
8168 0 : ScDocShell* pDocSh = GetDocShell();
8169 0 : if ( pDocSh )
8170 : {
8171 0 : ScDocument* pDoc = pDocSh->GetDocument();
8172 0 : SCTAB nTab = GetTab_Impl();
8173 0 : OUString aName;
8174 0 : pDoc->GetName( nTab, aName ); // Name dieses Szenarios
8175 :
8176 0 : SCTAB nDestTab = nTab;
8177 0 : while ( nDestTab > 0 && pDoc->IsScenario(nDestTab) )
8178 0 : --nDestTab;
8179 :
8180 0 : if ( !pDoc->IsScenario(nDestTab) )
8181 0 : pDocSh->UseScenario( nDestTab, aName );
8182 :
8183 : //! sonst Fehler oder so
8184 0 : }
8185 0 : }
8186 :
8187 : // XScenarioEnhanced
8188 :
8189 0 : uno::Sequence< table::CellRangeAddress > SAL_CALL ScTableSheetObj::getRanges( )
8190 : throw(uno::RuntimeException)
8191 : {
8192 0 : SolarMutexGuard aGuard;
8193 0 : ScDocShell* pDocSh = GetDocShell();
8194 0 : if ( pDocSh )
8195 : {
8196 0 : ScDocument* pDoc = pDocSh->GetDocument();
8197 0 : SCTAB nTab = GetTab_Impl();
8198 0 : const ScRangeList* pRangeList = pDoc->GetScenarioRanges(nTab);
8199 0 : if (pRangeList)
8200 : {
8201 0 : size_t nCount = pRangeList->size();
8202 0 : uno::Sequence< table::CellRangeAddress > aRetRanges( nCount );
8203 0 : table::CellRangeAddress* pAry = aRetRanges.getArray();
8204 0 : for( size_t nIndex = 0; nIndex < nCount; nIndex++ )
8205 : {
8206 0 : const ScRange* pRange = (*pRangeList)[nIndex];
8207 0 : pAry->StartColumn = pRange->aStart.Col();
8208 0 : pAry->StartRow = pRange->aStart.Row();
8209 0 : pAry->EndColumn = pRange->aEnd.Col();
8210 0 : pAry->EndRow = pRange->aEnd.Row();
8211 0 : pAry->Sheet = pRange->aStart.Tab();
8212 0 : ++pAry;
8213 : }
8214 0 : return aRetRanges;
8215 : }
8216 : }
8217 0 : return uno::Sequence< table::CellRangeAddress > ();
8218 : }
8219 :
8220 : // XExternalSheetName
8221 :
8222 0 : void ScTableSheetObj::setExternalName( const OUString& aUrl, const OUString& aSheetName )
8223 : throw (container::ElementExistException, uno::RuntimeException)
8224 : {
8225 0 : SolarMutexGuard aGuard;
8226 0 : ScDocShell* pDocSh = GetDocShell();
8227 0 : if ( pDocSh )
8228 : {
8229 0 : ScDocument* pDoc = pDocSh->GetDocument();
8230 0 : if ( pDoc )
8231 : {
8232 0 : const SCTAB nTab = GetTab_Impl();
8233 0 : const String aAbsDocName( ScGlobal::GetAbsDocName( aUrl, pDocSh ) );
8234 0 : const String aDocTabName( ScGlobal::GetDocTabName( aAbsDocName, aSheetName ) );
8235 0 : if ( !pDoc->RenameTab( nTab, aDocTabName, false /*bUpdateRef*/, sal_True /*bExternalDocument*/ ) )
8236 : {
8237 0 : throw container::ElementExistException( OUString(), *this );
8238 0 : }
8239 : }
8240 0 : }
8241 0 : }
8242 :
8243 : // XEventsSupplier
8244 :
8245 0 : uno::Reference<container::XNameReplace> SAL_CALL ScTableSheetObj::getEvents() throw (uno::RuntimeException)
8246 : {
8247 0 : SolarMutexGuard aGuard;
8248 0 : ScDocShell* pDocSh = GetDocShell();
8249 0 : if ( pDocSh )
8250 0 : return new ScSheetEventsObj( pDocSh, GetTab_Impl() );
8251 :
8252 0 : return NULL;
8253 : }
8254 :
8255 : // XPropertySet erweitert fuer Sheet-Properties
8256 :
8257 169 : uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTableSheetObj::getPropertySetInfo()
8258 : throw(uno::RuntimeException)
8259 : {
8260 169 : SolarMutexGuard aGuard;
8261 : static uno::Reference<beans::XPropertySetInfo> aRef(
8262 169 : new SfxItemPropertySetInfo( pSheetPropSet->getPropertyMap() ));
8263 169 : return aRef;
8264 : }
8265 :
8266 692 : void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
8267 : throw(lang::IllegalArgumentException, uno::RuntimeException)
8268 : {
8269 692 : if ( pEntry )
8270 : {
8271 692 : if ( IsScItemWid( pEntry->nWID ) )
8272 : {
8273 : // for Item WIDs, call ScCellRangesBase directly
8274 0 : ScCellRangesBase::SetOnePropertyValue(pEntry, aValue);
8275 0 : return;
8276 : }
8277 :
8278 : // own properties
8279 :
8280 692 : ScDocShell* pDocSh = GetDocShell();
8281 692 : if (!pDocSh)
8282 0 : return; //! Exception oder so?
8283 692 : ScDocument* pDoc = pDocSh->GetDocument();
8284 692 : SCTAB nTab = GetTab_Impl();
8285 692 : ScDocFunc &rFunc = pDocSh->GetDocFunc();
8286 :
8287 692 : if ( pEntry->nWID == SC_WID_UNO_PAGESTL )
8288 : {
8289 170 : OUString aStrVal;
8290 170 : aValue >>= aStrVal;
8291 : OUString aNewStr(ScStyleNameConversion::ProgrammaticToDisplayName(
8292 340 : aStrVal, SFX_STYLE_FAMILY_PAGE ));
8293 :
8294 : //! Undo? (auch bei SID_STYLE_APPLY an der View)
8295 :
8296 170 : if ( pDoc->GetPageStyle( nTab ) != aNewStr )
8297 : {
8298 8 : pDoc->SetPageStyle( nTab, aNewStr );
8299 8 : if (!pDoc->IsImportingXML())
8300 : {
8301 2 : ScPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab ).UpdatePages();
8302 :
8303 2 : SfxBindings* pBindings = pDocSh->GetViewBindings();
8304 2 : if (pBindings)
8305 : {
8306 2 : pBindings->Invalidate( SID_STYLE_FAMILY4 );
8307 2 : pBindings->Invalidate( SID_STATUS_PAGESTYLE );
8308 2 : pBindings->Invalidate( FID_RESET_PRINTZOOM );
8309 2 : pBindings->Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT );
8310 2 : pBindings->Invalidate( SID_ATTR_PARA_RIGHT_TO_LEFT );
8311 : }
8312 : }
8313 8 : pDocSh->SetDocumentModified();
8314 170 : }
8315 : }
8316 522 : else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
8317 : {
8318 234 : sal_Bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
8319 234 : rFunc.SetTableVisible( nTab, bVis, sal_True );
8320 : }
8321 288 : else if ( pEntry->nWID == SC_WID_UNO_ISACTIVE )
8322 : {
8323 0 : if (pDoc->IsScenario(nTab))
8324 0 : pDoc->SetActiveScenario( nTab, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
8325 : }
8326 288 : else if ( pEntry->nWID == SC_WID_UNO_BORDCOL )
8327 : {
8328 0 : if (pDoc->IsScenario(nTab))
8329 : {
8330 0 : sal_Int32 nNewColor = 0;
8331 0 : if (aValue >>= nNewColor)
8332 : {
8333 0 : OUString aName;
8334 0 : OUString aComment;
8335 0 : Color aColor;
8336 : sal_uInt16 nFlags;
8337 0 : pDoc->GetName( nTab, aName );
8338 0 : pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8339 :
8340 0 : aColor = Color(static_cast<sal_uInt32>(nNewColor));
8341 :
8342 0 : pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
8343 : }
8344 : }
8345 : }
8346 288 : else if ( pEntry->nWID == SC_WID_UNO_PROTECT )
8347 : {
8348 0 : if (pDoc->IsScenario(nTab))
8349 : {
8350 0 : OUString aName;
8351 0 : OUString aComment;
8352 0 : Color aColor;
8353 : sal_uInt16 nFlags;
8354 0 : pDoc->GetName( nTab, aName );
8355 0 : pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8356 0 : sal_Bool bModify(false);
8357 :
8358 0 : if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
8359 : {
8360 0 : if (!(nFlags & SC_SCENARIO_PROTECT))
8361 : {
8362 0 : nFlags |= SC_SCENARIO_PROTECT;
8363 0 : bModify = sal_True;
8364 : }
8365 : }
8366 : else
8367 : {
8368 0 : if (nFlags & SC_SCENARIO_PROTECT)
8369 : {
8370 0 : nFlags -= SC_SCENARIO_PROTECT;
8371 0 : bModify = sal_True;
8372 : }
8373 : }
8374 :
8375 0 : if (bModify)
8376 0 : pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
8377 : }
8378 : }
8379 288 : else if ( pEntry->nWID == SC_WID_UNO_SHOWBORD )
8380 : {
8381 0 : if (pDoc->IsScenario(nTab))
8382 : {
8383 0 : OUString aName;
8384 0 : OUString aComment;
8385 0 : Color aColor;
8386 : sal_uInt16 nFlags;
8387 0 : pDoc->GetName( nTab, aName );
8388 0 : pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8389 0 : sal_Bool bModify(false);
8390 :
8391 0 : if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
8392 : {
8393 0 : if (!(nFlags & SC_SCENARIO_SHOWFRAME))
8394 : {
8395 0 : nFlags |= SC_SCENARIO_SHOWFRAME;
8396 0 : bModify = sal_True;
8397 : }
8398 : }
8399 : else
8400 : {
8401 0 : if (nFlags & SC_SCENARIO_SHOWFRAME)
8402 : {
8403 0 : nFlags -= SC_SCENARIO_SHOWFRAME;
8404 0 : bModify = sal_True;
8405 : }
8406 : }
8407 :
8408 0 : if (bModify)
8409 0 : pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
8410 : }
8411 : }
8412 288 : else if ( pEntry->nWID == SC_WID_UNO_PRINTBORD )
8413 : {
8414 0 : if (pDoc->IsScenario(nTab))
8415 : {
8416 0 : OUString aName;
8417 0 : OUString aComment;
8418 0 : Color aColor;
8419 : sal_uInt16 nFlags;
8420 0 : pDoc->GetName( nTab, aName );
8421 0 : pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8422 0 : sal_Bool bModify(false);
8423 :
8424 0 : if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
8425 : {
8426 0 : if (!(nFlags & SC_SCENARIO_PRINTFRAME))
8427 : {
8428 0 : nFlags |= SC_SCENARIO_PRINTFRAME;
8429 0 : bModify = sal_True;
8430 : }
8431 : }
8432 : else
8433 : {
8434 0 : if (nFlags & SC_SCENARIO_PRINTFRAME)
8435 : {
8436 0 : nFlags -= SC_SCENARIO_PRINTFRAME;
8437 0 : bModify = sal_True;
8438 : }
8439 : }
8440 :
8441 0 : if (bModify)
8442 0 : pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
8443 : }
8444 : }
8445 288 : else if ( pEntry->nWID == SC_WID_UNO_COPYBACK )
8446 : {
8447 0 : if (pDoc->IsScenario(nTab))
8448 : {
8449 0 : OUString aName;
8450 0 : OUString aComment;
8451 0 : Color aColor;
8452 : sal_uInt16 nFlags;
8453 0 : pDoc->GetName( nTab, aName );
8454 0 : pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8455 0 : sal_Bool bModify(false);
8456 :
8457 0 : if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
8458 : {
8459 0 : if (!(nFlags & SC_SCENARIO_TWOWAY))
8460 : {
8461 0 : nFlags |= SC_SCENARIO_TWOWAY;
8462 0 : bModify = sal_True;
8463 : }
8464 : }
8465 : else
8466 : {
8467 0 : if (nFlags & SC_SCENARIO_TWOWAY)
8468 : {
8469 0 : nFlags -= SC_SCENARIO_TWOWAY;
8470 0 : bModify = sal_True;
8471 : }
8472 : }
8473 :
8474 0 : if (bModify)
8475 0 : pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
8476 : }
8477 : }
8478 288 : else if ( pEntry->nWID == SC_WID_UNO_COPYSTYL )
8479 : {
8480 0 : if (pDoc->IsScenario(nTab))
8481 : {
8482 0 : OUString aName;
8483 0 : OUString aComment;
8484 0 : Color aColor;
8485 : sal_uInt16 nFlags;
8486 0 : pDoc->GetName( nTab, aName );
8487 0 : pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8488 0 : sal_Bool bModify(false);
8489 :
8490 0 : if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
8491 : {
8492 0 : if (!(nFlags & SC_SCENARIO_ATTRIB))
8493 : {
8494 0 : nFlags |= SC_SCENARIO_ATTRIB;
8495 0 : bModify = sal_True;
8496 : }
8497 : }
8498 : else
8499 : {
8500 0 : if (nFlags & SC_SCENARIO_ATTRIB)
8501 : {
8502 0 : nFlags -= SC_SCENARIO_ATTRIB;
8503 0 : bModify = sal_True;
8504 : }
8505 : }
8506 :
8507 0 : if (bModify)
8508 0 : pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
8509 : }
8510 : }
8511 288 : else if ( pEntry->nWID == SC_WID_UNO_COPYFORM )
8512 : {
8513 0 : if (pDoc->IsScenario(nTab))
8514 : {
8515 0 : OUString aName;
8516 0 : OUString aComment;
8517 0 : Color aColor;
8518 : sal_uInt16 nFlags;
8519 0 : pDoc->GetName( nTab, aName );
8520 0 : pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8521 0 : sal_Bool bModify(false);
8522 :
8523 0 : if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
8524 : {
8525 0 : if (nFlags & SC_SCENARIO_VALUE)
8526 : {
8527 0 : nFlags -= SC_SCENARIO_VALUE;
8528 0 : bModify = sal_True;
8529 : }
8530 : }
8531 : else
8532 : {
8533 0 : if (!(nFlags & SC_SCENARIO_VALUE))
8534 : {
8535 0 : nFlags |= SC_SCENARIO_VALUE;
8536 0 : bModify = sal_True;
8537 : }
8538 : }
8539 :
8540 0 : if (bModify)
8541 0 : pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
8542 : }
8543 : }
8544 288 : else if ( pEntry->nWID == SC_WID_UNO_TABLAYOUT )
8545 : {
8546 157 : sal_Int16 nValue = 0;
8547 157 : if (aValue >>= nValue)
8548 : {
8549 157 : if (nValue == com::sun::star::text::WritingMode2::RL_TB)
8550 2 : rFunc.SetLayoutRTL(nTab, sal_True, sal_True);
8551 : else
8552 155 : rFunc.SetLayoutRTL(nTab, false, sal_True);
8553 : }
8554 : }
8555 131 : else if ( pEntry->nWID == SC_WID_UNO_AUTOPRINT )
8556 : {
8557 0 : sal_Bool bAutoPrint = ScUnoHelpFunctions::GetBoolFromAny( aValue );
8558 0 : if (bAutoPrint)
8559 0 : pDoc->SetPrintEntireSheet( nTab ); // clears all print ranges
8560 : else
8561 : {
8562 0 : if (pDoc->IsPrintEntireSheet( nTab ))
8563 0 : pDoc->ClearPrintRanges( nTab ); // if this flag is true, there are no PrintRanges, so Clear clears only the flag.
8564 : }
8565 : }
8566 131 : else if ( pEntry->nWID == SC_WID_UNO_TABCOLOR )
8567 : {
8568 43 : sal_Int32 nColor = COL_AUTO;
8569 43 : if ( aValue >>= nColor )
8570 : {
8571 43 : const Color aColor( static_cast< ColorData >( nColor ) );
8572 43 : if ( pDoc->GetTabBgColor( nTab ) != aColor )
8573 0 : rFunc.SetTabBgColor( nTab, aColor, true, true );
8574 : }
8575 : }
8576 88 : else if ( pEntry->nWID == SC_WID_UNO_CODENAME )
8577 : {
8578 43 : OUString aCodeName;
8579 43 : if ( pDocSh && ( aValue >>= aCodeName ) )
8580 : {
8581 43 : pDocSh->GetDocument()->SetCodeName( GetTab_Impl(), aCodeName );
8582 43 : }
8583 : }
8584 : else
8585 45 : ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID
8586 : }
8587 : }
8588 :
8589 1790 : void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
8590 : uno::Any& rAny )
8591 : throw(uno::RuntimeException)
8592 : {
8593 1790 : if ( pEntry )
8594 : {
8595 1790 : ScDocShell* pDocSh = GetDocShell();
8596 1790 : if (!pDocSh)
8597 0 : throw uno::RuntimeException();
8598 1790 : ScDocument* pDoc = pDocSh->GetDocument();
8599 1790 : SCTAB nTab = GetTab_Impl();
8600 :
8601 1790 : if ( pEntry->nWID == SC_WID_UNO_NAMES )
8602 : {
8603 0 : rAny <<= uno::Reference<sheet::XNamedRanges>(new ScLocalNamedRangesObj(pDocSh, this));
8604 : }
8605 1790 : else if ( pEntry->nWID == SC_WID_UNO_PAGESTL )
8606 : {
8607 138 : rAny <<= OUString( ScStyleNameConversion::DisplayToProgrammaticName(
8608 69 : pDoc->GetPageStyle( nTab ), SFX_STYLE_FAMILY_PAGE ) );
8609 : }
8610 1721 : else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
8611 : {
8612 13 : sal_Bool bVis = pDoc->IsVisible( nTab );
8613 13 : ScUnoHelpFunctions::SetBoolInAny( rAny, bVis );
8614 : }
8615 1708 : else if ( pEntry->nWID == SC_WID_UNO_LINKDISPBIT )
8616 : {
8617 : // no target bitmaps for individual entries (would be all equal)
8618 : // ScLinkTargetTypeObj::SetLinkTargetBitmap( aAny, SC_LINKTARGETTYPE_SHEET );
8619 : }
8620 1708 : else if ( pEntry->nWID == SC_WID_UNO_LINKDISPNAME )
8621 : {
8622 : // LinkDisplayName for hyperlink dialog
8623 0 : rAny <<= getName(); // sheet name
8624 : }
8625 1708 : else if ( pEntry->nWID == SC_WID_UNO_ISACTIVE )
8626 : {
8627 0 : if (pDoc->IsScenario(nTab))
8628 0 : ScUnoHelpFunctions::SetBoolInAny( rAny, pDoc->IsActiveScenario( nTab ));
8629 : }
8630 1708 : else if ( pEntry->nWID == SC_WID_UNO_BORDCOL )
8631 : {
8632 0 : if (pDoc->IsScenario(nTab))
8633 : {
8634 0 : OUString aComment;
8635 0 : Color aColor;
8636 : sal_uInt16 nFlags;
8637 0 : pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8638 :
8639 0 : rAny <<= static_cast<sal_Int32>(aColor.GetColor());
8640 : }
8641 : }
8642 1708 : else if ( pEntry->nWID == SC_WID_UNO_PROTECT )
8643 : {
8644 0 : if (pDoc->IsScenario(nTab))
8645 : {
8646 0 : OUString aComment;
8647 0 : Color aColor;
8648 : sal_uInt16 nFlags;
8649 0 : pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8650 :
8651 0 : ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_PROTECT) != 0 );
8652 : }
8653 : }
8654 1708 : else if ( pEntry->nWID == SC_WID_UNO_SHOWBORD )
8655 : {
8656 0 : if (pDoc->IsScenario(nTab))
8657 : {
8658 0 : OUString aComment;
8659 0 : Color aColor;
8660 : sal_uInt16 nFlags;
8661 0 : pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8662 :
8663 0 : ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_SHOWFRAME) != 0 );
8664 : }
8665 : }
8666 1708 : else if ( pEntry->nWID == SC_WID_UNO_PRINTBORD )
8667 : {
8668 0 : if (pDoc->IsScenario(nTab))
8669 : {
8670 0 : OUString aComment;
8671 0 : Color aColor;
8672 : sal_uInt16 nFlags;
8673 0 : pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8674 :
8675 0 : ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_PRINTFRAME) != 0 );
8676 : }
8677 : }
8678 1708 : else if ( pEntry->nWID == SC_WID_UNO_COPYBACK )
8679 : {
8680 0 : if (pDoc->IsScenario(nTab))
8681 : {
8682 0 : OUString aComment;
8683 0 : Color aColor;
8684 : sal_uInt16 nFlags;
8685 0 : pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8686 :
8687 0 : ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_TWOWAY) != 0 );
8688 : }
8689 : }
8690 1708 : else if ( pEntry->nWID == SC_WID_UNO_COPYSTYL )
8691 : {
8692 0 : if (pDoc->IsScenario(nTab))
8693 : {
8694 0 : OUString aComment;
8695 0 : Color aColor;
8696 : sal_uInt16 nFlags;
8697 0 : pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8698 :
8699 0 : ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_ATTRIB) != 0 );
8700 : }
8701 : }
8702 1708 : else if ( pEntry->nWID == SC_WID_UNO_COPYFORM )
8703 : {
8704 0 : if (pDoc->IsScenario(nTab))
8705 : {
8706 0 : OUString aComment;
8707 0 : Color aColor;
8708 : sal_uInt16 nFlags;
8709 0 : pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8710 :
8711 0 : ScUnoHelpFunctions::SetBoolInAny( rAny, !(nFlags & SC_SCENARIO_VALUE));
8712 : }
8713 : }
8714 1708 : else if ( pEntry->nWID == SC_WID_UNO_TABLAYOUT )
8715 : {
8716 17 : if (pDoc->IsLayoutRTL(nTab))
8717 4 : rAny <<= sal_Int16(com::sun::star::text::WritingMode2::RL_TB);
8718 : else
8719 13 : rAny <<= sal_Int16(com::sun::star::text::WritingMode2::LR_TB);
8720 : }
8721 1691 : else if ( pEntry->nWID == SC_WID_UNO_AUTOPRINT )
8722 : {
8723 0 : sal_Bool bAutoPrint = pDoc->IsPrintEntireSheet( nTab );
8724 0 : ScUnoHelpFunctions::SetBoolInAny( rAny, bAutoPrint );
8725 : }
8726 1691 : else if ( pEntry->nWID == SC_WID_UNO_TABCOLOR )
8727 : {
8728 9 : rAny <<= sal_Int32(pDoc->GetTabBgColor(nTab).GetColor());
8729 : }
8730 1682 : else if ( pEntry->nWID == SC_WID_UNO_CODENAME )
8731 : {
8732 1677 : OUString aCodeName;
8733 1677 : if ( pDocSh )
8734 1677 : pDocSh->GetDocument()->GetCodeName( GetTab_Impl(), aCodeName );
8735 1677 : rAny <<= OUString( aCodeName );
8736 : }
8737 : else
8738 5 : ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
8739 : }
8740 1790 : }
8741 :
8742 2134 : const SfxItemPropertyMap& ScTableSheetObj::GetItemPropertyMap()
8743 : {
8744 2134 : return pSheetPropSet->getPropertyMap();
8745 : }
8746 :
8747 : // XServiceInfo
8748 :
8749 0 : OUString SAL_CALL ScTableSheetObj::getImplementationName() throw(uno::RuntimeException)
8750 : {
8751 0 : return OUString( "ScTableSheetObj" );
8752 : }
8753 :
8754 0 : sal_Bool SAL_CALL ScTableSheetObj::supportsService( const OUString& rServiceName )
8755 : throw(uno::RuntimeException)
8756 : {
8757 0 : String aServiceStr( rServiceName );
8758 0 : return aServiceStr.EqualsAscii( SCSPREADSHEET_SERVICE ) ||
8759 0 : aServiceStr.EqualsAscii( SCSHEETCELLRANGE_SERVICE ) ||
8760 0 : aServiceStr.EqualsAscii( SCCELLRANGE_SERVICE ) ||
8761 0 : aServiceStr.EqualsAscii( SCCELLPROPERTIES_SERVICE ) ||
8762 0 : aServiceStr.EqualsAscii( SCCHARPROPERTIES_SERVICE ) ||
8763 0 : aServiceStr.EqualsAscii( SCPARAPROPERTIES_SERVICE ) ||
8764 0 : aServiceStr.EqualsAscii( SCLINKTARGET_SERVICE );
8765 : }
8766 :
8767 0 : uno::Sequence<OUString> SAL_CALL ScTableSheetObj::getSupportedServiceNames()
8768 : throw(uno::RuntimeException)
8769 : {
8770 0 : uno::Sequence<OUString> aRet(7);
8771 0 : OUString* pArray = aRet.getArray();
8772 0 : pArray[0] = OUString( SCSPREADSHEET_SERVICE );
8773 0 : pArray[1] = OUString( SCSHEETCELLRANGE_SERVICE );
8774 0 : pArray[2] = OUString( SCCELLRANGE_SERVICE );
8775 0 : pArray[3] = OUString( SCCELLPROPERTIES_SERVICE );
8776 0 : pArray[4] = OUString( SCCHARPROPERTIES_SERVICE );
8777 0 : pArray[5] = OUString( SCPARAPROPERTIES_SERVICE );
8778 0 : pArray[6] = OUString( SCLINKTARGET_SERVICE );
8779 0 : return aRet;
8780 : }
8781 :
8782 : // XUnoTunnel
8783 :
8784 3427 : sal_Int64 SAL_CALL ScTableSheetObj::getSomething(
8785 : const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException)
8786 : {
8787 6854 : if ( rId.getLength() == 16 &&
8788 3427 : 0 == memcmp( getUnoTunnelId().getConstArray(),
8789 6854 : rId.getConstArray(), 16 ) )
8790 : {
8791 315 : return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
8792 : }
8793 :
8794 3112 : return ScCellRangeObj::getSomething( rId );
8795 : }
8796 :
8797 : namespace
8798 : {
8799 : class theScTableSheetObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScTableSheetObjUnoTunnelId> {};
8800 : }
8801 :
8802 6277 : const uno::Sequence<sal_Int8>& ScTableSheetObj::getUnoTunnelId()
8803 : {
8804 6277 : return theScTableSheetObjUnoTunnelId::get().getSeq();
8805 : }
8806 :
8807 2850 : ScTableSheetObj* ScTableSheetObj::getImplementation( const uno::Reference<uno::XInterface> xObj )
8808 : {
8809 2850 : ScTableSheetObj* pRet = NULL;
8810 2850 : uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
8811 2850 : if (xUT.is())
8812 2850 : pRet = reinterpret_cast<ScTableSheetObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
8813 2850 : return pRet;
8814 : }
8815 :
8816 : //------------------------------------------------------------------------
8817 :
8818 1069 : ScTableColumnObj::ScTableColumnObj( ScDocShell* pDocSh, SCCOL nCol, SCTAB nTab ) :
8819 : ScCellRangeObj( pDocSh, ScRange(nCol,0,nTab, nCol,MAXROW,nTab) ),
8820 1069 : pColPropSet(lcl_GetColumnPropertySet())
8821 : {
8822 1069 : }
8823 :
8824 2136 : ScTableColumnObj::~ScTableColumnObj()
8825 : {
8826 2136 : }
8827 :
8828 1136 : uno::Any SAL_CALL ScTableColumnObj::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException)
8829 : {
8830 1136 : SC_QUERYINTERFACE( container::XNamed )
8831 :
8832 1136 : return ScCellRangeObj::queryInterface( rType );
8833 : }
8834 :
8835 6503 : void SAL_CALL ScTableColumnObj::acquire() throw()
8836 : {
8837 6503 : ScCellRangeObj::acquire();
8838 6503 : }
8839 :
8840 6500 : void SAL_CALL ScTableColumnObj::release() throw()
8841 : {
8842 6500 : ScCellRangeObj::release();
8843 6500 : }
8844 :
8845 0 : uno::Sequence<uno::Type> SAL_CALL ScTableColumnObj::getTypes() throw(uno::RuntimeException)
8846 : {
8847 0 : static uno::Sequence<uno::Type> aTypes;
8848 0 : if ( aTypes.getLength() == 0 )
8849 : {
8850 0 : uno::Sequence<uno::Type> aParentTypes(ScCellRangeObj::getTypes());
8851 0 : long nParentLen = aParentTypes.getLength();
8852 0 : const uno::Type* pParentPtr = aParentTypes.getConstArray();
8853 :
8854 0 : aTypes.realloc( nParentLen + 1 );
8855 0 : uno::Type* pPtr = aTypes.getArray();
8856 0 : pPtr[nParentLen + 0] = getCppuType((const uno::Reference<container::XNamed>*)0);
8857 :
8858 0 : for (long i=0; i<nParentLen; i++)
8859 0 : pPtr[i] = pParentPtr[i]; // parent types first
8860 : }
8861 0 : return aTypes;
8862 : }
8863 :
8864 : namespace
8865 : {
8866 : class theScTableColumnObjImplementationId : public rtl::Static< UnoTunnelIdInit, theScTableColumnObjImplementationId > {};
8867 : }
8868 :
8869 10 : uno::Sequence<sal_Int8> SAL_CALL ScTableColumnObj::getImplementationId() throw(uno::RuntimeException)
8870 : {
8871 10 : return theScTableColumnObjImplementationId::get().getSeq();
8872 : }
8873 :
8874 : // XNamed
8875 :
8876 0 : OUString SAL_CALL ScTableColumnObj::getName() throw(uno::RuntimeException)
8877 : {
8878 0 : SolarMutexGuard aGuard;
8879 :
8880 0 : const ScRange& rRange = GetRange();
8881 : OSL_ENSURE(rRange.aStart.Col() == rRange.aEnd.Col(), "too many columns");
8882 0 : SCCOL nCol = rRange.aStart.Col();
8883 :
8884 0 : return ScColToAlpha( nCol ); // from global.hxx
8885 : }
8886 :
8887 0 : void SAL_CALL ScTableColumnObj::setName( const OUString& /* aNewName */ )
8888 : throw(uno::RuntimeException)
8889 : {
8890 0 : SolarMutexGuard aGuard;
8891 0 : throw uno::RuntimeException(); // read-only
8892 : }
8893 :
8894 : // XPropertySet erweitert fuer Spalten-Properties
8895 :
8896 10 : uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTableColumnObj::getPropertySetInfo()
8897 : throw(uno::RuntimeException)
8898 : {
8899 10 : SolarMutexGuard aGuard;
8900 : static uno::Reference<beans::XPropertySetInfo> aRef(
8901 10 : new SfxItemPropertySetInfo( pColPropSet->getPropertyMap() ));
8902 10 : return aRef;
8903 : }
8904 :
8905 4 : void ScTableColumnObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
8906 : throw(lang::IllegalArgumentException, uno::RuntimeException)
8907 : {
8908 4 : if ( pEntry )
8909 : {
8910 4 : if ( IsScItemWid( pEntry->nWID ) )
8911 : {
8912 : // for Item WIDs, call ScCellRangesBase directly
8913 0 : ScCellRangesBase::SetOnePropertyValue(pEntry, aValue);
8914 0 : return;
8915 : }
8916 :
8917 : // own properties
8918 :
8919 4 : ScDocShell* pDocSh = GetDocShell();
8920 4 : if (!pDocSh)
8921 0 : return; //! Exception oder so?
8922 4 : const ScRange& rRange = GetRange();
8923 : OSL_ENSURE(rRange.aStart.Col() == rRange.aEnd.Col(), "zuviele Spalten");
8924 4 : SCCOL nCol = rRange.aStart.Col();
8925 4 : SCTAB nTab = rRange.aStart.Tab();
8926 4 : ScDocFunc &rFunc = pDocSh->GetDocFunc();
8927 :
8928 : SCCOLROW nColArr[2];
8929 4 : nColArr[0] = nColArr[1] = nCol;
8930 :
8931 4 : if ( pEntry->nWID == SC_WID_UNO_CELLWID )
8932 : {
8933 0 : sal_Int32 nNewWidth = 0;
8934 0 : if ( aValue >>= nNewWidth )
8935 : {
8936 : // property is 1/100mm, column width is twips
8937 0 : nNewWidth = HMMToTwips(nNewWidth);
8938 : rFunc.SetWidthOrHeight( sal_True, 1, nColArr, nTab, SC_SIZE_ORIGINAL,
8939 0 : (sal_uInt16)nNewWidth, sal_True, sal_True );
8940 : }
8941 : }
8942 4 : else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
8943 : {
8944 0 : sal_Bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
8945 0 : ScSizeMode eMode = bVis ? SC_SIZE_SHOW : SC_SIZE_DIRECT;
8946 0 : rFunc.SetWidthOrHeight( sal_True, 1, nColArr, nTab, eMode, 0, sal_True, sal_True );
8947 : // SC_SIZE_DIRECT mit Groesse 0 blendet aus
8948 : }
8949 4 : else if ( pEntry->nWID == SC_WID_UNO_OWIDTH )
8950 : {
8951 2 : sal_Bool bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
8952 2 : if (bOpt)
8953 : rFunc.SetWidthOrHeight( sal_True, 1, nColArr, nTab,
8954 2 : SC_SIZE_OPTIMAL, STD_EXTRA_WIDTH, sal_True, sal_True );
8955 : // sal_False bei Spalten momentan ohne Auswirkung
8956 : }
8957 2 : else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE || pEntry->nWID == SC_WID_UNO_MANPAGE )
8958 : {
8959 2 : sal_Bool bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue );
8960 2 : if (bSet)
8961 1 : rFunc.InsertPageBreak( sal_True, rRange.aStart, sal_True, sal_True, sal_True );
8962 : else
8963 1 : rFunc.RemovePageBreak( sal_True, rRange.aStart, sal_True, sal_True, sal_True );
8964 : }
8965 : else
8966 0 : ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID
8967 : }
8968 : }
8969 :
8970 32 : void ScTableColumnObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
8971 : uno::Any& rAny )
8972 : throw(uno::RuntimeException)
8973 : {
8974 32 : if ( pEntry )
8975 : {
8976 32 : ScDocShell* pDocSh = GetDocShell();
8977 32 : if (!pDocSh)
8978 0 : throw uno::RuntimeException();
8979 :
8980 32 : ScDocument* pDoc = pDocSh->GetDocument();
8981 32 : const ScRange& rRange = GetRange();
8982 : OSL_ENSURE(rRange.aStart.Col() == rRange.aEnd.Col(), "zuviele Spalten");
8983 32 : SCCOL nCol = rRange.aStart.Col();
8984 32 : SCTAB nTab = rRange.aStart.Tab();
8985 :
8986 32 : if ( pEntry->nWID == SC_WID_UNO_CELLWID )
8987 : {
8988 : // for hidden column, return original height
8989 10 : sal_uInt16 nWidth = pDoc->GetOriginalWidth( nCol, nTab );
8990 : // property is 1/100mm, column width is twips
8991 10 : nWidth = (sal_uInt16) TwipsToHMM(nWidth);
8992 10 : rAny <<= (sal_Int32)( nWidth );
8993 : }
8994 22 : else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
8995 : {
8996 10 : bool bHidden = pDoc->ColHidden(nCol, nTab);
8997 10 : ScUnoHelpFunctions::SetBoolInAny( rAny, !bHidden );
8998 : }
8999 12 : else if ( pEntry->nWID == SC_WID_UNO_OWIDTH )
9000 : {
9001 : //! momentan immer gesetzt ??!?!
9002 0 : sal_Bool bOpt = !(pDoc->GetColFlags( nCol, nTab ) & CR_MANUALSIZE);
9003 0 : ScUnoHelpFunctions::SetBoolInAny( rAny, bOpt );
9004 : }
9005 12 : else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE )
9006 : {
9007 2 : ScBreakType nBreak = pDoc->HasColBreak(nCol, nTab);
9008 2 : ScUnoHelpFunctions::SetBoolInAny( rAny, nBreak );
9009 : }
9010 10 : else if ( pEntry->nWID == SC_WID_UNO_MANPAGE )
9011 : {
9012 10 : ScBreakType nBreak = pDoc->HasColBreak(nCol, nTab);
9013 10 : ScUnoHelpFunctions::SetBoolInAny(rAny, (nBreak & BREAK_MANUAL));
9014 : }
9015 : else
9016 0 : ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
9017 : }
9018 32 : }
9019 :
9020 16 : const SfxItemPropertyMap& ScTableColumnObj::GetItemPropertyMap()
9021 : {
9022 16 : return pColPropSet->getPropertyMap();
9023 : }
9024 :
9025 : //------------------------------------------------------------------------
9026 :
9027 71 : ScTableRowObj::ScTableRowObj(ScDocShell* pDocSh, SCROW nRow, SCTAB nTab) :
9028 : ScCellRangeObj( pDocSh, ScRange(0,nRow,nTab, MAXCOL,nRow,nTab) ),
9029 71 : pRowPropSet(lcl_GetRowPropertySet())
9030 : {
9031 71 : }
9032 :
9033 142 : ScTableRowObj::~ScTableRowObj()
9034 : {
9035 142 : }
9036 :
9037 : // XPropertySet erweitert fuer Zeilen-Properties
9038 :
9039 13 : uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTableRowObj::getPropertySetInfo()
9040 : throw(uno::RuntimeException)
9041 : {
9042 13 : SolarMutexGuard aGuard;
9043 : static uno::Reference<beans::XPropertySetInfo> aRef(
9044 13 : new SfxItemPropertySetInfo( pRowPropSet->getPropertyMap() ));
9045 13 : return aRef;
9046 : }
9047 :
9048 4 : void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
9049 : throw(lang::IllegalArgumentException, uno::RuntimeException)
9050 : {
9051 4 : if ( pEntry )
9052 : {
9053 4 : if ( IsScItemWid( pEntry->nWID ) )
9054 : {
9055 : // for Item WIDs, call ScCellRangesBase directly
9056 0 : ScCellRangesBase::SetOnePropertyValue(pEntry, aValue);
9057 0 : return;
9058 : }
9059 :
9060 : // own properties
9061 :
9062 4 : ScDocShell* pDocSh = GetDocShell();
9063 4 : if (!pDocSh)
9064 0 : return; //! Exception oder so?
9065 4 : ScDocument* pDoc = pDocSh->GetDocument();
9066 4 : const ScRange& rRange = GetRange();
9067 : OSL_ENSURE(rRange.aStart.Row() == rRange.aEnd.Row(), "zuviele Zeilen");
9068 4 : SCROW nRow = rRange.aStart.Row();
9069 4 : SCTAB nTab = rRange.aStart.Tab();
9070 4 : ScDocFunc &rFunc = pDocSh->GetDocFunc();
9071 :
9072 : SCCOLROW nRowArr[2];
9073 4 : nRowArr[0] = nRowArr[1] = nRow;
9074 :
9075 4 : if ( pEntry->nWID == SC_WID_UNO_CELLHGT )
9076 : {
9077 0 : sal_Int32 nNewHeight = 0;
9078 0 : if ( aValue >>= nNewHeight )
9079 : {
9080 : // property is 1/100mm, row height is twips
9081 0 : nNewHeight = HMMToTwips(nNewHeight);
9082 : rFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, SC_SIZE_ORIGINAL,
9083 0 : (sal_uInt16)nNewHeight, sal_True, sal_True );
9084 : }
9085 : }
9086 4 : else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
9087 : {
9088 2 : sal_Bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
9089 2 : ScSizeMode eMode = bVis ? SC_SIZE_SHOW : SC_SIZE_DIRECT;
9090 2 : rFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, eMode, 0, sal_True, sal_True );
9091 : // SC_SIZE_DIRECT mit Groesse 0 blendet aus
9092 : }
9093 2 : else if ( pEntry->nWID == SC_WID_UNO_CELLFILT )
9094 : {
9095 0 : sal_Bool bFil = ScUnoHelpFunctions::GetBoolFromAny( aValue );
9096 : // SC_SIZE_DIRECT mit Groesse 0 blendet aus
9097 0 : pDoc->SetRowFiltered(nRow, nRow, nTab, bFil);
9098 : }
9099 2 : else if ( pEntry->nWID == SC_WID_UNO_OHEIGHT )
9100 : {
9101 0 : sal_Bool bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
9102 0 : if (bOpt)
9103 0 : rFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, SC_SIZE_OPTIMAL, 0, sal_True, sal_True );
9104 : else
9105 : {
9106 : // set current height again manually
9107 0 : sal_uInt16 nHeight = pDoc->GetOriginalHeight( nRow, nTab );
9108 0 : rFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, SC_SIZE_ORIGINAL, nHeight, sal_True, sal_True );
9109 : }
9110 : }
9111 2 : else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE || pEntry->nWID == SC_WID_UNO_MANPAGE )
9112 : {
9113 2 : sal_Bool bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue );
9114 2 : if (bSet)
9115 1 : rFunc.InsertPageBreak( false, rRange.aStart, sal_True, sal_True, sal_True );
9116 : else
9117 1 : rFunc.RemovePageBreak( false, rRange.aStart, sal_True, sal_True, sal_True );
9118 : }
9119 : else
9120 0 : ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID
9121 : }
9122 : }
9123 :
9124 50 : void ScTableRowObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
9125 : uno::Any& rAny )
9126 : throw(uno::RuntimeException)
9127 : {
9128 50 : if ( pEntry )
9129 : {
9130 50 : ScDocShell* pDocSh = GetDocShell();
9131 50 : if (!pDocSh)
9132 0 : throw uno::RuntimeException();
9133 50 : ScDocument* pDoc = pDocSh->GetDocument();
9134 50 : const ScRange& rRange = GetRange();
9135 : OSL_ENSURE(rRange.aStart.Row() == rRange.aEnd.Row(), "zuviele Zeilen");
9136 50 : SCROW nRow = rRange.aStart.Row();
9137 50 : SCTAB nTab = rRange.aStart.Tab();
9138 :
9139 50 : if ( pEntry->nWID == SC_WID_UNO_CELLHGT )
9140 : {
9141 : // for hidden row, return original height
9142 13 : sal_uInt16 nHeight = pDoc->GetOriginalHeight( nRow, nTab );
9143 : // property is 1/100mm, row height is twips
9144 13 : nHeight = (sal_uInt16) TwipsToHMM(nHeight);
9145 13 : rAny <<= (sal_Int32)( nHeight );
9146 : }
9147 37 : else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
9148 : {
9149 9 : bool bHidden = pDoc->RowHidden(nRow, nTab);
9150 9 : ScUnoHelpFunctions::SetBoolInAny( rAny, !bHidden );
9151 : }
9152 28 : else if ( pEntry->nWID == SC_WID_UNO_CELLFILT )
9153 : {
9154 0 : bool bVis = pDoc->RowFiltered(nRow, nTab);
9155 0 : ScUnoHelpFunctions::SetBoolInAny( rAny, bVis );
9156 : }
9157 28 : else if ( pEntry->nWID == SC_WID_UNO_OHEIGHT )
9158 : {
9159 13 : sal_Bool bOpt = !(pDoc->GetRowFlags( nRow, nTab ) & CR_MANUALSIZE);
9160 13 : ScUnoHelpFunctions::SetBoolInAny( rAny, bOpt );
9161 : }
9162 15 : else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE )
9163 : {
9164 2 : ScBreakType nBreak = pDoc->HasRowBreak(nRow, nTab);
9165 2 : ScUnoHelpFunctions::SetBoolInAny( rAny, nBreak );
9166 : }
9167 13 : else if ( pEntry->nWID == SC_WID_UNO_MANPAGE )
9168 : {
9169 13 : ScBreakType nBreak = (pDoc->HasRowBreak(nRow, nTab) & BREAK_MANUAL);
9170 13 : ScUnoHelpFunctions::SetBoolInAny( rAny, nBreak );
9171 : }
9172 : else
9173 0 : ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
9174 : }
9175 50 : }
9176 :
9177 28 : const SfxItemPropertyMap& ScTableRowObj::GetItemPropertyMap()
9178 : {
9179 28 : return pRowPropSet->getPropertyMap();
9180 : }
9181 :
9182 : //------------------------------------------------------------------------
9183 :
9184 13 : ScCellsObj::ScCellsObj(ScDocShell* pDocSh, const ScRangeList& rR) :
9185 : pDocShell( pDocSh ),
9186 13 : aRanges( rR )
9187 : {
9188 13 : pDocShell->GetDocument()->AddUnoObject(*this);
9189 13 : }
9190 :
9191 39 : ScCellsObj::~ScCellsObj()
9192 : {
9193 13 : if (pDocShell)
9194 9 : pDocShell->GetDocument()->RemoveUnoObject(*this);
9195 26 : }
9196 :
9197 8 : void ScCellsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
9198 : {
9199 8 : if ( rHint.ISA( ScUpdateRefHint ) )
9200 : {
9201 0 : const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint;
9202 0 : aRanges.UpdateReference( rRef.GetMode(), pDocShell->GetDocument(), rRef.GetRange(),
9203 0 : rRef.GetDx(), rRef.GetDy(), rRef.GetDz() );
9204 : }
9205 16 : else if ( rHint.ISA( SfxSimpleHint ) &&
9206 8 : ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
9207 : {
9208 4 : pDocShell = NULL; // ungueltig geworden
9209 : }
9210 8 : }
9211 :
9212 : // XEnumerationAccess
9213 :
9214 12 : uno::Reference<container::XEnumeration> SAL_CALL ScCellsObj::createEnumeration()
9215 : throw(uno::RuntimeException)
9216 : {
9217 12 : SolarMutexGuard aGuard;
9218 12 : if (pDocShell)
9219 12 : return new ScCellsEnumeration( pDocShell, aRanges );
9220 0 : return NULL;
9221 : }
9222 :
9223 1 : uno::Type SAL_CALL ScCellsObj::getElementType() throw(uno::RuntimeException)
9224 : {
9225 1 : SolarMutexGuard aGuard;
9226 1 : return getCppuType((uno::Reference<table::XCell>*)0);
9227 : }
9228 :
9229 1 : sal_Bool SAL_CALL ScCellsObj::hasElements() throw(uno::RuntimeException)
9230 : {
9231 1 : SolarMutexGuard aGuard;
9232 1 : sal_Bool bHas = false;
9233 1 : if ( pDocShell )
9234 : {
9235 : //! schneller selber testen?
9236 :
9237 1 : uno::Reference<container::XEnumeration> xEnum(new ScCellsEnumeration( pDocShell, aRanges ));
9238 1 : bHas = xEnum->hasMoreElements();
9239 : }
9240 1 : return bHas;
9241 : }
9242 :
9243 : //------------------------------------------------------------------------
9244 :
9245 13 : ScCellsEnumeration::ScCellsEnumeration(ScDocShell* pDocSh, const ScRangeList& rR) :
9246 : pDocShell( pDocSh ),
9247 : aRanges( rR ),
9248 : pMark( NULL ),
9249 13 : bAtEnd( false )
9250 : {
9251 13 : ScDocument* pDoc = pDocShell->GetDocument();
9252 13 : pDoc->AddUnoObject(*this);
9253 :
9254 13 : if ( aRanges.empty() )
9255 9 : bAtEnd = true;
9256 : else
9257 : {
9258 4 : SCTAB nTab = 0;
9259 4 : const ScRange* pFirst = aRanges[ 0 ];
9260 4 : if (pFirst)
9261 4 : nTab = pFirst->aStart.Tab();
9262 4 : aPos = ScAddress(0,0,nTab);
9263 4 : CheckPos_Impl(); // aPos auf erste passende Zelle setzen
9264 : }
9265 13 : }
9266 :
9267 4 : void ScCellsEnumeration::CheckPos_Impl()
9268 : {
9269 4 : if (!pDocShell)
9270 4 : return;
9271 :
9272 4 : bool bFound = false;
9273 4 : ScDocument* pDoc = pDocShell->GetDocument();
9274 4 : ScRefCellValue aCell;
9275 4 : aCell.assign(*pDoc, aPos);
9276 4 : if (!aCell.isEmpty())
9277 : {
9278 4 : if (!pMark)
9279 : {
9280 4 : pMark = new ScMarkData;
9281 4 : pMark->MarkFromRangeList(aRanges, false);
9282 4 : pMark->MarkToMulti(); // needed for GetNextMarkedCell
9283 : }
9284 4 : bFound = pMark->IsCellMarked(aPos.Col(), aPos.Row());
9285 : }
9286 4 : if (!bFound)
9287 1 : Advance_Impl();
9288 : }
9289 :
9290 39 : ScCellsEnumeration::~ScCellsEnumeration()
9291 : {
9292 13 : if (pDocShell)
9293 10 : pDocShell->GetDocument()->RemoveUnoObject(*this);
9294 13 : delete pMark;
9295 26 : }
9296 :
9297 2 : void ScCellsEnumeration::Advance_Impl()
9298 : {
9299 : OSL_ENSURE(!bAtEnd,"zuviel Advance_Impl");
9300 2 : if (!pMark)
9301 : {
9302 0 : pMark = new ScMarkData;
9303 0 : pMark->MarkFromRangeList( aRanges, false );
9304 0 : pMark->MarkToMulti(); // needed for GetNextMarkedCell
9305 : }
9306 :
9307 2 : SCCOL nCol = aPos.Col();
9308 2 : SCROW nRow = aPos.Row();
9309 2 : SCTAB nTab = aPos.Tab();
9310 2 : sal_Bool bFound = pDocShell->GetDocument()->GetNextMarkedCell( nCol, nRow, nTab, *pMark );
9311 2 : if (bFound)
9312 1 : aPos.Set( nCol, nRow, nTab );
9313 : else
9314 1 : bAtEnd = sal_True; // kommt nix mehr
9315 2 : }
9316 :
9317 7 : void ScCellsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint )
9318 : {
9319 7 : if ( rHint.ISA( ScUpdateRefHint ) )
9320 : {
9321 0 : if (pDocShell)
9322 : {
9323 0 : const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint;
9324 0 : aRanges.UpdateReference( rRef.GetMode(), pDocShell->GetDocument(), rRef.GetRange(),
9325 0 : rRef.GetDx(), rRef.GetDy(), rRef.GetDz() );
9326 :
9327 0 : delete pMark; // aus verschobenen Bereichen neu erzeugen
9328 0 : pMark = NULL;
9329 :
9330 0 : if (!bAtEnd) // aPos anpassen
9331 : {
9332 0 : ScRangeList aNew;
9333 0 : aNew.Append(ScRange(aPos));
9334 0 : aNew.UpdateReference( rRef.GetMode(), pDocShell->GetDocument(), rRef.GetRange(),
9335 0 : rRef.GetDx(), rRef.GetDy(), rRef.GetDz() );
9336 0 : if (aNew.size()==1)
9337 : {
9338 0 : aPos = aNew[ 0 ]->aStart;
9339 0 : CheckPos_Impl();
9340 0 : }
9341 : }
9342 : }
9343 : }
9344 14 : else if ( rHint.ISA( SfxSimpleHint ) &&
9345 7 : ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
9346 : {
9347 3 : pDocShell = NULL; // ungueltig geworden
9348 : }
9349 7 : }
9350 :
9351 : // XEnumeration
9352 :
9353 13 : sal_Bool SAL_CALL ScCellsEnumeration::hasMoreElements() throw(uno::RuntimeException)
9354 : {
9355 13 : SolarMutexGuard aGuard;
9356 13 : return !bAtEnd;
9357 : }
9358 :
9359 2 : uno::Any SAL_CALL ScCellsEnumeration::nextElement() throw(container::NoSuchElementException,
9360 : lang::WrappedTargetException, uno::RuntimeException)
9361 : {
9362 2 : SolarMutexGuard aGuard;
9363 2 : if (pDocShell && !bAtEnd)
9364 : {
9365 : // Interface-Typ muss zu ScCellsObj::getElementType passen
9366 :
9367 1 : ScAddress aTempPos(aPos);
9368 1 : Advance_Impl();
9369 2 : return uno::makeAny(uno::Reference<table::XCell>(new ScCellObj( pDocShell, aTempPos )));
9370 : }
9371 :
9372 1 : throw container::NoSuchElementException(); // no more elements
9373 : }
9374 :
9375 : //------------------------------------------------------------------------
9376 :
9377 3 : ScCellFormatsObj::ScCellFormatsObj(ScDocShell* pDocSh, const ScRange& rRange) :
9378 : pDocShell( pDocSh ),
9379 3 : aTotalRange( rRange )
9380 : {
9381 3 : ScDocument* pDoc = pDocShell->GetDocument();
9382 3 : pDoc->AddUnoObject(*this);
9383 :
9384 : OSL_ENSURE( aTotalRange.aStart.Tab() == aTotalRange.aEnd.Tab(), "unterschiedliche Tabellen" );
9385 3 : }
9386 :
9387 9 : ScCellFormatsObj::~ScCellFormatsObj()
9388 : {
9389 3 : if (pDocShell)
9390 0 : pDocShell->GetDocument()->RemoveUnoObject(*this);
9391 6 : }
9392 :
9393 8 : void ScCellFormatsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
9394 : {
9395 8 : if ( rHint.ISA( ScUpdateRefHint ) )
9396 : {
9397 : //! aTotalRange...
9398 : }
9399 14 : else if ( rHint.ISA( SfxSimpleHint ) &&
9400 6 : ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
9401 : {
9402 3 : pDocShell = NULL; // ungueltig geworden
9403 : }
9404 8 : }
9405 :
9406 5 : ScCellRangeObj* ScCellFormatsObj::GetObjectByIndex_Impl(long nIndex) const
9407 : {
9408 : //! direkt auf die AttrArrays zugreifen !!!!
9409 :
9410 5 : ScCellRangeObj* pRet = NULL;
9411 5 : if (pDocShell)
9412 : {
9413 5 : ScDocument* pDoc = pDocShell->GetDocument();
9414 5 : long nPos = 0;
9415 5 : ScAttrRectIterator aIter( pDoc, aTotalRange.aStart.Tab(),
9416 5 : aTotalRange.aStart.Col(), aTotalRange.aStart.Row(),
9417 15 : aTotalRange.aEnd.Col(), aTotalRange.aEnd.Row() );
9418 : SCCOL nCol1, nCol2;
9419 : SCROW nRow1, nRow2;
9420 15 : while ( aIter.GetNext( nCol1, nCol2, nRow1, nRow2 ) )
9421 : {
9422 5 : if ( nPos == nIndex )
9423 : {
9424 4 : SCTAB nTab = aTotalRange.aStart.Tab();
9425 4 : ScRange aNext( nCol1, nRow1, nTab, nCol2, nRow2, nTab );
9426 :
9427 4 : if ( aNext.aStart == aNext.aEnd )
9428 0 : pRet = new ScCellObj( pDocShell, aNext.aStart );
9429 : else
9430 4 : pRet = new ScCellRangeObj( pDocShell, aNext );
9431 : }
9432 5 : ++nPos;
9433 5 : }
9434 : }
9435 5 : return pRet;
9436 : }
9437 :
9438 : // XIndexAccess
9439 :
9440 3 : sal_Int32 SAL_CALL ScCellFormatsObj::getCount() throw(uno::RuntimeException)
9441 : {
9442 3 : SolarMutexGuard aGuard;
9443 :
9444 : //! direkt auf die AttrArrays zugreifen !!!!
9445 :
9446 3 : long nCount = 0;
9447 3 : if (pDocShell)
9448 : {
9449 3 : ScDocument* pDoc = pDocShell->GetDocument();
9450 3 : ScAttrRectIterator aIter( pDoc, aTotalRange.aStart.Tab(),
9451 3 : aTotalRange.aStart.Col(), aTotalRange.aStart.Row(),
9452 9 : aTotalRange.aEnd.Col(), aTotalRange.aEnd.Row() );
9453 : SCCOL nCol1, nCol2;
9454 : SCROW nRow1, nRow2;
9455 9 : while ( aIter.GetNext( nCol1, nCol2, nRow1, nRow2 ) )
9456 6 : ++nCount;
9457 : }
9458 3 : return nCount;
9459 : }
9460 :
9461 5 : uno::Any SAL_CALL ScCellFormatsObj::getByIndex( sal_Int32 nIndex )
9462 : throw(lang::IndexOutOfBoundsException,
9463 : lang::WrappedTargetException, uno::RuntimeException)
9464 : {
9465 5 : SolarMutexGuard aGuard;
9466 :
9467 10 : uno::Reference<table::XCellRange> xRange(GetObjectByIndex_Impl(nIndex));
9468 5 : if (xRange.is())
9469 8 : return uno::makeAny(xRange);
9470 : else
9471 6 : throw lang::IndexOutOfBoundsException();
9472 : }
9473 :
9474 1 : uno::Type SAL_CALL ScCellFormatsObj::getElementType() throw(uno::RuntimeException)
9475 : {
9476 1 : SolarMutexGuard aGuard;
9477 1 : return getCppuType((uno::Reference<table::XCellRange>*)0);
9478 : }
9479 :
9480 1 : sal_Bool SAL_CALL ScCellFormatsObj::hasElements() throw(uno::RuntimeException)
9481 : {
9482 1 : SolarMutexGuard aGuard;
9483 1 : return ( getCount() != 0 ); //! immer groesser 0 ??
9484 : }
9485 :
9486 : // XEnumerationAccess
9487 :
9488 2 : uno::Reference<container::XEnumeration> SAL_CALL ScCellFormatsObj::createEnumeration()
9489 : throw(uno::RuntimeException)
9490 : {
9491 2 : SolarMutexGuard aGuard;
9492 2 : if (pDocShell)
9493 2 : return new ScCellFormatsEnumeration( pDocShell, aTotalRange );
9494 0 : return NULL;
9495 : }
9496 :
9497 : //------------------------------------------------------------------------
9498 :
9499 2 : ScCellFormatsEnumeration::ScCellFormatsEnumeration(ScDocShell* pDocSh, const ScRange& rRange) :
9500 : pDocShell( pDocSh ),
9501 2 : nTab( rRange.aStart.Tab() ),
9502 : pIter( NULL ),
9503 : bAtEnd( false ),
9504 4 : bDirty( false )
9505 : {
9506 2 : ScDocument* pDoc = pDocShell->GetDocument();
9507 2 : pDoc->AddUnoObject(*this);
9508 :
9509 : OSL_ENSURE( rRange.aStart.Tab() == rRange.aEnd.Tab(),
9510 : "CellFormatsEnumeration: unterschiedliche Tabellen" );
9511 :
9512 : pIter = new ScAttrRectIterator( pDoc, nTab,
9513 4 : rRange.aStart.Col(), rRange.aStart.Row(),
9514 4 : rRange.aEnd.Col(), rRange.aEnd.Row() );
9515 2 : Advance_Impl();
9516 2 : }
9517 :
9518 6 : ScCellFormatsEnumeration::~ScCellFormatsEnumeration()
9519 : {
9520 2 : if (pDocShell)
9521 0 : pDocShell->GetDocument()->RemoveUnoObject(*this);
9522 2 : delete pIter;
9523 4 : }
9524 :
9525 3 : void ScCellFormatsEnumeration::Advance_Impl()
9526 : {
9527 : OSL_ENSURE(!bAtEnd,"zuviel Advance_Impl");
9528 :
9529 3 : if ( pIter )
9530 : {
9531 3 : if ( bDirty )
9532 : {
9533 0 : pIter->DataChanged(); // AttrArray-Index neu suchen
9534 0 : bDirty = false;
9535 : }
9536 :
9537 : SCCOL nCol1, nCol2;
9538 : SCROW nRow1, nRow2;
9539 3 : if ( pIter->GetNext( nCol1, nCol2, nRow1, nRow2 ) )
9540 2 : aNext = ScRange( nCol1, nRow1, nTab, nCol2, nRow2, nTab );
9541 : else
9542 1 : bAtEnd = sal_True; // kommt nix mehr
9543 : }
9544 : else
9545 0 : bAtEnd = sal_True; // Dok weggekommen oder so
9546 3 : }
9547 :
9548 1 : ScCellRangeObj* ScCellFormatsEnumeration::NextObject_Impl()
9549 : {
9550 1 : ScCellRangeObj* pRet = NULL;
9551 1 : if (pDocShell && !bAtEnd)
9552 : {
9553 1 : if ( aNext.aStart == aNext.aEnd )
9554 0 : pRet = new ScCellObj( pDocShell, aNext.aStart );
9555 : else
9556 1 : pRet = new ScCellRangeObj( pDocShell, aNext );
9557 1 : Advance_Impl();
9558 : }
9559 1 : return pRet;
9560 : }
9561 :
9562 2 : void ScCellFormatsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint )
9563 : {
9564 2 : if ( rHint.ISA( ScUpdateRefHint ) )
9565 : {
9566 : //! und nun ???
9567 : }
9568 2 : else if ( rHint.ISA( SfxSimpleHint ) )
9569 : {
9570 2 : sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId();
9571 2 : if ( nId == SFX_HINT_DYING )
9572 : {
9573 2 : pDocShell = NULL; // ungueltig geworden
9574 2 : delete pIter;
9575 2 : pIter = NULL;
9576 : }
9577 0 : else if ( nId == SFX_HINT_DATACHANGED )
9578 : {
9579 0 : bDirty = sal_True; // AttrArray-Index evtl. ungueltig geworden
9580 : }
9581 : }
9582 2 : }
9583 :
9584 : // XEnumeration
9585 :
9586 2 : sal_Bool SAL_CALL ScCellFormatsEnumeration::hasMoreElements() throw(uno::RuntimeException)
9587 : {
9588 2 : SolarMutexGuard aGuard;
9589 2 : return !bAtEnd;
9590 : }
9591 :
9592 2 : uno::Any SAL_CALL ScCellFormatsEnumeration::nextElement() throw(container::NoSuchElementException,
9593 : lang::WrappedTargetException, uno::RuntimeException)
9594 : {
9595 2 : SolarMutexGuard aGuard;
9596 :
9597 2 : if ( bAtEnd || !pDocShell )
9598 1 : throw container::NoSuchElementException(); // no more elements
9599 :
9600 : // Interface-Typ muss zu ScCellFormatsObj::getElementType passen
9601 :
9602 1 : return uno::makeAny(uno::Reference<table::XCellRange> (NextObject_Impl()));
9603 : }
9604 :
9605 : //------------------------------------------------------------------------
9606 :
9607 12 : ScUniqueCellFormatsObj::ScUniqueCellFormatsObj(ScDocShell* pDocSh, const ScRange& rRange) :
9608 : pDocShell( pDocSh ),
9609 : aTotalRange( rRange ),
9610 12 : aRangeLists()
9611 : {
9612 12 : pDocShell->GetDocument()->AddUnoObject(*this);
9613 :
9614 : OSL_ENSURE( aTotalRange.aStart.Tab() == aTotalRange.aEnd.Tab(), "unterschiedliche Tabellen" );
9615 :
9616 12 : GetObjects_Impl();
9617 12 : }
9618 :
9619 36 : ScUniqueCellFormatsObj::~ScUniqueCellFormatsObj()
9620 : {
9621 12 : if (pDocShell)
9622 9 : pDocShell->GetDocument()->RemoveUnoObject(*this);
9623 24 : }
9624 :
9625 3 : void ScUniqueCellFormatsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
9626 : {
9627 3 : if ( rHint.ISA( ScUpdateRefHint ) )
9628 : {
9629 : //! aTotalRange...
9630 : }
9631 3 : else if ( rHint.ISA( SfxSimpleHint ) )
9632 : {
9633 3 : sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId();
9634 3 : if ( nId == SFX_HINT_DYING )
9635 3 : pDocShell = NULL; // ungueltig geworden
9636 : }
9637 3 : }
9638 :
9639 : //
9640 : // Fill the list of formats from the document
9641 : //
9642 :
9643 : // hash code to access the range lists by ScPatternAttr pointer
9644 : struct ScPatternHashCode
9645 : {
9646 90 : size_t operator()( const ScPatternAttr* pPattern ) const
9647 : {
9648 90 : return reinterpret_cast<size_t>(pPattern);
9649 : }
9650 : };
9651 :
9652 : // Hash map to find a range by its start row
9653 : typedef ::boost::unordered_map< SCROW, ScRange > ScRowRangeHashMap;
9654 :
9655 : typedef ::std::vector<ScRange> ScRangeVector;
9656 :
9657 : // Hash map entry.
9658 : // The Join method depends on the column-wise order of ScAttrRectIterator
9659 : class ScUniqueFormatsEntry
9660 : {
9661 : enum EntryState { STATE_EMPTY, STATE_SINGLE, STATE_COMPLEX };
9662 :
9663 : EntryState eState;
9664 : ScRange aSingleRange;
9665 : ScRowRangeHashMap aJoinedRanges; // "active" ranges to be merged
9666 : ScRangeVector aCompletedRanges; // ranges that will no longer be touched
9667 : ScRangeListRef aReturnRanges; // result as ScRangeList for further use
9668 :
9669 : public:
9670 32 : ScUniqueFormatsEntry() : eState( STATE_EMPTY ) {}
9671 : ScUniqueFormatsEntry( const ScUniqueFormatsEntry& r ) :
9672 : eState( r.eState ),
9673 : aSingleRange( r.aSingleRange ),
9674 : aJoinedRanges( r.aJoinedRanges ),
9675 : aCompletedRanges( r.aCompletedRanges ),
9676 : aReturnRanges( r.aReturnRanges ) {}
9677 32 : ~ScUniqueFormatsEntry() {}
9678 :
9679 : void Join( const ScRange& rNewRange );
9680 : const ScRangeList& GetRanges();
9681 32 : void Clear() { aReturnRanges.Clear(); } // aJoinedRanges and aCompletedRanges are cleared in GetRanges
9682 : };
9683 :
9684 90 : void ScUniqueFormatsEntry::Join( const ScRange& rNewRange )
9685 : {
9686 : // Special-case handling for single range
9687 :
9688 90 : if ( eState == STATE_EMPTY )
9689 : {
9690 32 : aSingleRange = rNewRange;
9691 32 : eState = STATE_SINGLE;
9692 70 : return;
9693 : }
9694 58 : if ( eState == STATE_SINGLE )
9695 : {
9696 39 : if ( aSingleRange.aStart.Row() == rNewRange.aStart.Row() &&
9697 21 : aSingleRange.aEnd.Row() == rNewRange.aEnd.Row() &&
9698 6 : aSingleRange.aEnd.Col() + 1 == rNewRange.aStart.Col() )
9699 : {
9700 6 : aSingleRange.aEnd.SetCol( rNewRange.aEnd.Col() );
9701 6 : return; // still a single range
9702 : }
9703 :
9704 9 : SCROW nSingleRow = aSingleRange.aStart.Row();
9705 9 : aJoinedRanges.insert( ScRowRangeHashMap::value_type( nSingleRow, aSingleRange ) );
9706 9 : eState = STATE_COMPLEX;
9707 : // continue normally
9708 : }
9709 :
9710 : // This is called in the order of ScAttrRectIterator results.
9711 : // rNewRange can only be joined with an existing entry if it's the same rows, starting in the next column.
9712 : // If the old entry for the start row extends to a different end row, or ends in a different column, it
9713 : // can be moved to aCompletedRanges because it can't be joined with following iterator results.
9714 : // Everything happens within one sheet, so Tab can be ignored.
9715 :
9716 52 : SCROW nStartRow = rNewRange.aStart.Row();
9717 52 : ScRowRangeHashMap::iterator aIter( aJoinedRanges.find( nStartRow ) ); // find the active entry for the start row
9718 52 : if ( aIter != aJoinedRanges.end() )
9719 : {
9720 43 : ScRange& rOldRange = aIter->second;
9721 54 : if ( rOldRange.aEnd.Row() == rNewRange.aEnd.Row() &&
9722 11 : rOldRange.aEnd.Col() + 1 == rNewRange.aStart.Col() )
9723 : {
9724 : // extend existing range
9725 0 : rOldRange.aEnd.SetCol( rNewRange.aEnd.Col() );
9726 : }
9727 : else
9728 : {
9729 : // move old range to aCompletedRanges, keep rNewRange for joining
9730 43 : aCompletedRanges.push_back( rOldRange );
9731 43 : rOldRange = rNewRange; // replace in hash map
9732 : }
9733 : }
9734 : else
9735 : {
9736 : // keep rNewRange for joining
9737 9 : aJoinedRanges.insert( ScRowRangeHashMap::value_type( nStartRow, rNewRange ) );
9738 : }
9739 : }
9740 :
9741 32 : const ScRangeList& ScUniqueFormatsEntry::GetRanges()
9742 : {
9743 32 : if ( eState == STATE_SINGLE )
9744 : {
9745 23 : aReturnRanges = new ScRangeList;
9746 23 : aReturnRanges->Append( aSingleRange );
9747 23 : return *aReturnRanges;
9748 : }
9749 :
9750 : // move remaining entries from aJoinedRanges to aCompletedRanges
9751 :
9752 9 : ScRowRangeHashMap::const_iterator aJoinedEnd = aJoinedRanges.end();
9753 27 : for ( ScRowRangeHashMap::const_iterator aJoinedIter = aJoinedRanges.begin(); aJoinedIter != aJoinedEnd; ++aJoinedIter )
9754 18 : aCompletedRanges.push_back( aJoinedIter->second );
9755 9 : aJoinedRanges.clear();
9756 :
9757 : // sort all ranges for a predictable API result
9758 :
9759 9 : std::sort( aCompletedRanges.begin(), aCompletedRanges.end() );
9760 :
9761 : // fill and return ScRangeList
9762 :
9763 9 : aReturnRanges = new ScRangeList;
9764 9 : ScRangeVector::const_iterator aCompEnd( aCompletedRanges.end() );
9765 70 : for ( ScRangeVector::const_iterator aCompIter( aCompletedRanges.begin() ); aCompIter != aCompEnd; ++aCompIter )
9766 61 : aReturnRanges->Append( *aCompIter );
9767 9 : aCompletedRanges.clear();
9768 :
9769 9 : return *aReturnRanges;
9770 : }
9771 :
9772 : typedef ::boost::unordered_map< const ScPatternAttr*, ScUniqueFormatsEntry, ScPatternHashCode > ScUniqueFormatsHashMap;
9773 :
9774 : // function object to sort the range lists by start of first range
9775 : struct ScUniqueFormatsOrder
9776 : {
9777 27 : bool operator()( const ScRangeList& rList1, const ScRangeList& rList2 ) const
9778 : {
9779 : // all range lists have at least one entry
9780 : OSL_ENSURE( rList1.size() > 0 && rList2.size() > 0, "ScUniqueFormatsOrder: empty list" );
9781 :
9782 : // compare start positions using ScAddress comparison operator
9783 27 : return ( rList1[ 0 ]->aStart < rList2[ 0 ]->aStart );
9784 : }
9785 : };
9786 :
9787 12 : void ScUniqueCellFormatsObj::GetObjects_Impl()
9788 : {
9789 12 : if (pDocShell)
9790 : {
9791 12 : ScDocument* pDoc = pDocShell->GetDocument();
9792 12 : SCTAB nTab = aTotalRange.aStart.Tab();
9793 : ScAttrRectIterator aIter( pDoc, nTab,
9794 12 : aTotalRange.aStart.Col(), aTotalRange.aStart.Row(),
9795 24 : aTotalRange.aEnd.Col(), aTotalRange.aEnd.Row() );
9796 : SCCOL nCol1, nCol2;
9797 : SCROW nRow1, nRow2;
9798 :
9799 : // Collect the ranges for each format in a hash map, to avoid nested loops
9800 :
9801 24 : ScUniqueFormatsHashMap aHashMap;
9802 114 : while (aIter.GetNext( nCol1, nCol2, nRow1, nRow2 ) )
9803 : {
9804 90 : ScRange aRange( nCol1, nRow1, nTab, nCol2, nRow2, nTab );
9805 90 : const ScPatternAttr* pPattern = pDoc->GetPattern(nCol1, nRow1, nTab);
9806 90 : aHashMap[pPattern].Join( aRange );
9807 : }
9808 :
9809 : // Fill the vector aRangeLists with the range lists from the hash map
9810 :
9811 12 : aRangeLists.reserve( aHashMap.size() );
9812 12 : ScUniqueFormatsHashMap::iterator aMapIter( aHashMap.begin() );
9813 12 : ScUniqueFormatsHashMap::iterator aMapEnd( aHashMap.end() );
9814 56 : while ( aMapIter != aMapEnd )
9815 : {
9816 32 : ScUniqueFormatsEntry& rEntry = aMapIter->second;
9817 32 : const ScRangeList& rRanges = rEntry.GetRanges();
9818 32 : aRangeLists.push_back( rRanges ); // copy ScRangeList
9819 32 : rEntry.Clear(); // free memory, don't hold both copies of all ranges
9820 32 : ++aMapIter;
9821 : }
9822 :
9823 : // Sort the vector by first range's start position, to avoid random shuffling
9824 : // due to using the ScPatterAttr pointers
9825 :
9826 : ScUniqueFormatsOrder aComp;
9827 24 : ::std::sort( aRangeLists.begin(), aRangeLists.end(), aComp );
9828 : }
9829 12 : }
9830 :
9831 : // XIndexAccess
9832 :
9833 11 : sal_Int32 SAL_CALL ScUniqueCellFormatsObj::getCount() throw(uno::RuntimeException)
9834 : {
9835 11 : SolarMutexGuard aGuard;
9836 :
9837 11 : return aRangeLists.size();
9838 : }
9839 :
9840 28 : uno::Any SAL_CALL ScUniqueCellFormatsObj::getByIndex( sal_Int32 nIndex )
9841 : throw(lang::IndexOutOfBoundsException,
9842 : lang::WrappedTargetException, uno::RuntimeException)
9843 : {
9844 28 : SolarMutexGuard aGuard;
9845 :
9846 28 : if(static_cast<sal_uInt32>(nIndex) < aRangeLists.size())
9847 54 : return uno::makeAny(uno::Reference<sheet::XSheetCellRangeContainer>(new ScCellRangesObj(pDocShell, aRangeLists[nIndex])));
9848 : else
9849 27 : throw lang::IndexOutOfBoundsException();
9850 : }
9851 :
9852 1 : uno::Type SAL_CALL ScUniqueCellFormatsObj::getElementType() throw(uno::RuntimeException)
9853 : {
9854 1 : SolarMutexGuard aGuard;
9855 1 : return getCppuType((uno::Reference<sheet::XSheetCellRangeContainer>*)0);
9856 : }
9857 :
9858 1 : sal_Bool SAL_CALL ScUniqueCellFormatsObj::hasElements() throw(uno::RuntimeException)
9859 : {
9860 1 : SolarMutexGuard aGuard;
9861 1 : return ( aRangeLists.size() != 0 );
9862 : }
9863 :
9864 : // XEnumerationAccess
9865 :
9866 2 : uno::Reference<container::XEnumeration> SAL_CALL ScUniqueCellFormatsObj::createEnumeration()
9867 : throw(uno::RuntimeException)
9868 : {
9869 2 : SolarMutexGuard aGuard;
9870 2 : if (pDocShell)
9871 2 : return new ScUniqueCellFormatsEnumeration( pDocShell, aRangeLists );
9872 0 : return NULL;
9873 : }
9874 :
9875 : //------------------------------------------------------------------------
9876 :
9877 2 : ScUniqueCellFormatsEnumeration::ScUniqueCellFormatsEnumeration(ScDocShell* pDocSh, const ScMyRangeLists& rRangeLists) :
9878 : aRangeLists(rRangeLists),
9879 : pDocShell( pDocSh ),
9880 2 : nCurrentPosition(0)
9881 : {
9882 2 : pDocShell->GetDocument()->AddUnoObject(*this);
9883 2 : }
9884 :
9885 6 : ScUniqueCellFormatsEnumeration::~ScUniqueCellFormatsEnumeration()
9886 : {
9887 2 : if (pDocShell)
9888 0 : pDocShell->GetDocument()->RemoveUnoObject(*this);
9889 4 : }
9890 :
9891 2 : void ScUniqueCellFormatsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint )
9892 : {
9893 2 : if ( rHint.ISA( ScUpdateRefHint ) )
9894 : {
9895 : //! und nun ???
9896 : }
9897 2 : else if ( rHint.ISA( SfxSimpleHint ) )
9898 : {
9899 2 : sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId();
9900 2 : if ( nId == SFX_HINT_DYING )
9901 2 : pDocShell = NULL; // ungueltig geworden
9902 : }
9903 2 : }
9904 :
9905 : // XEnumeration
9906 :
9907 10 : sal_Bool SAL_CALL ScUniqueCellFormatsEnumeration::hasMoreElements() throw(uno::RuntimeException)
9908 : {
9909 10 : SolarMutexGuard aGuard;
9910 10 : return static_cast<sal_uInt32>(nCurrentPosition) < aRangeLists.size();
9911 : }
9912 :
9913 5 : uno::Any SAL_CALL ScUniqueCellFormatsEnumeration::nextElement() throw(container::NoSuchElementException,
9914 : lang::WrappedTargetException, uno::RuntimeException)
9915 : {
9916 5 : SolarMutexGuard aGuard;
9917 :
9918 5 : if ( !hasMoreElements() || !pDocShell )
9919 1 : throw container::NoSuchElementException(); // no more elements
9920 :
9921 : // Interface-Typ muss zu ScCellFormatsObj::getElementType passen
9922 :
9923 4 : return uno::makeAny(uno::Reference<sheet::XSheetCellRangeContainer>(new ScCellRangesObj(pDocShell, aRangeLists[nCurrentPosition++])));
9924 93 : }
9925 :
9926 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|