1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: docpool.cxx,v $
10 * $Revision: 1.25.144.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
36 #include "scitems.hxx"
37 #include <tools/shl.hxx>
38 #include <vcl/outdev.hxx>
39 #include <svtools/aeitem.hxx>
40 #include <svtools/itemiter.hxx>
41 #include <svx/algitem.hxx>
42 #include <svx/boxitem.hxx>
43 #include <svx/bolnitem.hxx>
44 #include <svx/brshitem.hxx>
45 #include <svx/charreliefitem.hxx>
46 #include <svx/cntritem.hxx>
47 #include <svx/colritem.hxx>
48 #include <svx/crsditem.hxx>
49 #include <svx/dialmgr.hxx>
50 #include <svx/emphitem.hxx>
51 #include <svx/fhgtitem.hxx>
52 #include <svx/fontitem.hxx>
53 #include <svx/forbiddenruleitem.hxx>
54 #include <svx/frmdiritem.hxx>
55 #include <svx/hngpnctitem.hxx>
56 #include <svx/itemtype.hxx>
57 #include <svx/langitem.hxx>
58 #include <svx/lrspitem.hxx>
59 #include <svx/pageitem.hxx>
60 #include <svx/pbinitem.hxx>
61 #include <svx/postitem.hxx>
62 #include <svx/rotmodit.hxx>
63 #include <svx/scriptspaceitem.hxx>
64 #include <svx/shaditem.hxx>
65 #include <svx/shdditem.hxx>
66 #include <svx/sizeitem.hxx>
67 #include <svx/svxitems.hrc>
68 #include <svx/udlnitem.hxx>
69 #include <svx/ulspitem.hxx>
70 #include <svx/wghtitem.hxx>
71 #include <svx/wrlmitem.hxx>
72 #include <svx/xmlcnitm.hxx>
74 #include "docpool.hxx"
77 #include "patattr.hxx"
78 #include "globstr.hrc"
79 #include "sc.hrc" // Slot-IDs
82 #define SC_MAX_POOLREF (SFX_ITEMS_OLD_MAXREF - 39)
83 #define SC_SAFE_POOLREF (SC_MAX_POOLREF + 20)
85 // STATIC DATA -----------------------------------------------------------
87 USHORT
* ScDocumentPool::pVersionMap1
= 0;
88 USHORT
* ScDocumentPool::pVersionMap2
= 0;
89 USHORT
* ScDocumentPool::pVersionMap3
= 0;
90 USHORT
* ScDocumentPool::pVersionMap4
= 0;
91 USHORT
* ScDocumentPool::pVersionMap5
= 0;
92 USHORT
* ScDocumentPool::pVersionMap6
= 0;
93 USHORT
* ScDocumentPool::pVersionMap7
= 0;
94 USHORT
* ScDocumentPool::pVersionMap8
= 0;
95 USHORT
* ScDocumentPool::pVersionMap9
= 0;
96 USHORT
* ScDocumentPool::pVersionMap10
= 0;
97 USHORT
* ScDocumentPool::pVersionMap11
= 0;
99 // ATTR_FONT_TWOLINES (not used) was changed to ATTR_USERDEF (not saved in binary format) in 641c
101 static SfxItemInfo __READONLY_DATA aItemInfos
[] =
103 { SID_ATTR_CHAR_FONT
, SFX_ITEM_POOLABLE
}, // ATTR_FONT
104 { SID_ATTR_CHAR_FONTHEIGHT
, SFX_ITEM_POOLABLE
}, // ATTR_FONT_HEIGHT
105 { SID_ATTR_CHAR_WEIGHT
, SFX_ITEM_POOLABLE
}, // ATTR_FONT_WEIGHT
106 { SID_ATTR_CHAR_POSTURE
, SFX_ITEM_POOLABLE
}, // ATTR_FONT_POSTURE
107 { SID_ATTR_CHAR_UNDERLINE
, SFX_ITEM_POOLABLE
}, // ATTR_FONT_UNDERLINE
108 { SID_ATTR_CHAR_OVERLINE
, SFX_ITEM_POOLABLE
}, // ATTR_FONT_OVERLINE
109 { SID_ATTR_CHAR_STRIKEOUT
, SFX_ITEM_POOLABLE
}, // ATTR_FONT_CROSSEDOUT
110 { SID_ATTR_CHAR_CONTOUR
, SFX_ITEM_POOLABLE
}, // ATTR_FONT_CONTOUR
111 { SID_ATTR_CHAR_SHADOWED
, SFX_ITEM_POOLABLE
}, // ATTR_FONT_SHADOWED
112 { SID_ATTR_CHAR_COLOR
, SFX_ITEM_POOLABLE
}, // ATTR_FONT_COLOR
113 { SID_ATTR_CHAR_LANGUAGE
, SFX_ITEM_POOLABLE
}, // ATTR_FONT_LANGUAGE
114 { SID_ATTR_CHAR_CJK_FONT
, SFX_ITEM_POOLABLE
}, // ATTR_CJK_FONT from 614
115 { SID_ATTR_CHAR_CJK_FONTHEIGHT
, SFX_ITEM_POOLABLE
}, // ATTR_CJK_FONT_HEIGHT from 614
116 { SID_ATTR_CHAR_CJK_WEIGHT
, SFX_ITEM_POOLABLE
}, // ATTR_CJK_FONT_WEIGHT from 614
117 { SID_ATTR_CHAR_CJK_POSTURE
, SFX_ITEM_POOLABLE
}, // ATTR_CJK_FONT_POSTURE from 614
118 { SID_ATTR_CHAR_CJK_LANGUAGE
, SFX_ITEM_POOLABLE
}, // ATTR_CJK_FONT_LANGUAGE from 614
119 { SID_ATTR_CHAR_CTL_FONT
, SFX_ITEM_POOLABLE
}, // ATTR_CTL_FONT from 614
120 { SID_ATTR_CHAR_CTL_FONTHEIGHT
, SFX_ITEM_POOLABLE
}, // ATTR_CTL_FONT_HEIGHT from 614
121 { SID_ATTR_CHAR_CTL_WEIGHT
, SFX_ITEM_POOLABLE
}, // ATTR_CTL_FONT_WEIGHT from 614
122 { SID_ATTR_CHAR_CTL_POSTURE
, SFX_ITEM_POOLABLE
}, // ATTR_CTL_FONT_POSTURE from 614
123 { SID_ATTR_CHAR_CTL_LANGUAGE
, SFX_ITEM_POOLABLE
}, // ATTR_CTL_FONT_LANGUAGE from 614
124 { SID_ATTR_CHAR_EMPHASISMARK
, SFX_ITEM_POOLABLE
}, // ATTR_FONT_EMPHASISMARK from 614
125 { 0, SFX_ITEM_POOLABLE
}, // ATTR_USERDEF from 614 / 641c
126 { SID_ATTR_CHAR_WORDLINEMODE
, SFX_ITEM_POOLABLE
}, // ATTR_FONT_WORDLINE from 632b
127 { SID_ATTR_CHAR_RELIEF
, SFX_ITEM_POOLABLE
}, // ATTR_FONT_RELIEF from 632b
128 { SID_ATTR_ALIGN_HYPHENATION
, SFX_ITEM_POOLABLE
}, // ATTR_HYPHENATE from 632b
129 { 0, SFX_ITEM_POOLABLE
}, // ATTR_SCRIPTSPACE from 614d
130 { 0, SFX_ITEM_POOLABLE
}, // ATTR_HANGPUNCTUATION from 614d
131 { SID_ATTR_PARA_FORBIDDEN_RULES
,SFX_ITEM_POOLABLE
}, // ATTR_FORBIDDEN_RULES from 614d
132 { SID_ATTR_ALIGN_HOR_JUSTIFY
, SFX_ITEM_POOLABLE
}, // ATTR_HOR_JUSTIFY
133 { SID_ATTR_ALIGN_INDENT
, SFX_ITEM_POOLABLE
}, // ATTR_INDENT ab 350
134 { SID_ATTR_ALIGN_VER_JUSTIFY
, SFX_ITEM_POOLABLE
}, // ATTR_VER_JUSTIFY
135 { SID_ATTR_ALIGN_STACKED
, SFX_ITEM_POOLABLE
}, // ATTR_STACKED from 680/dr14 (replaces ATTR_ORIENTATION)
136 { SID_ATTR_ALIGN_DEGREES
, SFX_ITEM_POOLABLE
}, // ATTR_ROTATE_VALUE ab 367
137 { SID_ATTR_ALIGN_LOCKPOS
, SFX_ITEM_POOLABLE
}, // ATTR_ROTATE_MODE ab 367
138 { SID_ATTR_ALIGN_ASIANVERTICAL
, SFX_ITEM_POOLABLE
}, // ATTR_VERTICAL_ASIAN from 642
139 { SID_ATTR_FRAMEDIRECTION
, SFX_ITEM_POOLABLE
}, // ATTR_WRITINGDIR from 643
140 { SID_ATTR_ALIGN_LINEBREAK
, SFX_ITEM_POOLABLE
}, // ATTR_LINEBREAK
141 { SID_ATTR_ALIGN_SHRINKTOFIT
, SFX_ITEM_POOLABLE
}, // ATTR_SHRINKTOFIT from 680/dr14
142 { SID_ATTR_BORDER_DIAG_TLBR
, SFX_ITEM_POOLABLE
}, // ATTR_BORDER_TLBR from 680/dr14
143 { SID_ATTR_BORDER_DIAG_BLTR
, SFX_ITEM_POOLABLE
}, // ATTR_BORDER_BLTR from 680/dr14
144 { SID_ATTR_ALIGN_MARGIN
, SFX_ITEM_POOLABLE
}, // ATTR_MARGIN
145 { 0, SFX_ITEM_POOLABLE
}, // ATTR_MERGE
146 { 0, SFX_ITEM_POOLABLE
}, // ATTR_MERGE_FLAG
147 { SID_ATTR_NUMBERFORMAT_VALUE
, SFX_ITEM_POOLABLE
}, // ATTR_VALUE_FORMAT
148 { ATTR_LANGUAGE_FORMAT
, SFX_ITEM_POOLABLE
}, // ATTR_LANGUAGE_FORMAT ab 329, wird im Dialog mit SID_ATTR_NUMBERFORMAT_VALUE kombiniert
149 { SID_ATTR_BRUSH
, SFX_ITEM_POOLABLE
}, // ATTR_BACKGROUND
150 { SID_SCATTR_PROTECTION
, SFX_ITEM_POOLABLE
}, // ATTR_PROTECTION
151 { SID_ATTR_BORDER_OUTER
, SFX_ITEM_POOLABLE
}, // ATTR_BORDER
152 { SID_ATTR_BORDER_INNER
, SFX_ITEM_POOLABLE
}, // ATTR_BORDER_INNER
153 { SID_ATTR_BORDER_SHADOW
, SFX_ITEM_POOLABLE
}, // ATTR_SHADOW
154 { 0, SFX_ITEM_POOLABLE
}, // ATTR_VALIDDATA
155 { 0, SFX_ITEM_POOLABLE
}, // ATTR_CONDITIONAL
156 { 0, SFX_ITEM_POOLABLE
}, // ATTR_PATTERN
157 { SID_ATTR_LRSPACE
, SFX_ITEM_POOLABLE
}, // ATTR_LRSPACE
158 { SID_ATTR_ULSPACE
, SFX_ITEM_POOLABLE
}, // ATTR_ULSPACE
159 { SID_ATTR_PAGE
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE
160 { 0, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_PAPERTRAY, seit 303 nur noch dummy
161 { SID_ATTR_PAGE_PAPERBIN
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_PAPERBIN
162 { SID_ATTR_PAGE_SIZE
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_SIZE
163 { SID_ATTR_PAGE_MAXSIZE
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_MAXSIZE
164 { SID_ATTR_PAGE_EXT1
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_HORCENTER
165 { SID_ATTR_PAGE_EXT2
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_VERCENTER
166 { SID_ATTR_PAGE_ON
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_ON
167 { SID_ATTR_PAGE_DYNAMIC
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_DYNAMIC
168 { SID_ATTR_PAGE_SHARED
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_SHARED
169 { SID_SCATTR_PAGE_NOTES
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_NOTES
170 { SID_SCATTR_PAGE_GRID
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_GRID
171 { SID_SCATTR_PAGE_HEADERS
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_HEADERS
172 { SID_SCATTR_PAGE_CHARTS
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_CHARTS
173 { SID_SCATTR_PAGE_OBJECTS
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_OBJECTS
174 { SID_SCATTR_PAGE_DRAWINGS
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_DRAWINGS
175 { SID_SCATTR_PAGE_TOPDOWN
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_TOPDOWN
176 { SID_SCATTR_PAGE_SCALE
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_SCALE
177 { SID_SCATTR_PAGE_SCALETOPAGES
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_SCALETOPAGES
178 { SID_SCATTR_PAGE_FIRSTPAGENO
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_FIRSTPAGENO
179 { SID_SCATTR_PAGE_PRINTAREA
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_PRINTAREA
180 { SID_SCATTR_PAGE_REPEATROW
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_REPEATROW
181 { SID_SCATTR_PAGE_REPEATCOL
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_REPEATCOL
182 { SID_SCATTR_PAGE_PRINTTABLES
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_PRINTTABLES
183 { SID_SCATTR_PAGE_HEADERLEFT
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_HEADERLEFT
184 { SID_SCATTR_PAGE_FOOTERLEFT
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_FOOTERLEFT
185 { SID_SCATTR_PAGE_HEADERRIGHT
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_HEADERRIGHT
186 { SID_SCATTR_PAGE_FOOTERRIGHT
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_FOOTERRIGHT
187 { SID_ATTR_PAGE_HEADERSET
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_HEADERSET
188 { SID_ATTR_PAGE_FOOTERSET
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_FOOTERSET
189 { SID_SCATTR_PAGE_FORMULAS
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_FORMULAS
190 { SID_SCATTR_PAGE_NULLVALS
, SFX_ITEM_POOLABLE
}, // ATTR_PAGE_NULLVALS
191 { SID_SCATTR_PAGE_SCALETO
, SFX_ITEM_POOLABLE
} // ATTR_PAGE_SCALETO
194 // -----------------------------------------------------------------------
196 ScDocumentPool::ScDocumentPool( SfxItemPool
* pSecPool
, BOOL bLoadRefCounts
)
198 : SfxItemPool ( String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("ScDocumentPool")),
199 ATTR_STARTINDEX
, ATTR_ENDINDEX
,
200 aItemInfos
, NULL
, bLoadRefCounts
),
201 pSecondary ( pSecPool
)
203 // latin font from GetDefaultFonts is not used, DEFAULTFONT_LATIN_SPREADSHEET instead
204 Font aStdFont
= OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_SPREADSHEET
, LANGUAGE_ENGLISH_US
,
205 DEFAULTFONT_FLAGS_ONLYONE
);
206 SvxFontItem
* pStdFont
= new SvxFontItem( aStdFont
.GetFamily(),
207 aStdFont
.GetName(), aStdFont
.GetStyleName(),
208 aStdFont
.GetPitch(), aStdFont
.GetCharSet(),
211 SvxFontItem
* pCjkFont
= new SvxFontItem( ATTR_CJK_FONT
);
212 SvxFontItem
* pCtlFont
= new SvxFontItem( ATTR_CTL_FONT
);
213 SvxFontItem
aDummy( ATTR_FONT
);
214 GetDefaultFonts( aDummy
, *pCjkFont
, *pCtlFont
);
216 SvxBoxInfoItem
* pGlobalBorderInnerAttr
= new SvxBoxInfoItem( ATTR_BORDER_INNER
);
217 SfxItemSet
* pSet
= new SfxItemSet( *this, ATTR_PATTERN_START
, ATTR_PATTERN_END
);
218 SfxItemSet
aSetItemItemSet( *this,
219 ATTR_BACKGROUND
, ATTR_BACKGROUND
,
220 ATTR_BORDER
, ATTR_SHADOW
,
221 ATTR_LRSPACE
, ATTR_ULSPACE
,
222 ATTR_PAGE_SIZE
, ATTR_PAGE_SIZE
,
223 ATTR_PAGE_ON
, ATTR_PAGE_SHARED
,
226 pGlobalBorderInnerAttr
->SetLine(NULL
, BOXINFO_LINE_HORI
);
227 pGlobalBorderInnerAttr
->SetLine(NULL
, BOXINFO_LINE_VERT
);
228 pGlobalBorderInnerAttr
->SetTable(TRUE
);
229 pGlobalBorderInnerAttr
->SetDist(TRUE
);
230 pGlobalBorderInnerAttr
->SetMinDist(FALSE
);
232 ppPoolDefaults
= new SfxPoolItem
*[ATTR_ENDINDEX
-ATTR_STARTINDEX
+1];
234 ppPoolDefaults
[ ATTR_FONT
- ATTR_STARTINDEX
] = pStdFont
;
235 ppPoolDefaults
[ ATTR_FONT_HEIGHT
- ATTR_STARTINDEX
] = new SvxFontHeightItem( 200, 100, ATTR_FONT_HEIGHT
); // 10 pt;
236 ppPoolDefaults
[ ATTR_FONT_WEIGHT
- ATTR_STARTINDEX
] = new SvxWeightItem( WEIGHT_NORMAL
, ATTR_FONT_WEIGHT
);
237 ppPoolDefaults
[ ATTR_FONT_POSTURE
- ATTR_STARTINDEX
] = new SvxPostureItem( ITALIC_NONE
, ATTR_FONT_POSTURE
);
238 ppPoolDefaults
[ ATTR_FONT_UNDERLINE
- ATTR_STARTINDEX
] = new SvxUnderlineItem( UNDERLINE_NONE
, ATTR_FONT_UNDERLINE
);
239 ppPoolDefaults
[ ATTR_FONT_OVERLINE
- ATTR_STARTINDEX
] = new SvxOverlineItem( UNDERLINE_NONE
, ATTR_FONT_OVERLINE
);
240 ppPoolDefaults
[ ATTR_FONT_CROSSEDOUT
- ATTR_STARTINDEX
] = new SvxCrossedOutItem( STRIKEOUT_NONE
, ATTR_FONT_CROSSEDOUT
);
241 ppPoolDefaults
[ ATTR_FONT_CONTOUR
- ATTR_STARTINDEX
] = new SvxContourItem( sal_False
, ATTR_FONT_CONTOUR
);
242 ppPoolDefaults
[ ATTR_FONT_SHADOWED
- ATTR_STARTINDEX
] = new SvxShadowedItem( sal_False
, ATTR_FONT_SHADOWED
);
243 ppPoolDefaults
[ ATTR_FONT_COLOR
- ATTR_STARTINDEX
] = new SvxColorItem( Color(COL_AUTO
), ATTR_FONT_COLOR
);
244 ppPoolDefaults
[ ATTR_FONT_LANGUAGE
- ATTR_STARTINDEX
] = new SvxLanguageItem( LanguageType(LANGUAGE_DONTKNOW
), ATTR_FONT_LANGUAGE
);
245 ppPoolDefaults
[ ATTR_CJK_FONT
- ATTR_STARTINDEX
] = pCjkFont
;
246 ppPoolDefaults
[ ATTR_CJK_FONT_HEIGHT
- ATTR_STARTINDEX
] = new SvxFontHeightItem( 200, 100, ATTR_CJK_FONT_HEIGHT
);
247 ppPoolDefaults
[ ATTR_CJK_FONT_WEIGHT
- ATTR_STARTINDEX
] = new SvxWeightItem( WEIGHT_NORMAL
, ATTR_CJK_FONT_WEIGHT
);
248 ppPoolDefaults
[ ATTR_CJK_FONT_POSTURE
- ATTR_STARTINDEX
] = new SvxPostureItem( ITALIC_NONE
, ATTR_CJK_FONT_POSTURE
);
249 ppPoolDefaults
[ ATTR_CJK_FONT_LANGUAGE
-ATTR_STARTINDEX
] = new SvxLanguageItem( LanguageType(LANGUAGE_DONTKNOW
),
250 ATTR_CJK_FONT_LANGUAGE
);
251 ppPoolDefaults
[ ATTR_CTL_FONT
- ATTR_STARTINDEX
] = pCtlFont
;
252 ppPoolDefaults
[ ATTR_CTL_FONT_HEIGHT
- ATTR_STARTINDEX
] = new SvxFontHeightItem( 200, 100, ATTR_CTL_FONT_HEIGHT
);
253 ppPoolDefaults
[ ATTR_CTL_FONT_WEIGHT
- ATTR_STARTINDEX
] = new SvxWeightItem( WEIGHT_NORMAL
, ATTR_CTL_FONT_WEIGHT
);
254 ppPoolDefaults
[ ATTR_CTL_FONT_POSTURE
- ATTR_STARTINDEX
] = new SvxPostureItem( ITALIC_NONE
, ATTR_CTL_FONT_POSTURE
);
255 ppPoolDefaults
[ ATTR_CTL_FONT_LANGUAGE
-ATTR_STARTINDEX
] = new SvxLanguageItem( LanguageType(LANGUAGE_DONTKNOW
),
256 ATTR_CTL_FONT_LANGUAGE
);
257 ppPoolDefaults
[ ATTR_FONT_EMPHASISMARK
-ATTR_STARTINDEX
] = new SvxEmphasisMarkItem( EMPHASISMARK_NONE
, ATTR_FONT_EMPHASISMARK
);
258 ppPoolDefaults
[ ATTR_USERDEF
- ATTR_STARTINDEX
] = new SvXMLAttrContainerItem( ATTR_USERDEF
);
259 ppPoolDefaults
[ ATTR_FONT_WORDLINE
- ATTR_STARTINDEX
] = new SvxWordLineModeItem(sal_False
, ATTR_FONT_WORDLINE
);
260 ppPoolDefaults
[ ATTR_FONT_RELIEF
- ATTR_STARTINDEX
] = new SvxCharReliefItem( RELIEF_NONE
, ATTR_FONT_RELIEF
);
261 ppPoolDefaults
[ ATTR_HYPHENATE
- ATTR_STARTINDEX
] = new SfxBoolItem( ATTR_HYPHENATE
);
262 ppPoolDefaults
[ ATTR_SCRIPTSPACE
- ATTR_STARTINDEX
] = new SvxScriptSpaceItem( sal_False
, ATTR_SCRIPTSPACE
);
263 ppPoolDefaults
[ ATTR_HANGPUNCTUATION
- ATTR_STARTINDEX
] = new SvxHangingPunctuationItem( sal_False
, ATTR_HANGPUNCTUATION
);
264 ppPoolDefaults
[ ATTR_FORBIDDEN_RULES
- ATTR_STARTINDEX
] = new SvxForbiddenRuleItem( sal_False
, ATTR_FORBIDDEN_RULES
);
265 ppPoolDefaults
[ ATTR_HOR_JUSTIFY
- ATTR_STARTINDEX
] = new SvxHorJustifyItem( SVX_HOR_JUSTIFY_STANDARD
, ATTR_HOR_JUSTIFY
);
266 ppPoolDefaults
[ ATTR_INDENT
- ATTR_STARTINDEX
] = new SfxUInt16Item( ATTR_INDENT
, 0 );
267 ppPoolDefaults
[ ATTR_VER_JUSTIFY
- ATTR_STARTINDEX
] = new SvxVerJustifyItem( SVX_VER_JUSTIFY_STANDARD
, ATTR_VER_JUSTIFY
);
268 ppPoolDefaults
[ ATTR_STACKED
- ATTR_STARTINDEX
] = new SfxBoolItem( ATTR_STACKED
, FALSE
);
269 ppPoolDefaults
[ ATTR_ROTATE_VALUE
- ATTR_STARTINDEX
] = new SfxInt32Item( ATTR_ROTATE_VALUE
, 0 );
270 ppPoolDefaults
[ ATTR_ROTATE_MODE
- ATTR_STARTINDEX
] = new SvxRotateModeItem( SVX_ROTATE_MODE_BOTTOM
, ATTR_ROTATE_MODE
);
271 ppPoolDefaults
[ ATTR_VERTICAL_ASIAN
- ATTR_STARTINDEX
] = new SfxBoolItem( ATTR_VERTICAL_ASIAN
);
272 // The default for the ATTR_WRITINGDIR cell attribute must by FRMDIR_ENVIRONMENT,
273 // so that value is returned when asking for a default cell's attributes.
274 // The value from the page style is set as DefaultHorizontalTextDirection for the EditEngine.
275 ppPoolDefaults
[ ATTR_WRITINGDIR
- ATTR_STARTINDEX
] = new SvxFrameDirectionItem( FRMDIR_ENVIRONMENT
, ATTR_WRITINGDIR
);
276 ppPoolDefaults
[ ATTR_LINEBREAK
- ATTR_STARTINDEX
] = new SfxBoolItem( ATTR_LINEBREAK
);
277 ppPoolDefaults
[ ATTR_SHRINKTOFIT
- ATTR_STARTINDEX
] = new SfxBoolItem( ATTR_SHRINKTOFIT
);
278 ppPoolDefaults
[ ATTR_BORDER_TLBR
- ATTR_STARTINDEX
] = new SvxLineItem( ATTR_BORDER_TLBR
);
279 ppPoolDefaults
[ ATTR_BORDER_BLTR
- ATTR_STARTINDEX
] = new SvxLineItem( ATTR_BORDER_BLTR
);
280 SvxMarginItem
* pItem
= new SvxMarginItem( ATTR_MARGIN
);
281 pItem
->SetTopMargin( 27 );
282 pItem
->SetBottomMargin( 27 );
283 ppPoolDefaults
[ ATTR_MARGIN
- ATTR_STARTINDEX
] = pItem
;
284 ppPoolDefaults
[ ATTR_MERGE
- ATTR_STARTINDEX
] = new ScMergeAttr
;
285 ppPoolDefaults
[ ATTR_MERGE_FLAG
- ATTR_STARTINDEX
] = new ScMergeFlagAttr
;
286 ppPoolDefaults
[ ATTR_VALUE_FORMAT
- ATTR_STARTINDEX
] = new SfxUInt32Item( ATTR_VALUE_FORMAT
, 0 );
287 ppPoolDefaults
[ ATTR_LANGUAGE_FORMAT
- ATTR_STARTINDEX
] = new SvxLanguageItem( ScGlobal::eLnge
, ATTR_LANGUAGE_FORMAT
);
288 ppPoolDefaults
[ ATTR_BACKGROUND
- ATTR_STARTINDEX
] = new SvxBrushItem( Color(COL_TRANSPARENT
), ATTR_BACKGROUND
);
289 ppPoolDefaults
[ ATTR_PROTECTION
- ATTR_STARTINDEX
] = new ScProtectionAttr
;
290 ppPoolDefaults
[ ATTR_BORDER
- ATTR_STARTINDEX
] = new SvxBoxItem( ATTR_BORDER
);
291 ppPoolDefaults
[ ATTR_BORDER_INNER
- ATTR_STARTINDEX
] = pGlobalBorderInnerAttr
;
292 ppPoolDefaults
[ ATTR_SHADOW
- ATTR_STARTINDEX
] = new SvxShadowItem( ATTR_SHADOW
);
293 ppPoolDefaults
[ ATTR_VALIDDATA
- ATTR_STARTINDEX
] = new SfxUInt32Item( ATTR_VALIDDATA
, 0 );
294 ppPoolDefaults
[ ATTR_CONDITIONAL
- ATTR_STARTINDEX
] = new SfxUInt32Item( ATTR_CONDITIONAL
, 0 );
296 // GetRscString funktioniert erst nach ScGlobal::Init, zu erkennen am EmptyBrushItem
297 //! zusaetzliche Methode ScGlobal::IsInit() oder so...
298 //! oder erkennen, ob dies der Secondary-Pool fuer einen MessagePool ist
299 if ( ScGlobal::GetEmptyBrushItem() )
300 ppPoolDefaults
[ ATTR_PATTERN
- ATTR_STARTINDEX
] = new ScPatternAttr( pSet
, ScGlobal::GetRscString(STR_STYLENAME_STANDARD
) );
302 ppPoolDefaults
[ ATTR_PATTERN
- ATTR_STARTINDEX
] = new ScPatternAttr( pSet
,
303 String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(STRING_STANDARD
)) ); //! without name?
305 ppPoolDefaults
[ ATTR_LRSPACE
- ATTR_STARTINDEX
] = new SvxLRSpaceItem( ATTR_LRSPACE
);
306 ppPoolDefaults
[ ATTR_ULSPACE
- ATTR_STARTINDEX
] = new SvxULSpaceItem( ATTR_ULSPACE
);
307 ppPoolDefaults
[ ATTR_PAGE
- ATTR_STARTINDEX
] = new SvxPageItem( ATTR_PAGE
);
308 ppPoolDefaults
[ ATTR_PAGE_PAPERTRAY
- ATTR_STARTINDEX
] = new SfxAllEnumItem( ATTR_PAGE_PAPERTRAY
);
309 ppPoolDefaults
[ ATTR_PAGE_PAPERBIN
- ATTR_STARTINDEX
] = new SvxPaperBinItem( ATTR_PAGE_PAPERBIN
);
310 ppPoolDefaults
[ ATTR_PAGE_SIZE
- ATTR_STARTINDEX
] = new SvxSizeItem( ATTR_PAGE_SIZE
);
311 ppPoolDefaults
[ ATTR_PAGE_MAXSIZE
- ATTR_STARTINDEX
] = new SvxSizeItem( ATTR_PAGE_MAXSIZE
);
312 ppPoolDefaults
[ ATTR_PAGE_HORCENTER
- ATTR_STARTINDEX
] = new SfxBoolItem( ATTR_PAGE_HORCENTER
);
313 ppPoolDefaults
[ ATTR_PAGE_VERCENTER
- ATTR_STARTINDEX
] = new SfxBoolItem( ATTR_PAGE_VERCENTER
);
314 ppPoolDefaults
[ ATTR_PAGE_ON
- ATTR_STARTINDEX
] = new SfxBoolItem( ATTR_PAGE_ON
, TRUE
);
315 ppPoolDefaults
[ ATTR_PAGE_DYNAMIC
- ATTR_STARTINDEX
] = new SfxBoolItem( ATTR_PAGE_DYNAMIC
, TRUE
);
316 ppPoolDefaults
[ ATTR_PAGE_SHARED
- ATTR_STARTINDEX
] = new SfxBoolItem( ATTR_PAGE_SHARED
, TRUE
);
317 ppPoolDefaults
[ ATTR_PAGE_NOTES
- ATTR_STARTINDEX
] = new SfxBoolItem( ATTR_PAGE_NOTES
, FALSE
);
318 ppPoolDefaults
[ ATTR_PAGE_GRID
- ATTR_STARTINDEX
] = new SfxBoolItem( ATTR_PAGE_GRID
, FALSE
);
319 ppPoolDefaults
[ ATTR_PAGE_HEADERS
- ATTR_STARTINDEX
] = new SfxBoolItem( ATTR_PAGE_HEADERS
, FALSE
);
320 ppPoolDefaults
[ ATTR_PAGE_CHARTS
- ATTR_STARTINDEX
] = new ScViewObjectModeItem( ATTR_PAGE_CHARTS
);
321 ppPoolDefaults
[ ATTR_PAGE_OBJECTS
- ATTR_STARTINDEX
] = new ScViewObjectModeItem( ATTR_PAGE_OBJECTS
);
322 ppPoolDefaults
[ ATTR_PAGE_DRAWINGS
- ATTR_STARTINDEX
] = new ScViewObjectModeItem( ATTR_PAGE_DRAWINGS
);
323 ppPoolDefaults
[ ATTR_PAGE_TOPDOWN
- ATTR_STARTINDEX
] = new SfxBoolItem( ATTR_PAGE_TOPDOWN
, TRUE
);
324 ppPoolDefaults
[ ATTR_PAGE_SCALE
- ATTR_STARTINDEX
] = new SfxUInt16Item( ATTR_PAGE_SCALE
, 100 );
325 ppPoolDefaults
[ ATTR_PAGE_SCALETOPAGES
-ATTR_STARTINDEX
] = new SfxUInt16Item( ATTR_PAGE_SCALETOPAGES
, 1 );
326 ppPoolDefaults
[ ATTR_PAGE_FIRSTPAGENO
- ATTR_STARTINDEX
] = new SfxUInt16Item( ATTR_PAGE_FIRSTPAGENO
, 1 );
327 ppPoolDefaults
[ ATTR_PAGE_PRINTAREA
- ATTR_STARTINDEX
] = new ScRangeItem( ATTR_PAGE_PRINTAREA
);
328 ppPoolDefaults
[ ATTR_PAGE_REPEATROW
- ATTR_STARTINDEX
] = new ScRangeItem( ATTR_PAGE_REPEATROW
);
329 ppPoolDefaults
[ ATTR_PAGE_REPEATCOL
- ATTR_STARTINDEX
] = new ScRangeItem( ATTR_PAGE_REPEATCOL
);
330 ppPoolDefaults
[ ATTR_PAGE_PRINTTABLES
- ATTR_STARTINDEX
] = new ScTableListItem( ATTR_PAGE_PRINTTABLES
);
331 ppPoolDefaults
[ ATTR_PAGE_HEADERLEFT
- ATTR_STARTINDEX
] = new ScPageHFItem( ATTR_PAGE_HEADERLEFT
);
332 ppPoolDefaults
[ ATTR_PAGE_FOOTERLEFT
- ATTR_STARTINDEX
] = new ScPageHFItem( ATTR_PAGE_FOOTERLEFT
);
333 ppPoolDefaults
[ ATTR_PAGE_HEADERRIGHT
- ATTR_STARTINDEX
] = new ScPageHFItem( ATTR_PAGE_HEADERRIGHT
);
334 ppPoolDefaults
[ ATTR_PAGE_FOOTERRIGHT
- ATTR_STARTINDEX
] = new ScPageHFItem( ATTR_PAGE_FOOTERRIGHT
);
335 ppPoolDefaults
[ ATTR_PAGE_HEADERSET
- ATTR_STARTINDEX
] = new SvxSetItem( ATTR_PAGE_HEADERSET
, aSetItemItemSet
);
336 ppPoolDefaults
[ ATTR_PAGE_FOOTERSET
- ATTR_STARTINDEX
] = new SvxSetItem( ATTR_PAGE_FOOTERSET
, aSetItemItemSet
);
337 ppPoolDefaults
[ ATTR_PAGE_FORMULAS
- ATTR_STARTINDEX
] = new SfxBoolItem( ATTR_PAGE_FORMULAS
, FALSE
);
338 ppPoolDefaults
[ ATTR_PAGE_NULLVALS
- ATTR_STARTINDEX
] = new SfxBoolItem( ATTR_PAGE_NULLVALS
, TRUE
);
339 ppPoolDefaults
[ ATTR_PAGE_SCALETO
- ATTR_STARTINDEX
] = new ScPageScaleToItem( 1, 1 );
340 // ppPoolDefaults[ ATTR_ITEM_DOUBLE - ATTR_STARTINDEX ] = new ScDoubleItem( ATTR_ITEM_DOUBLE, 0 );
342 SetDefaults( ppPoolDefaults
);
345 SetSecondaryPool( pSecondary
);
347 // ATTR_LANGUAGE_FORMAT ab sv329 eingefuegt, VersionMap in _ScGlobal__Init
348 SetVersionMap( 1, 100, 157, pVersionMap1
);
350 // ATTR_VALIDDATA, ATTR_CONDITIONAL ab 341
351 SetVersionMap( 2, 100, 158, pVersionMap2
);
353 // ATTR_INDENT ab 350
354 SetVersionMap( 3, 100, 160, pVersionMap3
);
356 // ATTR_ROTATE_VALUE, ATTR_ROTATE_MODE ab 367
357 SetVersionMap( 4, 100, 161, pVersionMap4
);
359 // CJK, CTL, EMPHASISMARK, TWOLINES from 614
360 SetVersionMap( 5, 100, 163, pVersionMap5
);
362 // ATTR_SCRIPTSPACE, ATTR_HANGPUNCTUATION, ATTR_FORBIDDEN_RULES from 614d
363 SetVersionMap( 6, 100, 175, pVersionMap6
);
365 // ATTR_FONT_WORDLINE, ATTR_FONT_RELIEF, ATTR_HYPHENATE from 632b
366 SetVersionMap( 7, 100, 178, pVersionMap7
);
368 // ATTR_VERTICAL_ASIAN from 642q
369 SetVersionMap( 8, 100, 181, pVersionMap8
);
371 // ATTR_WRITINGDIR from 643y
372 SetVersionMap( 9, 100, 182, pVersionMap9
);
374 // ATTR_PAGE_SCALETO added in 680/sab008
375 // new version map not required
377 // ATTR_SHRINKTOFIT, ATTR_BORDER_TL_BR, ATTR_BORDER_BL_TR added in 680/dr14
378 SetVersionMap( 10, 100, 184, pVersionMap10
);
380 // ATTR_FONT_OVERLINE added in DEV300/overline2
381 SetVersionMap( 11, 100, 187, pVersionMap11
);
384 __EXPORT
ScDocumentPool::~ScDocumentPool()
388 for ( USHORT i
=0; i
< ATTR_ENDINDEX
-ATTR_STARTINDEX
+1; i
++ )
390 SetRefCount( *ppPoolDefaults
[i
], 0 );
391 delete ppPoolDefaults
[i
];
394 delete[] ppPoolDefaults
;
395 SfxItemPool::Free(pSecondary
);
398 void ScDocumentPool::InitVersionMaps()
400 DBG_ASSERT( !pVersionMap1
&& !pVersionMap2
&&
401 !pVersionMap3
&& !pVersionMap4
&&
402 !pVersionMap5
&& !pVersionMap6
&&
403 !pVersionMap7
&& !pVersionMap8
&&
404 !pVersionMap9
&& !pVersionMap10
&&
405 !pVersionMap11
, "InitVersionMaps call multiple times" );
407 // alte WhichId's mappen
408 // nicht mit ATTR_* zaehlen, falls die sich nochmal aendern
410 // erste Map: ATTR_LANGUAGE_FORMAT ab sv329 eingefuegt
412 const USHORT nMap1Start
= 100; // alter ATTR_STARTINDEX
413 const USHORT nMap1End
= 157; // alter ATTR_ENDINDEX
414 const USHORT nMap1Count
= nMap1End
- nMap1Start
+ 1;
415 const USHORT nMap1New
= 18; // ATTR_LANGUAGE_FORMAT - ATTR_STARTINDEX
416 pVersionMap1
= new USHORT
[ nMap1Count
];
418 for ( i
=0, j
=nMap1Start
; i
< nMap1New
; i
++, j
++ )
420 // ein Eintrag eingefuegt...
421 for ( i
=nMap1New
, j
=nMap1Start
+nMap1New
+1; i
< nMap1Count
; i
++, j
++ )
424 // zweite Map: ATTR_VALIDDATA und ATTR_CONDITIONAL ab 341 eingefuegt
426 const USHORT nMap2Start
= 100; // ATTR_STARTINDEX
427 const USHORT nMap2End
= 158; // ATTR_ENDINDEX
428 const USHORT nMap2Count
= nMap2End
- nMap2Start
+ 1;
429 const USHORT nMap2New
= 24; // ATTR_VALIDDATA - ATTR_STARTINDEX
430 pVersionMap2
= new USHORT
[ nMap2Count
];
431 for ( i
=0, j
=nMap2Start
; i
< nMap2New
; i
++, j
++ )
433 // zwei Eintraege eingefuegt...
434 for ( i
=nMap2New
, j
=nMap2Start
+nMap2New
+2; i
< nMap2Count
; i
++, j
++ )
437 // dritte Map: ATTR_INDENT ab 350 eingefuegt
439 const USHORT nMap3Start
= 100; // ATTR_STARTINDEX
440 const USHORT nMap3End
= 160; // ATTR_ENDINDEX
441 const USHORT nMap3Count
= nMap3End
- nMap3Start
+ 1;
442 const USHORT nMap3New
= 11; // ATTR_INDENT - ATTR_STARTINDEX
443 pVersionMap3
= new USHORT
[ nMap3Count
];
444 for ( i
=0, j
=nMap3Start
; i
< nMap3New
; i
++, j
++ )
446 // ein Eintrag eingefuegt...
447 for ( i
=nMap3New
, j
=nMap3Start
+nMap3New
+1; i
< nMap3Count
; i
++, j
++ )
450 // vierte Map: ATTR_ROTATE_VALUE und ATTR_ROTATE_MODE ab 367 eingefuegt
452 const USHORT nMap4Start
= 100; // ATTR_STARTINDEX
453 const USHORT nMap4End
= 161; // ATTR_ENDINDEX
454 const USHORT nMap4Count
= nMap4End
- nMap4Start
+ 1;
455 const USHORT nMap4New
= 14; // ATTR_ROTATE_VALUE - ATTR_STARTINDEX
456 pVersionMap4
= new USHORT
[ nMap4Count
];
457 for ( i
=0, j
=nMap4Start
; i
< nMap4New
; i
++, j
++ )
459 // zwei Eintraege eingefuegt...
460 for ( i
=nMap4New
, j
=nMap4Start
+nMap4New
+2; i
< nMap4Count
; i
++, j
++ )
463 // fifth map: CJK..., CTL..., EMPHASISMARK, TWOLINES (12 items) added in 614
465 const USHORT nMap5Start
= 100; // ATTR_STARTINDEX
466 const USHORT nMap5End
= 163; // ATTR_ENDINDEX
467 const USHORT nMap5Count
= nMap5End
- nMap5Start
+ 1;
468 const USHORT nMap5New
= 10; // ATTR_CJK_FONT - ATTR_STARTINDEX
469 pVersionMap5
= new USHORT
[ nMap5Count
];
470 for ( i
=0, j
=nMap5Start
; i
< nMap5New
; i
++, j
++ )
472 // 12 entries inserted
473 for ( i
=nMap5New
, j
=nMap5Start
+nMap5New
+12; i
< nMap5Count
; i
++, j
++ )
476 // sixth map: ATTR_SCRIPTSPACE, ATTR_HANGPUNCTUATION, ATTR_FORBIDDEN_RULES added in 614d
478 const USHORT nMap6Start
= 100; // ATTR_STARTINDEX
479 const USHORT nMap6End
= 175; // ATTR_ENDINDEX
480 const USHORT nMap6Count
= nMap6End
- nMap6Start
+ 1;
481 const USHORT nMap6New
= 22; // ATTR_SCRIPTSPACE - ATTR_STARTINDEX
482 pVersionMap6
= new USHORT
[ nMap6Count
];
483 for ( i
=0, j
=nMap6Start
; i
< nMap6New
; i
++, j
++ )
485 // 3 entries inserted
486 for ( i
=nMap6New
, j
=nMap6Start
+nMap6New
+3; i
< nMap6Count
; i
++, j
++ )
489 // seventh map: ATTR_FONT_WORDLINE, ATTR_FONT_RELIEF, ATTR_HYPHENATE added in 632b
491 const USHORT nMap7Start
= 100; // ATTR_STARTINDEX
492 const USHORT nMap7End
= 178; // ATTR_ENDINDEX
493 const USHORT nMap7Count
= nMap7End
- nMap7Start
+ 1;
494 const USHORT nMap7New
= 22; // ATTR_FONT_WORDLINE - ATTR_STARTINDEX
495 pVersionMap7
= new USHORT
[ nMap7Count
];
496 for ( i
=0, j
=nMap7Start
; i
< nMap7New
; i
++, j
++ )
498 // 3 entries inserted
499 for ( i
=nMap7New
, j
=nMap7Start
+nMap7New
+3; i
< nMap7Count
; i
++, j
++ )
502 // eighth map: ATTR_VERTICAL_ASIAN added in 642q
504 const USHORT nMap8Start
= 100; // ATTR_STARTINDEX
505 const USHORT nMap8End
= 181; // ATTR_ENDINDEX
506 const USHORT nMap8Count
= nMap8End
- nMap8Start
+ 1;
507 const USHORT nMap8New
= 34; // ATTR_VERTICAL_ASIAN - ATTR_STARTINDEX
508 pVersionMap8
= new USHORT
[ nMap8Count
];
509 for ( i
=0, j
=nMap8Start
; i
< nMap8New
; i
++, j
++ )
512 for ( i
=nMap8New
, j
=nMap8Start
+nMap8New
+1; i
< nMap8Count
; i
++, j
++ )
515 // 9th map: ATTR_WRITINGDIR added in 643y
517 const USHORT nMap9Start
= 100; // ATTR_STARTINDEX
518 const USHORT nMap9End
= 182; // ATTR_ENDINDEX
519 const USHORT nMap9Count
= nMap9End
- nMap9Start
+ 1;
520 const USHORT nMap9New
= 35; // ATTR_WRITINGDIR - ATTR_STARTINDEX
521 pVersionMap9
= new USHORT
[ nMap9Count
];
522 for ( i
=0, j
=nMap9Start
; i
< nMap9New
; i
++, j
++ )
525 for ( i
=nMap9New
, j
=nMap9Start
+nMap9New
+1; i
< nMap9Count
; i
++, j
++ )
528 // ATTR_PAGE_SCALETO added in 680/sab008
530 // 10th map: ATTR_SHRINKTOFIT, ATTR_BORDER_TL_BR, ATTR_BORDER_BL_TR added in 680/dr14
532 const USHORT nMap10Start
= 100; // ATTR_STARTINDEX
533 const USHORT nMap10End
= 184; // ATTR_ENDINDEX
534 const USHORT nMap10Count
= nMap10End
- nMap10Start
+ 1;
535 const USHORT nMap10New
= 37; // ATTR_SHRINKTOFIT - ATTR_STARTINDEX
536 pVersionMap10
= new USHORT
[ nMap10Count
];
537 for ( i
=0, j
=nMap10Start
; i
< nMap10New
; i
++, j
++ )
538 pVersionMap10
[i
] = j
;
539 // 3 entries inserted
540 for ( i
=nMap10New
, j
=nMap10Start
+nMap10New
+3; i
< nMap10Count
; i
++, j
++ )
541 pVersionMap10
[i
] = j
;
543 // 11th map: ATTR_FONT_OVERLINE added in DEV300/overline2
545 const USHORT nMap11Start
= 100; // ATTR_STARTINDEX
546 const USHORT nMap11End
= 187; // ATTR_ENDINDEX
547 const USHORT nMap11Count
= nMap11End
- nMap11Start
+ 1;
548 const USHORT nMap11New
= 5; // ATTR_FONT_OVERLINE - ATTR_STARTINDEX
549 pVersionMap11
= new USHORT
[ nMap11Count
];
550 for ( i
=0, j
=nMap11Start
; i
< nMap11New
; i
++, j
++ )
551 pVersionMap11
[i
] = j
;
553 for ( i
=nMap11New
, j
=nMap11Start
+nMap11New
+1; i
< nMap11Count
; i
++, j
++ )
554 pVersionMap11
[i
] = j
;
557 void ScDocumentPool::DeleteVersionMaps()
559 DBG_ASSERT( pVersionMap1
&& pVersionMap2
&&
560 pVersionMap3
&& pVersionMap4
&&
561 pVersionMap5
&& pVersionMap6
&&
562 pVersionMap7
&& pVersionMap8
&&
563 pVersionMap9
&& pVersionMap10
&&
564 pVersionMap11
, "DeleteVersionMaps without maps" );
566 delete[] pVersionMap11
;
568 delete[] pVersionMap10
;
570 delete[] pVersionMap9
;
572 delete[] pVersionMap8
;
574 delete[] pVersionMap7
;
576 delete[] pVersionMap6
;
578 delete[] pVersionMap5
;
580 delete[] pVersionMap4
;
582 delete[] pVersionMap3
;
584 delete[] pVersionMap2
;
586 delete[] pVersionMap1
;
590 // ----------------------------------------------------------------------------------------
592 // Fuer die Pattern-Attribute (SetItems) kann der USHORT RefCount leicht ueberlaufen
593 // (z.B. 600 ganze Zeilen abwechselnd formatieren).
594 // Darum wird der RefCount bei SC_MAX_POOLREF festgehalten und nicht mehr hoch- oder
595 // heruntergezaehlt. Dieser RefCount wird dann erst beim naechsten Laden neu gezaehlt.
596 // Die Differenz zwischen SC_MAX_POOLREF und SC_SAFE_POOLREF ist ein wenig groesser
597 // als noetig, um zu erkennen, wenn der RefCount aus Versehen doch "normal" veraendert
598 // wird (Assertions).
601 const SfxPoolItem
& __EXPORT
ScDocumentPool::Put( const SfxPoolItem
& rItem
, USHORT nWhich
)
603 if ( rItem
.Which() != ATTR_PATTERN
) // nur Pattern ist special
604 return SfxItemPool::Put( rItem
, nWhich
);
606 // das Default-Pattern dieses Pools nicht kopieren
607 if (&rItem
== ppPoolDefaults
[ ATTR_PATTERN
- ATTR_STARTINDEX
])
610 // ansonsten muss Put immer passieren, weil es ein anderer Pool sein kann
611 const SfxPoolItem
& rNew
= SfxItemPool::Put( rItem
, nWhich
);
616 void __EXPORT
ScDocumentPool::Remove( const SfxPoolItem
& rItem
)
618 if ( rItem
.Which() == ATTR_PATTERN
) // nur Pattern ist special
620 ULONG nRef
= rItem
.GetRefCount();
621 if ( nRef
>= (ULONG
) SC_MAX_POOLREF
&& nRef
<= (ULONG
) SFX_ITEMS_OLD_MAXREF
)
623 if ( nRef
!= (ULONG
) SC_SAFE_POOLREF
)
625 DBG_ERROR("Wer fummelt da an meinen Ref-Counts herum");
626 SetRefCount( (SfxPoolItem
&)rItem
, (ULONG
) SC_SAFE_POOLREF
);
628 return; // nicht herunterzaehlen
631 SfxItemPool::Remove( rItem
);
634 void ScDocumentPool::CheckRef( const SfxPoolItem
& rItem
) // static
636 ULONG nRef
= rItem
.GetRefCount();
637 if ( nRef
>= (ULONG
) SC_MAX_POOLREF
&& nRef
<= (ULONG
) SFX_ITEMS_OLD_MAXREF
)
639 // beim Apply vom Cache wird evtl. um 2 hochgezaehlt (auf MAX+1 oder SAFE+2),
640 // heruntergezaehlt wird nur einzeln (in LoadCompleted)
641 DBG_ASSERT( nRef
<=(ULONG
)SC_MAX_POOLREF
+1 || (nRef
>=(ULONG
)SC_SAFE_POOLREF
-1 && nRef
<=(ULONG
)SC_SAFE_POOLREF
+2),
642 "ScDocumentPool::CheckRef" );
643 SetRefCount( (SfxPoolItem
&)rItem
, (ULONG
) SC_SAFE_POOLREF
);
647 // ----------------------------------------------------------------------------------------
649 void ScDocumentPool::StyleDeleted( ScStyleSheet
* pStyle
)
651 USHORT nCount
= GetItemCount(ATTR_PATTERN
);
652 for (USHORT i
=0; i
<nCount
; i
++)
654 ScPatternAttr
* pPattern
= (ScPatternAttr
*)GetItem(ATTR_PATTERN
, i
);
655 if ( pPattern
&& pPattern
->GetStyleSheet() == pStyle
)
656 pPattern
->StyleToName();
660 SfxItemPool
* __EXPORT
ScDocumentPool::Clone() const
662 return new SfxItemPool (*this, TRUE
);
665 SfxItemPresentation lcl_HFPresentation
667 const SfxPoolItem
& rItem
,
668 SfxItemPresentation ePresentation
,
669 SfxMapUnit eCoreMetric
,
670 SfxMapUnit ePresentationMetric
,
672 const IntlWrapper
* pIntl
675 const SfxItemSet
& rSet
= ((const SfxSetItem
&)rItem
).GetItemSet();
676 const SfxPoolItem
* pItem
;
678 if ( SFX_ITEM_SET
== rSet
.GetItemState(ATTR_PAGE_ON
,FALSE
,&pItem
) )
680 if( FALSE
== ((const SfxBoolItem
*)pItem
)->GetValue() )
681 return SFX_ITEM_PRESENTATION_NONE
;
684 SfxItemIter
aIter( rSet
);
685 pItem
= aIter
.FirstItem();
687 String aDel
= String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM( " + " ));
691 USHORT nWhich
= pItem
->Which();
698 case ATTR_PAGE_DYNAMIC
:
699 case ATTR_PAGE_SHARED
:
704 SvxLRSpaceItem
& rLRItem
= (SvxLRSpaceItem
&)*pItem
;
705 USHORT nPropLeftMargin
= rLRItem
.GetPropLeft();
706 USHORT nPropRightMargin
= rLRItem
.GetPropRight();
707 USHORT nLeftMargin
, nRightMargin
;
709 nTmp
= rLRItem
.GetLeft();
710 nLeftMargin
= nTmp
< 0 ? 0 : USHORT(nTmp
);
711 nTmp
= rLRItem
.GetRight();
712 nRightMargin
= nTmp
< 0 ? 0 : USHORT(nTmp
);
714 aText
= SVX_RESSTR(RID_SVXITEMS_LRSPACE_LEFT
);
715 if ( 100 != nPropLeftMargin
)
717 aText
+= String::CreateFromInt32( nPropLeftMargin
);
722 aText
+= GetMetricText( (long)nLeftMargin
,
723 eCoreMetric
, ePresentationMetric
, pIntl
);
724 aText
+= SVX_RESSTR(GetMetricId(ePresentationMetric
));
728 // nPropFirstLineOfst haben wir nicht
730 aText
+= SVX_RESSTR(RID_SVXITEMS_LRSPACE_RIGHT
);
731 if ( 100 != nPropRightMargin
)
733 aText
+= String::CreateFromInt32( nPropRightMargin
);
738 aText
+= GetMetricText( (long)nRightMargin
,
739 eCoreMetric
, ePresentationMetric
, pIntl
);
740 aText
+= SVX_RESSTR(GetMetricId(ePresentationMetric
));
747 pIntl
= ScGlobal::GetScIntlWrapper();
748 pItem
->GetPresentation( ePresentation
, eCoreMetric
, ePresentationMetric
, aText
, pIntl
);
758 pItem
= aIter
.NextItem();
761 rText
.EraseTrailingChars();
762 rText
.EraseTrailingChars( '+' );
763 rText
.EraseTrailingChars();
765 return ePresentation
;
768 SfxItemPresentation __EXPORT
ScDocumentPool::GetPresentation(
769 const SfxPoolItem
& rItem
,
770 SfxItemPresentation ePresentation
,
771 SfxMapUnit ePresentationMetric
,
773 const IntlWrapper
* pIntl
) const
775 USHORT nW
= rItem
.Which();
776 String
aStrYes ( ScGlobal::GetRscString(STR_YES
) );
777 String
aStrNo ( ScGlobal::GetRscString(STR_NO
) );
778 String aStrSep
= String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(": "));
782 case ATTR_PAGE_TOPDOWN
:
783 switch ( ePresentation
)
785 case SFX_ITEM_PRESENTATION_COMPLETE
:
786 rText
= ScGlobal::GetRscString(STR_SCATTR_PAGE_PRINTDIR
);
788 // break; // DURCHFALLEN!!!
789 case SFX_ITEM_PRESENTATION_NAMELESS
:
790 rText
+= ((const SfxBoolItem
&)rItem
).GetValue() ?
791 ScGlobal::GetRscString(STR_SCATTR_PAGE_TOPDOWN
) :
792 ScGlobal::GetRscString(STR_SCATTR_PAGE_LEFTRIGHT
) ;
796 // added to avoid warnings
801 case ATTR_PAGE_HEADERS
:
802 switch ( ePresentation
)
804 case SFX_ITEM_PRESENTATION_COMPLETE
:
805 rText
= ScGlobal::GetRscString(STR_SCATTR_PAGE_HEADERS
);
807 // break; // DURCHFALLEN!!!
808 case SFX_ITEM_PRESENTATION_NAMELESS
:
809 rText
+= ((const SfxBoolItem
&)rItem
).GetValue() ? aStrYes
: aStrNo
;
813 // added to avoid warnings
818 case ATTR_PAGE_NULLVALS
:
819 switch ( ePresentation
)
821 case SFX_ITEM_PRESENTATION_COMPLETE
:
822 rText
= ScGlobal::GetRscString(STR_SCATTR_PAGE_NULLVALS
);
824 // break; // DURCHFALLEN!!!
825 case SFX_ITEM_PRESENTATION_NAMELESS
:
826 rText
+= ((const SfxBoolItem
&)rItem
).GetValue() ? aStrYes
: aStrNo
;
830 // added to avoid warnings
835 case ATTR_PAGE_FORMULAS
:
836 switch ( ePresentation
)
838 case SFX_ITEM_PRESENTATION_COMPLETE
:
839 rText
= ScGlobal::GetRscString(STR_SCATTR_PAGE_FORMULAS
);
841 // break; // DURCHFALLEN!!!
842 case SFX_ITEM_PRESENTATION_NAMELESS
:
843 rText
+= ((const SfxBoolItem
&)rItem
).GetValue() ? aStrYes
: aStrNo
;
847 // added to avoid warnings
852 case ATTR_PAGE_NOTES
:
853 switch ( ePresentation
)
855 case SFX_ITEM_PRESENTATION_COMPLETE
:
856 rText
= ScGlobal::GetRscString(STR_SCATTR_PAGE_NOTES
);
858 // break; // DURCHFALLEN!!!
859 case SFX_ITEM_PRESENTATION_NAMELESS
:
860 rText
+= ((const SfxBoolItem
&)rItem
).GetValue() ? aStrYes
: aStrNo
;
864 // added to avoid warnings
870 switch ( ePresentation
)
872 case SFX_ITEM_PRESENTATION_COMPLETE
:
873 rText
= ScGlobal::GetRscString(STR_SCATTR_PAGE_GRID
);
875 // break; // DURCHFALLEN!!!
876 case SFX_ITEM_PRESENTATION_NAMELESS
:
877 rText
+= ((const SfxBoolItem
&)rItem
).GetValue() ? aStrYes
: aStrNo
;
881 // added to avoid warnings
886 case ATTR_PAGE_SCALETOPAGES
:
888 USHORT nPagNo
= ((const SfxUInt16Item
&)rItem
).GetValue();
892 switch ( ePresentation
)
894 case SFX_ITEM_PRESENTATION_COMPLETE
:
896 rText
.Assign( ScGlobal::GetRscString( STR_SCATTR_PAGE_SCALETOPAGES
) ).Append( aStrSep
);
898 // break; // DURCHFALLEN!!!
899 case SFX_ITEM_PRESENTATION_NAMELESS
:
901 String
aPages( ScGlobal::GetRscString( STR_SCATTR_PAGE_SCALE_PAGES
) );
902 aPages
.SearchAndReplaceAscii( "%1", String::CreateFromInt32( nPagNo
) );
903 rText
.Append( aPages
);
908 // added to avoid warnings
914 ePresentation
= SFX_ITEM_PRESENTATION_NONE
;
919 case ATTR_PAGE_FIRSTPAGENO
:
921 USHORT nPagNo
= ((const SfxUInt16Item
&)rItem
).GetValue();
925 switch ( ePresentation
)
927 case SFX_ITEM_PRESENTATION_COMPLETE
:
928 rText
= ScGlobal::GetRscString(STR_SCATTR_PAGE_FIRSTPAGENO
);
930 // break; // DURCHFALLEN!!!
931 case SFX_ITEM_PRESENTATION_NAMELESS
:
932 rText
+= String::CreateFromInt32( nPagNo
);
936 // added to avoid warnings
942 ePresentation
= SFX_ITEM_PRESENTATION_NONE
;
947 case ATTR_PAGE_SCALE
:
949 USHORT nPercent
= ((const SfxUInt16Item
&)rItem
).GetValue();
953 switch ( ePresentation
)
955 case SFX_ITEM_PRESENTATION_COMPLETE
:
956 rText
= ScGlobal::GetRscString(STR_SCATTR_PAGE_SCALE
);
958 // break; // DURCHFALLEN!!!
959 case SFX_ITEM_PRESENTATION_NAMELESS
:
960 rText
+= String::CreateFromInt32( nPercent
);
965 // added to avoid warnings
971 ePresentation
= SFX_ITEM_PRESENTATION_NONE
;
976 case ATTR_PAGE_HEADERSET
:
980 if( lcl_HFPresentation( rItem
, ePresentation
, GetMetric( nW
), ePresentationMetric
, aBuffer
, pIntl
) != SFX_ITEM_PRESENTATION_NONE
)
982 rText
= ScGlobal::GetRscString(STR_HEADER
);
983 rText
.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " ( " ));
985 rText
.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " ) " ));
990 case ATTR_PAGE_FOOTERSET
:
994 if( lcl_HFPresentation( rItem
, ePresentation
, GetMetric( nW
), ePresentationMetric
, aBuffer
, pIntl
) != SFX_ITEM_PRESENTATION_NONE
)
996 rText
= ScGlobal::GetRscString(STR_FOOTER
);
997 rText
.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " ( " ));
999 rText
.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " ) " ));
1005 case ATTR_PAGE_HEADERLEFT:
1006 rText = "SID_SCATTR_PAGE_HEADERLEFT";
1009 case ATTR_PAGE_FOOTERLEFT:
1010 rText = "SID_SCATTR_PAGE_FOOTERLEFT";
1013 case ATTR_PAGE_HEADERRIGHT:
1014 rText = "SID_SCATTR_PAGE_HEADERRIGHT";
1017 case ATTR_PAGE_FOOTERRIGHT:
1018 rText = "SID_SCATTR_PAGE_FOOTERRIGHT";
1024 pIntl
= ScGlobal::GetScIntlWrapper();
1025 ePresentation
= rItem
.GetPresentation( ePresentation
, GetMetric( nW
), ePresentationMetric
, rText
, pIntl
);
1029 return ePresentation
;
1032 SfxMapUnit __EXPORT
ScDocumentPool::GetMetric( USHORT nWhich
) const
1034 // eigene Attribute: Twips, alles andere 1/100 mm
1036 if ( nWhich
>= ATTR_STARTINDEX
&& nWhich
<= ATTR_ENDINDEX
)
1037 return SFX_MAPUNIT_TWIP
;
1039 return SFX_MAPUNIT_100TH_MM
;