1b3f79822SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3b3f79822SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4b3f79822SAndrew Rist * or more contributor license agreements. See the NOTICE file
5b3f79822SAndrew Rist * distributed with this work for additional information
6b3f79822SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7b3f79822SAndrew Rist * to you under the Apache License, Version 2.0 (the
8b3f79822SAndrew Rist * "License"); you may not use this file except in compliance
9b3f79822SAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11b3f79822SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13b3f79822SAndrew Rist * Unless required by applicable law or agreed to in writing,
14b3f79822SAndrew Rist * software distributed under the License is distributed on an
15b3f79822SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16b3f79822SAndrew Rist * KIND, either express or implied. See the License for the
17b3f79822SAndrew Rist * specific language governing permissions and limitations
18b3f79822SAndrew Rist * under the License.
19cdf0e10cSrcweir *
20b3f79822SAndrew Rist *************************************************************/
21b3f79822SAndrew Rist
22b3f79822SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sc.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir
28cdf0e10cSrcweir #include "scitems.hxx"
29cdf0e10cSrcweir #include <editeng/eeitem.hxx>
30cdf0e10cSrcweir #include <svx/svdpool.hxx>
31cdf0e10cSrcweir
32cdf0e10cSrcweir #include <svx/algitem.hxx>
33cdf0e10cSrcweir #include <editeng/boxitem.hxx>
34cdf0e10cSrcweir #include <editeng/brshitem.hxx>
35cdf0e10cSrcweir #include <editeng/editeng.hxx>
36cdf0e10cSrcweir #include <editeng/flditem.hxx>
37cdf0e10cSrcweir #include <svx/fmdpage.hxx>
38cdf0e10cSrcweir #include <editeng/langitem.hxx>
39cdf0e10cSrcweir #include <sfx2/linkmgr.hxx>
40cdf0e10cSrcweir #include <svl/srchitem.hxx>
41cdf0e10cSrcweir #include <svx/unomid.hxx>
42cdf0e10cSrcweir #include <editeng/unoprnms.hxx>
43cdf0e10cSrcweir #include <editeng/unotext.hxx>
44cdf0e10cSrcweir #include <svx/svdpage.hxx>
45cdf0e10cSrcweir #include <sfx2/bindings.hxx>
46cdf0e10cSrcweir #include <svl/zforlist.hxx>
47cdf0e10cSrcweir #include <svl/zformat.hxx>
48cdf0e10cSrcweir #include <rtl/uuid.h>
49cdf0e10cSrcweir #include <float.h> // DBL_MIN
50cdf0e10cSrcweir
51cdf0e10cSrcweir #include <com/sun/star/awt/XBitmap.hpp>
52cdf0e10cSrcweir #include <com/sun/star/util/CellProtection.hpp>
53cdf0e10cSrcweir #include <com/sun/star/table/CellHoriJustify.hpp>
54cdf0e10cSrcweir #include <com/sun/star/table/CellOrientation.hpp>
55cdf0e10cSrcweir #include <com/sun/star/table/CellVertJustify.hpp>
56cdf0e10cSrcweir #include <com/sun/star/table/ShadowFormat.hpp>
57cdf0e10cSrcweir #include <com/sun/star/table/TableBorder.hpp>
58cdf0e10cSrcweir #include <com/sun/star/sheet/CellFlags.hpp>
59cdf0e10cSrcweir #include <com/sun/star/sheet/FormulaResult.hpp>
60cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
61cdf0e10cSrcweir #include <com/sun/star/lang/Locale.hpp>
62cdf0e10cSrcweir #include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
63cdf0e10cSrcweir #include <com/sun/star/beans/SetPropertyTolerantFailed.hpp>
64cdf0e10cSrcweir #include <com/sun/star/text/WritingMode2.hpp>
65cdf0e10cSrcweir
66cdf0e10cSrcweir #include "autoform.hxx"
67cdf0e10cSrcweir #include "cellsuno.hxx"
68cdf0e10cSrcweir #include "cursuno.hxx"
69cdf0e10cSrcweir #include "textuno.hxx"
70cdf0e10cSrcweir #include "editsrc.hxx"
71cdf0e10cSrcweir #include "notesuno.hxx"
72cdf0e10cSrcweir #include "fielduno.hxx"
73cdf0e10cSrcweir #include "docuno.hxx" // ScTableColumnsObj etc
74cdf0e10cSrcweir #include "datauno.hxx"
75cdf0e10cSrcweir #include "dapiuno.hxx"
76cdf0e10cSrcweir #include "chartuno.hxx"
77cdf0e10cSrcweir #include "fmtuno.hxx"
78cdf0e10cSrcweir #include "miscuno.hxx"
79cdf0e10cSrcweir #include "convuno.hxx"
80cdf0e10cSrcweir #include "srchuno.hxx"
81cdf0e10cSrcweir #include "targuno.hxx"
82cdf0e10cSrcweir #include "tokenuno.hxx"
83cdf0e10cSrcweir #include "eventuno.hxx"
84cdf0e10cSrcweir #include "docsh.hxx"
85cdf0e10cSrcweir #include "markdata.hxx"
86cdf0e10cSrcweir #include "patattr.hxx"
87cdf0e10cSrcweir #include "docpool.hxx"
88cdf0e10cSrcweir #include "docfunc.hxx"
89cdf0e10cSrcweir #include "dbdocfun.hxx"
90cdf0e10cSrcweir #include "olinefun.hxx"
91cdf0e10cSrcweir #include "hints.hxx"
92cdf0e10cSrcweir #include "cell.hxx"
93cdf0e10cSrcweir #include "undocell.hxx"
94cdf0e10cSrcweir #include "undotab.hxx"
95cdf0e10cSrcweir #include "undoblk.hxx" // fuer lcl_ApplyBorder - nach docfunc verschieben!
96cdf0e10cSrcweir #include "stlsheet.hxx"
97cdf0e10cSrcweir #include "dbcolect.hxx"
98cdf0e10cSrcweir #include "attrib.hxx"
99cdf0e10cSrcweir #include "chartarr.hxx"
100cdf0e10cSrcweir #include "chartlis.hxx"
101cdf0e10cSrcweir #include "drwlayer.hxx"
102cdf0e10cSrcweir #include "printfun.hxx"
103cdf0e10cSrcweir #include "prnsave.hxx"
104cdf0e10cSrcweir #include "tablink.hxx"
105cdf0e10cSrcweir #include "dociter.hxx"
106cdf0e10cSrcweir #include "rangeutl.hxx"
107cdf0e10cSrcweir #include "conditio.hxx"
108cdf0e10cSrcweir #include "validat.hxx"
109cdf0e10cSrcweir #include "sc.hrc"
110cdf0e10cSrcweir #include "brdcst.hxx"
111cdf0e10cSrcweir #include "unoguard.hxx"
112cdf0e10cSrcweir #include "cellform.hxx"
113cdf0e10cSrcweir #include "globstr.hrc"
114cdf0e10cSrcweir #include "unonames.hxx"
115cdf0e10cSrcweir #include "styleuno.hxx"
116cdf0e10cSrcweir #include "rangeseq.hxx"
117cdf0e10cSrcweir #include "unowids.hxx"
118cdf0e10cSrcweir #include "paramisc.hxx"
119cdf0e10cSrcweir #include "formula/errorcodes.hxx"
120cdf0e10cSrcweir #include "unoreflist.hxx"
121cdf0e10cSrcweir #include "formula/grammar.hxx"
122cdf0e10cSrcweir
123cdf0e10cSrcweir #include <list>
124cdf0e10cSrcweir
125cdf0e10cSrcweir using namespace com::sun::star;
126cdf0e10cSrcweir
127cdf0e10cSrcweir //------------------------------------------------------------------------
128cdf0e10cSrcweir
129cdf0e10cSrcweir
130cdf0e10cSrcweir class ScNamedEntry
131cdf0e10cSrcweir {
132cdf0e10cSrcweir String aName;
133cdf0e10cSrcweir ScRange aRange;
134cdf0e10cSrcweir
135cdf0e10cSrcweir public:
ScNamedEntry(const String & rN,const ScRange & rR)136cdf0e10cSrcweir ScNamedEntry(const String& rN, const ScRange& rR) :
137cdf0e10cSrcweir aName(rN), aRange(rR) {}
138cdf0e10cSrcweir
GetName() const139cdf0e10cSrcweir const String& GetName() const { return aName; }
GetRange() const140cdf0e10cSrcweir const ScRange& GetRange() const { return aRange; }
141cdf0e10cSrcweir };
142cdf0e10cSrcweir
143cdf0e10cSrcweir
144cdf0e10cSrcweir //------------------------------------------------------------------------
145cdf0e10cSrcweir
146cdf0e10cSrcweir // Die Namen in den Maps muessen (nach strcmp) sortiert sein!
147cdf0e10cSrcweir //! statt Which-ID 0 special IDs verwenden, und nicht ueber Namen vergleichen !!!!!!!!!
148cdf0e10cSrcweir
149cdf0e10cSrcweir // Left/Right/Top/BottomBorder are mapped directly to the core items,
150cdf0e10cSrcweir // not collected/applied to the borders of a range -> ATTR_BORDER can be used directly
151cdf0e10cSrcweir
lcl_GetCellsPropertySet()152cdf0e10cSrcweir const SfxItemPropertySet* lcl_GetCellsPropertySet()
153cdf0e10cSrcweir {
154cdf0e10cSrcweir static SfxItemPropertyMapEntry aCellsPropertyMap_Impl[] =
155cdf0e10cSrcweir {
156cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ABSNAME), SC_WID_UNO_ABSNAME, &getCppuType((rtl::OUString*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
157cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(), 0, 0 },
158cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
159cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND, &getCppuType((sal_Int32*)0), 0, MID_BACK_COLOR },
160cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLPRO), ATTR_PROTECTION, &getCppuType((util::CellProtection*)0), 0, 0 },
161cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL), SC_WID_UNO_CELLSTYL,&getCppuType((rtl::OUString*)0), 0, 0 },
162cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CCOLOR), ATTR_FONT_COLOR, &getCppuType((sal_Int32*)0), 0, 0 },
163cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COUTL), ATTR_FONT_CONTOUR, &getBooleanCppuType(), 0, 0 },
164cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CCROSS), ATTR_FONT_CROSSEDOUT,&getBooleanCppuType(), 0, MID_CROSSED_OUT },
165cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS), ATTR_FONT_EMPHASISMARK,&getCppuType((sal_Int16*)0), 0, MID_EMPHASIS },
166cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFONT), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
167cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFCHARS), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
168cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
169cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
170cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
171cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
172cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
173cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFNAME), ATTR_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },
174cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME), ATTR_CJK_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },
175cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME), ATTR_CTL_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },
176cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFPITCH), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
177cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
178cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
179cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE), ATTR_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_STYLE_NAME },
180cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE), ATTR_CJK_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_STYLE_NAME },
181cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE), ATTR_CTL_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_STYLE_NAME },
182cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT), ATTR_FONT_HEIGHT, &getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
183cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT), ATTR_CJK_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
184cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT), ATTR_CTL_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
185cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CLOCAL), ATTR_FONT_LANGUAGE, &getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
186cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL), ATTR_CJK_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
187cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL), ATTR_CTL_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
188cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COVER), ATTR_FONT_OVERLINE, &getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
189cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL), ATTR_FONT_OVERLINE, &getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
190cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS), ATTR_FONT_OVERLINE, &getBooleanCppuType(), 0, MID_TL_HASCOLOR },
191cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CPOST), ATTR_FONT_POSTURE, &getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
192cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CPOST), ATTR_CJK_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
193cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CPOST), ATTR_CTL_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
194cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CRELIEF), ATTR_FONT_RELIEF, &getCppuType((sal_Int16*)0), 0, MID_RELIEF },
195cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CSHADD), ATTR_FONT_SHADOWED, &getBooleanCppuType(), 0, 0 },
196cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE), ATTR_FONT_CROSSEDOUT,&getCppuType((sal_Int16*)0), 0, MID_CROSS_OUT },
197cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CUNDER), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
198cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
199cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS), ATTR_FONT_UNDERLINE,&getBooleanCppuType(), 0, MID_TL_HASCOLOR },
200cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT), ATTR_FONT_WEIGHT, &getCppuType((float*)0), 0, MID_WEIGHT },
201cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT), ATTR_CJK_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
202cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT), ATTR_CTL_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
203cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD), ATTR_FONT_WORDLINE, &getBooleanCppuType(), 0, 0 },
204cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR), SC_WID_UNO_CHCOLHDR,&getBooleanCppuType(), 0, 0 },
205cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR), SC_WID_UNO_CHROWHDR,&getBooleanCppuType(), 0, 0 },
206cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CONDFMT), SC_WID_UNO_CONDFMT, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
207cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CONDLOC), SC_WID_UNO_CONDLOC, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
208cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CONDXML), SC_WID_UNO_CONDXML, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
209cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
210cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
211cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS), ATTR_HOR_JUSTIFY, &getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
212cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND, &getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
213cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_WRAP), ATTR_LINEBREAK, &getBooleanCppuType(), 0, 0 },
214cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
215cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_NUMFMT), ATTR_VALUE_FORMAT, &getCppuType((sal_Int32*)0), 0, 0 },
216cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_NUMRULES), SC_WID_UNO_NUMRULES,&getCppuType((const uno::Reference<container::XIndexReplace>*)0), 0, 0 },
217cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLORI), ATTR_STACKED, &getCppuType((table::CellOrientation*)0), 0, 0 },
218cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PADJUST), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
219cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
220cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PINDENT), ATTR_INDENT, &getCppuType((sal_Int16*)0), 0, 0 }, //! CONVERT_TWIPS
221cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST),ATTR_SCRIPTSPACE, &getBooleanCppuType(), 0, 0 },
222cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISFORBID),ATTR_FORBIDDEN_RULES,&getBooleanCppuType(), 0, 0 },
223cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISHANG), ATTR_HANGPUNCTUATION,&getBooleanCppuType(), 0, 0 },
224cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN),ATTR_HYPHENATE, &getBooleanCppuType(), 0, 0 },
225cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
226cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_L_MARGIN | CONVERT_TWIPS },
227cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_R_MARGIN | CONVERT_TWIPS },
228cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
229cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
230cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ROTANG), ATTR_ROTATE_VALUE, &getCppuType((sal_Int32*)0), 0, 0 },
231cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ROTREF), ATTR_ROTATE_MODE, &getCppuType((table::CellVertJustify*)0), 0, 0 },
232cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_SHADOW), ATTR_SHADOW, &getCppuType((table::ShadowFormat*)0), 0, 0 | CONVERT_TWIPS },
233cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(), 0, 0 },
234cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_TBLBORD), SC_WID_UNO_TBLBORD, &getCppuType((table::TableBorder*)0), 0, 0 | CONVERT_TWIPS },
235cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
236cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_USERDEF), ATTR_USERDEF, &getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
237cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_VALIDAT), SC_WID_UNO_VALIDAT, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
238cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_VALILOC), SC_WID_UNO_VALILOC, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
239cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_VALIXML), SC_WID_UNO_VALIXML, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
240cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY, &getCppuType((table::CellVertJustify*)0), 0, 0 },
241cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
242cdf0e10cSrcweir {0,0,0,0,0,0}
243cdf0e10cSrcweir };
244cdf0e10cSrcweir static SfxItemPropertySet aCellsPropertySet( aCellsPropertyMap_Impl );
245cdf0e10cSrcweir return &aCellsPropertySet;
246cdf0e10cSrcweir }
247cdf0e10cSrcweir
248cdf0e10cSrcweir // CellRange enthaelt alle Eintraege von Cells, zusaetzlich eigene Eintraege
249cdf0e10cSrcweir // mit Which-ID 0 (werden nur fuer getPropertySetInfo benoetigt).
250cdf0e10cSrcweir
lcl_GetRangePropertySet()251cdf0e10cSrcweir const SfxItemPropertySet* lcl_GetRangePropertySet()
252cdf0e10cSrcweir {
253cdf0e10cSrcweir static SfxItemPropertyMapEntry aRangePropertyMap_Impl[] =
254cdf0e10cSrcweir {
255cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ABSNAME), SC_WID_UNO_ABSNAME, &getCppuType((rtl::OUString*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
256cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(), 0, 0 },
257cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
258cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND, &getCppuType((sal_Int32*)0), 0, MID_BACK_COLOR },
259cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLPRO), ATTR_PROTECTION, &getCppuType((util::CellProtection*)0), 0, 0 },
260cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL), SC_WID_UNO_CELLSTYL,&getCppuType((rtl::OUString*)0), 0, 0 },
261cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CCOLOR), ATTR_FONT_COLOR, &getCppuType((sal_Int32*)0), 0, 0 },
262cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COUTL), ATTR_FONT_CONTOUR, &getBooleanCppuType(), 0, 0 },
263cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CCROSS), ATTR_FONT_CROSSEDOUT,&getBooleanCppuType(), 0, MID_CROSSED_OUT },
264cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS), ATTR_FONT_EMPHASISMARK,&getCppuType((sal_Int16*)0), 0, MID_EMPHASIS },
265cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFONT), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
266cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFCHARS), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
267cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
268cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
269cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
270cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
271cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
272cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFNAME), ATTR_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },
273cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME), ATTR_CJK_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },
274cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME), ATTR_CTL_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },
275cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFPITCH), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
276cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
277cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
278cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE), ATTR_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_STYLE_NAME },
279cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE), ATTR_CJK_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_STYLE_NAME },
280cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE), ATTR_CTL_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_STYLE_NAME },
281cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT), ATTR_FONT_HEIGHT, &getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
282cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT), ATTR_CJK_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
283cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT), ATTR_CTL_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
284cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CLOCAL), ATTR_FONT_LANGUAGE, &getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
285cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL), ATTR_CJK_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
286cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL), ATTR_CTL_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
287cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COVER), ATTR_FONT_OVERLINE, &getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
288cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL), ATTR_FONT_OVERLINE, &getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
289cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS), ATTR_FONT_OVERLINE, &getBooleanCppuType(), 0, MID_TL_HASCOLOR },
290cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CPOST), ATTR_FONT_POSTURE, &getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
291cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CPOST), ATTR_CJK_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
292cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CPOST), ATTR_CTL_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
293cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CRELIEF), ATTR_FONT_RELIEF, &getCppuType((sal_Int16*)0), 0, MID_RELIEF },
294cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CSHADD), ATTR_FONT_SHADOWED, &getBooleanCppuType(), 0, 0 },
295cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE), ATTR_FONT_CROSSEDOUT,&getCppuType((sal_Int16*)0), 0, MID_CROSS_OUT },
296cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CUNDER), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
297cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
298cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS), ATTR_FONT_UNDERLINE,&getBooleanCppuType(), 0, MID_TL_HASCOLOR },
299cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT), ATTR_FONT_WEIGHT, &getCppuType((float*)0), 0, MID_WEIGHT },
300cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT), ATTR_CJK_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
301cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT), ATTR_CTL_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
302cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD), ATTR_FONT_WORDLINE, &getBooleanCppuType(), 0, 0 },
303cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR), SC_WID_UNO_CHCOLHDR,&getBooleanCppuType(), 0, 0 },
304cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR), SC_WID_UNO_CHROWHDR,&getBooleanCppuType(), 0, 0 },
305cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CONDFMT), SC_WID_UNO_CONDFMT, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
306cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CONDLOC), SC_WID_UNO_CONDLOC, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
307cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CONDXML), SC_WID_UNO_CONDXML, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
308cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
309cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
310cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS), ATTR_HOR_JUSTIFY, &getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
311cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND, &getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
312cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_WRAP), ATTR_LINEBREAK, &getBooleanCppuType(), 0, 0 },
313cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
314cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_NUMFMT), ATTR_VALUE_FORMAT, &getCppuType((sal_Int32*)0), 0, 0 },
315cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_NUMRULES), SC_WID_UNO_NUMRULES,&getCppuType((const uno::Reference<container::XIndexReplace>*)0), 0, 0 },
316cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLORI), ATTR_STACKED, &getCppuType((table::CellOrientation*)0), 0, 0 },
317cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PADJUST), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
318cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
319cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PINDENT), ATTR_INDENT, &getCppuType((sal_Int16*)0), 0, 0 }, //! CONVERT_TWIPS
320cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST),ATTR_SCRIPTSPACE, &getBooleanCppuType(), 0, 0 },
321cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISFORBID),ATTR_FORBIDDEN_RULES,&getBooleanCppuType(), 0, 0 },
322cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISHANG), ATTR_HANGPUNCTUATION,&getBooleanCppuType(), 0, 0 },
323cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN),ATTR_HYPHENATE, &getBooleanCppuType(), 0, 0 },
324cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
325cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_L_MARGIN | CONVERT_TWIPS },
326cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_R_MARGIN | CONVERT_TWIPS },
327cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
328cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_POS), SC_WID_UNO_POS, &getCppuType((awt::Point*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
329cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
330cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ROTANG), ATTR_ROTATE_VALUE, &getCppuType((sal_Int32*)0), 0, 0 },
331cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ROTREF), ATTR_ROTATE_MODE, &getCppuType((table::CellVertJustify*)0), 0, 0 },
332cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_SHADOW), ATTR_SHADOW, &getCppuType((table::ShadowFormat*)0), 0, 0 | CONVERT_TWIPS },
333cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(), 0, 0 },
334cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_SIZE), SC_WID_UNO_SIZE, &getCppuType((awt::Size*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
335cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_TBLBORD), SC_WID_UNO_TBLBORD, &getCppuType((table::TableBorder*)0), 0, 0 | CONVERT_TWIPS },
336cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
337cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_USERDEF), ATTR_USERDEF, &getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
338cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_VALIDAT), SC_WID_UNO_VALIDAT, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
339cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_VALILOC), SC_WID_UNO_VALILOC, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
340cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_VALIXML), SC_WID_UNO_VALIXML, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
341cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY, &getCppuType((table::CellVertJustify*)0), 0, 0 },
342cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
343cdf0e10cSrcweir {0,0,0,0,0,0}
344cdf0e10cSrcweir };
345cdf0e10cSrcweir static SfxItemPropertySet aRangePropertySet( aRangePropertyMap_Impl );
346cdf0e10cSrcweir return &aRangePropertySet;
347cdf0e10cSrcweir }
348cdf0e10cSrcweir
349cdf0e10cSrcweir // Cell enthaelt alle Eintraege von CellRange, zusaetzlich eigene Eintraege
350cdf0e10cSrcweir // mit Which-ID 0 (werden nur fuer getPropertySetInfo benoetigt).
351cdf0e10cSrcweir
lcl_GetCellPropertySet()352cdf0e10cSrcweir const SfxItemPropertySet* lcl_GetCellPropertySet()
353cdf0e10cSrcweir {
354cdf0e10cSrcweir static SfxItemPropertyMapEntry aCellPropertyMap_Impl[] =
355cdf0e10cSrcweir {
356cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ABSNAME), SC_WID_UNO_ABSNAME, &getCppuType((rtl::OUString*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
357cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(), 0, 0 },
358cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
359cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND, &getCppuType((sal_Int32*)0), 0, MID_BACK_COLOR },
360cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLPRO), ATTR_PROTECTION, &getCppuType((util::CellProtection*)0), 0, 0 },
361cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL), SC_WID_UNO_CELLSTYL,&getCppuType((rtl::OUString*)0), 0, 0 },
362cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CCOLOR), ATTR_FONT_COLOR, &getCppuType((sal_Int32*)0), 0, 0 },
363cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COUTL), ATTR_FONT_CONTOUR, &getBooleanCppuType(), 0, 0 },
364cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CCROSS), ATTR_FONT_CROSSEDOUT,&getBooleanCppuType(), 0, MID_CROSSED_OUT },
365cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS), ATTR_FONT_EMPHASISMARK,&getCppuType((sal_Int16*)0), 0, MID_EMPHASIS },
366cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFONT), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
367cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFCHARS), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
368cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
369cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
370cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
371cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
372cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
373cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFNAME), ATTR_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },
374cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME), ATTR_CJK_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },
375cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME), ATTR_CTL_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },
376cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFPITCH), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
377cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
378cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
379cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE), ATTR_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_STYLE_NAME },
380cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE), ATTR_CJK_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_STYLE_NAME },
381cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE), ATTR_CTL_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_STYLE_NAME },
382cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT), ATTR_FONT_HEIGHT, &getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
383cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT), ATTR_CJK_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
384cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT), ATTR_CTL_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
385cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CLOCAL), ATTR_FONT_LANGUAGE, &getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
386cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL), ATTR_CJK_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
387cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL), ATTR_CTL_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
388cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COVER), ATTR_FONT_OVERLINE, &getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
389cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL), ATTR_FONT_OVERLINE, &getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
390cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS), ATTR_FONT_OVERLINE, &getBooleanCppuType(), 0, MID_TL_HASCOLOR },
391cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CPOST), ATTR_FONT_POSTURE, &getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
392cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CPOST), ATTR_CJK_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
393cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CPOST), ATTR_CTL_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
394cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CRELIEF), ATTR_FONT_RELIEF, &getCppuType((sal_Int16*)0), 0, MID_RELIEF },
395cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CSHADD), ATTR_FONT_SHADOWED, &getBooleanCppuType(), 0, 0 },
396cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE), ATTR_FONT_CROSSEDOUT,&getCppuType((sal_Int16*)0), 0, MID_CROSS_OUT },
397cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CUNDER), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
398cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
399cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS), ATTR_FONT_UNDERLINE,&getBooleanCppuType(), 0, MID_TL_HASCOLOR },
400cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT), ATTR_FONT_WEIGHT, &getCppuType((float*)0), 0, MID_WEIGHT },
401cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT), ATTR_CJK_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
402cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT), ATTR_CTL_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
403cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD), ATTR_FONT_WORDLINE, &getBooleanCppuType(), 0, 0 },
404cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR), SC_WID_UNO_CHCOLHDR,&getBooleanCppuType(), 0, 0 },
405cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR), SC_WID_UNO_CHROWHDR,&getBooleanCppuType(), 0, 0 },
406cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CONDFMT), SC_WID_UNO_CONDFMT, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
407cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CONDLOC), SC_WID_UNO_CONDLOC, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
408cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CONDXML), SC_WID_UNO_CONDXML, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
409cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
410cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
411cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_FORMLOC), SC_WID_UNO_FORMLOC, &getCppuType((rtl::OUString*)0), 0, 0 },
412cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_FORMRT), SC_WID_UNO_FORMRT, &getCppuType((table::CellContentType*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
413cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS), ATTR_HOR_JUSTIFY, &getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
414cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND, &getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
415cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_WRAP), ATTR_LINEBREAK, &getBooleanCppuType(), 0, 0 },
416cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
417cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_NUMFMT), ATTR_VALUE_FORMAT, &getCppuType((sal_Int32*)0), 0, 0 },
418cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_NUMRULES), SC_WID_UNO_NUMRULES,&getCppuType((const uno::Reference<container::XIndexReplace>*)0), 0, 0 },
419cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLORI), ATTR_STACKED, &getCppuType((table::CellOrientation*)0), 0, 0 },
420cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PADJUST), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
421cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
422cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PINDENT), ATTR_INDENT, &getCppuType((sal_Int16*)0), 0, 0 }, //! CONVERT_TWIPS
423cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST),ATTR_SCRIPTSPACE, &getBooleanCppuType(), 0, 0 },
424cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISFORBID),ATTR_FORBIDDEN_RULES,&getBooleanCppuType(), 0, 0 },
425cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISHANG), ATTR_HANGPUNCTUATION,&getBooleanCppuType(), 0, 0 },
426cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN),ATTR_HYPHENATE, &getBooleanCppuType(), 0, 0 },
427cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
428cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_L_MARGIN | CONVERT_TWIPS },
429cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_R_MARGIN | CONVERT_TWIPS },
430cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
431cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_POS), SC_WID_UNO_POS, &getCppuType((awt::Point*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
432cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
433cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ROTANG), ATTR_ROTATE_VALUE, &getCppuType((sal_Int32*)0), 0, 0 },
434cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ROTREF), ATTR_ROTATE_MODE, &getCppuType((table::CellVertJustify*)0), 0, 0 },
435cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_SHADOW), ATTR_SHADOW, &getCppuType((table::ShadowFormat*)0), 0, 0 | CONVERT_TWIPS },
436cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(), 0, 0 },
437cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_SIZE), SC_WID_UNO_SIZE, &getCppuType((awt::Size*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
438cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_TBLBORD), SC_WID_UNO_TBLBORD, &getCppuType((table::TableBorder*)0), 0, 0 | CONVERT_TWIPS },
439cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
440cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_USERDEF), ATTR_USERDEF, &getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
441cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_VALIDAT), SC_WID_UNO_VALIDAT, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
442cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_VALILOC), SC_WID_UNO_VALILOC, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
443cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_VALIXML), SC_WID_UNO_VALIXML, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
444cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY, &getCppuType((table::CellVertJustify*)0), 0, 0 },
445cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
446cdf0e10cSrcweir {0,0,0,0,0,0}
447cdf0e10cSrcweir };
448cdf0e10cSrcweir static SfxItemPropertySet aCellPropertySet( aCellPropertyMap_Impl );
449cdf0e10cSrcweir return &aCellPropertySet;
450cdf0e10cSrcweir }
451cdf0e10cSrcweir
452cdf0e10cSrcweir // Column und Row enthalten alle Eintraege von CellRange, zusaetzlich eigene Eintraege
453cdf0e10cSrcweir // mit Which-ID 0 (werden nur fuer getPropertySetInfo benoetigt).
454cdf0e10cSrcweir
lcl_GetColumnPropertySet()455cdf0e10cSrcweir const SfxItemPropertySet* lcl_GetColumnPropertySet()
456cdf0e10cSrcweir {
457cdf0e10cSrcweir static SfxItemPropertyMapEntry aColumnPropertyMap_Impl[] =
458cdf0e10cSrcweir {
459cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ABSNAME), SC_WID_UNO_ABSNAME, &getCppuType((rtl::OUString*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
460cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(), 0, 0 },
461cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
462cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND, &getCppuType((sal_Int32*)0), 0, MID_BACK_COLOR },
463cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLPRO), ATTR_PROTECTION, &getCppuType((util::CellProtection*)0), 0, 0 },
464cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL), SC_WID_UNO_CELLSTYL,&getCppuType((rtl::OUString*)0), 0, 0 },
465cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CCOLOR), ATTR_FONT_COLOR, &getCppuType((sal_Int32*)0), 0, 0 },
466cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COUTL), ATTR_FONT_CONTOUR, &getBooleanCppuType(), 0, 0 },
467cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CCROSS), ATTR_FONT_CROSSEDOUT,&getBooleanCppuType(), 0, MID_CROSSED_OUT },
468cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS), ATTR_FONT_EMPHASISMARK,&getCppuType((sal_Int16*)0), 0, MID_EMPHASIS },
469cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFONT), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
470cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFCHARS), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
471cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
472cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
473cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
474cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
475cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
476cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFNAME), ATTR_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },
477cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME), ATTR_CJK_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },
478cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME), ATTR_CTL_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },
479cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFPITCH), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
480cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
481cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
482cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE), ATTR_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_STYLE_NAME },
483cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE), ATTR_CJK_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_STYLE_NAME },
484cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE), ATTR_CTL_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_STYLE_NAME },
485cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT), ATTR_FONT_HEIGHT, &getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
486cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT), ATTR_CJK_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
487cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT), ATTR_CTL_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
488cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CLOCAL), ATTR_FONT_LANGUAGE, &getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
489cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL), ATTR_CJK_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
490cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL), ATTR_CTL_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
491cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COVER), ATTR_FONT_OVERLINE, &getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
492cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL), ATTR_FONT_OVERLINE, &getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
493cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS), ATTR_FONT_OVERLINE, &getBooleanCppuType(), 0, MID_TL_HASCOLOR },
494cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CPOST), ATTR_FONT_POSTURE, &getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
495cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CPOST), ATTR_CJK_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
496cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CPOST), ATTR_CTL_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
497cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CRELIEF), ATTR_FONT_RELIEF, &getCppuType((sal_Int16*)0), 0, MID_RELIEF },
498cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CSHADD), ATTR_FONT_SHADOWED, &getBooleanCppuType(), 0, 0 },
499cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE), ATTR_FONT_CROSSEDOUT,&getCppuType((sal_Int16*)0), 0, MID_CROSS_OUT },
500cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CUNDER), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
501cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
502cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS), ATTR_FONT_UNDERLINE,&getBooleanCppuType(), 0, MID_TL_HASCOLOR },
503cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT), ATTR_FONT_WEIGHT, &getCppuType((float*)0), 0, MID_WEIGHT },
504cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT), ATTR_CJK_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
505cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT), ATTR_CTL_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
506cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD), ATTR_FONT_WORDLINE, &getBooleanCppuType(), 0, 0 },
507cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR), SC_WID_UNO_CHCOLHDR,&getBooleanCppuType(), 0, 0 },
508cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR), SC_WID_UNO_CHROWHDR,&getBooleanCppuType(), 0, 0 },
509cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CONDFMT), SC_WID_UNO_CONDFMT, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
510cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CONDLOC), SC_WID_UNO_CONDLOC, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
511cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CONDXML), SC_WID_UNO_CONDXML, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
512cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
513cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
514cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS), ATTR_HOR_JUSTIFY, &getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
515cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND, &getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
516cdf0e10cSrcweir // {MAP_CHAR_LEN(SC_UNONAME_CELLFILT), SC_WID_UNO_CELLFILT,&getBooleanCppuType(), 0, 0 },
517cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_MANPAGE), SC_WID_UNO_MANPAGE, &getBooleanCppuType(), 0, 0 },
518cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_NEWPAGE), SC_WID_UNO_NEWPAGE, &getBooleanCppuType(), 0, 0 },
519cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_WRAP), ATTR_LINEBREAK, &getBooleanCppuType(), 0, 0 },
520cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLVIS), SC_WID_UNO_CELLVIS, &getBooleanCppuType(), 0, 0 },
521cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
522cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_NUMFMT), ATTR_VALUE_FORMAT, &getCppuType((sal_Int32*)0), 0, 0 },
523cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_NUMRULES), SC_WID_UNO_NUMRULES,&getCppuType((const uno::Reference<container::XIndexReplace>*)0), 0, 0 },
524cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_OWIDTH), SC_WID_UNO_OWIDTH, &getBooleanCppuType(), 0, 0 },
525cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLORI), ATTR_STACKED, &getCppuType((table::CellOrientation*)0), 0, 0 },
526cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PADJUST), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
527cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
528cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PINDENT), ATTR_INDENT, &getCppuType((sal_Int16*)0), 0, 0 }, //! CONVERT_TWIPS
529cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST),ATTR_SCRIPTSPACE, &getBooleanCppuType(), 0, 0 },
530cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISFORBID),ATTR_FORBIDDEN_RULES,&getBooleanCppuType(), 0, 0 },
531cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISHANG), ATTR_HANGPUNCTUATION,&getBooleanCppuType(), 0, 0 },
532cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN),ATTR_HYPHENATE, &getBooleanCppuType(), 0, 0 },
533cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
534cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_L_MARGIN | CONVERT_TWIPS },
535cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_R_MARGIN | CONVERT_TWIPS },
536cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
537cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_POS), SC_WID_UNO_POS, &getCppuType((awt::Point*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
538cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
539cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ROTANG), ATTR_ROTATE_VALUE, &getCppuType((sal_Int32*)0), 0, 0 },
540cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ROTREF), ATTR_ROTATE_MODE, &getCppuType((table::CellVertJustify*)0), 0, 0 },
541cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_SHADOW), ATTR_SHADOW, &getCppuType((table::ShadowFormat*)0), 0, 0 | CONVERT_TWIPS },
542cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(), 0, 0 },
543cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_SIZE), SC_WID_UNO_SIZE, &getCppuType((awt::Size*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
544cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_TBLBORD), SC_WID_UNO_TBLBORD, &getCppuType((table::TableBorder*)0), 0, 0 | CONVERT_TWIPS },
545cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
546cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_USERDEF), ATTR_USERDEF, &getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
547cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_VALIDAT), SC_WID_UNO_VALIDAT, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
548cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_VALILOC), SC_WID_UNO_VALILOC, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
549cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_VALIXML), SC_WID_UNO_VALIXML, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
550cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY, &getCppuType((table::CellVertJustify*)0), 0, 0 },
551cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLWID), SC_WID_UNO_CELLWID, &getCppuType((sal_Int32*)0), 0, 0 },
552cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
553cdf0e10cSrcweir {0,0,0,0,0,0}
554cdf0e10cSrcweir };
555cdf0e10cSrcweir static SfxItemPropertySet aColumnPropertySet( aColumnPropertyMap_Impl );
556cdf0e10cSrcweir return &aColumnPropertySet;
557cdf0e10cSrcweir }
558cdf0e10cSrcweir
lcl_GetRowPropertySet()559cdf0e10cSrcweir const SfxItemPropertySet* lcl_GetRowPropertySet()
560cdf0e10cSrcweir {
561cdf0e10cSrcweir static SfxItemPropertyMapEntry aRowPropertyMap_Impl[] =
562cdf0e10cSrcweir {
563cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ABSNAME), SC_WID_UNO_ABSNAME, &getCppuType((rtl::OUString*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
564cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(), 0, 0 },
565cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
566cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND, &getCppuType((sal_Int32*)0), 0, MID_BACK_COLOR },
567cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLPRO), ATTR_PROTECTION, &getCppuType((util::CellProtection*)0), 0, 0 },
568cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL), SC_WID_UNO_CELLSTYL,&getCppuType((rtl::OUString*)0), 0, 0 },
569cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CCOLOR), ATTR_FONT_COLOR, &getCppuType((sal_Int32*)0), 0, 0 },
570cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COUTL), ATTR_FONT_CONTOUR, &getBooleanCppuType(), 0, 0 },
571cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CCROSS), ATTR_FONT_CROSSEDOUT,&getBooleanCppuType(), 0, MID_CROSSED_OUT },
572cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS), ATTR_FONT_EMPHASISMARK,&getCppuType((sal_Int16*)0), 0, MID_EMPHASIS },
573cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFONT), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
574cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFCHARS), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
575cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
576cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
577cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
578cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
579cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
580cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFNAME), ATTR_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },
581cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME), ATTR_CJK_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },
582cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME), ATTR_CTL_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },
583cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFPITCH), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
584cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
585cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
586cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE), ATTR_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_STYLE_NAME },
587cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE), ATTR_CJK_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_STYLE_NAME },
588cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE), ATTR_CTL_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_STYLE_NAME },
589cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT), ATTR_FONT_HEIGHT, &getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
590cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT), ATTR_CJK_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
591cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT), ATTR_CTL_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
592cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CLOCAL), ATTR_FONT_LANGUAGE, &getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
593cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL), ATTR_CJK_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
594cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL), ATTR_CTL_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
595cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COVER), ATTR_FONT_OVERLINE, &getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
596cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL), ATTR_FONT_OVERLINE, &getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
597cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS), ATTR_FONT_OVERLINE, &getBooleanCppuType(), 0, MID_TL_HASCOLOR },
598cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CPOST), ATTR_FONT_POSTURE, &getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
599cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CPOST), ATTR_CJK_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
600cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CPOST), ATTR_CTL_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
601cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CRELIEF), ATTR_FONT_RELIEF, &getCppuType((sal_Int16*)0), 0, MID_RELIEF },
602cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CSHADD), ATTR_FONT_SHADOWED, &getBooleanCppuType(), 0, 0 },
603cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE), ATTR_FONT_CROSSEDOUT,&getCppuType((sal_Int16*)0), 0, MID_CROSS_OUT },
604cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CUNDER), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
605cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
606cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS), ATTR_FONT_UNDERLINE,&getBooleanCppuType(), 0, MID_TL_HASCOLOR },
607cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT), ATTR_FONT_WEIGHT, &getCppuType((float*)0), 0, MID_WEIGHT },
608cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT), ATTR_CJK_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
609cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT), ATTR_CTL_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
610cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD), ATTR_FONT_WORDLINE, &getBooleanCppuType(), 0, 0 },
611cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR), SC_WID_UNO_CHCOLHDR,&getBooleanCppuType(), 0, 0 },
612cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR), SC_WID_UNO_CHROWHDR,&getBooleanCppuType(), 0, 0 },
613cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CONDFMT), SC_WID_UNO_CONDFMT, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
614cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CONDLOC), SC_WID_UNO_CONDLOC, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
615cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CONDXML), SC_WID_UNO_CONDXML, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
616cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
617cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
618cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLHGT), SC_WID_UNO_CELLHGT, &getCppuType((sal_Int32*)0), 0, 0 },
619cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS), ATTR_HOR_JUSTIFY, &getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
620cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND, &getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
621cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLFILT), SC_WID_UNO_CELLFILT,&getBooleanCppuType(), 0, 0 },
622cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_MANPAGE), SC_WID_UNO_MANPAGE, &getBooleanCppuType(), 0, 0 },
623cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_NEWPAGE), SC_WID_UNO_NEWPAGE, &getBooleanCppuType(), 0, 0 },
624cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_WRAP), ATTR_LINEBREAK, &getBooleanCppuType(), 0, 0 },
625cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLVIS), SC_WID_UNO_CELLVIS, &getBooleanCppuType(), 0, 0 },
626cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
627cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_NUMFMT), ATTR_VALUE_FORMAT, &getCppuType((sal_Int32*)0), 0, 0 },
628cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_NUMRULES), SC_WID_UNO_NUMRULES,&getCppuType((const uno::Reference<container::XIndexReplace>*)0), 0, 0 },
629cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_OHEIGHT), SC_WID_UNO_OHEIGHT, &getBooleanCppuType(), 0, 0 },
630cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLORI), ATTR_STACKED, &getCppuType((table::CellOrientation*)0), 0, 0 },
631cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PADJUST), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
632cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
633cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PINDENT), ATTR_INDENT, &getCppuType((sal_Int16*)0), 0, 0 }, //! CONVERT_TWIPS
634cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST),ATTR_SCRIPTSPACE, &getBooleanCppuType(), 0, 0 },
635cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISFORBID),ATTR_FORBIDDEN_RULES,&getBooleanCppuType(), 0, 0 },
636cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISHANG), ATTR_HANGPUNCTUATION,&getBooleanCppuType(), 0, 0 },
637cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN),ATTR_HYPHENATE, &getBooleanCppuType(), 0, 0 },
638cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
639cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_L_MARGIN | CONVERT_TWIPS },
640cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_R_MARGIN | CONVERT_TWIPS },
641cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
642cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_POS), SC_WID_UNO_POS, &getCppuType((awt::Point*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
643cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
644cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ROTANG), ATTR_ROTATE_VALUE, &getCppuType((sal_Int32*)0), 0, 0 },
645cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ROTREF), ATTR_ROTATE_MODE, &getCppuType((table::CellVertJustify*)0), 0, 0 },
646cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_SHADOW), ATTR_SHADOW, &getCppuType((table::ShadowFormat*)0), 0, 0 | CONVERT_TWIPS },
647cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(), 0, 0 },
648cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_SIZE), SC_WID_UNO_SIZE, &getCppuType((awt::Size*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
649cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_TBLBORD), SC_WID_UNO_TBLBORD, &getCppuType((table::TableBorder*)0), 0, 0 | CONVERT_TWIPS },
650cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
651cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_USERDEF), ATTR_USERDEF, &getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
652cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_VALIDAT), SC_WID_UNO_VALIDAT, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
653cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_VALILOC), SC_WID_UNO_VALILOC, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
654cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_VALIXML), SC_WID_UNO_VALIXML, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
655cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY, &getCppuType((table::CellVertJustify*)0), 0, 0 },
656cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
657cdf0e10cSrcweir {0,0,0,0,0,0}
658cdf0e10cSrcweir };
659cdf0e10cSrcweir static SfxItemPropertySet aRowPropertySet( aRowPropertyMap_Impl );
660cdf0e10cSrcweir return &aRowPropertySet;
661cdf0e10cSrcweir }
662cdf0e10cSrcweir
lcl_GetSheetPropertySet()663cdf0e10cSrcweir const SfxItemPropertySet* lcl_GetSheetPropertySet()
664cdf0e10cSrcweir {
665cdf0e10cSrcweir static SfxItemPropertyMapEntry aSheetPropertyMap_Impl[] =
666cdf0e10cSrcweir {
667cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ABSNAME), SC_WID_UNO_ABSNAME, &getCppuType((rtl::OUString*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
668cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(), 0, 0 },
669cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_AUTOPRINT),SC_WID_UNO_AUTOPRINT,&getBooleanCppuType(), 0, 0 },
670cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_BORDCOL), SC_WID_UNO_BORDCOL, &getCppuType((sal_Int32*)0), 0, 0 },
671cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
672cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND, &getCppuType((sal_Int32*)0), 0, MID_BACK_COLOR },
673cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLPRO), ATTR_PROTECTION, &getCppuType((util::CellProtection*)0), 0, 0 },
674cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL), SC_WID_UNO_CELLSTYL,&getCppuType((rtl::OUString*)0), 0, 0 },
675cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CCOLOR), ATTR_FONT_COLOR, &getCppuType((sal_Int32*)0), 0, 0 },
676cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COUTL), ATTR_FONT_CONTOUR, &getBooleanCppuType(), 0, 0 },
677cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CCROSS), ATTR_FONT_CROSSEDOUT,&getBooleanCppuType(), 0, MID_CROSSED_OUT },
678cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS), ATTR_FONT_EMPHASISMARK,&getCppuType((sal_Int16*)0), 0, MID_EMPHASIS },
679cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFONT), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
680cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFCHARS), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
681cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
682cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
683cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
684cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
685cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
686cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFNAME), ATTR_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },
687cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME), ATTR_CJK_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },
688cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME), ATTR_CTL_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },
689cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFPITCH), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
690cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
691cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
692cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE), ATTR_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_STYLE_NAME },
693cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE), ATTR_CJK_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_STYLE_NAME },
694cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE), ATTR_CTL_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_STYLE_NAME },
695cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT), ATTR_FONT_HEIGHT, &getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
696cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT), ATTR_CJK_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
697cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT), ATTR_CTL_FONT_HEIGHT,&getCppuType((float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
698cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CLOCAL), ATTR_FONT_LANGUAGE, &getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
699cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL), ATTR_CJK_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
700cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL), ATTR_CTL_FONT_LANGUAGE,&getCppuType((lang::Locale*)0), 0, MID_LANG_LOCALE },
701cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COVER), ATTR_FONT_OVERLINE, &getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
702cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL), ATTR_FONT_OVERLINE, &getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
703cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS), ATTR_FONT_OVERLINE, &getBooleanCppuType(), 0, MID_TL_HASCOLOR },
704cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CPOST), ATTR_FONT_POSTURE, &getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
705cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CPOST), ATTR_CJK_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
706cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CPOST), ATTR_CTL_FONT_POSTURE,&getCppuType((awt::FontSlant*)0), 0, MID_POSTURE },
707cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CRELIEF), ATTR_FONT_RELIEF, &getCppuType((sal_Int16*)0), 0, MID_RELIEF },
708cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CSHADD), ATTR_FONT_SHADOWED, &getBooleanCppuType(), 0, 0 },
709cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE), ATTR_FONT_CROSSEDOUT,&getCppuType((sal_Int16*)0), 0, MID_CROSS_OUT },
710cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CUNDER), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int16*)0), 0, MID_TL_STYLE },
711cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
712cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS), ATTR_FONT_UNDERLINE,&getBooleanCppuType(), 0, MID_TL_HASCOLOR },
713cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT), ATTR_FONT_WEIGHT, &getCppuType((float*)0), 0, MID_WEIGHT },
714cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT), ATTR_CJK_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
715cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT), ATTR_CTL_FONT_WEIGHT,&getCppuType((float*)0), 0, MID_WEIGHT },
716cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD), ATTR_FONT_WORDLINE, &getBooleanCppuType(), 0, 0 },
717cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR), SC_WID_UNO_CHCOLHDR,&getBooleanCppuType(), 0, 0 },
718cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR), SC_WID_UNO_CHROWHDR,&getBooleanCppuType(), 0, 0 },
719cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CONDFMT), SC_WID_UNO_CONDFMT, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
720cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CONDLOC), SC_WID_UNO_CONDLOC, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
721cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CONDXML), SC_WID_UNO_CONDXML, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
722cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COPYBACK), SC_WID_UNO_COPYBACK,&getBooleanCppuType(), 0, 0 },
723cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COPYFORM), SC_WID_UNO_COPYFORM,&getBooleanCppuType(), 0, 0 },
724cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_COPYSTYL), SC_WID_UNO_COPYSTYL,&getBooleanCppuType(), 0, 0 },
725cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
726cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
727cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS), ATTR_HOR_JUSTIFY, &getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
728cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ISACTIVE), SC_WID_UNO_ISACTIVE,&getBooleanCppuType(), 0, 0 },
729cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND, &getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
730cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_WRAP), ATTR_LINEBREAK, &getBooleanCppuType(), 0, 0 },
731cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLVIS), SC_WID_UNO_CELLVIS, &getBooleanCppuType(), 0, 0 },
732cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
733cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_LINKDISPBIT), SC_WID_UNO_LINKDISPBIT,&getCppuType((uno::Reference<awt::XBitmap>*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
734cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_LINKDISPNAME), SC_WID_UNO_LINKDISPNAME,&getCppuType((rtl::OUString*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
735cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_NUMFMT), ATTR_VALUE_FORMAT, &getCppuType((sal_Int32*)0), 0, 0 },
736cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_NUMRULES), SC_WID_UNO_NUMRULES,&getCppuType((const uno::Reference<container::XIndexReplace>*)0), 0, 0 },
737cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLORI), ATTR_STACKED, &getCppuType((table::CellOrientation*)0), 0, 0 },
738cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PAGESTL), SC_WID_UNO_PAGESTL, &getCppuType((rtl::OUString*)0), 0, 0 },
739cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PADJUST), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
740cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
741cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PINDENT), ATTR_INDENT, &getCppuType((sal_Int16*)0), 0, 0 }, //! CONVERT_TWIPS
742cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST),ATTR_SCRIPTSPACE, &getBooleanCppuType(), 0, 0 },
743cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISFORBID),ATTR_FORBIDDEN_RULES,&getBooleanCppuType(), 0, 0 },
744cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISHANG), ATTR_HANGPUNCTUATION,&getBooleanCppuType(), 0, 0 },
745cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN),ATTR_HYPHENATE, &getBooleanCppuType(), 0, 0 },
746cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
747cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_L_MARGIN | CONVERT_TWIPS },
748cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_R_MARGIN | CONVERT_TWIPS },
749cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN), ATTR_MARGIN, &getCppuType((sal_Int32*)0), 0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
750cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_POS), SC_WID_UNO_POS, &getCppuType((awt::Point*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
751cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PRINTBORD),SC_WID_UNO_PRINTBORD,&getBooleanCppuType(), 0, 0 },
752cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_PROTECT), SC_WID_UNO_PROTECT, &getBooleanCppuType(), 0, 0 },
753cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
754cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ROTANG), ATTR_ROTATE_VALUE, &getCppuType((sal_Int32*)0), 0, 0 },
755cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ROTREF), ATTR_ROTATE_MODE, &getCppuType((table::CellVertJustify*)0), 0, 0 },
756cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_SHADOW), ATTR_SHADOW, &getCppuType((table::ShadowFormat*)0), 0, 0 | CONVERT_TWIPS },
757cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_SHOWBORD), SC_WID_UNO_SHOWBORD,&getBooleanCppuType(), 0, 0 },
758cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(), 0, 0 },
759cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_SIZE), SC_WID_UNO_SIZE, &getCppuType((awt::Size*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
760cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_TBLBORD), SC_WID_UNO_TBLBORD, &getCppuType((table::TableBorder*)0), 0, 0 | CONVERT_TWIPS },
761cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_TABLAYOUT),SC_WID_UNO_TABLAYOUT,&getCppuType((sal_Int16*)0), 0, 0 },
762cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
763cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_USERDEF), ATTR_USERDEF, &getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
764cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_VALIDAT), SC_WID_UNO_VALIDAT, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
765cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_VALILOC), SC_WID_UNO_VALILOC, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
766cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_VALIXML), SC_WID_UNO_VALIXML, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
767cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY, &getCppuType((table::CellVertJustify*)0), 0, 0 },
768cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
769cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_TABCOLOR), SC_WID_UNO_TABCOLOR, &getCppuType((sal_Int32*)0), 0, 0 },
770cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNO_CODENAME), SC_WID_UNO_CODENAME, &getCppuType(static_cast< const rtl::OUString * >(0)), 0, 0},
771cdf0e10cSrcweir {0,0,0,0,0,0}
772cdf0e10cSrcweir };
773cdf0e10cSrcweir static SfxItemPropertySet aSheetPropertySet( aSheetPropertyMap_Impl );
774cdf0e10cSrcweir return &aSheetPropertySet;
775cdf0e10cSrcweir }
776cdf0e10cSrcweir
lcl_GetEditPropertyMap()777cdf0e10cSrcweir const SfxItemPropertyMapEntry* lcl_GetEditPropertyMap()
778cdf0e10cSrcweir {
779cdf0e10cSrcweir static SfxItemPropertyMapEntry aEditPropertyMap_Impl[] =
780cdf0e10cSrcweir {
781cdf0e10cSrcweir SVX_UNOEDIT_CHAR_PROPERTIES,
782cdf0e10cSrcweir SVX_UNOEDIT_FONT_PROPERTIES,
783cdf0e10cSrcweir SVX_UNOEDIT_PARA_PROPERTIES,
784cdf0e10cSrcweir SVX_UNOEDIT_NUMBERING_PROPERTIE, // for completeness of service ParagraphProperties
785cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_TEXTUSER), EE_CHAR_XMLATTRIBS, &getCppuType((const uno::Reference< container::XNameContainer >*)0), 0, 0},
786cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_USERDEF), EE_PARA_XMLATTRIBS, &getCppuType((const uno::Reference< container::XNameContainer >*)0), 0, 0},
787cdf0e10cSrcweir {0,0,0,0,0,0}
788cdf0e10cSrcweir };
789cdf0e10cSrcweir return aEditPropertyMap_Impl;
790cdf0e10cSrcweir }
lcl_GetEditPropertySet()791cdf0e10cSrcweir const SvxItemPropertySet* lcl_GetEditPropertySet()
792cdf0e10cSrcweir {
793cdf0e10cSrcweir static SvxItemPropertySet aEditPropertySet( lcl_GetEditPropertyMap(), SdrObject::GetGlobalDrawObjectItemPool() );
794cdf0e10cSrcweir return &aEditPropertySet;
795cdf0e10cSrcweir }
796cdf0e10cSrcweir
797cdf0e10cSrcweir
798cdf0e10cSrcweir //------------------------------------------------------------------------
799cdf0e10cSrcweir
800cdf0e10cSrcweir //! diese Funktionen in einen allgemeinen Header verschieben
TwipsToHMM(long nTwips)801cdf0e10cSrcweir inline long TwipsToHMM(long nTwips) { return (nTwips * 127 + 36) / 72; }
HMMToTwips(long nHMM)802cdf0e10cSrcweir inline long HMMToTwips(long nHMM) { return (nHMM * 72 + 63) / 127; }
803cdf0e10cSrcweir
804cdf0e10cSrcweir //------------------------------------------------------------------------
805cdf0e10cSrcweir
806cdf0e10cSrcweir #define SCCHARPROPERTIES_SERVICE "com.sun.star.style.CharacterProperties"
807cdf0e10cSrcweir #define SCPARAPROPERTIES_SERVICE "com.sun.star.style.ParagraphProperties"
808cdf0e10cSrcweir #define SCCELLPROPERTIES_SERVICE "com.sun.star.table.CellProperties"
809cdf0e10cSrcweir #define SCCELLRANGE_SERVICE "com.sun.star.table.CellRange"
810cdf0e10cSrcweir #define SCCELL_SERVICE "com.sun.star.table.Cell"
811cdf0e10cSrcweir #define SCSHEETCELLRANGES_SERVICE "com.sun.star.sheet.SheetCellRanges"
812cdf0e10cSrcweir #define SCSHEETCELLRANGE_SERVICE "com.sun.star.sheet.SheetCellRange"
813cdf0e10cSrcweir #define SCSPREADSHEET_SERVICE "com.sun.star.sheet.Spreadsheet"
814cdf0e10cSrcweir #define SCSHEETCELL_SERVICE "com.sun.star.sheet.SheetCell"
815cdf0e10cSrcweir
816cdf0e10cSrcweir SC_SIMPLE_SERVICE_INFO( ScCellFormatsEnumeration, "ScCellFormatsEnumeration", "com.sun.star.sheet.CellFormatRangesEnumeration" )
817cdf0e10cSrcweir SC_SIMPLE_SERVICE_INFO( ScCellFormatsObj, "ScCellFormatsObj", "com.sun.star.sheet.CellFormatRanges" )
818cdf0e10cSrcweir SC_SIMPLE_SERVICE_INFO( ScUniqueCellFormatsEnumeration, "ScUniqueCellFormatsEnumeration", "com.sun.star.sheet.UniqueCellFormatRangesEnumeration" )
819cdf0e10cSrcweir SC_SIMPLE_SERVICE_INFO( ScUniqueCellFormatsObj, "ScUniqueCellFormatsObj", "com.sun.star.sheet.UniqueCellFormatRanges" )
820cdf0e10cSrcweir SC_SIMPLE_SERVICE_INFO( ScCellRangesBase, "ScCellRangesBase", "stardiv.unknown" )
821cdf0e10cSrcweir SC_SIMPLE_SERVICE_INFO( ScCellsEnumeration, "ScCellsEnumeration", "com.sun.star.sheet.CellsEnumeration" )
822cdf0e10cSrcweir SC_SIMPLE_SERVICE_INFO( ScCellsObj, "ScCellsObj", "com.sun.star.sheet.Cells" )
823cdf0e10cSrcweir SC_SIMPLE_SERVICE_INFO( ScTableColumnObj, "ScTableColumnObj", "com.sun.star.table.TableColumn" )
824cdf0e10cSrcweir SC_SIMPLE_SERVICE_INFO( ScTableRowObj, "ScTableRowObj", "com.sun.star.table.TableRow" )
825cdf0e10cSrcweir
826cdf0e10cSrcweir //------------------------------------------------------------------------
827cdf0e10cSrcweir
828cdf0e10cSrcweir SV_IMPL_PTRARR( XModifyListenerArr_Impl, XModifyListenerPtr );
829cdf0e10cSrcweir SV_IMPL_PTRARR( ScNamedEntryArr_Impl, ScNamedEntryPtr );
830cdf0e10cSrcweir
831cdf0e10cSrcweir //------------------------------------------------------------------------
832cdf0e10cSrcweir
833cdf0e10cSrcweir //! ScLinkListener in anderes File verschieben !!!
834cdf0e10cSrcweir
~ScLinkListener()835cdf0e10cSrcweir ScLinkListener::~ScLinkListener()
836cdf0e10cSrcweir {
837cdf0e10cSrcweir }
838cdf0e10cSrcweir
Notify(SvtBroadcaster &,const SfxHint & rHint)839cdf0e10cSrcweir void ScLinkListener::Notify( SvtBroadcaster&, const SfxHint& rHint )
840cdf0e10cSrcweir {
841cdf0e10cSrcweir aLink.Call( (SfxHint*)&rHint );
842cdf0e10cSrcweir }
843cdf0e10cSrcweir
844cdf0e10cSrcweir //------------------------------------------------------------------------
845cdf0e10cSrcweir
lcl_CopyProperties(beans::XPropertySet & rDest,beans::XPropertySet & rSource)846cdf0e10cSrcweir void lcl_CopyProperties( beans::XPropertySet& rDest, beans::XPropertySet& rSource )
847cdf0e10cSrcweir {
848cdf0e10cSrcweir uno::Reference<beans::XPropertySetInfo> xInfo(rSource.getPropertySetInfo());
849cdf0e10cSrcweir if (xInfo.is())
850cdf0e10cSrcweir {
851cdf0e10cSrcweir uno::Sequence<beans::Property> aSeq(xInfo->getProperties());
852cdf0e10cSrcweir const beans::Property* pAry = aSeq.getConstArray();
853cdf0e10cSrcweir sal_uLong nCount = aSeq.getLength();
854cdf0e10cSrcweir for (sal_uLong i=0; i<nCount; i++)
855cdf0e10cSrcweir {
856cdf0e10cSrcweir rtl::OUString aName(pAry[i].Name);
857cdf0e10cSrcweir rDest.setPropertyValue( aName, rSource.getPropertyValue( aName ) );
858cdf0e10cSrcweir }
859cdf0e10cSrcweir }
860cdf0e10cSrcweir }
861cdf0e10cSrcweir
lcl_FirstTab(const ScRangeList & rRanges)862cdf0e10cSrcweir SCTAB lcl_FirstTab( const ScRangeList& rRanges )
863cdf0e10cSrcweir {
864cdf0e10cSrcweir DBG_ASSERT(rRanges.Count() >= 1, "was fuer Ranges ?!?!");
865cdf0e10cSrcweir const ScRange* pFirst = rRanges.GetObject(0);
866cdf0e10cSrcweir if (pFirst)
867cdf0e10cSrcweir return pFirst->aStart.Tab();
868cdf0e10cSrcweir
869cdf0e10cSrcweir return 0; // soll nicht sein
870cdf0e10cSrcweir }
871cdf0e10cSrcweir
lcl_WholeSheet(const ScRangeList & rRanges)872cdf0e10cSrcweir sal_Bool lcl_WholeSheet( const ScRangeList& rRanges )
873cdf0e10cSrcweir {
874cdf0e10cSrcweir if ( rRanges.Count() == 1 )
875cdf0e10cSrcweir {
876cdf0e10cSrcweir ScRange* pRange = rRanges.GetObject(0);
877cdf0e10cSrcweir if ( pRange && pRange->aStart.Col() == 0 && pRange->aEnd.Col() == MAXCOL &&
878cdf0e10cSrcweir pRange->aStart.Row() == 0 && pRange->aEnd.Row() == MAXROW )
879cdf0e10cSrcweir return sal_True;
880cdf0e10cSrcweir }
881cdf0e10cSrcweir return sal_False;
882cdf0e10cSrcweir }
883cdf0e10cSrcweir
884cdf0e10cSrcweir //------------------------------------------------------------------------
885cdf0e10cSrcweir
lcl_SummaryToSubTotal(sheet::GeneralFunction eSummary)886cdf0e10cSrcweir ScSubTotalFunc lcl_SummaryToSubTotal( sheet::GeneralFunction eSummary )
887cdf0e10cSrcweir {
888cdf0e10cSrcweir ScSubTotalFunc eSubTotal;
889cdf0e10cSrcweir switch (eSummary)
890cdf0e10cSrcweir {
891cdf0e10cSrcweir case sheet::GeneralFunction_SUM:
892cdf0e10cSrcweir eSubTotal = SUBTOTAL_FUNC_SUM;
893cdf0e10cSrcweir break;
894cdf0e10cSrcweir case sheet::GeneralFunction_COUNT:
895cdf0e10cSrcweir eSubTotal = SUBTOTAL_FUNC_CNT2;
896cdf0e10cSrcweir break;
897cdf0e10cSrcweir case sheet::GeneralFunction_AVERAGE:
898cdf0e10cSrcweir eSubTotal = SUBTOTAL_FUNC_AVE;
899cdf0e10cSrcweir break;
900cdf0e10cSrcweir case sheet::GeneralFunction_MAX:
901cdf0e10cSrcweir eSubTotal = SUBTOTAL_FUNC_MAX;
902cdf0e10cSrcweir break;
903cdf0e10cSrcweir case sheet::GeneralFunction_MIN:
904cdf0e10cSrcweir eSubTotal = SUBTOTAL_FUNC_MIN;
905cdf0e10cSrcweir break;
906cdf0e10cSrcweir case sheet::GeneralFunction_PRODUCT:
907cdf0e10cSrcweir eSubTotal = SUBTOTAL_FUNC_PROD;
908cdf0e10cSrcweir break;
909cdf0e10cSrcweir case sheet::GeneralFunction_COUNTNUMS:
910cdf0e10cSrcweir eSubTotal = SUBTOTAL_FUNC_CNT;
911cdf0e10cSrcweir break;
912cdf0e10cSrcweir case sheet::GeneralFunction_STDEV:
913cdf0e10cSrcweir eSubTotal = SUBTOTAL_FUNC_STD;
914cdf0e10cSrcweir break;
915cdf0e10cSrcweir case sheet::GeneralFunction_STDEVP:
916cdf0e10cSrcweir eSubTotal = SUBTOTAL_FUNC_STDP;
917cdf0e10cSrcweir break;
918cdf0e10cSrcweir case sheet::GeneralFunction_VAR:
919cdf0e10cSrcweir eSubTotal = SUBTOTAL_FUNC_VAR;
920cdf0e10cSrcweir break;
921cdf0e10cSrcweir case sheet::GeneralFunction_VARP:
922cdf0e10cSrcweir eSubTotal = SUBTOTAL_FUNC_VARP;
923cdf0e10cSrcweir break;
924cdf0e10cSrcweir
925cdf0e10cSrcweir case sheet::GeneralFunction_NONE:
926cdf0e10cSrcweir case sheet::GeneralFunction_AUTO:
927cdf0e10cSrcweir default:
928cdf0e10cSrcweir eSubTotal = SUBTOTAL_FUNC_NONE;
929cdf0e10cSrcweir break;
930cdf0e10cSrcweir }
931cdf0e10cSrcweir return eSubTotal;
932cdf0e10cSrcweir }
933cdf0e10cSrcweir
934cdf0e10cSrcweir //------------------------------------------------------------------------
935cdf0e10cSrcweir
GetBorderLine(SvxBorderLine & rLine,const table::BorderLine & rStruct)936cdf0e10cSrcweir const SvxBorderLine* ScHelperFunctions::GetBorderLine( SvxBorderLine& rLine, const table::BorderLine& rStruct )
937cdf0e10cSrcweir {
938cdf0e10cSrcweir // Calc braucht Twips, im Uno-Struct sind 1/100mm
939cdf0e10cSrcweir
940cdf0e10cSrcweir rLine.SetOutWidth( (sal_uInt16)HMMToTwips( rStruct.OuterLineWidth ) );
941cdf0e10cSrcweir rLine.SetInWidth( (sal_uInt16)HMMToTwips( rStruct.InnerLineWidth ) );
942cdf0e10cSrcweir rLine.SetDistance( (sal_uInt16)HMMToTwips( rStruct.LineDistance ) );
943cdf0e10cSrcweir rLine.SetColor( ColorData( rStruct.Color ) );
944cdf0e10cSrcweir
945cdf0e10cSrcweir if ( rLine.GetOutWidth() || rLine.GetInWidth() || rLine.GetDistance() )
946cdf0e10cSrcweir return &rLine;
947cdf0e10cSrcweir else
948cdf0e10cSrcweir return NULL;
949cdf0e10cSrcweir }
950cdf0e10cSrcweir
FillBoxItems(SvxBoxItem & rOuter,SvxBoxInfoItem & rInner,const table::TableBorder & rBorder)951cdf0e10cSrcweir void ScHelperFunctions::FillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const table::TableBorder& rBorder )
952cdf0e10cSrcweir {
953cdf0e10cSrcweir SvxBorderLine aLine;
954cdf0e10cSrcweir rOuter.SetDistance( (sal_uInt16)HMMToTwips( rBorder.Distance ) );
955cdf0e10cSrcweir rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.TopLine ), BOX_LINE_TOP );
956cdf0e10cSrcweir rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.BottomLine ), BOX_LINE_BOTTOM );
957cdf0e10cSrcweir rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.LeftLine ), BOX_LINE_LEFT );
958cdf0e10cSrcweir rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.RightLine ), BOX_LINE_RIGHT );
959cdf0e10cSrcweir rInner.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.HorizontalLine ), BOXINFO_LINE_HORI );
960cdf0e10cSrcweir rInner.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.VerticalLine ), BOXINFO_LINE_VERT );
961cdf0e10cSrcweir rInner.SetValid( VALID_TOP, rBorder.IsTopLineValid );
962cdf0e10cSrcweir rInner.SetValid( VALID_BOTTOM, rBorder.IsBottomLineValid );
963cdf0e10cSrcweir rInner.SetValid( VALID_LEFT, rBorder.IsLeftLineValid );
964cdf0e10cSrcweir rInner.SetValid( VALID_RIGHT, rBorder.IsRightLineValid );
965cdf0e10cSrcweir rInner.SetValid( VALID_HORI, rBorder.IsHorizontalLineValid );
966cdf0e10cSrcweir rInner.SetValid( VALID_VERT, rBorder.IsVerticalLineValid );
967cdf0e10cSrcweir rInner.SetValid( VALID_DISTANCE, rBorder.IsDistanceValid );
968cdf0e10cSrcweir rInner.SetTable( sal_True );
969cdf0e10cSrcweir }
970cdf0e10cSrcweir
FillBorderLine(table::BorderLine & rStruct,const SvxBorderLine * pLine)971cdf0e10cSrcweir void ScHelperFunctions::FillBorderLine( table::BorderLine& rStruct, const SvxBorderLine* pLine )
972cdf0e10cSrcweir {
973cdf0e10cSrcweir if (pLine)
974cdf0e10cSrcweir {
975cdf0e10cSrcweir rStruct.Color = pLine->GetColor().GetColor();
976cdf0e10cSrcweir rStruct.InnerLineWidth = (sal_Int16)TwipsToHMM( pLine->GetInWidth() );
977cdf0e10cSrcweir rStruct.OuterLineWidth = (sal_Int16)TwipsToHMM( pLine->GetOutWidth() );
978cdf0e10cSrcweir rStruct.LineDistance = (sal_Int16)TwipsToHMM( pLine->GetDistance() );
979cdf0e10cSrcweir }
980cdf0e10cSrcweir else
981cdf0e10cSrcweir rStruct.Color = rStruct.InnerLineWidth =
982cdf0e10cSrcweir rStruct.OuterLineWidth = rStruct.LineDistance = 0;
983cdf0e10cSrcweir }
984cdf0e10cSrcweir
FillTableBorder(table::TableBorder & rBorder,const SvxBoxItem & rOuter,const SvxBoxInfoItem & rInner)985cdf0e10cSrcweir void ScHelperFunctions::FillTableBorder( table::TableBorder& rBorder,
986cdf0e10cSrcweir const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner )
987cdf0e10cSrcweir {
988cdf0e10cSrcweir ScHelperFunctions::FillBorderLine( rBorder.TopLine, rOuter.GetTop() );
989cdf0e10cSrcweir ScHelperFunctions::FillBorderLine( rBorder.BottomLine, rOuter.GetBottom() );
990cdf0e10cSrcweir ScHelperFunctions::FillBorderLine( rBorder.LeftLine, rOuter.GetLeft() );
991cdf0e10cSrcweir ScHelperFunctions::FillBorderLine( rBorder.RightLine, rOuter.GetRight() );
992cdf0e10cSrcweir ScHelperFunctions::FillBorderLine( rBorder.HorizontalLine, rInner.GetHori() );
993cdf0e10cSrcweir ScHelperFunctions::FillBorderLine( rBorder.VerticalLine, rInner.GetVert() );
994cdf0e10cSrcweir
995cdf0e10cSrcweir rBorder.Distance = rOuter.GetDistance();
996cdf0e10cSrcweir rBorder.IsTopLineValid = rInner.IsValid(VALID_TOP);
997cdf0e10cSrcweir rBorder.IsBottomLineValid = rInner.IsValid(VALID_BOTTOM);
998cdf0e10cSrcweir rBorder.IsLeftLineValid = rInner.IsValid(VALID_LEFT);
999cdf0e10cSrcweir rBorder.IsRightLineValid = rInner.IsValid(VALID_RIGHT);
1000cdf0e10cSrcweir rBorder.IsHorizontalLineValid = rInner.IsValid(VALID_HORI);
1001cdf0e10cSrcweir rBorder.IsVerticalLineValid = rInner.IsValid(VALID_VERT);
1002cdf0e10cSrcweir rBorder.IsDistanceValid = rInner.IsValid(VALID_DISTANCE);
1003cdf0e10cSrcweir }
1004cdf0e10cSrcweir
1005cdf0e10cSrcweir //------------------------------------------------------------------------
1006cdf0e10cSrcweir
1007cdf0e10cSrcweir //! lcl_ApplyBorder nach docfunc verschieben!
1008cdf0e10cSrcweir
ApplyBorder(ScDocShell * pDocShell,const ScRangeList & rRanges,const SvxBoxItem & rOuter,const SvxBoxInfoItem & rInner)1009cdf0e10cSrcweir void ScHelperFunctions::ApplyBorder( ScDocShell* pDocShell, const ScRangeList& rRanges,
1010cdf0e10cSrcweir const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner )
1011cdf0e10cSrcweir {
1012cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
1013cdf0e10cSrcweir sal_Bool bUndo(pDoc->IsUndoEnabled());
1014cdf0e10cSrcweir ScDocument* pUndoDoc = NULL;
1015cdf0e10cSrcweir if (bUndo)
1016cdf0e10cSrcweir pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
1017cdf0e10cSrcweir sal_uLong nCount = rRanges.Count();
1018cdf0e10cSrcweir sal_uLong i;
1019cdf0e10cSrcweir for (i=0; i<nCount; i++)
1020cdf0e10cSrcweir {
1021cdf0e10cSrcweir ScRange aRange(*rRanges.GetObject(i));
1022cdf0e10cSrcweir SCTAB nTab = aRange.aStart.Tab();
1023cdf0e10cSrcweir
1024cdf0e10cSrcweir if (bUndo)
1025cdf0e10cSrcweir {
1026cdf0e10cSrcweir if ( i==0 )
1027cdf0e10cSrcweir pUndoDoc->InitUndo( pDoc, nTab, nTab );
1028cdf0e10cSrcweir else
1029cdf0e10cSrcweir pUndoDoc->AddUndoTab( nTab, nTab );
1030cdf0e10cSrcweir pDoc->CopyToDocument( aRange, IDF_ATTRIB, sal_False, pUndoDoc );
1031cdf0e10cSrcweir }
1032cdf0e10cSrcweir
1033cdf0e10cSrcweir ScMarkData aMark;
1034cdf0e10cSrcweir aMark.SetMarkArea( aRange );
1035cdf0e10cSrcweir aMark.SelectTable( nTab, sal_True );
1036cdf0e10cSrcweir
1037cdf0e10cSrcweir pDoc->ApplySelectionFrame( aMark, &rOuter, &rInner );
1038cdf0e10cSrcweir // RowHeight bei Umrandung alleine nicht noetig
1039cdf0e10cSrcweir }
1040cdf0e10cSrcweir
1041cdf0e10cSrcweir if (bUndo)
1042cdf0e10cSrcweir {
1043cdf0e10cSrcweir pDocShell->GetUndoManager()->AddUndoAction(
1044cdf0e10cSrcweir new ScUndoBorder( pDocShell, rRanges, pUndoDoc, rOuter, rInner ) );
1045cdf0e10cSrcweir }
1046cdf0e10cSrcweir
1047cdf0e10cSrcweir for (i=0; i<nCount; i++)
1048cdf0e10cSrcweir pDocShell->PostPaint( *rRanges.GetObject(i), PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
1049cdf0e10cSrcweir
1050cdf0e10cSrcweir pDocShell->SetDocumentModified();
1051cdf0e10cSrcweir }
1052cdf0e10cSrcweir
1053cdf0e10cSrcweir //! move lcl_PutDataArray to docfunc?
1054cdf0e10cSrcweir //! merge loop with ScFunctionAccess::callFunction
1055cdf0e10cSrcweir
lcl_PutDataArray(ScDocShell & rDocShell,const ScRange & rRange,const uno::Sequence<uno::Sequence<uno::Any>> & aData)1056cdf0e10cSrcweir sal_Bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
1057cdf0e10cSrcweir const uno::Sequence< uno::Sequence<uno::Any> >& aData )
1058cdf0e10cSrcweir {
1059cdf0e10cSrcweir // sal_Bool bApi = sal_True;
1060cdf0e10cSrcweir
1061cdf0e10cSrcweir ScDocument* pDoc = rDocShell.GetDocument();
1062cdf0e10cSrcweir SCTAB nTab = rRange.aStart.Tab();
1063cdf0e10cSrcweir SCCOL nStartCol = rRange.aStart.Col();
1064cdf0e10cSrcweir SCROW nStartRow = rRange.aStart.Row();
1065cdf0e10cSrcweir SCCOL nEndCol = rRange.aEnd.Col();
1066cdf0e10cSrcweir SCROW nEndRow = rRange.aEnd.Row();
1067cdf0e10cSrcweir sal_Bool bUndo(pDoc->IsUndoEnabled());
1068cdf0e10cSrcweir
1069cdf0e10cSrcweir if ( !pDoc->IsBlockEditable( nTab, nStartCol,nStartRow, nEndCol,nEndRow ) )
1070cdf0e10cSrcweir {
1071cdf0e10cSrcweir //! error message
1072cdf0e10cSrcweir return sal_False;
1073cdf0e10cSrcweir }
1074cdf0e10cSrcweir
1075cdf0e10cSrcweir long nCols = 0;
1076cdf0e10cSrcweir long nRows = aData.getLength();
1077cdf0e10cSrcweir const uno::Sequence<uno::Any>* pArray = aData.getConstArray();
1078cdf0e10cSrcweir if ( nRows )
1079cdf0e10cSrcweir nCols = pArray[0].getLength();
1080cdf0e10cSrcweir
1081cdf0e10cSrcweir if ( nCols != nEndCol-nStartCol+1 || nRows != nEndRow-nStartRow+1 )
1082cdf0e10cSrcweir {
1083cdf0e10cSrcweir //! error message?
1084cdf0e10cSrcweir return sal_False;
1085cdf0e10cSrcweir }
1086cdf0e10cSrcweir
1087cdf0e10cSrcweir ScDocument* pUndoDoc = NULL;
1088cdf0e10cSrcweir if ( bUndo )
1089cdf0e10cSrcweir {
1090cdf0e10cSrcweir pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
1091cdf0e10cSrcweir pUndoDoc->InitUndo( pDoc, nTab, nTab );
1092cdf0e10cSrcweir pDoc->CopyToDocument( rRange, IDF_CONTENTS|IDF_NOCAPTIONS, sal_False, pUndoDoc );
1093cdf0e10cSrcweir }
1094cdf0e10cSrcweir
1095cdf0e10cSrcweir pDoc->DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS );
1096cdf0e10cSrcweir
1097cdf0e10cSrcweir /* #164410# Use double allocation, which will speed up import filters
1098cdf0e10cSrcweir using XCellRangeData::setDataArray() significantly. */
1099cdf0e10cSrcweir bool bDoubleAlloc = ScColumn::bDoubleAlloc;
1100cdf0e10cSrcweir ScColumn::bDoubleAlloc = true;
1101cdf0e10cSrcweir
1102cdf0e10cSrcweir sal_Bool bError = sal_False;
1103cdf0e10cSrcweir SCROW nDocRow = nStartRow;
1104cdf0e10cSrcweir for (long nRow=0; nRow<nRows; nRow++)
1105cdf0e10cSrcweir {
1106cdf0e10cSrcweir const uno::Sequence<uno::Any>& rColSeq = pArray[nRow];
1107cdf0e10cSrcweir if ( rColSeq.getLength() == nCols )
1108cdf0e10cSrcweir {
1109cdf0e10cSrcweir SCCOL nDocCol = nStartCol;
1110cdf0e10cSrcweir const uno::Any* pColArr = rColSeq.getConstArray();
1111cdf0e10cSrcweir for (long nCol=0; nCol<nCols; nCol++)
1112cdf0e10cSrcweir {
1113cdf0e10cSrcweir const uno::Any& rElement = pColArr[nCol];
1114cdf0e10cSrcweir switch( rElement.getValueTypeClass() )
1115cdf0e10cSrcweir {
1116cdf0e10cSrcweir case uno::TypeClass_VOID:
1117cdf0e10cSrcweir {
1118cdf0e10cSrcweir // void = "no value"
1119cdf0e10cSrcweir pDoc->SetError( nDocCol, nDocRow, nTab, NOTAVAILABLE );
1120cdf0e10cSrcweir }
1121cdf0e10cSrcweir break;
1122cdf0e10cSrcweir
1123cdf0e10cSrcweir // #87871# accept integer types because Basic passes a floating point
1124cdf0e10cSrcweir // variable as byte, short or long if it's an integer number.
1125cdf0e10cSrcweir case uno::TypeClass_BYTE:
1126cdf0e10cSrcweir case uno::TypeClass_SHORT:
1127cdf0e10cSrcweir case uno::TypeClass_UNSIGNED_SHORT:
1128cdf0e10cSrcweir case uno::TypeClass_LONG:
1129cdf0e10cSrcweir case uno::TypeClass_UNSIGNED_LONG:
1130cdf0e10cSrcweir case uno::TypeClass_FLOAT:
1131cdf0e10cSrcweir case uno::TypeClass_DOUBLE:
1132cdf0e10cSrcweir {
1133cdf0e10cSrcweir double fVal(0.0);
1134cdf0e10cSrcweir rElement >>= fVal;
1135cdf0e10cSrcweir pDoc->SetValue( nDocCol, nDocRow, nTab, fVal );
1136cdf0e10cSrcweir }
1137cdf0e10cSrcweir break;
1138cdf0e10cSrcweir
1139cdf0e10cSrcweir case uno::TypeClass_STRING:
1140cdf0e10cSrcweir {
1141cdf0e10cSrcweir rtl::OUString aUStr;
1142cdf0e10cSrcweir rElement >>= aUStr;
1143cdf0e10cSrcweir if ( aUStr.getLength() )
1144cdf0e10cSrcweir pDoc->PutCell( nDocCol, nDocRow, nTab, new ScStringCell( aUStr ) );
1145cdf0e10cSrcweir }
1146cdf0e10cSrcweir break;
1147cdf0e10cSrcweir
1148cdf0e10cSrcweir // accept Sequence<FormulaToken> for formula cells
1149cdf0e10cSrcweir case uno::TypeClass_SEQUENCE:
1150cdf0e10cSrcweir {
1151cdf0e10cSrcweir uno::Sequence< sheet::FormulaToken > aTokens;
1152cdf0e10cSrcweir if ( rElement >>= aTokens )
1153cdf0e10cSrcweir {
1154cdf0e10cSrcweir ScTokenArray aTokenArray;
1155cdf0e10cSrcweir ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, aTokens );
1156cdf0e10cSrcweir ScAddress aPos( nDocCol, nDocRow, nTab );
1157cdf0e10cSrcweir ScBaseCell* pNewCell = new ScFormulaCell( pDoc, aPos, &aTokenArray );
1158cdf0e10cSrcweir pDoc->PutCell( aPos, pNewCell );
1159cdf0e10cSrcweir }
1160cdf0e10cSrcweir else
1161cdf0e10cSrcweir bError = true;
1162cdf0e10cSrcweir }
1163cdf0e10cSrcweir break;
1164cdf0e10cSrcweir
1165cdf0e10cSrcweir default:
1166cdf0e10cSrcweir bError = true; // invalid type
1167cdf0e10cSrcweir }
1168cdf0e10cSrcweir
1169cdf0e10cSrcweir ++nDocCol;
1170cdf0e10cSrcweir }
1171cdf0e10cSrcweir }
1172cdf0e10cSrcweir else
1173cdf0e10cSrcweir bError = sal_True; // wrong size
1174cdf0e10cSrcweir
1175cdf0e10cSrcweir ++nDocRow;
1176cdf0e10cSrcweir }
1177cdf0e10cSrcweir ScColumn::bDoubleAlloc = bDoubleAlloc;
1178cdf0e10cSrcweir
1179cdf0e10cSrcweir sal_Bool bHeight = rDocShell.AdjustRowHeight( nStartRow, nEndRow, nTab );
1180cdf0e10cSrcweir
1181cdf0e10cSrcweir if ( pUndoDoc )
1182cdf0e10cSrcweir {
1183cdf0e10cSrcweir ScMarkData aDestMark;
1184cdf0e10cSrcweir aDestMark.SelectOneTable( nTab );
1185cdf0e10cSrcweir rDocShell.GetUndoManager()->AddUndoAction(
1186cdf0e10cSrcweir new ScUndoPaste( &rDocShell,
1187cdf0e10cSrcweir nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab, aDestMark,
1188cdf0e10cSrcweir pUndoDoc, NULL, IDF_CONTENTS, NULL,NULL,NULL,NULL, sal_False ) );
1189cdf0e10cSrcweir }
1190cdf0e10cSrcweir
1191cdf0e10cSrcweir if (!bHeight)
1192cdf0e10cSrcweir rDocShell.PostPaint( rRange, PAINT_GRID ); // AdjustRowHeight may have painted already
1193cdf0e10cSrcweir
1194cdf0e10cSrcweir rDocShell.SetDocumentModified();
1195cdf0e10cSrcweir
1196cdf0e10cSrcweir return !bError;
1197cdf0e10cSrcweir }
1198cdf0e10cSrcweir
lcl_PutFormulaArray(ScDocShell & rDocShell,const ScRange & rRange,const uno::Sequence<uno::Sequence<rtl::OUString>> & aData,const::rtl::OUString & rFormulaNmsp,const formula::FormulaGrammar::Grammar eGrammar)1199cdf0e10cSrcweir sal_Bool lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange,
1200cdf0e10cSrcweir const uno::Sequence< uno::Sequence<rtl::OUString> >& aData,
1201cdf0e10cSrcweir const ::rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar )
1202cdf0e10cSrcweir {
1203cdf0e10cSrcweir // sal_Bool bApi = sal_True;
1204cdf0e10cSrcweir
1205cdf0e10cSrcweir ScDocument* pDoc = rDocShell.GetDocument();
1206cdf0e10cSrcweir SCTAB nTab = rRange.aStart.Tab();
1207cdf0e10cSrcweir SCCOL nStartCol = rRange.aStart.Col();
1208cdf0e10cSrcweir SCROW nStartRow = rRange.aStart.Row();
1209cdf0e10cSrcweir SCCOL nEndCol = rRange.aEnd.Col();
1210cdf0e10cSrcweir SCROW nEndRow = rRange.aEnd.Row();
1211cdf0e10cSrcweir sal_Bool bUndo(pDoc->IsUndoEnabled());
1212cdf0e10cSrcweir
1213cdf0e10cSrcweir if ( !pDoc->IsBlockEditable( nTab, nStartCol,nStartRow, nEndCol,nEndRow ) )
1214cdf0e10cSrcweir {
1215cdf0e10cSrcweir //! error message
1216cdf0e10cSrcweir return sal_False;
1217cdf0e10cSrcweir }
1218cdf0e10cSrcweir
1219cdf0e10cSrcweir long nCols = 0;
1220cdf0e10cSrcweir long nRows = aData.getLength();
1221cdf0e10cSrcweir const uno::Sequence<rtl::OUString>* pArray = aData.getConstArray();
1222cdf0e10cSrcweir if ( nRows )
1223cdf0e10cSrcweir nCols = pArray[0].getLength();
1224cdf0e10cSrcweir
1225cdf0e10cSrcweir if ( nCols != nEndCol-nStartCol+1 || nRows != nEndRow-nStartRow+1 )
1226cdf0e10cSrcweir {
1227cdf0e10cSrcweir //! error message?
1228cdf0e10cSrcweir return sal_False;
1229cdf0e10cSrcweir }
1230cdf0e10cSrcweir
1231cdf0e10cSrcweir ScDocument* pUndoDoc = NULL;
1232cdf0e10cSrcweir if ( bUndo )
1233cdf0e10cSrcweir {
1234cdf0e10cSrcweir pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
1235cdf0e10cSrcweir pUndoDoc->InitUndo( pDoc, nTab, nTab );
1236cdf0e10cSrcweir pDoc->CopyToDocument( rRange, IDF_CONTENTS, sal_False, pUndoDoc );
1237cdf0e10cSrcweir }
1238cdf0e10cSrcweir
1239cdf0e10cSrcweir pDoc->DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS );
1240cdf0e10cSrcweir
1241cdf0e10cSrcweir ScDocFunc aFunc( rDocShell ); // for InterpretEnglishString
1242cdf0e10cSrcweir
1243cdf0e10cSrcweir sal_Bool bError = sal_False;
1244cdf0e10cSrcweir SCROW nDocRow = nStartRow;
1245cdf0e10cSrcweir for (long nRow=0; nRow<nRows; nRow++)
1246cdf0e10cSrcweir {
1247cdf0e10cSrcweir const uno::Sequence<rtl::OUString>& rColSeq = pArray[nRow];
1248cdf0e10cSrcweir if ( rColSeq.getLength() == nCols )
1249cdf0e10cSrcweir {
1250cdf0e10cSrcweir SCCOL nDocCol = nStartCol;
1251cdf0e10cSrcweir const rtl::OUString* pColArr = rColSeq.getConstArray();
1252cdf0e10cSrcweir for (long nCol=0; nCol<nCols; nCol++)
1253cdf0e10cSrcweir {
1254cdf0e10cSrcweir String aText(pColArr[nCol]);
1255cdf0e10cSrcweir ScAddress aPos( nDocCol, nDocRow, nTab );
1256cdf0e10cSrcweir ScBaseCell* pNewCell = aFunc.InterpretEnglishString( aPos, aText, rFormulaNmsp, eGrammar );
1257cdf0e10cSrcweir pDoc->PutCell( aPos, pNewCell );
1258cdf0e10cSrcweir
1259cdf0e10cSrcweir ++nDocCol;
1260cdf0e10cSrcweir }
1261cdf0e10cSrcweir }
1262cdf0e10cSrcweir else
1263cdf0e10cSrcweir bError = sal_True; // wrong size
1264cdf0e10cSrcweir
1265cdf0e10cSrcweir ++nDocRow;
1266cdf0e10cSrcweir }
1267cdf0e10cSrcweir
1268cdf0e10cSrcweir sal_Bool bHeight = rDocShell.AdjustRowHeight( nStartRow, nEndRow, nTab );
1269cdf0e10cSrcweir
1270cdf0e10cSrcweir if ( pUndoDoc )
1271cdf0e10cSrcweir {
1272cdf0e10cSrcweir ScMarkData aDestMark;
1273cdf0e10cSrcweir aDestMark.SelectOneTable( nTab );
1274cdf0e10cSrcweir rDocShell.GetUndoManager()->AddUndoAction(
1275cdf0e10cSrcweir new ScUndoPaste( &rDocShell,
1276cdf0e10cSrcweir nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab, aDestMark,
1277cdf0e10cSrcweir pUndoDoc, NULL, IDF_CONTENTS, NULL,NULL,NULL,NULL, sal_False ) );
1278cdf0e10cSrcweir }
1279cdf0e10cSrcweir
1280cdf0e10cSrcweir if (!bHeight)
1281cdf0e10cSrcweir rDocShell.PostPaint( rRange, PAINT_GRID ); // AdjustRowHeight may have painted already
1282cdf0e10cSrcweir
1283cdf0e10cSrcweir rDocShell.SetDocumentModified();
1284cdf0e10cSrcweir
1285cdf0e10cSrcweir return !bError;
1286cdf0e10cSrcweir }
1287cdf0e10cSrcweir
1288cdf0e10cSrcweir // used in ScCellRangeObj::getFormulaArray and ScCellObj::GetInputString_Impl
lcl_GetInputString(ScDocument * pDoc,const ScAddress & rPosition,sal_Bool bEnglish)1289cdf0e10cSrcweir String lcl_GetInputString( ScDocument* pDoc, const ScAddress& rPosition, sal_Bool bEnglish )
1290cdf0e10cSrcweir {
1291cdf0e10cSrcweir String aVal;
1292cdf0e10cSrcweir if ( pDoc )
1293cdf0e10cSrcweir {
1294cdf0e10cSrcweir ScBaseCell* pCell = pDoc->GetCell( rPosition );
1295cdf0e10cSrcweir if ( pCell && pCell->GetCellType() != CELLTYPE_NOTE )
1296cdf0e10cSrcweir {
1297cdf0e10cSrcweir CellType eType = pCell->GetCellType();
1298cdf0e10cSrcweir if ( eType == CELLTYPE_FORMULA )
1299cdf0e10cSrcweir {
1300cdf0e10cSrcweir ScFormulaCell* pForm = (ScFormulaCell*)pCell;
1301cdf0e10cSrcweir pForm->GetFormula( aVal,formula::FormulaGrammar::mapAPItoGrammar( bEnglish, false));
1302cdf0e10cSrcweir }
1303cdf0e10cSrcweir else
1304cdf0e10cSrcweir {
1305cdf0e10cSrcweir SvNumberFormatter* pFormatter = bEnglish ? ScGlobal::GetEnglishFormatter() :
1306cdf0e10cSrcweir pDoc->GetFormatTable();
1307cdf0e10cSrcweir // Since the English formatter was constructed with
1308cdf0e10cSrcweir // LANGUAGE_ENGLISH_US the "General" format has index key 0,
1309cdf0e10cSrcweir // we don't have to query.
1310cdf0e10cSrcweir sal_uInt32 nNumFmt = bEnglish ?
1311cdf0e10cSrcweir // pFormatter->GetStandardIndex(LANGUAGE_ENGLISH_US) :
1312cdf0e10cSrcweir 0 :
1313cdf0e10cSrcweir pDoc->GetNumberFormat( rPosition );
1314cdf0e10cSrcweir
1315cdf0e10cSrcweir if ( eType == CELLTYPE_EDIT )
1316cdf0e10cSrcweir {
1317cdf0e10cSrcweir // GetString an der EditCell macht Leerzeichen aus Umbruechen,
1318cdf0e10cSrcweir // hier werden die Umbrueche aber gebraucht
1319cdf0e10cSrcweir const EditTextObject* pData = ((ScEditCell*)pCell)->GetData();
1320cdf0e10cSrcweir if (pData)
1321cdf0e10cSrcweir {
1322cdf0e10cSrcweir EditEngine& rEngine = pDoc->GetEditEngine();
1323cdf0e10cSrcweir rEngine.SetText( *pData );
1324cdf0e10cSrcweir aVal = rEngine.GetText( LINEEND_LF );
1325cdf0e10cSrcweir }
1326cdf0e10cSrcweir }
1327cdf0e10cSrcweir else
1328cdf0e10cSrcweir ScCellFormat::GetInputString( pCell, nNumFmt, aVal, *pFormatter );
1329cdf0e10cSrcweir
1330cdf0e10cSrcweir // ggf. ein ' davorhaengen wie in ScTabViewShell::UpdateInputHandler
1331cdf0e10cSrcweir if ( eType == CELLTYPE_STRING || eType == CELLTYPE_EDIT )
1332cdf0e10cSrcweir {
1333cdf0e10cSrcweir double fDummy;
1334cdf0e10cSrcweir sal_Bool bIsNumberFormat(pFormatter->IsNumberFormat(aVal, nNumFmt, fDummy));
1335cdf0e10cSrcweir if ( bIsNumberFormat )
1336cdf0e10cSrcweir aVal.Insert('\'',0);
1337cdf0e10cSrcweir else if ( aVal.Len() && aVal.GetChar(0) == '\'' )
1338cdf0e10cSrcweir {
1339cdf0e10cSrcweir // if the string starts with a "'", add another one because setFormula
1340cdf0e10cSrcweir // strips one (like text input, except for "text" number formats)
1341cdf0e10cSrcweir if ( bEnglish || ( pFormatter->GetType(nNumFmt) != NUMBERFORMAT_TEXT ) )
1342cdf0e10cSrcweir aVal.Insert('\'',0);
1343cdf0e10cSrcweir }
1344cdf0e10cSrcweir }
1345cdf0e10cSrcweir }
1346cdf0e10cSrcweir }
1347cdf0e10cSrcweir }
1348cdf0e10cSrcweir return aVal;
1349cdf0e10cSrcweir }
1350cdf0e10cSrcweir
1351cdf0e10cSrcweir //------------------------------------------------------------------------
1352cdf0e10cSrcweir
1353cdf0e10cSrcweir // Default-ctor fuer SMART_REFLECTION Krempel
ScCellRangesBase()1354cdf0e10cSrcweir ScCellRangesBase::ScCellRangesBase() :
1355cdf0e10cSrcweir pPropSet(lcl_GetCellsPropertySet()),
1356cdf0e10cSrcweir pDocShell( NULL ),
1357cdf0e10cSrcweir pValueListener( NULL ),
1358cdf0e10cSrcweir pCurrentFlat( NULL ),
1359cdf0e10cSrcweir pCurrentDeep( NULL ),
1360cdf0e10cSrcweir pCurrentDataSet( NULL ),
1361cdf0e10cSrcweir pNoDfltCurrentDataSet( NULL ),
1362cdf0e10cSrcweir pMarkData( NULL ),
1363cdf0e10cSrcweir nObjectId( 0 ),
1364cdf0e10cSrcweir bChartColAsHdr( sal_False ),
1365cdf0e10cSrcweir bChartRowAsHdr( sal_False ),
1366cdf0e10cSrcweir bCursorOnly( sal_False ),
1367cdf0e10cSrcweir bGotDataChangedHint( sal_False ),
1368cdf0e10cSrcweir aValueListeners( 0 )
1369cdf0e10cSrcweir {
1370cdf0e10cSrcweir }
1371cdf0e10cSrcweir
ScCellRangesBase(ScDocShell * pDocSh,const ScRange & rR)1372cdf0e10cSrcweir ScCellRangesBase::ScCellRangesBase(ScDocShell* pDocSh, const ScRange& rR) :
1373cdf0e10cSrcweir pPropSet(lcl_GetCellsPropertySet()),
1374cdf0e10cSrcweir pDocShell( pDocSh ),
1375cdf0e10cSrcweir pValueListener( NULL ),
1376cdf0e10cSrcweir pCurrentFlat( NULL ),
1377cdf0e10cSrcweir pCurrentDeep( NULL ),
1378cdf0e10cSrcweir pCurrentDataSet( NULL ),
1379cdf0e10cSrcweir pNoDfltCurrentDataSet( NULL ),
1380cdf0e10cSrcweir pMarkData( NULL ),
1381cdf0e10cSrcweir nObjectId( 0 ),
1382cdf0e10cSrcweir bChartColAsHdr( sal_False ),
1383cdf0e10cSrcweir bChartRowAsHdr( sal_False ),
1384cdf0e10cSrcweir bCursorOnly( sal_False ),
1385cdf0e10cSrcweir bGotDataChangedHint( sal_False ),
1386cdf0e10cSrcweir aValueListeners( 0 )
1387cdf0e10cSrcweir {
1388cdf0e10cSrcweir ScRange aCellRange(rR);
1389cdf0e10cSrcweir aCellRange.Justify();
1390cdf0e10cSrcweir aRanges.Append( aCellRange );
1391cdf0e10cSrcweir
1392cdf0e10cSrcweir if (pDocShell) // Null if created with createInstance
1393cdf0e10cSrcweir {
1394cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
1395cdf0e10cSrcweir pDoc->AddUnoObject(*this);
1396cdf0e10cSrcweir nObjectId = pDoc->GetNewUnoId();
1397cdf0e10cSrcweir }
1398cdf0e10cSrcweir }
1399cdf0e10cSrcweir
ScCellRangesBase(ScDocShell * pDocSh,const ScRangeList & rR)1400cdf0e10cSrcweir ScCellRangesBase::ScCellRangesBase(ScDocShell* pDocSh, const ScRangeList& rR) :
1401cdf0e10cSrcweir pPropSet(lcl_GetCellsPropertySet()),
1402cdf0e10cSrcweir pDocShell( pDocSh ),
1403cdf0e10cSrcweir pValueListener( NULL ),
1404cdf0e10cSrcweir pCurrentFlat( NULL ),
1405cdf0e10cSrcweir pCurrentDeep( NULL ),
1406cdf0e10cSrcweir pCurrentDataSet( NULL ),
1407cdf0e10cSrcweir pNoDfltCurrentDataSet( NULL ),
1408cdf0e10cSrcweir pMarkData( NULL ),
1409cdf0e10cSrcweir aRanges( rR ),
1410cdf0e10cSrcweir nObjectId( 0 ),
1411cdf0e10cSrcweir bChartColAsHdr( sal_False ),
1412cdf0e10cSrcweir bChartRowAsHdr( sal_False ),
1413cdf0e10cSrcweir bCursorOnly( sal_False ),
1414cdf0e10cSrcweir bGotDataChangedHint( sal_False ),
1415cdf0e10cSrcweir aValueListeners( 0 )
1416cdf0e10cSrcweir {
1417cdf0e10cSrcweir if (pDocShell) // Null if created with createInstance
1418cdf0e10cSrcweir {
1419cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
1420cdf0e10cSrcweir pDoc->AddUnoObject(*this);
1421cdf0e10cSrcweir nObjectId = pDoc->GetNewUnoId();
1422cdf0e10cSrcweir }
1423cdf0e10cSrcweir }
1424cdf0e10cSrcweir
~ScCellRangesBase()1425cdf0e10cSrcweir ScCellRangesBase::~ScCellRangesBase()
1426cdf0e10cSrcweir {
1427cdf0e10cSrcweir // #107294# call RemoveUnoObject first, so no notification can happen
1428cdf0e10cSrcweir // during ForgetCurrentAttrs
1429cdf0e10cSrcweir
1430cdf0e10cSrcweir if (pDocShell)
1431cdf0e10cSrcweir pDocShell->GetDocument()->RemoveUnoObject(*this);
1432cdf0e10cSrcweir
1433cdf0e10cSrcweir ForgetCurrentAttrs();
1434cdf0e10cSrcweir ForgetMarkData();
1435cdf0e10cSrcweir
1436cdf0e10cSrcweir delete pValueListener;
1437cdf0e10cSrcweir
1438cdf0e10cSrcweir //! XChartDataChangeEventListener abmelden ??
1439cdf0e10cSrcweir //! (ChartCollection haelt dann auch dieses Objekt fest!)
1440cdf0e10cSrcweir }
1441cdf0e10cSrcweir
ForgetCurrentAttrs()1442cdf0e10cSrcweir void ScCellRangesBase::ForgetCurrentAttrs()
1443cdf0e10cSrcweir {
1444cdf0e10cSrcweir delete pCurrentFlat;
1445cdf0e10cSrcweir delete pCurrentDeep;
1446cdf0e10cSrcweir delete pCurrentDataSet;
1447cdf0e10cSrcweir delete pNoDfltCurrentDataSet;
1448cdf0e10cSrcweir pCurrentFlat = NULL;
1449cdf0e10cSrcweir pCurrentDeep = NULL;
1450cdf0e10cSrcweir pCurrentDataSet = NULL;
1451cdf0e10cSrcweir pNoDfltCurrentDataSet = NULL;
1452cdf0e10cSrcweir
1453cdf0e10cSrcweir // #i62483# pMarkData can remain unchanged, is deleted only if the range changes (RefChanged)
1454cdf0e10cSrcweir }
1455cdf0e10cSrcweir
ForgetMarkData()1456cdf0e10cSrcweir void ScCellRangesBase::ForgetMarkData()
1457cdf0e10cSrcweir {
1458cdf0e10cSrcweir delete pMarkData;
1459cdf0e10cSrcweir pMarkData = NULL;
1460cdf0e10cSrcweir }
1461cdf0e10cSrcweir
GetCurrentAttrsFlat()1462cdf0e10cSrcweir const ScPatternAttr* ScCellRangesBase::GetCurrentAttrsFlat()
1463cdf0e10cSrcweir {
1464cdf0e10cSrcweir // get and cache direct cell attributes for this object's range
1465cdf0e10cSrcweir
1466cdf0e10cSrcweir if ( !pCurrentFlat && pDocShell )
1467cdf0e10cSrcweir {
1468cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
1469cdf0e10cSrcweir pCurrentFlat = pDoc->CreateSelectionPattern( *GetMarkData(), sal_False );
1470cdf0e10cSrcweir }
1471cdf0e10cSrcweir return pCurrentFlat;
1472cdf0e10cSrcweir }
1473cdf0e10cSrcweir
GetCurrentAttrsDeep()1474cdf0e10cSrcweir const ScPatternAttr* ScCellRangesBase::GetCurrentAttrsDeep()
1475cdf0e10cSrcweir {
1476cdf0e10cSrcweir // get and cache cell attributes (incl. styles) for this object's range
1477cdf0e10cSrcweir
1478cdf0e10cSrcweir if ( !pCurrentDeep && pDocShell )
1479cdf0e10cSrcweir {
1480cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
1481cdf0e10cSrcweir pCurrentDeep = pDoc->CreateSelectionPattern( *GetMarkData(), sal_True );
1482cdf0e10cSrcweir }
1483cdf0e10cSrcweir return pCurrentDeep;
1484cdf0e10cSrcweir }
1485cdf0e10cSrcweir
GetCurrentDataSet(bool bNoDflt)1486cdf0e10cSrcweir SfxItemSet* ScCellRangesBase::GetCurrentDataSet(bool bNoDflt)
1487cdf0e10cSrcweir {
1488cdf0e10cSrcweir if(!pCurrentDataSet)
1489cdf0e10cSrcweir {
1490cdf0e10cSrcweir const ScPatternAttr* pPattern = GetCurrentAttrsDeep();
1491cdf0e10cSrcweir if ( pPattern )
1492cdf0e10cSrcweir {
1493cdf0e10cSrcweir // Dontcare durch Default ersetzen, damit man immer eine Reflection hat
1494cdf0e10cSrcweir pCurrentDataSet = new SfxItemSet( pPattern->GetItemSet() );
1495cdf0e10cSrcweir pNoDfltCurrentDataSet = new SfxItemSet( pPattern->GetItemSet() );
1496cdf0e10cSrcweir pCurrentDataSet->ClearInvalidItems();
1497cdf0e10cSrcweir }
1498cdf0e10cSrcweir }
1499cdf0e10cSrcweir return bNoDflt ? pNoDfltCurrentDataSet : pCurrentDataSet;
1500cdf0e10cSrcweir }
1501cdf0e10cSrcweir
GetMarkData()1502cdf0e10cSrcweir const ScMarkData* ScCellRangesBase::GetMarkData()
1503cdf0e10cSrcweir {
1504cdf0e10cSrcweir if (!pMarkData)
1505cdf0e10cSrcweir {
1506cdf0e10cSrcweir pMarkData = new ScMarkData();
1507cdf0e10cSrcweir pMarkData->MarkFromRangeList( aRanges, sal_False );
1508cdf0e10cSrcweir }
1509cdf0e10cSrcweir return pMarkData;
1510cdf0e10cSrcweir }
1511cdf0e10cSrcweir
Notify(SfxBroadcaster &,const SfxHint & rHint)1512cdf0e10cSrcweir void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint )
1513cdf0e10cSrcweir {
1514cdf0e10cSrcweir if ( rHint.ISA( ScUpdateRefHint ) )
1515cdf0e10cSrcweir {
1516cdf0e10cSrcweir const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint;
1517cdf0e10cSrcweir
1518cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
1519cdf0e10cSrcweir ScRangeList* pUndoRanges = NULL;
1520cdf0e10cSrcweir if ( pDoc->HasUnoRefUndo() )
1521cdf0e10cSrcweir pUndoRanges = new ScRangeList( aRanges );
1522cdf0e10cSrcweir
1523cdf0e10cSrcweir if ( aRanges.UpdateReference( rRef.GetMode(), pDoc, rRef.GetRange(),
1524cdf0e10cSrcweir rRef.GetDx(), rRef.GetDy(), rRef.GetDz() ) )
1525cdf0e10cSrcweir {
1526cdf0e10cSrcweir if (rRef.GetMode() == URM_INSDEL &&
1527cdf0e10cSrcweir aRanges.Count() == 1 &&
1528cdf0e10cSrcweir ScTableSheetObj::getImplementation( (cppu::OWeakObject*)this ))
1529cdf0e10cSrcweir {
1530cdf0e10cSrcweir // #101755#; the range size of a sheet does not change
1531cdf0e10cSrcweir ScRange* pR = aRanges.First();
1532cdf0e10cSrcweir if (pR)
1533cdf0e10cSrcweir {
1534cdf0e10cSrcweir pR->aStart.SetCol(0);
1535cdf0e10cSrcweir pR->aStart.SetRow(0);
1536cdf0e10cSrcweir pR->aEnd.SetCol(MAXCOL);
1537cdf0e10cSrcweir pR->aEnd.SetRow(MAXROW);
1538cdf0e10cSrcweir }
1539cdf0e10cSrcweir }
1540cdf0e10cSrcweir RefChanged();
1541cdf0e10cSrcweir
1542cdf0e10cSrcweir // #129050# any change of the range address is broadcast to value (modify) listeners
1543cdf0e10cSrcweir if ( aValueListeners.Count() )
1544cdf0e10cSrcweir bGotDataChangedHint = sal_True;
1545cdf0e10cSrcweir
1546cdf0e10cSrcweir if ( pUndoRanges )
1547cdf0e10cSrcweir pDoc->AddUnoRefChange( nObjectId, *pUndoRanges );
1548cdf0e10cSrcweir }
1549cdf0e10cSrcweir
1550cdf0e10cSrcweir delete pUndoRanges;
1551cdf0e10cSrcweir }
1552cdf0e10cSrcweir else if ( rHint.ISA( SfxSimpleHint ) )
1553cdf0e10cSrcweir {
1554cdf0e10cSrcweir sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId();
1555cdf0e10cSrcweir if ( nId == SFX_HINT_DYING )
1556cdf0e10cSrcweir {
1557cdf0e10cSrcweir ForgetCurrentAttrs();
1558cdf0e10cSrcweir pDocShell = NULL; // invalid
1559cdf0e10cSrcweir
1560cdf0e10cSrcweir if ( aValueListeners.Count() != 0 )
1561cdf0e10cSrcweir {
1562cdf0e10cSrcweir // dispose listeners
1563cdf0e10cSrcweir
1564cdf0e10cSrcweir lang::EventObject aEvent;
1565cdf0e10cSrcweir aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
1566cdf0e10cSrcweir for ( sal_uInt16 n=0; n<aValueListeners.Count(); n++ )
1567cdf0e10cSrcweir (*aValueListeners[n])->disposing( aEvent );
1568cdf0e10cSrcweir
1569cdf0e10cSrcweir aValueListeners.DeleteAndDestroy( 0, aValueListeners.Count() );
1570cdf0e10cSrcweir
1571cdf0e10cSrcweir // The listeners can't have the last ref to this, as it's still held
1572cdf0e10cSrcweir // by the DocShell.
1573cdf0e10cSrcweir }
1574cdf0e10cSrcweir }
1575cdf0e10cSrcweir else if ( nId == SFX_HINT_DATACHANGED )
1576cdf0e10cSrcweir {
1577cdf0e10cSrcweir // document content changed -> forget cached attributes
1578cdf0e10cSrcweir ForgetCurrentAttrs();
1579cdf0e10cSrcweir
1580cdf0e10cSrcweir if ( bGotDataChangedHint && pDocShell )
1581cdf0e10cSrcweir {
1582cdf0e10cSrcweir // This object was notified of content changes, so one call
1583cdf0e10cSrcweir // for each listener is generated now.
1584cdf0e10cSrcweir // The calls can't be executed directly because the document's
1585cdf0e10cSrcweir // UNO broadcaster list must not be modified.
1586cdf0e10cSrcweir // Instead, add to the document's list of listener calls,
1587cdf0e10cSrcweir // which will be executed directly after the broadcast of
1588cdf0e10cSrcweir // SFX_HINT_DATACHANGED.
1589cdf0e10cSrcweir
1590cdf0e10cSrcweir lang::EventObject aEvent;
1591cdf0e10cSrcweir aEvent.Source.set((cppu::OWeakObject*)this);
1592cdf0e10cSrcweir
1593cdf0e10cSrcweir // the EventObject holds a Ref to this object until after the listener calls
1594cdf0e10cSrcweir
1595cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
1596cdf0e10cSrcweir for ( sal_uInt16 n=0; n<aValueListeners.Count(); n++ )
1597cdf0e10cSrcweir pDoc->AddUnoListenerCall( *aValueListeners[n], aEvent );
1598cdf0e10cSrcweir
1599cdf0e10cSrcweir bGotDataChangedHint = sal_False;
1600cdf0e10cSrcweir }
1601cdf0e10cSrcweir }
1602cdf0e10cSrcweir else if ( nId == SC_HINT_CALCALL )
1603cdf0e10cSrcweir {
1604cdf0e10cSrcweir // broadcast from DoHardRecalc - set bGotDataChangedHint
1605cdf0e10cSrcweir // (SFX_HINT_DATACHANGED follows separately)
1606cdf0e10cSrcweir
1607cdf0e10cSrcweir if ( aValueListeners.Count() )
1608cdf0e10cSrcweir bGotDataChangedHint = sal_True;
1609cdf0e10cSrcweir }
1610cdf0e10cSrcweir }
1611cdf0e10cSrcweir else if ( rHint.ISA( ScUnoRefUndoHint ) )
1612cdf0e10cSrcweir {
1613cdf0e10cSrcweir const ScUnoRefUndoHint& rUndoHint = static_cast<const ScUnoRefUndoHint&>(rHint);
1614cdf0e10cSrcweir if ( rUndoHint.GetObjectId() == nObjectId )
1615cdf0e10cSrcweir {
1616cdf0e10cSrcweir // restore ranges from hint
1617cdf0e10cSrcweir
1618cdf0e10cSrcweir aRanges = rUndoHint.GetRanges();
1619cdf0e10cSrcweir
1620cdf0e10cSrcweir RefChanged();
1621cdf0e10cSrcweir if ( aValueListeners.Count() )
1622cdf0e10cSrcweir bGotDataChangedHint = sal_True; // need to broadcast the undo, too
1623cdf0e10cSrcweir }
1624cdf0e10cSrcweir }
1625cdf0e10cSrcweir }
1626cdf0e10cSrcweir
RefChanged()1627cdf0e10cSrcweir void ScCellRangesBase::RefChanged()
1628cdf0e10cSrcweir {
1629cdf0e10cSrcweir //! adjust XChartDataChangeEventListener
1630cdf0e10cSrcweir
1631cdf0e10cSrcweir if ( pValueListener && aValueListeners.Count() != 0 )
1632cdf0e10cSrcweir {
1633cdf0e10cSrcweir pValueListener->EndListeningAll();
1634cdf0e10cSrcweir
1635cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
1636cdf0e10cSrcweir sal_uLong nCount = aRanges.Count();
1637cdf0e10cSrcweir for (sal_uLong i=0; i<nCount; i++)
1638cdf0e10cSrcweir pDoc->StartListeningArea( *aRanges.GetObject(i), pValueListener );
1639cdf0e10cSrcweir }
1640cdf0e10cSrcweir
1641cdf0e10cSrcweir ForgetCurrentAttrs();
1642cdf0e10cSrcweir ForgetMarkData();
1643cdf0e10cSrcweir }
1644cdf0e10cSrcweir
GetDocument() const1645cdf0e10cSrcweir ScDocument* ScCellRangesBase::GetDocument() const
1646cdf0e10cSrcweir {
1647cdf0e10cSrcweir if (pDocShell)
1648cdf0e10cSrcweir return pDocShell->GetDocument();
1649cdf0e10cSrcweir else
1650cdf0e10cSrcweir return NULL;
1651cdf0e10cSrcweir }
1652cdf0e10cSrcweir
InitInsertRange(ScDocShell * pDocSh,const ScRange & rR)1653cdf0e10cSrcweir void ScCellRangesBase::InitInsertRange(ScDocShell* pDocSh, const ScRange& rR)
1654cdf0e10cSrcweir {
1655cdf0e10cSrcweir if ( !pDocShell && pDocSh )
1656cdf0e10cSrcweir {
1657cdf0e10cSrcweir pDocShell = pDocSh;
1658cdf0e10cSrcweir
1659cdf0e10cSrcweir ScRange aCellRange(rR);
1660cdf0e10cSrcweir aCellRange.Justify();
1661cdf0e10cSrcweir aRanges.RemoveAll();
1662cdf0e10cSrcweir aRanges.Append( aCellRange );
1663cdf0e10cSrcweir
1664cdf0e10cSrcweir pDocShell->GetDocument()->AddUnoObject(*this);
1665cdf0e10cSrcweir
1666cdf0e10cSrcweir RefChanged(); // Range im Range-Objekt anpassen
1667cdf0e10cSrcweir }
1668cdf0e10cSrcweir }
1669cdf0e10cSrcweir
AddRange(const ScRange & rRange,const sal_Bool bMergeRanges)1670cdf0e10cSrcweir void ScCellRangesBase::AddRange(const ScRange& rRange, const sal_Bool bMergeRanges)
1671cdf0e10cSrcweir {
1672cdf0e10cSrcweir if (bMergeRanges)
1673cdf0e10cSrcweir aRanges.Join(rRange);
1674cdf0e10cSrcweir else
1675cdf0e10cSrcweir aRanges.Append(rRange);
1676cdf0e10cSrcweir RefChanged();
1677cdf0e10cSrcweir }
1678cdf0e10cSrcweir
SetNewRange(const ScRange & rNew)1679cdf0e10cSrcweir void ScCellRangesBase::SetNewRange(const ScRange& rNew)
1680cdf0e10cSrcweir {
1681cdf0e10cSrcweir ScRange aCellRange(rNew);
1682cdf0e10cSrcweir aCellRange.Justify();
1683cdf0e10cSrcweir
1684cdf0e10cSrcweir aRanges.RemoveAll();
1685cdf0e10cSrcweir aRanges.Append( aCellRange );
1686cdf0e10cSrcweir RefChanged();
1687cdf0e10cSrcweir }
1688cdf0e10cSrcweir
SetNewRanges(const ScRangeList & rNew)1689cdf0e10cSrcweir void ScCellRangesBase::SetNewRanges(const ScRangeList& rNew)
1690cdf0e10cSrcweir {
1691cdf0e10cSrcweir aRanges = rNew;
1692cdf0e10cSrcweir RefChanged();
1693cdf0e10cSrcweir }
1694cdf0e10cSrcweir
SetCursorOnly(sal_Bool bSet)1695cdf0e10cSrcweir void ScCellRangesBase::SetCursorOnly( sal_Bool bSet )
1696cdf0e10cSrcweir {
1697cdf0e10cSrcweir // set for a selection object that is created from the cursor position
1698cdf0e10cSrcweir // without anything selected (may contain several sheets)
1699cdf0e10cSrcweir
1700cdf0e10cSrcweir bCursorOnly = bSet;
1701cdf0e10cSrcweir }
1702cdf0e10cSrcweir
queryInterface(const uno::Type & rType)1703cdf0e10cSrcweir uno::Any SAL_CALL ScCellRangesBase::queryInterface( const uno::Type& rType )
1704cdf0e10cSrcweir throw(uno::RuntimeException)
1705cdf0e10cSrcweir {
1706cdf0e10cSrcweir SC_QUERYINTERFACE( beans::XPropertySet )
1707cdf0e10cSrcweir SC_QUERYINTERFACE( beans::XMultiPropertySet )
1708cdf0e10cSrcweir SC_QUERYINTERFACE( beans::XTolerantMultiPropertySet )
1709cdf0e10cSrcweir SC_QUERYINTERFACE( beans::XPropertyState )
1710cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XSheetOperation )
1711cdf0e10cSrcweir SC_QUERYINTERFACE( chart::XChartDataArray )
1712cdf0e10cSrcweir SC_QUERYINTERFACE( chart::XChartData )
1713cdf0e10cSrcweir SC_QUERYINTERFACE( util::XIndent )
1714cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XCellRangesQuery )
1715cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XFormulaQuery )
1716cdf0e10cSrcweir SC_QUERYINTERFACE( util::XReplaceable )
1717cdf0e10cSrcweir SC_QUERYINTERFACE( util::XSearchable )
1718cdf0e10cSrcweir SC_QUERYINTERFACE( util::XModifyBroadcaster )
1719cdf0e10cSrcweir SC_QUERYINTERFACE( lang::XServiceInfo )
1720cdf0e10cSrcweir SC_QUERYINTERFACE( lang::XUnoTunnel )
1721cdf0e10cSrcweir SC_QUERYINTERFACE( lang::XTypeProvider )
1722cdf0e10cSrcweir
1723cdf0e10cSrcweir return OWeakObject::queryInterface( rType );
1724cdf0e10cSrcweir }
1725cdf0e10cSrcweir
acquire()1726cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::acquire() throw()
1727cdf0e10cSrcweir {
1728cdf0e10cSrcweir OWeakObject::acquire();
1729cdf0e10cSrcweir }
1730cdf0e10cSrcweir
release()1731cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::release() throw()
1732cdf0e10cSrcweir {
1733cdf0e10cSrcweir OWeakObject::release();
1734cdf0e10cSrcweir }
1735cdf0e10cSrcweir
getTypes()1736cdf0e10cSrcweir uno::Sequence<uno::Type> SAL_CALL ScCellRangesBase::getTypes() throw(uno::RuntimeException)
1737cdf0e10cSrcweir {
1738cdf0e10cSrcweir static uno::Sequence<uno::Type> aTypes;
1739cdf0e10cSrcweir if ( aTypes.getLength() == 0 )
1740cdf0e10cSrcweir {
1741cdf0e10cSrcweir aTypes.realloc(13);
1742cdf0e10cSrcweir uno::Type* pPtr = aTypes.getArray();
1743cdf0e10cSrcweir pPtr[0] = getCppuType((const uno::Reference<beans::XPropertySet>*)0);
1744cdf0e10cSrcweir pPtr[1] = getCppuType((const uno::Reference<beans::XMultiPropertySet>*)0);
1745cdf0e10cSrcweir pPtr[2] = getCppuType((const uno::Reference<beans::XPropertyState>*)0);
1746cdf0e10cSrcweir pPtr[3] = getCppuType((const uno::Reference<sheet::XSheetOperation>*)0);
1747cdf0e10cSrcweir pPtr[4] = getCppuType((const uno::Reference<chart::XChartDataArray>*)0);
1748cdf0e10cSrcweir pPtr[5] = getCppuType((const uno::Reference<util::XIndent>*)0);
1749cdf0e10cSrcweir pPtr[6] = getCppuType((const uno::Reference<sheet::XCellRangesQuery>*)0);
1750cdf0e10cSrcweir pPtr[7] = getCppuType((const uno::Reference<sheet::XFormulaQuery>*)0);
1751cdf0e10cSrcweir pPtr[8] = getCppuType((const uno::Reference<util::XReplaceable>*)0);
1752cdf0e10cSrcweir pPtr[9] = getCppuType((const uno::Reference<util::XModifyBroadcaster>*)0);
1753cdf0e10cSrcweir pPtr[10]= getCppuType((const uno::Reference<lang::XServiceInfo>*)0);
1754cdf0e10cSrcweir pPtr[11]= getCppuType((const uno::Reference<lang::XUnoTunnel>*)0);
1755cdf0e10cSrcweir pPtr[12]= getCppuType((const uno::Reference<lang::XTypeProvider>*)0);
1756cdf0e10cSrcweir }
1757cdf0e10cSrcweir return aTypes;
1758cdf0e10cSrcweir }
1759cdf0e10cSrcweir
getImplementationId()1760cdf0e10cSrcweir uno::Sequence<sal_Int8> SAL_CALL ScCellRangesBase::getImplementationId()
1761cdf0e10cSrcweir throw(uno::RuntimeException)
1762cdf0e10cSrcweir {
1763cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aId;
1764cdf0e10cSrcweir if( aId.getLength() == 0 )
1765cdf0e10cSrcweir {
1766cdf0e10cSrcweir aId.realloc( 16 );
1767cdf0e10cSrcweir rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
1768cdf0e10cSrcweir }
1769cdf0e10cSrcweir return aId;
1770cdf0e10cSrcweir }
1771cdf0e10cSrcweir
1772cdf0e10cSrcweir // ---
1773cdf0e10cSrcweir
PaintRanges_Impl(sal_uInt16 nPart)1774cdf0e10cSrcweir void ScCellRangesBase::PaintRanges_Impl( sal_uInt16 nPart )
1775cdf0e10cSrcweir {
1776cdf0e10cSrcweir sal_uLong nCount = aRanges.Count();
1777cdf0e10cSrcweir for (sal_uLong i=0; i<nCount; i++)
1778cdf0e10cSrcweir pDocShell->PostPaint( *aRanges.GetObject(i), nPart );
1779cdf0e10cSrcweir }
1780cdf0e10cSrcweir
1781cdf0e10cSrcweir // XSheetOperation
1782cdf0e10cSrcweir
computeFunction(sheet::GeneralFunction nFunction)1783cdf0e10cSrcweir double SAL_CALL ScCellRangesBase::computeFunction( sheet::GeneralFunction nFunction )
1784cdf0e10cSrcweir throw(uno::Exception, uno::RuntimeException)
1785cdf0e10cSrcweir {
1786cdf0e10cSrcweir ScUnoGuard aGuard;
1787cdf0e10cSrcweir ScMarkData aMark(*GetMarkData());
1788cdf0e10cSrcweir aMark.MarkToSimple();
1789cdf0e10cSrcweir if (!aMark.IsMarked())
1790cdf0e10cSrcweir aMark.SetMarkNegative(sal_True); // um Dummy Position angeben zu koennen
1791cdf0e10cSrcweir
1792cdf0e10cSrcweir ScAddress aDummy; // wenn nicht Marked, ignoriert wegen Negative
1793cdf0e10cSrcweir double fVal;
1794cdf0e10cSrcweir ScSubTotalFunc eFunc = lcl_SummaryToSubTotal( nFunction );
1795cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
1796cdf0e10cSrcweir if ( !pDoc->GetSelectionFunction( eFunc, aDummy, aMark, fVal ) )
1797cdf0e10cSrcweir {
1798cdf0e10cSrcweir throw uno::RuntimeException(); //! own exception?
1799cdf0e10cSrcweir }
1800cdf0e10cSrcweir
1801cdf0e10cSrcweir return fVal;
1802cdf0e10cSrcweir }
1803cdf0e10cSrcweir
clearContents(sal_Int32 nContentFlags)1804cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::clearContents( sal_Int32 nContentFlags ) throw(uno::RuntimeException)
1805cdf0e10cSrcweir {
1806cdf0e10cSrcweir ScUnoGuard aGuard;
1807cdf0e10cSrcweir if ( aRanges.Count() )
1808cdf0e10cSrcweir {
1809cdf0e10cSrcweir // only for clearContents: EDITATTR is only used if no contents are deleted
1810cdf0e10cSrcweir sal_uInt16 nDelFlags = static_cast< sal_uInt16 >( nContentFlags & IDF_ALL );
1811cdf0e10cSrcweir if ( ( nContentFlags & IDF_EDITATTR ) && ( nContentFlags & IDF_CONTENTS ) == 0 )
1812cdf0e10cSrcweir nDelFlags |= IDF_EDITATTR;
1813cdf0e10cSrcweir
1814cdf0e10cSrcweir ScDocFunc aFunc(*pDocShell);
1815cdf0e10cSrcweir aFunc.DeleteContents( *GetMarkData(), nDelFlags, sal_True, sal_True );
1816cdf0e10cSrcweir }
1817cdf0e10cSrcweir // sonst ist nichts zu tun
1818cdf0e10cSrcweir }
1819cdf0e10cSrcweir
1820cdf0e10cSrcweir // XPropertyState
1821cdf0e10cSrcweir
GetItemPropertyMap()1822cdf0e10cSrcweir const SfxItemPropertyMap* ScCellRangesBase::GetItemPropertyMap()
1823cdf0e10cSrcweir {
1824cdf0e10cSrcweir return pPropSet->getPropertyMap();
1825cdf0e10cSrcweir }
1826cdf0e10cSrcweir
lcl_GetPropertyWhich(const SfxItemPropertySimpleEntry * pEntry,sal_uInt16 & rItemWhich)1827cdf0e10cSrcweir void lcl_GetPropertyWhich( const SfxItemPropertySimpleEntry* pEntry,
1828cdf0e10cSrcweir sal_uInt16& rItemWhich )
1829cdf0e10cSrcweir {
1830cdf0e10cSrcweir // Which-ID des betroffenen Items, auch wenn das Item die Property
1831cdf0e10cSrcweir // nicht alleine behandeln kann
1832cdf0e10cSrcweir if ( pEntry )
1833cdf0e10cSrcweir {
1834cdf0e10cSrcweir if ( IsScItemWid( pEntry->nWID ) )
1835cdf0e10cSrcweir rItemWhich = pEntry->nWID;
1836cdf0e10cSrcweir else
1837cdf0e10cSrcweir switch ( pEntry->nWID )
1838cdf0e10cSrcweir {
1839cdf0e10cSrcweir case SC_WID_UNO_TBLBORD:
1840cdf0e10cSrcweir rItemWhich = ATTR_BORDER;
1841cdf0e10cSrcweir break;
1842cdf0e10cSrcweir case SC_WID_UNO_CONDFMT:
1843cdf0e10cSrcweir case SC_WID_UNO_CONDLOC:
1844cdf0e10cSrcweir case SC_WID_UNO_CONDXML:
1845cdf0e10cSrcweir rItemWhich = ATTR_CONDITIONAL;
1846cdf0e10cSrcweir break;
1847cdf0e10cSrcweir case SC_WID_UNO_VALIDAT:
1848cdf0e10cSrcweir case SC_WID_UNO_VALILOC:
1849cdf0e10cSrcweir case SC_WID_UNO_VALIXML:
1850cdf0e10cSrcweir rItemWhich = ATTR_VALIDDATA;
1851cdf0e10cSrcweir break;
1852cdf0e10cSrcweir }
1853cdf0e10cSrcweir }
1854cdf0e10cSrcweir
1855cdf0e10cSrcweir }
1856cdf0e10cSrcweir
GetOnePropertyState(sal_uInt16 nItemWhich,const SfxItemPropertySimpleEntry * pEntry)1857cdf0e10cSrcweir beans::PropertyState ScCellRangesBase::GetOnePropertyState( sal_uInt16 nItemWhich, const SfxItemPropertySimpleEntry* pEntry )
1858cdf0e10cSrcweir {
1859cdf0e10cSrcweir beans::PropertyState eRet = beans::PropertyState_DIRECT_VALUE;
1860cdf0e10cSrcweir if ( nItemWhich ) // item wid (from map or special case)
1861cdf0e10cSrcweir {
1862cdf0e10cSrcweir // For items that contain several properties (like background),
1863cdf0e10cSrcweir // "ambiguous" is returned too often here
1864cdf0e10cSrcweir
1865cdf0e10cSrcweir // for PropertyState, don't look at styles
1866cdf0e10cSrcweir const ScPatternAttr* pPattern = GetCurrentAttrsFlat();
1867cdf0e10cSrcweir if ( pPattern )
1868cdf0e10cSrcweir {
1869cdf0e10cSrcweir SfxItemState eState = pPattern->GetItemSet().GetItemState( nItemWhich, sal_False );
1870cdf0e10cSrcweir
1871cdf0e10cSrcweir // // if no rotate value is set, look at orientation
1872cdf0e10cSrcweir // //! also for a fixed value of 0 (in case orientation is ambiguous)?
1873cdf0e10cSrcweir // if ( nItemWhich == ATTR_ROTATE_VALUE && eState == SFX_ITEM_DEFAULT )
1874cdf0e10cSrcweir // eState = pPattern->GetItemSet().GetItemState( ATTR_ORIENTATION, sal_False );
1875cdf0e10cSrcweir
1876cdf0e10cSrcweir if ( nItemWhich == ATTR_VALUE_FORMAT && eState == SFX_ITEM_DEFAULT )
1877cdf0e10cSrcweir eState = pPattern->GetItemSet().GetItemState( ATTR_LANGUAGE_FORMAT, sal_False );
1878cdf0e10cSrcweir
1879cdf0e10cSrcweir if ( eState == SFX_ITEM_SET )
1880cdf0e10cSrcweir eRet = beans::PropertyState_DIRECT_VALUE;
1881cdf0e10cSrcweir else if ( eState == SFX_ITEM_DEFAULT )
1882cdf0e10cSrcweir eRet = beans::PropertyState_DEFAULT_VALUE;
1883cdf0e10cSrcweir else if ( eState == SFX_ITEM_DONTCARE )
1884cdf0e10cSrcweir eRet = beans::PropertyState_AMBIGUOUS_VALUE;
1885cdf0e10cSrcweir else
1886cdf0e10cSrcweir {
1887cdf0e10cSrcweir DBG_ERROR("unbekannter ItemState");
1888cdf0e10cSrcweir }
1889cdf0e10cSrcweir }
1890cdf0e10cSrcweir }
1891cdf0e10cSrcweir else if ( pEntry )
1892cdf0e10cSrcweir {
1893cdf0e10cSrcweir if ( pEntry->nWID == SC_WID_UNO_CHCOLHDR || pEntry->nWID == SC_WID_UNO_CHROWHDR || pEntry->nWID == SC_WID_UNO_ABSNAME )
1894cdf0e10cSrcweir eRet = beans::PropertyState_DIRECT_VALUE;
1895cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
1896cdf0e10cSrcweir {
1897cdf0e10cSrcweir // a style is always set, there's no default state
1898cdf0e10cSrcweir const ScStyleSheet* pStyle = pDocShell->GetDocument()->GetSelectionStyle(*GetMarkData());
1899cdf0e10cSrcweir if (pStyle)
1900cdf0e10cSrcweir eRet = beans::PropertyState_DIRECT_VALUE;
1901cdf0e10cSrcweir else
1902cdf0e10cSrcweir eRet = beans::PropertyState_AMBIGUOUS_VALUE;
1903cdf0e10cSrcweir }
1904cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_NUMRULES )
1905cdf0e10cSrcweir eRet = beans::PropertyState_DEFAULT_VALUE; // numbering rules are always default
1906cdf0e10cSrcweir }
1907cdf0e10cSrcweir return eRet;
1908cdf0e10cSrcweir }
1909cdf0e10cSrcweir
getPropertyState(const rtl::OUString & aPropertyName)1910cdf0e10cSrcweir beans::PropertyState SAL_CALL ScCellRangesBase::getPropertyState( const rtl::OUString& aPropertyName )
1911cdf0e10cSrcweir throw(beans::UnknownPropertyException, uno::RuntimeException)
1912cdf0e10cSrcweir {
1913cdf0e10cSrcweir ScUnoGuard aGuard;
1914cdf0e10cSrcweir if ( aRanges.Count() == 0 )
1915cdf0e10cSrcweir throw uno::RuntimeException();
1916cdf0e10cSrcweir
1917cdf0e10cSrcweir const SfxItemPropertyMap* pMap = GetItemPropertyMap(); // from derived class
1918cdf0e10cSrcweir sal_uInt16 nItemWhich = 0;
1919cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( aPropertyName );
1920cdf0e10cSrcweir lcl_GetPropertyWhich( pEntry, nItemWhich );
1921cdf0e10cSrcweir return GetOnePropertyState( nItemWhich, pEntry );
1922cdf0e10cSrcweir }
1923cdf0e10cSrcweir
getPropertyStates(const uno::Sequence<rtl::OUString> & aPropertyNames)1924cdf0e10cSrcweir uno::Sequence<beans::PropertyState> SAL_CALL ScCellRangesBase::getPropertyStates(
1925cdf0e10cSrcweir const uno::Sequence<rtl::OUString>& aPropertyNames )
1926cdf0e10cSrcweir throw(beans::UnknownPropertyException, uno::RuntimeException)
1927cdf0e10cSrcweir {
1928cdf0e10cSrcweir ScUnoGuard aGuard;
1929cdf0e10cSrcweir
1930cdf0e10cSrcweir const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
1931cdf0e10cSrcweir
1932cdf0e10cSrcweir uno::Sequence<beans::PropertyState> aRet(aPropertyNames.getLength());
1933cdf0e10cSrcweir beans::PropertyState* pStates = aRet.getArray();
1934cdf0e10cSrcweir for(sal_Int32 i = 0; i < aPropertyNames.getLength(); i++)
1935cdf0e10cSrcweir {
1936cdf0e10cSrcweir sal_uInt16 nItemWhich = 0;
1937cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( aPropertyNames[i] );
1938cdf0e10cSrcweir lcl_GetPropertyWhich( pEntry, nItemWhich );
1939cdf0e10cSrcweir pStates[i] = GetOnePropertyState(nItemWhich, pEntry);
1940cdf0e10cSrcweir }
1941cdf0e10cSrcweir return aRet;
1942cdf0e10cSrcweir }
1943cdf0e10cSrcweir
setPropertyToDefault(const rtl::OUString & aPropertyName)1944cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::setPropertyToDefault( const rtl::OUString& aPropertyName )
1945cdf0e10cSrcweir throw(beans::UnknownPropertyException, uno::RuntimeException)
1946cdf0e10cSrcweir {
1947cdf0e10cSrcweir ScUnoGuard aGuard;
1948cdf0e10cSrcweir if ( pDocShell )
1949cdf0e10cSrcweir {
1950cdf0e10cSrcweir const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
1951cdf0e10cSrcweir sal_uInt16 nItemWhich = 0;
1952cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( aPropertyName );
1953cdf0e10cSrcweir lcl_GetPropertyWhich( pEntry, nItemWhich );
1954cdf0e10cSrcweir if ( nItemWhich ) // item wid (from map or special case)
1955cdf0e10cSrcweir {
1956cdf0e10cSrcweir if ( aRanges.Count() ) // leer = nichts zu tun
1957cdf0e10cSrcweir {
1958cdf0e10cSrcweir ScDocFunc aFunc(*pDocShell);
1959cdf0e10cSrcweir
1960cdf0e10cSrcweir //! Bei Items, die mehrere Properties enthalten (z.B. Hintergrund)
1961cdf0e10cSrcweir //! wird hier zuviel zurueckgesetzt
1962cdf0e10cSrcweir
1963cdf0e10cSrcweir // //! for ATTR_ROTATE_VALUE, also reset ATTR_ORIENTATION?
1964cdf0e10cSrcweir
1965cdf0e10cSrcweir sal_uInt16 aWIDs[3];
1966cdf0e10cSrcweir aWIDs[0] = nItemWhich;
1967cdf0e10cSrcweir if ( nItemWhich == ATTR_VALUE_FORMAT )
1968cdf0e10cSrcweir {
1969cdf0e10cSrcweir aWIDs[1] = ATTR_LANGUAGE_FORMAT; // #67847# language for number formats
1970cdf0e10cSrcweir aWIDs[2] = 0;
1971cdf0e10cSrcweir }
1972cdf0e10cSrcweir else
1973cdf0e10cSrcweir aWIDs[1] = 0;
1974cdf0e10cSrcweir aFunc.ClearItems( *GetMarkData(), aWIDs, sal_True );
1975cdf0e10cSrcweir }
1976cdf0e10cSrcweir }
1977cdf0e10cSrcweir else if ( pEntry )
1978cdf0e10cSrcweir {
1979cdf0e10cSrcweir if ( pEntry->nWID == SC_WID_UNO_CHCOLHDR )
1980cdf0e10cSrcweir bChartColAsHdr = sal_False;
1981cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_CHROWHDR )
1982cdf0e10cSrcweir bChartRowAsHdr = sal_False;
1983cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
1984cdf0e10cSrcweir {
1985cdf0e10cSrcweir ScDocFunc aFunc(*pDocShell);
1986cdf0e10cSrcweir aFunc.ApplyStyle( *GetMarkData(), ScGlobal::GetRscString(STR_STYLENAME_STANDARD), sal_True, sal_True );
1987cdf0e10cSrcweir }
1988cdf0e10cSrcweir }
1989cdf0e10cSrcweir }
1990cdf0e10cSrcweir }
1991cdf0e10cSrcweir
getPropertyDefault(const rtl::OUString & aPropertyName)1992cdf0e10cSrcweir uno::Any SAL_CALL ScCellRangesBase::getPropertyDefault( const rtl::OUString& aPropertyName )
1993cdf0e10cSrcweir throw(beans::UnknownPropertyException, lang::WrappedTargetException,
1994cdf0e10cSrcweir uno::RuntimeException)
1995cdf0e10cSrcweir {
1996cdf0e10cSrcweir //! mit getPropertyValue zusammenfassen
1997cdf0e10cSrcweir
1998cdf0e10cSrcweir ScUnoGuard aGuard;
1999cdf0e10cSrcweir uno::Any aAny;
2000cdf0e10cSrcweir
2001cdf0e10cSrcweir if ( pDocShell )
2002cdf0e10cSrcweir {
2003cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
2004cdf0e10cSrcweir const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
2005cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( aPropertyName );
2006cdf0e10cSrcweir if ( pEntry )
2007cdf0e10cSrcweir {
2008cdf0e10cSrcweir if ( IsScItemWid( pEntry->nWID ) )
2009cdf0e10cSrcweir {
2010cdf0e10cSrcweir const ScPatternAttr* pPattern = pDoc->GetDefPattern();
2011cdf0e10cSrcweir if ( pPattern )
2012cdf0e10cSrcweir {
2013cdf0e10cSrcweir const SfxItemSet& rSet = pPattern->GetItemSet();
2014cdf0e10cSrcweir
2015cdf0e10cSrcweir switch ( pEntry->nWID ) // fuer Item-Spezial-Behandlungen
2016cdf0e10cSrcweir {
2017cdf0e10cSrcweir case ATTR_VALUE_FORMAT:
2018cdf0e10cSrcweir // default has no language set
2019cdf0e10cSrcweir aAny <<= (sal_Int32)( ((const SfxUInt32Item&)rSet.Get(pEntry->nWID)).GetValue() );
2020cdf0e10cSrcweir break;
2021cdf0e10cSrcweir case ATTR_INDENT:
2022cdf0e10cSrcweir aAny <<= (sal_Int16)( TwipsToHMM(((const SfxUInt16Item&)
2023cdf0e10cSrcweir rSet.Get(pEntry->nWID)).GetValue()) );
2024cdf0e10cSrcweir break;
2025cdf0e10cSrcweir default:
2026cdf0e10cSrcweir pPropSet->getPropertyValue(aPropertyName, rSet, aAny);
2027cdf0e10cSrcweir }
2028cdf0e10cSrcweir }
2029cdf0e10cSrcweir }
2030cdf0e10cSrcweir else
2031cdf0e10cSrcweir switch ( pEntry->nWID )
2032cdf0e10cSrcweir {
2033cdf0e10cSrcweir case SC_WID_UNO_CHCOLHDR:
2034cdf0e10cSrcweir case SC_WID_UNO_CHROWHDR:
2035cdf0e10cSrcweir ScUnoHelpFunctions::SetBoolInAny( aAny, sal_False );
2036cdf0e10cSrcweir break;
2037cdf0e10cSrcweir case SC_WID_UNO_CELLSTYL:
2038cdf0e10cSrcweir aAny <<= rtl::OUString( ScStyleNameConversion::DisplayToProgrammaticName(
2039cdf0e10cSrcweir ScGlobal::GetRscString(STR_STYLENAME_STANDARD), SFX_STYLE_FAMILY_PARA ) );
2040cdf0e10cSrcweir break;
2041cdf0e10cSrcweir case SC_WID_UNO_TBLBORD:
2042cdf0e10cSrcweir {
2043cdf0e10cSrcweir const ScPatternAttr* pPattern = pDoc->GetDefPattern();
2044cdf0e10cSrcweir if ( pPattern )
2045cdf0e10cSrcweir {
2046cdf0e10cSrcweir table::TableBorder aBorder;
2047cdf0e10cSrcweir ScHelperFunctions::FillTableBorder( aBorder,
2048cdf0e10cSrcweir (const SvxBoxItem&)pPattern->GetItem(ATTR_BORDER),
2049cdf0e10cSrcweir (const SvxBoxInfoItem&)pPattern->GetItem(ATTR_BORDER_INNER) );
2050cdf0e10cSrcweir aAny <<= aBorder;
2051cdf0e10cSrcweir }
2052cdf0e10cSrcweir }
2053cdf0e10cSrcweir break;
2054cdf0e10cSrcweir case SC_WID_UNO_CONDFMT:
2055cdf0e10cSrcweir case SC_WID_UNO_CONDLOC:
2056cdf0e10cSrcweir case SC_WID_UNO_CONDXML:
2057cdf0e10cSrcweir {
2058cdf0e10cSrcweir sal_Bool bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
2059cdf0e10cSrcweir sal_Bool bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
2060cdf0e10cSrcweir formula::FormulaGrammar::Grammar eGrammar = (bXML ?
2061cdf0e10cSrcweir pDoc->GetStorageGrammar() :
2062cdf0e10cSrcweir formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
2063cdf0e10cSrcweir
2064cdf0e10cSrcweir aAny <<= uno::Reference<sheet::XSheetConditionalEntries>(
2065cdf0e10cSrcweir new ScTableConditionalFormat( pDoc, 0, eGrammar ));
2066cdf0e10cSrcweir }
2067cdf0e10cSrcweir break;
2068cdf0e10cSrcweir case SC_WID_UNO_VALIDAT:
2069cdf0e10cSrcweir case SC_WID_UNO_VALILOC:
2070cdf0e10cSrcweir case SC_WID_UNO_VALIXML:
2071cdf0e10cSrcweir {
2072cdf0e10cSrcweir sal_Bool bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
2073cdf0e10cSrcweir sal_Bool bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
2074cdf0e10cSrcweir formula::FormulaGrammar::Grammar eGrammar = (bXML ?
2075cdf0e10cSrcweir pDoc->GetStorageGrammar() :
2076cdf0e10cSrcweir formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
2077cdf0e10cSrcweir
2078cdf0e10cSrcweir aAny <<= uno::Reference<beans::XPropertySet>(
2079cdf0e10cSrcweir new ScTableValidationObj( pDoc, 0, eGrammar ));
2080cdf0e10cSrcweir }
2081cdf0e10cSrcweir break;
2082cdf0e10cSrcweir case SC_WID_UNO_NUMRULES:
2083cdf0e10cSrcweir {
2084cdf0e10cSrcweir aAny <<= uno::Reference<container::XIndexReplace>(ScStyleObj::CreateEmptyNumberingRules());
2085cdf0e10cSrcweir }
2086cdf0e10cSrcweir break;
2087cdf0e10cSrcweir }
2088cdf0e10cSrcweir }
2089cdf0e10cSrcweir }
2090cdf0e10cSrcweir
2091cdf0e10cSrcweir return aAny;
2092cdf0e10cSrcweir }
2093cdf0e10cSrcweir
2094cdf0e10cSrcweir // XPropertySet
2095cdf0e10cSrcweir
getPropertySetInfo()2096cdf0e10cSrcweir uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCellRangesBase::getPropertySetInfo()
2097cdf0e10cSrcweir throw(uno::RuntimeException)
2098cdf0e10cSrcweir {
2099cdf0e10cSrcweir ScUnoGuard aGuard;
2100cdf0e10cSrcweir static uno::Reference<beans::XPropertySetInfo> aRef(
2101cdf0e10cSrcweir new SfxItemPropertySetInfo( pPropSet->getPropertyMap() ));
2102cdf0e10cSrcweir return aRef;
2103cdf0e10cSrcweir }
2104cdf0e10cSrcweir
2105cdf0e10cSrcweir
lcl_SetCellProperty(const SfxItemPropertySimpleEntry & rEntry,const uno::Any & rValue,ScPatternAttr & rPattern,ScDocument * pDoc,sal_uInt16 & rFirstItemId,sal_uInt16 & rSecondItemId)2106cdf0e10cSrcweir void lcl_SetCellProperty( const SfxItemPropertySimpleEntry& rEntry, const uno::Any& rValue,
2107cdf0e10cSrcweir ScPatternAttr& rPattern, ScDocument* pDoc,
2108cdf0e10cSrcweir sal_uInt16& rFirstItemId, sal_uInt16& rSecondItemId )
2109cdf0e10cSrcweir {
2110cdf0e10cSrcweir rFirstItemId = rEntry.nWID;
2111cdf0e10cSrcweir rSecondItemId = 0;
2112cdf0e10cSrcweir
2113cdf0e10cSrcweir SfxItemSet& rSet = rPattern.GetItemSet();
2114cdf0e10cSrcweir switch ( rEntry.nWID )
2115cdf0e10cSrcweir {
2116cdf0e10cSrcweir case ATTR_VALUE_FORMAT:
2117cdf0e10cSrcweir {
2118cdf0e10cSrcweir // #67847# language for number formats
2119cdf0e10cSrcweir SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
2120cdf0e10cSrcweir sal_uLong nOldFormat = ((const SfxUInt32Item&)rSet.Get( ATTR_VALUE_FORMAT )).GetValue();
2121cdf0e10cSrcweir LanguageType eOldLang = ((const SvxLanguageItem&)rSet.Get( ATTR_LANGUAGE_FORMAT )).GetLanguage();
2122cdf0e10cSrcweir nOldFormat = pFormatter->GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang );
2123cdf0e10cSrcweir
2124cdf0e10cSrcweir sal_Int32 nIntVal = 0;
2125cdf0e10cSrcweir if ( rValue >>= nIntVal )
2126cdf0e10cSrcweir {
2127cdf0e10cSrcweir sal_uLong nNewFormat = (sal_uLong)nIntVal;
2128cdf0e10cSrcweir rSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
2129cdf0e10cSrcweir
2130cdf0e10cSrcweir const SvNumberformat* pNewEntry = pFormatter->GetEntry( nNewFormat );
2131cdf0e10cSrcweir LanguageType eNewLang =
2132cdf0e10cSrcweir pNewEntry ? pNewEntry->GetLanguage() : LANGUAGE_DONTKNOW;
2133cdf0e10cSrcweir if ( eNewLang != eOldLang && eNewLang != LANGUAGE_DONTKNOW )
2134cdf0e10cSrcweir {
2135cdf0e10cSrcweir rSet.Put( SvxLanguageItem( eNewLang, ATTR_LANGUAGE_FORMAT ) );
2136cdf0e10cSrcweir
2137cdf0e10cSrcweir // #40606# if only language is changed,
2138cdf0e10cSrcweir // don't touch number format attribute
2139cdf0e10cSrcweir sal_uLong nNewMod = nNewFormat % SV_COUNTRY_LANGUAGE_OFFSET;
2140cdf0e10cSrcweir if ( nNewMod == ( nOldFormat % SV_COUNTRY_LANGUAGE_OFFSET ) &&
2141cdf0e10cSrcweir nNewMod <= SV_MAX_ANZ_STANDARD_FORMATE )
2142cdf0e10cSrcweir {
2143cdf0e10cSrcweir rFirstItemId = 0; // don't use ATTR_VALUE_FORMAT value
2144cdf0e10cSrcweir }
2145cdf0e10cSrcweir
2146cdf0e10cSrcweir rSecondItemId = ATTR_LANGUAGE_FORMAT;
2147cdf0e10cSrcweir }
2148cdf0e10cSrcweir }
2149cdf0e10cSrcweir else
2150cdf0e10cSrcweir throw lang::IllegalArgumentException();
2151cdf0e10cSrcweir }
2152cdf0e10cSrcweir break;
2153cdf0e10cSrcweir case ATTR_INDENT:
2154cdf0e10cSrcweir {
2155cdf0e10cSrcweir sal_Int16 nIntVal = 0;
2156cdf0e10cSrcweir if ( rValue >>= nIntVal )
2157cdf0e10cSrcweir rSet.Put( SfxUInt16Item( rEntry.nWID, (sal_uInt16)HMMToTwips(nIntVal) ) );
2158cdf0e10cSrcweir else
2159cdf0e10cSrcweir throw lang::IllegalArgumentException();
2160cdf0e10cSrcweir }
2161cdf0e10cSrcweir break;
2162cdf0e10cSrcweir case ATTR_ROTATE_VALUE:
2163cdf0e10cSrcweir {
2164cdf0e10cSrcweir sal_Int32 nRotVal = 0;
2165cdf0e10cSrcweir if ( rValue >>= nRotVal )
2166cdf0e10cSrcweir {
2167cdf0e10cSrcweir // stored value is always between 0 and 360 deg.
2168cdf0e10cSrcweir nRotVal %= 36000;
2169cdf0e10cSrcweir if ( nRotVal < 0 )
2170cdf0e10cSrcweir nRotVal += 36000;
2171cdf0e10cSrcweir
2172cdf0e10cSrcweir rSet.Put( SfxInt32Item( ATTR_ROTATE_VALUE, nRotVal ) );
2173cdf0e10cSrcweir }
2174cdf0e10cSrcweir else
2175cdf0e10cSrcweir throw lang::IllegalArgumentException();
2176cdf0e10cSrcweir }
2177cdf0e10cSrcweir break;
2178cdf0e10cSrcweir case ATTR_STACKED:
2179cdf0e10cSrcweir {
2180cdf0e10cSrcweir table::CellOrientation eOrient;
2181cdf0e10cSrcweir if( rValue >>= eOrient )
2182cdf0e10cSrcweir {
2183cdf0e10cSrcweir switch( eOrient )
2184cdf0e10cSrcweir {
2185cdf0e10cSrcweir case table::CellOrientation_STANDARD:
2186cdf0e10cSrcweir rSet.Put( SfxBoolItem( ATTR_STACKED, sal_False ) );
2187cdf0e10cSrcweir break;
2188cdf0e10cSrcweir case table::CellOrientation_TOPBOTTOM:
2189cdf0e10cSrcweir rSet.Put( SfxBoolItem( ATTR_STACKED, sal_False ) );
2190cdf0e10cSrcweir rSet.Put( SfxInt32Item( ATTR_ROTATE_VALUE, 27000 ) );
2191cdf0e10cSrcweir rSecondItemId = ATTR_ROTATE_VALUE;
2192cdf0e10cSrcweir break;
2193cdf0e10cSrcweir case table::CellOrientation_BOTTOMTOP:
2194cdf0e10cSrcweir rSet.Put( SfxBoolItem( ATTR_STACKED, sal_False ) );
2195cdf0e10cSrcweir rSet.Put( SfxInt32Item( ATTR_ROTATE_VALUE, 9000 ) );
2196cdf0e10cSrcweir rSecondItemId = ATTR_ROTATE_VALUE;
2197cdf0e10cSrcweir break;
2198cdf0e10cSrcweir case table::CellOrientation_STACKED:
2199cdf0e10cSrcweir rSet.Put( SfxBoolItem( ATTR_STACKED, sal_True ) );
2200cdf0e10cSrcweir break;
2201cdf0e10cSrcweir default:
2202cdf0e10cSrcweir {
2203cdf0e10cSrcweir // added to avoid warnings
2204cdf0e10cSrcweir }
2205cdf0e10cSrcweir }
2206cdf0e10cSrcweir }
2207cdf0e10cSrcweir }
2208cdf0e10cSrcweir break;
2209cdf0e10cSrcweir default:
2210cdf0e10cSrcweir {
2211cdf0e10cSrcweir lcl_GetCellsPropertySet()->setPropertyValue(rEntry, rValue, rSet);
2212cdf0e10cSrcweir }
2213cdf0e10cSrcweir }
2214cdf0e10cSrcweir }
2215cdf0e10cSrcweir
setPropertyValue(const rtl::OUString & aPropertyName,const uno::Any & aValue)2216cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::setPropertyValue(
2217cdf0e10cSrcweir const rtl::OUString& aPropertyName, const uno::Any& aValue )
2218cdf0e10cSrcweir throw(beans::UnknownPropertyException, beans::PropertyVetoException,
2219cdf0e10cSrcweir lang::IllegalArgumentException, lang::WrappedTargetException,
2220cdf0e10cSrcweir uno::RuntimeException)
2221cdf0e10cSrcweir {
2222cdf0e10cSrcweir ScUnoGuard aGuard;
2223cdf0e10cSrcweir
2224cdf0e10cSrcweir if ( !pDocShell || aRanges.Count() == 0 )
2225cdf0e10cSrcweir throw uno::RuntimeException();
2226cdf0e10cSrcweir
2227cdf0e10cSrcweir const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
2228cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( aPropertyName );
2229cdf0e10cSrcweir if ( !pEntry )
2230cdf0e10cSrcweir throw beans::UnknownPropertyException();
2231cdf0e10cSrcweir
2232cdf0e10cSrcweir SetOnePropertyValue( pEntry, aValue );
2233cdf0e10cSrcweir }
2234cdf0e10cSrcweir
SetOnePropertyValue(const SfxItemPropertySimpleEntry * pEntry,const uno::Any & aValue)2235cdf0e10cSrcweir void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
2236cdf0e10cSrcweir throw(lang::IllegalArgumentException, uno::RuntimeException)
2237cdf0e10cSrcweir {
2238cdf0e10cSrcweir if ( pEntry )
2239cdf0e10cSrcweir {
2240cdf0e10cSrcweir if ( IsScItemWid( pEntry->nWID ) )
2241cdf0e10cSrcweir {
2242cdf0e10cSrcweir if ( aRanges.Count() ) // leer = nichts zu tun
2243cdf0e10cSrcweir {
2244cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
2245cdf0e10cSrcweir ScDocFunc aFunc(*pDocShell);
2246cdf0e10cSrcweir
2247cdf0e10cSrcweir // Fuer Teile von zusammengesetzten Items mit mehreren Properties (z.B. Hintergrund)
2248cdf0e10cSrcweir // muss vorher das alte Item aus dem Dokument geholt werden
2249cdf0e10cSrcweir //! Das kann hier aber nicht erkannt werden
2250cdf0e10cSrcweir //! -> eigenes Flag im PropertyMap-Eintrag, oder was ???
2251cdf0e10cSrcweir //! Item direkt von einzelner Position im Bereich holen?
2252cdf0e10cSrcweir // ClearInvalidItems, damit auf jeden Fall ein Item vom richtigen Typ da ist
2253cdf0e10cSrcweir
2254cdf0e10cSrcweir ScPatternAttr aPattern( *GetCurrentAttrsDeep() );
2255cdf0e10cSrcweir SfxItemSet& rSet = aPattern.GetItemSet();
2256cdf0e10cSrcweir rSet.ClearInvalidItems();
2257cdf0e10cSrcweir
2258cdf0e10cSrcweir sal_uInt16 nFirstItem, nSecondItem;
2259cdf0e10cSrcweir lcl_SetCellProperty( *pEntry, aValue, aPattern, pDoc, nFirstItem, nSecondItem );
2260cdf0e10cSrcweir
2261cdf0e10cSrcweir for (sal_uInt16 nWhich = ATTR_PATTERN_START; nWhich <= ATTR_PATTERN_END; nWhich++)
2262cdf0e10cSrcweir if ( nWhich != nFirstItem && nWhich != nSecondItem )
2263cdf0e10cSrcweir rSet.ClearItem(nWhich);
2264cdf0e10cSrcweir
2265cdf0e10cSrcweir aFunc.ApplyAttributes( *GetMarkData(), aPattern, sal_True, sal_True );
2266cdf0e10cSrcweir }
2267cdf0e10cSrcweir }
2268cdf0e10cSrcweir else // implemented here
2269cdf0e10cSrcweir switch ( pEntry->nWID )
2270cdf0e10cSrcweir {
2271cdf0e10cSrcweir case SC_WID_UNO_CHCOLHDR:
2272cdf0e10cSrcweir // chart header flags are set for this object, not stored with document
2273cdf0e10cSrcweir bChartColAsHdr = ScUnoHelpFunctions::GetBoolFromAny( aValue );
2274cdf0e10cSrcweir break;
2275cdf0e10cSrcweir case SC_WID_UNO_CHROWHDR:
2276cdf0e10cSrcweir bChartRowAsHdr = ScUnoHelpFunctions::GetBoolFromAny( aValue );
2277cdf0e10cSrcweir break;
2278cdf0e10cSrcweir case SC_WID_UNO_CELLSTYL:
2279cdf0e10cSrcweir {
2280cdf0e10cSrcweir rtl::OUString aStrVal;
2281cdf0e10cSrcweir aValue >>= aStrVal;
2282cdf0e10cSrcweir String aString(ScStyleNameConversion::ProgrammaticToDisplayName(
2283cdf0e10cSrcweir aStrVal, SFX_STYLE_FAMILY_PARA ));
2284cdf0e10cSrcweir ScDocFunc aFunc(*pDocShell);
2285cdf0e10cSrcweir aFunc.ApplyStyle( *GetMarkData(), aString, sal_True, sal_True );
2286cdf0e10cSrcweir }
2287cdf0e10cSrcweir break;
2288cdf0e10cSrcweir case SC_WID_UNO_TBLBORD:
2289cdf0e10cSrcweir {
2290cdf0e10cSrcweir table::TableBorder aBorder;
2291cdf0e10cSrcweir if ( aRanges.Count() && ( aValue >>= aBorder ) ) // empty = nothing to do
2292cdf0e10cSrcweir {
2293cdf0e10cSrcweir SvxBoxItem aOuter(ATTR_BORDER);
2294cdf0e10cSrcweir SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
2295cdf0e10cSrcweir ScHelperFunctions::FillBoxItems( aOuter, aInner, aBorder );
2296cdf0e10cSrcweir
2297cdf0e10cSrcweir ScHelperFunctions::ApplyBorder( pDocShell, aRanges, aOuter, aInner ); //! docfunc
2298cdf0e10cSrcweir }
2299cdf0e10cSrcweir }
2300cdf0e10cSrcweir break;
2301cdf0e10cSrcweir case SC_WID_UNO_CONDFMT:
2302cdf0e10cSrcweir case SC_WID_UNO_CONDLOC:
2303cdf0e10cSrcweir case SC_WID_UNO_CONDXML:
2304cdf0e10cSrcweir {
2305cdf0e10cSrcweir uno::Reference<sheet::XSheetConditionalEntries> xInterface(aValue, uno::UNO_QUERY);
2306cdf0e10cSrcweir if ( aRanges.Count() && xInterface.is() ) // leer = nichts zu tun
2307cdf0e10cSrcweir {
2308cdf0e10cSrcweir ScTableConditionalFormat* pFormat =
2309cdf0e10cSrcweir ScTableConditionalFormat::getImplementation( xInterface );
2310cdf0e10cSrcweir if (pFormat)
2311cdf0e10cSrcweir {
2312cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
2313cdf0e10cSrcweir sal_Bool bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
2314cdf0e10cSrcweir sal_Bool bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
2315cdf0e10cSrcweir formula::FormulaGrammar::Grammar eGrammar = (bXML ?
2316cdf0e10cSrcweir formula::FormulaGrammar::GRAM_UNSPECIFIED :
2317cdf0e10cSrcweir formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
2318cdf0e10cSrcweir
2319cdf0e10cSrcweir ScConditionalFormat aNew( 0, pDoc ); // Index wird beim Einfuegen gesetzt
2320cdf0e10cSrcweir pFormat->FillFormat( aNew, pDoc, eGrammar );
2321cdf0e10cSrcweir sal_uLong nIndex = pDoc->AddCondFormat( aNew );
2322cdf0e10cSrcweir
2323cdf0e10cSrcweir ScDocFunc aFunc(*pDocShell);
2324cdf0e10cSrcweir
2325cdf0e10cSrcweir ScPatternAttr aPattern( pDoc->GetPool() );
2326cdf0e10cSrcweir aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_CONDITIONAL, nIndex ) );
2327cdf0e10cSrcweir aFunc.ApplyAttributes( *GetMarkData(), aPattern, sal_True, sal_True );
2328cdf0e10cSrcweir }
2329cdf0e10cSrcweir }
2330cdf0e10cSrcweir }
2331cdf0e10cSrcweir break;
2332cdf0e10cSrcweir case SC_WID_UNO_VALIDAT:
2333cdf0e10cSrcweir case SC_WID_UNO_VALILOC:
2334cdf0e10cSrcweir case SC_WID_UNO_VALIXML:
2335cdf0e10cSrcweir {
2336cdf0e10cSrcweir uno::Reference<beans::XPropertySet> xInterface(aValue, uno::UNO_QUERY);
2337cdf0e10cSrcweir if ( aRanges.Count() && xInterface.is() ) // leer = nichts zu tun
2338cdf0e10cSrcweir {
2339cdf0e10cSrcweir ScTableValidationObj* pValidObj =
2340cdf0e10cSrcweir ScTableValidationObj::getImplementation( xInterface );
2341cdf0e10cSrcweir if (pValidObj)
2342cdf0e10cSrcweir {
2343cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
2344cdf0e10cSrcweir sal_Bool bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
2345cdf0e10cSrcweir sal_Bool bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
2346cdf0e10cSrcweir formula::FormulaGrammar::Grammar eGrammar = (bXML ?
2347cdf0e10cSrcweir formula::FormulaGrammar::GRAM_UNSPECIFIED :
2348cdf0e10cSrcweir formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
2349cdf0e10cSrcweir
2350cdf0e10cSrcweir ScValidationData* pNewData =
2351cdf0e10cSrcweir pValidObj->CreateValidationData( pDoc, eGrammar );
2352cdf0e10cSrcweir sal_uLong nIndex = pDoc->AddValidationEntry( *pNewData );
2353cdf0e10cSrcweir delete pNewData;
2354cdf0e10cSrcweir
2355cdf0e10cSrcweir ScDocFunc aFunc(*pDocShell);
2356cdf0e10cSrcweir
2357cdf0e10cSrcweir ScPatternAttr aPattern( pDoc->GetPool() );
2358cdf0e10cSrcweir aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALIDDATA, nIndex ) );
2359cdf0e10cSrcweir aFunc.ApplyAttributes( *GetMarkData(), aPattern, sal_True, sal_True );
2360cdf0e10cSrcweir }
2361cdf0e10cSrcweir }
2362cdf0e10cSrcweir }
2363cdf0e10cSrcweir break;
2364cdf0e10cSrcweir // SC_WID_UNO_NUMRULES is ignored...
2365cdf0e10cSrcweir }
2366cdf0e10cSrcweir }
2367cdf0e10cSrcweir }
2368cdf0e10cSrcweir
getPropertyValue(const rtl::OUString & aPropertyName)2369cdf0e10cSrcweir uno::Any SAL_CALL ScCellRangesBase::getPropertyValue( const rtl::OUString& aPropertyName )
2370cdf0e10cSrcweir throw(beans::UnknownPropertyException, lang::WrappedTargetException,
2371cdf0e10cSrcweir uno::RuntimeException)
2372cdf0e10cSrcweir {
2373cdf0e10cSrcweir ScUnoGuard aGuard;
2374cdf0e10cSrcweir
2375cdf0e10cSrcweir if ( !pDocShell || aRanges.Count() == 0 )
2376cdf0e10cSrcweir throw uno::RuntimeException();
2377cdf0e10cSrcweir
2378cdf0e10cSrcweir const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
2379cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( aPropertyName );
2380cdf0e10cSrcweir if ( !pEntry )
2381cdf0e10cSrcweir throw beans::UnknownPropertyException();
2382cdf0e10cSrcweir
2383cdf0e10cSrcweir uno::Any aAny;
2384cdf0e10cSrcweir GetOnePropertyValue( pEntry, aAny );
2385cdf0e10cSrcweir return aAny;
2386cdf0e10cSrcweir }
2387cdf0e10cSrcweir
GetOnePropertyValue(const SfxItemPropertySimpleEntry * pEntry,uno::Any & rAny)2388cdf0e10cSrcweir void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
2389cdf0e10cSrcweir uno::Any& rAny )
2390cdf0e10cSrcweir throw(uno::RuntimeException)
2391cdf0e10cSrcweir {
2392cdf0e10cSrcweir if ( pEntry )
2393cdf0e10cSrcweir {
2394cdf0e10cSrcweir if ( IsScItemWid( pEntry->nWID ) )
2395cdf0e10cSrcweir {
2396cdf0e10cSrcweir SfxItemSet* pDataSet = GetCurrentDataSet();
2397cdf0e10cSrcweir if ( pDataSet )
2398cdf0e10cSrcweir {
2399cdf0e10cSrcweir switch ( pEntry->nWID ) // fuer Item-Spezial-Behandlungen
2400cdf0e10cSrcweir {
2401cdf0e10cSrcweir case ATTR_VALUE_FORMAT:
2402cdf0e10cSrcweir {
2403cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
2404cdf0e10cSrcweir
2405cdf0e10cSrcweir sal_uLong nOldFormat = ((const SfxUInt32Item&)
2406cdf0e10cSrcweir pDataSet->Get( ATTR_VALUE_FORMAT )).GetValue();
2407cdf0e10cSrcweir LanguageType eOldLang = ((const SvxLanguageItem&)
2408cdf0e10cSrcweir pDataSet->Get( ATTR_LANGUAGE_FORMAT )).GetLanguage();
2409cdf0e10cSrcweir nOldFormat = pDoc->GetFormatTable()->
2410cdf0e10cSrcweir GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang );
2411cdf0e10cSrcweir rAny <<= (sal_Int32)( nOldFormat );
2412cdf0e10cSrcweir }
2413cdf0e10cSrcweir break;
2414cdf0e10cSrcweir case ATTR_INDENT:
2415cdf0e10cSrcweir rAny <<= (sal_Int16)( TwipsToHMM(((const SfxUInt16Item&)
2416cdf0e10cSrcweir pDataSet->Get(pEntry->nWID)).GetValue()) );
2417cdf0e10cSrcweir break;
2418cdf0e10cSrcweir case ATTR_STACKED:
2419cdf0e10cSrcweir {
2420cdf0e10cSrcweir sal_Int32 nRot = ((const SfxInt32Item&)pDataSet->Get(ATTR_ROTATE_VALUE)).GetValue();
2421cdf0e10cSrcweir sal_Bool bStacked = ((const SfxBoolItem&)pDataSet->Get(pEntry->nWID)).GetValue();
2422cdf0e10cSrcweir SvxOrientationItem( nRot, bStacked, 0 ).QueryValue( rAny );
2423cdf0e10cSrcweir }
2424cdf0e10cSrcweir break;
2425cdf0e10cSrcweir default:
2426cdf0e10cSrcweir pPropSet->getPropertyValue(*pEntry, *pDataSet, rAny);
2427cdf0e10cSrcweir }
2428cdf0e10cSrcweir }
2429cdf0e10cSrcweir }
2430cdf0e10cSrcweir else // implemented here
2431cdf0e10cSrcweir switch ( pEntry->nWID )
2432cdf0e10cSrcweir {
2433cdf0e10cSrcweir case SC_WID_UNO_CHCOLHDR:
2434cdf0e10cSrcweir ScUnoHelpFunctions::SetBoolInAny( rAny, bChartColAsHdr );
2435cdf0e10cSrcweir break;
2436cdf0e10cSrcweir case SC_WID_UNO_CHROWHDR:
2437cdf0e10cSrcweir ScUnoHelpFunctions::SetBoolInAny( rAny, bChartRowAsHdr );
2438cdf0e10cSrcweir break;
2439cdf0e10cSrcweir case SC_WID_UNO_CELLSTYL:
2440cdf0e10cSrcweir {
2441cdf0e10cSrcweir String aStyleName;
2442cdf0e10cSrcweir const ScStyleSheet* pStyle = pDocShell->GetDocument()->GetSelectionStyle(*GetMarkData());
2443cdf0e10cSrcweir if (pStyle)
2444cdf0e10cSrcweir aStyleName = pStyle->GetName();
2445cdf0e10cSrcweir rAny <<= rtl::OUString( ScStyleNameConversion::DisplayToProgrammaticName(
2446cdf0e10cSrcweir aStyleName, SFX_STYLE_FAMILY_PARA ) );
2447cdf0e10cSrcweir }
2448cdf0e10cSrcweir break;
2449cdf0e10cSrcweir case SC_WID_UNO_TBLBORD:
2450cdf0e10cSrcweir {
2451cdf0e10cSrcweir //! loop throgh all ranges
2452cdf0e10cSrcweir const ScRange* pFirst = aRanges.GetObject(0);
2453cdf0e10cSrcweir if (pFirst)
2454cdf0e10cSrcweir {
2455cdf0e10cSrcweir SvxBoxItem aOuter(ATTR_BORDER);
2456cdf0e10cSrcweir SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
2457cdf0e10cSrcweir
2458cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
2459cdf0e10cSrcweir ScMarkData aMark;
2460cdf0e10cSrcweir aMark.SetMarkArea( *pFirst );
2461cdf0e10cSrcweir aMark.SelectTable( pFirst->aStart.Tab(), sal_True );
2462cdf0e10cSrcweir pDoc->GetSelectionFrame( aMark, aOuter, aInner );
2463cdf0e10cSrcweir
2464cdf0e10cSrcweir table::TableBorder aBorder;
2465cdf0e10cSrcweir ScHelperFunctions::FillTableBorder( aBorder, aOuter, aInner );
2466cdf0e10cSrcweir rAny <<= aBorder;
2467cdf0e10cSrcweir }
2468cdf0e10cSrcweir }
2469cdf0e10cSrcweir break;
2470cdf0e10cSrcweir case SC_WID_UNO_CONDFMT:
2471cdf0e10cSrcweir case SC_WID_UNO_CONDLOC:
2472cdf0e10cSrcweir case SC_WID_UNO_CONDXML:
2473cdf0e10cSrcweir {
2474cdf0e10cSrcweir const ScPatternAttr* pPattern = GetCurrentAttrsDeep();
2475cdf0e10cSrcweir if ( pPattern )
2476cdf0e10cSrcweir {
2477cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
2478cdf0e10cSrcweir sal_Bool bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
2479cdf0e10cSrcweir sal_Bool bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
2480cdf0e10cSrcweir formula::FormulaGrammar::Grammar eGrammar = (bXML ?
2481cdf0e10cSrcweir pDoc->GetStorageGrammar() :
2482cdf0e10cSrcweir formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
2483cdf0e10cSrcweir sal_uLong nIndex = ((const SfxUInt32Item&)
2484cdf0e10cSrcweir pPattern->GetItem(ATTR_CONDITIONAL)).GetValue();
2485cdf0e10cSrcweir rAny <<= uno::Reference<sheet::XSheetConditionalEntries>(
2486cdf0e10cSrcweir new ScTableConditionalFormat( pDoc, nIndex, eGrammar ));
2487cdf0e10cSrcweir }
2488cdf0e10cSrcweir }
2489cdf0e10cSrcweir break;
2490cdf0e10cSrcweir case SC_WID_UNO_VALIDAT:
2491cdf0e10cSrcweir case SC_WID_UNO_VALILOC:
2492cdf0e10cSrcweir case SC_WID_UNO_VALIXML:
2493cdf0e10cSrcweir {
2494cdf0e10cSrcweir const ScPatternAttr* pPattern = GetCurrentAttrsDeep();
2495cdf0e10cSrcweir if ( pPattern )
2496cdf0e10cSrcweir {
2497cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
2498cdf0e10cSrcweir sal_Bool bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
2499cdf0e10cSrcweir sal_Bool bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
2500cdf0e10cSrcweir formula::FormulaGrammar::Grammar eGrammar = (bXML ?
2501cdf0e10cSrcweir pDoc->GetStorageGrammar() :
2502cdf0e10cSrcweir formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
2503cdf0e10cSrcweir sal_uLong nIndex = ((const SfxUInt32Item&)
2504cdf0e10cSrcweir pPattern->GetItem(ATTR_VALIDDATA)).GetValue();
2505cdf0e10cSrcweir rAny <<= uno::Reference<beans::XPropertySet>(
2506cdf0e10cSrcweir new ScTableValidationObj( pDoc, nIndex, eGrammar ));
2507cdf0e10cSrcweir }
2508cdf0e10cSrcweir }
2509cdf0e10cSrcweir break;
2510cdf0e10cSrcweir case SC_WID_UNO_NUMRULES:
2511cdf0e10cSrcweir {
2512cdf0e10cSrcweir // always return empty numbering rules object
2513cdf0e10cSrcweir rAny <<= uno::Reference<container::XIndexReplace>(ScStyleObj::CreateEmptyNumberingRules());
2514cdf0e10cSrcweir }
2515cdf0e10cSrcweir break;
2516cdf0e10cSrcweir case SC_WID_UNO_ABSNAME:
2517cdf0e10cSrcweir {
2518cdf0e10cSrcweir String sRet;
2519cdf0e10cSrcweir aRanges.Format(sRet, SCR_ABS_3D, pDocShell->GetDocument());
2520cdf0e10cSrcweir rAny <<= rtl::OUString(sRet);
2521cdf0e10cSrcweir }
2522cdf0e10cSrcweir }
2523cdf0e10cSrcweir }
2524cdf0e10cSrcweir }
2525cdf0e10cSrcweir
addPropertyChangeListener(const rtl::OUString &,const uno::Reference<beans::XPropertyChangeListener> &)2526cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::addPropertyChangeListener( const rtl::OUString& /* aPropertyName */,
2527cdf0e10cSrcweir const uno::Reference<beans::XPropertyChangeListener>& /* aListener */)
2528cdf0e10cSrcweir throw(beans::UnknownPropertyException,
2529cdf0e10cSrcweir lang::WrappedTargetException, uno::RuntimeException)
2530cdf0e10cSrcweir {
2531cdf0e10cSrcweir ScUnoGuard aGuard;
2532cdf0e10cSrcweir if ( aRanges.Count() == 0 )
2533cdf0e10cSrcweir throw uno::RuntimeException();
2534cdf0e10cSrcweir
2535cdf0e10cSrcweir DBG_ERROR("not implemented");
2536cdf0e10cSrcweir }
2537cdf0e10cSrcweir
removePropertyChangeListener(const rtl::OUString &,const uno::Reference<beans::XPropertyChangeListener> &)2538cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::removePropertyChangeListener( const rtl::OUString& /* aPropertyName */,
2539cdf0e10cSrcweir const uno::Reference<beans::XPropertyChangeListener>& /* aListener */)
2540cdf0e10cSrcweir throw(beans::UnknownPropertyException,
2541cdf0e10cSrcweir lang::WrappedTargetException, uno::RuntimeException)
2542cdf0e10cSrcweir {
2543cdf0e10cSrcweir ScUnoGuard aGuard;
2544cdf0e10cSrcweir if ( aRanges.Count() == 0 )
2545cdf0e10cSrcweir throw uno::RuntimeException();
2546cdf0e10cSrcweir
2547cdf0e10cSrcweir DBG_ERROR("not implemented");
2548cdf0e10cSrcweir }
2549cdf0e10cSrcweir
addVetoableChangeListener(const rtl::OUString &,const uno::Reference<beans::XVetoableChangeListener> &)2550cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::addVetoableChangeListener( const rtl::OUString&,
2551cdf0e10cSrcweir const uno::Reference<beans::XVetoableChangeListener>&)
2552cdf0e10cSrcweir throw(beans::UnknownPropertyException,
2553cdf0e10cSrcweir lang::WrappedTargetException, uno::RuntimeException)
2554cdf0e10cSrcweir {
2555cdf0e10cSrcweir DBG_ERROR("not implemented");
2556cdf0e10cSrcweir }
2557cdf0e10cSrcweir
removeVetoableChangeListener(const rtl::OUString &,const uno::Reference<beans::XVetoableChangeListener> &)2558cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::removeVetoableChangeListener( const rtl::OUString&,
2559cdf0e10cSrcweir const uno::Reference<beans::XVetoableChangeListener>&)
2560cdf0e10cSrcweir throw(beans::UnknownPropertyException,
2561cdf0e10cSrcweir lang::WrappedTargetException, uno::RuntimeException)
2562cdf0e10cSrcweir {
2563cdf0e10cSrcweir DBG_ERROR("not implemented");
2564cdf0e10cSrcweir }
2565cdf0e10cSrcweir
2566cdf0e10cSrcweir // XMultiPropertySet
2567cdf0e10cSrcweir
setPropertyValues(const uno::Sequence<rtl::OUString> & aPropertyNames,const uno::Sequence<uno::Any> & aValues)2568cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::setPropertyValues( const uno::Sequence< rtl::OUString >& aPropertyNames,
2569cdf0e10cSrcweir const uno::Sequence< uno::Any >& aValues )
2570cdf0e10cSrcweir throw (beans::PropertyVetoException,
2571cdf0e10cSrcweir lang::IllegalArgumentException,
2572cdf0e10cSrcweir lang::WrappedTargetException,
2573cdf0e10cSrcweir uno::RuntimeException)
2574cdf0e10cSrcweir {
2575cdf0e10cSrcweir ScUnoGuard aGuard;
2576cdf0e10cSrcweir
2577cdf0e10cSrcweir sal_Int32 nCount(aPropertyNames.getLength());
2578cdf0e10cSrcweir sal_Int32 nValues(aValues.getLength());
2579cdf0e10cSrcweir if (nCount != nValues)
2580cdf0e10cSrcweir throw lang::IllegalArgumentException();
2581cdf0e10cSrcweir
2582cdf0e10cSrcweir if ( pDocShell && nCount )
2583cdf0e10cSrcweir {
2584cdf0e10cSrcweir const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
2585cdf0e10cSrcweir const rtl::OUString* pNames = aPropertyNames.getConstArray();
2586cdf0e10cSrcweir const uno::Any* pValues = aValues.getConstArray();
2587cdf0e10cSrcweir
2588cdf0e10cSrcweir const SfxItemPropertySimpleEntry** pEntryArray = new const SfxItemPropertySimpleEntry*[nCount];
2589cdf0e10cSrcweir
2590cdf0e10cSrcweir sal_Int32 i;
2591cdf0e10cSrcweir for(i = 0; i < nCount; i++)
2592cdf0e10cSrcweir {
2593cdf0e10cSrcweir // first loop: find all properties in map, but handle only CellStyle
2594cdf0e10cSrcweir // (CellStyle must be set before any other cell properties)
2595cdf0e10cSrcweir
2596cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( pNames[i] );
2597cdf0e10cSrcweir pEntryArray[i] = pEntry;
2598cdf0e10cSrcweir if (pEntry)
2599cdf0e10cSrcweir {
2600cdf0e10cSrcweir if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
2601cdf0e10cSrcweir {
2602cdf0e10cSrcweir try
2603cdf0e10cSrcweir {
2604cdf0e10cSrcweir SetOnePropertyValue( pEntry, pValues[i] );
2605cdf0e10cSrcweir }
2606cdf0e10cSrcweir catch ( lang::IllegalArgumentException& )
2607cdf0e10cSrcweir {
2608cdf0e10cSrcweir DBG_ERROR("exception when setting cell style"); // not supposed to happen
2609cdf0e10cSrcweir }
2610cdf0e10cSrcweir }
2611cdf0e10cSrcweir }
2612cdf0e10cSrcweir }
2613cdf0e10cSrcweir
2614cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
2615cdf0e10cSrcweir ScPatternAttr* pOldPattern = NULL;
2616cdf0e10cSrcweir ScPatternAttr* pNewPattern = NULL;
2617cdf0e10cSrcweir
2618cdf0e10cSrcweir for(i = 0; i < nCount; i++)
2619cdf0e10cSrcweir {
2620cdf0e10cSrcweir // second loop: handle other properties
2621cdf0e10cSrcweir
2622cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = pEntryArray[i];
2623cdf0e10cSrcweir if ( pEntry )
2624cdf0e10cSrcweir {
2625cdf0e10cSrcweir if ( IsScItemWid( pEntry->nWID ) ) // can be handled by SfxItemPropertySet
2626cdf0e10cSrcweir {
2627cdf0e10cSrcweir if ( !pOldPattern )
2628cdf0e10cSrcweir {
2629cdf0e10cSrcweir pOldPattern = new ScPatternAttr( *GetCurrentAttrsDeep() );
2630cdf0e10cSrcweir pOldPattern->GetItemSet().ClearInvalidItems();
2631cdf0e10cSrcweir pNewPattern = new ScPatternAttr( pDoc->GetPool() );
2632cdf0e10cSrcweir }
2633cdf0e10cSrcweir
2634cdf0e10cSrcweir // collect items in pNewPattern, apply with one call after the loop
2635cdf0e10cSrcweir
2636cdf0e10cSrcweir sal_uInt16 nFirstItem, nSecondItem;
2637cdf0e10cSrcweir lcl_SetCellProperty( *pEntry, pValues[i], *pOldPattern, pDoc, nFirstItem, nSecondItem );
2638cdf0e10cSrcweir
2639cdf0e10cSrcweir // put only affected items into new set
2640cdf0e10cSrcweir if ( nFirstItem )
2641cdf0e10cSrcweir pNewPattern->GetItemSet().Put( pOldPattern->GetItemSet().Get( nFirstItem ) );
2642cdf0e10cSrcweir if ( nSecondItem )
2643cdf0e10cSrcweir pNewPattern->GetItemSet().Put( pOldPattern->GetItemSet().Get( nSecondItem ) );
2644cdf0e10cSrcweir }
2645cdf0e10cSrcweir else if ( pEntry->nWID != SC_WID_UNO_CELLSTYL ) // CellStyle is handled above
2646cdf0e10cSrcweir {
2647cdf0e10cSrcweir // call virtual method to set a single property
2648cdf0e10cSrcweir SetOnePropertyValue( pEntry, pValues[i] );
2649cdf0e10cSrcweir }
2650cdf0e10cSrcweir }
2651cdf0e10cSrcweir }
2652cdf0e10cSrcweir
2653cdf0e10cSrcweir if ( pNewPattern && aRanges.Count() )
2654cdf0e10cSrcweir {
2655cdf0e10cSrcweir ScDocFunc aFunc(*pDocShell);
2656cdf0e10cSrcweir aFunc.ApplyAttributes( *GetMarkData(), *pNewPattern, sal_True, sal_True );
2657cdf0e10cSrcweir }
2658cdf0e10cSrcweir
2659cdf0e10cSrcweir delete pNewPattern;
2660cdf0e10cSrcweir delete pOldPattern;
2661cdf0e10cSrcweir delete[] pEntryArray;
2662cdf0e10cSrcweir }
2663cdf0e10cSrcweir }
2664cdf0e10cSrcweir
getPropertyValues(const uno::Sequence<rtl::OUString> & aPropertyNames)2665cdf0e10cSrcweir uno::Sequence<uno::Any> SAL_CALL ScCellRangesBase::getPropertyValues(
2666cdf0e10cSrcweir const uno::Sequence< rtl::OUString >& aPropertyNames )
2667cdf0e10cSrcweir throw (uno::RuntimeException)
2668cdf0e10cSrcweir {
2669cdf0e10cSrcweir ScUnoGuard aGuard;
2670cdf0e10cSrcweir
2671cdf0e10cSrcweir const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
2672cdf0e10cSrcweir
2673cdf0e10cSrcweir uno::Sequence<uno::Any> aRet(aPropertyNames.getLength());
2674cdf0e10cSrcweir uno::Any* pProperties = aRet.getArray();
2675cdf0e10cSrcweir for(sal_Int32 i = 0; i < aPropertyNames.getLength(); i++)
2676cdf0e10cSrcweir {
2677cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( aPropertyNames[i] );
2678cdf0e10cSrcweir GetOnePropertyValue( pEntry, pProperties[i] );
2679cdf0e10cSrcweir }
2680cdf0e10cSrcweir return aRet;
2681cdf0e10cSrcweir }
2682cdf0e10cSrcweir
addPropertiesChangeListener(const uno::Sequence<rtl::OUString> &,const uno::Reference<beans::XPropertiesChangeListener> &)2683cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::addPropertiesChangeListener( const uno::Sequence< rtl::OUString >& /* aPropertyNames */,
2684cdf0e10cSrcweir const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
2685cdf0e10cSrcweir throw (uno::RuntimeException)
2686cdf0e10cSrcweir {
2687cdf0e10cSrcweir DBG_ERROR("not implemented");
2688cdf0e10cSrcweir }
2689cdf0e10cSrcweir
removePropertiesChangeListener(const uno::Reference<beans::XPropertiesChangeListener> &)2690cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::removePropertiesChangeListener( const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
2691cdf0e10cSrcweir throw (uno::RuntimeException)
2692cdf0e10cSrcweir {
2693cdf0e10cSrcweir DBG_ERROR("not implemented");
2694cdf0e10cSrcweir }
2695cdf0e10cSrcweir
firePropertiesChangeEvent(const uno::Sequence<rtl::OUString> &,const uno::Reference<beans::XPropertiesChangeListener> &)2696cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::firePropertiesChangeEvent( const uno::Sequence< rtl::OUString >& /* aPropertyNames */,
2697cdf0e10cSrcweir const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
2698cdf0e10cSrcweir throw (uno::RuntimeException)
2699cdf0e10cSrcweir {
2700cdf0e10cSrcweir DBG_ERROR("not implemented");
2701cdf0e10cSrcweir }
2702cdf0e10cSrcweir
IMPL_LINK(ScCellRangesBase,ValueListenerHdl,SfxHint *,pHint)2703cdf0e10cSrcweir IMPL_LINK( ScCellRangesBase, ValueListenerHdl, SfxHint*, pHint )
2704cdf0e10cSrcweir {
2705cdf0e10cSrcweir if ( pDocShell && pHint && pHint->ISA( SfxSimpleHint ) &&
2706cdf0e10cSrcweir ((const SfxSimpleHint*)pHint)->GetId() & (SC_HINT_DATACHANGED | SC_HINT_DYING) )
2707cdf0e10cSrcweir {
2708cdf0e10cSrcweir // This may be called several times for a single change, if several formulas
2709cdf0e10cSrcweir // in the range are notified. So only a flag is set that is checked when
2710cdf0e10cSrcweir // SFX_HINT_DATACHANGED is received.
2711cdf0e10cSrcweir
2712cdf0e10cSrcweir bGotDataChangedHint = sal_True;
2713cdf0e10cSrcweir }
2714cdf0e10cSrcweir return 0;
2715cdf0e10cSrcweir }
2716cdf0e10cSrcweir
2717cdf0e10cSrcweir // XTolerantMultiPropertySet
setPropertyValuesTolerant(const uno::Sequence<::rtl::OUString> & aPropertyNames,const uno::Sequence<uno::Any> & aValues)2718cdf0e10cSrcweir uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL ScCellRangesBase::setPropertyValuesTolerant( const uno::Sequence< ::rtl::OUString >& aPropertyNames,
2719cdf0e10cSrcweir const uno::Sequence< uno::Any >& aValues )
2720cdf0e10cSrcweir throw (lang::IllegalArgumentException, uno::RuntimeException)
2721cdf0e10cSrcweir {
2722cdf0e10cSrcweir ScUnoGuard aGuard;
2723cdf0e10cSrcweir
2724cdf0e10cSrcweir sal_Int32 nCount(aPropertyNames.getLength());
2725cdf0e10cSrcweir sal_Int32 nValues(aValues.getLength());
2726cdf0e10cSrcweir if (nCount != nValues)
2727cdf0e10cSrcweir throw lang::IllegalArgumentException();
2728cdf0e10cSrcweir
2729cdf0e10cSrcweir if ( pDocShell && nCount )
2730cdf0e10cSrcweir {
2731cdf0e10cSrcweir uno::Sequence < beans::SetPropertyTolerantFailed > aReturns(nCount);
2732cdf0e10cSrcweir beans::SetPropertyTolerantFailed* pReturns = aReturns.getArray();
2733cdf0e10cSrcweir
2734cdf0e10cSrcweir const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
2735cdf0e10cSrcweir const rtl::OUString* pNames = aPropertyNames.getConstArray();
2736cdf0e10cSrcweir const uno::Any* pValues = aValues.getConstArray();
2737cdf0e10cSrcweir
2738cdf0e10cSrcweir const SfxItemPropertySimpleEntry** pMapArray = new const SfxItemPropertySimpleEntry*[nCount];
2739cdf0e10cSrcweir
2740cdf0e10cSrcweir sal_Int32 i;
2741cdf0e10cSrcweir for(i = 0; i < nCount; i++)
2742cdf0e10cSrcweir {
2743cdf0e10cSrcweir // first loop: find all properties in map, but handle only CellStyle
2744cdf0e10cSrcweir // (CellStyle must be set before any other cell properties)
2745cdf0e10cSrcweir
2746cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( pNames[i] );
2747cdf0e10cSrcweir pMapArray[i] = pEntry;
2748cdf0e10cSrcweir if (pEntry)
2749cdf0e10cSrcweir {
2750cdf0e10cSrcweir if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
2751cdf0e10cSrcweir {
2752cdf0e10cSrcweir try
2753cdf0e10cSrcweir {
2754cdf0e10cSrcweir SetOnePropertyValue( pEntry, pValues[i] );
2755cdf0e10cSrcweir }
2756cdf0e10cSrcweir catch ( lang::IllegalArgumentException& )
2757cdf0e10cSrcweir {
2758cdf0e10cSrcweir DBG_ERROR("exception when setting cell style"); // not supposed to happen
2759cdf0e10cSrcweir }
2760cdf0e10cSrcweir }
2761cdf0e10cSrcweir }
2762cdf0e10cSrcweir }
2763cdf0e10cSrcweir
2764cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
2765cdf0e10cSrcweir ScPatternAttr* pOldPattern = NULL;
2766cdf0e10cSrcweir ScPatternAttr* pNewPattern = NULL;
2767cdf0e10cSrcweir
2768cdf0e10cSrcweir sal_Int32 nFailed(0);
2769cdf0e10cSrcweir for(i = 0; i < nCount; i++)
2770cdf0e10cSrcweir {
2771cdf0e10cSrcweir // second loop: handle other properties
2772cdf0e10cSrcweir
2773cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = pMapArray[i];
2774cdf0e10cSrcweir if ( pEntry && ((pEntry->nFlags & beans::PropertyAttribute::READONLY) == 0))
2775cdf0e10cSrcweir {
2776cdf0e10cSrcweir if ( IsScItemWid( pEntry->nWID ) ) // can be handled by SfxItemPropertySet
2777cdf0e10cSrcweir {
2778cdf0e10cSrcweir if ( !pOldPattern )
2779cdf0e10cSrcweir {
2780cdf0e10cSrcweir pOldPattern = new ScPatternAttr( *GetCurrentAttrsDeep() );
2781cdf0e10cSrcweir pOldPattern->GetItemSet().ClearInvalidItems();
2782cdf0e10cSrcweir pNewPattern = new ScPatternAttr( pDoc->GetPool() );
2783cdf0e10cSrcweir }
2784cdf0e10cSrcweir
2785cdf0e10cSrcweir // collect items in pNewPattern, apply with one call after the loop
2786cdf0e10cSrcweir
2787cdf0e10cSrcweir sal_uInt16 nFirstItem, nSecondItem;
2788cdf0e10cSrcweir try
2789cdf0e10cSrcweir {
2790cdf0e10cSrcweir lcl_SetCellProperty( *pEntry, pValues[i], *pOldPattern, pDoc, nFirstItem, nSecondItem );
2791cdf0e10cSrcweir
2792cdf0e10cSrcweir // put only affected items into new set
2793cdf0e10cSrcweir if ( nFirstItem )
2794cdf0e10cSrcweir pNewPattern->GetItemSet().Put( pOldPattern->GetItemSet().Get( nFirstItem ) );
2795cdf0e10cSrcweir if ( nSecondItem )
2796cdf0e10cSrcweir pNewPattern->GetItemSet().Put( pOldPattern->GetItemSet().Get( nSecondItem ) );
2797cdf0e10cSrcweir }
2798cdf0e10cSrcweir catch ( lang::IllegalArgumentException& )
2799cdf0e10cSrcweir {
2800cdf0e10cSrcweir pReturns[nFailed].Name = pNames[i];
2801cdf0e10cSrcweir pReturns[nFailed++].Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT;
2802cdf0e10cSrcweir }
2803cdf0e10cSrcweir }
2804cdf0e10cSrcweir else if ( pEntry->nWID != SC_WID_UNO_CELLSTYL ) // CellStyle is handled above
2805cdf0e10cSrcweir {
2806cdf0e10cSrcweir // call virtual method to set a single property
2807cdf0e10cSrcweir try
2808cdf0e10cSrcweir {
2809cdf0e10cSrcweir SetOnePropertyValue( pEntry, pValues[i] );
2810cdf0e10cSrcweir }
2811cdf0e10cSrcweir catch ( lang::IllegalArgumentException& )
2812cdf0e10cSrcweir {
2813cdf0e10cSrcweir pReturns[nFailed].Name = pNames[i];
2814cdf0e10cSrcweir pReturns[nFailed++].Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT;
2815cdf0e10cSrcweir }
2816cdf0e10cSrcweir }
2817cdf0e10cSrcweir }
2818cdf0e10cSrcweir else
2819cdf0e10cSrcweir {
2820cdf0e10cSrcweir pReturns[nFailed].Name = pNames[i];
2821cdf0e10cSrcweir if (pEntry)
2822cdf0e10cSrcweir pReturns[nFailed++].Result = beans::TolerantPropertySetResultType::PROPERTY_VETO;
2823cdf0e10cSrcweir else
2824cdf0e10cSrcweir pReturns[nFailed++].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
2825cdf0e10cSrcweir }
2826cdf0e10cSrcweir }
2827cdf0e10cSrcweir
2828cdf0e10cSrcweir if ( pNewPattern && aRanges.Count() )
2829cdf0e10cSrcweir {
2830cdf0e10cSrcweir ScDocFunc aFunc(*pDocShell);
2831cdf0e10cSrcweir aFunc.ApplyAttributes( *GetMarkData(), *pNewPattern, sal_True, sal_True );
2832cdf0e10cSrcweir }
2833cdf0e10cSrcweir
2834cdf0e10cSrcweir delete pNewPattern;
2835cdf0e10cSrcweir delete pOldPattern;
2836cdf0e10cSrcweir delete[] pMapArray;
2837cdf0e10cSrcweir
2838cdf0e10cSrcweir aReturns.realloc(nFailed);
2839cdf0e10cSrcweir
2840cdf0e10cSrcweir return aReturns;
2841cdf0e10cSrcweir }
2842cdf0e10cSrcweir return uno::Sequence < beans::SetPropertyTolerantFailed >();
2843cdf0e10cSrcweir }
2844cdf0e10cSrcweir
getPropertyValuesTolerant(const uno::Sequence<::rtl::OUString> & aPropertyNames)2845cdf0e10cSrcweir uno::Sequence< beans::GetPropertyTolerantResult > SAL_CALL ScCellRangesBase::getPropertyValuesTolerant( const uno::Sequence< ::rtl::OUString >& aPropertyNames )
2846cdf0e10cSrcweir throw (uno::RuntimeException)
2847cdf0e10cSrcweir {
2848cdf0e10cSrcweir ScUnoGuard aGuard;
2849cdf0e10cSrcweir
2850cdf0e10cSrcweir sal_Int32 nCount(aPropertyNames.getLength());
2851cdf0e10cSrcweir uno::Sequence < beans::GetPropertyTolerantResult > aReturns(nCount);
2852cdf0e10cSrcweir beans::GetPropertyTolerantResult* pReturns = aReturns.getArray();
2853cdf0e10cSrcweir
2854cdf0e10cSrcweir const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
2855cdf0e10cSrcweir
2856cdf0e10cSrcweir for(sal_Int32 i = 0; i < nCount; i++)
2857cdf0e10cSrcweir {
2858cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( aPropertyNames[i] );
2859cdf0e10cSrcweir if (!pEntry)
2860cdf0e10cSrcweir {
2861cdf0e10cSrcweir pReturns[i].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
2862cdf0e10cSrcweir }
2863cdf0e10cSrcweir else
2864cdf0e10cSrcweir {
2865cdf0e10cSrcweir sal_uInt16 nItemWhich = 0;
2866cdf0e10cSrcweir lcl_GetPropertyWhich( pEntry, nItemWhich );
2867cdf0e10cSrcweir pReturns[i].State = GetOnePropertyState( nItemWhich, pEntry );
2868cdf0e10cSrcweir GetOnePropertyValue( pEntry, pReturns[i].Value );
2869cdf0e10cSrcweir pReturns[i].Result = beans::TolerantPropertySetResultType::SUCCESS;
2870cdf0e10cSrcweir }
2871cdf0e10cSrcweir }
2872cdf0e10cSrcweir return aReturns;
2873cdf0e10cSrcweir }
2874cdf0e10cSrcweir
getDirectPropertyValuesTolerant(const uno::Sequence<::rtl::OUString> & aPropertyNames)2875cdf0e10cSrcweir uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL ScCellRangesBase::getDirectPropertyValuesTolerant( const uno::Sequence< ::rtl::OUString >& aPropertyNames )
2876cdf0e10cSrcweir throw (uno::RuntimeException)
2877cdf0e10cSrcweir {
2878cdf0e10cSrcweir ScUnoGuard aGuard;
2879cdf0e10cSrcweir
2880cdf0e10cSrcweir sal_Int32 nCount(aPropertyNames.getLength());
2881cdf0e10cSrcweir uno::Sequence < beans::GetDirectPropertyTolerantResult > aReturns(nCount);
2882cdf0e10cSrcweir beans::GetDirectPropertyTolerantResult* pReturns = aReturns.getArray();
2883cdf0e10cSrcweir
2884cdf0e10cSrcweir const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
2885cdf0e10cSrcweir
2886cdf0e10cSrcweir sal_Int32 j = 0;
2887cdf0e10cSrcweir for(sal_Int32 i = 0; i < nCount; i++)
2888cdf0e10cSrcweir {
2889cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( aPropertyNames[i] );
2890cdf0e10cSrcweir if (!pEntry)
2891cdf0e10cSrcweir {
2892cdf0e10cSrcweir pReturns[i].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
2893cdf0e10cSrcweir }
2894cdf0e10cSrcweir else
2895cdf0e10cSrcweir {
2896cdf0e10cSrcweir sal_uInt16 nItemWhich = 0;
2897cdf0e10cSrcweir lcl_GetPropertyWhich( pEntry, nItemWhich );
2898cdf0e10cSrcweir pReturns[j].State = GetOnePropertyState( nItemWhich, pEntry );
2899cdf0e10cSrcweir if (pReturns[j].State == beans::PropertyState_DIRECT_VALUE)
2900cdf0e10cSrcweir {
2901cdf0e10cSrcweir GetOnePropertyValue( pEntry, pReturns[j].Value );
2902cdf0e10cSrcweir pReturns[j].Result = beans::TolerantPropertySetResultType::SUCCESS;
2903cdf0e10cSrcweir pReturns[j].Name = aPropertyNames[i];
2904cdf0e10cSrcweir ++j;
2905cdf0e10cSrcweir }
2906cdf0e10cSrcweir }
2907cdf0e10cSrcweir }
2908cdf0e10cSrcweir if (j < nCount)
2909cdf0e10cSrcweir aReturns.realloc(j);
2910cdf0e10cSrcweir return aReturns;
2911cdf0e10cSrcweir }
2912cdf0e10cSrcweir
2913cdf0e10cSrcweir // XIndent
2914cdf0e10cSrcweir
decrementIndent()2915cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::decrementIndent() throw(::com::sun::star::uno::RuntimeException)
2916cdf0e10cSrcweir {
2917cdf0e10cSrcweir ScUnoGuard aGuard;
2918cdf0e10cSrcweir if ( pDocShell && aRanges.Count() ) // leer = nichts zu tun
2919cdf0e10cSrcweir {
2920cdf0e10cSrcweir ScDocFunc aFunc(*pDocShell);
2921cdf0e10cSrcweir //#97041#; put only MultiMarked ScMarkData in ChangeIndent
2922cdf0e10cSrcweir ScMarkData aMarkData(*GetMarkData());
2923cdf0e10cSrcweir aMarkData.MarkToMulti();
2924cdf0e10cSrcweir aFunc.ChangeIndent( aMarkData, sal_False, sal_True );
2925cdf0e10cSrcweir }
2926cdf0e10cSrcweir }
2927cdf0e10cSrcweir
incrementIndent()2928cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::incrementIndent() throw(::com::sun::star::uno::RuntimeException)
2929cdf0e10cSrcweir {
2930cdf0e10cSrcweir ScUnoGuard aGuard;
2931cdf0e10cSrcweir if ( pDocShell && aRanges.Count() ) // leer = nichts zu tun
2932cdf0e10cSrcweir {
2933cdf0e10cSrcweir ScDocFunc aFunc(*pDocShell);
2934cdf0e10cSrcweir //#97041#; put only MultiMarked ScMarkData in ChangeIndent
2935cdf0e10cSrcweir ScMarkData aMarkData(*GetMarkData());
2936cdf0e10cSrcweir aMarkData.MarkToMulti();
2937cdf0e10cSrcweir aFunc.ChangeIndent( aMarkData, sal_True, sal_True );
2938cdf0e10cSrcweir }
2939cdf0e10cSrcweir }
2940cdf0e10cSrcweir
2941cdf0e10cSrcweir // XChartData
2942cdf0e10cSrcweir
CreateMemChart_Impl() const2943cdf0e10cSrcweir ScMemChart* ScCellRangesBase::CreateMemChart_Impl() const
2944cdf0e10cSrcweir {
2945cdf0e10cSrcweir if ( pDocShell && aRanges.Count() )
2946cdf0e10cSrcweir {
2947cdf0e10cSrcweir ScRangeListRef xChartRanges;
2948cdf0e10cSrcweir if ( aRanges.Count() == 1 )
2949cdf0e10cSrcweir {
2950cdf0e10cSrcweir // ganze Tabelle sinnvoll begrenzen (auf belegten Datenbereich)
2951cdf0e10cSrcweir // (nur hier, Listener werden auf den ganzen Bereich angemeldet)
2952cdf0e10cSrcweir //! direkt testen, ob es ein ScTableSheetObj ist?
2953cdf0e10cSrcweir
2954cdf0e10cSrcweir ScRange* pRange = aRanges.GetObject(0);
2955cdf0e10cSrcweir if ( pRange->aStart.Col() == 0 && pRange->aEnd.Col() == MAXCOL &&
2956cdf0e10cSrcweir pRange->aStart.Row() == 0 && pRange->aEnd.Row() == MAXROW )
2957cdf0e10cSrcweir {
2958cdf0e10cSrcweir SCTAB nTab = pRange->aStart.Tab();
2959cdf0e10cSrcweir
2960cdf0e10cSrcweir SCCOL nStartX;
2961cdf0e10cSrcweir SCROW nStartY; // Anfang holen
2962cdf0e10cSrcweir if (!pDocShell->GetDocument()->GetDataStart( nTab, nStartX, nStartY ))
2963cdf0e10cSrcweir {
2964cdf0e10cSrcweir nStartX = 0;
2965cdf0e10cSrcweir nStartY = 0;
2966cdf0e10cSrcweir }
2967cdf0e10cSrcweir
2968cdf0e10cSrcweir SCCOL nEndX;
2969cdf0e10cSrcweir SCROW nEndY; // Ende holen
2970cdf0e10cSrcweir if (!pDocShell->GetDocument()->GetTableArea( nTab, nEndX, nEndY ))
2971cdf0e10cSrcweir {
2972cdf0e10cSrcweir nEndX = 0;
2973cdf0e10cSrcweir nEndY = 0;
2974cdf0e10cSrcweir }
2975cdf0e10cSrcweir
2976cdf0e10cSrcweir xChartRanges = new ScRangeList;
2977cdf0e10cSrcweir xChartRanges->Append( ScRange( nStartX, nStartY, nTab, nEndX, nEndY, nTab ) );
2978cdf0e10cSrcweir }
2979cdf0e10cSrcweir }
2980cdf0e10cSrcweir if (!xChartRanges.Is()) // sonst Ranges direkt uebernehmen
2981cdf0e10cSrcweir xChartRanges = new ScRangeList(aRanges);
2982cdf0e10cSrcweir ScChartArray aArr( pDocShell->GetDocument(), xChartRanges, String() );
2983cdf0e10cSrcweir
2984cdf0e10cSrcweir // RowAsHdr = ColHeaders und umgekehrt
2985cdf0e10cSrcweir aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr );
2986cdf0e10cSrcweir
2987cdf0e10cSrcweir return aArr.CreateMemChart();
2988cdf0e10cSrcweir }
2989cdf0e10cSrcweir return NULL;
2990cdf0e10cSrcweir }
2991cdf0e10cSrcweir
getData()2992cdf0e10cSrcweir uno::Sequence< uno::Sequence<double> > SAL_CALL ScCellRangesBase::getData()
2993cdf0e10cSrcweir throw(uno::RuntimeException)
2994cdf0e10cSrcweir {
2995cdf0e10cSrcweir ScUnoGuard aGuard;
2996cdf0e10cSrcweir ScMemChart* pMemChart = CreateMemChart_Impl();
2997cdf0e10cSrcweir if ( pMemChart )
2998cdf0e10cSrcweir {
2999cdf0e10cSrcweir sal_Int32 nColCount = pMemChart->GetColCount();
3000cdf0e10cSrcweir sal_Int32 nRowCount = static_cast<sal_Int32>(pMemChart->GetRowCount());
3001cdf0e10cSrcweir
3002cdf0e10cSrcweir uno::Sequence< uno::Sequence<double> > aRowSeq( nRowCount );
3003cdf0e10cSrcweir uno::Sequence<double>* pRowAry = aRowSeq.getArray();
3004cdf0e10cSrcweir for (sal_Int32 nRow = 0; nRow < nRowCount; nRow++)
3005cdf0e10cSrcweir {
3006cdf0e10cSrcweir uno::Sequence<double> aColSeq( nColCount );
3007cdf0e10cSrcweir double* pColAry = aColSeq.getArray();
3008cdf0e10cSrcweir for (sal_Int32 nCol = 0; nCol < nColCount; nCol++)
3009cdf0e10cSrcweir pColAry[nCol] = pMemChart->GetData( static_cast<short>(nCol), static_cast<short>(nRow) );
3010cdf0e10cSrcweir
3011cdf0e10cSrcweir pRowAry[nRow] = aColSeq;
3012cdf0e10cSrcweir }
3013cdf0e10cSrcweir
3014cdf0e10cSrcweir delete pMemChart;
3015cdf0e10cSrcweir return aRowSeq;
3016cdf0e10cSrcweir }
3017cdf0e10cSrcweir
3018cdf0e10cSrcweir return uno::Sequence< uno::Sequence<double> >(0);
3019cdf0e10cSrcweir }
3020cdf0e10cSrcweir
GetLimitedChartRanges_Impl(long nDataColumns,long nDataRows) const3021cdf0e10cSrcweir ScRangeListRef ScCellRangesBase::GetLimitedChartRanges_Impl( long nDataColumns, long nDataRows ) const
3022cdf0e10cSrcweir {
3023cdf0e10cSrcweir if ( aRanges.Count() == 1 )
3024cdf0e10cSrcweir {
3025cdf0e10cSrcweir ScRange* pRange = aRanges.GetObject(0);
3026cdf0e10cSrcweir if ( pRange->aStart.Col() == 0 && pRange->aEnd.Col() == MAXCOL &&
3027cdf0e10cSrcweir pRange->aStart.Row() == 0 && pRange->aEnd.Row() == MAXROW )
3028cdf0e10cSrcweir {
3029cdf0e10cSrcweir // if aRanges is a complete sheet, limit to given size
3030cdf0e10cSrcweir
3031cdf0e10cSrcweir SCTAB nTab = pRange->aStart.Tab();
3032cdf0e10cSrcweir
3033cdf0e10cSrcweir long nEndColumn = nDataColumns - 1 + ( bChartColAsHdr ? 1 : 0 );
3034cdf0e10cSrcweir if ( nEndColumn < 0 )
3035cdf0e10cSrcweir nEndColumn = 0;
3036cdf0e10cSrcweir if ( nEndColumn > MAXCOL )
3037cdf0e10cSrcweir nEndColumn = MAXCOL;
3038cdf0e10cSrcweir
3039cdf0e10cSrcweir long nEndRow = nDataRows - 1 + ( bChartRowAsHdr ? 1 : 0 );
3040cdf0e10cSrcweir if ( nEndRow < 0 )
3041cdf0e10cSrcweir nEndRow = 0;
3042cdf0e10cSrcweir if ( nEndRow > MAXROW )
3043cdf0e10cSrcweir nEndRow = MAXROW;
3044cdf0e10cSrcweir
3045cdf0e10cSrcweir ScRangeListRef xChartRanges = new ScRangeList;
3046cdf0e10cSrcweir xChartRanges->Append( ScRange( 0, 0, nTab, (SCCOL)nEndColumn, (SCROW)nEndRow, nTab ) );
3047cdf0e10cSrcweir return xChartRanges;
3048cdf0e10cSrcweir }
3049cdf0e10cSrcweir }
3050cdf0e10cSrcweir
3051cdf0e10cSrcweir return new ScRangeList(aRanges); // as-is
3052cdf0e10cSrcweir }
3053cdf0e10cSrcweir
setData(const uno::Sequence<uno::Sequence<double>> & aData)3054cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::setData( const uno::Sequence< uno::Sequence<double> >& aData )
3055cdf0e10cSrcweir throw(uno::RuntimeException)
3056cdf0e10cSrcweir {
3057cdf0e10cSrcweir ScUnoGuard aGuard;
3058cdf0e10cSrcweir sal_Bool bDone = sal_False;
3059cdf0e10cSrcweir long nRowCount = aData.getLength();
3060cdf0e10cSrcweir long nColCount = nRowCount ? aData[0].getLength() : 0;
3061cdf0e10cSrcweir ScRangeListRef xChartRanges = GetLimitedChartRanges_Impl( nColCount, nRowCount );
3062cdf0e10cSrcweir if ( pDocShell && xChartRanges.Is() )
3063cdf0e10cSrcweir {
3064cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
3065cdf0e10cSrcweir ScChartArray aArr( pDoc, xChartRanges, String() );
3066cdf0e10cSrcweir aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr ); // RowAsHdr = ColHeaders
3067cdf0e10cSrcweir const ScChartPositionMap* pPosMap = aArr.GetPositionMap();
3068cdf0e10cSrcweir if (pPosMap)
3069cdf0e10cSrcweir {
3070cdf0e10cSrcweir if ( pPosMap->GetColCount() == static_cast<SCCOL>(nColCount) &&
3071cdf0e10cSrcweir pPosMap->GetRowCount() == static_cast<SCROW>(nRowCount) )
3072cdf0e10cSrcweir {
3073cdf0e10cSrcweir for (long nRow=0; nRow<nRowCount; nRow++)
3074cdf0e10cSrcweir {
3075cdf0e10cSrcweir const uno::Sequence<double>& rRowSeq = aData[nRow];
3076cdf0e10cSrcweir const double* pArray = rRowSeq.getConstArray();
3077cdf0e10cSrcweir nColCount = rRowSeq.getLength();
3078cdf0e10cSrcweir for (long nCol=0; nCol<nColCount; nCol++)
3079cdf0e10cSrcweir {
3080cdf0e10cSrcweir const ScAddress* pPos = pPosMap->GetPosition(
3081cdf0e10cSrcweir sal::static_int_cast<SCCOL>(nCol),
3082cdf0e10cSrcweir sal::static_int_cast<SCROW>(nRow) );
3083cdf0e10cSrcweir if (pPos)
3084cdf0e10cSrcweir {
3085cdf0e10cSrcweir double fVal = pArray[nCol];
3086cdf0e10cSrcweir if ( fVal == DBL_MIN )
3087cdf0e10cSrcweir pDoc->PutCell( *pPos, NULL ); // empty cell
3088cdf0e10cSrcweir else
3089cdf0e10cSrcweir pDoc->SetValue( pPos->Col(), pPos->Row(), pPos->Tab(), pArray[nCol] );
3090cdf0e10cSrcweir }
3091cdf0e10cSrcweir }
3092cdf0e10cSrcweir }
3093cdf0e10cSrcweir
3094cdf0e10cSrcweir //! undo
3095cdf0e10cSrcweir PaintRanges_Impl( PAINT_GRID );
3096cdf0e10cSrcweir pDocShell->SetDocumentModified();
3097cdf0e10cSrcweir ForceChartListener_Impl(); // call listeners for this object synchronously
3098cdf0e10cSrcweir bDone = sal_True;
3099cdf0e10cSrcweir }
3100cdf0e10cSrcweir }
3101cdf0e10cSrcweir }
3102cdf0e10cSrcweir
3103cdf0e10cSrcweir if (!bDone)
3104cdf0e10cSrcweir throw uno::RuntimeException();
3105cdf0e10cSrcweir }
3106cdf0e10cSrcweir
getRowDescriptions()3107cdf0e10cSrcweir uno::Sequence<rtl::OUString> SAL_CALL ScCellRangesBase::getRowDescriptions()
3108cdf0e10cSrcweir throw(uno::RuntimeException)
3109cdf0e10cSrcweir {
3110cdf0e10cSrcweir ScUnoGuard aGuard;
3111cdf0e10cSrcweir ScMemChart* pMemChart = CreateMemChart_Impl();
3112cdf0e10cSrcweir if ( pMemChart )
3113cdf0e10cSrcweir {
3114cdf0e10cSrcweir sal_Int32 nRowCount = static_cast<sal_Int32>(pMemChart->GetRowCount());
3115cdf0e10cSrcweir uno::Sequence<rtl::OUString> aSeq( nRowCount );
3116cdf0e10cSrcweir rtl::OUString* pAry = aSeq.getArray();
3117cdf0e10cSrcweir for (sal_Int32 nRow = 0; nRow < nRowCount; nRow++)
3118cdf0e10cSrcweir pAry[nRow] = pMemChart->GetRowText(static_cast<short>(nRow));
3119cdf0e10cSrcweir
3120cdf0e10cSrcweir delete pMemChart;
3121cdf0e10cSrcweir return aSeq;
3122cdf0e10cSrcweir }
3123cdf0e10cSrcweir return uno::Sequence<rtl::OUString>(0);
3124cdf0e10cSrcweir }
3125cdf0e10cSrcweir
setRowDescriptions(const uno::Sequence<rtl::OUString> & aRowDescriptions)3126cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::setRowDescriptions(
3127cdf0e10cSrcweir const uno::Sequence<rtl::OUString>& aRowDescriptions )
3128cdf0e10cSrcweir throw(uno::RuntimeException)
3129cdf0e10cSrcweir {
3130cdf0e10cSrcweir ScUnoGuard aGuard;
3131cdf0e10cSrcweir sal_Bool bDone = sal_False;
3132cdf0e10cSrcweir if ( bChartColAsHdr )
3133cdf0e10cSrcweir {
3134cdf0e10cSrcweir long nRowCount = aRowDescriptions.getLength();
3135cdf0e10cSrcweir ScRangeListRef xChartRanges = GetLimitedChartRanges_Impl( 1, nRowCount );
3136cdf0e10cSrcweir if ( pDocShell && xChartRanges.Is() )
3137cdf0e10cSrcweir {
3138cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
3139cdf0e10cSrcweir ScChartArray aArr( pDoc, xChartRanges, String() );
3140cdf0e10cSrcweir aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr ); // RowAsHdr = ColHeaders
3141cdf0e10cSrcweir const ScChartPositionMap* pPosMap = aArr.GetPositionMap();
3142cdf0e10cSrcweir if (pPosMap)
3143cdf0e10cSrcweir {
3144cdf0e10cSrcweir if ( pPosMap->GetRowCount() == static_cast<SCROW>(nRowCount) )
3145cdf0e10cSrcweir {
3146cdf0e10cSrcweir const rtl::OUString* pArray = aRowDescriptions.getConstArray();
3147cdf0e10cSrcweir for (long nRow=0; nRow<nRowCount; nRow++)
3148cdf0e10cSrcweir {
3149cdf0e10cSrcweir const ScAddress* pPos = pPosMap->GetRowHeaderPosition(
3150cdf0e10cSrcweir static_cast<SCSIZE>(nRow) );
3151cdf0e10cSrcweir if (pPos)
3152cdf0e10cSrcweir {
3153cdf0e10cSrcweir String aStr = pArray[nRow];
3154cdf0e10cSrcweir if ( aStr.Len() )
3155cdf0e10cSrcweir pDoc->PutCell( *pPos, new ScStringCell( aStr ) );
3156cdf0e10cSrcweir else
3157cdf0e10cSrcweir pDoc->PutCell( *pPos, NULL ); // empty cell
3158cdf0e10cSrcweir }
3159cdf0e10cSrcweir }
3160cdf0e10cSrcweir
3161cdf0e10cSrcweir //! undo
3162cdf0e10cSrcweir PaintRanges_Impl( PAINT_GRID );
3163cdf0e10cSrcweir pDocShell->SetDocumentModified();
3164cdf0e10cSrcweir ForceChartListener_Impl(); // call listeners for this object synchronously
3165cdf0e10cSrcweir bDone = sal_True;
3166cdf0e10cSrcweir }
3167cdf0e10cSrcweir }
3168cdf0e10cSrcweir }
3169cdf0e10cSrcweir }
3170cdf0e10cSrcweir
3171cdf0e10cSrcweir if (!bDone)
3172cdf0e10cSrcweir throw uno::RuntimeException();
3173cdf0e10cSrcweir }
3174cdf0e10cSrcweir
getColumnDescriptions()3175cdf0e10cSrcweir uno::Sequence<rtl::OUString> SAL_CALL ScCellRangesBase::getColumnDescriptions()
3176cdf0e10cSrcweir throw(uno::RuntimeException)
3177cdf0e10cSrcweir {
3178cdf0e10cSrcweir ScUnoGuard aGuard;
3179cdf0e10cSrcweir ScMemChart* pMemChart = CreateMemChart_Impl();
3180cdf0e10cSrcweir if ( pMemChart )
3181cdf0e10cSrcweir {
3182cdf0e10cSrcweir sal_Int32 nColCount = pMemChart->GetColCount();
3183cdf0e10cSrcweir uno::Sequence<rtl::OUString> aSeq( nColCount );
3184cdf0e10cSrcweir rtl::OUString* pAry = aSeq.getArray();
3185cdf0e10cSrcweir for (sal_Int32 nCol = 0; nCol < nColCount; nCol++)
3186cdf0e10cSrcweir pAry[nCol] = pMemChart->GetColText(static_cast<short>(nCol));
3187cdf0e10cSrcweir
3188cdf0e10cSrcweir delete pMemChart;
3189cdf0e10cSrcweir return aSeq;
3190cdf0e10cSrcweir }
3191cdf0e10cSrcweir return uno::Sequence<rtl::OUString>(0);
3192cdf0e10cSrcweir }
3193cdf0e10cSrcweir
setColumnDescriptions(const uno::Sequence<rtl::OUString> & aColumnDescriptions)3194cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::setColumnDescriptions(
3195cdf0e10cSrcweir const uno::Sequence<rtl::OUString>& aColumnDescriptions )
3196cdf0e10cSrcweir throw(uno::RuntimeException)
3197cdf0e10cSrcweir {
3198cdf0e10cSrcweir ScUnoGuard aGuard;
3199cdf0e10cSrcweir sal_Bool bDone = sal_False;
3200cdf0e10cSrcweir if ( bChartRowAsHdr )
3201cdf0e10cSrcweir {
3202cdf0e10cSrcweir long nColCount = aColumnDescriptions.getLength();
3203cdf0e10cSrcweir ScRangeListRef xChartRanges = GetLimitedChartRanges_Impl( nColCount, 1 );
3204cdf0e10cSrcweir if ( pDocShell && xChartRanges.Is() )
3205cdf0e10cSrcweir {
3206cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
3207cdf0e10cSrcweir ScChartArray aArr( pDoc, xChartRanges, String() );
3208cdf0e10cSrcweir aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr ); // RowAsHdr = ColHeaders
3209cdf0e10cSrcweir const ScChartPositionMap* pPosMap = aArr.GetPositionMap();
3210cdf0e10cSrcweir if (pPosMap)
3211cdf0e10cSrcweir {
3212cdf0e10cSrcweir if ( pPosMap->GetColCount() == static_cast<SCCOL>(nColCount) )
3213cdf0e10cSrcweir {
3214cdf0e10cSrcweir const rtl::OUString* pArray = aColumnDescriptions.getConstArray();
3215cdf0e10cSrcweir for (long nCol=0; nCol<nColCount; nCol++)
3216cdf0e10cSrcweir {
3217cdf0e10cSrcweir const ScAddress* pPos = pPosMap->GetColHeaderPosition(
3218cdf0e10cSrcweir sal::static_int_cast<SCCOL>(nCol) );
3219cdf0e10cSrcweir if (pPos)
3220cdf0e10cSrcweir {
3221cdf0e10cSrcweir String aStr(pArray[nCol]);
3222cdf0e10cSrcweir if ( aStr.Len() )
3223cdf0e10cSrcweir pDoc->PutCell( *pPos, new ScStringCell( aStr ) );
3224cdf0e10cSrcweir else
3225cdf0e10cSrcweir pDoc->PutCell( *pPos, NULL ); // empty cell
3226cdf0e10cSrcweir }
3227cdf0e10cSrcweir }
3228cdf0e10cSrcweir
3229cdf0e10cSrcweir //! undo
3230cdf0e10cSrcweir PaintRanges_Impl( PAINT_GRID );
3231cdf0e10cSrcweir pDocShell->SetDocumentModified();
3232cdf0e10cSrcweir ForceChartListener_Impl(); // call listeners for this object synchronously
3233cdf0e10cSrcweir bDone = sal_True;
3234cdf0e10cSrcweir }
3235cdf0e10cSrcweir }
3236cdf0e10cSrcweir }
3237cdf0e10cSrcweir }
3238cdf0e10cSrcweir
3239cdf0e10cSrcweir if (!bDone)
3240cdf0e10cSrcweir throw uno::RuntimeException();
3241cdf0e10cSrcweir }
3242cdf0e10cSrcweir
ForceChartListener_Impl()3243cdf0e10cSrcweir void ScCellRangesBase::ForceChartListener_Impl()
3244cdf0e10cSrcweir {
3245cdf0e10cSrcweir // call Update immediately so the caller to setData etc. can
3246cdf0e10cSrcweir // regognize the listener call
3247cdf0e10cSrcweir
3248cdf0e10cSrcweir if ( pDocShell )
3249cdf0e10cSrcweir {
3250cdf0e10cSrcweir ScChartListenerCollection* pColl = pDocShell->GetDocument()->GetChartListenerCollection();
3251cdf0e10cSrcweir if ( pColl )
3252cdf0e10cSrcweir {
3253cdf0e10cSrcweir sal_uInt16 nCollCount = pColl->GetCount();
3254cdf0e10cSrcweir for ( sal_uInt16 nIndex = 0; nIndex < nCollCount; nIndex++ )
3255cdf0e10cSrcweir {
3256cdf0e10cSrcweir ScChartListener* pChartListener = (ScChartListener*)pColl->At(nIndex);
3257cdf0e10cSrcweir if ( pChartListener &&
3258cdf0e10cSrcweir pChartListener->GetUnoSource() == static_cast<chart::XChartData*>(this) &&
3259cdf0e10cSrcweir pChartListener->IsDirty() )
3260cdf0e10cSrcweir pChartListener->Update();
3261cdf0e10cSrcweir }
3262cdf0e10cSrcweir }
3263cdf0e10cSrcweir }
3264cdf0e10cSrcweir }
3265cdf0e10cSrcweir
lcl_UniqueName(ScStrCollection & rColl,const String & rPrefix)3266cdf0e10cSrcweir String lcl_UniqueName( ScStrCollection& rColl, const String& rPrefix )
3267cdf0e10cSrcweir {
3268cdf0e10cSrcweir long nNumber = 1;
3269cdf0e10cSrcweir sal_uInt16 nCollCount = rColl.GetCount();
3270cdf0e10cSrcweir while (sal_True)
3271cdf0e10cSrcweir {
3272cdf0e10cSrcweir String aName(rPrefix);
3273cdf0e10cSrcweir aName += String::CreateFromInt32( nNumber );
3274cdf0e10cSrcweir sal_Bool bFound = sal_False;
3275cdf0e10cSrcweir for (sal_uInt16 i=0; i<nCollCount; i++)
3276cdf0e10cSrcweir if ( rColl[i]->GetString() == aName )
3277cdf0e10cSrcweir {
3278cdf0e10cSrcweir bFound = sal_True;
3279cdf0e10cSrcweir break;
3280cdf0e10cSrcweir }
3281cdf0e10cSrcweir if (!bFound)
3282cdf0e10cSrcweir return aName;
3283cdf0e10cSrcweir ++nNumber;
3284cdf0e10cSrcweir }
3285cdf0e10cSrcweir }
3286cdf0e10cSrcweir
addChartDataChangeEventListener(const uno::Reference<chart::XChartDataChangeEventListener> & aListener)3287cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::addChartDataChangeEventListener( const uno::Reference<
3288cdf0e10cSrcweir chart::XChartDataChangeEventListener >& aListener )
3289cdf0e10cSrcweir throw(uno::RuntimeException)
3290cdf0e10cSrcweir {
3291cdf0e10cSrcweir ScUnoGuard aGuard;
3292cdf0e10cSrcweir if ( pDocShell && aRanges.Count() )
3293cdf0e10cSrcweir {
3294cdf0e10cSrcweir //! auf doppelte testen?
3295cdf0e10cSrcweir
3296cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
3297cdf0e10cSrcweir ScRangeListRef aRangesRef( new ScRangeList(aRanges) );
3298cdf0e10cSrcweir ScChartListenerCollection* pColl = pDoc->GetChartListenerCollection();
3299cdf0e10cSrcweir String aName(lcl_UniqueName( *pColl,
3300cdf0e10cSrcweir String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("__Uno")) ));
3301cdf0e10cSrcweir ScChartListener* pListener = new ScChartListener( aName, pDoc, aRangesRef );
3302cdf0e10cSrcweir pListener->SetUno( aListener, this );
3303cdf0e10cSrcweir pColl->Insert( pListener );
3304cdf0e10cSrcweir pListener->StartListeningTo();
3305cdf0e10cSrcweir }
3306cdf0e10cSrcweir }
3307cdf0e10cSrcweir
removeChartDataChangeEventListener(const uno::Reference<chart::XChartDataChangeEventListener> & aListener)3308cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::removeChartDataChangeEventListener( const uno::Reference<
3309cdf0e10cSrcweir chart::XChartDataChangeEventListener >& aListener )
3310cdf0e10cSrcweir throw(uno::RuntimeException)
3311cdf0e10cSrcweir {
3312cdf0e10cSrcweir ScUnoGuard aGuard;
3313cdf0e10cSrcweir if ( pDocShell && aRanges.Count() )
3314cdf0e10cSrcweir {
3315cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
3316cdf0e10cSrcweir ScChartListenerCollection* pColl = pDoc->GetChartListenerCollection();
3317cdf0e10cSrcweir pColl->FreeUno( aListener, this );
3318cdf0e10cSrcweir }
3319cdf0e10cSrcweir }
3320cdf0e10cSrcweir
getNotANumber()3321cdf0e10cSrcweir double SAL_CALL ScCellRangesBase::getNotANumber() throw(::com::sun::star::uno::RuntimeException)
3322cdf0e10cSrcweir {
3323cdf0e10cSrcweir // im ScChartArray wird DBL_MIN verwendet, weil das Chart es so will
3324cdf0e10cSrcweir return DBL_MIN;
3325cdf0e10cSrcweir }
3326cdf0e10cSrcweir
isNotANumber(double nNumber)3327cdf0e10cSrcweir sal_Bool SAL_CALL ScCellRangesBase::isNotANumber( double nNumber ) throw(uno::RuntimeException)
3328cdf0e10cSrcweir {
3329cdf0e10cSrcweir // im ScChartArray wird DBL_MIN verwendet, weil das Chart es so will
3330cdf0e10cSrcweir return (nNumber == DBL_MIN);
3331cdf0e10cSrcweir }
3332cdf0e10cSrcweir
3333cdf0e10cSrcweir // XModifyBroadcaster
3334cdf0e10cSrcweir
addModifyListener(const uno::Reference<util::XModifyListener> & aListener)3335cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::addModifyListener( const uno::Reference<util::XModifyListener>& aListener )
3336cdf0e10cSrcweir throw(uno::RuntimeException)
3337cdf0e10cSrcweir {
3338cdf0e10cSrcweir ScUnoGuard aGuard;
3339cdf0e10cSrcweir if ( aRanges.Count() == 0 )
3340cdf0e10cSrcweir throw uno::RuntimeException();
3341cdf0e10cSrcweir
3342cdf0e10cSrcweir uno::Reference<util::XModifyListener> *pObj =
3343cdf0e10cSrcweir new uno::Reference<util::XModifyListener>( aListener );
3344cdf0e10cSrcweir aValueListeners.Insert( pObj, aValueListeners.Count() );
3345cdf0e10cSrcweir
3346cdf0e10cSrcweir if ( aValueListeners.Count() == 1 )
3347cdf0e10cSrcweir {
3348cdf0e10cSrcweir if (!pValueListener)
3349cdf0e10cSrcweir pValueListener = new ScLinkListener( LINK( this, ScCellRangesBase, ValueListenerHdl ) );
3350cdf0e10cSrcweir
3351cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
3352cdf0e10cSrcweir sal_uLong nCount = aRanges.Count();
3353cdf0e10cSrcweir for (sal_uLong i=0; i<nCount; i++)
3354cdf0e10cSrcweir pDoc->StartListeningArea( *aRanges.GetObject(i), pValueListener );
3355cdf0e10cSrcweir
3356cdf0e10cSrcweir acquire(); // don't lose this object (one ref for all listeners)
3357cdf0e10cSrcweir }
3358cdf0e10cSrcweir }
3359cdf0e10cSrcweir
removeModifyListener(const uno::Reference<util::XModifyListener> & aListener)3360cdf0e10cSrcweir void SAL_CALL ScCellRangesBase::removeModifyListener( const uno::Reference<util::XModifyListener>& aListener )
3361cdf0e10cSrcweir throw(uno::RuntimeException)
3362cdf0e10cSrcweir {
3363cdf0e10cSrcweir
3364cdf0e10cSrcweir ScUnoGuard aGuard;
3365cdf0e10cSrcweir if ( aRanges.Count() == 0 )
3366cdf0e10cSrcweir throw uno::RuntimeException();
3367cdf0e10cSrcweir
3368cdf0e10cSrcweir acquire(); // in case the listeners have the last ref - released below
3369cdf0e10cSrcweir
3370cdf0e10cSrcweir sal_uInt16 nCount = aValueListeners.Count();
3371cdf0e10cSrcweir for ( sal_uInt16 n=nCount; n--; )
3372cdf0e10cSrcweir {
3373cdf0e10cSrcweir uno::Reference<util::XModifyListener> *pObj = aValueListeners[n];
3374cdf0e10cSrcweir if ( *pObj == aListener )
3375cdf0e10cSrcweir {
3376cdf0e10cSrcweir aValueListeners.DeleteAndDestroy( n );
3377cdf0e10cSrcweir
3378cdf0e10cSrcweir if ( aValueListeners.Count() == 0 )
3379cdf0e10cSrcweir {
3380cdf0e10cSrcweir if (pValueListener)
3381cdf0e10cSrcweir pValueListener->EndListeningAll();
3382cdf0e10cSrcweir
3383cdf0e10cSrcweir release(); // release the ref for the listeners
3384cdf0e10cSrcweir }
3385cdf0e10cSrcweir
3386cdf0e10cSrcweir break;
3387cdf0e10cSrcweir }
3388cdf0e10cSrcweir }
3389cdf0e10cSrcweir
3390cdf0e10cSrcweir release(); // might delete this object
3391cdf0e10cSrcweir }
3392cdf0e10cSrcweir
3393cdf0e10cSrcweir // XCellRangesQuery
3394cdf0e10cSrcweir
queryVisibleCells()3395cdf0e10cSrcweir uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryVisibleCells()
3396cdf0e10cSrcweir throw(uno::RuntimeException)
3397cdf0e10cSrcweir {
3398cdf0e10cSrcweir ScUnoGuard aGuard;
3399cdf0e10cSrcweir if (pDocShell)
3400cdf0e10cSrcweir {
3401cdf0e10cSrcweir //! fuer alle Tabellen getrennt, wenn Markierungen pro Tabelle getrennt sind!
3402cdf0e10cSrcweir SCTAB nTab = lcl_FirstTab(aRanges);
3403cdf0e10cSrcweir
3404cdf0e10cSrcweir ScMarkData aMarkData(*GetMarkData());
3405cdf0e10cSrcweir
3406cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
3407cdf0e10cSrcweir SCCOL nCol = 0, nLastCol;
3408cdf0e10cSrcweir while (nCol <= MAXCOL)
3409cdf0e10cSrcweir {
3410cdf0e10cSrcweir if (pDoc->ColHidden(nCol, nTab, nLastCol))
3411cdf0e10cSrcweir // hidden columns. Unselect them.
3412cdf0e10cSrcweir aMarkData.SetMultiMarkArea(ScRange(nCol, 0, nTab, nLastCol, MAXROW, nTab), false);
3413cdf0e10cSrcweir
3414cdf0e10cSrcweir nCol = nLastCol + 1;
3415cdf0e10cSrcweir }
3416cdf0e10cSrcweir
3417cdf0e10cSrcweir SCROW nRow = 0, nLastRow;
3418cdf0e10cSrcweir while (nRow <= MAXROW)
3419cdf0e10cSrcweir {
3420cdf0e10cSrcweir if (pDoc->RowHidden(nRow, nTab, nLastRow))
3421cdf0e10cSrcweir // These rows are hidden. Unselect them.
3422cdf0e10cSrcweir aMarkData.SetMultiMarkArea(ScRange(0, nRow, nTab, MAXCOL, nLastRow, nTab), false);
3423cdf0e10cSrcweir
3424cdf0e10cSrcweir nRow = nLastRow + 1;
3425cdf0e10cSrcweir }
3426cdf0e10cSrcweir
3427cdf0e10cSrcweir ScRangeList aNewRanges;
3428cdf0e10cSrcweir aMarkData.FillRangeListWithMarks( &aNewRanges, sal_False );
3429cdf0e10cSrcweir return new ScCellRangesObj( pDocShell, aNewRanges );
3430cdf0e10cSrcweir }
3431cdf0e10cSrcweir
3432cdf0e10cSrcweir return NULL;
3433cdf0e10cSrcweir }
3434cdf0e10cSrcweir
queryEmptyCells()3435cdf0e10cSrcweir uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryEmptyCells()
3436cdf0e10cSrcweir throw(uno::RuntimeException)
3437cdf0e10cSrcweir {
3438cdf0e10cSrcweir ScUnoGuard aGuard;
3439cdf0e10cSrcweir if (pDocShell)
3440cdf0e10cSrcweir {
3441cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
3442cdf0e10cSrcweir
3443cdf0e10cSrcweir ScMarkData aMarkData(*GetMarkData());
3444cdf0e10cSrcweir
3445cdf0e10cSrcweir // belegte Zellen wegmarkieren
3446cdf0e10cSrcweir sal_uLong nCount = aRanges.Count();
3447cdf0e10cSrcweir for (sal_uLong i=0; i<nCount; i++)
3448cdf0e10cSrcweir {
3449cdf0e10cSrcweir ScRange aRange = *aRanges.GetObject(i);
3450cdf0e10cSrcweir
3451cdf0e10cSrcweir ScCellIterator aIter( pDoc, aRange );
3452cdf0e10cSrcweir ScBaseCell* pCell = aIter.GetFirst();
3453cdf0e10cSrcweir while (pCell)
3454cdf0e10cSrcweir {
3455cdf0e10cSrcweir // Notizen zaehlen als nicht-leer
3456cdf0e10cSrcweir if ( !pCell->IsBlank() )
3457cdf0e10cSrcweir aMarkData.SetMultiMarkArea(
3458cdf0e10cSrcweir ScRange( aIter.GetCol(), aIter.GetRow(), aIter.GetTab() ),
3459cdf0e10cSrcweir sal_False );
3460cdf0e10cSrcweir
3461cdf0e10cSrcweir pCell = aIter.GetNext();
3462cdf0e10cSrcweir }
3463cdf0e10cSrcweir }
3464cdf0e10cSrcweir
3465cdf0e10cSrcweir ScRangeList aNewRanges;
3466cdf0e10cSrcweir // IsMultiMarked reicht hier nicht (wird beim deselektieren nicht zurueckgesetzt)
3467d3bd7a82SAndre Fischer //if (aMarkData.HasAnyMultiMarks()) // #20044# should be set for all empty range
3468cdf0e10cSrcweir aMarkData.FillRangeListWithMarks( &aNewRanges, sal_False );
3469cdf0e10cSrcweir
3470cdf0e10cSrcweir return new ScCellRangesObj( pDocShell, aNewRanges ); // aNewRanges kann leer sein
3471cdf0e10cSrcweir }
3472cdf0e10cSrcweir
3473cdf0e10cSrcweir return NULL;
3474cdf0e10cSrcweir }
3475cdf0e10cSrcweir
queryContentCells(sal_Int16 nContentFlags)3476cdf0e10cSrcweir uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryContentCells(
3477cdf0e10cSrcweir sal_Int16 nContentFlags )
3478cdf0e10cSrcweir throw(uno::RuntimeException)
3479cdf0e10cSrcweir {
3480cdf0e10cSrcweir ScUnoGuard aGuard;
3481cdf0e10cSrcweir if (pDocShell)
3482cdf0e10cSrcweir {
3483cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
3484cdf0e10cSrcweir
3485cdf0e10cSrcweir ScMarkData aMarkData;
3486cdf0e10cSrcweir
3487cdf0e10cSrcweir // passende Zellen selektieren
3488cdf0e10cSrcweir sal_uLong nCount = aRanges.Count();
3489cdf0e10cSrcweir for (sal_uLong i=0; i<nCount; i++)
3490cdf0e10cSrcweir {
3491cdf0e10cSrcweir ScRange aRange = *aRanges.GetObject(i);
3492cdf0e10cSrcweir
3493cdf0e10cSrcweir ScCellIterator aIter( pDoc, aRange );
3494cdf0e10cSrcweir ScBaseCell* pCell = aIter.GetFirst();
3495cdf0e10cSrcweir while (pCell)
3496cdf0e10cSrcweir {
3497cdf0e10cSrcweir sal_Bool bAdd = sal_False;
3498cdf0e10cSrcweir if ( pCell->HasNote() && ( nContentFlags & sheet::CellFlags::ANNOTATION ) )
3499cdf0e10cSrcweir bAdd = sal_True;
3500cdf0e10cSrcweir else
3501cdf0e10cSrcweir switch ( pCell->GetCellType() )
3502cdf0e10cSrcweir {
3503cdf0e10cSrcweir case CELLTYPE_STRING:
3504cdf0e10cSrcweir if ( nContentFlags & sheet::CellFlags::STRING )
3505cdf0e10cSrcweir bAdd = sal_True;
3506cdf0e10cSrcweir break;
3507cdf0e10cSrcweir case CELLTYPE_EDIT:
3508cdf0e10cSrcweir if ( (nContentFlags & sheet::CellFlags::STRING) || (nContentFlags & sheet::CellFlags::FORMATTED) )
3509cdf0e10cSrcweir bAdd = sal_True;
3510cdf0e10cSrcweir break;
3511cdf0e10cSrcweir case CELLTYPE_FORMULA:
3512cdf0e10cSrcweir if ( nContentFlags & sheet::CellFlags::FORMULA )
3513cdf0e10cSrcweir bAdd = sal_True;
3514cdf0e10cSrcweir break;
3515cdf0e10cSrcweir case CELLTYPE_VALUE:
3516cdf0e10cSrcweir if ( (nContentFlags & (sheet::CellFlags::VALUE|sheet::CellFlags::DATETIME))
3517cdf0e10cSrcweir == (sheet::CellFlags::VALUE|sheet::CellFlags::DATETIME) )
3518cdf0e10cSrcweir bAdd = sal_True;
3519cdf0e10cSrcweir else
3520cdf0e10cSrcweir {
3521cdf0e10cSrcweir // Date/Time Erkennung
3522cdf0e10cSrcweir
3523cdf0e10cSrcweir sal_uLong nIndex = (sal_uLong)((SfxUInt32Item*)pDoc->GetAttr(
3524cdf0e10cSrcweir aIter.GetCol(), aIter.GetRow(), aIter.GetTab(),
3525cdf0e10cSrcweir ATTR_VALUE_FORMAT ))->GetValue();
3526cdf0e10cSrcweir short nTyp = pDoc->GetFormatTable()->GetType(nIndex);
3527cdf0e10cSrcweir if ((nTyp == NUMBERFORMAT_DATE) || (nTyp == NUMBERFORMAT_TIME) ||
3528cdf0e10cSrcweir (nTyp == NUMBERFORMAT_DATETIME))
3529cdf0e10cSrcweir {
3530cdf0e10cSrcweir if ( nContentFlags & sheet::CellFlags::DATETIME )
3531cdf0e10cSrcweir bAdd = sal_True;
3532cdf0e10cSrcweir }
3533cdf0e10cSrcweir else
3534cdf0e10cSrcweir {
3535cdf0e10cSrcweir if ( nContentFlags & sheet::CellFlags::VALUE )
3536cdf0e10cSrcweir bAdd = sal_True;
3537cdf0e10cSrcweir }
3538cdf0e10cSrcweir }
3539cdf0e10cSrcweir break;
3540cdf0e10cSrcweir default:
3541cdf0e10cSrcweir {
3542cdf0e10cSrcweir // added to avoid warnings
3543cdf0e10cSrcweir }
3544cdf0e10cSrcweir }
3545cdf0e10cSrcweir
3546cdf0e10cSrcweir if (bAdd)
3547cdf0e10cSrcweir aMarkData.SetMultiMarkArea(
3548cdf0e10cSrcweir ScRange( aIter.GetCol(), aIter.GetRow(), aIter.GetTab() ),
3549cdf0e10cSrcweir sal_True );
3550cdf0e10cSrcweir
3551cdf0e10cSrcweir pCell = aIter.GetNext();
3552cdf0e10cSrcweir }
3553cdf0e10cSrcweir }
3554cdf0e10cSrcweir
3555cdf0e10cSrcweir ScRangeList aNewRanges;
3556cdf0e10cSrcweir if (aMarkData.IsMultiMarked())
3557cdf0e10cSrcweir aMarkData.FillRangeListWithMarks( &aNewRanges, sal_False );
3558cdf0e10cSrcweir
3559cdf0e10cSrcweir return new ScCellRangesObj( pDocShell, aNewRanges ); // aNewRanges kann leer sein
3560cdf0e10cSrcweir }
3561cdf0e10cSrcweir
3562cdf0e10cSrcweir return NULL;
3563cdf0e10cSrcweir }
3564cdf0e10cSrcweir
queryFormulaCells(sal_Int32 nResultFlags)3565cdf0e10cSrcweir uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryFormulaCells(
3566cdf0e10cSrcweir sal_Int32 nResultFlags )
3567cdf0e10cSrcweir throw(uno::RuntimeException)
3568cdf0e10cSrcweir {
3569cdf0e10cSrcweir ScUnoGuard aGuard;
3570cdf0e10cSrcweir if (pDocShell)
3571cdf0e10cSrcweir {
3572cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
3573cdf0e10cSrcweir
3574cdf0e10cSrcweir ScMarkData aMarkData;
3575cdf0e10cSrcweir
3576cdf0e10cSrcweir // passende Zellen selektieren
3577cdf0e10cSrcweir sal_uLong nCount = aRanges.Count();
3578cdf0e10cSrcweir for (sal_uLong i=0; i<nCount; i++)
3579cdf0e10cSrcweir {
3580cdf0e10cSrcweir ScRange aRange = *aRanges.GetObject(i);
3581cdf0e10cSrcweir
3582cdf0e10cSrcweir ScCellIterator aIter( pDoc, aRange );
3583cdf0e10cSrcweir ScBaseCell* pCell = aIter.GetFirst();
3584cdf0e10cSrcweir while (pCell)
3585cdf0e10cSrcweir {
3586cdf0e10cSrcweir if (pCell->GetCellType() == CELLTYPE_FORMULA)
3587cdf0e10cSrcweir {
3588cdf0e10cSrcweir ScFormulaCell* pFCell = (ScFormulaCell*)pCell;
3589cdf0e10cSrcweir sal_Bool bAdd = sal_False;
3590cdf0e10cSrcweir if (pFCell->GetErrCode())
3591cdf0e10cSrcweir {
3592cdf0e10cSrcweir if ( nResultFlags & sheet::FormulaResult::ERROR )
3593cdf0e10cSrcweir bAdd = sal_True;
3594cdf0e10cSrcweir }
3595cdf0e10cSrcweir else if (pFCell->IsValue())
3596cdf0e10cSrcweir {
3597cdf0e10cSrcweir if ( nResultFlags & sheet::FormulaResult::VALUE )
3598cdf0e10cSrcweir bAdd = sal_True;
3599cdf0e10cSrcweir }
3600cdf0e10cSrcweir else // String
3601cdf0e10cSrcweir {
3602cdf0e10cSrcweir if ( nResultFlags & sheet::FormulaResult::STRING )
3603cdf0e10cSrcweir bAdd = sal_True;
3604cdf0e10cSrcweir }
3605cdf0e10cSrcweir
3606cdf0e10cSrcweir if (bAdd)
3607cdf0e10cSrcweir aMarkData.SetMultiMarkArea(
3608cdf0e10cSrcweir ScRange( aIter.GetCol(), aIter.GetRow(), aIter.GetTab() ),
3609cdf0e10cSrcweir sal_True );
3610cdf0e10cSrcweir }
3611cdf0e10cSrcweir
3612cdf0e10cSrcweir pCell = aIter.GetNext();
3613cdf0e10cSrcweir }
3614cdf0e10cSrcweir }
3615cdf0e10cSrcweir
3616cdf0e10cSrcweir ScRangeList aNewRanges;
3617cdf0e10cSrcweir if (aMarkData.IsMultiMarked())
3618cdf0e10cSrcweir aMarkData.FillRangeListWithMarks( &aNewRanges, sal_False );
3619cdf0e10cSrcweir
3620cdf0e10cSrcweir return new ScCellRangesObj( pDocShell, aNewRanges ); // aNewRanges kann leer sein
3621cdf0e10cSrcweir }
3622cdf0e10cSrcweir
3623cdf0e10cSrcweir return NULL;
3624cdf0e10cSrcweir }
3625cdf0e10cSrcweir
QueryDifferences_Impl(const table::CellAddress & aCompare,sal_Bool bColumnDiff)3626cdf0e10cSrcweir uno::Reference<sheet::XSheetCellRanges> ScCellRangesBase::QueryDifferences_Impl(
3627cdf0e10cSrcweir const table::CellAddress& aCompare, sal_Bool bColumnDiff)
3628cdf0e10cSrcweir {
3629cdf0e10cSrcweir if (pDocShell)
3630cdf0e10cSrcweir {
3631cdf0e10cSrcweir sal_uLong nRangeCount = aRanges.Count();
3632cdf0e10cSrcweir sal_uLong i;
3633cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
3634cdf0e10cSrcweir ScMarkData aMarkData;
3635cdf0e10cSrcweir
3636cdf0e10cSrcweir SCCOLROW nCmpPos = bColumnDiff ? (SCCOLROW)aCompare.Row : (SCCOLROW)aCompare.Column;
3637cdf0e10cSrcweir
3638cdf0e10cSrcweir // zuerst alles selektieren, wo ueberhaupt etwas in der Vergleichsspalte steht
3639cdf0e10cSrcweir // (fuer gleiche Zellen wird die Selektion im zweiten Schritt aufgehoben)
3640cdf0e10cSrcweir
3641cdf0e10cSrcweir SCTAB nTab = lcl_FirstTab(aRanges); //! fuer alle Tabellen, wenn Markierungen pro Tabelle!
3642cdf0e10cSrcweir ScRange aCmpRange, aCellRange;
3643cdf0e10cSrcweir if (bColumnDiff)
3644cdf0e10cSrcweir aCmpRange = ScRange( 0,nCmpPos,nTab, MAXCOL,nCmpPos,nTab );
3645cdf0e10cSrcweir else
3646cdf0e10cSrcweir aCmpRange = ScRange( static_cast<SCCOL>(nCmpPos),0,nTab, static_cast<SCCOL>(nCmpPos),MAXROW,nTab );
3647cdf0e10cSrcweir ScCellIterator aCmpIter( pDoc, aCmpRange );
3648cdf0e10cSrcweir ScBaseCell* pCmpCell = aCmpIter.GetFirst();
3649cdf0e10cSrcweir while (pCmpCell)
3650cdf0e10cSrcweir {
3651cdf0e10cSrcweir if (pCmpCell->GetCellType() != CELLTYPE_NOTE)
3652cdf0e10cSrcweir {
3653cdf0e10cSrcweir SCCOLROW nCellPos = bColumnDiff ? static_cast<SCCOLROW>(aCmpIter.GetCol()) : static_cast<SCCOLROW>(aCmpIter.GetRow());
3654cdf0e10cSrcweir if (bColumnDiff)
3655cdf0e10cSrcweir aCellRange = ScRange( static_cast<SCCOL>(nCellPos),0,nTab,
3656cdf0e10cSrcweir static_cast<SCCOL>(nCellPos),MAXROW,nTab );
3657cdf0e10cSrcweir else
3658cdf0e10cSrcweir aCellRange = ScRange( 0,nCellPos,nTab, MAXCOL,nCellPos,nTab );
3659cdf0e10cSrcweir
3660cdf0e10cSrcweir for (i=0; i<nRangeCount; i++)
3661cdf0e10cSrcweir {
3662cdf0e10cSrcweir ScRange aRange(*aRanges.GetObject(i));
3663cdf0e10cSrcweir if ( aRange.Intersects( aCellRange ) )
3664cdf0e10cSrcweir {
3665cdf0e10cSrcweir if (bColumnDiff)
3666cdf0e10cSrcweir {
3667cdf0e10cSrcweir aRange.aStart.SetCol(static_cast<SCCOL>(nCellPos));
3668cdf0e10cSrcweir aRange.aEnd.SetCol(static_cast<SCCOL>(nCellPos));
3669cdf0e10cSrcweir }
3670cdf0e10cSrcweir else
3671cdf0e10cSrcweir {
3672cdf0e10cSrcweir aRange.aStart.SetRow(nCellPos);
3673cdf0e10cSrcweir aRange.aEnd.SetRow(nCellPos);
3674cdf0e10cSrcweir }
3675cdf0e10cSrcweir aMarkData.SetMultiMarkArea( aRange );
3676cdf0e10cSrcweir }
3677cdf0e10cSrcweir }
3678cdf0e10cSrcweir }
3679cdf0e10cSrcweir pCmpCell = aCmpIter.GetNext();
3680cdf0e10cSrcweir }
3681cdf0e10cSrcweir
3682cdf0e10cSrcweir // alle nichtleeren Zellen mit der Vergleichsspalte vergleichen und entsprechend
3683cdf0e10cSrcweir // selektieren oder aufheben
3684cdf0e10cSrcweir
3685cdf0e10cSrcweir ScAddress aCmpAddr;
3686cdf0e10cSrcweir for (i=0; i<nRangeCount; i++)
3687cdf0e10cSrcweir {
3688cdf0e10cSrcweir ScRange aRange(*aRanges.GetObject(i));
3689cdf0e10cSrcweir
3690cdf0e10cSrcweir ScCellIterator aIter( pDoc, aRange );
3691cdf0e10cSrcweir ScBaseCell* pCell = aIter.GetFirst();
3692cdf0e10cSrcweir while (pCell)
3693cdf0e10cSrcweir {
3694cdf0e10cSrcweir if (bColumnDiff)
3695cdf0e10cSrcweir aCmpAddr = ScAddress( aIter.GetCol(), nCmpPos, aIter.GetTab() );
3696cdf0e10cSrcweir else
3697cdf0e10cSrcweir aCmpAddr = ScAddress( static_cast<SCCOL>(nCmpPos), aIter.GetRow(), aIter.GetTab() );
3698cdf0e10cSrcweir const ScBaseCell* pOtherCell = pDoc->GetCell( aCmpAddr );
3699cdf0e10cSrcweir
3700cdf0e10cSrcweir ScRange aOneRange( aIter.GetCol(), aIter.GetRow(), aIter.GetTab() );
3701cdf0e10cSrcweir if ( !ScBaseCell::CellEqual( pCell, pOtherCell ) )
3702cdf0e10cSrcweir aMarkData.SetMultiMarkArea( aOneRange );
3703cdf0e10cSrcweir else
3704cdf0e10cSrcweir aMarkData.SetMultiMarkArea( aOneRange, sal_False ); // deselect
3705cdf0e10cSrcweir
3706cdf0e10cSrcweir pCell = aIter.GetNext();
3707cdf0e10cSrcweir }
3708cdf0e10cSrcweir }
3709cdf0e10cSrcweir
3710cdf0e10cSrcweir ScRangeList aNewRanges;
3711cdf0e10cSrcweir if (aMarkData.IsMultiMarked())
3712cdf0e10cSrcweir aMarkData.FillRangeListWithMarks( &aNewRanges, sal_False );
3713cdf0e10cSrcweir
3714cdf0e10cSrcweir return new ScCellRangesObj( pDocShell, aNewRanges ); // aNewRanges kann leer sein
3715cdf0e10cSrcweir }
3716cdf0e10cSrcweir return NULL;
3717cdf0e10cSrcweir }
3718cdf0e10cSrcweir
queryColumnDifferences(const table::CellAddress & aCompare)3719cdf0e10cSrcweir uno::Reference<sheet::XSheetCellRanges > SAL_CALL ScCellRangesBase::queryColumnDifferences(
3720cdf0e10cSrcweir const table::CellAddress& aCompare ) throw(uno::RuntimeException)
3721cdf0e10cSrcweir {
3722cdf0e10cSrcweir ScUnoGuard aGuard;
3723cdf0e10cSrcweir return QueryDifferences_Impl( aCompare, sal_True );
3724cdf0e10cSrcweir }
3725cdf0e10cSrcweir
queryRowDifferences(const table::CellAddress & aCompare)3726cdf0e10cSrcweir uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryRowDifferences(
3727cdf0e10cSrcweir const table::CellAddress& aCompare ) throw(uno::RuntimeException)
3728cdf0e10cSrcweir {
3729cdf0e10cSrcweir ScUnoGuard aGuard;
3730cdf0e10cSrcweir return QueryDifferences_Impl( aCompare, sal_False );
3731cdf0e10cSrcweir }
3732cdf0e10cSrcweir
queryIntersection(const table::CellRangeAddress & aRange)3733cdf0e10cSrcweir uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryIntersection(
3734cdf0e10cSrcweir const table::CellRangeAddress& aRange ) throw(uno::RuntimeException)
3735cdf0e10cSrcweir {
3736cdf0e10cSrcweir ScUnoGuard aGuard;
3737cdf0e10cSrcweir ScRange aMask( (SCCOL)aRange.StartColumn, (SCROW)aRange.StartRow, aRange.Sheet,
3738cdf0e10cSrcweir (SCCOL)aRange.EndColumn, (SCROW)aRange.EndRow, aRange.Sheet );
3739cdf0e10cSrcweir
3740cdf0e10cSrcweir ScRangeList aNew;
3741cdf0e10cSrcweir sal_uLong nCount = aRanges.Count();
3742cdf0e10cSrcweir for (sal_uLong i=0; i<nCount; i++)
3743cdf0e10cSrcweir {
3744cdf0e10cSrcweir ScRange aTemp(*aRanges.GetObject(i));
3745cdf0e10cSrcweir if ( aTemp.Intersects( aMask ) )
3746cdf0e10cSrcweir aNew.Join( ScRange( Max( aTemp.aStart.Col(), aMask.aStart.Col() ),
3747cdf0e10cSrcweir Max( aTemp.aStart.Row(), aMask.aStart.Row() ),
3748cdf0e10cSrcweir Max( aTemp.aStart.Tab(), aMask.aStart.Tab() ),
3749cdf0e10cSrcweir Min( aTemp.aEnd.Col(), aMask.aEnd.Col() ),
3750cdf0e10cSrcweir Min( aTemp.aEnd.Row(), aMask.aEnd.Row() ),
3751cdf0e10cSrcweir Min( aTemp.aEnd.Tab(), aMask.aEnd.Tab() ) ) );
3752cdf0e10cSrcweir }
3753cdf0e10cSrcweir
3754cdf0e10cSrcweir return new ScCellRangesObj( pDocShell, aNew ); // kann leer sein
3755cdf0e10cSrcweir }
3756cdf0e10cSrcweir
3757cdf0e10cSrcweir // XFormulaQuery
3758cdf0e10cSrcweir
queryPrecedents(sal_Bool bRecursive)3759cdf0e10cSrcweir uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryPrecedents(
3760cdf0e10cSrcweir sal_Bool bRecursive ) throw(uno::RuntimeException)
3761cdf0e10cSrcweir {
3762cdf0e10cSrcweir ScUnoGuard aGuard;
3763cdf0e10cSrcweir if ( pDocShell )
3764cdf0e10cSrcweir {
3765cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
3766cdf0e10cSrcweir
3767cdf0e10cSrcweir ScRangeList aNewRanges(aRanges);
3768cdf0e10cSrcweir sal_Bool bFound;
3769cdf0e10cSrcweir do
3770cdf0e10cSrcweir {
3771cdf0e10cSrcweir bFound = sal_False;
3772cdf0e10cSrcweir
3773cdf0e10cSrcweir // #97205# aMarkData uses aNewRanges, not aRanges, so GetMarkData can't be used
3774cdf0e10cSrcweir ScMarkData aMarkData;
3775cdf0e10cSrcweir aMarkData.MarkFromRangeList( aNewRanges, sal_False );
3776cdf0e10cSrcweir aMarkData.MarkToMulti(); // needed for IsAllMarked
3777cdf0e10cSrcweir
3778cdf0e10cSrcweir sal_uLong nCount = aNewRanges.Count();
3779cdf0e10cSrcweir for (sal_uLong nR=0; nR<nCount; nR++)
3780cdf0e10cSrcweir {
3781cdf0e10cSrcweir ScRange aRange(*aNewRanges.GetObject(nR));
3782cdf0e10cSrcweir ScCellIterator aIter( pDoc, aRange );
3783cdf0e10cSrcweir ScBaseCell* pCell = aIter.GetFirst();
3784cdf0e10cSrcweir while (pCell)
3785cdf0e10cSrcweir {
3786cdf0e10cSrcweir if ( pCell->GetCellType() == CELLTYPE_FORMULA )
3787cdf0e10cSrcweir {
3788cdf0e10cSrcweir ScFormulaCell* pFCell = (ScFormulaCell*) pCell;
3789cdf0e10cSrcweir
3790cdf0e10cSrcweir ScDetectiveRefIter aRefIter( pFCell );
3791cdf0e10cSrcweir ScRange aRefRange;
3792cdf0e10cSrcweir while ( aRefIter.GetNextRef( aRefRange) )
3793cdf0e10cSrcweir {
3794cdf0e10cSrcweir if ( bRecursive && !bFound && !aMarkData.IsAllMarked( aRefRange ) )
3795cdf0e10cSrcweir bFound = sal_True;
3796cdf0e10cSrcweir aMarkData.SetMultiMarkArea( aRefRange, sal_True );
3797cdf0e10cSrcweir }
3798cdf0e10cSrcweir }
3799cdf0e10cSrcweir pCell = aIter.GetNext();
3800cdf0e10cSrcweir }
3801cdf0e10cSrcweir }
3802cdf0e10cSrcweir
3803cdf0e10cSrcweir aMarkData.FillRangeListWithMarks( &aNewRanges, sal_True );
3804cdf0e10cSrcweir }
3805cdf0e10cSrcweir while ( bRecursive && bFound );
3806cdf0e10cSrcweir
3807cdf0e10cSrcweir return new ScCellRangesObj( pDocShell, aNewRanges );
3808cdf0e10cSrcweir }
3809cdf0e10cSrcweir
3810cdf0e10cSrcweir return NULL;
3811cdf0e10cSrcweir }
3812cdf0e10cSrcweir
queryDependents(sal_Bool bRecursive)3813cdf0e10cSrcweir uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryDependents(
3814cdf0e10cSrcweir sal_Bool bRecursive ) throw(uno::RuntimeException)
3815cdf0e10cSrcweir {
3816cdf0e10cSrcweir ScUnoGuard aGuard;
3817cdf0e10cSrcweir if ( pDocShell )
3818cdf0e10cSrcweir {
3819cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
3820cdf0e10cSrcweir
3821cdf0e10cSrcweir ScRangeList aNewRanges(aRanges);
3822cdf0e10cSrcweir sal_Bool bFound;
3823cdf0e10cSrcweir do
3824cdf0e10cSrcweir {
3825cdf0e10cSrcweir bFound = sal_False;
3826cdf0e10cSrcweir sal_uLong nRangesCount = aNewRanges.Count();
3827cdf0e10cSrcweir
3828cdf0e10cSrcweir // #97205# aMarkData uses aNewRanges, not aRanges, so GetMarkData can't be used
3829cdf0e10cSrcweir ScMarkData aMarkData;
3830cdf0e10cSrcweir aMarkData.MarkFromRangeList( aNewRanges, sal_False );
3831cdf0e10cSrcweir aMarkData.MarkToMulti(); // needed for IsAllMarked
3832cdf0e10cSrcweir
3833cdf0e10cSrcweir SCTAB nTab = lcl_FirstTab(aNewRanges); //! alle Tabellen
3834cdf0e10cSrcweir
3835cdf0e10cSrcweir ScCellIterator aCellIter( pDoc, 0,0, nTab, MAXCOL,MAXROW, nTab );
3836cdf0e10cSrcweir ScBaseCell* pCell = aCellIter.GetFirst();
3837cdf0e10cSrcweir while (pCell)
3838cdf0e10cSrcweir {
3839cdf0e10cSrcweir if (pCell->GetCellType() == CELLTYPE_FORMULA)
3840cdf0e10cSrcweir {
3841cdf0e10cSrcweir sal_Bool bMark = sal_False;
3842cdf0e10cSrcweir ScDetectiveRefIter aIter( (ScFormulaCell*) pCell );
3843cdf0e10cSrcweir ScRange aRefRange;
3844cdf0e10cSrcweir while ( aIter.GetNextRef( aRefRange) )
3845cdf0e10cSrcweir {
3846cdf0e10cSrcweir for (sal_uLong nR=0; nR<nRangesCount; nR++)
3847cdf0e10cSrcweir {
3848cdf0e10cSrcweir ScRange aRange(*aNewRanges.GetObject(nR));
3849cdf0e10cSrcweir if (aRange.Intersects(aRefRange))
3850cdf0e10cSrcweir bMark = sal_True; // von Teil des Ranges abhaengig
3851cdf0e10cSrcweir }
3852cdf0e10cSrcweir }
3853cdf0e10cSrcweir if (bMark)
3854cdf0e10cSrcweir {
3855cdf0e10cSrcweir ScRange aCellRange( aCellIter.GetCol(),
3856cdf0e10cSrcweir aCellIter.GetRow(),
3857cdf0e10cSrcweir aCellIter.GetTab() );
3858cdf0e10cSrcweir if ( bRecursive && !bFound && !aMarkData.IsAllMarked( aCellRange ) )
3859cdf0e10cSrcweir bFound = sal_True;
3860cdf0e10cSrcweir aMarkData.SetMultiMarkArea( aCellRange, sal_True );
3861cdf0e10cSrcweir }
3862cdf0e10cSrcweir }
3863cdf0e10cSrcweir pCell = aCellIter.GetNext();
3864cdf0e10cSrcweir }
3865cdf0e10cSrcweir
3866cdf0e10cSrcweir aMarkData.FillRangeListWithMarks( &aNewRanges, sal_True );
3867cdf0e10cSrcweir }
3868cdf0e10cSrcweir while ( bRecursive && bFound );
3869cdf0e10cSrcweir
3870cdf0e10cSrcweir return new ScCellRangesObj( pDocShell, aNewRanges );
3871cdf0e10cSrcweir }
3872cdf0e10cSrcweir
3873cdf0e10cSrcweir return NULL;
3874cdf0e10cSrcweir }
3875cdf0e10cSrcweir
3876cdf0e10cSrcweir // XSearchable
3877cdf0e10cSrcweir
createSearchDescriptor()3878cdf0e10cSrcweir uno::Reference<util::XSearchDescriptor> SAL_CALL ScCellRangesBase::createSearchDescriptor()
3879cdf0e10cSrcweir throw(uno::RuntimeException)
3880cdf0e10cSrcweir {
3881cdf0e10cSrcweir ScUnoGuard aGuard;
3882cdf0e10cSrcweir return new ScCellSearchObj;
3883cdf0e10cSrcweir }
3884cdf0e10cSrcweir
findAll(const uno::Reference<util::XSearchDescriptor> & xDesc)3885cdf0e10cSrcweir uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangesBase::findAll(
3886cdf0e10cSrcweir const uno::Reference<util::XSearchDescriptor>& xDesc )
3887cdf0e10cSrcweir throw(uno::RuntimeException)
3888cdf0e10cSrcweir {
3889cdf0e10cSrcweir // Wenn nichts gefunden wird, soll Null zurueckgegeben werden (?)
3890cdf0e10cSrcweir uno::Reference<container::XIndexAccess> xRet;
3891cdf0e10cSrcweir if ( pDocShell && xDesc.is() )
3892cdf0e10cSrcweir {
3893cdf0e10cSrcweir ScCellSearchObj* pSearch = ScCellSearchObj::getImplementation( xDesc );
3894cdf0e10cSrcweir if (pSearch)
3895cdf0e10cSrcweir {
3896cdf0e10cSrcweir SvxSearchItem* pSearchItem = pSearch->GetSearchItem();
3897cdf0e10cSrcweir if (pSearchItem)
3898cdf0e10cSrcweir {
3899cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
3900cdf0e10cSrcweir pSearchItem->SetCommand( SVX_SEARCHCMD_FIND_ALL );
3901cdf0e10cSrcweir // immer nur innerhalb dieses Objekts
3902cdf0e10cSrcweir pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) );
3903cdf0e10cSrcweir
3904cdf0e10cSrcweir ScMarkData aMark(*GetMarkData());
3905cdf0e10cSrcweir
3906cdf0e10cSrcweir String aDummyUndo;
3907cdf0e10cSrcweir SCCOL nCol = 0;
3908cdf0e10cSrcweir SCROW nRow = 0;
3909cdf0e10cSrcweir SCTAB nTab = 0;
3910cdf0e10cSrcweir sal_Bool bFound = pDoc->SearchAndReplace( *pSearchItem, nCol, nRow, nTab,
3911cdf0e10cSrcweir aMark, aDummyUndo, NULL );
3912cdf0e10cSrcweir if (bFound)
3913cdf0e10cSrcweir {
3914cdf0e10cSrcweir ScRangeList aNewRanges;
3915cdf0e10cSrcweir aMark.FillRangeListWithMarks( &aNewRanges, sal_True );
3916cdf0e10cSrcweir // bei findAll immer CellRanges, egal wieviel gefunden wurde
3917cdf0e10cSrcweir xRet.set(new ScCellRangesObj( pDocShell, aNewRanges ));
3918cdf0e10cSrcweir }
3919cdf0e10cSrcweir }
3920cdf0e10cSrcweir }
3921cdf0e10cSrcweir }
3922cdf0e10cSrcweir return xRet;
3923cdf0e10cSrcweir }
3924cdf0e10cSrcweir
Find_Impl(const uno::Reference<util::XSearchDescriptor> & xDesc,const ScAddress * pLastPos)3925cdf0e10cSrcweir uno::Reference<uno::XInterface> ScCellRangesBase::Find_Impl(
3926cdf0e10cSrcweir const uno::Reference<util::XSearchDescriptor>& xDesc,
3927cdf0e10cSrcweir const ScAddress* pLastPos )
3928cdf0e10cSrcweir {
3929cdf0e10cSrcweir uno::Reference<uno::XInterface> xRet;
3930cdf0e10cSrcweir if ( pDocShell && xDesc.is() )
3931cdf0e10cSrcweir {
3932cdf0e10cSrcweir ScCellSearchObj* pSearch = ScCellSearchObj::getImplementation( xDesc );
3933cdf0e10cSrcweir if (pSearch)
3934cdf0e10cSrcweir {
3935cdf0e10cSrcweir SvxSearchItem* pSearchItem = pSearch->GetSearchItem();
3936cdf0e10cSrcweir if (pSearchItem)
3937cdf0e10cSrcweir {
3938cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
3939cdf0e10cSrcweir pSearchItem->SetCommand( SVX_SEARCHCMD_FIND );
3940cdf0e10cSrcweir // immer nur innerhalb dieses Objekts
3941cdf0e10cSrcweir pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) );
3942cdf0e10cSrcweir
3943cdf0e10cSrcweir ScMarkData aMark(*GetMarkData());
3944cdf0e10cSrcweir
3945cdf0e10cSrcweir SCCOL nCol;
3946cdf0e10cSrcweir SCROW nRow;
3947cdf0e10cSrcweir SCTAB nTab;
3948cdf0e10cSrcweir if (pLastPos)
3949cdf0e10cSrcweir pLastPos->GetVars( nCol, nRow, nTab );
3950cdf0e10cSrcweir else
3951cdf0e10cSrcweir {
3952cdf0e10cSrcweir nTab = lcl_FirstTab(aRanges); //! mehrere Tabellen?
3953cdf0e10cSrcweir ScDocument::GetSearchAndReplaceStart( *pSearchItem, nCol, nRow );
3954cdf0e10cSrcweir }
3955cdf0e10cSrcweir
3956cdf0e10cSrcweir String aDummyUndo;
3957cdf0e10cSrcweir sal_Bool bFound = pDoc->SearchAndReplace( *pSearchItem, nCol, nRow, nTab,
3958cdf0e10cSrcweir aMark, aDummyUndo, NULL );
3959cdf0e10cSrcweir if (bFound)
3960cdf0e10cSrcweir {
3961cdf0e10cSrcweir ScAddress aFoundPos( nCol, nRow, nTab );
3962cdf0e10cSrcweir xRet.set((cppu::OWeakObject*) new ScCellObj( pDocShell, aFoundPos ));
3963cdf0e10cSrcweir }
3964cdf0e10cSrcweir }
3965cdf0e10cSrcweir }
3966cdf0e10cSrcweir }
3967cdf0e10cSrcweir return xRet;
3968cdf0e10cSrcweir }
3969cdf0e10cSrcweir
findFirst(const uno::Reference<util::XSearchDescriptor> & xDesc)3970cdf0e10cSrcweir uno::Reference<uno::XInterface> SAL_CALL ScCellRangesBase::findFirst(
3971cdf0e10cSrcweir const uno::Reference<util::XSearchDescriptor>& xDesc )
3972cdf0e10cSrcweir throw(uno::RuntimeException)
3973cdf0e10cSrcweir {
3974cdf0e10cSrcweir ScUnoGuard aGuard;
3975cdf0e10cSrcweir return Find_Impl( xDesc, NULL );
3976cdf0e10cSrcweir }
3977cdf0e10cSrcweir
findNext(const uno::Reference<uno::XInterface> & xStartAt,const uno::Reference<util::XSearchDescriptor> & xDesc)3978cdf0e10cSrcweir uno::Reference<uno::XInterface> SAL_CALL ScCellRangesBase::findNext(
3979cdf0e10cSrcweir const uno::Reference<uno::XInterface>& xStartAt,
3980cdf0e10cSrcweir const uno::Reference<util::XSearchDescriptor >& xDesc )
3981cdf0e10cSrcweir throw(uno::RuntimeException)
3982cdf0e10cSrcweir {
3983cdf0e10cSrcweir ScUnoGuard aGuard;
3984cdf0e10cSrcweir if ( xStartAt.is() )
3985cdf0e10cSrcweir {
3986cdf0e10cSrcweir ScCellRangesBase* pRangesImp = ScCellRangesBase::getImplementation( xStartAt );
3987cdf0e10cSrcweir if ( pRangesImp && pRangesImp->GetDocShell() == pDocShell )
3988cdf0e10cSrcweir {
3989cdf0e10cSrcweir const ScRangeList& rStartRanges = pRangesImp->GetRangeList();
3990cdf0e10cSrcweir if ( rStartRanges.Count() == 1 )
3991cdf0e10cSrcweir {
3992cdf0e10cSrcweir ScAddress aStartPos = rStartRanges.GetObject(0)->aStart;
3993cdf0e10cSrcweir return Find_Impl( xDesc, &aStartPos );
3994cdf0e10cSrcweir }
3995cdf0e10cSrcweir }
3996cdf0e10cSrcweir }
3997cdf0e10cSrcweir return NULL;
3998cdf0e10cSrcweir }
3999cdf0e10cSrcweir
4000cdf0e10cSrcweir // XReplaceable
4001cdf0e10cSrcweir
createReplaceDescriptor()4002cdf0e10cSrcweir uno::Reference<util::XReplaceDescriptor> SAL_CALL ScCellRangesBase::createReplaceDescriptor()
4003cdf0e10cSrcweir throw(uno::RuntimeException)
4004cdf0e10cSrcweir {
4005cdf0e10cSrcweir ScUnoGuard aGuard;
4006cdf0e10cSrcweir return new ScCellSearchObj;
4007cdf0e10cSrcweir }
4008cdf0e10cSrcweir
replaceAll(const uno::Reference<util::XSearchDescriptor> & xDesc)4009cdf0e10cSrcweir sal_Int32 SAL_CALL ScCellRangesBase::replaceAll( const uno::Reference<util::XSearchDescriptor>& xDesc )
4010cdf0e10cSrcweir throw(uno::RuntimeException)
4011cdf0e10cSrcweir {
4012cdf0e10cSrcweir ScUnoGuard aGuard;
4013cdf0e10cSrcweir sal_Int32 nReplaced = 0;
4014cdf0e10cSrcweir if ( pDocShell && xDesc.is() )
4015cdf0e10cSrcweir {
4016cdf0e10cSrcweir ScCellSearchObj* pSearch = ScCellSearchObj::getImplementation( xDesc );
4017cdf0e10cSrcweir if (pSearch)
4018cdf0e10cSrcweir {
4019cdf0e10cSrcweir SvxSearchItem* pSearchItem = pSearch->GetSearchItem();
4020cdf0e10cSrcweir if (pSearchItem)
4021cdf0e10cSrcweir {
4022cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
4023cdf0e10cSrcweir sal_Bool bUndo(pDoc->IsUndoEnabled());
4024cdf0e10cSrcweir pSearchItem->SetCommand( SVX_SEARCHCMD_REPLACE_ALL );
4025cdf0e10cSrcweir // immer nur innerhalb dieses Objekts
4026cdf0e10cSrcweir pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) );
4027cdf0e10cSrcweir
4028cdf0e10cSrcweir ScMarkData aMark(*GetMarkData());
4029cdf0e10cSrcweir
4030cdf0e10cSrcweir SCTAB nTabCount = pDoc->GetTableCount();
4031cdf0e10cSrcweir sal_Bool bProtected = !pDocShell->IsEditable();
4032cdf0e10cSrcweir for (SCTAB i=0; i<nTabCount; i++)
4033cdf0e10cSrcweir if ( aMark.GetTableSelect(i) && pDoc->IsTabProtected(i) )
4034cdf0e10cSrcweir bProtected = sal_True;
4035cdf0e10cSrcweir if (bProtected)
4036cdf0e10cSrcweir {
4037cdf0e10cSrcweir //! Exception, oder was?
4038cdf0e10cSrcweir }
4039cdf0e10cSrcweir else
4040cdf0e10cSrcweir {
4041cdf0e10cSrcweir SCTAB nTab = aMark.GetFirstSelected(); // bei SearchAndReplace nicht benutzt
4042cdf0e10cSrcweir SCCOL nCol = 0;
4043cdf0e10cSrcweir SCROW nRow = 0;
4044cdf0e10cSrcweir
4045cdf0e10cSrcweir String aUndoStr;
4046cdf0e10cSrcweir ScDocument* pUndoDoc = NULL;
4047cdf0e10cSrcweir if (bUndo)
4048cdf0e10cSrcweir {
4049cdf0e10cSrcweir pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
4050cdf0e10cSrcweir pUndoDoc->InitUndo( pDoc, nTab, nTab );
4051cdf0e10cSrcweir }
4052cdf0e10cSrcweir for (SCTAB i=0; i<nTabCount; i++)
4053cdf0e10cSrcweir if ( aMark.GetTableSelect(i) && i != nTab && bUndo)
4054cdf0e10cSrcweir pUndoDoc->AddUndoTab( i, i );
4055cdf0e10cSrcweir ScMarkData* pUndoMark = NULL;
4056cdf0e10cSrcweir if (bUndo)
4057cdf0e10cSrcweir pUndoMark = new ScMarkData(aMark);
4058cdf0e10cSrcweir
4059cdf0e10cSrcweir sal_Bool bFound(sal_False);
4060cdf0e10cSrcweir if (bUndo)
4061cdf0e10cSrcweir bFound = pDoc->SearchAndReplace( *pSearchItem, nCol, nRow, nTab,
4062cdf0e10cSrcweir aMark, aUndoStr, pUndoDoc );
4063cdf0e10cSrcweir if (bFound)
4064cdf0e10cSrcweir {
4065cdf0e10cSrcweir nReplaced = pUndoDoc->GetCellCount();
4066cdf0e10cSrcweir
4067cdf0e10cSrcweir pDocShell->GetUndoManager()->AddUndoAction(
4068cdf0e10cSrcweir new ScUndoReplace( pDocShell, *pUndoMark, nCol, nRow, nTab,
4069cdf0e10cSrcweir aUndoStr, pUndoDoc, pSearchItem ) );
4070cdf0e10cSrcweir
4071cdf0e10cSrcweir pDocShell->PostPaintGridAll();
4072cdf0e10cSrcweir pDocShell->SetDocumentModified();
4073cdf0e10cSrcweir }
4074cdf0e10cSrcweir else
4075cdf0e10cSrcweir {
4076cdf0e10cSrcweir delete pUndoDoc;
4077cdf0e10cSrcweir delete pUndoMark;
4078cdf0e10cSrcweir // nReplaced bleibt 0
4079cdf0e10cSrcweir }
4080cdf0e10cSrcweir }
4081cdf0e10cSrcweir }
4082cdf0e10cSrcweir }
4083cdf0e10cSrcweir }
4084cdf0e10cSrcweir return nReplaced;
4085cdf0e10cSrcweir }
4086cdf0e10cSrcweir
4087cdf0e10cSrcweir // XUnoTunnel
4088cdf0e10cSrcweir
getSomething(const uno::Sequence<sal_Int8> & rId)4089cdf0e10cSrcweir sal_Int64 SAL_CALL ScCellRangesBase::getSomething(
4090cdf0e10cSrcweir const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException)
4091cdf0e10cSrcweir {
4092cdf0e10cSrcweir if ( rId.getLength() == 16 &&
4093cdf0e10cSrcweir 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
4094cdf0e10cSrcweir rId.getConstArray(), 16 ) )
4095cdf0e10cSrcweir {
4096cdf0e10cSrcweir return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
4097cdf0e10cSrcweir }
4098cdf0e10cSrcweir return 0;
4099cdf0e10cSrcweir }
4100cdf0e10cSrcweir
4101cdf0e10cSrcweir // static
getUnoTunnelId()4102cdf0e10cSrcweir const uno::Sequence<sal_Int8>& ScCellRangesBase::getUnoTunnelId()
4103cdf0e10cSrcweir {
4104cdf0e10cSrcweir static uno::Sequence<sal_Int8> * pSeq = 0;
4105cdf0e10cSrcweir if( !pSeq )
4106cdf0e10cSrcweir {
4107cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
4108cdf0e10cSrcweir if( !pSeq )
4109cdf0e10cSrcweir {
4110cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aSeq( 16 );
4111cdf0e10cSrcweir rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
4112cdf0e10cSrcweir pSeq = &aSeq;
4113cdf0e10cSrcweir }
4114cdf0e10cSrcweir }
4115cdf0e10cSrcweir return *pSeq;
4116cdf0e10cSrcweir }
4117cdf0e10cSrcweir
4118cdf0e10cSrcweir // static
getImplementation(const uno::Reference<uno::XInterface> xObj)4119cdf0e10cSrcweir ScCellRangesBase* ScCellRangesBase::getImplementation( const uno::Reference<uno::XInterface> xObj )
4120cdf0e10cSrcweir {
4121cdf0e10cSrcweir ScCellRangesBase* pRet = NULL;
4122cdf0e10cSrcweir uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
4123cdf0e10cSrcweir if (xUT.is())
4124cdf0e10cSrcweir pRet = reinterpret_cast<ScCellRangesBase*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
4125cdf0e10cSrcweir return pRet;
4126cdf0e10cSrcweir }
4127cdf0e10cSrcweir
4128cdf0e10cSrcweir //------------------------------------------------------------------------
4129cdf0e10cSrcweir
ScCellRangesObj(ScDocShell * pDocSh,const ScRangeList & rR)4130cdf0e10cSrcweir ScCellRangesObj::ScCellRangesObj(ScDocShell* pDocSh, const ScRangeList& rR) :
4131cdf0e10cSrcweir ScCellRangesBase( pDocSh, rR )
4132cdf0e10cSrcweir {
4133cdf0e10cSrcweir }
4134cdf0e10cSrcweir
~ScCellRangesObj()4135cdf0e10cSrcweir ScCellRangesObj::~ScCellRangesObj()
4136cdf0e10cSrcweir {
4137cdf0e10cSrcweir }
4138cdf0e10cSrcweir
RefChanged()4139cdf0e10cSrcweir void ScCellRangesObj::RefChanged()
4140cdf0e10cSrcweir {
4141cdf0e10cSrcweir ScCellRangesBase::RefChanged();
4142cdf0e10cSrcweir
4143cdf0e10cSrcweir // nix weiter...
4144cdf0e10cSrcweir }
4145cdf0e10cSrcweir
queryInterface(const uno::Type & rType)4146cdf0e10cSrcweir uno::Any SAL_CALL ScCellRangesObj::queryInterface( const uno::Type& rType )
4147cdf0e10cSrcweir throw(uno::RuntimeException)
4148cdf0e10cSrcweir {
4149cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XSheetCellRangeContainer )
4150cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XSheetCellRanges )
4151cdf0e10cSrcweir SC_QUERYINTERFACE( container::XIndexAccess )
4152cdf0e10cSrcweir SC_QUERY_MULTIPLE( container::XElementAccess, container::XIndexAccess )
4153cdf0e10cSrcweir SC_QUERYINTERFACE( container::XEnumerationAccess )
4154cdf0e10cSrcweir SC_QUERYINTERFACE( container::XNameContainer )
4155cdf0e10cSrcweir SC_QUERYINTERFACE( container::XNameReplace )
4156cdf0e10cSrcweir SC_QUERYINTERFACE( container::XNameAccess )
4157cdf0e10cSrcweir
4158cdf0e10cSrcweir return ScCellRangesBase::queryInterface( rType );
4159cdf0e10cSrcweir }
4160cdf0e10cSrcweir
acquire()4161cdf0e10cSrcweir void SAL_CALL ScCellRangesObj::acquire() throw()
4162cdf0e10cSrcweir {
4163cdf0e10cSrcweir ScCellRangesBase::acquire();
4164cdf0e10cSrcweir }
4165cdf0e10cSrcweir
release()4166cdf0e10cSrcweir void SAL_CALL ScCellRangesObj::release() throw()
4167cdf0e10cSrcweir {
4168cdf0e10cSrcweir ScCellRangesBase::release();
4169cdf0e10cSrcweir }
4170cdf0e10cSrcweir
getTypes()4171cdf0e10cSrcweir uno::Sequence<uno::Type> SAL_CALL ScCellRangesObj::getTypes() throw(uno::RuntimeException)
4172cdf0e10cSrcweir {
4173cdf0e10cSrcweir static uno::Sequence<uno::Type> aTypes;
4174cdf0e10cSrcweir if ( aTypes.getLength() == 0 )
4175cdf0e10cSrcweir {
4176cdf0e10cSrcweir uno::Sequence<uno::Type> aParentTypes(ScCellRangesBase::getTypes());
4177cdf0e10cSrcweir long nParentLen = aParentTypes.getLength();
4178cdf0e10cSrcweir const uno::Type* pParentPtr = aParentTypes.getConstArray();
4179cdf0e10cSrcweir
4180cdf0e10cSrcweir aTypes.realloc( nParentLen + 3 );
4181cdf0e10cSrcweir uno::Type* pPtr = aTypes.getArray();
4182cdf0e10cSrcweir pPtr[nParentLen + 0] = getCppuType((const uno::Reference<sheet::XSheetCellRangeContainer>*)0);
4183cdf0e10cSrcweir pPtr[nParentLen + 1] = getCppuType((const uno::Reference<container::XNameContainer>*)0);
4184cdf0e10cSrcweir pPtr[nParentLen + 2] = getCppuType((const uno::Reference<container::XEnumerationAccess>*)0);
4185cdf0e10cSrcweir
4186cdf0e10cSrcweir for (long i=0; i<nParentLen; i++)
4187cdf0e10cSrcweir pPtr[i] = pParentPtr[i]; // parent types first
4188cdf0e10cSrcweir }
4189cdf0e10cSrcweir return aTypes;
4190cdf0e10cSrcweir }
4191cdf0e10cSrcweir
getImplementationId()4192cdf0e10cSrcweir uno::Sequence<sal_Int8> SAL_CALL ScCellRangesObj::getImplementationId()
4193cdf0e10cSrcweir throw(uno::RuntimeException)
4194cdf0e10cSrcweir {
4195cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aId;
4196cdf0e10cSrcweir if( aId.getLength() == 0 )
4197cdf0e10cSrcweir {
4198cdf0e10cSrcweir aId.realloc( 16 );
4199cdf0e10cSrcweir rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
4200cdf0e10cSrcweir }
4201cdf0e10cSrcweir return aId;
4202cdf0e10cSrcweir }
4203cdf0e10cSrcweir
4204cdf0e10cSrcweir // XCellRanges
4205cdf0e10cSrcweir
GetObjectByIndex_Impl(sal_Int32 nIndex) const4206cdf0e10cSrcweir ScCellRangeObj* ScCellRangesObj::GetObjectByIndex_Impl(sal_Int32 nIndex) const
4207cdf0e10cSrcweir {
4208cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
4209cdf0e10cSrcweir const ScRangeList& rRanges = GetRangeList();
4210cdf0e10cSrcweir if ( pDocSh && nIndex >= 0 && nIndex < sal::static_int_cast<sal_Int32>(rRanges.Count()) )
4211cdf0e10cSrcweir {
4212cdf0e10cSrcweir ScRange aRange(*rRanges.GetObject(nIndex));
4213cdf0e10cSrcweir if ( aRange.aStart == aRange.aEnd )
4214cdf0e10cSrcweir return new ScCellObj( pDocSh, aRange.aStart );
4215cdf0e10cSrcweir else
4216cdf0e10cSrcweir return new ScCellRangeObj( pDocSh, aRange );
4217cdf0e10cSrcweir }
4218cdf0e10cSrcweir
4219cdf0e10cSrcweir return NULL; // keine DocShell oder falscher Index
4220cdf0e10cSrcweir }
4221cdf0e10cSrcweir
getRangeAddresses()4222cdf0e10cSrcweir uno::Sequence<table::CellRangeAddress> SAL_CALL ScCellRangesObj::getRangeAddresses()
4223cdf0e10cSrcweir throw(uno::RuntimeException)
4224cdf0e10cSrcweir {
4225cdf0e10cSrcweir ScUnoGuard aGuard;
4226cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
4227cdf0e10cSrcweir const ScRangeList& rRanges = GetRangeList();
4228cdf0e10cSrcweir sal_uLong nCount = rRanges.Count();
4229cdf0e10cSrcweir if ( pDocSh && nCount )
4230cdf0e10cSrcweir {
4231cdf0e10cSrcweir table::CellRangeAddress aRangeAddress;
4232cdf0e10cSrcweir uno::Sequence<table::CellRangeAddress> aSeq(nCount);
4233cdf0e10cSrcweir table::CellRangeAddress* pAry = aSeq.getArray();
4234cdf0e10cSrcweir for (sal_uInt32 i=0; i<nCount; i++)
4235cdf0e10cSrcweir {
4236cdf0e10cSrcweir ScUnoConversion::FillApiRange( aRangeAddress, *rRanges.GetObject(i) );
4237cdf0e10cSrcweir pAry[i] = aRangeAddress;
4238cdf0e10cSrcweir }
4239cdf0e10cSrcweir return aSeq;
4240cdf0e10cSrcweir }
4241cdf0e10cSrcweir
4242cdf0e10cSrcweir return uno::Sequence<table::CellRangeAddress>(0); // leer ist moeglich
4243cdf0e10cSrcweir }
4244cdf0e10cSrcweir
getCells()4245cdf0e10cSrcweir uno::Reference<container::XEnumerationAccess> SAL_CALL ScCellRangesObj::getCells()
4246cdf0e10cSrcweir throw(uno::RuntimeException)
4247cdf0e10cSrcweir {
4248cdf0e10cSrcweir ScUnoGuard aGuard;
4249cdf0e10cSrcweir
4250cdf0e10cSrcweir // getCells with empty range list is possible (no exception),
4251cdf0e10cSrcweir // the resulting enumeration just has no elements
4252cdf0e10cSrcweir // (same behaviour as a valid range with no cells)
4253cdf0e10cSrcweir // This is handled in ScCellsEnumeration ctor.
4254cdf0e10cSrcweir
4255cdf0e10cSrcweir const ScRangeList& rRanges = GetRangeList();
4256cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
4257cdf0e10cSrcweir if (pDocSh)
4258cdf0e10cSrcweir return new ScCellsObj( pDocSh, rRanges );
4259cdf0e10cSrcweir return NULL;
4260cdf0e10cSrcweir }
4261cdf0e10cSrcweir
getRangeAddressesAsString()4262cdf0e10cSrcweir rtl::OUString SAL_CALL ScCellRangesObj::getRangeAddressesAsString()
4263cdf0e10cSrcweir throw(uno::RuntimeException)
4264cdf0e10cSrcweir {
4265cdf0e10cSrcweir ScUnoGuard aGuard;
4266cdf0e10cSrcweir String aString;
4267cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
4268cdf0e10cSrcweir const ScRangeList& rRanges = GetRangeList();
4269cdf0e10cSrcweir if (pDocSh)
4270cdf0e10cSrcweir rRanges.Format( aString, SCA_VALID | SCA_TAB_3D, pDocSh->GetDocument() );
4271cdf0e10cSrcweir return aString;
4272cdf0e10cSrcweir }
4273cdf0e10cSrcweir
4274cdf0e10cSrcweir // XSheetCellRangeContainer
4275cdf0e10cSrcweir
addRangeAddress(const table::CellRangeAddress & rRange,sal_Bool bMergeRanges)4276cdf0e10cSrcweir void SAL_CALL ScCellRangesObj::addRangeAddress( const table::CellRangeAddress& rRange,
4277cdf0e10cSrcweir sal_Bool bMergeRanges )
4278cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException)
4279cdf0e10cSrcweir {
4280cdf0e10cSrcweir ScUnoGuard aGuard;
4281cdf0e10cSrcweir ScRange aRange(static_cast<SCCOL>(rRange.StartColumn),
4282cdf0e10cSrcweir static_cast<SCROW>(rRange.StartRow),
4283cdf0e10cSrcweir static_cast<SCTAB>(rRange.Sheet),
4284cdf0e10cSrcweir static_cast<SCCOL>(rRange.EndColumn),
4285cdf0e10cSrcweir static_cast<SCROW>(rRange.EndRow),
4286cdf0e10cSrcweir static_cast<SCTAB>(rRange.Sheet));
4287cdf0e10cSrcweir AddRange(aRange, bMergeRanges);
4288cdf0e10cSrcweir }
4289cdf0e10cSrcweir
lcl_RemoveNamedEntry(ScNamedEntryArr_Impl & rNamedEntries,const ScRange & rRange)4290cdf0e10cSrcweir void lcl_RemoveNamedEntry( ScNamedEntryArr_Impl& rNamedEntries, const ScRange& rRange )
4291cdf0e10cSrcweir {
4292cdf0e10cSrcweir sal_uInt16 nCount = rNamedEntries.Count();
4293cdf0e10cSrcweir for ( sal_uInt16 n=nCount; n--; )
4294cdf0e10cSrcweir if ( rNamedEntries[n]->GetRange() == rRange )
4295cdf0e10cSrcweir rNamedEntries.DeleteAndDestroy( n );
4296cdf0e10cSrcweir }
4297cdf0e10cSrcweir
removeRangeAddress(const table::CellRangeAddress & rRange)4298cdf0e10cSrcweir void SAL_CALL ScCellRangesObj::removeRangeAddress( const table::CellRangeAddress& rRange )
4299cdf0e10cSrcweir throw(::com::sun::star::container::NoSuchElementException,
4300cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException)
4301cdf0e10cSrcweir {
4302cdf0e10cSrcweir ScUnoGuard aGuard;
4303cdf0e10cSrcweir const ScRangeList& rRanges = GetRangeList();
4304cdf0e10cSrcweir
4305cdf0e10cSrcweir ScRangeList aSheetRanges;
4306cdf0e10cSrcweir ScRangeList aNotSheetRanges;
4307cdf0e10cSrcweir for (sal_uInt32 i = 0; i < rRanges.Count(); ++i)
4308cdf0e10cSrcweir {
4309cdf0e10cSrcweir if (rRanges.GetObject(i)->aStart.Tab() == rRange.Sheet)
4310cdf0e10cSrcweir {
4311cdf0e10cSrcweir aSheetRanges.Append(*rRanges.GetObject(i));
4312cdf0e10cSrcweir }
4313cdf0e10cSrcweir else
4314cdf0e10cSrcweir {
4315cdf0e10cSrcweir aNotSheetRanges.Append(*rRanges.GetObject(i));
4316cdf0e10cSrcweir }
4317cdf0e10cSrcweir }
4318cdf0e10cSrcweir ScMarkData aMarkData;
4319cdf0e10cSrcweir aMarkData.MarkFromRangeList( aSheetRanges, sal_False );
4320cdf0e10cSrcweir ScRange aRange(static_cast<SCCOL>(rRange.StartColumn),
4321cdf0e10cSrcweir static_cast<SCROW>(rRange.StartRow),
4322cdf0e10cSrcweir static_cast<SCTAB>(rRange.Sheet),
4323cdf0e10cSrcweir static_cast<SCCOL>(rRange.EndColumn),
4324cdf0e10cSrcweir static_cast<SCROW>(rRange.EndRow),
4325cdf0e10cSrcweir static_cast<SCTAB>(rRange.Sheet));
4326cdf0e10cSrcweir if (aMarkData.GetTableSelect( aRange.aStart.Tab() ))
4327cdf0e10cSrcweir {
4328cdf0e10cSrcweir aMarkData.MarkToMulti();
4329cdf0e10cSrcweir if (aMarkData.IsAllMarked( aRange ) )
4330cdf0e10cSrcweir {
4331cdf0e10cSrcweir aMarkData.SetMultiMarkArea( aRange, sal_False );
4332cdf0e10cSrcweir lcl_RemoveNamedEntry(aNamedEntries, aRange);
4333cdf0e10cSrcweir }
4334cdf0e10cSrcweir else
4335cdf0e10cSrcweir throw container::NoSuchElementException();
4336cdf0e10cSrcweir }
4337cdf0e10cSrcweir SetNewRanges(aNotSheetRanges);
4338cdf0e10cSrcweir ScRangeList aNew;
4339cdf0e10cSrcweir aMarkData.FillRangeListWithMarks( &aNew, sal_False );
4340cdf0e10cSrcweir for (sal_uInt32 j = 0; j < aNew.Count(); ++j)
4341cdf0e10cSrcweir {
4342cdf0e10cSrcweir AddRange(*aNew.GetObject(j), sal_False);
4343cdf0e10cSrcweir }
4344cdf0e10cSrcweir }
4345cdf0e10cSrcweir
addRangeAddresses(const uno::Sequence<table::CellRangeAddress> & rRanges,sal_Bool bMergeRanges)4346cdf0e10cSrcweir void SAL_CALL ScCellRangesObj::addRangeAddresses( const uno::Sequence<table::CellRangeAddress >& rRanges,
4347cdf0e10cSrcweir sal_Bool bMergeRanges )
4348cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException)
4349cdf0e10cSrcweir {
4350cdf0e10cSrcweir ScUnoGuard aGuard;
4351cdf0e10cSrcweir sal_Int32 nCount(rRanges.getLength());
4352cdf0e10cSrcweir if (nCount)
4353cdf0e10cSrcweir {
4354cdf0e10cSrcweir const table::CellRangeAddress* pRanges = rRanges.getConstArray();
4355cdf0e10cSrcweir for (sal_Int32 i = 0; i < rRanges.getLength(); i++, pRanges++)
4356cdf0e10cSrcweir {
4357cdf0e10cSrcweir ScRange aRange(static_cast<SCCOL>(pRanges->StartColumn),
4358cdf0e10cSrcweir static_cast<SCROW>(pRanges->StartRow),
4359cdf0e10cSrcweir static_cast<SCTAB>(pRanges->Sheet),
4360cdf0e10cSrcweir static_cast<SCCOL>(pRanges->EndColumn),
4361cdf0e10cSrcweir static_cast<SCROW>(pRanges->EndRow),
4362cdf0e10cSrcweir static_cast<SCTAB>(pRanges->Sheet));
4363cdf0e10cSrcweir AddRange(aRange, bMergeRanges);
4364cdf0e10cSrcweir }
4365cdf0e10cSrcweir }
4366cdf0e10cSrcweir }
4367cdf0e10cSrcweir
removeRangeAddresses(const uno::Sequence<table::CellRangeAddress> & rRangeSeq)4368cdf0e10cSrcweir void SAL_CALL ScCellRangesObj::removeRangeAddresses( const uno::Sequence<table::CellRangeAddress >& rRangeSeq )
4369cdf0e10cSrcweir throw(::com::sun::star::container::NoSuchElementException,
4370cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException)
4371cdf0e10cSrcweir {
4372cdf0e10cSrcweir // with this implementation not needed
4373cdf0e10cSrcweir // ScUnoGuard aGuard;
4374cdf0e10cSrcweir
4375cdf0e10cSrcweir
4376cdf0e10cSrcweir // use sometimes a better/faster implementation
4377cdf0e10cSrcweir sal_uInt32 nCount(rRangeSeq.getLength());
4378cdf0e10cSrcweir if (nCount)
4379cdf0e10cSrcweir {
4380cdf0e10cSrcweir const table::CellRangeAddress* pRanges = rRangeSeq.getConstArray();
4381cdf0e10cSrcweir for (sal_uInt32 i=0; i < nCount; ++i, ++pRanges)
4382cdf0e10cSrcweir {
4383cdf0e10cSrcweir removeRangeAddress(*pRanges);
4384cdf0e10cSrcweir }
4385cdf0e10cSrcweir }
4386cdf0e10cSrcweir }
4387cdf0e10cSrcweir
4388cdf0e10cSrcweir // XNameContainer
4389cdf0e10cSrcweir
lcl_RemoveNamedEntry(ScNamedEntryArr_Impl & rNamedEntries,const String & rName)4390cdf0e10cSrcweir void lcl_RemoveNamedEntry( ScNamedEntryArr_Impl& rNamedEntries, const String& rName )
4391cdf0e10cSrcweir {
4392cdf0e10cSrcweir sal_uInt16 nCount = rNamedEntries.Count();
4393cdf0e10cSrcweir for ( sal_uInt16 n=nCount; n--; )
4394cdf0e10cSrcweir if ( rNamedEntries[n]->GetName() == rName )
4395cdf0e10cSrcweir rNamedEntries.DeleteAndDestroy( n );
4396cdf0e10cSrcweir }
4397cdf0e10cSrcweir
insertByName(const rtl::OUString & aName,const uno::Any & aElement)4398cdf0e10cSrcweir void SAL_CALL ScCellRangesObj::insertByName( const rtl::OUString& aName, const uno::Any& aElement )
4399cdf0e10cSrcweir throw(lang::IllegalArgumentException, container::ElementExistException,
4400cdf0e10cSrcweir lang::WrappedTargetException, uno::RuntimeException)
4401cdf0e10cSrcweir {
4402cdf0e10cSrcweir ScUnoGuard aGuard;
4403cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
4404cdf0e10cSrcweir sal_Bool bDone = sal_False;
4405cdf0e10cSrcweir
4406cdf0e10cSrcweir //! Type of aElement can be some specific interface instead of XInterface
4407cdf0e10cSrcweir
4408cdf0e10cSrcweir uno::Reference<uno::XInterface> xInterface(aElement, uno::UNO_QUERY);
4409cdf0e10cSrcweir if ( pDocSh && xInterface.is() )
4410cdf0e10cSrcweir {
4411cdf0e10cSrcweir ScCellRangesBase* pRangesImp = ScCellRangesBase::getImplementation( xInterface );
4412cdf0e10cSrcweir if ( pRangesImp && pRangesImp->GetDocShell() == pDocSh )
4413cdf0e10cSrcweir {
4414cdf0e10cSrcweir // if explicit name is given and already existing, throw exception
4415cdf0e10cSrcweir
4416cdf0e10cSrcweir String aNamStr(aName);
4417cdf0e10cSrcweir if ( aNamStr.Len() )
4418cdf0e10cSrcweir {
4419cdf0e10cSrcweir sal_uInt16 nNamedCount = aNamedEntries.Count();
4420cdf0e10cSrcweir for (sal_uInt16 n=0; n<nNamedCount; n++)
4421cdf0e10cSrcweir if ( aNamedEntries[n]->GetName() == aNamStr )
4422cdf0e10cSrcweir throw container::ElementExistException();
4423cdf0e10cSrcweir }
4424cdf0e10cSrcweir
4425cdf0e10cSrcweir ScRangeList aNew(GetRangeList());
4426cdf0e10cSrcweir const ScRangeList& rAddRanges = pRangesImp->GetRangeList();
4427cdf0e10cSrcweir sal_uLong nAddCount = rAddRanges.Count();
4428cdf0e10cSrcweir for (sal_uLong i=0; i<nAddCount; i++)
4429cdf0e10cSrcweir aNew.Join( *rAddRanges.GetObject(i) );
4430cdf0e10cSrcweir SetNewRanges(aNew);
4431cdf0e10cSrcweir bDone = sal_True;
4432cdf0e10cSrcweir
4433cdf0e10cSrcweir if ( aName.getLength() && nAddCount == 1 )
4434cdf0e10cSrcweir {
4435cdf0e10cSrcweir // if a name is given, also insert into list of named entries
4436cdf0e10cSrcweir // (only possible for a single range)
4437cdf0e10cSrcweir // name is not in aNamedEntries (tested above)
4438cdf0e10cSrcweir
4439cdf0e10cSrcweir ScNamedEntry* pEntry = new ScNamedEntry( aNamStr, *rAddRanges.GetObject(0) );
4440cdf0e10cSrcweir aNamedEntries.Insert( pEntry, aNamedEntries.Count() );
4441cdf0e10cSrcweir }
4442cdf0e10cSrcweir }
4443cdf0e10cSrcweir }
4444cdf0e10cSrcweir
4445cdf0e10cSrcweir if (!bDone)
4446cdf0e10cSrcweir {
4447cdf0e10cSrcweir // invalid element - double names are handled above
4448cdf0e10cSrcweir throw lang::IllegalArgumentException();
4449cdf0e10cSrcweir }
4450cdf0e10cSrcweir }
4451cdf0e10cSrcweir
lcl_FindRangeByName(const ScRangeList & rRanges,ScDocShell * pDocSh,const String & rName,sal_uLong & rIndex)4452cdf0e10cSrcweir sal_Bool lcl_FindRangeByName( const ScRangeList& rRanges, ScDocShell* pDocSh,
4453cdf0e10cSrcweir const String& rName, sal_uLong& rIndex )
4454cdf0e10cSrcweir {
4455cdf0e10cSrcweir if (pDocSh)
4456cdf0e10cSrcweir {
4457cdf0e10cSrcweir String aRangeStr;
4458cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
4459cdf0e10cSrcweir sal_uLong nCount = rRanges.Count();
4460cdf0e10cSrcweir for (sal_uLong i=0; i<nCount; i++)
4461cdf0e10cSrcweir {
4462cdf0e10cSrcweir rRanges.GetObject(i)->Format( aRangeStr, SCA_VALID | SCA_TAB_3D, pDoc );
4463cdf0e10cSrcweir if ( aRangeStr == rName )
4464cdf0e10cSrcweir {
4465cdf0e10cSrcweir rIndex = i;
4466cdf0e10cSrcweir return sal_True;
4467cdf0e10cSrcweir }
4468cdf0e10cSrcweir }
4469cdf0e10cSrcweir }
4470cdf0e10cSrcweir return sal_False; // nicht gefunden
4471cdf0e10cSrcweir }
4472cdf0e10cSrcweir
lcl_FindRangeOrEntry(const ScNamedEntryArr_Impl & rNamedEntries,const ScRangeList & rRanges,ScDocShell * pDocSh,const String & rName,ScRange & rFound)4473cdf0e10cSrcweir sal_Bool lcl_FindRangeOrEntry( const ScNamedEntryArr_Impl& rNamedEntries,
4474cdf0e10cSrcweir const ScRangeList& rRanges, ScDocShell* pDocSh,
4475cdf0e10cSrcweir const String& rName, ScRange& rFound )
4476cdf0e10cSrcweir {
4477cdf0e10cSrcweir // exact range in list?
4478cdf0e10cSrcweir
4479cdf0e10cSrcweir sal_uLong nIndex = 0;
4480cdf0e10cSrcweir if ( lcl_FindRangeByName( rRanges, pDocSh, rName, nIndex ) )
4481cdf0e10cSrcweir {
4482cdf0e10cSrcweir rFound = *rRanges.GetObject(nIndex);
4483cdf0e10cSrcweir return sal_True;
4484cdf0e10cSrcweir }
4485cdf0e10cSrcweir
4486cdf0e10cSrcweir // range contained in selection? (sheet must be specified)
4487cdf0e10cSrcweir
4488cdf0e10cSrcweir ScRange aCellRange;
4489cdf0e10cSrcweir sal_uInt16 nParse = aCellRange.ParseAny( rName, pDocSh->GetDocument() );
4490cdf0e10cSrcweir if ( ( nParse & ( SCA_VALID | SCA_TAB_3D ) ) == ( SCA_VALID | SCA_TAB_3D ) )
4491cdf0e10cSrcweir {
4492cdf0e10cSrcweir ScMarkData aMarkData;
4493cdf0e10cSrcweir aMarkData.MarkFromRangeList( rRanges, sal_False );
4494cdf0e10cSrcweir aMarkData.MarkToMulti(); // needed for IsAllMarked
4495cdf0e10cSrcweir if ( aMarkData.IsAllMarked( aCellRange ) )
4496cdf0e10cSrcweir {
4497cdf0e10cSrcweir rFound = aCellRange;
4498cdf0e10cSrcweir return sal_True;
4499cdf0e10cSrcweir }
4500cdf0e10cSrcweir }
4501cdf0e10cSrcweir
4502cdf0e10cSrcweir // named entry in this object?
4503cdf0e10cSrcweir
4504cdf0e10cSrcweir if ( rNamedEntries.Count() )
4505cdf0e10cSrcweir {
4506cdf0e10cSrcweir for ( sal_uInt16 n=0; n<rNamedEntries.Count(); n++ )
4507cdf0e10cSrcweir if ( rNamedEntries[n]->GetName() == rName )
4508cdf0e10cSrcweir {
4509cdf0e10cSrcweir // test if named entry is contained in rRanges
4510cdf0e10cSrcweir
4511cdf0e10cSrcweir const ScRange& rComp = rNamedEntries[n]->GetRange();
4512cdf0e10cSrcweir ScMarkData aMarkData;
4513cdf0e10cSrcweir aMarkData.MarkFromRangeList( rRanges, sal_False );
4514cdf0e10cSrcweir aMarkData.MarkToMulti(); // needed for IsAllMarked
4515cdf0e10cSrcweir if ( aMarkData.IsAllMarked( rComp ) )
4516cdf0e10cSrcweir {
4517cdf0e10cSrcweir rFound = rComp;
4518cdf0e10cSrcweir return sal_True;
4519cdf0e10cSrcweir }
4520cdf0e10cSrcweir }
4521cdf0e10cSrcweir }
4522cdf0e10cSrcweir
4523cdf0e10cSrcweir return sal_False; // not found
4524cdf0e10cSrcweir }
4525cdf0e10cSrcweir
removeByName(const rtl::OUString & aName)4526cdf0e10cSrcweir void SAL_CALL ScCellRangesObj::removeByName( const rtl::OUString& aName )
4527cdf0e10cSrcweir throw(container::NoSuchElementException,
4528cdf0e10cSrcweir lang::WrappedTargetException, uno::RuntimeException)
4529cdf0e10cSrcweir {
4530cdf0e10cSrcweir ScUnoGuard aGuard;
4531cdf0e10cSrcweir sal_Bool bDone = sal_False;
4532cdf0e10cSrcweir String aNameStr(aName);
4533cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
4534cdf0e10cSrcweir const ScRangeList& rRanges = GetRangeList();
4535cdf0e10cSrcweir sal_uLong nIndex = 0;
4536cdf0e10cSrcweir if ( lcl_FindRangeByName( rRanges, pDocSh, aNameStr, nIndex ) )
4537cdf0e10cSrcweir {
4538cdf0e10cSrcweir // einzelnen Range weglassen
4539cdf0e10cSrcweir ScRangeList aNew;
4540cdf0e10cSrcweir sal_uLong nCount = rRanges.Count();
4541cdf0e10cSrcweir for (sal_uLong i=0; i<nCount; i++)
4542cdf0e10cSrcweir if (i != nIndex)
4543cdf0e10cSrcweir aNew.Append( *rRanges.GetObject(i) );
4544cdf0e10cSrcweir SetNewRanges(aNew);
4545cdf0e10cSrcweir bDone = sal_True;
4546cdf0e10cSrcweir }
4547cdf0e10cSrcweir else if (pDocSh)
4548cdf0e10cSrcweir {
4549cdf0e10cSrcweir // deselect any ranges (parsed or named entry)
4550cdf0e10cSrcweir ScRangeList aDiff;
4551cdf0e10cSrcweir sal_Bool bValid = ( aDiff.Parse( aNameStr, pDocSh->GetDocument() ) & SCA_VALID ) != 0;
4552cdf0e10cSrcweir if ( !bValid && aNamedEntries.Count() )
4553cdf0e10cSrcweir {
4554cdf0e10cSrcweir sal_uInt16 nCount = aNamedEntries.Count();
4555cdf0e10cSrcweir for (sal_uInt16 n=0; n<nCount && !bValid; n++)
4556cdf0e10cSrcweir if (aNamedEntries[n]->GetName() == aNameStr)
4557cdf0e10cSrcweir {
4558cdf0e10cSrcweir aDiff.RemoveAll();
4559cdf0e10cSrcweir aDiff.Append( aNamedEntries[n]->GetRange() );
4560cdf0e10cSrcweir bValid = sal_True;
4561cdf0e10cSrcweir }
4562cdf0e10cSrcweir }
4563cdf0e10cSrcweir if ( bValid )
4564cdf0e10cSrcweir {
4565cdf0e10cSrcweir ScMarkData aMarkData;
4566cdf0e10cSrcweir aMarkData.MarkFromRangeList( rRanges, sal_False );
4567cdf0e10cSrcweir
4568cdf0e10cSrcweir sal_uLong nDiffCount = aDiff.Count();
4569cdf0e10cSrcweir for (sal_uLong i=0; i<nDiffCount; i++)
4570cdf0e10cSrcweir {
4571cdf0e10cSrcweir ScRange* pDiffRange = aDiff.GetObject(i);
4572cdf0e10cSrcweir if (aMarkData.GetTableSelect( pDiffRange->aStart.Tab() ))
4573cdf0e10cSrcweir aMarkData.SetMultiMarkArea( *pDiffRange, sal_False );
4574cdf0e10cSrcweir }
4575cdf0e10cSrcweir
4576cdf0e10cSrcweir ScRangeList aNew;
4577cdf0e10cSrcweir aMarkData.FillRangeListWithMarks( &aNew, sal_False );
4578cdf0e10cSrcweir SetNewRanges(aNew);
4579cdf0e10cSrcweir
4580cdf0e10cSrcweir bDone = sal_True; //! error if range was not selected before?
4581cdf0e10cSrcweir }
4582cdf0e10cSrcweir }
4583cdf0e10cSrcweir
4584cdf0e10cSrcweir if (aNamedEntries.Count())
4585cdf0e10cSrcweir lcl_RemoveNamedEntry( aNamedEntries, aNameStr ); // remove named entry
4586cdf0e10cSrcweir
4587cdf0e10cSrcweir if (!bDone)
4588cdf0e10cSrcweir throw container::NoSuchElementException(); // not found
4589cdf0e10cSrcweir }
4590cdf0e10cSrcweir
4591cdf0e10cSrcweir // XNameReplace
4592cdf0e10cSrcweir
replaceByName(const rtl::OUString & aName,const uno::Any & aElement)4593cdf0e10cSrcweir void SAL_CALL ScCellRangesObj::replaceByName( const rtl::OUString& aName, const uno::Any& aElement )
4594cdf0e10cSrcweir throw(lang::IllegalArgumentException, container::NoSuchElementException,
4595cdf0e10cSrcweir lang::WrappedTargetException, uno::RuntimeException)
4596cdf0e10cSrcweir {
4597cdf0e10cSrcweir ScUnoGuard aGuard;
4598cdf0e10cSrcweir //! zusammenfassen?
4599cdf0e10cSrcweir removeByName( aName );
4600cdf0e10cSrcweir insertByName( aName, aElement );
4601cdf0e10cSrcweir }
4602cdf0e10cSrcweir
4603cdf0e10cSrcweir // XNameAccess
4604cdf0e10cSrcweir
getByName(const rtl::OUString & aName)4605cdf0e10cSrcweir uno::Any SAL_CALL ScCellRangesObj::getByName( const rtl::OUString& aName )
4606cdf0e10cSrcweir throw(container::NoSuchElementException,
4607cdf0e10cSrcweir lang::WrappedTargetException, uno::RuntimeException)
4608cdf0e10cSrcweir {
4609cdf0e10cSrcweir ScUnoGuard aGuard;
4610cdf0e10cSrcweir uno::Any aRet;
4611cdf0e10cSrcweir
4612cdf0e10cSrcweir String aNameStr(aName);
4613cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
4614cdf0e10cSrcweir const ScRangeList& rRanges = GetRangeList();
4615cdf0e10cSrcweir ScRange aRange;
4616cdf0e10cSrcweir if ( lcl_FindRangeOrEntry( aNamedEntries, rRanges, pDocSh, aNameStr, aRange ) )
4617cdf0e10cSrcweir {
4618cdf0e10cSrcweir uno::Reference<table::XCellRange> xRange;
4619cdf0e10cSrcweir if ( aRange.aStart == aRange.aEnd )
4620cdf0e10cSrcweir xRange.set(new ScCellObj( pDocSh, aRange.aStart ));
4621cdf0e10cSrcweir else
4622cdf0e10cSrcweir xRange.set(new ScCellRangeObj( pDocSh, aRange ));
4623cdf0e10cSrcweir aRet <<= xRange;
4624cdf0e10cSrcweir }
4625cdf0e10cSrcweir else
4626cdf0e10cSrcweir throw container::NoSuchElementException();
4627cdf0e10cSrcweir return aRet;
4628cdf0e10cSrcweir }
4629cdf0e10cSrcweir
lcl_FindEntryName(const ScNamedEntryArr_Impl & rNamedEntries,const ScRange & rRange,String & rName)4630cdf0e10cSrcweir sal_Bool lcl_FindEntryName( const ScNamedEntryArr_Impl& rNamedEntries,
4631cdf0e10cSrcweir const ScRange& rRange, String& rName )
4632cdf0e10cSrcweir {
4633cdf0e10cSrcweir sal_uInt16 nCount = rNamedEntries.Count();
4634cdf0e10cSrcweir for (sal_uInt16 i=0; i<nCount; i++)
4635cdf0e10cSrcweir if (rNamedEntries[i]->GetRange() == rRange)
4636cdf0e10cSrcweir {
4637cdf0e10cSrcweir rName = rNamedEntries[i]->GetName();
4638cdf0e10cSrcweir return sal_True;
4639cdf0e10cSrcweir }
4640cdf0e10cSrcweir return sal_False;
4641cdf0e10cSrcweir }
4642cdf0e10cSrcweir
getElementNames()4643cdf0e10cSrcweir uno::Sequence<rtl::OUString> SAL_CALL ScCellRangesObj::getElementNames()
4644cdf0e10cSrcweir throw(uno::RuntimeException)
4645cdf0e10cSrcweir {
4646cdf0e10cSrcweir ScUnoGuard aGuard;
4647cdf0e10cSrcweir
4648cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
4649cdf0e10cSrcweir const ScRangeList& rRanges = GetRangeList();
4650cdf0e10cSrcweir if (pDocSh)
4651cdf0e10cSrcweir {
4652cdf0e10cSrcweir String aRangeStr;
4653cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
4654cdf0e10cSrcweir sal_uLong nCount = rRanges.Count();
4655cdf0e10cSrcweir
4656cdf0e10cSrcweir uno::Sequence<rtl::OUString> aSeq(nCount);
4657cdf0e10cSrcweir rtl::OUString* pAry = aSeq.getArray();
4658cdf0e10cSrcweir for (sal_uLong i=0; i<nCount; i++)
4659cdf0e10cSrcweir {
4660cdf0e10cSrcweir // use given name if for exactly this range, otherwise just format
4661cdf0e10cSrcweir ScRange aRange = *rRanges.GetObject(i);
4662cdf0e10cSrcweir if ( !aNamedEntries.Count() || !lcl_FindEntryName( aNamedEntries, aRange, aRangeStr ) )
4663cdf0e10cSrcweir aRange.Format( aRangeStr, SCA_VALID | SCA_TAB_3D, pDoc );
4664cdf0e10cSrcweir pAry[i] = aRangeStr;
4665cdf0e10cSrcweir }
4666cdf0e10cSrcweir return aSeq;
4667cdf0e10cSrcweir }
4668cdf0e10cSrcweir return uno::Sequence<rtl::OUString>(0);
4669cdf0e10cSrcweir }
4670cdf0e10cSrcweir
hasByName(const rtl::OUString & aName)4671cdf0e10cSrcweir sal_Bool SAL_CALL ScCellRangesObj::hasByName( const rtl::OUString& aName )
4672cdf0e10cSrcweir throw(uno::RuntimeException)
4673cdf0e10cSrcweir {
4674cdf0e10cSrcweir ScUnoGuard aGuard;
4675cdf0e10cSrcweir String aNameStr(aName);
4676cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
4677cdf0e10cSrcweir const ScRangeList& rRanges = GetRangeList();
4678cdf0e10cSrcweir ScRange aRange;
4679cdf0e10cSrcweir return lcl_FindRangeOrEntry( aNamedEntries, rRanges, pDocSh, aNameStr, aRange );
4680cdf0e10cSrcweir }
4681cdf0e10cSrcweir
4682cdf0e10cSrcweir // XEnumerationAccess
4683cdf0e10cSrcweir
createEnumeration()4684cdf0e10cSrcweir uno::Reference<container::XEnumeration> SAL_CALL ScCellRangesObj::createEnumeration()
4685cdf0e10cSrcweir throw(uno::RuntimeException)
4686cdf0e10cSrcweir {
4687cdf0e10cSrcweir ScUnoGuard aGuard;
4688cdf0e10cSrcweir return new ScIndexEnumeration(this, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SheetCellRangesEnumeration")));
4689cdf0e10cSrcweir }
4690cdf0e10cSrcweir
4691cdf0e10cSrcweir // XIndexAccess
4692cdf0e10cSrcweir
getCount()4693cdf0e10cSrcweir sal_Int32 SAL_CALL ScCellRangesObj::getCount() throw(uno::RuntimeException)
4694cdf0e10cSrcweir {
4695cdf0e10cSrcweir ScUnoGuard aGuard;
4696cdf0e10cSrcweir const ScRangeList& rRanges = GetRangeList();
4697cdf0e10cSrcweir return rRanges.Count();
4698cdf0e10cSrcweir }
4699cdf0e10cSrcweir
getByIndex(sal_Int32 nIndex)4700cdf0e10cSrcweir uno::Any SAL_CALL ScCellRangesObj::getByIndex( sal_Int32 nIndex )
4701cdf0e10cSrcweir throw(lang::IndexOutOfBoundsException,
4702cdf0e10cSrcweir lang::WrappedTargetException, uno::RuntimeException)
4703cdf0e10cSrcweir {
4704cdf0e10cSrcweir ScUnoGuard aGuard;
4705cdf0e10cSrcweir uno::Reference<table::XCellRange> xRange(GetObjectByIndex_Impl(nIndex));
4706cdf0e10cSrcweir if (xRange.is())
4707cdf0e10cSrcweir return uno::makeAny(xRange);
4708cdf0e10cSrcweir else
4709cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
4710cdf0e10cSrcweir // return uno::Any();
4711cdf0e10cSrcweir }
4712cdf0e10cSrcweir
getElementType()4713cdf0e10cSrcweir uno::Type SAL_CALL ScCellRangesObj::getElementType() throw(uno::RuntimeException)
4714cdf0e10cSrcweir {
4715cdf0e10cSrcweir ScUnoGuard aGuard;
4716cdf0e10cSrcweir return getCppuType((uno::Reference<table::XCellRange>*)0);
4717cdf0e10cSrcweir }
4718cdf0e10cSrcweir
hasElements()4719cdf0e10cSrcweir sal_Bool SAL_CALL ScCellRangesObj::hasElements() throw(uno::RuntimeException)
4720cdf0e10cSrcweir {
4721cdf0e10cSrcweir ScUnoGuard aGuard;
4722cdf0e10cSrcweir const ScRangeList& rRanges = GetRangeList();
4723cdf0e10cSrcweir return rRanges.Count() != 0;
4724cdf0e10cSrcweir }
4725cdf0e10cSrcweir
4726cdf0e10cSrcweir // XServiceInfo
4727cdf0e10cSrcweir
getImplementationName()4728cdf0e10cSrcweir rtl::OUString SAL_CALL ScCellRangesObj::getImplementationName() throw(uno::RuntimeException)
4729cdf0e10cSrcweir {
4730cdf0e10cSrcweir return rtl::OUString::createFromAscii( "ScCellRangesObj" );
4731cdf0e10cSrcweir }
4732cdf0e10cSrcweir
supportsService(const rtl::OUString & rServiceName)4733cdf0e10cSrcweir sal_Bool SAL_CALL ScCellRangesObj::supportsService( const rtl::OUString& rServiceName )
4734cdf0e10cSrcweir throw(uno::RuntimeException)
4735cdf0e10cSrcweir {
4736cdf0e10cSrcweir String aServiceStr(rServiceName);
4737cdf0e10cSrcweir return aServiceStr.EqualsAscii( SCSHEETCELLRANGES_SERVICE ) ||
4738cdf0e10cSrcweir aServiceStr.EqualsAscii( SCCELLPROPERTIES_SERVICE ) ||
4739cdf0e10cSrcweir aServiceStr.EqualsAscii( SCCHARPROPERTIES_SERVICE ) ||
4740cdf0e10cSrcweir aServiceStr.EqualsAscii( SCPARAPROPERTIES_SERVICE );
4741cdf0e10cSrcweir }
4742cdf0e10cSrcweir
getSupportedServiceNames()4743cdf0e10cSrcweir uno::Sequence<rtl::OUString> SAL_CALL ScCellRangesObj::getSupportedServiceNames()
4744cdf0e10cSrcweir throw(uno::RuntimeException)
4745cdf0e10cSrcweir {
4746cdf0e10cSrcweir uno::Sequence<rtl::OUString> aRet(4);
4747cdf0e10cSrcweir rtl::OUString* pArray = aRet.getArray();
4748cdf0e10cSrcweir pArray[0] = rtl::OUString::createFromAscii( SCSHEETCELLRANGES_SERVICE );
4749cdf0e10cSrcweir pArray[1] = rtl::OUString::createFromAscii( SCCELLPROPERTIES_SERVICE );
4750cdf0e10cSrcweir pArray[2] = rtl::OUString::createFromAscii( SCCHARPROPERTIES_SERVICE );
4751cdf0e10cSrcweir pArray[3] = rtl::OUString::createFromAscii( SCPARAPROPERTIES_SERVICE );
4752cdf0e10cSrcweir return aRet;
4753cdf0e10cSrcweir }
4754cdf0e10cSrcweir
4755cdf0e10cSrcweir //------------------------------------------------------------------------
4756cdf0e10cSrcweir
4757cdf0e10cSrcweir // static
CreateRangeFromDoc(ScDocument * pDoc,const ScRange & rR)4758cdf0e10cSrcweir uno::Reference<table::XCellRange> ScCellRangeObj::CreateRangeFromDoc( ScDocument* pDoc, const ScRange& rR )
4759cdf0e10cSrcweir {
4760cdf0e10cSrcweir SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
4761cdf0e10cSrcweir if ( pObjSh && pObjSh->ISA(ScDocShell) )
4762cdf0e10cSrcweir return new ScCellRangeObj( (ScDocShell*) pObjSh, rR );
4763cdf0e10cSrcweir return NULL;
4764cdf0e10cSrcweir }
4765cdf0e10cSrcweir
4766cdf0e10cSrcweir //------------------------------------------------------------------------
4767cdf0e10cSrcweir
ScCellRangeObj(ScDocShell * pDocSh,const ScRange & rR)4768cdf0e10cSrcweir ScCellRangeObj::ScCellRangeObj(ScDocShell* pDocSh, const ScRange& rR) :
4769cdf0e10cSrcweir ScCellRangesBase( pDocSh, rR ),
4770cdf0e10cSrcweir pRangePropSet( lcl_GetRangePropertySet() ),
4771cdf0e10cSrcweir aRange( rR )
4772cdf0e10cSrcweir {
4773cdf0e10cSrcweir aRange.Justify(); // Anfang / Ende richtig
4774cdf0e10cSrcweir }
4775cdf0e10cSrcweir
~ScCellRangeObj()4776cdf0e10cSrcweir ScCellRangeObj::~ScCellRangeObj()
4777cdf0e10cSrcweir {
4778cdf0e10cSrcweir }
4779cdf0e10cSrcweir
RefChanged()4780cdf0e10cSrcweir void ScCellRangeObj::RefChanged()
4781cdf0e10cSrcweir {
4782cdf0e10cSrcweir ScCellRangesBase::RefChanged();
4783cdf0e10cSrcweir
4784cdf0e10cSrcweir const ScRangeList& rRanges = GetRangeList();
4785cdf0e10cSrcweir DBG_ASSERT(rRanges.Count() == 1, "was fuer Ranges ?!?!");
4786cdf0e10cSrcweir const ScRange* pFirst = rRanges.GetObject(0);
4787cdf0e10cSrcweir if (pFirst)
4788cdf0e10cSrcweir {
4789cdf0e10cSrcweir aRange = *pFirst;
4790cdf0e10cSrcweir aRange.Justify();
4791cdf0e10cSrcweir }
4792cdf0e10cSrcweir }
4793cdf0e10cSrcweir
queryInterface(const uno::Type & rType)4794cdf0e10cSrcweir uno::Any SAL_CALL ScCellRangeObj::queryInterface( const uno::Type& rType )
4795cdf0e10cSrcweir throw(uno::RuntimeException)
4796cdf0e10cSrcweir {
4797cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XCellRangeAddressable )
4798cdf0e10cSrcweir SC_QUERYINTERFACE( table::XCellRange )
4799cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XSheetCellRange )
4800cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XArrayFormulaRange )
4801cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XArrayFormulaTokens )
4802cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XCellRangeData )
4803cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XCellRangeFormula )
4804cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XMultipleOperation )
4805cdf0e10cSrcweir SC_QUERYINTERFACE( util::XMergeable )
4806cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XCellSeries )
4807cdf0e10cSrcweir SC_QUERYINTERFACE( table::XAutoFormattable )
4808cdf0e10cSrcweir SC_QUERYINTERFACE( util::XSortable )
4809cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XSheetFilterableEx )
4810cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XSheetFilterable )
4811cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XSubTotalCalculatable )
4812cdf0e10cSrcweir SC_QUERYINTERFACE( table::XColumnRowRange )
4813cdf0e10cSrcweir SC_QUERYINTERFACE( util::XImportable )
4814cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XCellFormatRangesSupplier )
4815cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XUniqueCellFormatRangesSupplier )
4816cdf0e10cSrcweir
4817cdf0e10cSrcweir return ScCellRangesBase::queryInterface( rType );
4818cdf0e10cSrcweir }
4819cdf0e10cSrcweir
acquire()4820cdf0e10cSrcweir void SAL_CALL ScCellRangeObj::acquire() throw()
4821cdf0e10cSrcweir {
4822cdf0e10cSrcweir ScCellRangesBase::acquire();
4823cdf0e10cSrcweir }
4824cdf0e10cSrcweir
release()4825cdf0e10cSrcweir void SAL_CALL ScCellRangeObj::release() throw()
4826cdf0e10cSrcweir {
4827cdf0e10cSrcweir ScCellRangesBase::release();
4828cdf0e10cSrcweir }
4829cdf0e10cSrcweir
getTypes()4830cdf0e10cSrcweir uno::Sequence<uno::Type> SAL_CALL ScCellRangeObj::getTypes() throw(uno::RuntimeException)
4831cdf0e10cSrcweir {
4832cdf0e10cSrcweir static uno::Sequence<uno::Type> aTypes;
4833cdf0e10cSrcweir if ( aTypes.getLength() == 0 )
4834cdf0e10cSrcweir {
4835cdf0e10cSrcweir uno::Sequence<uno::Type> aParentTypes(ScCellRangesBase::getTypes());
4836cdf0e10cSrcweir long nParentLen = aParentTypes.getLength();
4837cdf0e10cSrcweir const uno::Type* pParentPtr = aParentTypes.getConstArray();
4838cdf0e10cSrcweir
4839cdf0e10cSrcweir aTypes.realloc( nParentLen + 17 );
4840cdf0e10cSrcweir uno::Type* pPtr = aTypes.getArray();
4841cdf0e10cSrcweir pPtr[nParentLen + 0] = getCppuType((const uno::Reference<sheet::XCellRangeAddressable>*)0);
4842cdf0e10cSrcweir pPtr[nParentLen + 1] = getCppuType((const uno::Reference<sheet::XSheetCellRange>*)0);
4843cdf0e10cSrcweir pPtr[nParentLen + 2] = getCppuType((const uno::Reference<sheet::XArrayFormulaRange>*)0);
4844cdf0e10cSrcweir pPtr[nParentLen + 3] = getCppuType((const uno::Reference<sheet::XArrayFormulaTokens>*)0);
4845cdf0e10cSrcweir pPtr[nParentLen + 4] = getCppuType((const uno::Reference<sheet::XCellRangeData>*)0);
4846cdf0e10cSrcweir pPtr[nParentLen + 5] = getCppuType((const uno::Reference<sheet::XCellRangeFormula>*)0);
4847cdf0e10cSrcweir pPtr[nParentLen + 6] = getCppuType((const uno::Reference<sheet::XMultipleOperation>*)0);
4848cdf0e10cSrcweir pPtr[nParentLen + 7] = getCppuType((const uno::Reference<util::XMergeable>*)0);
4849cdf0e10cSrcweir pPtr[nParentLen + 8] = getCppuType((const uno::Reference<sheet::XCellSeries>*)0);
4850cdf0e10cSrcweir pPtr[nParentLen + 9] = getCppuType((const uno::Reference<table::XAutoFormattable>*)0);
4851cdf0e10cSrcweir pPtr[nParentLen +10] = getCppuType((const uno::Reference<util::XSortable>*)0);
4852cdf0e10cSrcweir pPtr[nParentLen +11] = getCppuType((const uno::Reference<sheet::XSheetFilterableEx>*)0);
4853cdf0e10cSrcweir pPtr[nParentLen +12] = getCppuType((const uno::Reference<sheet::XSubTotalCalculatable>*)0);
4854cdf0e10cSrcweir pPtr[nParentLen +13] = getCppuType((const uno::Reference<table::XColumnRowRange>*)0);
4855cdf0e10cSrcweir pPtr[nParentLen +14] = getCppuType((const uno::Reference<util::XImportable>*)0);
4856cdf0e10cSrcweir pPtr[nParentLen +15] = getCppuType((const uno::Reference<sheet::XCellFormatRangesSupplier>*)0);
4857cdf0e10cSrcweir pPtr[nParentLen +16] = getCppuType((const uno::Reference<sheet::XUniqueCellFormatRangesSupplier>*)0);
4858cdf0e10cSrcweir
4859cdf0e10cSrcweir for (long i=0; i<nParentLen; i++)
4860cdf0e10cSrcweir pPtr[i] = pParentPtr[i]; // parent types first
4861cdf0e10cSrcweir }
4862cdf0e10cSrcweir return aTypes;
4863cdf0e10cSrcweir }
4864cdf0e10cSrcweir
getImplementationId()4865cdf0e10cSrcweir uno::Sequence<sal_Int8> SAL_CALL ScCellRangeObj::getImplementationId()
4866cdf0e10cSrcweir throw(uno::RuntimeException)
4867cdf0e10cSrcweir {
4868cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aId;
4869cdf0e10cSrcweir if( aId.getLength() == 0 )
4870cdf0e10cSrcweir {
4871cdf0e10cSrcweir aId.realloc( 16 );
4872cdf0e10cSrcweir rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
4873cdf0e10cSrcweir }
4874cdf0e10cSrcweir return aId;
4875cdf0e10cSrcweir }
4876cdf0e10cSrcweir
4877cdf0e10cSrcweir // XCellRange
4878cdf0e10cSrcweir
4879cdf0e10cSrcweir // ColumnCount / RowCount sind weggefallen
4880cdf0e10cSrcweir //! werden im Writer fuer Tabellen noch gebraucht ???
4881cdf0e10cSrcweir
GetCellByPosition_Impl(sal_Int32 nColumn,sal_Int32 nRow)4882cdf0e10cSrcweir uno::Reference<table::XCell> ScCellRangeObj::GetCellByPosition_Impl(
4883cdf0e10cSrcweir sal_Int32 nColumn, sal_Int32 nRow )
4884cdf0e10cSrcweir throw(lang::IndexOutOfBoundsException, uno::RuntimeException)
4885cdf0e10cSrcweir {
4886cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
4887cdf0e10cSrcweir if (!pDocSh)
4888cdf0e10cSrcweir throw uno::RuntimeException();
4889cdf0e10cSrcweir
4890cdf0e10cSrcweir if ( nColumn >= 0 && nRow >= 0 )
4891cdf0e10cSrcweir {
4892cdf0e10cSrcweir sal_Int32 nPosX = aRange.aStart.Col() + nColumn;
4893cdf0e10cSrcweir sal_Int32 nPosY = aRange.aStart.Row() + nRow;
4894cdf0e10cSrcweir
4895cdf0e10cSrcweir if ( nPosX <= aRange.aEnd.Col() && nPosY <= aRange.aEnd.Row() )
4896cdf0e10cSrcweir {
4897cdf0e10cSrcweir ScAddress aNew( (SCCOL)nPosX, (SCROW)nPosY, aRange.aStart.Tab() );
4898cdf0e10cSrcweir return new ScCellObj( pDocSh, aNew );
4899cdf0e10cSrcweir }
4900cdf0e10cSrcweir }
4901cdf0e10cSrcweir
4902cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
4903cdf0e10cSrcweir // return NULL;
4904cdf0e10cSrcweir }
4905cdf0e10cSrcweir
getCellByPosition(sal_Int32 nColumn,sal_Int32 nRow)4906cdf0e10cSrcweir uno::Reference<table::XCell> SAL_CALL ScCellRangeObj::getCellByPosition(
4907cdf0e10cSrcweir sal_Int32 nColumn, sal_Int32 nRow )
4908cdf0e10cSrcweir throw(lang::IndexOutOfBoundsException, uno::RuntimeException)
4909cdf0e10cSrcweir {
4910cdf0e10cSrcweir ScUnoGuard aGuard;
4911cdf0e10cSrcweir
4912cdf0e10cSrcweir return GetCellByPosition_Impl(nColumn, nRow);
4913cdf0e10cSrcweir }
4914cdf0e10cSrcweir
getCellRangeByPosition(sal_Int32 nLeft,sal_Int32 nTop,sal_Int32 nRight,sal_Int32 nBottom)4915cdf0e10cSrcweir uno::Reference<table::XCellRange> SAL_CALL ScCellRangeObj::getCellRangeByPosition(
4916cdf0e10cSrcweir sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom )
4917cdf0e10cSrcweir throw(lang::IndexOutOfBoundsException, uno::RuntimeException)
4918cdf0e10cSrcweir {
4919cdf0e10cSrcweir ScUnoGuard aGuard;
4920cdf0e10cSrcweir
4921cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
4922cdf0e10cSrcweir if (!pDocSh)
4923cdf0e10cSrcweir throw uno::RuntimeException();
4924cdf0e10cSrcweir
4925cdf0e10cSrcweir if ( nLeft >= 0 && nTop >= 0 && nRight >= 0 && nBottom >= 0 )
4926cdf0e10cSrcweir {
4927cdf0e10cSrcweir sal_Int32 nStartX = aRange.aStart.Col() + nLeft;
4928cdf0e10cSrcweir sal_Int32 nStartY = aRange.aStart.Row() + nTop;
4929cdf0e10cSrcweir sal_Int32 nEndX = aRange.aStart.Col() + nRight;
4930cdf0e10cSrcweir sal_Int32 nEndY = aRange.aStart.Row() + nBottom;
4931cdf0e10cSrcweir
4932cdf0e10cSrcweir if ( nStartX <= nEndX && nEndX <= aRange.aEnd.Col() &&
4933cdf0e10cSrcweir nStartY <= nEndY && nEndY <= aRange.aEnd.Row() )
4934cdf0e10cSrcweir {
4935cdf0e10cSrcweir ScRange aNew( (SCCOL)nStartX, (SCROW)nStartY, aRange.aStart.Tab(),
4936cdf0e10cSrcweir (SCCOL)nEndX, (SCROW)nEndY, aRange.aEnd.Tab() );
4937cdf0e10cSrcweir return new ScCellRangeObj( pDocSh, aNew );
4938cdf0e10cSrcweir }
4939cdf0e10cSrcweir }
4940cdf0e10cSrcweir
4941cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
4942cdf0e10cSrcweir // return NULL;
4943cdf0e10cSrcweir }
4944cdf0e10cSrcweir
4945cdf0e10cSrcweir
getCellRangeByName(const rtl::OUString & aName)4946cdf0e10cSrcweir uno::Reference<table::XCellRange> SAL_CALL ScCellRangeObj::getCellRangeByName(
4947cdf0e10cSrcweir const rtl::OUString& aName ) throw(uno::RuntimeException)
4948cdf0e10cSrcweir {
4949cdf0e10cSrcweir return getCellRangeByName( aName, ScAddress::detailsOOOa1 );
4950cdf0e10cSrcweir }
4951cdf0e10cSrcweir
getCellRangeByName(const rtl::OUString & aName,const ScAddress::Details & rDetails)4952cdf0e10cSrcweir uno::Reference<table::XCellRange> ScCellRangeObj::getCellRangeByName(
4953cdf0e10cSrcweir const rtl::OUString& aName, const ScAddress::Details& rDetails ) throw(uno::RuntimeException)
4954cdf0e10cSrcweir {
4955cdf0e10cSrcweir // name refers to the whole document (with the range's table as default),
4956cdf0e10cSrcweir // valid only if the range is within this range
4957cdf0e10cSrcweir
4958cdf0e10cSrcweir ScUnoGuard aGuard;
4959cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
4960cdf0e10cSrcweir if ( pDocSh )
4961cdf0e10cSrcweir {
4962cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
4963cdf0e10cSrcweir SCTAB nTab = aRange.aStart.Tab();
4964cdf0e10cSrcweir
4965cdf0e10cSrcweir ScRange aCellRange;
4966cdf0e10cSrcweir sal_Bool bFound = sal_False;
4967cdf0e10cSrcweir String aString(aName);
4968cdf0e10cSrcweir sal_uInt16 nParse = aCellRange.ParseAny( aString, pDoc, rDetails );
4969cdf0e10cSrcweir if ( nParse & SCA_VALID )
4970cdf0e10cSrcweir {
4971cdf0e10cSrcweir if ( !(nParse & SCA_TAB_3D) ) // keine Tabelle angegeben -> auf dieser Tabelle
4972cdf0e10cSrcweir {
4973cdf0e10cSrcweir aCellRange.aStart.SetTab(nTab);
4974cdf0e10cSrcweir aCellRange.aEnd.SetTab(nTab);
4975cdf0e10cSrcweir }
4976cdf0e10cSrcweir bFound = sal_True;
4977cdf0e10cSrcweir }
4978cdf0e10cSrcweir else
4979cdf0e10cSrcweir {
4980cdf0e10cSrcweir ScRangeUtil aRangeUtil;
4981cdf0e10cSrcweir if ( aRangeUtil.MakeRangeFromName( aString, pDoc, nTab, aCellRange, RUTL_NAMES ) ||
4982cdf0e10cSrcweir aRangeUtil.MakeRangeFromName( aString, pDoc, nTab, aCellRange, RUTL_DBASE ) )
4983cdf0e10cSrcweir bFound = sal_True;
4984cdf0e10cSrcweir }
4985cdf0e10cSrcweir
4986cdf0e10cSrcweir if (bFound) // valid only if within this object's range
4987cdf0e10cSrcweir {
4988cdf0e10cSrcweir if (!aRange.In(aCellRange))
4989cdf0e10cSrcweir bFound = sal_False;
4990cdf0e10cSrcweir }
4991cdf0e10cSrcweir
4992cdf0e10cSrcweir if (bFound)
4993cdf0e10cSrcweir {
4994cdf0e10cSrcweir if ( aCellRange.aStart == aCellRange.aEnd )
4995cdf0e10cSrcweir return new ScCellObj( pDocSh, aCellRange.aStart );
4996cdf0e10cSrcweir else
4997cdf0e10cSrcweir return new ScCellRangeObj( pDocSh, aCellRange );
4998cdf0e10cSrcweir }
4999cdf0e10cSrcweir }
5000cdf0e10cSrcweir
5001cdf0e10cSrcweir throw uno::RuntimeException();
5002cdf0e10cSrcweir // return NULL;
5003cdf0e10cSrcweir }
5004cdf0e10cSrcweir
5005cdf0e10cSrcweir // XColumnRowRange
5006cdf0e10cSrcweir
getColumns()5007cdf0e10cSrcweir uno::Reference<table::XTableColumns> SAL_CALL ScCellRangeObj::getColumns() throw(uno::RuntimeException)
5008cdf0e10cSrcweir {
5009cdf0e10cSrcweir ScUnoGuard aGuard;
5010cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5011cdf0e10cSrcweir if (pDocSh)
5012cdf0e10cSrcweir return new ScTableColumnsObj( pDocSh, aRange.aStart.Tab(),
5013cdf0e10cSrcweir aRange.aStart.Col(), aRange.aEnd.Col() );
5014cdf0e10cSrcweir
5015cdf0e10cSrcweir DBG_ERROR("Dokument ungueltig");
5016cdf0e10cSrcweir return NULL;
5017cdf0e10cSrcweir }
5018cdf0e10cSrcweir
getRows()5019cdf0e10cSrcweir uno::Reference<table::XTableRows> SAL_CALL ScCellRangeObj::getRows() throw(uno::RuntimeException)
5020cdf0e10cSrcweir {
5021cdf0e10cSrcweir ScUnoGuard aGuard;
5022cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5023cdf0e10cSrcweir if (pDocSh)
5024cdf0e10cSrcweir return new ScTableRowsObj( pDocSh, aRange.aStart.Tab(),
5025cdf0e10cSrcweir aRange.aStart.Row(), aRange.aEnd.Row() );
5026cdf0e10cSrcweir
5027cdf0e10cSrcweir DBG_ERROR("Dokument ungueltig");
5028cdf0e10cSrcweir return NULL;
5029cdf0e10cSrcweir }
5030cdf0e10cSrcweir
5031cdf0e10cSrcweir // XAddressableCellRange
5032cdf0e10cSrcweir
getRangeAddress()5033cdf0e10cSrcweir table::CellRangeAddress SAL_CALL ScCellRangeObj::getRangeAddress() throw(uno::RuntimeException)
5034cdf0e10cSrcweir {
5035cdf0e10cSrcweir ScUnoGuard aGuard;
5036cdf0e10cSrcweir table::CellRangeAddress aRet;
5037cdf0e10cSrcweir ScUnoConversion::FillApiRange( aRet, aRange );
5038cdf0e10cSrcweir return aRet;
5039cdf0e10cSrcweir }
5040cdf0e10cSrcweir
5041cdf0e10cSrcweir // XSheetCellRange
5042cdf0e10cSrcweir
getSpreadsheet()5043cdf0e10cSrcweir uno::Reference<sheet::XSpreadsheet> SAL_CALL ScCellRangeObj::getSpreadsheet()
5044cdf0e10cSrcweir throw(uno::RuntimeException)
5045cdf0e10cSrcweir {
5046cdf0e10cSrcweir ScUnoGuard aGuard;
5047cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5048cdf0e10cSrcweir if (pDocSh)
5049cdf0e10cSrcweir return new ScTableSheetObj( pDocSh, aRange.aStart.Tab() );
5050cdf0e10cSrcweir
5051cdf0e10cSrcweir DBG_ERROR("Dokument ungueltig");
5052cdf0e10cSrcweir return NULL;
5053cdf0e10cSrcweir }
5054cdf0e10cSrcweir
5055cdf0e10cSrcweir // XArrayFormulaRange
5056cdf0e10cSrcweir
getArrayFormula()5057cdf0e10cSrcweir rtl::OUString SAL_CALL ScCellRangeObj::getArrayFormula() throw(uno::RuntimeException)
5058cdf0e10cSrcweir {
5059cdf0e10cSrcweir ScUnoGuard aGuard;
5060cdf0e10cSrcweir
5061cdf0e10cSrcweir // Matrix-Formel, wenn eindeutig Teil einer Matrix,
5062cdf0e10cSrcweir // also wenn Anfang und Ende des Blocks zur selben Matrix gehoeren.
5063cdf0e10cSrcweir // Sonst Leerstring.
5064cdf0e10cSrcweir
5065cdf0e10cSrcweir String aFormula;
5066cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5067cdf0e10cSrcweir if (pDocSh)
5068cdf0e10cSrcweir {
5069cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
5070cdf0e10cSrcweir const ScBaseCell* pCell1 = pDoc->GetCell( aRange.aStart );
5071cdf0e10cSrcweir const ScBaseCell* pCell2 = pDoc->GetCell( aRange.aEnd );
5072cdf0e10cSrcweir if ( pCell1 && pCell2 && pCell1->GetCellType() == CELLTYPE_FORMULA &&
5073cdf0e10cSrcweir pCell2->GetCellType() == CELLTYPE_FORMULA )
5074cdf0e10cSrcweir {
5075cdf0e10cSrcweir const ScFormulaCell* pFCell1 = (const ScFormulaCell*)pCell1;
5076cdf0e10cSrcweir const ScFormulaCell* pFCell2 = (const ScFormulaCell*)pCell2;
5077cdf0e10cSrcweir ScAddress aStart1;
5078cdf0e10cSrcweir ScAddress aStart2;
5079cdf0e10cSrcweir if ( pFCell1->GetMatrixOrigin( aStart1 ) && pFCell2->GetMatrixOrigin( aStart2 ) )
5080cdf0e10cSrcweir {
5081cdf0e10cSrcweir if ( aStart1 == aStart2 ) // beides dieselbe Matrix
5082cdf0e10cSrcweir pFCell1->GetFormula( aFormula ); // egal, von welcher Zelle
5083cdf0e10cSrcweir }
5084cdf0e10cSrcweir }
5085cdf0e10cSrcweir }
5086cdf0e10cSrcweir return aFormula;
5087cdf0e10cSrcweir }
5088cdf0e10cSrcweir
SetArrayFormula_Impl(const rtl::OUString & rFormula,const rtl::OUString & rFormulaNmsp,const formula::FormulaGrammar::Grammar eGrammar)5089cdf0e10cSrcweir void ScCellRangeObj::SetArrayFormula_Impl( const rtl::OUString& rFormula,
5090cdf0e10cSrcweir const rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar ) throw(uno::RuntimeException)
5091cdf0e10cSrcweir {
5092cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5093cdf0e10cSrcweir if (pDocSh)
5094cdf0e10cSrcweir {
5095cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
5096cdf0e10cSrcweir if ( rFormula.getLength() )
5097cdf0e10cSrcweir {
5098cdf0e10cSrcweir if ( ScTableSheetObj::getImplementation( (cppu::OWeakObject*)this ) )
5099cdf0e10cSrcweir {
5100cdf0e10cSrcweir // #74681# don't set array formula for sheet object
5101cdf0e10cSrcweir throw uno::RuntimeException();
5102cdf0e10cSrcweir }
5103cdf0e10cSrcweir
5104cdf0e10cSrcweir aFunc.EnterMatrix( aRange, NULL, NULL, rFormula, sal_True, sal_True, rFormulaNmsp, eGrammar );
5105cdf0e10cSrcweir }
5106cdf0e10cSrcweir else
5107cdf0e10cSrcweir {
5108cdf0e10cSrcweir // empty string -> erase array formula
5109cdf0e10cSrcweir ScMarkData aMark;
5110cdf0e10cSrcweir aMark.SetMarkArea( aRange );
5111cdf0e10cSrcweir aMark.SelectTable( aRange.aStart.Tab(), sal_True );
5112cdf0e10cSrcweir aFunc.DeleteContents( aMark, IDF_CONTENTS, sal_True, sal_True );
5113cdf0e10cSrcweir }
5114cdf0e10cSrcweir }
5115cdf0e10cSrcweir }
5116cdf0e10cSrcweir
setArrayFormula(const rtl::OUString & aFormula)5117cdf0e10cSrcweir void SAL_CALL ScCellRangeObj::setArrayFormula( const rtl::OUString& aFormula )
5118cdf0e10cSrcweir throw(uno::RuntimeException)
5119cdf0e10cSrcweir {
5120cdf0e10cSrcweir ScUnoGuard aGuard;
5121cdf0e10cSrcweir // GRAM_PODF_A1 for API compatibility.
5122cdf0e10cSrcweir SetArrayFormula_Impl( aFormula, ::rtl::OUString(), formula::FormulaGrammar::GRAM_PODF_A1);
5123cdf0e10cSrcweir }
5124cdf0e10cSrcweir
SetArrayFormulaWithGrammar(const rtl::OUString & rFormula,const rtl::OUString & rFormulaNmsp,const formula::FormulaGrammar::Grammar eGrammar)5125cdf0e10cSrcweir void ScCellRangeObj::SetArrayFormulaWithGrammar( const rtl::OUString& rFormula,
5126cdf0e10cSrcweir const rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar ) throw(uno::RuntimeException)
5127cdf0e10cSrcweir {
5128cdf0e10cSrcweir ScUnoGuard aGuard;
5129cdf0e10cSrcweir SetArrayFormula_Impl( rFormula, rFormulaNmsp, eGrammar);
5130cdf0e10cSrcweir }
5131cdf0e10cSrcweir
5132cdf0e10cSrcweir // XArrayFormulaTokens
5133cdf0e10cSrcweir
getArrayTokens()5134cdf0e10cSrcweir uno::Sequence<sheet::FormulaToken> SAL_CALL ScCellRangeObj::getArrayTokens() throw(uno::RuntimeException)
5135cdf0e10cSrcweir {
5136cdf0e10cSrcweir ScUnoGuard aGuard;
5137cdf0e10cSrcweir
5138cdf0e10cSrcweir // same cell logic as in getArrayFormula
5139cdf0e10cSrcweir
5140cdf0e10cSrcweir uno::Sequence<sheet::FormulaToken> aSequence;
5141cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5142cdf0e10cSrcweir if ( pDocSh )
5143cdf0e10cSrcweir {
5144cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
5145cdf0e10cSrcweir const ScBaseCell* pCell1 = pDoc->GetCell( aRange.aStart );
5146cdf0e10cSrcweir const ScBaseCell* pCell2 = pDoc->GetCell( aRange.aEnd );
5147cdf0e10cSrcweir if ( pCell1 && pCell2 && pCell1->GetCellType() == CELLTYPE_FORMULA &&
5148cdf0e10cSrcweir pCell2->GetCellType() == CELLTYPE_FORMULA )
5149cdf0e10cSrcweir {
5150cdf0e10cSrcweir const ScFormulaCell* pFCell1 = (const ScFormulaCell*)pCell1;
5151cdf0e10cSrcweir const ScFormulaCell* pFCell2 = (const ScFormulaCell*)pCell2;
5152cdf0e10cSrcweir ScAddress aStart1;
5153cdf0e10cSrcweir ScAddress aStart2;
5154cdf0e10cSrcweir if ( pFCell1->GetMatrixOrigin( aStart1 ) && pFCell2->GetMatrixOrigin( aStart2 ) )
5155cdf0e10cSrcweir {
5156cdf0e10cSrcweir if ( aStart1 == aStart2 )
5157cdf0e10cSrcweir {
5158cdf0e10cSrcweir ScTokenArray* pTokenArray = pFCell1->GetCode();
5159cdf0e10cSrcweir if ( pTokenArray )
5160cdf0e10cSrcweir (void)ScTokenConversion::ConvertToTokenSequence( *pDoc, aSequence, *pTokenArray );
5161cdf0e10cSrcweir }
5162cdf0e10cSrcweir }
5163cdf0e10cSrcweir }
5164cdf0e10cSrcweir }
5165cdf0e10cSrcweir return aSequence;
5166cdf0e10cSrcweir }
5167cdf0e10cSrcweir
setArrayTokens(const uno::Sequence<sheet::FormulaToken> & rTokens)5168cdf0e10cSrcweir void SAL_CALL ScCellRangeObj::setArrayTokens( const uno::Sequence<sheet::FormulaToken>& rTokens ) throw(uno::RuntimeException)
5169cdf0e10cSrcweir {
5170cdf0e10cSrcweir ScUnoGuard aGuard;
5171cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5172cdf0e10cSrcweir if ( pDocSh )
5173cdf0e10cSrcweir {
5174cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
5175cdf0e10cSrcweir if ( rTokens.getLength() )
5176cdf0e10cSrcweir {
5177cdf0e10cSrcweir if ( ScTableSheetObj::getImplementation( (cppu::OWeakObject*)this ) )
5178cdf0e10cSrcweir {
5179cdf0e10cSrcweir throw uno::RuntimeException();
5180cdf0e10cSrcweir }
5181cdf0e10cSrcweir
5182cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
5183cdf0e10cSrcweir ScTokenArray aTokenArray;
5184cdf0e10cSrcweir (void)ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, rTokens );
5185cdf0e10cSrcweir
5186cdf0e10cSrcweir // Actually GRAM_PODF_A1 is a don't-care here because of the token
5187cdf0e10cSrcweir // array being set, it fits with other API compatibility grammars
5188cdf0e10cSrcweir // though.
5189cdf0e10cSrcweir aFunc.EnterMatrix( aRange, NULL, &aTokenArray, EMPTY_STRING, sal_True, sal_True, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
5190cdf0e10cSrcweir }
5191cdf0e10cSrcweir else
5192cdf0e10cSrcweir {
5193cdf0e10cSrcweir // empty sequence -> erase array formula
5194cdf0e10cSrcweir ScMarkData aMark;
5195cdf0e10cSrcweir aMark.SetMarkArea( aRange );
5196cdf0e10cSrcweir aMark.SelectTable( aRange.aStart.Tab(), sal_True );
5197cdf0e10cSrcweir aFunc.DeleteContents( aMark, IDF_CONTENTS, sal_True, sal_True );
5198cdf0e10cSrcweir }
5199cdf0e10cSrcweir }
5200cdf0e10cSrcweir }
5201cdf0e10cSrcweir
5202cdf0e10cSrcweir // XCellRangeData
5203cdf0e10cSrcweir
getDataArray()5204cdf0e10cSrcweir uno::Sequence< uno::Sequence<uno::Any> > SAL_CALL ScCellRangeObj::getDataArray()
5205cdf0e10cSrcweir throw(uno::RuntimeException)
5206cdf0e10cSrcweir {
5207cdf0e10cSrcweir ScUnoGuard aGuard;
5208cdf0e10cSrcweir
5209cdf0e10cSrcweir if ( ScTableSheetObj::getImplementation( (cppu::OWeakObject*)this ) )
5210cdf0e10cSrcweir {
5211cdf0e10cSrcweir // don't create a data array for the sheet
5212cdf0e10cSrcweir throw uno::RuntimeException();
5213cdf0e10cSrcweir }
5214cdf0e10cSrcweir
5215cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5216cdf0e10cSrcweir if (pDocSh)
5217cdf0e10cSrcweir {
5218cdf0e10cSrcweir uno::Any aAny;
5219cdf0e10cSrcweir // bAllowNV = TRUE: errors as void
5220cdf0e10cSrcweir if ( ScRangeToSequence::FillMixedArray( aAny, pDocSh->GetDocument(), aRange, sal_True ) )
5221cdf0e10cSrcweir {
5222cdf0e10cSrcweir uno::Sequence< uno::Sequence<uno::Any> > aSeq;
5223cdf0e10cSrcweir if ( aAny >>= aSeq )
5224cdf0e10cSrcweir return aSeq; // success
5225cdf0e10cSrcweir }
5226cdf0e10cSrcweir }
5227cdf0e10cSrcweir
5228cdf0e10cSrcweir throw uno::RuntimeException(); // no other exceptions specified
5229cdf0e10cSrcweir // return uno::Sequence< uno::Sequence<uno::Any> >(0);
5230cdf0e10cSrcweir }
5231cdf0e10cSrcweir
setDataArray(const uno::Sequence<uno::Sequence<uno::Any>> & aArray)5232cdf0e10cSrcweir void SAL_CALL ScCellRangeObj::setDataArray(
5233cdf0e10cSrcweir const uno::Sequence< uno::Sequence<uno::Any> >& aArray )
5234cdf0e10cSrcweir throw(uno::RuntimeException)
5235cdf0e10cSrcweir {
5236cdf0e10cSrcweir ScUnoGuard aGuard;
5237cdf0e10cSrcweir
5238cdf0e10cSrcweir sal_Bool bDone = sal_False;
5239cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5240cdf0e10cSrcweir if (pDocSh)
5241cdf0e10cSrcweir {
5242cdf0e10cSrcweir //! move lcl_PutDataArray to docfunc?
5243cdf0e10cSrcweir bDone = lcl_PutDataArray( *pDocSh, aRange, aArray );
5244cdf0e10cSrcweir }
5245cdf0e10cSrcweir
5246cdf0e10cSrcweir if (!bDone)
5247cdf0e10cSrcweir throw uno::RuntimeException(); // no other exceptions specified
5248cdf0e10cSrcweir }
5249cdf0e10cSrcweir
5250cdf0e10cSrcweir // XCellRangeFormula
5251cdf0e10cSrcweir
getFormulaArray()5252cdf0e10cSrcweir uno::Sequence< uno::Sequence<rtl::OUString> > SAL_CALL ScCellRangeObj::getFormulaArray()
5253cdf0e10cSrcweir throw(uno::RuntimeException)
5254cdf0e10cSrcweir {
5255cdf0e10cSrcweir ScUnoGuard aGuard;
5256cdf0e10cSrcweir
5257cdf0e10cSrcweir if ( ScTableSheetObj::getImplementation( (cppu::OWeakObject*)this ) )
5258cdf0e10cSrcweir {
5259cdf0e10cSrcweir // don't create a data array for the sheet
5260cdf0e10cSrcweir throw uno::RuntimeException();
5261cdf0e10cSrcweir }
5262cdf0e10cSrcweir
5263cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5264cdf0e10cSrcweir if (pDocSh)
5265cdf0e10cSrcweir {
5266cdf0e10cSrcweir SCCOL nStartCol = aRange.aStart.Col();
5267cdf0e10cSrcweir SCROW nStartRow = aRange.aStart.Row();
5268cdf0e10cSrcweir SCCOL nEndCol = aRange.aEnd.Col();
5269cdf0e10cSrcweir SCROW nEndRow = aRange.aEnd.Row();
5270cdf0e10cSrcweir SCCOL nColCount = nEndCol + 1 - nStartCol;
5271cdf0e10cSrcweir SCROW nRowCount = nEndRow + 1 - nStartRow;
5272cdf0e10cSrcweir SCTAB nTab = aRange.aStart.Tab();
5273cdf0e10cSrcweir
5274cdf0e10cSrcweir uno::Sequence< uno::Sequence<rtl::OUString> > aRowSeq( nRowCount );
5275cdf0e10cSrcweir uno::Sequence<rtl::OUString>* pRowAry = aRowSeq.getArray();
5276cdf0e10cSrcweir for (SCROW nRowIndex = 0; nRowIndex < nRowCount; nRowIndex++)
5277cdf0e10cSrcweir {
5278cdf0e10cSrcweir uno::Sequence<rtl::OUString> aColSeq( nColCount );
5279cdf0e10cSrcweir rtl::OUString* pColAry = aColSeq.getArray();
5280cdf0e10cSrcweir for (SCCOL nColIndex = 0; nColIndex < nColCount; nColIndex++)
5281cdf0e10cSrcweir pColAry[nColIndex] = lcl_GetInputString( pDocSh->GetDocument(),
5282cdf0e10cSrcweir ScAddress( nStartCol+nColIndex, nStartRow+nRowIndex, nTab ), sal_True );
5283cdf0e10cSrcweir
5284cdf0e10cSrcweir pRowAry[nRowIndex] = aColSeq;
5285cdf0e10cSrcweir }
5286cdf0e10cSrcweir
5287cdf0e10cSrcweir return aRowSeq;
5288cdf0e10cSrcweir }
5289cdf0e10cSrcweir
5290cdf0e10cSrcweir throw uno::RuntimeException(); // no other exceptions specified
5291cdf0e10cSrcweir // return uno::Sequence< uno::Sequence<rtl::OUString> >(0);
5292cdf0e10cSrcweir }
5293cdf0e10cSrcweir
setFormulaArray(const uno::Sequence<uno::Sequence<rtl::OUString>> & aArray)5294cdf0e10cSrcweir void SAL_CALL ScCellRangeObj::setFormulaArray(
5295cdf0e10cSrcweir const uno::Sequence< uno::Sequence<rtl::OUString> >& aArray )
5296cdf0e10cSrcweir throw(uno::RuntimeException)
5297cdf0e10cSrcweir {
5298cdf0e10cSrcweir ScUnoGuard aGuard;
5299cdf0e10cSrcweir
5300cdf0e10cSrcweir sal_Bool bDone = sal_False;
5301cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5302cdf0e10cSrcweir if (pDocSh)
5303cdf0e10cSrcweir {
5304cdf0e10cSrcweir ScExternalRefManager::ApiGuard aExtRefGuard(pDocSh->GetDocument());
5305cdf0e10cSrcweir
5306cdf0e10cSrcweir // GRAM_PODF_A1 for API compatibility.
5307cdf0e10cSrcweir bDone = lcl_PutFormulaArray( *pDocSh, aRange, aArray, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
5308cdf0e10cSrcweir }
5309cdf0e10cSrcweir
5310cdf0e10cSrcweir if (!bDone)
5311cdf0e10cSrcweir throw uno::RuntimeException(); // no other exceptions specified
5312cdf0e10cSrcweir }
5313cdf0e10cSrcweir
5314cdf0e10cSrcweir // XMultipleOperation
5315cdf0e10cSrcweir
setTableOperation(const table::CellRangeAddress & aFormulaRange,sheet::TableOperationMode nMode,const table::CellAddress & aColumnCell,const table::CellAddress & aRowCell)5316cdf0e10cSrcweir void SAL_CALL ScCellRangeObj::setTableOperation( const table::CellRangeAddress& aFormulaRange,
5317cdf0e10cSrcweir sheet::TableOperationMode nMode,
5318cdf0e10cSrcweir const table::CellAddress& aColumnCell,
5319cdf0e10cSrcweir const table::CellAddress& aRowCell )
5320cdf0e10cSrcweir throw(uno::RuntimeException)
5321cdf0e10cSrcweir {
5322cdf0e10cSrcweir ScUnoGuard aGuard;
5323cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5324cdf0e10cSrcweir if (pDocSh)
5325cdf0e10cSrcweir {
5326cdf0e10cSrcweir sal_Bool bError = sal_False;
5327cdf0e10cSrcweir ScTabOpParam aParam;
5328cdf0e10cSrcweir aParam.aRefFormulaCell = ScRefAddress( (SCCOL)aFormulaRange.StartColumn,
5329cdf0e10cSrcweir (SCROW)aFormulaRange.StartRow, aFormulaRange.Sheet,
5330cdf0e10cSrcweir sal_False, sal_False, sal_False );
5331cdf0e10cSrcweir aParam.aRefFormulaEnd = ScRefAddress( (SCCOL)aFormulaRange.EndColumn,
5332cdf0e10cSrcweir (SCROW)aFormulaRange.EndRow, aFormulaRange.Sheet,
5333cdf0e10cSrcweir sal_False, sal_False, sal_False );
5334cdf0e10cSrcweir aParam.aRefRowCell = ScRefAddress( (SCCOL)aRowCell.Column,
5335cdf0e10cSrcweir (SCROW)aRowCell.Row, aRowCell.Sheet,
5336cdf0e10cSrcweir sal_False, sal_False, sal_False );
5337cdf0e10cSrcweir aParam.aRefColCell = ScRefAddress( (SCCOL)aColumnCell.Column,
5338cdf0e10cSrcweir (SCROW)aColumnCell.Row, aColumnCell.Sheet,
5339cdf0e10cSrcweir sal_False, sal_False, sal_False );
5340cdf0e10cSrcweir switch (nMode)
5341cdf0e10cSrcweir {
5342cdf0e10cSrcweir case sheet::TableOperationMode_COLUMN:
5343cdf0e10cSrcweir aParam.nMode = 0;
5344cdf0e10cSrcweir break;
5345cdf0e10cSrcweir case sheet::TableOperationMode_ROW:
5346cdf0e10cSrcweir aParam.nMode = 1;
5347cdf0e10cSrcweir break;
5348cdf0e10cSrcweir case sheet::TableOperationMode_BOTH:
5349cdf0e10cSrcweir aParam.nMode = 2;
5350cdf0e10cSrcweir break;
5351cdf0e10cSrcweir default:
5352cdf0e10cSrcweir bError = sal_True;
5353cdf0e10cSrcweir }
5354cdf0e10cSrcweir
5355cdf0e10cSrcweir if (!bError)
5356cdf0e10cSrcweir {
5357cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
5358cdf0e10cSrcweir aFunc.TabOp( aRange, NULL, aParam, sal_True, sal_True );
5359cdf0e10cSrcweir }
5360cdf0e10cSrcweir }
5361cdf0e10cSrcweir }
5362cdf0e10cSrcweir
5363cdf0e10cSrcweir // XMergeable
5364cdf0e10cSrcweir
merge(sal_Bool bMerge)5365cdf0e10cSrcweir void SAL_CALL ScCellRangeObj::merge( sal_Bool bMerge ) throw(uno::RuntimeException)
5366cdf0e10cSrcweir {
5367cdf0e10cSrcweir ScUnoGuard aGuard;
5368cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5369cdf0e10cSrcweir if ( pDocSh )
5370cdf0e10cSrcweir {
5371cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
5372cdf0e10cSrcweir if ( bMerge )
5373cdf0e10cSrcweir aFunc.MergeCells( aRange, sal_False, sal_True, sal_True );
5374cdf0e10cSrcweir else
5375cdf0e10cSrcweir aFunc.UnmergeCells( aRange, sal_True, sal_True );
5376cdf0e10cSrcweir
5377cdf0e10cSrcweir //! Fehler abfangen?
5378cdf0e10cSrcweir }
5379cdf0e10cSrcweir }
5380cdf0e10cSrcweir
getIsMerged()5381cdf0e10cSrcweir sal_Bool SAL_CALL ScCellRangeObj::getIsMerged() throw(uno::RuntimeException)
5382cdf0e10cSrcweir {
5383cdf0e10cSrcweir ScUnoGuard aGuard;
5384cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5385cdf0e10cSrcweir return pDocSh && pDocSh->GetDocument()->HasAttrib( aRange, HASATTR_MERGED );
5386cdf0e10cSrcweir }
5387cdf0e10cSrcweir
5388cdf0e10cSrcweir // XCellSeries
5389cdf0e10cSrcweir
fillSeries(sheet::FillDirection nFillDirection,sheet::FillMode nFillMode,sheet::FillDateMode nFillDateMode,double fStep,double fEndValue)5390cdf0e10cSrcweir void SAL_CALL ScCellRangeObj::fillSeries( sheet::FillDirection nFillDirection,
5391cdf0e10cSrcweir sheet::FillMode nFillMode, sheet::FillDateMode nFillDateMode,
5392cdf0e10cSrcweir double fStep, double fEndValue ) throw(uno::RuntimeException)
5393cdf0e10cSrcweir {
5394cdf0e10cSrcweir ScUnoGuard aGuard;
5395cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5396cdf0e10cSrcweir if ( pDocSh )
5397cdf0e10cSrcweir {
5398cdf0e10cSrcweir sal_Bool bError = sal_False;
5399cdf0e10cSrcweir
5400cdf0e10cSrcweir FillDir eDir = FILL_TO_BOTTOM;
5401cdf0e10cSrcweir switch (nFillDirection)
5402cdf0e10cSrcweir {
5403cdf0e10cSrcweir case sheet::FillDirection_TO_BOTTOM:
5404cdf0e10cSrcweir eDir = FILL_TO_BOTTOM;
5405cdf0e10cSrcweir break;
5406cdf0e10cSrcweir case sheet::FillDirection_TO_RIGHT:
5407cdf0e10cSrcweir eDir = FILL_TO_RIGHT;
5408cdf0e10cSrcweir break;
5409cdf0e10cSrcweir case sheet::FillDirection_TO_TOP:
5410cdf0e10cSrcweir eDir = FILL_TO_TOP;
5411cdf0e10cSrcweir break;
5412cdf0e10cSrcweir case sheet::FillDirection_TO_LEFT:
5413cdf0e10cSrcweir eDir = FILL_TO_LEFT;
5414cdf0e10cSrcweir break;
5415cdf0e10cSrcweir default:
5416cdf0e10cSrcweir bError = sal_True;
5417cdf0e10cSrcweir }
5418cdf0e10cSrcweir
5419cdf0e10cSrcweir FillCmd eCmd = FILL_SIMPLE;
5420cdf0e10cSrcweir switch ( nFillMode )
5421cdf0e10cSrcweir {
5422cdf0e10cSrcweir case sheet::FillMode_SIMPLE:
5423cdf0e10cSrcweir eCmd = FILL_SIMPLE;
5424cdf0e10cSrcweir break;
5425cdf0e10cSrcweir case sheet::FillMode_LINEAR:
5426cdf0e10cSrcweir eCmd = FILL_LINEAR;
5427cdf0e10cSrcweir break;
5428cdf0e10cSrcweir case sheet::FillMode_GROWTH:
5429cdf0e10cSrcweir eCmd = FILL_GROWTH;
5430cdf0e10cSrcweir break;
5431cdf0e10cSrcweir case sheet::FillMode_DATE:
5432cdf0e10cSrcweir eCmd = FILL_DATE;
5433cdf0e10cSrcweir break;
5434cdf0e10cSrcweir case sheet::FillMode_AUTO:
5435cdf0e10cSrcweir eCmd = FILL_AUTO;
5436cdf0e10cSrcweir break;
5437cdf0e10cSrcweir default:
5438cdf0e10cSrcweir bError = sal_True;
5439cdf0e10cSrcweir }
5440cdf0e10cSrcweir
5441cdf0e10cSrcweir FillDateCmd eDateCmd = FILL_DAY;
5442cdf0e10cSrcweir switch ( nFillDateMode )
5443cdf0e10cSrcweir {
5444cdf0e10cSrcweir case sheet::FillDateMode_FILL_DATE_DAY:
5445cdf0e10cSrcweir eDateCmd = FILL_DAY;
5446cdf0e10cSrcweir break;
5447cdf0e10cSrcweir case sheet::FillDateMode_FILL_DATE_WEEKDAY:
5448cdf0e10cSrcweir eDateCmd = FILL_WEEKDAY;
5449cdf0e10cSrcweir break;
5450cdf0e10cSrcweir case sheet::FillDateMode_FILL_DATE_MONTH:
5451cdf0e10cSrcweir eDateCmd = FILL_MONTH;
5452cdf0e10cSrcweir break;
5453cdf0e10cSrcweir case sheet::FillDateMode_FILL_DATE_YEAR:
5454cdf0e10cSrcweir eDateCmd = FILL_YEAR;
5455cdf0e10cSrcweir break;
5456cdf0e10cSrcweir default:
5457cdf0e10cSrcweir bError = sal_True;
5458cdf0e10cSrcweir }
5459cdf0e10cSrcweir
5460cdf0e10cSrcweir if (!bError)
5461cdf0e10cSrcweir {
5462cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
5463cdf0e10cSrcweir aFunc.FillSeries( aRange, NULL, eDir, eCmd, eDateCmd,
5464cdf0e10cSrcweir MAXDOUBLE, fStep, fEndValue, sal_True, sal_True );
5465cdf0e10cSrcweir }
5466cdf0e10cSrcweir }
5467cdf0e10cSrcweir }
5468cdf0e10cSrcweir
fillAuto(sheet::FillDirection nFillDirection,sal_Int32 nSourceCount)5469cdf0e10cSrcweir void SAL_CALL ScCellRangeObj::fillAuto( sheet::FillDirection nFillDirection,
5470cdf0e10cSrcweir sal_Int32 nSourceCount ) throw(uno::RuntimeException)
5471cdf0e10cSrcweir {
5472cdf0e10cSrcweir ScUnoGuard aGuard;
5473cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5474cdf0e10cSrcweir if ( pDocSh && nSourceCount )
5475cdf0e10cSrcweir {
5476cdf0e10cSrcweir ScRange aSourceRange(aRange);
5477cdf0e10cSrcweir SCsCOLROW nCount = 0; // "Dest-Count"
5478cdf0e10cSrcweir FillDir eDir = FILL_TO_BOTTOM;
5479cdf0e10cSrcweir sal_Bool bError = sal_False;
5480cdf0e10cSrcweir switch (nFillDirection)
5481cdf0e10cSrcweir {
5482cdf0e10cSrcweir case sheet::FillDirection_TO_BOTTOM:
5483cdf0e10cSrcweir aSourceRange.aEnd.SetRow( static_cast<SCROW>( aSourceRange.aStart.Row() + nSourceCount - 1 ) );
5484cdf0e10cSrcweir nCount = aRange.aEnd.Row() - aSourceRange.aEnd.Row();
5485cdf0e10cSrcweir eDir = FILL_TO_BOTTOM;
5486cdf0e10cSrcweir break;
5487cdf0e10cSrcweir case sheet::FillDirection_TO_RIGHT:
5488cdf0e10cSrcweir aSourceRange.aEnd.SetCol( static_cast<SCCOL>( aSourceRange.aStart.Col() + nSourceCount - 1 ) );
5489cdf0e10cSrcweir nCount = aRange.aEnd.Col() - aSourceRange.aEnd.Col();
5490cdf0e10cSrcweir eDir = FILL_TO_RIGHT;
5491cdf0e10cSrcweir break;
5492cdf0e10cSrcweir case sheet::FillDirection_TO_TOP:
5493cdf0e10cSrcweir aSourceRange.aStart.SetRow( static_cast<SCROW>( aSourceRange.aEnd.Row() - nSourceCount + 1 ) );
5494cdf0e10cSrcweir nCount = aSourceRange.aStart.Row() - aRange.aStart.Row();
5495cdf0e10cSrcweir eDir = FILL_TO_TOP;
5496cdf0e10cSrcweir break;
5497cdf0e10cSrcweir case sheet::FillDirection_TO_LEFT:
5498cdf0e10cSrcweir aSourceRange.aStart.SetCol( static_cast<SCCOL>( aSourceRange.aEnd.Col() - nSourceCount + 1 ) );
5499cdf0e10cSrcweir nCount = aSourceRange.aStart.Col() - aRange.aStart.Col();
5500cdf0e10cSrcweir eDir = FILL_TO_LEFT;
5501cdf0e10cSrcweir break;
5502cdf0e10cSrcweir default:
5503cdf0e10cSrcweir bError = sal_True;
5504cdf0e10cSrcweir }
5505cdf0e10cSrcweir if (nCount < 0 || nCount > MAXROW) // overflow
5506cdf0e10cSrcweir bError = sal_True;
5507cdf0e10cSrcweir
5508cdf0e10cSrcweir if (!bError)
5509cdf0e10cSrcweir {
5510cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
5511cdf0e10cSrcweir aFunc.FillAuto( aSourceRange, NULL, eDir, nCount, sal_True, sal_True );
5512cdf0e10cSrcweir }
5513cdf0e10cSrcweir }
5514cdf0e10cSrcweir }
5515cdf0e10cSrcweir
5516cdf0e10cSrcweir // XAutoFormattable
5517cdf0e10cSrcweir
autoFormat(const rtl::OUString & aName)5518cdf0e10cSrcweir void SAL_CALL ScCellRangeObj::autoFormat( const rtl::OUString& aName )
5519cdf0e10cSrcweir throw(lang::IllegalArgumentException, uno::RuntimeException)
5520cdf0e10cSrcweir {
5521cdf0e10cSrcweir ScUnoGuard aGuard;
5522cdf0e10cSrcweir ScAutoFormat* pAutoFormat = ScGlobal::GetAutoFormat();
5523cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5524cdf0e10cSrcweir if ( pDocSh && pAutoFormat )
5525cdf0e10cSrcweir {
5526cdf0e10cSrcweir String aNameString(aName);
5527cdf0e10cSrcweir sal_uInt16 nCount = pAutoFormat->GetCount();
5528cdf0e10cSrcweir sal_uInt16 nIndex;
5529cdf0e10cSrcweir String aCompare;
5530cdf0e10cSrcweir for (nIndex=0; nIndex<nCount; nIndex++)
5531cdf0e10cSrcweir {
5532cdf0e10cSrcweir (*pAutoFormat)[nIndex]->GetName(aCompare);
5533*dcaf07f7SJohn Bampton if ( aCompare == aNameString ) //! Case-insensitive ???
5534cdf0e10cSrcweir break;
5535cdf0e10cSrcweir }
5536cdf0e10cSrcweir if (nIndex<nCount)
5537cdf0e10cSrcweir {
5538cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
5539cdf0e10cSrcweir aFunc.AutoFormat( aRange, NULL, nIndex, sal_True, sal_True );
5540cdf0e10cSrcweir }
5541cdf0e10cSrcweir else
5542cdf0e10cSrcweir throw lang::IllegalArgumentException();
5543cdf0e10cSrcweir }
5544cdf0e10cSrcweir }
5545cdf0e10cSrcweir
5546cdf0e10cSrcweir // XSortable
5547cdf0e10cSrcweir
createSortDescriptor()5548cdf0e10cSrcweir uno::Sequence<beans::PropertyValue> SAL_CALL ScCellRangeObj::createSortDescriptor()
5549cdf0e10cSrcweir throw(uno::RuntimeException)
5550cdf0e10cSrcweir {
5551cdf0e10cSrcweir ScUnoGuard aGuard;
5552cdf0e10cSrcweir ScSortParam aParam;
5553cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5554cdf0e10cSrcweir if ( pDocSh )
5555cdf0e10cSrcweir {
5556cdf0e10cSrcweir // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich
5557cdf0e10cSrcweir ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK );
5558cdf0e10cSrcweir if (pData)
5559cdf0e10cSrcweir {
5560cdf0e10cSrcweir pData->GetSortParam(aParam);
5561cdf0e10cSrcweir
5562cdf0e10cSrcweir // im SortDescriptor sind die Fields innerhalb des Bereichs gezaehlt
5563cdf0e10cSrcweir ScRange aDBRange;
5564cdf0e10cSrcweir pData->GetArea(aDBRange);
5565cdf0e10cSrcweir SCCOLROW nFieldStart = aParam.bByRow ?
5566cdf0e10cSrcweir static_cast<SCCOLROW>(aDBRange.aStart.Col()) :
5567cdf0e10cSrcweir static_cast<SCCOLROW>(aDBRange.aStart.Row());
5568cdf0e10cSrcweir for (sal_uInt16 i=0; i<MAXSORT; i++)
5569cdf0e10cSrcweir if ( aParam.bDoSort[i] && aParam.nField[i] >= nFieldStart )
5570cdf0e10cSrcweir aParam.nField[i] -= nFieldStart;
5571cdf0e10cSrcweir }
5572cdf0e10cSrcweir }
5573cdf0e10cSrcweir
5574cdf0e10cSrcweir uno::Sequence<beans::PropertyValue> aSeq( ScSortDescriptor::GetPropertyCount() );
5575cdf0e10cSrcweir ScSortDescriptor::FillProperties( aSeq, aParam );
5576cdf0e10cSrcweir return aSeq;
5577cdf0e10cSrcweir }
5578cdf0e10cSrcweir
sort(const uno::Sequence<beans::PropertyValue> & aDescriptor)5579cdf0e10cSrcweir void SAL_CALL ScCellRangeObj::sort( const uno::Sequence<beans::PropertyValue>& aDescriptor )
5580cdf0e10cSrcweir throw(uno::RuntimeException)
5581cdf0e10cSrcweir {
5582cdf0e10cSrcweir ScUnoGuard aGuard;
5583cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5584cdf0e10cSrcweir if (pDocSh)
5585cdf0e10cSrcweir {
5586cdf0e10cSrcweir sal_uInt16 i;
5587cdf0e10cSrcweir ScSortParam aParam;
5588cdf0e10cSrcweir ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen
5589cdf0e10cSrcweir if (pData)
5590cdf0e10cSrcweir {
5591cdf0e10cSrcweir // alten Einstellungen holen, falls nicht alles neu gesetzt wird
5592cdf0e10cSrcweir pData->GetSortParam(aParam);
5593cdf0e10cSrcweir SCCOLROW nOldStart = aParam.bByRow ?
5594cdf0e10cSrcweir static_cast<SCCOLROW>(aRange.aStart.Col()) :
5595cdf0e10cSrcweir static_cast<SCCOLROW>(aRange.aStart.Row());
5596cdf0e10cSrcweir for (i=0; i<MAXSORT; i++)
5597cdf0e10cSrcweir if ( aParam.bDoSort[i] && aParam.nField[i] >= nOldStart )
5598cdf0e10cSrcweir aParam.nField[i] -= nOldStart;
5599cdf0e10cSrcweir }
5600cdf0e10cSrcweir
5601cdf0e10cSrcweir ScSortDescriptor::FillSortParam( aParam, aDescriptor );
5602cdf0e10cSrcweir
5603cdf0e10cSrcweir // im SortDescriptor sind die Fields innerhalb des Bereichs gezaehlt
5604cdf0e10cSrcweir // ByRow kann bei FillSortParam umgesetzt worden sein
5605cdf0e10cSrcweir SCCOLROW nFieldStart = aParam.bByRow ?
5606cdf0e10cSrcweir static_cast<SCCOLROW>(aRange.aStart.Col()) :
5607cdf0e10cSrcweir static_cast<SCCOLROW>(aRange.aStart.Row());
5608cdf0e10cSrcweir for (i=0; i<MAXSORT; i++)
5609cdf0e10cSrcweir aParam.nField[i] += nFieldStart;
5610cdf0e10cSrcweir
5611cdf0e10cSrcweir SCTAB nTab = aRange.aStart.Tab();
5612cdf0e10cSrcweir aParam.nCol1 = aRange.aStart.Col();
5613cdf0e10cSrcweir aParam.nRow1 = aRange.aStart.Row();
5614cdf0e10cSrcweir aParam.nCol2 = aRange.aEnd.Col();
5615cdf0e10cSrcweir aParam.nRow2 = aRange.aEnd.Row();
5616cdf0e10cSrcweir
5617cdf0e10cSrcweir pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen
5618cdf0e10cSrcweir
5619cdf0e10cSrcweir ScDBDocFunc aFunc(*pDocSh); // Bereich muss angelegt sein
5620cdf0e10cSrcweir aFunc.Sort( nTab, aParam, sal_True, sal_True, sal_True );
5621cdf0e10cSrcweir }
5622cdf0e10cSrcweir }
5623cdf0e10cSrcweir
5624cdf0e10cSrcweir // XFilterable
5625cdf0e10cSrcweir
createFilterDescriptor(sal_Bool bEmpty)5626cdf0e10cSrcweir uno::Reference<sheet::XSheetFilterDescriptor> SAL_CALL ScCellRangeObj::createFilterDescriptor(
5627cdf0e10cSrcweir sal_Bool bEmpty ) throw(uno::RuntimeException)
5628cdf0e10cSrcweir {
5629cdf0e10cSrcweir ScUnoGuard aGuard;
5630cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5631cdf0e10cSrcweir ScFilterDescriptor* pNew = new ScFilterDescriptor(pDocSh);
5632cdf0e10cSrcweir if ( !bEmpty && pDocSh )
5633cdf0e10cSrcweir {
5634cdf0e10cSrcweir // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich
5635cdf0e10cSrcweir ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK );
5636cdf0e10cSrcweir if (pData)
5637cdf0e10cSrcweir {
5638cdf0e10cSrcweir ScQueryParam aParam;
5639cdf0e10cSrcweir pData->GetQueryParam(aParam);
5640cdf0e10cSrcweir // im FilterDescriptor sind die Fields innerhalb des Bereichs gezaehlt
5641cdf0e10cSrcweir ScRange aDBRange;
5642cdf0e10cSrcweir pData->GetArea(aDBRange);
5643cdf0e10cSrcweir SCCOLROW nFieldStart = aParam.bByRow ?
5644cdf0e10cSrcweir static_cast<SCCOLROW>(aDBRange.aStart.Col()) :
5645cdf0e10cSrcweir static_cast<SCCOLROW>(aDBRange.aStart.Row());
5646cdf0e10cSrcweir SCSIZE nCount = aParam.GetEntryCount();
5647cdf0e10cSrcweir for (SCSIZE i=0; i<nCount; i++)
5648cdf0e10cSrcweir {
5649cdf0e10cSrcweir ScQueryEntry& rEntry = aParam.GetEntry(i);
5650cdf0e10cSrcweir if (rEntry.bDoQuery && rEntry.nField >= nFieldStart)
5651cdf0e10cSrcweir rEntry.nField -= nFieldStart;
5652cdf0e10cSrcweir }
5653cdf0e10cSrcweir pNew->SetParam(aParam);
5654cdf0e10cSrcweir }
5655cdf0e10cSrcweir }
5656cdf0e10cSrcweir return pNew;
5657cdf0e10cSrcweir }
5658cdf0e10cSrcweir
filter(const uno::Reference<sheet::XSheetFilterDescriptor> & xDescriptor)5659cdf0e10cSrcweir void SAL_CALL ScCellRangeObj::filter( const uno::Reference<sheet::XSheetFilterDescriptor>& xDescriptor )
5660cdf0e10cSrcweir throw(uno::RuntimeException)
5661cdf0e10cSrcweir {
5662cdf0e10cSrcweir ScUnoGuard aGuard;
5663cdf0e10cSrcweir
5664cdf0e10cSrcweir // das koennte theoretisch ein fremdes Objekt sein, also nur das
5665cdf0e10cSrcweir // oeffentliche XSheetFilterDescriptor Interface benutzen, um
5666cdf0e10cSrcweir // die Daten in ein ScFilterDescriptor Objekt zu kopieren:
5667cdf0e10cSrcweir //! wenn es schon ein ScFilterDescriptor ist, direkt per getImplementation?
5668cdf0e10cSrcweir
5669cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5670cdf0e10cSrcweir ScFilterDescriptor aImpl(pDocSh);
5671cdf0e10cSrcweir uno::Reference< sheet::XSheetFilterDescriptor2 > xDescriptor2( xDescriptor, uno::UNO_QUERY );
5672cdf0e10cSrcweir if ( xDescriptor2.is() )
5673cdf0e10cSrcweir {
5674cdf0e10cSrcweir aImpl.setFilterFields2( xDescriptor2->getFilterFields2() );
5675cdf0e10cSrcweir }
5676cdf0e10cSrcweir else
5677cdf0e10cSrcweir {
5678cdf0e10cSrcweir aImpl.setFilterFields( xDescriptor->getFilterFields() );
5679cdf0e10cSrcweir }
5680cdf0e10cSrcweir // Rest sind jetzt Properties...
5681cdf0e10cSrcweir
5682cdf0e10cSrcweir uno::Reference<beans::XPropertySet> xPropSet( xDescriptor, uno::UNO_QUERY );
5683cdf0e10cSrcweir if (xPropSet.is())
5684cdf0e10cSrcweir lcl_CopyProperties( aImpl, *(beans::XPropertySet*)xPropSet.get() );
5685cdf0e10cSrcweir
5686cdf0e10cSrcweir //
5687cdf0e10cSrcweir // ausfuehren...
5688cdf0e10cSrcweir //
5689cdf0e10cSrcweir
5690cdf0e10cSrcweir if (pDocSh)
5691cdf0e10cSrcweir {
5692cdf0e10cSrcweir ScQueryParam aParam = aImpl.GetParam();
5693cdf0e10cSrcweir // im FilterDescriptor sind die Fields innerhalb des Bereichs gezaehlt
5694cdf0e10cSrcweir SCCOLROW nFieldStart = aParam.bByRow ?
5695cdf0e10cSrcweir static_cast<SCCOLROW>(aRange.aStart.Col()) :
5696cdf0e10cSrcweir static_cast<SCCOLROW>(aRange.aStart.Row());
5697cdf0e10cSrcweir SCSIZE nCount = aParam.GetEntryCount();
5698cdf0e10cSrcweir for (SCSIZE i=0; i<nCount; i++)
5699cdf0e10cSrcweir {
5700cdf0e10cSrcweir ScQueryEntry& rEntry = aParam.GetEntry(i);
5701cdf0e10cSrcweir if (rEntry.bDoQuery)
5702cdf0e10cSrcweir {
5703cdf0e10cSrcweir rEntry.nField += nFieldStart;
5704cdf0e10cSrcweir // Im Dialog wird immer der String angezeigt -> muss zum Wert passen
5705cdf0e10cSrcweir if ( !rEntry.bQueryByString )
5706cdf0e10cSrcweir pDocSh->GetDocument()->GetFormatTable()->
5707cdf0e10cSrcweir GetInputLineString( rEntry.nVal, 0, *rEntry.pStr );
5708cdf0e10cSrcweir }
5709cdf0e10cSrcweir }
5710cdf0e10cSrcweir
5711cdf0e10cSrcweir SCTAB nTab = aRange.aStart.Tab();
5712cdf0e10cSrcweir aParam.nCol1 = aRange.aStart.Col();
5713cdf0e10cSrcweir aParam.nRow1 = aRange.aStart.Row();
5714cdf0e10cSrcweir aParam.nCol2 = aRange.aEnd.Col();
5715cdf0e10cSrcweir aParam.nRow2 = aRange.aEnd.Row();
5716cdf0e10cSrcweir
5717cdf0e10cSrcweir pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen
5718cdf0e10cSrcweir
5719cdf0e10cSrcweir //! keep source range in filter descriptor
5720cdf0e10cSrcweir //! if created by createFilterDescriptorByObject ???
5721cdf0e10cSrcweir
5722cdf0e10cSrcweir ScDBDocFunc aFunc(*pDocSh);
5723cdf0e10cSrcweir aFunc.Query( nTab, aParam, NULL, sal_True, sal_True ); // Bereich muss angelegt sein
5724cdf0e10cSrcweir }
5725cdf0e10cSrcweir }
5726cdf0e10cSrcweir
5727cdf0e10cSrcweir //! get/setAutoFilter als Properties!!!
5728cdf0e10cSrcweir
5729cdf0e10cSrcweir // XAdvancedFilterSource
5730cdf0e10cSrcweir
createFilterDescriptorByObject(const uno::Reference<sheet::XSheetFilterable> & xObject)5731cdf0e10cSrcweir uno::Reference<sheet::XSheetFilterDescriptor> SAL_CALL ScCellRangeObj::createFilterDescriptorByObject(
5732cdf0e10cSrcweir const uno::Reference<sheet::XSheetFilterable>& xObject )
5733cdf0e10cSrcweir throw(uno::RuntimeException)
5734cdf0e10cSrcweir {
5735cdf0e10cSrcweir ScUnoGuard aGuard;
5736cdf0e10cSrcweir
5737cdf0e10cSrcweir // this ist hier nicht der Bereich, der gefiltert wird, sondern der
5738cdf0e10cSrcweir // Bereich mit der Abfrage...
5739cdf0e10cSrcweir
5740cdf0e10cSrcweir uno::Reference<sheet::XCellRangeAddressable> xAddr( xObject, uno::UNO_QUERY );
5741cdf0e10cSrcweir
5742cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5743cdf0e10cSrcweir if ( pDocSh && xAddr.is() )
5744cdf0e10cSrcweir {
5745cdf0e10cSrcweir //! Test, ob xObject im selben Dokument ist
5746cdf0e10cSrcweir
5747cdf0e10cSrcweir ScFilterDescriptor* pNew = new ScFilterDescriptor(pDocSh); //! stattdessen vom Objekt?
5748cdf0e10cSrcweir //XSheetFilterDescriptorRef xNew = xObject->createFilterDescriptor(sal_True);
5749cdf0e10cSrcweir
5750cdf0e10cSrcweir ScQueryParam aParam = pNew->GetParam();
5751cdf0e10cSrcweir aParam.bHasHeader = sal_True;
5752cdf0e10cSrcweir
5753cdf0e10cSrcweir table::CellRangeAddress aDataAddress(xAddr->getRangeAddress());
5754cdf0e10cSrcweir aParam.nCol1 = (SCCOL)aDataAddress.StartColumn;
5755cdf0e10cSrcweir aParam.nRow1 = (SCROW)aDataAddress.StartRow;
5756cdf0e10cSrcweir aParam.nCol2 = (SCCOL)aDataAddress.EndColumn;
5757cdf0e10cSrcweir aParam.nRow2 = (SCROW)aDataAddress.EndRow;
5758cdf0e10cSrcweir aParam.nTab = aDataAddress.Sheet;
5759cdf0e10cSrcweir
5760cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
5761cdf0e10cSrcweir sal_Bool bOk = pDoc->CreateQueryParam(
5762cdf0e10cSrcweir aRange.aStart.Col(), aRange.aStart.Row(),
5763cdf0e10cSrcweir aRange.aEnd.Col(), aRange.aEnd.Row(),
5764cdf0e10cSrcweir aRange.aStart.Tab(), aParam );
5765cdf0e10cSrcweir if ( bOk )
5766cdf0e10cSrcweir {
5767cdf0e10cSrcweir // im FilterDescriptor sind die Fields innerhalb des Bereichs gezaehlt
5768cdf0e10cSrcweir SCCOLROW nFieldStart = aParam.bByRow ?
5769cdf0e10cSrcweir static_cast<SCCOLROW>(aDataAddress.StartColumn) :
5770cdf0e10cSrcweir static_cast<SCCOLROW>(aDataAddress.StartRow);
5771cdf0e10cSrcweir SCSIZE nCount = aParam.GetEntryCount();
5772cdf0e10cSrcweir for (SCSIZE i=0; i<nCount; i++)
5773cdf0e10cSrcweir {
5774cdf0e10cSrcweir ScQueryEntry& rEntry = aParam.GetEntry(i);
5775cdf0e10cSrcweir if (rEntry.bDoQuery && rEntry.nField >= nFieldStart)
5776cdf0e10cSrcweir rEntry.nField -= nFieldStart;
5777cdf0e10cSrcweir }
5778cdf0e10cSrcweir
5779cdf0e10cSrcweir pNew->SetParam( aParam );
5780cdf0e10cSrcweir return pNew;
5781cdf0e10cSrcweir }
5782cdf0e10cSrcweir else
5783cdf0e10cSrcweir {
5784cdf0e10cSrcweir delete pNew;
5785cdf0e10cSrcweir return NULL; // ungueltig -> null
5786cdf0e10cSrcweir }
5787cdf0e10cSrcweir }
5788cdf0e10cSrcweir
5789cdf0e10cSrcweir DBG_ERROR("kein Dokument oder kein Bereich");
5790cdf0e10cSrcweir return NULL;
5791cdf0e10cSrcweir }
5792cdf0e10cSrcweir
5793cdf0e10cSrcweir // XSubTotalSource
5794cdf0e10cSrcweir
createSubTotalDescriptor(sal_Bool bEmpty)5795cdf0e10cSrcweir uno::Reference<sheet::XSubTotalDescriptor> SAL_CALL ScCellRangeObj::createSubTotalDescriptor(
5796cdf0e10cSrcweir sal_Bool bEmpty ) throw(uno::RuntimeException)
5797cdf0e10cSrcweir {
5798cdf0e10cSrcweir ScUnoGuard aGuard;
5799cdf0e10cSrcweir ScSubTotalDescriptor* pNew = new ScSubTotalDescriptor;
5800cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5801cdf0e10cSrcweir if ( !bEmpty && pDocSh )
5802cdf0e10cSrcweir {
5803cdf0e10cSrcweir // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich
5804cdf0e10cSrcweir ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK );
5805cdf0e10cSrcweir if (pData)
5806cdf0e10cSrcweir {
5807cdf0e10cSrcweir ScSubTotalParam aParam;
5808cdf0e10cSrcweir pData->GetSubTotalParam(aParam);
5809cdf0e10cSrcweir // im SubTotalDescriptor sind die Fields innerhalb des Bereichs gezaehlt
5810cdf0e10cSrcweir ScRange aDBRange;
5811cdf0e10cSrcweir pData->GetArea(aDBRange);
5812cdf0e10cSrcweir SCCOL nFieldStart = aDBRange.aStart.Col();
5813cdf0e10cSrcweir for (sal_uInt16 i=0; i<MAXSUBTOTAL; i++)
5814cdf0e10cSrcweir {
5815cdf0e10cSrcweir if ( aParam.bGroupActive[i] )
5816cdf0e10cSrcweir {
5817cdf0e10cSrcweir if ( aParam.nField[i] >= nFieldStart )
5818cdf0e10cSrcweir aParam.nField[i] = sal::static_int_cast<SCCOL>( aParam.nField[i] - nFieldStart );
5819cdf0e10cSrcweir for (SCCOL j=0; j<aParam.nSubTotals[i]; j++)
5820cdf0e10cSrcweir if ( aParam.pSubTotals[i][j] >= nFieldStart )
5821cdf0e10cSrcweir aParam.pSubTotals[i][j] = sal::static_int_cast<SCCOL>( aParam.pSubTotals[i][j] - nFieldStart );
5822cdf0e10cSrcweir }
5823cdf0e10cSrcweir }
5824cdf0e10cSrcweir pNew->SetParam(aParam);
5825cdf0e10cSrcweir }
5826cdf0e10cSrcweir }
5827cdf0e10cSrcweir return pNew;
5828cdf0e10cSrcweir }
5829cdf0e10cSrcweir
applySubTotals(const uno::Reference<sheet::XSubTotalDescriptor> & xDescriptor,sal_Bool bReplace)5830cdf0e10cSrcweir void SAL_CALL ScCellRangeObj::applySubTotals(
5831cdf0e10cSrcweir const uno::Reference<sheet::XSubTotalDescriptor>& xDescriptor,
5832cdf0e10cSrcweir sal_Bool bReplace ) throw(uno::RuntimeException)
5833cdf0e10cSrcweir {
5834cdf0e10cSrcweir ScUnoGuard aGuard;
5835cdf0e10cSrcweir
5836cdf0e10cSrcweir if (!xDescriptor.is()) return;
5837cdf0e10cSrcweir
5838cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5839cdf0e10cSrcweir ScSubTotalDescriptorBase* pImp =
5840cdf0e10cSrcweir ScSubTotalDescriptorBase::getImplementation( xDescriptor );
5841cdf0e10cSrcweir
5842cdf0e10cSrcweir if (pDocSh && pImp)
5843cdf0e10cSrcweir {
5844cdf0e10cSrcweir ScSubTotalParam aParam;
5845cdf0e10cSrcweir pImp->GetData(aParam); // virtuelle Methode der Basisklasse
5846cdf0e10cSrcweir
5847cdf0e10cSrcweir // im SubTotalDescriptor sind die Fields innerhalb des Bereichs gezaehlt
5848cdf0e10cSrcweir SCCOL nFieldStart = aRange.aStart.Col();
5849cdf0e10cSrcweir for (sal_uInt16 i=0; i<MAXSUBTOTAL; i++)
5850cdf0e10cSrcweir {
5851cdf0e10cSrcweir if ( aParam.bGroupActive[i] )
5852cdf0e10cSrcweir {
5853cdf0e10cSrcweir aParam.nField[i] = sal::static_int_cast<SCCOL>( aParam.nField[i] + nFieldStart );
5854cdf0e10cSrcweir for (SCCOL j=0; j<aParam.nSubTotals[i]; j++)
5855cdf0e10cSrcweir aParam.pSubTotals[i][j] = sal::static_int_cast<SCCOL>( aParam.pSubTotals[i][j] + nFieldStart );
5856cdf0e10cSrcweir }
5857cdf0e10cSrcweir }
5858cdf0e10cSrcweir
5859cdf0e10cSrcweir aParam.bReplace = bReplace;
5860cdf0e10cSrcweir
5861cdf0e10cSrcweir SCTAB nTab = aRange.aStart.Tab();
5862cdf0e10cSrcweir aParam.nCol1 = aRange.aStart.Col();
5863cdf0e10cSrcweir aParam.nRow1 = aRange.aStart.Row();
5864cdf0e10cSrcweir aParam.nCol2 = aRange.aEnd.Col();
5865cdf0e10cSrcweir aParam.nRow2 = aRange.aEnd.Row();
5866cdf0e10cSrcweir
5867cdf0e10cSrcweir pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen
5868cdf0e10cSrcweir
5869cdf0e10cSrcweir ScDBDocFunc aFunc(*pDocSh);
5870cdf0e10cSrcweir aFunc.DoSubTotals( nTab, aParam, NULL, sal_True, sal_True ); // Bereich muss angelegt sein
5871cdf0e10cSrcweir }
5872cdf0e10cSrcweir }
5873cdf0e10cSrcweir
removeSubTotals()5874cdf0e10cSrcweir void SAL_CALL ScCellRangeObj::removeSubTotals() throw(uno::RuntimeException)
5875cdf0e10cSrcweir {
5876cdf0e10cSrcweir ScUnoGuard aGuard;
5877cdf0e10cSrcweir
5878cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5879cdf0e10cSrcweir if (pDocSh)
5880cdf0e10cSrcweir {
5881cdf0e10cSrcweir ScSubTotalParam aParam;
5882cdf0e10cSrcweir ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK );
5883cdf0e10cSrcweir if (pData)
5884cdf0e10cSrcweir pData->GetSubTotalParam(aParam); // auch bei Remove die Feld-Eintraege behalten
5885cdf0e10cSrcweir
5886cdf0e10cSrcweir aParam.bRemoveOnly = sal_True;
5887cdf0e10cSrcweir
5888cdf0e10cSrcweir SCTAB nTab = aRange.aStart.Tab();
5889cdf0e10cSrcweir aParam.nCol1 = aRange.aStart.Col();
5890cdf0e10cSrcweir aParam.nRow1 = aRange.aStart.Row();
5891cdf0e10cSrcweir aParam.nCol2 = aRange.aEnd.Col();
5892cdf0e10cSrcweir aParam.nRow2 = aRange.aEnd.Row();
5893cdf0e10cSrcweir
5894cdf0e10cSrcweir pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen
5895cdf0e10cSrcweir
5896cdf0e10cSrcweir ScDBDocFunc aFunc(*pDocSh);
5897cdf0e10cSrcweir aFunc.DoSubTotals( nTab, aParam, NULL, sal_True, sal_True ); // Bereich muss angelegt sein
5898cdf0e10cSrcweir }
5899cdf0e10cSrcweir }
5900cdf0e10cSrcweir
createImportDescriptor(sal_Bool bEmpty)5901cdf0e10cSrcweir uno::Sequence<beans::PropertyValue> SAL_CALL ScCellRangeObj::createImportDescriptor( sal_Bool bEmpty )
5902cdf0e10cSrcweir throw(uno::RuntimeException)
5903cdf0e10cSrcweir {
5904cdf0e10cSrcweir ScUnoGuard aGuard;
5905cdf0e10cSrcweir ScImportParam aParam;
5906cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5907cdf0e10cSrcweir if ( !bEmpty && pDocSh )
5908cdf0e10cSrcweir {
5909cdf0e10cSrcweir // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich
5910cdf0e10cSrcweir ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK );
5911cdf0e10cSrcweir if (pData)
5912cdf0e10cSrcweir pData->GetImportParam(aParam);
5913cdf0e10cSrcweir }
5914cdf0e10cSrcweir
5915cdf0e10cSrcweir uno::Sequence<beans::PropertyValue> aSeq( ScImportDescriptor::GetPropertyCount() );
5916cdf0e10cSrcweir ScImportDescriptor::FillProperties( aSeq, aParam );
5917cdf0e10cSrcweir return aSeq;
5918cdf0e10cSrcweir }
5919cdf0e10cSrcweir
doImport(const uno::Sequence<beans::PropertyValue> & aDescriptor)5920cdf0e10cSrcweir void SAL_CALL ScCellRangeObj::doImport( const uno::Sequence<beans::PropertyValue>& aDescriptor )
5921cdf0e10cSrcweir throw(uno::RuntimeException)
5922cdf0e10cSrcweir {
5923cdf0e10cSrcweir ScUnoGuard aGuard;
5924cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5925cdf0e10cSrcweir if (pDocSh)
5926cdf0e10cSrcweir {
5927cdf0e10cSrcweir ScImportParam aParam;
5928cdf0e10cSrcweir ScImportDescriptor::FillImportParam( aParam, aDescriptor );
5929cdf0e10cSrcweir
5930cdf0e10cSrcweir SCTAB nTab = aRange.aStart.Tab();
5931cdf0e10cSrcweir aParam.nCol1 = aRange.aStart.Col();
5932cdf0e10cSrcweir aParam.nRow1 = aRange.aStart.Row();
5933cdf0e10cSrcweir aParam.nCol2 = aRange.aEnd.Col();
5934cdf0e10cSrcweir aParam.nRow2 = aRange.aEnd.Row();
5935cdf0e10cSrcweir
5936cdf0e10cSrcweir //! TODO: could we get passed a valid result set by any means?
5937cdf0e10cSrcweir
5938cdf0e10cSrcweir pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen
5939cdf0e10cSrcweir
5940cdf0e10cSrcweir ScDBDocFunc aFunc(*pDocSh); // Bereich muss angelegt sein
5941cdf0e10cSrcweir aFunc.DoImport( nTab, aParam, NULL, sal_True ); //! Api-Flag as parameter
5942cdf0e10cSrcweir }
5943cdf0e10cSrcweir }
5944cdf0e10cSrcweir
5945cdf0e10cSrcweir // XCellFormatRangesSupplier
5946cdf0e10cSrcweir
getCellFormatRanges()5947cdf0e10cSrcweir uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangeObj::getCellFormatRanges()
5948cdf0e10cSrcweir throw(uno::RuntimeException)
5949cdf0e10cSrcweir {
5950cdf0e10cSrcweir ScUnoGuard aGuard;
5951cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5952cdf0e10cSrcweir if ( pDocSh )
5953cdf0e10cSrcweir return new ScCellFormatsObj( pDocSh, aRange );
5954cdf0e10cSrcweir return NULL;
5955cdf0e10cSrcweir }
5956cdf0e10cSrcweir
5957cdf0e10cSrcweir // XUniqueCellFormatRangesSupplier
5958cdf0e10cSrcweir
getUniqueCellFormatRanges()5959cdf0e10cSrcweir uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangeObj::getUniqueCellFormatRanges()
5960cdf0e10cSrcweir throw(uno::RuntimeException)
5961cdf0e10cSrcweir {
5962cdf0e10cSrcweir ScUnoGuard aGuard;
5963cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5964cdf0e10cSrcweir if ( pDocSh )
5965cdf0e10cSrcweir return new ScUniqueCellFormatsObj( pDocSh, aRange );
5966cdf0e10cSrcweir return NULL;
5967cdf0e10cSrcweir }
5968cdf0e10cSrcweir
5969cdf0e10cSrcweir // XPropertySet erweitert fuer Range-Properties
5970cdf0e10cSrcweir
getPropertySetInfo()5971cdf0e10cSrcweir uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCellRangeObj::getPropertySetInfo()
5972cdf0e10cSrcweir throw(uno::RuntimeException)
5973cdf0e10cSrcweir {
5974cdf0e10cSrcweir ScUnoGuard aGuard;
5975cdf0e10cSrcweir static uno::Reference<beans::XPropertySetInfo> aRef(
5976cdf0e10cSrcweir new SfxItemPropertySetInfo( pRangePropSet->getPropertyMap() ));
5977cdf0e10cSrcweir return aRef;
5978cdf0e10cSrcweir }
5979cdf0e10cSrcweir
SetOnePropertyValue(const SfxItemPropertySimpleEntry * pEntry,const uno::Any & aValue)5980cdf0e10cSrcweir void ScCellRangeObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
5981cdf0e10cSrcweir throw(lang::IllegalArgumentException, uno::RuntimeException)
5982cdf0e10cSrcweir {
5983cdf0e10cSrcweir // Range has only Position and Size in addition to ScCellRangesBase, both are ReadOnly
5984cdf0e10cSrcweir // -> nothing to do here
5985cdf0e10cSrcweir
5986cdf0e10cSrcweir ScCellRangesBase::SetOnePropertyValue( pEntry, aValue );
5987cdf0e10cSrcweir }
5988cdf0e10cSrcweir
GetOnePropertyValue(const SfxItemPropertySimpleEntry * pEntry,uno::Any & rAny)5989cdf0e10cSrcweir void ScCellRangeObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
5990cdf0e10cSrcweir uno::Any& rAny )
5991cdf0e10cSrcweir throw(uno::RuntimeException)
5992cdf0e10cSrcweir {
5993cdf0e10cSrcweir if ( pEntry )
5994cdf0e10cSrcweir {
5995cdf0e10cSrcweir if ( pEntry->nWID == SC_WID_UNO_POS )
5996cdf0e10cSrcweir {
5997cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
5998cdf0e10cSrcweir if (pDocSh)
5999cdf0e10cSrcweir {
6000cdf0e10cSrcweir // GetMMRect converts using HMM_PER_TWIPS, like the DrawingLayer
6001cdf0e10cSrcweir Rectangle aMMRect(pDocSh->GetDocument()->GetMMRect(
6002cdf0e10cSrcweir aRange.aStart.Col(), aRange.aStart.Row(),
6003cdf0e10cSrcweir aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab() ));
6004cdf0e10cSrcweir awt::Point aPos( aMMRect.Left(), aMMRect.Top() );
6005cdf0e10cSrcweir rAny <<= aPos;
6006cdf0e10cSrcweir }
6007cdf0e10cSrcweir }
6008cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_SIZE )
6009cdf0e10cSrcweir {
6010cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
6011cdf0e10cSrcweir if (pDocSh)
6012cdf0e10cSrcweir {
6013cdf0e10cSrcweir // GetMMRect converts using HMM_PER_TWIPS, like the DrawingLayer
6014cdf0e10cSrcweir Rectangle aMMRect = pDocSh->GetDocument()->GetMMRect(
6015cdf0e10cSrcweir aRange.aStart.Col(), aRange.aStart.Row(),
6016cdf0e10cSrcweir aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab() );
6017cdf0e10cSrcweir Size aSize(aMMRect.GetSize());
6018cdf0e10cSrcweir awt::Size aAwtSize( aSize.Width(), aSize.Height() );
6019cdf0e10cSrcweir rAny <<= aAwtSize;
6020cdf0e10cSrcweir }
6021cdf0e10cSrcweir }
6022cdf0e10cSrcweir else
6023cdf0e10cSrcweir ScCellRangesBase::GetOnePropertyValue( pEntry, rAny );
6024cdf0e10cSrcweir
6025cdf0e10cSrcweir }
6026cdf0e10cSrcweir }
6027cdf0e10cSrcweir
GetItemPropertyMap()6028cdf0e10cSrcweir const SfxItemPropertyMap* ScCellRangeObj::GetItemPropertyMap()
6029cdf0e10cSrcweir {
6030cdf0e10cSrcweir return pRangePropSet->getPropertyMap();
6031cdf0e10cSrcweir }
6032cdf0e10cSrcweir
6033cdf0e10cSrcweir // XServiceInfo
6034cdf0e10cSrcweir
getImplementationName()6035cdf0e10cSrcweir rtl::OUString SAL_CALL ScCellRangeObj::getImplementationName() throw(uno::RuntimeException)
6036cdf0e10cSrcweir {
6037cdf0e10cSrcweir return rtl::OUString::createFromAscii( "ScCellRangeObj" );
6038cdf0e10cSrcweir }
6039cdf0e10cSrcweir
supportsService(const rtl::OUString & rServiceName)6040cdf0e10cSrcweir sal_Bool SAL_CALL ScCellRangeObj::supportsService( const rtl::OUString& rServiceName )
6041cdf0e10cSrcweir throw(uno::RuntimeException)
6042cdf0e10cSrcweir {
6043cdf0e10cSrcweir String aServiceStr( rServiceName );
6044cdf0e10cSrcweir return aServiceStr.EqualsAscii( SCSHEETCELLRANGE_SERVICE ) ||
6045cdf0e10cSrcweir aServiceStr.EqualsAscii( SCCELLRANGE_SERVICE ) ||
6046cdf0e10cSrcweir aServiceStr.EqualsAscii( SCCELLPROPERTIES_SERVICE ) ||
6047cdf0e10cSrcweir aServiceStr.EqualsAscii( SCCHARPROPERTIES_SERVICE ) ||
6048cdf0e10cSrcweir aServiceStr.EqualsAscii( SCPARAPROPERTIES_SERVICE );
6049cdf0e10cSrcweir }
6050cdf0e10cSrcweir
getSupportedServiceNames()6051cdf0e10cSrcweir uno::Sequence<rtl::OUString> SAL_CALL ScCellRangeObj::getSupportedServiceNames()
6052cdf0e10cSrcweir throw(uno::RuntimeException)
6053cdf0e10cSrcweir {
6054cdf0e10cSrcweir uno::Sequence<rtl::OUString> aRet(5);
6055cdf0e10cSrcweir rtl::OUString* pArray = aRet.getArray();
6056cdf0e10cSrcweir pArray[0] = rtl::OUString::createFromAscii( SCSHEETCELLRANGE_SERVICE );
6057cdf0e10cSrcweir pArray[1] = rtl::OUString::createFromAscii( SCCELLRANGE_SERVICE );
6058cdf0e10cSrcweir pArray[2] = rtl::OUString::createFromAscii( SCCELLPROPERTIES_SERVICE );
6059cdf0e10cSrcweir pArray[3] = rtl::OUString::createFromAscii( SCCHARPROPERTIES_SERVICE );
6060cdf0e10cSrcweir pArray[4] = rtl::OUString::createFromAscii( SCPARAPROPERTIES_SERVICE );
6061cdf0e10cSrcweir return aRet;
6062cdf0e10cSrcweir }
6063cdf0e10cSrcweir
6064cdf0e10cSrcweir //------------------------------------------------------------------------
6065cdf0e10cSrcweir
GetEditPropertySet()6066cdf0e10cSrcweir const SvxItemPropertySet* ScCellObj::GetEditPropertySet() // static
6067cdf0e10cSrcweir {
6068cdf0e10cSrcweir return lcl_GetEditPropertySet();
6069cdf0e10cSrcweir }
GetCellPropertyMap()6070cdf0e10cSrcweir const SfxItemPropertyMap* ScCellObj::GetCellPropertyMap()
6071cdf0e10cSrcweir {
6072cdf0e10cSrcweir return lcl_GetCellPropertySet()->getPropertyMap();
6073cdf0e10cSrcweir }
6074cdf0e10cSrcweir
ScCellObj(ScDocShell * pDocSh,const ScAddress & rP)6075cdf0e10cSrcweir ScCellObj::ScCellObj(ScDocShell* pDocSh, const ScAddress& rP) :
6076cdf0e10cSrcweir ScCellRangeObj( pDocSh, ScRange(rP,rP) ),
6077cdf0e10cSrcweir pUnoText( NULL ),
6078cdf0e10cSrcweir pCellPropSet( lcl_GetCellPropertySet() ),
6079cdf0e10cSrcweir aCellPos( rP ),
6080cdf0e10cSrcweir nActionLockCount( 0 )
6081cdf0e10cSrcweir {
6082cdf0e10cSrcweir // pUnoText is allocated on demand (GetUnoText)
6083cdf0e10cSrcweir // can't be aggregated because getString/setString is handled here
6084cdf0e10cSrcweir }
6085cdf0e10cSrcweir
GetUnoText()6086cdf0e10cSrcweir SvxUnoText& ScCellObj::GetUnoText()
6087cdf0e10cSrcweir {
6088cdf0e10cSrcweir if (!pUnoText)
6089cdf0e10cSrcweir {
6090cdf0e10cSrcweir pUnoText = new ScCellTextObj( GetDocShell(), aCellPos );
6091cdf0e10cSrcweir pUnoText->acquire();
6092cdf0e10cSrcweir if (nActionLockCount)
6093cdf0e10cSrcweir {
6094cdf0e10cSrcweir ScSharedCellEditSource* pEditSource =
6095cdf0e10cSrcweir static_cast<ScSharedCellEditSource*> (pUnoText->GetEditSource());
6096cdf0e10cSrcweir if (pEditSource)
6097cdf0e10cSrcweir pEditSource->SetDoUpdateData(sal_False);
6098cdf0e10cSrcweir }
6099cdf0e10cSrcweir }
6100cdf0e10cSrcweir return *pUnoText;
6101cdf0e10cSrcweir }
6102cdf0e10cSrcweir
~ScCellObj()6103cdf0e10cSrcweir ScCellObj::~ScCellObj()
6104cdf0e10cSrcweir {
6105cdf0e10cSrcweir if (pUnoText)
6106cdf0e10cSrcweir pUnoText->release();
6107cdf0e10cSrcweir }
6108cdf0e10cSrcweir
RefChanged()6109cdf0e10cSrcweir void ScCellObj::RefChanged()
6110cdf0e10cSrcweir {
6111cdf0e10cSrcweir ScCellRangeObj::RefChanged();
6112cdf0e10cSrcweir
6113cdf0e10cSrcweir const ScRangeList& rRanges = GetRangeList();
6114cdf0e10cSrcweir DBG_ASSERT(rRanges.Count() == 1, "was fuer Ranges ?!?!");
6115cdf0e10cSrcweir const ScRange* pFirst = rRanges.GetObject(0);
6116cdf0e10cSrcweir if (pFirst)
6117cdf0e10cSrcweir aCellPos = pFirst->aStart;
6118cdf0e10cSrcweir }
6119cdf0e10cSrcweir
queryInterface(const uno::Type & rType)6120cdf0e10cSrcweir uno::Any SAL_CALL ScCellObj::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException)
6121cdf0e10cSrcweir {
6122cdf0e10cSrcweir SC_QUERYINTERFACE( table::XCell )
6123cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XFormulaTokens )
6124cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XCellAddressable )
6125cdf0e10cSrcweir SC_QUERYINTERFACE( text::XText )
6126cdf0e10cSrcweir SC_QUERYINTERFACE( text::XSimpleText )
6127cdf0e10cSrcweir SC_QUERYINTERFACE( text::XTextRange )
6128cdf0e10cSrcweir SC_QUERYINTERFACE( container::XEnumerationAccess )
6129cdf0e10cSrcweir SC_QUERYINTERFACE( container::XElementAccess )
6130cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XSheetAnnotationAnchor )
6131cdf0e10cSrcweir SC_QUERYINTERFACE( text::XTextFieldsSupplier )
6132cdf0e10cSrcweir SC_QUERYINTERFACE( document::XActionLockable )
6133cdf0e10cSrcweir
6134cdf0e10cSrcweir return ScCellRangeObj::queryInterface( rType );
6135cdf0e10cSrcweir }
6136cdf0e10cSrcweir
acquire()6137cdf0e10cSrcweir void SAL_CALL ScCellObj::acquire() throw()
6138cdf0e10cSrcweir {
6139cdf0e10cSrcweir ScCellRangeObj::acquire();
6140cdf0e10cSrcweir }
6141cdf0e10cSrcweir
release()6142cdf0e10cSrcweir void SAL_CALL ScCellObj::release() throw()
6143cdf0e10cSrcweir {
6144cdf0e10cSrcweir ScCellRangeObj::release();
6145cdf0e10cSrcweir }
6146cdf0e10cSrcweir
getTypes()6147cdf0e10cSrcweir uno::Sequence<uno::Type> SAL_CALL ScCellObj::getTypes() throw(uno::RuntimeException)
6148cdf0e10cSrcweir {
6149cdf0e10cSrcweir static uno::Sequence<uno::Type> aTypes;
6150cdf0e10cSrcweir if ( aTypes.getLength() == 0 )
6151cdf0e10cSrcweir {
6152cdf0e10cSrcweir uno::Sequence<uno::Type> aParentTypes(ScCellRangeObj::getTypes());
6153cdf0e10cSrcweir long nParentLen = aParentTypes.getLength();
6154cdf0e10cSrcweir const uno::Type* pParentPtr = aParentTypes.getConstArray();
6155cdf0e10cSrcweir
6156cdf0e10cSrcweir aTypes.realloc( nParentLen + 8 );
6157cdf0e10cSrcweir uno::Type* pPtr = aTypes.getArray();
6158cdf0e10cSrcweir pPtr[nParentLen + 0] = getCppuType((const uno::Reference<table::XCell>*)0);
6159cdf0e10cSrcweir pPtr[nParentLen + 1] = getCppuType((const uno::Reference<sheet::XCellAddressable>*)0);
6160cdf0e10cSrcweir pPtr[nParentLen + 2] = getCppuType((const uno::Reference<text::XText>*)0);
6161cdf0e10cSrcweir pPtr[nParentLen + 3] = getCppuType((const uno::Reference<container::XEnumerationAccess>*)0);
6162cdf0e10cSrcweir pPtr[nParentLen + 4] = getCppuType((const uno::Reference<sheet::XSheetAnnotationAnchor>*)0);
6163cdf0e10cSrcweir pPtr[nParentLen + 5] = getCppuType((const uno::Reference<text::XTextFieldsSupplier>*)0);
6164cdf0e10cSrcweir pPtr[nParentLen + 6] = getCppuType((const uno::Reference<document::XActionLockable>*)0);
6165cdf0e10cSrcweir pPtr[nParentLen + 7] = getCppuType((const uno::Reference<sheet::XFormulaTokens>*)0);
6166cdf0e10cSrcweir
6167cdf0e10cSrcweir for (long i=0; i<nParentLen; i++)
6168cdf0e10cSrcweir pPtr[i] = pParentPtr[i]; // parent types first
6169cdf0e10cSrcweir }
6170cdf0e10cSrcweir return aTypes;
6171cdf0e10cSrcweir }
6172cdf0e10cSrcweir
getImplementationId()6173cdf0e10cSrcweir uno::Sequence<sal_Int8> SAL_CALL ScCellObj::getImplementationId() throw(uno::RuntimeException)
6174cdf0e10cSrcweir {
6175cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aId;
6176cdf0e10cSrcweir if( aId.getLength() == 0 )
6177cdf0e10cSrcweir {
6178cdf0e10cSrcweir aId.realloc( 16 );
6179cdf0e10cSrcweir rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
6180cdf0e10cSrcweir }
6181cdf0e10cSrcweir return aId;
6182cdf0e10cSrcweir }
6183cdf0e10cSrcweir
6184cdf0e10cSrcweir // Hilfsfunktionen
6185cdf0e10cSrcweir
GetInputString_Impl(sal_Bool bEnglish) const6186cdf0e10cSrcweir String ScCellObj::GetInputString_Impl(sal_Bool bEnglish) const // fuer getFormula / FormulaLocal
6187cdf0e10cSrcweir {
6188cdf0e10cSrcweir if (GetDocShell())
6189cdf0e10cSrcweir return lcl_GetInputString( GetDocShell()->GetDocument(), aCellPos, bEnglish );
6190cdf0e10cSrcweir return String();
6191cdf0e10cSrcweir }
6192cdf0e10cSrcweir
GetOutputString_Impl(ScDocument * pDoc,const ScAddress & aCellPos)6193cdf0e10cSrcweir String ScCellObj::GetOutputString_Impl(ScDocument* pDoc, const ScAddress& aCellPos)
6194cdf0e10cSrcweir {
6195cdf0e10cSrcweir String aVal;
6196cdf0e10cSrcweir if ( pDoc )
6197cdf0e10cSrcweir {
6198cdf0e10cSrcweir ScBaseCell* pCell = pDoc->GetCell( aCellPos );
6199cdf0e10cSrcweir if ( pCell && pCell->GetCellType() != CELLTYPE_NOTE )
6200cdf0e10cSrcweir {
6201cdf0e10cSrcweir if ( pCell->GetCellType() == CELLTYPE_EDIT )
6202cdf0e10cSrcweir {
6203cdf0e10cSrcweir // GetString an der EditCell macht Leerzeichen aus Umbruechen,
6204cdf0e10cSrcweir // hier werden die Umbrueche aber gebraucht
6205cdf0e10cSrcweir const EditTextObject* pData = ((ScEditCell*)pCell)->GetData();
6206cdf0e10cSrcweir if (pData)
6207cdf0e10cSrcweir {
6208cdf0e10cSrcweir EditEngine& rEngine = pDoc->GetEditEngine();
6209cdf0e10cSrcweir rEngine.SetText( *pData );
6210cdf0e10cSrcweir aVal = rEngine.GetText( LINEEND_LF );
6211cdf0e10cSrcweir }
6212cdf0e10cSrcweir // Edit-Zellen auch nicht per NumberFormatter formatieren
6213cdf0e10cSrcweir // (passend zur Ausgabe)
6214cdf0e10cSrcweir }
6215cdf0e10cSrcweir else
6216cdf0e10cSrcweir {
6217cdf0e10cSrcweir // wie in GetString am Dokument (column)
6218cdf0e10cSrcweir Color* pColor;
6219cdf0e10cSrcweir sal_uLong nNumFmt = pDoc->GetNumberFormat( aCellPos );
6220cdf0e10cSrcweir ScCellFormat::GetString( pCell, nNumFmt, aVal, &pColor, *pDoc->GetFormatTable() );
6221cdf0e10cSrcweir }
6222cdf0e10cSrcweir }
6223cdf0e10cSrcweir }
6224cdf0e10cSrcweir return aVal;
6225cdf0e10cSrcweir }
6226cdf0e10cSrcweir
GetOutputString_Impl() const6227cdf0e10cSrcweir String ScCellObj::GetOutputString_Impl() const
6228cdf0e10cSrcweir {
6229cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
6230cdf0e10cSrcweir String aVal;
6231cdf0e10cSrcweir if ( pDocSh )
6232cdf0e10cSrcweir aVal = GetOutputString_Impl(pDocSh->GetDocument(), aCellPos);
6233cdf0e10cSrcweir return aVal;
6234cdf0e10cSrcweir }
6235cdf0e10cSrcweir
SetString_Impl(const String & rString,sal_Bool bInterpret,sal_Bool bEnglish)6236cdf0e10cSrcweir void ScCellObj::SetString_Impl(const String& rString, sal_Bool bInterpret, sal_Bool bEnglish)
6237cdf0e10cSrcweir {
6238cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
6239cdf0e10cSrcweir if ( pDocSh )
6240cdf0e10cSrcweir {
6241cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
6242cdf0e10cSrcweir // GRAM_PODF_A1 for API compatibility.
6243cdf0e10cSrcweir (void)aFunc.SetCellText( aCellPos, rString, bInterpret, bEnglish, sal_True, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
6244cdf0e10cSrcweir }
6245cdf0e10cSrcweir }
6246cdf0e10cSrcweir
GetValue_Impl() const6247cdf0e10cSrcweir double ScCellObj::GetValue_Impl() const
6248cdf0e10cSrcweir {
6249cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
6250cdf0e10cSrcweir if ( pDocSh )
6251cdf0e10cSrcweir return pDocSh->GetDocument()->GetValue( aCellPos );
6252cdf0e10cSrcweir
6253cdf0e10cSrcweir return 0.0;
6254cdf0e10cSrcweir }
6255cdf0e10cSrcweir
SetValue_Impl(double fValue)6256cdf0e10cSrcweir void ScCellObj::SetValue_Impl(double fValue)
6257cdf0e10cSrcweir {
6258cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
6259cdf0e10cSrcweir if ( pDocSh )
6260cdf0e10cSrcweir {
6261cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
6262cdf0e10cSrcweir (void)aFunc.PutCell( aCellPos, new ScValueCell(fValue), sal_True );
6263cdf0e10cSrcweir }
6264cdf0e10cSrcweir }
6265cdf0e10cSrcweir
6266cdf0e10cSrcweir // only for XML import
6267cdf0e10cSrcweir
SetFormulaResultString(const::rtl::OUString & rResult)6268cdf0e10cSrcweir void ScCellObj::SetFormulaResultString( const ::rtl::OUString& rResult )
6269cdf0e10cSrcweir {
6270cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
6271cdf0e10cSrcweir if ( pDocSh )
6272cdf0e10cSrcweir {
6273cdf0e10cSrcweir ScBaseCell* pCell = pDocSh->GetDocument()->GetCell( aCellPos );
6274cdf0e10cSrcweir if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA )
6275cdf0e10cSrcweir ((ScFormulaCell*)pCell)->SetHybridString( rResult );
6276cdf0e10cSrcweir }
6277cdf0e10cSrcweir }
6278cdf0e10cSrcweir
SetFormulaResultDouble(double fResult)6279cdf0e10cSrcweir void ScCellObj::SetFormulaResultDouble( double fResult )
6280cdf0e10cSrcweir {
6281cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
6282cdf0e10cSrcweir if ( pDocSh )
6283cdf0e10cSrcweir {
6284cdf0e10cSrcweir ScBaseCell* pCell = pDocSh->GetDocument()->GetCell( aCellPos );
6285cdf0e10cSrcweir if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA )
6286cdf0e10cSrcweir ((ScFormulaCell*)pCell)->SetHybridDouble( fResult );
6287cdf0e10cSrcweir }
6288cdf0e10cSrcweir }
6289cdf0e10cSrcweir
SetFormulaWithGrammar(const::rtl::OUString & rFormula,const::rtl::OUString & rFormulaNmsp,const formula::FormulaGrammar::Grammar eGrammar)6290cdf0e10cSrcweir void ScCellObj::SetFormulaWithGrammar( const ::rtl::OUString& rFormula,
6291cdf0e10cSrcweir const ::rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar )
6292cdf0e10cSrcweir {
6293cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
6294cdf0e10cSrcweir if ( pDocSh )
6295cdf0e10cSrcweir {
6296cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
6297cdf0e10cSrcweir aFunc.SetCellText( aCellPos, rFormula, sal_True, sal_True, sal_True, rFormulaNmsp, eGrammar);
6298cdf0e10cSrcweir }
6299cdf0e10cSrcweir }
6300cdf0e10cSrcweir
InputEnglishString(const::rtl::OUString & rText)6301cdf0e10cSrcweir void ScCellObj::InputEnglishString( const ::rtl::OUString& rText )
6302cdf0e10cSrcweir {
6303cdf0e10cSrcweir // This is like a mixture of setFormula and property FormulaLocal:
6304cdf0e10cSrcweir // The cell's number format is checked for "text", a new cell format may be set,
6305cdf0e10cSrcweir // but all parsing is in English.
6306cdf0e10cSrcweir
6307cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
6308cdf0e10cSrcweir if ( pDocSh )
6309cdf0e10cSrcweir {
6310cdf0e10cSrcweir String aString(rText);
6311cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
6312cdf0e10cSrcweir SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
6313cdf0e10cSrcweir sal_uInt32 nOldFormat = pDoc->GetNumberFormat( aCellPos );
6314cdf0e10cSrcweir if ( pFormatter->GetType( nOldFormat ) == NUMBERFORMAT_TEXT )
6315cdf0e10cSrcweir {
6316cdf0e10cSrcweir SetString_Impl(aString, sal_False, sal_False); // text cell
6317cdf0e10cSrcweir }
6318cdf0e10cSrcweir else
6319cdf0e10cSrcweir {
6320cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
6321cdf0e10cSrcweir short nFormatType = 0;
6322cdf0e10cSrcweir ScBaseCell* pNewCell = aFunc.InterpretEnglishString( aCellPos, aString,
6323cdf0e10cSrcweir EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1, &nFormatType );
6324cdf0e10cSrcweir if (pNewCell)
6325cdf0e10cSrcweir {
6326cdf0e10cSrcweir if ( ( nOldFormat % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 && nFormatType != 0 )
6327cdf0e10cSrcweir {
6328cdf0e10cSrcweir // apply a format for the recognized type and the old format's language
6329cdf0e10cSrcweir sal_uInt32 nNewFormat = ScGlobal::GetStandardFormat( *pFormatter, nOldFormat, nFormatType );
6330cdf0e10cSrcweir if ( nNewFormat != nOldFormat )
6331cdf0e10cSrcweir {
6332cdf0e10cSrcweir ScPatternAttr aPattern( pDoc->GetPool() );
6333cdf0e10cSrcweir aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
6334cdf0e10cSrcweir // ATTR_LANGUAGE_FORMAT remains unchanged
6335cdf0e10cSrcweir aFunc.ApplyAttributes( *GetMarkData(), aPattern, sal_True, sal_True );
6336cdf0e10cSrcweir }
6337cdf0e10cSrcweir }
6338cdf0e10cSrcweir // put the cell into the document
6339cdf0e10cSrcweir // (after applying the format, so possible formula recalculation already uses the new format)
6340cdf0e10cSrcweir (void)aFunc.PutCell( aCellPos, pNewCell, sal_True );
6341cdf0e10cSrcweir }
6342cdf0e10cSrcweir else
6343cdf0e10cSrcweir SetString_Impl(aString, sal_False, sal_False); // no cell from InterpretEnglishString, probably empty string
6344cdf0e10cSrcweir }
6345cdf0e10cSrcweir }
6346cdf0e10cSrcweir }
6347cdf0e10cSrcweir
6348cdf0e10cSrcweir // XText
6349cdf0e10cSrcweir
createTextCursor()6350cdf0e10cSrcweir uno::Reference<text::XTextCursor> SAL_CALL ScCellObj::createTextCursor()
6351cdf0e10cSrcweir throw(uno::RuntimeException)
6352cdf0e10cSrcweir {
6353cdf0e10cSrcweir ScUnoGuard aGuard;
6354cdf0e10cSrcweir return new ScCellTextCursor( *this );
6355cdf0e10cSrcweir }
6356cdf0e10cSrcweir
createTextCursorByRange(const uno::Reference<text::XTextRange> & aTextPosition)6357cdf0e10cSrcweir uno::Reference<text::XTextCursor> SAL_CALL ScCellObj::createTextCursorByRange(
6358cdf0e10cSrcweir const uno::Reference<text::XTextRange>& aTextPosition )
6359cdf0e10cSrcweir throw(uno::RuntimeException)
6360cdf0e10cSrcweir {
6361cdf0e10cSrcweir ScUnoGuard aGuard;
6362cdf0e10cSrcweir SvxUnoTextCursor* pCursor = new ScCellTextCursor( *this );
6363cdf0e10cSrcweir uno::Reference<text::XTextCursor> xCursor(pCursor);
6364cdf0e10cSrcweir
6365cdf0e10cSrcweir SvxUnoTextRangeBase* pRange = SvxUnoTextRangeBase::getImplementation( aTextPosition );
6366cdf0e10cSrcweir if(pRange)
6367cdf0e10cSrcweir pCursor->SetSelection( pRange->GetSelection() );
6368cdf0e10cSrcweir else
6369cdf0e10cSrcweir {
6370cdf0e10cSrcweir ScCellTextCursor* pOther = ScCellTextCursor::getImplementation( aTextPosition );
6371cdf0e10cSrcweir if(pOther)
6372cdf0e10cSrcweir pCursor->SetSelection( pOther->GetSelection() );
6373cdf0e10cSrcweir else
6374cdf0e10cSrcweir throw uno::RuntimeException();
6375cdf0e10cSrcweir }
6376cdf0e10cSrcweir
6377cdf0e10cSrcweir return xCursor;
6378cdf0e10cSrcweir }
6379cdf0e10cSrcweir
getString()6380cdf0e10cSrcweir rtl::OUString SAL_CALL ScCellObj::getString() throw(uno::RuntimeException)
6381cdf0e10cSrcweir {
6382cdf0e10cSrcweir ScUnoGuard aGuard;
6383cdf0e10cSrcweir return GetOutputString_Impl();
6384cdf0e10cSrcweir }
6385cdf0e10cSrcweir
setString(const rtl::OUString & aText)6386cdf0e10cSrcweir void SAL_CALL ScCellObj::setString( const rtl::OUString& aText ) throw(uno::RuntimeException)
6387cdf0e10cSrcweir {
6388cdf0e10cSrcweir ScUnoGuard aGuard;
6389cdf0e10cSrcweir String aString(aText);
6390cdf0e10cSrcweir SetString_Impl(aString, sal_False, sal_False); // immer Text
6391cdf0e10cSrcweir
6392cdf0e10cSrcweir // don't create pUnoText here if not there
6393cdf0e10cSrcweir if (pUnoText)
6394cdf0e10cSrcweir pUnoText->SetSelection(ESelection( 0,0, 0,aString.Len() ));
6395cdf0e10cSrcweir }
6396cdf0e10cSrcweir
insertString(const uno::Reference<text::XTextRange> & xRange,const rtl::OUString & aString,sal_Bool bAbsorb)6397cdf0e10cSrcweir void SAL_CALL ScCellObj::insertString( const uno::Reference<text::XTextRange>& xRange,
6398cdf0e10cSrcweir const rtl::OUString& aString, sal_Bool bAbsorb )
6399cdf0e10cSrcweir throw(uno::RuntimeException)
6400cdf0e10cSrcweir {
6401cdf0e10cSrcweir // special handling for ScCellTextCursor is no longer needed,
6402cdf0e10cSrcweir // SvxUnoText::insertString checks for SvxUnoTextRangeBase instead of SvxUnoTextRange
6403cdf0e10cSrcweir
6404cdf0e10cSrcweir ScUnoGuard aGuard;
6405cdf0e10cSrcweir GetUnoText().insertString(xRange, aString, bAbsorb);
6406cdf0e10cSrcweir }
6407cdf0e10cSrcweir
insertControlCharacter(const uno::Reference<text::XTextRange> & xRange,sal_Int16 nControlCharacter,sal_Bool bAbsorb)6408cdf0e10cSrcweir void SAL_CALL ScCellObj::insertControlCharacter( const uno::Reference<text::XTextRange>& xRange,
6409cdf0e10cSrcweir sal_Int16 nControlCharacter, sal_Bool bAbsorb )
6410cdf0e10cSrcweir throw(lang::IllegalArgumentException, uno::RuntimeException)
6411cdf0e10cSrcweir {
6412cdf0e10cSrcweir ScUnoGuard aGuard;
6413cdf0e10cSrcweir GetUnoText().insertControlCharacter(xRange, nControlCharacter, bAbsorb);
6414cdf0e10cSrcweir }
6415cdf0e10cSrcweir
insertTextContent(const uno::Reference<text::XTextRange> & xRange,const uno::Reference<text::XTextContent> & xContent,sal_Bool bAbsorb)6416cdf0e10cSrcweir void SAL_CALL ScCellObj::insertTextContent( const uno::Reference<text::XTextRange >& xRange,
6417cdf0e10cSrcweir const uno::Reference<text::XTextContent >& xContent,
6418cdf0e10cSrcweir sal_Bool bAbsorb )
6419cdf0e10cSrcweir throw(lang::IllegalArgumentException, uno::RuntimeException)
6420cdf0e10cSrcweir {
6421cdf0e10cSrcweir ScUnoGuard aGuard;
6422cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
6423cdf0e10cSrcweir if ( pDocSh && xContent.is() )
6424cdf0e10cSrcweir {
6425cdf0e10cSrcweir ScCellFieldObj* pCellField = ScCellFieldObj::getImplementation( xContent );
6426cdf0e10cSrcweir SvxUnoTextRangeBase* pTextRange = ScCellTextCursor::getImplementation( xRange );
6427cdf0e10cSrcweir
6428cdf0e10cSrcweir #if 0
6429cdf0e10cSrcweir if (!pTextRange)
6430cdf0e10cSrcweir pTextRange = SvxUnoTextRangeBase::getImplementation( xRange );
6431cdf0e10cSrcweir
6432cdf0e10cSrcweir //! bei SvxUnoTextRange testen, ob in passendem Objekt !!!
6433cdf0e10cSrcweir #endif
6434cdf0e10cSrcweir
6435cdf0e10cSrcweir if ( pCellField && !pCellField->IsInserted() && pTextRange )
6436cdf0e10cSrcweir {
6437cdf0e10cSrcweir SvxEditSource* pEditSource = pTextRange->GetEditSource();
6438cdf0e10cSrcweir ESelection aSelection(pTextRange->GetSelection());
6439cdf0e10cSrcweir
6440cdf0e10cSrcweir if (!bAbsorb)
6441cdf0e10cSrcweir {
6442cdf0e10cSrcweir // nicht ersetzen -> hinten anhaengen
6443cdf0e10cSrcweir aSelection.Adjust();
6444cdf0e10cSrcweir aSelection.nStartPara = aSelection.nEndPara;
6445cdf0e10cSrcweir aSelection.nStartPos = aSelection.nEndPos;
6446cdf0e10cSrcweir }
6447cdf0e10cSrcweir
6448cdf0e10cSrcweir SvxFieldItem aItem(pCellField->CreateFieldItem());
6449cdf0e10cSrcweir
6450cdf0e10cSrcweir SvxTextForwarder* pForwarder = pEditSource->GetTextForwarder();
6451cdf0e10cSrcweir pForwarder->QuickInsertField( aItem, aSelection );
6452cdf0e10cSrcweir pEditSource->UpdateData();
6453cdf0e10cSrcweir
6454cdf0e10cSrcweir // neue Selektion: ein Zeichen
6455cdf0e10cSrcweir aSelection.Adjust();
6456cdf0e10cSrcweir aSelection.nEndPara = aSelection.nStartPara;
6457cdf0e10cSrcweir aSelection.nEndPos = aSelection.nStartPos + 1;
6458cdf0e10cSrcweir pCellField->InitDoc( pDocSh, aCellPos, aSelection );
6459cdf0e10cSrcweir
6460cdf0e10cSrcweir // #91431# for bAbsorb=sal_False, the new selection must be behind the inserted content
6461cdf0e10cSrcweir // (the xml filter relies on this)
6462cdf0e10cSrcweir if (!bAbsorb)
6463cdf0e10cSrcweir aSelection.nStartPos = aSelection.nEndPos;
6464cdf0e10cSrcweir
6465cdf0e10cSrcweir pTextRange->SetSelection( aSelection );
6466cdf0e10cSrcweir
6467cdf0e10cSrcweir return;
6468cdf0e10cSrcweir }
6469cdf0e10cSrcweir }
6470cdf0e10cSrcweir GetUnoText().insertTextContent(xRange, xContent, bAbsorb);
6471cdf0e10cSrcweir }
6472cdf0e10cSrcweir
removeTextContent(const uno::Reference<text::XTextContent> & xContent)6473cdf0e10cSrcweir void SAL_CALL ScCellObj::removeTextContent( const uno::Reference<text::XTextContent>& xContent )
6474cdf0e10cSrcweir throw(container::NoSuchElementException, uno::RuntimeException)
6475cdf0e10cSrcweir {
6476cdf0e10cSrcweir ScUnoGuard aGuard;
6477cdf0e10cSrcweir if ( xContent.is() )
6478cdf0e10cSrcweir {
6479cdf0e10cSrcweir ScCellFieldObj* pCellField = ScCellFieldObj::getImplementation( xContent );
6480cdf0e10cSrcweir if ( pCellField && pCellField->IsInserted() )
6481cdf0e10cSrcweir {
6482cdf0e10cSrcweir //! Testen, ob das Feld in dieser Zelle ist
6483cdf0e10cSrcweir pCellField->DeleteField();
6484cdf0e10cSrcweir return;
6485cdf0e10cSrcweir }
6486cdf0e10cSrcweir }
6487cdf0e10cSrcweir GetUnoText().removeTextContent(xContent);
6488cdf0e10cSrcweir }
6489cdf0e10cSrcweir
getText()6490cdf0e10cSrcweir uno::Reference<text::XText> SAL_CALL ScCellObj::getText() throw(uno::RuntimeException)
6491cdf0e10cSrcweir {
6492cdf0e10cSrcweir ScUnoGuard aGuard;
6493cdf0e10cSrcweir return this;
6494cdf0e10cSrcweir }
6495cdf0e10cSrcweir
getStart()6496cdf0e10cSrcweir uno::Reference<text::XTextRange> SAL_CALL ScCellObj::getStart() throw(uno::RuntimeException)
6497cdf0e10cSrcweir {
6498cdf0e10cSrcweir ScUnoGuard aGuard;
6499cdf0e10cSrcweir return GetUnoText().getStart();
6500cdf0e10cSrcweir }
6501cdf0e10cSrcweir
getEnd()6502cdf0e10cSrcweir uno::Reference<text::XTextRange> SAL_CALL ScCellObj::getEnd() throw(uno::RuntimeException)
6503cdf0e10cSrcweir {
6504cdf0e10cSrcweir ScUnoGuard aGuard;
6505cdf0e10cSrcweir return GetUnoText().getEnd();
6506cdf0e10cSrcweir }
6507cdf0e10cSrcweir
createEnumeration()6508cdf0e10cSrcweir uno::Reference<container::XEnumeration> SAL_CALL ScCellObj::createEnumeration()
6509cdf0e10cSrcweir throw(uno::RuntimeException)
6510cdf0e10cSrcweir {
6511cdf0e10cSrcweir ScUnoGuard aGuard;
6512cdf0e10cSrcweir return GetUnoText().createEnumeration();
6513cdf0e10cSrcweir }
6514cdf0e10cSrcweir
getElementType()6515cdf0e10cSrcweir uno::Type SAL_CALL ScCellObj::getElementType() throw(uno::RuntimeException)
6516cdf0e10cSrcweir {
6517cdf0e10cSrcweir ScUnoGuard aGuard;
6518cdf0e10cSrcweir return GetUnoText().getElementType();
6519cdf0e10cSrcweir }
6520cdf0e10cSrcweir
hasElements()6521cdf0e10cSrcweir sal_Bool SAL_CALL ScCellObj::hasElements() throw(uno::RuntimeException)
6522cdf0e10cSrcweir {
6523cdf0e10cSrcweir ScUnoGuard aGuard;
6524cdf0e10cSrcweir return GetUnoText().hasElements();
6525cdf0e10cSrcweir }
6526cdf0e10cSrcweir
6527cdf0e10cSrcweir // XCell
6528cdf0e10cSrcweir
getFormula()6529cdf0e10cSrcweir rtl::OUString SAL_CALL ScCellObj::getFormula() throw(uno::RuntimeException)
6530cdf0e10cSrcweir {
6531cdf0e10cSrcweir ScUnoGuard aGuard;
6532cdf0e10cSrcweir // sal_True = englisch
6533cdf0e10cSrcweir return GetInputString_Impl(sal_True);
6534cdf0e10cSrcweir }
6535cdf0e10cSrcweir
setFormula(const rtl::OUString & aFormula)6536cdf0e10cSrcweir void SAL_CALL ScCellObj::setFormula( const rtl::OUString& aFormula ) throw(uno::RuntimeException)
6537cdf0e10cSrcweir {
6538cdf0e10cSrcweir ScUnoGuard aGuard;
6539cdf0e10cSrcweir String aString(aFormula);
6540cdf0e10cSrcweir SetString_Impl(aString, sal_True, sal_True); // englisch interpretieren
6541cdf0e10cSrcweir }
6542cdf0e10cSrcweir
getValue()6543cdf0e10cSrcweir double SAL_CALL ScCellObj::getValue() throw(uno::RuntimeException)
6544cdf0e10cSrcweir {
6545cdf0e10cSrcweir ScUnoGuard aGuard;
6546cdf0e10cSrcweir return GetValue_Impl();
6547cdf0e10cSrcweir }
6548cdf0e10cSrcweir
setValue(double nValue)6549cdf0e10cSrcweir void SAL_CALL ScCellObj::setValue( double nValue ) throw(uno::RuntimeException)
6550cdf0e10cSrcweir {
6551cdf0e10cSrcweir ScUnoGuard aGuard;
6552cdf0e10cSrcweir SetValue_Impl(nValue);
6553cdf0e10cSrcweir }
6554cdf0e10cSrcweir
getType()6555cdf0e10cSrcweir table::CellContentType SAL_CALL ScCellObj::getType() throw(uno::RuntimeException)
6556cdf0e10cSrcweir {
6557cdf0e10cSrcweir ScUnoGuard aGuard;
6558cdf0e10cSrcweir table::CellContentType eRet = table::CellContentType_EMPTY;
6559cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
6560cdf0e10cSrcweir if (pDocSh)
6561cdf0e10cSrcweir {
6562cdf0e10cSrcweir CellType eCalcType = pDocSh->GetDocument()->GetCellType( aCellPos );
6563cdf0e10cSrcweir switch (eCalcType)
6564cdf0e10cSrcweir {
6565cdf0e10cSrcweir case CELLTYPE_VALUE:
6566cdf0e10cSrcweir eRet = table::CellContentType_VALUE;
6567cdf0e10cSrcweir break;
6568cdf0e10cSrcweir case CELLTYPE_STRING:
6569cdf0e10cSrcweir case CELLTYPE_EDIT:
6570cdf0e10cSrcweir eRet = table::CellContentType_TEXT;
6571cdf0e10cSrcweir break;
6572cdf0e10cSrcweir case CELLTYPE_FORMULA:
6573cdf0e10cSrcweir eRet = table::CellContentType_FORMULA;
6574cdf0e10cSrcweir break;
6575cdf0e10cSrcweir default:
6576cdf0e10cSrcweir eRet = table::CellContentType_EMPTY;
6577cdf0e10cSrcweir }
6578cdf0e10cSrcweir }
6579cdf0e10cSrcweir else
6580cdf0e10cSrcweir {
6581cdf0e10cSrcweir DBG_ERROR("keine DocShell"); //! Exception oder so?
6582cdf0e10cSrcweir }
6583cdf0e10cSrcweir
6584cdf0e10cSrcweir return eRet;
6585cdf0e10cSrcweir }
6586cdf0e10cSrcweir
GetResultType_Impl()6587cdf0e10cSrcweir table::CellContentType ScCellObj::GetResultType_Impl()
6588cdf0e10cSrcweir {
6589cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
6590cdf0e10cSrcweir if ( pDocSh )
6591cdf0e10cSrcweir {
6592cdf0e10cSrcweir ScBaseCell* pCell = pDocSh->GetDocument()->GetCell(aCellPos);
6593cdf0e10cSrcweir if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA )
6594cdf0e10cSrcweir {
6595cdf0e10cSrcweir sal_Bool bValue = ((ScFormulaCell*)pCell)->IsValue();
6596cdf0e10cSrcweir return bValue ? table::CellContentType_VALUE : table::CellContentType_TEXT;
6597cdf0e10cSrcweir }
6598cdf0e10cSrcweir }
6599cdf0e10cSrcweir return getType(); // wenn keine Formel
6600cdf0e10cSrcweir }
6601cdf0e10cSrcweir
getError()6602cdf0e10cSrcweir sal_Int32 SAL_CALL ScCellObj::getError() throw(uno::RuntimeException)
6603cdf0e10cSrcweir {
6604cdf0e10cSrcweir ScUnoGuard aGuard;
6605cdf0e10cSrcweir sal_uInt16 nError = 0;
6606cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
6607cdf0e10cSrcweir if (pDocSh)
6608cdf0e10cSrcweir {
6609cdf0e10cSrcweir ScBaseCell* pCell = pDocSh->GetDocument()->GetCell( aCellPos );
6610cdf0e10cSrcweir if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA )
6611cdf0e10cSrcweir nError = ((ScFormulaCell*)pCell)->GetErrCode();
6612cdf0e10cSrcweir // sonst bleibt's bei 0
6613cdf0e10cSrcweir }
6614cdf0e10cSrcweir else
6615cdf0e10cSrcweir {
6616cdf0e10cSrcweir DBG_ERROR("keine DocShell"); //! Exception oder so?
6617cdf0e10cSrcweir }
6618cdf0e10cSrcweir
6619cdf0e10cSrcweir return nError;
6620cdf0e10cSrcweir }
6621cdf0e10cSrcweir
6622cdf0e10cSrcweir // XFormulaTokens
6623cdf0e10cSrcweir
getTokens()6624cdf0e10cSrcweir uno::Sequence<sheet::FormulaToken> SAL_CALL ScCellObj::getTokens() throw(uno::RuntimeException)
6625cdf0e10cSrcweir {
6626cdf0e10cSrcweir ScUnoGuard aGuard;
6627cdf0e10cSrcweir uno::Sequence<sheet::FormulaToken> aSequence;
6628cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
6629cdf0e10cSrcweir if ( pDocSh )
6630cdf0e10cSrcweir {
6631cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
6632cdf0e10cSrcweir ScBaseCell* pCell = pDoc->GetCell( aCellPos );
6633cdf0e10cSrcweir if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA )
6634cdf0e10cSrcweir {
6635cdf0e10cSrcweir ScTokenArray* pTokenArray = static_cast<ScFormulaCell*>(pCell)->GetCode();
6636cdf0e10cSrcweir if ( pTokenArray )
6637cdf0e10cSrcweir (void)ScTokenConversion::ConvertToTokenSequence( *pDoc, aSequence, *pTokenArray );
6638cdf0e10cSrcweir }
6639cdf0e10cSrcweir }
6640cdf0e10cSrcweir return aSequence;
6641cdf0e10cSrcweir }
6642cdf0e10cSrcweir
setTokens(const uno::Sequence<sheet::FormulaToken> & rTokens)6643cdf0e10cSrcweir void SAL_CALL ScCellObj::setTokens( const uno::Sequence<sheet::FormulaToken>& rTokens ) throw(uno::RuntimeException)
6644cdf0e10cSrcweir {
6645cdf0e10cSrcweir ScUnoGuard aGuard;
6646cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
6647cdf0e10cSrcweir if ( pDocSh )
6648cdf0e10cSrcweir {
6649cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
6650cdf0e10cSrcweir ScTokenArray aTokenArray;
6651cdf0e10cSrcweir (void)ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, rTokens );
6652cdf0e10cSrcweir
6653cdf0e10cSrcweir ScDocFunc aFunc( *pDocSh );
6654cdf0e10cSrcweir ScBaseCell* pNewCell = new ScFormulaCell( pDoc, aCellPos, &aTokenArray );
6655cdf0e10cSrcweir (void)aFunc.PutCell( aCellPos, pNewCell, sal_True );
6656cdf0e10cSrcweir }
6657cdf0e10cSrcweir }
6658cdf0e10cSrcweir
6659cdf0e10cSrcweir // XCellAddressable
6660cdf0e10cSrcweir
getCellAddress()6661cdf0e10cSrcweir table::CellAddress SAL_CALL ScCellObj::getCellAddress() throw(uno::RuntimeException)
6662cdf0e10cSrcweir {
6663cdf0e10cSrcweir ScUnoGuard aGuard;
6664cdf0e10cSrcweir table::CellAddress aAdr;
6665cdf0e10cSrcweir aAdr.Sheet = aCellPos.Tab();
6666cdf0e10cSrcweir aAdr.Column = aCellPos.Col();
6667cdf0e10cSrcweir aAdr.Row = aCellPos.Row();
6668cdf0e10cSrcweir return aAdr;
6669cdf0e10cSrcweir }
6670cdf0e10cSrcweir
6671cdf0e10cSrcweir // XSheetAnnotationAnchor
6672cdf0e10cSrcweir
getAnnotation()6673cdf0e10cSrcweir uno::Reference<sheet::XSheetAnnotation> SAL_CALL ScCellObj::getAnnotation()
6674cdf0e10cSrcweir throw(uno::RuntimeException)
6675cdf0e10cSrcweir {
6676cdf0e10cSrcweir ScUnoGuard aGuard;
6677cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
6678cdf0e10cSrcweir if ( pDocSh )
6679cdf0e10cSrcweir return new ScAnnotationObj( pDocSh, aCellPos );
6680cdf0e10cSrcweir
6681cdf0e10cSrcweir DBG_ERROR("getAnnotation ohne DocShell");
6682cdf0e10cSrcweir return NULL;
6683cdf0e10cSrcweir }
6684cdf0e10cSrcweir
6685cdf0e10cSrcweir // XFieldTypesSupplier
6686cdf0e10cSrcweir
getTextFields()6687cdf0e10cSrcweir uno::Reference<container::XEnumerationAccess> SAL_CALL ScCellObj::getTextFields()
6688cdf0e10cSrcweir throw(uno::RuntimeException)
6689cdf0e10cSrcweir {
6690cdf0e10cSrcweir ScUnoGuard aGuard;
6691cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
6692cdf0e10cSrcweir if ( pDocSh )
6693cdf0e10cSrcweir return new ScCellFieldsObj( pDocSh, aCellPos );
6694cdf0e10cSrcweir
6695cdf0e10cSrcweir return NULL;
6696cdf0e10cSrcweir }
6697cdf0e10cSrcweir
getTextFieldMasters()6698cdf0e10cSrcweir uno::Reference<container::XNameAccess> SAL_CALL ScCellObj::getTextFieldMasters()
6699cdf0e10cSrcweir throw(uno::RuntimeException)
6700cdf0e10cSrcweir {
6701cdf0e10cSrcweir // sowas gibts nicht im Calc (?)
6702cdf0e10cSrcweir return NULL;
6703cdf0e10cSrcweir }
6704cdf0e10cSrcweir
6705cdf0e10cSrcweir // XPropertySet erweitert fuer Zell-Properties
6706cdf0e10cSrcweir
getPropertySetInfo()6707cdf0e10cSrcweir uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCellObj::getPropertySetInfo()
6708cdf0e10cSrcweir throw(uno::RuntimeException)
6709cdf0e10cSrcweir {
6710cdf0e10cSrcweir ScUnoGuard aGuard;
6711cdf0e10cSrcweir static uno::Reference<beans::XPropertySetInfo> aRef(
6712cdf0e10cSrcweir new SfxItemPropertySetInfo( pCellPropSet->getPropertyMap() ));
6713cdf0e10cSrcweir return aRef;
6714cdf0e10cSrcweir }
6715cdf0e10cSrcweir
SetOnePropertyValue(const SfxItemPropertySimpleEntry * pEntry,const uno::Any & aValue)6716cdf0e10cSrcweir void ScCellObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
6717cdf0e10cSrcweir throw(lang::IllegalArgumentException, uno::RuntimeException)
6718cdf0e10cSrcweir {
6719cdf0e10cSrcweir if ( pEntry )
6720cdf0e10cSrcweir {
6721cdf0e10cSrcweir if ( pEntry->nWID == SC_WID_UNO_FORMLOC )
6722cdf0e10cSrcweir {
6723cdf0e10cSrcweir rtl::OUString aStrVal;
6724cdf0e10cSrcweir aValue >>= aStrVal;
6725cdf0e10cSrcweir String aString(aStrVal);
6726cdf0e10cSrcweir SetString_Impl(aString, sal_True, sal_False); // lokal interpretieren
6727cdf0e10cSrcweir }
6728cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_FORMRT )
6729cdf0e10cSrcweir {
6730cdf0e10cSrcweir // Read-Only
6731cdf0e10cSrcweir //! Exception oder so...
6732cdf0e10cSrcweir }
6733cdf0e10cSrcweir else
6734cdf0e10cSrcweir ScCellRangeObj::SetOnePropertyValue( pEntry, aValue );
6735cdf0e10cSrcweir }
6736cdf0e10cSrcweir }
6737cdf0e10cSrcweir
GetOnePropertyValue(const SfxItemPropertySimpleEntry * pEntry,uno::Any & rAny)6738cdf0e10cSrcweir void ScCellObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
6739cdf0e10cSrcweir uno::Any& rAny )
6740cdf0e10cSrcweir throw(uno::RuntimeException)
6741cdf0e10cSrcweir {
6742cdf0e10cSrcweir if ( pEntry )
6743cdf0e10cSrcweir {
6744cdf0e10cSrcweir if ( pEntry->nWID == SC_WID_UNO_FORMLOC )
6745cdf0e10cSrcweir {
6746cdf0e10cSrcweir // sal_False = lokal
6747cdf0e10cSrcweir rAny <<= rtl::OUString( GetInputString_Impl(sal_False) );
6748cdf0e10cSrcweir }
6749cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_FORMRT )
6750cdf0e10cSrcweir {
6751cdf0e10cSrcweir table::CellContentType eType = GetResultType_Impl();
6752cdf0e10cSrcweir rAny <<= eType;
6753cdf0e10cSrcweir }
6754cdf0e10cSrcweir else
6755cdf0e10cSrcweir ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
6756cdf0e10cSrcweir }
6757cdf0e10cSrcweir }
6758cdf0e10cSrcweir
GetItemPropertyMap()6759cdf0e10cSrcweir const SfxItemPropertyMap* ScCellObj::GetItemPropertyMap()
6760cdf0e10cSrcweir {
6761cdf0e10cSrcweir return pCellPropSet->getPropertyMap();
6762cdf0e10cSrcweir }
6763cdf0e10cSrcweir
6764cdf0e10cSrcweir // XServiceInfo
6765cdf0e10cSrcweir
getImplementationName()6766cdf0e10cSrcweir rtl::OUString SAL_CALL ScCellObj::getImplementationName() throw(uno::RuntimeException)
6767cdf0e10cSrcweir {
6768cdf0e10cSrcweir return rtl::OUString::createFromAscii( "ScCellObj" );
6769cdf0e10cSrcweir }
6770cdf0e10cSrcweir
supportsService(const rtl::OUString & rServiceName)6771cdf0e10cSrcweir sal_Bool SAL_CALL ScCellObj::supportsService( const rtl::OUString& rServiceName )
6772cdf0e10cSrcweir throw(uno::RuntimeException)
6773cdf0e10cSrcweir {
6774cdf0e10cSrcweir // CellRange/SheetCellRange are not in SheetCell service description,
6775cdf0e10cSrcweir // but ScCellObj is used instead of ScCellRangeObj in CellRanges collections,
6776cdf0e10cSrcweir // so it must support them
6777cdf0e10cSrcweir
6778cdf0e10cSrcweir String aServiceStr(rServiceName);
6779cdf0e10cSrcweir return aServiceStr.EqualsAscii( SCSHEETCELL_SERVICE ) ||
6780cdf0e10cSrcweir aServiceStr.EqualsAscii( SCCELL_SERVICE ) ||
6781cdf0e10cSrcweir aServiceStr.EqualsAscii( SCCELLPROPERTIES_SERVICE ) ||
6782cdf0e10cSrcweir aServiceStr.EqualsAscii( SCCHARPROPERTIES_SERVICE ) ||
6783cdf0e10cSrcweir aServiceStr.EqualsAscii( SCPARAPROPERTIES_SERVICE ) ||
6784cdf0e10cSrcweir aServiceStr.EqualsAscii( SCSHEETCELLRANGE_SERVICE ) ||
6785cdf0e10cSrcweir aServiceStr.EqualsAscii( SCCELLRANGE_SERVICE );
6786cdf0e10cSrcweir }
6787cdf0e10cSrcweir
getSupportedServiceNames()6788cdf0e10cSrcweir uno::Sequence<rtl::OUString> SAL_CALL ScCellObj::getSupportedServiceNames()
6789cdf0e10cSrcweir throw(uno::RuntimeException)
6790cdf0e10cSrcweir {
6791cdf0e10cSrcweir uno::Sequence<rtl::OUString> aRet(7);
6792cdf0e10cSrcweir rtl::OUString* pArray = aRet.getArray();
6793cdf0e10cSrcweir pArray[0] = rtl::OUString::createFromAscii( SCSHEETCELL_SERVICE );
6794cdf0e10cSrcweir pArray[1] = rtl::OUString::createFromAscii( SCCELL_SERVICE );
6795cdf0e10cSrcweir pArray[2] = rtl::OUString::createFromAscii( SCCELLPROPERTIES_SERVICE );
6796cdf0e10cSrcweir pArray[3] = rtl::OUString::createFromAscii( SCCHARPROPERTIES_SERVICE );
6797cdf0e10cSrcweir pArray[4] = rtl::OUString::createFromAscii( SCPARAPROPERTIES_SERVICE );
6798cdf0e10cSrcweir pArray[5] = rtl::OUString::createFromAscii( SCSHEETCELLRANGE_SERVICE );
6799cdf0e10cSrcweir pArray[6] = rtl::OUString::createFromAscii( SCCELLRANGE_SERVICE );
6800cdf0e10cSrcweir return aRet;
6801cdf0e10cSrcweir }
6802cdf0e10cSrcweir
6803cdf0e10cSrcweir // XActionLockable
6804cdf0e10cSrcweir
isActionLocked()6805cdf0e10cSrcweir sal_Bool SAL_CALL ScCellObj::isActionLocked() throw(uno::RuntimeException)
6806cdf0e10cSrcweir {
6807cdf0e10cSrcweir ScUnoGuard aGuard;
6808cdf0e10cSrcweir return nActionLockCount != 0;
6809cdf0e10cSrcweir }
6810cdf0e10cSrcweir
addActionLock()6811cdf0e10cSrcweir void SAL_CALL ScCellObj::addActionLock() throw(uno::RuntimeException)
6812cdf0e10cSrcweir {
6813cdf0e10cSrcweir ScUnoGuard aGuard;
6814cdf0e10cSrcweir if (!nActionLockCount)
6815cdf0e10cSrcweir {
6816cdf0e10cSrcweir if (pUnoText)
6817cdf0e10cSrcweir {
6818cdf0e10cSrcweir ScSharedCellEditSource* pEditSource =
6819cdf0e10cSrcweir static_cast<ScSharedCellEditSource*> (pUnoText->GetEditSource());
6820cdf0e10cSrcweir if (pEditSource)
6821cdf0e10cSrcweir pEditSource->SetDoUpdateData(sal_False);
6822cdf0e10cSrcweir }
6823cdf0e10cSrcweir }
6824cdf0e10cSrcweir nActionLockCount++;
6825cdf0e10cSrcweir }
6826cdf0e10cSrcweir
removeActionLock()6827cdf0e10cSrcweir void SAL_CALL ScCellObj::removeActionLock() throw(uno::RuntimeException)
6828cdf0e10cSrcweir {
6829cdf0e10cSrcweir ScUnoGuard aGuard;
6830cdf0e10cSrcweir if (nActionLockCount > 0)
6831cdf0e10cSrcweir {
6832cdf0e10cSrcweir nActionLockCount--;
6833cdf0e10cSrcweir if (!nActionLockCount)
6834cdf0e10cSrcweir {
6835cdf0e10cSrcweir if (pUnoText)
6836cdf0e10cSrcweir {
6837cdf0e10cSrcweir ScSharedCellEditSource* pEditSource =
6838cdf0e10cSrcweir static_cast<ScSharedCellEditSource*> (pUnoText->GetEditSource());
6839cdf0e10cSrcweir if (pEditSource)
6840cdf0e10cSrcweir {
6841cdf0e10cSrcweir pEditSource->SetDoUpdateData(sal_True);
6842cdf0e10cSrcweir if (pEditSource->IsDirty())
6843cdf0e10cSrcweir pEditSource->UpdateData();
6844cdf0e10cSrcweir }
6845cdf0e10cSrcweir }
6846cdf0e10cSrcweir }
6847cdf0e10cSrcweir }
6848cdf0e10cSrcweir }
6849cdf0e10cSrcweir
setActionLocks(sal_Int16 nLock)6850cdf0e10cSrcweir void SAL_CALL ScCellObj::setActionLocks( sal_Int16 nLock ) throw(uno::RuntimeException)
6851cdf0e10cSrcweir {
6852cdf0e10cSrcweir ScUnoGuard aGuard;
6853cdf0e10cSrcweir if (pUnoText)
6854cdf0e10cSrcweir {
6855cdf0e10cSrcweir ScSharedCellEditSource* pEditSource =
6856cdf0e10cSrcweir static_cast<ScSharedCellEditSource*> (pUnoText->GetEditSource());
6857cdf0e10cSrcweir if (pEditSource)
6858cdf0e10cSrcweir {
6859cdf0e10cSrcweir pEditSource->SetDoUpdateData(nLock == 0);
6860cdf0e10cSrcweir if ((nActionLockCount > 0) && (nLock == 0) && pEditSource->IsDirty())
6861cdf0e10cSrcweir pEditSource->UpdateData();
6862cdf0e10cSrcweir }
6863cdf0e10cSrcweir }
6864cdf0e10cSrcweir nActionLockCount = nLock;
6865cdf0e10cSrcweir }
6866cdf0e10cSrcweir
resetActionLocks()6867cdf0e10cSrcweir sal_Int16 SAL_CALL ScCellObj::resetActionLocks() throw(uno::RuntimeException)
6868cdf0e10cSrcweir {
6869cdf0e10cSrcweir ScUnoGuard aGuard;
6870cdf0e10cSrcweir sal_uInt16 nRet(nActionLockCount);
6871cdf0e10cSrcweir if (pUnoText)
6872cdf0e10cSrcweir {
6873cdf0e10cSrcweir ScSharedCellEditSource* pEditSource =
6874cdf0e10cSrcweir static_cast<ScSharedCellEditSource*> (pUnoText->GetEditSource());
6875cdf0e10cSrcweir if (pEditSource)
6876cdf0e10cSrcweir {
6877cdf0e10cSrcweir pEditSource->SetDoUpdateData(sal_True);
6878cdf0e10cSrcweir if (pEditSource->IsDirty())
6879cdf0e10cSrcweir pEditSource->UpdateData();
6880cdf0e10cSrcweir }
6881cdf0e10cSrcweir }
6882cdf0e10cSrcweir nActionLockCount = 0;
6883cdf0e10cSrcweir return nRet;
6884cdf0e10cSrcweir }
6885cdf0e10cSrcweir
6886cdf0e10cSrcweir //------------------------------------------------------------------------
6887cdf0e10cSrcweir
ScTableSheetObj(ScDocShell * pDocSh,SCTAB nTab)6888cdf0e10cSrcweir ScTableSheetObj::ScTableSheetObj( ScDocShell* pDocSh, SCTAB nTab ) :
6889cdf0e10cSrcweir ScCellRangeObj( pDocSh, ScRange(0,0,nTab, MAXCOL,MAXROW,nTab) ),
6890cdf0e10cSrcweir pSheetPropSet(lcl_GetSheetPropertySet())
6891cdf0e10cSrcweir {
6892cdf0e10cSrcweir }
6893cdf0e10cSrcweir
~ScTableSheetObj()6894cdf0e10cSrcweir ScTableSheetObj::~ScTableSheetObj()
6895cdf0e10cSrcweir {
6896cdf0e10cSrcweir }
6897cdf0e10cSrcweir
InitInsertSheet(ScDocShell * pDocSh,SCTAB nTab)6898cdf0e10cSrcweir void ScTableSheetObj::InitInsertSheet(ScDocShell* pDocSh, SCTAB nTab)
6899cdf0e10cSrcweir {
6900cdf0e10cSrcweir InitInsertRange( pDocSh, ScRange(0,0,nTab, MAXCOL,MAXROW,nTab) );
6901cdf0e10cSrcweir }
6902cdf0e10cSrcweir
queryInterface(const uno::Type & rType)6903cdf0e10cSrcweir uno::Any SAL_CALL ScTableSheetObj::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException)
6904cdf0e10cSrcweir {
6905cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XSpreadsheet )
6906cdf0e10cSrcweir SC_QUERYINTERFACE( container::XNamed )
6907cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XSheetPageBreak )
6908cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XCellRangeMovement )
6909cdf0e10cSrcweir SC_QUERYINTERFACE( table::XTableChartsSupplier )
6910cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XDataPilotTablesSupplier )
6911cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XScenariosSupplier )
6912cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XSheetAnnotationsSupplier )
6913cdf0e10cSrcweir SC_QUERYINTERFACE( drawing::XDrawPageSupplier )
6914cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XPrintAreas )
6915cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XSheetAuditing )
6916cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XSheetOutline )
6917cdf0e10cSrcweir SC_QUERYINTERFACE( util::XProtectable )
6918cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XScenario )
6919cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XScenarioEnhanced )
6920cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XSheetLinkable )
6921cdf0e10cSrcweir SC_QUERYINTERFACE( sheet::XExternalSheetName )
6922cdf0e10cSrcweir SC_QUERYINTERFACE( document::XEventsSupplier )
6923cdf0e10cSrcweir
6924cdf0e10cSrcweir return ScCellRangeObj::queryInterface( rType );
6925cdf0e10cSrcweir }
6926cdf0e10cSrcweir
acquire()6927cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::acquire() throw()
6928cdf0e10cSrcweir {
6929cdf0e10cSrcweir ScCellRangeObj::acquire();
6930cdf0e10cSrcweir }
6931cdf0e10cSrcweir
release()6932cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::release() throw()
6933cdf0e10cSrcweir {
6934cdf0e10cSrcweir ScCellRangeObj::release();
6935cdf0e10cSrcweir }
6936cdf0e10cSrcweir
getTypes()6937cdf0e10cSrcweir uno::Sequence<uno::Type> SAL_CALL ScTableSheetObj::getTypes() throw(uno::RuntimeException)
6938cdf0e10cSrcweir {
6939cdf0e10cSrcweir static uno::Sequence<uno::Type> aTypes;
6940cdf0e10cSrcweir if ( aTypes.getLength() == 0 )
6941cdf0e10cSrcweir {
6942cdf0e10cSrcweir uno::Sequence<uno::Type> aParentTypes = ScCellRangeObj::getTypes();
6943cdf0e10cSrcweir long nParentLen = aParentTypes.getLength();
6944cdf0e10cSrcweir const uno::Type* pParentPtr = aParentTypes.getConstArray();
6945cdf0e10cSrcweir
6946cdf0e10cSrcweir aTypes.realloc( nParentLen + 18 );
6947cdf0e10cSrcweir uno::Type* pPtr = aTypes.getArray();
6948cdf0e10cSrcweir pPtr[nParentLen + 0] = getCppuType((const uno::Reference<sheet::XSpreadsheet>*)0);
6949cdf0e10cSrcweir pPtr[nParentLen + 1] = getCppuType((const uno::Reference<container::XNamed>*)0);
6950cdf0e10cSrcweir pPtr[nParentLen + 2] = getCppuType((const uno::Reference<sheet::XSheetPageBreak>*)0);
6951cdf0e10cSrcweir pPtr[nParentLen + 3] = getCppuType((const uno::Reference<sheet::XCellRangeMovement>*)0);
6952cdf0e10cSrcweir pPtr[nParentLen + 4] = getCppuType((const uno::Reference<table::XTableChartsSupplier>*)0);
6953cdf0e10cSrcweir pPtr[nParentLen + 5] = getCppuType((const uno::Reference<sheet::XDataPilotTablesSupplier>*)0);
6954cdf0e10cSrcweir pPtr[nParentLen + 6] = getCppuType((const uno::Reference<sheet::XScenariosSupplier>*)0);
6955cdf0e10cSrcweir pPtr[nParentLen + 7] = getCppuType((const uno::Reference<sheet::XSheetAnnotationsSupplier>*)0);
6956cdf0e10cSrcweir pPtr[nParentLen + 8] = getCppuType((const uno::Reference<drawing::XDrawPageSupplier>*)0);
6957cdf0e10cSrcweir pPtr[nParentLen + 9] = getCppuType((const uno::Reference<sheet::XPrintAreas>*)0);
6958cdf0e10cSrcweir pPtr[nParentLen +10] = getCppuType((const uno::Reference<sheet::XSheetAuditing>*)0);
6959cdf0e10cSrcweir pPtr[nParentLen +11] = getCppuType((const uno::Reference<sheet::XSheetOutline>*)0);
6960cdf0e10cSrcweir pPtr[nParentLen +12] = getCppuType((const uno::Reference<util::XProtectable>*)0);
6961cdf0e10cSrcweir pPtr[nParentLen +13] = getCppuType((const uno::Reference<sheet::XScenario>*)0);
6962cdf0e10cSrcweir pPtr[nParentLen +14] = getCppuType((const uno::Reference<sheet::XScenarioEnhanced>*)0);
6963cdf0e10cSrcweir pPtr[nParentLen +15] = getCppuType((const uno::Reference<sheet::XSheetLinkable>*)0);
6964cdf0e10cSrcweir pPtr[nParentLen +16] = getCppuType((const uno::Reference<sheet::XExternalSheetName>*)0);
6965cdf0e10cSrcweir pPtr[nParentLen +17] = getCppuType((const uno::Reference<document::XEventsSupplier>*)0);
6966cdf0e10cSrcweir
6967cdf0e10cSrcweir for (long i=0; i<nParentLen; i++)
6968cdf0e10cSrcweir pPtr[i] = pParentPtr[i]; // parent types first
6969cdf0e10cSrcweir }
6970cdf0e10cSrcweir return aTypes;
6971cdf0e10cSrcweir }
6972cdf0e10cSrcweir
getImplementationId()6973cdf0e10cSrcweir uno::Sequence<sal_Int8> SAL_CALL ScTableSheetObj::getImplementationId() throw(uno::RuntimeException)
6974cdf0e10cSrcweir {
6975cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aId;
6976cdf0e10cSrcweir if( aId.getLength() == 0 )
6977cdf0e10cSrcweir {
6978cdf0e10cSrcweir aId.realloc( 16 );
6979cdf0e10cSrcweir rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
6980cdf0e10cSrcweir }
6981cdf0e10cSrcweir return aId;
6982cdf0e10cSrcweir }
6983cdf0e10cSrcweir
6984cdf0e10cSrcweir // Hilfsfunktionen
6985cdf0e10cSrcweir
GetTab_Impl() const6986cdf0e10cSrcweir SCTAB ScTableSheetObj::GetTab_Impl() const
6987cdf0e10cSrcweir {
6988cdf0e10cSrcweir const ScRangeList& rRanges = GetRangeList();
6989cdf0e10cSrcweir DBG_ASSERT(rRanges.Count() == 1, "was fuer Ranges ?!?!");
6990cdf0e10cSrcweir const ScRange* pFirst = rRanges.GetObject(0);
6991cdf0e10cSrcweir if (pFirst)
6992cdf0e10cSrcweir return pFirst->aStart.Tab();
6993cdf0e10cSrcweir
6994cdf0e10cSrcweir return 0; // soll nicht sein
6995cdf0e10cSrcweir }
6996cdf0e10cSrcweir
6997cdf0e10cSrcweir // former XSheet
6998cdf0e10cSrcweir
getCharts()6999cdf0e10cSrcweir uno::Reference<table::XTableCharts> SAL_CALL ScTableSheetObj::getCharts() throw(uno::RuntimeException)
7000cdf0e10cSrcweir {
7001cdf0e10cSrcweir ScUnoGuard aGuard;
7002cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7003cdf0e10cSrcweir if ( pDocSh )
7004cdf0e10cSrcweir return new ScChartsObj( pDocSh, GetTab_Impl() );
7005cdf0e10cSrcweir
7006cdf0e10cSrcweir DBG_ERROR("kein Dokument");
7007cdf0e10cSrcweir return NULL;
7008cdf0e10cSrcweir }
7009cdf0e10cSrcweir
getDataPilotTables()7010cdf0e10cSrcweir uno::Reference<sheet::XDataPilotTables> SAL_CALL ScTableSheetObj::getDataPilotTables()
7011cdf0e10cSrcweir throw(uno::RuntimeException)
7012cdf0e10cSrcweir {
7013cdf0e10cSrcweir ScUnoGuard aGuard;
7014cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7015cdf0e10cSrcweir if ( pDocSh )
7016cdf0e10cSrcweir return new ScDataPilotTablesObj( pDocSh, GetTab_Impl() );
7017cdf0e10cSrcweir
7018cdf0e10cSrcweir DBG_ERROR("kein Dokument");
7019cdf0e10cSrcweir return NULL;
7020cdf0e10cSrcweir }
7021cdf0e10cSrcweir
getScenarios()7022cdf0e10cSrcweir uno::Reference<sheet::XScenarios> SAL_CALL ScTableSheetObj::getScenarios() throw(uno::RuntimeException)
7023cdf0e10cSrcweir {
7024cdf0e10cSrcweir ScUnoGuard aGuard;
7025cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7026cdf0e10cSrcweir
7027cdf0e10cSrcweir if ( pDocSh )
7028cdf0e10cSrcweir return new ScScenariosObj( pDocSh, GetTab_Impl() );
7029cdf0e10cSrcweir
7030cdf0e10cSrcweir DBG_ERROR("kein Dokument");
7031cdf0e10cSrcweir return NULL;
7032cdf0e10cSrcweir }
7033cdf0e10cSrcweir
getAnnotations()7034cdf0e10cSrcweir uno::Reference<sheet::XSheetAnnotations> SAL_CALL ScTableSheetObj::getAnnotations()
7035cdf0e10cSrcweir throw(uno::RuntimeException)
7036cdf0e10cSrcweir {
7037cdf0e10cSrcweir ScUnoGuard aGuard;
7038cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7039cdf0e10cSrcweir
7040cdf0e10cSrcweir if ( pDocSh )
7041cdf0e10cSrcweir return new ScAnnotationsObj( pDocSh, GetTab_Impl() );
7042cdf0e10cSrcweir
7043cdf0e10cSrcweir DBG_ERROR("kein Dokument");
7044cdf0e10cSrcweir return NULL;
7045cdf0e10cSrcweir }
7046cdf0e10cSrcweir
getCellRangeByName(const rtl::OUString & rRange)7047cdf0e10cSrcweir uno::Reference<table::XCellRange> SAL_CALL ScTableSheetObj::getCellRangeByName(
7048cdf0e10cSrcweir const rtl::OUString& rRange ) throw(uno::RuntimeException)
7049cdf0e10cSrcweir {
7050cdf0e10cSrcweir ScUnoGuard aGuard;
7051cdf0e10cSrcweir return ScCellRangeObj::getCellRangeByName( rRange );
7052cdf0e10cSrcweir }
7053cdf0e10cSrcweir
createCursor()7054cdf0e10cSrcweir uno::Reference<sheet::XSheetCellCursor> SAL_CALL ScTableSheetObj::createCursor()
7055cdf0e10cSrcweir throw(uno::RuntimeException)
7056cdf0e10cSrcweir {
7057cdf0e10cSrcweir ScUnoGuard aGuard;
7058cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7059cdf0e10cSrcweir if ( pDocSh )
7060cdf0e10cSrcweir {
7061cdf0e10cSrcweir //! einzelne Zelle oder ganze Tabelle???????
7062cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7063cdf0e10cSrcweir return new ScCellCursorObj( pDocSh, ScRange( 0,0,nTab, MAXCOL,MAXROW,nTab ) );
7064cdf0e10cSrcweir }
7065cdf0e10cSrcweir return NULL;
7066cdf0e10cSrcweir }
7067cdf0e10cSrcweir
createCursorByRange(const uno::Reference<sheet::XSheetCellRange> & xCellRange)7068cdf0e10cSrcweir uno::Reference<sheet::XSheetCellCursor> SAL_CALL ScTableSheetObj::createCursorByRange(
7069cdf0e10cSrcweir const uno::Reference<sheet::XSheetCellRange>& xCellRange )
7070cdf0e10cSrcweir throw(uno::RuntimeException)
7071cdf0e10cSrcweir {
7072cdf0e10cSrcweir ScUnoGuard aGuard;
7073cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7074cdf0e10cSrcweir if ( pDocSh && xCellRange.is() )
7075cdf0e10cSrcweir {
7076cdf0e10cSrcweir ScCellRangesBase* pRangesImp = ScCellRangesBase::getImplementation( xCellRange );
7077cdf0e10cSrcweir if (pRangesImp)
7078cdf0e10cSrcweir {
7079cdf0e10cSrcweir const ScRangeList& rRanges = pRangesImp->GetRangeList();
7080cdf0e10cSrcweir DBG_ASSERT( rRanges.Count() == 1, "Range? Ranges?" );
7081cdf0e10cSrcweir return new ScCellCursorObj( pDocSh, *rRanges.GetObject(0) );
7082cdf0e10cSrcweir }
7083cdf0e10cSrcweir }
7084cdf0e10cSrcweir return NULL;
7085cdf0e10cSrcweir }
7086cdf0e10cSrcweir
7087cdf0e10cSrcweir // XSheetCellRange
7088cdf0e10cSrcweir
getSpreadsheet()7089cdf0e10cSrcweir uno::Reference<sheet::XSpreadsheet> SAL_CALL ScTableSheetObj::getSpreadsheet()
7090cdf0e10cSrcweir throw(uno::RuntimeException)
7091cdf0e10cSrcweir {
7092cdf0e10cSrcweir ScUnoGuard aGuard;
7093cdf0e10cSrcweir return this; //!???
7094cdf0e10cSrcweir }
7095cdf0e10cSrcweir
7096cdf0e10cSrcweir // XCellRange
7097cdf0e10cSrcweir
getCellByPosition(sal_Int32 nColumn,sal_Int32 nRow)7098cdf0e10cSrcweir uno::Reference<table::XCell> SAL_CALL ScTableSheetObj::getCellByPosition(
7099cdf0e10cSrcweir sal_Int32 nColumn, sal_Int32 nRow )
7100cdf0e10cSrcweir throw(lang::IndexOutOfBoundsException, uno::RuntimeException)
7101cdf0e10cSrcweir {
7102cdf0e10cSrcweir ScUnoGuard aGuard;
7103cdf0e10cSrcweir return ScCellRangeObj::GetCellByPosition_Impl(nColumn, nRow);
7104cdf0e10cSrcweir }
7105cdf0e10cSrcweir
getCellRangeByPosition(sal_Int32 nLeft,sal_Int32 nTop,sal_Int32 nRight,sal_Int32 nBottom)7106cdf0e10cSrcweir uno::Reference<table::XCellRange> SAL_CALL ScTableSheetObj::getCellRangeByPosition(
7107cdf0e10cSrcweir sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom )
7108cdf0e10cSrcweir throw(lang::IndexOutOfBoundsException, uno::RuntimeException)
7109cdf0e10cSrcweir {
7110cdf0e10cSrcweir ScUnoGuard aGuard;
7111cdf0e10cSrcweir return ScCellRangeObj::getCellRangeByPosition(nLeft,nTop,nRight,nBottom);
7112cdf0e10cSrcweir }
7113cdf0e10cSrcweir
getColumnPageBreaks()7114cdf0e10cSrcweir uno::Sequence<sheet::TablePageBreakData> SAL_CALL ScTableSheetObj::getColumnPageBreaks()
7115cdf0e10cSrcweir throw(uno::RuntimeException)
7116cdf0e10cSrcweir {
7117cdf0e10cSrcweir ScUnoGuard aGuard;
7118cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7119cdf0e10cSrcweir if ( pDocSh )
7120cdf0e10cSrcweir {
7121cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
7122cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7123cdf0e10cSrcweir
7124cdf0e10cSrcweir Size aSize(pDoc->GetPageSize( nTab ));
7125cdf0e10cSrcweir if (aSize.Width() && aSize.Height()) // effektive Groesse schon gesetzt?
7126cdf0e10cSrcweir pDoc->UpdatePageBreaks( nTab );
7127cdf0e10cSrcweir else
7128cdf0e10cSrcweir {
7129cdf0e10cSrcweir // Umbrueche updaten wie in ScDocShell::PageStyleModified:
7130cdf0e10cSrcweir ScPrintFunc aPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab );
7131cdf0e10cSrcweir aPrintFunc.UpdatePages();
7132cdf0e10cSrcweir }
7133cdf0e10cSrcweir
7134cdf0e10cSrcweir SCCOL nCount = 0;
7135cdf0e10cSrcweir SCCOL nCol;
7136cdf0e10cSrcweir for (nCol=0; nCol<=MAXCOL; nCol++)
7137cdf0e10cSrcweir if (pDoc->HasColBreak(nCol, nTab))
7138cdf0e10cSrcweir ++nCount;
7139cdf0e10cSrcweir
7140cdf0e10cSrcweir sheet::TablePageBreakData aData;
7141cdf0e10cSrcweir uno::Sequence<sheet::TablePageBreakData> aSeq(nCount);
7142cdf0e10cSrcweir sheet::TablePageBreakData* pAry = aSeq.getArray();
7143cdf0e10cSrcweir sal_uInt16 nPos = 0;
7144cdf0e10cSrcweir for (nCol=0; nCol<=MAXCOL; nCol++)
7145cdf0e10cSrcweir {
7146cdf0e10cSrcweir ScBreakType nBreak = pDoc->HasColBreak(nCol, nTab);
7147cdf0e10cSrcweir if (nBreak)
7148cdf0e10cSrcweir {
7149cdf0e10cSrcweir aData.Position = nCol;
7150cdf0e10cSrcweir aData.ManualBreak = (nBreak & BREAK_MANUAL);
7151cdf0e10cSrcweir pAry[nPos] = aData;
7152cdf0e10cSrcweir ++nPos;
7153cdf0e10cSrcweir }
7154cdf0e10cSrcweir }
7155cdf0e10cSrcweir return aSeq;
7156cdf0e10cSrcweir }
7157cdf0e10cSrcweir return uno::Sequence<sheet::TablePageBreakData>(0);
7158cdf0e10cSrcweir }
7159cdf0e10cSrcweir
getRowPageBreaks()7160cdf0e10cSrcweir uno::Sequence<sheet::TablePageBreakData> SAL_CALL ScTableSheetObj::getRowPageBreaks()
7161cdf0e10cSrcweir throw(uno::RuntimeException)
7162cdf0e10cSrcweir {
7163cdf0e10cSrcweir ScUnoGuard aGuard;
7164cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7165cdf0e10cSrcweir if ( pDocSh )
7166cdf0e10cSrcweir {
7167cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
7168cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7169cdf0e10cSrcweir
7170cdf0e10cSrcweir Size aSize(pDoc->GetPageSize( nTab ));
7171cdf0e10cSrcweir if (aSize.Width() && aSize.Height()) // effektive Groesse schon gesetzt?
7172cdf0e10cSrcweir pDoc->UpdatePageBreaks( nTab );
7173cdf0e10cSrcweir else
7174cdf0e10cSrcweir {
7175cdf0e10cSrcweir // Umbrueche updaten wie in ScDocShell::PageStyleModified:
7176cdf0e10cSrcweir ScPrintFunc aPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab );
7177cdf0e10cSrcweir aPrintFunc.UpdatePages();
7178cdf0e10cSrcweir }
7179cdf0e10cSrcweir return pDoc->GetRowBreakData(nTab);
7180cdf0e10cSrcweir }
7181cdf0e10cSrcweir return uno::Sequence<sheet::TablePageBreakData>(0);
7182cdf0e10cSrcweir }
7183cdf0e10cSrcweir
removeAllManualPageBreaks()7184cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::removeAllManualPageBreaks() throw(uno::RuntimeException)
7185cdf0e10cSrcweir {
7186cdf0e10cSrcweir ScUnoGuard aGuard;
7187cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7188cdf0e10cSrcweir if ( pDocSh )
7189cdf0e10cSrcweir {
7190cdf0e10cSrcweir //! docfunc Funktion, auch fuer ScViewFunc::RemoveManualBreaks
7191cdf0e10cSrcweir
7192cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
7193cdf0e10cSrcweir sal_Bool bUndo (pDoc->IsUndoEnabled());
7194cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7195cdf0e10cSrcweir
7196cdf0e10cSrcweir if (bUndo)
7197cdf0e10cSrcweir {
7198cdf0e10cSrcweir ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
7199cdf0e10cSrcweir pUndoDoc->InitUndo( pDoc, nTab, nTab, sal_True, sal_True );
7200cdf0e10cSrcweir pDoc->CopyToDocument( 0,0,nTab, MAXCOL,MAXROW,nTab, IDF_NONE, sal_False, pUndoDoc );
7201cdf0e10cSrcweir pDocSh->GetUndoManager()->AddUndoAction(
7202cdf0e10cSrcweir new ScUndoRemoveBreaks( pDocSh, nTab, pUndoDoc ) );
7203cdf0e10cSrcweir }
7204cdf0e10cSrcweir
7205cdf0e10cSrcweir pDoc->RemoveManualBreaks(nTab);
7206cdf0e10cSrcweir pDoc->UpdatePageBreaks(nTab);
7207cdf0e10cSrcweir
7208cdf0e10cSrcweir //? UpdatePageBreakData( sal_True );
7209cdf0e10cSrcweir pDocSh->SetDocumentModified();
7210cdf0e10cSrcweir pDocSh->PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID );
7211cdf0e10cSrcweir }
7212cdf0e10cSrcweir }
7213cdf0e10cSrcweir
7214cdf0e10cSrcweir // XNamed
7215cdf0e10cSrcweir
getName()7216cdf0e10cSrcweir rtl::OUString SAL_CALL ScTableSheetObj::getName() throw(uno::RuntimeException)
7217cdf0e10cSrcweir {
7218cdf0e10cSrcweir ScUnoGuard aGuard;
7219cdf0e10cSrcweir String aName;
7220cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7221cdf0e10cSrcweir if ( pDocSh )
7222cdf0e10cSrcweir pDocSh->GetDocument()->GetName( GetTab_Impl(), aName );
7223cdf0e10cSrcweir return aName;
7224cdf0e10cSrcweir }
7225cdf0e10cSrcweir
setName(const rtl::OUString & aNewName)7226cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::setName( const rtl::OUString& aNewName )
7227cdf0e10cSrcweir throw(uno::RuntimeException)
7228cdf0e10cSrcweir {
7229cdf0e10cSrcweir ScUnoGuard aGuard;
7230cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7231cdf0e10cSrcweir if ( pDocSh )
7232cdf0e10cSrcweir {
7233cdf0e10cSrcweir String aString(aNewName);
7234cdf0e10cSrcweir ScDocFunc aFunc( *pDocSh );
7235cdf0e10cSrcweir aFunc.RenameTable( GetTab_Impl(), aString, sal_True, sal_True );
7236cdf0e10cSrcweir }
7237cdf0e10cSrcweir }
7238cdf0e10cSrcweir
7239cdf0e10cSrcweir // XDrawPageSupplier
7240cdf0e10cSrcweir
getDrawPage()7241cdf0e10cSrcweir uno::Reference<drawing::XDrawPage> SAL_CALL ScTableSheetObj::getDrawPage()
7242cdf0e10cSrcweir throw(uno::RuntimeException)
7243cdf0e10cSrcweir {
7244cdf0e10cSrcweir ScUnoGuard aGuard;
7245cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7246cdf0e10cSrcweir if ( pDocSh )
7247cdf0e10cSrcweir {
7248cdf0e10cSrcweir ScDrawLayer* pDrawLayer = pDocSh->MakeDrawLayer();
7249cdf0e10cSrcweir DBG_ASSERT(pDrawLayer,"kann Draw-Layer nicht anlegen");
7250cdf0e10cSrcweir
7251cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7252cdf0e10cSrcweir SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
7253cdf0e10cSrcweir DBG_ASSERT(pPage,"Draw-Page nicht gefunden");
7254cdf0e10cSrcweir if (pPage)
7255cdf0e10cSrcweir return uno::Reference<drawing::XDrawPage> (pPage->getUnoPage(), uno::UNO_QUERY);
7256cdf0e10cSrcweir
7257cdf0e10cSrcweir // Das DrawPage-Objekt meldet sich als Listener am SdrModel an
7258cdf0e10cSrcweir // und sollte von dort alle Aktionen mitbekommen
7259cdf0e10cSrcweir }
7260cdf0e10cSrcweir return NULL;
7261cdf0e10cSrcweir }
7262cdf0e10cSrcweir
7263cdf0e10cSrcweir // XCellMovement
7264cdf0e10cSrcweir
insertCells(const table::CellRangeAddress & rRangeAddress,sheet::CellInsertMode nMode)7265cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::insertCells( const table::CellRangeAddress& rRangeAddress,
7266cdf0e10cSrcweir sheet::CellInsertMode nMode ) throw(uno::RuntimeException)
7267cdf0e10cSrcweir {
7268cdf0e10cSrcweir ScUnoGuard aGuard;
7269cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7270cdf0e10cSrcweir if ( pDocSh )
7271cdf0e10cSrcweir {
7272cdf0e10cSrcweir sal_Bool bDo = sal_True;
7273cdf0e10cSrcweir InsCellCmd eCmd = INS_NONE;
7274cdf0e10cSrcweir switch (nMode)
7275cdf0e10cSrcweir {
7276cdf0e10cSrcweir case sheet::CellInsertMode_NONE: bDo = sal_False; break;
7277cdf0e10cSrcweir case sheet::CellInsertMode_DOWN: eCmd = INS_CELLSDOWN; break;
7278cdf0e10cSrcweir case sheet::CellInsertMode_RIGHT: eCmd = INS_CELLSRIGHT; break;
7279cdf0e10cSrcweir case sheet::CellInsertMode_ROWS: eCmd = INS_INSROWS; break;
7280cdf0e10cSrcweir case sheet::CellInsertMode_COLUMNS: eCmd = INS_INSCOLS; break;
7281cdf0e10cSrcweir default:
7282cdf0e10cSrcweir DBG_ERROR("insertCells: falscher Mode");
7283cdf0e10cSrcweir bDo = sal_False;
7284cdf0e10cSrcweir }
7285cdf0e10cSrcweir
7286cdf0e10cSrcweir if (bDo)
7287cdf0e10cSrcweir {
7288cdf0e10cSrcweir DBG_ASSERT( rRangeAddress.Sheet == GetTab_Impl(), "falsche Tabelle in CellRangeAddress" );
7289cdf0e10cSrcweir ScRange aScRange;
7290cdf0e10cSrcweir ScUnoConversion::FillScRange( aScRange, rRangeAddress );
7291cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
7292cdf0e10cSrcweir aFunc.InsertCells( aScRange, NULL, eCmd, sal_True, sal_True );
7293cdf0e10cSrcweir }
7294cdf0e10cSrcweir }
7295cdf0e10cSrcweir }
7296cdf0e10cSrcweir
removeRange(const table::CellRangeAddress & rRangeAddress,sheet::CellDeleteMode nMode)7297cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::removeRange( const table::CellRangeAddress& rRangeAddress,
7298cdf0e10cSrcweir sheet::CellDeleteMode nMode ) throw(uno::RuntimeException)
7299cdf0e10cSrcweir {
7300cdf0e10cSrcweir ScUnoGuard aGuard;
7301cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7302cdf0e10cSrcweir if ( pDocSh )
7303cdf0e10cSrcweir {
7304cdf0e10cSrcweir sal_Bool bDo = sal_True;
7305cdf0e10cSrcweir DelCellCmd eCmd = DEL_NONE;
7306cdf0e10cSrcweir switch (nMode)
7307cdf0e10cSrcweir {
7308cdf0e10cSrcweir case sheet::CellDeleteMode_NONE: bDo = sal_False; break;
7309cdf0e10cSrcweir case sheet::CellDeleteMode_UP: eCmd = DEL_CELLSUP; break;
7310cdf0e10cSrcweir case sheet::CellDeleteMode_LEFT: eCmd = DEL_CELLSLEFT; break;
7311cdf0e10cSrcweir case sheet::CellDeleteMode_ROWS: eCmd = DEL_DELROWS; break;
7312cdf0e10cSrcweir case sheet::CellDeleteMode_COLUMNS: eCmd = DEL_DELCOLS; break;
7313cdf0e10cSrcweir default:
7314cdf0e10cSrcweir DBG_ERROR("deleteCells: falscher Mode");
7315cdf0e10cSrcweir bDo = sal_False;
7316cdf0e10cSrcweir }
7317cdf0e10cSrcweir
7318cdf0e10cSrcweir if (bDo)
7319cdf0e10cSrcweir {
7320cdf0e10cSrcweir DBG_ASSERT( rRangeAddress.Sheet == GetTab_Impl(), "falsche Tabelle in CellRangeAddress" );
7321cdf0e10cSrcweir ScRange aScRange;
7322cdf0e10cSrcweir ScUnoConversion::FillScRange( aScRange, rRangeAddress );
7323cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
7324cdf0e10cSrcweir aFunc.DeleteCells( aScRange, NULL, eCmd, sal_True, sal_True );
7325cdf0e10cSrcweir }
7326cdf0e10cSrcweir }
7327cdf0e10cSrcweir }
7328cdf0e10cSrcweir
moveRange(const table::CellAddress & aDestination,const table::CellRangeAddress & aSource)7329cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::moveRange( const table::CellAddress& aDestination,
7330cdf0e10cSrcweir const table::CellRangeAddress& aSource )
7331cdf0e10cSrcweir throw(uno::RuntimeException)
7332cdf0e10cSrcweir {
7333cdf0e10cSrcweir ScUnoGuard aGuard;
7334cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7335cdf0e10cSrcweir if ( pDocSh )
7336cdf0e10cSrcweir {
7337cdf0e10cSrcweir DBG_ASSERT( aSource.Sheet == GetTab_Impl(), "falsche Tabelle in CellRangeAddress" );
7338cdf0e10cSrcweir ScRange aSourceRange;
7339cdf0e10cSrcweir ScUnoConversion::FillScRange( aSourceRange, aSource );
7340cdf0e10cSrcweir ScAddress aDestPos( (SCCOL)aDestination.Column, (SCROW)aDestination.Row, aDestination.Sheet );
7341cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
7342cdf0e10cSrcweir aFunc.MoveBlock( aSourceRange, aDestPos, sal_True, sal_True, sal_True, sal_True );
7343cdf0e10cSrcweir }
7344cdf0e10cSrcweir }
7345cdf0e10cSrcweir
copyRange(const table::CellAddress & aDestination,const table::CellRangeAddress & aSource)7346cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::copyRange( const table::CellAddress& aDestination,
7347cdf0e10cSrcweir const table::CellRangeAddress& aSource )
7348cdf0e10cSrcweir throw(uno::RuntimeException)
7349cdf0e10cSrcweir {
7350cdf0e10cSrcweir ScUnoGuard aGuard;
7351cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7352cdf0e10cSrcweir if ( pDocSh )
7353cdf0e10cSrcweir {
7354cdf0e10cSrcweir DBG_ASSERT( aSource.Sheet == GetTab_Impl(), "falsche Tabelle in CellRangeAddress" );
7355cdf0e10cSrcweir ScRange aSourceRange;
7356cdf0e10cSrcweir ScUnoConversion::FillScRange( aSourceRange, aSource );
7357cdf0e10cSrcweir ScAddress aDestPos( (SCCOL)aDestination.Column, (SCROW)aDestination.Row, aDestination.Sheet );
7358cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
7359cdf0e10cSrcweir aFunc.MoveBlock( aSourceRange, aDestPos, sal_False, sal_True, sal_True, sal_True );
7360cdf0e10cSrcweir }
7361cdf0e10cSrcweir }
7362cdf0e10cSrcweir
7363cdf0e10cSrcweir // XPrintAreas
7364cdf0e10cSrcweir
PrintAreaUndo_Impl(ScPrintRangeSaver * pOldRanges)7365cdf0e10cSrcweir void ScTableSheetObj::PrintAreaUndo_Impl( ScPrintRangeSaver* pOldRanges )
7366cdf0e10cSrcweir {
7367cdf0e10cSrcweir // Umbrueche und Undo
7368cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7369980cf52eSArmin Le Grand ScDocument* pDoc = pDocSh ? pDocSh->GetDocument() : 0;
7370cdf0e10cSrcweir
7371980cf52eSArmin Le Grand if(pDocSh && pDoc)
7372980cf52eSArmin Le Grand {
7373980cf52eSArmin Le Grand const bool bUndo(pDoc->IsUndoEnabled());
7374980cf52eSArmin Le Grand const SCTAB nTab(GetTab_Impl());
7375980cf52eSArmin Le Grand
7376cdf0e10cSrcweir if(bUndo)
7377cdf0e10cSrcweir {
7378cdf0e10cSrcweir pDocSh->GetUndoManager()->AddUndoAction(
7379980cf52eSArmin Le Grand new ScUndoPrintRange(
7380980cf52eSArmin Le Grand pDocSh,
7381980cf52eSArmin Le Grand nTab,
7382980cf52eSArmin Le Grand pOldRanges,
7383980cf52eSArmin Le Grand pDoc->CreatePrintRangeSaver())); // create new ranges
7384980cf52eSArmin Le Grand
7385980cf52eSArmin Le Grand // #120105# ownership of old ranges has changed, mark as consumed
7386980cf52eSArmin Le Grand pOldRanges = 0;
7387cdf0e10cSrcweir }
7388cdf0e10cSrcweir
7389cdf0e10cSrcweir ScPrintFunc(pDocSh, pDocSh->GetPrinter(), nTab).UpdatePages();
7390cdf0e10cSrcweir SfxBindings* pBindings = pDocSh->GetViewBindings();
7391980cf52eSArmin Le Grand
7392cdf0e10cSrcweir if(pBindings)
7393980cf52eSArmin Le Grand {
7394cdf0e10cSrcweir pBindings->Invalidate(SID_DELETE_PRINTAREA);
7395980cf52eSArmin Le Grand }
7396cdf0e10cSrcweir
7397cdf0e10cSrcweir pDocSh->SetDocumentModified();
7398cdf0e10cSrcweir }
7399980cf52eSArmin Le Grand
7400980cf52eSArmin Le Grand if(pOldRanges)
7401980cf52eSArmin Le Grand {
7402980cf52eSArmin Le Grand // #120105# pOldRanges not used, need to cleanup
7403cdf0e10cSrcweir delete pOldRanges;
7404cdf0e10cSrcweir }
7405980cf52eSArmin Le Grand }
7406cdf0e10cSrcweir
getPrintAreas()7407cdf0e10cSrcweir uno::Sequence<table::CellRangeAddress> SAL_CALL ScTableSheetObj::getPrintAreas()
7408cdf0e10cSrcweir throw(uno::RuntimeException)
7409cdf0e10cSrcweir {
7410cdf0e10cSrcweir ScUnoGuard aGuard;
7411cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7412cdf0e10cSrcweir if ( pDocSh )
7413cdf0e10cSrcweir {
7414cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
7415cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7416cdf0e10cSrcweir sal_uInt16 nCount = pDoc->GetPrintRangeCount( nTab );
7417cdf0e10cSrcweir
7418cdf0e10cSrcweir table::CellRangeAddress aRangeAddress;
7419cdf0e10cSrcweir uno::Sequence<table::CellRangeAddress> aSeq(nCount);
7420cdf0e10cSrcweir table::CellRangeAddress* pAry = aSeq.getArray();
7421cdf0e10cSrcweir for (sal_uInt16 i=0; i<nCount; i++)
7422cdf0e10cSrcweir {
7423cdf0e10cSrcweir const ScRange* pRange = pDoc->GetPrintRange( nTab, i );
7424cdf0e10cSrcweir DBG_ASSERT(pRange,"wo ist der Druckbereich");
7425cdf0e10cSrcweir if (pRange)
7426cdf0e10cSrcweir {
7427cdf0e10cSrcweir ScUnoConversion::FillApiRange( aRangeAddress, *pRange );
7428cdf0e10cSrcweir aRangeAddress.Sheet = nTab; // core does not care about sheet index
7429cdf0e10cSrcweir pAry[i] = aRangeAddress;
7430cdf0e10cSrcweir }
7431cdf0e10cSrcweir }
7432cdf0e10cSrcweir return aSeq;
7433cdf0e10cSrcweir }
7434cdf0e10cSrcweir return uno::Sequence<table::CellRangeAddress>();
7435cdf0e10cSrcweir }
7436cdf0e10cSrcweir
setPrintAreas(const uno::Sequence<table::CellRangeAddress> & aPrintAreas)7437cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::setPrintAreas(
7438cdf0e10cSrcweir const uno::Sequence<table::CellRangeAddress>& aPrintAreas )
7439cdf0e10cSrcweir throw(uno::RuntimeException)
7440cdf0e10cSrcweir {
7441cdf0e10cSrcweir ScUnoGuard aGuard;
7442cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7443cdf0e10cSrcweir if ( pDocSh )
7444cdf0e10cSrcweir {
7445cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
7446cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7447cdf0e10cSrcweir
7448cdf0e10cSrcweir ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver();
7449cdf0e10cSrcweir
7450cdf0e10cSrcweir sal_uInt16 nCount = (sal_uInt16) aPrintAreas.getLength();
7451cdf0e10cSrcweir pDoc->ClearPrintRanges( nTab );
7452cdf0e10cSrcweir if (nCount)
7453cdf0e10cSrcweir {
7454cdf0e10cSrcweir ScRange aPrintRange;
7455cdf0e10cSrcweir const table::CellRangeAddress* pAry = aPrintAreas.getConstArray();
7456cdf0e10cSrcweir for (sal_uInt16 i=0; i<nCount; i++)
7457cdf0e10cSrcweir {
7458cdf0e10cSrcweir ScUnoConversion::FillScRange( aPrintRange, pAry[i] );
7459cdf0e10cSrcweir pDoc->AddPrintRange( nTab, aPrintRange );
7460cdf0e10cSrcweir }
7461cdf0e10cSrcweir }
7462cdf0e10cSrcweir
7463cdf0e10cSrcweir PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc.
7464cdf0e10cSrcweir }
7465cdf0e10cSrcweir }
7466cdf0e10cSrcweir
getPrintTitleColumns()7467cdf0e10cSrcweir sal_Bool SAL_CALL ScTableSheetObj::getPrintTitleColumns() throw(uno::RuntimeException)
7468cdf0e10cSrcweir {
7469cdf0e10cSrcweir ScUnoGuard aGuard;
7470cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7471cdf0e10cSrcweir if ( pDocSh )
7472cdf0e10cSrcweir {
7473cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
7474cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7475cdf0e10cSrcweir return ( pDoc->GetRepeatColRange(nTab) != NULL );
7476cdf0e10cSrcweir }
7477cdf0e10cSrcweir return sal_False;
7478cdf0e10cSrcweir }
7479cdf0e10cSrcweir
setPrintTitleColumns(sal_Bool bPrintTitleColumns)7480cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::setPrintTitleColumns( sal_Bool bPrintTitleColumns )
7481cdf0e10cSrcweir throw(uno::RuntimeException)
7482cdf0e10cSrcweir {
7483cdf0e10cSrcweir ScUnoGuard aGuard;
7484cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7485cdf0e10cSrcweir if ( pDocSh )
7486cdf0e10cSrcweir {
7487cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
7488cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7489cdf0e10cSrcweir
7490cdf0e10cSrcweir ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver();
7491cdf0e10cSrcweir
7492cdf0e10cSrcweir if ( bPrintTitleColumns )
7493cdf0e10cSrcweir {
7494cdf0e10cSrcweir if ( !pDoc->GetRepeatColRange( nTab ) ) // keinen bestehenden Bereich veraendern
7495cdf0e10cSrcweir {
7496cdf0e10cSrcweir ScRange aNew( 0, 0, nTab, 0, 0, nTab ); // Default
7497cdf0e10cSrcweir pDoc->SetRepeatColRange( nTab, &aNew ); // einschalten
7498cdf0e10cSrcweir }
7499cdf0e10cSrcweir }
7500cdf0e10cSrcweir else
7501cdf0e10cSrcweir pDoc->SetRepeatColRange( nTab, NULL ); // abschalten
7502cdf0e10cSrcweir
7503cdf0e10cSrcweir PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc.
7504cdf0e10cSrcweir
7505cdf0e10cSrcweir //! zuletzt gesetzten Bereich beim Abschalten merken und beim Einschalten wiederherstellen ???
7506cdf0e10cSrcweir }
7507cdf0e10cSrcweir }
7508cdf0e10cSrcweir
getTitleColumns()7509cdf0e10cSrcweir table::CellRangeAddress SAL_CALL ScTableSheetObj::getTitleColumns() throw(uno::RuntimeException)
7510cdf0e10cSrcweir {
7511cdf0e10cSrcweir ScUnoGuard aGuard;
7512cdf0e10cSrcweir table::CellRangeAddress aRet;
7513cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7514cdf0e10cSrcweir if ( pDocSh )
7515cdf0e10cSrcweir {
7516cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
7517cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7518cdf0e10cSrcweir const ScRange* pRange = pDoc->GetRepeatColRange(nTab);
7519cdf0e10cSrcweir if (pRange)
7520cdf0e10cSrcweir {
7521cdf0e10cSrcweir ScUnoConversion::FillApiRange( aRet, *pRange );
7522cdf0e10cSrcweir aRet.Sheet = nTab; // core does not care about sheet index
7523cdf0e10cSrcweir }
7524cdf0e10cSrcweir }
7525cdf0e10cSrcweir return aRet;
7526cdf0e10cSrcweir }
7527cdf0e10cSrcweir
setTitleColumns(const table::CellRangeAddress & aTitleColumns)7528cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::setTitleColumns( const table::CellRangeAddress& aTitleColumns )
7529cdf0e10cSrcweir throw(uno::RuntimeException)
7530cdf0e10cSrcweir {
7531cdf0e10cSrcweir ScUnoGuard aGuard;
7532cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7533cdf0e10cSrcweir if ( pDocSh )
7534cdf0e10cSrcweir {
7535cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
7536cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7537cdf0e10cSrcweir
7538cdf0e10cSrcweir ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver();
7539cdf0e10cSrcweir
7540cdf0e10cSrcweir ScRange aNew;
7541cdf0e10cSrcweir ScUnoConversion::FillScRange( aNew, aTitleColumns );
7542cdf0e10cSrcweir pDoc->SetRepeatColRange( nTab, &aNew ); // immer auch einschalten
7543cdf0e10cSrcweir
7544cdf0e10cSrcweir PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc.
7545cdf0e10cSrcweir }
7546cdf0e10cSrcweir }
7547cdf0e10cSrcweir
getPrintTitleRows()7548cdf0e10cSrcweir sal_Bool SAL_CALL ScTableSheetObj::getPrintTitleRows() throw(uno::RuntimeException)
7549cdf0e10cSrcweir {
7550cdf0e10cSrcweir ScUnoGuard aGuard;
7551cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7552cdf0e10cSrcweir if ( pDocSh )
7553cdf0e10cSrcweir {
7554cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
7555cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7556cdf0e10cSrcweir return ( pDoc->GetRepeatRowRange(nTab) != NULL );
7557cdf0e10cSrcweir }
7558cdf0e10cSrcweir return sal_False;
7559cdf0e10cSrcweir }
7560cdf0e10cSrcweir
setPrintTitleRows(sal_Bool bPrintTitleRows)7561cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::setPrintTitleRows( sal_Bool bPrintTitleRows )
7562cdf0e10cSrcweir throw(uno::RuntimeException)
7563cdf0e10cSrcweir {
7564cdf0e10cSrcweir ScUnoGuard aGuard;
7565cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7566cdf0e10cSrcweir if ( pDocSh )
7567cdf0e10cSrcweir {
7568cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
7569cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7570cdf0e10cSrcweir
7571cdf0e10cSrcweir ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver();
7572cdf0e10cSrcweir
7573cdf0e10cSrcweir if ( bPrintTitleRows )
7574cdf0e10cSrcweir {
7575cdf0e10cSrcweir if ( !pDoc->GetRepeatRowRange( nTab ) ) // keinen bestehenden Bereich veraendern
7576cdf0e10cSrcweir {
7577cdf0e10cSrcweir ScRange aNew( 0, 0, nTab, 0, 0, nTab ); // Default
7578cdf0e10cSrcweir pDoc->SetRepeatRowRange( nTab, &aNew ); // einschalten
7579cdf0e10cSrcweir }
7580cdf0e10cSrcweir }
7581cdf0e10cSrcweir else
7582cdf0e10cSrcweir pDoc->SetRepeatRowRange( nTab, NULL ); // abschalten
7583cdf0e10cSrcweir
7584cdf0e10cSrcweir PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc.
7585cdf0e10cSrcweir
7586cdf0e10cSrcweir //! zuletzt gesetzten Bereich beim Abschalten merken und beim Einschalten wiederherstellen ???
7587cdf0e10cSrcweir }
7588cdf0e10cSrcweir }
7589cdf0e10cSrcweir
getTitleRows()7590cdf0e10cSrcweir table::CellRangeAddress SAL_CALL ScTableSheetObj::getTitleRows() throw(uno::RuntimeException)
7591cdf0e10cSrcweir {
7592cdf0e10cSrcweir ScUnoGuard aGuard;
7593cdf0e10cSrcweir table::CellRangeAddress aRet;
7594cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7595cdf0e10cSrcweir if ( pDocSh )
7596cdf0e10cSrcweir {
7597cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
7598cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7599cdf0e10cSrcweir const ScRange* pRange = pDoc->GetRepeatRowRange(nTab);
7600cdf0e10cSrcweir if (pRange)
7601cdf0e10cSrcweir {
7602cdf0e10cSrcweir ScUnoConversion::FillApiRange( aRet, *pRange );
7603cdf0e10cSrcweir aRet.Sheet = nTab; // core does not care about sheet index
7604cdf0e10cSrcweir }
7605cdf0e10cSrcweir }
7606cdf0e10cSrcweir return aRet;
7607cdf0e10cSrcweir }
7608cdf0e10cSrcweir
setTitleRows(const table::CellRangeAddress & aTitleRows)7609cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::setTitleRows( const table::CellRangeAddress& aTitleRows )
7610cdf0e10cSrcweir throw(uno::RuntimeException)
7611cdf0e10cSrcweir {
7612cdf0e10cSrcweir ScUnoGuard aGuard;
7613cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7614cdf0e10cSrcweir if ( pDocSh )
7615cdf0e10cSrcweir {
7616cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
7617cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7618cdf0e10cSrcweir
7619cdf0e10cSrcweir ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver();
7620cdf0e10cSrcweir
7621cdf0e10cSrcweir ScRange aNew;
7622cdf0e10cSrcweir ScUnoConversion::FillScRange( aNew, aTitleRows );
7623cdf0e10cSrcweir pDoc->SetRepeatRowRange( nTab, &aNew ); // immer auch einschalten
7624cdf0e10cSrcweir
7625cdf0e10cSrcweir PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc.
7626cdf0e10cSrcweir }
7627cdf0e10cSrcweir }
7628cdf0e10cSrcweir
7629cdf0e10cSrcweir // XSheetLinkable
7630cdf0e10cSrcweir
getLinkMode()7631cdf0e10cSrcweir sheet::SheetLinkMode SAL_CALL ScTableSheetObj::getLinkMode() throw(uno::RuntimeException)
7632cdf0e10cSrcweir {
7633cdf0e10cSrcweir ScUnoGuard aGuard;
7634cdf0e10cSrcweir sheet::SheetLinkMode eRet = sheet::SheetLinkMode_NONE;
7635cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7636cdf0e10cSrcweir if ( pDocSh )
7637cdf0e10cSrcweir {
7638cdf0e10cSrcweir sal_uInt8 nMode = pDocSh->GetDocument()->GetLinkMode( GetTab_Impl() );
7639cdf0e10cSrcweir if ( nMode == SC_LINK_NORMAL )
7640cdf0e10cSrcweir eRet = sheet::SheetLinkMode_NORMAL;
7641cdf0e10cSrcweir else if ( nMode == SC_LINK_VALUE )
7642cdf0e10cSrcweir eRet = sheet::SheetLinkMode_VALUE;
7643cdf0e10cSrcweir }
7644cdf0e10cSrcweir return eRet;
7645cdf0e10cSrcweir }
7646cdf0e10cSrcweir
setLinkMode(sheet::SheetLinkMode nLinkMode)7647cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::setLinkMode( sheet::SheetLinkMode nLinkMode )
7648cdf0e10cSrcweir throw(uno::RuntimeException)
7649cdf0e10cSrcweir {
7650cdf0e10cSrcweir ScUnoGuard aGuard;
7651cdf0e10cSrcweir
7652cdf0e10cSrcweir //! Filter und Options aus altem Link suchen
7653cdf0e10cSrcweir
7654cdf0e10cSrcweir rtl::OUString aUrl(getLinkUrl());
7655cdf0e10cSrcweir rtl::OUString aSheet(getLinkSheetName());
7656cdf0e10cSrcweir
7657cdf0e10cSrcweir rtl::OUString aEmpty;
7658cdf0e10cSrcweir link( aUrl, aSheet, aEmpty, aEmpty, nLinkMode );
7659cdf0e10cSrcweir }
7660cdf0e10cSrcweir
getLinkUrl()7661cdf0e10cSrcweir rtl::OUString SAL_CALL ScTableSheetObj::getLinkUrl() throw(uno::RuntimeException)
7662cdf0e10cSrcweir {
7663cdf0e10cSrcweir ScUnoGuard aGuard;
7664cdf0e10cSrcweir String aFile;
7665cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7666cdf0e10cSrcweir if ( pDocSh )
7667cdf0e10cSrcweir aFile = pDocSh->GetDocument()->GetLinkDoc( GetTab_Impl() );
7668cdf0e10cSrcweir return aFile;
7669cdf0e10cSrcweir }
7670cdf0e10cSrcweir
setLinkUrl(const rtl::OUString & aLinkUrl)7671cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::setLinkUrl( const rtl::OUString& aLinkUrl )
7672cdf0e10cSrcweir throw(uno::RuntimeException)
7673cdf0e10cSrcweir {
7674cdf0e10cSrcweir ScUnoGuard aGuard;
7675cdf0e10cSrcweir
7676cdf0e10cSrcweir //! Filter und Options aus altem Link suchen
7677cdf0e10cSrcweir
7678cdf0e10cSrcweir sheet::SheetLinkMode eMode = getLinkMode();
7679cdf0e10cSrcweir rtl::OUString aSheet(getLinkSheetName());
7680cdf0e10cSrcweir
7681cdf0e10cSrcweir rtl::OUString aEmpty;
7682cdf0e10cSrcweir link( aLinkUrl, aSheet, aEmpty, aEmpty, eMode );
7683cdf0e10cSrcweir }
7684cdf0e10cSrcweir
getLinkSheetName()7685cdf0e10cSrcweir rtl::OUString SAL_CALL ScTableSheetObj::getLinkSheetName() throw(uno::RuntimeException)
7686cdf0e10cSrcweir {
7687cdf0e10cSrcweir ScUnoGuard aGuard;
7688cdf0e10cSrcweir String aSheet;
7689cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7690cdf0e10cSrcweir if ( pDocSh )
7691cdf0e10cSrcweir aSheet = pDocSh->GetDocument()->GetLinkTab( GetTab_Impl() );
7692cdf0e10cSrcweir return aSheet;
7693cdf0e10cSrcweir }
7694cdf0e10cSrcweir
setLinkSheetName(const rtl::OUString & aLinkSheetName)7695cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::setLinkSheetName( const rtl::OUString& aLinkSheetName )
7696cdf0e10cSrcweir throw(uno::RuntimeException)
7697cdf0e10cSrcweir {
7698cdf0e10cSrcweir ScUnoGuard aGuard;
7699cdf0e10cSrcweir
7700cdf0e10cSrcweir //! Filter und Options aus altem Link suchen
7701cdf0e10cSrcweir
7702cdf0e10cSrcweir sheet::SheetLinkMode eMode = getLinkMode();
7703cdf0e10cSrcweir rtl::OUString aUrl(getLinkUrl());
7704cdf0e10cSrcweir
7705cdf0e10cSrcweir rtl::OUString aEmpty;
7706cdf0e10cSrcweir link( aUrl, aLinkSheetName, aEmpty, aEmpty, eMode );
7707cdf0e10cSrcweir }
7708cdf0e10cSrcweir
link(const rtl::OUString & aUrl,const rtl::OUString & aSheetName,const rtl::OUString & aFilterName,const rtl::OUString & aFilterOptions,sheet::SheetLinkMode nMode)7709cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::link( const rtl::OUString& aUrl, const rtl::OUString& aSheetName,
7710cdf0e10cSrcweir const rtl::OUString& aFilterName, const rtl::OUString& aFilterOptions,
7711cdf0e10cSrcweir sheet::SheetLinkMode nMode ) throw(uno::RuntimeException)
7712cdf0e10cSrcweir {
7713cdf0e10cSrcweir ScUnoGuard aGuard;
7714cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7715cdf0e10cSrcweir if ( pDocSh )
7716cdf0e10cSrcweir {
7717cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
7718cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7719cdf0e10cSrcweir
7720cdf0e10cSrcweir String aFileString (aUrl);
7721cdf0e10cSrcweir String aFilterString (aFilterName);
7722cdf0e10cSrcweir String aOptString (aFilterOptions);
7723cdf0e10cSrcweir String aSheetString (aSheetName);
7724cdf0e10cSrcweir
7725cdf0e10cSrcweir aFileString = ScGlobal::GetAbsDocName( aFileString, pDocSh );
7726cdf0e10cSrcweir if ( !aFilterString.Len() )
7727cdf0e10cSrcweir ScDocumentLoader::GetFilterName( aFileString, aFilterString, aOptString, sal_True, sal_False );
7728cdf0e10cSrcweir
7729cdf0e10cSrcweir // remove application prefix from filter name here, so the filter options
7730cdf0e10cSrcweir // aren't reset when the filter name is changed in ScTableLink::DataChanged
7731cdf0e10cSrcweir ScDocumentLoader::RemoveAppPrefix( aFilterString );
7732cdf0e10cSrcweir
7733cdf0e10cSrcweir sal_uInt8 nLinkMode = SC_LINK_NONE;
7734cdf0e10cSrcweir if ( nMode == sheet::SheetLinkMode_NORMAL )
7735cdf0e10cSrcweir nLinkMode = SC_LINK_NORMAL;
7736cdf0e10cSrcweir else if ( nMode == sheet::SheetLinkMode_VALUE )
7737cdf0e10cSrcweir nLinkMode = SC_LINK_VALUE;
7738cdf0e10cSrcweir
7739cdf0e10cSrcweir sal_uLong nRefresh = 0;
7740cdf0e10cSrcweir pDoc->SetLink( nTab, nLinkMode, aFileString, aFilterString, aOptString, aSheetString, nRefresh );
7741cdf0e10cSrcweir
7742cdf0e10cSrcweir pDocSh->UpdateLinks(); // ggf. Link eintragen oder loeschen
7743cdf0e10cSrcweir SfxBindings* pBindings = pDocSh->GetViewBindings();
7744cdf0e10cSrcweir if (pBindings)
7745cdf0e10cSrcweir pBindings->Invalidate(SID_LINKS);
7746cdf0e10cSrcweir
7747cdf0e10cSrcweir //! Undo fuer Link-Daten an der Table
7748cdf0e10cSrcweir
7749cdf0e10cSrcweir if ( nLinkMode != SC_LINK_NONE && pDoc->IsExecuteLinkEnabled() ) // Link updaten
7750cdf0e10cSrcweir {
7751cdf0e10cSrcweir // Update immer, auch wenn der Link schon da war
7752cdf0e10cSrcweir //! Update nur fuer die betroffene Tabelle???
7753cdf0e10cSrcweir
7754cdf0e10cSrcweir sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
7755cdf0e10cSrcweir sal_uInt16 nCount = pLinkManager->GetLinks().Count();
7756cdf0e10cSrcweir for ( sal_uInt16 i=0; i<nCount; i++ )
7757cdf0e10cSrcweir {
7758cdf0e10cSrcweir ::sfx2::SvBaseLink* pBase = *pLinkManager->GetLinks()[i];
7759cdf0e10cSrcweir if (pBase->ISA(ScTableLink))
7760cdf0e10cSrcweir {
7761cdf0e10cSrcweir ScTableLink* pTabLink = (ScTableLink*)pBase;
7762cdf0e10cSrcweir if ( pTabLink->GetFileName() == aFileString )
7763cdf0e10cSrcweir pTabLink->Update(); // inkl. Paint&Undo
7764cdf0e10cSrcweir
7765cdf0e10cSrcweir //! Der Dateiname sollte nur einmal vorkommen (?)
7766cdf0e10cSrcweir }
7767cdf0e10cSrcweir }
7768cdf0e10cSrcweir }
7769cdf0e10cSrcweir
7770cdf0e10cSrcweir //! Notify fuer ScSheetLinkObj Objekte!!!
7771cdf0e10cSrcweir }
7772cdf0e10cSrcweir }
7773cdf0e10cSrcweir
7774cdf0e10cSrcweir // XSheetAuditing
7775cdf0e10cSrcweir
hideDependents(const table::CellAddress & aPosition)7776cdf0e10cSrcweir sal_Bool SAL_CALL ScTableSheetObj::hideDependents( const table::CellAddress& aPosition )
7777cdf0e10cSrcweir throw(uno::RuntimeException)
7778cdf0e10cSrcweir {
7779cdf0e10cSrcweir ScUnoGuard aGuard;
7780cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7781cdf0e10cSrcweir if ( pDocSh )
7782cdf0e10cSrcweir {
7783cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7784cdf0e10cSrcweir DBG_ASSERT( aPosition.Sheet == nTab, "falsche Tabelle in CellAddress" );
7785cdf0e10cSrcweir ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
7786cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
7787cdf0e10cSrcweir return aFunc.DetectiveDelSucc( aPos );
7788cdf0e10cSrcweir }
7789cdf0e10cSrcweir return sal_False;
7790cdf0e10cSrcweir }
7791cdf0e10cSrcweir
hidePrecedents(const table::CellAddress & aPosition)7792cdf0e10cSrcweir sal_Bool SAL_CALL ScTableSheetObj::hidePrecedents( const table::CellAddress& aPosition )
7793cdf0e10cSrcweir throw(uno::RuntimeException)
7794cdf0e10cSrcweir {
7795cdf0e10cSrcweir ScUnoGuard aGuard;
7796cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7797cdf0e10cSrcweir if ( pDocSh )
7798cdf0e10cSrcweir {
7799cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7800cdf0e10cSrcweir DBG_ASSERT( aPosition.Sheet == nTab, "falsche Tabelle in CellAddress" );
7801cdf0e10cSrcweir ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
7802cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
7803cdf0e10cSrcweir return aFunc.DetectiveDelPred( aPos );
7804cdf0e10cSrcweir }
7805cdf0e10cSrcweir return sal_False;
7806cdf0e10cSrcweir }
7807cdf0e10cSrcweir
showDependents(const table::CellAddress & aPosition)7808cdf0e10cSrcweir sal_Bool SAL_CALL ScTableSheetObj::showDependents( const table::CellAddress& aPosition )
7809cdf0e10cSrcweir throw(uno::RuntimeException)
7810cdf0e10cSrcweir {
7811cdf0e10cSrcweir ScUnoGuard aGuard;
7812cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7813cdf0e10cSrcweir if ( pDocSh )
7814cdf0e10cSrcweir {
7815cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7816cdf0e10cSrcweir DBG_ASSERT( aPosition.Sheet == nTab, "falsche Tabelle in CellAddress" );
7817cdf0e10cSrcweir ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
7818cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
7819cdf0e10cSrcweir return aFunc.DetectiveAddSucc( aPos );
7820cdf0e10cSrcweir }
7821cdf0e10cSrcweir return sal_False;
7822cdf0e10cSrcweir }
7823cdf0e10cSrcweir
showPrecedents(const table::CellAddress & aPosition)7824cdf0e10cSrcweir sal_Bool SAL_CALL ScTableSheetObj::showPrecedents( const table::CellAddress& aPosition )
7825cdf0e10cSrcweir throw(uno::RuntimeException)
7826cdf0e10cSrcweir {
7827cdf0e10cSrcweir ScUnoGuard aGuard;
7828cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7829cdf0e10cSrcweir if ( pDocSh )
7830cdf0e10cSrcweir {
7831cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7832cdf0e10cSrcweir DBG_ASSERT( aPosition.Sheet == nTab, "falsche Tabelle in CellAddress" );
7833cdf0e10cSrcweir ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
7834cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
7835cdf0e10cSrcweir return aFunc.DetectiveAddPred( aPos );
7836cdf0e10cSrcweir }
7837cdf0e10cSrcweir return sal_False;
7838cdf0e10cSrcweir }
7839cdf0e10cSrcweir
showErrors(const table::CellAddress & aPosition)7840cdf0e10cSrcweir sal_Bool SAL_CALL ScTableSheetObj::showErrors( const table::CellAddress& aPosition )
7841cdf0e10cSrcweir throw(uno::RuntimeException)
7842cdf0e10cSrcweir {
7843cdf0e10cSrcweir ScUnoGuard aGuard;
7844cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7845cdf0e10cSrcweir if ( pDocSh )
7846cdf0e10cSrcweir {
7847cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7848cdf0e10cSrcweir DBG_ASSERT( aPosition.Sheet == nTab, "falsche Tabelle in CellAddress" );
7849cdf0e10cSrcweir ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
7850cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
7851cdf0e10cSrcweir return aFunc.DetectiveAddError( aPos );
7852cdf0e10cSrcweir }
7853cdf0e10cSrcweir return sal_False;
7854cdf0e10cSrcweir }
7855cdf0e10cSrcweir
showInvalid()7856cdf0e10cSrcweir sal_Bool SAL_CALL ScTableSheetObj::showInvalid() throw(uno::RuntimeException)
7857cdf0e10cSrcweir {
7858cdf0e10cSrcweir ScUnoGuard aGuard;
7859cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7860cdf0e10cSrcweir if ( pDocSh )
7861cdf0e10cSrcweir {
7862cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
7863cdf0e10cSrcweir return aFunc.DetectiveMarkInvalid( GetTab_Impl() );
7864cdf0e10cSrcweir }
7865cdf0e10cSrcweir return sal_False;
7866cdf0e10cSrcweir }
7867cdf0e10cSrcweir
clearArrows()7868cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::clearArrows() throw(uno::RuntimeException)
7869cdf0e10cSrcweir {
7870cdf0e10cSrcweir ScUnoGuard aGuard;
7871cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7872cdf0e10cSrcweir if ( pDocSh )
7873cdf0e10cSrcweir {
7874cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
7875cdf0e10cSrcweir aFunc.DetectiveDelAll( GetTab_Impl() );
7876cdf0e10cSrcweir }
7877cdf0e10cSrcweir }
7878cdf0e10cSrcweir
7879cdf0e10cSrcweir // XSheetOutline
7880cdf0e10cSrcweir
group(const table::CellRangeAddress & rGroupRange,table::TableOrientation nOrientation)7881cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::group( const table::CellRangeAddress& rGroupRange,
7882cdf0e10cSrcweir table::TableOrientation nOrientation )
7883cdf0e10cSrcweir throw(uno::RuntimeException)
7884cdf0e10cSrcweir {
7885cdf0e10cSrcweir ScUnoGuard aGuard;
7886cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7887cdf0e10cSrcweir if ( pDocSh )
7888cdf0e10cSrcweir {
7889cdf0e10cSrcweir sal_Bool bColumns = ( nOrientation == table::TableOrientation_COLUMNS );
7890cdf0e10cSrcweir ScRange aGroupRange;
7891cdf0e10cSrcweir ScUnoConversion::FillScRange( aGroupRange, rGroupRange );
7892cdf0e10cSrcweir ScOutlineDocFunc aFunc(*pDocSh);
7893cdf0e10cSrcweir aFunc.MakeOutline( aGroupRange, bColumns, sal_True, sal_True );
7894cdf0e10cSrcweir }
7895cdf0e10cSrcweir }
7896cdf0e10cSrcweir
ungroup(const table::CellRangeAddress & rGroupRange,table::TableOrientation nOrientation)7897cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::ungroup( const table::CellRangeAddress& rGroupRange,
7898cdf0e10cSrcweir table::TableOrientation nOrientation )
7899cdf0e10cSrcweir throw(uno::RuntimeException)
7900cdf0e10cSrcweir {
7901cdf0e10cSrcweir ScUnoGuard aGuard;
7902cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7903cdf0e10cSrcweir if ( pDocSh )
7904cdf0e10cSrcweir {
7905cdf0e10cSrcweir sal_Bool bColumns = ( nOrientation == table::TableOrientation_COLUMNS );
7906cdf0e10cSrcweir ScRange aGroupRange;
7907cdf0e10cSrcweir ScUnoConversion::FillScRange( aGroupRange, rGroupRange );
7908cdf0e10cSrcweir ScOutlineDocFunc aFunc(*pDocSh);
7909cdf0e10cSrcweir aFunc.RemoveOutline( aGroupRange, bColumns, sal_True, sal_True );
7910cdf0e10cSrcweir }
7911cdf0e10cSrcweir }
7912cdf0e10cSrcweir
autoOutline(const table::CellRangeAddress & rCellRange)7913cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::autoOutline( const table::CellRangeAddress& rCellRange )
7914cdf0e10cSrcweir throw(uno::RuntimeException)
7915cdf0e10cSrcweir {
7916cdf0e10cSrcweir ScUnoGuard aGuard;
7917cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7918cdf0e10cSrcweir if ( pDocSh )
7919cdf0e10cSrcweir {
7920cdf0e10cSrcweir ScRange aFormulaRange;
7921cdf0e10cSrcweir ScUnoConversion::FillScRange( aFormulaRange, rCellRange );
7922cdf0e10cSrcweir ScOutlineDocFunc aFunc(*pDocSh);
7923cdf0e10cSrcweir aFunc.AutoOutline( aFormulaRange, sal_True, sal_True );
7924cdf0e10cSrcweir }
7925cdf0e10cSrcweir }
7926cdf0e10cSrcweir
clearOutline()7927cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::clearOutline() throw(uno::RuntimeException)
7928cdf0e10cSrcweir {
7929cdf0e10cSrcweir ScUnoGuard aGuard;
7930cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7931cdf0e10cSrcweir if ( pDocSh )
7932cdf0e10cSrcweir {
7933cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7934cdf0e10cSrcweir ScOutlineDocFunc aFunc(*pDocSh);
7935cdf0e10cSrcweir aFunc.RemoveAllOutlines( nTab, sal_True, sal_True );
7936cdf0e10cSrcweir }
7937cdf0e10cSrcweir }
7938cdf0e10cSrcweir
hideDetail(const table::CellRangeAddress & rCellRange)7939cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::hideDetail( const table::CellRangeAddress& rCellRange )
7940cdf0e10cSrcweir throw(uno::RuntimeException)
7941cdf0e10cSrcweir {
7942cdf0e10cSrcweir ScUnoGuard aGuard;
7943cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7944cdf0e10cSrcweir if ( pDocSh )
7945cdf0e10cSrcweir {
7946cdf0e10cSrcweir ScRange aMarkRange;
7947cdf0e10cSrcweir ScUnoConversion::FillScRange( aMarkRange, rCellRange );
7948cdf0e10cSrcweir ScOutlineDocFunc aFunc(*pDocSh);
7949cdf0e10cSrcweir aFunc.HideMarkedOutlines( aMarkRange, sal_True, sal_True );
7950cdf0e10cSrcweir }
7951cdf0e10cSrcweir }
7952cdf0e10cSrcweir
showDetail(const table::CellRangeAddress & rCellRange)7953cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::showDetail( const table::CellRangeAddress& rCellRange )
7954cdf0e10cSrcweir throw(uno::RuntimeException)
7955cdf0e10cSrcweir {
7956cdf0e10cSrcweir ScUnoGuard aGuard;
7957cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7958cdf0e10cSrcweir if ( pDocSh )
7959cdf0e10cSrcweir {
7960cdf0e10cSrcweir ScRange aMarkRange;
7961cdf0e10cSrcweir ScUnoConversion::FillScRange( aMarkRange, rCellRange );
7962cdf0e10cSrcweir ScOutlineDocFunc aFunc(*pDocSh);
7963cdf0e10cSrcweir aFunc.ShowMarkedOutlines( aMarkRange, sal_True, sal_True );
7964cdf0e10cSrcweir }
7965cdf0e10cSrcweir }
7966cdf0e10cSrcweir
showLevel(sal_Int16 nLevel,table::TableOrientation nOrientation)7967cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::showLevel( sal_Int16 nLevel, table::TableOrientation nOrientation )
7968cdf0e10cSrcweir throw(uno::RuntimeException)
7969cdf0e10cSrcweir {
7970cdf0e10cSrcweir ScUnoGuard aGuard;
7971cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7972cdf0e10cSrcweir if ( pDocSh )
7973cdf0e10cSrcweir {
7974cdf0e10cSrcweir sal_Bool bColumns = ( nOrientation == table::TableOrientation_COLUMNS );
7975cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
7976cdf0e10cSrcweir ScOutlineDocFunc aFunc(*pDocSh);
7977cdf0e10cSrcweir aFunc.SelectLevel( nTab, bColumns, nLevel, sal_True, sal_True, sal_True );
7978cdf0e10cSrcweir }
7979cdf0e10cSrcweir }
7980cdf0e10cSrcweir
7981cdf0e10cSrcweir // XProtectable
7982cdf0e10cSrcweir
protect(const rtl::OUString & aPassword)7983cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::protect( const rtl::OUString& aPassword )
7984cdf0e10cSrcweir throw(uno::RuntimeException)
7985cdf0e10cSrcweir {
7986cdf0e10cSrcweir ScUnoGuard aGuard;
7987cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
7988cdf0e10cSrcweir // #i108245# if already protected, don't change anything
7989cdf0e10cSrcweir if ( pDocSh && !pDocSh->GetDocument()->IsTabProtected( GetTab_Impl() ) )
7990cdf0e10cSrcweir {
7991cdf0e10cSrcweir String aString(aPassword);
7992cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
7993cdf0e10cSrcweir aFunc.Protect( GetTab_Impl(), aString, sal_True );
7994cdf0e10cSrcweir }
7995cdf0e10cSrcweir }
7996cdf0e10cSrcweir
unprotect(const rtl::OUString & aPassword)7997cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::unprotect( const rtl::OUString& aPassword )
7998cdf0e10cSrcweir throw(lang::IllegalArgumentException, uno::RuntimeException)
7999cdf0e10cSrcweir {
8000cdf0e10cSrcweir ScUnoGuard aGuard;
8001cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
8002cdf0e10cSrcweir if ( pDocSh )
8003cdf0e10cSrcweir {
8004cdf0e10cSrcweir String aString(aPassword);
8005cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
8006cdf0e10cSrcweir sal_Bool bDone = aFunc.Unprotect( GetTab_Impl(), aString, sal_True );
8007cdf0e10cSrcweir if (!bDone)
8008cdf0e10cSrcweir throw lang::IllegalArgumentException();
8009cdf0e10cSrcweir }
8010cdf0e10cSrcweir }
8011cdf0e10cSrcweir
isProtected()8012cdf0e10cSrcweir sal_Bool SAL_CALL ScTableSheetObj::isProtected() throw(uno::RuntimeException)
8013cdf0e10cSrcweir {
8014cdf0e10cSrcweir ScUnoGuard aGuard;
8015cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
8016cdf0e10cSrcweir if ( pDocSh )
8017cdf0e10cSrcweir return pDocSh->GetDocument()->IsTabProtected( GetTab_Impl() );
8018cdf0e10cSrcweir
8019cdf0e10cSrcweir DBG_ERROR("keine DocShell"); //! Exception oder so?
8020cdf0e10cSrcweir return sal_False;
8021cdf0e10cSrcweir }
8022cdf0e10cSrcweir
8023cdf0e10cSrcweir // XScenario
8024cdf0e10cSrcweir
getIsScenario()8025cdf0e10cSrcweir sal_Bool SAL_CALL ScTableSheetObj::getIsScenario() throw(uno::RuntimeException)
8026cdf0e10cSrcweir {
8027cdf0e10cSrcweir ScUnoGuard aGuard;
8028cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
8029cdf0e10cSrcweir if ( pDocSh )
8030cdf0e10cSrcweir return pDocSh->GetDocument()->IsScenario( GetTab_Impl() );
8031cdf0e10cSrcweir
8032cdf0e10cSrcweir return sal_False;
8033cdf0e10cSrcweir }
8034cdf0e10cSrcweir
getScenarioComment()8035cdf0e10cSrcweir rtl::OUString SAL_CALL ScTableSheetObj::getScenarioComment() throw(uno::RuntimeException)
8036cdf0e10cSrcweir {
8037cdf0e10cSrcweir ScUnoGuard aGuard;
8038cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
8039cdf0e10cSrcweir if ( pDocSh )
8040cdf0e10cSrcweir {
8041cdf0e10cSrcweir String aComment;
8042cdf0e10cSrcweir Color aColor;
8043cdf0e10cSrcweir sal_uInt16 nFlags;
8044cdf0e10cSrcweir pDocSh->GetDocument()->GetScenarioData( GetTab_Impl(), aComment, aColor, nFlags );
8045cdf0e10cSrcweir return aComment;
8046cdf0e10cSrcweir }
8047cdf0e10cSrcweir return rtl::OUString();
8048cdf0e10cSrcweir }
8049cdf0e10cSrcweir
setScenarioComment(const rtl::OUString & aScenarioComment)8050cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::setScenarioComment( const rtl::OUString& aScenarioComment )
8051cdf0e10cSrcweir throw(uno::RuntimeException)
8052cdf0e10cSrcweir {
8053cdf0e10cSrcweir ScUnoGuard aGuard;
8054cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
8055cdf0e10cSrcweir if ( pDocSh )
8056cdf0e10cSrcweir {
8057cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
8058cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
8059cdf0e10cSrcweir
8060cdf0e10cSrcweir String aName;
8061cdf0e10cSrcweir String aComment;
8062cdf0e10cSrcweir Color aColor;
8063cdf0e10cSrcweir sal_uInt16 nFlags;
8064cdf0e10cSrcweir pDoc->GetName( nTab, aName );
8065cdf0e10cSrcweir pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8066cdf0e10cSrcweir
8067cdf0e10cSrcweir aComment = String( aScenarioComment );
8068cdf0e10cSrcweir
8069cdf0e10cSrcweir pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
8070cdf0e10cSrcweir }
8071cdf0e10cSrcweir }
8072cdf0e10cSrcweir
addRanges(const uno::Sequence<table::CellRangeAddress> & rScenRanges)8073cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::addRanges( const uno::Sequence<table::CellRangeAddress>& rScenRanges )
8074cdf0e10cSrcweir throw(uno::RuntimeException)
8075cdf0e10cSrcweir {
8076cdf0e10cSrcweir ScUnoGuard aGuard;
8077cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
8078cdf0e10cSrcweir if ( pDocSh )
8079cdf0e10cSrcweir {
8080cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
8081cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
8082cdf0e10cSrcweir
8083cdf0e10cSrcweir if (pDoc->IsScenario(nTab))
8084cdf0e10cSrcweir {
8085cdf0e10cSrcweir ScMarkData aMarkData;
8086cdf0e10cSrcweir aMarkData.SelectTable( nTab, sal_True );
8087cdf0e10cSrcweir
8088cdf0e10cSrcweir sal_uInt16 nRangeCount = (sal_uInt16)rScenRanges.getLength();
8089cdf0e10cSrcweir if (nRangeCount)
8090cdf0e10cSrcweir {
8091cdf0e10cSrcweir const table::CellRangeAddress* pAry = rScenRanges.getConstArray();
8092cdf0e10cSrcweir for (sal_uInt16 i=0; i<nRangeCount; i++)
8093cdf0e10cSrcweir {
8094cdf0e10cSrcweir DBG_ASSERT( pAry[i].Sheet == nTab, "addRanges mit falscher Tab" );
8095cdf0e10cSrcweir ScRange aOneRange( (SCCOL)pAry[i].StartColumn, (SCROW)pAry[i].StartRow, nTab,
8096cdf0e10cSrcweir (SCCOL)pAry[i].EndColumn, (SCROW)pAry[i].EndRow, nTab );
8097cdf0e10cSrcweir
8098cdf0e10cSrcweir aMarkData.SetMultiMarkArea( aOneRange );
8099cdf0e10cSrcweir }
8100cdf0e10cSrcweir }
8101cdf0e10cSrcweir
8102cdf0e10cSrcweir // Szenario-Ranges sind durch Attribut gekennzeichnet
8103cdf0e10cSrcweir ScPatternAttr aPattern( pDoc->GetPool() );
8104cdf0e10cSrcweir aPattern.GetItemSet().Put( ScMergeFlagAttr( SC_MF_SCENARIO ) );
8105cdf0e10cSrcweir aPattern.GetItemSet().Put( ScProtectionAttr( sal_True ) );
8106cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
8107cdf0e10cSrcweir aFunc.ApplyAttributes( aMarkData, aPattern, sal_True, sal_True );
8108cdf0e10cSrcweir }
8109cdf0e10cSrcweir
8110cdf0e10cSrcweir // don't use. We should use therefor a private interface, so we can also set the flags.
8111cdf0e10cSrcweir /* else if (nTab > 0 && pDoc->IsImportingXML()) // make this sheet as an scenario and only if it is not the first sheet and only if it is ImportingXML,
8112cdf0e10cSrcweir // because than no UNDO and repaint is necessary.
8113cdf0e10cSrcweir {
8114cdf0e10cSrcweir sal_uInt16 nRangeCount = (sal_uInt16)rScenRanges.getLength();
8115cdf0e10cSrcweir if (nRangeCount)
8116cdf0e10cSrcweir {
8117cdf0e10cSrcweir pDoc->SetScenario( nTab, sal_True );
8118cdf0e10cSrcweir
8119cdf0e10cSrcweir // default flags
8120cdf0e10cSrcweir Color aColor( COL_LIGHTGRAY ); // Default
8121cdf0e10cSrcweir sal_uInt16 nFlags = SC_SCENARIO_SHOWFRAME | SC_SCENARIO_PRINTFRAME | SC_SCENARIO_TWOWAY;
8122cdf0e10cSrcweir String aComment;
8123cdf0e10cSrcweir
8124cdf0e10cSrcweir pDoc->SetScenarioData( nTab, aComment, aColor, nFlags );
8125cdf0e10cSrcweir const table::CellRangeAddress* pAry = rScenRanges.getConstArray();
8126cdf0e10cSrcweir for (sal_uInt16 i=0; i<nRangeCount; i++)
8127cdf0e10cSrcweir {
8128cdf0e10cSrcweir DBG_ASSERT( pAry[i].Sheet == nTab, "addRanges mit falscher Tab" );
8129cdf0e10cSrcweir pDoc->ApplyFlagsTab( (sal_uInt16)pAry[i].StartColumn, (sal_uInt16)pAry[i].StartRow,
8130cdf0e10cSrcweir (sal_uInt16)pAry[i].EndColumn, (sal_uInt16)pAry[i].EndRow, nTab, SC_MF_SCENARIO );
8131cdf0e10cSrcweir }
8132cdf0e10cSrcweir pDoc->SetActiveScenario( nTab, sal_True );
8133cdf0e10cSrcweir
8134cdf0e10cSrcweir // set to next visible tab
8135cdf0e10cSrcweir sal_uInt16 j = nTab - 1;
8136cdf0e10cSrcweir sal_Bool bFinished = sal_False;
8137cdf0e10cSrcweir while (j < nTab && !bFinished)
8138cdf0e10cSrcweir {
8139cdf0e10cSrcweir if (pDoc->IsVisible(j))
8140cdf0e10cSrcweir {
8141cdf0e10cSrcweir pDoc->SetVisibleTab(j);
8142cdf0e10cSrcweir bFinished = sal_True;
8143cdf0e10cSrcweir }
8144cdf0e10cSrcweir else
8145cdf0e10cSrcweir --j;
8146cdf0e10cSrcweir }
8147cdf0e10cSrcweir
8148cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
8149cdf0e10cSrcweir aFunc.SetTableVisible( nTab, sal_False, sal_True );
8150cdf0e10cSrcweir }
8151cdf0e10cSrcweir }*/
8152cdf0e10cSrcweir }
8153cdf0e10cSrcweir }
8154cdf0e10cSrcweir
apply()8155cdf0e10cSrcweir void SAL_CALL ScTableSheetObj::apply() throw(uno::RuntimeException)
8156cdf0e10cSrcweir {
8157cdf0e10cSrcweir ScUnoGuard aGuard;
8158cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
8159cdf0e10cSrcweir if ( pDocSh )
8160cdf0e10cSrcweir {
8161cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
8162cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
8163cdf0e10cSrcweir String aName;
8164cdf0e10cSrcweir pDoc->GetName( nTab, aName ); // Name dieses Szenarios
8165cdf0e10cSrcweir
8166cdf0e10cSrcweir SCTAB nDestTab = nTab;
8167cdf0e10cSrcweir while ( nDestTab > 0 && pDoc->IsScenario(nDestTab) )
8168cdf0e10cSrcweir --nDestTab;
8169cdf0e10cSrcweir
8170cdf0e10cSrcweir if ( !pDoc->IsScenario(nDestTab) )
8171cdf0e10cSrcweir pDocSh->UseScenario( nDestTab, aName );
8172cdf0e10cSrcweir
8173cdf0e10cSrcweir //! sonst Fehler oder so
8174cdf0e10cSrcweir }
8175cdf0e10cSrcweir }
8176cdf0e10cSrcweir
8177cdf0e10cSrcweir // XScenarioEnhanced
8178cdf0e10cSrcweir
getRanges()8179cdf0e10cSrcweir uno::Sequence< table::CellRangeAddress > SAL_CALL ScTableSheetObj::getRanges( )
8180cdf0e10cSrcweir throw(uno::RuntimeException)
8181cdf0e10cSrcweir {
8182cdf0e10cSrcweir ScUnoGuard aGuard;
8183cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
8184cdf0e10cSrcweir if ( pDocSh )
8185cdf0e10cSrcweir {
8186cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
8187cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
8188cdf0e10cSrcweir const ScRangeList* pRangeList = pDoc->GetScenarioRanges(nTab);
8189cdf0e10cSrcweir if (pRangeList)
8190cdf0e10cSrcweir {
8191cdf0e10cSrcweir sal_Int32 nCount = pRangeList->Count();
8192cdf0e10cSrcweir uno::Sequence< table::CellRangeAddress > aRetRanges(nCount);
8193cdf0e10cSrcweir table::CellRangeAddress* pAry = aRetRanges.getArray();
8194cdf0e10cSrcweir for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
8195cdf0e10cSrcweir {
8196cdf0e10cSrcweir const ScRange* pRange = pRangeList->GetObject( nIndex );
8197cdf0e10cSrcweir pAry->StartColumn = pRange->aStart.Col();
8198cdf0e10cSrcweir pAry->StartRow = pRange->aStart.Row();
8199cdf0e10cSrcweir pAry->EndColumn = pRange->aEnd.Col();
8200cdf0e10cSrcweir pAry->EndRow = pRange->aEnd.Row();
8201cdf0e10cSrcweir pAry->Sheet = pRange->aStart.Tab();
8202cdf0e10cSrcweir ++pAry;
8203cdf0e10cSrcweir }
8204cdf0e10cSrcweir return aRetRanges;
8205cdf0e10cSrcweir }
8206cdf0e10cSrcweir }
8207cdf0e10cSrcweir return uno::Sequence< table::CellRangeAddress > ();
8208cdf0e10cSrcweir }
8209cdf0e10cSrcweir
8210cdf0e10cSrcweir // XExternalSheetName
8211cdf0e10cSrcweir
setExternalName(const::rtl::OUString & aUrl,const::rtl::OUString & aSheetName)8212cdf0e10cSrcweir void ScTableSheetObj::setExternalName( const ::rtl::OUString& aUrl, const ::rtl::OUString& aSheetName )
8213cdf0e10cSrcweir throw (container::ElementExistException, uno::RuntimeException)
8214cdf0e10cSrcweir {
8215cdf0e10cSrcweir ScUnoGuard aGuard;
8216cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
8217cdf0e10cSrcweir if ( pDocSh )
8218cdf0e10cSrcweir {
8219cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
8220cdf0e10cSrcweir if ( pDoc )
8221cdf0e10cSrcweir {
8222cdf0e10cSrcweir const SCTAB nTab = GetTab_Impl();
8223cdf0e10cSrcweir const String aAbsDocName( ScGlobal::GetAbsDocName( aUrl, pDocSh ) );
8224cdf0e10cSrcweir const String aDocTabName( ScGlobal::GetDocTabName( aAbsDocName, aSheetName ) );
8225cdf0e10cSrcweir if ( !pDoc->RenameTab( nTab, aDocTabName, sal_False /*bUpdateRef*/, sal_True /*bExternalDocument*/ ) )
8226cdf0e10cSrcweir {
8227cdf0e10cSrcweir throw container::ElementExistException( ::rtl::OUString(), *this );
8228cdf0e10cSrcweir }
8229cdf0e10cSrcweir }
8230cdf0e10cSrcweir }
8231cdf0e10cSrcweir }
8232cdf0e10cSrcweir
8233cdf0e10cSrcweir // XEventsSupplier
8234cdf0e10cSrcweir
getEvents()8235cdf0e10cSrcweir uno::Reference<container::XNameReplace> SAL_CALL ScTableSheetObj::getEvents() throw (uno::RuntimeException)
8236cdf0e10cSrcweir {
8237cdf0e10cSrcweir ScUnoGuard aGuard;
8238cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
8239cdf0e10cSrcweir if ( pDocSh )
8240cdf0e10cSrcweir return new ScSheetEventsObj( pDocSh, GetTab_Impl() );
8241cdf0e10cSrcweir
8242cdf0e10cSrcweir return NULL;
8243cdf0e10cSrcweir }
8244cdf0e10cSrcweir
8245cdf0e10cSrcweir // XPropertySet erweitert fuer Sheet-Properties
8246cdf0e10cSrcweir
getPropertySetInfo()8247cdf0e10cSrcweir uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTableSheetObj::getPropertySetInfo()
8248cdf0e10cSrcweir throw(uno::RuntimeException)
8249cdf0e10cSrcweir {
8250cdf0e10cSrcweir ScUnoGuard aGuard;
8251cdf0e10cSrcweir static uno::Reference<beans::XPropertySetInfo> aRef(
8252cdf0e10cSrcweir new SfxItemPropertySetInfo( pSheetPropSet->getPropertyMap() ));
8253cdf0e10cSrcweir return aRef;
8254cdf0e10cSrcweir }
8255cdf0e10cSrcweir
SetOnePropertyValue(const SfxItemPropertySimpleEntry * pEntry,const uno::Any & aValue)8256cdf0e10cSrcweir void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
8257cdf0e10cSrcweir throw(lang::IllegalArgumentException, uno::RuntimeException)
8258cdf0e10cSrcweir {
8259cdf0e10cSrcweir if ( pEntry )
8260cdf0e10cSrcweir {
8261cdf0e10cSrcweir if ( IsScItemWid( pEntry->nWID ) )
8262cdf0e10cSrcweir {
8263cdf0e10cSrcweir // for Item WIDs, call ScCellRangesBase directly
8264cdf0e10cSrcweir ScCellRangesBase::SetOnePropertyValue(pEntry, aValue);
8265cdf0e10cSrcweir return;
8266cdf0e10cSrcweir }
8267cdf0e10cSrcweir
8268cdf0e10cSrcweir // own properties
8269cdf0e10cSrcweir
8270cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
8271cdf0e10cSrcweir if (!pDocSh)
8272cdf0e10cSrcweir return; //! Exception oder so?
8273cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
8274cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
8275cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
8276cdf0e10cSrcweir
8277cdf0e10cSrcweir if ( pEntry->nWID == SC_WID_UNO_PAGESTL )
8278cdf0e10cSrcweir {
8279cdf0e10cSrcweir rtl::OUString aStrVal;
8280cdf0e10cSrcweir aValue >>= aStrVal;
8281cdf0e10cSrcweir String aNewStr(ScStyleNameConversion::ProgrammaticToDisplayName(
8282cdf0e10cSrcweir aStrVal, SFX_STYLE_FAMILY_PAGE ));
8283cdf0e10cSrcweir
8284cdf0e10cSrcweir //! Undo? (auch bei SID_STYLE_APPLY an der View)
8285cdf0e10cSrcweir
8286cdf0e10cSrcweir if ( pDoc->GetPageStyle( nTab ) != aNewStr )
8287cdf0e10cSrcweir {
8288cdf0e10cSrcweir pDoc->SetPageStyle( nTab, aNewStr );
8289cdf0e10cSrcweir if (!pDoc->IsImportingXML())
8290cdf0e10cSrcweir {
8291cdf0e10cSrcweir ScPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab ).UpdatePages();
8292cdf0e10cSrcweir
8293cdf0e10cSrcweir SfxBindings* pBindings = pDocSh->GetViewBindings();
8294cdf0e10cSrcweir if (pBindings)
8295cdf0e10cSrcweir {
8296cdf0e10cSrcweir pBindings->Invalidate( SID_STYLE_FAMILY4 );
8297cdf0e10cSrcweir pBindings->Invalidate( SID_STATUS_PAGESTYLE );
8298cdf0e10cSrcweir pBindings->Invalidate( FID_RESET_PRINTZOOM );
8299cdf0e10cSrcweir pBindings->Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT );
8300cdf0e10cSrcweir pBindings->Invalidate( SID_ATTR_PARA_RIGHT_TO_LEFT );
8301cdf0e10cSrcweir }
8302cdf0e10cSrcweir }
8303cdf0e10cSrcweir pDocSh->SetDocumentModified();
8304cdf0e10cSrcweir }
8305cdf0e10cSrcweir }
8306cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
8307cdf0e10cSrcweir {
8308cdf0e10cSrcweir sal_Bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
8309cdf0e10cSrcweir aFunc.SetTableVisible( nTab, bVis, sal_True );
8310cdf0e10cSrcweir }
8311cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_ISACTIVE )
8312cdf0e10cSrcweir {
8313cdf0e10cSrcweir if (pDoc->IsScenario(nTab))
8314cdf0e10cSrcweir pDoc->SetActiveScenario( nTab, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
8315cdf0e10cSrcweir }
8316cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_BORDCOL )
8317cdf0e10cSrcweir {
8318cdf0e10cSrcweir if (pDoc->IsScenario(nTab))
8319cdf0e10cSrcweir {
8320cdf0e10cSrcweir sal_Int32 nNewColor = 0;
8321cdf0e10cSrcweir if (aValue >>= nNewColor)
8322cdf0e10cSrcweir {
8323cdf0e10cSrcweir String aName;
8324cdf0e10cSrcweir String aComment;
8325cdf0e10cSrcweir Color aColor;
8326cdf0e10cSrcweir sal_uInt16 nFlags;
8327cdf0e10cSrcweir pDoc->GetName( nTab, aName );
8328cdf0e10cSrcweir pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8329cdf0e10cSrcweir
8330cdf0e10cSrcweir aColor = Color(static_cast<sal_uInt32>(nNewColor));
8331cdf0e10cSrcweir
8332cdf0e10cSrcweir pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
8333cdf0e10cSrcweir }
8334cdf0e10cSrcweir }
8335cdf0e10cSrcweir }
8336cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_PROTECT )
8337cdf0e10cSrcweir {
8338cdf0e10cSrcweir if (pDoc->IsScenario(nTab))
8339cdf0e10cSrcweir {
8340cdf0e10cSrcweir String aName;
8341cdf0e10cSrcweir String aComment;
8342cdf0e10cSrcweir Color aColor;
8343cdf0e10cSrcweir sal_uInt16 nFlags;
8344cdf0e10cSrcweir pDoc->GetName( nTab, aName );
8345cdf0e10cSrcweir pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8346cdf0e10cSrcweir sal_Bool bModify(sal_False);
8347cdf0e10cSrcweir
8348cdf0e10cSrcweir if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
8349cdf0e10cSrcweir {
8350cdf0e10cSrcweir if (!(nFlags & SC_SCENARIO_PROTECT))
8351cdf0e10cSrcweir {
8352cdf0e10cSrcweir nFlags |= SC_SCENARIO_PROTECT;
8353cdf0e10cSrcweir bModify = sal_True;
8354cdf0e10cSrcweir }
8355cdf0e10cSrcweir }
8356cdf0e10cSrcweir else
8357cdf0e10cSrcweir {
8358cdf0e10cSrcweir if (nFlags & SC_SCENARIO_PROTECT)
8359cdf0e10cSrcweir {
8360cdf0e10cSrcweir nFlags -= SC_SCENARIO_PROTECT;
8361cdf0e10cSrcweir bModify = sal_True;
8362cdf0e10cSrcweir }
8363cdf0e10cSrcweir }
8364cdf0e10cSrcweir
8365cdf0e10cSrcweir if (bModify)
8366cdf0e10cSrcweir pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
8367cdf0e10cSrcweir }
8368cdf0e10cSrcweir }
8369cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_SHOWBORD )
8370cdf0e10cSrcweir {
8371cdf0e10cSrcweir if (pDoc->IsScenario(nTab))
8372cdf0e10cSrcweir {
8373cdf0e10cSrcweir String aName;
8374cdf0e10cSrcweir String aComment;
8375cdf0e10cSrcweir Color aColor;
8376cdf0e10cSrcweir sal_uInt16 nFlags;
8377cdf0e10cSrcweir pDoc->GetName( nTab, aName );
8378cdf0e10cSrcweir pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8379cdf0e10cSrcweir sal_Bool bModify(sal_False);
8380cdf0e10cSrcweir
8381cdf0e10cSrcweir if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
8382cdf0e10cSrcweir {
8383cdf0e10cSrcweir if (!(nFlags & SC_SCENARIO_SHOWFRAME))
8384cdf0e10cSrcweir {
8385cdf0e10cSrcweir nFlags |= SC_SCENARIO_SHOWFRAME;
8386cdf0e10cSrcweir bModify = sal_True;
8387cdf0e10cSrcweir }
8388cdf0e10cSrcweir }
8389cdf0e10cSrcweir else
8390cdf0e10cSrcweir {
8391cdf0e10cSrcweir if (nFlags & SC_SCENARIO_SHOWFRAME)
8392cdf0e10cSrcweir {
8393cdf0e10cSrcweir nFlags -= SC_SCENARIO_SHOWFRAME;
8394cdf0e10cSrcweir bModify = sal_True;
8395cdf0e10cSrcweir }
8396cdf0e10cSrcweir }
8397cdf0e10cSrcweir
8398cdf0e10cSrcweir if (bModify)
8399cdf0e10cSrcweir pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
8400cdf0e10cSrcweir }
8401cdf0e10cSrcweir }
8402cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_PRINTBORD )
8403cdf0e10cSrcweir {
8404cdf0e10cSrcweir if (pDoc->IsScenario(nTab))
8405cdf0e10cSrcweir {
8406cdf0e10cSrcweir String aName;
8407cdf0e10cSrcweir String aComment;
8408cdf0e10cSrcweir Color aColor;
8409cdf0e10cSrcweir sal_uInt16 nFlags;
8410cdf0e10cSrcweir pDoc->GetName( nTab, aName );
8411cdf0e10cSrcweir pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8412cdf0e10cSrcweir sal_Bool bModify(sal_False);
8413cdf0e10cSrcweir
8414cdf0e10cSrcweir if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
8415cdf0e10cSrcweir {
8416cdf0e10cSrcweir if (!(nFlags & SC_SCENARIO_PRINTFRAME))
8417cdf0e10cSrcweir {
8418cdf0e10cSrcweir nFlags |= SC_SCENARIO_PRINTFRAME;
8419cdf0e10cSrcweir bModify = sal_True;
8420cdf0e10cSrcweir }
8421cdf0e10cSrcweir }
8422cdf0e10cSrcweir else
8423cdf0e10cSrcweir {
8424cdf0e10cSrcweir if (nFlags & SC_SCENARIO_PRINTFRAME)
8425cdf0e10cSrcweir {
8426cdf0e10cSrcweir nFlags -= SC_SCENARIO_PRINTFRAME;
8427cdf0e10cSrcweir bModify = sal_True;
8428cdf0e10cSrcweir }
8429cdf0e10cSrcweir }
8430cdf0e10cSrcweir
8431cdf0e10cSrcweir if (bModify)
8432cdf0e10cSrcweir pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
8433cdf0e10cSrcweir }
8434cdf0e10cSrcweir }
8435cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_COPYBACK )
8436cdf0e10cSrcweir {
8437cdf0e10cSrcweir if (pDoc->IsScenario(nTab))
8438cdf0e10cSrcweir {
8439cdf0e10cSrcweir String aName;
8440cdf0e10cSrcweir String aComment;
8441cdf0e10cSrcweir Color aColor;
8442cdf0e10cSrcweir sal_uInt16 nFlags;
8443cdf0e10cSrcweir pDoc->GetName( nTab, aName );
8444cdf0e10cSrcweir pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8445cdf0e10cSrcweir sal_Bool bModify(sal_False);
8446cdf0e10cSrcweir
8447cdf0e10cSrcweir if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
8448cdf0e10cSrcweir {
8449cdf0e10cSrcweir if (!(nFlags & SC_SCENARIO_TWOWAY))
8450cdf0e10cSrcweir {
8451cdf0e10cSrcweir nFlags |= SC_SCENARIO_TWOWAY;
8452cdf0e10cSrcweir bModify = sal_True;
8453cdf0e10cSrcweir }
8454cdf0e10cSrcweir }
8455cdf0e10cSrcweir else
8456cdf0e10cSrcweir {
8457cdf0e10cSrcweir if (nFlags & SC_SCENARIO_TWOWAY)
8458cdf0e10cSrcweir {
8459cdf0e10cSrcweir nFlags -= SC_SCENARIO_TWOWAY;
8460cdf0e10cSrcweir bModify = sal_True;
8461cdf0e10cSrcweir }
8462cdf0e10cSrcweir }
8463cdf0e10cSrcweir
8464cdf0e10cSrcweir if (bModify)
8465cdf0e10cSrcweir pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
8466cdf0e10cSrcweir }
8467cdf0e10cSrcweir }
8468cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_COPYSTYL )
8469cdf0e10cSrcweir {
8470cdf0e10cSrcweir if (pDoc->IsScenario(nTab))
8471cdf0e10cSrcweir {
8472cdf0e10cSrcweir String aName;
8473cdf0e10cSrcweir String aComment;
8474cdf0e10cSrcweir Color aColor;
8475cdf0e10cSrcweir sal_uInt16 nFlags;
8476cdf0e10cSrcweir pDoc->GetName( nTab, aName );
8477cdf0e10cSrcweir pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8478cdf0e10cSrcweir sal_Bool bModify(sal_False);
8479cdf0e10cSrcweir
8480cdf0e10cSrcweir if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
8481cdf0e10cSrcweir {
8482cdf0e10cSrcweir if (!(nFlags & SC_SCENARIO_ATTRIB))
8483cdf0e10cSrcweir {
8484cdf0e10cSrcweir nFlags |= SC_SCENARIO_ATTRIB;
8485cdf0e10cSrcweir bModify = sal_True;
8486cdf0e10cSrcweir }
8487cdf0e10cSrcweir }
8488cdf0e10cSrcweir else
8489cdf0e10cSrcweir {
8490cdf0e10cSrcweir if (nFlags & SC_SCENARIO_ATTRIB)
8491cdf0e10cSrcweir {
8492cdf0e10cSrcweir nFlags -= SC_SCENARIO_ATTRIB;
8493cdf0e10cSrcweir bModify = sal_True;
8494cdf0e10cSrcweir }
8495cdf0e10cSrcweir }
8496cdf0e10cSrcweir
8497cdf0e10cSrcweir if (bModify)
8498cdf0e10cSrcweir pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
8499cdf0e10cSrcweir }
8500cdf0e10cSrcweir }
8501cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_COPYFORM )
8502cdf0e10cSrcweir {
8503cdf0e10cSrcweir if (pDoc->IsScenario(nTab))
8504cdf0e10cSrcweir {
8505cdf0e10cSrcweir String aName;
8506cdf0e10cSrcweir String aComment;
8507cdf0e10cSrcweir Color aColor;
8508cdf0e10cSrcweir sal_uInt16 nFlags;
8509cdf0e10cSrcweir pDoc->GetName( nTab, aName );
8510cdf0e10cSrcweir pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8511cdf0e10cSrcweir sal_Bool bModify(sal_False);
8512cdf0e10cSrcweir
8513cdf0e10cSrcweir if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
8514cdf0e10cSrcweir {
8515cdf0e10cSrcweir if (nFlags & SC_SCENARIO_VALUE)
8516cdf0e10cSrcweir {
8517cdf0e10cSrcweir nFlags -= SC_SCENARIO_VALUE;
8518cdf0e10cSrcweir bModify = sal_True;
8519cdf0e10cSrcweir }
8520cdf0e10cSrcweir }
8521cdf0e10cSrcweir else
8522cdf0e10cSrcweir {
8523cdf0e10cSrcweir if (!(nFlags & SC_SCENARIO_VALUE))
8524cdf0e10cSrcweir {
8525cdf0e10cSrcweir nFlags |= SC_SCENARIO_VALUE;
8526cdf0e10cSrcweir bModify = sal_True;
8527cdf0e10cSrcweir }
8528cdf0e10cSrcweir }
8529cdf0e10cSrcweir
8530cdf0e10cSrcweir if (bModify)
8531cdf0e10cSrcweir pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
8532cdf0e10cSrcweir }
8533cdf0e10cSrcweir }
8534cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_TABLAYOUT )
8535cdf0e10cSrcweir {
8536cdf0e10cSrcweir sal_Int16 nValue = 0;
8537cdf0e10cSrcweir if (aValue >>= nValue)
8538cdf0e10cSrcweir {
8539cdf0e10cSrcweir if (nValue == com::sun::star::text::WritingMode2::RL_TB)
8540cdf0e10cSrcweir aFunc.SetLayoutRTL(nTab, sal_True, sal_True);
8541cdf0e10cSrcweir else
8542cdf0e10cSrcweir aFunc.SetLayoutRTL(nTab, sal_False, sal_True);
8543cdf0e10cSrcweir }
8544cdf0e10cSrcweir }
8545cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_AUTOPRINT )
8546cdf0e10cSrcweir {
8547cdf0e10cSrcweir sal_Bool bAutoPrint = ScUnoHelpFunctions::GetBoolFromAny( aValue );
8548cdf0e10cSrcweir if (bAutoPrint)
8549cdf0e10cSrcweir pDoc->SetPrintEntireSheet( nTab ); // clears all print ranges
8550cdf0e10cSrcweir else
8551cdf0e10cSrcweir {
8552cdf0e10cSrcweir if (pDoc->IsPrintEntireSheet( nTab ))
8553cdf0e10cSrcweir pDoc->ClearPrintRanges( nTab ); // if this flag is true, there are no PrintRanges, so Clear clears only the flag.
8554cdf0e10cSrcweir }
8555cdf0e10cSrcweir }
8556cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_TABCOLOR )
8557cdf0e10cSrcweir {
8558d62340edSAriel Constenla-Haile sal_Int32 nColor = COL_AUTO;
8559cdf0e10cSrcweir if ( aValue >>= nColor )
8560cdf0e10cSrcweir {
85619c9d9e15SAriel Constenla-Haile const Color aColor( static_cast< ColorData >( nColor ) );
85629c9d9e15SAriel Constenla-Haile if ( pDoc->GetTabBgColor( nTab ) != aColor )
85639c9d9e15SAriel Constenla-Haile aFunc.SetTabBgColor( nTab, aColor, sal_True, sal_True );
8564cdf0e10cSrcweir }
8565cdf0e10cSrcweir }
8566cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_CODENAME )
8567cdf0e10cSrcweir {
8568cdf0e10cSrcweir rtl::OUString aCodeName;
8569cdf0e10cSrcweir if ( pDocSh && ( aValue >>= aCodeName ) )
8570cdf0e10cSrcweir {
8571cdf0e10cSrcweir pDocSh->GetDocument()->SetCodeName( GetTab_Impl(), aCodeName );
8572cdf0e10cSrcweir }
8573cdf0e10cSrcweir }
8574cdf0e10cSrcweir else
8575cdf0e10cSrcweir ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID
8576cdf0e10cSrcweir }
8577cdf0e10cSrcweir }
8578cdf0e10cSrcweir
GetOnePropertyValue(const SfxItemPropertySimpleEntry * pEntry,uno::Any & rAny)8579cdf0e10cSrcweir void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
8580cdf0e10cSrcweir uno::Any& rAny )
8581cdf0e10cSrcweir throw(uno::RuntimeException)
8582cdf0e10cSrcweir {
8583cdf0e10cSrcweir if ( pEntry )
8584cdf0e10cSrcweir {
8585cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
8586cdf0e10cSrcweir if (!pDocSh)
8587cdf0e10cSrcweir throw uno::RuntimeException();
8588cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
8589cdf0e10cSrcweir SCTAB nTab = GetTab_Impl();
8590cdf0e10cSrcweir
8591cdf0e10cSrcweir if ( pEntry->nWID == SC_WID_UNO_PAGESTL )
8592cdf0e10cSrcweir {
8593cdf0e10cSrcweir rAny <<= rtl::OUString( ScStyleNameConversion::DisplayToProgrammaticName(
8594cdf0e10cSrcweir pDoc->GetPageStyle( nTab ), SFX_STYLE_FAMILY_PAGE ) );
8595cdf0e10cSrcweir }
8596cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
8597cdf0e10cSrcweir {
8598cdf0e10cSrcweir sal_Bool bVis = pDoc->IsVisible( nTab );
8599cdf0e10cSrcweir ScUnoHelpFunctions::SetBoolInAny( rAny, bVis );
8600cdf0e10cSrcweir }
8601cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_LINKDISPBIT )
8602cdf0e10cSrcweir {
8603cdf0e10cSrcweir // no target bitmaps for individual entries (would be all equal)
8604cdf0e10cSrcweir // ScLinkTargetTypeObj::SetLinkTargetBitmap( aAny, SC_LINKTARGETTYPE_SHEET );
8605cdf0e10cSrcweir }
8606cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_LINKDISPNAME )
8607cdf0e10cSrcweir {
8608cdf0e10cSrcweir // LinkDisplayName for hyperlink dialog
8609cdf0e10cSrcweir rAny <<= getName(); // sheet name
8610cdf0e10cSrcweir }
8611cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_ISACTIVE )
8612cdf0e10cSrcweir {
8613cdf0e10cSrcweir if (pDoc->IsScenario(nTab))
8614cdf0e10cSrcweir ScUnoHelpFunctions::SetBoolInAny( rAny, pDoc->IsActiveScenario( nTab ));
8615cdf0e10cSrcweir }
8616cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_BORDCOL )
8617cdf0e10cSrcweir {
8618cdf0e10cSrcweir if (pDoc->IsScenario(nTab))
8619cdf0e10cSrcweir {
8620cdf0e10cSrcweir String aComment;
8621cdf0e10cSrcweir Color aColor;
8622cdf0e10cSrcweir sal_uInt16 nFlags;
8623cdf0e10cSrcweir pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8624cdf0e10cSrcweir
8625cdf0e10cSrcweir rAny <<= static_cast<sal_Int32>(aColor.GetColor());
8626cdf0e10cSrcweir }
8627cdf0e10cSrcweir }
8628cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_PROTECT )
8629cdf0e10cSrcweir {
8630cdf0e10cSrcweir if (pDoc->IsScenario(nTab))
8631cdf0e10cSrcweir {
8632cdf0e10cSrcweir String aComment;
8633cdf0e10cSrcweir Color aColor;
8634cdf0e10cSrcweir sal_uInt16 nFlags;
8635cdf0e10cSrcweir pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8636cdf0e10cSrcweir
8637cdf0e10cSrcweir ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_PROTECT) != 0 );
8638cdf0e10cSrcweir }
8639cdf0e10cSrcweir }
8640cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_SHOWBORD )
8641cdf0e10cSrcweir {
8642cdf0e10cSrcweir if (pDoc->IsScenario(nTab))
8643cdf0e10cSrcweir {
8644cdf0e10cSrcweir String aComment;
8645cdf0e10cSrcweir Color aColor;
8646cdf0e10cSrcweir sal_uInt16 nFlags;
8647cdf0e10cSrcweir pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8648cdf0e10cSrcweir
8649cdf0e10cSrcweir ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_SHOWFRAME) != 0 );
8650cdf0e10cSrcweir }
8651cdf0e10cSrcweir }
8652cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_PRINTBORD )
8653cdf0e10cSrcweir {
8654cdf0e10cSrcweir if (pDoc->IsScenario(nTab))
8655cdf0e10cSrcweir {
8656cdf0e10cSrcweir String aComment;
8657cdf0e10cSrcweir Color aColor;
8658cdf0e10cSrcweir sal_uInt16 nFlags;
8659cdf0e10cSrcweir pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8660cdf0e10cSrcweir
8661cdf0e10cSrcweir ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_PRINTFRAME) != 0 );
8662cdf0e10cSrcweir }
8663cdf0e10cSrcweir }
8664cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_COPYBACK )
8665cdf0e10cSrcweir {
8666cdf0e10cSrcweir if (pDoc->IsScenario(nTab))
8667cdf0e10cSrcweir {
8668cdf0e10cSrcweir String aComment;
8669cdf0e10cSrcweir Color aColor;
8670cdf0e10cSrcweir sal_uInt16 nFlags;
8671cdf0e10cSrcweir pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8672cdf0e10cSrcweir
8673cdf0e10cSrcweir ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_TWOWAY) != 0 );
8674cdf0e10cSrcweir }
8675cdf0e10cSrcweir }
8676cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_COPYSTYL )
8677cdf0e10cSrcweir {
8678cdf0e10cSrcweir if (pDoc->IsScenario(nTab))
8679cdf0e10cSrcweir {
8680cdf0e10cSrcweir String aComment;
8681cdf0e10cSrcweir Color aColor;
8682cdf0e10cSrcweir sal_uInt16 nFlags;
8683cdf0e10cSrcweir pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8684cdf0e10cSrcweir
8685cdf0e10cSrcweir ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_ATTRIB) != 0 );
8686cdf0e10cSrcweir }
8687cdf0e10cSrcweir }
8688cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_COPYFORM )
8689cdf0e10cSrcweir {
8690cdf0e10cSrcweir if (pDoc->IsScenario(nTab))
8691cdf0e10cSrcweir {
8692cdf0e10cSrcweir String aComment;
8693cdf0e10cSrcweir Color aColor;
8694cdf0e10cSrcweir sal_uInt16 nFlags;
8695cdf0e10cSrcweir pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
8696cdf0e10cSrcweir
8697cdf0e10cSrcweir ScUnoHelpFunctions::SetBoolInAny( rAny, !(nFlags & SC_SCENARIO_VALUE));
8698cdf0e10cSrcweir }
8699cdf0e10cSrcweir }
8700cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_TABLAYOUT )
8701cdf0e10cSrcweir {
8702cdf0e10cSrcweir if (pDoc->IsLayoutRTL(nTab))
8703cdf0e10cSrcweir rAny <<= sal_Int16(com::sun::star::text::WritingMode2::RL_TB);
8704cdf0e10cSrcweir else
8705cdf0e10cSrcweir rAny <<= sal_Int16(com::sun::star::text::WritingMode2::LR_TB);
8706cdf0e10cSrcweir }
8707cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_AUTOPRINT )
8708cdf0e10cSrcweir {
8709cdf0e10cSrcweir sal_Bool bAutoPrint = pDoc->IsPrintEntireSheet( nTab );
8710cdf0e10cSrcweir ScUnoHelpFunctions::SetBoolInAny( rAny, bAutoPrint );
8711cdf0e10cSrcweir }
8712cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_TABCOLOR )
8713cdf0e10cSrcweir {
8714cdf0e10cSrcweir rAny <<= sal_Int32(pDoc->GetTabBgColor(nTab).GetColor());
8715cdf0e10cSrcweir }
8716cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_CODENAME )
8717cdf0e10cSrcweir {
8718cdf0e10cSrcweir String aCodeName;
8719cdf0e10cSrcweir if ( pDocSh )
8720cdf0e10cSrcweir pDocSh->GetDocument()->GetCodeName( GetTab_Impl(), aCodeName );
8721cdf0e10cSrcweir rAny <<= rtl::OUString( aCodeName );
8722cdf0e10cSrcweir }
8723cdf0e10cSrcweir else
8724cdf0e10cSrcweir ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
8725cdf0e10cSrcweir }
8726cdf0e10cSrcweir }
8727cdf0e10cSrcweir
GetItemPropertyMap()8728cdf0e10cSrcweir const SfxItemPropertyMap* ScTableSheetObj::GetItemPropertyMap()
8729cdf0e10cSrcweir {
8730cdf0e10cSrcweir return pSheetPropSet->getPropertyMap();
8731cdf0e10cSrcweir }
8732cdf0e10cSrcweir
8733cdf0e10cSrcweir // XServiceInfo
8734cdf0e10cSrcweir
getImplementationName()8735cdf0e10cSrcweir rtl::OUString SAL_CALL ScTableSheetObj::getImplementationName() throw(uno::RuntimeException)
8736cdf0e10cSrcweir {
8737cdf0e10cSrcweir return rtl::OUString::createFromAscii( "ScTableSheetObj" );
8738cdf0e10cSrcweir }
8739cdf0e10cSrcweir
supportsService(const rtl::OUString & rServiceName)8740cdf0e10cSrcweir sal_Bool SAL_CALL ScTableSheetObj::supportsService( const rtl::OUString& rServiceName )
8741cdf0e10cSrcweir throw(uno::RuntimeException)
8742cdf0e10cSrcweir {
8743cdf0e10cSrcweir String aServiceStr( rServiceName );
8744cdf0e10cSrcweir return aServiceStr.EqualsAscii( SCSPREADSHEET_SERVICE ) ||
8745cdf0e10cSrcweir aServiceStr.EqualsAscii( SCSHEETCELLRANGE_SERVICE ) ||
8746cdf0e10cSrcweir aServiceStr.EqualsAscii( SCCELLRANGE_SERVICE ) ||
8747cdf0e10cSrcweir aServiceStr.EqualsAscii( SCCELLPROPERTIES_SERVICE ) ||
8748cdf0e10cSrcweir aServiceStr.EqualsAscii( SCCHARPROPERTIES_SERVICE ) ||
8749cdf0e10cSrcweir aServiceStr.EqualsAscii( SCPARAPROPERTIES_SERVICE ) ||
8750cdf0e10cSrcweir aServiceStr.EqualsAscii( SCLINKTARGET_SERVICE );
8751cdf0e10cSrcweir }
8752cdf0e10cSrcweir
getSupportedServiceNames()8753cdf0e10cSrcweir uno::Sequence<rtl::OUString> SAL_CALL ScTableSheetObj::getSupportedServiceNames()
8754cdf0e10cSrcweir throw(uno::RuntimeException)
8755cdf0e10cSrcweir {
8756cdf0e10cSrcweir uno::Sequence<rtl::OUString> aRet(7);
8757cdf0e10cSrcweir rtl::OUString* pArray = aRet.getArray();
8758cdf0e10cSrcweir pArray[0] = rtl::OUString::createFromAscii( SCSPREADSHEET_SERVICE );
8759cdf0e10cSrcweir pArray[1] = rtl::OUString::createFromAscii( SCSHEETCELLRANGE_SERVICE );
8760cdf0e10cSrcweir pArray[2] = rtl::OUString::createFromAscii( SCCELLRANGE_SERVICE );
8761cdf0e10cSrcweir pArray[3] = rtl::OUString::createFromAscii( SCCELLPROPERTIES_SERVICE );
8762cdf0e10cSrcweir pArray[4] = rtl::OUString::createFromAscii( SCCHARPROPERTIES_SERVICE );
8763cdf0e10cSrcweir pArray[5] = rtl::OUString::createFromAscii( SCPARAPROPERTIES_SERVICE );
8764cdf0e10cSrcweir pArray[6] = rtl::OUString::createFromAscii( SCLINKTARGET_SERVICE );
8765cdf0e10cSrcweir return aRet;
8766cdf0e10cSrcweir }
8767cdf0e10cSrcweir
8768cdf0e10cSrcweir // XUnoTunnel
8769cdf0e10cSrcweir
getSomething(const uno::Sequence<sal_Int8> & rId)8770cdf0e10cSrcweir sal_Int64 SAL_CALL ScTableSheetObj::getSomething(
8771cdf0e10cSrcweir const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException)
8772cdf0e10cSrcweir {
8773cdf0e10cSrcweir if ( rId.getLength() == 16 &&
8774cdf0e10cSrcweir 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
8775cdf0e10cSrcweir rId.getConstArray(), 16 ) )
8776cdf0e10cSrcweir {
8777cdf0e10cSrcweir return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
8778cdf0e10cSrcweir }
8779cdf0e10cSrcweir
8780cdf0e10cSrcweir return ScCellRangeObj::getSomething( rId );
8781cdf0e10cSrcweir }
8782cdf0e10cSrcweir
8783cdf0e10cSrcweir // static
getUnoTunnelId()8784cdf0e10cSrcweir const uno::Sequence<sal_Int8>& ScTableSheetObj::getUnoTunnelId()
8785cdf0e10cSrcweir {
8786cdf0e10cSrcweir static uno::Sequence<sal_Int8> * pSeq = 0;
8787cdf0e10cSrcweir if( !pSeq )
8788cdf0e10cSrcweir {
8789cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
8790cdf0e10cSrcweir if( !pSeq )
8791cdf0e10cSrcweir {
8792cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aSeq( 16 );
8793cdf0e10cSrcweir rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
8794cdf0e10cSrcweir pSeq = &aSeq;
8795cdf0e10cSrcweir }
8796cdf0e10cSrcweir }
8797cdf0e10cSrcweir return *pSeq;
8798cdf0e10cSrcweir }
8799cdf0e10cSrcweir
8800cdf0e10cSrcweir // static
getImplementation(const uno::Reference<uno::XInterface> xObj)8801cdf0e10cSrcweir ScTableSheetObj* ScTableSheetObj::getImplementation( const uno::Reference<uno::XInterface> xObj )
8802cdf0e10cSrcweir {
8803cdf0e10cSrcweir ScTableSheetObj* pRet = NULL;
8804cdf0e10cSrcweir uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
8805cdf0e10cSrcweir if (xUT.is())
8806cdf0e10cSrcweir pRet = reinterpret_cast<ScTableSheetObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
8807cdf0e10cSrcweir return pRet;
8808cdf0e10cSrcweir }
8809cdf0e10cSrcweir
8810cdf0e10cSrcweir //------------------------------------------------------------------------
8811cdf0e10cSrcweir
ScTableColumnObj(ScDocShell * pDocSh,SCCOL nCol,SCTAB nTab)8812cdf0e10cSrcweir ScTableColumnObj::ScTableColumnObj( ScDocShell* pDocSh, SCCOL nCol, SCTAB nTab ) :
8813cdf0e10cSrcweir ScCellRangeObj( pDocSh, ScRange(nCol,0,nTab, nCol,MAXROW,nTab) ),
8814cdf0e10cSrcweir pColPropSet(lcl_GetColumnPropertySet())
8815cdf0e10cSrcweir {
8816cdf0e10cSrcweir }
8817cdf0e10cSrcweir
~ScTableColumnObj()8818cdf0e10cSrcweir ScTableColumnObj::~ScTableColumnObj()
8819cdf0e10cSrcweir {
8820cdf0e10cSrcweir }
8821cdf0e10cSrcweir
queryInterface(const uno::Type & rType)8822cdf0e10cSrcweir uno::Any SAL_CALL ScTableColumnObj::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException)
8823cdf0e10cSrcweir {
8824cdf0e10cSrcweir SC_QUERYINTERFACE( container::XNamed )
8825cdf0e10cSrcweir
8826cdf0e10cSrcweir return ScCellRangeObj::queryInterface( rType );
8827cdf0e10cSrcweir }
8828cdf0e10cSrcweir
acquire()8829cdf0e10cSrcweir void SAL_CALL ScTableColumnObj::acquire() throw()
8830cdf0e10cSrcweir {
8831cdf0e10cSrcweir ScCellRangeObj::acquire();
8832cdf0e10cSrcweir }
8833cdf0e10cSrcweir
release()8834cdf0e10cSrcweir void SAL_CALL ScTableColumnObj::release() throw()
8835cdf0e10cSrcweir {
8836cdf0e10cSrcweir ScCellRangeObj::release();
8837cdf0e10cSrcweir }
8838cdf0e10cSrcweir
getTypes()8839cdf0e10cSrcweir uno::Sequence<uno::Type> SAL_CALL ScTableColumnObj::getTypes() throw(uno::RuntimeException)
8840cdf0e10cSrcweir {
8841cdf0e10cSrcweir static uno::Sequence<uno::Type> aTypes;
8842cdf0e10cSrcweir if ( aTypes.getLength() == 0 )
8843cdf0e10cSrcweir {
8844cdf0e10cSrcweir uno::Sequence<uno::Type> aParentTypes(ScCellRangeObj::getTypes());
8845cdf0e10cSrcweir long nParentLen = aParentTypes.getLength();
8846cdf0e10cSrcweir const uno::Type* pParentPtr = aParentTypes.getConstArray();
8847cdf0e10cSrcweir
8848cdf0e10cSrcweir aTypes.realloc( nParentLen + 1 );
8849cdf0e10cSrcweir uno::Type* pPtr = aTypes.getArray();
8850cdf0e10cSrcweir pPtr[nParentLen + 0] = getCppuType((const uno::Reference<container::XNamed>*)0);
8851cdf0e10cSrcweir
8852cdf0e10cSrcweir for (long i=0; i<nParentLen; i++)
8853cdf0e10cSrcweir pPtr[i] = pParentPtr[i]; // parent types first
8854cdf0e10cSrcweir }
8855cdf0e10cSrcweir return aTypes;
8856cdf0e10cSrcweir }
8857cdf0e10cSrcweir
getImplementationId()8858cdf0e10cSrcweir uno::Sequence<sal_Int8> SAL_CALL ScTableColumnObj::getImplementationId() throw(uno::RuntimeException)
8859cdf0e10cSrcweir {
8860cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aId;
8861cdf0e10cSrcweir if( aId.getLength() == 0 )
8862cdf0e10cSrcweir {
8863cdf0e10cSrcweir aId.realloc( 16 );
8864cdf0e10cSrcweir rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
8865cdf0e10cSrcweir }
8866cdf0e10cSrcweir return aId;
8867cdf0e10cSrcweir }
8868cdf0e10cSrcweir
8869cdf0e10cSrcweir // XNamed
8870cdf0e10cSrcweir
getName()8871cdf0e10cSrcweir rtl::OUString SAL_CALL ScTableColumnObj::getName() throw(uno::RuntimeException)
8872cdf0e10cSrcweir {
8873cdf0e10cSrcweir ScUnoGuard aGuard;
8874cdf0e10cSrcweir
8875cdf0e10cSrcweir const ScRange& rRange = GetRange();
8876cdf0e10cSrcweir DBG_ASSERT(rRange.aStart.Col() == rRange.aEnd.Col(), "too many columns");
8877cdf0e10cSrcweir SCCOL nCol = rRange.aStart.Col();
8878cdf0e10cSrcweir
8879cdf0e10cSrcweir return ScColToAlpha( nCol ); // from global.hxx
8880cdf0e10cSrcweir }
8881cdf0e10cSrcweir
setName(const rtl::OUString &)8882cdf0e10cSrcweir void SAL_CALL ScTableColumnObj::setName( const rtl::OUString& /* aNewName */ )
8883cdf0e10cSrcweir throw(uno::RuntimeException)
8884cdf0e10cSrcweir {
8885cdf0e10cSrcweir ScUnoGuard aGuard;
8886cdf0e10cSrcweir throw uno::RuntimeException(); // read-only
8887cdf0e10cSrcweir }
8888cdf0e10cSrcweir
8889cdf0e10cSrcweir // XPropertySet erweitert fuer Spalten-Properties
8890cdf0e10cSrcweir
getPropertySetInfo()8891cdf0e10cSrcweir uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTableColumnObj::getPropertySetInfo()
8892cdf0e10cSrcweir throw(uno::RuntimeException)
8893cdf0e10cSrcweir {
8894cdf0e10cSrcweir ScUnoGuard aGuard;
8895cdf0e10cSrcweir static uno::Reference<beans::XPropertySetInfo> aRef(
8896cdf0e10cSrcweir new SfxItemPropertySetInfo( pColPropSet->getPropertyMap() ));
8897cdf0e10cSrcweir return aRef;
8898cdf0e10cSrcweir }
8899cdf0e10cSrcweir
SetOnePropertyValue(const SfxItemPropertySimpleEntry * pEntry,const uno::Any & aValue)8900cdf0e10cSrcweir void ScTableColumnObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
8901cdf0e10cSrcweir throw(lang::IllegalArgumentException, uno::RuntimeException)
8902cdf0e10cSrcweir {
8903cdf0e10cSrcweir if ( pEntry )
8904cdf0e10cSrcweir {
8905cdf0e10cSrcweir if ( IsScItemWid( pEntry->nWID ) )
8906cdf0e10cSrcweir {
8907cdf0e10cSrcweir // for Item WIDs, call ScCellRangesBase directly
8908cdf0e10cSrcweir ScCellRangesBase::SetOnePropertyValue(pEntry, aValue);
8909cdf0e10cSrcweir return;
8910cdf0e10cSrcweir }
8911cdf0e10cSrcweir
8912cdf0e10cSrcweir // own properties
8913cdf0e10cSrcweir
8914cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
8915cdf0e10cSrcweir if (!pDocSh)
8916cdf0e10cSrcweir return; //! Exception oder so?
8917cdf0e10cSrcweir const ScRange& rRange = GetRange();
8918cdf0e10cSrcweir DBG_ASSERT(rRange.aStart.Col() == rRange.aEnd.Col(), "zuviele Spalten");
8919cdf0e10cSrcweir SCCOL nCol = rRange.aStart.Col();
8920cdf0e10cSrcweir SCTAB nTab = rRange.aStart.Tab();
8921cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
8922cdf0e10cSrcweir
8923cdf0e10cSrcweir SCCOLROW nColArr[2];
8924cdf0e10cSrcweir nColArr[0] = nColArr[1] = nCol;
8925cdf0e10cSrcweir
8926cdf0e10cSrcweir if ( pEntry->nWID == SC_WID_UNO_CELLWID )
8927cdf0e10cSrcweir {
8928cdf0e10cSrcweir sal_Int32 nNewWidth = 0;
8929cdf0e10cSrcweir if ( aValue >>= nNewWidth )
8930cdf0e10cSrcweir {
8931cdf0e10cSrcweir // property is 1/100mm, column width is twips
8932cdf0e10cSrcweir nNewWidth = HMMToTwips(nNewWidth);
8933cdf0e10cSrcweir aFunc.SetWidthOrHeight( sal_True, 1, nColArr, nTab, SC_SIZE_ORIGINAL,
8934cdf0e10cSrcweir (sal_uInt16)nNewWidth, sal_True, sal_True );
8935cdf0e10cSrcweir }
8936cdf0e10cSrcweir }
8937cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
8938cdf0e10cSrcweir {
8939cdf0e10cSrcweir sal_Bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
8940cdf0e10cSrcweir ScSizeMode eMode = bVis ? SC_SIZE_SHOW : SC_SIZE_DIRECT;
8941cdf0e10cSrcweir aFunc.SetWidthOrHeight( sal_True, 1, nColArr, nTab, eMode, 0, sal_True, sal_True );
8942cdf0e10cSrcweir // SC_SIZE_DIRECT mit Groesse 0 blendet aus
8943cdf0e10cSrcweir }
8944cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_OWIDTH )
8945cdf0e10cSrcweir {
8946cdf0e10cSrcweir sal_Bool bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
8947cdf0e10cSrcweir if (bOpt)
8948cdf0e10cSrcweir aFunc.SetWidthOrHeight( sal_True, 1, nColArr, nTab,
8949cdf0e10cSrcweir SC_SIZE_OPTIMAL, STD_EXTRA_WIDTH, sal_True, sal_True );
8950cdf0e10cSrcweir // sal_False bei Spalten momentan ohne Auswirkung
8951cdf0e10cSrcweir }
8952cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE || pEntry->nWID == SC_WID_UNO_MANPAGE )
8953cdf0e10cSrcweir {
8954cdf0e10cSrcweir sal_Bool bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue );
8955cdf0e10cSrcweir if (bSet)
8956cdf0e10cSrcweir aFunc.InsertPageBreak( sal_True, rRange.aStart, sal_True, sal_True, sal_True );
8957cdf0e10cSrcweir else
8958cdf0e10cSrcweir aFunc.RemovePageBreak( sal_True, rRange.aStart, sal_True, sal_True, sal_True );
8959cdf0e10cSrcweir }
8960cdf0e10cSrcweir else
8961cdf0e10cSrcweir ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID
8962cdf0e10cSrcweir }
8963cdf0e10cSrcweir }
8964cdf0e10cSrcweir
GetOnePropertyValue(const SfxItemPropertySimpleEntry * pEntry,uno::Any & rAny)8965cdf0e10cSrcweir void ScTableColumnObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
8966cdf0e10cSrcweir uno::Any& rAny )
8967cdf0e10cSrcweir throw(uno::RuntimeException)
8968cdf0e10cSrcweir {
8969cdf0e10cSrcweir if ( pEntry )
8970cdf0e10cSrcweir {
8971cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
8972cdf0e10cSrcweir if (!pDocSh)
8973cdf0e10cSrcweir throw uno::RuntimeException();
8974cdf0e10cSrcweir
8975cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
8976cdf0e10cSrcweir const ScRange& rRange = GetRange();
8977cdf0e10cSrcweir DBG_ASSERT(rRange.aStart.Col() == rRange.aEnd.Col(), "zuviele Spalten");
8978cdf0e10cSrcweir SCCOL nCol = rRange.aStart.Col();
8979cdf0e10cSrcweir SCTAB nTab = rRange.aStart.Tab();
8980cdf0e10cSrcweir
8981cdf0e10cSrcweir if ( pEntry->nWID == SC_WID_UNO_CELLWID )
8982cdf0e10cSrcweir {
8983cdf0e10cSrcweir // for hidden column, return original height
8984cdf0e10cSrcweir sal_uInt16 nWidth = pDoc->GetOriginalWidth( nCol, nTab );
8985cdf0e10cSrcweir // property is 1/100mm, column width is twips
8986cdf0e10cSrcweir nWidth = (sal_uInt16) TwipsToHMM(nWidth);
8987cdf0e10cSrcweir rAny <<= (sal_Int32)( nWidth );
8988cdf0e10cSrcweir }
8989cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
8990cdf0e10cSrcweir {
8991cdf0e10cSrcweir SCCOL nDummy;
8992cdf0e10cSrcweir bool bHidden = pDoc->ColHidden(nCol, nTab, nDummy);
8993cdf0e10cSrcweir ScUnoHelpFunctions::SetBoolInAny( rAny, !bHidden );
8994cdf0e10cSrcweir }
8995cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_OWIDTH )
8996cdf0e10cSrcweir {
8997cdf0e10cSrcweir //! momentan immer gesetzt ??!?!
8998cdf0e10cSrcweir sal_Bool bOpt = !(pDoc->GetColFlags( nCol, nTab ) & CR_MANUALSIZE);
8999cdf0e10cSrcweir ScUnoHelpFunctions::SetBoolInAny( rAny, bOpt );
9000cdf0e10cSrcweir }
9001cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE )
9002cdf0e10cSrcweir {
9003cdf0e10cSrcweir ScBreakType nBreak = pDoc->HasColBreak(nCol, nTab);
9004cdf0e10cSrcweir ScUnoHelpFunctions::SetBoolInAny( rAny, nBreak );
9005cdf0e10cSrcweir }
9006cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_MANPAGE )
9007cdf0e10cSrcweir {
9008cdf0e10cSrcweir ScBreakType nBreak = pDoc->HasColBreak(nCol, nTab);
9009cdf0e10cSrcweir ScUnoHelpFunctions::SetBoolInAny(rAny, (nBreak & BREAK_MANUAL));
9010cdf0e10cSrcweir }
9011cdf0e10cSrcweir else
9012cdf0e10cSrcweir ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
9013cdf0e10cSrcweir }
9014cdf0e10cSrcweir }
9015cdf0e10cSrcweir
GetItemPropertyMap()9016cdf0e10cSrcweir const SfxItemPropertyMap* ScTableColumnObj::GetItemPropertyMap()
9017cdf0e10cSrcweir {
9018cdf0e10cSrcweir return pColPropSet->getPropertyMap();
9019cdf0e10cSrcweir }
9020cdf0e10cSrcweir
9021cdf0e10cSrcweir //------------------------------------------------------------------------
9022cdf0e10cSrcweir
ScTableRowObj(ScDocShell * pDocSh,SCROW nRow,SCTAB nTab)9023cdf0e10cSrcweir ScTableRowObj::ScTableRowObj(ScDocShell* pDocSh, SCROW nRow, SCTAB nTab) :
9024cdf0e10cSrcweir ScCellRangeObj( pDocSh, ScRange(0,nRow,nTab, MAXCOL,nRow,nTab) ),
9025cdf0e10cSrcweir pRowPropSet(lcl_GetRowPropertySet())
9026cdf0e10cSrcweir {
9027cdf0e10cSrcweir }
9028cdf0e10cSrcweir
~ScTableRowObj()9029cdf0e10cSrcweir ScTableRowObj::~ScTableRowObj()
9030cdf0e10cSrcweir {
9031cdf0e10cSrcweir }
9032cdf0e10cSrcweir
9033cdf0e10cSrcweir // XPropertySet erweitert fuer Zeilen-Properties
9034cdf0e10cSrcweir
getPropertySetInfo()9035cdf0e10cSrcweir uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTableRowObj::getPropertySetInfo()
9036cdf0e10cSrcweir throw(uno::RuntimeException)
9037cdf0e10cSrcweir {
9038cdf0e10cSrcweir ScUnoGuard aGuard;
9039cdf0e10cSrcweir static uno::Reference<beans::XPropertySetInfo> aRef(
9040cdf0e10cSrcweir new SfxItemPropertySetInfo( pRowPropSet->getPropertyMap() ));
9041cdf0e10cSrcweir return aRef;
9042cdf0e10cSrcweir }
9043cdf0e10cSrcweir
SetOnePropertyValue(const SfxItemPropertySimpleEntry * pEntry,const uno::Any & aValue)9044cdf0e10cSrcweir void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
9045cdf0e10cSrcweir throw(lang::IllegalArgumentException, uno::RuntimeException)
9046cdf0e10cSrcweir {
9047cdf0e10cSrcweir if ( pEntry )
9048cdf0e10cSrcweir {
9049cdf0e10cSrcweir if ( IsScItemWid( pEntry->nWID ) )
9050cdf0e10cSrcweir {
9051cdf0e10cSrcweir // for Item WIDs, call ScCellRangesBase directly
9052cdf0e10cSrcweir ScCellRangesBase::SetOnePropertyValue(pEntry, aValue);
9053cdf0e10cSrcweir return;
9054cdf0e10cSrcweir }
9055cdf0e10cSrcweir
9056cdf0e10cSrcweir // own properties
9057cdf0e10cSrcweir
9058cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
9059cdf0e10cSrcweir if (!pDocSh)
9060cdf0e10cSrcweir return; //! Exception oder so?
9061cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
9062cdf0e10cSrcweir const ScRange& rRange = GetRange();
9063cdf0e10cSrcweir DBG_ASSERT(rRange.aStart.Row() == rRange.aEnd.Row(), "zuviele Zeilen");
9064cdf0e10cSrcweir SCROW nRow = rRange.aStart.Row();
9065cdf0e10cSrcweir SCTAB nTab = rRange.aStart.Tab();
9066cdf0e10cSrcweir ScDocFunc aFunc(*pDocSh);
9067cdf0e10cSrcweir
9068cdf0e10cSrcweir SCCOLROW nRowArr[2];
9069cdf0e10cSrcweir nRowArr[0] = nRowArr[1] = nRow;
9070cdf0e10cSrcweir
9071cdf0e10cSrcweir if ( pEntry->nWID == SC_WID_UNO_CELLHGT )
9072cdf0e10cSrcweir {
9073cdf0e10cSrcweir sal_Int32 nNewHeight = 0;
9074cdf0e10cSrcweir if ( aValue >>= nNewHeight )
9075cdf0e10cSrcweir {
9076cdf0e10cSrcweir // property is 1/100mm, row height is twips
9077cdf0e10cSrcweir nNewHeight = HMMToTwips(nNewHeight);
9078cdf0e10cSrcweir aFunc.SetWidthOrHeight( sal_False, 1, nRowArr, nTab, SC_SIZE_ORIGINAL,
9079cdf0e10cSrcweir (sal_uInt16)nNewHeight, sal_True, sal_True );
9080cdf0e10cSrcweir }
9081cdf0e10cSrcweir }
9082cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
9083cdf0e10cSrcweir {
9084cdf0e10cSrcweir sal_Bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
9085cdf0e10cSrcweir ScSizeMode eMode = bVis ? SC_SIZE_SHOW : SC_SIZE_DIRECT;
9086cdf0e10cSrcweir aFunc.SetWidthOrHeight( sal_False, 1, nRowArr, nTab, eMode, 0, sal_True, sal_True );
9087cdf0e10cSrcweir // SC_SIZE_DIRECT mit Groesse 0 blendet aus
9088cdf0e10cSrcweir }
9089cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_CELLFILT )
9090cdf0e10cSrcweir {
9091cdf0e10cSrcweir sal_Bool bFil = ScUnoHelpFunctions::GetBoolFromAny( aValue );
9092cdf0e10cSrcweir // ScSizeMode eMode = bVis ? SC_SIZE_SHOW : SC_SIZE_DIRECT;
9093cdf0e10cSrcweir // aFunc.SetWidthOrHeight( sal_False, 1, nRowArr, nTab, eMode, 0, sal_True, sal_True );
9094cdf0e10cSrcweir // SC_SIZE_DIRECT mit Groesse 0 blendet aus
9095cdf0e10cSrcweir pDoc->SetRowFiltered(nRow, nRow, nTab, bFil);
9096cdf0e10cSrcweir }
9097cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_OHEIGHT )
9098cdf0e10cSrcweir {
9099cdf0e10cSrcweir sal_Bool bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
9100cdf0e10cSrcweir if (bOpt)
9101cdf0e10cSrcweir aFunc.SetWidthOrHeight( sal_False, 1, nRowArr, nTab, SC_SIZE_OPTIMAL, 0, sal_True, sal_True );
9102cdf0e10cSrcweir else
9103cdf0e10cSrcweir {
9104cdf0e10cSrcweir // set current height again manually
9105cdf0e10cSrcweir sal_uInt16 nHeight = pDoc->GetOriginalHeight( nRow, nTab );
9106cdf0e10cSrcweir aFunc.SetWidthOrHeight( sal_False, 1, nRowArr, nTab, SC_SIZE_ORIGINAL, nHeight, sal_True, sal_True );
9107cdf0e10cSrcweir }
9108cdf0e10cSrcweir }
9109cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE || pEntry->nWID == SC_WID_UNO_MANPAGE )
9110cdf0e10cSrcweir {
9111cdf0e10cSrcweir sal_Bool bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue );
9112cdf0e10cSrcweir if (bSet)
9113cdf0e10cSrcweir aFunc.InsertPageBreak( sal_False, rRange.aStart, sal_True, sal_True, sal_True );
9114cdf0e10cSrcweir else
9115cdf0e10cSrcweir aFunc.RemovePageBreak( sal_False, rRange.aStart, sal_True, sal_True, sal_True );
9116cdf0e10cSrcweir }
9117cdf0e10cSrcweir else
9118cdf0e10cSrcweir ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID
9119cdf0e10cSrcweir }
9120cdf0e10cSrcweir }
9121cdf0e10cSrcweir
GetOnePropertyValue(const SfxItemPropertySimpleEntry * pEntry,uno::Any & rAny)9122cdf0e10cSrcweir void ScTableRowObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
9123cdf0e10cSrcweir uno::Any& rAny )
9124cdf0e10cSrcweir throw(uno::RuntimeException)
9125cdf0e10cSrcweir {
9126cdf0e10cSrcweir if ( pEntry )
9127cdf0e10cSrcweir {
9128cdf0e10cSrcweir ScDocShell* pDocSh = GetDocShell();
9129cdf0e10cSrcweir if (!pDocSh)
9130cdf0e10cSrcweir throw uno::RuntimeException();
9131cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
9132cdf0e10cSrcweir const ScRange& rRange = GetRange();
9133cdf0e10cSrcweir DBG_ASSERT(rRange.aStart.Row() == rRange.aEnd.Row(), "zuviele Zeilen");
9134cdf0e10cSrcweir SCROW nRow = rRange.aStart.Row();
9135cdf0e10cSrcweir SCTAB nTab = rRange.aStart.Tab();
9136cdf0e10cSrcweir
9137cdf0e10cSrcweir if ( pEntry->nWID == SC_WID_UNO_CELLHGT )
9138cdf0e10cSrcweir {
9139cdf0e10cSrcweir // for hidden row, return original height
9140cdf0e10cSrcweir sal_uInt16 nHeight = pDoc->GetOriginalHeight( nRow, nTab );
9141cdf0e10cSrcweir // property is 1/100mm, row height is twips
9142cdf0e10cSrcweir nHeight = (sal_uInt16) TwipsToHMM(nHeight);
9143cdf0e10cSrcweir rAny <<= (sal_Int32)( nHeight );
9144cdf0e10cSrcweir }
9145cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
9146cdf0e10cSrcweir {
9147cdf0e10cSrcweir SCROW nDummy;
9148cdf0e10cSrcweir bool bHidden = pDoc->RowHidden(nRow, nTab, nDummy);
9149cdf0e10cSrcweir ScUnoHelpFunctions::SetBoolInAny( rAny, !bHidden );
9150cdf0e10cSrcweir }
9151cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_CELLFILT )
9152cdf0e10cSrcweir {
9153cdf0e10cSrcweir bool bVis = pDoc->RowFiltered(nRow, nTab);
9154cdf0e10cSrcweir ScUnoHelpFunctions::SetBoolInAny( rAny, bVis );
9155cdf0e10cSrcweir }
9156cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_OHEIGHT )
9157cdf0e10cSrcweir {
9158cdf0e10cSrcweir sal_Bool bOpt = !(pDoc->GetRowFlags( nRow, nTab ) & CR_MANUALSIZE);
9159cdf0e10cSrcweir ScUnoHelpFunctions::SetBoolInAny( rAny, bOpt );
9160cdf0e10cSrcweir }
9161cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE )
9162cdf0e10cSrcweir {
9163cdf0e10cSrcweir ScBreakType nBreak = pDoc->HasRowBreak(nRow, nTab);
9164cdf0e10cSrcweir ScUnoHelpFunctions::SetBoolInAny( rAny, nBreak );
9165cdf0e10cSrcweir }
9166cdf0e10cSrcweir else if ( pEntry->nWID == SC_WID_UNO_MANPAGE )
9167cdf0e10cSrcweir {
9168cdf0e10cSrcweir ScBreakType nBreak = (pDoc->HasRowBreak(nRow, nTab) & BREAK_MANUAL);
9169cdf0e10cSrcweir ScUnoHelpFunctions::SetBoolInAny( rAny, nBreak );
9170cdf0e10cSrcweir }
9171cdf0e10cSrcweir else
9172cdf0e10cSrcweir ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
9173cdf0e10cSrcweir }
9174cdf0e10cSrcweir }
9175cdf0e10cSrcweir
GetItemPropertyMap()9176cdf0e10cSrcweir const SfxItemPropertyMap* ScTableRowObj::GetItemPropertyMap()
9177cdf0e10cSrcweir {
9178cdf0e10cSrcweir return pRowPropSet->getPropertyMap();
9179cdf0e10cSrcweir }
9180cdf0e10cSrcweir
9181cdf0e10cSrcweir //------------------------------------------------------------------------
9182cdf0e10cSrcweir
ScCellsObj(ScDocShell * pDocSh,const ScRangeList & rR)9183cdf0e10cSrcweir ScCellsObj::ScCellsObj(ScDocShell* pDocSh, const ScRangeList& rR) :
9184cdf0e10cSrcweir pDocShell( pDocSh ),
9185cdf0e10cSrcweir aRanges( rR )
9186cdf0e10cSrcweir {
9187cdf0e10cSrcweir pDocShell->GetDocument()->AddUnoObject(*this);
9188cdf0e10cSrcweir }
9189cdf0e10cSrcweir
~ScCellsObj()9190cdf0e10cSrcweir ScCellsObj::~ScCellsObj()
9191cdf0e10cSrcweir {
9192cdf0e10cSrcweir if (pDocShell)
9193cdf0e10cSrcweir pDocShell->GetDocument()->RemoveUnoObject(*this);
9194cdf0e10cSrcweir }
9195cdf0e10cSrcweir
Notify(SfxBroadcaster &,const SfxHint & rHint)9196cdf0e10cSrcweir void ScCellsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
9197cdf0e10cSrcweir {
9198cdf0e10cSrcweir if ( rHint.ISA( ScUpdateRefHint ) )
9199cdf0e10cSrcweir {
9200cdf0e10cSrcweir const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint;
9201cdf0e10cSrcweir aRanges.UpdateReference( rRef.GetMode(), pDocShell->GetDocument(), rRef.GetRange(),
9202cdf0e10cSrcweir rRef.GetDx(), rRef.GetDy(), rRef.GetDz() );
9203cdf0e10cSrcweir }
9204cdf0e10cSrcweir else if ( rHint.ISA( SfxSimpleHint ) &&
9205cdf0e10cSrcweir ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
9206cdf0e10cSrcweir {
9207cdf0e10cSrcweir pDocShell = NULL; // ungueltig geworden
9208cdf0e10cSrcweir }
9209cdf0e10cSrcweir }
9210cdf0e10cSrcweir
9211cdf0e10cSrcweir // XEnumerationAccess
9212cdf0e10cSrcweir
createEnumeration()9213cdf0e10cSrcweir uno::Reference<container::XEnumeration> SAL_CALL ScCellsObj::createEnumeration()
9214cdf0e10cSrcweir throw(uno::RuntimeException)
9215cdf0e10cSrcweir {
9216cdf0e10cSrcweir ScUnoGuard aGuard;
9217cdf0e10cSrcweir if (pDocShell)
9218cdf0e10cSrcweir return new ScCellsEnumeration( pDocShell, aRanges );
9219cdf0e10cSrcweir return NULL;
9220cdf0e10cSrcweir }
9221cdf0e10cSrcweir
getElementType()9222cdf0e10cSrcweir uno::Type SAL_CALL ScCellsObj::getElementType() throw(uno::RuntimeException)
9223cdf0e10cSrcweir {
9224cdf0e10cSrcweir ScUnoGuard aGuard;
9225cdf0e10cSrcweir return getCppuType((uno::Reference<table::XCell>*)0);
9226cdf0e10cSrcweir }
9227cdf0e10cSrcweir
hasElements()9228cdf0e10cSrcweir sal_Bool SAL_CALL ScCellsObj::hasElements() throw(uno::RuntimeException)
9229cdf0e10cSrcweir {
9230cdf0e10cSrcweir ScUnoGuard aGuard;
9231cdf0e10cSrcweir sal_Bool bHas = sal_False;
9232cdf0e10cSrcweir if ( pDocShell )
9233cdf0e10cSrcweir {
9234cdf0e10cSrcweir //! schneller selber testen?
9235cdf0e10cSrcweir
9236cdf0e10cSrcweir uno::Reference<container::XEnumeration> xEnum(new ScCellsEnumeration( pDocShell, aRanges ));
9237cdf0e10cSrcweir bHas = xEnum->hasMoreElements();
9238cdf0e10cSrcweir }
9239cdf0e10cSrcweir return bHas;
9240cdf0e10cSrcweir }
9241cdf0e10cSrcweir
9242cdf0e10cSrcweir //------------------------------------------------------------------------
9243cdf0e10cSrcweir
ScCellsEnumeration(ScDocShell * pDocSh,const ScRangeList & rR)9244cdf0e10cSrcweir ScCellsEnumeration::ScCellsEnumeration(ScDocShell* pDocSh, const ScRangeList& rR) :
9245cdf0e10cSrcweir pDocShell( pDocSh ),
9246cdf0e10cSrcweir aRanges( rR ),
9247cdf0e10cSrcweir pMark( NULL ),
9248cdf0e10cSrcweir bAtEnd( sal_False )
9249cdf0e10cSrcweir {
9250cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
9251cdf0e10cSrcweir pDoc->AddUnoObject(*this);
9252cdf0e10cSrcweir
9253cdf0e10cSrcweir if ( aRanges.Count() == 0 )
9254cdf0e10cSrcweir bAtEnd = sal_True;
9255cdf0e10cSrcweir else
9256cdf0e10cSrcweir {
9257cdf0e10cSrcweir SCTAB nTab = 0;
9258cdf0e10cSrcweir const ScRange* pFirst = aRanges.GetObject(0);
9259cdf0e10cSrcweir if (pFirst)
9260cdf0e10cSrcweir nTab = pFirst->aStart.Tab();
9261cdf0e10cSrcweir aPos = ScAddress(0,0,nTab);
9262cdf0e10cSrcweir CheckPos_Impl(); // aPos auf erste passende Zelle setzen
9263cdf0e10cSrcweir }
9264cdf0e10cSrcweir }
9265cdf0e10cSrcweir
CheckPos_Impl()9266cdf0e10cSrcweir void ScCellsEnumeration::CheckPos_Impl()
9267cdf0e10cSrcweir {
9268cdf0e10cSrcweir if (pDocShell)
9269cdf0e10cSrcweir {
9270cdf0e10cSrcweir sal_Bool bFound = sal_False;
9271cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
9272cdf0e10cSrcweir ScBaseCell* pCell = pDoc->GetCell(aPos);
9273cdf0e10cSrcweir if ( pCell && pCell->GetCellType() != CELLTYPE_NOTE )
9274cdf0e10cSrcweir {
9275cdf0e10cSrcweir if (!pMark)
9276cdf0e10cSrcweir {
9277cdf0e10cSrcweir pMark = new ScMarkData;
9278cdf0e10cSrcweir pMark->MarkFromRangeList( aRanges, sal_False );
9279cdf0e10cSrcweir pMark->MarkToMulti(); // needed for GetNextMarkedCell
9280cdf0e10cSrcweir }
9281cdf0e10cSrcweir bFound = pMark->IsCellMarked( aPos.Col(), aPos.Row() );
9282cdf0e10cSrcweir }
9283cdf0e10cSrcweir if (!bFound)
9284cdf0e10cSrcweir Advance_Impl();
9285cdf0e10cSrcweir }
9286cdf0e10cSrcweir }
9287cdf0e10cSrcweir
~ScCellsEnumeration()9288cdf0e10cSrcweir ScCellsEnumeration::~ScCellsEnumeration()
9289cdf0e10cSrcweir {
9290cdf0e10cSrcweir if (pDocShell)
9291cdf0e10cSrcweir pDocShell->GetDocument()->RemoveUnoObject(*this);
9292cdf0e10cSrcweir delete pMark;
9293cdf0e10cSrcweir }
9294cdf0e10cSrcweir
Advance_Impl()9295cdf0e10cSrcweir void ScCellsEnumeration::Advance_Impl()
9296cdf0e10cSrcweir {
9297cdf0e10cSrcweir DBG_ASSERT(!bAtEnd,"zuviel Advance_Impl");
9298cdf0e10cSrcweir if (!pMark)
9299cdf0e10cSrcweir {
9300cdf0e10cSrcweir pMark = new ScMarkData;
9301cdf0e10cSrcweir pMark->MarkFromRangeList( aRanges, sal_False );
9302cdf0e10cSrcweir pMark->MarkToMulti(); // needed for GetNextMarkedCell
9303cdf0e10cSrcweir }
9304cdf0e10cSrcweir
9305cdf0e10cSrcweir SCCOL nCol = aPos.Col();
9306cdf0e10cSrcweir SCROW nRow = aPos.Row();
9307cdf0e10cSrcweir SCTAB nTab = aPos.Tab();
9308cdf0e10cSrcweir sal_Bool bFound = pDocShell->GetDocument()->GetNextMarkedCell( nCol, nRow, nTab, *pMark );
9309cdf0e10cSrcweir if (bFound)
9310cdf0e10cSrcweir aPos.Set( nCol, nRow, nTab );
9311cdf0e10cSrcweir else
9312cdf0e10cSrcweir bAtEnd = sal_True; // kommt nix mehr
9313cdf0e10cSrcweir }
9314cdf0e10cSrcweir
Notify(SfxBroadcaster &,const SfxHint & rHint)9315cdf0e10cSrcweir void ScCellsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint )
9316cdf0e10cSrcweir {
9317cdf0e10cSrcweir if ( rHint.ISA( ScUpdateRefHint ) )
9318cdf0e10cSrcweir {
9319cdf0e10cSrcweir if (pDocShell)
9320cdf0e10cSrcweir {
9321cdf0e10cSrcweir const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint;
9322cdf0e10cSrcweir aRanges.UpdateReference( rRef.GetMode(), pDocShell->GetDocument(), rRef.GetRange(),
9323cdf0e10cSrcweir rRef.GetDx(), rRef.GetDy(), rRef.GetDz() );
9324cdf0e10cSrcweir
9325cdf0e10cSrcweir delete pMark; // aus verschobenen Bereichen neu erzeugen
9326cdf0e10cSrcweir pMark = NULL;
9327cdf0e10cSrcweir
9328cdf0e10cSrcweir if (!bAtEnd) // aPos anpassen
9329cdf0e10cSrcweir {
9330cdf0e10cSrcweir ScRangeList aNew;
9331cdf0e10cSrcweir aNew.Append(ScRange(aPos));
9332cdf0e10cSrcweir aNew.UpdateReference( rRef.GetMode(), pDocShell->GetDocument(), rRef.GetRange(),
9333cdf0e10cSrcweir rRef.GetDx(), rRef.GetDy(), rRef.GetDz() );
9334cdf0e10cSrcweir if (aNew.Count()==1)
9335cdf0e10cSrcweir {
9336cdf0e10cSrcweir aPos = aNew.GetObject(0)->aStart;
9337cdf0e10cSrcweir CheckPos_Impl();
9338cdf0e10cSrcweir }
9339cdf0e10cSrcweir }
9340cdf0e10cSrcweir }
9341cdf0e10cSrcweir }
9342cdf0e10cSrcweir else if ( rHint.ISA( SfxSimpleHint ) &&
9343cdf0e10cSrcweir ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
9344cdf0e10cSrcweir {
9345cdf0e10cSrcweir pDocShell = NULL; // ungueltig geworden
9346cdf0e10cSrcweir }
9347cdf0e10cSrcweir }
9348cdf0e10cSrcweir
9349cdf0e10cSrcweir // XEnumeration
9350cdf0e10cSrcweir
hasMoreElements()9351cdf0e10cSrcweir sal_Bool SAL_CALL ScCellsEnumeration::hasMoreElements() throw(uno::RuntimeException)
9352cdf0e10cSrcweir {
9353cdf0e10cSrcweir ScUnoGuard aGuard;
9354cdf0e10cSrcweir return !bAtEnd;
9355cdf0e10cSrcweir }
9356cdf0e10cSrcweir
nextElement()9357cdf0e10cSrcweir uno::Any SAL_CALL ScCellsEnumeration::nextElement() throw(container::NoSuchElementException,
9358cdf0e10cSrcweir lang::WrappedTargetException, uno::RuntimeException)
9359cdf0e10cSrcweir {
9360cdf0e10cSrcweir ScUnoGuard aGuard;
9361cdf0e10cSrcweir if (pDocShell && !bAtEnd)
9362cdf0e10cSrcweir {
9363cdf0e10cSrcweir // Interface-Typ muss zu ScCellsObj::getElementType passen
9364cdf0e10cSrcweir
9365cdf0e10cSrcweir ScAddress aTempPos(aPos);
9366cdf0e10cSrcweir Advance_Impl();
9367cdf0e10cSrcweir return uno::makeAny(uno::Reference<table::XCell>(new ScCellObj( pDocShell, aTempPos )));
9368cdf0e10cSrcweir }
9369cdf0e10cSrcweir
9370cdf0e10cSrcweir throw container::NoSuchElementException(); // no more elements
9371cdf0e10cSrcweir // return uno::Any();
9372cdf0e10cSrcweir }
9373cdf0e10cSrcweir
9374cdf0e10cSrcweir //------------------------------------------------------------------------
9375cdf0e10cSrcweir
ScCellFormatsObj(ScDocShell * pDocSh,const ScRange & rRange)9376cdf0e10cSrcweir ScCellFormatsObj::ScCellFormatsObj(ScDocShell* pDocSh, const ScRange& rRange) :
9377cdf0e10cSrcweir pDocShell( pDocSh ),
9378cdf0e10cSrcweir aTotalRange( rRange )
9379cdf0e10cSrcweir {
9380cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
9381cdf0e10cSrcweir pDoc->AddUnoObject(*this);
9382cdf0e10cSrcweir
9383cdf0e10cSrcweir DBG_ASSERT( aTotalRange.aStart.Tab() == aTotalRange.aEnd.Tab(), "unterschiedliche Tabellen" );
9384cdf0e10cSrcweir }
9385cdf0e10cSrcweir
~ScCellFormatsObj()9386cdf0e10cSrcweir ScCellFormatsObj::~ScCellFormatsObj()
9387cdf0e10cSrcweir {
9388cdf0e10cSrcweir if (pDocShell)
9389cdf0e10cSrcweir pDocShell->GetDocument()->RemoveUnoObject(*this);
9390cdf0e10cSrcweir }
9391cdf0e10cSrcweir
Notify(SfxBroadcaster &,const SfxHint & rHint)9392cdf0e10cSrcweir void ScCellFormatsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
9393cdf0e10cSrcweir {
9394cdf0e10cSrcweir if ( rHint.ISA( ScUpdateRefHint ) )
9395cdf0e10cSrcweir {
9396cdf0e10cSrcweir //! aTotalRange...
9397cdf0e10cSrcweir }
9398cdf0e10cSrcweir else if ( rHint.ISA( SfxSimpleHint ) &&
9399cdf0e10cSrcweir ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
9400cdf0e10cSrcweir {
9401cdf0e10cSrcweir pDocShell = NULL; // ungueltig geworden
9402cdf0e10cSrcweir }
9403cdf0e10cSrcweir }
9404cdf0e10cSrcweir
GetObjectByIndex_Impl(long nIndex) const9405cdf0e10cSrcweir ScCellRangeObj* ScCellFormatsObj::GetObjectByIndex_Impl(long nIndex) const
9406cdf0e10cSrcweir {
9407cdf0e10cSrcweir //! direkt auf die AttrArrays zugreifen !!!!
9408cdf0e10cSrcweir
9409cdf0e10cSrcweir ScCellRangeObj* pRet = NULL;
9410cdf0e10cSrcweir if (pDocShell)
9411cdf0e10cSrcweir {
9412cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
9413cdf0e10cSrcweir long nPos = 0;
9414cdf0e10cSrcweir ScAttrRectIterator aIter( pDoc, aTotalRange.aStart.Tab(),
9415cdf0e10cSrcweir aTotalRange.aStart.Col(), aTotalRange.aStart.Row(),
9416cdf0e10cSrcweir aTotalRange.aEnd.Col(), aTotalRange.aEnd.Row() );
9417cdf0e10cSrcweir SCCOL nCol1, nCol2;
9418cdf0e10cSrcweir SCROW nRow1, nRow2;
9419cdf0e10cSrcweir while ( aIter.GetNext( nCol1, nCol2, nRow1, nRow2 ) )
9420cdf0e10cSrcweir {
9421cdf0e10cSrcweir if ( nPos == nIndex )
9422cdf0e10cSrcweir {
9423cdf0e10cSrcweir SCTAB nTab = aTotalRange.aStart.Tab();
9424cdf0e10cSrcweir ScRange aNext( nCol1, nRow1, nTab, nCol2, nRow2, nTab );
9425cdf0e10cSrcweir
9426cdf0e10cSrcweir if ( aNext.aStart == aNext.aEnd )
9427cdf0e10cSrcweir pRet = new ScCellObj( pDocShell, aNext.aStart );
9428cdf0e10cSrcweir else
9429cdf0e10cSrcweir pRet = new ScCellRangeObj( pDocShell, aNext );
9430cdf0e10cSrcweir }
9431cdf0e10cSrcweir ++nPos;
9432cdf0e10cSrcweir }
9433cdf0e10cSrcweir }
9434cdf0e10cSrcweir return pRet;
9435cdf0e10cSrcweir }
9436cdf0e10cSrcweir
9437cdf0e10cSrcweir // XIndexAccess
9438cdf0e10cSrcweir
getCount()9439cdf0e10cSrcweir sal_Int32 SAL_CALL ScCellFormatsObj::getCount() throw(uno::RuntimeException)
9440cdf0e10cSrcweir {
9441cdf0e10cSrcweir ScUnoGuard aGuard;
9442cdf0e10cSrcweir
9443cdf0e10cSrcweir //! direkt auf die AttrArrays zugreifen !!!!
9444cdf0e10cSrcweir
9445cdf0e10cSrcweir long nCount = 0;
9446cdf0e10cSrcweir if (pDocShell)
9447cdf0e10cSrcweir {
9448cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
9449cdf0e10cSrcweir ScAttrRectIterator aIter( pDoc, aTotalRange.aStart.Tab(),
9450cdf0e10cSrcweir aTotalRange.aStart.Col(), aTotalRange.aStart.Row(),
9451cdf0e10cSrcweir aTotalRange.aEnd.Col(), aTotalRange.aEnd.Row() );
9452cdf0e10cSrcweir SCCOL nCol1, nCol2;
9453cdf0e10cSrcweir SCROW nRow1, nRow2;
9454cdf0e10cSrcweir while ( aIter.GetNext( nCol1, nCol2, nRow1, nRow2 ) )
9455cdf0e10cSrcweir ++nCount;
9456cdf0e10cSrcweir }
9457cdf0e10cSrcweir return nCount;
9458cdf0e10cSrcweir }
9459cdf0e10cSrcweir
getByIndex(sal_Int32 nIndex)9460cdf0e10cSrcweir uno::Any SAL_CALL ScCellFormatsObj::getByIndex( sal_Int32 nIndex )
9461cdf0e10cSrcweir throw(lang::IndexOutOfBoundsException,
9462cdf0e10cSrcweir lang::WrappedTargetException, uno::RuntimeException)
9463cdf0e10cSrcweir {
9464cdf0e10cSrcweir ScUnoGuard aGuard;
9465cdf0e10cSrcweir
9466cdf0e10cSrcweir uno::Reference<table::XCellRange> xRange(GetObjectByIndex_Impl(nIndex));
9467cdf0e10cSrcweir if (xRange.is())
9468cdf0e10cSrcweir return uno::makeAny(xRange);
9469cdf0e10cSrcweir else
9470cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
9471cdf0e10cSrcweir // return uno::Any();
9472cdf0e10cSrcweir }
9473cdf0e10cSrcweir
getElementType()9474cdf0e10cSrcweir uno::Type SAL_CALL ScCellFormatsObj::getElementType() throw(uno::RuntimeException)
9475cdf0e10cSrcweir {
9476cdf0e10cSrcweir ScUnoGuard aGuard;
9477cdf0e10cSrcweir return getCppuType((uno::Reference<table::XCellRange>*)0);
9478cdf0e10cSrcweir }
9479cdf0e10cSrcweir
hasElements()9480cdf0e10cSrcweir sal_Bool SAL_CALL ScCellFormatsObj::hasElements() throw(uno::RuntimeException)
9481cdf0e10cSrcweir {
9482cdf0e10cSrcweir ScUnoGuard aGuard;
9483cdf0e10cSrcweir return ( getCount() != 0 ); //! immer groesser 0 ??
9484cdf0e10cSrcweir }
9485cdf0e10cSrcweir
9486cdf0e10cSrcweir // XEnumerationAccess
9487cdf0e10cSrcweir
createEnumeration()9488cdf0e10cSrcweir uno::Reference<container::XEnumeration> SAL_CALL ScCellFormatsObj::createEnumeration()
9489cdf0e10cSrcweir throw(uno::RuntimeException)
9490cdf0e10cSrcweir {
9491cdf0e10cSrcweir ScUnoGuard aGuard;
9492cdf0e10cSrcweir if (pDocShell)
9493cdf0e10cSrcweir return new ScCellFormatsEnumeration( pDocShell, aTotalRange );
9494cdf0e10cSrcweir return NULL;
9495cdf0e10cSrcweir }
9496cdf0e10cSrcweir
9497cdf0e10cSrcweir //------------------------------------------------------------------------
9498cdf0e10cSrcweir
ScCellFormatsEnumeration(ScDocShell * pDocSh,const ScRange & rRange)9499cdf0e10cSrcweir ScCellFormatsEnumeration::ScCellFormatsEnumeration(ScDocShell* pDocSh, const ScRange& rRange) :
9500cdf0e10cSrcweir pDocShell( pDocSh ),
9501cdf0e10cSrcweir nTab( rRange.aStart.Tab() ),
9502cdf0e10cSrcweir pIter( NULL ),
9503cdf0e10cSrcweir bAtEnd( sal_False ),
9504cdf0e10cSrcweir bDirty( sal_False )
9505cdf0e10cSrcweir {
9506cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
9507cdf0e10cSrcweir pDoc->AddUnoObject(*this);
9508cdf0e10cSrcweir
9509cdf0e10cSrcweir DBG_ASSERT( rRange.aStart.Tab() == rRange.aEnd.Tab(),
9510cdf0e10cSrcweir "CellFormatsEnumeration: unterschiedliche Tabellen" );
9511cdf0e10cSrcweir
9512cdf0e10cSrcweir pIter = new ScAttrRectIterator( pDoc, nTab,
9513cdf0e10cSrcweir rRange.aStart.Col(), rRange.aStart.Row(),
9514cdf0e10cSrcweir rRange.aEnd.Col(), rRange.aEnd.Row() );
9515cdf0e10cSrcweir Advance_Impl();
9516cdf0e10cSrcweir }
9517cdf0e10cSrcweir
~ScCellFormatsEnumeration()9518cdf0e10cSrcweir ScCellFormatsEnumeration::~ScCellFormatsEnumeration()
9519cdf0e10cSrcweir {
9520cdf0e10cSrcweir if (pDocShell)
9521cdf0e10cSrcweir pDocShell->GetDocument()->RemoveUnoObject(*this);
9522cdf0e10cSrcweir delete pIter;
9523cdf0e10cSrcweir }
9524cdf0e10cSrcweir
Advance_Impl()9525cdf0e10cSrcweir void ScCellFormatsEnumeration::Advance_Impl()
9526cdf0e10cSrcweir {
9527cdf0e10cSrcweir DBG_ASSERT(!bAtEnd,"zuviel Advance_Impl");
9528cdf0e10cSrcweir
9529cdf0e10cSrcweir if ( pIter )
9530cdf0e10cSrcweir {
9531cdf0e10cSrcweir if ( bDirty )
9532cdf0e10cSrcweir {
9533cdf0e10cSrcweir pIter->DataChanged(); // AttrArray-Index neu suchen
9534cdf0e10cSrcweir bDirty = sal_False;
9535cdf0e10cSrcweir }
9536cdf0e10cSrcweir
9537cdf0e10cSrcweir SCCOL nCol1, nCol2;
9538cdf0e10cSrcweir SCROW nRow1, nRow2;
9539cdf0e10cSrcweir if ( pIter->GetNext( nCol1, nCol2, nRow1, nRow2 ) )
9540cdf0e10cSrcweir aNext = ScRange( nCol1, nRow1, nTab, nCol2, nRow2, nTab );
9541cdf0e10cSrcweir else
9542cdf0e10cSrcweir bAtEnd = sal_True; // kommt nix mehr
9543cdf0e10cSrcweir }
9544cdf0e10cSrcweir else
9545cdf0e10cSrcweir bAtEnd = sal_True; // Dok weggekommen oder so
9546cdf0e10cSrcweir }
9547cdf0e10cSrcweir
NextObject_Impl()9548cdf0e10cSrcweir ScCellRangeObj* ScCellFormatsEnumeration::NextObject_Impl()
9549cdf0e10cSrcweir {
9550cdf0e10cSrcweir ScCellRangeObj* pRet = NULL;
9551cdf0e10cSrcweir if (pDocShell && !bAtEnd)
9552cdf0e10cSrcweir {
9553cdf0e10cSrcweir if ( aNext.aStart == aNext.aEnd )
9554cdf0e10cSrcweir pRet = new ScCellObj( pDocShell, aNext.aStart );
9555cdf0e10cSrcweir else
9556cdf0e10cSrcweir pRet = new ScCellRangeObj( pDocShell, aNext );
9557cdf0e10cSrcweir Advance_Impl();
9558cdf0e10cSrcweir }
9559cdf0e10cSrcweir return pRet;
9560cdf0e10cSrcweir }
9561cdf0e10cSrcweir
Notify(SfxBroadcaster &,const SfxHint & rHint)9562cdf0e10cSrcweir void ScCellFormatsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint )
9563cdf0e10cSrcweir {
9564cdf0e10cSrcweir if ( rHint.ISA( ScUpdateRefHint ) )
9565cdf0e10cSrcweir {
9566cdf0e10cSrcweir //! und nun ???
9567cdf0e10cSrcweir }
9568cdf0e10cSrcweir else if ( rHint.ISA( SfxSimpleHint ) )
9569cdf0e10cSrcweir {
9570cdf0e10cSrcweir sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId();
9571cdf0e10cSrcweir if ( nId == SFX_HINT_DYING )
9572cdf0e10cSrcweir {
9573cdf0e10cSrcweir pDocShell = NULL; // ungueltig geworden
9574cdf0e10cSrcweir delete pIter;
9575cdf0e10cSrcweir pIter = NULL;
9576cdf0e10cSrcweir }
9577cdf0e10cSrcweir else if ( nId == SFX_HINT_DATACHANGED )
9578cdf0e10cSrcweir {
9579cdf0e10cSrcweir bDirty = sal_True; // AttrArray-Index evtl. ungueltig geworden
9580cdf0e10cSrcweir }
9581cdf0e10cSrcweir }
9582cdf0e10cSrcweir }
9583cdf0e10cSrcweir
9584cdf0e10cSrcweir // XEnumeration
9585cdf0e10cSrcweir
hasMoreElements()9586cdf0e10cSrcweir sal_Bool SAL_CALL ScCellFormatsEnumeration::hasMoreElements() throw(uno::RuntimeException)
9587cdf0e10cSrcweir {
9588cdf0e10cSrcweir ScUnoGuard aGuard;
9589cdf0e10cSrcweir return !bAtEnd;
9590cdf0e10cSrcweir }
9591cdf0e10cSrcweir
nextElement()9592cdf0e10cSrcweir uno::Any SAL_CALL ScCellFormatsEnumeration::nextElement() throw(container::NoSuchElementException,
9593cdf0e10cSrcweir lang::WrappedTargetException, uno::RuntimeException)
9594cdf0e10cSrcweir {
9595cdf0e10cSrcweir ScUnoGuard aGuard;
9596cdf0e10cSrcweir
9597cdf0e10cSrcweir if ( bAtEnd || !pDocShell )
9598cdf0e10cSrcweir throw container::NoSuchElementException(); // no more elements
9599cdf0e10cSrcweir
9600cdf0e10cSrcweir // Interface-Typ muss zu ScCellFormatsObj::getElementType passen
9601cdf0e10cSrcweir
9602cdf0e10cSrcweir return uno::makeAny(uno::Reference<table::XCellRange> (NextObject_Impl()));
9603cdf0e10cSrcweir }
9604cdf0e10cSrcweir
9605cdf0e10cSrcweir //------------------------------------------------------------------------
9606cdf0e10cSrcweir
ScUniqueCellFormatsObj(ScDocShell * pDocSh,const ScRange & rRange)9607cdf0e10cSrcweir ScUniqueCellFormatsObj::ScUniqueCellFormatsObj(ScDocShell* pDocSh, const ScRange& rRange) :
9608cdf0e10cSrcweir pDocShell( pDocSh ),
9609cdf0e10cSrcweir aTotalRange( rRange ),
9610cdf0e10cSrcweir aRangeLists()
9611cdf0e10cSrcweir {
9612cdf0e10cSrcweir pDocShell->GetDocument()->AddUnoObject(*this);
9613cdf0e10cSrcweir
9614cdf0e10cSrcweir DBG_ASSERT( aTotalRange.aStart.Tab() == aTotalRange.aEnd.Tab(), "unterschiedliche Tabellen" );
9615cdf0e10cSrcweir
9616cdf0e10cSrcweir GetObjects_Impl();
9617cdf0e10cSrcweir }
9618cdf0e10cSrcweir
~ScUniqueCellFormatsObj()9619cdf0e10cSrcweir ScUniqueCellFormatsObj::~ScUniqueCellFormatsObj()
9620cdf0e10cSrcweir {
9621cdf0e10cSrcweir if (pDocShell)
9622cdf0e10cSrcweir pDocShell->GetDocument()->RemoveUnoObject(*this);
9623cdf0e10cSrcweir }
9624cdf0e10cSrcweir
Notify(SfxBroadcaster &,const SfxHint & rHint)9625cdf0e10cSrcweir void ScUniqueCellFormatsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
9626cdf0e10cSrcweir {
9627cdf0e10cSrcweir if ( rHint.ISA( ScUpdateRefHint ) )
9628cdf0e10cSrcweir {
9629cdf0e10cSrcweir //! aTotalRange...
9630cdf0e10cSrcweir }
9631cdf0e10cSrcweir else if ( rHint.ISA( SfxSimpleHint ) )
9632cdf0e10cSrcweir {
9633cdf0e10cSrcweir sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId();
9634cdf0e10cSrcweir if ( nId == SFX_HINT_DYING )
9635cdf0e10cSrcweir pDocShell = NULL; // ungueltig geworden
9636cdf0e10cSrcweir }
9637cdf0e10cSrcweir }
9638cdf0e10cSrcweir
9639cdf0e10cSrcweir //
9640cdf0e10cSrcweir // Fill the list of formats from the document
9641cdf0e10cSrcweir //
9642cdf0e10cSrcweir
9643cdf0e10cSrcweir // hash code to access the range lists by ScPatternAttr pointer
9644cdf0e10cSrcweir struct ScPatternHashCode
9645cdf0e10cSrcweir {
operator ()ScPatternHashCode9646cdf0e10cSrcweir size_t operator()( const ScPatternAttr* pPattern ) const
9647cdf0e10cSrcweir {
9648cdf0e10cSrcweir return reinterpret_cast<size_t>(pPattern);
9649cdf0e10cSrcweir }
9650cdf0e10cSrcweir };
9651cdf0e10cSrcweir
9652cdf0e10cSrcweir // Hash map to find a range by its start row
9653cdf0e10cSrcweir typedef ::std::hash_map< SCROW, ScRange > ScRowRangeHashMap;
9654cdf0e10cSrcweir
9655cdf0e10cSrcweir typedef ::std::vector<ScRange> ScRangeVector;
9656cdf0e10cSrcweir
9657cdf0e10cSrcweir // Hash map entry.
9658cdf0e10cSrcweir // The Join method depends on the column-wise order of ScAttrRectIterator
9659cdf0e10cSrcweir class ScUniqueFormatsEntry
9660cdf0e10cSrcweir {
9661cdf0e10cSrcweir enum EntryState { STATE_EMPTY, STATE_SINGLE, STATE_COMPLEX };
9662cdf0e10cSrcweir
9663cdf0e10cSrcweir EntryState eState;
9664cdf0e10cSrcweir ScRange aSingleRange;
9665cdf0e10cSrcweir ScRowRangeHashMap aJoinedRanges; // "active" ranges to be merged
9666cdf0e10cSrcweir ScRangeVector aCompletedRanges; // ranges that will no longer be touched
9667cdf0e10cSrcweir ScRangeListRef aReturnRanges; // result as ScRangeList for further use
9668cdf0e10cSrcweir
9669cdf0e10cSrcweir public:
ScUniqueFormatsEntry()9670cdf0e10cSrcweir ScUniqueFormatsEntry() : eState( STATE_EMPTY ) {}
ScUniqueFormatsEntry(const ScUniqueFormatsEntry & r)9671cdf0e10cSrcweir ScUniqueFormatsEntry( const ScUniqueFormatsEntry& r ) :
9672cdf0e10cSrcweir eState( r.eState ),
9673cdf0e10cSrcweir aSingleRange( r.aSingleRange ),
9674cdf0e10cSrcweir aJoinedRanges( r.aJoinedRanges ),
9675cdf0e10cSrcweir aCompletedRanges( r.aCompletedRanges ),
9676cdf0e10cSrcweir aReturnRanges( r.aReturnRanges ) {}
~ScUniqueFormatsEntry()9677cdf0e10cSrcweir ~ScUniqueFormatsEntry() {}
9678cdf0e10cSrcweir
9679cdf0e10cSrcweir void Join( const ScRange& rNewRange );
9680cdf0e10cSrcweir const ScRangeList& GetRanges();
Clear()9681cdf0e10cSrcweir void Clear() { aReturnRanges.Clear(); } // aJoinedRanges and aCompletedRanges are cleared in GetRanges
9682cdf0e10cSrcweir };
9683cdf0e10cSrcweir
Join(const ScRange & rNewRange)9684cdf0e10cSrcweir void ScUniqueFormatsEntry::Join( const ScRange& rNewRange )
9685cdf0e10cSrcweir {
9686cdf0e10cSrcweir // Special-case handling for single range
9687cdf0e10cSrcweir
9688cdf0e10cSrcweir if ( eState == STATE_EMPTY )
9689cdf0e10cSrcweir {
9690cdf0e10cSrcweir aSingleRange = rNewRange;
9691cdf0e10cSrcweir eState = STATE_SINGLE;
9692cdf0e10cSrcweir return;
9693cdf0e10cSrcweir }
9694cdf0e10cSrcweir if ( eState == STATE_SINGLE )
9695cdf0e10cSrcweir {
9696cdf0e10cSrcweir if ( aSingleRange.aStart.Row() == rNewRange.aStart.Row() &&
9697cdf0e10cSrcweir aSingleRange.aEnd.Row() == rNewRange.aEnd.Row() &&
9698cdf0e10cSrcweir aSingleRange.aEnd.Col() + 1 == rNewRange.aStart.Col() )
9699cdf0e10cSrcweir {
9700cdf0e10cSrcweir aSingleRange.aEnd.SetCol( rNewRange.aEnd.Col() );
9701cdf0e10cSrcweir return; // still a single range
9702cdf0e10cSrcweir }
9703cdf0e10cSrcweir
9704cdf0e10cSrcweir SCROW nSingleRow = aSingleRange.aStart.Row();
9705cdf0e10cSrcweir aJoinedRanges.insert( ScRowRangeHashMap::value_type( nSingleRow, aSingleRange ) );
9706cdf0e10cSrcweir eState = STATE_COMPLEX;
9707cdf0e10cSrcweir // continue normally
9708cdf0e10cSrcweir }
9709cdf0e10cSrcweir
9710cdf0e10cSrcweir // This is called in the order of ScAttrRectIterator results.
9711cdf0e10cSrcweir // rNewRange can only be joined with an existing entry if it's the same rows, starting in the next column.
9712cdf0e10cSrcweir // If the old entry for the start row extends to a different end row, or ends in a different column, it
9713cdf0e10cSrcweir // can be moved to aCompletedRanges because it can't be joined with following iterator results.
9714cdf0e10cSrcweir // Everything happens within one sheet, so Tab can be ignored.
9715cdf0e10cSrcweir
9716cdf0e10cSrcweir SCROW nStartRow = rNewRange.aStart.Row();
9717cdf0e10cSrcweir ScRowRangeHashMap::iterator aIter( aJoinedRanges.find( nStartRow ) ); // find the active entry for the start row
9718cdf0e10cSrcweir if ( aIter != aJoinedRanges.end() )
9719cdf0e10cSrcweir {
9720cdf0e10cSrcweir ScRange& rOldRange = aIter->second;
9721cdf0e10cSrcweir if ( rOldRange.aEnd.Row() == rNewRange.aEnd.Row() &&
9722cdf0e10cSrcweir rOldRange.aEnd.Col() + 1 == rNewRange.aStart.Col() )
9723cdf0e10cSrcweir {
9724cdf0e10cSrcweir // extend existing range
9725cdf0e10cSrcweir rOldRange.aEnd.SetCol( rNewRange.aEnd.Col() );
9726cdf0e10cSrcweir }
9727cdf0e10cSrcweir else
9728cdf0e10cSrcweir {
9729cdf0e10cSrcweir // move old range to aCompletedRanges, keep rNewRange for joining
9730cdf0e10cSrcweir aCompletedRanges.push_back( rOldRange );
9731cdf0e10cSrcweir rOldRange = rNewRange; // replace in hash map
9732cdf0e10cSrcweir }
9733cdf0e10cSrcweir }
9734cdf0e10cSrcweir else
9735cdf0e10cSrcweir {
9736cdf0e10cSrcweir // keep rNewRange for joining
9737cdf0e10cSrcweir aJoinedRanges.insert( ScRowRangeHashMap::value_type( nStartRow, rNewRange ) );
9738cdf0e10cSrcweir }
9739cdf0e10cSrcweir }
9740cdf0e10cSrcweir
GetRanges()9741cdf0e10cSrcweir const ScRangeList& ScUniqueFormatsEntry::GetRanges()
9742cdf0e10cSrcweir {
9743cdf0e10cSrcweir if ( eState == STATE_SINGLE )
9744cdf0e10cSrcweir {
9745cdf0e10cSrcweir aReturnRanges = new ScRangeList;
9746cdf0e10cSrcweir aReturnRanges->Append( aSingleRange );
9747cdf0e10cSrcweir return *aReturnRanges;
9748cdf0e10cSrcweir }
9749cdf0e10cSrcweir
9750cdf0e10cSrcweir // move remaining entries from aJoinedRanges to aCompletedRanges
9751cdf0e10cSrcweir
9752cdf0e10cSrcweir ScRowRangeHashMap::const_iterator aJoinedEnd = aJoinedRanges.end();
9753cdf0e10cSrcweir for ( ScRowRangeHashMap::const_iterator aJoinedIter = aJoinedRanges.begin(); aJoinedIter != aJoinedEnd; ++aJoinedIter )
9754cdf0e10cSrcweir aCompletedRanges.push_back( aJoinedIter->second );
9755cdf0e10cSrcweir aJoinedRanges.clear();
9756cdf0e10cSrcweir
9757cdf0e10cSrcweir // sort all ranges for a predictable API result
9758cdf0e10cSrcweir
9759cdf0e10cSrcweir std::sort( aCompletedRanges.begin(), aCompletedRanges.end() );
9760cdf0e10cSrcweir
9761cdf0e10cSrcweir // fill and return ScRangeList
9762cdf0e10cSrcweir
9763cdf0e10cSrcweir aReturnRanges = new ScRangeList;
9764cdf0e10cSrcweir ScRangeVector::const_iterator aCompEnd( aCompletedRanges.end() );
9765cdf0e10cSrcweir for ( ScRangeVector::const_iterator aCompIter( aCompletedRanges.begin() ); aCompIter != aCompEnd; ++aCompIter )
9766cdf0e10cSrcweir aReturnRanges->Append( *aCompIter );
9767cdf0e10cSrcweir aCompletedRanges.clear();
9768cdf0e10cSrcweir
9769cdf0e10cSrcweir return *aReturnRanges;
9770cdf0e10cSrcweir }
9771cdf0e10cSrcweir
9772cdf0e10cSrcweir typedef ::std::hash_map< const ScPatternAttr*, ScUniqueFormatsEntry, ScPatternHashCode > ScUniqueFormatsHashMap;
9773cdf0e10cSrcweir
9774cdf0e10cSrcweir // function object to sort the range lists by start of first range
9775cdf0e10cSrcweir struct ScUniqueFormatsOrder
9776cdf0e10cSrcweir {
operator ()ScUniqueFormatsOrder9777cdf0e10cSrcweir bool operator()( const ScRangeList& rList1, const ScRangeList& rList2 ) const
9778cdf0e10cSrcweir {
9779cdf0e10cSrcweir // all range lists have at least one entry
9780cdf0e10cSrcweir DBG_ASSERT( rList1.Count() > 0 && rList2.Count() > 0, "ScUniqueFormatsOrder: empty list" );
9781cdf0e10cSrcweir
9782cdf0e10cSrcweir // compare start positions using ScAddress comparison operator
9783cdf0e10cSrcweir return ( rList1.GetObject(0)->aStart < rList2.GetObject(0)->aStart );
9784cdf0e10cSrcweir }
9785cdf0e10cSrcweir };
9786cdf0e10cSrcweir
GetObjects_Impl()9787cdf0e10cSrcweir void ScUniqueCellFormatsObj::GetObjects_Impl()
9788cdf0e10cSrcweir {
9789cdf0e10cSrcweir if (pDocShell)
9790cdf0e10cSrcweir {
9791cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument();
9792cdf0e10cSrcweir SCTAB nTab = aTotalRange.aStart.Tab();
9793cdf0e10cSrcweir ScAttrRectIterator aIter( pDoc, nTab,
9794cdf0e10cSrcweir aTotalRange.aStart.Col(), aTotalRange.aStart.Row(),
9795cdf0e10cSrcweir aTotalRange.aEnd.Col(), aTotalRange.aEnd.Row() );
9796cdf0e10cSrcweir SCCOL nCol1, nCol2;
9797cdf0e10cSrcweir SCROW nRow1, nRow2;
9798cdf0e10cSrcweir
9799cdf0e10cSrcweir // Collect the ranges for each format in a hash map, to avoid nested loops
9800cdf0e10cSrcweir
9801cdf0e10cSrcweir ScUniqueFormatsHashMap aHashMap;
9802cdf0e10cSrcweir while (aIter.GetNext( nCol1, nCol2, nRow1, nRow2 ) )
9803cdf0e10cSrcweir {
9804cdf0e10cSrcweir ScRange aRange( nCol1, nRow1, nTab, nCol2, nRow2, nTab );
9805cdf0e10cSrcweir const ScPatternAttr* pPattern = pDoc->GetPattern(nCol1, nRow1, nTab);
9806cdf0e10cSrcweir aHashMap[pPattern].Join( aRange );
9807cdf0e10cSrcweir }
9808cdf0e10cSrcweir
9809cdf0e10cSrcweir // Fill the vector aRangeLists with the range lists from the hash map
9810cdf0e10cSrcweir
9811cdf0e10cSrcweir aRangeLists.reserve( aHashMap.size() );
9812cdf0e10cSrcweir ScUniqueFormatsHashMap::iterator aMapIter( aHashMap.begin() );
9813cdf0e10cSrcweir ScUniqueFormatsHashMap::iterator aMapEnd( aHashMap.end() );
9814cdf0e10cSrcweir while ( aMapIter != aMapEnd )
9815cdf0e10cSrcweir {
9816cdf0e10cSrcweir ScUniqueFormatsEntry& rEntry = aMapIter->second;
9817cdf0e10cSrcweir const ScRangeList& rRanges = rEntry.GetRanges();
9818cdf0e10cSrcweir aRangeLists.push_back( rRanges ); // copy ScRangeList
9819cdf0e10cSrcweir rEntry.Clear(); // free memory, don't hold both copies of all ranges
9820cdf0e10cSrcweir ++aMapIter;
9821cdf0e10cSrcweir }
9822cdf0e10cSrcweir
9823cdf0e10cSrcweir // Sort the vector by first range's start position, to avoid random shuffling
9824cdf0e10cSrcweir // due to using the ScPatterAttr pointers
9825cdf0e10cSrcweir
9826cdf0e10cSrcweir ScUniqueFormatsOrder aComp;
9827cdf0e10cSrcweir ::std::sort( aRangeLists.begin(), aRangeLists.end(), aComp );
9828cdf0e10cSrcweir }
9829cdf0e10cSrcweir }
9830cdf0e10cSrcweir
9831cdf0e10cSrcweir // XIndexAccess
9832cdf0e10cSrcweir
getCount()9833cdf0e10cSrcweir sal_Int32 SAL_CALL ScUniqueCellFormatsObj::getCount() throw(uno::RuntimeException)
9834cdf0e10cSrcweir {
9835cdf0e10cSrcweir ScUnoGuard aGuard;
9836cdf0e10cSrcweir
9837cdf0e10cSrcweir return aRangeLists.size();
9838cdf0e10cSrcweir }
9839cdf0e10cSrcweir
getByIndex(sal_Int32 nIndex)9840cdf0e10cSrcweir uno::Any SAL_CALL ScUniqueCellFormatsObj::getByIndex( sal_Int32 nIndex )
9841cdf0e10cSrcweir throw(lang::IndexOutOfBoundsException,
9842cdf0e10cSrcweir lang::WrappedTargetException, uno::RuntimeException)
9843cdf0e10cSrcweir {
9844cdf0e10cSrcweir ScUnoGuard aGuard;
9845cdf0e10cSrcweir
9846cdf0e10cSrcweir if(static_cast<sal_uInt32>(nIndex) < aRangeLists.size())
9847cdf0e10cSrcweir return uno::makeAny(uno::Reference<sheet::XSheetCellRangeContainer>(new ScCellRangesObj(pDocShell, aRangeLists[nIndex])));
9848cdf0e10cSrcweir else
9849cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
9850cdf0e10cSrcweir // return uno::Any();
9851cdf0e10cSrcweir }
9852cdf0e10cSrcweir
getElementType()9853cdf0e10cSrcweir uno::Type SAL_CALL ScUniqueCellFormatsObj::getElementType() throw(uno::RuntimeException)
9854cdf0e10cSrcweir {
9855cdf0e10cSrcweir ScUnoGuard aGuard;
9856cdf0e10cSrcweir return getCppuType((uno::Reference<sheet::XSheetCellRangeContainer>*)0);
9857cdf0e10cSrcweir }
9858cdf0e10cSrcweir
hasElements()9859cdf0e10cSrcweir sal_Bool SAL_CALL ScUniqueCellFormatsObj::hasElements() throw(uno::RuntimeException)
9860cdf0e10cSrcweir {
9861cdf0e10cSrcweir ScUnoGuard aGuard;
9862cdf0e10cSrcweir return ( aRangeLists.size() != 0 );
9863cdf0e10cSrcweir }
9864cdf0e10cSrcweir
9865cdf0e10cSrcweir // XEnumerationAccess
9866cdf0e10cSrcweir
createEnumeration()9867cdf0e10cSrcweir uno::Reference<container::XEnumeration> SAL_CALL ScUniqueCellFormatsObj::createEnumeration()
9868cdf0e10cSrcweir throw(uno::RuntimeException)
9869cdf0e10cSrcweir {
9870cdf0e10cSrcweir ScUnoGuard aGuard;
9871cdf0e10cSrcweir if (pDocShell)
9872cdf0e10cSrcweir return new ScUniqueCellFormatsEnumeration( pDocShell, aRangeLists );
9873cdf0e10cSrcweir return NULL;
9874cdf0e10cSrcweir }
9875cdf0e10cSrcweir
9876cdf0e10cSrcweir //------------------------------------------------------------------------
9877cdf0e10cSrcweir
ScUniqueCellFormatsEnumeration(ScDocShell * pDocSh,const ScMyRangeLists & rRangeLists)9878cdf0e10cSrcweir ScUniqueCellFormatsEnumeration::ScUniqueCellFormatsEnumeration(ScDocShell* pDocSh, const ScMyRangeLists& rRangeLists) :
9879cdf0e10cSrcweir aRangeLists(rRangeLists),
9880cdf0e10cSrcweir pDocShell( pDocSh ),
9881cdf0e10cSrcweir nCurrentPosition(0)
9882cdf0e10cSrcweir {
9883cdf0e10cSrcweir pDocShell->GetDocument()->AddUnoObject(*this);
9884cdf0e10cSrcweir }
9885cdf0e10cSrcweir
~ScUniqueCellFormatsEnumeration()9886cdf0e10cSrcweir ScUniqueCellFormatsEnumeration::~ScUniqueCellFormatsEnumeration()
9887cdf0e10cSrcweir {
9888cdf0e10cSrcweir if (pDocShell)
9889cdf0e10cSrcweir pDocShell->GetDocument()->RemoveUnoObject(*this);
9890cdf0e10cSrcweir }
9891cdf0e10cSrcweir
Notify(SfxBroadcaster &,const SfxHint & rHint)9892cdf0e10cSrcweir void ScUniqueCellFormatsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint )
9893cdf0e10cSrcweir {
9894cdf0e10cSrcweir if ( rHint.ISA( ScUpdateRefHint ) )
9895cdf0e10cSrcweir {
9896cdf0e10cSrcweir //! und nun ???
9897cdf0e10cSrcweir }
9898cdf0e10cSrcweir else if ( rHint.ISA( SfxSimpleHint ) )
9899cdf0e10cSrcweir {
9900cdf0e10cSrcweir sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId();
9901cdf0e10cSrcweir if ( nId == SFX_HINT_DYING )
9902cdf0e10cSrcweir pDocShell = NULL; // ungueltig geworden
9903cdf0e10cSrcweir }
9904cdf0e10cSrcweir }
9905cdf0e10cSrcweir
9906cdf0e10cSrcweir // XEnumeration
9907cdf0e10cSrcweir
hasMoreElements()9908cdf0e10cSrcweir sal_Bool SAL_CALL ScUniqueCellFormatsEnumeration::hasMoreElements() throw(uno::RuntimeException)
9909cdf0e10cSrcweir {
9910cdf0e10cSrcweir ScUnoGuard aGuard;
9911cdf0e10cSrcweir return static_cast<sal_uInt32>(nCurrentPosition) < aRangeLists.size();
9912cdf0e10cSrcweir }
9913cdf0e10cSrcweir
nextElement()9914cdf0e10cSrcweir uno::Any SAL_CALL ScUniqueCellFormatsEnumeration::nextElement() throw(container::NoSuchElementException,
9915cdf0e10cSrcweir lang::WrappedTargetException, uno::RuntimeException)
9916cdf0e10cSrcweir {
9917cdf0e10cSrcweir ScUnoGuard aGuard;
9918cdf0e10cSrcweir
9919cdf0e10cSrcweir if ( !hasMoreElements() || !pDocShell )
9920cdf0e10cSrcweir throw container::NoSuchElementException(); // no more elements
9921cdf0e10cSrcweir
9922cdf0e10cSrcweir // Interface-Typ muss zu ScCellFormatsObj::getElementType passen
9923cdf0e10cSrcweir
9924cdf0e10cSrcweir return uno::makeAny(uno::Reference<sheet::XSheetCellRangeContainer>(new ScCellRangesObj(pDocShell, aRangeLists[nCurrentPosition++])));
9925cdf0e10cSrcweir }
9926